|
@ -82,8 +82,9 @@ s<template>
|
82
|
82
|
<div class="detail_item1">
|
83
|
83
|
<div>抓拍图片</div>
|
84
|
84
|
<div>
|
85
|
|
<img :src="rowdata.pictureInfo.fileUrl" alt="" srcset="" style="width:100%;height:100%">
|
86
|
|
|
|
85
|
<!-- <img :src="rowdata.pictureInfo.fileUrl" alt="" srcset="" style="width:100%;height:100%"> -->
|
|
86
|
<!--处理图片里的方框-->
|
|
87
|
<img :src="mainimage" alt="" srcset="" style="width:100%;height:100%">
|
87
|
88
|
</div>
|
88
|
89
|
</div>
|
89
|
90
|
<div class="detail_item2">
|
|
@ -185,7 +186,9 @@ export default {
|
185
|
186
|
|
186
|
187
|
// }
|
187
|
188
|
// 截取后的图片
|
188
|
|
newimage: ''
|
|
189
|
newimage: '',
|
|
190
|
// 详情的主图片
|
|
191
|
mainimage: ''
|
189
|
192
|
|
190
|
193
|
}
|
191
|
194
|
},
|
|
@ -205,6 +208,7 @@ export default {
|
205
|
208
|
// console.log('公司信息是', res)
|
206
|
209
|
if (res.status === 200) {
|
207
|
210
|
this.companyTypesList = res.data.data
|
|
211
|
console.log(this.companyTypesList)
|
208
|
212
|
this.search()
|
209
|
213
|
} else {
|
210
|
214
|
this.$Message.danger('获取数据失败')
|
|
@ -215,6 +219,8 @@ export default {
|
215
|
219
|
// this.rowdata = scope.row
|
216
|
220
|
// console.log(this.rowdata)
|
217
|
221
|
// console.log('id是', scope.row.aiIdenLogId)
|
|
222
|
this.newimage = ''
|
|
223
|
this.mainimage = ''
|
218
|
224
|
var res = await accessapi.getOneInAndOutRecord({ params: { aiIdenLogId: scope.row.aiIdenLogId } })
|
219
|
225
|
|
220
|
226
|
if (res.data.success) {
|
|
@ -226,6 +232,7 @@ export default {
|
226
|
232
|
// this.rowdata.alarmInfo.newImg = this.rowdata.pictureInfo.fileUrl
|
227
|
233
|
|
228
|
234
|
this.getImage()
|
|
235
|
this.getmainimage()
|
229
|
236
|
// var loadTimer
|
230
|
237
|
// var imgObject = new Image()
|
231
|
238
|
// imgObject.setAttribute('crossOrigin', 'anonymous')
|
|
@ -291,21 +298,23 @@ export default {
|
291
|
298
|
var params = this.searchdata
|
292
|
299
|
params.pageNumber = this.page
|
293
|
300
|
params.pageSize = this.limit
|
294
|
|
console.log(params)
|
|
301
|
// console.log(params)
|
295
|
302
|
var res = await accessapi.getaccesslist({ params: params })
|
296
|
303
|
// console.log(res)
|
297
|
304
|
if (res.status === 200) {
|
298
|
305
|
// console.log(res)
|
299
|
306
|
this.data = res.data.data.data
|
|
307
|
// console.log(this.data)
|
|
308
|
// console.log(this.companyTypesList)
|
300
|
309
|
this.data = this.data.map((item) => {
|
301
|
310
|
// 处理进出时间
|
302
|
311
|
// item.taskExecuteTime = formatDateTime(item.taskExecuteTime)
|
303
|
312
|
// 处理相似度
|
304
|
313
|
// item.simi = this.percentagedata(item.simi)
|
305
|
314
|
// console.log('公司的数据是', this.companyTypesList)
|
306
|
|
// console.log('公司id', item)
|
|
315
|
// console.log('公司id', item.companyId, typeof item.companyId)
|
307
|
316
|
// console.log('公司名字是', this.companyTypesList.filter((item1) => { return item1.id === 10000 }))
|
308
|
|
item.companyinfo = this.companyTypesList.filter((item1) => { return item1.id === item.companyId })
|
|
317
|
item.companyinfo = this.companyTypesList.filter((item1) => { return String(item1.id) === item.companyId })
|
309
|
318
|
if (item.companyinfo.length > 0) {
|
310
|
319
|
item.companyname = item.companyinfo[0].name
|
311
|
320
|
} else {
|
|
@ -360,6 +369,7 @@ export default {
|
360
|
369
|
return true
|
361
|
370
|
}
|
362
|
371
|
},
|
|
372
|
// 处理截图图片
|
363
|
373
|
async getImage () {
|
364
|
374
|
var loadTimer
|
365
|
375
|
var imgObject = new Image()
|
|
@ -392,6 +402,50 @@ export default {
|
392
|
402
|
// console.log(tnCanvas.toDataURL())
|
393
|
403
|
return tnCanvas.toDataURL()
|
394
|
404
|
}
|
|
405
|
},
|
|
406
|
|
|
407
|
// 处理主图片
|
|
408
|
async getmainimage () {
|
|
409
|
var that = this
|
|
410
|
|
|
411
|
var x = this.rowdata.alarmInfo.face_box[0]
|
|
412
|
var y = this.rowdata.alarmInfo.face_box[1]
|
|
413
|
var width = this.rowdata.alarmInfo.face_box[2] - this.rowdata.alarmInfo.face_box[0]
|
|
414
|
var height = this.rowdata.alarmInfo.face_box[3] - this.rowdata.alarmInfo.face_box[1]
|
|
415
|
function getBase64Image (img) {
|
|
416
|
var canvas = document.createElement('canvas')
|
|
417
|
canvas.width = img.width
|
|
418
|
canvas.height = img.height
|
|
419
|
var ctx = canvas.getContext('2d')
|
|
420
|
ctx.drawImage(img, 0, 0, img.width, img.height)
|
|
421
|
ctx.beginPath()
|
|
422
|
ctx.moveTo(x, y)
|
|
423
|
ctx.lineTo(x + width, y)
|
|
424
|
ctx.lineTo(x + width, y + height)
|
|
425
|
ctx.lineTo(x, y + height)
|
|
426
|
ctx.lineTo(x, y) // 绘制最后一笔使图像闭合
|
|
427
|
ctx.lineWidth = 5
|
|
428
|
ctx.strokeStyle = 'red'
|
|
429
|
ctx.stroke()
|
|
430
|
|
|
431
|
var dataURL = canvas.toDataURL('image/png') // 可选其他值 image/jpeg
|
|
432
|
return dataURL
|
|
433
|
}
|
|
434
|
|
|
435
|
function main (src, cb) {
|
|
436
|
var image = new Image()
|
|
437
|
image.src = src + '?v=' + Math.random() // 处理缓存
|
|
438
|
image.crossOrigin = '*' // 支持跨域图片
|
|
439
|
image.onload = function () {
|
|
440
|
var base64 = getBase64Image(image)
|
|
441
|
cb && cb(base64)
|
|
442
|
}
|
|
443
|
}
|
|
444
|
|
|
445
|
main(this.rowdata.pictureInfo.fileUrl, function (base64) {
|
|
446
|
// console.log(base64, '是否成功打印base64')
|
|
447
|
that.mainimage = base64
|
|
448
|
})
|
395
|
449
|
}
|
396
|
450
|
|
397
|
451
|
}
|