[update] 修改新建流程页,企标计划立项/变更流程

This commit is contained in:
lideqin
2023-10-10 11:14:30 +08:00
parent f863ea3255
commit ea357bf590
11 changed files with 166 additions and 11 deletions
@@ -0,0 +1,690 @@
<template>
<internal-detail-page :title="pageTitle" :content-padding="0">
<!-- 标题右侧tab -->
<template v-slot:titleRightCustom>
<div class="table-operator-tab">
<a class="switch-item" :class="switchValue === 'base' ? 'table-operator-tab-active' : ''"
@click="switchChange('base')">{{ $t('basicInformation') }}
</a>
<a class="switch-item" :class="switchValue === 'user' ? 'table-operator-tab-active' : ''"
@click="switchChange('user')">{{ $t('personalInformation') }}
</a>
</div>
</template>
<!-- 基础信息 -->
<div v-if="switchValue === 'base'" class="scroll-content">
<!-- 流程信息 -->
<div class="process-part-title">{{ $t('processInformation') }}</div>
<a-form :form="processInfoForm">
<a-row>
<a-col :span="12">
<!-- 流程名称 -->
<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"
:maxLength="50"
v-decorator="['processName', validatorRules.processName]" />
</a-form-item>
</a-col>
<a-col :span="12">
<!-- 截止日期 -->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('expirationDate')">
<a-date-picker :placeholder="$t('pleaseSelect') + $t('expirationDate')"
style="width: 100%"
:disabled="disabled"
value-format="YYYY-MM-DD"
v-decorator="['expirationDate']" />
</a-form-item>
</a-col>
<a-col :span="24">
<!-- 流程说明 -->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('processExplain')">
<a-textarea :placeholder="$t('pleaseEnter') + $t('processExplain')"
:maxLength="500"
:rows="4"
:disabled="disabled"
v-decorator="['processExplain']" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 业务基本信息 -->
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<!-- 申请类型和项目类型 -->
<a-form-model :model="formInline" class="form-add" :rules="rules" ref="ruleForm">
<div class="collapsible-panel-form">
<div class="form-flex-box collapsible-panel-form-content collapsible-content-no-head">
<!-- 申请类型 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.applicationType')">
{{ $t('workCenter.enterpriseInitChangePlan.applicationType') }}
</span>
</div>
<a-form-model-item class="item-model" prop="applicationType">
<a-select v-model="formInline.applicationType"
: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>
</a-form-model-item>
</div>
<!-- 项目类别 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.itemCategory')">
{{ $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"
: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>
<a-select v-else
v-model="formInline.itemCategory"
: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.masterDraftingDepartmentChanges') }}</a-select-option>
<a-select-option :value="4">{{ $t('workCenter.enterpriseInitChangePlan.merge') }}</a-select-option>
</a-select>
</a-form-model-item>
</div>
</div>
</div>
</a-form-model>
<!-- 申请类型为立项时的业务基本信息部分组件 -->
<approval-base-info
v-if="formInline.applicationType === 1"
ref="approvalBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
:itemCategory="formInline.itemCategory">
</approval-base-info>
<!-- 申请类型为变更时的业务基本信息部分组件 -->
<change-base-info
v-else-if="formInline.applicationType === 2"
ref="changeBaseInfo"
:disabled="disabled"
:currentNode="currentNode"
>
</change-base-info>
<!-- 部分节点需要选人 -->
<a-form v-if="formInline.applicationType === 2 && [6, 7].includes(currentNode)" class="user-form" :form="userForm">
<a-row :gutter="24">
<a-col :span="12">
<!-- 所长,节点6需要选所长 -->
<a-form-item v-if="currentNode === 6" :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('workCenter.enterpriseInitChangePlan.superintendent')">
<user-selection :placeholder="$t('pleaseSelect') + $t('workCenter.enterpriseInitChangePlan.superintendent')"
type="radio"
v-decorator="['superintendent', validatorRules.superintendent]"
input-type="textarea" />
</a-form-item>
</a-col>
<a-col :span="12">
<!-- 相关人员,节点7需要选相关人员 -->
<a-form-item v-if="currentNode === 7" :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('workCenter.enterpriseInitChangePlan.relatedPersonnel')">
<user-selection :placeholder="$t('pleaseSelect') + $t('workCenter.enterpriseInitChangePlan.relatedPersonnel')"
type="checkbox"
v-decorator="['relatedPersonnel', validatorRules.relatedPersonnel]"
input-type="textarea" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 流程审批信息 -->
<div class="process-part-title">{{ $t('processApprovalInformation') }}</div>
<a-form :form="approvalInfoForm">
<!--备注-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('remarks')">
<a-textarea :placeholder="$t('pleaseEnter') + $t('remarks')"
:maxLength="500"
:rows="4"
v-decorator="['remarks', validatorRules.remarks]" />
</a-form-item>
<!--附件-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('businessSupport.questionAnswer.attach')">
<j-upload v-decorator="['file']" return-id />
</a-form-item>
</a-form>
</div>
<!-- 人员信息 -->
<div v-if="switchValue === 'user'" class="scroll-content personnel-info-wrapper">
<personnel-info :data="personnelInfoData" :currentNode="currentNode"></personnel-info>
</div>
<!-- 操作按钮 -->
<div class="bottom-operate-box">
<!-- 发起节点 -->
<template v-if="currentNode === 1">
<!-- 保存 -->
<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>
</template>
<!-- 变更的新起草部门主管级上一级领导下发节点 -->
<template v-else-if="formInline.applicationType === 2 && [6, 7].includes(currentNode)">
<!-- 转办 -->
<a-button type="primary" ghost :loading="loading" @click="handleTurnTo" icon="upload">{{ $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" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('agree') }}</a-button>
</template>
<template v-else-if="formInline.applicationType === 2 && currentNode === 9">
<!-- 确定, 谁发起的谁点确定抄送消息 -->
<a-button type="primary" :loading="loading" @click="handleDetermine" icon="upload">{{ $t('determine') }}</a-button>
</template>
<template v-else>
<!-- 转办 -->
<a-button type="primary" ghost :loading="loading" @click="handleTurnTo" icon="upload">{{ $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" :loading="loading" @click="handleAgree" icon="check-circle">{{ $t('agree') }}</a-button>
<!-- 驳回 -->
<a-button type="primary" :loading="loading" @click="handleReject" icon="check-circle">{{ $t('reject') }}</a-button>
</template>
</div>
<!-- 选人弹框 -->
<user-select-modal ref="userSelectModal" type="radio" @change="userSelectModalChange"></user-select-modal>
</internal-detail-page>
</template>
<script>
import InternalDetailPage from '@/components/InternalDetailPage'
import PersonnelInfo from '@/components/PersonnelInfo'
import UserSelectModal from '@/components/selection/UserSelectModal'
import UserSelection from '@/components/selection/UserSelection'
import {
enterprisePlanApprovalTurnTo,
enterprisePlanApprovalAgree,
enterprisePlanApprovalReject,
enterprisePlanApprovalDetermine
} from '@/api/workCenter'
import ApprovalBaseInfo from './modules/ApprovalBaseInfo'
import ChangeBaseInfo from './modules/ChangeBaseInfo'
// 标准立项的人员信息
const approvalPersonalInfo = [ // 人员信息的数据
{
id: 1,
nodeName: '主起草人发起',
nodeRoleName: '发起人',
canChoose: false
},
{
id: 2,
nodeName: '部所联络人校对',
nodeRoleName: '部所联络人',
canChoose: true,
chooseType: 'radio',
chooseSource: 'contactManage'
},
{
id: 3,
nodeName: '专家审批',
nodeRoleName: '专家',
canChoose: true,
chooseType: 'checkbox',
chooseSource: 'workGroup'
},
{
id: 4,
nodeName: '发起人主管级领导审批',
nodeRoleName: '发起人主管级领导',
canChoose: true,
chooseType: 'radio'
},
{
id: 5,
nodeName: '发起人主管级上级领导审批',
nodeRoleName: '发起人主管级上级领导',
canChoose: true,
chooseType: 'radio'
},
{
id: 6,
nodeName: '标准化审批',
nodeRoleName: '标准化',
canChoose: true,
chooseType: 'radio'
}
]
// 变更的人员信息
const changePersonalInfo = [
{
id: 1,
nodeName: '主起草人发起',
nodeRoleName: '发起人',
canChoose: false
},
{
id: 2,
nodeName: '部所联络人校对',
nodeRoleName: '部所联络人',
canChoose: true,
chooseType: 'radio',
chooseSource: 'contactManage'
},
{
id: 3,
nodeName: '主起草人主管级领导审批',
nodeRoleName: '主起草人主管级领导',
canChoose: true,
chooseType: 'radio'
},
{
id: 4,
nodeName: '主起草人主管级上一级领导审批',
nodeRoleName: '主起草人主管级上一级领导',
canChoose: true,
chooseType: 'radio'
},
{
id: 5,
nodeName: '标准化审批',
nodeRoleName: '标准化',
canChoose: true,
chooseType: 'radio'
},
{
id: 6,
nodeName: '新起草部门主管级上一级领导下发',
nodeRoleName: '新起草部门主管级上一级领导',
canChoose: true,
chooseType: 'radio',
disabled: true
},
{
id: 7,
nodeName: '新起草部门主管级领导确认',
nodeRoleName: '新起草部门主管级领导',
canChoose: true,
chooseType: 'radio',
disabled: true
},
{
id: 8,
nodeName: '相关人员会签',
nodeRoleName: '相关人员',
canChoose: true,
chooseType: 'checkbox',
disabled: true
},
{
id: 9,
nodeName: '抄送主起草人',
nodeRoleName: '主起草人',
canChoose: true,
chooseType: 'checkbox',
disabled: true
},
]
export default {
name: 'PlanApprovalFlow',
components: {
ChangeBaseInfo,
ApprovalBaseInfo,
UserSelectModal,
PersonnelInfo,
InternalDetailPage,
UserSelection
},
computed: {
pageTitle () {
return this.$t('flowCenter') + this.$route.meta.title
}
},
watch: {
'formInline.applicationType' (value) {
if (value) {
if (this.formInline.applicationType === 1) {
this.personnelInfoData = approvalPersonalInfo
} else {
this.personnelInfoData = changePersonalInfo
}
}
if (this.formInline.itemCategory) {
this.formInline.itemCategory = undefined
}
}
},
mounted () {
this.personnelInfoData = approvalPersonalInfo
},
data () {
return {
loading: false,
switchValue: 'base', // 头部tab选中值
disabled: false,
currentNode: 1, // 当前节点
model: {},
processInfoForm: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
sm: { span: 4 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 }
},
longLabelCol: {
xs: { span: 24 },
sm: { span: 2 }
},
longWrapperCol: {
xs: { span: 24 },
sm: { span: 22 }
},
validatorRules: {
// 流程名称
processName: {
rules: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('processName') }
],
validateTrigger: 'blur'
},
remarks: {
rules: [
{ required: false, message: this.$t('pleaseEnter') + this.$t('remarks') }
],
validateTrigger: 'blur'
},
// 所长
superintendent: {
rules: [
{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.enterpriseInitChangePlan.superintendent') }
],
validateTrigger: 'change'
},
// 相关人员
relatedPersonnel: {
rules: [
{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.enterpriseInitChangePlan.relatedPersonnel') }
],
validateTrigger: 'change'
}
},
formInline: {},
rules: {
// 申请类型
applicationType: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.applicationType') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 项目类别
itemCategory: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.itemCategory') + this.$t('cannotEmpty'),
trigger: 'change'
}
]
},
userForm: this.$form.createForm(this), // 部分节点需要选人的表单
approvalInfoForm: this.$form.createForm(this), // 审批信息表单
personnelInfoData: []
}
},
methods: {
// 头部tab改变
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 () {
},
// 提交
handleSubmit () {
if (this.loading) return
this.processInfoForm.validateFields((err, values) => {
this.$refs.ruleForm.validate(valid => {
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
// 立项和变更的数据不一样,分开判断
if (this.formInline.applicationType === 1) {
// 是立项
this.$refs.approvalBaseInfo.$refs.ruleForm.validate(approvalBaseValid => {
if (valid && approvalBaseValid && !err && !approvalErr) {
this.loading = true
const param = Object.assign({}, this.$refs.approvalBaseInfo.formInline)
console.log(param)
}
})
} else {
// 是变更
this.userForm.validateFields((userErr, userValues) => {
if (valid && !err && !approvalErr && !userErr) {
this.loading = true
const param = this.$refs.changeBaseInfo.dataSource
console.log(param)
}
})
}
})
})
})
},
// 转办
handleTurnTo () {
if (this.loading) return
// 点击显示选人组件
this.$refs.userSelectModal.open()
},
// 转办选完人的回调
userSelectModalChange (userIds) {
this.approvalInfoForm.validateFields((err, values) => {
if (!err) {
this.loading = true
let param = {}
param = Object.assign({}, values)
param.userIds = userIds
param.processId = this.model.id
enterprisePlanApprovalTurnTo(param).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
// 同意
handleAgree () {
if (this.loading) return
this.approvalInfoForm.validateFields((err, values) => {
if (!err) {
this.loading = true
let param = {}
param = Object.assign({}, values)
param.processId = this.model.id
enterprisePlanApprovalAgree(param).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
// 驳回
handleReject () {
if (this.loading) return
this.validatorRules.remarks.rules[0].required = true
this.approvalInfoForm.validateFields((err, values) => {
if (!err) {
this.loading = true
let param = {}
param = Object.assign({}, values)
param.processId = this.model.id
enterprisePlanApprovalReject(param).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
this.validatorRules.remarks.rules[0].required = false
})
}
})
},
// 确定
handleDetermine () {
if (this.loading) return
this.approvalInfoForm.validateFields((err, values) => {
if (!err) {
this.loading = true
let param = {}
param = Object.assign({}, values)
param.processId = this.model.id
enterprisePlanApprovalDetermine(param).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
this.validatorRules.remarks.rules[0].required = false
})
}
})
}
}
}
</script>
<style scoped lang="less">
/deep/ .ant-form-item-children {
width: 100%;
display: inline-block;
}
.form-flex-box {
display: flex;
flex-wrap: wrap;
}
.form-flex-item-line {
width: 100%;
}
.collapsible-panel-form {
margin-top: 20px;
&-header {
height: 56px;
line-height: 56px;
background: rgba(245, 245, 245, 0.6);
border-radius: 8px 8px 0 0;
border: 1px solid #E5E6EB;
padding: 0 20px;
font-size: 16px;
font-family: PingFang SC-Medium, PingFang SC, sans-serif;
font-weight: 600;
color: #1D2129;
display: flex;
justify-content: space-between;
.retractable-btn {
cursor: pointer;
font-size: 14px;
font-family: PingFang SC-Regular, PingFang SC, sans-serif;
color: @primary-color;
}
.anticon {
margin-right: 8px;
}
.pack-up-btn {
transform: rotate(-90deg);
}
.unfold-btn {
transform: rotate(90deg);
}
}
&-content {
border: 1px solid #E5E6EB;
border-top: none;
border-radius: 0 0 8px 8px;
padding: 20px;
}
}
.collapsible-content-no-head {
border-top: 1px solid #E5E6EB;
border-radius: 8px 8px 8px 8px;
}
.form-flex-item {
width: calc(100% / 3);
}
.bottom-operate-box {
height: 52px;
padding: 10px 32px;
text-align: right;
.ant-btn {
margin-left: 15px;
}
}
.scroll-content {
height: calc(100% - 52px);
box-sizing: border-box;
overflow: auto;
padding: 32px;
}
.user-form {
margin-top: 24px;
/deep/ .ant-form-item {
margin-bottom: 0;
}
}
// 人员信息
.personnel-info-wrapper {
/deep/ .ant-steps {
width: 400px;
}
}
</style>