diff --git a/src/views/modules/base/epidemic/static/options.js b/src/views/modules/base/epidemic/static/options.js index 35f0a81a7..37e4ca537 100644 --- a/src/views/modules/base/epidemic/static/options.js +++ b/src/views/modules/base/epidemic/static/options.js @@ -46,7 +46,7 @@ export function pieOption (_charts) { position: 'outside', alignTo: 'edge', // formatter: '{a|{c}}\n\n{name|{b}}', - formatter: '{a|{c}}\n{r|}\n{name|{b}}', + formatter: '{name|{b}}{a|{c}}\n{r|}\n{d|{d}%}', // minMargin: 5, edgeDistance: 20, lineHeight: 15, diff --git a/src/views/modules/base/epidemic/static/static.vue b/src/views/modules/base/epidemic/static/static.vue index 725fb11cc..7daa7a801 100644 --- a/src/views/modules/base/epidemic/static/static.vue +++ b/src/views/modules/base/epidemic/static/static.vue @@ -4,8 +4,9 @@
- 所属组织 + 所属组织: + + 查询
@@ -76,57 +82,35 @@ export default { checkStrictly: true }, - noInit: false, noEduInit: false, - agencyId: '', - orgType: '', + grid: '', - eduItem: [ + pieItem: [ { - name: '小学', + name: '接种0针人数', value: 0, color: 'rgba(27, 81, 255, 1)' }, { - name: '初中', + name: '接种1针人数', value: 1, color: 'rgba(0, 229, 237, 1)' }, { - name: '高中', + name: '接种2针人数', value: 2, color: 'rgba(120, 0, 255, 1)' }, { - name: '中专', + name: '接种3针人数', value: 3, color: 'rgba(255, 120, 0, 1)' }, { - name: '大专', + name: '接种4针人数', value: 4, color: 'rgba(255, 186, 0, 1)' - }, { - name: '本科', - value: 5, - color: 'rgba(22, 215, 131, 1)' - }, { - name: '硕士', - value: 6, - color: 'rgba(42, 0, 255, 1)' - }, { - name: '博士', - value: 7, - color: 'rgba(198, 0, 255, 1)' - }, { - name: '其他', - value: 8, - color: 'rgba(255, 42, 0, 1)' } ], - - partyOrgs: [], - partyOrgList: [], - pieEduChartSs: null, pieEduOptions: null, @@ -147,7 +131,7 @@ export default { async mounted () { await nextTick(100); await this.getOrgTreeList() - this.getEduCount() + this.getPieData() this.getLineChart() this.getLine() @@ -156,6 +140,9 @@ export default { }, methods: { + handleSearch (val) { + this.getPieData() + }, pieInitOks (dom) { console.log('pies准备好了', dom) @@ -163,16 +150,16 @@ export default { // this.pieInitState = true }, - async getEduCount (orgId, orgType) { + async getPieData () { // const url = "/epmetuser/icresiuser/partymembereducationstatistics"; - const url = '/resi/partymember/icPartyMember/partymembereducationstatistics' + const url = '/epmetuser/epidemicPrevention/vaccinePie' let params = { - orgId: orgId || '', - orgType + gridId: this.gridId, + agencyId: this.agencyId }; const { data, code, msg } = await requestPost(url, params); if (code === 0) { - this.eduItem = data.map(item => { + this.pieItem = data.map(item => { return { ...item, name: item.label, @@ -187,9 +174,6 @@ export default { initEduCharts () { - let option = { - - } let legend = { show: true, // orient: 'vertical', @@ -205,9 +189,10 @@ export default { } }, formatter: name => { - for (let a = 0; a < this.eduItem.length; a++) { + for (let a = 0; a < this.pieItem.length; a++) { + // return this.pieItem[a].name // this.data 这个数据中有名称和次数 - if (this.eduItem[a].name === name) { + if (this.pieItem[a].name === name) { //两个名称进行对比,取出对应的次数 let params1 = name + "\n"; //然后return你需要的legend格式即可 console.log(params1); @@ -224,8 +209,8 @@ export default { this.pieEduOptions = pieOption(this.pieEduChartS) this.pieEduOptions.legend = { ...legend } - const maxValue = Math.max(...this.eduItem.map(i => Number(i.value))); - const maxIndex = this.eduItem.findIndex(a => Number(a.value) == maxValue); + const maxValue = Math.max(...this.pieItem.map(i => Number(i.value))); + const maxIndex = this.pieItem.findIndex(a => Number(a.value) == maxValue); this.clickEduPie(maxIndex) console.log('----------------------最大值', maxValue, maxIndex) let fun = params => { @@ -240,7 +225,7 @@ export default { clickEduPie (seriesIndex) { let _code = '' let isClick = false - this.eduItem.forEach((element, index) => { + this.pieItem.forEach((element, index) => { if (index === seriesIndex) { _code = element.code @@ -261,7 +246,7 @@ export default { } }; - console.log('zlcm') + } else { element.isClick = false element.label = { @@ -281,7 +266,7 @@ export default { }); - this.pieEduOptions.series[0].data = this.eduItem + this.pieEduOptions.series[0].data = this.pieItem // this.$refs.pieChart.hideLoading() this.$refs.eduChart.setOption(this.pieEduOptions) @@ -364,16 +349,16 @@ export default { let obj = this.$refs["myCascader"].getCheckedNodes()[0].data if (obj) { if (obj.level === 'grid') { - this.formData.gridId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''; - this.formData.agencyId = '' + this.gridId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''; + this.agencyId = '' } else { - this.formData.agencyId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''; - this.formData.gridId = '' + this.agencyId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''; + this.gridId = '' } } else { - this.formData.agencyId = '' - this.formData.gridId = '' + this.agencyId = '' + this.gridId = '' } },