refactor: correct the typo

This commit is contained in:
Thanaphon Frappet 2024-11-05 09:45:43 +07:00
parent f96837b133
commit a848beb1bf

View file

@ -494,7 +494,7 @@ const totalGroup = ref<number>(0);
const total = ref<number>(0); const total = ref<number>(0);
// id // id
const currentIdGrop = ref<string>(''); const currentIdGroup = ref<string>('');
const currentIdType = ref<string>(''); const currentIdType = ref<string>('');
const currentIdService = ref<string>(''); const currentIdService = ref<string>('');
const currentIdProduct = ref<string>(''); const currentIdProduct = ref<string>('');
@ -628,7 +628,7 @@ async function fetchListOfProduct() {
: currentStatus.value === 'ACTIVE' : currentStatus.value === 'ACTIVE'
? 'ACTIVE' ? 'ACTIVE'
: undefined, : undefined,
productGroupId: currentIdGrop.value, productGroupId: currentIdGroup.value,
}); });
if (res) { if (res) {
@ -661,7 +661,7 @@ async function fetchListOfService() {
: currentStatus.value === 'ACTIVE' : currentStatus.value === 'ACTIVE'
? 'ACTIVE' ? 'ACTIVE'
: undefined, : undefined,
productGroupId: currentIdGrop.value, productGroupId: currentIdGroup.value,
}); });
if (res) { if (res) {
@ -820,7 +820,7 @@ async function deleteProductById(productId?: string) {
if (editByTree.value === 'group') { if (editByTree.value === 'group') {
// Product Group // Product Group
const res = await deleteProductGroup( const res = await deleteProductGroup(
productId ?? currentIdGrop.value, productId ?? currentIdGroup.value,
); );
if (res) { if (res) {
} }
@ -835,7 +835,7 @@ async function deleteProductById(productId?: string) {
if (productMode.value === 'group') { if (productMode.value === 'group') {
// Product Group // Product Group
const res = await deleteProductGroup( const res = await deleteProductGroup(
productId ?? currentIdGrop.value, productId ?? currentIdGroup.value,
); );
if (res) { if (res) {
} }
@ -1099,12 +1099,12 @@ function assignFormDataProductServiceCreate() {
async function submitService(notClose = false) { async function submitService(notClose = false) {
assignFormDataProductServiceCreate(); assignFormDataProductServiceCreate();
formDataProductService.value.productGroupId = currentIdGrop.value; formDataProductService.value.productGroupId = currentIdGroup.value;
if (profileFileImg.value) if (profileFileImg.value)
formDataProductService.value.image = profileFileImg.value; formDataProductService.value.image = profileFileImg.value;
if (dialogService.value) { if (dialogService.value) {
formDataProductService.value.productGroupId = currentIdGrop.value; formDataProductService.value.productGroupId = currentIdGroup.value;
if ( if (
formDataProductService.value.code === '' || formDataProductService.value.code === '' ||
@ -1145,7 +1145,7 @@ async function submitService(notClose = false) {
} }
async function submitProduct(notClose = false) { async function submitProduct(notClose = false) {
formDataProduct.value.productGroupId = currentIdGrop.value; formDataProduct.value.productGroupId = currentIdGroup.value;
if (profileFileImg.value) { if (profileFileImg.value) {
formDataProduct.value.image = profileFileImg.value; formDataProduct.value.image = profileFileImg.value;
} }
@ -1190,7 +1190,7 @@ async function submitGroup() {
if (drawerInfo.value) { if (drawerInfo.value) {
if (currentIdGropTree.value) if (currentIdGropTree.value)
await editProductGroup(currentIdGropTree.value, formDataGroup.value); await editProductGroup(currentIdGropTree.value, formDataGroup.value);
else await editProductGroup(currentIdGrop.value, formDataGroup.value); else await editProductGroup(currentIdGroup.value, formDataGroup.value);
} else { } else {
const res = await createProductGroup(formDataGroup.value); const res = await createProductGroup(formDataGroup.value);
@ -1316,7 +1316,7 @@ async function calculateStats(opt?: {
}) { }) {
if (opt && opt.type === 'service' && productMode.value === 'service') { if (opt && opt.type === 'service' && productMode.value === 'service') {
const resStatsService = await fetchStatsService({ const resStatsService = await fetchStatsService({
productGroupId: currentIdGrop.value, productGroupId: currentIdGroup.value,
}); });
stat.value[1].count = resStatsService ?? 0; stat.value[1].count = resStatsService ?? 0;
return; return;
@ -1324,7 +1324,7 @@ async function calculateStats(opt?: {
if (opt && opt.type === 'product' && productMode.value === 'product') { if (opt && opt.type === 'product' && productMode.value === 'product') {
const resStatsProduct = await fetchStatsProduct({ const resStatsProduct = await fetchStatsProduct({
productGroupId: currentIdGrop.value, productGroupId: currentIdGroup.value,
}); });
stat.value[2].count = resStatsProduct ?? 0; stat.value[2].count = resStatsProduct ?? 0;
return; return;
@ -1403,7 +1403,7 @@ async function enterGroup(
expandedTree.value.push(id); expandedTree.value.push(id);
pathGroupName.value = name; pathGroupName.value = name;
currentIdType.value = ''; currentIdType.value = '';
currentIdGrop.value = id; currentIdGroup.value = id;
currentNoAction.value = status === 'INACTIVE'; currentNoAction.value = status === 'INACTIVE';
pathTypeName.value = name; pathTypeName.value = name;
@ -1477,7 +1477,7 @@ onMounted(async () => {
i18n: true, i18n: true,
handler: () => { handler: () => {
expandedTree.value = []; expandedTree.value = [];
currentIdGrop.value = ''; currentIdGroup.value = '';
productMode.value = 'group'; productMode.value = 'group';
}, },
}, },
@ -1503,7 +1503,7 @@ watch(
handler: () => { handler: () => {
productMode.value = 'group'; productMode.value = 'group';
expandedTree.value = []; expandedTree.value = [];
currentIdGrop.value = ''; currentIdGroup.value = '';
currentIdType.value = ''; currentIdType.value = '';
filterStat.value = []; filterStat.value = [];
}, },
@ -1716,17 +1716,17 @@ watch(
@select=" @select="
async (v: (typeof treeProductTypeAndGroup)[number]) => { async (v: (typeof treeProductTypeAndGroup)[number]) => {
if (v.type === 'group') { if (v.type === 'group') {
if (currentIdGrop !== v.id) { if (currentIdGroup !== v.id) {
await enterGroup(v.id, v.name, v.status); await enterGroup(v.id, v.name, v.status);
return; return;
} }
if (currentIdGrop === v.id) { if (currentIdGroup === v.id) {
expandedTree = []; expandedTree = [];
filterStat = []; filterStat = [];
expandedTree = expandedTree.filter((i) => v.id !== i); expandedTree = expandedTree.filter((i) => v.id !== i);
currentIdGrop = ''; currentIdGroup = '';
currentIdType = ''; currentIdType = '';
productMode = 'group'; productMode = 'group';
currentNoAction = false; currentNoAction = false;
@ -2116,7 +2116,7 @@ watch(
clearFormGroup(); clearFormGroup();
await assignFormDataGroup(props.row); await assignFormDataGroup(props.row);
isEdit = false; isEdit = false;
currentIdGrop = props.row.id; currentIdGroup = props.row.id;
drawerInfo = true; drawerInfo = true;
} }
} }
@ -2136,7 +2136,7 @@ watch(
clearFormGroup(); clearFormGroup();
await assignFormDataGroup(props.row); await assignFormDataGroup(props.row);
isEdit = false; isEdit = false;
currentIdGrop = props.row.id; currentIdGroup = props.row.id;
drawerInfo = true; drawerInfo = true;
} }
} }
@ -2148,7 +2148,7 @@ watch(
clearFormGroup(); clearFormGroup();
await assignFormDataGroup(props.row); await assignFormDataGroup(props.row);
isEdit = true; isEdit = true;
currentIdGrop = props.row.id; currentIdGroup = props.row.id;
drawerInfo = true; drawerInfo = true;
} }
@ -2208,7 +2208,7 @@ watch(
clearFormGroup(); clearFormGroup();
await assignFormDataGroup(props.row); await assignFormDataGroup(props.row);
isEdit = false; isEdit = false;
currentIdGrop = props.row.id; currentIdGroup = props.row.id;
drawerInfo = true; drawerInfo = true;
} }
} }
@ -2219,7 +2219,7 @@ watch(
clearFormGroup(); clearFormGroup();
await assignFormDataGroup(props.row); await assignFormDataGroup(props.row);
isEdit = true; isEdit = true;
currentIdGrop = props.row.id; currentIdGroup = props.row.id;
drawerInfo = true; drawerInfo = true;
} }
@ -4023,7 +4023,7 @@ watch(
dense dense
@add-product=" @add-product="
async (index) => { async (index) => {
await fetchListOfProductIsAdd(currentIdGrop); await fetchListOfProductIsAdd(currentIdGroup);
currentWorkIndex = index; currentWorkIndex = index;
selectProduct = JSON.parse( selectProduct = JSON.parse(
JSON.stringify(workItems[currentWorkIndex].product), JSON.stringify(workItems[currentWorkIndex].product),
@ -4419,7 +4419,7 @@ watch(
:price-display="priceDisplay" :price-display="priceDisplay"
@add-product=" @add-product="
async (index) => { async (index) => {
await fetchListOfProductIsAdd(currentIdGrop); await fetchListOfProductIsAdd(currentIdGroup);
currentWorkIndex = index; currentWorkIndex = index;
selectProduct = JSON.parse( selectProduct = JSON.parse(
JSON.stringify(workItems[currentWorkIndex].product), JSON.stringify(workItems[currentWorkIndex].product),
@ -4496,7 +4496,7 @@ watch(
clearFormGroup(); clearFormGroup();
await assignFormDataGroup(currentNode); await assignFormDataGroup(currentNode);
isEdit = false; isEdit = false;
currentIdGrop = currentNode.id; currentIdGroup = currentNode.id;
drawerInfo = true; drawerInfo = true;
} }
} }
@ -4523,7 +4523,7 @@ watch(
clearFormGroup(); clearFormGroup();
await assignFormDataGroup(currentNode); await assignFormDataGroup(currentNode);
isEdit = true; isEdit = true;
currentIdGrop = currentNode.id; currentIdGroup = currentNode.id;
drawerInfo = true; drawerInfo = true;
} }