add 标准法规入库/变更流程

This commit is contained in:
赵霄
2023-11-08 18:11:14 +08:00
parent a66a3e3ec7
commit 67e073c600
5 changed files with 398 additions and 110 deletions
+11 -1
View File
@@ -133,6 +133,13 @@ const enStandardStartUseReject = (params) => postAction('', params)
const toDoTurnTo = (params) => postAction('', params)
// 已发-强制撤回
const compulsoryWithdrawal = (params) => postAction('', params)
/*标准法规入库/变更流程*/
// 发起
const initiateStandardECProcess = (params) => postAction('/process/fb/processFbEntryChange/startProcess', params)
// 保存
const saveStandardECProcess = (params) => postAction('/process/fb/processFbEntryChange/saveToDraft', params)
export {
getProcessNodeList,
@@ -200,5 +207,8 @@ export {
enStandardStartUseReject,
toDoTurnTo,
compulsoryWithdrawal
compulsoryWithdrawal,
initiateStandardECProcess,
saveStandardECProcess
}
-1
View File
@@ -28,7 +28,6 @@
<div class="personnel-container-content">
<div class="personnel-container-content-text">
<template v-if="step.canChoose && index >= currentNodeIndex">
<!-- TODO 数据库设计确定后处理数据抛出格式-->
<user-select-by-work-group v-if="step.chooseSource === 'workGroup'" v-model="step.linkUserIds" :type="step.chooseType" :name-str="step.linkUserIds_dictText" input-type="textarea"/>
<user-select-by-contact v-else-if="step.chooseSource === 'contactManage'" v-model="step.linkUserIds" :type="step.chooseType" :name-str="step.linkUserIds_dictText" input-type="textarea"/>
<user-selection v-else-if="step.chooseSource === 'user'" :type="step.chooseType" v-model="step.linkUserIds" :name-str="step.linkUserIds_dictText" input-type="textarea" />
+1 -1
View File
@@ -299,7 +299,7 @@ export default {
}
},
watch: {
// 国内、海外的零部件名称、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
// 国内的零部件名称、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
'formInline.standard_property' () {
this.handleDomesticSpecialCheck()
},
+8 -2
View File
@@ -175,6 +175,12 @@ export const StandardizedActivityType = new EsEnums({
// 支付状态
export const PayState = new EsEnums({
已支付: { text: '已支付', value: '1' },
未支付: { text: '未支付', value: '2' }
havePaid: { text: '已支付', value: '1' },
nonPayment: { text: '未支付', value: '2' }
})
// 标准法规入库/变更流程
export const FGEntryChangeProcessNode = {
initiate: { text: '法规工程师发起', value: '1', btn: ['save', 'submit'] },
approve: { text: '审批', value: '2', btn: ['return', 'save', 'agree', 'reject'] }
}
@@ -1,5 +1,5 @@
<template>
<internal-detail-page :title="pageTitle" :content-padding="0">
<internal-detail-page :title="pageTitle" :content-padding="0" :loading="loading">
<!-- 标题右侧tab -->
<template v-slot:titleRightCustom>
<div class="table-operator-tab">
@@ -26,7 +26,7 @@
@change="event => event.target.value = event.target.value.trim()"
:maxLength="50"
disabled
v-decorator="['nodeName']" />
v-decorator="['processName']" />
</a-form-item>
</a-col>
<a-col :span="12">
@@ -37,6 +37,7 @@
:getCalendarContainer="(trigger) => trigger.parentNode"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
v-decorator="['processDueDate']"
style="width: 100%" />
</a-form-item>
</a-col>
@@ -47,13 +48,13 @@
@change="event => event.target.value = event.target.value.trim()"
:maxLength="500"
type="textarea"
v-decorator="['nodeName']" />
v-decorator="['processDescription']" />
</a-form-item>
</a-form>
<!--业务基本信息-->
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<a-form-model :model="basicFormInfo" v-if="isFormInline" class="form-add" :rules="rules" ref="ruleForm">
<a-form-model :model="formInline" v-if="isFormInline" class="form-add" :rules="rules" ref="ruleForm">
<template v-for="(val,index) in formList">
<div :key="index"
class="collapsible-panel-form"
@@ -75,7 +76,7 @@
</div>
<a-form-model-item class="item-model" prop="source">
<j-dict-select-tag class="box-input"
v-model="basicFormInfo.source"
v-model="formInline.source"
:disabled="disabled || disabledFieldList.includes('source')"
:placeholder="$t('pleaseSelect')+$t('standardSelect.source')"
:type="'select'"
@@ -92,7 +93,7 @@
</div>
<a-form-model-item class="item-model" prop="operationType">
<j-dict-select-tag class="box-input"
v-model="basicFormInfo.operationType"
v-model="formInline.operationType"
:disabled="disabled || disabledFieldList.includes('operationType')"
:placeholder="$t('pleaseSelect')+$t('log.operationType')"
:type="'select'"
@@ -111,20 +112,23 @@
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName" v-if="item.dbFieldName === 'standard_number_temp'">
<a-form-model-item class="item-model"
:prop="item.dbFieldName"
v-if="item.dbFieldName === 'standard_number_temp'">
<!--标准单选-->
<standard-selection v-if="basicFormInfo.operationType === OperationType.CHANGE.value"
:source="basicFormInfo.source"
<standard-selection v-if="formInline.operationType === OperationType.CHANGE.value"
:source="formInline.source"
:disabledSourceSearch="true"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
type="radio"
:placeholder="$t('pleaseEnter')+item.dbFieldTxt"
v-model="basicFormInfo[item.dbFieldName]" />
v-model="formInline[item.dbFieldName]"
@listChange="handleStandardChange" />
<!--文本框-->
<a-input v-else
class="box-input"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:maxLength="50"
@change="event => event.target.value = event.target.value.trim()"
:placeholder="specialPlaceholder[item.dbFieldName] || $t('pleaseEnter')+item.dbFieldTxt" />
@@ -137,26 +141,26 @@
:getCalendarContainer="(trigger) => trigger.parentNode"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
style="width: 100%" />
<!-- 2, 单选用户 -->
<user-selection v-else-if="item.fieldShowType === FieldType.USER_SINGLE.value"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:filedName="item.dbFieldName"
@nameChange="userSelectNameChange"
:nameStr="basicFormInfo[item.dbFieldName + '_dictText']"
:nameStr="formInline[item.dbFieldName + '_dictText']"
type="radio"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)" />
<!-- 3, 单选组织机构 -->
<j-select-depart v-else-if="item.fieldShowType === FieldType.ORGAN_SINGLE.value"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:backDepart="true" />
<!-- 4, 日期多选 -->
<j-multiple-date-picker v-else-if="item.fieldShowType === FieldType.DATE_MORE.value"
class="box-input"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:fieldName="item.dbFieldName"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)" />
<!-- 5, 多行文本 -->
@@ -164,16 +168,18 @@
:placeholder="$t('pleaseEnter')+item.dbFieldTxt"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:maxLength="500"
v-model="basicFormInfo[item.dbFieldName]" :rows="4" />
v-model="formInline[item.dbFieldName]" :rows="4" />
<!-- 6, 标准多选 -->
<standard-selection v-else-if="item.fieldShowType === FieldType.STANDARD_MORE.value"
:source="basicFormInfo.source"
:source="formInline.source"
:disabledSourceSearch="true"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="basicFormInfo[item.dbFieldName]" />
:exclude-standard-numbers="excludeStandardFields.includes(item.dbFieldName) ? excludeStandardNumbers : null"
v-model="formInline[item.dbFieldName]" />
<!-- 7, 多选组织机构 -->
<j-select-depart v-else-if="item.fieldShowType === FieldType.ORGAN_MORE.value"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:multi="true"
:backDepart="true"
:treeOpera="true" />
@@ -181,8 +187,8 @@
<a-button v-else-if="item.fieldShowType === FieldType.FILE_UP.value" type="primary" class="button-text"
@click="clickButtonToUpload(item)">
{{
(basicFormInfo[item.dbFieldName] === 'null' || basicFormInfo[item.dbFieldName] === ''
|| basicFormInfo[item.dbFieldName] === null || basicFormInfo[item.dbFieldName] === undefined)
(formInline[item.dbFieldName] === 'null' || formInline[item.dbFieldName] === ''
|| formInline[item.dbFieldName] === null || formInline[item.dbFieldName] === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
@@ -191,14 +197,14 @@
<a-input v-else-if="item.fieldShowType === FieldType.TEXT_BOX.value"
class="box-input"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="basicFormInfo[item.dbFieldName]"
:maxLength="50"
v-model.trim="formInline[item.dbFieldName]"
:maxLength="item.dbLength"
@change="event => event.target.value = event.target.value.trim()"
:placeholder="specialPlaceholder[item.dbFieldName] || $t('pleaseEnter')+item.dbFieldTxt" />
<!-- 10, 下拉单选数据字典 -->
<j-dict-select-tag v-else-if="item.fieldShowType === FieldType.OPTION_SINGLE.value"
class="box-input"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
:type="'select'"
@@ -207,7 +213,7 @@
<!-- 11, 下拉多选数据字典 -->
<j-multi-select-tag v-else-if="item.fieldShowType === FieldType.OPTION_MORE.value"
class="box-input"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
:type="'select'"
@@ -216,7 +222,7 @@
<!-- 12, 树选择 -->
<a-tree-select
v-else-if="item.fieldShowType === FieldType.TREE.value"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
style="width: 100%"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
@@ -229,19 +235,29 @@
<j-date v-else-if="item.fieldShowType === FieldType.YEAR_PICKER.value"
show-type="year"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:default-value="defaultValue[item.dbFieldName]"
date-format="YYYY"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt" />
<!-- 15, 树选择单选 -->
<a-tree-select v-else-if="item.fieldShowType === FieldType.TREE_SINGLE.value"
v-model="basicFormInfo[item.dbFieldName]"
v-model="formInline[item.dbFieldName]"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
style="width: 100%"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:tree-data="optionsData[item.dbFieldName]"
:label-in-value="false"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt" />
<!--16树形弹框选择-->
<tree-selection v-else-if="item.fieldShowType === FieldType.TREE_MODAL_SELECT.value"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
v-model="formInline[item.dbFieldName]"
@nameChange="treeSelectNameChange"
:filedName="item.dbFieldName"
type="radio"
:nameStr="formInline[item.dbFieldName + '_dictText']"
:dict-id="item.dictId"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)" />
</a-form-model-item>
</div>
</template>
@@ -259,11 +275,11 @@
@change="event => event.target.value = event.target.value.trim()"
:maxLength="500"
type="textarea"
v-decorator="['remarks']" />
v-decorator="['handleText']" />
</a-form-item>
<!--附件-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('businessSupport.questionAnswer.attach')">
<j-upload v-decorator="['file']" return-id />
<j-upload v-decorator="['handleFile']" return-id />
</a-form-item>
</a-form>
</div>
@@ -271,21 +287,31 @@
<div class="detail-page-scroll-content p-0" v-show="switchValue === 'user'">
<process-detail-list>
<template #personnelInfo>
<personnel-info :data="personalInfoData" />
<personnel-info ref="personnelInfo" :data="personnelInfoData" />
</template>
</process-detail-list>
</div>
<div class="detail-page-bottom-operate-box">
<!--转办 审批节点存在-->
<a-button type="primary" :loading="loading" ghost icon="arrow-up" @click="handleTurnTo">{{ $t('turnTo') }}</a-button>
<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 @click="handleSave"><i class="iconfont icon-save" />{{ $t('preservation') }}</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" icon="upload">{{ $t('submit') }}</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" @click="handleSubmit">{{ $t('agree') }}</a-button>
<a-button type="primary" :loading="loading" icon="check-circle" v-if="btnList.includes('agree')" @click="handleSubmit">
{{ $t('agree') }}
</a-button>
<!--驳回 审批节点存在-->
<a-button type="primary" :loading="loading" icon="close-circle" @click="handleSubmit">{{ $t('reject') }}</a-button>
<a-button type="primary" :loading="loading" icon="close-circle" v-if="btnList.includes('reject')" @click="handleSubmit">
{{ $t('reject') }}
</a-button>
</div>
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false"></upload-file>
@@ -297,8 +323,20 @@
<script>
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import { FieldType, StandardSource, OperationType } from '../../../enums/commonEnums.js'
import { getDomesticStandardDocumentInfo, getDomesticStandardFormModal, getOverseasStandardForm } from '../../../api/standardRegulationLibraryApi.js'
import {
FieldType,
StandardSource,
OperationType,
StandardProperty,
ProcessKey,
FGEntryChangeProcessNode
} from '../../../enums/commonEnums.js'
import {
getDomesticStandardDocumentInfo,
getDomesticStandardFormModal,
getOverseasStandardForm,
getOverseasStandardDocumentInfo
} from '../../../api/standardRegulationLibraryApi.js'
import { getAction } from '../../../api/manage.js'
import { ajaxGetDictItems, getFormDictTreeList } from '../../../api/api.js'
import JMultipleDatePicker from '../../../components/JMultipleDatePicker.vue'
@@ -308,6 +346,9 @@ import UploadFile from '../../../components/UploadFile.vue'
import PersonnelInfo from '../../../components/PersonnelInfo.vue'
import ProcessDetailList from '../../../components/ProcessDetailList.vue'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
import TreeSelection from '../../../components/selection/TreeSelection'
import { initiateStandardECProcess, saveStandardECProcess } from '../../../api/workCenter'
import { WorkCenterMixin } from '../../../mixins/WorkCenterMixin'
export default {
name: 'StandardEntryOrChangeProcess',
@@ -319,8 +360,10 @@ export default {
JMultipleDatePicker,
InternalDetailPage,
ProcessDetailList,
UserSelectModal
UserSelectModal,
TreeSelection
},
mixins: [WorkCenterMixin],
data () {
return {
FieldType,
@@ -343,8 +386,7 @@ export default {
},
// 流程信息表单
processInfoForm: this.$form.createForm(this),
getFormFunc: getDomesticStandardFormModal,
getDocumentInfoFunc: getDomesticStandardDocumentInfo,
processInfo: {},
// 特殊的placeholder
specialPlaceholder: {
standard_number_temp: `${this.$t('standardRegulationLibrary.inputExample')}7258`
@@ -362,60 +404,20 @@ export default {
isFormInline: false,
rules: {},
// 业务基本信息表单
basicFormInfo: {},
formInline: {},
// 需要隐藏的字段
hiddenFieldList: [],
disabled: false,
uploadName: '',
sourceOptions: [],
// 审批信息的表单
approvalInfoForm: this.$form.createForm(this),
approvalInfo: {},
loading: false,
switchValue: 'base',
personalInfoData: [ // 人员信息的数据
{
id: 1,
nodeName: '主起草人发起',
nodeRoleName: '发起人',
canChoose: false
},
{
id: 2,
nodeName: '部所联络人校对',
nodeRoleName: '部所联络人',
canChoose: true,
chooseType: 'radio',
chooseSource: 'contactManage'
},
{
id: 3,
nodeName: '专家审批',
nodeRoleName: '专家',
canChoose: true,
chooseType: 'checkbox',
chooseSource: 'workGroup'
},
{
id: 4,
nodeName: '发起人主管级领导审批',
nodeRoleName: '发起人主管级领导',
canChoose: true,
chooseType: 'radio'
}
// {
// id: 5,
// nodeName: '发起人主管级上级领导审批',
// nodeRoleName: '发起人主管级上级领导',
// canChoose: true,
// chooseType: 'radio'
// },
// {
// id: 6,
// nodeName: '标准化审批',
// nodeRoleName: '标准化',
// canChoose: true,
// chooseType: 'radio'
// }
]
excludeStandardNumbers: null,
currentNode: null,
btnList: [] // 拥有的按钮
}
},
computed: {
@@ -424,22 +426,43 @@ export default {
},
// 不可编辑的字段
disabledFieldList () {
if (this.isEdit) {
// 标准法规变更
if (this.formInline.operationType === OperationType.CHANGE.value) {
// 标准编号,被代替标准号,被引用标准号,标准类别,年代号
return ['standard_number_temp', 'replaced_by_standard_number', 'referenced_standard', 'standard_class', 'year_number']
return ['standard_name', 'replaced_by_standard_number', 'referenced_standard', 'standard_class', 'year_number']
}
return ['replaced_by_standard_number', 'referenced_standard']
},
// 不能包含当前标准的字段
excludeStandardFields () {
if (this.formInline.operationType === OperationType.CHANGE.value) {
return ['substitute_standard_number', 'reference_standard']
}
return []
}
},
watch: {
// 国内的零部件名称、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
'formInline.standard_property' () {
this.handleDomesticSpecialCheck()
}
},
created () {
if (this.$route.query.id) {
this.disabled = true
} else {
this.currentNode = FGEntryChangeProcessNode.initiate.value
this.btnList = FGEntryChangeProcessNode.initiate.btn
}
this.getSourceOptions()
// 默认选中国内
this.initDomesticStandardForm()
this.getPersonInfoStructure(ProcessKey.FB_ENTRY_CHANGE.value)
},
methods: {
/**
* 数据字典值获取
*/
getSourceOptions () {
ajaxGetDictItems('standard_source').then(res => {
if (res.success) {
@@ -455,35 +478,44 @@ export default {
module: StandardSource.DOMESTIC.value,
type: 2 // 2是新增;1是详情
}
this.basicFormInfo = {}
this.formInline = {}
this.loading = true
getDomesticStandardFormModal(params).then(res => {
if (res.success) {
this.formList = res.result || {}
this.formListArr = Object.values(this.formList).reduce((acc, cur) => acc.concat(cur), [])
this.formPartList = Object.keys(this.formList)
this.basicFormInfo.source = StandardSource.DOMESTIC.value
this.formInline.source = StandardSource.DOMESTIC.value
this.getOptionsData() // 处理通过接口获取的下拉数据
this.integrateData() // 处理表单验证
this.initRetractableFlag() // 处理面板展开
}
}).finally(() => {
this.loading = false
})
},
/**
* 获取海外标准的表单
*/
initOverseasStandardForm () {
this.loading = true
const params = {
module: StandardSource.OVERSEAS.value,
type: 2 // 2是新增;1是详情
}
this.basicFormInfo = {}
this.formInline = {}
getOverseasStandardForm(params).then(res => {
if (res.success) {
this.formList = res.result || {}
this.formListArr = Object.values(this.formList).reduce((acc, cur) => acc.concat(cur), [])
this.formPartList = Object.keys(this.formList)
this.basicFormInfo.source = StandardSource.OVERSEAS.value
this.formInline.source = StandardSource.OVERSEAS.value
this.getOptionsData() // 处理通过接口获取的下拉数据
this.integrateData() // 处理表单验证
this.initRetractableFlag() // 处理面板展开
}
}).finally(() => {
this.loading = false
})
},
/**
@@ -570,14 +602,14 @@ export default {
* @param fieldName
*/
userSelectNameChange (value, fieldName) {
this.basicFormInfo[fieldName + '_dictText'] = value
this.formInline[fieldName + '_dictText'] = value
},
/**
* 点击点击上传按钮
* @param item
*/
clickButtonToUpload (item) {
this.$refs.uploadFile.open(this.basicFormInfo[item.dbFieldName])
this.$refs.uploadFile.open(this.formInline[item.dbFieldName])
this.uploadName = item.dbFieldName
},
/**
@@ -592,14 +624,14 @@ export default {
})
}
/** 赋值给当前对应的表单文件 */
this.basicFormInfo[this.uploadName] = attIdList.join(',')
this.basicFormInfo = { ...this.basicFormInfo }
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
},
/**
* 来源变更,重新获取表单
*/
handleSourceChange () {
switch (this.basicFormInfo.source) {
switch (this.formInline.source) {
case StandardSource.DOMESTIC.value:
this.initDomesticStandardForm()
break
@@ -607,28 +639,128 @@ export default {
this.initOverseasStandardForm()
break
default:
this.basicFormInfo.source = StandardSource.DOMESTIC.value
this.formInline.source = StandardSource.DOMESTIC.value
this.initDomesticStandardForm()
break
}
},
handleOperationTypeChange () {
console.log(this.basicFormInfo.operationType)
/**
* 操作类型变化
*/
handleOperationTypeChange (value) {
this.$refs.ruleForm.clearValidate()
this.formInline = {
source: this.formInline.source
}
this.formInline.operationType = value
},
switchChange (value) {
this.switchValue = value
},
/**
* 处理页面的数据
*/
dealFormData () {
const formData = {}
let flag = true
// 处理流程信息
this.processInfoForm.validateFields((errors, values) => {
if (!errors) {
formData.basicProcessInfoDTO = Object.assign(this.processInfo, values)
} else {
flag = false
}
formData.basicProcessInfoDTO = Object.assign(this.processInfo, values)
})
// 处理业务信息
this.$refs.ruleForm.validate(valid => {
if (valid) {
formData.businessInfoDTO = this.dealBusinessData({ ...this.formInline })
} else {
flag = false
}
})
// 处理流程审批信息
this.approvalInfoForm.validateFields((errors, values) => {
if (!errors) {
formData.basicTaskInfoDTO = Object.assign(this.approvalInfo, values)
} else {
flag = false
}
})
// 处理人员信息
const userInfo = this.$refs.personnelInfo.getDataObjVerify()
if (!userInfo) {
flag = false
} else {
formData.userInfoMap = userInfo
}
if (flag) {
return formData
}
return flag
},
dealBusinessData (data) {
// 下划线转驼峰
const toHump = (name) => {
return name.replace(/\_(\w)/g, function (all, letter) {
return letter.toUpperCase()
})
}
const resultData = {}
Object.keys(data).forEach(key => {
const newKey = toHump(key)
resultData[newKey] = data[key]
})
return resultData
},
/**
* 保存
*/
handleSave () {
const formData = {
basicProcessInfoDTO: Object.assign(this.processInfo, this.processInfoForm.getFieldsValue()), // 流程信息
businessInfoDTO: this.dealBusinessData({ ...this.formInline }), // 业务信息
basicTaskInfoDTO: Object.assign(this.approvalInfo, this.approvalInfoForm.getFieldsValue()), // 流程审批信息
userInfoMap: this.$refs.personnelInfo.getDataObj() // 用户信息
}
const params = { ...formData.basicProcessInfoDTO, ...formData.businessInfoDTO, ...formData.basicTaskInfoDTO }
if (!Object.values(params).some(tt => !!tt || tt === 0)) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
this.loading = true
saveStandardECProcess(formData).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
}
this.loading = true
initiateStandardECProcess(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 转办
@@ -638,6 +770,143 @@ export default {
},
continueTurnTo () {
},
treeSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_dictText'] = value
},
/**
* 标准变化
* @param list
*/
handleStandardChange (list) {
if (this.formInline.operationType === OperationType.CHANGE.value && list && list.length > 0) {
const standardId = list[0].id
switch (this.formInline.source) {
case StandardSource.DOMESTIC.value:
this.initDomesticFormData(standardId)
break
case StandardSource.OVERSEAS.value:
this.initOverseasFormData(standardId)
break
default:
break
}
}
},
/**
* 获取国内标准表单数据
* @param id
*/
initDomesticFormData (id) {
this.loading = true
getDomesticStandardDocumentInfo({ id, type: 2 }).then(res => {
if (res.success) {
// 处理树结构多选回显
console.log(this.da)
const formList = Object.values(this.formList).reduce((acc, cur) => acc.concat(cur), [])
const treeMultipleField = formList.filter(tt => tt.fieldShowType === FieldType.TREE.value)
const data = res.result || {}
treeMultipleField.forEach(field => {
const valueArr = []
if (data[field.dbFieldName]) {
const values = data[field.dbFieldName].split(',')
for (let i = 0; i < values.length; i++) {
valueArr[i] = {
value: values[i]
}
}
data[field.dbFieldName] = valueArr
} else {
data[field.dbFieldName] = undefined
}
})
const dictField = formList.filter(tt => tt.fieldShowType === FieldType.OPTION_SINGLE.value)
dictField.forEach(field => {
data[field.dbFieldName] = data[field.dbFieldName] || null
})
this.formInline = Object.assign({ ...this.formInline }, { ...data })
// 处理标准选择不能选自己
this.excludeStandardNumbers = this.formInline.standard_number
this.handleDomesticSpecialCheck()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 国内的特殊处理
*/
handleDomesticSpecialCheck () {
const fieldNameList = ['part_name', 'applicable_certification', 'applicable_vehicle']
const rules = JSON.parse(JSON.stringify(this.rules))
if (this.formInline.standard_property === StandardProperty.admittance.value) {
fieldNameList.forEach(key => {
if (rules[key] && rules[key].length > 0) {
rules[key][0].required = true
const dataPart = Object.keys(this.formList).find(tt => this.formList[tt].some(item => item.dbFieldName === key))
const index = this.formList[dataPart].findIndex(tt => tt.dbFieldName === key)
this.formList[dataPart][index].fieldMustInput = '1'
}
})
} else {
fieldNameList.forEach(key => {
if (rules[key] && rules[key].length > 0) {
rules[key][0].required = false
const dataPart = Object.keys(this.formList).find(tt => this.formList[tt].some(item => item.dbFieldName === key))
const index = this.formList[dataPart].findIndex(tt => tt.dbFieldName === key)
this.formList[dataPart][index].fieldMustInput = '0'
}
})
}
this.rules = Object.assign({}, rules)
this.$refs.ruleForm.clearValidate()
},
/**
* 获取海外的表单数据
* @param id
*/
initOverseasFormData (id) {
this.loading = true
getOverseasStandardDocumentInfo({ id, type: 2 }).then(res => {
if (res.success) {
// 处理树结构多选回显
const formList = Object.values(this.formList).reduce((acc, cur) => acc.concat(cur), [])
const treeMultipleField = formList.filter(tt => tt.fieldShowType === FieldType.TREE.value)
const data = res.result || {}
treeMultipleField.forEach(field => {
const valueArr = []
if (data[field.dbFieldName]) {
const values = data[field.dbFieldName].split(',')
for (let i = 0; i < values.length; i++) {
valueArr[i] = {
value: values[i]
}
}
data[field.dbFieldName] = valueArr
} else {
data[field.dbFieldName] = undefined
}
})
const dictField = formList.filter(tt => tt.fieldShowType === FieldType.OPTION_SINGLE.value)
dictField.forEach(field => {
data[field.dbFieldName] = data[field.dbFieldName] || null
})
this.formInline = Object.assign({ ...this.formInline }, { ...data })
// 处理标准选择不能选自己
this.excludeStandardNumbers = this.formInline.standard_number
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
goBack () {
let timer = setTimeout(() => {
this.$router.go(-1)
}, 700)
}
}
}
@@ -650,4 +919,8 @@ export default {
width: 100%;
display: inline-block;
}
.button-text {
width: 100%;
}
</style>