statisticalReport.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <!-- 统计报表 -->
  2. <template>
  3. <view class="report">
  4. <view class="report-header">
  5. <view class="report-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="report-header-right" v-if="currentType.value === 6">
  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 class="report-header-right" v-else>
  16. <uni-datetime-picker v-model="curDate" type="daterange" @change="dateChange">
  17. <u--text text="日期查询" color="#1767F2"></u--text>
  18. </uni-datetime-picker>
  19. </view>
  20. </view>
  21. <view class="report-content">
  22. <template v-if="currentType.value === 1">
  23. <TollCollectorPerformance ref="tollCollectorPerformance"/>
  24. </template>
  25. <template v-else-if="currentType.value === 2">
  26. <SectionBerth ref="sectionBerth"/>
  27. </template>
  28. <template v-else-if="currentType.value === 3">
  29. <ParkingReallyIncome ref="parkingReallyIncome"/>
  30. </template>
  31. <template v-else-if="currentType.value === 4">
  32. <ArrearsReport ref="arrearsReport" />
  33. </template>
  34. <template v-else-if="currentType.value === 5">
  35. <RevenueReport ref="revenueReport" />
  36. </template>
  37. <template v-else-if="currentType.value === 6">
  38. <ReallyReceivable ref="reallyReceivable"/>
  39. </template>
  40. <template v-else-if="currentType.value === 7">
  41. <CheckWorkAttendance ref="checkWorkAttendance" />
  42. </template>
  43. </view>
  44. <!-- 报表类型 -->
  45. <u-picker :show="typePicker" :columns="typeList" @confirm="typeConfirm" @cancel="typePicker = false"></u-picker>
  46. <!-- 年 -->
  47. <u-picker :show="yearPicker" :columns="yearList" :defaultIndex="defaultYear" @confirm="yearConfirm"
  48. @cancel="yearPicker = false"></u-picker>
  49. <!-- 月 -->
  50. <u-picker :show="monthPicker" :columns="monthList" :defaultIndex="defaultMonth" @confirm="monthConfirm"
  51. @cancel="monthPicker = false"></u-picker>
  52. <!-- 日 -->
  53. <u-picker :show="dayPicker" :columns="dayList" :defaultIndex="defaultDay" @confirm="dayConfirm"
  54. @cancel="dayPicker = false"></u-picker>
  55. </view>
  56. </template>
  57. <script>
  58. import TollCollectorPerformance from './components/tollCollectorPerformance.vue'
  59. import SectionBerth from './components/sectionBerth.vue'
  60. import ParkingReallyIncome from './components/parkingReallyIncome.vue'
  61. import ArrearsReport from './components/arrearsReport.vue'
  62. import RevenueReport from './components/revenueReport.vue'
  63. import ReallyReceivable from './components/reallyReceivable.vue'
  64. import CheckWorkAttendance from './components/checkWorkAttendance.vue'
  65. export default {
  66. components: {
  67. TollCollectorPerformance,
  68. SectionBerth,
  69. ParkingReallyIncome,
  70. ArrearsReport,
  71. RevenueReport,
  72. ReallyReceivable,
  73. CheckWorkAttendance
  74. },
  75. data() {
  76. return {
  77. tabList: [{
  78. label: '年',
  79. value: 2
  80. },
  81. {
  82. label: '月',
  83. value: 1
  84. },
  85. {
  86. label: '日',
  87. value: 0
  88. }
  89. ],
  90. currentType: {},
  91. tabCur: 2,
  92. typePicker: false,
  93. typeList: [[
  94. // {
  95. // text: '收费员业绩统计',
  96. // value: 1,
  97. // key: 'tollCollectorPerformance'
  98. // },
  99. {
  100. text: '路段泊位统计',
  101. value: 2,
  102. key: 'sectionBerth'
  103. },
  104. {
  105. text: '停车场实收统计',
  106. value: 3,
  107. key: 'parkingReallyIncome'
  108. },
  109. {
  110. text: '欠费统计',
  111. value: 4,
  112. key: 'arrearsReport'
  113. },
  114. {
  115. text: '营收统计',
  116. value: 5,
  117. key: 'revenueReport'
  118. },
  119. {
  120. text: '应收实收分析',
  121. value: 6,
  122. key: 'reallyReceivable'
  123. },
  124. {
  125. text: '考勤统计',
  126. value: 7,
  127. key: 'checkWorkAttendance'
  128. }
  129. ]],
  130. // 日期
  131. curDate: [],
  132. // 参数
  133. params: {
  134. reportType: 2,
  135. queryDate: '',
  136. title: ''
  137. },
  138. // 年
  139. yearPicker: false,
  140. yearList: this.getYearList(),
  141. defaultYear: [4],
  142. currentYear: '',
  143. yearObj: {},
  144. // 月
  145. monthPicker: false,
  146. monthList: this.getMonthList(),
  147. defaultMonth: [],
  148. currentMonth: '01',
  149. monthObj: {},
  150. // 日
  151. dayPicker: false,
  152. dayList: this.getDayList(),
  153. defaultDay: [],
  154. currentDay: '01',
  155. dayObj: {}
  156. }
  157. },
  158. onShow() {
  159. this.currentType = this.typeList[0][0]
  160. if (this.currentType.value === 5 || this.currentType.value === 7) {
  161. let today = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
  162. this.curDate = [today, today]
  163. } else {
  164. this.curDate = []
  165. }
  166. setTimeout(() => {
  167. if (this.currentType.value === 6) {
  168. this.currentYear = this.yearList[0][4].value
  169. this.yearObj = this.yearList[0][4]
  170. this.params.title = this.yearList[0][4].text
  171. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  172. this.$refs[this.currentType.key].getData(this.params)
  173. } else {
  174. this.$refs[this.currentType.key].getData(this.curDate)
  175. }
  176. }, 500)
  177. },
  178. methods: {
  179. getYearList() {
  180. const date = new Date()
  181. const year = date.getFullYear();
  182. const list = [
  183. []
  184. ]
  185. for (let i = year - 4; i < year + 1; i++) {
  186. const obj = {
  187. text: String(i),
  188. value: String(i)
  189. }
  190. list[0].push(obj)
  191. }
  192. return list
  193. },
  194. getMonthList() {
  195. const date = new Date()
  196. const month = date.getMonth()
  197. const list = [
  198. []
  199. ]
  200. for (let i = 1; i < 13; i++) {
  201. const obj = {
  202. text: String(i),
  203. value: String(i)
  204. }
  205. if (i < 10) {
  206. obj.text = '0' + i
  207. obj.value = '0' + i
  208. }
  209. list[0].push(obj)
  210. }
  211. setTimeout(() => {
  212. this.defaultMonth = [0]
  213. }, 1000)
  214. return list
  215. },
  216. getDayList() {
  217. const date = new Date()
  218. const year = date.getFullYear()
  219. let month = date.getMonth()
  220. if (this.monthObj) {
  221. month = parseInt(this.monthObj.value)
  222. month = String(month)
  223. }
  224. const day = date.getDate()
  225. const dayLen = (new Date(year, month, 0)).getDate()
  226. const list = [
  227. []
  228. ]
  229. for (let i = 1; i < dayLen + 1; i++) {
  230. const obj = {
  231. text: String(i),
  232. value: String(i)
  233. }
  234. if (i < 10) {
  235. obj.text = '0' + i
  236. obj.value = '0' + i
  237. }
  238. list[0].push(obj)
  239. }
  240. setTimeout(() => {
  241. this.defaultDay = [0]
  242. }, 1000)
  243. return list
  244. },
  245. tabClick(item) {
  246. this.tabCur = item.value
  247. switch (item.value) {
  248. case 2:
  249. this.yearPicker = true
  250. break
  251. case 1:
  252. this.monthPicker = true
  253. break
  254. case 0:
  255. this.dayPicker = true
  256. break
  257. }
  258. this.params.reportType = this.tabCur
  259. },
  260. typeConfirm(e) {
  261. this.currentType = e.value[0]
  262. this.typePicker = false
  263. if (this.currentType.value === 5 || this.currentType.value === 7) {
  264. let today = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
  265. this.curDate = [today, today]
  266. } else {
  267. this.curDate = []
  268. }
  269. setTimeout(() => {
  270. if (this.currentType.value === 6) {
  271. this.currentYear = this.yearList[0][4].value
  272. this.yearObj = this.yearList[0][4]
  273. this.params.title = this.yearList[0][4].text
  274. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  275. this.$refs[this.currentType.key].getData(this.params)
  276. } else {
  277. this.$refs[this.currentType.key].getData(this.curDate)
  278. }
  279. }, 500)
  280. },
  281. dateChange(e) {
  282. this.curDate = e
  283. this.$refs[this.currentType.key].getData(this.curDate)
  284. },
  285. yearConfirm(e) {
  286. this.defaultYear = [e.indexs[0]]
  287. this.currentYear = e.value[0].value
  288. this.params.title = e.value[0].text
  289. this.yearObj = e.value[0]
  290. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  291. this.$refs[this.currentType.key].getData(this.params)
  292. this.yearPicker = false
  293. },
  294. monthConfirm(e) {
  295. this.defaultMonth = [e.indexs[0]]
  296. this.currentMonth = e.value[0].value
  297. this.monthObj = e.value[0]
  298. this.params.title = `${this.yearObj.text}-${this.monthObj.text}`
  299. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  300. this.$refs[this.currentType.key].getData(this.params)
  301. this.monthPicker = false
  302. this.dayList = this.getDayList()
  303. },
  304. dayConfirm(e) {
  305. this.defaultDay = [e.indexs[0]]
  306. this.title = e.value[0].text
  307. this.currentDay = e.value[0].value
  308. this.dayObj = e.value[0]
  309. this.params.title = `${this.yearObj.text}-${this.monthObj.text}-${this.dayObj.text}`
  310. this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
  311. this.$refs[this.currentType.key].getData(this.params)
  312. this.dayPicker = false
  313. }
  314. }
  315. }
  316. </script>
  317. <style lang="scss">
  318. page {
  319. background-color: #1767F2;
  320. min-height: calc(100vh - 44px);
  321. }
  322. </style>
  323. <style lang="scss" scoped>
  324. @import './statisticalReport.scss';
  325. </style>