fix 81119
This commit is contained in:
+2
-5
@@ -339,7 +339,7 @@ export default {
|
|||||||
}
|
}
|
||||||
// 发起节点:通过表格中的员获取所属部门人稽查征求意见对象
|
// 发起节点:通过表格中的员获取所属部门人稽查征求意见对象
|
||||||
if (this.isInitiate) {
|
if (this.isInitiate) {
|
||||||
const userList = this.$refs.inspectionPlanTable.dataSource.map(item => item.objectOfConsultation.split(',')).flat(Infinity)
|
const userList = this.$refs.inspectionPlanTable.getData().map(item => item.objectOfConsultation.split(',')).flat(Infinity)
|
||||||
personnelObj.opinionFillList = Array.from(new Set(userList)).filter(item => item)
|
personnelObj.opinionFillList = Array.from(new Set(userList)).filter(item => item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -382,10 +382,7 @@ export default {
|
|||||||
}
|
}
|
||||||
const params = {}
|
const params = {}
|
||||||
// 业务表信息
|
// 业务表信息
|
||||||
params.processEsInspectPlanList = this.$refs.inspectionPlanTable.dataSource.map(item => {
|
params.processEsInspectPlanList = this.$refs.inspectionPlanTable.getData()
|
||||||
delete item.createTime
|
|
||||||
return item
|
|
||||||
})
|
|
||||||
// 获取删除业务信息的ids列表
|
// 获取删除业务信息的ids列表
|
||||||
params.processAllDelIds = this.$refs.inspectionPlanTable.getDelIds()
|
params.processAllDelIds = this.$refs.inspectionPlanTable.getDelIds()
|
||||||
// 收集所有表单信息
|
// 收集所有表单信息
|
||||||
|
|||||||
+30
-12
@@ -18,7 +18,7 @@
|
|||||||
:columns="columns"
|
:columns="columns"
|
||||||
:dataSource="dataSource"
|
:dataSource="dataSource"
|
||||||
:can-drag="true"
|
:can-drag="true"
|
||||||
:rowKey="(_, index) => index"
|
rowKey="id"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
:row-selection="hasTableOperator ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps } : null"
|
:row-selection="hasTableOperator ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps } : null"
|
||||||
@@ -76,6 +76,8 @@ import { EsInspectionPlan } from '@/enums/commonEnums'
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
// 临时id前缀
|
||||||
|
const tempIdPrefix = 'tempId_'
|
||||||
let importModalLoading
|
let importModalLoading
|
||||||
export default {
|
export default {
|
||||||
name: 'InspectionPlanTable',
|
name: 'InspectionPlanTable',
|
||||||
@@ -295,13 +297,9 @@ export default {
|
|||||||
title: this.$t('confirmBatchDeletion'),
|
title: this.$t('confirmBatchDeletion'),
|
||||||
content: this.$t('deleteAData'),
|
content: this.$t('deleteAData'),
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
// 将删除的id进行收集,提交节点的时候后端进行删除
|
// 收集除了前端生成的id
|
||||||
this.selectedRowKeys.forEach(key => {
|
this.delIds.push(...this.selectedRowKeys.filter(item => !item.includes(tempIdPrefix)))
|
||||||
if (this.dataSource[key].id) {
|
this.dataSource = this.dataSource.filter((item) => !this.selectedRowKeys.includes(item.id))
|
||||||
this.delIds.push(this.dataSource[key].id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.dataSource = this.dataSource.filter((item, index) => !this.selectedRowKeys.includes(index))
|
|
||||||
this.onClearSelected()
|
this.onClearSelected()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -313,11 +311,13 @@ export default {
|
|||||||
title: this.$t('confirmDeletion'),
|
title: this.$t('confirmDeletion'),
|
||||||
content: this.$t('areYouSure'),
|
content: this.$t('areYouSure'),
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
// 将删除的id进行收集,提交节点的时候后端进行删除
|
// 将删除的id进行收集,提交节点的时候后端进行删除(非前端临时id)
|
||||||
if (this.dataSource[index].id) {
|
const id = this.dataSource[index].id
|
||||||
|
if (id && !id.includes(tempIdPrefix)) {
|
||||||
this.delIds.push(this.dataSource[index].id)
|
this.delIds.push(this.dataSource[index].id)
|
||||||
}
|
}
|
||||||
this.dataSource.splice(index, 1)
|
this.dataSource.splice(index, 1)
|
||||||
|
this.onClearSelected()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -332,12 +332,19 @@ export default {
|
|||||||
this.$refs.modalForm.title = this.$t('edit')
|
this.$refs.modalForm.title = this.$t('edit')
|
||||||
this.$refs.modalForm.disableSubmit = false
|
this.$refs.modalForm.disableSubmit = false
|
||||||
},
|
},
|
||||||
|
// 临时生成前端id,提交后端前删除,作用是给rowKey唯一值,因为禁用选择使用下标会出错
|
||||||
|
generateTempId (index) {
|
||||||
|
// 用时间戳加行号,防止导入时同一个时间戳重复
|
||||||
|
return tempIdPrefix + +new Date() + '_' + index
|
||||||
|
},
|
||||||
// 添加或编辑回调
|
// 添加或编辑回调
|
||||||
handleAddOrEditCallback (row, index) {
|
handleAddOrEditCallback (row, index) {
|
||||||
this.$message.success(this.$t('operationSuccessful'))
|
this.$message.success(this.$t('operationSuccessful'))
|
||||||
console.log('添加或编辑回调', row, index)
|
console.log('添加或编辑回调', row, index)
|
||||||
// index -1就是添加
|
// index -1就是添加
|
||||||
if (index === undefined || index === -1) {
|
if (index === undefined || index === -1) {
|
||||||
|
// 新增时手动添加前端id
|
||||||
|
row.id = this.generateTempId(this.dataSource.length)
|
||||||
this.dataSource.push(row)
|
this.dataSource.push(row)
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.splice(index, 1, row)
|
this.dataSource.splice(index, 1, row)
|
||||||
@@ -361,7 +368,14 @@ export default {
|
|||||||
return obj
|
return obj
|
||||||
},
|
},
|
||||||
getData () {
|
getData () {
|
||||||
return this.dataSource
|
return this.dataSource.map(item => {
|
||||||
|
// 如果有前端生成的id,就把id去掉不给后端提交
|
||||||
|
if ((item.id + '').includes(tempIdPrefix)) {
|
||||||
|
delete item.id
|
||||||
|
}
|
||||||
|
delete item.createTime
|
||||||
|
return item
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 更新表格数据
|
// 更新表格数据
|
||||||
updateData (list) {
|
updateData (list) {
|
||||||
@@ -440,7 +454,11 @@ export default {
|
|||||||
}
|
}
|
||||||
// 前端存储
|
// 前端存储
|
||||||
const data = info.file.response.result || []
|
const data = info.file.response.result || []
|
||||||
this.dataSource.push(...data)
|
this.dataSource.push(...data.map((item, index) => {
|
||||||
|
// 导入的时候生成前端id,不用索引防止禁用出错
|
||||||
|
item.id = this.generateTempId(this.dataSource.length + index)
|
||||||
|
return item
|
||||||
|
}))
|
||||||
} else {
|
} else {
|
||||||
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {
|
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {
|
||||||
this.messageLineFeed(this.$t('fileImportError'), info.file.response.result)
|
this.messageLineFeed(this.$t('fileImportError'), info.file.response.result)
|
||||||
|
|||||||
Reference in New Issue
Block a user