Files
laws-sinotruk-client/src/views/workCenter/standardConsultationProcess/StandardConsultationProcess.vue
T
2024-03-05 11:01:55 +08:00

1414 lines
54 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 :content-padding="0" :title="pageTitle" :loading="loading">
<!-- 标题右侧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('workCenter.basicInformation') }}
</a>
<!--人员信息-->
<a class="switch-item" :class="switchValue === 'user' ? 'table-operator-tab-active' : ''"
@click="switchChange('user')">{{ $t('workCenter.personalInformation') }}
</a>
</div>
</template>
<!--基本信息-->
<div class="detail-page-scroll-content" v-show="switchValue === 'base'">
<!--流程信息-->
<div class="process-part-title">{{ $t('processInformation') }}</div>
<a-form :form="processInfoForm">
<a-row>
<a-col :span="12">
<!--流程名称-->
<a-form-item :labelCol="twoLabelCol" :wrapperCol="twoWrapperCol" :label="$t('processName')">
<a-input :placeholder="$t('pleaseEnter') + $t('processName')"
:maxLength="50"
disabled
v-decorator="['processName']" />
</a-form-item>
</a-col>
<a-col :span="12">
<!--截止日期-->
<a-form-item :labelCol="twoLabelCol" :wrapperCol="twoWrapperCol" :label="$t('expirationDate')">
<a-date-picker class="box-input"
:placeholder="$t('pleaseSelect') + $t('expirationDate')"
:getCalendarContainer="(trigger) => trigger.parentNode"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
v-decorator="['processDueDate']"
:disabled="processInfoDisabled"
style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
<!--流程说明-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('processExplain')">
<a-input :placeholder="$t('pleaseEnter') + $t('processExplain')"
:maxLength="500"
type="textarea"
:disabled="processInfoDisabled"
:rows="4"
v-decorator="['processDescription']" />
</a-form-item>
</a-form>
<!--业务基本信息-->
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<a-form :form="basicServiceInfoForm">
<div class="form-flex-box">
<div class="form-flex-item custom-flex-form-item">
<!--标准编号-->
<a-form-item :label="$t('standardNumber')">
<standard-selection v-decorator="['standardNumber', validatorRules.standardNumber]"
:disabled="basicServiceInfoDisabled"
:placeholder="$t('pleaseSelect') + $t('standardNumber')"
:filters="{releaseSplitFlag: '1'}"
:can-selected-source="[StandardSource.DOMESTIC.value]"
type="radio"
select-only
@listChange="handleStandardChange" />
</a-form-item>
</div>
<div class="form-flex-item custom-flex-form-item">
<!--标准名称-->
<a-form-item :label="$t('standardName')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardName')"
disabled
v-decorator="['standardName', validatorRules.standardName]" />
</a-form-item>
</div>
<div class="form-flex-item custom-flex-form-item">
<!--标准文本-->
<a-form-item :label="$t('workCenter.standardConsultationProcess.standardText')"
:class="{'add-required': basicServiceInfoDisabled}">
<div class="box-title-text" v-if="!basicServiceInfoDisabled">
<a-input class="box-input disabled-white-input"
v-decorator="['standardTextFileName', validatorRules.standardText]"
readonly
disabled
:title="basicServiceInfo.standardTextFileName"
:placeholder="$t('pleaseSelect') + $t('workCenter.standardConsultationProcess.standardText')" />
<a-button type="primary" class="button-box" @click="chooseStandardText">
{{ this.$t('workCenter.standardConsultationProcess.selectText') }}
</a-button>
</div>
<file-echo :file-ids="basicServiceInfo.standardTextFileId" v-else />
</a-form-item>
</div>
<div class="form-flex-item custom-flex-form-item">
<!--相关文件-->
<a-form-item :label="$t('workCenter.standardConsultationProcess.relevantDocument')">
<j-upload return-id v-decorator="['relatedFile', validatorRules.relatedFile]" :disabled="basicServiceInfoDisabled" />
</a-form-item>
</div>
<div class="form-flex-item custom-flex-form-item">
<!--征求意见结束日期-->
<a-form-item :label="$t('workCenter.standardConsultationProcess.endDate')">
<j-date show-type="day"
:placeholder="$t('pleaseSelect') + $t('workCenter.standardConsultationProcess.endDate')"
v-decorator="['consultationDueDate', validatorRules.consultationDueDate]"
:disabled="basicServiceInfoDisabled"
:disabled-date="consultationDueDateDisabledDate" />
</a-form-item>
</div>
</div>
</a-form>
<!--业务分派信息-->
<template v-if="showDispatchInformation">
<div class="process-part-title">{{ $t('workCenter.dispatchInformation') }}</div>
<a-form :form="dispatchInfoForm">
<div class="form-flex-box">
<div class="form-flex-item custom-flex-form-item" v-if="currentNode.indexOf(ConsultationProcess.distribute.value) === 0">
<!--下发人员类型-->
<a-form-item :label="$t('workCenter.standardConsultationProcess.senderType')">
<j-dict-select-tag v-decorator="['userType', validatorRules.userType]"
:placeholder="$t('pleaseSelect') + $t('workCenter.standardConsultationProcess.senderType')"
type="select"
dict-code="sender_type"
:triggerChange="false"
@change="handleSenderTypeChange" />
</a-form-item>
</div>
<!--各部所主管级领导分发节点且选了模块负责人类型显示-->
<div class="form-flex-item custom-flex-form-item"
v-if="senderType === SenderType.moduleOwner.value && currentNode.indexOf(ConsultationProcess.distribute.value) === 0">
<!--模块负责人-->
<a-form-item :label="$t('workCenter.standardConsultationProcess.moduleOwner')">
<user-selection v-decorator="['moduleOwnerId', validatorRules.moduleOwnerId]"
:name-str="dispatchInfo.moduleOwnerId_dictText"
type="checkbox"
:placeholder="$t('pleaseSelect') + $t('workCenter.standardConsultationProcess.moduleOwner')"
@nameChange="handleModuleOwnerNameChange" />
</a-form-item>
</div>
<!--下发人员类型选了模块负责人或者模块负责人分发节点都显示这个选项-->
<div class="form-flex-item custom-flex-form-item"
v-if="senderType === SenderType.designEngineer.value || currentNode.indexOf(ConsultationProcess.moduleOwnerDistribution.value)===0">
<!--设计工程师-->
<a-form-item :label="$t('workCenter.standardConsultationProcess.designEngineer')">
<user-selection v-decorator="['designEngineerId', validatorRules.designEngineerId]"
:name-str="dispatchInfo.designEngineerId_dictText"
type="checkbox"
:placeholder="$t('pleaseSelect') + $t('workCenter.standardConsultationProcess.designEngineer')"
@nameChange="handleDesignEngineerNameChange" />
</a-form-item>
</div>
</div>
</a-form>
</template>
<!--征求意见列表-->
<template v-if="showConsultationList">
<div class="process-part-title">{{ $t('workCenter.standardConsultationProcess.solicitationList') }}</div>
<!--设计工程师填写征求意见表格-->
<template v-if="currentNode.indexOf(ConsultationProcess.designEngineerFillIn.value) === 0">
<div class="table-operator">
<!-- 新增-->
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
<!-- 批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDel">{{ $t('delete') }}</a-button>
</div>
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
:rowKey="(record, index) => {return index}"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:loading="loading">
<!--修改前修改后修改理由弹框显示内容-->
<template v-slot:modalDetail="{text, record}">
<div class="table-text can-click" @click="showContent(text)" v-if="text">{{ text }}</div>
<div v-else>{{ global.emptyLine }}</div>
</template>
<!-- 操作栏 -->
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
<a @click="handleEdit(record, index)" class="table-ope-btn">{{ $t('edit') }}</a>
</div>
</j-table>
</div>
</template>
<!--模块负责人汇总填写意见-->
<template v-if="showAuditTable">
<div class="table-operator">
<!--批量操作汇总节点才有的按钮-->
<a-button type="primary" icon="delete" ghost @click="batchOperate" v-if="isSummaryNode">
{{ $t('batchOperation') }}
</a-button>
</div>
<j-expand-table ref="expandTable"
:columns="columns"
:data-source="dataSource"
rowKey="id"
bordered
form-is-depend="isAdopt"
:pagination="false"
:locale="tableLocale"
:class="{'empty-no-opinion': tableEmptyShowNoOpinion}"
:extra-form="collectExtraForm"
:all-disabled="disabledConsultationList"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
<!--表头插槽 start-->
<!--意见-->
<template v-slot:customTitleOpinion>
<span class="table-header-required">*</span>
{{ $t('workCenter.esInspectionPlan.opinion') }}
</template>
<!--表头插槽 end-->
<!--修改前修改后修改理由弹框显示内容-->
<template v-slot:modalDetail="{text, record}">
<div class="table-text can-click" @click="showContent(text)" v-if="text">{{ text }}</div>
<div v-else>{{ global.emptyLine }}</div>
</template>
<!--意见汇总节点才用插槽用表头控制了-->
<template v-slot:opinion="{text, record, index}">
<j-dict-select-tag :value="record.isAdopt"
:triggerChange="false"
class="opinion-select"
dict-code="consultation_opinion"
:placeholder="$t('pleaseSelect') + $t('workCenter.esInspectionPlan.opinion')"
@change="value => {handleOpinionChange(value, index, record)}" />
</template>
</j-expand-table>
</template>
</template>
<!--流程审批信息-->
<div class="process-part-title">{{ $t('processApprovalInformation') }}</div>
<a-form :form="approvalInfoForm">
<!--备注-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('remarks')">
<a-input :placeholder="$t('pleaseEnter') + $t('remarks')"
:maxLength="500"
type="textarea"
:rows="4"
v-decorator="['handleText', validatorRules.handleText]" />
</a-form-item>
<!--附件-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('businessSupport.questionAnswer.attach')">
<j-upload v-decorator="['handleFile']" return-id />
</a-form-item>
</a-form>
</div>
<!--人员信息-->
<div class="detail-page-scroll-content p-0" v-show="switchValue === 'user'">
<process-detail-list :process-key="processKey">
<template #personnelInfo>
<personnel-info ref="personnelInfo"
:data="personnelInfoData"
:current-node="currentNode"
:special-process-node-prefix="currentNodePrefix" />
</template>
</process-detail-list>
</div>
<div class="detail-page-bottom-operate-box">
<!--转办 审批节点存在-->
<a-button type="primary" :loading="loading" ghost icon="arrow-up" v-if="btnList.includes('return')" @click="handleTurnTo">
{{ $t('turnTo') }}
</a-button>
<!--保存 发起节点审批节点都存在-->
<a-button type="primary" :loading="loading" ghost v-if="btnList.includes('save')" @click="handleSave">
<i class="iconfont icon-save" />{{ $t('preservation') }}
</a-button>
<!--提交 发起节点存在-->
<a-button type="primary" :loading="loading" @click="handleSubmit" v-if="btnList.includes('submit')" icon="upload">
{{ $t('submit') }}
</a-button>
<!--同意 审批节点存在-->
<a-button type="primary" :loading="loading" icon="check-circle" v-if="btnList.includes('agree')" @click="handleAgree">
{{ $t('agree') }}
</a-button>
<!--驳回 审批节点存在-->
<a-button type="primary" :loading="loading" icon="close-circle" v-if="btnList.includes('reject')" @click="handleReject">
{{ $t('reject') }}
</a-button>
</div>
<!--新增编辑征求意见列表弹框-->
<consultation-modal ref="consultationModal" @ok="handleAddData" />
<!--选择标准文本-->
<select-standard-file-modal ref="selectStandardFileModal" @okItem="handleSelectedFile" />
<!--批量填写意见-->
<batch-write-opinion-modal ref="opinionModal" @ok="handleWriteOpinion" />
<!--转办选人-->
<user-select-modal ref="userSelectModal" check-required @change="continueTurnTo" />
<!--修改前修改后修改理由展示完整内容-->
<text-content-modal ref="textContentModal" />
</internal-detail-page>
</template>
<script>
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import StandardSelection from '../../../components/selection/StandardSelection.vue'
import { ConsultationProcess, SenderType, ProcessKey, StandardSource } from '../../../enums/commonEnums'
import UserSelection from '../../../components/selection/UserSelection'
import JTable from '../../../components/jero/JTable'
import ConsultationModal from './modules/ConsultationModal'
import ProcessDetailList from '../../../components/ProcessDetailList'
import PersonnelInfo from '../../../components/PersonnelInfo'
import { WorkCenterMixin } from '../../../mixins/WorkCenterMixin'
import JExpandTable from '../../../components/JExpandTable'
import SelectStandardFileModal from './modules/SelectStandardFileModal'
import FileEcho from '../../../components/FileEcho'
import BatchWriteOpinionModal from './modules/BatchWriteOpinionModal'
import {
saveConsultationProcess,
queryConsultationProcessDetail,
initiateConsultationProcess,
submitConsultationProcess,
transferConsultationProcess,
agreeConsultationProcess,
rejectConsultationProcess
} from '../../../api/workCenter'
import UserSelectModal from '../../../components/selection/UserSelectModal'
import { getFileInfo } from '../../../api/api'
import TextContentModal from '../../businessSupport/askForAdvice/modules/TextContentModal'
import moment from 'moment'
import { Empty } from 'ant-design-vue'
export default {
name: 'StandardConsultationProcess',
components: {
TextContentModal,
UserSelectModal,
FileEcho,
PersonnelInfo,
ProcessDetailList,
JTable,
UserSelection,
InternalDetailPage,
StandardSelection,
ConsultationModal,
JExpandTable,
SelectStandardFileModal,
BatchWriteOpinionModal
},
mixins: [WorkCenterMixin],
data () {
return {
SenderType,
ConsultationProcess,
StandardSource,
switchValue: 'base',
twoLabelCol: {
xs: { span: 24 },
sm: { span: 4 }
},
twoWrapperCol: {
xs: { span: 24 },
sm: { span: 20 }
},
longLabelCol: {
xs: { span: 24 },
sm: { span: 2 }
},
longWrapperCol: {
xs: { span: 24 },
sm: { span: 22 }
},
// 流程信息
processInfo: {},
processInfoForm: this.$form.createForm(this),
// 业务基本信息
basicServiceInfo: {},
basicServiceInfoForm: this.$form.createForm(this),
// 流程审批信息
approvalInfo: {},
approvalInfoForm: this.$form.createForm(this),
// 业务分派信息
dispatchInfo: {},
dispatchInfoDisabled: false,
dispatchInfoForm: this.$form.createForm(this),
validatorRules: {
// 标准编号
standardNumber: {
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('standardSelect.standardNumber') }],
validateTrigger: 'change'
},
// 标准名称
standardName: {
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardName') }],
validateTrigger: 'blur'
},
// 标准文本
standardText: {
rules: [{
required: true,
message: this.$t('pleaseSelect') + this.$t('workCenter.standardConsultationProcess.standardText')
}],
validateTrigger: 'change'
},
// 相关文件
relatedFile: {
rules: [{
required: false,
message: this.$t('uploadFile.pleaseUpload') + this.$t('workCenter.standardConsultationProcess.relevantDocument')
}],
validateTrigger: 'change'
},
// 征求意见结束日期
consultationDueDate: {
rules: [{
required: true,
message: this.$t('pleaseSelect') + this.$t('workCenter.standardConsultationProcess.endDate')
}],
validateTrigger: 'change'
},
// 下发人员类型
userType: {
rules: [{
required: true,
message: this.$t('pleaseSelect') + this.$t('workCenter.standardConsultationProcess.senderType')
}],
validateTrigger: 'change'
},
// 模块负责人
moduleOwnerId: {
rules: [{
required: true,
message: this.$t('pleaseSelect') + this.$t('workCenter.standardConsultationProcess.senderType')
}],
validateTrigger: 'change'
},
// 设计工程师
designEngineerId: {
rules: [{
required: true,
message: this.$t('pleaseSelect') + this.$t('workCenter.standardConsultationProcess.designEngineer')
}],
validateTrigger: 'change'
},
// 备注
handleText: {
rules: [{ required: false, message: this.$t('pleaseEnter') + this.$t('remarks') }],
validateTrigger: 'blur'
}
},
btnList: [], // 显示的按钮
loading: false,
currentNode: '', // 当前节点
nodeEnumsKey: null, // 当前节点对应枚举的key
senderType: null,
// 设计工程师填写表头
designEngineerFillInColumns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 章节编号
title: this.$t('workCenter.esInspectionProcess.sectionNumber'),
width: 180,
align: 'center',
dataIndex: 'chapterNumber',
scopedSlots: { customRender: 'text' }
},
{ // 章节名称
title: this.$t('workCenter.standardConsultationProcess.chapterName'),
width: 180,
align: 'center',
dataIndex: 'chapterName',
scopedSlots: { customRender: 'text' }
},
{ // 修改意见内容
title: this.$t('workCenter.standardConsultationProcess.reasonForRevision'),
children: [
{ // 修改前
title: this.$t('workCenter.enStandardChange.beforeUpdate'),
align: 'center',
width: 180,
dataIndex: 'modificationBefore',
scopedSlots: { customRender: 'modalDetail' }
},
{ // 修改后
title: this.$t('workCenter.enStandardChange.afterUpdate'),
align: 'center',
width: 180,
dataIndex: 'modificationAfter',
scopedSlots: { customRender: 'modalDetail' }
},
{ // 修改理由
title: this.$t('workCenter.enStandardChange.updateReason'),
align: 'center',
width: 180,
dataIndex: 'modificationReason',
scopedSlots: { customRender: 'modalDetail' }
}
]
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
width: 200
}
],
// 汇总表头
collectColumns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 章节编号
title: this.$t('workCenter.esInspectionProcess.sectionNumber'),
width: 180,
align: 'center',
dataIndex: 'chapterNumber',
scopedSlots: { customRender: 'text' }
},
{ // 章节名称
title: this.$t('workCenter.standardConsultationProcess.chapterName'),
width: 180,
align: 'center',
dataIndex: 'chapterName',
scopedSlots: { customRender: 'text' }
},
{ // 修改意见内容
title: this.$t('workCenter.standardConsultationProcess.reasonForRevision'),
children: [
{ // 修改前
title: this.$t('workCenter.enStandardChange.beforeUpdate'),
align: 'center',
width: 180,
dataIndex: 'modificationBefore',
scopedSlots: { customRender: 'modalDetail' }
},
{ // 修改后
title: this.$t('workCenter.enStandardChange.afterUpdate'),
align: 'center',
width: 180,
dataIndex: 'modificationAfter',
scopedSlots: { customRender: 'modalDetail' }
},
{ // 修改理由
title: this.$t('workCenter.enStandardChange.updateReason'),
align: 'center',
width: 180,
dataIndex: 'modificationReason',
scopedSlots: { customRender: 'modalDetail' }
}
]
},
{ // 设计工程师
title: this.$t('workCenter.standardConsultationProcess.designEngineer'),
width: 180,
align: 'center',
dataIndex: 'designEngineerName',
scopedSlots: { customRender: 'text' }
},
{ // 意见
// title: this.$t('workCenter.esInspectionPlan.opinion'),
slots: { title: 'customTitleOpinion' },
width: 180,
align: 'center',
dataIndex: 'isAdopt_dictText',
scopedSlots: { customRender: 'opinion' }
}
],
dataSource: [],
selectedRowKeys: [],
// 汇总表格的表单校验
collectExtraForm: {
// 采纳
'1': {
rules: {
// 依据描述
basisDescription: {
required: false,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
trigger: 'blur'
},
// 佐证材料
basisFile: {
required: false,
message: this.$t('pleaseUpload') + this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
trigger: 'change'
}
},
formArr: [
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
dbFieldName: 'basisDescription'
},
{
fieldShowType: 2,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
dbFieldName: 'basisFile'
}
]
},
// 部分采纳
'2': {
rules: {
// 依据描述
basisDescription: {
required: false,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
trigger: 'blur'
},
// 佐证材料
basisFile: {
required: false,
message: this.$t('pleaseUpload') + this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
trigger: 'change'
}
},
formArr: [
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
dbFieldName: 'basisDescription'
},
{
fieldShowType: 2,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
dbFieldName: 'basisFile'
}
]
},
// 不采纳
'3': {
rules: {
// 依据描述
basisDescription: {
required: true,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
trigger: 'blur'
},
// 佐证材料
basisFile: {
required: false,
message: this.$t('pleaseUpload') + this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
trigger: 'change'
}
},
formArr: [
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
dbFieldName: 'basisDescription'
},
{
fieldShowType: 2,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
dbFieldName: 'basisFile'
}
]
}
},
// 审批表头
approvalColumns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 章节编号
title: this.$t('workCenter.esInspectionProcess.sectionNumber'),
width: 180,
align: 'center',
dataIndex: 'chapterNumber',
scopedSlots: { customRender: 'text' }
},
{ // 章节名称
title: this.$t('workCenter.standardConsultationProcess.chapterName'),
width: 180,
align: 'center',
dataIndex: 'chapterName',
scopedSlots: { customRender: 'text' }
},
{ // 修改意见内容
title: this.$t('workCenter.standardConsultationProcess.reasonForRevision'),
children: [
{ // 修改前
title: this.$t('workCenter.enStandardChange.beforeUpdate'),
align: 'center',
width: 180,
dataIndex: 'modificationBefore',
scopedSlots: { customRender: 'modalDetail' }
},
{ // 修改后
title: this.$t('workCenter.enStandardChange.afterUpdate'),
align: 'center',
width: 180,
dataIndex: 'modificationAfter',
scopedSlots: { customRender: 'modalDetail' }
},
{ // 修改理由
title: this.$t('workCenter.enStandardChange.updateReason'),
align: 'center',
width: 180,
dataIndex: 'modificationReason',
scopedSlots: { customRender: 'modalDetail' }
}
]
},
{ // 设计工程师
title: this.$t('workCenter.standardConsultationProcess.designEngineer'),
width: 180,
align: 'center',
dataIndex: 'designEngineerName',
scopedSlots: { customRender: 'text' }
},
{ // 模块负责人意见
title: this.$t('workCenter.standardConsultationProcess.moduleOwner') + this.$t('workCenter.esInspectionPlan.opinion'),
width: 180,
align: 'center',
dataIndex: 'isAdopt_dictText',
scopedSlots: { customRender: 'text' }
}
],
businessId: null,
currentNodePrefix: null, // 当前节点的固定前缀,用于人员信息组件处理
disabledBtnClick: false,
tableEmptyShowNoOpinion: false, // 表格暂无数据文本在汇总节点显示无意见
tableLocale: {
emptyText: <a-empty image={Empty.PRESENTED_IMAGE_SIMPLE}><span slot="description"> {this.$t('noData')} </span></a-empty>
}
}
},
computed: {
// 流程的key
processKey () {
return ProcessKey.CONSULTATION.value
},
pageTitle () {
const subTitle = this.$route.query.taskName || ConsultationProcess.initiate.text
return `${this.$t('flowCenter')}${this.$route.meta.title}${subTitle}`
},
// 是否展示业务分派信息,各部所主管级领导分发、模块负责人分发显示
showDispatchInformation () {
const nodes = [ConsultationProcess.distribute.value, ConsultationProcess.moduleOwnerDistribution.value]
return nodes.some(tt => this.currentNode.indexOf(tt) === 0)
},
// 流程信息禁用,非发起节点都禁用
processInfoDisabled () {
return this.currentNode.indexOf(ConsultationProcess.initiate.value) === -1
},
// 业务基本信息禁用,非发起节点都禁用
basicServiceInfoDisabled () {
return !!this.currentNode && this.currentNode.indexOf(ConsultationProcess.initiate.value) === -1
},
// 展示征求意见列表(设计工程师填写征求意见、模块负责人/各部所主管级领导汇总、各部所主管级领导/法规工程师审批)
showConsultationList () {
const nodes = [ConsultationProcess.designEngineerFillIn.value, ConsultationProcess.moduleOwnerSummary.value, ConsultationProcess.leaderApproval.value, ConsultationProcess.leaderSummary.value, ConsultationProcess.regulatoryEngineerApproval.value]
return nodes.some(tt => this.currentNode.indexOf(tt) === 0)
},
// 展示审批的表格
showAuditTable () {
const nodes = [ConsultationProcess.moduleOwnerSummary.value, ConsultationProcess.leaderSummary.value, ConsultationProcess.leaderApproval.value, ConsultationProcess.regulatoryEngineerApproval.value]
return nodes.some(tt => this.currentNode.indexOf(tt) === 0) || this.nodeEnumsKey === 'regulatoryEngineerApproval'
},
// 是否汇总节点
isSummaryNode () {
const nodes = [ConsultationProcess.moduleOwnerSummary.value, ConsultationProcess.leaderSummary.value]
return nodes.some(tt => this.currentNode.indexOf(tt) === 0)
},
// 征求意见列表禁用
disabledConsultationList () {
const nodes = [ConsultationProcess.leaderApproval.value, ConsultationProcess.regulatoryEngineerApproval.value]
return nodes.some(tt => this.currentNode.indexOf(tt) === 0)
},
// 没有意见可以直接提交的节点
isNoOpinionSubmitNode () {
const nodes = [ConsultationProcess.moduleOwnerSummary.value, ConsultationProcess.leaderApproval.value, ConsultationProcess.leaderSummary.value, ConsultationProcess.leaderSummary.value, ConsultationProcess.regulatoryEngineerApproval.value]
return nodes.some(tt => this.currentNode.indexOf(tt) === 0)
},
columns () {
// 设计工程师填写征求意见表头
if (this.currentNode.indexOf(ConsultationProcess.designEngineerFillIn.value) === 0) {
return this.designEngineerFillInColumns
}
// 模块负责人汇总填写意见表头
const summaryNodes = [ConsultationProcess.moduleOwnerSummary.value, ConsultationProcess.leaderSummary.value]
if (summaryNodes.some(tt => this.currentNode.indexOf(tt) === 0)) {
return this.collectColumns
}
// 审批节点表头
const auditNodes = [ConsultationProcess.leaderApproval.value, ConsultationProcess.regulatoryEngineerApproval.value]
if (auditNodes.some(tt => this.currentNode.indexOf(tt) === 0) || this.nodeEnumsKey === 'regulatoryEngineerApproval') {
return this.approvalColumns
}
return []
}
},
watch: {
tableEmptyShowNoOpinion () {
this.tableLocale.emptyText = <a-empty image={Empty.PRESENTED_IMAGE_SIMPLE}>
<span slot="description"> {this.tableEmptyShowNoOpinion ? this.$t('workCenter.standardConsultationProcess.noOpinion') : this.$t('noData')} </span>
</a-empty>
}
},
created () {
// 获取人员信息数据
this.getPersonInfoStructure(this.processKey, () => {
// 有流程id或者草稿id点进来的
if (this.$route.query.processInstanceId || this.$route.query.draftId) {
this.currentNode = this.$route.query.nodeId || ConsultationProcess.initiate.value
this.initPersonInfoData(this.currentNode.indexOf(ConsultationProcess.initiate.value) === 0)
this.initProcessDetailData()
} else {
this.currentNode = ConsultationProcess.initiate.value
this.initPersonInfoData(this.currentNode.indexOf(ConsultationProcess.initiate.value) === 0)
}
// 找不到这个节点默认使用审批节点页面及按钮,发起除外
this.nodeEnumsKey = this.currentNode ? ConsultationProcess.keyOfValueByLike(this.currentNode) || 'regulatoryEngineerApproval' : 'initiate'
this.currentNodePrefix = ConsultationProcess[this.nodeEnumsKey].value
this.btnList = ConsultationProcess[this.nodeEnumsKey].btn
})
},
methods: {
initProcessDetailData () {
this.loading = true
const params = {
taskId: this.$route.query.taskId,
projectId: this.$route.query.projectId
}
if (this.$route.query.draftId) {
params.draftId = this.$route.query.draftId
} else {
params.processInstanceId = this.$route.query.processInstanceId
}
queryConsultationProcessDetail(params).then(async res => {
if (res.success) {
let result = res.result || {}
// 草稿有数据需要从草稿里取
if (result.infoJsonStr) {
result = JSON.parse(result.infoJsonStr)
this.draftInitPersonInfo(result.userInfoMap)
}
this.businessId = result.businessId
// 处理流程信息
this.processInfo = Object.assign({}, result.basicProcessInfoDTO || {})
// 流程审批信息
this.approvalInfo = Object.assign({}, result.basicTaskInfoDTO || {})
this.approvalInfo.taskId = this.approvalInfo.taskId || this.$route.query.taskId
// 业务基本信息
this.basicServiceInfo = Object.assign({}, result.businessInfoDTO.processFbStandardConsultation || {})
if (this.currentNode.indexOf(ConsultationProcess.initiate.value) !== -1 && this.basicServiceInfo.standardTextFileId) {
await this.queryFileName()
}
// 业务分派信息
this.dispatchInfo = Object.assign({}, result.businessInfoDTO.processFbConsultationUserLink || {})
if (this.dispatchInfo.userType) {
this.handleSenderTypeChange(this.dispatchInfo.userType)
}
// 征求意见列表
this.dataSource = result.businessInfoDTO.processFbConsultationLists || []
// 如果是设计工程师后面的节点,没有征求意见table emptyText显示“无意见”,否则显示“暂无数据”
this.tableEmptyShowNoOpinion = (!this.dataSource || this.dataSource.length === 0) && this.isNoOpinionSubmitNode
// 统一处理表单回显
this.$nextTick(() => {
this.processInfoForm.setFieldsValue(this.processInfo)
this.approvalInfoForm.setFieldsValue(this.approvalInfo)
this.basicServiceInfoForm.setFieldsValue(this.basicServiceInfo)
this.dispatchInfoForm.setFieldsValue(this.dispatchInfo)
})
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
queryFileName () {
return new Promise(resolve => {
getFileInfo({ id: this.basicServiceInfo.standardTextFileId }).then(res => {
if (res.success) {
this.basicServiceInfo.standardTextFileName = res.result.fileName
}
}).finally(() => {
resolve()
})
})
},
switchChange (value) {
this.switchValue = value
},
/**
* 选择标准带出标准名称
* @param name
*/
handleStandardChange (list) {
const standard = list[0] || {}
this.basicServiceInfoForm.setFieldsValue({ standardName: standard.standardName, standardTextFileName: null })
this.basicServiceInfo.standardId = standard.id
delete this.basicServiceInfo.standardTextFileName
delete this.basicServiceInfo.standardText
delete this.basicServiceInfo.standardTextFileId
// 标准编号、标准名称都有的情况下生成流程名称
if (standard.standardNumber && standard.standardName) {
this.processInfoForm.setFieldsValue({ processName: `${standard.standardNumber}-${standard.standardName}-征求意见` })
} else {
this.processInfoForm.setFieldsValue({ processName: null })
}
},
/**
* 选择标准文本
*/
chooseStandardText () {
const selectedStandard = this.basicServiceInfoForm.getFieldValue('standardNumber')
if (!selectedStandard) {
this.$message.warning(this.$t('workCenter.standardConsultationProcess.pleaseSelectCriteriaFirst'))
return
}
this.$refs.selectStandardFileModal.open(selectedStandard, this.basicServiceInfo.standardText)
},
/**
* 下发人员类型修改
* @param value
*/
handleSenderTypeChange (value) {
this.senderType = value
},
/**
* 征求意见列表-新增
*/
handleAdd () {
const pdfId = this.basicServiceInfo.standardTextFileId
this.$refs.consultationModal.add(pdfId, this.basicServiceInfo.standardText)
},
/**
* 表单填写完成,新增数据
*/
handleAddData (lineData) {
if (lineData.index || lineData.index === 0) {
this.dataSource.splice(lineData.index, 1, lineData)
} else {
this.dataSource.push(lineData)
}
},
/**
* 征求意见列表-删除
*/
batchDel () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectLeastOne'))
return
}
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: () => {
const tableData = JSON.parse(JSON.stringify(this.dataSource))
this.selectedRowKeys.forEach(index => {
tableData[index] = null
})
this.dataSource = tableData.filter(tt => !!tt)
this.selectedRowKeys = []
this.$message.success(this.$t('successfullyDelete'))
}
})
},
onSelectChange (selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
handleEdit (record, index) {
record.index = index
const pdfId = this.basicServiceInfo.standardTextFileId
this.$refs.consultationModal.edit(pdfId, record)
},
asyncConfirmData () {
return new Promise(resolve => {
this.$confirm({
title: this.$t('tips'),
content: this.$t('workCenter.standardConsultationProcess.isThereNoOpinion'),
onOk: () => {
resolve(true)
},
onCancel: () => {
resolve(false)
}
})
})
},
/**
* 处理页面数据
*/
async dealFormData (isSave) {
// 提交的表单数据,流程信息,流程审批信息,征求意见列表,业务分派信息,业务基本信息
let formData = {}, processInfo = {}, approvalInfo = {}, consultationListData = [], dispatchInfo = {}, basicServiceInfo = {},
userInfoMap = {}, flag = true, baseFlag
// 保存,只需要有填写内容即可
if (isSave) {
// 流程信息
processInfo = Object.assign(this.processInfo, this.processInfoForm.getFieldsValue())
// 业务基本信息
basicServiceInfo = Object.assign(this.basicServiceInfo, this.basicServiceInfoForm.getFieldsValue())
// 流程审批信息
approvalInfo = Object.assign(this.approvalInfo, this.approvalInfoForm.getFieldsValue())
approvalInfo.finishFlag = 1 // 保存——1;提交/同意/驳回——2
// 业务分派信息
if (this.showDispatchInformation) {
dispatchInfo = Object.assign(this.dispatchInfo, this.dispatchInfoForm.getFieldsValue())
}
// 用户信息
userInfoMap = this.$refs.personnelInfo.getDataObj()
const saveCheckObj = { ...processInfo, ...basicServiceInfo, ...approvalInfo, ...dispatchInfo, ...userInfoMap }
// 征求意见列表
consultationListData = this.dataSource || []
if (!(Object.values(saveCheckObj).some(tt => !!tt || tt === 0) || consultationListData.length > 0)) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
flag = false
}
} else {
// 流程信息
this.processInfoForm.validateFields({ force: true }, (errors, values) => {
if (!errors) {
processInfo = Object.assign(this.processInfo, values)
} else {
flag = false
}
})
// 业务基本信息
this.basicServiceInfoForm.validateFields({ force: true }, (errors, values) => {
if (!errors) {
basicServiceInfo = Object.assign(this.basicServiceInfo, values)
} else {
flag = false
}
})
// 流程审批信息
this.approvalInfoForm.validateFields({ force: true }, (errors, values) => {
if (!errors) {
approvalInfo = Object.assign(this.approvalInfo, values)
approvalInfo.finishFlag = 2 // 保存——1;提交/同意/驳回——2
} else {
flag = false
}
})
// 业务分派信息
if (this.showDispatchInformation) {
this.dispatchInfoForm.validateFields({ force: true }, (errors, values) => {
if (!errors) {
dispatchInfo = Object.assign(this.dispatchInfo, values)
} else {
flag = false
this.$message.warning(this.$t('pleaseEnterRemarks'))
}
})
} else {
dispatchInfo = Object.assign({}, this.dispatchInfo)
}
// 征求意见列表
if (this.showConsultationList && (this.currentNode.indexOf(ConsultationProcess.moduleOwnerSummary.value) !== -1 || this.currentNode.indexOf(ConsultationProcess.leaderSummary.value) !== -1) && !this.$refs.expandTable.submit()) {
// 校验提醒
this.$message.warning(this.$t('workCenter.checkTableRequired'))
flag = false
}
// 征求意见列表且当前节点不是汇总节点, 至少一行数据
if (this.showConsultationList && (!this.dataSource || this.dataSource.length === 0) && !this.isNoOpinionSubmitNode) {
const listAsyncConfirmResult = await this.asyncConfirmData()
if (!listAsyncConfirmResult) {
flag = false
}
}
if (!flag) {
this.switchValue = 'base'
return false
}
baseFlag = flag
// 用户信息
const userInfo = this.$refs.personnelInfo.getDataObjVerify()
if (!userInfo) {
flag = false
} else {
userInfoMap = userInfo
}
if (!flag && !baseFlag) {
this.switchValue = 'base'
} else if (!flag && !userInfo) {
this.switchValue = 'user'
}
consultationListData = this.dataSource || []
}
if (!flag) {
return false
}
formData = {
draftId: this.$route.query.draftId,
businessId: this.businessId,
basicProcessInfoDTO: processInfo,
basicTaskInfoDTO: approvalInfo,
businessInfoDTO: {
processFbStandardConsultation: basicServiceInfo,
processFbConsultationUserLink: dispatchInfo,
processFbConsultationLists: this.dataSource
},
userInfoMap
}
return formData
},
/**
* 转办
*/
handleTurnTo () {
if (this.disabledBtnClick) {
return
}
this.$refs.userSelectModal.open()
},
continueTurnTo (userId) {
this.disabledBtnClick = true
const params = {
taskId: this.$route.query.taskId,
userId,
projectId: this.$route.query.projectId
}
this.loading = true
transferConsultationProcess(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.disabledBtnClick = false
}
}).finally(() => {
this.loading = false
})
},
/**
* 保存
*/
async handleSave () {
if (this.disabledBtnClick) {
return
}
this.disabledBtnClick = true
const formData = await this.dealFormData(true)
if (!formData) {
this.disabledBtnClick = false
return
}
this.loading = true
formData.infoJsonStr = JSON.stringify(formData)
// saveSource:从待办进入保存--1;发起/草稿页面--2
if (this.$route.query.processInstanceId) {
formData.saveSource = 1
} else {
formData.saveSource = 2
}
saveConsultationProcess(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.disabledBtnClick = false
}
}).finally(() => {
this.loading = false
})
},
/**
* 提交
*/
async handleSubmit () {
if (this.disabledBtnClick) {
return
}
this.disabledBtnClick = true
const formData = await this.dealFormData()
if (!formData) {
this.disabledBtnClick = false
return
}
this.loading = true
let func
if (!this.currentNode || (this.currentNode.indexOf(ConsultationProcess.initiate.value) === 0 && (!this.$route.query.processInstanceId || this.$route.query.draftId))) {
func = initiateConsultationProcess
const saveForm = await this.dealFormData(true)
if (saveForm) {
formData.infoJsonStr = JSON.stringify(saveForm)
}
} else {
func = submitConsultationProcess
}
func(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.disabledBtnClick = false
}
}).finally(() => {
this.loading = false
})
},
/**
* 同意
*/
async handleAgree () {
if (this.disabledBtnClick) {
return
}
this.disabledBtnClick = true
this.validatorRules.handleText.rules[0].required = false
if (!this.approvalInfoForm.getFieldValue('handleText')) {
this.approvalInfoForm.setFieldsValue({ handleText: '同意' })
}
const formData = await this.dealFormData()
if (!formData) {
this.disabledBtnClick = false
return
}
this.loading = true
formData.basicTaskInfoDTO.commitFlag = 1 // 同意就传1,驳回传2,其他都为空
agreeConsultationProcess(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.disabledBtnClick = false
}
}).finally(() => {
this.loading = false
})
},
/**
* 驳回
*/
async handleReject () {
if (this.disabledBtnClick) {
return
}
this.disabledBtnClick = true
this.validatorRules.handleText.rules[0].required = true
const formData = await this.dealFormData()
if (!formData) {
this.disabledBtnClick = false
return
}
this.loading = true
formData.basicTaskInfoDTO.commitFlag = 2 // 同意就传1,驳回传2,其他都为空
rejectConsultationProcess(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
this.disabledBtnClick = false
}
}).finally(() => {
this.loading = false
})
},
/**
* 批量操作
*/
batchOperate () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectLeastOne'))
return
}
this.$refs.opinionModal.open()
},
handleWriteOpinion ({ isAdopt }) {
this.selectedRowKeys.forEach(id => {
const index = this.dataSource.findIndex(tt => tt.id === id)
this.$set(this.dataSource[index], 'isAdopt', isAdopt)
})
},
/**
* 选中标准文本
* @param item
*/
handleSelectedFile (item) {
this.basicServiceInfoForm.setFieldsValue({ standardTextFileName: item.fileName })
this.basicServiceInfo.standardTextFileName = item.fileName
this.basicServiceInfo.standardText = item.publishBeforeId
this.basicServiceInfo.standardTextFileId = item.fileId
},
/**
* 修改意见
* @param value
* @param index
* @param record
*/
handleOpinionChange (value, index, record) {
record.isAdopt = value
// 处理变化之后清空之前的数据
const extraFormKeys = Object.keys(this.extraForm)
let deleteField = []
for (const key of extraFormKeys) {
if (key !== value) {
const fields = this.extraForm[key].formArr.map(tt => tt.dbFieldName)
deleteField = [...deleteField, ...fields]
}
}
for (const fieldName of deleteField) {
delete record[fieldName]
}
this.$set(this.dataSource, index, record)
},
showContent (text) {
this.$refs.textContentModal.open(text)
},
/**
* 征求意见截至日期不可选今天之前的日期
*/
consultationDueDateDisabledDate (current) {
return current && current < moment().subtract(1, 'days').endOf('day')
},
/**
* 模块负责人名字
* @param name
*/
handleModuleOwnerNameChange (name) {
this.dispatchInfo.moduleOwnerId_dictText = name
},
/**
* 设计工程师名字
* @param name
*/
handleDesignEngineerNameChange (name) {
this.dispatchInfo.designEngineerId_dictText = name
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
.box-title-text {
height: 40px;
line-height: 40px;
display: flex;
align-items: center;
.box-input {
width: 100%;
}
.button-box {
margin-left: 10px;
}
}
.disabled-white-input[disabled] {
background-color: white;
color: rgba(0, 0, 0, 0.65);
}
.opinion-select {
width: 100%;
}
.add-required > ::v-deep.ant-form-item-label > label::before {
display: inline-block;
margin-right: 4px;
color: #f5222d;
font-size: 14px;
font-family: SimSun, sans-serif;
line-height: 1;
content: '*';
}
.can-click {
cursor: pointer;
}
.empty-no-opinion {
/deep/ .ant-empty-description {
color: rgba(0, 0, 0, 0.5);
}
}
</style>