[update] 企标流程联调
This commit is contained in:
@@ -125,7 +125,8 @@ import {
|
||||
import MainDrafterInitBaseInfo from './modules/MainDrafterInitBaseInfo'
|
||||
import ApproveBaseInfo from './modules/ApproveBaseInfo'
|
||||
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
|
||||
import { ProcessKey } from '../../../enums/commonEnums'
|
||||
import { ProcessKey, EsChangeNodes } from '@/enums/commonEnums'
|
||||
import { enStandardChangeGetDataDraft } from '../../../api/workCenter'
|
||||
|
||||
export default {
|
||||
name: 'EnterpriseStandardChangeFlow',
|
||||
@@ -144,39 +145,50 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
// 获取人员信息结构
|
||||
this.getPersonInfoStructure(ProcessKey.ES_CHANGE.value)
|
||||
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 === '主起草人发起') {
|
||||
const nodeId = this.$route.query.nodeId
|
||||
if (nodeId) {
|
||||
if (nodeId === EsChangeNodes.mainDrafterStart.value) {
|
||||
this.currentNode = 1
|
||||
} else if (taskName === '相关人员校对') {
|
||||
} else if (nodeId === EsChangeNodes.relevantPersonnelCheck.value) {
|
||||
this.currentNode = 2
|
||||
} else if (taskName === '起草人主管级领导审批') {
|
||||
} else if (nodeId === EsChangeNodes.mainDrafterLeaderApproval.value) {
|
||||
this.currentNode = 3
|
||||
} else if (taskName === '标准化审批') {
|
||||
} else if (nodeId === EsChangeNodes.standardizationApproval.value) {
|
||||
this.currentNode = 4
|
||||
} else if (taskName === '起草人主管级上一级领导审批') {
|
||||
} else if (nodeId === EsChangeNodes.mainDrafterLeaderLeaderApproval.value) {
|
||||
this.currentNode = 5
|
||||
} else {
|
||||
// 预留加签节点
|
||||
this.currentNode = 999
|
||||
}
|
||||
}
|
||||
if (this.currentNode === 1) {
|
||||
this.disabled = false
|
||||
this.initPersonInfoData(true)
|
||||
// 获取人员信息结构
|
||||
this.getPersonInfoStructure(ProcessKey.ES_CHANGE.value, () => {
|
||||
if (this.$route.query.processInstanceId) {
|
||||
if (this.currentNode === 1) {
|
||||
this.disabled = false
|
||||
this.initPersonInfoData(true)
|
||||
} else {
|
||||
this.disabled = true
|
||||
// 如果不是第一个节点,人员信息全部不可选
|
||||
this.initPersonInfoData(false)
|
||||
}
|
||||
}
|
||||
})
|
||||
if (this.$route.query.taskId && !this.$route.query.draftId) {
|
||||
// 有流程id说明是从流程中心来的,需要初始化数据
|
||||
this.getProcessData('todo', { taskId: this.$route.query.taskId })
|
||||
}
|
||||
if (this.$route.query.draftId) {
|
||||
// 有草稿id,说明是从流程中心-草稿来的,需要初始化数据
|
||||
this.getProcessData('draft', { draftId: this.$route.query.draftId, projectId: this.$route.query.projectId })
|
||||
}
|
||||
if (this.$route.query.taskName) {
|
||||
// 说明是已发起流程
|
||||
this.currentNodeName = this.$route.query.taskName
|
||||
} else {
|
||||
this.disabled = true
|
||||
this.initPersonInfoData(false)
|
||||
this.currentNodeName = '发起人发起'
|
||||
}
|
||||
// 如果是查看进入的,不可编辑,不可操作
|
||||
if (this.$route.query.onlyLook) {
|
||||
@@ -235,15 +247,26 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
// 根据流程id获取数据并回显
|
||||
getProcessData (taskId) {
|
||||
enStandardChangeGetDataById(taskId).then(res => {
|
||||
getProcessData (type, param) {
|
||||
let func
|
||||
let params = {}
|
||||
if (type === 'todo') {
|
||||
func = enStandardChangeGetDataById
|
||||
params = param.taskId
|
||||
} else {
|
||||
func = enStandardChangeGetDataDraft
|
||||
params = param
|
||||
}
|
||||
func(params).then(res => {
|
||||
if (res.success) {
|
||||
this.model = res.result
|
||||
this.$nextTick(() => {
|
||||
// 初始化流程信息
|
||||
this.processInfoForm.setFieldsValue(pick(this.model[0], 'prcName', 'dueTime', 'prcMes'))
|
||||
// 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息
|
||||
// this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'commitText', 'commitFile'))
|
||||
// 初始化流程审批信息,草稿进来的才回显审批信息
|
||||
if (type === 'draft') {
|
||||
this.approvalInfoForm.setFieldsValue(pick(this.model.common, 'commitText', 'commitFile'))
|
||||
}
|
||||
})
|
||||
// 初始化业务基本信息中组件内容
|
||||
} else {
|
||||
@@ -274,6 +297,8 @@ export default {
|
||||
// 需要传给后端的
|
||||
const paramObj = {}
|
||||
paramObj.common = { ...processInfoForm, ...approvalInfoForm }
|
||||
paramObj.common.taskId = this.$route.query.taskId || null
|
||||
paramObj.common.processInstanceId = this.model.common ? this.model.common.processInstanceId : null
|
||||
paramObj.flowUser = personnelObj
|
||||
if (this.$refs.baseInfoRef) {
|
||||
// 业务基本信息
|
||||
@@ -285,12 +310,9 @@ export default {
|
||||
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
|
||||
return
|
||||
}
|
||||
paramObj.data = Object.assign({}, baseInfo.formInline)
|
||||
if (baseInfo.dataSource) {
|
||||
paramObj.dataList = baseInfo.dataSource.map(item => {
|
||||
return { ...item, ...baseInfo.formInline }
|
||||
})
|
||||
} else {
|
||||
paramObj.dataList = [baseInfo.formInline]
|
||||
paramObj.data.list = baseInfo.dataSource
|
||||
}
|
||||
} else {
|
||||
const param = { ...processInfoForm, ...approvalInfoForm, ...personnelObj }
|
||||
@@ -328,12 +350,12 @@ export default {
|
||||
this.approvalInfoForm.validateFields(async (approvalErr, approvalValues) => {
|
||||
const data = await this.$refs.baseInfoRef.getDataValidate()
|
||||
if (!err && !approvalErr && data) {
|
||||
this.loading = true
|
||||
const param = {} // 需要传给后端的数据
|
||||
param.common = { ...values, ...approvalValues }
|
||||
param.flowUser = personnelObj
|
||||
param.dataList = data.dataSource.map(item => {
|
||||
return { ...item, ...data.formInline }
|
||||
})
|
||||
param.data = Object.assign({}, data.formInline)
|
||||
param.data.list = data.dataSource
|
||||
enStandardChangeApproval(param).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
|
||||
Reference in New Issue
Block a user