Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #101 from Jzow/master
Browse files Browse the repository at this point in the history
Fix bug in multi-attribute selection product info
  • Loading branch information
Jzow authored Oct 19, 2023
2 parents 89b70bf + cecb005 commit 3f719e6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
15 changes: 15 additions & 0 deletions src/api/product/product.ts
Original file line number Diff line number Diff line change
@@ -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<BaseDataResp<number>>(
{
url: Api.getBarCode,
}
);
}
33 changes: 27 additions & 6 deletions src/views/product/info/components/ProductInfoModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -532,7 +533,7 @@ export default {
unitChecked.value = true
} else {
unitStatus.value = false;
manyUnitStatus.vaalue = true;
manyUnitStatus.value = true;
unitChecked.value = false
}
}
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
}
};
Expand Down

0 comments on commit 3f719e6

Please sign in to comment.