From 2f90a728355b4178f12b15ea4f9d9b8867fde5a0 Mon Sep 17 00:00:00 2001 From: jiangyy Date: Wed, 8 Dec 2021 16:51:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=B2=E7=AA=81=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visual/communityGovern/resibuzz.vue | 349 +++++++++--------- 1 file changed, 174 insertions(+), 175 deletions(-) diff --git a/src/views/modules/visual/communityGovern/resibuzz.vue b/src/views/modules/visual/communityGovern/resibuzz.vue index 40359485..7286a85f 100644 --- a/src/views/modules/visual/communityGovern/resibuzz.vue +++ b/src/views/modules/visual/communityGovern/resibuzz.vue @@ -230,209 +230,208 @@ export default { } }, - methods: { - pieInitOk (dom) { - console.log('pie准备好了', dom) - this.pieChartS = dom - this.pieInitState = true - }, - getPie () { - if (this.pieInitState) { - this.getPieChart() + pieInitOk (dom) { + console.log('pie准备好了', dom) + this.pieChartS = dom + this.pieInitState = true + + }, + getPie () { + if (this.pieInitState) { + this.getPieChart() + } else { + setTimeout(() => { + this.getPie() + }, 500) + } + }, + // 获取饼状图 + async getPieChart () { + this.$refs.pieChart.clear() + this.pieTotal = 0 + const _that = this + // this.$refs.pieChart.showLoading() + // const url ="/gov/issue/issue/resibuzz-leftpiechart"; + const url = "http://yapi.elinkservice.cn/mock/245/gov/issue/issue/resibuzz-leftpiechart"; + let params = { + orgId: this.orgId, + }; + + const { data, code, msg } = await requestPost(url, params); + // 获取pieChart配置 + this.pieOption = pieOption(this.pieChartS) + + + if (code === 0) { + // 获取pieChart配置 + this.pieOption = pieOption() + if (data && data.length > 0) { + // this.pieData = data + } else { - setTimeout(() => { - this.getPie() - }, 500) + this.pieData = [{ count: 0, categoryName: '无分类', color: '#00E5ED' }] } - }, - // 获取饼状图 - async getPieChart () { - this.$refs.pieChart.clear() - this.pieTotal = 0 - const _that = this - // this.$refs.pieChart.showLoading() - // const url ="/gov/issue/issue/resibuzz-leftpiechart"; - const url = "http://yapi.elinkservice.cn/mock/245/gov/issue/issue/resibuzz-leftpiechart"; - let params = { - orgId: this.orgId, - }; - - const { data, code, msg } = await requestPost(url, params); - // 获取pieChart配置 - this.pieOption = pieOption(this.pieChartS) - this.pieOption.title.text = this.pieTotal - this.pieOption.series[1].data = this.pieData - if (code === 0) { - // 获取pieChart配置 - this.pieOption = pieOption() - if (data && data.length > 0) { - // this.pieData = data + this.pieData.forEach(item => { + item.name = item.categoryName + item.value = item.count + this.colorArray.push(item.color) + this.pieTotal = this.pieTotal + item.value - } else { - this.pieData = [{ count: 0, categoryName: '无分类', color: '#00E5ED' }] + }); + + + this.pieOption.title.text = this.pieTotal + this.pieOption.series[1].itemStyle = { + color: function (params) { + return _that.colorArray[params.dataIndex] } + } + this.clickPie(0) - this.pieData.forEach(item => { - item.name = item.categoryName - item.value = item.count - this.colorArray.push(item.color) - this.pieTotal = this.pieTotal + item.value + let fun = function (params) { + _that.clickPie(params.dataIndex) + } + this.$refs.pieChart.handleClick(fun) + } else { + this.$message.error(msg); + } - }); + }, - this.pieOption.title.text = this.pieTotal - this.pieOption.series[1].itemStyle = { - color: function (params) { - return _that.colorArray[params.dataIndex] + clickPie (seriesIndex) { + this.pieData.forEach((element, index) => { + if (index === seriesIndex) { + element.label = { + show: true, + + }; + element.labelLine = { + show: true, + lineStyle: { + opacity: 1, } - } - this.clickPie(0) - let fun = function (params) { - _that.clickPie(params.dataIndex) - } - this.$refs.pieChart.handleClick(fun) + }; + console.log('zhilma') + // element.labelLayout = (params) => { + // const isLeft = params.labelRect.x < this.pieChartS.getWidth() / 2; + // const points = params.labelLinePoints; + // console.log('isLeft', isLeft, points) + // // Update the end point. + // points[2][0] = isLeft + // ? params.labelRect.x + // : params.labelRect.x + params.labelRect.width; + // return { + // labelLinePoints: points + // }; + // } + } else { - this.$message.error(msg); - } + element.label = { + show: false, + + }; + element.labelLine = { + show: false, + lineStyle: { + opacity: 0, + color: 'rgba(255,255,255,0)' + } + }; - }, + } + }); + this.pieOption.series[1].data = this.pieData + // this.$refs.pieChart.hideLoading() + this.$refs.pieChart.setOption(this.pieOption) - clickPie (seriesIndex) { - this.pieData.forEach((element, index) => { - if (index === seriesIndex) { - element.label = { - show: true, - - }; - element.labelLine = { - show: true, - lineStyle: { - opacity: 1, - } - - }; - console.log('zhilma') - // element.labelLayout = (params) => { - // const isLeft = params.labelRect.x < this.pieChartS.getWidth() / 2; - // const points = params.labelLinePoints; - // console.log('isLeft', isLeft, points) - // // Update the end point. - // points[2][0] = isLeft - // ? params.labelRect.x - // : params.labelRect.x + params.labelRect.width; - // return { - // labelLinePoints: points - // }; - // } - - } else { - element.label = { - show: false, - - }; - element.labelLine = { - show: false, - lineStyle: { - opacity: 0, - color: 'rgba(255,255,255,0)' - } - - }; + }, - } - }); - this.pieOption.series[1].data = this.pieData - // this.$refs.pieChart.hideLoading() - this.$refs.pieChart.setOption(this.pieOption) + handleChangeState (index) { + this.getTable() + }, - }, + handleChangeAgency (value) { + console.log(value) + this.agencyName = this.$refs["myCascader"].getCheckedNodes()[0].label + this.orgId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '' + console.log(this.agencyIdArray) + }, - handleChangeState (index) { - this.getTable() - }, + //加载组织数据 + async getTable () { + // const url = "/gov/issue/issue/resibuzz"; + const url = "http://yapi.elinkservice.cn/mock/245/gov/issue/issue/resibuzz"; + let params = { + status: this.status, + orgId: this.orgId, + pageNo: this.demand.pageNo, + pageSize: this.demand.pageSize, + }; - handleChangeAgency (value) { - console.log(value) - this.agencyName = this.$refs["myCascader"].getCheckedNodes()[0].label - this.orgId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '' - console.log(this.agencyIdArray) - }, + const { data, code, msg } = await requestPost(url, params); + this.demand.loading = false; - //加载组织数据 - async getTable () { - // const url = "/gov/issue/issue/resibuzz"; - const url = "http://yapi.elinkservice.cn/mock/245/gov/issue/issue/resibuzz"; - let params = { - status: this.status, - orgId: this.orgId, - pageNo: this.demand.pageNo, - pageSize: this.demand.pageSize, - }; - - const { data, code, msg } = await requestPost(url, params); - this.demand.loading = false; - - if (code === 0) { - this.demand.total = data.total; - this.demand.list = data.list.map((item) => { - return [ - { type: "index" }, - item.issueTitle, - item.suggestion, - item.categoryName, - item.status, - item.createdTime, - item.issueOriginator, - item.voteAccount, - item.supportCount, - item.oppositionCount, - { type: "operate", list: ["查看"] }, - ]; - }); - } else { - this.$message.error(msg); - } - }, + if (code === 0) { + this.demand.total = data.total; + this.demand.list = data.list.map((item) => { + return [ + { type: "index" }, + item.issueTitle, + item.suggestion, + item.categoryName, + item.status, + item.createdTime, + item.issueOriginator, + item.voteAccount, + item.supportCount, + item.oppositionCount, + { type: "operate", list: ["查看"] }, + ]; + }); + } else { + this.$message.error(msg); + } + }, - handlePageNoChange_demand (val) { - this.demand.pageNo = val; - this.getTable(); - }, - toUserInfo (uid) { - this.$router.push({ path: `/main-shuju/visual-basicinfo-people/${uid}` }); - }, + handlePageNoChange_demand (val) { + this.demand.pageNo = val; + this.getTable(); }, - props: { - uid: { - type: String, - default: "", - // default: "8ada68cb6f1e4b9a8333348a39ef3aee", - }, + toUserInfo (uid) { + this.$router.push({ path: `/main-shuju/visual-basicinfo-people/${uid}` }); + }, + }, + props: { + uid: { + type: String, + default: "", + // default: "8ada68cb6f1e4b9a8333348a39ef3aee", }, + }, - computed: {}, + computed: {}, - components: { - cptCard, - cptTb, - screenEchartsFrame, - }, + components: { + cptCard, + cptTb, + screenEchartsFrame, + }, - watch: { - uid (id) { - this.userId = id; - }, - userId () { - this.getApiData(); - window.scrollTo(0, 0); - }, + watch: { + uid (id) { + this.userId = id; + }, + userId () { + this.getApiData(); + window.scrollTo(0, 0); }, - }; + }, +};