operationalAnalysis.vue 8.5 KB

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