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 @@
- {{scope.row.parent.amountCurrent}}
+
@@ -516,7 +516,7 @@
- {{scope.row.amount - scope.row.amountAlready}}
+ {{scope.row.amount - scope.row.amountAlready}}
@@ -600,7 +600,6 @@
const procurementDetailProperties = [
"spec",
- "amount",
"purchaseList",
"amountCurrent",
"supplierName",
@@ -754,18 +753,32 @@
* @returns {boolean} 校验通过否
*/
checkProcurementDetails() {
- // TODO FIXME 修改为提示第几行数据有问题
- 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++;
+ })
+ }
})
- 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 + "' 的数据未填写")
+ if (isNotEmpty(emptyRowIndex)) {
+ const indexString = emptyRowIndex.join(",")
+ this.$message.error("在合同清单明细中第 '" + indexString + "' 行中的数据未填写完整")
return false
}
return true
@@ -1042,6 +1055,9 @@
}
if (!validStatus) {
+ if (isEmpty(document.getElementsByClassName('el-message'))) {
+ this.$message.error("表单填写不完整,不能提交");
+ }
return false
}
@@ -1055,7 +1071,9 @@
const detail = budgetCostIdMap.get(budgetCostId)
const ret = []
const map = detail => {
- const ret = {}
+ const ret = {
+ amount: detail.amount // 需要 amount
+ }
procurementDetailProperties.forEach(property => {
ret[property] = detail[property]
})
@@ -1232,7 +1250,7 @@
const { row } = scope
const { children } = row
const newRow = {
- ...row,
+ // ...row, // 不显示数据相同的部分
rowKey: this.rowKeyCounter++,
newRow: true,
parent: row // 记录上一级元素,在删除的时候使用
@@ -1250,8 +1268,8 @@
},
removeProcurementDetailRow(scope) {
- const { rowKey } = scope.row
- .filter(child => child.rowKey !== rowKey)
+ const { rowKey, parent } = scope.row
+ parent.children = parent.children.filter(child => child.rowKey !== rowKey)
},
// 区别子项