1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309 |
- // 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() {
- 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: (res.data.good / res.data.goodOrBad * 100).toFixed(2)
- })
- 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: res.data.conutNumbers,
- mattersZero: 7 - res.data.listTotal.conutNumber.toString().length
- })
- })
- },
- // 前往信箱统计
- gotoXXTJ() {
- wx.navigateTo({
- url: '/pages/dataCenterXXTJ/dataCenterXXTJ',
- })
- },
- // 前往政务统计
- gotoZWTJ() {
- wx.navigateTo({
- url: '/pages/dataCenterZWTJ/dataCenterZWTJ',
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- return {
- title: '数据中心'
- }
- }
- })
|