(function() {
Vue.component('dept-source', {
template: '
',
props: ["info"],
data: function() {
return {
hospitalData: [],
deptData: [],
subDeptData: [],
planDate: [],
currentHospitalId:"",
nowDate:new Date().format("YYYY-MM-dd"),
pageIndex:1,
pageSize:10
}
},
mounted: function() {
var vm = this;
setTimeout(function(){
vm.currentHospitalId = JSON.parse(vm.info).hospitalId;
vm.getHospitalList();
vm.getDeptList();
vm.getVisitDate();
vm.bindEvents();
},50);
},
methods: {
bindEvents:function(){
//查看更多
$(".more-list").click(function() {
var parent = $(this).parents(".select-condition-list-item");
parent.toggleClass('select-condition-list-item-active');
if(parent.hasClass("select-condition-list-item-active")) {
$(this).text("收起")
} else {
$(this).text("更多")
}
})
},
//获取医院列表
getHospitalList: function() {
var vm = this;
var params = {
pageIndex: 1,
pageSize: 99,
provinceCode: 360000,
cityCode: 361100
}
appointmentAPI.querySimpleHospitalList(params).then(function(res) {
if(res.successFlg && res.obj.Code == "10000") {
vm.hospitalData = res.obj.Result;
}
})
},
//获取科室列表
getDeptList: function() {
var vm = this;
var params = {
pageIndex: 1,
pageSize: 99,
hospitalId: vm.currentHospitalId
}
appointmentAPI.querySimpleHosDeptList(params).then(function(res) {
if(res.successFlg && res.obj.Code == "10000") {
vm.deptData = res.obj.Result;
}
})
},
//默认只有7天的号源
getVisitDate: function() {
var vm = this;
var now = new Date(),d = new Date();
for(i = 1; i < 8; i++) {
var nDate = now.getDate();
d.setDate(nDate + i);
var obj = {
date: d.format("MM月dd日"),
date1: d.format("YYYY-MM-dd"),
day: this.getWeekDay(d.getDay())
}
this.planDate.push(obj);
}
},
getWeekDay: function(val) {
switch(val) {
case 0:
return "周日";
break;
case 1:
return "周一";
break;
case 2:
return "周二";
break;
case 3:
return "周三";
break;
case 4:
return "周四";
break;
case 5:
return "周五";
break;
case 6:
return "周六";
break;
}
}
}
});
function getDeptList(vm) {
}
})()