fix:fetch operate

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-10-14 13:44:11 +07:00
parent de2571e02f
commit 8a3c77f744
2 changed files with 35 additions and 13 deletions

View file

@ -155,6 +155,15 @@ const idCheck = computed(() => {
}
});
//
const commanderList = computed(() => {
if (typeAdd.value == "COMMANDER") {
return rows.value?.approvers.map((items: SeqTypeRow) => items.profileId);
} else if (typeAdd.value == "APPROVER") {
return rows.value?.commanders.map((items: SeqTypeRow) => items.profileId);
}
});
//
const approveCheck = computed(() => {
return (
@ -1240,5 +1249,6 @@ onMounted(async () => {
:fetchDetailLeave="fetchDetailLeave"
:id-check="idCheck"
:keycloak-user-id="keycloakUserId"
:commanders-list="commanderList"
/>
</template>

View file

@ -10,14 +10,6 @@ import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
import { useRoute } from "vue-router";
const modal = defineModel<boolean>("modal", { required: true });
const props = defineProps({
type: String,
profileType: String,
keycloakUserId: String,
fetchDetailLeave: Function,
idCheck: Array,
});
const $q = useQuasar();
const mixin = useCounterMixin();
const route = useRoute();
@ -30,6 +22,16 @@ const {
dialogMessageNotify,
} = mixin;
const modal = defineModel<boolean>("modal", { required: true });
const props = defineProps({
type: String,
profileType: String,
keycloakUserId: String,
fetchDetailLeave: Function,
idCheck: Array,
commandersList: Array,
});
const pageId = ref<string>(route.params.id as string);
const keyword = ref<string>("");
const isAct = ref<boolean>(false);
@ -102,13 +104,13 @@ function getSearch() {
}
async function getData() {
const url =
props.type == "COMMANDER"
? config.API.workflowCommanderOperate
: config.API.workflowCommanderSign;
// const url =
// props.type == "COMMANDER"
// ? config.API.workflowCommanderOperate
// : config.API.workflowCommanderSign;
showLoader();
await http
.put(url, {
.put(config.API.workflowCommanderOperate, {
pageSize: pagination.value.rowsPerPage,
page: pagination.value.page,
keyword: keyword.value,
@ -148,6 +150,16 @@ function onSubmit() {
profileId: items.id,
keycloakId: items.keycloakId,
}));
const hasCommander = selected.value.some((e) =>
props.commandersList?.some((i: any) => i === e.id)
);
if (hasCommander) {
dialogMessageNotify($q, "ไม่สามารถเลือกได้ เนื่องจากเลือกรายชื่อซ้ำ");
return;
}
showLoader();
http
.post(