fix: work type and function
This commit is contained in:
parent
a02dd8b5e0
commit
12e52e4a79
1 changed files with 11 additions and 4 deletions
|
|
@ -24,7 +24,9 @@ import { ref } from 'vue';
|
|||
const useProductServiceStore = defineStore('api-product-service', () => {
|
||||
// Product Type
|
||||
|
||||
const workNameItems = ref<string[]>([]);
|
||||
const workNameItems = ref<{ id: string; name: string; isEdit: boolean }[]>(
|
||||
[],
|
||||
);
|
||||
|
||||
async function fetchStatsProductType() {
|
||||
const res = await api.get('/product-type/stats');
|
||||
|
|
@ -589,6 +591,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
|||
if (!res) return false;
|
||||
|
||||
if (res.status === 201) {
|
||||
await fetchListOfWork();
|
||||
return res.data;
|
||||
}
|
||||
|
||||
|
|
@ -616,18 +619,20 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
|||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
await fetchListOfWork();
|
||||
return res.data;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async function deleteWork(serviceId: string) {
|
||||
const res = await api.delete(`/work/${serviceId}`);
|
||||
async function deleteWork(workId: string) {
|
||||
const res = await api.delete(`/work/${workId}`);
|
||||
|
||||
if (!res) return false;
|
||||
|
||||
if (res.status === 200) {
|
||||
await fetchListOfWork();
|
||||
return res.data;
|
||||
}
|
||||
|
||||
|
|
@ -674,7 +679,9 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
|||
const res = await fetchListWork();
|
||||
|
||||
if (res) {
|
||||
workNameItems.value = res.result.map((item) => item.name);
|
||||
workNameItems.value = res.result.map((item) => {
|
||||
return { id: item.id, name: item.name, isEdit: false };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue