Files
laws-sinotruk-client/src/views/workCenter/projectComplianceEvaluationProcess/ProjectComplianceEvaluationProcess.vue
T

1405 lines
52 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'">
<!--步骤条-->
<a-steps :current="currentStep" v-if="showStep">
<a-step v-for="item in steps" :key="item.title" :title="item.title" />
</a-steps>
<!--流程信息-->
<div class="process-part-title" v-show="processInfoShowField && processInfoShowField.length > 0">{{ $t('processInformation') }}</div>
<a-form :form="processInfoForm">
<a-row>
<a-col :span="12" v-show="processInfoShowField.includes('processName')">
<!--流程名称-->
<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()"
:maxLength="50"
:disabled="processInfoDisabled"
v-decorator="['processName', validatorRules.processName]" />
</a-form-item>
</a-col>
<a-col :span="12" v-show="processInfoShowField.includes('processDueDate')">
<!--截止日期-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :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-row>
<a-col :span="12" v-show="processInfoShowField.includes('projectName')">
<!--车型项目信息-->
<a-form-item :labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="$t('workCenter.projectComplianceEvaluationProcess.vehicleItemInfo')">
<div class="can-click-table-text" v-if="projectDataSource && projectDataSource.length > 0">
<div v-for="(project, index) in projectDataSource" :key="index + 'project'" @click="toProjectDetail(project)">
{{ projectDataSource[0].projectName }}
</div>
</div>
</a-form-item>
</a-col>
<a-col :span="12" v-show="processInfoShowField.includes('standardNumber')">
<!--属性及文本附件-->
<a-form-item :labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="$t('workCenter.projectComplianceEvaluationProcess.propertiesAndTextAttachments')">
<div class="can-click-table-text" v-if="standardDataSource && standardDataSource.length > 0">
<div v-for="(standard, index) in standardDataSource" :key="index + 'standard'" @click="toStandardDetail(standard)">
{{ standard.standardNumber }} {{ standard.standardName }}
</div>
</div>
</a-form-item>
</a-col>
</a-row>
<!--流程说明-->
<a-form-item v-show="processInfoShowField.includes('processDescription')"
:labelCol="longLabelCol"
:wrapperCol="longWrapperCol"
:label="$t('processExplain')">
<a-input :placeholder="$t('pleaseEnter') + $t('processExplain')"
@change="event => event.target.value = event.target.value.trim()"
:maxLength="500"
type="textarea"
:disabled="processInfoDisabled"
v-decorator="['processDescription']" />
</a-form-item>
</a-form>
<!--发起第二步选择项目第三步添加标准采用引入组件的方式-->
<keep-alive>
<component :is="comp"
v-if="comp"
ref="projectStandardTable"
:project-id="projectId"
:echo-data-source="currentStep === 1 ? projectDataSource : standardDataSource" />
</keep-alive>
<!--业务分派信息-->
<template v-if="showDispatchAndApprovalInfo">
<div class="process-part-title">{{ middlePartTitle }}</div>
<div class="table-operator">
<!--批量选择人员-->
<a-button type="primary" ghost @click="batchSelector" v-if="!showExpandTable">
{{ $t('workCenter.projectComplianceEvaluationProcess.batchSelector') }}
</a-button>
</div>
<div v-if="!showExpandTable">
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="tableRowKey"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@change="handleTableChange"
v-bind="$attrs">
<!--条文内容-->
<template v-slot:clauseContent="{text}">
<div class="table-text" @click="showContent(text)" v-if="text">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<!--责任单位-->
<template v-slot:depart="{text, record, index}">
<j-select-depart v-if="record.canAssignFlag + '' === '1'"
multi
:back-depart="true"
:value="record.responsibleUnits"
@change="value => handleDepartChange(value, record, index)" />
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<!--责任单位负责人-->
<template v-slot:user="{text, record, index}">
<user-selection v-if="record.canAssignFlag + '' === '1'"
:name-str="record.responsibleUnitLeaders_dictText"
:show-btn="false"
:value="record.responsibleUnitLeaders"
:placeholder="$t('pleaseSelect') + $t('workCenter.projectComplianceEvaluationProcess.responsibleUnitHead')"
type="checkbox"
@listChange="value => handleUserChange(value, record, index, 'responsibleUnitLeaders')" />
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<!--模块负责人-->
<template v-slot:moduleOwner="{text, record, index}">
<!--不涉及不需要选模块负责人需要填写不涉及理由-->
<user-selection :name-str="record.moduleOwners_dictText"
:show-btn="false"
:value="record.moduleOwners"
:placeholder="$t('pleaseSelect') + $t('workCenter.standardConsultationProcess.moduleOwner')"
type="checkbox"
v-if="!record.notInvolved && record.canAssignFlag + '' === '1'"
@listChange="value => handleUserChange(value, record, index, 'moduleOwners')" />
<div v-else>{{ global.emptyLine }}</div>
</template>
<!--设计工程师-->
<template v-slot:designEngineers="{text, record, index}">
<!--不涉及不需要选模块负责人需要填写不涉及理由-->
<user-selection :name-str="record.designEngineers_dictText"
:show-btn="false"
:value="record.designEngineers"
:placeholder="$t('pleaseSelect') + $t('workCenter.standardConsultationProcess.designEngineer')"
type="radio"
v-if="!record.notInvolved && record.canAssignFlag + '' === '1'"
@listChange="value => handleUserChange(value, record, index, 'designEngineers')" />
<div v-else>{{ global.emptyLine }}</div>
</template>
<!--操作删除-->
<template v-slot:action="{text, record}">
<a @click="handleDelete(record.tableRowKey)">{{ $t('delete') }}</a>
</template>
<!--操作不涉及/不涉及原因-->
<template v-slot:notInvolved="{text, record}">
<a @click="handleUninvolved(record)" :disabled="record.canAssignFlag + '' !== '1'">
{{
!record.notInvolved ? $t('projectLibrary.vehicleItemLibrary.uninvolved') : $t('workCenter.projectComplianceEvaluationProcess.noCauseInvolved')
}}
</a>
</template>
</j-table>
</div>
<div v-if="showExpandTable">
<j-expand-table ref="expandTable"
:columns="columns"
:data-source="dataSource"
:pagination="ipagination"
:all-disabled="expandTableDisabled"
form-is-depend="evaluationFeedback"
:extra-form="extraForm"
@change="handleTableChange">
<!--条文内容-->
<template v-slot:clauseContent="{text}">
<div class="table-text" style="cursor: pointer" @click="showContent(text)" v-if="text">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<!--评估反馈-->
<template v-slot:evaluationFeedback="{text, record, index}">
<j-dict-select-tag
v-if="!expandTableDisabled && record.canAssignFlag + '' === '1'"
style="width: 100%"
:placeholder="$t('pleaseSelect') + $t('workCenter.projectComplianceEvaluationProcess.evaluationFeedback')"
:value="record.evaluationFeedback"
dict-code="assess_results"
@change="value => handleEvaluationFeedBackChange(value, record, index)" />
<template v-else>
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
</template>
</j-expand-table>
</div>
<a-form :form="dispatchInfoForm" class="dispatch-form" v-if="showCcPerson">
<a-row>
<a-col :span="12">
<!--抄送人员-->
<a-form-item :labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="$t('workCenter.projectComplianceEvaluationProcess.ccPerson')">
<user-selection :placeholder="$t('pleaseSelect') + $t('workCenter.projectComplianceEvaluationProcess.ccPerson')"
type="checkbox"
v-decorator="['carbonCopyPersonnels', validatorRules.carbonCopyPersonnels]" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
<!--流程审批信息-->
<template v-if="showDispatchAndApprovalInfo">
<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')"
@change="event => event.target.value = event.target.value.trim()"
:maxLength="500"
type="textarea"
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>
</template>
</div>
<!--人员信息-->
<div class="detail-page-scroll-content p-0" v-show="switchValue === 'user'">
<process-detail-list :process-key="ProcessKey.PROJECT_COMPLIANCE_EVALUATION.value">
<template #personnelInfo>
<personnel-info ref="personnelInfo" :data="personnelInfoData" :current-node="personnelInfoCurrentNode" />
</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" ghost icon="arrow-up" v-if="btnList.includes('pre')" @click="handleLastStep">
{{ $t('workCenter.projectComplianceEvaluationProcess.lastStep') }}
</a-button>
<!--下一步-->
<a-button type="primary" :loading="loading" icon="arrow-down" v-if="btnList.includes('next')" @click="handleNextStep">
{{ $t('workCenter.projectComplianceEvaluationProcess.nextStep') }}
</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>
<!--选人-->
<user-select-modal :type="userSelectType" ref="userSelectModal" @listChange="handleBatchSelectorOk" @change="continueTransfer" />
<!--不涉及-->
<uninvolved-modal ref="uninvolvedModal" @ok="handleUninvolvedOk" />
<!--条文内容-->
<split-clause-detail ref="clauseDetail" />
</internal-detail-page>
</template>
<script>
import PersonnelInfo from '../../../components/PersonnelInfo'
import InternalDetailPage from '../../../components/InternalDetailPage'
import ProcessDetailList from '../../../components/ProcessDetailList'
import { WorkCenterMixin } from '../../../mixins/WorkCenterMixin'
import { EvaluationResultType, ProcessKey, ProjectComplianceEvaluationProcessNode, StandardSource } from '../../../enums/commonEnums'
import JTable from '../../../components/jero/JTable'
import ProjectTable from './components/ProjectTable'
import UserSelection from '../../../components/selection/UserSelection'
import UserSelectModal from '../../../components/selection/UserSelectModal'
import UninvolvedModal from './modules/UninvolvedModal'
import JExpandTable from '../../../components/JExpandTable'
import {
queryStandardClauseList,
initiateProjectComplianceEvaluation,
submitProjectComplianceEvaluation,
saveProjectComplianceEvaluation,
queryProjectComplianceEvaluation,
processTransfer,
agreeProjectComplianceEvaluation,
rejectProjectComplianceEvaluation
} from '../../../api/workCenter'
import SplitClauseDetail from '../../documentTool/documentSplit/modules/SplitClauseDetail'
export default {
name: 'ProjectComplianceEvaluationProcess',
components: {
JExpandTable,
JTable,
ProcessDetailList,
InternalDetailPage,
PersonnelInfo,
ProjectTable,
UserSelection,
UserSelectModal,
UninvolvedModal,
SplitClauseDetail
},
mixins: [WorkCenterMixin],
data () {
return {
ProcessKey,
loading: false,
// 流程信息表单
processInfoForm: this.$form.createForm(this),
processInfo: {},
// 业务分派信息的表单
dispatchInfoForm: this.$form.createForm(this),
dispatchInfo: {},
// 审批信息的表单
approvalInfoForm: this.$form.createForm(this),
approvalInfo: {},
currentNode: null,
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 18 }
},
longLabelCol: {
xs: { span: 24 },
sm: { span: 3 }
},
longWrapperCol: {
xs: { span: 24 },
sm: { span: 21 }
},
/* 分页参数 */
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
validatorRules: {
// 流程名称
processName: {
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('processName') }],
validateTrigger: 'blur'
},
// 备注
handleText: {
rules: [{ required: false, message: this.$t('pleaseEnter') + this.$t('remarks') }],
validateTrigger: 'blur'
},
// 抄送人员
carbonCopyPersonnels: {
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.projectComplianceEvaluationProcess.ccPerson') }],
validateTrigger: 'change'
}
},
currentStep: 0,
steps: [
// 基本信息
{
title: this.$t('essentialInformation')
},
// 选择项目
{
title: this.$t('projectLibrary.selectProject')
},
// 选择标准
{
title: this.$t('workCenter.projectComplianceEvaluationProcess.selectStandard')
},
// 任务分发
{
title: this.$t('workCenter.projectComplianceEvaluationProcess.taskDistributing')
}
],
projectDataSource: [], // 选中的项目
projectId: null, // 选中项目的id
standardDataSource: [], // 选中的标准
basicColumns: [
// 序号
{
title: this.$t('serialNumber'),
key: 'rowIndex',
width: 80,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
// 标准编号/条款号
{
dataIndex: 'termNumber',
title: this.$t('projectLibrary.vehicleItemLibrary.standardNumberClauseNumber'),
width: 150,
align: 'center',
scopedSlots: { customRender: 'text' }
},
// 标准名称/条款名称
{
dataIndex: 'termName',
title: this.$t('workCenter.projectComplianceEvaluationProcess.standardNameClauseName'),
width: 160,
align: 'center',
scopedSlots: { customRender: 'text' }
},
// 条款内容
{
dataIndex: 'termText',
title: this.$t('workCenter.projectComplianceEvaluationProcess.terms'),
width: 150,
align: 'center',
scopedSlots: { customRender: 'clauseContent' }
}
],
dataSource: [],
selectedRowKeys: [],
// 展开表格的配置项
extraForm: {
// 符合
'1': {
rules: {
// 依据描述
description: {
required: true,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
trigger: 'blur'
},
// 佐证材料
fileId: {
required: false,
message: this.$t('pleaseUpload') + this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
trigger: 'change'
}
},
formArr: [
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
dbFieldName: 'description'
},
{
fieldShowType: 2,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
dbFieldName: 'fileId'
}
]
},
// 不符合
'2': {
rules: {
// 不符合项
nonConformance: {
required: true,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.vehicleItemLibrary.nonConformanceTerm'),
trigger: 'blur'
},
// 应对措施
countermeasures: {
required: true,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.vehicleItemLibrary.solutions'),
trigger: 'blur'
},
// 预计整改完成日期
expectedTime: {
required: true,
message: this.$t('pleaseSelect') + this.$t('projectLibrary.vehicleItemLibrary.estimatedDateOfCompletionOfRectification'),
trigger: 'change'
}
},
formArr: [
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.vehicleItemLibrary.nonConformanceTerm'),
dbFieldName: 'nonConformance'
},
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.vehicleItemLibrary.solutions'),
dbFieldName: 'countermeasures'
},
{
fieldShowType: 3,
dbFieldTxt: this.$t('projectLibrary.vehicleItemLibrary.estimatedDateOfCompletionOfRectification'),
dbFieldName: 'expectedTime'
}
]
},
// 待验证
'3': {
rules: {
// 风险点
riskPoints: {
required: true,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.vehicleItemLibrary.riskPoint'),
trigger: 'blur'
},
// 验证方案
validateSolution: {
required: true,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.vehicleItemLibrary.verificationScheme'),
trigger: 'blur'
},
// 预计整改完成日期
expectedTime: {
required: true,
message: this.$t('pleaseSelect') + this.$t('projectLibrary.vehicleItemLibrary.estimatedDateOfCompletionOfRectification'),
trigger: 'change'
}
},
formArr: [
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.vehicleItemLibrary.riskPoint'),
dbFieldName: 'riskPoints'
},
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.vehicleItemLibrary.verificationScheme'),
dbFieldName: 'validateSolution'
},
{
fieldShowType: 3,
dbFieldTxt: this.$t('projectLibrary.vehicleItemLibrary.estimatedDateOfCompletionOfRectification'),
dbFieldName: 'expectedTime'
}
]
},
// 不涉及
'4': {
rules: {
// 依据描述
description: {
required: true,
message: this.$t('pleaseEnter') + this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
trigger: 'blur'
}
},
formArr: [
{
fieldShowType: 1,
dbFieldTxt: this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
dbFieldName: 'description'
}
]
}
},
businessId: null,
isTransfer: false // 是否转办选人
}
},
computed: {
pageTitle () {
const subTitle = this.$route.query.taskName || ProjectComplianceEvaluationProcessNode.initiate.text
return `${this.$t('flowCenter')}${this.$route.meta.title}${subTitle}`
},
// 流程信息禁用
processInfoDisabled () {
return !(this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value && !this.$route.query.processInstanceId && this.currentStep !== 3)
},
// 节点显示的按钮
btnList () {
let btnList = ProjectComplianceEvaluationProcessNode.propertyOfValue('btn', this.currentNode) || ProjectComplianceEvaluationProcessNode.moduleOwnerApproval.btn
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value) {
switch (this.currentStep) {
case 0:
btnList = ['save', 'next']
break
case 1:
case 2:
btnList = ['save', 'pre', 'next']
break
case 3:
btnList = ['save', 'pre', 'submit']
break
default:
break
}
}
return btnList
},
// 流程信息展示的字段
processInfoShowField () {
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value) {
let fieldList = []
switch (this.currentStep) {
case 0:
fieldList = ['processName', 'processDueDate', 'processDescription']
break
case 1:
case 2:
fieldList = []
break
case 3:
fieldList = ['processName', 'processDueDate', 'processDescription', 'projectName', 'standardNumber']
break
default:
fieldList = []
break
}
return fieldList
}
return ['processName', 'processDueDate', 'processDescription', 'projectName', 'standardNumber']
},
comp () {
// 发起节点的第二步
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value && this.currentStep === 1) {
return resolve => require(['./components/ProjectTable.vue'], resolve)
}
// 发起节点第三步
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value && this.currentStep === 2) {
return resolve => require(['./components/StandardList.vue'], resolve)
}
return null
},
// 展示业务分派信息和流程审批信息的判断
showDispatchAndApprovalInfo () {
return !(this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value && this.currentStep !== 3)
},
// 业务分派信息部分表头
columns () {
console.log(this.currentNode)
// 法规工程师发起
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value) {
return this.basicColumns.concat([
// // 责任单位
// {
// title: this.$t('workCenter.projectComplianceEvaluationProcess.accountabilityUnit'),
// dataIndex: 'responsibleUnits',
// width: 150,
// scopedSlots: { customRender: 'depart' }
// },
// 责任单位负责人
{
title: this.$t('workCenter.projectComplianceEvaluationProcess.responsibleUnitHead'),
dataIndex: 'responsibleUnitLeaders',
width: 150,
scopedSlots: { customRender: 'user' }
},
// 操作
{
title: this.$t('operation'),
fixed: 'right',
width: 100,
scopedSlots: { customRender: 'action' }
}
])
}
// 各部门主管级领导下发
if (this.currentNode === ProjectComplianceEvaluationProcessNode.departLeaderIssued.value) {
return this.basicColumns.concat([
// 发起人
{
title: this.$t('workCenter.processCenter.initiator'),
dataIndex: 'depart',
width: 150
},
// 模块负责人
{
title: this.$t('workCenter.standardConsultationProcess.moduleOwner'),
dataIndex: 'moduleOwners',
width: 150,
scopedSlots: { customRender: 'moduleOwner' }
},
// 操作
{
title: this.$t('operation'),
fixed: 'right',
width: 120,
scopedSlots: { customRender: 'notInvolved' }
}
])
}
// 模块负责人分发
if (this.currentNode === ProjectComplianceEvaluationProcessNode.moduleOwnerIssued.value) {
return this.basicColumns.concat([
// 设计工程师
{
title: this.$t('workCenter.standardConsultationProcess.designEngineer'),
dataIndex: 'designEngineers',
width: 150,
scopedSlots: { customRender: 'designEngineers' }
},
// 操作
{
title: this.$t('operation'),
fixed: 'right',
width: 120,
scopedSlots: { customRender: 'notInvolved' }
}
])
}
// 设计工程师评估、模块负责人审批,及用户新增的审批节点都显示审批节点的表头
const showNode = [ProjectComplianceEvaluationProcessNode.designEngineerEvaluation.value, ProjectComplianceEvaluationProcessNode.moduleOwnerApproval.value, ProjectComplianceEvaluationProcessNode.moduleOwnerModification.value]
if (showNode.includes(this.currentNode) || !ProjectComplianceEvaluationProcessNode.keyOfValue(this.currentNode)) {
return this.basicColumns.concat([
// 上一节点处理人
{
title: this.$t('workCenter.projectComplianceEvaluationProcess.preNodePeople'),
dataIndex: 'previousNodeHandler',
width: 150,
align: 'center',
scopedSlots: { customRender: 'text' }
},
// 评估反馈
{
// 设计工程师评估节点是评估反馈,其他节点是评估结果
title: this.currentNode === ProjectComplianceEvaluationProcessNode.designEngineerEvaluation.value ? this.$t('workCenter.projectComplianceEvaluationProcess.evaluationFeedback') : this.$t('projectLibrary.vehicleItemLibrary.evaluationResult'),
dataIndex: 'evaluationFeedback_dictText',
width: 150,
align: 'center',
scopedSlots: { customRender: 'evaluationFeedback' }
}
])
}
// 法规工程师归档、各部门主管级领导审批
const nodes = [ProjectComplianceEvaluationProcessNode.regulatoryEngineerFiling.value, ProjectComplianceEvaluationProcessNode.departLeaderApproval.value]
if (nodes.includes(this.currentNode)) {
return this.basicColumns.concat([
// 评估人
{
title: this.$t('projectLibrary.vehicleItemLibrary.evaluator'),
dataIndex: 'assessorName',
width: 150,
align: 'center',
scopedSlots: { customRender: 'text' }
},
// 评估结果
{
title: this.$t('projectLibrary.vehicleItemLibrary.evaluationResult'),
dataIndex: 'evaluationFeedback_dictText',
width: 150,
align: 'center',
scopedSlots: { customRender: 'evaluationFeedback' }
}
])
}
return []
},
// 是否展示步骤条
showStep () {
return this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value
},
// 是否展示可展开表格
showExpandTable () {
// 设计工程师评估及之后节点都是
const showNode = [ProjectComplianceEvaluationProcessNode.designEngineerEvaluation.value, ProjectComplianceEvaluationProcessNode.moduleOwnerApproval.value, ProjectComplianceEvaluationProcessNode.departLeaderApproval.value, ProjectComplianceEvaluationProcessNode.regulatoryEngineerFiling.value, ProjectComplianceEvaluationProcessNode.moduleOwnerModification.value]
return showNode.includes(this.currentNode) || !ProjectComplianceEvaluationProcessNode.keyOfValue(this.currentNode)
},
// 展开表格的禁用
expandTableDisabled () {
return this.showExpandTable && this.currentNode !== ProjectComplianceEvaluationProcessNode.designEngineerEvaluation.value && this.currentNode !== ProjectComplianceEvaluationProcessNode.moduleOwnerModification.value
},
// 是否展示抄送人员
showCcPerson () {
return this.currentNode === ProjectComplianceEvaluationProcessNode.regulatoryEngineerFiling.value
},
// 转办、批量选人的用户弹窗类型
userSelectType () {
if (this.currentNode === ProjectComplianceEvaluationProcessNode.moduleOwnerIssued.value || this.isTransfer) {
return 'radio'
}
return 'checkbox'
},
// 中间部分的标题,评估节点:项目评估,分发节点:业务分派信息,其他节点:业务基本信息
middlePartTitle () {
// 分发节点
const dispatchNodes = [ProjectComplianceEvaluationProcessNode.initiate.value, ProjectComplianceEvaluationProcessNode.departLeaderIssued.value, ProjectComplianceEvaluationProcessNode.moduleOwnerIssued.value]
// 评估节点
const evaluationNodes = [ProjectComplianceEvaluationProcessNode.designEngineerEvaluation.value, ProjectComplianceEvaluationProcessNode.moduleOwnerModification.value]
if (dispatchNodes.includes(this.currentNode)) {
return this.$t('workCenter.dispatchInformation')
}
if (evaluationNodes.includes(this.currentNode)) {
return this.$t('workCenter.standardCompliance.projectAppraisal')
}
return this.$t('basicServiceInformation')
},
// 人员信息的当前节点,如果是模块负责人修改,在人员信息需要显示当前节点是模块负责人审批
personnelInfoCurrentNode () {
return this.currentNode === ProjectComplianceEvaluationProcessNode.moduleOwnerModification.value ? ProjectComplianceEvaluationProcessNode.moduleOwnerApproval.value : this.currentNode
}
},
created () {
if (this.$route.query.processInstanceId || this.$route.query.draftId) {
this.currentNode = this.$route.query.nodeId || ProjectComplianceEvaluationProcessNode.initiate.value
this.initProcessInfo()
} else {
this.currentNode = ProjectComplianceEvaluationProcessNode.initiate.value
}
this.getPersonInfoStructure(ProcessKey.PROJECT_COMPLIANCE_EVALUATION.value, () => {
this.initPersonInfoData(this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value)
})
},
methods: {
/**
* 获取流程数据
*/
initProcessInfo () {
const params = {
draftId: this.$route.query.draftId,
processInstanceId: this.$route.query.draftId ? null : this.$route.query.processInstanceId,
taskId: this.$route.query.taskId
}
this.loading = true
queryProjectComplianceEvaluation(params).then(res => {
if (res.success) {
const { result = {} } = res
this.approvalInfo = Object.assign({}, result.basicTaskInfoDTO)
// 如果是草稿,会从json里取数据
if (this.$route.query.draftId) {
const draftResult = JSON.parse(result.infoJsonStr)
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value) {
// 步骤条回显
this.currentStep = draftResult.currentStep
// 项目信息
this.projectDataSource = draftResult.projectList
// 标准信息
this.standardDataSource = draftResult.standardList
// 业务分派信息
this.dataSource = draftResult.dispatchList
}
// 流程审批信息
this.approvalInfo = Object.assign({}, draftResult.approvalInfo)
} else {
// 项目、标准信息回显
this.projectDataSource = [result.businessInfoDTO.processProjectAssess]
this.standardDataSource = result.businessInfoDTO.processProjectAssessLinkList || []
const dataList = result.businessInfoDTO.processProjectAssessTermList || []
this.dataSource = dataList.map((item, index) => {
item.tableRowKey = index
return item
})
}
// 流程信息
this.processInfo = Object.assign({}, result.basicProcessInfoDTO)
this.businessId = result.businessId
this.$nextTick(() => {
if (this.processInfoForm) {
this.processInfoForm.setFieldsValue(this.processInfo)
}
if (this.approvalInfoForm) {
this.approvalInfoForm.setFieldsValue(this.approvalInfo)
}
})
}
}).finally(() => {
this.loading = false
})
},
/**
* 上一步
*/
handleLastStep () {
this.currentStep--
},
/**
* 下一步
*/
handleNextStep () {
let flag = true
// 第一步,填写流程信息
if (this.currentStep === 0) {
this.processInfoForm.validateFields(this.processInfoShowField, (errors, values) => {
if (errors) {
flag = false
} else {
this.processInfo = Object.assign(this.processInfo, values)
}
})
}
// 第二步选择项目
if (this.currentStep === 1) {
this.projectDataSource = this.$refs.projectStandardTable.getData()
if (!this.projectDataSource || this.projectDataSource.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
flag = false
} else {
this.projectId = this.projectDataSource[0].id
}
}
// 第三步选择标准
if (this.currentStep === 2) {
this.standardDataSource = this.$refs.projectStandardTable.getData()
console.log(this.standardDataSource)
if (!this.standardDataSource || this.standardDataSource.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
flag = false
} else {
this.getDispatchList()
}
}
if (!flag) {
return
}
this.currentStep++
},
/**
* 获取业务分派信息列表
*/
getDispatchList () {
const params = this.standardDataSource.map(item => {
return {
sarFileSplitInfoId: item.sarFileSplitInfoId,
standardId: item.standardId,
standardNumber: item.standardNumber,
standardName: item.standardName
}
})
queryStandardClauseList(params).then(res => {
if (res.success) {
const data = res.result || []
this.dataSource = data.map((item, index) => {
item.tableRowKey = index
return item
})
}
})
},
/**
* 跳转项目详情
*/
toProjectDetail (project) {
this.$router.push({
path: '/projectLibrary/VehicleItemLibraryDetail',
query: {
id: project.id || project.projectId,
projectName: project.projectName
}
})
},
/**
* 跳转标准详情
*/
toStandardDetail ({ source, standardId }) {
let path
// 根据来源跳转不同的详情页
switch (source) {
// 国内
case StandardSource.DOMESTIC.value:
path = '/standardRegulationLibrary/DomesticStandardDetail'
break
// 海外
case StandardSource.OVERSEAS.value:
path = '/standardRegulationLibrary/OverseasStandardDetail'
break
// 企标
case StandardSource.ENTERPRISE.value:
path = '/enterpriseStandardLibrary/enterpriseStandardDetail'
break
default:
break
}
if (!path) {
return
}
const query = {
id: standardId
}
this.$openPageNewSheet({
path, query
})
},
/**
* 批量选择人员
*/
batchSelector () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectOne'))
return
}
this.isTransfer = false
this.$refs.userSelectModal.open()
},
handleBatchSelectorOk (list) {
// 转办不走这个方法
if (this.isTransfer) {
return
}
let fieldName
switch (this.currentNode) {
// 发起节点,批量选择的是责任单位负责人
case ProjectComplianceEvaluationProcessNode.initiate.value:
fieldName = 'responsibleUnitLeaders'
break
// 各部门主管级领导下发,批量选择的是模块负责人
case ProjectComplianceEvaluationProcessNode.departLeaderIssued.value:
fieldName = 'moduleOwners'
break
// 模块负责人分发,批量选择的是设计工程师
case ProjectComplianceEvaluationProcessNode.moduleOwnerIssued.value:
fieldName = 'designEngineers'
break
default:
break
}
if (!fieldName) {
return
}
this.dataSource.forEach((item, index) => {
// 给可选人的数据赋值
if (this.selectedRowKeys.includes(index) && item.canAssignFlag + '' === '1') {
item[fieldName] = list.map(tt => tt.id).join(',')
item[fieldName + '_dictText'] = list.map(tt => tt.realname + '(' + tt.username + ')').join(',')
this.$set(this.dataSource, index, item)
}
})
console.log(this.dataSource)
this.selectedRowKeys = []
},
onSelectChange (selectedRowKeys) {
console.log(selectedRowKeys)
this.selectedRowKeys = selectedRowKeys
},
/**
* 选择部门
* @param value
* @param record
* @param index
*/
handleDepartChange (value, record, index) {
record.responsibleUnits = value
this.$set(this.dataSource, index, record)
},
/**
* 选择用户
* @param list
* @param record
* @param index
* @param fieldName
*/
handleUserChange (list, record, index, fieldName) {
record[fieldName] = list.map(tt => tt.id).join(',')
record[fieldName + '_dictText'] = list.map(tt => tt.realname + '(' + tt.username + ')').join(',')
},
/**
* 删除
* @param rowKey
*/
handleDelete (rowKey) {
const index = this.dataSource.findIndex(tt => tt.tableRowKey === rowKey)
if (index !== -1) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
this.dataSource.splice(index, 1)
}
})
}
},
/**
* 不涉及
* @param record
*/
handleUninvolved (record) {
this.$refs.uninvolvedModal.open(record, record.tableRowKey)
},
handleUninvolvedOk (record, index) {
this.$set(this.dataSource, index, record)
},
/**
* 评估反馈修改
* @param value
* @param record
* @param index
*/
handleEvaluationFeedBackChange (value, record, index) {
record.evaluationFeedback = 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)
},
dealFormData () {
let formData = {}, basicTaskInfoDTO = {}, flag = true
// 流程信息
formData.basicProcessInfoDTO = { ...this.processInfo }
// 发起节点需要多传一些参数
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value) {
let processProjectAssess = {}, processProjectAssessLinkList = [], processProjectAssessTermList = []
// 项目信息(发起第二步)
if (this.projectDataSource && this.projectDataSource.length > 0) {
processProjectAssess.projectId = this.projectDataSource[0].id
}
// 关联标准列表(发起第三步)
processProjectAssessLinkList = JSON.parse(JSON.stringify(this.standardDataSource))
// 关联条款列表(发起第四步)
processProjectAssessTermList = JSON.parse(JSON.stringify(this.dataSource))
// 校验责任单位负责人必填
if (processProjectAssessTermList.some(tt => !tt.responsibleUnitLeaders && tt.canAssignFlag + '' === '1')) {
this.$message.warning(this.$t('workCenter.projectComplianceEvaluationProcess.pleaseSelectResponsibleUnitLeader'))
flag = false
}
formData.businessInfoDTO = {
processProjectAssess, processProjectAssessLinkList, processProjectAssessTermList
}
} else {
// 设计工程师评估节点,expand-table校验
if ((this.currentNode === ProjectComplianceEvaluationProcessNode.designEngineerEvaluation.value || this.currentNode === ProjectComplianceEvaluationProcessNode.moduleOwnerModification.value) && !this.$refs.expandTable.submit()) {
this.$message.warning(this.$t('workCenter.checkTableRequired'))
flag = false
}
const data = JSON.parse(JSON.stringify(this.dataSource))
formData.businessInfoDTO = {
processProjectAssessTermList: data
}
// 各部门主管级领导下发,校验模块负责人必填
if (this.currentNode === ProjectComplianceEvaluationProcessNode.departLeaderIssued.value) {
if (data.some(tt => !tt.moduleOwners && !tt.notInvolved && tt.canAssignFlag + '' === '1')) {
this.$message.warning(this.$t('workCenter.projectComplianceEvaluationProcess.pleaseSelectModuleOwner'))
flag = false
}
}
}
// 流程审批意见数据
this.approvalInfoForm.validateFields((errors, values) => {
if (!errors) {
basicTaskInfoDTO = Object.assign(this.approvalInfo, values)
basicTaskInfoDTO.taskId = basicTaskInfoDTO.taskId || this.$route.query.taskId
} else {
flag = false
this.$message.warning(this.$t('pleaseEnterRemarks'))
}
})
// 抄送人员校验
if (this.showCcPerson) {
this.dispatchInfoForm.validateFields((errors, values) => {
if (!errors) {
formData.businessInfoDTO.carbonCopyPersonnels = values.carbonCopyPersonnels
} else {
flag = false
}
})
}
formData.basicTaskInfoDTO = basicTaskInfoDTO
formData.businessId = this.businessId
if (!flag) {
return false
}
return formData
},
/**
* 保存
*/
handleSave () {
const formData = {}
// 流程信息
const processInfo = Object.assign(this.processInfo, this.processInfoForm.getFieldsValue())
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value) {
// 记录当前在哪一步
formData.currentStep = this.currentStep
// 项目列表
if (this.currentStep === 1) {
formData.projectList = this.$refs.projectStandardTable.getData()
} else {
formData.projectList = this.projectDataSource
}
// 标准列表
if (this.currentStep === 2) {
formData.standardList = this.$refs.projectStandardTable.getData()
} else {
formData.standardList = this.standardDataSource
}
}
// 分发列表
formData.dispatchList = this.dataSource
// 流程审批信息
formData.approvalInfo = Object.assign(this.approvalInfo, this.approvalInfoForm.getFieldsValue())
const params = {
infoJsonStr: JSON.stringify(formData),
basicProcessInfoDTO: processInfo,
draftId: this.$route.query.draftId
}
console.log(params)
this.loading = true
saveProjectComplianceEvaluation(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 提交
*/
handleSubmit () {
const formData = this.dealFormData()
if (!formData) {
return
}
let submitFunc
// 发起和提交的接口判断
if (this.currentNode === ProjectComplianceEvaluationProcessNode.initiate.value) {
submitFunc = initiateProjectComplianceEvaluation
} else {
submitFunc = submitProjectComplianceEvaluation
}
if (!submitFunc) {
return
}
this.loading = true
submitFunc(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 转办
*/
handleTurnTo () {
this.isTransfer = true
this.$refs.userSelectModal.open()
},
continueTransfer (userId) {
if (!this.isTransfer) {
return
}
const params = {
taskId: this.$route.query.taskId,
userId
}
this.loading = true
processTransfer(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 同意
*/
handleAgree () {
this.validatorRules.handleText.rules[0].required = false
if (!this.approvalInfoForm.getFieldValue('handleText')) {
this.approvalInfoForm.setFieldsValue({ handleText: '同意' })
}
const formData = this.dealFormData()
if (!formData) {
return
}
this.loading = true
agreeProjectComplianceEvaluation(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 驳回
*/
handleReject () {
this.validatorRules.handleText.rules[0].required = true
const formData = this.dealFormData()
if (!formData) {
return
}
this.loading = true
rejectProjectComplianceEvaluation(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
handleTableChange (pagination) {
this.ipagination = pagination
},
showContent (text) {
this.$refs.clauseDetail.open(text)
}
},
beforeRouteLeave (to, form, next) {
// 跳转项目详情就不销毁
if (to.path !== '/projectLibrary/VehicleItemLibraryDetail') {
this.$destroy()
}
next()
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
/deep/ .ant-steps-item-process > .ant-steps-item-container > .ant-steps-item-content > .ant-steps-item-title {
color: @primary-color;
}
/deep/ .ant-steps-item-wait > .ant-steps-item-container > .ant-steps-item-content > .ant-steps-item-title {
color: #4E5969;
}
/deep/ .ant-steps-item-wait .ant-steps-item-icon {
background: #F2F3F5;
border-color: transparent;
}
/deep/ .ant-steps-item-wait .ant-steps-item-icon > .ant-steps-icon {
font-weight: 600;
color: #4E5969;
}
/deep/ .user-input {
width: 100% !important;
}
.dispatch-form {
margin-top: 20px;
}
</style>