From c4d2aafc584850ba330a1a42263e1de809ba0a33 Mon Sep 17 00:00:00 2001 From: jameszow Date: Fri, 20 Oct 2023 02:31:38 +0800 Subject: [PATCH 1/2] Fix bug in multi-attribute selection --- .../info/components/ProductInfoModal.vue | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/views/product/info/components/ProductInfoModal.vue b/src/views/product/info/components/ProductInfoModal.vue index bb5cef6..8f4b0f1 100644 --- a/src/views/product/info/components/ProductInfoModal.vue +++ b/src/views/product/info/components/ProductInfoModal.vue @@ -336,6 +336,7 @@ import {getCategoryList} from "/@/api/product/productCategory" import {ProductUnitQueryReq} from "/@/api/product/model/productUnitModel" import {DefaultOptionType} from "ant-design-vue/es/vc-tree-select/TreeSelect"; import {ProductAttributeListReq} from "@/api/product/model/productAttributeModel" +import {getBarCode} from "@/api/product/product" import {getAttributeList, getAttributeById} from "@/api/product/productAttribute" export default { @@ -532,7 +533,7 @@ export default { unitChecked.value = true } else { unitStatus.value = false; - manyUnitStatus.vaalue = true; + manyUnitStatus.value = true; unitChecked.value = false } } @@ -697,7 +698,27 @@ export default { } skuArr.value = arr; - console.info(skuArr.value); + loadBarCode(); + } + + function loadBarCode(){ + getBarCode().then(res => { + if (res && res.code==='00000') { + let maxBarCode = res.data + if (skuArr.value.length > 0) { + meTable.dataSource.splice(0); // 清空meTableData数组 + for (let i = 0; i < skuArr.value.length; i++) { + let currentBarCode = maxBarCode + i + const newRowData = {key: i, unit: unit, barCode: currentBarCode, sku: skuArr.value[i]} + meTable.dataSource.push(newRowData); + } + meTable.dataSource.forEach(row => { + edit(row.key); + }); + console.info(meTable.dataSource); + } + } + }) } watch(manySkuSelected, (value) => { @@ -783,10 +804,10 @@ export default { }; const edit = (key) => { - if (key === 0) { - editableData[0] = cloneDeep(meTable.dataSource.find(item => item.key === 0)); - } else { - editableData[key] = cloneDeep(meTable.dataSource.find(item => item.key === key)); + const rowData = meTable.dataSource.find(item => item.key === key); + if (rowData) { + console.info("能不能修改key: " + key) + editableData[key] = cloneDeep(rowData); } }; From cecb0051fb3e076f702d128e327a00ba2d1b62e1 Mon Sep 17 00:00:00 2001 From: jameszow Date: Fri, 20 Oct 2023 02:31:53 +0800 Subject: [PATCH 2/2] API for adding product barcodes --- src/api/product/product.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/api/product/product.ts diff --git a/src/api/product/product.ts b/src/api/product/product.ts new file mode 100644 index 0000000..8d6736a --- /dev/null +++ b/src/api/product/product.ts @@ -0,0 +1,15 @@ +import {defHttp} from '/@/utils/http/axios'; +import { ErrorMessageMode } from '/#/axios'; +import {BaseDataResp} from "@/api/model/baseModel"; + +enum Api { + getBarCode = '/product/getBarCode', +} + +export function getBarCode() { + return defHttp.get>( + { + url: Api.getBarCode, + } + ); +} \ No newline at end of file