From 49433609d13799c233fec123e0a37ef23558f2cd Mon Sep 17 00:00:00 2001 From: Harry Yang Date: Tue, 3 Jan 2023 14:59:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E5=90=88=E5=90=8C=E6=B8=85?= =?UTF-8?q?=E5=8D=95=E6=98=8E=E7=BB=86=20=E9=AA=8C=E8=AF=81=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=88=B0=E8=A1=8C=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/admin/business/process-edit.ftl | 15 ++++++- .../templates/admin/business/process-new.ftl | 41 ++++++++++++++----- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/main/resources/templates/admin/business/process-edit.ftl b/src/main/resources/templates/admin/business/process-edit.ftl index 5e1ff5f..a677373 100644 --- a/src/main/resources/templates/admin/business/process-edit.ftl +++ b/src/main/resources/templates/admin/business/process-edit.ftl @@ -334,7 +334,7 @@
- + @@ -588,6 +588,16 @@ } return true }, + + checkExpirationDate() { + const emptyRows = this.incomeDetails.filter(detail => isBlank(detail.expirationDate)) + if (isNotEmpty(emptyRows)) { + const indexString = emptyRows.map(detail => detail.index).join(",") + this.$message.error("在合同清单明细中第 '" + indexString + "' 行的质保期未填写") + return false + } + return true + }, /** * 保存 业务采购合同清单明细,返回上一级的表单界面 */ @@ -670,8 +680,9 @@ this.initForm({ ...form, ...process, ...contract, applyDeptId }) this.projectSelected = true this.processType = process.processType + let indexCounter = 1; this.incomeDetails = incomeDetails && incomeDetails.map(detail => ({ - ...detail, type: computeType(detail.type) + ...detail, type: computeType(detail.type), index: indexCounter++ // 用于记录序号,展示或者定位 })) this.fileList = attachments.map(item => ({ diff --git a/src/main/resources/templates/admin/business/process-new.ftl b/src/main/resources/templates/admin/business/process-new.ftl index ad73f16..c212949 100644 --- a/src/main/resources/templates/admin/business/process-new.ftl +++ b/src/main/resources/templates/admin/business/process-new.ftl @@ -109,7 +109,8 @@
- + @@ -829,7 +830,8 @@ return } fetch("${base}/process/projects?q=" + q) - .then(res => res.json()) + .then(checkStatus) + .then(parseJSON) .then(data => { if (data.length === 0) { callback([]) @@ -839,8 +841,16 @@ callback(data) } }) - .catch(err => { - this.$message.error('项目搜索失败'); + .catch(({ response }) => { + if (response) { + parseJSON(response) + .then(json => { + this.$message.error(json.message || "项目搜索失败") + }) + } + else { + this.$message.error("项目搜索失败") + } }) }, /** @@ -860,7 +870,8 @@ }) fetch("${base}/process/projects/" + id + "?processType=" + this.processType) - .then(res => res.json()) + .then(checkStatus) + .then(parseJSON) .then(data => { const { incomeDetails, procurementDetails, ...form } = data if (!form.projectNo || !form.projectName) { @@ -892,8 +903,9 @@ this.initForm(form) this.projectSelected = true + let indexCounter = 1; this.incomeDetails = incomeDetails && incomeDetails.map(detail => ({ - ...detail, type: computeType(detail.type) + ...detail, type: computeType(detail.type), index: indexCounter++ // 用于记录序号,展示或者定位 })) let rowKey = 0 @@ -906,9 +918,18 @@ this.rowKeyCounter = rowKey }) - .catch(err => { - this.$message.error("项目'" + name + "'加载失败"); + .catch(({ response }) => { + if (response) { + parseJSON(response) + .then(json => { + this.$message.error(json.message || "项目'" + name + "'加载失败") + }) + } + else { + this.$message.error("项目'" + name + "'加载失败") + } }) + .finally(() => loading.close()) }, clearProjectProcess() { @@ -1118,8 +1139,8 @@ checkExpirationDate() { const emptyRows = this.incomeDetails.filter(detail => isBlank(detail.expirationDate)) if (isNotEmpty(emptyRows)) { - const row = emptyRows[0] - this.$message.error("合同清单明细 名称为:'" + row.name + "' 类别为:'" + row.type + "' 的质保期未填写") + const indexString = emptyRows.map(detail => detail.index).join(",") + this.$message.error("在合同清单明细中第 '" + indexString + "' 行的质保期未填写") return false } return true