operationalAnalysis.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <!-- 运营分析 -->
  2. <template>
  3. <view class="operation">
  4. <view class="operation-header">
  5. <view class="operation-header-left" @click="typePicker = true">
  6. <u-icon name="arrow-down" color="#000" size="15"></u-icon>
  7. <text>{{ currentType.text }}</text>
  8. </view>
  9. <view class="operation-header-right">
  10. <view class="tab">
  11. <view class="tab-item" v-for="(item, index) in tabList" :key="index"
  12. :class="{'active': tabCur === item.value}" @click="tabClick(item)">{{ item.label }}</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="operation-main">
  17. <template v-if="currentType.value === 1">
  18. <RevenueAnalysis ref="revenueAnalysis" :type="currentType.type" :title="title"/>
  19. </template>
  20. <template v-else-if="currentType.value === 2">
  21. <RevenueAnalysis ref="revenueAnalysis" :type="currentType.type" :title="title"/>
  22. </template>
  23. <template v-else-if="currentType.value === 3">
  24. <RevenueRanking ref="revenueRanking" :title="title"/>
  25. </template>
  26. <template v-else-if="currentType.value === 4">
  27. <TrafficFlow ref="trafficFlow" :title="title"/>
  28. </template>
  29. <template v-else-if="currentType.value === 5">
  30. <TollCollectorPerformance ref="tollCollectorPerformance" type="table" :title="title"/>
  31. </template>
  32. <template v-else-if="currentType.value === 6">
  33. <TollCollectorPerformance ref="tollCollectorPerformance" type="line" :title="title"/>
  34. </template>
  35. <template v-else-if="currentType.value === 7">
  36. <SectionAnalysis ref="sectionAnalysis" :title="title"/>
  37. </template>
  38. <template v-else-if="currentType.value === 8">
  39. <ArrearsAnalysis :chartData="currentType.data" :title="title"/>
  40. </template>
  41. <template v-else-if="currentType.value === 9">
  42. <IncomeAnalysis :chartData="currentType.data" :title="title"/>
  43. </template>
  44. <template v-else-if="currentType.value === 10">
  45. <PaymentMethod :chartData="currentType.data" :title="title"/>
  46. </template>
  47. <template v-else-if="currentType.value === 11">
  48. <SourceOfPayment :chartData="currentType.data" :title="title"/>
  49. </template>
  50. </view>
  51. <!-- 分析类型 -->
  52. <u-picker :show="typePicker" :columns="typeList" @confirm="typeConfirm" @cancel="typePicker = false"></u-picker>
  53. <!-- 年 -->
  54. <u-picker :show="yearPicker" :columns="yearList" :defaultIndex="defaultYear" @confirm="yearConfirm"
  55. @cancel="yearPicker = false"></u-picker>
  56. <!-- 月 -->
  57. <u-picker :show="monthPicker" :columns="monthList" :defaultIndex="defaultMonth" @confirm="monthConfirm"
  58. @cancel="monthPicker = false"></u-picker>
  59. <!-- 日 -->
  60. <u-picker :show="dayPicker" :columns="dayList" :defaultIndex="defaultDay" @confirm="dayConfirm"
  61. @cancel="dayPicker = false"></u-picker>
  62. </view>
  63. </template>
  64. <script>
  65. import RevenueAnalysis from './components/revenueAnalysis.vue'
  66. import RevenueRanking from './components/revenueRanking.vue'
  67. import TrafficFlow from './components/trafficFlow.vue'
  68. import TollCollectorPerformance from './components/tollCollectorPerformance.vue'
  69. import SectionAnalysis from './components/sectionAnalysis.vue'
  70. import ArrearsAnalysis from './components/arrearsAnalysis.vue'
  71. import IncomeAnalysis from './components/incomeAnalysis.vue'
  72. import SourceOfPayment from './components/sourceOfPayment.vue'
  73. import PaymentMethod from './components/paymentMethod.vue'
  74. export default {
  75. components: {
  76. RevenueAnalysis,
  77. RevenueRanking,
  78. TrafficFlow,
  79. TollCollectorPerformance,
  80. SectionAnalysis,
  81. ArrearsAnalysis,
  82. IncomeAnalysis,
  83. SourceOfPayment,
  84. PaymentMethod
  85. },
  86. data() {
  87. return {
  88. tabList: [{
  89. label: '年',
  90. value: 2
  91. },
  92. {
  93. label: '月',
  94. value: 1
  95. },
  96. {
  97. label: '日',
  98. value: 0
  99. }
  100. ],
  101. tabCur: 2,
  102. // 参数
  103. params: {
  104. reportType: 2,
  105. queryDate: ''
  106. },
  107. // 类型
  108. typePicker: false,
  109. currentType: {},
  110. typeList: [
  111. [{
  112. text: '营收分析(折线)',
  113. value: 1,
  114. type: 'line',
  115. key: 'revenueAnalysis'
  116. },
  117. {
  118. text: '营收分析(柱状)',
  119. value: 2,
  120. type: 'column',
  121. key: 'revenueAnalysis'
  122. },
  123. {
  124. text: '路段/停车场营收排行',
  125. value: 3,
  126. key: 'revenueRanking'
  127. },
  128. {
  129. text: '车流量分析',
  130. value: 4,
  131. key: 'trafficFlow'
  132. },
  133. {
  134. text: '收费员业绩排行',
  135. value: 5,
  136. key: 'tollCollectorPerformance'
  137. },
  138. {
  139. text: '收费员业绩分析',
  140. value: 6,
  141. key: 'tollCollectorPerformance'
  142. },
  143. {
  144. text: '路段分析',
  145. value: 7,
  146. key: 'sectionAnalysis'
  147. },
  148. {
  149. text: '欠费分析',
  150. value: 8,
  151. data: {
  152. categories: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  153. series: [{
  154. name: '',
  155. data: [10, 10, 20, 30, 40, 0, 0, 0, 0, 0, 0, 0]
  156. }]
  157. }
  158. },
  159. {
  160. text: '收入分析',
  161. value: 9,
  162. data: {
  163. categories: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  164. series: [{
  165. name: '',
  166. data: [10, 10, 20, 30, 40, 0, 0, 0, 0, 0, 0, 0]
  167. }]
  168. }
  169. },
  170. {
  171. text: '支付方式占比',
  172. value: 10,
  173. data: {
  174. series: [{
  175. data: [{
  176. "name": "一班",
  177. "value": 50
  178. },
  179. {
  180. "name": "二班",
  181. "value": 30
  182. },
  183. {
  184. "name": "三班",
  185. "value": 20
  186. },
  187. {
  188. "name": "四班",
  189. "value": 18
  190. },
  191. {
  192. "name": "五班",
  193. "value": 8
  194. }
  195. ]
  196. }]
  197. }
  198. },
  199. {
  200. text: '支付来源分析',
  201. value: 11,
  202. data: {
  203. categories: [1, 2, 3, 4, 5],
  204. series: [{
  205. name: '',
  206. data: [10, 10, 20, 30, 40]
  207. }]
  208. }
  209. }
  210. ]
  211. ],
  212. title: '',
  213. // 年
  214. yearPicker: false,
  215. yearList: this.getYearList(),
  216. defaultYear: [4],
  217. currentYear: '',
  218. yearObj: {},
  219. // 月
  220. monthPicker: false,
  221. monthList: this.getMonthList(),
  222. defaultMonth: [],
  223. currentMonth: '01',
  224. monthObj: {},
  225. // 日
  226. dayPicker: false,
  227. dayList: this.getDayList(),
  228. defaultDay: [],
  229. currentDay: '01',
  230. dayObj: {}
  231. }
  232. },
  233. onShow() {
  234. this.currentType = this.typeList[0][6]
  235. this.defaultSetVal();
  236. },
  237. methods: {
  238. defaultSetVal() {
  239. this.currentYear = this.yearList[0][4].value
  240. this.title = this.yearList[0][4].text
  241. this.yearObj = this.yearList[0][4]
  242. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  243. setTimeout(() => {
  244. this.$refs[this.currentType.key].getData(this.params)
  245. }, 500)
  246. },
  247. getYearList() {
  248. const date = new Date()
  249. const year = date.getFullYear();
  250. const list = [
  251. []
  252. ]
  253. for (let i = year - 4; i < year + 1; i++) {
  254. const obj = {
  255. text: String(i),
  256. value: String(i)
  257. }
  258. list[0].push(obj)
  259. }
  260. return list
  261. },
  262. getMonthList() {
  263. const date = new Date()
  264. const month = date.getMonth()
  265. const list = [
  266. []
  267. ]
  268. for (let i = 1; i < 13; i++) {
  269. const obj = {
  270. text: String(i),
  271. value: String(i)
  272. }
  273. if (i < 10) {
  274. obj.text = '0' + i
  275. obj.value = '0' + i
  276. }
  277. list[0].push(obj)
  278. }
  279. setTimeout(() => {
  280. this.defaultMonth = [month]
  281. }, 1000)
  282. return list
  283. },
  284. getDayList() {
  285. const date = new Date()
  286. const year = date.getFullYear()
  287. const month = date.getMonth()
  288. const day = date.getDate()
  289. const dayLen = (new Date(year, month, 0)).getDate()
  290. const list = [
  291. []
  292. ]
  293. for (let i = 1; i < dayLen + 1; i++) {
  294. const obj = {
  295. text: String(i),
  296. value: String(i)
  297. }
  298. if (i < 10) {
  299. obj.text = '0' + i
  300. obj.value = '0' + i
  301. }
  302. list[0].push(obj)
  303. }
  304. setTimeout(() => {
  305. this.defaultDay = [day - 1]
  306. }, 1000)
  307. return list
  308. },
  309. /**
  310. * 点击tab
  311. * @param {Object} item
  312. */
  313. tabClick(item) {
  314. this.tabCur = item.value
  315. switch (item.value) {
  316. case 0:
  317. this.dayPicker = true
  318. break
  319. case 1:
  320. this.monthPicker = true
  321. break
  322. case 2:
  323. this.yearPicker = true
  324. break
  325. }
  326. this.params.reportType = this.tabCur
  327. },
  328. /**
  329. * 选择器确认
  330. * @param {Object} e
  331. */
  332. typeConfirm(e) {
  333. this.currentType = e.value[0]
  334. this.typePicker = false
  335. },
  336. yearConfirm(e) {
  337. this.defaultYear = [e.indexs[0]]
  338. this.title = e.value[0].text
  339. this.currentYear = e.value[0].value
  340. this.yearObj = e.value[0]
  341. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  342. this.$refs[this.currentType.key].getData(this.params)
  343. this.yearPicker = false
  344. },
  345. monthConfirm(e) {
  346. this.defaultMonth = [e.indexs[0]]
  347. this.currentMonth = e.value[0].value
  348. this.monthObj = e.value[0]
  349. this.title = `${this.yearObj.text}-${this.monthObj.text}`
  350. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  351. this.$refs[this.currentType.key].getData(this.params)
  352. this.monthPicker = false
  353. },
  354. dayConfirm(e) {
  355. this.defaultDay = [e.indexs[0]]
  356. this.title = e.value[0].text
  357. this.currentDay = e.value[0].value
  358. this.dayObj = e.value[0]
  359. this.title = `${this.yearObj.text}-${this.monthObj.text}-${this.dayObj.text}`
  360. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  361. this.$refs[this.currentType.key].getData(this.params)
  362. this.dayPicker = false
  363. }
  364. }
  365. }
  366. </script>
  367. <style lang="scss">
  368. page {
  369. background-color: #1767F2;
  370. min-height: calc(100vh - 44px);
  371. }
  372. </style>
  373. <style lang="scss" scoped>
  374. @import './operationalAnalysis.scss';
  375. </style>