优化施工人员、销售人员非空验证
This commit is contained in:
parent
3b532d153d
commit
2fb197b815
@ -201,12 +201,12 @@
|
|||||||
<el-col :span="createTicketType ? 12 : 16">
|
<el-col :span="createTicketType ? 12 : 16">
|
||||||
<el-descriptions class="margin-top" :column="createTicketType ? 2 : 3" border :size="'medium'"
|
<el-descriptions class="margin-top" :column="createTicketType ? 2 : 3" border :size="'medium'"
|
||||||
style="margin-bottom: 1rem">
|
style="margin-bottom: 1rem">
|
||||||
<el-descriptions-item>
|
<!-- <el-descriptions-item>-->
|
||||||
<template slot="label">
|
<!-- <template slot="label">-->
|
||||||
工单号
|
<!-- 工单号-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
<TicketChoose @selected="getTickets"/>
|
<!-- <TicketChoose @selected="getTickets"/>-->
|
||||||
</el-descriptions-item>
|
<!-- </el-descriptions-item>-->
|
||||||
<el-descriptions-item>
|
<el-descriptions-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
时间
|
时间
|
||||||
@ -253,7 +253,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" style="margin-top:1rem;display: flex;justify-content: right">
|
<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="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>-->
|
<!-- <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.createInit()
|
||||||
this.createItemInit()
|
this.createItemInit()
|
||||||
try {
|
try {
|
||||||
|
const count = this.handleValidate()
|
||||||
|
if (count > 0){
|
||||||
|
return
|
||||||
|
}
|
||||||
await createTickets(this.formData)
|
await createTickets(this.formData)
|
||||||
this.$modal.msgSuccess("新增成功")
|
this.$modal.msgSuccess("新增成功")
|
||||||
this.init()
|
this.init()
|
||||||
@ -532,6 +536,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 新增子表信息init
|
// 新增子表信息init
|
||||||
createItemInit() {
|
createItemInit() {
|
||||||
|
this.formData.itemList = []
|
||||||
// 项目
|
// 项目
|
||||||
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("project", this.projectList)]
|
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)]
|
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) {
|
formatItem(type, list) {
|
||||||
if (!(list && list.length > 0)) {
|
if (!(list && list.length > 0)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user