|
|
@@ -144,6 +144,7 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<el-pagination
|
|
|
+ style="margin-top: 10px"
|
|
|
background
|
|
|
layout="total, sizes, prev, pager, next"
|
|
|
:current-page="pagination.currentPage"
|
|
|
@@ -510,8 +511,8 @@
|
|
|
:disabled="isViewMode"
|
|
|
clearable
|
|
|
filterable
|
|
|
- allow-create
|
|
|
- default-first-option
|
|
|
+ multiple
|
|
|
+ collapse-tags
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in allUnits"
|
|
|
@@ -1312,10 +1313,33 @@
|
|
|
) + 1
|
|
|
: 1
|
|
|
|
|
|
+ // 确保 auditedUnit 是数组格式
|
|
|
+ let auditedUnitArray = []
|
|
|
+ if (row.auditedUnit) {
|
|
|
+ if (Array.isArray(row.auditedUnit)) {
|
|
|
+ auditedUnitArray = row.auditedUnit
|
|
|
+ } else if (typeof row.auditedUnit === 'string') {
|
|
|
+ // 如果是字符串,尝试转换为数组(可能是逗号分隔的单位名称)
|
|
|
+ // 这里假设查询结果中的 auditedUnit 可能是单位名称字符串,需要转换为 unitId
|
|
|
+ // 如果已经是 unitId,直接使用
|
|
|
+ const unitItem = this.allUnits.find(
|
|
|
+ (unit) =>
|
|
|
+ unit.unitId === row.auditedUnit ||
|
|
|
+ unit.unitId === String(row.auditedUnit) ||
|
|
|
+ unit.unitName === row.auditedUnit
|
|
|
+ )
|
|
|
+ if (unitItem) {
|
|
|
+ auditedUnitArray = [unitItem.unitId]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.selectedFileList.push({
|
|
|
...row,
|
|
|
// 使用自动递增的序号
|
|
|
materialOrderNum: newOrderNum,
|
|
|
+ // 确保 auditedUnit 是数组格式
|
|
|
+ auditedUnit: auditedUnitArray,
|
|
|
})
|
|
|
|
|
|
this.$message.success('添加成功')
|
|
|
@@ -1347,10 +1371,10 @@
|
|
|
item.materialOrderNum === this.dataDialogForm.materialOrderNum
|
|
|
)
|
|
|
|
|
|
- if (exists) {
|
|
|
- this.$message.warning('该文件已添加')
|
|
|
- return
|
|
|
- }
|
|
|
+ // if (exists) {
|
|
|
+ // this.$message.warning('该文件已添加')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
// 添加到已选择列表
|
|
|
this.selectedFileList.push({
|
|
|
@@ -1359,7 +1383,7 @@
|
|
|
materialName: this.dataDialogForm.materialName.trim(),
|
|
|
documentName: '',
|
|
|
documentNo: '',
|
|
|
- auditedUnit: '',
|
|
|
+ auditedUnit: [], // 多选,初始化为空数组
|
|
|
generateTime: '',
|
|
|
fileSource: '',
|
|
|
isNew: true, // 标记为新添加的行
|
|
|
@@ -1368,7 +1392,7 @@
|
|
|
// 序号自动递增,资料名称不清空
|
|
|
this.dataDialogForm.materialOrderNum =
|
|
|
this.selectedFileList.length + 1 || 1
|
|
|
- this.$message.success('添加成功')
|
|
|
+ // this.$message.success('添加成功')
|
|
|
})
|
|
|
},
|
|
|
// 删除文件
|
|
|
@@ -1485,14 +1509,31 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 处理被监审单位:如果是unitId,转换为unitName
|
|
|
- let auditedUnitName = item.auditedUnit || ''
|
|
|
- if (auditedUnitName) {
|
|
|
- // 如果是unitId,查找对应的unitName
|
|
|
+ // 处理被监审单位:如果是unitId数组,转换为unitName数组,然后转换为逗号分隔的字符串
|
|
|
+ let auditedUnitName = ''
|
|
|
+ if (
|
|
|
+ item.auditedUnit &&
|
|
|
+ Array.isArray(item.auditedUnit) &&
|
|
|
+ item.auditedUnit.length > 0
|
|
|
+ ) {
|
|
|
+ // 将unitId数组转换为unitName数组
|
|
|
+ const unitNames = item.auditedUnit
|
|
|
+ .map((unitId) => {
|
|
|
+ const unitItem = this.allUnits.find(
|
|
|
+ (unit) =>
|
|
|
+ unit.unitId === unitId || unit.unitId === String(unitId)
|
|
|
+ )
|
|
|
+ return unitItem ? unitItem.unitName : ''
|
|
|
+ })
|
|
|
+ .filter((name) => name) // 过滤掉空值
|
|
|
+ // 转换为逗号分隔的字符串
|
|
|
+ auditedUnitName = unitNames.join(',')
|
|
|
+ } else if (item.auditedUnit && !Array.isArray(item.auditedUnit)) {
|
|
|
+ // 兼容旧数据:单个unitId字符串
|
|
|
const unitItem = this.allUnits.find(
|
|
|
(unit) =>
|
|
|
- unit.unitId === auditedUnitName ||
|
|
|
- unit.unitId === String(auditedUnitName)
|
|
|
+ unit.unitId === item.auditedUnit ||
|
|
|
+ unit.unitId === String(item.auditedUnit)
|
|
|
)
|
|
|
if (unitItem) {
|
|
|
auditedUnitName = unitItem.unitName
|
|
|
@@ -1625,17 +1666,25 @@
|
|
|
) {
|
|
|
// 直接使用返回的明细数据
|
|
|
this.selectedFileList = originalData.detailList.map((detail) => {
|
|
|
- // 处理被监审单位:如果是unitName,查找对应的unitId
|
|
|
- let auditedUnit =
|
|
|
+ // 处理被监审单位:如果是unitName(可能是逗号分隔的字符串),查找对应的unitId数组
|
|
|
+ let auditedUnit = []
|
|
|
+ const auditedUnitNameStr =
|
|
|
detail.auditedUnitName || detail.auditedUnit || ''
|
|
|
- if (auditedUnit && this.allUnits.length > 0) {
|
|
|
- // 尝试通过unitName查找unitId
|
|
|
- const unitItem = this.allUnits.find(
|
|
|
- (unit) => unit.unitName === auditedUnit
|
|
|
- )
|
|
|
- if (unitItem) {
|
|
|
- auditedUnit = unitItem.unitId
|
|
|
- }
|
|
|
+ if (auditedUnitNameStr && this.allUnits.length > 0) {
|
|
|
+ // 如果是逗号分隔的字符串,分割成数组
|
|
|
+ const unitNameArray = auditedUnitNameStr
|
|
|
+ .split(',')
|
|
|
+ .map((name) => name.trim())
|
|
|
+ .filter((name) => name)
|
|
|
+ // 将unitName数组转换为unitId数组
|
|
|
+ auditedUnit = unitNameArray
|
|
|
+ .map((unitName) => {
|
|
|
+ const unitItem = this.allUnits.find(
|
|
|
+ (unit) => unit.unitName === unitName
|
|
|
+ )
|
|
|
+ return unitItem ? unitItem.unitId : null
|
|
|
+ })
|
|
|
+ .filter((unitId) => unitId !== null) // 过滤掉未找到的
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
@@ -1646,7 +1695,7 @@
|
|
|
detail.materialName || this.dataDialogForm.materialName || '',
|
|
|
documentName: detail.documentName || '',
|
|
|
documentNo: detail.documentNumber || detail.documentNo || '',
|
|
|
- auditedUnit: auditedUnit,
|
|
|
+ auditedUnit: auditedUnit, // 数组格式
|
|
|
generateTime: detail.generateTime || '',
|
|
|
fileSource: detail.fileSource || '',
|
|
|
pageCount: detail.pageCount || null,
|
|
|
@@ -1717,17 +1766,25 @@
|
|
|
) {
|
|
|
// 直接使用返回的明细数据
|
|
|
this.selectedFileList = originalData.detailList.map((detail) => {
|
|
|
- // 处理被监审单位:如果是unitName,查找对应的unitId
|
|
|
- let auditedUnit =
|
|
|
+ // 处理被监审单位:如果是unitName(可能是逗号分隔的字符串),查找对应的unitId数组
|
|
|
+ let auditedUnit = []
|
|
|
+ const auditedUnitNameStr =
|
|
|
detail.auditedUnitName || detail.auditedUnit || ''
|
|
|
- if (auditedUnit && this.allUnits.length > 0) {
|
|
|
- // 尝试通过unitName查找unitId
|
|
|
- const unitItem = this.allUnits.find(
|
|
|
- (unit) => unit.unitName === auditedUnit
|
|
|
- )
|
|
|
- if (unitItem) {
|
|
|
- auditedUnit = unitItem.unitId
|
|
|
- }
|
|
|
+ if (auditedUnitNameStr && this.allUnits.length > 0) {
|
|
|
+ // 如果是逗号分隔的字符串,分割成数组
|
|
|
+ const unitNameArray = auditedUnitNameStr
|
|
|
+ .split(',')
|
|
|
+ .map((name) => name.trim())
|
|
|
+ .filter((name) => name)
|
|
|
+ // 将unitName数组转换为unitId数组
|
|
|
+ auditedUnit = unitNameArray
|
|
|
+ .map((unitName) => {
|
|
|
+ const unitItem = this.allUnits.find(
|
|
|
+ (unit) => unit.unitName === unitName
|
|
|
+ )
|
|
|
+ return unitItem ? unitItem.unitId : null
|
|
|
+ })
|
|
|
+ .filter((unitId) => unitId !== null) // 过滤掉未找到的
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
@@ -1738,7 +1795,7 @@
|
|
|
detail.materialName || this.dataDialogForm.materialName || '',
|
|
|
documentName: detail.documentName || '',
|
|
|
documentNo: detail.documentNumber || detail.documentNo || '',
|
|
|
- auditedUnit: auditedUnit,
|
|
|
+ auditedUnit: auditedUnit, // 数组格式
|
|
|
generateTime: detail.generateTime || '',
|
|
|
fileSource: detail.fileSource || '',
|
|
|
pageCount: detail.pageCount || null,
|