123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- (function() {
- Vue.component('dept-source', {
- template: '<div class="select-hospital">\
- <ul class="select-condition-list" @click="itemClick">\
- <li class="select-condition-list-item" data-type="hostipal">\
- <div class="condition-name">医院</div>\
- <div class="condition-list">\
- <span>全部</span>\
- <span :class="{\'active\': hos.hospitalId==currentHospitalId}" v-for="hos in hospitalData" v-bind:data-val="hos.hospitalId">{{hos.hosName}}</span>\
- </div>\
- <div class="more-list">更多</div>\
- </li>\
- <li class="select-condition-list-item" data-type="visitdept">\
- <div class="condition-name">就诊科室</div>\
- <div class="condition-list">\
- <span class="active">全部</span>\
- <span v-for="dept in deptData" v-bind:data-val="dept.hosDeptId">{{dept.deptName}}</span>\
- </div>\
- <div class="more-list">更多</div>\
- </li>\
- <li class="select-condition-list-item" data-type="visitdate">\
- <div class="condition-name">就诊日期</div>\
- <div class="condition-list">\
- <span class="active">全部</span>\
- <span data-val="{{nowDate}}">今天</span>\
- <span v-for="d in planDate" v-bind:data-val="d.date1">{{d.day}}({{d.date}})</span>\
- </div>\
- <div class="more-list">更多</div>\
- </li>\
- </ul>\
- </div>',
- 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: {
- itemClick:function(){
- var vm = this;
- var hosDeptId = "";
- var curType = $(event.target).closest("li").attr("data-type");
- var activeItemId = $(event.target).attr("data-val");
- $(event.target).closest("li").find("span").removeClass("active");
- $(event.target).addClass("active");
- if(curType=="hostipal") {//医院
- vm.currentHospitalId = activeItemId;
- hosDeptId = ""
- vm.getDeptList();
- }else if(curType=="visitdept"){//就诊科室
- vm.currentHospitalId = $(".select-condition-list li[data-type=hostipal]").find("span.active").attr("data-val");
- hosDeptId = activeItemId;
- }else if(curType=="subdept"){//子科室
-
- }else if(curType=="visitdate"){//就诊日期
-
- }
- EventBus.$emit('update-doctor-list',{hospitalId:vm.currentHospitalId,hosDeptId:hosDeptId});
- },
- 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;
- // vm.deptData = _.filter(vm.deptData,function(item){
- // return
- // })
- }
- })
- },
- //默认只有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;
- }
- }
- }
- });
- })()
- //<li class="select-condition-list-item">\
- // <div class="condition-name">医生类型</div>\
- // <div class="condition-list">\
- // <span>全部</span>\
- // <span>主任医师</span>\
- // <span>其他</span>\
- // </div>\
- // <div class="more-list">更多</div>\
- //</li>\
- //<li class="select-condition-list-item" data-type="subdept">\
- // <div class="condition-name">子科室</div>\
- // <div class="condition-list">\
- // <span class="active">全部</span>\
- // </div>\
- // <div class="more-list">更多</div>\
- //</li>\
|