From 01901d3efc4649d95144a367d608cdcd2fe357b2 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Wed, 30 Oct 2024 20:37:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=A1=BE=E9=97=AE=E4=BF=AE=E6=94=B9=E9=85=8D=E4=BB=B6=E5=94=AE?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stockOperate/Components/WaresItem.vue | 35 +++++ .../tickets/Components/TicketWaresShow.vue | 137 ++++++++++++------ 2 files changed, 129 insertions(+), 43 deletions(-) diff --git a/src/views/repair/stockOperate/Components/WaresItem.vue b/src/views/repair/stockOperate/Components/WaresItem.vue index 5008948..5e77f93 100644 --- a/src/views/repair/stockOperate/Components/WaresItem.vue +++ b/src/views/repair/stockOperate/Components/WaresItem.vue @@ -419,6 +419,12 @@ export default { // 提交 async handleSubmit() { try { + const isNull = this.validateNull(); + if (!isNull) return; + const names = this.validateZero() + if (names){ + await this.$modal.confirm("确认配件:" + names + "的采购价格为0吗?") + } await this.createInit() await createRepairSo(this.formData) this.inStockDialog = false @@ -457,6 +463,35 @@ export default { } })] }, + validateNull(){ + const flag = this.partList.map(item => { + const price = item.newPrice + if (price === null || price === ""){ + this.$modal.msgError("配件:" + item.name + "采购价格为空") + return false + }else { + return true + } + }) + let count = 0 + flag.forEach(item => { + if (!item){ + count++ + } + }) + return count === 0 + }, + validateZero(){ + const flag = this.partList.map(item => { + const price = parseFloat(item.newPrice) + if (price === 0){ + return item.name + }else { + return "" + } + }) + return flag.filter(item => item !== "").join(",") + } } } diff --git a/src/views/repair/tickets/Components/TicketWaresShow.vue b/src/views/repair/tickets/Components/TicketWaresShow.vue index a65565d..02ad1d8 100644 --- a/src/views/repair/tickets/Components/TicketWaresShow.vue +++ b/src/views/repair/tickets/Components/TicketWaresShow.vue @@ -123,13 +123,16 @@