12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349 |
- // 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: '首页'
- }
- }
- })
|