checkerStatistic.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <div class="form-wrap">
  3. <el-form
  4. class="search-box"
  5. ref="form"
  6. :model="form"
  7. :inline="true">
  8. <div class="block-title">
  9. 查询条件
  10. </div>
  11. <el-form-item
  12. label="起始时间"
  13. prop="checkTimeBegin">
  14. <el-date-picker
  15. v-model="form.checkTimeBegin"
  16. type="datetime"
  17. placeholder="选择日期时间">
  18. </el-date-picker>
  19. </el-form-item>
  20. <el-form-item
  21. label="截止时间"
  22. prop="checkTimeEnd">
  23. <el-date-picker
  24. default-time="23:59:59"
  25. v-model="form.checkTimeEnd"
  26. type="datetime"
  27. placeholder="选择日期时间">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item
  31. label="检票闸机"
  32. prop="checkerId">
  33. <el-select
  34. v-model="form.checkerId"
  35. clearable
  36. filterable>
  37. <el-option
  38. value=""
  39. label="全部"></el-option>
  40. <el-option
  41. v-for="item in deviceList"
  42. :key="item.id"
  43. :label="item.name"
  44. :value="item.id">
  45. </el-option>
  46. </el-select>
  47. </el-form-item>
  48. <!-- <el-form-item
  49. label="票种"
  50. prop="ticketTypeIdList">
  51. <el-select v-model="form.ticketTypeIdList">
  52. <el-option
  53. value=""
  54. label="全部"></el-option>
  55. <el-option
  56. v-for="item in ticketTypeList"
  57. :key="item.id"
  58. :value="item.id"
  59. :label="item.name">
  60. </el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item
  64. label="销售渠道"
  65. prop="sourceList">
  66. <el-select
  67. v-model="form.sourceList"
  68. multiple
  69. clearable>
  70. <el-option
  71. v-for="(item,index) in saleChannel"
  72. :key="index"
  73. :label="item"
  74. :value="item"
  75. >
  76. </el-option>
  77. </el-select>
  78. </el-form-item>
  79. <el-form-item
  80. label="售票类型"
  81. prop="keyWords7"
  82. >
  83. <el-select
  84. v-model="form.keyWords7"
  85. placeholder="请选择">
  86. <el-option
  87. value=""
  88. label="全部">
  89. </el-option>
  90. <el-option
  91. :value="1"
  92. label="散客">
  93. </el-option>
  94. <el-option
  95. :value="2"
  96. label="团体">
  97. </el-option>
  98. </el-select>
  99. </el-form-item> -->
  100. <div
  101. class="btn-wrap"
  102. style="margin-bottom:20px">
  103. <el-button
  104. @click="reportExport">
  105. 导出
  106. </el-button>
  107. <el-button
  108. @click="reset">
  109. 重置
  110. </el-button>
  111. <el-button
  112. :disabled="loading"
  113. type="primary"
  114. @click="getCheckStatistic">
  115. 搜索
  116. </el-button>
  117. </div>
  118. </el-form>
  119. <div class="table-box">
  120. <!-- <div class="block-title">
  121. 统计结果
  122. </div> -->
  123. <el-table
  124. border
  125. stripe
  126. v-loading="loading"
  127. :data="tableData"
  128. :row-class-name="totalRowClassName"
  129. :span-method="objectSpanMethod">
  130. <!-- <el-table-column
  131. v-for="(item,index) in finalGroup"
  132. :key="index"
  133. :prop="item.prop||item.value"
  134. :label="item.label">
  135. </el-table-column> -->
  136. <!-- <el-table-column
  137. v-if="tableData.find(v=>v.otaSourceName)"
  138. prop="otaSourceName"
  139. label="分销商">
  140. </el-table-column>
  141. <el-table-column
  142. v-if="tableData.find(v=>v.tagName)"
  143. prop="tagName"
  144. label="票种标签">
  145. </el-table-column> -->
  146. <el-table-column
  147. prop="checkerName"
  148. label="检票设备">
  149. </el-table-column>
  150. <el-table-column
  151. prop="enterNums"
  152. label="进入总次数">
  153. </el-table-column>
  154. <el-table-column
  155. prop="outNums"
  156. label="出入总次数">
  157. </el-table-column>
  158. <!-- <el-table-column
  159. prop="checkCount"
  160. label="检票数量">
  161. </el-table-column>
  162. <el-table-column
  163. prop="检票人数"
  164. label="人数">
  165. </el-table-column>
  166. <el-table-column
  167. prop="checkPrice"
  168. label="检票金额">
  169. </el-table-column> -->
  170. </el-table>
  171. </div>
  172. </div>
  173. </template>
  174. <script>
  175. import { getCheckerAccessStatistics } from '@/api/queryReport'
  176. import { totalRowClassName } from '@/utils'
  177. import moment from 'moment'
  178. // import { apiOrder } from '@/api/order.js'
  179. import { getDeviceList } from '@/api/checker'
  180. // import ReaderInput from '@/components/ReaderInput'
  181. // import draggable from 'vuedraggable'
  182. // import moment from 'moment'
  183. export default {
  184. name: 'checkStatistic',
  185. computed: {
  186. scenicName () {
  187. return this.$localStore.get('scenicName') || this.$store.state.user.scenicName
  188. },
  189. saleChannel () {
  190. return this.$store.state.app.saleChannel
  191. },
  192. scenicList () {
  193. return this.$store.state.app.scenicList
  194. },
  195. ticketTypeList () {
  196. return this.$store.state.app.ticketTypeList
  197. },
  198. userScenic () {
  199. return this.$store.state.app.account.managerScenicMatrix ? this.$store.state.app.account.managerScenicMatrix : this.$store.state.app.scenicList
  200. }
  201. },
  202. components: {
  203. },
  204. data () {
  205. return {
  206. groupKeys: [{ value: 'tagName', label: '票种标签' }, { value: 'otaSourceName', label: '分销商' }],
  207. form: {
  208. export: false,
  209. checkTimeBegin: new Date(moment().startOf('day').subtract(7, 'day').format('YYYY-MM-DD HH:mm:ss')),
  210. checkTimeEnd: new Date(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')),
  211. ticketTypeIdList: [], //
  212. sourceList: [],
  213. pageNum: 1,
  214. pageSize: 10
  215. },
  216. selectKeys: [],
  217. finalGroup: [],
  218. tableIndex: 1,
  219. OrderIndexArr: [],
  220. isShow_otaName: false,
  221. tableData: [],
  222. deviceList: [],
  223. loading: false
  224. }
  225. },
  226. created () {
  227. },
  228. mounted () {
  229. this.form.keyList2 = this.userScenic.map(v => v.id)
  230. this.getCheckStatistic()
  231. },
  232. methods: {
  233. hideClear () {
  234. if (['铭投山庄'].includes(this.scenicName)) {
  235. if (this.form.keyList2.length === 1) {
  236. return 'hideClear'
  237. } else {
  238. return ''
  239. }
  240. } else {
  241. return ''
  242. }
  243. },
  244. disabled (item) {
  245. if (['铭投山庄'].includes(this.scenicName)) {
  246. if (this.form.keyList2.length > 1) {
  247. return false
  248. } else if (this.form.keyList2.length === 1) {
  249. if (this.form.keyList2.includes(item.id)) {
  250. return true
  251. } else {
  252. return false
  253. }
  254. }
  255. } else {
  256. return false
  257. }
  258. },
  259. totalRowClassName,
  260. reset () {
  261. this.$refs.form.resetFields()
  262. },
  263. getDeviceList () {
  264. getDeviceList({ pageSize: -1, pageNum: 1 }).then((res) => {
  265. this.deviceList = res?.data.records
  266. })
  267. },
  268. // 获取表格数据
  269. getCheckStatistic () {
  270. this.loading = true
  271. this.tableIndex++
  272. this.finalGroup = []
  273. this.finalGroup = this.groupKeys.filter(i => {
  274. return this.selectKeys.includes(i.value)
  275. })
  276. if (this.form.checkTimeBegin) {
  277. this.form.checkTimeBegin = moment(this.form.checkTimeBegin).format('YYYY-MM-DD HH:mm:ss')
  278. }
  279. if (this.form.checkTimeEnd) {
  280. this.form.checkTimeEnd = moment(this.form.checkTimeEnd).format('YYYY-MM-DD HH:mm:ss')
  281. }
  282. // this.form.keyGroupBy = this.finalGroup.map(i => i.value)
  283. getCheckerAccessStatistics(this.form).then(res => {
  284. this.tableData = res.data
  285. }).finally(() => {
  286. this.loading = false
  287. })
  288. },
  289. objectSpanMethod ({ row, column, rowIndex, columnIndex }) {
  290. if (columnIndex < this.finalGroup.length) {
  291. if (!(this.OrderIndexArr[columnIndex] && this.OrderIndexArr[columnIndex].length)) return
  292. for (let i = 0; i < this.OrderIndexArr[columnIndex].length; i++) {
  293. let element = this.OrderIndexArr[columnIndex][i]
  294. for (let j = 0; j < element.length; j++) {
  295. let item = element[j]
  296. if (rowIndex === item) {
  297. if (j === 0) {
  298. return {
  299. rowspan: element.length,
  300. colspan: 1
  301. }
  302. } else if (j !== 0) {
  303. return {
  304. rowspan: 0,
  305. colspan: 0
  306. }
  307. }
  308. }
  309. }
  310. }
  311. }
  312. },
  313. reportExport () {
  314. this.$confirm(`是否要导出明细数据`, '确认提示', {
  315. confirmButtonText: '是',
  316. cancelButtonText: '否',
  317. type: 'warning'
  318. }).then(() => {
  319. this.handleExport({
  320. ...this.form,
  321. export: true,
  322. exportDetail: true
  323. })
  324. }).catch(() => {
  325. this.handleExport({
  326. ...this.form,
  327. export: true,
  328. exportDetail: false
  329. })
  330. })
  331. },
  332. handleExport (params) {
  333. getCheckerAccessStatistics(params).then(() => {
  334. this.$message.success('导出成功。')
  335. this.goToDownload()
  336. }, () => {
  337. this.$message.success('导出失败。')
  338. })
  339. }
  340. }
  341. }
  342. </script>
  343. <style scoped lang="scss">
  344. .hideClear{
  345. ::v-deep .el-tag.el-tag--info .el-tag__close{
  346. display: none;
  347. }
  348. }
  349. </style>