var template = '' $.ajax('../../../component/statistics/TurndownAnalysis/index.html', { data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function (res) {}, success: function (res) { template = res } }) Vue.component('turndown-analysis', { template: template, props: [], data: function () { return { years: [], yearType: '1', chooseYear: null, chooseTime: null, rangeOptions: [ { label: '区', value: 'town' }, { label: '社区', value: 'hospital' }, { label: '团队', value: 'team' } ], areaOptions: [ { label: '思明区', value: '350203' }, { label: '海沧区', value: '350205' }, { label: '湖里区', value: '350206' }, { label: '集美区', value: '350211' }, { label: '同安区', value: '350212' }, { label: '翔安区', value: '350213' } ], hospitalOptions: [], teamOptions: [], form: { range: 'town' }, loading: false, exportLoading: false, tableData: [], tableHeader: [ { label: '居民', prop: 'name', width: '100' }, { label: '年龄', prop: 'age', width: '90' }, { label: '性别', prop: 'sex', width: '90' }, { label: '手机号', prop: 'mobile', width: '110' }, { label: '是否签约', prop: 'isSign', width: '110' }, { label: '社区名称', prop: 'hospitalName', width: '130' }, { label: '下转次数', prop: 'num', width: '100' }, { label: '最近一次下转诊断', prop: 'diagnosisName', width: '130' }, { label: '最近一次下转时间', prop: 'turnDownTime', width: '150' }, { label: '最近一次下转类型', prop: 'eventType', width: '130' }, { label: '风险评估次数', prop: 'screenNum', width: '110' }, { label: '最近一次评估结果', prop: 'screenResult', width: '130' } ], page: 1, size: 10, total: 0, level: 0, } }, methods: { init() { var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole')) if (selectedRole.code.indexOf('350200') > -1) { this.level = 1 // 市卫健委 this.areaOptions = [ { label: '思明区', value: '350203' }, { label: '海沧区', value: '350205' }, { label: '湖里区', value: '350206' }, { label: '集美区', value: '350211' }, { label: '同安区', value: '350212' }, { label: '翔安区', value: '350213' } ] } else if (selectedRole.code.length == 6) { this.level = 2 // 区管理 this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }] this.form = { range: 'town', area: selectedRole.code } this.getHospital(selectedRole.code) } else { this.level = 3 // 社区管理 this.rangeOptions = [ { label: '社区', value: 'hospital' }, { label: '团队', value: 'team' } ] this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }] this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }] this.form = { range: 'hospital', area: selectedRole.code.substring(0, 6), hospital: selectedRole.code } this.getTeam(selectedRole.code) } this.initTime() this.getList() }, initTime() { var vm = this var now = new Date() vm.nowyear = vm.chooseYear = now.getFullYear() vm.years = [] for (i = vm.nowyear; i >= 2013; i--) { vm.years.push(i) } }, resetArea() { if (this.level == 1) { delete this.form.area delete this.form.hospital delete this.form.team } else if (this.level == 2) { delete this.form.hospital delete this.form.team } else { delete this.form.team } }, getList() { var vm = this this.loading = true var params = { ...this.form, page: this.page, pageSize: this.size } if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } httpRequest.get('statistics/collaborate/turnDownAnalysis', { data: params }).then(function (res) { if (res.status == 200) { vm.tableData = res.detailModelList vm.total = res.totalCount } vm.loading = false }) }, queryDate() { this.page = 1 this.getList() }, exportTable() { var vm = this var params = { ...this.form, page: this.page, pageSize: this.size } if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } this.exportLoading = true var fileName = `下转动态分析${new Date().getTime()}.xls` httpRequest.downLoadFileForAjax('statistics/collaborate/exportTurnDownAnalysis', fileName, params).then(function () { vm.exportLoading = false }) }, eliminateClick() { var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole')) if (this.level == 1) { this.form = { range: 'town' } } else if (this.level == 2) { this.form = { range: 'town', area: selectedRole.code } this.getHospital(selectedRole.code) } else { this.form = { range: 'hospital', area: selectedRole.code.substring(0, 6), hospital: selectedRole.code } this.getTeam(selectedRole.code) } this.yearType = '1' this.chooseYear = new Date().getFullYear() this.chooseTime = null this.$forceUpdate() }, getHospital(code) { var vm = this delete this.form.hospital delete this.form.team var params = { type: 5, code: code } httpRequest.post('common/district', { data: params }).then(function (res) { vm.hospitalOptions = [{ code: '', name: '全部' }] vm.hospitalOptions = vm.hospitalOptions.concat(res.list) }) }, getTeam(code) { var vm = this delete this.form.team var params = { hospital: code, area: this.form.area } httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) { vm.teamOptions = [{ id: '', name: '全部' }] vm.teamOptions = vm.teamOptions.concat(res.data) }) }, handleCurrentChange(val) { this.page = val this.getList() }, handleSizeChange(val) { this.size = val this.getList() }, openDialog(scope) { layer.open({ type: 2, // offset: ['100px'], //右下角弹出 area: ['568px', '100%'], shade: 0.5, title: '查看筛选结果', fixed: true, //不固定 maxmin: true, closeBtn: 1, shift: 5, shadeClose: false, //点击遮罩关闭层 content: `../../jbsc/html/view_screening_results.html?resultCode=${scope.row.code}&opt=1` }) } }, mounted() { this.init() } })