销售合同清单明细 验证提示到行级别

master
Harry Yang 2023-01-03 14:59:31 +08:00
parent 7050cad2df
commit 49433609d1
2 changed files with 44 additions and 12 deletions

View File

@ -334,7 +334,7 @@
<div class="am-u-sm-12 am-u-md-12" v-if="isSaleContractDetailMode">
<el-table border :data="incomeDetails">
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
<el-table-column prop="index" label="序号" fixed></el-table-column>
<el-table-column prop="name" label="名称" fixed width="120"></el-table-column>
<el-table-column prop="type" label="类别"></el-table-column>
<el-table-column prop="spec" label="规格型号"></el-table-column>
@ -588,6 +588,16 @@
}
return true
},
checkExpirationDate() {
const emptyRows = this.incomeDetails.filter(detail => isBlank(detail.expirationDate))
if (isNotEmpty(emptyRows)) {
const indexString = emptyRows.map(detail => detail.index).join(",")
this.$message.error("在合同清单明细中第 '" + indexString + "' 行的质保期未填写")
return false
}
return true
},
/**
* 保存 业务采购合同清单明细,返回上一级的表单界面
*/
@ -670,8 +680,9 @@
this.initForm({ ...form, ...process, ...contract, applyDeptId })
this.projectSelected = true
this.processType = process.processType
let indexCounter = 1;
this.incomeDetails = incomeDetails && incomeDetails.map(detail => ({
...detail, type: computeType(detail.type)
...detail, type: computeType(detail.type), index: indexCounter++ // 用于记录序号,展示或者定位
}))
this.fileList = attachments.map(item => ({

View File

@ -109,7 +109,8 @@
</div>
</el-dialog>
<el-dialog title="预算采购明细表" :visible.sync="procurementDetailSelectorVisible" v-cloak width="90%" :close-on-click-modal="false">
<el-dialog title="预算采购明细表" :visible.sync="procurementDetailSelectorVisible" v-cloak width="90%"
:close-on-click-modal="false">
<el-table border :data="procurementDetails">
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
@ -829,7 +830,8 @@
return
}
fetch("${base}/process/projects?q=" + q)
.then(res => res.json())
.then(checkStatus)
.then(parseJSON)
.then(data => {
if (data.length === 0) {
callback([])
@ -839,8 +841,16 @@
callback(data)
}
})
.catch(err => {
this.$message.error('项目搜索失败');
.catch(({ response }) => {
if (response) {
parseJSON(response)
.then(json => {
this.$message.error(json.message || "项目搜索失败")
})
}
else {
this.$message.error("项目搜索失败")
}
})
},
/**
@ -860,7 +870,8 @@
})
fetch("${base}/process/projects/" + id + "?processType=" + this.processType)
.then(res => res.json())
.then(checkStatus)
.then(parseJSON)
.then(data => {
const { incomeDetails, procurementDetails, ...form } = data
if (!form.projectNo || !form.projectName) {
@ -892,8 +903,9 @@
this.initForm(form)
this.projectSelected = true
let indexCounter = 1;
this.incomeDetails = incomeDetails && incomeDetails.map(detail => ({
...detail, type: computeType(detail.type)
...detail, type: computeType(detail.type), index: indexCounter++ // 用于记录序号,展示或者定位
}))
let rowKey = 0
@ -906,9 +918,18 @@
this.rowKeyCounter = rowKey
})
.catch(err => {
this.$message.error("项目'" + name + "'加载失败");
.catch(({ response }) => {
if (response) {
parseJSON(response)
.then(json => {
this.$message.error(json.message || "项目'" + name + "'加载失败")
})
}
else {
this.$message.error("项目'" + name + "'加载失败")
}
})
.finally(() => loading.close())
},
clearProjectProcess() {
@ -1118,8 +1139,8 @@
checkExpirationDate() {
const emptyRows = this.incomeDetails.filter(detail => isBlank(detail.expirationDate))
if (isNotEmpty(emptyRows)) {
const row = emptyRows[0]
this.$message.error("合同清单明细 名称为:'" + row.name + "' 类别为:'" + row.type + "' 的质保期未填写")
const indexString = emptyRows.map(detail => detail.index).join(",")
this.$message.error("在合同清单明细中第 '" + indexString + "' 行的质保期未填写")
return false
}
return true