feat: update status condition
This commit is contained in:
parent
b093e4b546
commit
594a416e3d
4 changed files with 48 additions and 32 deletions
|
|
@ -30,7 +30,7 @@ defineEmits<{
|
||||||
['status-color-waiting']: statusWaiting,
|
['status-color-waiting']: statusWaiting,
|
||||||
['step-status-active']: statusActive,
|
['step-status-active']: statusActive,
|
||||||
}"
|
}"
|
||||||
@click="statusWaiting ? undefined : $emit('click')"
|
@click="statusWaiting && !statusDone ? undefined : $emit('click')"
|
||||||
>
|
>
|
||||||
<div class="q-px-sm">
|
<div class="q-px-sm">
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -57,15 +57,15 @@ defineEmits<{
|
||||||
--_color: var(--blue-5-hsl);
|
--_color: var(--blue-5-hsl);
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
}
|
}
|
||||||
&.status-color-done {
|
&.status-color-waiting:not(.status-color-done) {
|
||||||
--_color: var(--green-5-hsl);
|
|
||||||
color: var(--foreground);
|
|
||||||
}
|
|
||||||
&.status-color-waiting {
|
|
||||||
--_color: var(--gray-4-hsl);
|
--_color: var(--gray-4-hsl);
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
cursor: not-allowed !important;
|
cursor: not-allowed !important;
|
||||||
}
|
}
|
||||||
|
&.status-color-done {
|
||||||
|
--_color: var(--green-5-hsl);
|
||||||
|
color: var(--foreground);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-status-active {
|
.step-status-active {
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ async function fetchList(opts?: { rotateFlowId?: boolean }) {
|
||||||
pageSize: pageSize.value,
|
pageSize: pageSize.value,
|
||||||
requestDataStatus:
|
requestDataStatus:
|
||||||
pageState.statusFilter === 'None' ? undefined : pageState.statusFilter,
|
pageState.statusFilter === 'None' ? undefined : pageState.statusFilter,
|
||||||
|
// responsibleOnly: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
import { baseUrl } from 'src/stores/utils';
|
import { baseUrl } from 'src/stores/utils';
|
||||||
|
|
||||||
import BadgeComponent from 'src/components/BadgeComponent.vue';
|
import BadgeComponent from 'src/components/BadgeComponent.vue';
|
||||||
|
|
@ -6,14 +7,14 @@ import BadgeComponent from 'src/components/BadgeComponent.vue';
|
||||||
import { ProductRelation, PayCondition } from 'src/stores/quotations/types';
|
import { ProductRelation, PayCondition } from 'src/stores/quotations/types';
|
||||||
import { Step, RequestWorkStatus } from 'src/stores/request-list/types';
|
import { Step, RequestWorkStatus } from 'src/stores/request-list/types';
|
||||||
|
|
||||||
const workStatus = [
|
const workStatus = ref([
|
||||||
RequestWorkStatus.Ready,
|
RequestWorkStatus.Ready,
|
||||||
RequestWorkStatus.Waiting,
|
RequestWorkStatus.Waiting,
|
||||||
RequestWorkStatus.InProgress,
|
RequestWorkStatus.InProgress,
|
||||||
RequestWorkStatus.Validate,
|
RequestWorkStatus.Validate,
|
||||||
RequestWorkStatus.Ended,
|
RequestWorkStatus.Ended,
|
||||||
RequestWorkStatus.Completed,
|
RequestWorkStatus.Completed,
|
||||||
];
|
]);
|
||||||
|
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
(
|
(
|
||||||
|
|
@ -22,7 +23,7 @@ defineEmits<{
|
||||||
): void;
|
): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
product: ProductRelation;
|
product: ProductRelation;
|
||||||
name: string;
|
name: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
|
@ -37,8 +38,30 @@ defineProps<{
|
||||||
payCondition: PayCondition;
|
payCondition: PayCondition;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
cancel?: boolean;
|
cancel?: boolean;
|
||||||
|
orderAble?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
function changeableStatus(currentStatus?: RequestWorkStatus) {
|
||||||
|
switch (currentStatus) {
|
||||||
|
case RequestWorkStatus.Ready:
|
||||||
|
case RequestWorkStatus.Waiting:
|
||||||
|
case RequestWorkStatus.InProgress:
|
||||||
|
return [RequestWorkStatus.Canceled];
|
||||||
|
case RequestWorkStatus.Validate:
|
||||||
|
case RequestWorkStatus.Ended:
|
||||||
|
case RequestWorkStatus.Completed:
|
||||||
|
case RequestWorkStatus.Canceled:
|
||||||
|
return [];
|
||||||
|
default:
|
||||||
|
if (props.readonly) return [];
|
||||||
|
if (props.orderAble) {
|
||||||
|
return [RequestWorkStatus.Ready, RequestWorkStatus.Canceled];
|
||||||
|
} else {
|
||||||
|
return [RequestWorkStatus.Ended, RequestWorkStatus.Canceled];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: Function
|
// NOTE: Function
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -87,9 +110,7 @@ defineProps<{
|
||||||
<div class="justify-end flex">
|
<div class="justify-end flex">
|
||||||
<q-btn-dropdown
|
<q-btn-dropdown
|
||||||
:disable="
|
:disable="
|
||||||
readonly ||
|
readonly || changeableStatus(status?.workStatus).length === 0
|
||||||
status?.workStatus === 'Waiting' ||
|
|
||||||
status?.workStatus === 'InProgress'
|
|
||||||
"
|
"
|
||||||
dense
|
dense
|
||||||
unelevated
|
unelevated
|
||||||
|
|
@ -104,11 +125,12 @@ defineProps<{
|
||||||
"
|
"
|
||||||
class="text-capitalize text-weight-regular product-status rounded"
|
class="text-capitalize text-weight-regular product-status rounded"
|
||||||
:class="{
|
:class="{
|
||||||
disable:
|
disable: $q.screen.gt.xs && readonly,
|
||||||
$q.screen.gt.xs &&
|
wait:
|
||||||
(readonly ||
|
($q.screen.gt.xs &&
|
||||||
status?.workStatus === RequestWorkStatus.Waiting ||
|
!readonly &&
|
||||||
status?.workStatus === RequestWorkStatus.InProgress),
|
status?.workStatus === RequestWorkStatus.Waiting) ||
|
||||||
|
status?.workStatus === RequestWorkStatus.InProgress,
|
||||||
pending:
|
pending:
|
||||||
$q.screen.gt.xs &&
|
$q.screen.gt.xs &&
|
||||||
!readonly &&
|
!readonly &&
|
||||||
|
|
@ -129,13 +151,7 @@ defineProps<{
|
||||||
!readonly &&
|
!readonly &&
|
||||||
status?.workStatus === RequestWorkStatus.Canceled,
|
status?.workStatus === RequestWorkStatus.Canceled,
|
||||||
}"
|
}"
|
||||||
:style="
|
:style="readonly ? `opacity: 30% !important` : ''"
|
||||||
readonly ||
|
|
||||||
status?.workStatus === RequestWorkStatus.Waiting ||
|
|
||||||
status?.workStatus === RequestWorkStatus.InProgress
|
|
||||||
? `opacity: 30% !important`
|
|
||||||
: ''
|
|
||||||
"
|
|
||||||
:menu-offset="[0, 8]"
|
:menu-offset="[0, 8]"
|
||||||
dropdown-icon="mdi-chevron-down"
|
dropdown-icon="mdi-chevron-down"
|
||||||
content-class="bordered rounded"
|
content-class="bordered rounded"
|
||||||
|
|
@ -143,14 +159,15 @@ defineProps<{
|
||||||
>
|
>
|
||||||
<q-list dense>
|
<q-list dense>
|
||||||
<q-item
|
<q-item
|
||||||
v-for="(value, index) in workStatus"
|
v-for="(value, index) in changeableStatus(status?.workStatus)"
|
||||||
:key="index"
|
:key="index"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
|
class="row items-center"
|
||||||
@click="
|
@click="
|
||||||
$emit('changeStatus', {
|
$emit('changeStatus', {
|
||||||
step: status,
|
step: status,
|
||||||
requestWorkStatus: workStatus[index],
|
requestWorkStatus: value,
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -194,10 +194,6 @@ async function triggerChangeStatusWork(step: Step, responsibleUserId?: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
if (successAll.value) {
|
|
||||||
await requestListStore.editStatusRequestWork(step, !!successAll.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function triggerChangeStatusFile(opt: {
|
async function triggerChangeStatusFile(opt: {
|
||||||
|
|
@ -503,7 +499,9 @@ function goToQuotation(
|
||||||
)?.workStatus;
|
)?.workStatus;
|
||||||
return (
|
return (
|
||||||
status === RequestWorkStatus.Completed ||
|
status === RequestWorkStatus.Completed ||
|
||||||
status === RequestWorkStatus.Ended
|
status === RequestWorkStatus.Ended ||
|
||||||
|
status === RequestWorkStatus.Canceled ||
|
||||||
|
(data?.requestDataStatus === 'Canceled' && !status)
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
|
|
@ -680,7 +678,7 @@ function goToQuotation(
|
||||||
(v) => v.id === getUserId(),
|
(v) => v.id === getUserId(),
|
||||||
))
|
))
|
||||||
"
|
"
|
||||||
:order-able="value._formExpansion"
|
:order-able="value._messengerExpansion"
|
||||||
:installment-info="getInstallmentInfo()"
|
:installment-info="getInstallmentInfo()"
|
||||||
:pay-success="
|
:pay-success="
|
||||||
isInstallmentPaySuccess(value.productService.installmentNo)
|
isInstallmentPaySuccess(value.productService.installmentNo)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue