fix: Not enough time to assign worker to selectedWorker
This commit is contained in:
parent
13cf2da9f9
commit
bd2933f9d3
1 changed files with 17 additions and 13 deletions
|
|
@ -321,12 +321,21 @@ function toggleDeleteProduct(index: number) {
|
||||||
deleteItem(productServiceList.value, index);
|
deleteItem(productServiceList.value, index);
|
||||||
}
|
}
|
||||||
async function assignWorkerToSelectedWorker() {
|
async function assignWorkerToSelectedWorker() {
|
||||||
quotationFormData.value.worker.forEach((value, i) => {
|
if (quotationFormData.value.customerBranchId) {
|
||||||
const tempValue: Employee | undefined = workerList.value.find(
|
const retEmp = await customerStore.fetchBranchEmployee(
|
||||||
(v) => v.id === value.id,
|
quotationFormData.value.customerBranchId,
|
||||||
);
|
);
|
||||||
if (tempValue !== undefined) selectedWorker.value.push(tempValue);
|
if (retEmp) {
|
||||||
});
|
workerList.value = retEmp.data.result;
|
||||||
|
|
||||||
|
quotationFormData.value.worker.forEach((value) => {
|
||||||
|
const tempValue: Employee | undefined = workerList.value.find(
|
||||||
|
(v) => v.id === value.id,
|
||||||
|
);
|
||||||
|
if (tempValue !== undefined) selectedWorker.value.push(tempValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertToTable(nodes: Node[]) {
|
function convertToTable(nodes: Node[]) {
|
||||||
|
|
@ -463,13 +472,6 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
if (ret) productGroup.value = ret.result;
|
if (ret) productGroup.value = ret.result;
|
||||||
|
|
||||||
if (quotationFormData.value.customerBranchId) {
|
|
||||||
const retEmp = await customerStore.fetchBranchEmployee(
|
|
||||||
quotationFormData.value.customerBranchId,
|
|
||||||
);
|
|
||||||
if (retEmp) workerList.value = retEmp.data.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
currentQuotationId.value !== undefined &&
|
currentQuotationId.value !== undefined &&
|
||||||
quotationFormState.value.mode !== 'create'
|
quotationFormState.value.mode !== 'create'
|
||||||
|
|
@ -477,8 +479,10 @@ onMounted(async () => {
|
||||||
await quotationForm.assignFormData(
|
await quotationForm.assignFormData(
|
||||||
currentQuotationId.value,
|
currentQuotationId.value,
|
||||||
quotationFormState.value.mode,
|
quotationFormState.value.mode,
|
||||||
|
async () => {
|
||||||
|
await assignWorkerToSelectedWorker();
|
||||||
|
},
|
||||||
);
|
);
|
||||||
await assignWorkerToSelectedWorker();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pageState.isLoaded = true;
|
pageState.isLoaded = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue