// 慢阻肺患者档案-服务档案 var template = '' $.ajax('../../../component/statistics/CopdServeNum/index.html', { data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function (res) {}, success: function (res) { template = res } }) Vue.component('copd-serve-num', { template: template, props: [], data() { return { // 当前显示的字段 communityArr: [], tableFieldList: [], quotaStrArr: [], value1: [], rangeList: [ { name: '按区', code: 'town' }, { name: '按社区', code: 'hospital' } ], startTime: '', endTime: '', rangeCode: 'town', quotaStr: '', range: '', area: '', hospital: '', page: 1, size: 20, chooseYear: '', years: '', userRole: '', levelList: [ { level: '4', areaLevel: '2' }, { level: '3', areaLevel: '3' }, { level: '2', areaLevel: '4' } ], //两种搜索,地区等级对比 areaLevel: '', // 2、市,3、区,4、社区,5、团队 initareaLevel: '', initlevel: '', initarea: '', level: '', areaTitle: '', areaCode: null, communityList: [{ code: '', name: '全部' }], communityCode: null, teamList: [{ code: '', name: '全部' }], teamCode: '', userRoleCode: '', docInfo: JSON.parse(window.localStorage.getItem('docInfo')), isGuGan: false, areaList: [], tabledata: [], tableHeader: [ { label: '地区', prop: 'name', width: '90' }, { label: '总患者人数', prop: 'patientNum', width: '90' }, { label: '计划服务人数', prop: 'planNum', width: '90' }, { label: '已服务人数', prop: 'serviceNum', width: '90' }, { label: '服务完成度', prop: 'serviceProgress', width: '90' } ], radio: '1', fileList: [], file: undefined, isProgressShow: false, percentage: 0, success: false, loading: false, isOver: false, status: '', errList: [], daLoading: false, isShow: false, datatotal: 0 } }, methods: { gotoDownLoad() { const a = document.createElement('a') a.style.display = 'none' a.download = '模板.xlsx' a.href = './template.xls' a.target = '_blank' a.click() }, hospitalList() { var vm = this statisticAPI.hospitalList({ queryArea: vm.userRoleCode }).then(function (res) { if (res.status == 200) { vm.communityArr = res.detailModelList } }) }, //获取省市区 type:区3 getDistrict: function (type, code, name) { var vm = this, list = [], param = '' if (type == 3) { list = [{ code: code, name: name }] param = 'area' } else if (type == 5) { list = [{ code: '', name: '全部' }] param = 'community' } var params = { type: type, code: code } homeAPI.getDistrict(params).then(function (res) { if (res.status == 200) { vm[param + 'List'] = list.concat(res.list) // vm[param + 'Code'] = vm[param + 'List'][0].code } else { vm.$message.error(res.msg) } }) }, // 初始化时间 initTime(vm) { var now = new Date() vm.endTime = now.format('yyyy-MM-dd') var start = now.getFullYear() + '-' + '01-01' vm.startTime = new Date(start).format('yyyy-MM-dd') vm.nowyear = vm.chooseYear = now.getFullYear() // vm.chooseYear = '2022' vm.nowmonth = now.getMonth() + 1 vm.years = [] for (i = vm.nowyear; i >= 2013; i--) { vm.years.push(i) } }, // 数据范围初始化 initScope(type) { var vm = this //获得缓存中缓存的角色权限 var userRole = window.sessionStorage.getItem('selectedRole') if (!userRole) { return false } vm.userRole = JSON.parse(userRole) vm.areaTitle = vm.userRole.name if (vm.isGuGan) { return } if (type == 3) { this.areaCode = null this.communityCode = null if (vm.userRole.code == '350200' || vm.userRole.code == 'jk_350200') { vm.getDistrict(type, 350200, '厦门市') } else if (vm.userRole.code.indexOf('jk_') > -1) { vm.getDistrict(type, vm.userRole.code.substring(3), vm.areaTitle.substring(0, 3)) } else if (vm.userRole.code.length == 6) { vm.getDistrict(type, vm.userRole.code, vm.areaTitle.substring(0, 3)) } } else { this.communityCode = null if (this.rangeCode == 'hospital') vm.getDistrict(type, vm.areaCode) } return //获得缓存中缓存的角色权限 var userRole = window.sessionStorage.getItem('selectedRole') if (!userRole) { return false } vm.userRole = JSON.parse(userRole) //level:2、市,3、区,4、社区,5、团队 vm.initareaLevel = vm.areaLevel = vm.userRole.code == 'jk_350200' ? 2 : vm.userRole.code.length == 9 ? 3 : 4 vm.initlevel = vm.level = vm.userRole.code == 'jk_350200' ? 4 : vm.userRole.code.length == 9 ? 3 : 2 // vm.lowLevel = vm.initlowLevel = vm.userRole.code == '350200' ? 3 : vm.userRole.code.length == 6 ? 2 : 1; vm.initarea = vm.area = vm.userRole.code vm.areaTitle = vm.userRole.name if (vm.initlevel == 4) { //市获取区 vm.getDistrict(3, vm.initarea.substring(3), vm.areaTitle.substr(0, 3)) vm.rangeCode = vm.rangeList[0].code } else if (vm.initlevel == 3) { //区获取社区 vm.areaList = [{ code: vm.initarea, name: vm.areaTitle }] vm.areaCode = vm.initarea vm.rangeCode = vm.rangeList[0].code } else if (vm.initlevel == 2) { //社区获取团队 vm.communityList = [{ code: vm.initarea, name: vm.areaTitle }] vm.communityCode = vm.initarea vm.rangeList.shift() vm.rangeCode = vm.rangeList[0].code } vm.range = vm.rangeCode }, toggleField(fieldName) { return this.tableFieldList.indexOf(fieldName) !== -1 }, selChange: function (type) { var vm = this, name = '' if (type == 3) { vm.initSelOption('community') vm.initSelOption('team') vm.getCommunityHospital() } else if (type == 5) { vm.initSelOption('team') // vm.teamListByArea(); } }, initSelOption: function (param) { var vm = this vm[param + 'List'] = [{ code: '', name: '全部' }] if (param == 'team') { vm[param + 'List'] = [{ id: '', name: '全部' }] } vm[param + 'Code'] = vm[param + 'List'][0].code || vm[param + 'List'][0].id }, getCommunityHospital: function () { var vm = this, list = [{ code: '', name: '全部' }], param = 'community' homeAPI.getCommunityHospital({ area: vm.areaCode == '350200' ? '' : vm.areaCode }).then(function (res) { if (res.status == 200) { vm[param + 'List'] = list.concat(res.data) vm[param + 'Code'] = vm[param + 'List'][0].code } else { vm.$message.error(res.msg) } }) }, exportTable() { var vm = this vm.daLoading = true var params = { year: this.chooseYear, range: this.rangeCode, area: this.areaCode == '350200' ? '' : this.areaCode } statisticAPI.exportServiceProgress(params, '服务人数配置及进度查询.xls').then(function (res) { vm.daLoading = false vm.$message({ message: '导出成功!', type: 'success' }) }) }, resetDate() { if (this.isGuGan) { this.rangeCode = 'hospital' this.areaCode = this.docInfo.town this.communityCode = this.docInfo.hospital } else { this.rangeCode = 'town' this.areaCode = '' this.communityCode = '' } this.startTime = '' this.endTime = '' this.quotaStr = '' this.range = '' this.area = '' this.hospital = '' this.sex = '' this.firstVisitType = '' this.firstVisitArea = '' this.firstVisitOrgLevel = '' this.hasLung = '' this.hasCt = '' this.hasx = '' this.hasBloodGas = '' this.hasSmoke = '' this.hasDrink = '' this.diseaseConversion = '' this.age = '' }, handleCurrentChange(val) { this.page = val this.search() }, handleSizeChange(val) { this.size = val this.search() }, //上传 toggle(isShow) { this.isShow = isShow if (!isShow) { this.reset() } }, reset(type) { this.percentage = 0 this.success = false this.isOver = false this.errList = [] if (type != 1) { this.loading = false this.file = undefined this.month = '' } }, search() { var vm = this vm.daLoading = true var params = { year: this.chooseYear, range: this.rangeCode, area: this.areaCode == '350200' ? '' : this.areaCode } statisticAPI.getServiceProgress(params).then(function (res) { vm.daLoading = false if (res.status == 200) { vm.tabledata = res.detailModelList vm.totalCount = res.totalCount vm.totalPage = res.totalPage } else { vm.$message.error(res.msg) } console.log(res, 'llllllllllllllllllllllllllllllll') }) }, close(type) { this.reset(type) this.isProgressShow = false if (type != 1) { this.isShow = false } }, beforeUploadPic(file) { this.file = file }, check() { var vm = this vm.loading = true if (!vm.file) { vm.loading = false vm.$message('请选择文件') return } vm.save() }, save() { var vm = this vm.daLoading = true var formData = new FormData() formData.append('file', vm.file) // vm.initProgress() httpRequest .post('doctor/jkCopd/importPlanExcel', { data: formData, cache: false, //上传文件无需缓存 processData: false, //用于对data参数进行序列化处理 这里必须false contentType: false //必须 }) .then(function (res) { if (res.status == 200) { vm.search() vm.daLoading = false vm.isShow = false vm.$message({ message: '导入成功!', type: 'success' }) } else { vm.$message.error('导入失败!') vm.daLoading = false } }) .catch(function (e) { console.error(e) vm.daLoading = false }) }, initProgress() { var vm = this this.isProgressShow = true setTimeout(() => { if (!vm.isOver && vm.percentage != 90) { vm.percentage += 10 vm.initProgress() } }, 1000) } }, mounted() { var vm = this var userRole = JSON.parse(window.sessionStorage.getItem('selectedRole')) vm.userRoleCode = userRole.code this.initTime(this) if (this.docInfo.expandLevelName) { this.isGuGan = this.docInfo.expandLevelName.indexOf('慢病骨干') > -1 } this.initScope(3) if (this.isGuGan) { // 如何是慢病骨干 则只能选社区,并且限定死社区 this.rangeList = [{ name: '按社区', code: 'hospital' }] this.rangeCode = 'hospital' this.areaList = [{ name: this.docInfo.hospitalName.substring(0, 3), code: this.docInfo.town }] this.areaCode = this.docInfo.town this.communityList = [{ name: this.docInfo.hospitalName, code: this.docInfo.hospital }] this.communityCode = this.docInfo.hospital // vm.receivingHospitalList = [{code:this.docInfo.hospital,name:this.docInfo.hospitalName}] // this.hospital = this.docInfo.hospital } this.search() EventBus.$on('copd-record-filter-change', function (event) { vm.quotaStrArr = event console.log(vm.quotaStrArr, '999sd8s9a8d9s8ad9sa89') }) }, destroyed() { EventBus.$off('copd-record-filter-change') } })