Files
laws-sinotruk-client/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue
T

690 lines
27 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<internal-detail-page :title="pageTitle" :content-padding="0" :loading="loading">
<!-- 标题右侧tab -->
<template v-slot:titleRightCustom v-if="!isLook">
<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-show="switchValue === 'base'" class="detail-page-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')" :colon="formItemColon">
<a-input :placeholder="$t('pleaseEnter') + $t('processName')"
:disabled="disabled || processInfoDisabled || isLook"
:maxLength="50"
v-decorator="['prcName', validatorRules.prcName]" />
</a-form-item>
</a-col>
<a-col :span="12">
<!-- 截止日期 -->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('expirationDate')" :colon="formItemColon">
<a-date-picker :placeholder="$t('pleaseSelect') + $t('expirationDate')"
style="width: 100%"
:disabled="disabled || processInfoDisabled || isLook"
value-format="YYYY-MM-DD"
v-decorator="['dueTime']" />
</a-form-item>
</a-col>
<a-col :span="24">
<!-- 流程说明 -->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('processExplain')" :colon="formItemColon">
<a-textarea :placeholder="$t('pleaseEnter') + $t('processExplain')"
:maxLength="500"
:rows="4"
:disabled="disabled || processInfoDisabled || isLook"
v-decorator="['prcMes']" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 业务基本信息 -->
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<!-- 节点1标准工程师发起的基本信息表单 -->
<engineer-init-base-info v-if="[1, 3, 10].includes(currentNode)" ref="baseInfoRef" :disabled="isLook" :currentNode="currentNode"></engineer-init-base-info>
<!-- 节点2部所联络人选取审批人 -->
<contact-select-approver-base-info v-else-if="[2, 5].includes(currentNode)" ref="baseInfoRef" :disabled="isLook" :currentNode="currentNode" @batchReject="handleBatchReject"></contact-select-approver-base-info>
<!-- 节点3主起草单位主管级领导审批下发 -->
<leader-approve-sent-base-info v-else-if="currentNode === 4" ref="baseInfoRef" :disabled="isLook"></leader-approve-sent-base-info>
<!-- 节点4主起草人填写信息 -->
<!-- 节点5部所联络人汇总 -->
<!-- 节点6主起草单位主管级领导批准 -->
<!-- 节点7标准化归档 -->
<table-base-info v-else ref="baseInfoRef" :disabled="isLook" :current-node="currentNode"></table-base-info>
<!-- 流程审批信息 -->
<div class="process-part-title">{{ $t('processApprovalInformation') }}</div>
<a-form :form="approvalInfoForm">
<!--备注-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('remarks')" :colon="formItemColon">
<a-textarea :placeholder="$t('pleaseEnter') + $t('remarks')"
:maxLength="500"
:rows="4"
:disabled="isLook"
v-decorator="['commitText', validatorRules.commitText]" />
</a-form-item>
<!--附件-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('attach')" :colon="formItemColon">
<j-upload v-decorator="['commitFile']" return-id multiple :disabled="isLook" />
</a-form-item>
</a-form>
</div>
<!-- 人员信息 -->
<div v-show="switchValue === 'user'" class="detail-page-scroll-content p-0">
<process-detail-list :processKey="ProcessKey.ES_ANNUAL_INIT.value">
<personnel-info slot="personnelInfo" ref="personnelInfo" :data="personnelInfoData" :currentNode="currentNodeId"></personnel-info>
</process-detail-list>
</div>
<!-- 操作按钮 -->
<div v-if="!isLook" class="detail-page-bottom-operate-box">
<!-- 发起节点 -->
<template v-if="[1, 3, 10].includes(currentNode)">
<!-- 保存 -->
<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="handleStart" icon="upload">{{ $t('submit') }}</a-button>
</template>
<!-- 部所联络人汇总 -->
<template v-else-if="currentNode === 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" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('submit') }}</a-button>
</template>
<template v-else-if="currentNode === 6 || currentNode === 9">
<!-- 提交 -->
<a-button type="primary" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('submit') }}</a-button>
</template>
<template v-else>
<!-- 转办 -->
<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" :loading="loading" @click="handleAgree" icon="check-circle">{{ $t('agree') }}</a-button>
<!-- 驳回 -->
<a-button type="primary" :loading="loading" @click="handleReject" icon="close-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 UserSelectModal from '@/components/selection/UserSelectModal'
import ProcessDetailList from '@/components/ProcessDetailList'
import PersonnelInfo from '@/components/PersonnelInfo'
import EngineerInitBaseInfo from './modules/EngineerInitBaseInfo'
import ContactSelectApproverBaseInfo from './modules/ContactSelectApproverBaseInfo'
import LeaderApproveSentBaseInfo from './modules/LeaderApproveSentBaseInfo'
import TableBaseInfo from './modules/TableBaseInfo'
import {
standardizationInitApproval,
standardizationInitSave,
standardizationInitTurnTo,
standardizationInitAgree,
standardizationInitReject,
standardizationInitGetDataById,
standardizationInitGetDataDraft,
standardizationInitBatchReject,
saveSnapShot,
getLookData
} from '@/api/workCenter'
import pick from 'lodash.pick'
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
import { ProcessKey, EsRevisionPlanStandardizationInitNodes, ProcessType } from '@/enums/commonEnums'
export default {
name: 'RevisionPlanStandardizationInitFlow',
components: {
TableBaseInfo,
LeaderApproveSentBaseInfo,
ContactSelectApproverBaseInfo,
EngineerInitBaseInfo,
InternalDetailPage,
UserSelectModal,
ProcessDetailList,
PersonnelInfo
},
mixins: [WorkCenterMixin],
computed: {
pageTitle () {
return this.$t('flowCenter') + this.$route.meta.title + '' + this.currentNodeName + ''
},
// 流程信息不能编辑
processInfoDisabled () {
return this.currentNode !== 1
}
},
mounted () {
// 初始化节点
const nodeId = this.$route.query.nodeId
if (nodeId) {
this.currentNodeId = nodeId
if (nodeId === EsRevisionPlanStandardizationInitNodes.standardizationStart.value) {
// 标准化工程师发起
this.currentNode = 1
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.contactSelectApprover.value) {
// 部所联络人选取审批人
this.currentNode = 2
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.standardizationUpdate.value) {
// 标准化工程师修改调整(隐藏节点)
this.currentNode = 3
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.mainDrafterLeaderSend.value) {
// 主起草单位主管级领导审批下发
this.currentNode = 4
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.contactUpdate.value) {
// 部所联络人修改调整(隐藏节点)
this.currentNode = 5
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.mainDrafterEnterInfo.value) {
// 主起草人填写信息
this.currentNode = 6
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.contactsApproval.value) {
// 部所联络人汇总
this.currentNode = 7
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.mainDrafterLeaderApproval.value) {
// 主起草单位主管级领导批准
this.currentNode = 8
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.standardizationSumUp.value) {
// 标准化归档
this.currentNode = 9
} else if (nodeId === EsRevisionPlanStandardizationInitNodes.standardizationTwoUpdate.value) {
// 标准化归档
this.currentNode = 10
} else {
// 预留加签节点
this.currentNode = 999
}
}
console.log(this.currentNode)
// 获取人员信息结构
this.getPersonInfoStructure(ProcessKey.ES_ANNUAL_INIT.value, () => {
if (this.$route.query.processInstanceId) {
if (this.currentNode === 1) {
this.disabled = false
this.initPersonInfoData(true)
} else {
this.disabled = true
// 如果不是第一个节点,人员信息全部不可选
this.initPersonInfoData(false)
}
}
})
if (this.$route.query.isLook + '' === '1') {
// 是查看
this.isLook = true
// 人员信息全部不可选
this.initPersonInfoData(false)
// 查询数据
this.getProcessData('look', { snapshotId: this.$route.query.snapshotId })
} else {
if (this.$route.query.taskId && !this.$route.query.draftId) {
// 有流程id说明是从流程中心来的,需要初始化数据
this.getProcessData('todo', { taskId: this.$route.query.taskId })
}
if (this.$route.query.draftId) {
// 有草稿id,说明是从流程中心-草稿来的,需要初始化数据
this.getProcessData('draft', { draftId: this.$route.query.draftId, projectId: this.$route.query.projectId })
}
}
if (this.$route.query.taskName) {
// 说明是已发起流程
this.currentNodeName = this.$route.query.taskName
} else {
this.currentNodeName = '标准化工程师发起'
}
},
data () {
return {
ProcessKey,
loading: false,
switchValue: 'base',
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 }
},
disabled: false,
validatorRules: {
// 流程名称
prcName: {
rules: [
{
required: true,
message: this.$t('pleaseEnter') + this.$t('processName')
}
],
validateTrigger: 'blur'
},
// 备注
commitText: {
rules: [
{
required: false,
message: this.$t('pleaseEnter') + this.$t('remarks')
}
],
validateTrigger: 'blur'
}
},
currentNode: 1,
currentNodeName: '',
currentNodeId: EsRevisionPlanStandardizationInitNodes.standardizationStart.value, // 当前节点id
approvalInfoForm: this.$form.createForm(this), // 审批信息表单
personnelInfoData: [], // 人员信息数据
url: {
list: '' // 人员信息右侧表的分页查询接口
},
model: {},
isLook: false
}
},
methods: {
getProcessData (type, param) {
let func
let params = {}
if (type === 'todo') {
func = standardizationInitGetDataById
params = param.taskId
} else if (type === 'look') {
func = getLookData
params = param
} else {
func = standardizationInitGetDataDraft
params = param
}
this.loading = true
func(params).then(res => {
if (res.success) {
this.model = res.result
this.$nextTick(() => {
// 初始化流程信息
this.processInfoForm.setFieldsValue(pick(this.model.common, 'prcName', 'dueTime', 'prcMes'))
// 有草稿json按草稿进来的回显
if (this.model.infoJsonStr) {
// 初始化流程信息
const prcObj = Object.assign({}, this.model)
prcObj.dueTime = this.model.processDueDate
prcObj.prcMes = this.model.processDescription
this.processInfoForm.setFieldsValue(pick(prcObj, 'prcName', 'dueTime', 'prcMes'))
// 初始化流程审批信息
prcObj.commitText = this.model.handleText
prcObj.commitFile = this.model.handleFile
this.approvalInfoForm.setFieldsValue(pick(prcObj, 'commitText', 'commitFile'))
this.model.dataList = JSON.parse(this.model.infoJsonStr).dataList
}
// 初始化业务基本信息
this.$refs.baseInfoRef.initData(this.model.dataList)
})
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
switchChange (value) {
this.switchValue = value
},
// 保存
handleSave () {
if (this.loading) {
return
}
// 有任意一项填了即可
// 流程信息表单
const processInfoForm = this.processInfoForm.getFieldsValue()
// 流程审批信息
const approvalInfoForm = this.approvalInfoForm.getFieldsValue()
// 人员信息的数据, 处理成对象
const personnelObj = this.$refs.personnelInfo.getDataObj()
// 需要传给后端的
const paramObj = {}
// 流程信息
paramObj.basicProcessInfoDTO = Object.assign({}, processInfoForm)
paramObj.basicProcessInfoDTO.processName = paramObj.basicProcessInfoDTO.prcName
paramObj.basicProcessInfoDTO.processDueDate = paramObj.basicProcessInfoDTO.dueTime
paramObj.basicProcessInfoDTO.processDescription = paramObj.basicProcessInfoDTO.prcMes
paramObj.basicProcessInfoDTO.processInstanceId = this.$route.query.processInstanceId
// 流程审批信息
paramObj.basicTaskInfoDTO = Object.assign({}, approvalInfoForm)
paramObj.basicTaskInfoDTO.handleText = paramObj.basicTaskInfoDTO.commitText
paramObj.basicTaskInfoDTO.handleFile = paramObj.basicTaskInfoDTO.commitFile
paramObj.basicTaskInfoDTO.taskId = this.$route.query.taskId
// 草稿id
if (this.model.infoJsonStr) {
paramObj.draftId = this.model.id
}
// param.common = { ...processInfoForm, ...approvalInfoForm }
// param.flowUser = personnelObj
// 业务基本信息
if (this.$refs.baseInfoRef) {
const ruleForm = this.$refs.baseInfoRef.getData()
const form = { ...processInfoForm, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(form).some(v => !!v || v === 0)
if (!flag && ruleForm.dataSource.length <= 0) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
// 该流程中业务基本信息只有表格
paramObj.infoJsonStr = JSON.stringify({ dataList: ruleForm.dataSource })
} else {
// 需要外层信息至少填了一项
const form = { ...processInfoForm, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(form).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
}
this.loading = true
// 保存到草稿
standardizationInitSave(paramObj).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
},
// 获取快照json
getParamJsonStr () {
// 流程信息表单
const processInfoForm = this.processInfoForm.getFieldsValue()
// 流程审批信息
const approvalInfoForm = this.approvalInfoForm.getFieldsValue()
// 人员信息的数据, 处理成对象
const personnelObj = this.$refs.personnelInfo.getDataObj()
// 业务基本信息
const ruleForm = this.$refs.baseInfoRef.getData()
const infoJsonStr = JSON.stringify({
basicProcessInfoDTO: processInfoForm,
basicTaskInfoDTO: approvalInfoForm,
dataList: ruleForm.dataSource,
personnelObj: personnelObj
})
return infoJsonStr
},
// 保存快照
saveParamJsonStr (callback) {
// 流程信息表单
const processInfoForm = this.processInfoForm.getFieldsValue()
// 流程审批信息
const approvalInfoForm = this.approvalInfoForm.getFieldsValue()
// 人员信息的数据, 处理成对象
const personnelObj = this.$refs.personnelInfo.getDataObj()
// 业务基本信息
const ruleForm = this.$refs.baseInfoRef.getData()
const params = { ...processInfoForm, ...approvalInfoForm }
params.infoJsonStr = JSON.stringify({
basicProcessInfoDTO: processInfoForm,
basicTaskInfoDTO: approvalInfoForm,
dataList: ruleForm.dataSource,
personnelObj: personnelObj
})
params.taskId = this.$route.query.taskId
params.prcType = ProcessType.ES_ANNUAL_INIT.value
saveSnapShot(params).then(async res => {
if (res.success) {
callback && await callback()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
},
// 节点一时候的提交,发起变更
handleStart () {
if (this.loading) return
this.processInfoForm.validateFields((err, values) => {
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
const data = this.$refs.baseInfoRef.getDataValidate()
if (!err && !approvalErr && data) {
// 人员信息的数据, 处理成对象
const personnelObj = this.$refs.personnelInfo.getDataObjVerify()
if (!personnelObj) {
this.switchValue = 'user'
return
}
const param = {} // 传给后端的数据
param.common = { ...values, ...approvalValues }
// 草稿id
if (this.model.infoJsonStr) {
param.common.draftId = this.model.id
}
param.dataList = data.dataSource
param.flowUser = personnelObj
this.loading = true
let func
if (this.$route.query.processInstanceId) {
func = standardizationInitAgree
param.common.taskId = this.$route.query.taskId || ''
} else {
func = standardizationInitApproval
// 快照JSON
param.common.infoJsonStr = this.getParamJsonStr()
}
if (this.$route.query.taskId) {
// 先保存快照再提交
this.saveParamJsonStr(() => {
func(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
})
} else {
func(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
}
} else {
this.switchValue = 'base'
}
})
})
},
// 转办
handleTurnTo () {
if (this.loading) return
// 点击显示选人组件
this.$refs.userSelectModal.open()
},
// 转办选完人的回调
userSelectModalChange (userIds) {
this.approvalInfoForm.validateFields((err, values) => {
if (!err) {
this.loading = true
const param = Object.assign({}, values)
param.userId = userIds
param.taskId = this.$route.query.taskId
standardizationInitTurnTo(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
}
})
},
// 提交(节点457有提交)
handleSubmit () {
if (this.loading) return
// 流程审批信息校验
this.approvalInfoForm.validateFields((approvalErr, approvalValues) => {
const data = this.$refs.baseInfoRef.getDataValidate()
console.log(data)
if (!approvalErr && data) {
// 只有表格
const param = {}
param.common = approvalValues
param.common.taskId = this.$route.query.taskId
param.dataList = data.dataSource
this.loading = true
// 保存快照
this.saveParamJsonStr(() => {
standardizationInitAgree(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
})
} else {
this.switchValue = 'base'
}
})
},
// 同意(节点236有同意)
handleAgree () {
if (this.loading) return
this.validatorRules.commitText.rules[0].required = false
if (!this.approvalInfoForm.getFieldValue('commitText')) {
this.approvalInfoForm.setFieldsValue({ commitText: '同意' })
}
this.approvalInfoForm.validateFields((err, values) => {
const data = this.$refs.baseInfoRef.getDataValidate()
if (!err && data) {
// 只有表格
const param = {}
param.common = values
param.common.taskId = this.$route.query.taskId
param.dataList = data.dataSource
this.loading = true
// 保存快照
this.saveParamJsonStr(() => {
standardizationInitAgree(param).then(async res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
})
}
})
},
// 驳回(节点236有驳回)
handleReject () {
if (this.loading) return
this.validatorRules.commitText.rules[0].required = true
if (!this.approvalInfoForm.getFieldValue('commitText')) {
this.$message.warning(this.$t('pleaseEnterRemarks'))
this.switchValue = 'base'
}
this.$nextTick(() => {
this.approvalInfoForm.validateFields({ force: true }, (err, values) => {
if (!err) {
this.loading = true
const param = {}
param.common = Object.assign({}, values)
param.common.taskId = this.$route.query.taskId
console.log(param, this.$route.query.taskId)
// 保存快照
this.saveParamJsonStr(() => {
standardizationInitReject(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
})
}
})
})
},
// 批量驳回
handleBatchReject (ids) {
if (this.loading) return
this.validatorRules.commitText.rules[0].required = true
if (!this.approvalInfoForm.getFieldValue('commitText')) {
this.$message.warning(this.$t('pleaseEnterRemarks'))
return
}
this.$nextTick(() => {
this.approvalInfoForm.validateFields((err, values) => {
if (!err) {
this.loading = true
const param = {}
param.common = Object.assign({}, values)
param.common.taskId = this.$route.query.taskId
param.batchRejectIds = ids
console.log(param, this.$route.query.taskId)
standardizationInitBatchReject(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.loading = false
}
})
}
})
})
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>