优化施工人员、销售人员非空验证

This commit is contained in:
xiaofajia 2024-10-28 11:28:49 +08:00
parent 3b532d153d
commit 2fb197b815

View File

@ -201,12 +201,12 @@
<el-col :span="createTicketType ? 12 : 16">
<el-descriptions class="margin-top" :column="createTicketType ? 2 : 3" border :size="'medium'"
style="margin-bottom: 1rem">
<el-descriptions-item>
<template slot="label">
工单号
</template>
<TicketChoose @selected="getTickets"/>
</el-descriptions-item>
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 工单号-->
<!-- </template>-->
<!-- <TicketChoose @selected="getTickets"/>-->
<!-- </el-descriptions-item>-->
<el-descriptions-item>
<template slot="label">
时间
@ -253,7 +253,7 @@
</el-col>
<el-col :span="12" style="margin-top:1rem;display: flex;justify-content: right">
<el-button type="success" @click="handleSave" :disabled="isEnable">完成</el-button>
<el-button type="danger" @click="handlePaid" :disabled="isEnable">结算</el-button>
<!-- <el-button type="danger" @click="handlePaid" :disabled="isEnable">结算</el-button>-->
<!-- <el-button type="primary">通知施工</el-button>-->
<!-- <el-button type="primary">领料</el-button>-->
<!-- <el-button type="primary">退料</el-button>-->
@ -444,6 +444,10 @@ export default {
this.createInit()
this.createItemInit()
try {
const count = this.handleValidate()
if (count > 0){
return
}
await createTickets(this.formData)
this.$modal.msgSuccess("新增成功")
this.init()
@ -532,6 +536,7 @@ export default {
},
// init
createItemInit() {
this.formData.itemList = []
//
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("project", this.projectList)]
//
@ -539,6 +544,29 @@ export default {
//
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("other", this.otherList)]
},
//
handleValidate(){
let count = 0
this.formData.itemList.forEach(item => {
if (count !== 0) return count
if (!item.repairIds || !item.saleId){
let message = ""
switch (item.itemType){
case "01":
message += "项目:"
break
case "02":
message += "配件:"
break
case "03":
message += "其他:"
}
this.$modal.msgError(message + item.itemName + (!item.repairIds ? "施工人员" : "销售人员") + "不能为空")
count++
}
})
return count
},
//
formatItem(type, list) {
if (!(list && list.length > 0)) {