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

This commit is contained in:
lideqin
2023-10-16 20:34:08 +08:00
parent 2db880c6b7
commit 48ac6dd11e
18 changed files with 374 additions and 193 deletions
@@ -22,7 +22,7 @@
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('processName')">
<a-input :placeholder="$t('pleaseEnter') + $t('processName')"
@change="event => event.target.value = event.target.value.trim()"
:disabled="disabled"
:disabled="disabled || processNameDisabled"
:maxLength="50"
v-decorator="['processName', validatorRules.processName]" />
</a-form-item>
@@ -65,18 +65,18 @@
</span>
</div>
<a-form-model-item class="item-model" prop="applicationCategory">
<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>-->
<!--<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>
<!-- 项目类别 -->
@@ -91,12 +91,11 @@
<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>
</a-select>
<a-select v-else
<a-select v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value"
v-model="formInline.projectType"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.itemCategory')">
@@ -105,6 +104,11 @@
<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-select v-else
v-model="formInline.projectType"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.itemCategory')">
</a-select>
</a-form-model-item>
</div>
</div>
@@ -116,6 +120,7 @@
ref="approvalBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
@processNameChange="processNameChange"
:projectType="formInline.projectType">
</approval-base-info>
<!-- 申请类型为变更,项目类型为完成时间变更时的业务基本信息部分组件 -->
@@ -141,6 +146,7 @@
v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.RESPONSIBLE_DEPT_CHANGE.value"
ref="changeBaseInfo"
:disabled="disabled"
@processNameChange="processNameChange"
:projectType="formInline.projectType"
>
</duty-depart-change-base-info>
@@ -149,6 +155,7 @@
v-else-if="formInline.applicationCategory === ApplicationCategory.CHANGE.value && formInline.projectType === ProjectType.MERGE.value"
ref="changeBaseInfo"
:disabled="disabled"
@processNameChange="processNameChange"
:projectType="formInline.projectType"
>
</merge-base-info>
@@ -213,7 +220,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('save') }}</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" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('submit') }}</a-button>
</template>
@@ -225,7 +232,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('save') }}</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" :loading="loading" @click="handleAgree" icon="check-circle">{{ $t('agree') }}</a-button>
<!-- 驳回 -->
@@ -259,6 +266,9 @@ import JobEndBaseInfo from './modules/JobEndBaseInfo'
import DutyDepartChangeBaseInfo from './modules/DutyDepartChangeBaseInfo'
import MergeBaseInfo from './modules/MergeBaseInfo'
import { ProjectType, ApplicationCategory } from '@/enums/commonEnums'
import Vue from 'vue'
import { USER_INFO } from '@/store/mutation-types'
import pick from 'lodash.pick'
// 标准立项的人员信息
const approvalPersonalInfo = [ // 人员信息的数据
@@ -266,7 +276,8 @@ const approvalPersonalInfo = [ // 人员信息的数据
id: 1,
nodeName: '主起草人发起',
nodeRoleName: '发起人',
canChoose: false
canChoose: false,
userList: Vue.ls.get(USER_INFO).realname + '(' + Vue.ls.get(USER_INFO).username + ')'
},
{
id: 2,
@@ -359,32 +370,28 @@ const changePersonalInfo = [
nodeName: '新起草部门主管级上一级领导下发',
nodeRoleName: '新起草部门主管级上一级领导',
canChoose: false,
chooseType: 'radio',
fieldName: 'newMainDraftUserLeaderLeader'
chooseType: 'radio'
},
{
id: 7,
nodeName: '新起草部门主管级领导确认',
nodeRoleName: '新起草部门主管级领导',
canChoose: false,
chooseType: 'radio',
fieldName: 'newMainDraftUserLeader'
chooseType: 'radio'
},
{
id: 8,
nodeName: '相关人员会签',
nodeRoleName: '相关人员',
canChoose: false,
chooseType: 'checkbox',
fieldName: 'relatedUser'
chooseType: 'checkbox'
},
{
id: 9,
nodeName: '抄送主起草人',
nodeRoleName: '主起草人',
canChoose: false,
chooseType: 'checkbox',
fieldName: 'copyUser'
chooseType: 'checkbox'
}
]
@@ -405,7 +412,36 @@ export default {
computed: {
pageTitle () {
return this.$t('flowCenter') + this.$route.meta.title
},
// 流程名称是否不可填写
processNameDisabled () {
if (this.formInline.applicationCategory === ApplicationCategory.CHANGE.value &&
(this.formInline.projectType === ProjectType.COMPLETE_TIME_CHANGE.value ||
this.formInline.projectType === ProjectType.WORK_TERMINATE.value)) {
// 是完成时间变更或工作终止,流程名称无法自动生成,须填写
return false
} else {
return true
}
}
// 项目类别下拉框数据
// projectTypeOptions () {
// if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
// return [
// { value: ProjectType.ENACT.value, label: this.$t('workCenter.enterpriseInitChangePlan.formulate') },
// { value: ProjectType.MODIFY.value, label: this.$t('workCenter.enterpriseInitChangePlan.revise') }
// ]
// } else if (this.formInline.applicationCategory === ApplicationCategory.CHANGE.value) {
// return [
// { value: ProjectType.COMPLETE_TIME_CHANGE.value, label: this.$t('workCenter.enterpriseInitChangePlan.completionTimeChange') },
// { value: ProjectType.WORK_TERMINATE.value, label: this.$t('workCenter.enterpriseInitChangePlan.terminationOfWork') },
// { value: ProjectType.RESPONSIBLE_DEPT_CHANGE.value, label: this.$t('workCenter.enterpriseInitChangePlan.dutyDepartChange') },
// { value: ProjectType.MERGE.value, label: this.$t('workCenter.enterpriseInitChangePlan.merge') },
// ]
// } else {
// return []
// }
// }
},
watch: {
'formInline.applicationCategory' (value) {
@@ -414,7 +450,7 @@ export default {
if (this.currentNode === 1) {
this.personnelInfoData = approvalPersonalInfo
} else {
this.personnelInfoData = approvalPersonalInfo.map(item => {
this.personnelInfoData = this.personnelInfoData.map(item => {
return { ...item, canChoose: false }
})
}
@@ -422,7 +458,7 @@ export default {
if (this.currentNode === 1) {
this.personnelInfoData = changePersonalInfo
} else {
this.personnelInfoData = changePersonalInfo.map(item => {
this.personnelInfoData = this.personnelInfoData.map(item => {
return { ...item, canChoose: false }
})
}
@@ -434,16 +470,14 @@ export default {
}
},
mounted () {
console.log(this.$route.query.processId)
if (this.$route.query.processId) {
this.currentNode = 2 // todo: 先设置一个假数据,后端还不能返回当前节点
// 有流程id说明是从流程中心来的,需要初始化数据
this.getProcessData(this.$route.query.processId)
}
if (this.currentNode === 1) {
this.personnelInfoData = approvalPersonalInfo
} else {
this.personnelInfoData = approvalPersonalInfo.map(item => {
return { ...item, canChoose: false }
})
}
// 如果是查看进入的,不可编辑,不可操作
if (this.$route.query.onlyLook) {
@@ -460,7 +494,7 @@ export default {
disabled: false,
onlyLook: false, // 是否仅查看
currentNode: 1, // 当前节点
model: {},
model: [],
processInfoForm: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
@@ -539,6 +573,64 @@ export default {
getProcessData (processId) {
getProcessDataById({ processInstanceId: processId }).then(res => {
if (res.success) {
this.model = res.result
this.$nextTick(() => {
// 初始化流程信息
this.processInfoForm.setFieldsValue(pick(this.model[0], 'processName', 'deadlineDate', 'processDescription'))
// 初始化流程审批信息
this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'remarks', 'attachment'))
})
// 初始化业务基本信息的申请类型和项目类别
this.formInline.applicationCategory = this.model[0].applicationCategory
this.formInline.projectType = this.model[0].projectType
// 初始化人员信息 todo: 发起人还没处理
if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) {
this.personnelInfoData = approvalPersonalInfo.map(item => {
if (item.fieldName) {
return { ...item, userList: this.model[0][item.fieldName + '_dictText'], canChoose: false }
} else {
return item
}
})
} else {
this.personnelInfoData = changePersonalInfo.map(item => {
console.log(item)
if (item.fieldName) {
return { ...item, userList: this.model[0][item.fieldName + '_dictText'], canChoose: false }
} else {
return item
}
})
}
// 初始化业务基本信息中组件内容
if (this.model[0].applicationCategory === ApplicationCategory.INITIATION.value) {
// 是立项
this.$nextTick(() => {
this.$nextTick(() => {
const param = this.model[0]
param.enStandardSystem = param.enStandardSystem.split(',').map(item => { return { value: item } })
this.$refs.approvalBaseInfo.formInline = param
})
})
} else if (this.model[0].applicationCategory === ApplicationCategory.CHANGE.value &&
(this.model[0].projectType === ProjectType.COMPLETE_TIME_CHANGE.value ||
this.model[0].projectType === ProjectType.WORK_TERMINATE.value)) {
// 是完成时间变更或工作终止的变更
this.$nextTick(() => {
this.$refs.changeBaseInfo.dataSource = this.model
})
} else if (this.model[0].applicationCategory === ApplicationCategory.CHANGE.value &&
(this.model[0].projectType === ProjectType.RESPONSIBLE_DEPT_CHANGE.value ||
this.model[0].projectType === ProjectType.MERGE.value)) {
// 是责任部门变更或合并变更
this.$nextTick(() => {
this.$nextTick(() => {
const param = this.model[0]
param.enStandardSystem = param.enStandardSystem.split(',').map(item => { return { value: item } })
this.$refs.changeBaseInfo.formInline = param
})
})
}
console.log(res.result)
} else {
this.$message.warning(res.message)
@@ -549,6 +641,13 @@ export default {
switchChange (value) {
this.switchValue = value
},
// 流程名称修改
processNameChange (value) {
const param = { processName: value }
this.$nextTick(() => {
this.processInfoForm.setFieldsValue(pick(param, 'processName'))
})
},
// 保存(业务基本信息那里是表格的就穿给后端数组里多条数据,是表单的就在数组里放一条数据)
handleSave () {
// 有任意一项填了即可
@@ -577,7 +676,7 @@ export default {
if (approvalBaseInfo.enStandardSystem && approvalBaseInfo.enStandardSystem.length > 0) {
approvalBaseInfo.enStandardSystem = approvalBaseInfo.enStandardSystem.map(item => item.value).join(',')
}
const param = { ...processInfoForm, ...ruleForm, ...approvalBaseInfo, ...approvalInfoForm }
const param = { ...processInfoForm, ...ruleForm, ...approvalBaseInfo, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
@@ -587,7 +686,7 @@ export default {
arr.push(param)
} else if (this.formInline.projectType === ProjectType.COMPLETE_TIME_CHANGE.value) {
// 业务基本信息-变更-完成时间变更
const param = { ...processInfoForm, ...ruleForm, ...approvalInfoForm }
const param = { ...processInfoForm, ...ruleForm, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag && this.$refs.changeBaseInfo.dataSource.length <= 0) {
// 提示至少填写一项
@@ -597,7 +696,7 @@ export default {
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 param = { ...processInfoForm, ...ruleForm, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag && this.$refs.changeBaseInfo.dataSource.length <= 0) {
// 提示至少填写一项
@@ -611,7 +710,7 @@ export default {
if (this.$refs.changeBaseInfo) {
dutyDepartChangeForm = this.$refs.changeBaseInfo.formInline
}
const param = { ...processInfoForm, ...ruleForm, ...dutyDepartChangeForm, ...approvalInfoForm }
const param = { ...processInfoForm, ...ruleForm, ...dutyDepartChangeForm, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
@@ -625,7 +724,7 @@ export default {
if (this.$refs.changeBaseInfo) {
mergeForm = this.$refs.changeBaseInfo.formInline
}
const param = { ...processInfoForm, ...ruleForm, ...mergeForm, ...approvalInfoForm }
const param = { ...processInfoForm, ...ruleForm, ...mergeForm, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
@@ -635,7 +734,7 @@ export default {
arr.push(param)
} else {
// 还没有选择申请类型和项目类别,需要外层信息至少填了一项
const param = { ...processInfoForm, ...ruleForm, ...approvalBaseInfo, ...approvalInfoForm }
const param = { ...processInfoForm, ...ruleForm, ...approvalBaseInfo, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
@@ -657,29 +756,35 @@ 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'))
// return
// }
this.processInfoForm.validateFields((err, values) => {
this.$refs.ruleForm.validate(valid => {
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
let arr = [] // 需要传给后端的数据
let haveErr = false // 是否有错误,有错,则不能提交,false没有错
let haveErr = true // 是否有错误,有错,则不能提交,false没有错
// 立项和变更的数据不一样,分开判断
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)
haveErr = false
} else {
haveErr = true
}
@@ -689,16 +794,9 @@ export default {
// 是变更-完成时间 或者 变更-工作终止变更
if (valid && !err && !approvalErr && this.$refs.changeBaseInfo && this.$refs.changeBaseInfo.dataSource.length > 0) {
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 = { ...values, ...this.formInline, ...approvalValues, ...personnelObj }
arr = this.$refs.changeBaseInfo.dataSource.map(item => { return { ...item, ...param } })
haveErr = false
} else {
haveErr = true
if (this.$refs.changeBaseInfo.dataSource.length <= 0) {
@@ -710,16 +808,9 @@ export default {
this.$refs.changeBaseInfo.$refs.ruleForm.validate(changeBaseValid => {
if (valid && changeBaseValid && !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.changeBaseInfo.formInline, personnelObj)
arr.push(param)
haveErr = false
} else {
haveErr = true
}
@@ -735,16 +826,11 @@ export default {
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)
// 企标体系处理成逗号分隔
param.enStandardSystem = param.enStandardSystem.map(item => item.value).join(',')
arr.push(param)
haveErr = false
} else {
haveErr = true
}