dataCenter.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290
  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. for (let i = 0; i < list.length; i++) {
  700. if (list[i].subData[0].data.firstThridQuarter) {
  701. for (let j = 1; j <= 4; j++) {
  702. let str = ' ';
  703. if (j == 1) {
  704. str = list[i].date + '年' + ' ' + '第1季度';
  705. dateNum.push(str);
  706. } else {
  707. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  708. dateNum.push(str);
  709. }
  710. }
  711. } else {
  712. for (let j = 1; j <= 2; j++) {
  713. let str = ' ';
  714. if (j == 1) {
  715. str = list[i].date + '年' + ' ' + '第1季度';
  716. dateNum.push(str);
  717. } else {
  718. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  719. dateNum.push(str);
  720. }
  721. }
  722. }
  723. }
  724. const name = list[0].subData[0].subName;
  725. for (let i = 0; i < list.length; i++) {
  726. const current = list[i].subData.find(item => item.subName === name).data;
  727. quarter.push(current.firstQuarter.totalQuarter);
  728. alloneBasis.push(current.firstQuarter.oneBasis);
  729. if (current.firstSecondQuarter) {
  730. quarter.push(current.firstSecondQuarter.totalQuarter);
  731. alloneBasis.push(current.firstSecondQuarter.oneBasis);
  732. }
  733. if (current.firstThridQuarter) {
  734. quarter.push(current.firstThridQuarter.totalQuarter);
  735. alloneBasis.push(current.firstThridQuarter.oneBasis);
  736. }
  737. if (current.firstFourQuarter) {
  738. quarter.push(current.firstFourQuarter.totalQuarter);
  739. alloneBasis.push(current.firstFourQuarter.oneBasis);
  740. }
  741. }
  742. barChart.setOption({
  743. series: [{
  744. name: '同比增长(%)',
  745. type: 'line',
  746. data: alloneBasis,
  747. },
  748. {
  749. name: '季度',
  750. type: 'bar',
  751. data: quarter,
  752. itemStyle: {
  753. normal: {
  754. color: function (params) {
  755. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  756. let allColorList = [];
  757. for (let i = 0; i < dateNum.length; i++) {
  758. allColorList.push(colorList[i % 4])
  759. }
  760. return allColorList[params.dataIndex];
  761. }
  762. }
  763. },
  764. }
  765. ],
  766. xAxis: {
  767. data: dateNum
  768. }
  769. })
  770. }
  771. })
  772. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  773. return barChart;
  774. });
  775. },
  776. // 税收收入
  777. init_bar7() {
  778. this.barComponent7.init((canvas, width, height, dpr) => {
  779. // 初始化图表
  780. const barChart = echarts.init(canvas, null, {
  781. width: width,
  782. height: height,
  783. devicePixelRatio: dpr
  784. });
  785. barChart.setOption(this.getScaOption2());
  786. wx.request({
  787. url: 'https://www.cqna.gov.cn/data/natj/json/financial.json',
  788. success: function (res) {
  789. let list = res.data.financial;
  790. let dateNum = [];
  791. let alloneBasis = [];
  792. let quarter = [];
  793. for (let i = 0; i < list.length; i++) {
  794. if (list[i].subData[0].data.firstThridQuarter) {
  795. for (let j = 1; j <= 4; j++) {
  796. let str = ' ';
  797. if (j == 1) {
  798. str = list[i].date + '年' + ' ' + '第1季度';
  799. dateNum.push(str);
  800. } else {
  801. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  802. dateNum.push(str);
  803. }
  804. }
  805. } else {
  806. for (let j = 1; j <= 2; j++) {
  807. let str = ' ';
  808. if (j == 1) {
  809. str = list[i].date + '年' + ' ' + '第1季度';
  810. dateNum.push(str);
  811. } else {
  812. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  813. dateNum.push(str);
  814. }
  815. }
  816. }
  817. }
  818. const name = list[0].subData[1].subName;
  819. for (let i = 0; i < list.length; i++) {
  820. const current = list[i].subData.find(item => item.subName === name).data;
  821. quarter.push(current.firstQuarter.totalQuarter);
  822. alloneBasis.push(current.firstQuarter.oneBasis);
  823. if (current.firstSecondQuarter) {
  824. quarter.push(current.firstSecondQuarter.totalQuarter);
  825. alloneBasis.push(current.firstSecondQuarter.oneBasis);
  826. }
  827. if (current.firstThridQuarter) {
  828. quarter.push(current.firstThridQuarter.totalQuarter);
  829. alloneBasis.push(current.firstThridQuarter.oneBasis);
  830. }
  831. if (current.firstFourQuarter) {
  832. quarter.push(current.firstFourQuarter.totalQuarter);
  833. alloneBasis.push(current.firstFourQuarter.oneBasis);
  834. }
  835. }
  836. barChart.setOption({
  837. series: [{
  838. name: '同比增长(%)',
  839. type: 'line',
  840. data: alloneBasis,
  841. },
  842. {
  843. name: '季度',
  844. type: 'bar',
  845. data: quarter,
  846. itemStyle: {
  847. normal: {
  848. color: function (params) {
  849. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  850. let allColorList = [];
  851. for (let i = 0; i < dateNum.length; i++) {
  852. allColorList.push(colorList[i % 4])
  853. }
  854. return allColorList[params.dataIndex];
  855. }
  856. }
  857. },
  858. }
  859. ],
  860. xAxis: {
  861. data: dateNum
  862. }
  863. })
  864. }
  865. })
  866. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  867. return barChart;
  868. });
  869. },
  870. // 公共财政支出
  871. init_bar8() {
  872. this.barComponent8.init((canvas, width, height, dpr) => {
  873. // 初始化图表
  874. const barChart = echarts.init(canvas, null, {
  875. width: width,
  876. height: height,
  877. devicePixelRatio: dpr
  878. });
  879. barChart.setOption(this.getScaOption2());
  880. wx.request({
  881. url: 'https://www.cqna.gov.cn/data/natj/json/financial.json',
  882. success: function (res) {
  883. let list = res.data.financial;
  884. let dateNum = [];
  885. let alloneBasis = [];
  886. let quarter = [];
  887. for (let i = 0; i < list.length; i++) {
  888. if (list[i].subData[0].data.firstThridQuarter) {
  889. for (let j = 1; j <= 4; j++) {
  890. let str = ' ';
  891. if (j == 1) {
  892. str = list[i].date + '年' + ' ' + '第1季度';
  893. dateNum.push(str);
  894. } else {
  895. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  896. dateNum.push(str);
  897. }
  898. }
  899. } else {
  900. for (let j = 1; j <= 2; j++) {
  901. let str = ' ';
  902. if (j == 1) {
  903. str = list[i].date + '年' + ' ' + '第1季度';
  904. dateNum.push(str);
  905. } else {
  906. str = list[i].date + '年' + ' ' + '第1~' + j + '季度';
  907. dateNum.push(str);
  908. }
  909. }
  910. }
  911. }
  912. const name = list[0].subData[2].subName;
  913. for (let i = 0; i < list.length; i++) {
  914. const current = list[i].subData.find(item => item.subName === name).data;
  915. quarter.push(current.firstQuarter.totalQuarter);
  916. alloneBasis.push(current.firstQuarter.oneBasis);
  917. if (current.firstSecondQuarter) {
  918. quarter.push(current.firstSecondQuarter.totalQuarter);
  919. alloneBasis.push(current.firstSecondQuarter.oneBasis);
  920. }
  921. if (current.firstThridQuarter) {
  922. quarter.push(current.firstThridQuarter.totalQuarter);
  923. alloneBasis.push(current.firstThridQuarter.oneBasis);
  924. }
  925. if (current.firstFourQuarter) {
  926. quarter.push(current.firstFourQuarter.totalQuarter);
  927. alloneBasis.push(current.firstFourQuarter.oneBasis);
  928. }
  929. }
  930. barChart.setOption({
  931. series: [{
  932. name: '同比增长(%)',
  933. type: 'line',
  934. data: alloneBasis,
  935. },
  936. {
  937. name: '季度',
  938. type: 'bar',
  939. data: quarter,
  940. itemStyle: {
  941. normal: {
  942. color: function (params) {
  943. let colorList = ['#93BEF9', '#6AA3F3', '#448BEE', '#2A7BED'];
  944. let allColorList = [];
  945. for (let i = 0; i < dateNum.length; i++) {
  946. allColorList.push(colorList[i % 4])
  947. }
  948. return allColorList[params.dataIndex];
  949. }
  950. }
  951. },
  952. }
  953. ],
  954. xAxis: {
  955. data: dateNum
  956. }
  957. })
  958. }
  959. })
  960. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  961. return barChart;
  962. });
  963. },
  964. // 好差评图表
  965. init_goodOrBad() {
  966. this.goodOrBad.init((canvas, width, height, dpr) => {
  967. // 初始化图表
  968. const barChart = echarts.init(canvas, null, {
  969. width: width,
  970. height: height,
  971. devicePixelRatio: dpr
  972. });
  973. request({
  974. url: '/goodOrbad/getGoodOrBadByYearAndArea?area=1',
  975. method: 'GET'
  976. }).then(res => {
  977. if (res.result === 'ok') {
  978. let temp = [];
  979. temp.push(res.data.veryDissatisfied);
  980. temp.push(res.data.notSatisfied);
  981. temp.push(res.data.basicSatisfied);
  982. temp.push(res.data.satisfied);
  983. temp.push(res.data.great);
  984. // 计算最大值,以及分割值
  985. var maxValue = Math.max(...temp)
  986. maxValue = parseInt(maxValue/10000 + 1) * 10000
  987. var interval = maxValue / 4
  988. barChart.setOption(this.getGoodOrBadOption(maxValue, interval));
  989. this.setData({
  990. evalutionNum: res.data.goodOrBad,
  991. evalutionRate: (res.data.good / res.data.goodOrBad * 100).toFixed(2)
  992. })
  993. barChart.setOption({
  994. series: [{
  995. data: temp
  996. }]
  997. })
  998. }
  999. })
  1000. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  1001. return barChart;
  1002. });
  1003. },
  1004. // 近90天办理类别统计
  1005. init_processingCategory() {
  1006. this.processingCategory.init((canvas, width, height, dpr) => {
  1007. // 初始化图表
  1008. const barChart = echarts.init(canvas, null, {
  1009. width: width,
  1010. height: height,
  1011. devicePixelRatio: dpr
  1012. });
  1013. barChart.setOption(this.getStatisticsOption());
  1014. request({
  1015. url: '/mail/queryToType?type=3',
  1016. method: 'GET'
  1017. }).then(res => {
  1018. if (res.result) {
  1019. barChart.setOption({
  1020. series: [{
  1021. data: res.data
  1022. }],
  1023. legend: {
  1024. formatter: function (name) {
  1025. let data = res.data
  1026. let tarValue
  1027. for (let i = 0; i < data.length; i++) {
  1028. if (data[i].name == name) {
  1029. tarValue = data[i].value
  1030. }
  1031. }
  1032. let v = tarValue + ' 件'
  1033. return `${name} ${v}`
  1034. }
  1035. }
  1036. })
  1037. }
  1038. })
  1039. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  1040. return barChart;
  1041. });
  1042. },
  1043. // 近90天公开信箱领域统计
  1044. init_publicMailbox() {
  1045. this.publicMailbox.init((canvas, width, height, dpr) => {
  1046. // 初始化图表
  1047. const barChart = echarts.init(canvas, null, {
  1048. width: width,
  1049. height: height,
  1050. devicePixelRatio: dpr
  1051. });
  1052. barChart.setOption(this.getStatisticsOption());
  1053. request({
  1054. url: '/mail/queryToType?type=2',
  1055. method: 'GET'
  1056. }).then(res => {
  1057. if (res.result) {
  1058. barChart.setOption({
  1059. series: [{
  1060. data: res.data
  1061. }],
  1062. legend: {
  1063. formatter: function (name) {
  1064. let data = res.data
  1065. let tarValue
  1066. for (let i = 0; i < data.length; i++) {
  1067. if (data[i].name == name) {
  1068. tarValue = data[i].value
  1069. }
  1070. }
  1071. let v = tarValue + ' 件'
  1072. return `${name} ${v}`
  1073. }
  1074. }
  1075. })
  1076. }
  1077. })
  1078. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  1079. return barChart;
  1080. });
  1081. },
  1082. // 获取好差评图表
  1083. getGoodOrBadOption(maxValue, interval) {
  1084. //请求数据
  1085. let xAxis = {
  1086. type: 'value',
  1087. splitNumber: 4,
  1088. max: maxValue,
  1089. interval: interval,
  1090. axisLine: {
  1091. show: true
  1092. },
  1093. splitLine: {
  1094. interval: 0
  1095. }
  1096. },
  1097. yAxis = {
  1098. axisTick: {
  1099. show: false
  1100. },
  1101. type: 'category',
  1102. data: [
  1103. '非常不满意', '不满意', '基本满意', '满意', '非常满意'
  1104. ]
  1105. },
  1106. grid = {
  1107. left: '20%',
  1108. top: '5%',
  1109. bottom: '20%',
  1110. right: '20%'
  1111. },
  1112. series = [{
  1113. data: [],
  1114. type: 'bar',
  1115. barWidth: 15,
  1116. itemStyle: {
  1117. normal: {
  1118. barBorderRadius: [0, 7, 7, 0],
  1119. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
  1120. offset: 0,
  1121. color: '#006BFD'
  1122. },
  1123. {
  1124. offset: 1,
  1125. color: '#00E9F1'
  1126. }
  1127. ]),
  1128. }
  1129. },
  1130. label: {
  1131. show: true,
  1132. position: 'right',
  1133. valueAnimation: true
  1134. }
  1135. }]
  1136. return {
  1137. backgroundColor: '#FFFFFF',
  1138. xAxis: xAxis,
  1139. yAxis: yAxis,
  1140. grid: grid,
  1141. series: series,
  1142. animationDelay: function (idx) {
  1143. return idx * 50;
  1144. },
  1145. animationEasing: 'elasticOut'
  1146. };
  1147. },
  1148. // 获取本年度公开信息办理图表
  1149. getStatisticsOption() {
  1150. //请求数据
  1151. let legend = {
  1152. top: 'middle',
  1153. orient: 'vertical',
  1154. right: '10%',
  1155. itemHeight: 10,
  1156. itemWidth: 10,
  1157. // textStyle: {
  1158. // fontSize: 20
  1159. // }
  1160. },
  1161. tooltip = {
  1162. trigger: 'item'
  1163. },
  1164. series = [{
  1165. type: 'pie',
  1166. left: '-40%',
  1167. radius: ['40%', '60%'],
  1168. label: {
  1169. show: false,
  1170. position: 'center'
  1171. },
  1172. data: []
  1173. }]
  1174. return {
  1175. backgroundColor: '#FFFFFF',
  1176. legend: legend,
  1177. series: series,
  1178. tooltip: tooltip,
  1179. animationDelay: function (idx) {
  1180. return idx * 50;
  1181. },
  1182. animationEasing: 'elasticOut'
  1183. };
  1184. },
  1185. // 获取本年办件数
  1186. getOfficeNumberByAreaInfo() {
  1187. request({
  1188. url: '/department/getOfficeNumberByAreaInfo?area=1&timeType=3',
  1189. method: 'GET'
  1190. }).then(res => {
  1191. let temp = [];
  1192. temp.push(res.data.acceptNumber);
  1193. temp.push(res.data.serialNumber);
  1194. temp.push(res.data.applicationNumberNetwork);
  1195. this.setData({
  1196. officeNumber: temp
  1197. })
  1198. })
  1199. },
  1200. // 本年度公开信箱办理情况
  1201. queryLeaveAMessage() {
  1202. request({
  1203. url: '/mail/queryLeaveAMessage',
  1204. method: 'GET'
  1205. }).then(res => {
  1206. this.setData({
  1207. leaveAMessage: res.data
  1208. })
  1209. })
  1210. },
  1211. // 南岸区政务服务事项总数
  1212. queryDepartmentItem() {
  1213. request({
  1214. url: '/department/queryDepartmentItemRankByArea?area=1',
  1215. method: 'GET'
  1216. }).then(res => {
  1217. this.setData({
  1218. matters: res.data.conutNumbers,
  1219. mattersZero: 7 - res.data.listTotal.conutNumber.toString().length
  1220. })
  1221. })
  1222. },
  1223. // 前往信箱统计
  1224. gotoXXTJ() {
  1225. wx.navigateTo({
  1226. url: '/pages/dataCenterXXTJ/dataCenterXXTJ',
  1227. })
  1228. },
  1229. // 前往政务统计
  1230. gotoZWTJ() {
  1231. wx.navigateTo({
  1232. url: '/pages/dataCenterZWTJ/dataCenterZWTJ',
  1233. })
  1234. },
  1235. /**
  1236. * 生命周期函数--监听页面初次渲染完成
  1237. */
  1238. onReady() {
  1239. },
  1240. /**
  1241. * 生命周期函数--监听页面显示
  1242. */
  1243. onShow() {
  1244. },
  1245. /**
  1246. * 生命周期函数--监听页面隐藏
  1247. */
  1248. onHide() {
  1249. },
  1250. /**
  1251. * 生命周期函数--监听页面卸载
  1252. */
  1253. onUnload() {
  1254. },
  1255. /**
  1256. * 页面相关事件处理函数--监听用户下拉动作
  1257. */
  1258. onPullDownRefresh() {
  1259. },
  1260. /**
  1261. * 页面上拉触底事件的处理函数
  1262. */
  1263. onReachBottom() {
  1264. },
  1265. /**
  1266. * 用户点击右上角分享
  1267. */
  1268. onShareAppMessage() {
  1269. return {
  1270. title: '数据中心'
  1271. }
  1272. }
  1273. })