refactor: enhance request selection logic and improve filtering for empty step statuses
This commit is contained in:
parent
697a8531f1
commit
529d4ad3df
2 changed files with 52 additions and 31 deletions
|
|
@ -165,8 +165,21 @@ function submit() {
|
||||||
requestWorkId: string;
|
requestWorkId: string;
|
||||||
requestWorkStep?: Task;
|
requestWorkStep?: Task;
|
||||||
}[] = [];
|
}[] = [];
|
||||||
|
|
||||||
selectedEmployee.value.forEach((v, i) => {
|
selectedEmployee.value.forEach((v, i) => {
|
||||||
|
if (v.stepStatus.length === 0) {
|
||||||
|
selected.push({
|
||||||
|
step: 0,
|
||||||
|
requestWorkId: v.id || '',
|
||||||
|
requestWorkStep: {
|
||||||
|
taskOrderId: '',
|
||||||
|
requestWork: v,
|
||||||
|
step: 0,
|
||||||
|
workStatus: '',
|
||||||
|
requestWorkId: '',
|
||||||
|
attributes: undefined,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
const curr = v.stepStatus.find(
|
const curr = v.stepStatus.find(
|
||||||
(s) =>
|
(s) =>
|
||||||
s.workStatus ===
|
s.workStatus ===
|
||||||
|
|
@ -195,6 +208,7 @@ function submit() {
|
||||||
requestWorkStep: task,
|
requestWorkStep: task,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
|
|
@ -217,11 +231,17 @@ function onDialogOpen() {
|
||||||
if (taskList.value.length === 0) return;
|
if (taskList.value.length === 0) return;
|
||||||
const matchingItems = tempGroupEdit.value
|
const matchingItems = tempGroupEdit.value
|
||||||
.flatMap((g) => g.list)
|
.flatMap((g) => g.list)
|
||||||
.filter((l) =>
|
.filter((l) => {
|
||||||
l.stepStatus.some((s) =>
|
if (l.stepStatus.length === 0) {
|
||||||
taskList.value.some((t) => s.requestWorkId === t.requestWorkId),
|
return taskList.value.some(
|
||||||
),
|
(t) => t.requestWorkStep?.requestWork.id === l.id,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return l.stepStatus.some((s) =>
|
||||||
|
taskList.value.some((t) => s.requestWorkId === t.requestWorkId),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
selectedEmployee.value = JSON.parse(JSON.stringify(matchingItems));
|
selectedEmployee.value = JSON.parse(JSON.stringify(matchingItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -630,6 +630,7 @@ onMounted(async () => {
|
||||||
:task-list="taskListGroup"
|
:task-list="taskListGroup"
|
||||||
@add-product="openProductDialog"
|
@add-product="openProductDialog"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PaymentExpansion
|
<PaymentExpansion
|
||||||
v-if="view === null"
|
v-if="view === null"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue