dataCenter.js 33 KB

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