refactor: show all product and add column status and edit format remark
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s
This commit is contained in:
parent
145784ee40
commit
550ed55de0
7 changed files with 92 additions and 16 deletions
|
|
@ -159,6 +159,7 @@ export default {
|
|||
period: 'Period',
|
||||
documentStatus: 'Document Status',
|
||||
advanceSearch: 'Advance Search',
|
||||
totalPeople: '{meg} people',
|
||||
},
|
||||
|
||||
menu: {
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ export default {
|
|||
period: 'ช่วงเวลา',
|
||||
documentStatus: 'สถานะเอกสาร',
|
||||
advanceSearch: 'ค้นหาขั้นสูง',
|
||||
totalPeople: '{meg} คน',
|
||||
},
|
||||
|
||||
menu: {
|
||||
|
|
|
|||
|
|
@ -227,6 +227,12 @@ export const productColumn = [
|
|||
label: 'taskOrder.productList',
|
||||
field: 'productList',
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
align: 'center',
|
||||
label: 'general.status',
|
||||
field: 'status',
|
||||
},
|
||||
{
|
||||
name: 'amountOfEmployee',
|
||||
align: 'center',
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import { baseUrl, formatNumberDecimal, commaInput } from 'src/stores/utils';
|
|||
import { precisionRound } from 'src/utils/arithmetic';
|
||||
import { useConfigStore } from 'stores/config';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import BadgeComponent from 'src/components/BadgeComponent.vue';
|
||||
import { TaskStatus } from 'src/stores/task-order/types';
|
||||
|
||||
const currentBtnOpen = ref<boolean[]>([]);
|
||||
const configStore = useConfigStore();
|
||||
|
|
@ -30,7 +32,10 @@ const props = defineProps<{
|
|||
readonly?: boolean;
|
||||
agentPrice?: boolean;
|
||||
taskList: {
|
||||
product: RequestWork['productService']['product'];
|
||||
product: RequestWork['productService']['product'] & {
|
||||
taskStatus?: TaskStatus;
|
||||
totalNotStatusComplete?: number;
|
||||
};
|
||||
list: RequestWork[];
|
||||
}[];
|
||||
creditNote?: boolean;
|
||||
|
|
@ -111,6 +116,26 @@ function calcPrice(
|
|||
|
||||
return precisionRound(priceNoVat * amount + rawVatTotal);
|
||||
}
|
||||
|
||||
function taskOrderStatus(value: TaskStatus) {
|
||||
if ([TaskStatus.Pending].includes(value)) {
|
||||
return '--blue-6-hsl';
|
||||
}
|
||||
if ([TaskStatus.InProgress, TaskStatus.Validate].includes(value)) {
|
||||
return '--orange-5-hsl';
|
||||
}
|
||||
if (
|
||||
[
|
||||
TaskStatus.Canceled,
|
||||
TaskStatus.Restart,
|
||||
TaskStatus.Redo,
|
||||
TaskStatus.Failed,
|
||||
].includes(value)
|
||||
) {
|
||||
return '--red-5-hsl';
|
||||
}
|
||||
return '--green-8-hsl';
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<q-expansion-item
|
||||
|
|
@ -144,7 +169,8 @@ function calcPrice(
|
|||
(v) =>
|
||||
v.name !== 'discount' &&
|
||||
v.name !== 'priceBeforeVat' &&
|
||||
v.name !== 'vat',
|
||||
v.name !== 'vat' &&
|
||||
v.name !== 'status',
|
||||
)
|
||||
: productColumn
|
||||
"
|
||||
|
|
@ -173,7 +199,10 @@ function calcPrice(
|
|||
<template
|
||||
v-slot:body="props: {
|
||||
row: {
|
||||
product: RequestWork['productService']['product'];
|
||||
product: RequestWork['productService']['product'] & {
|
||||
taskStatus?: TaskStatus;
|
||||
totalNotStatusComplete?: number;
|
||||
};
|
||||
list: RequestWork[];
|
||||
};
|
||||
} & Omit<Parameters<QTableSlots['body']>[0], 'row'>"
|
||||
|
|
@ -203,6 +232,14 @@ function calcPrice(
|
|||
</q-avatar>
|
||||
{{ props.row.product.name }}
|
||||
</q-td>
|
||||
<q-td class="text-left" v-if="!creditNote">
|
||||
<BadgeComponent
|
||||
hide-icon
|
||||
:hsla-color="taskOrderStatus(props.row.product.taskStatus)"
|
||||
:title="`${$t(`taskOrder.status.${props.row.product.taskStatus}`)} ${!!props.row.product.totalNotStatusComplete ? $t('general.totalPeople', { meg: props.row.product.totalNotStatusComplete }) : ''}`"
|
||||
/>
|
||||
</q-td>
|
||||
|
||||
<q-td>
|
||||
{{ props.row.list.length }}
|
||||
</q-td>
|
||||
|
|
|
|||
|
|
@ -280,7 +280,10 @@ let taskListGroup = computed(() => {
|
|||
|
||||
const cacheData = currentFormData.value.taskList.reduce<
|
||||
{
|
||||
product: RequestWork['productService']['product'];
|
||||
product: RequestWork['productService']['product'] & {
|
||||
taskStatus?: TaskStatus;
|
||||
totalNotStatusComplete?: number;
|
||||
};
|
||||
list: (RequestWork & {
|
||||
_template?: {
|
||||
id: string;
|
||||
|
|
@ -289,15 +292,15 @@ let taskListGroup = computed(() => {
|
|||
step: number;
|
||||
responsibleInstitution: (string | { group: string })[];
|
||||
} | null;
|
||||
taskStatus?: TaskStatus;
|
||||
failedComment?: string;
|
||||
failedType?: string;
|
||||
})[];
|
||||
}[]
|
||||
>((acc, curr) => {
|
||||
if (
|
||||
const isNotComplete =
|
||||
fullTaskOrder.value?.taskOrderStatus === TaskOrderStatus.Complete &&
|
||||
curr.taskStatus !== TaskStatus.Complete
|
||||
) {
|
||||
return acc;
|
||||
}
|
||||
curr.taskStatus !== TaskStatus.Complete;
|
||||
|
||||
const task = curr.requestWorkStep;
|
||||
const step = curr.step;
|
||||
|
|
@ -308,9 +311,18 @@ let taskListGroup = computed(() => {
|
|||
let exist = acc.find(
|
||||
(item) => task.requestWork.productService.productId == item.product.id,
|
||||
);
|
||||
const record = Object.assign(task.requestWork, {
|
||||
_template: getTemplateData(task.requestWork, step),
|
||||
});
|
||||
|
||||
const record = Object.assign(
|
||||
{
|
||||
...task.requestWork,
|
||||
taskStatus: curr.taskStatus,
|
||||
failedComment: curr.failedComment || '',
|
||||
failedType: curr.failedType || '',
|
||||
},
|
||||
{
|
||||
_template: getTemplateData(task.requestWork, step),
|
||||
},
|
||||
);
|
||||
|
||||
const template = getTemplateData(task.requestWork, step);
|
||||
|
||||
|
|
@ -323,10 +335,18 @@ let taskListGroup = computed(() => {
|
|||
}
|
||||
|
||||
if (exist) {
|
||||
exist.list.push(task.requestWork);
|
||||
exist.list.push(record);
|
||||
if (isNotComplete) {
|
||||
exist.product.totalNotStatusComplete =
|
||||
(exist.product.totalNotStatusComplete || undefined) + 1;
|
||||
}
|
||||
} else {
|
||||
acc.push({
|
||||
product: task.requestWork.productService.product,
|
||||
product: {
|
||||
...task.requestWork.productService.product,
|
||||
taskStatus: curr.taskStatus || TaskStatus.Pending,
|
||||
totalNotStatusComplete: isNotComplete ? 1 : undefined,
|
||||
},
|
||||
list: [record],
|
||||
});
|
||||
}
|
||||
|
|
@ -985,6 +1005,7 @@ watch(
|
|||
"
|
||||
/>
|
||||
<!-- TODO: blind remark, urgent -->
|
||||
{{ console.log(taskListGroup) }}
|
||||
<RemarkExpansion
|
||||
v-if="
|
||||
view === TaskOrderStatus.Pending ||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ export interface TaskOrderPayload {
|
|||
requestWorkId: string;
|
||||
requestWorkStep?: Task;
|
||||
taskStatus?: TaskStatus;
|
||||
failedType?: string;
|
||||
failedComment?: string;
|
||||
}[];
|
||||
taskProduct?: {
|
||||
productId: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { RequestWork } from 'src/stores/request-list';
|
||||
import { TaskStatus } from 'src/stores/task-order/types';
|
||||
import { formatNumberDecimal } from 'src/stores/utils';
|
||||
import { i18n } from 'src/boot/i18n';
|
||||
|
||||
const templates = {
|
||||
'quotation-labor': {
|
||||
|
|
@ -46,7 +48,12 @@ const templates = {
|
|||
converter: (context?: {
|
||||
items?: {
|
||||
product: RequestWork['productService']['product'];
|
||||
list: RequestWork[];
|
||||
list: (RequestWork & {
|
||||
taskStatus?: TaskStatus;
|
||||
failedComment?: string;
|
||||
failedType?: string;
|
||||
codeRequest?: string;
|
||||
})[];
|
||||
}[];
|
||||
itemsDiscount?: {
|
||||
productId: string;
|
||||
|
|
@ -67,8 +74,9 @@ const templates = {
|
|||
const branch = v.request.quotation.customerBranch;
|
||||
return (
|
||||
`${i + 1}. ` +
|
||||
` ${v.request.code}_${branch.customer.customerType === 'PERS' ? `นายจ้าง ${branch.namePrefix}. ${branch.firstNameEN} ${branch.lastNameEN} `.toUpperCase() : branch.registerName}_` +
|
||||
`${employee.namePrefix}. ${employee.firstNameEN} ${employee.lastNameEN} `.toUpperCase() +
|
||||
`(${branch.customer.customerType === 'PERS' ? `นายจ้าง ${branch.namePrefix}. ${branch.firstNameEN} ${branch.lastNameEN} `.toUpperCase() : branch.registerName})`
|
||||
`${!!v.failedType && v.failedType !== 'other' ? `${i18n.global.t(`taskOrder.${v.failedType}`)}` : !!v.failedComment ? v.failedComment : ''}`
|
||||
);
|
||||
});
|
||||
return [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue