refactor: update emit type and simplify attribute handling in MessengerExpansion and RequestListView components

This commit is contained in:
puriphatt 2024-12-26 13:45:36 +07:00
parent a709ab6692
commit f485d95e81
2 changed files with 5 additions and 9 deletions

View file

@ -16,7 +16,7 @@ const props = defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'updateAttributes', value: AttributesForm): void; (e: 'updateAttributes', value: Step): void;
}>(); }>();
const requestListStore = useRequestList(); const requestListStore = useRequestList();
@ -69,7 +69,7 @@ async function triggerSubmit() {
if (res) { if (res) {
attributesForm.value = JSON.parse(JSON.stringify(formData.value)); attributesForm.value = JSON.parse(JSON.stringify(formData.value));
state.isEdit = false; state.isEdit = false;
emit('updateAttributes', attributesForm.value); emit('updateAttributes', res);
} }
} }

View file

@ -169,10 +169,11 @@ async function triggerChangeStatusWork(step: Step, responsibleUserId?: string) {
message: t('dialog.message.warningSelectDeliveryStaff'), message: t('dialog.message.warningSelectDeliveryStaff'),
action: async () => { action: async () => {
await nextTick(); await nextTick();
return;
}, },
}); });
return;
} }
const res = await requestListStore.editStatusRequestWork(step); const res = await requestListStore.editStatusRequestWork(step);
if (res) { if (res) {
const indexWork = workList.value?.findIndex( const indexWork = workList.value?.findIndex(
@ -782,12 +783,7 @@ function goToQuotation(
" "
@update-attributes=" @update-attributes="
(opt) => { (opt) => {
value.stepStatus[ value.stepStatus[pageState.currentStep - 1] = opt;
pageState.currentStep - 1
].responsibleUserId = opt.responsibleUserId;
value.stepStatus[
pageState.currentStep - 1
].responsibleUserLocal = opt.responsibleUserLocal;
} }
" "
/> />