|
5
|
</t-tab-panel>
|
|
6
|
<t-tab-panel label="导航页2" panel-id="tab-2">
|
|
7
|
<tab-change2></tab-change2>
|
|
8
|
</t-tab-panel>
|
|
9
|
</t-tabs>
|
142
|
10
|
</template>
|
143
|
11
|
|
144
|
12
|
<script>
|
145
|
|
import accessapi from '@/api/access'
|
|
13
|
import tabChange1 from './component/tab1'
|
|
14
|
import tabChange2 from './component/tab2'
|
146
|
15
|
|
147
|
16
|
export default {
|
148
|
|
|
|
17
|
components: {
|
|
18
|
tabChange1,
|
|
19
|
tabChange2
|
|
20
|
},
|
149
|
21
|
data () {
|
150
|
22
|
return {
|
151
|
|
// 进出类型
|
152
|
|
accesstype: [],
|
153
|
|
// 页码
|
154
|
|
total: 0,
|
155
|
|
// 选择的数据
|
156
|
|
selectdata: [],
|
157
|
|
// 模态框显示
|
158
|
|
detail_modal: false,
|
159
|
|
// 当前行数据
|
160
|
|
rowdata: {
|
161
|
|
alarmInfo: {},
|
162
|
|
pictureInfo: {}
|
163
|
|
},
|
164
|
|
// 公司列表
|
165
|
|
companyTypesList: [],
|
166
|
|
|
167
|
|
// 查询的参数
|
168
|
|
searchdata: {
|
169
|
|
|
170
|
|
nameAsLike: '',
|
171
|
|
beginDay: '',
|
172
|
|
endDay: ''
|
173
|
|
},
|
174
|
|
// 一页的数据
|
175
|
|
data: [
|
176
|
|
|
177
|
|
],
|
178
|
|
// 当前页
|
179
|
|
page: 1,
|
180
|
|
limit: 10,
|
181
|
|
// style: {
|
182
|
|
// bgimg: '',
|
183
|
|
// bgposition: '',
|
184
|
|
// scale: '',
|
185
|
|
// width: '',
|
186
|
|
// height: ''
|
187
|
|
|
188
|
|
// }
|
189
|
|
// 截取后的图片
|
190
|
|
newimage: '',
|
191
|
|
// 详情的主图片
|
192
|
|
mainimage: ''
|
193
|
|
|
194
|
23
|
}
|
195
|
|
},
|
196
|
|
|
197
|
|
mounted () {
|
198
|
|
// this.gettype()
|
199
|
|
this.getcompanyTypesList()
|
200
|
|
},
|
201
|
|
methods: {
|
202
|
|
// 表格中的选择数据
|
203
|
|
handleSelectionChange (val) {
|
204
|
|
this.selectdata = val
|
205
|
|
},
|
206
|
|
// 获取公司
|
207
|
|
async getcompanyTypesList () {
|
208
|
|
var res = await accessapi.getcompanyTypesList()
|
209
|
|
// console.log('公司信息是', res)
|
210
|
|
if (res.status === 200) {
|
211
|
|
this.companyTypesList = res.data.data
|
212
|
|
console.log(this.companyTypesList)
|
213
|
|
this.search()
|
214
|
|
} else {
|
215
|
|
this.$Message.danger('获取数据失败')
|
216
|
|
}
|
217
|
|
},
|
218
|
|
// 点击详情
|
219
|
|
async handleClick (scope) {
|
220
|
|
// this.rowdata = scope.row
|
221
|
|
// console.log(this.rowdata)
|
222
|
|
// console.log('id是', scope.row.aiIdenLogId)
|
223
|
|
this.newimage = ''
|
224
|
|
this.mainimage = ''
|
225
|
|
var res = await accessapi.getOneInAndOutRecord({ params: { aiIdenLogId: scope.row.aiIdenLogId } })
|
226
|
|
|
227
|
|
if (res.data.success) {
|
228
|
|
// this.rowdata = res.data.data
|
229
|
|
|
230
|
|
this.rowdata.pictureInfo = res.data.data.pictureInfo
|
231
|
|
console.log('数据', this.rowdata.pictureInfo)
|
232
|
|
this.rowdata.alarmInfo = res.data.data.alarmInfo
|
233
|
|
console.log('数据', this.rowdata.alarmInfo)
|
234
|
|
console.log('相似度数据', this.rowdata.alarmInfo.simi, typeof this.rowdata.alarmInfo.simi)
|
235
|
|
// this.rowdata.alarmInfo.newImg = this.rowdata.pictureInfo.fileUrl
|
236
|
|
|
237
|
|
this.getImage()
|
238
|
|
this.getmainimage()
|
239
|
|
// var loadTimer
|
240
|
|
// var imgObject = new Image()
|
241
|
|
// imgObject.setAttribute('crossOrigin', 'anonymous')
|
242
|
|
// imgObject.src = this.rowdata.pictureInfo.fileUrl
|
243
|
|
// console.log(this)
|
244
|
|
// imgObject.onload = this.onImgLoaded(loadTimer, imgObject, this.rowdata.alarmInfo)
|
245
|
|
|
246
|
|
// console.log(this.rowdata.alarmInfo.newImg)
|
247
|
|
|
248
|
|
// this.style.width = res.data.data.alarmInfo.face_box[2] - res.data.data.alarmInfo.face_box[0] + 'px'
|
249
|
|
// // console.log('width是', this.style.width)
|
250
|
|
// this.style.height = res.data.data.alarmInfo.face_box[3] - res.data.data.alarmInfo.face_box[1] + 'px'
|
251
|
|
// // console.log('height是', this.style.height)
|
252
|
|
// this.style.bgimg = 'url(' + res.data.data.pictureInfo.fileUrl + ')'
|
253
|
|
// // console.log('bgimg是', this.style.bgimg)
|
254
|
|
// this.style.bgposition = '' + -res.data.data.alarmInfo.face_box[0] + 'px ' + -res.data.data.alarmInfo.face_box[1] + 'px'
|
255
|
|
// console.log('bgposition是', this.style.bgposition)
|
256
|
|
// // transform: scale(0.33, 0.33);
|
257
|
|
// var width = res.data.data.alarmInfo.face_box[2] - res.data.data.alarmInfo.face_box[0]
|
258
|
|
// var height = res.data.data.alarmInfo.face_box[3] - res.data.data.alarmInfo.face_box[1]
|
259
|
|
// var scalex = 120 / width
|
260
|
|
// var scaley = 160 / height
|
261
|
|
// // console.log(scalex)
|
262
|
|
// this.style.scale = 'scale(' + scalex + ',' + scaley + ')'
|
263
|
|
// // console.log('scale是', this.style.scale)
|
264
|
|
// // console.log(res.data.data)
|
265
|
|
// console.log('详情数据是', this.rowdata.alarmInfo)
|
266
|
|
|
267
|
|
this.detail_modal = true
|
268
|
|
} else {
|
269
|
|
this.$Message.danger('获取数据失败')
|
270
|
|
}
|
271
|
|
},
|
272
|
|
// 分页
|
273
|
|
onChange (val) {
|
274
|
|
this.page = val
|
275
|
|
this.search()
|
276
|
|
},
|
277
|
|
|
278
|
|
// 点击查询按钮
|
279
|
|
btnsearch () {
|
280
|
|
if (this.page === 1) {
|
281
|
|
this.search()
|
282
|
|
} else {
|
283
|
|
this.page = 1
|
284
|
|
}
|
285
|
|
},
|
286
|
|
// 获取进出类型
|
287
|
|
// gettype () {
|
288
|
|
// accessapi.getaccesstype().then((res) => {
|
289
|
|
// this.accesstype = res.data.data
|
290
|
|
// console.log(this.accesstype)
|
291
|
|
// })
|
292
|
|
// },
|
293
|
|
// 查询数据
|
294
|
|
async search () {
|
295
|
|
// 检验数据
|
296
|
|
var flag = this.startreend(this.searchdata.beginDay, this.searchdata.endDay)
|
297
|
|
if (flag) {
|
298
|
|
// console.log(this.page)
|
299
|
|
// console.log(this.searchdata)
|
300
|
|
|
301
|
|
var params = this.searchdata
|
302
|
|
params.pageNumber = this.page
|
303
|
|
params.pageSize = this.limit
|
304
|
|
// console.log(params)
|
305
|
|
var res = await accessapi.getaccesslist({ params: params })
|
306
|
|
// console.log(res)
|
307
|
|
if (res.status === 200) {
|
308
|
|
// console.log(res)
|
309
|
|
this.data = res.data.data.data
|
310
|
|
// console.log(this.data)
|
311
|
|
// console.log(this.companyTypesList)
|
312
|
|
this.data = this.data.map((item) => {
|
313
|
|
// 处理进出时间
|
314
|
|
// item.taskExecuteTime = formatDateTime(item.taskExecuteTime)
|
315
|
|
// 处理相似度
|
316
|
|
// item.simi = this.percentagedata(item.simi)
|
317
|
|
// console.log('公司的数据是', this.companyTypesList)
|
318
|
|
// console.log('公司id', item.companyId, typeof item.companyId)
|
319
|
|
// console.log('公司名字是', this.companyTypesList.filter((item1) => { return item1.id === 10000 }))
|
320
|
|
item.companyinfo = this.companyTypesList.filter((item1) => { return String(item1.id) === item.companyId })
|
321
|
|
if (item.companyinfo.length > 0) {
|
322
|
|
item.companyname = item.companyinfo[0].name
|
323
|
|
} else {
|
324
|
|
item.companyname = ''
|
325
|
|
}
|
326
|
|
|
327
|
|
return item
|
328
|
|
})
|
329
|
|
|
330
|
|
// this.total = Math.ceil(res.data.data.total / res.data.data.size) * 5
|
331
|
|
// console.log(this.total)
|
332
|
|
this.total = res.data.data.total
|
333
|
|
// console.log('数据是', this.data)
|
334
|
|
}
|
335
|
|
} else {
|
336
|
|
this.$Message.danger('开始时间不能在结束时间的后面')
|
337
|
|
}
|
338
|
|
},
|
339
|
|
|
340
|
|
percentagedata (point) {
|
341
|
|
if (point === 0) {
|
342
|
|
return 0
|
343
|
|
}
|
344
|
|
var str = Number(point * 100).toFixed(1)
|
345
|
|
str += '%'
|
346
|
|
return str
|
347
|
|
},
|
348
|
|
|
349
|
|
// 重置数据
|
350
|
|
reset () {
|
351
|
|
for (var index in this.searchdata) {
|
352
|
|
this.searchdata[index] = ''
|
353
|
|
}
|
354
|
|
this.page = 1
|
355
|
|
this.$Message.success('数据重置成功')
|
356
|
|
},
|
357
|
|
|
358
|
|
// 字符串更改为时间类型
|
359
|
|
stringtodate (date) {
|
360
|
|
date = date.substring(0, 19)
|
361
|
|
date = date.replace(/-/g, '/')
|
362
|
|
var timestamp = new Date(date).getTime()
|
363
|
|
return timestamp
|
364
|
|
},
|
365
|
|
// 验证开始时间·和结束时间
|
366
|
|
startreend (startdate, enddate) {
|
367
|
|
startdate = this.stringtodate(startdate)
|
368
|
|
enddate = this.stringtodate(enddate)
|
369
|
|
if (startdate > enddate) {
|
370
|
|
return false
|
371
|
|
} else {
|
372
|
|
return true
|
373
|
|
}
|
374
|
|
},
|
375
|
|
// 处理截图图片
|
376
|
|
async getImage () {
|
377
|
|
var loadTimer
|
378
|
|
var imgObject = new Image()
|
379
|
|
imgObject.setAttribute('crossOrigin', 'anonymous')
|
380
|
|
imgObject.src = this.rowdata.pictureInfo.fileUrl
|
381
|
|
var e = this.rowdata.alarmInfo
|
382
|
|
var that = this
|
383
|
|
imgObject.onload = onImgLoaded()
|
384
|
|
// eslint-disable-next-line no-return-assign
|
385
|
|
function onImgLoaded () {
|
386
|
|
if (loadTimer != null) clearTimeout(loadTimer)
|
387
|
|
if (!imgObject.complete) {
|
388
|
|
loadTimer = setTimeout(() => {
|
389
|
|
onImgLoaded()
|
390
|
|
}, 3)
|
391
|
|
} else {
|
392
|
|
that.newimage = getImagePortion(imgObject, e.face_box[2] - e.face_box[0], e.face_box[3] - e.face_box[1], e.face_box[0], e.face_box[1])
|
393
|
|
}
|
394
|
|
}
|
395
|
|
function getImagePortion (imgObj, newWidth, newHeight, startX, startY) {
|
396
|
|
var tnCanvas = document.createElement('canvas')
|
397
|
|
var tnCanvasContext = tnCanvas.getContext('2d')
|
398
|
|
tnCanvas.width = newWidth; tnCanvas.height = newHeight
|
399
|
|
var bufferCanvas = document.createElement('canvas')
|
400
|
|
var bufferContext = bufferCanvas.getContext('2d')
|
401
|
|
bufferCanvas.width = imgObj.width
|
402
|
|
bufferCanvas.height = imgObj.height
|
403
|
|
bufferContext.drawImage(imgObj, 0, 0)
|
404
|
|
tnCanvasContext.drawImage(bufferCanvas, startX, startY, newWidth, newHeight, 0, 0, newWidth, newHeight)
|
405
|
|
// console.log(tnCanvas.toDataURL())
|
406
|
|
return tnCanvas.toDataURL()
|
407
|
|
}
|
408
|
|
},
|
409
|
|
|
410
|
|
// 处理主图片
|
411
|
|
async getmainimage () {
|
412
|
|
var that = this
|
413
|
|
|
414
|
|
var x = this.rowdata.alarmInfo.face_box[0]
|
415
|
|
var y = this.rowdata.alarmInfo.face_box[1]
|
416
|
|
var width = this.rowdata.alarmInfo.face_box[2] - this.rowdata.alarmInfo.face_box[0]
|
417
|
|
var height = this.rowdata.alarmInfo.face_box[3] - this.rowdata.alarmInfo.face_box[1]
|
418
|
|
function getBase64Image (img) {
|
419
|
|
var canvas = document.createElement('canvas')
|
420
|
|
canvas.width = img.width
|
421
|
|
canvas.height = img.height
|
422
|
|
var ctx = canvas.getContext('2d')
|
423
|
|
ctx.drawImage(img, 0, 0, img.width, img.height)
|
424
|
|
ctx.beginPath()
|
425
|
|
ctx.moveTo(x, y)
|
426
|
|
ctx.lineTo(x + width, y)
|
427
|
|
ctx.lineTo(x + width, y + height)
|
428
|
|
ctx.lineTo(x, y + height)
|
429
|
|
ctx.lineTo(x, y) // 绘制最后一笔使图像闭合
|
430
|
|
ctx.lineWidth = 5
|
431
|
|
ctx.strokeStyle = 'red'
|
432
|
|
ctx.stroke()
|
433
|
|
|
434
|
|
var dataURL = canvas.toDataURL('image/png') // 可选其他值 image/jpeg
|
435
|
|
return dataURL
|
436
|
|
}
|
437
|
|
|
438
|
|
function main (src, cb) {
|
439
|
|
var image = new Image()
|
440
|
|
image.src = src + '?v=' + Math.random() // 处理缓存
|
441
|
|
image.crossOrigin = '*' // 支持跨域图片
|
442
|
|
image.onload = function () {
|
443
|
|
var base64 = getBase64Image(image)
|
444
|
|
cb && cb(base64)
|
445
|
|
}
|
446
|
|
}
|
447
|
|
|
448
|
|
main(this.rowdata.pictureInfo.fileUrl, function (base64) {
|
449
|
|
// console.log(base64, '是否成功打印base64')
|
450
|
|
that.mainimage = base64
|
451
|
|
})
|
452
|
|
}
|
453
|
|
// //将分数转换为小数
|
454
|
|
// toPoint (percent) {
|
455
|
|
// var str = percent.replace('%', '')
|
456
|
|
// str = str / 100
|
457
|
|
// return str
|
458
|
|
// }
|
459
|
|
|
460
|
24
|
}
|
461
|
25
|
}
|
462
|
26
|
</script>
|
463
|
|
|
464
|
|
<style lang='scss' scoped>
|
465
|
|
.access {
|
466
|
|
font-size: 14px;
|
467
|
|
padding: 6px 24px;
|
468
|
|
height: 702px;
|
469
|
|
.upload {
|
470
|
|
font-size: 14px;
|
471
|
|
line-height: 22px;
|
472
|
|
}
|
473
|
|
.table th,
|
474
|
|
.table td {
|
475
|
|
font-size: 14px;
|
476
|
|
padding: 0 0 0 18px;
|
477
|
|
}
|
478
|
|
.access_header {
|
479
|
|
display: flex;
|
480
|
|
justify-content: space-between;
|
481
|
|
margin-top: 24px;
|
482
|
|
margin-bottom: 24px;
|
483
|
|
.title {
|
484
|
|
display: inline-block;
|
485
|
|
width: 70px;
|
486
|
|
height: 20px;
|
487
|
|
font-size: 14px;
|
488
|
|
text-align: right;
|
489
|
|
color: rgba($color: #000000, $alpha: 0.65);
|
490
|
|
}
|
491
|
|
}
|
492
|
|
|
493
|
|
.pager {
|
494
|
|
float: right;
|
495
|
|
margin-top: 26px;
|
496
|
|
}
|
497
|
|
}
|
498
|
|
.detail_content {
|
499
|
|
width: 100%;
|
500
|
|
height: 376px;
|
501
|
|
display: flex;
|
502
|
|
justify-content: space-between;
|
503
|
|
|
504
|
|
.detail_item1 {
|
505
|
|
width: 45%;
|
506
|
|
text-align: left;
|
507
|
|
> div:nth-child(1) {
|
508
|
|
margin: 0 0 20px 0;
|
509
|
|
color: rgba(0, 0, 0, 0.65);
|
510
|
|
font-size: 14px;
|
511
|
|
}
|
512
|
|
> div:nth-child(2) {
|
513
|
|
width: 100%;
|
514
|
|
height: 240px;
|
515
|
|
|
516
|
|
border-radius: 5px;
|
517
|
|
overflow: hidden;
|
518
|
|
position: relative;
|
519
|
|
}
|
520
|
|
}
|
521
|
|
|
522
|
|
.detail_item2 {
|
523
|
|
width: 50%;
|
524
|
|
text-align: left;
|
525
|
|
> div:nth-child(1) {
|
526
|
|
margin: 0 0 20px 0;
|
527
|
|
color: rgba(0, 0, 0, 0.65);
|
528
|
|
font-size: 14px;
|
529
|
|
}
|
530
|
|
> div:nth-child(2) {
|
531
|
|
width: 100%;
|
532
|
|
height: 190px;
|
533
|
|
|
534
|
|
display: flex;
|
535
|
|
justify-content: space-between;
|
536
|
|
.bottomimg {
|
537
|
|
margin-top: 12px;
|
538
|
|
width: 100%;
|
539
|
|
text-align: center;
|
540
|
|
font-size: 12px;
|
541
|
|
color: rgba(0, 0, 0, 0.65);
|
542
|
|
}
|
543
|
|
|
544
|
|
> div:nth-child(1) {
|
545
|
|
width: 120px;
|
546
|
|
height: 100%;
|
547
|
|
|
548
|
|
.scaleimg {
|
549
|
|
width: 120px;
|
550
|
|
height: 160px;
|
551
|
|
|
552
|
|
position: relative;
|
553
|
|
.imgcontant {
|
554
|
|
border-radius: 10px;
|
555
|
|
background-repeat: no-repeat;
|
556
|
|
background-attachment: local;
|
557
|
|
position: absolute;
|
558
|
|
top: -160px;
|
559
|
|
left: -120px;
|
560
|
|
}
|
561
|
|
}
|
562
|
|
}
|
563
|
|
> div:nth-child(2) {
|
564
|
|
width: 117.76px;
|
565
|
|
height: 160px;
|
566
|
|
|
567
|
|
line-height: 160px;
|
568
|
|
img {
|
569
|
|
width: 100%;
|
570
|
|
height: 84.32px;
|
571
|
|
}
|
572
|
|
}
|
573
|
|
> div:nth-child(3) {
|
574
|
|
height: 100%;
|
575
|
|
width: 120px;
|
576
|
|
}
|
577
|
|
}
|
578
|
|
.describe {
|
579
|
|
margin-top: 20px;
|
580
|
|
width: 100%;
|
581
|
|
height: 148px;
|
582
|
|
display: flex;
|
583
|
|
flex-wrap: wrap;
|
584
|
|
align-items: center;
|
585
|
|
|
586
|
|
> div {
|
587
|
|
width: 100%;
|
588
|
|
height: 22px;
|
589
|
|
font-size: 14px;
|
590
|
|
}
|
591
|
|
}
|
592
|
|
}
|
593
|
|
}
|
594
|
|
</style>
|
|
@ -41,7 +41,8 @@ export default {
|
41
|
41
|
staffTypesList: [],
|
42
|
42
|
companyTypeId: '',
|
43
|
43
|
departmentTypeId: '',
|
44
|
|
staffTypeId: ''
|
|
44
|
staffTypeId: '',
|
|
45
|
firstCreated: true
|
45
|
46
|
}
|
46
|
47
|
},
|
47
|
48
|
computed: {
|
|
@ -79,7 +80,6 @@ export default {
|
79
|
80
|
},
|
80
|
81
|
methods: {
|
81
|
82
|
getOrgId() {
|
82
|
|
console.log(123);
|
83
|
83
|
this.$emit('getOrgId', this.companyTypeId)
|
84
|
84
|
},
|
85
|
85
|
getDepId() {
|
|
@ -93,6 +93,8 @@ export default {
|
93
|
93
|
const res = await commonApi.getCompanyTypesList()
|
94
|
94
|
if (res.status === 200) {
|
95
|
95
|
this.companyTypesList = res.data.data
|
|
96
|
this.companyTypeId = 10086
|
|
97
|
this.getOrgId()
|
96
|
98
|
} else {
|
97
|
99
|
this.$Message.danger('公司类型列表数据获取失败!')
|
98
|
100
|
}
|
|
@ -123,6 +125,13 @@ export default {
|
123
|
125
|
})
|
124
|
126
|
// eslint-disable-next-line no-return-assign
|
125
|
127
|
this.departmentTypesList = data.filter(item => item.data = item.id)
|
|
128
|
this.$nextTick(() => {
|
|
129
|
if (this.firstCreated === true) {
|
|
130
|
this.departmentTypeId = '10087'
|
|
131
|
this.getDepId()
|
|
132
|
this.firstCreated = false
|
|
133
|
}
|
|
134
|
})
|
126
|
135
|
} else {
|
127
|
136
|
this.$Message.danger('部门类型列表数据获取失败!')
|
128
|
137
|
}
|
|
@ -118,6 +118,7 @@ export default {
|
118
|
118
|
this.form.resourceToolName = item.resourceToolName
|
119
|
119
|
this.form.resourceToolId = item.resourceToolId
|
120
|
120
|
this.form.pictureUrl = item.pictureUrl
|
|
121
|
this.form.videoUrl = item.videoUrl
|
121
|
122
|
},
|
122
|
123
|
handleSubmit () {
|
123
|
124
|
this.$emit('submit', this.form)
|
|
@ -115,7 +115,6 @@ export default {
|
115
|
115
|
companyName: '',
|
116
|
116
|
// 判断页面是否是第一次渲染
|
117
|
117
|
firstCreated: true
|
118
|
|
|
119
|
118
|
}
|
120
|
119
|
},
|
121
|
120
|
watch: {
|