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(() => {
|
const approveCheck = computed(() => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -1240,5 +1249,6 @@ onMounted(async () => {
|
||||||
:fetchDetailLeave="fetchDetailLeave"
|
:fetchDetailLeave="fetchDetailLeave"
|
||||||
:id-check="idCheck"
|
:id-check="idCheck"
|
||||||
:keycloak-user-id="keycloakUserId"
|
:keycloak-user-id="keycloakUserId"
|
||||||
|
:commanders-list="commanderList"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,6 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useRoute } from "vue-router";
|
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 $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
@ -30,6 +22,16 @@ const {
|
||||||
dialogMessageNotify,
|
dialogMessageNotify,
|
||||||
} = mixin;
|
} = 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 pageId = ref<string>(route.params.id as string);
|
||||||
const keyword = ref<string>("");
|
const keyword = ref<string>("");
|
||||||
const isAct = ref<boolean>(false);
|
const isAct = ref<boolean>(false);
|
||||||
|
|
@ -102,13 +104,13 @@ function getSearch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
const url =
|
// const url =
|
||||||
props.type == "COMMANDER"
|
// props.type == "COMMANDER"
|
||||||
? config.API.workflowCommanderOperate
|
// ? config.API.workflowCommanderOperate
|
||||||
: config.API.workflowCommanderSign;
|
// : config.API.workflowCommanderSign;
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.put(url, {
|
.put(config.API.workflowCommanderOperate, {
|
||||||
pageSize: pagination.value.rowsPerPage,
|
pageSize: pagination.value.rowsPerPage,
|
||||||
page: pagination.value.page,
|
page: pagination.value.page,
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
|
|
@ -148,6 +150,16 @@ function onSubmit() {
|
||||||
profileId: items.id,
|
profileId: items.id,
|
||||||
keycloakId: items.keycloakId,
|
keycloakId: items.keycloakId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const hasCommander = selected.value.some((e) =>
|
||||||
|
props.commandersList?.some((i: any) => i === e.id)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hasCommander) {
|
||||||
|
dialogMessageNotify($q, "ไม่สามารถเลือกได้ เนื่องจากเลือกรายชื่อซ้ำ");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.post(
|
.post(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue