|
|
@@ -0,0 +1,183 @@
|
|
|
+<template>
|
|
|
+ <wrapper
|
|
|
+ fill
|
|
|
+ margin
|
|
|
+ padding
|
|
|
+ background
|
|
|
+ >
|
|
|
+ <schema-table
|
|
|
+ ref="table"
|
|
|
+ :schema="schema"
|
|
|
+ />
|
|
|
+ <confirm-dialog
|
|
|
+ ref="editDialog"
|
|
|
+ title="抓图参数配置"
|
|
|
+ @confirm="onConfirm"
|
|
|
+ >
|
|
|
+ <div class="c-grid-form auto u-align-self--center">
|
|
|
+ <span class="c-grid-form__label">启用</span>
|
|
|
+ <div class="l-flex--row c-grid-form__option">
|
|
|
+ <el-switch
|
|
|
+ v-model="config.enabled"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <span class="c-grid-form__label">抓图时间范围</span>
|
|
|
+ <el-time-picker
|
|
|
+ v-model="range"
|
|
|
+ class="u-width"
|
|
|
+ is-range
|
|
|
+ format="HH:mm:ss"
|
|
|
+ value-format="HH:mm:ss"
|
|
|
+ :clearable="false"
|
|
|
+ />
|
|
|
+ <span class="c-grid-form__label">抓图间隔(s)</span>
|
|
|
+ <el-input-number
|
|
|
+ v-model="config.offset"
|
|
|
+ controls-position="right"
|
|
|
+ :min="1"
|
|
|
+ step-strictly
|
|
|
+ />
|
|
|
+ <span class="c-grid-form__label">开机保护时间(s)</span>
|
|
|
+ <el-input-number
|
|
|
+ v-model="config.preserveSecond"
|
|
|
+ controls-position="right"
|
|
|
+ :min="0"
|
|
|
+ step-strictly
|
|
|
+ />
|
|
|
+ <span class="c-grid-form__label">确认黑屏持续时间(s)</span>
|
|
|
+ <el-input-number
|
|
|
+ v-model="config.confirmDuration"
|
|
|
+ class="has-info"
|
|
|
+ data-info="范围:1~60"
|
|
|
+ controls-position="right"
|
|
|
+ :min="1"
|
|
|
+ :max="60"
|
|
|
+ step-strictly
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </confirm-dialog>
|
|
|
+ <table-dialog
|
|
|
+ ref="resultDialog"
|
|
|
+ title="检测结果"
|
|
|
+ size="lg"
|
|
|
+ :schema="snapSchema"
|
|
|
+ />
|
|
|
+ <preview-dialog ref="previewDialog" />
|
|
|
+ </wrapper>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ Camera,
|
|
|
+ CameraToThirdPartyMap
|
|
|
+} from '@/constant'
|
|
|
+import { getThirdPartyDevices } from '@/api/external'
|
|
|
+import {
|
|
|
+ getSnapPicConfig,
|
|
|
+ updateSnapPicConfig,
|
|
|
+ getSnapPicResults
|
|
|
+} from './api'
|
|
|
+
|
|
|
+const statusMap = ['-', '未审核', '队列中', '审核中', '审核后正常', '审核后黑屏', '审核失败']
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'CameraSnapPic',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ schema: {
|
|
|
+ list: getThirdPartyDevices,
|
|
|
+ condition: { cameraType: Camera.LED, deviceType: CameraToThirdPartyMap[Camera.LED] },
|
|
|
+ filters: [
|
|
|
+ { key: 'name', type: 'search', placeholder: '名称' }
|
|
|
+ ],
|
|
|
+ cols: [
|
|
|
+ { type: 'refresh' },
|
|
|
+ { prop: 'name', label: '名称' },
|
|
|
+ { prop: 'identifier', label: '唯一标识' },
|
|
|
+ { type: 'tag', render: ({ onlineStatus }) => onlineStatus === 1
|
|
|
+ ? { type: 'success', label: '在线' }
|
|
|
+ : { type: 'danger', label: '离线' } },
|
|
|
+ { label: '使用情况', type: 'tag', render: ({ bound }) => bound
|
|
|
+ ? { type: 'success', label: '已使用' }
|
|
|
+ : { type: 'primary', label: '未使用' } },
|
|
|
+ { type: 'invoke', render: [
|
|
|
+ { label: '配置', on: this.onConfig },
|
|
|
+ { label: '检测结果', on: this.onResult }
|
|
|
+ ] }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ curIdentifier: '',
|
|
|
+ config: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ range: {
|
|
|
+ get () {
|
|
|
+ return [this.config.startTime || '', this.config.endTime || '']
|
|
|
+ },
|
|
|
+ set (val) {
|
|
|
+ this.$set(this.config, 'startTime', val[0])
|
|
|
+ this.$set(this.config, 'endTime', val[1])
|
|
|
+ }
|
|
|
+ },
|
|
|
+ snapSchema () {
|
|
|
+ return {
|
|
|
+ list: getSnapPicResults,
|
|
|
+ condition: { identifier: this.curIdentifier },
|
|
|
+ cols: [
|
|
|
+ { type: 'refresh' },
|
|
|
+ { prop: 'file', label: '截图', type: 'asset', on: this.onViewAsset },
|
|
|
+ { prop: 'snapTime', label: '抓图时间' },
|
|
|
+ { prop: 'auditState', label: '审核状态', render: ({ auditState }) => statusMap[auditState] || '-' },
|
|
|
+ { prop: 'auditMsg', label: '审核信息' },
|
|
|
+ { prop: 'auditTime', label: '审核时间' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onConfig (camera) {
|
|
|
+ getSnapPicConfig(camera.identifier).then(({ data }) => {
|
|
|
+ const { startTime, endTime, offset, preserveSecond, confirmDuration, enabled } = {
|
|
|
+ startTime: '07:00:00',
|
|
|
+ endTime: '22:00:00',
|
|
|
+ offset: 10,
|
|
|
+ preserveSecond: 10,
|
|
|
+ confirmDuration: 10,
|
|
|
+ enabled: false,
|
|
|
+ ...data
|
|
|
+ }
|
|
|
+ this.config = {
|
|
|
+ startTime,
|
|
|
+ endTime,
|
|
|
+ offset,
|
|
|
+ preserveSecond,
|
|
|
+ confirmDuration,
|
|
|
+ enabled
|
|
|
+ }
|
|
|
+ this.$identifier = camera.identifier
|
|
|
+ this.$refs.editDialog.show()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onConfirm (done) {
|
|
|
+ if (!this.config.startTime || !this.config.endTime) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请选择抓图时间范围'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ updateSnapPicConfig(this.$identifier, this.config).then(done)
|
|
|
+ },
|
|
|
+ onResult (camera) {
|
|
|
+ this.curIdentifier = camera.identifier
|
|
|
+ this.$refs.resultDialog.show()
|
|
|
+ },
|
|
|
+ onViewAsset ({ file }) {
|
|
|
+ this.$refs.previewDialog.show(file)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|