From 54fa818666825a3c69f24dd7cb45bb3569b57e58 Mon Sep 17 00:00:00 2001 From: Harry Yang Date: Tue, 3 Jan 2023 15:59:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=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 | 40 ++++++++++---- .../templates/admin/business/process-new.ftl | 52 +++++++++++++------ 2 files changed, 65 insertions(+), 27 deletions(-) diff --git a/src/main/resources/templates/admin/business/process-edit.ftl b/src/main/resources/templates/admin/business/process-edit.ftl index f01c053..b0bb7d9 100644 --- a/src/main/resources/templates/admin/business/process-edit.ftl +++ b/src/main/resources/templates/admin/business/process-edit.ftl @@ -480,7 +480,6 @@ const procurementDetailProperties = [ "spec", - "amount", "purchaseList", "amountCurrent", "supplierName", @@ -574,16 +573,32 @@ * @returns {boolean} 校验通过否 */ checkProcurementDetails() { - const emptyRows = this.procurementDetails.filter(detail => { + let row = 1; + const emptyRowIndex = [] + + const containsEmpty = detail => { return isNotEmpty(procurementDetailProperties.filter(property => isBlank(detail[property]))) + } + + this.procurementDetails.forEach(detail => { + if (containsEmpty(detail)) { + emptyRowIndex.push(row) + } + row++; + const { children } = detail + if (children) { + children.forEach(childDetail => { + if (containsEmpty(childDetail)) { + emptyRowIndex.push(row) + } + // 每个children都加1 + row++; + }) + } }) - if (isNotEmpty(emptyRows)) { - this.procurementDetails.forEach(detail => { - const properties = procurementDetailProperties.filter(property => isBlank(detail[property])) - console.log(properties) - }) - const row = emptyRows[0] - this.$message.error("合同清单明细 费用项目为:'" + row.feeType + "' 采购类别为:'" + row.category + "' 的数据未填写") + if (isNotEmpty(emptyRowIndex)) { + const indexString = emptyRowIndex.join(",") + this.$message.error("在合同清单明细中第 '" + indexString + "' 行中的数据未填写完整") return false } return true @@ -871,6 +886,9 @@ } if (!validStatus) { + if (isEmpty(document.getElementsByClassName('el-message'))) { + this.$message.error("表单填写不完整,不能提交"); + } return false } @@ -883,7 +901,9 @@ const detail = budgetCostIdMap.get(budgetCostId) const ret = [] const map = detail => { - const ret = { id: detail.id } + const ret = { + id: detail.id, amount: detail.amount + } procurementDetailProperties.forEach(property => { ret[property] = detail[property] }) diff --git a/src/main/resources/templates/admin/business/process-new.ftl b/src/main/resources/templates/admin/business/process-new.ftl index 0cdb0da..42adcba 100644 --- a/src/main/resources/templates/admin/business/process-new.ftl +++ b/src/main/resources/templates/admin/business/process-new.ftl @@ -506,7 +506,7 @@