[update] 修改企标流程各模块的数据格式
This commit is contained in:
+60
-53
@@ -121,9 +121,10 @@ import {
|
||||
enStandardStartUseApproval,
|
||||
enStandardStartUseTurnTo,
|
||||
enStandardStartUseAgree,
|
||||
enStandardStartUseReject,
|
||||
enStandardStartUseReject
|
||||
} from '@/api/workCenter'
|
||||
import BaseInfoForm from './modules/BaseInfoForm'
|
||||
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
|
||||
|
||||
// 人员信息
|
||||
const personalInfo = [ // 人员信息的数据
|
||||
@@ -169,25 +170,48 @@ 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.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
|
||||
} else {
|
||||
this.personnelInfoData = personalInfo.map(item => {
|
||||
return { ...item, canChoose: false, fieldName: undefined }
|
||||
})
|
||||
this.disabled = true
|
||||
// 如果不是第一个节点,人员信息全部不可选
|
||||
this.initPersonInfoData()
|
||||
}
|
||||
// 如果是查看进入的,不可编辑,不可操作
|
||||
if (this.$route.query.onlyLook) {
|
||||
@@ -202,7 +226,8 @@ export default {
|
||||
disabled: false,
|
||||
onlyLook: false, // 是否仅查看
|
||||
currentNode: 1, // 当前节点
|
||||
model: [],
|
||||
currentNodeName: '',
|
||||
model: {},
|
||||
processInfoForm: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
@@ -255,14 +280,6 @@ export default {
|
||||
// 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息
|
||||
// this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'remarks', 'attachment'))
|
||||
})
|
||||
// 初始化人员信息 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)
|
||||
@@ -288,15 +305,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 }
|
||||
@@ -306,10 +315,14 @@ export default {
|
||||
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
|
||||
return
|
||||
}
|
||||
arr.push(param)
|
||||
// 需要传给后端的数据
|
||||
const paramObj = {}
|
||||
paramObj.common = { ...processInfoForm, ...approvalInfoForm }
|
||||
paramObj.flowUser = personnelObj
|
||||
paramObj.dataList = [baseInfo.formInline]
|
||||
this.loading = true
|
||||
// 保存到草稿
|
||||
enStandardStartUseSave(arr).then(res => {
|
||||
enStandardStartUseSave(paramObj).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
} else {
|
||||
@@ -323,36 +336,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 = [] // 需要传给后端的数据
|
||||
enStandardStartUseApproval(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]
|
||||
enStandardStartUseApproval(arr).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user