You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 14KB

1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
2 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
2 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
1 년 전
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <view class="content">
  3. <view>
  4. <!-- <view v-if="pieDataAll.length>0"> -->
  5. <view class="title_name">{{dealDateTime[0]}}年{{dealDateTime[1]}}月{{dealDateTime[2]}}日黔通智联ETC事业部全国发行日报表
  6. </view>
  7. <view class="table_wrap" v-if="dataAll">
  8. <t-table>
  9. <t-tr font-size="12">
  10. <t-td>车型</t-td>
  11. <t-td>记账副卡当日开卡数</t-td>
  12. <t-td>记账卡累计发卡数</t-td>
  13. </t-tr>
  14. <t-tr v-for="(item,index) in dataAll.vehicleData.vehicleDataDetails" :key="index" fontSize="12">
  15. <t-td>{{ item.vehicleType }}</t-td>
  16. <t-td>{{ item.dayCardCount }}</t-td>
  17. <t-td>{{ item.cardCount }}</t-td>
  18. </t-tr>
  19. <t-tr font-size="12">
  20. <t-td>合计</t-td>
  21. <t-td>{{ dataAll.vehicleData.vehicleDataCount.dayCardCount }}</t-td>
  22. <t-td>{{ dataAll.vehicleData.vehicleDataCount.cardCount }}</t-td>
  23. </t-tr>
  24. </t-table>
  25. </view>
  26. <!-- 改变类型和时间 -->
  27. <view class="change_type">
  28. <uni-data-select v-model="selectTypeValue" :localdata="typeRange" @change="changeType"
  29. :clear="false"></uni-data-select>
  30. <view class='time' @click="hideCanvas">
  31. <uni-datetime-picker type="date" :clear-icon="false" v-model="dateTime" @change="change" />
  32. </view>
  33. </view>
  34. <view v-if="pieData !={} || chartData !={} || lineData !={} ">
  35. <view v-if=" isShow===0 ">
  36. <view class=" title title_pie">
  37. <view class="choice_item1"><uni-data-select v-model="selectPieValue" :localdata="pieRange"
  38. @change="changePie" :clear="false"></uni-data-select></view>
  39. </view>
  40. <view class="charts-box">
  41. <qiun type="pie" :opts="opts" :chartData="pieData" />
  42. </view>
  43. </view>
  44. <view v-else-if="isShow === 1">
  45. <view class="title title_pie">
  46. <view class="choice_item1"><uni-data-select v-model="selectLineValue" :localdata="lineRange"
  47. @change="changeLine" :clear="false"></uni-data-select></view>
  48. </view>
  49. <view class="charts-box">
  50. <qiun type="line" :opts="optsLine" :chartData="lineData" :ontouch="true" />
  51. </view>
  52. </view>
  53. <view v-else>
  54. <view class="title title_pie">
  55. <view class="choice_item"><uni-data-select v-model="selectColValue" :localdata="colRange"
  56. @change="changeCol" :clear="false"></uni-data-select></view>
  57. </view>
  58. <view class="charts-box">
  59. <qiun type="column" :opts="optsCol" :chartData="chartData" :ontouch="true" />
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- <view v-else>暂无数据统计信息</view> -->
  65. </view>
  66. </template>
  67. <script>
  68. import * as IFCODE from "@/utils/network/api.js";
  69. import {
  70. request
  71. } from "@/utils/network/request.js";
  72. const tools = require("../../../static/etcUtil/tools.js");
  73. import {
  74. stringToJson
  75. } from "@/utils/network/encryption";
  76. import {
  77. nowDate
  78. } from "@/utils/utils";
  79. import {
  80. getItem
  81. } from "@/utils/storage";
  82. // 表格
  83. import tTable from "@/components/t-table/t-table.vue"
  84. import tTh from '@/components/t-table/t-th.vue'
  85. import tTr from '@/components/t-table/t-tr.vue'
  86. import tTd from '@/components/t-table/t-td.vue'
  87. // import qiun from "@/subpackage/service/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue";
  88. import qiun from "../qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue";
  89. export default {
  90. data() {
  91. return {
  92. canvasShow: false,
  93. dateTime: Date.now(), //日期
  94. noDealDateTime: '', //没有处理过的时间,传给后端
  95. dealDateTime: [], //处理过后的时间,前端展示
  96. dataAll: '', //总的数据
  97. //标题名称
  98. titleArr: {
  99. 'dayCardCount': '当日开户数',
  100. 'monthCardCount': '当月开户数',
  101. "monthCancelCount": "当月注销",
  102. 'yearCardCount': '当年累积开户数',
  103. 'cardCount': '总计开户数',
  104. 'dayCancelCount': '当日注销',
  105. 'yearCancelCount': '当年注销数',
  106. 'cancelCount': '总计注销数'
  107. },
  108. isShow: 0,
  109. pieData: {},
  110. chartData: {},
  111. lineData: {},
  112. opts: {
  113. fontSize: 11,
  114. },
  115. optsLine: {
  116. fontSize: 11,
  117. enableScroll: true,
  118. xAxis: {
  119. disableGrid: true,
  120. scrollShow: true,
  121. itemCount: 3
  122. },
  123. extra: {
  124. line: {
  125. type: "straight",
  126. width: 2,
  127. activeType: "hollow"
  128. }
  129. }
  130. },
  131. optsCol: {
  132. fontSize: 11,
  133. enableScroll: true,
  134. xAxis: {
  135. disableGrid: true,
  136. scrollShow: true,
  137. itemCount: 3.5
  138. },
  139. yAxis: {
  140. data: [{
  141. min: 0
  142. }]
  143. },
  144. extra: {
  145. column: {
  146. type: "group",
  147. width: 25,
  148. }
  149. }
  150. },
  151. selectPieValue: 0,
  152. pieRange: [],
  153. pieDataAll: [],
  154. selectLineValue: 0,
  155. lineRange: [{
  156. value: 0,
  157. text: "全部"
  158. },
  159. {
  160. value: 1,
  161. text: "记账卡"
  162. },
  163. {
  164. value: 2,
  165. text: "储值卡"
  166. },
  167. ],
  168. lineDataAll: [],
  169. selectColValue: 0,
  170. colRange: [],
  171. colData: {
  172. xData: ["当日开户数", "当月开户数", "当年累积开户数", "总计开户数", "当日注销", "当年注销数", "总计注销数"],
  173. yData: {}
  174. },
  175. selectTypeValue: 0,
  176. typeRange: [{
  177. value: 0,
  178. text: "饼状图"
  179. },
  180. {
  181. value: 1,
  182. text: "折线图"
  183. },
  184. {
  185. value: 2,
  186. text: "柱状图"
  187. },
  188. ],
  189. };
  190. },
  191. components: {
  192. tTable,
  193. tTh,
  194. tTr,
  195. tTd,
  196. qiun
  197. },
  198. onLoad() {
  199. this.noDealDateTime = nowDate(new Date());
  200. // this.noDealDateTime='2023-04-17';
  201. this.dealDateTime = nowDate(new Date()).split('-');
  202. this.reqPie(); //饼状图数据请求
  203. window.addEventListener('setItem', () => {
  204. console.log("此处发生变化")
  205. })
  206. },
  207. methods: {
  208. getPieData(data) {
  209. //模拟从服务器获取数据时的延时
  210. setTimeout(() => {
  211. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  212. let res = {
  213. series: [{
  214. data: data
  215. }]
  216. };
  217. this.pieData = JSON.parse(JSON.stringify(res));
  218. }, 500);
  219. },
  220. getColumnData(xData, yData) {
  221. //模拟从服务器获取数据时的延时
  222. setTimeout(() => {
  223. let res = {
  224. categories: xData,
  225. series: [yData]
  226. };
  227. this.chartData = JSON.parse(JSON.stringify(res));
  228. }, 500);
  229. },
  230. getLineData(data) {
  231. //模拟从服务器获取数据时的延时
  232. setTimeout(() => {
  233. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  234. let res = {
  235. categories: data.xData,
  236. series: data.yData
  237. };
  238. this.lineData = JSON.parse(JSON.stringify(res));
  239. }, 500);
  240. },
  241. selectitem(index, item) {
  242. if (index >= 0) {
  243. this.tval = item.value;
  244. } else {
  245. this.tval = ""
  246. }
  247. },
  248. //饼状图改变
  249. changePie(e) {
  250. this.getPieData(this.pieDataAll[e]);
  251. },
  252. // 折线图改变类型
  253. changeLine(e) {
  254. this.getLineData(this.lineDataAll[e]);
  255. },
  256. // 柱状图改变
  257. changeCol(e) {
  258. this.getColumnData(this.colData.xData, this.colData.yData[e]);
  259. },
  260. // 改变类型
  261. changeType(e) {
  262. this.isShow = e;
  263. },
  264. reqPie() {
  265. tools.showLoadingAlert("加载中");
  266. let options = {
  267. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  268. data: {
  269. accountDate: this.noDealDateTime, //统计日期
  270. agencyId: '', //渠道编号
  271. cardType: '', //卡类型 1-记账卡,0-储值卡
  272. vehicleType: '', //车辆类型 0-客车,1-货车,2-专项作业车
  273. }, //请求参数
  274. method: "POST", //提交方式(默认POST)
  275. showLoading: true, //是否显示加载中(默认显示)
  276. };
  277. // 调用方式
  278. request(IFCODE.dataStatistics, options)
  279. .then((res) => {
  280. tools.hideLoadingAlert();
  281. this.dataAll = stringToJson(res.bizContent);
  282. if (this.dataAll.cardData) {
  283. console.log("this.dataAll", this.dataAll)
  284. this.dealPieData(stringToJson(res.bizContent)); //处理饼状图数据
  285. this.getPieData(this.pieDataAll[0]); //饼状图展示
  286. this.dealLineData(stringToJson(res.bizContent)); //处理折线图数据
  287. this.getLineData(this.lineDataAll[0]); //折线图展示
  288. this.dealColData(stringToJson(res.bizContent)) //处理柱状图数据
  289. this.getColumnData(this.colData.xData, this.colData.yData[0]); //柱状图
  290. }
  291. })
  292. },
  293. dealPieData(data) {
  294. // 记账卡合计
  295. this.pieRange = []; //清空一遍数据
  296. this.pieDataAll = []; //清空一遍数据
  297. var pieDataItem = []
  298. if (data.cardData.accountCardData.accountCardDataCount) {
  299. var list = {
  300. value: 0,
  301. text: "记账卡合计"
  302. };
  303. this.pieRange.push(list);
  304. for (var i in data.cardData.accountCardData.accountCardDataCount) {
  305. if (this.titleArr[i]) {
  306. var obj = {};
  307. obj.name = this.titleArr[i];
  308. obj.value = (data.cardData.accountCardData.accountCardDataCount)[i];
  309. }
  310. pieDataItem.push(obj);
  311. }
  312. this.pieDataAll.push(pieDataItem);
  313. }
  314. // 储值卡合计
  315. var pieDataItem1 = []
  316. if (data.cardData.valueCardData.valueCardDataCount) {
  317. var list = {
  318. value: 1,
  319. text: "储值卡合计"
  320. };
  321. this.pieRange.push(list);
  322. for (var i in data.cardData.valueCardData.valueCardDataCount) {
  323. if (this.titleArr[i]) {
  324. var obj = {};
  325. obj.name = this.titleArr[i];
  326. obj.value = (data.cardData.valueCardData.valueCardDataCount)[i];
  327. }
  328. pieDataItem1.push(obj);
  329. }
  330. this.pieDataAll.push(pieDataItem1);
  331. }
  332. // ETC卡合计
  333. var pieDataItem2 = []
  334. if (data.cardData.cardDataCount) {
  335. var list = {
  336. value: 2,
  337. text: "ETC卡合计"
  338. };
  339. this.pieRange.push(list);
  340. for (var i in data.cardData.cardDataCount) {
  341. if (this.titleArr[i]) {
  342. var obj = {};
  343. obj.name = this.titleArr[i];
  344. obj.value = (data.cardData.cardDataCount)[i];
  345. }
  346. pieDataItem2.push(obj);
  347. }
  348. this.pieDataAll.push(pieDataItem2);
  349. }
  350. console.log("this.pieDataAll", this.pieDataAll)
  351. },
  352. dealLineData(data) {
  353. this.lineDataAll = [];
  354. // 全部
  355. var lineItem = {
  356. xData: ["当日开户数", "当月开户数", "当年累积开户数", "总计开户数", "当日注销", "当年注销数", "总计注销数"],
  357. yData: []
  358. }
  359. var allData = data.cardData.accountCardData.accountCardDataDetail.concat(data.cardData.valueCardData
  360. .valueCardDataDetail)
  361. for (var i = 0; i < allData.length; i++) {
  362. if (allData[i].agencyName) {
  363. var obj = {};
  364. obj.name = allData[i].agencyName
  365. obj.data = [];
  366. for (var n in this.titleArr) {
  367. obj.data.push(allData[i][n])
  368. }
  369. lineItem.yData.push(obj)
  370. }
  371. }
  372. this.lineDataAll.push(lineItem)
  373. // 记账卡
  374. var lineItem1 = {
  375. xData: ["当日开户数", "当月开户数", "当年累积开户数", "总计开户数", "当日注销", "当年注销数", "总计注销数"],
  376. yData: []
  377. }
  378. for (var i = 0; i < data.cardData.accountCardData.accountCardDataDetail.length; i++) {
  379. if (data.cardData.accountCardData.accountCardDataDetail[i].agencyName) {
  380. var obj = {};
  381. obj.name = data.cardData.accountCardData.accountCardDataDetail[i].agencyName
  382. obj.data = [];
  383. for (var n in this.titleArr) {
  384. obj.data.push(data.cardData.accountCardData.accountCardDataDetail[i][n])
  385. }
  386. lineItem1.yData.push(obj)
  387. }
  388. }
  389. this.lineDataAll.push(lineItem1)
  390. var lineItem2 = {
  391. xData: ["当日开户数", "当月开户数", "当年累积开户数", "总计开户数", "当日注销", "当年注销数", "总计注销数"],
  392. yData: []
  393. }
  394. for (var i = 0; i < data.cardData.valueCardData.valueCardDataDetail.length; i++) {
  395. if (data.cardData.valueCardData.valueCardDataDetail[i].agencyName) {
  396. var obj = {};
  397. obj.name = data.cardData.valueCardData.valueCardDataDetail[i].agencyName
  398. obj.data = [];
  399. for (var n in this.titleArr) {
  400. obj.data.push(data.cardData.valueCardData.valueCardDataDetail[i][n])
  401. }
  402. lineItem2.yData.push(obj)
  403. }
  404. }
  405. this.lineDataAll.push(lineItem2)
  406. },
  407. dealColData(data) {
  408. this.colRange = [];
  409. var allData = data.cardData.accountCardData.accountCardDataDetail.concat(data.cardData.valueCardData
  410. .valueCardDataDetail)
  411. for (var i = 0; i < allData.length; i++) {
  412. if (allData[i].agencyName) {
  413. var obj = {};
  414. obj.value = i;
  415. obj.text = allData[i].agencyName;
  416. this.colRange.push(obj); //获得选择类表
  417. this.colData.yData[i] = {};
  418. this.colData.yData[i]['name'] = allData[i].agencyName;
  419. this.colData.yData[i]['data'] = [];
  420. for (var n in this.titleArr) {
  421. this.colData.yData[i]['data'].push(allData[i][n])
  422. }
  423. }
  424. }
  425. },
  426. // 日期事件
  427. change(e) {
  428. this.dealDateTime = e.split('-');
  429. this.dateTime = e;
  430. this.noDealDateTime = e;
  431. this.reqPie(); //饼状图数据请求
  432. // window.addEventListener("show", () => {
  433. // console.log('它发生变化了')
  434. // });
  435. // this.canvasShow = getItem("show")
  436. },
  437. }
  438. };
  439. </script>
  440. <style scoped>
  441. ::v-deep .uni-date-x {
  442. background-color: #EEF7F7 !important;
  443. }
  444. .content {
  445. background-color: #EEF7F7;
  446. overflow: hidden;
  447. min-height: 100vh;
  448. }
  449. .charts-box {
  450. width: 100%;
  451. height: 300px;
  452. }
  453. .title {
  454. border-left: 10rpx solid rgb(24, 144, 255);
  455. font-size: 32rpx;
  456. margin: 6px 10px;
  457. border-radius: 8rpx;
  458. }
  459. .table_wrap {
  460. font-size: 14rpx;
  461. margin: 40rpx auto;
  462. width: 700rpx;
  463. height: auto
  464. }
  465. t-tr t-td:nth-child(1) {
  466. width: 20% !important;
  467. }
  468. t-tr t-td:nth-child(2) {
  469. width: 43% !important;
  470. }
  471. t-tr t-td:nth-child(3) {
  472. width: 37% !important;
  473. }
  474. .uni-stat__select {
  475. width: 40% !important;
  476. }
  477. .title_pie {
  478. display: flex;
  479. justify-content: flex-end;
  480. align-items: center;
  481. }
  482. .uni-select {
  483. font-size: 13px !important;
  484. height: 30px !important;
  485. }
  486. .change_type {
  487. padding: 0 3%;
  488. display: flex;
  489. justify-content: space-between;
  490. margin-bottom: 36rpx;
  491. margin-top: 16rpx;
  492. }
  493. .change_type>uni-data-select {
  494. width: 40%;
  495. }
  496. .time {
  497. width: 40%;
  498. }
  499. .title_name {
  500. width: 95%;
  501. font-weight: 600;
  502. text-align: center;
  503. margin: auto;
  504. }
  505. .choice_item {
  506. width: 50%;
  507. }
  508. .choice_item1 {
  509. width: 35%;
  510. }
  511. /deep/.uni-date__x-input,
  512. /deep/.uni-select {
  513. height: 32px;
  514. line-height: 32px !important;
  515. font-size: 13px !important;
  516. }
  517. </style>