update 流程保存草稿人员信息

This commit is contained in:
danshihao
2023-12-28 14:51:58 +08:00
parent f4998c71f5
commit d5b83ba72a
6 changed files with 175 additions and 46 deletions
@@ -221,6 +221,10 @@ export default {
},
processDisabled () {
return this.currentNode !== EsInspectionPlan.initiate.value
},
// 是否发起节点
isInitiate () {
return this.currentNode === EsInspectionPlan.initiate.value
}
},
created () {
@@ -237,9 +241,9 @@ export default {
}
// 查询人员信息
this.getPersonInfoStructure(this.processKey, () => {
this.initPersonInfoData(this.currentNode === EsInspectionPlan.initiate.value)
this.initPersonInfoData(this.isInitiate)
})
// 如果是待办进来,就获取详情数据
// 如果是待办或草稿进来,就获取详情数据
if (this.$route.query.projectId) {
this.loadPage()
return
@@ -266,7 +270,7 @@ export default {
* 获取页面详情
*/
loadPage () {
const { projectId, taskId } = this.$route.query
const { projectId, taskId, draftId } = this.$route.query
this.loading = true
getInspectPlanDetail({
projectId,
@@ -296,6 +300,17 @@ export default {
})
// 触发会签改变
this.changeIsCountersign(data.countersignTag)
// 草稿状态回显
if (draftId) {
const { draftData, personInfo } = JSON.parse(data.infoJsonStr || '{}')
console.log('草稿回显', JSON.parse(data.infoJsonStr || '{}'), draftData, personInfo)
// 节点1 回显人员信息
if (this.isInitiate) {
this.draftInitPersonInfo(personInfo)
}
// 回显业务信息(需要等后端调整)
}
}
}).finally(() => {
this.loading = false
@@ -306,7 +321,7 @@ export default {
let personnelObj = {}
const funName = isValidate ? 'getDataObjVerify' : 'getDataObj'
// 节点1:所有的人员信息
if (this.currentNode === EsInspectionPlan.initiate.value) {
if (this.isInitiate) {
// 人员信息的数据, 处理成对象
personnelObj = this.$refs.personnelInfo[funName]()
if (!personnelObj) {
@@ -318,9 +333,11 @@ export default {
personnelObj[key] = personnelObj[key].split(',')
}
}
// 通过表格中的所属部门人员获取稽查征求意见对象
const userList = this.$refs.inspectionPlanTable.dataSource.map(item => item.objectOfConsultation.split(',')).flat(Infinity)
personnelObj.opinionFillList = Array.from(new Set(userList)).filter(item => item)
// 发起节点:通过表格中的员获取所属部门人稽查征求意见对象
if (this.isInitiate) {
const userList = this.$refs.inspectionPlanTable.dataSource.map(item => item.objectOfConsultation.split(',')).flat(Infinity)
personnelObj.opinionFillList = Array.from(new Set(userList)).filter(item => item)
}
}
return personnelObj
},
@@ -347,8 +364,8 @@ export default {
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
}
// 收集人员信息
const getPersonInfo = this.getPersonInfo(isValidate)
if (!getPersonInfo) {
const personInfo = this.getPersonInfo(isValidate)
if (!personInfo) {
throw new Error('user')
}
@@ -361,7 +378,7 @@ export default {
})
// 处理其他参数
params.map = Object.assign({}, formDataList[1], getPersonInfo)
params.map = Object.assign({}, formDataList[1], personInfo)
// 节点三:会签表单放到对象最外层单独存储业务信息,params.map里是流程用的
if (this.currentNode === EsInspectionPlan.liaisonCollect.value && Object.hasOwnProperty.call(params.map, 'countersignTag')) {
params.countersignTag = params.map.countersignTag
@@ -412,6 +429,13 @@ export default {
if (this.loading) return
this.loading = true
this.getPageParams(false).then(res => {
// 保存草稿信息
res.infoJsonStr = JSON.stringify({
// 人员信息(要重新获取,流程里的信息不能直接用,后端需要多选人员处理成数组了)
personInfo: this.$refs.personnelInfo.getDataObj()
// 业务数据(需要等后端调整)
// draftData:
})
console.log(res)
return saveInspectPlan(res)
}).then(res => {