[update] 修改企标流程各模块的数据格式

This commit is contained in:
lideqin
2023-11-09 15:28:36 +08:00
parent 3d90dde143
commit 370f59d7bd
11 changed files with 351 additions and 539 deletions
@@ -140,6 +140,7 @@ import ContactInitBaseInfo from './modules/ContactInitBaseInfo'
import StandardizationInitBaseInfo from './modules/StandardizationInitBaseInfo'
import DrafterEnterOptionBaseInfo from './modules/DrafterEnterOptionBaseInfo'
import RecheckApproveBaseInfo from './modules/RecheckApproveBaseInfo'
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
// 人员信息
const personalInfo = [ // 人员信息的数据
@@ -188,27 +189,50 @@ export default {
PersonnelInfo,
UserSelectModal
},
mixins: [WorkCenterMixin],
computed: {
pageTitle () {
return this.$t('flowCenter') + this.$route.meta.title
return this.$t('flowCenter') + this.$route.meta.title + '' + this.currentNodeName + ''
}
},
mounted () {
if (this.$route.query.processId) {
this.currentNode = 2 // todo: 先设置一个假数据,后端还不能返回当前节点
// 获取人员信息结构
this.getPersonInfoStructure()
if (this.$route.query.taskId) {
this.currentNodeName = this.$route.query.taskName
// 有流程id说明是从流程中心来的,需要初始化数据
this.getProcessData(this.$route.query.processId)
this.getProcessData(this.$route.query.taskId)
} else {
this.currentNodeName = '发起人发起'
}
// 初始化节点
const taskName = this.$route.query.taskName
if (taskName) {
if (taskName === '发起人发起') {
// 发起人发起
this.currentNode = 1
} else if (taskName === '起草人填写意见') {
// 起草人填写意见
this.currentNode = 2
} else if (taskName === '起草人部长审批') {
// 起草人部长审批
this.currentNode = 3
} else if (taskName === '标准化审批') {
// 标准化审批
this.currentNode = 4
} else {
// 预留加签节点
this.currentNode = 999
}
}
if (this.currentNode === 1) {
this.personnelInfoData = personalInfo
this.disabled = false
// 是节点1的话还需要设置是联络人发起还是标准化发起 ??
// this.initRole =
} else {
this.personnelInfoData = personalInfo.map(item => {
return { ...item, canChoose: false, fieldName: undefined }
})
this.disabled = true
// 如果不是第一个节点,人员信息全部不可选
this.initPersonInfoData()
}
// 如果是查看进入的,不可编辑,不可操作
if (this.$route.query.onlyLook) {
@@ -223,8 +247,9 @@ export default {
disabled: false,
onlyLook: false, // 是否仅查看
currentNode: 1, // 当前节点
currentNodeName: '',
initRole: 'standardization', // 发起角色,发起的时候角色不一样表单不一样,contact联络人发起,standardization标准化发起
model: [],
model: {},
processInfoForm: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
@@ -267,8 +292,8 @@ export default {
},
methods: {
// 根据流程id获取数据并回显
getProcessData (processId) {
enStandardRecheckGetDataById({ processInstanceId: processId }).then(res => {
getProcessData (taskId) {
enStandardRecheckGetDataById(taskId).then(res => {
if (res.success) {
this.model = res.result
this.$nextTick(() => {
@@ -277,17 +302,6 @@ export default {
// 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息
// this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'remarks', 'attachment'))
})
// 初始化业务基本信息的申请类型和项目类别
this.formInline.applicationCategory = this.model[0].applicationCategory
this.formInline.projectType = this.model[0].projectType
// 初始化人员信息 todo: 发起人还没处理
this.personnelInfoData = personalInfo.map(item => {
if (item.fieldName) {
return { ...item, userList: this.model[0][item.fieldName + '_dictText'], canChoose: false }
} else {
return item
}
})
// 初始化业务基本信息中组件内容
} else {
this.$message.warning(res.message)
@@ -313,15 +327,7 @@ export default {
// 流程审批信息
const approvalInfoForm = this.approvalInfoForm.getFieldsValue()
// 人员信息的数据, 处理成对象
const personnelInfo = this.$refs.personnelInfo.stepsData
const personnelObj = {}
for (const item of personnelInfo) {
if (item.fieldName) {
personnelObj[item.fieldName] = item.user
}
}
// 需要传给后端的数据
const arr = []
const personnelObj = this.$refs.personnelInfo.getDataObj()
// 业务基本信息
const baseInfo = this.$refs.baseInfoRef.getData()
const param = { ...processInfoForm, ...baseInfo.formInline, ...approvalInfoForm, ...personnelObj }
@@ -331,16 +337,14 @@ export default {
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
if (baseInfo.dataSource && baseInfo.dataSource.length > 0) {
for (const item of baseInfo.dataSource) {
arr.push({ ...item, ...param })
}
} else {
arr.push(param)
}
// 需要传给后端的数据
const paramObj = {}
paramObj.common = { ...processInfoForm, ...approvalInfoForm }
paramObj.flowUser = personnelObj
paramObj.dataList = [baseInfo.formInline]
this.loading = true
// 保存到草稿
enStandardRecheckSave(arr).then(res => {
enStandardRecheckSave(paramObj).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
@@ -354,36 +358,30 @@ export default {
handleStart () {
if (this.loading) return
// 人员信息的数据, 处理成对象
const personnelInfo = this.$refs.personnelInfo.stepsData
const personnelObj = {}
for (const item of personnelInfo) {
if (item.fieldName) {
personnelObj[item.fieldName] = item.user
}
}
// 校验是否填了所有能填的人员信息
if (!Object.values(personnelObj).every(v => !!v)) {
this.$message.warning(this.$t('pleaseEnterPersonnelInfo'))
const personnelObj = this.$refs.personnelInfo.getDataObjVerify()
if (!personnelObj) {
return
}
// 流程信息的校验
this.processInfoForm.validateFields((err, values) => {
// 流程审批信息的校验
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
this.$refs.baseInfoRef.getDataValidate(data => {
if (!err && !approvalErr && data) {
const arr = [] // 需要传给后端的数据
enStandardRecheckApproval(arr).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
this.approvalInfoForm.validateFields(async (approvalErr, approvalValues) => {
const data = await this.$refs.baseInfoRef.getDataValidate()
if (!err && !approvalErr && data) {
const paramObj = {} // 需要传给后端的数据
paramObj.common = { ...values, ...approvalValues }
paramObj.flowUser = personnelObj
paramObj.dataList = [data.formInline]
enStandardRecheckApproval(paramObj).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
})
},