Bladeren bron

feat: appletOrderType

linfansen 1 jaar geleden
bovenliggende
commit
36873d31c2

+ 0 - 9
src/views/realm/report/api.js

@@ -144,13 +144,6 @@ export function getPeopleCoutingExcel (data) {
     url: '/camera/statistic/export',
     method: 'POST',
     data
-  }, downloadRequest).then(response => {
-    const startDateParts = data.startDate.split('-')
-    const endDateParts = data.endDate.split('-')
-    const fileName = data.startDate === data.endDate
-      ? `人流量统计${`${startDateParts[0]}年${startDateParts[1]}月${startDateParts[2]}日`}.xlsx`
-      : `人流量统计${`${startDateParts[0]}年${startDateParts[1]}月${startDateParts[2]}日`}-${`${endDateParts[0]}年${endDateParts[1]}月${endDateParts[2]}日`}.xlsx`
-    download(response, fileName)
   })
 }
 
@@ -160,8 +153,6 @@ export function getScreenOnlineExcel (data) {
     url: '/device/screen/online/export',
     method: 'POST',
     data
-  }, downloadRequest).then(response => {
-    download(response, `${data.startDate}-${data.endDate}_大屏终端上下线记录.xlsx`)
   })
 }
 

+ 5 - 2
src/views/realm/report/components/PeopleCountingDialog.vue

@@ -2,7 +2,7 @@
   <confirm-dialog
     ref="dialog"
     title="人流量统计"
-    confirm-text="下载"
+    confirm-text="添加任务"
     @confirm="onConfirm"
   >
     <template #default>
@@ -55,7 +55,10 @@ export default {
       getPeopleCoutingExcel({
         startDate: this.dateRange[0],
         endDate: parseTime(endDate, '{y}-{m}-{d}')
-      }, time).then(done)
+      }, time).then(({ data: { type } }) => {
+        this.$emit('added', type)
+        done()
+      })
     }
   }
 }

+ 2 - 2
src/views/realm/report/components/ScreenBroadcastDialog.vue

@@ -74,8 +74,8 @@ export default {
         deviceIdList: this.devices,
         startDate: this.dateRange[0],
         endDate: this.dateRange[1]
-      }).then(() => {
-        this.$emit('added')
+      }).then(({ data: { type } }) => {
+        this.$emit('added', type)
         done()
       })
     }

+ 5 - 2
src/views/realm/report/components/ScreenOnlineDialog.vue

@@ -3,7 +3,7 @@
     ref="dialog"
     size="lg fixed"
     title="大屏上下线记录"
-    confirm-text="下载"
+    confirm-text="添加任务"
     @confirm="onConfirm"
   >
     <template #default>
@@ -74,7 +74,10 @@ export default {
         deviceIdList: this.devices,
         startDate: this.dateRange[0],
         endDate: this.dateRange[1]
-      }).then(done)
+      }).then(({ data: { type } }) => {
+        this.$emit('added', type)
+        done()
+      })
     }
   }
 }

+ 24 - 3
src/views/realm/report/components/ServerAsyncTaskDialog.vue

@@ -8,7 +8,9 @@
 </template>
 
 <script>
-import { AppletOrderType } from '@/constant.js'
+import {
+  AppletOrderType, TaskStatus
+} from '@/constant.js'
 import { getServerAsyncTasks } from '../api.js'
 
 const TypeInfo = {
@@ -21,10 +23,28 @@ export default {
   name: 'ServerAsyncTaskDialog',
   data () {
     return {
-      schema: {
+      type: null
+    }
+  },
+  computed: {
+    schema () {
+      return {
         list: getServerAsyncTasks,
         autoRefreshEachPage: true,
         refreshInterval: 5000,
+        condition: { type: this.type },
+        filters: [
+          { key: 'type', type: 'select', options: [
+            { value: AppletOrderType.PACKAGE, label: '大屏播出单' },
+            { value: AppletOrderType.SOON, label: '大屏上下线记录' },
+            { value: AppletOrderType.DAILY, label: '人流量统计' }
+          ], placeholder: '任务类型' },
+          { key: 'status', type: 'select', options: [
+            { value: TaskStatus.CANCELLED, label: '待完成' },
+            { value: TaskStatus.DISABLE, label: '已完成' },
+            { value: TaskStatus.ENABLE, label: '下载失败' }
+          ], placeholder: '状态' }
+        ],
         cols: [
           { label: '任务类型', render: ({ type }) => TypeInfo[type] },
           { prop: 'createTime', label: '创建时间' },
@@ -42,7 +62,8 @@ export default {
     }
   },
   methods: {
-    show () {
+    show (type) {
+      this.type = typeof type === 'number' ? type : null
       this.$refs.dialog.show()
     },
     onDownload ({ downloadUrl }) {

+ 10 - 4
src/views/realm/report/index.vue

@@ -126,8 +126,14 @@
     <device-ad-dialog ref="deviceAdDialog" />
     <program-plays-dialog ref="programPlaysDialog" />
     <online-duration-dialog ref="onlineDurationDialog" />
-    <people-counting-dialog ref="peopleCountingDialog" />
-    <screen-online-dialog ref="screenOnlineDialogDialog" />
+    <people-counting-dialog
+      ref="peopleCountingDialog"
+      @added="showServerAsyncTask"
+    />
+    <screen-online-dialog
+      ref="screenOnlineDialogDialog"
+      @added="showServerAsyncTask"
+    />
     <screen-broadcast-dialog
       ref="screenBroadcastDialog"
       @added="showServerAsyncTask"
@@ -219,8 +225,8 @@ export default {
     addScreenBroadcastTask () {
       this.$refs.screenBroadcastDialog.show()
     },
-    showServerAsyncTask () {
-      this.$refs.serverAsyncTaskDialog.show()
+    showServerAsyncTask (type) {
+      this.$refs.serverAsyncTaskDialog.show(type)
     }
   }
 }