update 流程校验调整
This commit is contained in:
+33
-10
@@ -305,30 +305,42 @@ export default {
|
||||
async getPageParams (isValidate = true) {
|
||||
// 去除备注必填
|
||||
this.validatorRules.remarks.rules[0].required = false
|
||||
// 报错标记(base基本信息校验失败,user人员信息校验失败)
|
||||
let flag = ''
|
||||
const base = 'base'
|
||||
const user = 'user'
|
||||
// 如果需要校验校验表格数据
|
||||
if (isValidate) {
|
||||
const list = this.$refs.inspectionProcessTable.dataSource
|
||||
if (list.length === 0) {
|
||||
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
|
||||
throw new Error('base')
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 调整为前端存储
|
||||
*/
|
||||
// 节点1:稽查内容条数不能为0
|
||||
if (this.isInitiate && list.some(item => !(item.enterpriseStandardInspectContentList && item.enterpriseStandardInspectContentList.length))) {
|
||||
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
|
||||
throw new Error('base')
|
||||
this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillInspectionContent'))
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
}
|
||||
// 节点3:稽查报告条数不能为0
|
||||
if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectReportList && item.enterpriseStandardInspectReportList.length))) {
|
||||
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
|
||||
throw new Error('base')
|
||||
this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillInspectionReport'))
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
}
|
||||
// 节点3:整改计划条数不能为0
|
||||
if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectRectifyPlanList && item.enterpriseStandardInspectRectifyPlanList.length))) {
|
||||
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
|
||||
throw new Error('base')
|
||||
this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillRectificationPlan'))
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
}
|
||||
}
|
||||
const params = {}
|
||||
@@ -354,7 +366,13 @@ export default {
|
||||
// 收集所有表单信息
|
||||
let formDataList = []
|
||||
if (isValidate) {
|
||||
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm)
|
||||
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm).catch(() => {
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
// 空数组防止后续操作报错
|
||||
return []
|
||||
})
|
||||
} else {
|
||||
formDataList = [
|
||||
this.processInfoForm.getFieldsValue(),
|
||||
@@ -364,9 +382,9 @@ export default {
|
||||
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
|
||||
}
|
||||
// 收集人员信息
|
||||
const personInfo = this.getPersonInfo(isValidate)
|
||||
const personInfo = this.getPersonInfo(isValidate && !flag)
|
||||
if (!personInfo) {
|
||||
throw new Error('user')
|
||||
flag = user
|
||||
}
|
||||
|
||||
// 开始处理信息
|
||||
@@ -393,6 +411,11 @@ export default {
|
||||
// 业务表格数据,用于强制撤回后回显
|
||||
draftData: params.processEsInspectList
|
||||
})
|
||||
|
||||
// 如果有校验失败的,那就报错
|
||||
if (flag) {
|
||||
throw new Error(flag)
|
||||
}
|
||||
return params
|
||||
},
|
||||
/**
|
||||
|
||||
+12
-3
@@ -5,7 +5,6 @@
|
||||
:visible="visible"
|
||||
:confirmLoading="loading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
:cancelText="$t('close')">
|
||||
<a-spin :spinning="loading">
|
||||
@@ -39,6 +38,17 @@
|
||||
|
||||
</j-table>
|
||||
</a-spin>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<template slot="footer">
|
||||
<a-button :loading="loading" @click="handleCancel">
|
||||
{{ $t('cancel') }}
|
||||
</a-button>
|
||||
<a-button v-if="!disabled" type="primary" :loading="loading" @click="handleOk">
|
||||
{{ $t('submit') }}
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<!-- 新增编辑稽查内容 -->
|
||||
<inspection-process-content-modal ref="inspectionProcessContentModal" @ok="modalFormOk"/>
|
||||
</j-modal>
|
||||
@@ -85,7 +95,6 @@ export default {
|
||||
// },
|
||||
{
|
||||
// 操作
|
||||
fixed: 'right',
|
||||
title: this.$t('operation'),
|
||||
// dataIndex: 'action',
|
||||
align: 'center',
|
||||
@@ -107,7 +116,7 @@ export default {
|
||||
index: -1,
|
||||
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
|
||||
delIds: [],
|
||||
columns: columns.slice(0, this.disabled ? 3 : 4)
|
||||
columns: columns.slice(0, this.disabled ? 2 : 3)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
+9
-1
@@ -5,7 +5,6 @@
|
||||
:visible="visible"
|
||||
:confirmLoading="loading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
:cancelText="$t('close')">
|
||||
<a-spin :spinning="loading">
|
||||
@@ -47,6 +46,15 @@
|
||||
|
||||
</j-table>
|
||||
</a-spin>
|
||||
<!-- 操作按钮 -->
|
||||
<template slot="footer">
|
||||
<a-button :loading="loading" @click="handleCancel">
|
||||
{{ $t('cancel') }}
|
||||
</a-button>
|
||||
<a-button v-if="!disabled" type="primary" :loading="loading" @click="handleOk">
|
||||
{{ $t('submit') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<!-- 新增、编辑整改计划 -->
|
||||
<inspection-process-rectification-plan-modal ref="modalForm" @ok="modalFormOk" :temp-data-source="dataSource"/>
|
||||
</j-modal>
|
||||
|
||||
+9
-1
@@ -5,7 +5,6 @@
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
:cancelText="$t('close')">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
@@ -44,6 +43,15 @@
|
||||
|
||||
</j-table>
|
||||
</a-spin>
|
||||
<!-- 操作按钮 -->
|
||||
<template slot="footer">
|
||||
<a-button :loading="confirmLoading" @click="handleCancel">
|
||||
{{ $t('cancel') }}
|
||||
</a-button>
|
||||
<a-button v-if="!disabled" type="primary" :loading="confirmLoading" @click="handleOk">
|
||||
{{ $t('submit') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<!-- 新增、编辑稽查报告 -->
|
||||
<inspection-process-report-modal ref="modalForm" @ok="modalFormOk" :temp-data-source="dataSource"/>
|
||||
<!-- 上传回显 -->
|
||||
|
||||
Reference in New Issue
Block a user