From 2c198e67b97d8729b82d3a4139d7251ab76c76f7 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Wed, 20 Nov 2024 15:34:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E7=AE=A1=E7=9A=84=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E5=8D=95=E5=92=8C=E5=85=A5=E5=BA=93=E5=8D=95=E6=9C=AA=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E7=9A=84=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inOutWarehouse/inOutWarehouse.vue | 41 +- pages-warehouse/inOutWarehouse/part.vue | 357 ++++++++++++++---- 2 files changed, 324 insertions(+), 74 deletions(-) diff --git a/pages-warehouse/inOutWarehouse/inOutWarehouse.vue b/pages-warehouse/inOutWarehouse/inOutWarehouse.vue index ac8d742..6ecbe3d 100644 --- a/pages-warehouse/inOutWarehouse/inOutWarehouse.vue +++ b/pages-warehouse/inOutWarehouse/inOutWarehouse.vue @@ -17,7 +17,10 @@ - {{ item.waresName }} + + + {{ item.waresName }} + 单位: {{ item.wares.unit }} @@ -74,7 +77,8 @@ export default { formData: {}, active: '', isToBeReviewed: true, - query: null + query: null, + selectRows: [] }; }, onLoad(data) { @@ -91,7 +95,21 @@ export default { computed: {}, methods: { - handleSearch(){ + chooseItem(item) { + const index = this.selectRows.findIndex(i => i.id === item.id) + const parentIndex = this.wares.findIndex(i => i.id === item.id) + if (index === -1) { + this.$set(item, 'isSelected', true) + this.selectRows.push(item) + } else { + this.$set(item, 'isSelected', false) + this.selectRows.splice(index, 1) + } + if (parentIndex !== -1) { + this.$set(this.wares, parentIndex, item) + } + }, + handleSearch() { this.init() }, /** @@ -108,12 +126,12 @@ export default { params: params }).then((res) => { this.wares = res.data - if (this.isToBeReviewed){ + if (this.isToBeReviewed) { this.wares = this.wares.filter(item => item.waresStatus === '1') this.wares = this.wares.filter(item => this.isReceive ? (item.waresCount > item.waresAlreadyCount) : (item.waresAlreadyCount > 0)) } this.wares.forEach(item => { - if (!item.wares.stock){ + if (!item.wares.stock) { item.wares.stock = 0 } if (this.isReceive) { @@ -128,6 +146,11 @@ export default { item.maxNum = item.waresAlreadyCount item.thisNum = 0 } + if (!this.selectRows || this.selectRows.length === 0){ + item.isSelected = false + }else { + item.isSelected = this.selectRows.findIndex(i => i.id === item.id) !== -1 + } }) // res.data.map((item)=>{ // if(!item.waresAlreadyCount){ @@ -208,7 +231,7 @@ export default { } // 过滤一下,thisNum不等0才行 const flag = this.wares.filter(item => item.thisNum > 0) - if (!flag || flag.length === 0){ + if (!flag || flag.length === 0) { uni.showToast({ title: '请设置配件数量!', icon: 'none' @@ -252,7 +275,11 @@ export default { */ toPart() { const formData = this.formData; - formData.items = this.wares; + if (this.selectRows && this.selectRows.length > 0) { + formData.items = this.selectRows + } else { + formData.items = this.wares; + } setJSONData("applyWaresForm", formData) uni.navigateTo({ url: '/pages-warehouse/inOutWarehouse/part' diff --git a/pages-warehouse/inOutWarehouse/part.vue b/pages-warehouse/inOutWarehouse/part.vue index 23c6e43..01835d8 100644 --- a/pages-warehouse/inOutWarehouse/part.vue +++ b/pages-warehouse/inOutWarehouse/part.vue @@ -8,6 +8,11 @@ 查询 + + 关键字 + + 查询 + 备注 @@ -15,16 +20,76 @@