var template = '' $.ajax('../html/zbfzDetail.html',{ data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function(res) { }, success: function(res) { template = res } }) Vue.component('zbfz-detail', { props: [], template: template, data: function() { return { form: { patientName: '', doctorName: '' }, mzfWorksheetData:[], list:[], startTime:new Date('2023','05','26'), endTime:new Date(), regionList:[], regionData:[ {label:'全市',id:'1',type:'1'} ], regionListList:[], tertiaryHospitalsData:[ {label:'全部',id:'1',type:'2'} ], communityHospitalsList:[], communityHospitalsData:[ {label:'全部',id:'1',type:'3'} ], groupingList:[], groupingData:[ {label:'全部',id:'1',type:'4'} ], administrationStatusList:[], administrationStatusData:[ {label:'全部',id:'1',type:'5'} ], show:false, showTwo:false, showThree:false, currentPage:1, currentSize:10, datatotal:0, //总数 loadingTwo:false, setDisabled:{ disabledDate:function(time) { return time.getTime() > Date.now() } }, s:'', e:'', } }, created: function(){ var setDate = (new Date()).getTime(); var one = 30 * 24 * 3600 * 1000; //一个月 var oneMonths = setDate - one; this.startTime = new Date(oneMonths) this.s = this.startTime.format('yyyy-MM-dd') this.e = this.endTime.format('yyyy-MM-dd') this.list.unshift({type:'0',id:'time',label:this.s +"~"+ this.e}) this.hospitalWorkStatistics() }, watch:{ 'startTime':{ handler:function(o) { if(!o) { this.list.splice(0,1) } }, deep: true, immediate: true }, 'endTime':{ handler:function(o) { if(!o) { this.list.splice(0,1) } }, deep: true, immediate: true }, }, methods: { // 查询列表数据 hospitalWorkStatistics:function(page) { var vm = this vm.loadingTwo = true statisticAPI.getXxzxMedicalHistoryList({ startDate:this.startTime.format('yyyy-MM-dd'), endDate:this.endTime.format('yyyy-MM-dd'), name: vm.form.patientName, doctorName: vm.form.doctorName, page: page, pageSize: '10' }).then(function(res){ if(res.status == 200) { vm.loadingTwo = false vm.mzfWorksheetData = res.detailModelList vm.datatotal = res.totalCount } }).catch(function(err){ vm.loadingTwo = false }) }, startTimeChange:function(o) { console.log(o) if(!this.list[0] || this.list[0].type!=0) { this.list.unshift({type:'0',id:'time',label:o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')}) }else{ this.list[0].label = o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd') } }, endTimeChange:function(o) { if(!this.list[0] || this.list[0].type!=0) { this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')}) }else{ this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd') } }, deleteClick:function(item) { if(item.id == "time") { this.startTime = '' this.endTime = '' this.list.splice(0,1) } var index = this.list.findIndex(function(v){ return item.id == v.id }) this.list.splice(index,1) }, // 下一页 上一页 handleCurrentChange:function(val) { var vm = this vm.currentPage = val this.hospitalWorkStatistics(val) }, change:function(val) { this.list = this.list.concat(val) }, // 确定 confirm:function() { this.hospitalWorkStatistics() }, // 清除 eliminateClick:function() { this.form.patientName = '' this.form.doctorName = '' }, // 导出 exportHandle:function() { var vm = this vm.loadingTwo = true statisticAPI.exportXxzxMedicalHistoryList({ startDate:this.startTime.format('yyyy-MM-dd'), endDate:this.endTime.format('yyyy-MM-dd'), name: vm.form.patientName, doctorName: vm.form.doctorName, },'专病复诊明细表.xls').then(function(res){ vm.loadingTwo = false }) }, } })