var template = '' $.ajax('../html/mzfHxsj.html',{ data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function(res) { }, success: function(res) { template = res } }) Vue.component('mzf-hxsj', { props: [], template: template, data: function() { return { tableData:[], testArr1: [], testArr2: [], testPosition1: 0, testPosition2: 0, list:[], startTime:new Date('2023','05','26'), endTime:new Date(), regionData:[ {label:'全部',value:'8'}, {label:'未管理',value:'0'}, {label:'在管',value:'1'}, {label:'失访',value:'2'}, {label:'出组',value:'3'}, {label:'不纳入管理 ',value:'4'}, {label:'入组 ',value:'5'}, {label:'死亡 ',value:'6'}, {label:'已管理 ',value:'7'}, ], region: '8', //管理状态 tertiaryHospitalsData:[], tertiary: [], //地区 communityHospitalsData:[], communityHospitals: [], // 三级医院 groupingData:[], group: [], // 社区 queryLevel: 1, // :1.全部 2.区 3.等级医院 4.社区医院 patientName: '', // 患者姓名 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() < new Date('2023','05','26') || time.getTime() > Date.now(); } }, s:'', e:'', dialogVisible: false, dataInfo: [], url: '', showPdf: false } }, created: function(){ 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.findCopdHealthInfoList(1, 1 , '350200') this.cascadingFindHosptail(1, '') }, 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: { // 获取地区 cascadingFindHosptail: function(type, val, hos) { var vm = this var data = { findType: type ? type: 1, areaCode: val.length!=0 ? val.join(',') : '', hosptialCode: hos ? hos.join(',') : '' } statisticAPI.cascadingFindHosptail({ jsonStr: JSON.stringify(data) }).then(function(res){ if(res.status===200) { console.log(res, 'dq'); if(type == 2) { vm.communityHospitalsData = res.data } else if(type == 3) { vm.groupingData = res.data } else { vm.tertiaryHospitalsData = res.data } } }) }, tertiaryChange: function(val) { if(val.length == 0) { this.communityHospitals = [] this.communityHospitalsData = [] this.group = [] this.groupingData = [] }else { this.queryLevel = 2 this.cascadingFindHosptail(2, val) } }, comChange: function (val) { var vm = this if(val.length == 0) { vm.groupingData = [] vm.group = [] }else { vm.queryLevel = 3 vm.cascadingFindHosptail(3, vm.tertiary , val) } }, groChange: function() { var vm = this vm.queryLevel = 4 }, // 清除 clearGroup: function() { if(this.group.length == 0) { this.queryLevel = 3 } }, clearCommunityHospitals:function(val) { if(this.communityHospitals.length == 0) { this.queryLevel = 2 this.groupingData = [] } }, clearTertiary: function() { if(this.tertiary.length == 0) { this.queryLevel = 1 } }, findCopdHealthInfoList:function (page, queryLevel, code) { var vm = this vm.loadingTwo = true var data = { startTime:this.startTime.format('yyyy-MM-dd'), endTime:this.endTime.format('yyyy-MM-dd'), stageType: 2, findType: 5, copdState: vm.region, page: page, size: 10, searchKey: vm.patientName, queryLevel: queryLevel, queryCode: code, pageIf: "true" } statisticAPI.findCopdHealthInfoList({ jsonStr:JSON.stringify(data) }).then(function(res){ if(res.status == 200) { console.log(res,'hxsj'); vm.loadingTwo = false vm.tableData = res.data.list vm.datatotal = res.data.count } }).catch(function(err){ vm.loadingTwo = false }) }, startTimeChange:function(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 if(this.queryLevel == 1) { this.findCopdHealthInfoList(val, 1 , '350200') } else if(this.queryLevel == 2) { // 地区 var areaCode = this.tertiary.join(',') this.findCopdHealthInfoList(val, this.queryLevel, areaCode) }else if(this.queryLevel == 3) { // 三级医院 var areaCode = this.communityHospitals.join(',') this.findCopdHealthInfoList(val, this.queryLevel, areaCode) }else if(this.queryLevel == 4) { // 社区 var areaCode = this.group.join(',') this.findCopdHealthInfoList(val, this.queryLevel, areaCode) } }, change:function(val) { this.list = this.list.concat(val) }, // 确定 confirm:function() { // 全部 , 也是默认 if(this.queryLevel == 1) { this.findCopdHealthInfoList(1, 1 , '350200') } else if(this.queryLevel == 2) { // 地区 var areaCode = this.tertiary.join(',') this.findCopdHealthInfoList(1, this.queryLevel, areaCode) }else if(this.queryLevel == 3) { // 三级医院 var areaCode = this.communityHospitals.join(',') this.findCopdHealthInfoList(1, this.queryLevel, areaCode) }else if(this.queryLevel == 4) { // 社区 var areaCode = this.group.join(',') this.findCopdHealthInfoList(1, this.queryLevel, areaCode) } }, // 取消 cancel:function() { this.startTime = new Date('2023','05','26') this.endTime = new Date() this.tertiary = [] this.communityHospitals = [] this.group = [] this.patientName = '' this.region = '8' this.queryLevel = 1 }, // 查看 showInfo: function(item) { var vm = this vm.dialogVisible = true var data = { patientCode: item.patientCode } statisticAPI.findCopdHealthInfoByCode({ jsonStr:JSON.stringify(data) }).then(function(res){ if(res.status == 200) { vm.dataInfo = res.data } }) }, btn: function(item) { this.showPdf = true this.url = item.url }, // 导出 exportHandle:function() { // 全部 , 也是默认 if(this.queryLevel == 1) { this.exoprtCopdHealthInfoList(1, 1 , '') } else if(this.queryLevel == 2) { // 地区 var areaCode = this.tertiary.join(',') this.exoprtCopdHealthInfoList(1, this.queryLevel, areaCode) }else if(this.queryLevel == 3) { // 三级医院 var areaCode = this.communityHospitals.join(',') this.exoprtCopdHealthInfoList(1, this.queryLevel, areaCode) }else if(this.queryLevel == 4) { // 社区 var areaCode = this.group.join(',') this.exoprtCopdHealthInfoList(1, this.queryLevel, areaCode) } }, exoprtCopdHealthInfoList: function(page, queryLevel, code) { var vm = this vm.loadingTwo = true var data = { startTime:this.startTime.format('yyyy-MM-dd'), endTime:this.endTime.format('yyyy-MM-dd'), stageType: 2, findType: 5, copdState: vm.region, page: page, size: 10, searchKey: vm.patientName, queryLevel: queryLevel, queryCode: code, pageIf: "" } var jsonStr = JSON.stringify(data) statisticAPI.exoprtCopdHealthInfoList({ jsonStr: encodeURIComponent(jsonStr) },'阻肺呼吸训练数据.xls').then(function(res){ vm.loadingTwo = false }) } } })