Compare commits

...

3 Commits

View File

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