fix:fetch operate
This commit is contained in:
parent
de2571e02f
commit
8a3c77f744
2 changed files with 35 additions and 13 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue