[update] 企标计划立项、更改流程

This commit is contained in:
lideqin
2023-10-27 13:51:44 +08:00
parent 2bb6e58dc7
commit 776ee7c670
3 changed files with 104 additions and 48 deletions
+3 -3
View File
@@ -29,9 +29,9 @@
<div class="personnel-container-content-text">
<template v-if="step.canChoose && index >= currentNodeIndex">
<!-- TODO 数据库设计确定后处理数据抛出格式-->
<user-select-by-work-group v-if="step.chooseSource === 'workGroup'" v-model="step.user" :type="step.chooseType" input-type="textarea"/>
<user-select-by-contact v-else-if="step.chooseSource === 'contactManage'" v-model="step.user" :type="step.chooseType" input-type="textarea"/>
<user-selection v-else-if="!['contactManage', 'workGroup'].includes(step.chooseSource)" :type="step.chooseType" v-model="step.user" input-type="textarea" />
<user-select-by-work-group v-if="step.chooseSource === 'workGroup'" v-model="step.user" :type="step.chooseType" :name-str="step.user_dictText" input-type="textarea"/>
<user-select-by-contact v-else-if="step.chooseSource === 'contactManage'" v-model="step.user" :type="step.chooseType" :name-str="step.user_dictText" input-type="textarea"/>
<user-selection v-else-if="!['contactManage', 'workGroup'].includes(step.chooseSource)" :type="step.chooseType" v-model="step.user" :name-str="step.user_dictText" input-type="textarea" />
</template>
<div class="personnel-container-content-echo-text" v-else>{{ step.userList }}</div>
</div>
@@ -73,6 +73,7 @@
<!-- dictCode="esp_application_category" />-->
<a-select v-model="formInline.applicationCategory"
:disabled="disabled"
@change="applicationCategoryChange"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.applicationType')">
<a-select-option :value="ApplicationCategory.INITIATION.value">{{ $t('workCenter.enterpriseInitChangePlan.standardProjectEstablishment') }}</a-select-option>
<a-select-option :value="ApplicationCategory.CHANGE.value">{{ $t('workCenter.enterpriseInitChangePlan.change') }}</a-select-option>
@@ -442,47 +443,20 @@ export default {
// }
// }
},
watch: {
'formInline.applicationCategory' (value) {
if (value) {
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
if (this.currentNode === 1) {
this.personnelInfoData = approvalPersonalInfo
} else {
this.personnelInfoData = this.personnelInfoData.map(item => {
return { ...item, canChoose: false }
})
}
} else {
if (this.currentNode === 1) {
this.personnelInfoData = changePersonalInfo
} else {
this.personnelInfoData = this.personnelInfoData.map(item => {
return { ...item, canChoose: false }
})
}
}
}
if (this.formInline.projectType) {
this.formInline.projectType = undefined
}
}
},
// watch: {
// // 也只有节点1才会改变,应该在初始化数据的时候不触发才对??
// 'formInline.applicationCategory' (value) {
//
// }
// },
mounted () {
console.log(this.$route.query.taskId)
if (this.$route.query.taskId) {
this.currentNode = 2 // todo: 先设置一个假数据,后端还不能返回当前节点
// 有流程id说明是从流程中心来的,需要初始化数据
this.getProcessData(this.$route.query.taskId)
}
if (this.currentNode === 1) {
this.personnelInfoData = approvalPersonalInfo
this.disabled = false
} else {
this.personnelInfoData = approvalPersonalInfo.map(item => {
return { ...item, canChoose: false, fieldName: undefined }
})
this.disabled = true
// 没有taskId说明是新建进来的,初始化人员信息
this.personnelInfoData = approvalPersonalInfo
}
// 如果是查看进入的,不可编辑,不可操作
if (this.$route.query.onlyLook) {
@@ -553,7 +527,7 @@ export default {
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.applicationType') + this.$t('cannotEmpty'),
trigger: 'change'
trigger: ['change', 'blur']
}
],
// 项目类别
@@ -586,22 +560,88 @@ export default {
// this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'commitText', 'commitFile'))
})
// 初始化业务基本信息的申请类型和项目类别
this.formInline.applicationCategory = this.model.dataList[0].applicationCategory
this.formInline.projectType = this.model.dataList[0].projectType
const baseInfoForm = {}
baseInfoForm.applicationCategory = this.model.dataList[0].applicationCategory
this.formInline = Object.assign({}, baseInfoForm)
this.$nextTick(() => {
baseInfoForm.projectType = this.model.dataList[0].projectType
this.formInline = Object.assign({}, baseInfoForm)
})
// 初始化流程节点,此流程因为节点名称有重复,需要在此处根据applicationCatsegory做一些判断
const taskName = this.$route.query.taskName
if (taskName) {
if (taskName === '主起草人发起') {
this.currentNode = 1
} else if (taskName === '部所联络人校对') {
this.currentNode = 2
} else if (taskName === '专家审批' || taskName === '主起草人主管级领导审批') {
this.currentNode = 3
} else if (taskName === '发起人主管级领导审批' || taskName === '主起草人主管级上一级领导审批') {
this.currentNode = 4
} else if (taskName === '发起人主管级上级领导审批' || (taskName === '标准化审批' && this.formInline.applicationCategory === this.ApplicationCategory.CHANGE.value)) {
this.currentNode = 5
} else if ((taskName === '标准化审批' && this.formInline.applicationCategory === this.ApplicationCategory.INITIATION.value) || taskName === '新起草部门主管级上一级领导下发') {
this.currentNode = 6
} else if (taskName === '新起草部门主管级领导确认') {
this.currentNode = 7
} else if (taskName === '相关人员会签') {
this.currentNode = 8
} else {
this.currentNode = 9
}
}
// 根据流程节点初始化是否可以编辑
if (this.currentNode === 1) {
this.disabled = false
} else {
this.disabled = true
}
// 初始化人员信息 todo: 发起人还没处理
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value && this.currentNode === 1) {
// 立项的节点1
this.personnelInfoData = approvalPersonalInfo.map(item => {
if (item.fieldName) {
return { ...item, user: this.model.flowUser [item.fieldName], userList: this.model.flowUser [item.fieldName + '_dictText'], canChoose: false }
return {
...item,
user: this.model.flowUser[item.fieldName],
user_dictText: this.model.flowUser[item.fieldName + '_dictText']
}
} else {
return item
}
})
} else if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
// 立项的其他节点
this.personnelInfoData = approvalPersonalInfo.map(item => {
if (item.fieldName) {
return {
...item,
user: this.model.flowUser[item.fieldName],
userList: this.model.flowUser[item.fieldName + '_dictText'],
canChoose: false
}
} else {
return item
}
})
} else if (this.formInline.applicationCategory === ApplicationCategory.CHANGE.value && this.currentNode === 1) {
// 变更的节点1
this.personnelInfoData = changePersonalInfo.map(item => {
if (item.fieldName) {
return {
...item,
user: this.model.flowUser[item.fieldName],
user_dictText: this.model.flowUser[item.fieldName + '_dictText']
}
} else {
return item
}
})
} else {
// 变更的其他节点
this.personnelInfoData = changePersonalInfo.map(item => {
console.log(item)
if (item.fieldName) {
return { ...item, user: this.model.flowUser [item.fieldName], userList: this.model.flowUser [item.fieldName + '_dictText'], canChoose: false }
return { ...item, user: this.model.flowUser[item.fieldName], userList: this.model.flowUser[item.fieldName + '_dictText'], canChoose: false }
} else {
return item
}
@@ -647,6 +687,19 @@ export default {
switchChange (value) {
this.switchValue = value
},
// 申请类型改变
applicationCategoryChange (value) {
if (value) {
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
this.personnelInfoData = approvalPersonalInfo
} else {
this.personnelInfoData = changePersonalInfo
}
}
if (this.formInline.projectType) {
this.formInline.projectType = undefined
}
},
// 业务基本信息组件中获取到流程名称改变后的值
processNameChange (value) {
const param = { prcName: value }
@@ -749,7 +802,7 @@ export default {
const param = {} // 传给后端的参数
param.common = { ...processInfoForm, ...approvalInfoForm } // 流程信息和流程审批信息
param.dataList = arr // 业务基础信息数组
param.flowUser = personnelObj // 人员信息
param.flowUser = personnelObj // 人员信息
// 保存到草稿
enterprisePlanApprovalSave(param).then(res => {
if (res.success) {
@@ -781,6 +834,7 @@ export default {
this.$message.warning(this.$t('pleaseEnterPersonnelInfo'))
return
}
console.log(this.formInline)
this.processInfoForm.validateFields((err, values) => {
this.$refs.ruleForm.validate(valid => {
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
@@ -832,6 +886,7 @@ export default {
// 是变更-合并
this.$refs.changeBaseInfo.$refs.ruleForm.validate(changeBaseValid => {
if (valid && changeBaseValid && !err && !approvalErr) {
this.loading = true
const changeBaseInfo = this.$refs.changeBaseInfo.formInline
if (changeBaseInfo.projectTypeOne !== changeBaseInfo.projectTypeTwo) {
// 合并时候的两个计划需要限定修订+修订,或者制定+制定
@@ -864,11 +919,12 @@ export default {
const param = {} // 需要传给后端的数据
param.common = { ...values, ...approvalValues } // 流程信息和流程审批信息
param.dataList = arr
param.flowUser = personnelObj
param.flowUser = personnelObj
let func
if (this.$route.query.taskId) {
// 有taskId说明是驳回的提交
func = enterprisePlanApprovalAgree
param.common.taskId = this.$route.query.taskId
} else {
func = enterprisePlanApproval
}
@@ -147,7 +147,7 @@ export default {
this.$router.push({
path: path,
query: {
currentNode: record.currentNode,
taskName: record.taskName,
processId: record.id, // 流程id
taskId: record.taskId // 任务id
}