// pages/dataCenter/dataCenter.js import * as echarts from '../../ec-canvas/echarts'; import { imgUrl } from "../api/request" const baseUrl = "https://www.cqna.gov.cn/data/" const request = (options) => { return new Promise((resolve, reject) => { options.url = baseUrl + options.url wx.request({ // 配置 "wx.request" 请求参数 ...options, header: { 'content-type': 'application/json;charset=UTF-8' }, success: function (res) { // console.log("network-res=>", res); // 返回成功信息 resolve(res.data) }, fail: function (error) { // console.log("network-err=>", error); // 返回错误信息 reject(error) } }) }) } Page({ /** * 页面的初始数据 */ data: { // 图片前缀 imgUrl: imgUrl, // 图表 streetlinechartec: { lazyLoad: true, }, // 国民经济统计数据选中 currentTab: 0, // 国民经济统计数据 statistics: [{ title: 'GDP地区生产总值', name: 'streetlinechart' }, { title: '规模以上工业增加值', name: 'streetlinechart1' }, { title: '建筑业总产值', name: 'streetlinechart2' }, { title: '固定资产投资总额', name: 'streetlinechart3' }, { title: '商品房建设与销售', name: 'streetlinechart4' }, { title: '社会消费品零售总额', name: 'streetlinechart5' }], // { // title: '公共财政收入', // name: 'streetlinechart6' // }, { // title: '税收收入', // name: 'streetlinechart7' // }, { // title: '公共财政支出', // name: 'streetlinechart8' // } // 本年办件数 officeNumber: [], // 评价总量 evalutionNum: 0, // 满意度 evalutionRate: '', // 南岸区政务服务事项总数数据 matters: [], // 南岸区政务服务事项总数数据零的数量 mattersZero: 0, // 本年度公开信箱办理情况 leaveAMessage: {} }, // 切换国民经济统计数据 tabNav(e) { let currentTab = e.currentTarget.dataset.index this.setData({ currentTab }) }, // 切换国民经济统计数据 handleSwiper(e) { let { current, source } = e.detail if (source === 'autoplay' || source === 'touch') { const currentTab = current this.setData({ currentTab }) } }, catchTouchMove() { return true }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { // 加载字体 // wx.loadFontFace({ // family: 'DOUYU', // // source: 'url("https://hui.yrslm.com:8089/douyu.ttf")', // source: 'url("https://www.cqna.gov.cn/mnazw/applet/font/douyu.ttf")', // success: function (e) { // console.log(e, '动态加载字体成功') // }, // fail: function (e) { // console.log(e, '动态加载字体失败') // }, // }) // GDP地区生产总值 this.barComponent = this.selectComponent('#streetlinechart'); this.init_bar(); // 规模以上工业增加值 this.barComponent1 = this.selectComponent('#streetlinechart1'); this.init_bar1(); // 建筑业总产值 this.barComponent2 = this.selectComponent('#streetlinechart2'); this.init_bar2(); // 固定资产投资总额 this.barComponent3 = this.selectComponent('#streetlinechart3'); this.init_bar3(); // 商品房建设与销售 this.barComponent4 = this.selectComponent('#streetlinechart4'); this.init_bar4(); // 社会消费品零售总额 this.barComponent5 = this.selectComponent('#streetlinechart5'); this.init_bar5(); // // 公共财政收入 // this.barComponent6 = this.selectComponent('#streetlinechart6'); // this.init_bar6(); // // 税收收入 // this.barComponent7 = this.selectComponent('#streetlinechart7'); // this.init_bar7(); // // 公共财政支出 // this.barComponent8 = this.selectComponent('#streetlinechart8'); // this.init_bar8(); // 好差评图表 // this.goodOrBad = this.selectComponent('#goodOrBad'); this.init_goodOrBad(); // 获取本年办件数 this.getOfficeNumberByAreaInfo(); // 本年度公开信箱办理情况 this.queryLeaveAMessage(); // 南岸区政务服务事项总数 this.queryDepartmentItem(); // 近90天办理类别统计 this.processingCategory = this.selectComponent('#processingCategory'); this.init_processingCategory(); // 近90天公开信箱领域统计 this.publicMailbox = this.selectComponent('#publicMailbox'); this.init_publicMailbox(); }, // GDP地区生产总值/规模以上工业增加值/固定资产投资总额 getScaOption1() { //请求数据 let xAxis = { type: 'category', data: [], axisLabel: { rotate: 60 } }, yAxis = { type: 'value', axisLabel: { formatter: '{value}%' } }, grid = { left: '10%', bottom: '40%', top: '15%' }, dataZoom = [{ type: 'inside', show: true, start: 0, end: 40, }], legend = { data: ['增速(%)'] }, series = [{ name: '增速(%)', data: [], type: 'line', itemStyle: { normal: { color: '#FFA130', label: { show: true } } } }] return { backgroundColor: '#FFFFFF', xAxis: xAxis, yAxis: yAxis, grid: grid, dataZoom: dataZoom, legend: legend, series: series, animationDelay: function (idx) { return idx * 50; }, animationEasing: 'elasticOut' }; }, // 建筑业总产值/商品房建设与销售/社会消费品零售总额/公共财政收入/税收收入/公共财政支出 getScaOption2() { //请求数据 let xAxis = { type: 'category', data: [], axisLabel: { rotate: 60 } }, tooltip = { trigger: 'axis' }, yAxis = [{ type: 'value', axisLabel: { formatter: '{value}万元' } }, { type: 'value', axisLabel: { formatter: '{value}%' } }], grid = { left: '22%', right: '15%', bottom: '40%', top: '15%' }, legend = { data: ['季度', '同比增长(%)'] }, dataZoom = [{ type: 'inside', show: true, start: 0, end: 40, }], series = [{ name: '季度', type: 'bar', data: [], tooltip: { valueFormatter: function (value) { return value + '万元'; } } }, { name: '同比增长(%)', type: 'line', data: [], yAxisIndex: 1, tooltip: { valueFormatter: function (value) { return value + '%'; } }, itemStyle: { normal: { color: '#FFA130', label: { show: true } } } }] return { backgroundColor: '#FFFFFF', xAxis: xAxis, yAxis: yAxis, grid: grid, dataZoom: dataZoom, tooltip: tooltip, legend: legend, series: series, animationDelay: function (idx) { return idx * 50; }, animationEasing: 'elasticOut' }; }, // GDP地区生产总值 init_bar() { this.barComponent.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption1()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/jdp.json', success: function (res) { let list = res.data.GDP; let dateNum = []; let alloneBasis = []; for (let i = 0; i < list.length; i++) { for (let j = 1; j <= list[i].totalNum.length; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } let alloneBasisList = list[i].growth; for (let n = 0; n < alloneBasisList.length; n++) { alloneBasis.push(alloneBasisList[n]); } } barChart.setOption({ series: [{ data: alloneBasis, name: '同比增长(%)', }], xAxis: { data: dateNum }, legend: { data: ['同比增长(%)'] }, }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 规模以上工业增加值 init_bar1() { this.barComponent1.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption1()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/scale.json', success: function (res) { let list = res.data.scale; let dateNum = []; let alloneBasis = []; for (let i = 0; i < list.length; i++) { for (let j = 1; j <= list[i].totalNum.length; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } let alloneBasisList = list[i].growth; for (let n = 0; n < alloneBasisList.length; n++) { alloneBasis.push(alloneBasisList[n]); } } barChart.setOption({ series: [{ data: alloneBasis }], xAxis: { data: dateNum } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 建筑业总产值 init_bar2() { this.barComponent2.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption2()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/construction.json', success: function (res) { let list = res.data.construction; let dateNum = []; let alloneBasis = []; let allData = []; for (let i = 0; i < list.length; i++) { for (let j = 1; j <= list[i].totalNum.length; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } let alloneBasisList = list[i].alloneBasis; for (let n = 0; n < alloneBasisList.length; n++) { alloneBasis.push(alloneBasisList[n]); } let totalNumList = list[i].totalNum; for (let k = 0; k < totalNumList.length; k++) { allData.push(totalNumList[k]); } } barChart.setOption({ series: [{ name: '同比增长(%)', type: 'line', data: alloneBasis, }, { name: '季度', type: 'bar', data: allData, tooltip: { valueFormatter: function (value) { return value + '万平方米'; } }, itemStyle: { normal: { color: function (params) { let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED']; let allColorList = []; for (let i = 0; i < dateNum.length; i++) { allColorList.push(colorList[i % 4]) } return allColorList[params.dataIndex]; } } }, } ], xAxis: { data: dateNum } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 固定资产投资总额 init_bar3() { this.barComponent3.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption1()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/fixedAssets.json', success: function (res) { let list = res.data.fixedAssets; let dateNum = []; let alloneBasis = []; for (let i = 0; i < list.length; i++) { for (let j = 1; j <= list[i].totalNum.length; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } let alloneBasisList = list[i].growth; for (let n = 0; n < alloneBasisList.length; n++) { alloneBasis.push(alloneBasisList[n]); } } barChart.setOption({ series: [{ data: alloneBasis }], xAxis: { data: dateNum } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 商品房建设与销售 init_bar4() { this.barComponent4.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption2()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/realtyMarket.json', success: function (res) { let list = res.data.market; let dateNum = []; let alloneBasis = []; let allData = []; for (let i = 0; i < list.length; i++) { for (let j = 1; j <= list[i].totalNum.length; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } let alloneBasisList = list[i].alloneBasis; for (let n = 0; n < alloneBasisList.length; n++) { alloneBasis.push(alloneBasisList[n]); } let totalNumList = list[i].totalNum; for (let k = 0; k < totalNumList.length; k++) { allData.push(totalNumList[k]); } } barChart.setOption({ series: [{ name: '同比增长(%)', type: 'line', data: alloneBasis, }, { name: '季度', type: 'bar', data: allData, itemStyle: { normal: { color: function (params) { let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED']; let allColorList = []; for (let i = 0; i < dateNum.length; i++) { allColorList.push(colorList[i % 4]) } return allColorList[params.dataIndex]; } } }, } ], xAxis: { data: dateNum }, yAxis: [{ type: 'value', axisLabel: { formatter: '{value}万平方米' } }, { type: 'value', axisLabel: { formatter: '{value}%' } }], grid: { left: '20%', right: '15%', bottom: '40%', top: '15%' } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 社会消费品零售总额 init_bar5() { this.barComponent5.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption2()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/inlandTrade.json', success: function (res) { let list = res.data.trade; let dateNum = []; let alloneBasis = []; let allData = []; for (let i = 0; i < list.length; i++) { for (let j = 1; j <= list[i].totalNum.length; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } let alloneBasisList = list[i].alloneBasis; for (let n = 0; n < alloneBasisList.length; n++) { alloneBasis.push(alloneBasisList[n]); } let totalNumList = list[i].totalNum; for (let k = 0; k < totalNumList.length; k++) { allData.push(totalNumList[k]); } } barChart.setOption({ series: [{ name: '同比增长(%)', type: 'line', data: alloneBasis, }, { name: '季度', type: 'bar', data: allData, itemStyle: { normal: { color: function (params) { let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED']; let allColorList = []; for (let i = 0; i < dateNum.length; i++) { allColorList.push(colorList[i % 4]) } return allColorList[params.dataIndex]; } } }, } ], xAxis: { data: dateNum } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 公共财政收入 init_bar6() { this.barComponent6.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption2()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/financial.json', success: function (res) { let list = res.data.financial; let dateNum = []; let alloneBasis = []; let quarter = []; // console.log("financial"); // console.log(list); // console.log(list.length); for (let i = 0; i < list.length; i++) { if (list[i].subData[0].data.firstThridQuarter) { for (let j = 1; j <= 4; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } } else { if (list[i].subData[0].data.firstSecondQuarter) { for (let j = 1; j <= 2; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } }else{ let str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } } } const name = list[0].subData[0].subName; for (let i = 0; i < list.length; i++) { const current = list[i].subData.find(item => item.subName === name).data; quarter.push(current.firstQuarter.totalQuarter); alloneBasis.push(current.firstQuarter.oneBasis); if (current.firstSecondQuarter) { quarter.push(current.firstSecondQuarter.totalQuarter); alloneBasis.push(current.firstSecondQuarter.oneBasis); } if (current.firstThridQuarter) { quarter.push(current.firstThridQuarter.totalQuarter); alloneBasis.push(current.firstThridQuarter.oneBasis); } if (current.firstFourQuarter) { quarter.push(current.firstFourQuarter.totalQuarter); alloneBasis.push(current.firstFourQuarter.oneBasis); } } barChart.setOption({ series: [{ name: '同比增长(%)', type: 'line', data: alloneBasis, }, { name: '季度', type: 'bar', data: quarter, itemStyle: { normal: { color: function (params) { let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED']; let allColorList = []; for (let i = 0; i < dateNum.length; i++) { allColorList.push(colorList[i % 4]) } return allColorList[params.dataIndex]; } } }, } ], xAxis: { data: dateNum } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 税收收入 init_bar7() { this.barComponent7.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption2()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/financial.json', success: function (res) { let list = res.data.financial; let dateNum = []; let alloneBasis = []; let quarter = []; for (let i = 0; i < list.length; i++) { if (list[i].subData[0].data.firstThridQuarter) { for (let j = 1; j <= 4; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } } else { if (list[i].subData[0].data.firstSecondQuarter) { for (let j = 1; j <= 2; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } }else{ let str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } } } const name = list[0].subData[1].subName; for (let i = 0; i < list.length; i++) { const current = list[i].subData.find(item => item.subName === name).data; quarter.push(current.firstQuarter.totalQuarter); alloneBasis.push(current.firstQuarter.oneBasis); if (current.firstSecondQuarter) { quarter.push(current.firstSecondQuarter.totalQuarter); alloneBasis.push(current.firstSecondQuarter.oneBasis); } if (current.firstThridQuarter) { quarter.push(current.firstThridQuarter.totalQuarter); alloneBasis.push(current.firstThridQuarter.oneBasis); } if (current.firstFourQuarter) { quarter.push(current.firstFourQuarter.totalQuarter); alloneBasis.push(current.firstFourQuarter.oneBasis); } } barChart.setOption({ series: [{ name: '同比增长(%)', type: 'line', data: alloneBasis, }, { name: '季度', type: 'bar', data: quarter, itemStyle: { normal: { color: function (params) { let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED']; let allColorList = []; for (let i = 0; i < dateNum.length; i++) { allColorList.push(colorList[i % 4]) } return allColorList[params.dataIndex]; } } }, } ], xAxis: { data: dateNum } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 公共财政支出 init_bar8() { this.barComponent8.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getScaOption2()); wx.request({ url: 'https://www.cqna.gov.cn/data/natj/json/financial.json', success: function (res) { let list = res.data.financial; let dateNum = []; let alloneBasis = []; let quarter = []; for (let i = 0; i < list.length; i++) { if (list[i].subData[0].data.firstThridQuarter) { for (let j = 1; j <= 4; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } } else { if (list[i].subData[0].data.firstSecondQuarter) { for (let j = 1; j <= 2; j++) { let str = ' '; if (j == 1) { str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } else { str = list[i].date + '年' + ' ' + '第1~' + j + '季度'; dateNum.push(str); } } }else{ let str = list[i].date + '年' + ' ' + '第1季度'; dateNum.push(str); } } } const name = list[0].subData[2].subName; for (let i = 0; i < list.length; i++) { const current = list[i].subData.find(item => item.subName === name).data; quarter.push(current.firstQuarter.totalQuarter); alloneBasis.push(current.firstQuarter.oneBasis); if (current.firstSecondQuarter) { quarter.push(current.firstSecondQuarter.totalQuarter); alloneBasis.push(current.firstSecondQuarter.oneBasis); } if (current.firstThridQuarter) { quarter.push(current.firstThridQuarter.totalQuarter); alloneBasis.push(current.firstThridQuarter.oneBasis); } if (current.firstFourQuarter) { quarter.push(current.firstFourQuarter.totalQuarter); alloneBasis.push(current.firstFourQuarter.oneBasis); } } barChart.setOption({ series: [{ name: '同比增长(%)', type: 'line', data: alloneBasis, }, { name: '季度', type: 'bar', data: quarter, itemStyle: { normal: { color: function (params) { let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED']; let allColorList = []; for (let i = 0; i < dateNum.length; i++) { allColorList.push(colorList[i % 4]) } return allColorList[params.dataIndex]; } } }, } ], xAxis: { data: dateNum } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 好差评图表 init_goodOrBad() { wx.request({ url: 'https://www.cqna.gov.cn/data//goodOrbad/getGoodOrBad?area=1', method: 'GET', success: res => { res = res.data; if (res.result === 'ok') { this.setData({ // 评价总量 evalutionNum: res.data.totalEvaluationNumber, // 评价总量 goodevalutionRate: res.data.goodEvaluationRate, // 评价总量 badevalutionNum: res.data.poorEvaluationNumber, // 评价总量 badevalutionRate: res.data.poorEvaluationRate }) } } }) // this.goodOrBad.init((canvas, width, height, dpr) => { // // 初始化图表 // const barChart = echarts.init(canvas, null, { // width: width, // height: height, // devicePixelRatio: dpr // }); // request({ // url: '/goodOrbad/getGoodOrBadByYearAndArea?area=1', // method: 'GET' // }).then(res => { // if (res.result === 'ok') { // let temp = []; // temp.push(res.data.veryDissatisfied); // temp.push(res.data.notSatisfied); // temp.push(res.data.basicSatisfied); // temp.push(res.data.satisfied); // temp.push(res.data.great); // // 计算最大值,以及分割值 // var maxValue = Math.max(...temp) // maxValue = parseInt(maxValue/10000 + 1) * 10000 // var interval = maxValue / 4 // barChart.setOption(this.getGoodOrBadOption(maxValue, interval)); // this.setData({ // evalutionNum: res.data.goodOrBad, // evalutionRate: Math.floor(res.data.good / res.data.goodOrBad * 100 * 100) / 100 // }) // barChart.setOption({ // series: [{ // data: temp // }] // }) // } // }) // // 注意这里一定要返回 chart 实例,否则会影响事件处理等 // return barChart; // }); }, // 近90天办理类别统计 init_processingCategory() { this.processingCategory.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getStatisticsOption()); request({ url: '/mail/queryToType?type=3', method: 'GET' }).then(res => { if (res.result) { barChart.setOption({ series: [{ data: res.data }], legend: { formatter: function (name) { let data = res.data let tarValue for (let i = 0; i < data.length; i++) { if (data[i].name == name) { tarValue = data[i].value } } let v = tarValue + ' 件' return `${name} ${v}` } } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 近90天公开信箱领域统计 init_publicMailbox() { this.publicMailbox.init((canvas, width, height, dpr) => { // 初始化图表 const barChart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr }); barChart.setOption(this.getStatisticsOption()); request({ url: '/mail/queryToType?type=2', method: 'GET' }).then(res => { if (res.result) { barChart.setOption({ series: [{ data: res.data }], legend: { formatter: function (name) { let data = res.data let tarValue for (let i = 0; i < data.length; i++) { if (data[i].name == name) { tarValue = data[i].value } } let v = tarValue + ' 件' return `${name} ${v}` } } }) } }) // 注意这里一定要返回 chart 实例,否则会影响事件处理等 return barChart; }); }, // 获取好差评图表 getGoodOrBadOption(maxValue, interval) { //请求数据 let xAxis = { type: 'value', splitNumber: 4, max: maxValue, interval: interval, axisLine: { show: true }, splitLine: { interval: 0 } }, yAxis = { axisTick: { show: false }, type: 'category', data: [ '非常不满意', '不满意', '基本满意', '满意', '非常满意' ] }, grid = { left: '20%', top: '5%', bottom: '20%', right: '20%' }, series = [{ data: [], type: 'bar', barWidth: 15, itemStyle: { normal: { barBorderRadius: [0, 7, 7, 0], color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ offset: 0, color: '#006BFD' }, { offset: 1, color: '#00E9F1' } ]), } }, label: { show: true, position: 'right', valueAnimation: true } }] return { backgroundColor: '#FFFFFF', xAxis: xAxis, yAxis: yAxis, grid: grid, series: series, animationDelay: function (idx) { return idx * 50; }, animationEasing: 'elasticOut' }; }, // 获取本年度公开信息办理图表 getStatisticsOption() { //请求数据 let legend = { top: 'middle', orient: 'vertical', right: '10%', itemHeight: 10, itemWidth: 10, // textStyle: { // fontSize: 20 // } }, tooltip = { trigger: 'item' }, series = [{ type: 'pie', left: '-40%', radius: ['40%', '60%'], label: { show: false, position: 'center' }, data: [] }] return { backgroundColor: '#FFFFFF', legend: legend, series: series, tooltip: tooltip, animationDelay: function (idx) { return idx * 50; }, animationEasing: 'elasticOut' }; }, // 获取本年办件数 getOfficeNumberByAreaInfo() { request({ url: '/department/getOfficeNumberByAreaInfo?area=1&timeType=3', method: 'GET' }).then(res => { let temp = []; temp.push(res.data.acceptNumber); temp.push(res.data.serialNumber); temp.push(res.data.applicationNumberNetwork); this.setData({ officeNumber: temp }) }) }, // 本年度公开信箱办理情况 queryLeaveAMessage() { request({ url: '/mail/queryLeaveAMessage', method: 'GET' }).then(res => { this.setData({ leaveAMessage: res.data }) }) }, // 南岸区政务服务事项总数 queryDepartmentItem() { request({ url: '/department/queryDepartmentItemRankByArea?area=1', method: 'GET' }).then(res => { this.setData({ matters: [0,0,0,1,3,5,5], mattersZero: 3 }) }) }, // 前往信箱统计 gotoXXTJ() { wx.navigateTo({ url: '/pages/dataCenterXXTJ/dataCenterXXTJ', }) }, // 前往政务统计 gotoZWTJ() { wx.navigateTo({ url: '/pages/dataCenterZWTJ/dataCenterZWTJ', }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { return { title: '数据中心' } }, gotogmsjzx(){ wx.navigateTo({ url: '../../pages/web/web?url=https://www.cqna.gov.cn/sjkf/#/dataSetM', }) }, /** * 用户点击右上角分享 */ onShareAppMessage() { return { title: '首页' } }, onShareTimeline(){ return { title: '首页' } } })