refactor: เก็บตัวเเปร record ของ tree
This commit is contained in:
parent
eb5c4b1560
commit
e45f55f4e3
1 changed files with 8 additions and 1 deletions
|
|
@ -19,8 +19,9 @@ import {
|
||||||
ProductOnWork,
|
ProductOnWork,
|
||||||
WorkCreate,
|
WorkCreate,
|
||||||
ServiceAndProduct,
|
ServiceAndProduct,
|
||||||
|
TreeProduct,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import useFlowStore from '../flow';
|
import useFlowStore from '../flow';
|
||||||
|
|
||||||
import useMyBranchStore from 'src/stores/my-branch';
|
import useMyBranchStore from 'src/stores/my-branch';
|
||||||
|
|
@ -28,6 +29,8 @@ import useMyBranchStore from 'src/stores/my-branch';
|
||||||
const useProductServiceStore = defineStore('api-product-service', () => {
|
const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
const useMyBranch = useMyBranchStore();
|
const useMyBranch = useMyBranchStore();
|
||||||
|
|
||||||
|
const recordTreeProductType = ref<Record<string, TreeProduct[]>>({});
|
||||||
|
|
||||||
// Product Type
|
// Product Type
|
||||||
const flowStore = useFlowStore();
|
const flowStore = useFlowStore();
|
||||||
|
|
||||||
|
|
@ -91,6 +94,9 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
|
|
||||||
if (!res) return false;
|
if (!res) return false;
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
if (!!opts?.productGroupId) {
|
||||||
|
recordTreeProductType.value[opts?.productGroupId] = res.data.result;
|
||||||
|
}
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -771,6 +777,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
workNameItems,
|
workNameItems,
|
||||||
|
recordTreeProductType,
|
||||||
|
|
||||||
fetchStatsProductType,
|
fetchStatsProductType,
|
||||||
fetchListProductServiceByIdType,
|
fetchListProductServiceByIdType,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue