refactor: handle warning responsible user is null
This commit is contained in:
parent
4653a54914
commit
d80e7e5f2b
1 changed files with 34 additions and 15 deletions
|
|
@ -15,7 +15,7 @@ import DutyExpansion from './DutyExpansion.vue';
|
|||
import MessengerExpansion from './MessengerExpansion.vue';
|
||||
|
||||
// NOTE: Store
|
||||
import { baseUrl } from 'src/stores/utils';
|
||||
import { baseUrl, dialog } from 'src/stores/utils';
|
||||
import { dateFormatJS } from 'src/utils/datetime';
|
||||
import { useRequestList } from 'src/stores/request-list';
|
||||
import {
|
||||
|
|
@ -44,7 +44,7 @@ import { CreatedBy } from 'src/stores/types';
|
|||
import { getUserId } from 'src/services/keycloak';
|
||||
import { QuotationFull } from 'src/stores/quotations/types';
|
||||
|
||||
const { locale } = useI18n();
|
||||
const { locale, t } = useI18n();
|
||||
|
||||
// NOTE: Variable
|
||||
const route = useRoute();
|
||||
|
|
@ -52,7 +52,7 @@ const optionStore = useOptionStore();
|
|||
const requestListStore = useRequestList();
|
||||
const flowTemplateStore = useWorkflowTemplate();
|
||||
|
||||
const workList = ref<RequestWork[]>();
|
||||
const workList = ref<RequestWork[]>([]);
|
||||
const statusFile = ref<Attributes>({
|
||||
customer: {},
|
||||
employee: {},
|
||||
|
|
@ -159,7 +159,20 @@ onMounted(async () => {
|
|||
|
||||
watch(() => route.params['requestListId'], getData);
|
||||
|
||||
async function triggerChangeStatusWork(step: Step) {
|
||||
async function triggerChangeStatusWork(step: Step, responsibleUserId?: string) {
|
||||
if (step.workStatus === 'Ready' && !responsibleUserId) {
|
||||
dialog({
|
||||
color: 'warning',
|
||||
icon: 'mdi-alert',
|
||||
title: t('form.warning.title'),
|
||||
actionText: t('dialog.action.ok'),
|
||||
message: t('dialog.message.warningSelectDeliveryStaff'),
|
||||
action: async () => {
|
||||
await nextTick();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const res = await requestListStore.editStatusRequestWork(step);
|
||||
if (res) {
|
||||
const indexWork = workList.value?.findIndex(
|
||||
|
|
@ -683,14 +696,18 @@ function goToQuotation(
|
|||
:product="value.productService.product"
|
||||
@change-status="
|
||||
(v) => {
|
||||
triggerChangeStatusWork({
|
||||
workStatus: v.requestWorkStatus,
|
||||
step:
|
||||
v.step === undefined
|
||||
? pageState.currentStep
|
||||
: v.step.step,
|
||||
requestWorkId: value.id || '',
|
||||
});
|
||||
triggerChangeStatusWork(
|
||||
{
|
||||
workStatus: v.requestWorkStatus,
|
||||
step:
|
||||
v.step === undefined
|
||||
? pageState.currentStep
|
||||
: v.step.step,
|
||||
requestWorkId: value.id || '',
|
||||
},
|
||||
value.stepStatus?.[pageState.currentStep - 1]
|
||||
.responsibleUserId,
|
||||
);
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -764,7 +781,9 @@ function goToQuotation(
|
|||
"
|
||||
/>
|
||||
<MessengerExpansion
|
||||
v-if="value._messengerExpansion"
|
||||
v-if="
|
||||
value._messengerExpansion && value.stepStatus.length !== 0
|
||||
"
|
||||
:readonly="
|
||||
data.requestDataStatus === RequestDataStatus.Canceled
|
||||
"
|
||||
|
|
@ -773,8 +792,8 @@ function goToQuotation(
|
|||
requestWorkId: value.id || '',
|
||||
}"
|
||||
:id="value.id"
|
||||
:attributes-form="
|
||||
value.stepStatus?.[pageState.currentStep - 1]
|
||||
v-model:attributes-form="
|
||||
value.stepStatus[pageState.currentStep - 1]
|
||||
"
|
||||
:responsible-area-district-id="
|
||||
data.quotation.customerBranch.districtId
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue