|
@@ -230,9 +230,9 @@
|
|
230
|
@change="handleInspectionDateChange(scope.row, scope.$index)" />
|
230
|
@change="handleInspectionDateChange(scope.row, scope.$index)" />
|
|
231
|
</template>
|
231
|
</template>
|
|
232
|
</el-table-column>
|
232
|
</el-table-column>
|
|
233
|
- <el-table-column label="定检小组" prop="inspectionTeamName">
|
|
|
|
|
|
233
|
+ <el-table-column label="定检小组" prop="inspectionTeamId">
|
|
234
|
<template #default="scope">
|
234
|
<template #default="scope">
|
|
235
|
- <UserSelect v-model="scope.row.inspectionTeamIds" :multiple="true" :disabled="formDisabled" width="100%"
|
|
|
|
|
|
235
|
+ <UserSelect v-model="scope.row.inspectionTeamId" :multiple="true" :disabled="formDisabled" width="100%"
|
|
236
|
placeholder="请选择" />
|
236
|
placeholder="请选择" />
|
|
237
|
</template>
|
237
|
</template>
|
|
238
|
</el-table-column>
|
238
|
</el-table-column>
|
|
@@ -435,6 +435,9 @@ function handleEdit(row) {
|
|
435
|
form.inspectionTeamLeaderId = form.inspectionTeamLeaderId || ''
|
435
|
form.inspectionTeamLeaderId = form.inspectionTeamLeaderId || ''
|
|
436
|
form.inspectionTeamMember1Id = form.inspectionTeamMember1Id || ''
|
436
|
form.inspectionTeamMember1Id = form.inspectionTeamMember1Id || ''
|
|
437
|
form.inspectionTeamMember2Id = form.inspectionTeamMember2Id || ''
|
437
|
form.inspectionTeamMember2Id = form.inspectionTeamMember2Id || ''
|
|
|
|
438
|
+ form.equipmentInspectionRecordList.forEach(item => {
|
|
|
|
439
|
+ item.inspectionTeamId = item.inspectionTeamId ? item.inspectionTeamId.split(',').map(id => Number(id)).filter(id => !isNaN(id)) : []
|
|
|
|
440
|
+ })
|
|
438
|
formDisabled.value = false
|
441
|
formDisabled.value = false
|
|
439
|
dialog.title = '编辑设备'
|
442
|
dialog.title = '编辑设备'
|
|
440
|
dialog.visible = true
|
443
|
dialog.visible = true
|
|
@@ -465,6 +468,9 @@ function handleDetail(row) {
|
|
465
|
form.inspectionTeamLeaderId = form.inspectionTeamLeaderId || ''
|
468
|
form.inspectionTeamLeaderId = form.inspectionTeamLeaderId || ''
|
|
466
|
form.inspectionTeamMember1Id = form.inspectionTeamMember1Id || ''
|
469
|
form.inspectionTeamMember1Id = form.inspectionTeamMember1Id || ''
|
|
467
|
form.inspectionTeamMember2Id = form.inspectionTeamMember2Id || ''
|
470
|
form.inspectionTeamMember2Id = form.inspectionTeamMember2Id || ''
|
|
|
|
471
|
+ form.equipmentInspectionRecordList.forEach(item => {
|
|
|
|
472
|
+ item.inspectionTeamId = item.inspectionTeamId ? item.inspectionTeamId.split(',').map(id => Number(id)).filter(id => !isNaN(id)) : []
|
|
|
|
473
|
+ })
|
|
468
|
formDisabled.value = true
|
474
|
formDisabled.value = true
|
|
469
|
dialog.title = '设备详情'
|
475
|
dialog.title = '设备详情'
|
|
470
|
dialog.visible = true
|
476
|
dialog.visible = true
|
|
@@ -550,7 +556,35 @@ async function submitForm() {
|
|
550
|
if (valid) {
|
556
|
if (valid) {
|
|
551
|
const submitData = { ...form, ...form.installationLocation }
|
557
|
const submitData = { ...form, ...form.installationLocation }
|
|
552
|
submitData.baseAttachmentList = baseAttachmentListInternal.value
|
558
|
submitData.baseAttachmentList = baseAttachmentListInternal.value
|
|
553
|
-
|
|
|
|
|
|
559
|
+ // 收集所有定检小组用户ID,批量获取名称
|
|
|
|
560
|
+ const allTeamIds = new Set()
|
|
|
|
561
|
+ form.equipmentInspectionRecordList.forEach(item => {
|
|
|
|
562
|
+ if (item.inspectionTeamId && Array.isArray(item.inspectionTeamId)) {
|
|
|
|
563
|
+ item.inspectionTeamId.forEach(id => allTeamIds.add(id))
|
|
|
|
564
|
+ }
|
|
|
|
565
|
+ })
|
|
|
|
566
|
+ const userMap = new Map()
|
|
|
|
567
|
+ if (allTeamIds.size > 0) {
|
|
|
|
568
|
+ const userPromises = Array.from(allTeamIds).map(async id => {
|
|
|
|
569
|
+ try {
|
|
|
|
570
|
+ const res = await getUser(String(id))
|
|
|
|
571
|
+ return { id, name: res.data?.nickName || '' }
|
|
|
|
572
|
+ } catch {
|
|
|
|
573
|
+ return { id, name: '' }
|
|
|
|
574
|
+ }
|
|
|
|
575
|
+ })
|
|
|
|
576
|
+ const results = await Promise.all(userPromises)
|
|
|
|
577
|
+ results.forEach(({ id, name }) => userMap.set(id, name))
|
|
|
|
578
|
+ }
|
|
|
|
579
|
+ submitData.equipmentInspectionRecordList = form.equipmentInspectionRecordList.map(item => {
|
|
|
|
580
|
+ const teamIds = item.inspectionTeamId && Array.isArray(item.inspectionTeamId) ? item.inspectionTeamId.join(',') : ''
|
|
|
|
581
|
+ const teamNames = item.inspectionTeamId && Array.isArray(item.inspectionTeamId) ? item.inspectionTeamId.map(id => userMap.get(id) || '').filter(Boolean).join(',') : ''
|
|
|
|
582
|
+ return {
|
|
|
|
583
|
+ ...item,
|
|
|
|
584
|
+ inspectionTeamId: teamIds,
|
|
|
|
585
|
+ inspectionTeamName: teamNames
|
|
|
|
586
|
+ }
|
|
|
|
587
|
+ })
|
|
554
|
try {
|
588
|
try {
|
|
555
|
if (submitData.inspectionTeamLeaderId) {
|
589
|
if (submitData.inspectionTeamLeaderId) {
|
|
556
|
const leaderRes = await getUser(submitData.inspectionTeamLeaderId)
|
590
|
const leaderRes = await getUser(submitData.inspectionTeamLeaderId)
|
|
@@ -599,7 +633,7 @@ function addCheckRecord() {
|
|
599
|
}
|
633
|
}
|
|
600
|
form.equipmentInspectionRecordList.push({
|
634
|
form.equipmentInspectionRecordList.push({
|
|
601
|
inspectionDate: '',
|
635
|
inspectionDate: '',
|
|
602
|
- inspectionTeamIds: teamIds,
|
|
|
|
|
|
636
|
+ inspectionTeamId: teamIds,
|
|
603
|
inspectionTeamName: '',
|
637
|
inspectionTeamName: '',
|
|
604
|
inspectionResult: '',
|
638
|
inspectionResult: '',
|
|
605
|
inspectionNature: ''
|
639
|
inspectionNature: ''
|