diff --git a/src/views/credit/rempunish/accept.vue b/src/views/credit/rempunish/accept.vue index 15921b6..7bd033e 100644 --- a/src/views/credit/rempunish/accept.vue +++ b/src/views/credit/rempunish/accept.vue @@ -58,7 +58,7 @@
- +
@@ -200,11 +200,20 @@
+ + @@ -256,6 +265,7 @@ export default { bizSeq: this.$route.query.bizSeq, punishInfo: {}, IlcPunInfo: {}, + taskInfo: {}, process: {}, uploadPath: `${process.env.VUE_APP_BASE_API}/punishment/tBizRemPunishment/upload`, onlyShow: this.$route.query.onlyShow === '1', @@ -319,6 +329,7 @@ export default { getInfo(this.bizSeq).then(res => { this.punishInfo = res.data.punishInfo this.IlcPunInfo = res.data.IlcPunInfo + this.taskInfo = res.data.task this.punishInfo.repairOrg = this.user.orgCode this.punishInfo.repairOrgCn = this.user.orgName @@ -348,24 +359,43 @@ export default { }, submit() { this.submitLoading = true - this.$refs.form.validate((valid, rules) => { - if (!valid) { - this.$message.warning(rules[Object.keys(rules)[0]][0].message) - return - } - this.$confirm('确定提交后,上述行政处罚信息将从国家企业信用信息公示系统撤下,不再对外公示。').then(() => { - submitTask(this.punishInfo).then(res => { - if (res.code === 0) { - this.$message.success('提交成功') - this.$router.back() - } else { - this.$message.error('提交失败,' + res.msg) - } - }) + // 判断是否为"不予受理"或"不予修复"状态 + const isNotAgree = this.punishInfo.status === '3' + + if (isNotAgree) { + // 不需要验证,直接提交 + this.$confirm('确定提交?').then(() => { + this.performSubmit() + }).catch(() => { + this.submitLoading = false }) - }) + } else { + // 需要验证表单 + this.validateBusinessForm() + .then(() => { + return this.$confirm('确定提交后,上述行政处罚信息将从国家企业信用信息公示系统撤下,不再对外公示。'); + }) + .then(() => { + this.performSubmit(); + }) + .catch(error => { + console.warn('表单验证失败:', error.message); + this.submitLoading = false; + }); + } this.submitLoading = false }, + // 提取公共提交逻辑 + performSubmit() { + submitTask(this.punishInfo).then(res => { + if (res.code === 0) { + this.$message.success('提交成功') + this.$router.back() + } else { + this.$message.error('提交失败,' + res.msg) + } + }) + }, initFileList() { listFile({ id: this.bizSeq }).then(({ data }) => { if (data.length !== 0) { @@ -419,6 +449,44 @@ export default { this.reviewer = res.data } }) + }, + // 自定义验证方法 + validateBusinessForm() { + return new Promise((resolve, reject) => { + // 验证必填字段 + const validations = [ + { field: 'applyDate', name: '主体申请修复日期', value: this.punishInfo.applyDate }, + { field: 'repairNo', name: '准予修复决定书文号', value: this.punishInfo.repairNo }, + { field: 'repairDate', name: '信用修复决定时间', value: this.punishInfo.repairDate }, + { field: 'repairOrgCn', name: '作出信用修复决定机关', value: this.punishInfo.repairOrgCn } + ]; + + for (const validation of validations) { + if (!validation.value) { + this.$message.warning(`请填写${validation.name}`); + reject(new Error(`请填写${validation.name}`)); + return; + } + } + + // 验证文件上传 + const fileTypes = ['1', '2', '3']; + const fileLabels = ['信用修复决定审批表', '准予信用修复决定文书', '补充材料']; + + for (let i = 0; i < fileTypes.length; i++) { + const fileType = fileTypes[i]; + const fileLabel = fileLabels[i]; + const files = this.fileList.filter(item => item.attachtype === fileType); + + if (files.length === 0) { + this.$message.warning(`请上传${fileLabel}`); + reject(new Error(`请上传${fileLabel}`)); + return; + } + } + + resolve(true); + }); } }, components: {