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';
|
import MessengerExpansion from './MessengerExpansion.vue';
|
||||||
|
|
||||||
// NOTE: Store
|
// NOTE: Store
|
||||||
import { baseUrl } from 'src/stores/utils';
|
import { baseUrl, dialog } from 'src/stores/utils';
|
||||||
import { dateFormatJS } from 'src/utils/datetime';
|
import { dateFormatJS } from 'src/utils/datetime';
|
||||||
import { useRequestList } from 'src/stores/request-list';
|
import { useRequestList } from 'src/stores/request-list';
|
||||||
import {
|
import {
|
||||||
|
|
@ -44,7 +44,7 @@ import { CreatedBy } from 'src/stores/types';
|
||||||
import { getUserId } from 'src/services/keycloak';
|
import { getUserId } from 'src/services/keycloak';
|
||||||
import { QuotationFull } from 'src/stores/quotations/types';
|
import { QuotationFull } from 'src/stores/quotations/types';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale, t } = useI18n();
|
||||||
|
|
||||||
// NOTE: Variable
|
// NOTE: Variable
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
@ -52,7 +52,7 @@ const optionStore = useOptionStore();
|
||||||
const requestListStore = useRequestList();
|
const requestListStore = useRequestList();
|
||||||
const flowTemplateStore = useWorkflowTemplate();
|
const flowTemplateStore = useWorkflowTemplate();
|
||||||
|
|
||||||
const workList = ref<RequestWork[]>();
|
const workList = ref<RequestWork[]>([]);
|
||||||
const statusFile = ref<Attributes>({
|
const statusFile = ref<Attributes>({
|
||||||
customer: {},
|
customer: {},
|
||||||
employee: {},
|
employee: {},
|
||||||
|
|
@ -159,7 +159,20 @@ onMounted(async () => {
|
||||||
|
|
||||||
watch(() => route.params['requestListId'], getData);
|
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);
|
const res = await requestListStore.editStatusRequestWork(step);
|
||||||
if (res) {
|
if (res) {
|
||||||
const indexWork = workList.value?.findIndex(
|
const indexWork = workList.value?.findIndex(
|
||||||
|
|
@ -683,14 +696,18 @@ function goToQuotation(
|
||||||
:product="value.productService.product"
|
:product="value.productService.product"
|
||||||
@change-status="
|
@change-status="
|
||||||
(v) => {
|
(v) => {
|
||||||
triggerChangeStatusWork({
|
triggerChangeStatusWork(
|
||||||
|
{
|
||||||
workStatus: v.requestWorkStatus,
|
workStatus: v.requestWorkStatus,
|
||||||
step:
|
step:
|
||||||
v.step === undefined
|
v.step === undefined
|
||||||
? pageState.currentStep
|
? pageState.currentStep
|
||||||
: v.step.step,
|
: v.step.step,
|
||||||
requestWorkId: value.id || '',
|
requestWorkId: value.id || '',
|
||||||
});
|
},
|
||||||
|
value.stepStatus?.[pageState.currentStep - 1]
|
||||||
|
.responsibleUserId,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -764,7 +781,9 @@ function goToQuotation(
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<MessengerExpansion
|
<MessengerExpansion
|
||||||
v-if="value._messengerExpansion"
|
v-if="
|
||||||
|
value._messengerExpansion && value.stepStatus.length !== 0
|
||||||
|
"
|
||||||
:readonly="
|
:readonly="
|
||||||
data.requestDataStatus === RequestDataStatus.Canceled
|
data.requestDataStatus === RequestDataStatus.Canceled
|
||||||
"
|
"
|
||||||
|
|
@ -773,8 +792,8 @@ function goToQuotation(
|
||||||
requestWorkId: value.id || '',
|
requestWorkId: value.id || '',
|
||||||
}"
|
}"
|
||||||
:id="value.id"
|
:id="value.id"
|
||||||
:attributes-form="
|
v-model:attributes-form="
|
||||||
value.stepStatus?.[pageState.currentStep - 1]
|
value.stepStatus[pageState.currentStep - 1]
|
||||||
"
|
"
|
||||||
:responsible-area-district-id="
|
:responsible-area-district-id="
|
||||||
data.quotation.customerBranch.districtId
|
data.quotation.customerBranch.districtId
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue