var template = '' $.ajax('../../../component/statistics/ActivityHoldDetail/index.html', { data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function (res) {}, success: function (res) { template = res } }) Vue.component('activity-hold-detail', { template: template, data() { return { years: [], yearType: '1', chooseYear: null, chooseTime: null, form: { range: 'town', firstClassify: '', secondClassify: '', activityStatus: '', eventForm: '', eventAim: '' }, tableData: [], dialogShow: false, info: {}, page1: 1, size1: 10, total1: 0, page2: 1, size2: 10, total2: 0, loading: false, exportLoading: false, rangeOptions: [ { label: '按区', value: 'town' }, { label: '按社区', value: 'hospital' } ], areaOptions: [ { label: '思明区', value: '350203' }, { label: '海沧区', value: '350205' }, { label: '湖里区', value: '350206' }, { label: '集美区', value: '350211' }, { label: '同安区', value: '350212' }, { label: '翔安区', value: '350213' } ], level: 0, tableHeader: [ { label: '活动名称', prop: 'title', width: '120' }, { label: '活动一级类别', prop: 'firstClassify', width: '120' }, { label: '活动二级类别', prop: 'secondClassify', width: '120' }, { label: '活动状态', prop: 'activityStatus' }, { label: '举办形式', prop: 'eventForm' }, { label: '举办目的', prop: 'eventAim' }, { label: '主办机构', prop: 'organizer', width: '140' }, { label: '预计报名人数', prop: 'num', width: '120' }, { label: '已报名人数', prop: 'joinNum' }, { label: '参与社区医院数量', prop: 'hospitalNum', width: '140' }, { label: '活动创建时间', prop: 'createTime', width: '120' }, { label: '报名截止时间', prop: 'registrationEndTime', width: '120' }, { label: '活动下线时间', prop: 'offlineEndTime', width: '120' } ], dialogShow: false, query: {}, dialogTableData: [], dialogHeader: [ { label: '姓名', prop: 'name' }, { label: '性别', prop: 'sex' }, { label: '年龄', prop: 'age' }, { label: '证件号码', prop: 'idcard', width: '120' }, { label: '手机号码', prop: 'mobile' }, { label: '签约机构', prop: 'hospitalName' }, { label: '签约医生', prop: 'doctorName' }, { label: '积分', prop: 'jfTotal' }, { label: '奖励', prop: 'couponTotal' }, { label: '排名', prop: 'ranking' } ], dialogLoading: false, activityId: null } }, 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, firstClassify: '', secondClassify: '', activityStatus: '', eventForm: '', eventAim: '' } this.getHospital(selectedRole.code) } this.initTime() this.searchFn() }, 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) } }, searchFn() { var vm = this this.loading = true var params = { ...this.form, page: this.page1, size: this.size1 } vm.tableData = [] 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('doctor/healthBank/eventDetail', { data: params }).then(function (res) { if (res.status == 200) { vm.tableData = res.detailModelList vm.total1 = res.totalCount } vm.loading = false }) }, 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('doctor/healthBank/exportEventDetail', fileName, params).then(function () { vm.exportLoading = false }) }, eliminateClick() { var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole')) if (this.level == 1) { this.form = { range: 'town', firstClassify: '', secondClassify: '', activityStatus: '', eventForm: '', eventAim: '' } } else if (this.level == 2) { this.form = { range: 'town', area: selectedRole.code, firstClassify: '', secondClassify: '', activityStatus: '', eventForm: '', eventAim: '' } this.getHospital(selectedRole.code) } this.yearType = '1' this.chooseYear = new Date().getFullYear() this.chooseTime = null this.$forceUpdate() }, closeDialog() { this.dialogShow = false }, previewDetailData(row) { this.dialogShow = true this.activityId = row.id this.query = { // sex: '' } this.page1 = 1 this.dialogSearch() }, 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) }) }, 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 } }, dialogSearch() { var vm = this this.dialogLoading = true var params = { ...this.query, activityId: this.activityId, page: this.page2, size: this.size2 } httpRequest.get('doctor/healthBank/eventDataDetail', { data: params }).then(function (res) { if (res.status == 200) { vm.dialogTableData = res.detailModelList vm.total2 = res.totalCount } vm.dialogLoading = false }) }, dialogExport() { var vm = this var params = { ...this.query, activityId: this.activityId } 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('doctor/healthBank/exportEventDataDetail', fileName, params).then(function () { vm.exportLoading = false }) }, getSecondClassifyList(val) { switch (val) { case '': return [ { label: '全部', value: '' }, { label: '健康运动', value: '健康运动' }, { label: '健康问答', value: '健康问答' }, { label: '健康咨询', value: '健康咨询' } ] case '健康运动': return [ { label: '全部', value: '' }, { label: '健康运动', value: '健康运动' } ] case '健康教育': return [ { label: '全部', value: '' }, { label: '健康问答', value: '健康问答' } ] case '促进业务': return [ { label: '全部', value: '' }, { label: '健康咨询', value: '健康咨询' } ] } } }, mounted() { this.init() } })