[update] 联调企标计划立项/变更流程

This commit is contained in:
lideqin
2023-10-12 18:54:39 +08:00
parent 999ca5f719
commit 64bf3e05da
13 changed files with 483 additions and 512 deletions
@@ -12,7 +12,7 @@
</div>
</template>
<!-- 基础信息 -->
<div v-if="switchValue === 'base'" class="scroll-content">
<div v-show="switchValue === 'base'" class="scroll-content">
<!-- 流程信息 -->
<div class="process-part-title">{{ $t('processInformation') }}</div>
<a-form :form="processInfoForm">
@@ -34,7 +34,7 @@
style="width: 100%"
:disabled="disabled"
value-format="YYYY-MM-DD"
v-decorator="['expirationDate']" />
v-decorator="['deadlineDate']" />
</a-form-item>
</a-col>
<a-col :span="24">
@@ -44,7 +44,7 @@
:maxLength="500"
:rows="4"
:disabled="disabled"
v-decorator="['processExplain']" />
v-decorator="['processDescription']" />
</a-form-item>
</a-col>
</a-row>
@@ -64,12 +64,12 @@
{{ $t('workCenter.enterpriseInitChangePlan.applicationType') }}
</span>
</div>
<a-form-model-item class="item-model" prop="applicationType">
<a-select v-model="formInline.applicationType"
<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="1">{{ $t('workCenter.enterpriseInitChangePlan.standardProjectEstablishment') }}</a-select-option>
<a-select-option :value="2">{{ $t('workCenter.enterpriseInitChangePlan.change') }}</a-select-option>
<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>
@@ -81,23 +81,22 @@
{{ $t('workCenter.enterpriseInitChangePlan.itemCategory') }}
</span>
</div>
<a-form-model-item class="item-model" prop="itemCategory">
<a-select v-if="formInline.applicationType === 1"
v-model="formInline.itemCategory"
<a-form-model-item class="item-model" prop="projectType">
<a-select v-if="formInline.applicationCategory === ApplicationCategory.INITIATION.value"
v-model="formInline.projectType"
:disabled="disabled"
@change="itemCategoryChange"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.itemCategory')">
<a-select-option :value="1">{{ $t('workCenter.enterpriseInitChangePlan.formulate') }}</a-select-option>
<a-select-option :value="2">{{ $t('workCenter.enterpriseInitChangePlan.revise') }}</a-select-option>
<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>
</a-select>
<a-select v-else
v-model="formInline.itemCategory"
v-model="formInline.projectType"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.itemCategory')">
<a-select-option :value="1">{{ $t('workCenter.enterpriseInitChangePlan.completionTimeChange') }}</a-select-option>
<a-select-option :value="2">{{ $t('workCenter.enterpriseInitChangePlan.terminationOfWork') }}</a-select-option>
<a-select-option :value="3">{{ $t('workCenter.enterpriseInitChangePlan.dutyDepartChange') }}</a-select-option>
<a-select-option :value="4">{{ $t('workCenter.enterpriseInitChangePlan.merge') }}</a-select-option>
<a-select-option :value="ProjectType.COMPLETE_TIME_CHANGE.value">{{ $t('workCenter.enterpriseInitChangePlan.completionTimeChange') }}</a-select-option>
<a-select-option :value="ProjectType.WORK_TERMINATE.value">{{ $t('workCenter.enterpriseInitChangePlan.terminationOfWork') }}</a-select-option>
<a-select-option :value="ProjectType.RESPONSIBLE_DEPT_CHANGE.value">{{ $t('workCenter.enterpriseInitChangePlan.dutyDepartChange') }}</a-select-option>
<a-select-option :value="ProjectType.MERGE.value">{{ $t('workCenter.enterpriseInitChangePlan.merge') }}</a-select-option>
</a-select>
</a-form-model-item>
</div>
@@ -106,15 +105,15 @@
</a-form-model>
<!-- 申请类型为立项时的业务基本信息部分组件 -->
<approval-base-info
v-if="formInline.applicationType === 1"
v-show="formInline.applicationCategory === ApplicationCategory.INITIATION.value"
ref="approvalBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
:itemCategory="formInline.itemCategory">
:projectType="formInline.projectType">
</approval-base-info>
<!-- 申请类型为变更,项目类型为完成时间变更时的业务基本信息部分组件 -->
<finish-time-change-base-info
v-else-if="formInline.applicationType === 2 && formInline.itemCategory === 1"
v-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.COMPLETE_TIME_CHANGE.value"
ref="changeBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
@@ -122,7 +121,7 @@
</finish-time-change-base-info>
<!-- 申请类型为变更,项目类型为工作终止时的业务基本信息部分组件 -->
<job-end-base-info
v-else-if="formInline.applicationType === 2 && formInline.itemCategory === 2"
v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.WORK_TERMINATE.value"
ref="changeBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
@@ -130,21 +129,21 @@
</job-end-base-info>
<!-- 申请类型为变更,项目类型为责任部门变更的业务基本信息部分组件 -->
<duty-depart-change-base-info
v-else-if="formInline.applicationType === 2 && formInline.itemCategory === 3"
v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.RESPONSIBLE_DEPT_CHANGE.value"
ref="changeBaseInfo"
:disabled="disabled"
>
</duty-depart-change-base-info>
<!-- 申请类型为变更,项目类型为合并的业务基本信息部分组件 -->
<merge-base-info
v-else-if="formInline.applicationType === 2 && formInline.itemCategory === 4"
v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.MERGE.value"
ref="changeBaseInfo"
:disabled="disabled"
>
</merge-base-info>
<!-- 部分节点需要选人 -->
<a-form v-if="formInline.applicationType === 2 && [6, 7].includes(currentNode)" class="user-form" :form="userForm">
<a-form v-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && [6, 7].includes(currentNode)" class="user-form" :form="userForm">
<a-row :gutter="24">
<a-col :span="12">
<!-- 所长,节点6需要选所长 -->
@@ -179,14 +178,14 @@
</a-form-item>
<!--附件-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('businessSupport.questionAnswer.attach')">
<j-upload v-decorator="['file']" return-id />
<j-upload v-decorator="['attachment']" return-id />
</a-form-item>
</a-form>
</div>
<!-- 人员信息 -->
<div v-if="switchValue === 'user'" class="scroll-content">
<div v-show="switchValue === 'user'" class="scroll-content">
<process-detail-list :url="url">
<personnel-info slot="personnelInfo" :data="personnelInfoData" :currentNode="currentNode"></personnel-info>
<personnel-info slot="personnelInfo" ref="personnelInfo" :data="personnelInfoData" :currentNode="currentNode + ''"></personnel-info>
</process-detail-list>
</div>
<!-- 操作按钮 -->
@@ -196,18 +195,18 @@
<!-- 保存 -->
<a-button type="primary" ghost :loading="loading" @click="handleSave"><i class="iconfont icon-save"></i> {{ $t('preservation') }}</a-button>
<!-- 提交 -->
<a-button type="primary" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('agree') }}</a-button>
<a-button type="primary" :loading="loading" @click="handleStart" icon="upload">{{ $t('submit') }}</a-button>
</template>
<!-- 变更的新起草部门主管级上一级领导下发节点 -->
<template v-else-if="formInline.applicationType === 2 && [6, 7].includes(currentNode)">
<template v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && [6, 7].includes(currentNode)">
<!-- 转办 -->
<a-button type="primary" ghost :loading="loading" @click="handleTurnTo" icon="arrow-up">{{ $t('turnTo') }}</a-button>
<!-- 保存 -->
<a-button type="primary" ghost :loading="loading" @click="handleSave"><i class="iconfont icon-save"></i> {{ $t('preservation') }}</a-button>
<a-button type="primary" ghost :loading="loading" @click="handleSave"><i class="iconfont icon-save"></i> {{ $t('save') }}</a-button>
<!-- 提交 -->
<a-button type="primary" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('agree') }}</a-button>
<a-button type="primary" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('submit') }}</a-button>
</template>
<template v-else-if="formInline.applicationType === 2 && currentNode === 9">
<template v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && currentNode === 9">
<!-- 确定, 谁发起的谁点确定抄送消息 -->
<a-button type="primary" :loading="loading" @click="handleDetermine" icon="upload">{{ $t('determine') }}</a-button>
</template>
@@ -215,7 +214,7 @@
<!-- 转办 -->
<a-button type="primary" ghost :loading="loading" @click="handleTurnTo" icon="arrow-up">{{ $t('turnTo') }}</a-button>
<!-- 保存 -->
<a-button type="primary" ghost :loading="loading" @click="handleSave"><i class="iconfont icon-save"></i> {{ $t('preservation') }}</a-button>
<a-button type="primary" ghost :loading="loading" @click="handleSave"><i class="iconfont icon-save"></i> {{ $t('save') }}</a-button>
<!-- 同意 -->
<a-button type="primary" :loading="loading" @click="handleAgree" icon="check-circle">{{ $t('agree') }}</a-button>
<!-- 驳回 -->
@@ -237,14 +236,17 @@ import {
enterprisePlanApprovalTurnTo,
enterprisePlanApprovalAgree,
enterprisePlanApprovalReject,
enterprisePlanApprovalDetermine
enterprisePlanApprovalDetermine,
enterprisePlanApprovalSave,
enterprisePlanApproval
} from '@/api/workCenter'
import ApprovalBaseInfo from './modules/ApprovalBaseInfo'
import FinishTimeChangeBaseInfo from './modules/FinishTimeChangeBaseInfo'
import ProcessDetailList from '../../../components/ProcessDetailList'
import ProcessDetailList from '@/components/ProcessDetailList'
import JobEndBaseInfo from './modules/JobEndBaseInfo'
import DutyDepartChangeBaseInfo from './modules/DutyDepartChangeBaseInfo'
import MergeBaseInfo from './modules/MergeBaseInfo'
import { ProjectType, ApplicationCategory } from '@/enums/commonEnums'
// 标准立项的人员信息
const approvalPersonalInfo = [ // 人员信息的数据
@@ -260,7 +262,9 @@ const approvalPersonalInfo = [ // 人员信息的数据
nodeRoleName: '部所联络人',
canChoose: true,
chooseType: 'radio',
chooseSource: 'contactManage'
// todo: 还没有联络人管理模块,暂时用选用户
// chooseSource: 'contactManage',
fieldName: 'contactUser'
},
{
id: 3,
@@ -268,28 +272,32 @@ const approvalPersonalInfo = [ // 人员信息的数据
nodeRoleName: '专家',
canChoose: true,
chooseType: 'checkbox',
chooseSource: 'workGroup'
chooseSource: 'workGroup',
fieldName: 'standardExpert'
},
{
id: 4,
nodeName: '发起人主管级领导审批',
nodeRoleName: '发起人主管级领导',
canChoose: true,
chooseType: 'radio'
chooseType: 'radio',
fieldName: 'mainDraftUserLeader'
},
{
id: 5,
nodeName: '发起人主管级上级领导审批',
nodeRoleName: '发起人主管级上级领导',
canChoose: true,
chooseType: 'radio'
chooseType: 'radio',
fieldName: 'mainDraftUserLeaderLeader'
},
{
id: 6,
nodeName: '标准化审批',
nodeRoleName: '标准化',
canChoose: true,
chooseType: 'radio'
chooseType: 'radio',
fieldName: 'standardizationApprovalUser'
}
]
// 变更的人员信息
@@ -383,9 +391,9 @@ export default {
}
},
watch: {
'formInline.applicationType' (value) {
'formInline.applicationCategory' (value) {
if (value) {
if (this.formInline.applicationType === 1) {
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
if (this.currentNode === 1) {
this.personnelInfoData = approvalPersonalInfo
} else {
@@ -403,8 +411,8 @@ export default {
}
}
}
if (this.formInline.itemCategory) {
this.formInline.itemCategory = undefined
if (this.formInline.projectType) {
this.formInline.projectType = undefined
}
}
},
@@ -424,11 +432,13 @@ export default {
},
data () {
return {
ProjectType,
ApplicationCategory,
loading: false,
switchValue: 'base', // 头部tab选中值
disabled: false,
onlyLook: false, // 是否仅查看
currentNode: 2, // 当前节点
currentNode: 1, // 当前节点
model: {},
processInfoForm: this.$form.createForm(this),
labelCol: {
@@ -479,7 +489,7 @@ export default {
formInline: {},
rules: {
// 申请类型
applicationType: [
applicationCategory: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.applicationType') + this.$t('cannotEmpty'),
@@ -487,7 +497,7 @@ export default {
}
],
// 项目类别
itemCategory: [
projectType: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.itemCategory') + this.$t('cannotEmpty'),
@@ -508,18 +518,123 @@ export default {
switchChange (value) {
this.switchValue = value
},
// 项目类别改变
itemCategoryChange (value) {
console.log(value)
if (value === 1) {
this.$refs.approvalBaseInfo.rules.enterpriseStandardName[0].required = true
} else {
this.$refs.approvalBaseInfo.rules.enterpriseStandardName[0].required = false
// 保存(业务基本信息那里是表格的就穿给后端数组里多条数据,是表单的就在数组里放一条数据)
handleSave () {
// 有任意一项填了即可
// 流程信息表单
const processInfoForm = this.processInfoForm.getFieldsValue()
// 业务基本信息-申请类型和项目类别
const ruleForm = this.formInline
// 流程审批信息
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
}
}
// 需要传给后端的数组
let arr = []
// 业务基本信息-立项表单
let approvalBaseInfo = {}
if (this.$refs.approvalBaseInfo) {
approvalBaseInfo = this.$refs.approvalBaseInfo.formInline
console.log(approvalBaseInfo.enStandardSystem)
// 企标体系处理成逗号分隔
if (approvalBaseInfo.enStandardSystem && approvalBaseInfo.enStandardSystem.length > 0) {
approvalBaseInfo.enStandardSystem = approvalBaseInfo.enStandardSystem.map(item => item.value).join(',')
}
const param = { ...processInfoForm, ...ruleForm, ...approvalBaseInfo, ...approvalInfoForm }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
this.$message.error(this.$t('pleaseFillInAtLeastOneItem'))
return
}
arr.push(param)
} else if (this.formInline.projectType === ProjectType.COMPLETE_TIME_CHANGE.value) {
// 业务基本信息-变更-完成时间变更
const param = { ...processInfoForm, ...ruleForm, ...approvalInfoForm }
arr = this.$refs.changeBaseInfo.dataSource.map(item => { return { ...item, ...param } })
} else if (this.formInline.projectType === ProjectType.WORK_TERMINATE.value) {
// 业务基本信息-变更-工作终止
const param = { ...processInfoForm, ...ruleForm, ...approvalInfoForm }
arr = this.$refs.changeBaseInfo.dataSource.map(item => { return { ...item, ...param } })
}
// 是节点一的保存,保存到草稿
if (this.currentNode === 1) {
console.log(arr)
enterprisePlanApprovalSave(arr).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
})
}
},
// 保存
handleSave () {
// 节点一时候的提交,发起立项变更申请(业务基本信息那里是表格的就穿给后端数组里多条数据,是表单的就在数组里放一条数据)
handleStart () {
if (this.loading) return
this.processInfoForm.validateFields((err, values) => {
this.$refs.ruleForm.validate(valid => {
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
let arr = []
// 立项和变更的数据不一样,分开判断
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
// 是立项
this.$refs.approvalBaseInfo.$refs.ruleForm.validate(approvalBaseValid => {
if (valid && approvalBaseValid && !err && !approvalErr) {
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.approvalBaseInfo.formInline, personnelObj)
// 企标体系处理成逗号分隔
param.enStandardSystem = param.enStandardSystem.map(item => item.value).join(',')
arr.push(param)
}
})
} 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) {
this.loading = true
const param = { ...values, ...this.formInline, ...approvalValues }
arr = this.$refs.changeBaseInfo.dataSource.map(item => { return { ...item, ...param } })
} else {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
return
}
} else {
// 校验特定节点需要填写人的必填
this.userForm.validateFields((userErr, userValues) => {
if (valid && !err && !approvalErr && !userErr) {
this.loading = true
const param = this.$refs.changeBaseInfo.dataSource
console.log(param)
}
})
}
enterprisePlanApproval(arr).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
})
})
})
},
// 提交
handleSubmit () {
@@ -528,7 +643,7 @@ export default {
this.$refs.ruleForm.validate(valid => {
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
// 立项和变更的数据不一样,分开判断
if (this.formInline.applicationType === 1) {
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
// 是立项
this.$refs.approvalBaseInfo.$refs.ruleForm.validate(approvalBaseValid => {
if (valid && approvalBaseValid && !err && !approvalErr) {