Przeglądaj źródła

[FE]AI任务 进出记录

chenxr3 4 lat temu
rodzic
commit
545c278df0

+ 10 - 0
security-protection-platform/src/api/videoSurveillance/index.js

31
    return $default.get(`/sp/uploadFile/getFileUrl?fileName=${id}`).then(resp => {
31
    return $default.get(`/sp/uploadFile/getFileUrl?fileName=${id}`).then(resp => {
32
      return resp
32
      return resp
33
    }).catch((err) => { return err })
33
    }).catch((err) => { return err })
34
  },
35
  // 识别记录
36
  getDistinguishData(data) {
37
    return $default.get(`/sp/aiIdenLogManagement/queryAllAiIdenLogPicture`, data).then(resp => {
38
      return resp
39
    }).catch((err) => { return err })
40
  },
41
  // 识别记录详情
42
  queryOneAiIdenLog(data) {
43
    return $default.get('/sp/aiIdenLogManagement/queryOneAiIdenLog?aiIdenLogId=' + data).catch((err) => { return err })
34
  }
44
  }
35
}
45
}
36
export default api
46
export default api

BIN
security-protection-platform/src/assets/images/border.png


+ 337 - 45
security-protection-platform/src/modules/system/assignment/index.vue

3
    <t-card class="page-card">
3
    <t-card class="page-card">
4
      <div class="select-confidtion-box row">
4
      <div class="select-confidtion-box row">
5
        <div class="col-3">任务名称:
5
        <div class="col-3">任务名称:
6
          <t-select v-model="taskName" width="200px">
7
            <t-option v-for="item in taskNameList" :key="item.id" :value="item.charSpecValueId">{{ item.description }}</t-option>
6
          <t-select v-model="taskName" filterable width="200px">
7
            <t-option v-for="item in taskNameList" :key="item.aiTaskId" :value="item.aiTaskName">{{ item.aiTaskName }}</t-option>
8
          </t-select>
8
          </t-select>
9
        </div>
9
        </div>
10
        <div class="col-3">匹配模型:
10
        <div class="col-3">匹配模型:
11
          <t-select v-model="matchingType" width="200px">
11
          <t-select v-model="matchingType" width="200px">
12
            <t-option v-for="item in matchingTypeList" :key="item.id" :value="item.charSpecValueId">{{ item.description }}</t-option>
12
            <t-option v-for="item in matchingTypeList" :key="item.aiIdenModel" :value="item.aiIdenModel">{{ item.name }}</t-option>
13
          </t-select>
13
          </t-select>
14
        </div>
14
        </div>
15
        <div class="col-3">任务状态:
15
        <div class="col-3">任务状态:
16
          <t-select v-model="taskStatus" width="200px">
16
          <t-select v-model="taskStatus" width="200px">
17
            <t-option v-for="item in taskStatusList" :key="item.id" :value="item.charSpecValueId">{{ item.description }}</t-option>
17
            <t-option v-for="item in taskStatusList" :key="item.id" :value="item.id">{{ item.description }}</t-option>
18
          </t-select>
18
          </t-select>
19
        </div>
19
        </div>
20
        <div class="col-2 offset-1 select-button-box" align="end">
20
        <div class="col-2 offset-1 select-button-box" align="end">
23
        </div>
23
        </div>
24
      </div>
24
      </div>
25
      <div class="function-button-box">
25
      <div class="function-button-box">
26
        <t-button color="primary">
26
        <t-button color="primary" @click="addAiTask">
27
          <t-icon icon="plus-circle-outline" size="16"></t-icon>新增
27
          <t-icon icon="plus-circle-outline" size="16"></t-icon>新增
28
        </t-button>
28
        </t-button>
29
        <t-button @click="multDeleteDeviceData">
29
        <t-button @click="multdeleteAiTaskData">
30
          <t-icon icon="trash" size="16"></t-icon>删除
30
          <t-icon icon="trash" size="16"></t-icon>删除
31
        </t-button>
31
        </t-button>
32
      </div>
32
      </div>
43
            </template>
43
            </template>
44
          </t-table-column>
44
          </t-table-column>
45
          <t-table-column prop="aiTaskStatus" align="center" style="background-color:#000" label="状态" width="120">
45
          <t-table-column prop="aiTaskStatus" align="center" style="background-color:#000" label="状态" width="120">
46
            <template v-slot="{row}">
47
              <div :class="getTypecellClass(row.aiTaskStatus)" class="tag-cell">
48
                <span class="status-ball"></span>{{ row.aiTaskStatus }}
49
              </div>
46
            <template slot-scope="scope">
47
              <t-tag v-if="scope.row.aiTaskStatus=== 'RUN'" state="success">执行中</t-tag>
48
              <t-tag v-if="scope.row.aiTaskStatus=== 'STO'" state="stoped">已停止</t-tag>
50
            </template>
49
            </template>
51
          </t-table-column>
50
          </t-table-column>
52
          <t-table-column label="操作">
51
          <t-table-column label="操作">
53
            <template v-slot="{row}">
52
            <template v-slot="{row}">
54
              <a href="javascript:;" style="color:#0089D4;">编辑</a>
55
              <a href="javascript:;" style="color:#0089D4;" @click="deleteDeviceData(row)">删除</a>
56
              <a href="javascript:;" style="color:#0089D4;">执行</a>
57
              <a href="javascript:;" style="color:#0089D4;">停止</a>
53
              <a href="javascript:;" style="color:#0089D4;" @click="updAiTask(row)">编辑</a>
54
              <a href="javascript:;" style="color:#0089D4;" @click="deleteAiTaskData(row)">删除</a>
55
              <a href="javascript:;" style="color:#0089D4;" @click="changeToRUN(row)">执行</a>
56
              <a href="javascript:;" style="color:#0089D4;" @click="changeToSTO(row)">停止</a>
58
            </template>
57
            </template>
59
          </t-table-column>
58
          </t-table-column>
60
        </t-table>
59
        </t-table>
61
      </div>
60
      </div>
62
      <div class="table-pager">
61
      <div class="table-pager">
63
        <t-pager :current.sync="page" :total="total" :page-size="limit" :sizer-range="[10,20,50,100]" show-elevator show-sizer @on-size-change="onSizeChange" @on-change="onChange">>
62
        <t-pager :current.sync="page" :total="total" :page-size="limit" :sizer-range="[10,20,50,100]"
63
                 show-elevator show-sizer @on-size-change="onSizeChange" @on-change="onChange">
64
        </t-pager>
64
        </t-pager>
65
      </div>
65
      </div>
66
    </t-card>
66
    </t-card>
68
    <!-- <template>
68
    <!-- <template>
69
      <send-order-modal :data="currentDeviceData"></send-order-modal>
69
      <send-order-modal :data="currentDeviceData"></send-order-modal>
70
    </template> -->
70
    </template> -->
71
72
    <t-modal :visibled.sync="aiTaskModal" :mask-closable="false" title="AI任务" width="1000px">
73
      <p style="margin-bottom: 0px;text-align: left;line-height: 18px;font-size: 14px;border-left: 4px solid #147bd1;padding-left: 10px;"><b>基本信息</b></p>
74
      <p></p>
75
      <t-form ref="aiTaskModalForm" :model="aiTaskModalForm" :rules="aiTaskModalFormRules" :label-span="2" label-position="right">
76
        <div class="row">
77
          <div class="col">
78
            <t-form-item label="任务名称" prop="aiTaskName">
79
              <t-input v-model="aiTaskModalForm.aiTaskName" placeholder="请输入任务名称"></t-input>
80
            </t-form-item>
81
          </div>
82
          <div class="col">
83
            <t-form-item label="匹配模型" prop="aiIdenModel">
84
              <t-select v-model="aiTaskModalForm.aiIdenModel" >
85
                <t-option v-for="item in matchingTypeList" :key="item.aiIdenModel" :value="item.aiIdenModel">{{ item.name }}</t-option>
86
              </t-select>
87
            </t-form-item>
88
          </div>
89
        </div>
90
      </t-form>
91
      <p style="margin-bottom: 0px;text-align: left;line-height: 18px;font-size: 14px;border-left: 4px solid #147bd1;padding-left: 10px;"><b>执行设备</b></p>
92
      <div>
93
94
      </div>
95
      <div class="grid-demo">
96
        <t-row>
97
          <t-col span="2" push="10">
98
            <t-button color="primary" @click="getDeviceData">
99
              可选设备
100
            </t-button>
101
          </t-col>
102
          <t-col span="4" pull="4">关联执行设备:</t-col>
103
        </t-row>
104
      </div>
105
      <t-table :data="aiTaskModalForm.aiTaskDeviceList" line>
106
        <t-table-column prop="resourceToolCode" label="设备编号" width="100"></t-table-column>
107
        <t-table-column prop="resourceToolName" label="设备名称" width="100"></t-table-column>
108
        <t-table-column prop="resourceToolTypeName" label="设备类型" width="100"></t-table-column>
109
        <t-table-column label="操作" width="100">
110
          <template v-slot="{row}">
111
            <a href="javascript:;" style="color:#0089D4;" @click="deleteDeviceData(row)">删除</a>
112
          </template>
113
        </t-table-column>
114
      </t-table>
115
      <div slot="footer">
116
        <t-button :loading="loadingSubmit" color="primary" @click="onSubmit">确认</t-button>
117
        <t-button type="danger" long @click="aiTaskModal = false">关闭</t-button>
118
      </div>
119
    </t-modal>
120
    <t-modal :visibled.sync="aiTaskDeviceModal" :mask-closable="false" title="AI任务" width="800px">
121
      <t-table :data="deviceData.list" line @selection-change="deviceDataSelectChange">
122
        <t-table-column type="selection" width="70"></t-table-column>
123
        <t-table-column prop="resourceToolCode" label="设备编号" width="110"></t-table-column>
124
        <t-table-column prop="resourceToolName" label="设备名称" width="120"></t-table-column>
125
        <t-table-column prop="resourceToolTypeName" label="设备类型" width="120"></t-table-column>
126
      </t-table>
127
      <div class="table-pager">
128
        <t-pager :current.sync="deviceData.page" :total="deviceData.total" :page-size="deviceData.limit" :sizer-range="[10,20,50,100]"
129
                 show-elevator show-sizer @on-size-change="onDeviceSizeChange" @on-change="onDeviceChange">
130
        </t-pager>
131
      </div>
132
      <div slot="footer">
133
        <t-button color="primary" @click="addAiTaskDevice">确认</t-button>
134
        <t-button type="danger" long @click="aiTaskDeviceModal = false">关闭</t-button>
135
      </div>
136
    </t-modal>
71
  </div>
137
  </div>
72
</template>
138
</template>
73
139
91
      // 匹配模型列表
157
      // 匹配模型列表
92
      matchingTypeList: [],
158
      matchingTypeList: [],
93
      // 任务状态列表
159
      // 任务状态列表
94
      taskStatusList: [],
160
      taskStatusList: [
161
        {
162
          id: 'RUN',
163
          description: '执行中'
164
        },
165
        {
166
          id: 'STO',
167
          description: '已停止'
168
        }
169
      ],
95
      // 任务数据列表
170
      // 任务数据列表
96
      taskDataList: [],
171
      taskDataList: [],
97
      // 匹配模型
172
      // 匹配模型
103
      // 当前页的数据个数
178
      // 当前页的数据个数
104
      limit: 10,
179
      limit: 10,
105
      // 数据总数
180
      // 数据总数
106
      total: 100,
181
      total: 0,
107
      // 批量删除的设备id
182
      // 批量删除的设备id
108
      deletetaskStatus: [],
183
      deletetaskStatus: [],
109
      // 当前设备数据
184
      // 当前设备数据
110
      currentDeviceData: {}
185
      currentDeviceData: {},
186
      // 模态框开关
187
      aiTaskModal: false,
188
      aiTaskDeviceModal: false,
189
      // 模态框表单数据
190
      aiTaskModalForm: {
191
        aiTaskName: '',
192
        aiIdenModel: '',
193
        aiTaskStatus: '',
194
        // 配置任务模态框列表数据
195
        aiTaskDeviceList: []
196
      },
197
      // 模态框表单数据验证规则
198
      aiTaskModalFormRules: {
199
        aiTaskName: [
200
          { required: true, message: '任务名称不能为空' }
201
        ],
202
        aiIdenModel: [
203
          { required: true, message: '匹配模型不能为空' }
204
        ]
205
      },
206
      // 设备数据
207
      deviceData: {
208
        page: 1,
209
        limit: 10,
210
        total: 0,
211
        list: []
212
      },
213
      // 设备列表选中的数据
214
      deviceDataSelectList: [],
215
      loadingSubmit: false,
216
      submitType: 1
111
    }
217
    }
112
  },
218
  },
113
  created () {
219
  created () {
117
  },
223
  },
118
  methods: {
224
  methods: {
119
    getAiTaskData() {
225
    getAiTaskData() {
120
      sysapi.getAiTaskList({params: {aiTaskId: 9}}).then(res => {
226
      var params = {
227
        params: {
228
          workOrgId: null,
229
          nameAsLike: this.taskName,
230
          aiIdenModel: this.matchingType,
231
          aiTaskStatus: this.taskStatus,
232
          pageNumber: this.page,
233
          pageSize: this.limit
234
        }
235
      }
236
      sysapi.getAiTaskList(params).then(res => {
121
        this.taskDataList = res.data.data.data
237
        this.taskDataList = res.data.data.data
238
        this.total = res.data.data.total
122
        console.log(this.taskDataList)
239
        console.log(this.taskDataList)
123
      })
240
      })
124
    },
241
    },
125
    // 获取任务名称下拉框
242
    // 获取任务名称下拉框
126
    getTaskName() {
243
    getTaskName() {
127
      sysapi.getCharSpecList('AI_TASK_STATUS').then(res => {
128
        this.taskStatusList = res.data
244
      var params = {
245
        params: {
246
          workOrgId: null,
247
          name: null,
248
          nameAsLike: null,
249
          aiIdenModel: null,
250
          statusList: null,
251
          pageNumber: 1,
252
          pageSize: 10000
253
        }
254
      }
255
      sysapi.getAiTaskList(params).then(res => {
256
        this.taskNameList = res.data.data.data
129
      })
257
      })
258
      // sysapi.getCharSpecList('AI_TASK_STATUS').then(res => {
259
      //   this.taskStatusList = res.data
260
      // })
130
    },
261
    },
131
    // 获取匹配模型下拉框
262
    // 获取匹配模型下拉框
132
    getmatchingType() {
263
    getmatchingType() {
133
      sysapi.getAiTaskModelList().then(res => {
264
      sysapi.getAiTaskModelList().then(res => {
134
        console.log(res)
265
        console.log(res)
135
        this.matchingTypeList = res.data
266
        this.matchingTypeList = res.data.data
136
      })
267
      })
137
    },
268
    },
138
    getTypecellClass (orderTypeName) {
139
      let typecellClass = ''
140
      switch (orderTypeName) {
141
        case '摄像头':
142
        case '门禁':
143
          typecellClass = 'tag-cell-executing'
144
          break
145
        case '人脸终端':
146
          typecellClass = 'tag-cell-stoped'
147
          break
269
    // 获取设备列表
270
    getDeviceData () {
271
      this.aiTaskDeviceModal = true
272
      let params = {
273
        pageNumber: this.deviceData.page,
274
        pageSize: this.deviceData.limit // 每页条数
148
      }
275
      }
149
      return typecellClass
276
      sysapi.getResourceTool(params).then((resp) => {
277
        this.deviceData.list = resp.data.data.data || []
278
        this.deviceData.total = resp.data.data.total
279
      })
150
    },
280
    },
281
    addAiTask() {
282
      this.submitType = 1
283
      this.aiTaskModal = true
284
      this.aiTaskModalForm = {
285
        aiTaskName: '',
286
        aiIdenModel: '',
287
        aiTaskStatus: '',
288
        aiTaskDeviceList: []
289
      }
290
    },
291
    updAiTask(row) {
292
      this.submitType = 2
293
      this.aiTaskModal = true
294
      this.aiTaskModalForm = {
295
        aiTaskName: '',
296
        aiIdenModel: '',
297
        aiTaskStatus: '',
298
        aiTaskDeviceList: []
299
      }
300
      var params = {
301
        params: {aiTaskId: row.aiTaskId}
302
      }
303
      sysapi.getAiTaskById(params).then(res => {
304
        this.aiTaskModalForm = res.data.data
305
      })
306
    },
307
    // getTypecellClass (orderTypeName) {
308
    //   let typecellClass = ''
309
    //   switch (orderTypeName) {
310
    //     case 'RUN':
311
    //       typecellClass = 'tag-cell tag-cell-success'
312
    //       break
313
    //     case 'INI':
314
    //       typecellClass = 'tag-cell-stoped'
315
    //       break
316
    //   }
317
    //   return typecellClass
318
    // },
151
    // 查询数据
319
    // 查询数据
152
    selectHandle () {
320
    selectHandle () {
153
      this.page = 1
321
      this.page = 1
154
      this.getDeviceData()
322
      this.getAiTaskData()
155
    },
323
    },
156
    // 重置查询数据
324
    // 重置查询数据
157
    resetData () {
325
    resetData () {
159
      this.taskName = ''
327
      this.taskName = ''
160
      this.taskStatus = ''
328
      this.taskStatus = ''
161
      this.matchingType = ''
329
      this.matchingType = ''
162
      this.getDeviceData()
330
      this.getAiTaskData()
163
    },
331
    },
164
    // 当前页改变 触发事件
332
    // 当前页改变 触发事件
165
    onChange (page) {
333
    onChange (page) {
166
      this.page = page
334
      this.page = page
167
      this.getDeviceData()
335
      this.getAiTaskData()
168
    },
336
    },
169
    // 当前页数据总数改变 触发事件
337
    // 当前页数据总数改变 触发事件
170
    onSizeChange (pageSize) {
338
    onSizeChange (pageSize) {
171
      this.limit = pageSize
339
      this.limit = pageSize
340
      this.getAiTaskData()
341
    },
342
    // 当前页改变 触发事件
343
    onDeviceChange (page) {
344
      this.deviceData.page = page
345
      this.getDeviceData()
346
    },
347
    // 当前页数据总数改变 触发事件
348
    onDeviceSizeChange (pageSize) {
349
      this.deviceData.limit = pageSize
172
      this.getDeviceData()
350
      this.getDeviceData()
173
    },
351
    },
174
    // 删除数据
352
    // 删除数据
175
    deleteDeviceData (row) {
353
    deleteAiTaskData (row) {
176
      this.$Confirm.confirm({
354
      this.$Confirm.confirm({
177
        title: '正在准备删除...',
355
        title: '正在准备删除...',
178
        content: '<p>确定要删除?</p><p>删除后将无法还原!</p>',
356
        content: '<p>确定要删除?</p><p>删除后将无法还原!</p>',
179
        ok: async () => {
357
        ok: async () => {
180
          const res = await sysapi.deleteDeviceData({ taskStatus: row.taskStatus })
358
          const res = await sysapi.deleteAiTaskData([row.aiTaskId])
181
          if (res.status === 200) {
359
          if (res.status === 200) {
182
            this.getDeviceData()
360
            this.getAiTaskData()
183
            this.$Message.success('删除成功!')
361
            this.$Message.success('删除成功!')
184
          } else {
362
          } else {
185
            this.$Message.danger('删除失败!')
363
            this.$Message.danger('删除失败!')
190
        }
368
        }
191
      })
369
      })
192
    },
370
    },
371
    // 修改状态
372
    changeToRUN (row) {
373
      if (row.aiTaskStatus === 'RUN') {
374
        this.$Message.success('任务正在执行!')
375
      } else {
376
        this.changeAiTaskStatus(row, 'RUN')
377
      }
378
    },
379
    changeToSTO (row) {
380
      if (row.aiTaskStatus === 'STO') {
381
        this.$Message.success('任务已停止!')
382
      } else {
383
        this.changeAiTaskStatus(row, 'STO')
384
      }
385
    },
386
    changeAiTaskStatus(row, status) {
387
      var params = {
388
        params: {aiTaskId: row.aiTaskId}
389
      }
390
      sysapi.getAiTaskById(params).then(res => {
391
        params = res.data.data
392
        params.aiTaskStatus = status
393
        sysapi.createAiTask(params)
394
          .then((resp) => {
395
            if (resp.data.success) {
396
              this.$Message.success('修改状态成功!')
397
              this.getAiTaskData()
398
            } else {
399
              this.$Message.danger(resp.data.fail.message)
400
            }
401
          })
402
          .catch((error) => {
403
            this.$Message.danger('修改状态失败!')
404
          })
405
      })
406
    },
193
    // 当复选框发生改变时 触发事件
407
    // 当复选框发生改变时 触发事件
194
    selectChange (data) {
408
    selectChange (data) {
195
      const arr = []
196
      data.forEach(item => arr.push(item.taskStatus))
197
      this.deletetaskStatus = arr
409
      this.deletetaskStatus = data
410
    },
411
    // 当设备列表复选框发生改变时 触发事件
412
    deviceDataSelectChange (data) {
413
      this.deviceDataSelectList = data
414
    },
415
    // 设备列表模态框确认事件
416
    addAiTaskDevice () {
417
      this.aiTaskDeviceModal = false
418
      this.aiTaskModalForm.aiTaskDeviceList = this.aiTaskModalForm.aiTaskDeviceList.concat(this.deviceDataSelectList)
419
      this.aiTaskModalForm.aiTaskDeviceList = this.unique(this.aiTaskModalForm.aiTaskDeviceList)
420
      this.deviceDataSelectList = []
421
    },
422
    // 数组去重
423
    unique: function (arr) {
424
      for (var i = 0; i < arr.length; i++) {
425
        for (var j = i + 1; j < arr.length; j++) {
426
          if (arr[i].resourceToolId == arr[j].resourceToolId) {
427
            arr.splice(j, 1)
428
            j--
429
          }
430
        }
431
      }
432
      return arr
433
    },
434
    // 新增任务提交
435
    onSubmit() {
436
      this.loadingSubmit = true
437
      this.$refs['aiTaskModalForm'].validate((valid) => {
438
        if (valid) {
439
          var params
440
          if (this.submitType === 1) {
441
            params = {
442
              aiTaskName: this.aiTaskModalForm.aiTaskName,
443
              aiIdenModel: this.aiTaskModalForm.aiIdenModel,
444
              aiTaskStatus: 'RUN',
445
              aiTaskDeviceList: this.aiTaskModalForm.aiTaskDeviceList
446
            }
447
          } else {
448
            params = {
449
              aiTaskId: this.aiTaskModalForm.aiTaskId,
450
              aiTaskName: this.aiTaskModalForm.aiTaskName,
451
              aiIdenModel: this.aiTaskModalForm.aiIdenModel,
452
              aiTaskStatus: this.aiTaskModalForm.aiTaskStatus,
453
              aiTaskDeviceList: this.aiTaskModalForm.aiTaskDeviceList
454
            }
455
          }
456
          sysapi.createAiTask(params)
457
            .then((resp) => {
458
              if (resp.data.success) {
459
                this.$Message.success('提交成功')
460
                this.aiTaskModal = false
461
                this.getAiTaskData()
462
              } else {
463
                this.$Message.danger(resp.data.fail.message)
464
              }
465
            })
466
            .catch((error) => {
467
              console.log(error)
468
              this.$Message.danger('提交失败')
469
            }).finally(() => {
470
              this.loadingSubmit = false
471
            })
472
        } else {
473
          console.log('error--------->请输入完整的表单信息!')
474
          this.loadingSubmit = false
475
        }
476
      })
477
    },
478
    deleteDeviceData(row) {
479
      var arr = []
480
      this.aiTaskModalForm.aiTaskDeviceList.forEach(e => {
481
        if (e.resourceToolId != row.resourceToolId) {
482
          arr.push(e)
483
        }
484
      })
485
      this.aiTaskModalForm.aiTaskDeviceList = arr
198
    },
486
    },
199
    // 批量删除数据
487
    // 批量删除数据
200
    multDeleteDeviceData () {
488
    multdeleteAiTaskData () {
201
      if (this.deletetaskStatus.length === 0) {
489
      if (this.deletetaskStatus.length === 0) {
202
        return this.$Message.warning('请选择要删除的数据!')
490
        return this.$Message.warning('请选择要删除的数据!')
203
      }
491
      }
492
      var idList = []
493
      this.deletetaskStatus.forEach(e => {
494
        idList.push(e.aiTaskId)
495
      })
204
      this.$Confirm.confirm({
496
      this.$Confirm.confirm({
205
        title: '正在准备删除...',
497
        title: '正在准备删除...',
206
        content: '<p>确定要删除?</p><p>删除后将无法还原!</p>',
498
        content: '<p>确定要删除?</p><p>删除后将无法还原!</p>',
207
        ok: async () => {
499
        ok: async () => {
208
          const res = await sysapi.deleteDeviceData({ taskStatus: this.deletetaskStatus })
500
          const res = await sysapi.deleteAiTaskData(idList)
209
          if (res.status === 200) {
501
          if (res.status === 200) {
210
            this.getDeviceData()
502
            this.getAiTaskData()
211
            this.$Message.success('删除成功!')
503
            this.$Message.success('删除成功!')
212
          } else {
504
          } else {
213
            this.$Message.danger('删除失败!')
505
            this.$Message.danger('删除失败!')

+ 138 - 48
security-protection-platform/src/modules/videoSurveillance/distinguishRecord/index.vue

1
<template>
1
<template>
2
  <div class="page-main">
2
  <div class="page-main">
3
    <div class="page-top row-12">
3
    <div class="page-top row-12">
4
      <div class="col-4">开始时间:<t-date-picker v-model="startDate" style="width:200px" placeholder="请选择开始时间"></t-date-picker>
4
      <div class="col-4">开始时间:<t-date-picker v-model="startDate" type="dateTime" style="width:200px" placeholder="请选择开始时间"></t-date-picker>
5
      </div>
5
      </div>
6
      <div class="col-4">结束时间:<t-date-picker v-model="endDate" style="width:200px" placeholder="请选择结束时间"></t-date-picker>
6
      <div class="col-4">结束时间:<t-date-picker v-model="endDate" type="dateTime" style="width:200px" placeholder="请选择结束时间"></t-date-picker>
7
      </div>
7
      </div>
8
      <div class="col-4 button-box" align="end">
8
      <div class="col-4 button-box" align="end">
9
        <t-button color="primary" @click="getData">查询</t-button>
9
        <t-button color="primary" @click="getData">查询</t-button>
10
        <t-button @click="resetData">重置</t-button>
10
        <t-button @click="initData">重置</t-button>
11
      </div>
11
      </div>
12
    </div>
12
    </div>
13
    <div class="page-content">
13
    <div class="page-content">
14
      <div class="distinguish">
14
      <div class="distinguish">
15
        识别图片<img :src="distinguishUrl" class="distinguish-img">
15
        <b>识别图片</b>
16
        <div v-if="distinguishUrl !== ''">
17
          <img :src="distinguishUrl" class="distinguish-img">
18
        </div>
19
        <div v-else>
20
          <t-empty size="lg"></t-empty>
21
        </div>
16
      </div>
22
      </div>
17
      <div class="distinguish">
23
      <div class="distinguish">
18
        识别视频<img :src="distinguishUrl" class="distinguish-img">
24
        <b>识别视频</b>
25
        <div v-if="distinguishUrl !== ''">
26
          <div class="distinguish-video">
27
            <video-player ref="videoPlayer" :playsinline="true" :options="playerOptions" class="video-player vjs-custom-skin"></video-player>
28
          </div>
29
        </div>
30
        <div v-else>
31
          <t-empty size="lg"></t-empty>
32
        </div>
19
      </div>
33
      </div>
20
    </div>
34
    </div>
21
    <div class="page-bottom">
35
    <div class="page-bottom">
22
      <div>
36
      <div>
23
        识别结果
37
        <b>识别结果</b>
24
        <div class="bottom-result">
38
        <div class="bottom-result">
25
          <div class="page-top row-12">
39
          <div class="page-top row-12">
26
            <div class="result-txt col-6">设备位置:<span style="color:rgba(0, 0, 0, 0.65)">{{ devicePosition }}</span></div>
40
            <div class="result-txt col-6">设备位置:<span style="color:rgba(0, 0, 0, 0.65)">{{ devicePosition }}</span></div>
30
        </div>
44
        </div>
31
      </div>
45
      </div>
32
      <div class="img-viewer">
46
      <div class="img-viewer">
33
        <div v-for="(item,index) in dataImg" :key="index" :src="item.url" class="image-carousel">
34
          <img :src="item.url" class="img-viewer-size">
35
          <span>{{ item.date }}</span>
47
        <div v-for="(item,index) in dataImg" :key="index" :src="item.idenPictureUrl" class="image-carousel">
48
          <img :src="'http://10.19.90.34:19000/ai-image/'+item.idenPictureUrl" class="img-viewer-size" @click="getParticularsData(item.aiIdenLogId,index)">
49
          <span :class="{'fileName' : index === fileNameIndex}" style="width: 132px;margin-right: 14px;text-align:center">{{ item.fileName }}</span>
36
        </div>
50
        </div>
37
      </div>
51
      </div>
38
    </div>
52
    </div>
49
      captureTIme: '',
63
      captureTIme: '',
50
      defineResult: '',
64
      defineResult: '',
51
      devicePosition: '',
65
      devicePosition: '',
52
      distinguishUrl: '/static/images/demo.png',
53
      dataImg: [
54
        {
55
          url: '/static/images/demo.png'
56
        },
57
        {
58
          url: '/static/images/demo.png'
59
        },
60
        {
61
          url: '/static/images/demo.png'
62
        },
63
        {
64
          url: '/static/images/demo.png'
65
        },
66
        {
67
          url: '/static/images/demo.png'
68
        },
69
        {
70
          url: '/static/images/demo.png'
71
        },
72
        {
73
          url: '/static/images/demo.png'
74
        },
75
        {
76
          url: '/static/images/demo.png'
66
      distinguishUrl: '',
67
      dataImg: [],
68
      fileNameIndex: 0,
69
      playerOptions: {
70
        playbackRates: [0.7, 1.0, 1.5, 2.0], // 播放速度
71
        autoplay: true, // 如果true,浏览器准备好时开始回放。
72
        muted: true, // 默认情况下将会消除任何音频。
73
        loop: false, // 导致视频一结束就重新开始。
74
        preload: 'auto', // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
75
        language: 'zh-CN',
76
        aspectRatio: '13:10', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
77
        // fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
78
        // 是否流体自适应容器宽高
79
        fluid: false,
80
        // // 设置视频播放器的显示宽度(以像素为单位)
81
        // width: '500px',
82
        // // 设置视频播放器的显示高度(以像素为单位)
83
        height: 380,
84
        sources: [{
85
          type: 'video/mp4', // 这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目
86
          src: '' // url地址
87
        }],
88
89
        notSupportedMessage: '暂无视频可播放,请稍后再试', // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
90
        controlBar: {
91
          timeDivider: true,
92
          // durationDisplay: true,
93
          remainingTimeDisplay: false,
94
          fullscreenToggle: true, // 全屏按钮,
95
          pictureInPictureToggle: false
77
        }
96
        }
78
      ]
97
      }
79
    }
98
    }
80
  },
99
  },
81
  mounted() {
100
  mounted() {
82
    this.videoId = this.$route.query.videoId
101
    this.videoId = this.$route.query.videoId
83
    this.getData()
102
    this.initData()
84
  },
103
  },
85
  methods: {
104
  methods: {
86
    // 获取识别记录查询数据
105
    // 获取识别记录查询数据
106
    initData() {
107
      var date = new Date()
108
      this.endDate = this.formatDateTime(date)
109
      date.setDate(date.getDate() - 30)
110
      this.startDate = this.formatDateTime(date)
111
      this.getData()
112
    },
87
    getData() {
113
    getData() {
88
      let obj = {
89
        startDate: this.startDate,
90
        endDate: this.endDate,
91
        videoId: this.videoId
114
      if (this.startDate === ''|| this.endDate === '') {
115
        this.$Message.danger('请选择时间段')
116
      }
117
      var flag = this.startreend(this.startDate, this.endDate)
118
      if (flag) {
119
        var data = { params: { beginDay: this.startDate, endDay: this.endDate, id: this.videoId }}
120
        sysapi.getDistinguishData(data).then(res => {
121
          console.log(res.data)
122
          this.dataImg = res.data.data
123
          if (res.data.data.length > 0) {
124
            this.getParticularsData(res.data.data[0].aiIdenLogId, 0)
125
          } else {
126
            this.devicePosition = ''
127
            this.defineResult = ''
128
            this.captureTIme = ''
129
            this.distinguishUrl = ''
130
            this.playerOptions.sources[0].src = ''
131
            this.$Message.warning('所选时间段没有识别记录')
132
          }
133
        })
134
      } else {
135
        this.$Message.danger('开始时间不能在结束时间的后面')
92
      }
136
      }
93
      sysapi.getDistinguishData({params: obj}).then(res => {
137
    },
138
    // 字符串更改为时间类型
139
    stringtodate (date) {
140
      date = date.substring(0, 19)
141
      date = date.replace(/-/g, '/')
142
      var timestamp = new Date(date).getTime()
143
      return timestamp
144
    },
145
    // 验证开始时间·和结束时间
146
    startreend (startdate, enddate) {
147
      startdate = this.stringtodate(startdate)
148
      enddate = this.stringtodate(enddate)
149
      if (startdate > enddate) {
150
        return false
151
      } else {
152
        return true
153
      }
154
    },
155
    getParticularsData(aiIdenLogId, index) {
156
      this.fileNameIndex = index
157
      sysapi.queryOneAiIdenLog(aiIdenLogId).then(res => {
94
        console.log(res.data)
158
        console.log(res.data)
95
        this.devicePosition = res.data.devicePosition
96
        this.defineResult = res.data.defineResult
97
        this.captureTIme = res.data.captureTIme
159
        this.devicePosition = res.data.data.alarmInfo.monitorSceneName
160
        this.defineResult = res.data.data.alarmInfo.alarmMemo
161
        this.captureTIme = res.data.data.pictureInfo.fileDateTimeStr
162
        this.distinguishUrl = res.data.data.pictureInfo.fileUrl
163
        this.playerOptions.sources[0].src = res.data.data.videoInfo.videoFileUrl
98
      })
164
      })
99
    },
165
    },
100
    // 重置数据
166
    // 重置数据
101
    resetData() {
167
    resetData() {
102
      this.startDate = ''
168
      this.startDate = ''
103
      this.endDate = ''
169
      this.endDate = ''
170
    },
171
    formatDateTime (date) {
172
      let y = date.getFullYear()
173
      let m = date.getMonth() + 1
174
      m = m < 10 ? ('0' + m) : m
175
      let d = date.getDate()
176
      d = d < 10 ? ('0' + d) : d
177
      let h = date.getHours()
178
      h = h < 10 ? ('0' + h) : h
179
      let minute = date.getMinutes()
180
      minute = minute < 10 ? ('0' + minute) : minute
181
      let second = date.getSeconds()
182
      second = second < 10 ? ('0' + second) : second
183
      return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second
104
    }
184
    }
105
  }
185
  }
106
}
186
}
138
                height: 380px;
218
                height: 380px;
139
                width: 100%;;
219
                width: 100%;;
140
            }
220
            }
221
            .distinguish-video{
222
                border-radius: 4px;
223
                margin-top: 10px;
224
                height: 380px;
225
                width: 500px;;
226
            }
141
        }
227
        }
142
    }
228
    }
143
    .page-bottom{
229
    .page-bottom{
153
            margin-top: 24px;
239
            margin-top: 24px;
154
            display: flex;
240
            display: flex;
155
            .image-carousel{
241
            .image-carousel{
156
                display: flex;
157
                flex-direction: column;
158
                .img-viewer-size{
242
              display: flex;
243
              flex-direction: column;
244
              .img-viewer-size{
245
                cursor:pointer;
159
                width: 132px;
246
                width: 132px;
160
                height: 88px;
247
                height: 88px;
161
                margin-right: 14px;
248
                margin-right: 14px;
162
            }
249
              }
163
            }
250
            }
164
        }
251
        }
165
    }
252
    }
166
}
253
}
254
.fileName{
255
  color: #009bf3;
256
}
167
</style>
257
</style>