feat: rotate log id
This commit is contained in:
parent
7fedab36df
commit
14eb498133
1 changed files with 56 additions and 28 deletions
|
|
@ -20,9 +20,12 @@ import WorkNameManagement from 'src/components/04_product-service/WorkNameManage
|
|||
import useOptionStore from 'src/stores/options';
|
||||
import FormServiceProperties from 'src/components/04_product-service/FormServiceProperties.vue';
|
||||
|
||||
import useFlowStore from 'src/stores/flow';
|
||||
import { Status } from 'src/stores/types';
|
||||
import NoData from 'components/NoData.vue';
|
||||
|
||||
const flowStore = useFlowStore();
|
||||
|
||||
import { dialog, dialogWarningClose } from 'src/stores/utils';
|
||||
|
||||
import useProductServiceStore from 'src/stores/product-service';
|
||||
|
|
@ -100,6 +103,7 @@ const stat = ref<
|
|||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { onMounted } from 'vue';
|
||||
import { time } from 'console';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
|
@ -255,6 +259,7 @@ async function searchGroup() {
|
|||
if (resultList) {
|
||||
resultSearchGroup.value = resultList.result;
|
||||
}
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function searchProductAndService() {
|
||||
|
|
@ -265,6 +270,7 @@ async function searchProductAndService() {
|
|||
if (res) {
|
||||
productAndService.value = res.result;
|
||||
}
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function searchProduct(isAdd: boolean = true) {
|
||||
|
|
@ -286,6 +292,7 @@ async function searchProduct(isAdd: boolean = true) {
|
|||
});
|
||||
}
|
||||
}
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function searchService() {
|
||||
|
|
@ -301,12 +308,14 @@ async function searchService() {
|
|||
};
|
||||
});
|
||||
}
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function featchStatsService() {
|
||||
const resStatsService = await fetchStatsService();
|
||||
|
||||
totalService.value = resStatsService;
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function featchStatsProduct() {
|
||||
|
|
@ -315,6 +324,7 @@ async function featchStatsProduct() {
|
|||
});
|
||||
|
||||
totalProduct.value = resStatsProduct;
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function fetchListType() {
|
||||
|
|
@ -408,7 +418,7 @@ async function fetchListOfService() {
|
|||
}
|
||||
|
||||
async function searchType() {
|
||||
const res = await await fetchListProductServiceType({
|
||||
const res = await fetchListProductServiceType({
|
||||
query: inputSearch.value,
|
||||
productGroupId: currentId.value,
|
||||
});
|
||||
|
|
@ -459,6 +469,7 @@ async function toggleStatusProduct(id: string, status: Status) {
|
|||
});
|
||||
|
||||
await fetchListOfProduct(currentIdType.value);
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function toggleStatusService(id: string, status: Status) {
|
||||
|
|
@ -467,6 +478,7 @@ async function toggleStatusService(id: string, status: Status) {
|
|||
});
|
||||
|
||||
await fetchListOfService();
|
||||
flowStore.rotate();
|
||||
}
|
||||
async function toggleStatusType(id: string, status: Status) {
|
||||
await editProductServiceType(id, {
|
||||
|
|
@ -474,6 +486,7 @@ async function toggleStatusType(id: string, status: Status) {
|
|||
});
|
||||
|
||||
await fetchListType();
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function toggleStatusGroup(id: string, status: Status) {
|
||||
|
|
@ -482,6 +495,7 @@ async function toggleStatusGroup(id: string, status: Status) {
|
|||
});
|
||||
|
||||
await fetchListGroups();
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function fetchListOfProductAndService() {
|
||||
|
|
@ -528,6 +542,7 @@ async function deleteServiceById(serviceId?: string) {
|
|||
if (res) {
|
||||
totalService.value = totalService.value - 1;
|
||||
}
|
||||
flowStore.rotate();
|
||||
calculateStats();
|
||||
},
|
||||
cancel: () => {},
|
||||
|
|
@ -551,6 +566,7 @@ async function deleteTypeOfProduct(id?: string) {
|
|||
if (res) {
|
||||
totalProduct.value = totalProduct.value - 1;
|
||||
}
|
||||
flowStore.rotate();
|
||||
calculateStats();
|
||||
},
|
||||
cancel: () => {},
|
||||
|
|
@ -579,6 +595,7 @@ async function deleteProductById(productId?: string) {
|
|||
}
|
||||
await fetchListGroups();
|
||||
}
|
||||
flowStore.rotate();
|
||||
calculateStats();
|
||||
drawerInfo.value = false;
|
||||
},
|
||||
|
|
@ -594,6 +611,7 @@ function undoProductGroup() {
|
|||
code: previousValue.value.code,
|
||||
};
|
||||
isEdit.value = false;
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
function assignFormDataGroup(data: ProductGroup) {
|
||||
|
|
@ -617,14 +635,12 @@ const prevService = ref<ServiceCreate>({
|
|||
code: '',
|
||||
productTypeId: '',
|
||||
});
|
||||
const currentService = ref<ServiceById>();
|
||||
|
||||
async function assignFormDataProductService(id: string) {
|
||||
const res = await fetchListServiceById(id);
|
||||
|
||||
if (res) {
|
||||
statusToggle.value = res.status === 'INACTIVE' ? false : true;
|
||||
currentService.value = JSON.parse(JSON.stringify(res));
|
||||
|
||||
prevService.value = {
|
||||
code: res.code,
|
||||
|
|
@ -658,7 +674,7 @@ async function assignFormDataProductService(id: string) {
|
|||
product: item.productOnWork.map((productOnWorkItem) => {
|
||||
return {
|
||||
...productOnWorkItem.product,
|
||||
nameEn: productOnWorkItem.product.name,
|
||||
nameEn: '',
|
||||
};
|
||||
}),
|
||||
};
|
||||
|
|
@ -783,7 +799,7 @@ async function submitService() {
|
|||
if (productAndServiceTab.value === 'service') {
|
||||
await fetchListOfService();
|
||||
}
|
||||
|
||||
flowStore.rotate();
|
||||
clearFormService();
|
||||
}
|
||||
|
||||
|
|
@ -816,6 +832,8 @@ async function submitProduct() {
|
|||
if (productAndServiceTab.value === 'product') {
|
||||
await fetchListOfProduct(currentIdType.value);
|
||||
}
|
||||
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
async function submitGroup() {
|
||||
|
|
@ -832,6 +850,7 @@ async function submitGroup() {
|
|||
drawerInfo.value = false;
|
||||
await fetchListGroups();
|
||||
clearFormGroup();
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
function confirmDeleteWork(id: string) {
|
||||
|
|
@ -843,6 +862,7 @@ function confirmDeleteWork(id: string) {
|
|||
message: t('deleteConfirmMessage'),
|
||||
action: async () => {
|
||||
deleteWork(id);
|
||||
flowStore.rotate();
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
|
|
@ -897,53 +917,38 @@ async function calculateStats() {
|
|||
async function fetchStatus() {
|
||||
if (productAndServiceTab.value === 'all') {
|
||||
await fetchListOfProductAndService();
|
||||
flowStore.rotate();
|
||||
}
|
||||
if (productAndServiceTab.value === 'product') {
|
||||
await fetchListOfProduct(currentIdType.value);
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
||||
if (productAndServiceTab.value === 'service') {
|
||||
await fetchListOfService();
|
||||
flowStore.rotate();
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchSearch() {
|
||||
if (productAndServiceTab.value === 'all') {
|
||||
await searchProductAndService();
|
||||
flowStore.rotate();
|
||||
}
|
||||
if (productAndServiceTab.value === 'product') {
|
||||
await searchProduct(false);
|
||||
flowStore.rotate();
|
||||
}
|
||||
if (productAndServiceTab.value === 'service') {
|
||||
await searchService();
|
||||
flowStore.rotate();
|
||||
}
|
||||
}
|
||||
|
||||
function cloneData() {
|
||||
if (!currentService.value) return;
|
||||
formDataProductService.value = {
|
||||
...prevService.value,
|
||||
attributes: JSON.parse(JSON.stringify(currentService.value.attributes)),
|
||||
};
|
||||
|
||||
workItems.value = currentService.value.work.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
attributes: JSON.parse(JSON.stringify(item.attributes)),
|
||||
product: item.productOnWork.map((productOnWorkItem) => {
|
||||
return {
|
||||
...productOnWorkItem.product,
|
||||
nameEn: productOnWorkItem.product.name,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
calculateStats();
|
||||
await fetchListGroups();
|
||||
flowStore.rotate();
|
||||
});
|
||||
|
||||
watch(productMode, () => {
|
||||
|
|
@ -957,26 +962,32 @@ watch(currentStatus, async () => {
|
|||
} else {
|
||||
await fetchListType();
|
||||
}
|
||||
flowStore.rotate();
|
||||
});
|
||||
|
||||
watch(currentPageGroup, async () => {
|
||||
await fetchListGroups();
|
||||
flowStore.rotate();
|
||||
});
|
||||
|
||||
watch(currentPageType, async () => {
|
||||
await fetchListType();
|
||||
flowStore.rotate();
|
||||
});
|
||||
|
||||
watch(currentPageServiceAndProduct, async () => {
|
||||
await fetchListOfProductAndService();
|
||||
flowStore.rotate();
|
||||
});
|
||||
|
||||
watch(currentPageProduct, async () => {
|
||||
await fetchListOfProduct(currentIdType.value);
|
||||
flowStore.rotate();
|
||||
});
|
||||
|
||||
watch(currentPageService, async () => {
|
||||
await fetchListOfService();
|
||||
flowStore.rotate();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -1282,6 +1293,7 @@ watch(currentPageService, async () => {
|
|||
await featchStatsService();
|
||||
await featchStatsProduct();
|
||||
await fetchListOfProductAndService();
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
|
@ -1326,6 +1338,7 @@ watch(currentPageService, async () => {
|
|||
currentId = v.id;
|
||||
productMode = 'type';
|
||||
await fetchListType();
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
|
@ -1383,6 +1396,7 @@ watch(currentPageService, async () => {
|
|||
inputSearchProductAndService = '';
|
||||
currentStatus = 'All';
|
||||
await fetchListOfProductAndService();
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -1414,6 +1428,7 @@ watch(currentPageService, async () => {
|
|||
inputSearchProductAndService = '';
|
||||
currentStatus = 'All';
|
||||
await fetchListOfProduct(currentIdType);
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -1445,6 +1460,7 @@ watch(currentPageService, async () => {
|
|||
inputSearchProductAndService = '';
|
||||
currentStatus = 'All';
|
||||
await fetchListOfService();
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -1868,6 +1884,7 @@ watch(currentPageService, async () => {
|
|||
:close="
|
||||
() => {
|
||||
dialogProduct = false;
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -1914,6 +1931,7 @@ watch(currentPageService, async () => {
|
|||
() => {
|
||||
formDataProduct = { ...prevProduct };
|
||||
infoProductEdit = false;
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
:deleteData="
|
||||
|
|
@ -1929,6 +1947,7 @@ watch(currentPageService, async () => {
|
|||
:close="
|
||||
() => {
|
||||
dialogProductEdit = false;
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -1984,6 +2003,7 @@ watch(currentPageService, async () => {
|
|||
() => {
|
||||
clearFormService();
|
||||
dialogService = false;
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -2128,6 +2148,7 @@ watch(currentPageService, async () => {
|
|||
:close="
|
||||
() => {
|
||||
clearFormService();
|
||||
flowStore.rotate();
|
||||
dialogServiceEdit = false;
|
||||
}
|
||||
"
|
||||
|
|
@ -2139,8 +2160,9 @@ watch(currentPageService, async () => {
|
|||
:undo="
|
||||
() => {
|
||||
infoServiceEdit = false;
|
||||
cloneData();
|
||||
formDataProductService = { ...prevService };
|
||||
statusToggle = prevService.status === 'INACTIVE' ? false : true;
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
:delete-data="() => deleteServiceById()"
|
||||
|
|
@ -2165,6 +2187,12 @@ watch(currentPageService, async () => {
|
|||
v-if="currentServiceTab === 'serviceInformation'"
|
||||
dense
|
||||
service
|
||||
@service-properties="
|
||||
() => {
|
||||
tempValueProperties = formDataProductService.attributes;
|
||||
openPropertiesDialog('service');
|
||||
}
|
||||
"
|
||||
v-model:service-code="formDataProductService.code"
|
||||
v-model:service-description="formDataProductService.detail"
|
||||
v-model:service-name-th="formDataProductService.name"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue