采购合同清单明细 验证提示到行级别
parent
a6b6d05879
commit
54fa818666
|
@ -480,7 +480,6 @@
|
||||||
|
|
||||||
const procurementDetailProperties = [
|
const procurementDetailProperties = [
|
||||||
"spec",
|
"spec",
|
||||||
"amount",
|
|
||||||
"purchaseList",
|
"purchaseList",
|
||||||
"amountCurrent",
|
"amountCurrent",
|
||||||
"supplierName",
|
"supplierName",
|
||||||
|
@ -574,16 +573,32 @@
|
||||||
* @returns {boolean} 校验通过否
|
* @returns {boolean} 校验通过否
|
||||||
*/
|
*/
|
||||||
checkProcurementDetails() {
|
checkProcurementDetails() {
|
||||||
const emptyRows = this.procurementDetails.filter(detail => {
|
let row = 1;
|
||||||
|
const emptyRowIndex = []
|
||||||
|
|
||||||
|
const containsEmpty = detail => {
|
||||||
return isNotEmpty(procurementDetailProperties.filter(property => isBlank(detail[property])))
|
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)) {
|
if (isNotEmpty(emptyRowIndex)) {
|
||||||
this.procurementDetails.forEach(detail => {
|
const indexString = emptyRowIndex.join(",")
|
||||||
const properties = procurementDetailProperties.filter(property => isBlank(detail[property]))
|
this.$message.error("在合同清单明细中第 '" + indexString + "' 行中的数据未填写完整")
|
||||||
console.log(properties)
|
|
||||||
})
|
|
||||||
const row = emptyRows[0]
|
|
||||||
this.$message.error("合同清单明细 费用项目为:'" + row.feeType + "' 采购类别为:'" + row.category + "' 的数据未填写")
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -871,6 +886,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validStatus) {
|
if (!validStatus) {
|
||||||
|
if (isEmpty(document.getElementsByClassName('el-message'))) {
|
||||||
|
this.$message.error("表单填写不完整,不能提交");
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,7 +901,9 @@
|
||||||
const detail = budgetCostIdMap.get(budgetCostId)
|
const detail = budgetCostIdMap.get(budgetCostId)
|
||||||
const ret = []
|
const ret = []
|
||||||
const map = detail => {
|
const map = detail => {
|
||||||
const ret = { id: detail.id }
|
const ret = {
|
||||||
|
id: detail.id, amount: detail.amount
|
||||||
|
}
|
||||||
procurementDetailProperties.forEach(property => {
|
procurementDetailProperties.forEach(property => {
|
||||||
ret[property] = detail[property]
|
ret[property] = detail[property]
|
||||||
})
|
})
|
||||||
|
|
|
@ -506,7 +506,7 @@
|
||||||
<el-table-column prop="amountAlready" label="已采购数量" width="100"></el-table-column>
|
<el-table-column prop="amountAlready" label="已采购数量" width="100"></el-table-column>
|
||||||
<el-table-column prop="amountCurrent" label="本次采购数量" width="180">
|
<el-table-column prop="amountCurrent" label="本次采购数量" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.newRow">{{scope.row.parent.amountCurrent}}</span>
|
<span v-if="scope.row.newRow"></span>
|
||||||
<el-input-number v-else :precision="2" :step="0.1" :min="0" v-model="scope.row.amountCurrent"
|
<el-input-number v-else :precision="2" :step="0.1" :min="0" v-model="scope.row.amountCurrent"
|
||||||
:disabled="scope.row.amount - scope.row.amountAlready===0" size="mini"
|
:disabled="scope.row.amount - scope.row.amountAlready===0" size="mini"
|
||||||
:max="scope.row.amount - scope.row.amountAlready" controls-position="right">
|
:max="scope.row.amount - scope.row.amountAlready" controls-position="right">
|
||||||
|
@ -516,7 +516,7 @@
|
||||||
|
|
||||||
<el-table-column prop="amountLeft" label="未采购数量" width="100">
|
<el-table-column prop="amountLeft" label="未采购数量" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.amount - scope.row.amountAlready}}</span>
|
<span v-if="!scope.row.newRow">{{scope.row.amount - scope.row.amountAlready}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
@ -600,7 +600,6 @@
|
||||||
|
|
||||||
const procurementDetailProperties = [
|
const procurementDetailProperties = [
|
||||||
"spec",
|
"spec",
|
||||||
"amount",
|
|
||||||
"purchaseList",
|
"purchaseList",
|
||||||
"amountCurrent",
|
"amountCurrent",
|
||||||
"supplierName",
|
"supplierName",
|
||||||
|
@ -754,18 +753,32 @@
|
||||||
* @returns {boolean} 校验通过否
|
* @returns {boolean} 校验通过否
|
||||||
*/
|
*/
|
||||||
checkProcurementDetails() {
|
checkProcurementDetails() {
|
||||||
// TODO FIXME 修改为提示第几行数据有问题
|
let row = 1;
|
||||||
const emptyRows = this.procurementDetails.filter(detail => {
|
const emptyRowIndex = []
|
||||||
|
|
||||||
|
const containsEmpty = detail => {
|
||||||
return isNotEmpty(procurementDetailProperties.filter(property => isBlank(detail[property])))
|
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(emptyRowIndex)) {
|
||||||
if (isNotEmpty(emptyRows)) {
|
const indexString = emptyRowIndex.join(",")
|
||||||
this.procurementDetails.forEach(detail => {
|
this.$message.error("在合同清单明细中第 '" + indexString + "' 行中的数据未填写完整")
|
||||||
const properties = procurementDetailProperties.filter(property => isBlank(detail[property]))
|
|
||||||
console.log(properties)
|
|
||||||
})
|
|
||||||
const row = emptyRows[0]
|
|
||||||
this.$message.error("合同清单明细 费用项目为:'" + row.feeType + "' 采购类别为:'" + row.category + "' 的数据未填写")
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -1042,6 +1055,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validStatus) {
|
if (!validStatus) {
|
||||||
|
if (isEmpty(document.getElementsByClassName('el-message'))) {
|
||||||
|
this.$message.error("表单填写不完整,不能提交");
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1055,7 +1071,9 @@
|
||||||
const detail = budgetCostIdMap.get(budgetCostId)
|
const detail = budgetCostIdMap.get(budgetCostId)
|
||||||
const ret = []
|
const ret = []
|
||||||
const map = detail => {
|
const map = detail => {
|
||||||
const ret = {}
|
const ret = {
|
||||||
|
amount: detail.amount // 需要 amount
|
||||||
|
}
|
||||||
procurementDetailProperties.forEach(property => {
|
procurementDetailProperties.forEach(property => {
|
||||||
ret[property] = detail[property]
|
ret[property] = detail[property]
|
||||||
})
|
})
|
||||||
|
@ -1232,7 +1250,7 @@
|
||||||
const { row } = scope
|
const { row } = scope
|
||||||
const { children } = row
|
const { children } = row
|
||||||
const newRow = {
|
const newRow = {
|
||||||
...row,
|
// ...row, // 不显示数据相同的部分
|
||||||
rowKey: this.rowKeyCounter++,
|
rowKey: this.rowKeyCounter++,
|
||||||
newRow: true,
|
newRow: true,
|
||||||
parent: row // 记录上一级元素,在删除的时候使用
|
parent: row // 记录上一级元素,在删除的时候使用
|
||||||
|
@ -1250,8 +1268,8 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
removeProcurementDetailRow(scope) {
|
removeProcurementDetailRow(scope) {
|
||||||
const { rowKey } = scope.row
|
const { rowKey, parent } = scope.row
|
||||||
.filter(child => child.rowKey !== rowKey)
|
parent.children = parent.children.filter(child => child.rowKey !== rowKey)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 区别子项
|
// 区别子项
|
||||||
|
|
Loading…
Reference in New Issue