refactor(leave): validate isAct commander
This commit is contained in:
parent
852f3226c1
commit
8dc473eec0
3 changed files with 38 additions and 8 deletions
|
|
@ -30,6 +30,7 @@ const props = defineProps({
|
|||
fetchDetailLeave: Function,
|
||||
idCheck: Array,
|
||||
commandersList: Array,
|
||||
commandersIsAct: Boolean,
|
||||
});
|
||||
|
||||
const pageId = ref<string>(route.params.id as string);
|
||||
|
|
@ -117,7 +118,7 @@ async function getData() {
|
|||
total.value = data.total;
|
||||
rows.value = data.data;
|
||||
selected.value = data.data.filter((items: any) => {
|
||||
return props.idCheck?.some((i: any) => i === items.id);
|
||||
return props.idCheck?.some((i: any) => i === items.key);
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -153,10 +154,14 @@ function onSubmit() {
|
|||
]
|
||||
.filter(Boolean)
|
||||
.join(" "),
|
||||
isAct: isAct.value,
|
||||
keyId: items.key,
|
||||
}));
|
||||
|
||||
const hasCommander = selected.value.some((e) =>
|
||||
props.commandersList?.some((i: any) => i === e.id)
|
||||
props.commandersList?.some(
|
||||
(i: any) => i.profileId === e.id && i.isAct === isAct.value
|
||||
)
|
||||
);
|
||||
|
||||
if (hasCommander) {
|
||||
|
|
@ -205,6 +210,7 @@ watch(
|
|||
() => modal.value,
|
||||
() => {
|
||||
if (modal.value) {
|
||||
isAct.value = props.commandersIsAct ?? false;
|
||||
getSearch();
|
||||
}
|
||||
}
|
||||
|
|
@ -233,6 +239,7 @@ watch(
|
|||
label="ค้นหา"
|
||||
v-model="keyword"
|
||||
style="width: 300px"
|
||||
@keydown.enter.prevent="onSearchData()"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search"></q-icon>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue