[update] 联调企标立项、变更计划

This commit is contained in:
lideqin
2023-10-13 18:08:38 +08:00
parent 667656fc5d
commit bf517b5d37
23 changed files with 747 additions and 563 deletions
@@ -65,12 +65,18 @@
</span>
</div>
<a-form-model-item class="item-model" prop="applicationCategory">
<a-select v-model="formInline.applicationCategory"
:disabled="disabled"
: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>
</a-select>
<j-dict-select-tag v-model="formInline.applicationCategory"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.applicationType')"
:type="'select'"
:triggerChange="false"
dictCode="esp_application_category" />
<!--<a-select v-model="formInline.applicationCategory"-->
<!-- :disabled="disabled"-->
<!-- :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>-->
<!--</a-select>-->
</a-form-model-item>
</div>
<!-- 项目类别 -->
@@ -85,6 +91,7 @@
<a-select v-if="formInline.applicationCategory === ApplicationCategory.INITIATION.value"
v-model="formInline.projectType"
:disabled="disabled"
@change="projectTypeChange"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.itemCategory')">
<a-select-option :value="ProjectType.ENACT.value">{{ $t('workCenter.enterpriseInitChangePlan.formulate') }}</a-select-option>
<a-select-option :value="ProjectType.MODIFY.value">{{ $t('workCenter.enterpriseInitChangePlan.revise') }}</a-select-option>
@@ -105,7 +112,7 @@
</a-form-model>
<!-- 申请类型为立项时的业务基本信息部分组件 -->
<approval-base-info
v-show="formInline.applicationCategory === ApplicationCategory.INITIATION.value"
v-if="formInline.applicationCategory === ApplicationCategory.INITIATION.value"
ref="approvalBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
@@ -113,10 +120,11 @@
</approval-base-info>
<!-- 申请类型为变更,项目类型为完成时间变更时的业务基本信息部分组件 -->
<finish-time-change-base-info
v-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.COMPLETE_TIME_CHANGE.value"
v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.COMPLETE_TIME_CHANGE.value"
ref="changeBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
:projectType="formInline.projectType"
>
</finish-time-change-base-info>
<!-- 申请类型为变更,项目类型为工作终止时的业务基本信息部分组件 -->
@@ -125,6 +133,7 @@
ref="changeBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
:projectType="formInline.projectType"
>
</job-end-base-info>
<!-- 申请类型为变更,项目类型为责任部门变更的业务基本信息部分组件 -->
@@ -132,6 +141,7 @@
v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.RESPONSIBLE_DEPT_CHANGE.value"
ref="changeBaseInfo"
:disabled="disabled"
:projectType="formInline.projectType"
>
</duty-depart-change-base-info>
<!-- 申请类型为变更,项目类型为合并的业务基本信息部分组件 -->
@@ -139,6 +149,7 @@
v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.MERGE.value"
ref="changeBaseInfo"
:disabled="disabled"
:projectType="formInline.projectType"
>
</merge-base-info>
@@ -238,7 +249,8 @@ import {
enterprisePlanApprovalReject,
enterprisePlanApprovalDetermine,
enterprisePlanApprovalSave,
enterprisePlanApproval
enterprisePlanApproval,
getProcessDataById
} from '@/api/workCenter'
import ApprovalBaseInfo from './modules/ApprovalBaseInfo'
import FinishTimeChangeBaseInfo from './modules/FinishTimeChangeBaseInfo'
@@ -263,7 +275,7 @@ const approvalPersonalInfo = [ // 人员信息的数据
canChoose: true,
chooseType: 'radio',
// todo: 还没有联络人管理模块,暂时用选用户
// chooseSource: 'contactManage',
chooseSource: 'contactManage',
fieldName: 'contactUser'
},
{
@@ -314,60 +326,65 @@ const changePersonalInfo = [
nodeRoleName: '部所联络人',
canChoose: true,
chooseType: 'radio',
chooseSource: 'contactManage'
// todo: 还没有联络人管理模块,暂时用选用户
chooseSource: 'contactManage',
fieldName: 'contactUser'
},
{
id: 3,
nodeName: '主起草人主管级领导审批',
nodeRoleName: '主起草人主管级领导',
canChoose: true,
chooseType: 'radio'
chooseType: 'radio',
fieldName: 'mainDraftUserLeader'
},
{
id: 4,
nodeName: '主起草人主管级上一级领导审批',
nodeRoleName: '主起草人主管级上一级领导',
canChoose: true,
chooseType: 'radio'
chooseType: 'radio',
fieldName: 'mainDraftUserLeaderLeader'
},
{
id: 5,
nodeName: '标准化审批',
nodeRoleName: '标准化',
canChoose: true,
chooseType: 'radio'
chooseType: 'radio',
fieldName: 'standardizationApprovalUser'
},
{
id: 6,
nodeName: '新起草部门主管级上一级领导下发',
nodeRoleName: '新起草部门主管级上一级领导',
canChoose: true,
canChoose: false,
chooseType: 'radio',
disabled: true
fieldName: 'newMainDraftUserLeaderLeader'
},
{
id: 7,
nodeName: '新起草部门主管级领导确认',
nodeRoleName: '新起草部门主管级领导',
canChoose: true,
canChoose: false,
chooseType: 'radio',
disabled: true
fieldName: 'newMainDraftUserLeader'
},
{
id: 8,
nodeName: '相关人员会签',
nodeRoleName: '相关人员',
canChoose: true,
canChoose: false,
chooseType: 'checkbox',
disabled: true
fieldName: 'relatedUser'
},
{
id: 9,
nodeName: '抄送主起草人',
nodeRoleName: '主起草人',
canChoose: true,
canChoose: false,
chooseType: 'checkbox',
disabled: true
fieldName: 'copyUser'
}
]
@@ -417,6 +434,10 @@ export default {
}
},
mounted () {
if (this.$route.query.processId) {
// 有流程id说明是从流程中心来的,需要初始化数据
this.getProcessData(this.$route.query.processId)
}
if (this.currentNode === 1) {
this.personnelInfoData = approvalPersonalInfo
} else {
@@ -424,7 +445,7 @@ export default {
return { ...item, canChoose: false }
})
}
// 如果是查看进入的,不可编辑
// 如果是查看进入的,不可编辑,不可操作
if (this.$route.query.onlyLook) {
this.onlyLook = this.$route.query.onlyLook
this.disabled = this.$route.query.onlyLook
@@ -514,6 +535,16 @@ export default {
}
},
methods: {
// 根据流程id获取数据
getProcessData (processId) {
getProcessDataById({ processInstanceId: processId }).then(res => {
if (res.success) {
console.log(res.result)
} else {
this.$message.warning(res.message)
}
})
},
// 头部tab改变
switchChange (value) {
this.switchValue = value
@@ -550,22 +581,70 @@ export default {
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
this.$message.error(this.$t('pleaseFillInAtLeastOneItem'))
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
arr.push(param)
} else if (this.formInline.projectType === ProjectType.COMPLETE_TIME_CHANGE.value) {
// 业务基本信息-变更-完成时间变更
const param = { ...processInfoForm, ...ruleForm, ...approvalInfoForm }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag && this.$refs.changeBaseInfo.dataSource.length <= 0) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
arr = this.$refs.changeBaseInfo.dataSource.map(item => { return { ...item, ...param } })
} else if (this.formInline.projectType === ProjectType.WORK_TERMINATE.value) {
// 业务基本信息-变更-工作终止
const param = { ...processInfoForm, ...ruleForm, ...approvalInfoForm }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag && this.$refs.changeBaseInfo.dataSource.length <= 0) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
arr = this.$refs.changeBaseInfo.dataSource.map(item => { return { ...item, ...param } })
} else if (this.formInline.projectType === ProjectType.RESPONSIBLE_DEPT_CHANGE.value) {
// 业务基本信息-变更-责任部门变更
let dutyDepartChangeForm = {}
if (this.$refs.changeBaseInfo) {
dutyDepartChangeForm = this.$refs.changeBaseInfo.formInline
}
const param = { ...processInfoForm, ...ruleForm, ...dutyDepartChangeForm, ...approvalInfoForm }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
arr.push(param)
} else if (this.formInline.projectType === ProjectType.MERGE.value) {
// 业务基本信息-变更-合并
let mergeForm = {}
if (this.$refs.changeBaseInfo) {
mergeForm = this.$refs.changeBaseInfo.formInline
}
const param = { ...processInfoForm, ...ruleForm, ...mergeForm, ...approvalInfoForm }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
arr.push(param)
} else {
// 还没有选择申请类型和项目类别,需要外层信息至少填了一项
const param = { ...processInfoForm, ...ruleForm, ...approvalBaseInfo, ...approvalInfoForm }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
}
// 是节点一的保存,保存到草稿
if (this.currentNode === 1) {
console.log(arr)
enterprisePlanApprovalSave(arr).then(res => {
if (res.success) {
this.$message.success(res.message)
@@ -581,7 +660,8 @@ export default {
this.processInfoForm.validateFields((err, values) => {
this.$refs.ruleForm.validate(valid => {
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
let arr = []
let arr = [] // 需要传给后端的数据
let haveErr = false // 是否有错误,有错,则不能提交,false没有错
// 立项和变更的数据不一样,分开判断
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
// 是立项
@@ -600,28 +680,87 @@ export default {
// 企标体系处理成逗号分隔
param.enStandardSystem = param.enStandardSystem.map(item => item.value).join(',')
arr.push(param)
} else {
haveErr = true
}
})
} else if (this.formInline.projectType === ProjectType.COMPLETE_TIME_CHANGE.value ||
this.formInline.projectType === ProjectType.WORK_TERMINATE.value) {
// 是变更-完成时间 或者 变更-工作终止变更
if (valid && !err && !approvalErr && this.$refs.changeBaseInfo && this.$refs.changeBaseInfo.dataSource.length >= 0) {
if (valid && !err && !approvalErr && this.$refs.changeBaseInfo && this.$refs.changeBaseInfo.dataSource.length > 0) {
this.loading = true
const param = { ...values, ...this.formInline, ...approvalValues }
// 人员信息的数据, 处理成对象
const personnelInfo = this.$refs.personnelInfo.stepsData
const personnelObj = {}
for (const item of personnelInfo) {
if (item.fieldName) {
personnelObj[item.fieldName] = item.user
}
}
const param = { ...values, ...this.formInline, ...approvalValues, ...personnelObj }
arr = this.$refs.changeBaseInfo.dataSource.map(item => { return { ...item, ...param } })
} else {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
return
haveErr = true
if (this.$refs.changeBaseInfo.dataSource.length <= 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
}
}
} else {
// 校验特定节点需要填写人的必填
this.userForm.validateFields((userErr, userValues) => {
if (valid && !err && !approvalErr && !userErr) {
} else if (this.formInline.projectType === ProjectType.RESPONSIBLE_DEPT_CHANGE.value) {
// 是变更-责任部门变更
this.$refs.changeBaseInfo.$refs.ruleForm.validate(changeBaseValid => {
if (valid && changeBaseValid && !err && !approvalErr) {
this.loading = true
const param = this.$refs.changeBaseInfo.dataSource
console.log(param)
// 人员信息的数据, 处理成对象
const personnelInfo = this.$refs.personnelInfo.stepsData
const personnelObj = {}
for (const item of personnelInfo) {
if (item.fieldName) {
personnelObj[item.fieldName] = item.user
}
}
const param = Object.assign({}, values, this.formInline, approvalValues, this.$refs.changeBaseInfo.formInline, personnelObj)
arr.push(param)
} else {
haveErr = true
}
})
} else if (this.formInline.projectType === ProjectType.MERGE.value) {
// 是变更-合并
this.$refs.changeBaseInfo.$refs.ruleForm.validate(changeBaseValid => {
if (valid && changeBaseValid && !err && !approvalErr) {
const changeBaseInfo = this.$refs.changeBaseInfo.formInline
if (changeBaseInfo.projectTypeOne !== changeBaseInfo.projectTypeTwo) {
// 合并时候的两个计划需要限定修订+修订,或者制定+制定
this.$message.warning(this.$t('workCenter.enterpriseInitChangePlan.pleaseSelectTwoSameProjectTypePlan'))
return
}
this.loading = true
// 人员信息的数据, 处理成对象
const personnelInfo = this.$refs.personnelInfo.stepsData
const personnelObj = {}
for (const item of personnelInfo) {
if (item.fieldName) {
personnelObj[item.fieldName] = item.user
}
}
const param = Object.assign({}, values, this.formInline, approvalValues, this.$refs.changeBaseInfo.formInline, personnelObj)
arr.push(param)
} else {
haveErr = true
}
})
} else {
// 校验特定节点需要填写人的必填
// this.userForm.validateFields((userErr, userValues) => {
// if (valid && !err && !approvalErr && !userErr) {
// this.loading = true
// const param = this.$refs.changeBaseInfo.dataSource
// console.log(param)
// }
// })
}
if (haveErr) {
return
}
enterprisePlanApproval(arr).then(res => {
if (res.success) {