dataCenter.js 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  1. // pages/dataCenter/dataCenter.js
  2. import * as echarts from '../../ec-canvas/echarts';
  3. import {
  4. imgUrl
  5. } from "../api/request"
  6. const baseUrl = "https://www.cqna.gov.cn/data/"
  7. const request = (options) => {
  8. return new Promise((resolve, reject) => {
  9. options.url = baseUrl + options.url
  10. wx.request({
  11. // 配置 "wx.request" 请求参数
  12. ...options,
  13. header: {
  14. 'content-type': 'application/json;charset=UTF-8'
  15. },
  16. success: function (res) {
  17. // console.log("network-res=>", res);
  18. // 返回成功信息
  19. resolve(res.data)
  20. },
  21. fail: function (error) {
  22. // console.log("network-err=>", error);
  23. // 返回错误信息
  24. reject(error)
  25. }
  26. })
  27. })
  28. }
  29. Page({
  30. /**
  31. * 页面的初始数据
  32. */
  33. data: {
  34. // 图片前缀
  35. imgUrl: imgUrl,
  36. // 图表
  37. streetlinechartec: {
  38. lazyLoad: true,
  39. },
  40. // 国民经济统计数据选中
  41. currentTab: 0,
  42. // 国民经济统计数据
  43. statistics: [{
  44. title: 'GDP地区生产总值',
  45. name: 'streetlinechart'
  46. }, {
  47. title: '规模以上工业增加值',
  48. name: 'streetlinechart1'
  49. }, {
  50. title: '建筑业总产值',
  51. name: 'streetlinechart2'
  52. }, {
  53. title: '固定资产投资总额',
  54. name: 'streetlinechart3'
  55. }, {
  56. title: '商品房建设与销售',
  57. name: 'streetlinechart4'
  58. }, {
  59. title: '社会消费品零售总额',
  60. name: 'streetlinechart5'
  61. }, {
  62. title: '公共财政收入',
  63. name: 'streetlinechart6'
  64. }, {
  65. title: '税收收入',
  66. name: 'streetlinechart7'
  67. }, {
  68. title: '公共财政支出',
  69. name: 'streetlinechart8'
  70. }],
  71. // 本年办件数
  72. officeNumber: [],
  73. // 评价总量
  74. evalutionNum: 0,
  75. // 满意度
  76. evalutionRate: '',
  77. // 南岸区政务服务事项总数数据
  78. matters: [],
  79. // 南岸区政务服务事项总数数据零的数量
  80. mattersZero: 0,
  81. // 本年度公开信箱办理情况
  82. leaveAMessage: {}
  83. },
  84. // 切换国民经济统计数据
  85. tabNav(e) {
  86. let currentTab = e.currentTarget.dataset.index
  87. this.setData({
  88. currentTab
  89. })
  90. },
  91. // 切换国民经济统计数据
  92. handleSwiper(e) {
  93. let {
  94. current,
  95. source
  96. } = e.detail
  97. if (source === 'autoplay' || source === 'touch') {
  98. const currentTab = current
  99. this.setData({
  100. currentTab
  101. })
  102. }
  103. },
  104. catchTouchMove() {
  105. return true
  106. },
  107. /**
  108. * 生命周期函数--监听页面加载
  109. */
  110. onLoad(options) {
  111. // 加载字体
  112. // wx.loadFontFace({
  113. // family: 'DOUYU',
  114. // // source: 'url("https://hui.yrslm.com:8089/douyu.ttf")',
  115. // source: 'url("https://www.cqna.gov.cn/mnazw/applet/font/douyu.ttf")',
  116. // success: function (e) {
  117. // console.log(e, '动态加载字体成功')
  118. // },
  119. // fail: function (e) {
  120. // console.log(e, '动态加载字体失败')
  121. // },
  122. // })
  123. // GDP地区生产总值
  124. this.barComponent = this.selectComponent('#streetlinechart');
  125. this.init_bar();
  126. // 规模以上工业增加值
  127. this.barComponent1 = this.selectComponent('#streetlinechart1');
  128. this.init_bar1();
  129. // 建筑业总产值
  130. this.barComponent2 = this.selectComponent('#streetlinechart2');
  131. this.init_bar2();
  132. // 固定资产投资总额
  133. this.barComponent3 = this.selectComponent('#streetlinechart3');
  134. this.init_bar3();
  135. // 商品房建设与销售
  136. this.barComponent4 = this.selectComponent('#streetlinechart4');
  137. this.init_bar4();
  138. // 社会消费品零售总额
  139. this.barComponent5 = this.selectComponent('#streetlinechart5');
  140. this.init_bar5();
  141. // 公共财政收入
  142. this.barComponent6 = this.selectComponent('#streetlinechart6');
  143. this.init_bar6();
  144. // 税收收入
  145. this.barComponent7 = this.selectComponent('#streetlinechart7');
  146. this.init_bar7();
  147. // 公共财政支出
  148. this.barComponent8 = this.selectComponent('#streetlinechart8');
  149. this.init_bar8();
  150. // 好差评图表
  151. this.goodOrBad = this.selectComponent('#goodOrBad');
  152. this.init_goodOrBad();
  153. // 获取本年办件数
  154. this.getOfficeNumberByAreaInfo();
  155. // 本年度公开信箱办理情况
  156. this.queryLeaveAMessage();
  157. // 南岸区政务服务事项总数
  158. this.queryDepartmentItem();
  159. // 近90天办理类别统计
  160. this.processingCategory = this.selectComponent('#processingCategory');
  161. this.init_processingCategory();
  162. // 近90天公开信箱领域统计
  163. this.publicMailbox = this.selectComponent('#publicMailbox');
  164. this.init_publicMailbox();
  165. },
  166. // GDP地区生产总值/规模以上工业增加值/固定资产投资总额
  167. getScaOption1() {
  168. //请求数据
  169. let xAxis = {
  170. type: 'category',
  171. data: [],
  172. axisLabel: {
  173. rotate: 60
  174. }
  175. },
  176. yAxis = {
  177. type: 'value',
  178. axisLabel: {
  179. formatter: '{value}%'
  180. }
  181. },
  182. grid = {
  183. left: '10%',
  184. bottom: '40%',
  185. top: '15%'
  186. },
  187. dataZoom = [{
  188. type: 'inside',
  189. show: true,
  190. start: 0,
  191. end: 40,
  192. }],
  193. legend = {
  194. data: ['增速(%)']
  195. },
  196. series = [{
  197. name: '增速(%)',
  198. data: [],
  199. type: 'line',
  200. itemStyle: {
  201. normal: {
  202. color: '#FFA130',
  203. label: {
  204. show: true
  205. }
  206. }
  207. }
  208. }]
  209. return {
  210. backgroundColor: '#FFFFFF',
  211. xAxis: xAxis,
  212. yAxis: yAxis,
  213. grid: grid,
  214. dataZoom: dataZoom,
  215. legend: legend,
  216. series: series,
  217. animationDelay: function (idx) {
  218. return idx * 50;
  219. },
  220. animationEasing: 'elasticOut'
  221. };
  222. },
  223. // 建筑业总产值/商品房建设与销售/社会消费品零售总额/公共财政收入/税收收入/公共财政支出
  224. getScaOption2() {
  225. //请求数据
  226. let xAxis = {
  227. type: 'category',
  228. data: [],
  229. axisLabel: {
  230. rotate: 60
  231. }
  232. },
  233. tooltip = {
  234. trigger: 'axis'
  235. },
  236. yAxis = [{
  237. type: 'value',
  238. axisLabel: {
  239. formatter: '{value}万元'
  240. }
  241. }, {
  242. type: 'value',
  243. axisLabel: {
  244. formatter: '{value}%'
  245. }
  246. }],
  247. grid = {
  248. left: '22%',
  249. right: '15%',
  250. bottom: '40%',
  251. top: '15%'
  252. },
  253. legend = {
  254. data: ['季度', '同比增长(%)']
  255. },
  256. dataZoom = [{
  257. type: 'inside',
  258. show: true,
  259. start: 0,
  260. end: 40,
  261. }],
  262. series = [{
  263. name: '季度',
  264. type: 'bar',
  265. data: [],
  266. tooltip: {
  267. valueFormatter: function (value) {
  268. return value + '万元';
  269. }
  270. }
  271. }, {
  272. name: '同比增长(%)',
  273. type: 'line',
  274. data: [],
  275. yAxisIndex: 1,
  276. tooltip: {
  277. valueFormatter: function (value) {
  278. return value + '%';
  279. }
  280. },
  281. itemStyle: {
  282. normal: {
  283. color: '#FFA130',
  284. label: {
  285. show: true
  286. }
  287. }
  288. }
  289. }]
  290. return {
  291. backgroundColor: '#FFFFFF',
  292. xAxis: xAxis,
  293. yAxis: yAxis,
  294. grid: grid,
  295. dataZoom: dataZoom,
  296. tooltip: tooltip,
  297. legend: legend,
  298. series: series,
  299. animationDelay: function (idx) {
  300. return idx * 50;
  301. },
  302. animationEasing: 'elasticOut'
  303. };
  304. },
  305. // GDP地区生产总值
  306. init_bar() {
  307. this.barComponent.init((canvas, width, height, dpr) => {
  308. // 初始化图表
  309. const barChart = echarts.init(canvas, null, {
  310. width: width,
  311. height: height,
  312. devicePixelRatio: dpr
  313. });
  314. barChart.setOption(this.getScaOption1());
  315. wx.request({
  316. url: 'https://www.cqna.gov.cn/data/natj/json/jdp.json',
  317. success: function (res) {
  318. let list = res.data.GDP;
  319. let dateNum = [];
  320. let alloneBasis = [];
  321. for (let i = 0; i < list.length; i++) {
  322. for (let j = 1; j <= list[i].totalNum.length; j++) {
  323. let str = ' ';
  324. if (j == 1) {
  325. str = list[i].date + '年' + ' ' + '第1季度';
  326. dateNum.push(str);
  327. } else {
  328. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  329. dateNum.push(str);
  330. }
  331. }
  332. let alloneBasisList = list[i].growth;
  333. for (let n = 0; n < alloneBasisList.length; n++) {
  334. alloneBasis.push(alloneBasisList[n]);
  335. }
  336. }
  337. barChart.setOption({
  338. series: [{
  339. data: alloneBasis,
  340. name: '同比增长(%)',
  341. }],
  342. xAxis: {
  343. data: dateNum
  344. },
  345. legend: {
  346. data: ['同比增长(%)']
  347. },
  348. })
  349. }
  350. })
  351. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  352. return barChart;
  353. });
  354. },
  355. // 规模以上工业增加值
  356. init_bar1() {
  357. this.barComponent1.init((canvas, width, height, dpr) => {
  358. // 初始化图表
  359. const barChart = echarts.init(canvas, null, {
  360. width: width,
  361. height: height,
  362. devicePixelRatio: dpr
  363. });
  364. barChart.setOption(this.getScaOption1());
  365. wx.request({
  366. url: 'https://www.cqna.gov.cn/data/natj/json/scale.json',
  367. success: function (res) {
  368. let list = res.data.scale;
  369. let dateNum = [];
  370. let alloneBasis = [];
  371. for (let i = 0; i < list.length; i++) {
  372. for (let j = 1; j <= list[i].totalNum.length; j++) {
  373. let str = ' ';
  374. if (j == 1) {
  375. str = list[i].date + '年' + ' ' + '第1季度';
  376. dateNum.push(str);
  377. } else {
  378. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  379. dateNum.push(str);
  380. }
  381. }
  382. let alloneBasisList = list[i].growth;
  383. for (let n = 0; n < alloneBasisList.length; n++) {
  384. alloneBasis.push(alloneBasisList[n]);
  385. }
  386. }
  387. barChart.setOption({
  388. series: [{
  389. data: alloneBasis
  390. }],
  391. xAxis: {
  392. data: dateNum
  393. }
  394. })
  395. }
  396. })
  397. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  398. return barChart;
  399. });
  400. },
  401. // 建筑业总产值
  402. init_bar2() {
  403. this.barComponent2.init((canvas, width, height, dpr) => {
  404. // 初始化图表
  405. const barChart = echarts.init(canvas, null, {
  406. width: width,
  407. height: height,
  408. devicePixelRatio: dpr
  409. });
  410. barChart.setOption(this.getScaOption2());
  411. wx.request({
  412. url: 'https://www.cqna.gov.cn/data/natj/json/construction.json',
  413. success: function (res) {
  414. let list = res.data.construction;
  415. let dateNum = [];
  416. let alloneBasis = [];
  417. let allData = [];
  418. for (let i = 0; i < list.length; i++) {
  419. for (let j = 1; j <= list[i].totalNum.length; j++) {
  420. let str = ' ';
  421. if (j == 1) {
  422. str = list[i].date + '年' + ' ' + '第1季度';
  423. dateNum.push(str);
  424. } else {
  425. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  426. dateNum.push(str);
  427. }
  428. }
  429. let alloneBasisList = list[i].alloneBasis;
  430. for (let n = 0; n < alloneBasisList.length; n++) {
  431. alloneBasis.push(alloneBasisList[n]);
  432. }
  433. let totalNumList = list[i].totalNum;
  434. for (let k = 0; k < totalNumList.length; k++) {
  435. allData.push(totalNumList[k]);
  436. }
  437. }
  438. barChart.setOption({
  439. series: [{
  440. name: '同比增长(%)',
  441. type: 'line',
  442. data: alloneBasis,
  443. },
  444. {
  445. name: '季度',
  446. type: 'bar',
  447. data: allData,
  448. tooltip: {
  449. valueFormatter: function (value) {
  450. return value + '万平方米';
  451. }
  452. },
  453. itemStyle: {
  454. normal: {
  455. color: function (params) {
  456. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  457. let allColorList = [];
  458. for (let i = 0; i < dateNum.length; i++) {
  459. allColorList.push(colorList[i % 4])
  460. }
  461. return allColorList[params.dataIndex];
  462. }
  463. }
  464. },
  465. }
  466. ],
  467. xAxis: {
  468. data: dateNum
  469. }
  470. })
  471. }
  472. })
  473. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  474. return barChart;
  475. });
  476. },
  477. // 固定资产投资总额
  478. init_bar3() {
  479. this.barComponent3.init((canvas, width, height, dpr) => {
  480. // 初始化图表
  481. const barChart = echarts.init(canvas, null, {
  482. width: width,
  483. height: height,
  484. devicePixelRatio: dpr
  485. });
  486. barChart.setOption(this.getScaOption1());
  487. wx.request({
  488. url: 'https://www.cqna.gov.cn/data/natj/json/fixedAssets.json',
  489. success: function (res) {
  490. let list = res.data.fixedAssets;
  491. let dateNum = [];
  492. let alloneBasis = [];
  493. for (let i = 0; i < list.length; i++) {
  494. for (let j = 1; j <= list[i].totalNum.length; j++) {
  495. let str = ' ';
  496. if (j == 1) {
  497. str = list[i].date + '年' + ' ' + '第1季度';
  498. dateNum.push(str);
  499. } else {
  500. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  501. dateNum.push(str);
  502. }
  503. }
  504. let alloneBasisList = list[i].growth;
  505. for (let n = 0; n < alloneBasisList.length; n++) {
  506. alloneBasis.push(alloneBasisList[n]);
  507. }
  508. }
  509. barChart.setOption({
  510. series: [{
  511. data: alloneBasis
  512. }],
  513. xAxis: {
  514. data: dateNum
  515. }
  516. })
  517. }
  518. })
  519. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  520. return barChart;
  521. });
  522. },
  523. // 商品房建设与销售
  524. init_bar4() {
  525. this.barComponent4.init((canvas, width, height, dpr) => {
  526. // 初始化图表
  527. const barChart = echarts.init(canvas, null, {
  528. width: width,
  529. height: height,
  530. devicePixelRatio: dpr
  531. });
  532. barChart.setOption(this.getScaOption2());
  533. wx.request({
  534. url: 'https://www.cqna.gov.cn/data/natj/json/realtyMarket.json',
  535. success: function (res) {
  536. let list = res.data.market;
  537. let dateNum = [];
  538. let alloneBasis = [];
  539. let allData = [];
  540. for (let i = 0; i < list.length; i++) {
  541. for (let j = 1; j <= list[i].totalNum.length; j++) {
  542. let str = ' ';
  543. if (j == 1) {
  544. str = list[i].date + '年' + ' ' + '第1季度';
  545. dateNum.push(str);
  546. } else {
  547. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  548. dateNum.push(str);
  549. }
  550. }
  551. let alloneBasisList = list[i].alloneBasis;
  552. for (let n = 0; n < alloneBasisList.length; n++) {
  553. alloneBasis.push(alloneBasisList[n]);
  554. }
  555. let totalNumList = list[i].totalNum;
  556. for (let k = 0; k < totalNumList.length; k++) {
  557. allData.push(totalNumList[k]);
  558. }
  559. }
  560. barChart.setOption({
  561. series: [{
  562. name: '同比增长(%)',
  563. type: 'line',
  564. data: alloneBasis,
  565. },
  566. {
  567. name: '季度',
  568. type: 'bar',
  569. data: allData,
  570. itemStyle: {
  571. normal: {
  572. color: function (params) {
  573. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  574. let allColorList = [];
  575. for (let i = 0; i < dateNum.length; i++) {
  576. allColorList.push(colorList[i % 4])
  577. }
  578. return allColorList[params.dataIndex];
  579. }
  580. }
  581. },
  582. }
  583. ],
  584. xAxis: {
  585. data: dateNum
  586. },
  587. yAxis: [{
  588. type: 'value',
  589. axisLabel: {
  590. formatter: '{value}万平方米'
  591. }
  592. }, {
  593. type: 'value',
  594. axisLabel: {
  595. formatter: '{value}%'
  596. }
  597. }],
  598. grid: {
  599. left: '20%',
  600. right: '15%',
  601. bottom: '40%',
  602. top: '15%'
  603. }
  604. })
  605. }
  606. })
  607. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  608. return barChart;
  609. });
  610. },
  611. // 社会消费品零售总额
  612. init_bar5() {
  613. this.barComponent5.init((canvas, width, height, dpr) => {
  614. // 初始化图表
  615. const barChart = echarts.init(canvas, null, {
  616. width: width,
  617. height: height,
  618. devicePixelRatio: dpr
  619. });
  620. barChart.setOption(this.getScaOption2());
  621. wx.request({
  622. url: 'https://www.cqna.gov.cn/data/natj/json/inlandTrade.json',
  623. success: function (res) {
  624. let list = res.data.trade;
  625. let dateNum = [];
  626. let alloneBasis = [];
  627. let allData = [];
  628. for (let i = 0; i < list.length; i++) {
  629. for (let j = 1; j <= list[i].totalNum.length; j++) {
  630. let str = ' ';
  631. if (j == 1) {
  632. str = list[i].date + '年' + ' ' + '第1季度';
  633. dateNum.push(str);
  634. } else {
  635. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  636. dateNum.push(str);
  637. }
  638. }
  639. let alloneBasisList = list[i].alloneBasis;
  640. for (let n = 0; n < alloneBasisList.length; n++) {
  641. alloneBasis.push(alloneBasisList[n]);
  642. }
  643. let totalNumList = list[i].totalNum;
  644. for (let k = 0; k < totalNumList.length; k++) {
  645. allData.push(totalNumList[k]);
  646. }
  647. }
  648. barChart.setOption({
  649. series: [{
  650. name: '同比增长(%)',
  651. type: 'line',
  652. data: alloneBasis,
  653. },
  654. {
  655. name: '季度',
  656. type: 'bar',
  657. data: allData,
  658. itemStyle: {
  659. normal: {
  660. color: function (params) {
  661. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  662. let allColorList = [];
  663. for (let i = 0; i < dateNum.length; i++) {
  664. allColorList.push(colorList[i % 4])
  665. }
  666. return allColorList[params.dataIndex];
  667. }
  668. }
  669. },
  670. }
  671. ],
  672. xAxis: {
  673. data: dateNum
  674. }
  675. })
  676. }
  677. })
  678. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  679. return barChart;
  680. });
  681. },
  682. // 公共财政收入
  683. init_bar6() {
  684. this.barComponent6.init((canvas, width, height, dpr) => {
  685. // 初始化图表
  686. const barChart = echarts.init(canvas, null, {
  687. width: width,
  688. height: height,
  689. devicePixelRatio: dpr
  690. });
  691. barChart.setOption(this.getScaOption2());
  692. wx.request({
  693. url: 'https://www.cqna.gov.cn/data/natj/json/financial.json',
  694. success: function (res) {
  695. let list = res.data.financial;
  696. let dateNum = [];
  697. let alloneBasis = [];
  698. let quarter = [];
  699. // console.log("financial");
  700. // console.log(list);
  701. // console.log(list.length);
  702. for (let i = 0; i < list.length; i++) {
  703. if (list[i].subData[0].data.firstThridQuarter) {
  704. for (let j = 1; j <= 4; j++) {
  705. let str = ' ';
  706. if (j == 1) {
  707. str = list[i].date + '年' + ' ' + '第1季度';
  708. dateNum.push(str);
  709. } else {
  710. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  711. dateNum.push(str);
  712. }
  713. }
  714. } else {
  715. if (list[i].subData[0].data.firstSecondQuarter) {
  716. for (let j = 1; j <= 2; j++) {
  717. let str = ' ';
  718. if (j == 1) {
  719. str = list[i].date + '年' + ' ' + '第1季度';
  720. dateNum.push(str);
  721. } else {
  722. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  723. dateNum.push(str);
  724. }
  725. }
  726. }else{
  727. let str = list[i].date + '年' + ' ' + '第1季度';
  728. dateNum.push(str);
  729. }
  730. }
  731. }
  732. const name = list[0].subData[0].subName;
  733. for (let i = 0; i < list.length; i++) {
  734. const current = list[i].subData.find(item => item.subName === name).data;
  735. quarter.push(current.firstQuarter.totalQuarter);
  736. alloneBasis.push(current.firstQuarter.oneBasis);
  737. if (current.firstSecondQuarter) {
  738. quarter.push(current.firstSecondQuarter.totalQuarter);
  739. alloneBasis.push(current.firstSecondQuarter.oneBasis);
  740. }
  741. if (current.firstThridQuarter) {
  742. quarter.push(current.firstThridQuarter.totalQuarter);
  743. alloneBasis.push(current.firstThridQuarter.oneBasis);
  744. }
  745. if (current.firstFourQuarter) {
  746. quarter.push(current.firstFourQuarter.totalQuarter);
  747. alloneBasis.push(current.firstFourQuarter.oneBasis);
  748. }
  749. }
  750. barChart.setOption({
  751. series: [{
  752. name: '同比增长(%)',
  753. type: 'line',
  754. data: alloneBasis,
  755. },
  756. {
  757. name: '季度',
  758. type: 'bar',
  759. data: quarter,
  760. itemStyle: {
  761. normal: {
  762. color: function (params) {
  763. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  764. let allColorList = [];
  765. for (let i = 0; i < dateNum.length; i++) {
  766. allColorList.push(colorList[i % 4])
  767. }
  768. return allColorList[params.dataIndex];
  769. }
  770. }
  771. },
  772. }
  773. ],
  774. xAxis: {
  775. data: dateNum
  776. }
  777. })
  778. }
  779. })
  780. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  781. return barChart;
  782. });
  783. },
  784. // 税收收入
  785. init_bar7() {
  786. this.barComponent7.init((canvas, width, height, dpr) => {
  787. // 初始化图表
  788. const barChart = echarts.init(canvas, null, {
  789. width: width,
  790. height: height,
  791. devicePixelRatio: dpr
  792. });
  793. barChart.setOption(this.getScaOption2());
  794. wx.request({
  795. url: 'https://www.cqna.gov.cn/data/natj/json/financial.json',
  796. success: function (res) {
  797. let list = res.data.financial;
  798. let dateNum = [];
  799. let alloneBasis = [];
  800. let quarter = [];
  801. for (let i = 0; i < list.length; i++) {
  802. if (list[i].subData[0].data.firstThridQuarter) {
  803. for (let j = 1; j <= 4; j++) {
  804. let str = ' ';
  805. if (j == 1) {
  806. str = list[i].date + '年' + ' ' + '第1季度';
  807. dateNum.push(str);
  808. } else {
  809. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  810. dateNum.push(str);
  811. }
  812. }
  813. } else {
  814. if (list[i].subData[0].data.firstSecondQuarter) {
  815. for (let j = 1; j <= 2; j++) {
  816. let str = ' ';
  817. if (j == 1) {
  818. str = list[i].date + '年' + ' ' + '第1季度';
  819. dateNum.push(str);
  820. } else {
  821. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  822. dateNum.push(str);
  823. }
  824. }
  825. }else{
  826. let str = list[i].date + '年' + ' ' + '第1季度';
  827. dateNum.push(str);
  828. }
  829. }
  830. }
  831. const name = list[0].subData[1].subName;
  832. for (let i = 0; i < list.length; i++) {
  833. const current = list[i].subData.find(item => item.subName === name).data;
  834. quarter.push(current.firstQuarter.totalQuarter);
  835. alloneBasis.push(current.firstQuarter.oneBasis);
  836. if (current.firstSecondQuarter) {
  837. quarter.push(current.firstSecondQuarter.totalQuarter);
  838. alloneBasis.push(current.firstSecondQuarter.oneBasis);
  839. }
  840. if (current.firstThridQuarter) {
  841. quarter.push(current.firstThridQuarter.totalQuarter);
  842. alloneBasis.push(current.firstThridQuarter.oneBasis);
  843. }
  844. if (current.firstFourQuarter) {
  845. quarter.push(current.firstFourQuarter.totalQuarter);
  846. alloneBasis.push(current.firstFourQuarter.oneBasis);
  847. }
  848. }
  849. barChart.setOption({
  850. series: [{
  851. name: '同比增长(%)',
  852. type: 'line',
  853. data: alloneBasis,
  854. },
  855. {
  856. name: '季度',
  857. type: 'bar',
  858. data: quarter,
  859. itemStyle: {
  860. normal: {
  861. color: function (params) {
  862. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  863. let allColorList = [];
  864. for (let i = 0; i < dateNum.length; i++) {
  865. allColorList.push(colorList[i % 4])
  866. }
  867. return allColorList[params.dataIndex];
  868. }
  869. }
  870. },
  871. }
  872. ],
  873. xAxis: {
  874. data: dateNum
  875. }
  876. })
  877. }
  878. })
  879. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  880. return barChart;
  881. });
  882. },
  883. // 公共财政支出
  884. init_bar8() {
  885. this.barComponent8.init((canvas, width, height, dpr) => {
  886. // 初始化图表
  887. const barChart = echarts.init(canvas, null, {
  888. width: width,
  889. height: height,
  890. devicePixelRatio: dpr
  891. });
  892. barChart.setOption(this.getScaOption2());
  893. wx.request({
  894. url: 'https://www.cqna.gov.cn/data/natj/json/financial.json',
  895. success: function (res) {
  896. let list = res.data.financial;
  897. let dateNum = [];
  898. let alloneBasis = [];
  899. let quarter = [];
  900. for (let i = 0; i < list.length; i++) {
  901. if (list[i].subData[0].data.firstThridQuarter) {
  902. for (let j = 1; j <= 4; j++) {
  903. let str = ' ';
  904. if (j == 1) {
  905. str = list[i].date + '年' + ' ' + '第1季度';
  906. dateNum.push(str);
  907. } else {
  908. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  909. dateNum.push(str);
  910. }
  911. }
  912. } else {
  913. if (list[i].subData[0].data.firstSecondQuarter) {
  914. for (let j = 1; j <= 2; j++) {
  915. let str = ' ';
  916. if (j == 1) {
  917. str = list[i].date + '年' + ' ' + '第1季度';
  918. dateNum.push(str);
  919. } else {
  920. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  921. dateNum.push(str);
  922. }
  923. }
  924. }else{
  925. let str = list[i].date + '年' + ' ' + '第1季度';
  926. dateNum.push(str);
  927. }
  928. }
  929. }
  930. const name = list[0].subData[2].subName;
  931. for (let i = 0; i < list.length; i++) {
  932. const current = list[i].subData.find(item => item.subName === name).data;
  933. quarter.push(current.firstQuarter.totalQuarter);
  934. alloneBasis.push(current.firstQuarter.oneBasis);
  935. if (current.firstSecondQuarter) {
  936. quarter.push(current.firstSecondQuarter.totalQuarter);
  937. alloneBasis.push(current.firstSecondQuarter.oneBasis);
  938. }
  939. if (current.firstThridQuarter) {
  940. quarter.push(current.firstThridQuarter.totalQuarter);
  941. alloneBasis.push(current.firstThridQuarter.oneBasis);
  942. }
  943. if (current.firstFourQuarter) {
  944. quarter.push(current.firstFourQuarter.totalQuarter);
  945. alloneBasis.push(current.firstFourQuarter.oneBasis);
  946. }
  947. }
  948. barChart.setOption({
  949. series: [{
  950. name: '同比增长(%)',
  951. type: 'line',
  952. data: alloneBasis,
  953. },
  954. {
  955. name: '季度',
  956. type: 'bar',
  957. data: quarter,
  958. itemStyle: {
  959. normal: {
  960. color: function (params) {
  961. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  962. let allColorList = [];
  963. for (let i = 0; i < dateNum.length; i++) {
  964. allColorList.push(colorList[i % 4])
  965. }
  966. return allColorList[params.dataIndex];
  967. }
  968. }
  969. },
  970. }
  971. ],
  972. xAxis: {
  973. data: dateNum
  974. }
  975. })
  976. }
  977. })
  978. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  979. return barChart;
  980. });
  981. },
  982. // 好差评图表
  983. init_goodOrBad() {
  984. this.goodOrBad.init((canvas, width, height, dpr) => {
  985. // 初始化图表
  986. const barChart = echarts.init(canvas, null, {
  987. width: width,
  988. height: height,
  989. devicePixelRatio: dpr
  990. });
  991. request({
  992. url: '/goodOrbad/getGoodOrBadByYearAndArea?area=1',
  993. method: 'GET'
  994. }).then(res => {
  995. if (res.result === 'ok') {
  996. let temp = [];
  997. temp.push(res.data.veryDissatisfied);
  998. temp.push(res.data.notSatisfied);
  999. temp.push(res.data.basicSatisfied);
  1000. temp.push(res.data.satisfied);
  1001. temp.push(res.data.great);
  1002. // 计算最大值,以及分割值
  1003. var maxValue = Math.max(...temp)
  1004. maxValue = parseInt(maxValue/10000 + 1) * 10000
  1005. var interval = maxValue / 4
  1006. barChart.setOption(this.getGoodOrBadOption(maxValue, interval));
  1007. this.setData({
  1008. evalutionNum: res.data.goodOrBad,
  1009. evalutionRate: (res.data.good / res.data.goodOrBad * 100).toFixed(2)
  1010. })
  1011. barChart.setOption({
  1012. series: [{
  1013. data: temp
  1014. }]
  1015. })
  1016. }
  1017. })
  1018. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  1019. return barChart;
  1020. });
  1021. },
  1022. // 近90天办理类别统计
  1023. init_processingCategory() {
  1024. this.processingCategory.init((canvas, width, height, dpr) => {
  1025. // 初始化图表
  1026. const barChart = echarts.init(canvas, null, {
  1027. width: width,
  1028. height: height,
  1029. devicePixelRatio: dpr
  1030. });
  1031. barChart.setOption(this.getStatisticsOption());
  1032. request({
  1033. url: '/mail/queryToType?type=3',
  1034. method: 'GET'
  1035. }).then(res => {
  1036. if (res.result) {
  1037. barChart.setOption({
  1038. series: [{
  1039. data: res.data
  1040. }],
  1041. legend: {
  1042. formatter: function (name) {
  1043. let data = res.data
  1044. let tarValue
  1045. for (let i = 0; i < data.length; i++) {
  1046. if (data[i].name == name) {
  1047. tarValue = data[i].value
  1048. }
  1049. }
  1050. let v = tarValue + ' 件'
  1051. return `${name} ${v}`
  1052. }
  1053. }
  1054. })
  1055. }
  1056. })
  1057. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  1058. return barChart;
  1059. });
  1060. },
  1061. // 近90天公开信箱领域统计
  1062. init_publicMailbox() {
  1063. this.publicMailbox.init((canvas, width, height, dpr) => {
  1064. // 初始化图表
  1065. const barChart = echarts.init(canvas, null, {
  1066. width: width,
  1067. height: height,
  1068. devicePixelRatio: dpr
  1069. });
  1070. barChart.setOption(this.getStatisticsOption());
  1071. request({
  1072. url: '/mail/queryToType?type=2',
  1073. method: 'GET'
  1074. }).then(res => {
  1075. if (res.result) {
  1076. barChart.setOption({
  1077. series: [{
  1078. data: res.data
  1079. }],
  1080. legend: {
  1081. formatter: function (name) {
  1082. let data = res.data
  1083. let tarValue
  1084. for (let i = 0; i < data.length; i++) {
  1085. if (data[i].name == name) {
  1086. tarValue = data[i].value
  1087. }
  1088. }
  1089. let v = tarValue + ' 件'
  1090. return `${name} ${v}`
  1091. }
  1092. }
  1093. })
  1094. }
  1095. })
  1096. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  1097. return barChart;
  1098. });
  1099. },
  1100. // 获取好差评图表
  1101. getGoodOrBadOption(maxValue, interval) {
  1102. //请求数据
  1103. let xAxis = {
  1104. type: 'value',
  1105. splitNumber: 4,
  1106. max: maxValue,
  1107. interval: interval,
  1108. axisLine: {
  1109. show: true
  1110. },
  1111. splitLine: {
  1112. interval: 0
  1113. }
  1114. },
  1115. yAxis = {
  1116. axisTick: {
  1117. show: false
  1118. },
  1119. type: 'category',
  1120. data: [
  1121. '非常不满意', '不满意', '基本满意', '满意', '非常满意'
  1122. ]
  1123. },
  1124. grid = {
  1125. left: '20%',
  1126. top: '5%',
  1127. bottom: '20%',
  1128. right: '20%'
  1129. },
  1130. series = [{
  1131. data: [],
  1132. type: 'bar',
  1133. barWidth: 15,
  1134. itemStyle: {
  1135. normal: {
  1136. barBorderRadius: [0, 7, 7, 0],
  1137. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
  1138. offset: 0,
  1139. color: '#006BFD'
  1140. },
  1141. {
  1142. offset: 1,
  1143. color: '#00E9F1'
  1144. }
  1145. ]),
  1146. }
  1147. },
  1148. label: {
  1149. show: true,
  1150. position: 'right',
  1151. valueAnimation: true
  1152. }
  1153. }]
  1154. return {
  1155. backgroundColor: '#FFFFFF',
  1156. xAxis: xAxis,
  1157. yAxis: yAxis,
  1158. grid: grid,
  1159. series: series,
  1160. animationDelay: function (idx) {
  1161. return idx * 50;
  1162. },
  1163. animationEasing: 'elasticOut'
  1164. };
  1165. },
  1166. // 获取本年度公开信息办理图表
  1167. getStatisticsOption() {
  1168. //请求数据
  1169. let legend = {
  1170. top: 'middle',
  1171. orient: 'vertical',
  1172. right: '10%',
  1173. itemHeight: 10,
  1174. itemWidth: 10,
  1175. // textStyle: {
  1176. // fontSize: 20
  1177. // }
  1178. },
  1179. tooltip = {
  1180. trigger: 'item'
  1181. },
  1182. series = [{
  1183. type: 'pie',
  1184. left: '-40%',
  1185. radius: ['40%', '60%'],
  1186. label: {
  1187. show: false,
  1188. position: 'center'
  1189. },
  1190. data: []
  1191. }]
  1192. return {
  1193. backgroundColor: '#FFFFFF',
  1194. legend: legend,
  1195. series: series,
  1196. tooltip: tooltip,
  1197. animationDelay: function (idx) {
  1198. return idx * 50;
  1199. },
  1200. animationEasing: 'elasticOut'
  1201. };
  1202. },
  1203. // 获取本年办件数
  1204. getOfficeNumberByAreaInfo() {
  1205. request({
  1206. url: '/department/getOfficeNumberByAreaInfo?area=1&timeType=3',
  1207. method: 'GET'
  1208. }).then(res => {
  1209. let temp = [];
  1210. temp.push(res.data.acceptNumber);
  1211. temp.push(res.data.serialNumber);
  1212. temp.push(res.data.applicationNumberNetwork);
  1213. this.setData({
  1214. officeNumber: temp
  1215. })
  1216. })
  1217. },
  1218. // 本年度公开信箱办理情况
  1219. queryLeaveAMessage() {
  1220. request({
  1221. url: '/mail/queryLeaveAMessage',
  1222. method: 'GET'
  1223. }).then(res => {
  1224. this.setData({
  1225. leaveAMessage: res.data
  1226. })
  1227. })
  1228. },
  1229. // 南岸区政务服务事项总数
  1230. queryDepartmentItem() {
  1231. request({
  1232. url: '/department/queryDepartmentItemRankByArea?area=1',
  1233. method: 'GET'
  1234. }).then(res => {
  1235. this.setData({
  1236. matters: res.data.conutNumbers,
  1237. mattersZero: 7 - res.data.listTotal.conutNumber.toString().length
  1238. })
  1239. })
  1240. },
  1241. // 前往信箱统计
  1242. gotoXXTJ() {
  1243. wx.navigateTo({
  1244. url: '/pages/dataCenterXXTJ/dataCenterXXTJ',
  1245. })
  1246. },
  1247. // 前往政务统计
  1248. gotoZWTJ() {
  1249. wx.navigateTo({
  1250. url: '/pages/dataCenterZWTJ/dataCenterZWTJ',
  1251. })
  1252. },
  1253. /**
  1254. * 生命周期函数--监听页面初次渲染完成
  1255. */
  1256. onReady() {
  1257. },
  1258. /**
  1259. * 生命周期函数--监听页面显示
  1260. */
  1261. onShow() {
  1262. },
  1263. /**
  1264. * 生命周期函数--监听页面隐藏
  1265. */
  1266. onHide() {
  1267. },
  1268. /**
  1269. * 生命周期函数--监听页面卸载
  1270. */
  1271. onUnload() {
  1272. },
  1273. /**
  1274. * 页面相关事件处理函数--监听用户下拉动作
  1275. */
  1276. onPullDownRefresh() {
  1277. },
  1278. /**
  1279. * 页面上拉触底事件的处理函数
  1280. */
  1281. onReachBottom() {
  1282. },
  1283. /**
  1284. * 用户点击右上角分享
  1285. */
  1286. onShareAppMessage() {
  1287. return {
  1288. title: '数据中心'
  1289. }
  1290. }
  1291. })