Преглед на файлове

fix(ai): filtering of camera capture result

modify parameter range and add some operations
Casper Dai преди 2 години
родител
ревизия
cb85171fe6
променени са 2 файла, в които са добавени 71 реда и са изтрити 20 реда
  1. 21 3
      src/views/external/camera/snap/api.js
  2. 50 17
      src/views/external/camera/snap/index.vue

+ 21 - 3
src/views/external/camera/snap/api.js

@@ -6,6 +6,24 @@ import {
   addTenant
 } from '@/api/base'
 
+export const AduitStatus = {
+  SUBMITTED: 1,
+  QUEUE: 2,
+  REVIEWING: 3,
+  RESOLVED: 4,
+  REJECTED: 5,
+  FAILED: 6
+}
+
+export const AduitStatusInfo = {
+  [AduitStatus.SUBMITTED]: '待审核',
+  [AduitStatus.QUEUE]: '队列中',
+  [AduitStatus.REVIEWING]: '审核中',
+  [AduitStatus.RESOLVED]: '正常',
+  [AduitStatus.REJECTED]: '黑屏',
+  [AduitStatus.FAILED]: '审核失败'
+}
+
 // 查询抓图黑屏检测配置
 export function getSnapPicConfig (identifier) {
   return send({
@@ -35,13 +53,13 @@ export function getSnapPicResults (query) {
     })
   }).then(({ data, totalCount }) => {
     return {
-      data: data.map(({ snapPicUrl, ...params }) => {
+      data: data.map(({ snapPicUrl, picDeleted, ...params }) => {
         return {
-          file: snapPicUrl
+          file: snapPicUrl && !picDeleted
             ? {
               type: AssetType.IMAGE,
               url: snapPicUrl,
-              thumb: snapPicUrl
+              origin: true
             }
             : null,
           ...params

+ 50 - 17
src/views/external/camera/snap/index.vue

@@ -35,25 +35,31 @@
         <span class="c-grid-form__label">抓图间隔(s)</span>
         <el-input-number
           v-model="config.offset"
+          class="has-info"
+          data-info="范围:5~50"
           controls-position="right"
-          :min="1"
+          :min="5"
+          :max="50"
           step-strictly
         />
         <span class="c-grid-form__label">开机保护时间(s)</span>
         <el-input-number
           v-model="config.preserveSecond"
+          class="has-info"
+          data-info="范围:0~3600"
           controls-position="right"
           :min="0"
+          :max="3600"
           step-strictly
         />
-        <span class="c-grid-form__label">确认黑屏持续时间(s)</span>
+        <span class="c-grid-form__label">确认黑屏持续时间(min)</span>
         <el-input-number
           v-model="config.confirmDuration"
           class="has-info"
-          data-info="范围:1~60"
+          data-info="范围:1~30"
           controls-position="right"
           :min="1"
-          :max="60"
+          :max="30"
           step-strictly
         />
       </div>
@@ -65,6 +71,8 @@
       :schema="snapSchema"
     />
     <preview-dialog ref="previewDialog" />
+    <camera-dialog ref="cameraDialog" />
+    <mesh-dialog ref="meshDialog" />
   </wrapper>
 </template>
 
@@ -75,15 +83,19 @@ import {
 } from '@/constant'
 import { getThirdPartyDevices } from '@/api/external'
 import {
+  AduitStatus,
+  AduitStatusInfo,
   getSnapPicConfig,
   updateSnapPicConfig,
   getSnapPicResults
 } from './api'
-
-const statusMap = ['-', '未审核', '队列中', '审核中', '审核后正常', '审核后黑屏', '审核失败']
+import MeshDialog from '../../components/MeshDialog.vue'
 
 export default {
   name: 'CameraSnapPic',
+  components: {
+    MeshDialog
+  },
   data () {
     return {
       schema: {
@@ -103,12 +115,14 @@ export default {
             ? { type: 'success', label: '已使用' }
             : { type: 'primary', label: '未使用' } },
           { type: 'invoke', render: [
+            { label: '查看', allow: ({ onlineStatus }) => onlineStatus, on: this.onView },
+            { label: '所属网点', allow: ({ bound }) => bound, on: this.onViewMesh },
             { label: '配置', on: this.onConfig },
             { label: '检测结果', on: this.onResult }
-          ] }
+          ], width: 260 }
         ]
       },
-      curIdentifier: '',
+      cameraId: null,
       config: {}
     }
   },
@@ -125,14 +139,27 @@ export default {
     snapSchema () {
       return {
         list: getSnapPicResults,
-        condition: { identifier: this.curIdentifier },
+        condition: { cameraId: this.cameraId },
         cols: [
-          { type: 'refresh' },
-          { prop: 'file', label: '截图', type: 'asset', on: this.onViewAsset },
-          { prop: 'snapTime', label: '抓图时间' },
-          { prop: 'auditState', label: '审核状态', render: ({ auditState }) => statusMap[auditState] || '-' },
+          { prop: 'file', type: 'asset', on: this.onViewAsset, refresh: true },
+          { prop: 'snapTime', label: '抓图时间', width: 160 },
+          { prop: 'auditState', label: '审核状态', type: 'tag', render: ({ auditState }) => {
+            const info = AduitStatusInfo[auditState]
+            return info
+              ? {
+                type: auditState === AduitStatus.RESOLVED
+                  ? 'success'
+                  : auditState === AduitStatus.REJECTED
+                    ? 'danger'
+                    : auditState === AduitStatus.FAILED
+                      ? 'warning'
+                      : 'primary',
+                label: info
+              }
+              : null
+          }, width: 120, align: 'center' },
           { prop: 'auditMsg', label: '审核信息' },
-          { prop: 'auditTime', label: '审核时间' }
+          { prop: 'auditTime', label: '审核时间', width: 160 }
         ]
       }
     }
@@ -144,8 +171,8 @@ export default {
           startTime: '07:00:00',
           endTime: '22:00:00',
           offset: 10,
-          preserveSecond: 10,
-          confirmDuration: 10,
+          preserveSecond: 0,
+          confirmDuration: 1,
           enabled: false,
           ...data
         }
@@ -171,8 +198,14 @@ export default {
       }
       updateSnapPicConfig(this.$identifier, this.config).then(done)
     },
+    onView (camera) {
+      this.$refs.cameraDialog.show(camera)
+    },
+    onViewMesh ({ id }) {
+      this.$refs.meshDialog.show(id)
+    },
     onResult (camera) {
-      this.curIdentifier = camera.identifier
+      this.cameraId = camera.id
       this.$refs.resultDialog.show()
     },
     onViewAsset ({ file }) {