diff --git a/src/main/resources/templates/admin/business/process-edit.ftl b/src/main/resources/templates/admin/business/process-edit.ftl index 3b5f737..1059f5b 100644 --- a/src/main/resources/templates/admin/business/process-edit.ftl +++ b/src/main/resources/templates/admin/business/process-edit.ftl @@ -510,6 +510,21 @@ return !isBlank(obj) } + function checkStatus(response) { + if (response.status >= 200 && response.status < 300) { + return response + } + else { + const error = new Error(response.statusText); + error.response = response + throw error + } + } + + function parseJSON(response) { + return response.json() + } + const data = () => { return { mode: "btn", // btn @@ -556,8 +571,11 @@ const emptyRows = this.procurementDetails.filter(detail => { return isNotEmpty(procurementDetailProperties.filter(property => isBlank(detail[property]))) }) - console.log(emptyRows) 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 + "' 的数据未填写") return false @@ -607,7 +625,8 @@ }) fetch("${base}/process/" + id) - .then(res => res.json()) + .then(checkStatus) + .then(parseJSON) .then(data => { const { incomeDetails, process, contract, procurementDetails, attachments, ...form } = data // 转换数据 @@ -631,7 +650,7 @@ } // @formatter:on - const applyDeptId = process?.applyDeptId?.split(',') + const applyDeptId = process?.applyDeptId?.split(',').map(id => parseInt(id)) this.initForm({ ...form, ...process, ...contract, applyDeptId }) this.projectSelected = true this.processType = process.processType @@ -693,7 +712,7 @@ }) .catch(err => { console.log(err) - this.$message.error("项目加载失败"); + this.$message.error(err.message || "项目加载失败"); }) .finally(() => loading.close()) }, @@ -975,9 +994,7 @@ mounted() { const processId = ${processId} this.loadProject(processId) - this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}').map(option => ({ - ...option, label: option.name, value: option.id - })) + this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}') }, }) diff --git a/src/main/resources/templates/admin/business/process-new.ftl b/src/main/resources/templates/admin/business/process-new.ftl index 4ffb29e..f634fb1 100644 --- a/src/main/resources/templates/admin/business/process-new.ftl +++ b/src/main/resources/templates/admin/business/process-new.ftl @@ -593,7 +593,6 @@ "spec", "amount", "purchaseList", - "amountAlready", "amountCurrent", "supplierName", "totalTaxInclude", @@ -734,6 +733,10 @@ }) console.log(emptyRows) 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 + "' 的数据未填写") return false