Selaa lähdekoodia

feat: 人流量数据支持按照选择设备导出

lihao16 1 päivä sitten
vanhempi
sitoutus
1b89e2c8cd

+ 35 - 13
src/views/realm/report/components/PeopleCountingDialog.vue

@@ -1,24 +1,33 @@
 <template>
   <confirm-dialog
     ref="dialog"
+    size="lg fixed"
     title="人流量统计"
     confirm-text="添加任务"
     @confirm="onConfirm"
   >
     <template #default>
-      <div class="c-grid-form auto u-align-self--center">
-        <div class="c-grid-form__label u-required">
-          日期范围
-        </div>
-        <el-date-picker
-          v-model="dateRange"
-          type="daterange"
-          range-separator="至"
-          value-format="yyyy-MM-dd"
-          :picker-options="pickerOptions"
-          :editable="false"
-          :clearable="false"
+      <div class="l-flex__fill l-flex">
+        <device-tree
+          class="c-sibling-item c-sidebar u-width--xl"
+          checkbox
+          @change="onChange"
         />
+        <div class="c-sibling-item far">
+          <div class="c-sibling-item--v u-required">
+            日期范围
+          </div>
+          <el-date-picker
+            v-model="dateRange"
+            class="c-sibling-item--v"
+            type="daterange"
+            value-format="yyyy-MM-dd"
+            range-separator="至"
+            :picker-options="pickerOptions"
+            :editable="false"
+            :clearable="false"
+          />
+        </div>
       </div>
     </template>
   </confirm-dialog>
@@ -32,7 +41,8 @@ export default {
   name: 'PeopleCoutingDialog',
   data () {
     return {
-      dateRange: null
+      dateRange: null,
+      devices: []
     }
   },
   computed: {
@@ -44,12 +54,24 @@ export default {
   },
   methods: {
     show () {
+      this.devices = null
       const date = parseTime(new Date(), '{y}-{m}-{d}')
       this.dateRange = [date, date]
       this.$refs.dialog.show()
     },
+    onChange (devices) {
+      this.devices = devices.map(device => device.id)
+    },
     onConfirm (done) {
+      if (!this.devices || !this.devices.length) {
+        this.$message({
+          type: 'warning',
+          message: '请选择设备'
+        })
+        return
+      }
       getPeopleCoutingExcel({
+        deviceIdList: this.devices,
         startDate: this.dateRange[0],
         endDate: this.dateRange[1]
       }).then(({ data: { type } }) => {

+ 1 - 1
src/views/screen/deploy/workflow/utils.js

@@ -9,7 +9,7 @@ import {
 import { parseDuration } from '@/utils'
 import { getEventDescription } from '@/utils/event.js'
 
-export function parseDeploy ({ programCalendarName, resolutionRatio, calendarReleaseDeviceList, targetList }) {
+export function parseDeploy ({ programCalendarName, resolutionRatio, calendarReleaseDeviceList = [], targetList }) {
   targetList = targetList.map(item => parsePublishTarget(item))
 
   let priority = '-'