业务采购合同清单明细 校验

master
Harry Yang 2022-12-30 16:06:39 +08:00
parent 779a0dc27e
commit 59f7124d6d
2 changed files with 28 additions and 8 deletions

View File

@ -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}')
},
})

View File

@ -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