删除根目录的node_modules
This commit is contained in:
41
gear-ui3/src/store/modules/product.js
Normal file
41
gear-ui3/src/store/modules/product.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { listProduct } from '@/api/oa/product';
|
||||
import { listBomItem } from '@/api/oa/bomItem';
|
||||
|
||||
const useProductStore = defineStore('product', {
|
||||
state: () => ({
|
||||
productMap: {},
|
||||
bomMap: {},
|
||||
}),
|
||||
|
||||
actions: {
|
||||
setProductMap(productMap) {
|
||||
this.productMap = productMap;
|
||||
},
|
||||
setBomMap(bomMap) {
|
||||
this.bomMap = bomMap;
|
||||
},
|
||||
async getBomInfo(bomId) {
|
||||
try {
|
||||
if (!this.bomMap[bomId]) {
|
||||
const res = await listBomItem({ bomId });
|
||||
this.bomMap[bomId] = res.rows;
|
||||
}
|
||||
return this.bomMap[bomId];
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return [];
|
||||
}
|
||||
},
|
||||
fetchProductMap() {
|
||||
listProduct().then(res => {
|
||||
const map = {};
|
||||
res.data.forEach(item => {
|
||||
map[item.productId] = item;
|
||||
});
|
||||
this.productMap = map;
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
export default useProductStore;
|
||||
Reference in New Issue
Block a user