Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m38s

* develop:
  fix:hideBtnAction
This commit is contained in:
Warunee Tamkoo 2025-11-04 14:18:22 +07:00
commit 1df97bc832
12 changed files with 277 additions and 26 deletions

View file

@ -0,0 +1,60 @@
interface KeycloakPosition {
amountSpecial: number;
avatar: string;
avatarName: string;
birthDate: string;
child1: string;
child1DnaId: string;
child1Id: string;
child1ShortName: string;
child2: string;
child2DnaId: string;
child2Id: string;
child2ShortName: string;
child3: string;
child3DnaId: string;
child3Id: string;
child3ShortName: string;
child4: string;
child4DnaId: string;
child4Id: string;
child4ShortName: string;
citizenId: string;
dateRetireLaw: string;
dateStart: string;
firstName: string;
isDirector: boolean;
isProbation: boolean;
keycloak: string;
lastName: string;
leaveDate: string;
node: number;
nodeDnaId: string;
nodeId: string;
nodeShortName: string;
posExecutiveId: string;
posExecutiveName: string;
posExecutivePriority: string;
posLevelId: string;
posLevelName: string;
posLevelRank: number;
posMaster: number;
posMasterNo: number;
posNo: string;
posTypeId: string;
posTypeName: string;
posTypeRank: number;
position: string;
positionArea: string;
positionExecutiveField: string;
prefix: string;
profileId: string;
profileType: string;
rank: string;
root: string;
rootDnaId: string;
rootId: string;
rootShortName: string;
salary: number;
}
export type { KeycloakPosition };

View file

@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth";
/** importComponents*/ /** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
@ -67,6 +68,7 @@ const columns = ref<QTableProps["columns"]>([
const visibleColumns = ref<string[]>(["roleName", "roleDescription"]); const visibleColumns = ref<string[]>(["roleName", "roleDescription"]);
const selected = ref<Roles[]>([]); const selected = ref<Roles[]>([]);
const roleUser = ref<string[]>([]);
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
@ -74,10 +76,19 @@ function closeDialog() {
keyword.value = ""; keyword.value = "";
} }
function fetchListRoles() { async function fetchListRoles() {
showLoader(); showLoader();
http const isCheckRole = roleUser.value.includes("SUPER_ADMIN") ? true : false;
.get(config.API.managementAuth + `/list`)
const param: { params?: { isAdminVisibled: string } } = {};
if (!isCheckRole) {
param.params = {
isAdminVisibled: "true",
};
}
await http
.get(config.API.managementAuth + `/list`, param)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -138,8 +149,12 @@ function serchDataTable() {
watch( watch(
() => modal.value, () => modal.value,
() => { async () => {
modal.value && fetchListRoles(); if (modal.value) {
const token = await tokenParsed();
roleUser.value = token?.role || [];
await fetchListRoles();
}
} }
); );
</script> </script>

View file

@ -1,11 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref, watch } from "vue"; import { reactive, ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { storeToRefs } from "pinia";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStoreUser } from "@/modules/02_users/stores/main"; import { useDataStoreUser } from "@/modules/02_users/stores/main";
import { usekeycloakPosition } from "@/stores/keycloakPosition";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
@ -17,6 +19,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar(); const $q = useQuasar();
const store = useDataStoreUser(); const store = useDataStoreUser();
const { dataPosition } = storeToRefs(usekeycloakPosition());
const { showLoader, hideLoader, messageError, success, dialogConfirm } = const { showLoader, hideLoader, messageError, success, dialogConfirm } =
useCounterMixin(); useCounterMixin();
@ -168,6 +171,18 @@ function onClose() {
selected.value = []; selected.value = [];
} }
/**
* อน checkbox ของผใชงานทกำลงลอกอนอย
* @param id รหสผใชงาน
*/
function hideCheckbox(id: string) {
if (dataPosition.value?.profileId === id) {
return false;
} else {
return true;
}
}
/** /**
* การเปลยนแปลงของ pageSize ใน queryBody * การเปลยนแปลงของ pageSize ใน queryBody
* *
@ -208,7 +223,7 @@ watch(
dense dense
v-model="qurey.searchKeyword" v-model="qurey.searchKeyword"
label="คำค้น" label="คำค้น"
@keydown.enter.prevent="onSearchListPerson(true)"
> >
<!-- <template v-slot:append> <!-- <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -259,6 +274,7 @@ watch(
<q-tr :props="props"> <q-tr :props="props">
<td auto-width> <td auto-width>
<q-checkbox <q-checkbox
v-if="hideCheckbox(props.row.id)"
keep-color keep-color
color="primary" color="primary"
dense dense

View file

@ -1,11 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref, watch } from "vue"; import { reactive, ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { storeToRefs } from "pinia";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStoreUser } from "@/modules/02_users/stores/main"; import { useDataStoreUser } from "@/modules/02_users/stores/main";
import { usekeycloakPosition } from "@/stores/keycloakPosition";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
@ -17,6 +19,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar(); const $q = useQuasar();
const store = useDataStoreUser(); const store = useDataStoreUser();
const { dataPosition } = storeToRefs(usekeycloakPosition());
const { const {
showLoader, showLoader,
hideLoader, hideLoader,
@ -184,6 +187,18 @@ function onClose() {
isCheck.value = false; isCheck.value = false;
} }
/**
* อน checkbox ของผใชงานทกำลงลอกอนอย
* @param id รหสผใชงาน
*/
function hideCheckbox(id: string) {
if (dataPosition.value?.profileId === id) {
return false;
} else {
return true;
}
}
/** /**
* การเปลยนแปลงของ pageSize ใน queryBody * การเปลยนแปลงของ pageSize ใน queryBody
* *
@ -237,6 +252,7 @@ watch(
dense dense
v-model="qurey.searchKeyword" v-model="qurey.searchKeyword"
label="คำค้น" label="คำค้น"
@keydown.enter.prevent="onSearchListPerson(true)"
> >
<!-- <template v-slot:append> <!-- <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -287,6 +303,7 @@ watch(
<q-tr :props="props"> <q-tr :props="props">
<td auto-width> <td auto-width>
<q-checkbox <q-checkbox
v-if="hideCheckbox(props.row.id)"
keep-color keep-color
color="primary" color="primary"
dense dense

View file

@ -11,6 +11,7 @@ interface FormUser {
interface FormRole { interface FormRole {
roleName: string; roleName: string;
roleDescription: string; roleDescription: string;
isAdminVisibled: boolean;
} }
interface Roles { interface Roles {

View file

@ -59,8 +59,22 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{
name: "isAdminVisibled",
align: "left",
label: "ผู้ดูแลระบบมองเห็น",
sortable: true,
field: "isAdminVisibled",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]); ]);
const visibleColumns = ref<string[]>(["no", "roleName", "roleDescription"]); const visibleColumns = ref<string[]>([
"no",
"roleName",
"roleDescription",
"isAdminVisibled",
]); //
const modalDialogAdd = ref<boolean>(false); // const modalDialogAdd = ref<boolean>(false); //
@ -156,8 +170,8 @@ function serchDataTable() {
* hook ทำงานเมอมการเรยกใชงาน Components * hook ทำงานเมอมการเรยกใชงาน Components
* งขอมลบทบาท * งขอมลบทบาท
*/ */
onMounted(() => { onMounted(async () => {
fetchListRole(); await fetchListRole();
}); });
</script> </script>
@ -229,11 +243,20 @@ onMounted(() => {
<div v-if="col.name === 'no'"> <div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</div> </div>
<div v-else-if="col.name === 'isAdminVisibled'">
<q-icon
v-if="props.row.isAdminVisibled"
size="sm"
name="check"
color="primary"
/>
<span v-else>-</span>
</div>
<div v-else> <div v-else>
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>
</q-td> </q-td>
<q-td> <q-td auto-width>
<q-btn <q-btn
flat flat
dense dense

View file

@ -1,12 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted, watch } from "vue"; import { ref, reactive, onMounted, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { storeToRefs } from "pinia";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { usePermissionsStore } from "@/modules/02_users/stores/permissions"; import { usePermissionsStore } from "@/modules/02_users/stores/permissions";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
import { usekeycloakPosition } from "@/stores/keycloakPosition";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
@ -25,6 +27,7 @@ import PopupPersonal from "@/modules/02_users/components/RoleOrganization/Dialog
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = usePermissionsStore(); const store = usePermissionsStore();
const { dataPosition } = storeToRefs(usekeycloakPosition());
const { showLoader, hideLoader, messageError, success, dialogRemove } = const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin(); useCounterMixin();
@ -61,6 +64,11 @@ const nodes = ref<Array<NodeTree>>([
totalRootPositionNextVacant: 0, totalRootPositionNextVacant: 0,
children: [] as NodeTree[], children: [] as NodeTree[],
isOfficer: false, isOfficer: false,
orgRootDnaId: "",
orgChild1DnaId: "",
orgChild2DnaId: "",
orgChild3DnaId: "",
orgChild4DnaId: "",
}, },
]); // ]); //
const lazy = ref(nodes); const lazy = ref(nodes);
@ -319,6 +327,11 @@ async function fetchDataTree(id: string) {
totalRootPositionNextVacant: 0, totalRootPositionNextVacant: 0,
children: [] as NodeTree[], children: [] as NodeTree[],
isOfficer: false, isOfficer: false,
orgRootDnaId: "",
orgChild1DnaId: "",
orgChild2DnaId: "",
orgChild3DnaId: "",
orgChild4DnaId: "",
}, },
]; ];
} }
@ -482,6 +495,19 @@ function isUpload() {
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type); fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
} }
/**
* ตรวจสอบการแสดงป action
* @param current_holderId id ครองตำแหนงปจจ
* @returns true หากผใชงานมทธในการดำเนนการ
*/
function checkhideBtnAction(current_holderId: string) {
if (dataPosition.value?.profileId === current_holderId) {
return false;
} else {
return true;
}
}
onMounted(() => { onMounted(() => {
fetchOrganizationActive(); fetchOrganizationActive();
}); });
@ -764,8 +790,9 @@ onMounted(() => {
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>
</q-td> </q-td>
<q-td> <q-td auto-width>
<q-btn <q-btn
v-if="checkhideBtnAction(props.row.current_holderId)"
flat flat
dense dense
icon="mdi-dots-vertical" icon="mdi-dots-vertical"

View file

@ -1,12 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue"; import { ref, onMounted, reactive, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { storeToRefs } from "pinia";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStoreUser } from "@/modules/02_users/stores/main"; import { useDataStoreUser } from "@/modules/02_users/stores/main";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
import { usekeycloakPosition } from "@/stores/keycloakPosition";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
@ -21,6 +23,7 @@ import PopupPersonal from "@/modules/02_users/components/RoleOrganization/Dialog
const $q = useQuasar(); const $q = useQuasar();
const store = useDataStoreUser(); const store = useDataStoreUser();
const { dataPosition } = storeToRefs(usekeycloakPosition());
const { showLoader, hideLoader, messageError, success, dialogRemove } = const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin(); useCounterMixin();
@ -212,6 +215,14 @@ function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal; modalPersonal.value = modal;
} }
function checkhideBtnAction(id: string) {
if (dataPosition.value?.profileId === id) {
return false;
} else {
return true;
}
}
/** /**
* การเปลยนแปลงของ pageSize ใน queryBody * การเปลยนแปลงของ pageSize ใน queryBody
* เม pageSize การเปลยนแปลงใหโหลดขอมลหนาแรก * เม pageSize การเปลยนแปลงใหโหลดขอมลหนาแรก
@ -334,6 +345,7 @@ onMounted(async () => {
lazy-rules lazy-rules
label="คำค้น" label="คำค้น"
hide-bottom-space hide-bottom-space
@keydown.enter.prevent="fetchListPerson(true)"
> >
</q-input> </q-input>
</div> </div>
@ -393,6 +405,7 @@ onMounted(async () => {
<q-tr :props="props"> <q-tr :props="props">
<q-td auto-width> <q-td auto-width>
<q-btn <q-btn
v-if="checkhideBtnAction(props.row.profileId)"
flat flat
dense dense
color="red" color="red"

View file

@ -1,11 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted, watch } from "vue"; import { ref, reactive, onMounted, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { storeToRefs } from "pinia";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
import { usekeycloakPosition } from "@/stores/keycloakPosition";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
@ -23,6 +25,7 @@ import PopupPersonal from "@/modules/02_users/components/RoleOrganization/Dialog
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const { dataPosition } = storeToRefs(usekeycloakPosition());
const { showLoader, hideLoader, messageError, success, dialogRemove } = const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin(); useCounterMixin();
@ -59,6 +62,11 @@ const nodes = ref<Array<NodeTree>>([
totalRootPositionNextVacant: 0, totalRootPositionNextVacant: 0,
children: [] as NodeTree[], children: [] as NodeTree[],
isOfficer: false, isOfficer: false,
orgRootDnaId: "",
orgChild1DnaId: "",
orgChild2DnaId: "",
orgChild3DnaId: "",
orgChild4DnaId: "",
}, },
]); // ]); //
const lazy = ref(nodes); const lazy = ref(nodes);
@ -402,6 +410,14 @@ function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal; modalPersonal.value = modal;
} }
function hideBtnAction(id: string) {
if (dataPosition.value?.profileId === id) {
return false;
} else {
return true;
}
}
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/ /** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
watch([() => reqMaster.pageSize], () => { watch([() => reqMaster.pageSize], () => {
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type); fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
@ -680,8 +696,9 @@ onMounted(() => {
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>
</q-td> </q-td>
<q-td> <q-td accesskey="">
<q-btn <q-btn
v-if="hideBtnAction(props.row.current_holderId)"
flat flat
dense dense
icon="mdi-dots-vertical" icon="mdi-dots-vertical"

View file

@ -1,12 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue"; import { ref, onMounted, reactive, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { storeToRefs } from "pinia";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStoreUser } from "@/modules/02_users/stores/main"; import { useDataStoreUser } from "@/modules/02_users/stores/main";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
import { usekeycloakPosition } from "@/stores/keycloakPosition";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
@ -21,6 +23,7 @@ import PopupPersonal from "@/modules/02_users/components/RoleOrganization/Dialog
const $q = useQuasar(); const $q = useQuasar();
const store = useDataStoreUser(); const store = useDataStoreUser();
const { dataPosition } = storeToRefs(usekeycloakPosition());
const { showLoader, hideLoader, messageError, success, dialogRemove } = const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin(); useCounterMixin();
@ -256,6 +259,14 @@ function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal; modalPersonal.value = modal;
} }
function hideBtnAction(id: string) {
if (dataPosition.value?.profileId === id) {
return false;
} else {
return true;
}
}
/** /**
* การเปลยนแปลงของ pageSize ใน queryBody * การเปลยนแปลงของ pageSize ใน queryBody
* เม pageSize การเปลยนแปลงใหโหลดขอมลหนาแรก * เม pageSize การเปลยนแปลงใหโหลดขอมลหนาแรก
@ -378,6 +389,7 @@ onMounted(async () => {
lazy-rules lazy-rules
label="คำค้น" label="คำค้น"
hide-bottom-space hide-bottom-space
@keydown.enter.prevent="fetchListPerson(true)"
> >
</q-input> </q-input>
</div> </div>
@ -437,6 +449,7 @@ onMounted(async () => {
<q-tr :props="props"> <q-tr :props="props">
<q-td auto-width> <q-td auto-width>
<q-btn <q-btn
v-if="hideBtnAction(props.row.profileId)"
flat flat
dense dense
color="red" color="red"

View file

@ -6,6 +6,7 @@ import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth";
import type { import type {
DataOption, DataOption,
@ -51,6 +52,7 @@ const attrPrivilegeOp = ref<DataOption[]>([
const formData = reactive<FormRole>({ const formData = reactive<FormRole>({
roleName: "", // roleName: "", //
roleDescription: "", // roleDescription: "", //
isAdminVisibled: false, //
}); });
const sysListMain = ref<SysList[]>([]); const sysListMain = ref<SysList[]>([]);
@ -89,6 +91,7 @@ async function fetchDataRole() {
const sysList = data.roleAttributes; const sysList = data.roleAttributes;
formData.roleName = data.roleName; formData.roleName = data.roleName;
formData.roleDescription = data.roleDescription; formData.roleDescription = data.roleDescription;
formData.isAdminVisibled = data.isAdminVisibled;
const root: SystemList[] = []; const root: SystemList[] = [];
const chil: SystemList[] = []; const chil: SystemList[] = [];
@ -218,12 +221,42 @@ function onSubmit() {
}); });
} }
function onHandleChangeIsAdminVisibled(val: boolean) {
if (val === true) {
systemLists.value.forEach((system: SystemList) => {
if (system.selected && system.attrOwnership === "OWNER") {
system.attrOwnership = "STAFF";
system.attrIsCreate = system.attrIsCreate;
system.attrIsList = system.attrIsList;
system.attrIsGet = system.attrIsGet;
system.attrIsUpdate = system.attrIsUpdate;
system.attrIsDelete = system.attrIsDelete;
system.attrPrivilege = system.attrPrivilege;
}
if (system.children && system.children.length > 0) {
system.children.forEach((child: SystemList) => {
if (child.selected && child.attrOwnership === "OWNER") {
child.attrOwnership = "STAFF";
child.attrIsCreate = child.attrIsCreate;
child.attrIsList = child.attrIsList;
child.attrIsGet = child.attrIsGet;
child.attrIsUpdate = child.attrIsUpdate;
child.attrIsDelete = child.attrIsDelete;
child.attrPrivilege = child.attrPrivilege;
}
});
}
});
}
}
/** /**
* hook ทำงานเมอมการเรยกใช components * hook ทำงานเมอมการเรยกใช components
* *
* โหลดขอมลรายการระบบทงหมด * โหลดขอมลรายการระบบทงหมด
*/ */
onMounted(() => { onMounted(async () => {
fetchSys(); fetchSys();
}); });
</script> </script>
@ -249,17 +282,29 @@ onMounted(() => {
<q-card> <q-card>
<q-card-section> <q-card-section>
<div class="row q-col-gutter-md"> <div class="row q-col-gutter-md">
<div class="col-4"> <div class="row col-4">
<q-input <div class="col-12">
v-model="formData.roleName" <q-input
outlined v-model="formData.roleName"
dense outlined
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อบทบาท'}`,]" dense
lazy-rules :rules="[(val:string) => !!val || `${'กรุณากรอกชื่อบทบาท'}`,]"
hide-bottom-space lazy-rules
class="inputgreen" hide-bottom-space
label="ชื่อบทบาท" class="inputgreen"
/> label="ชื่อบทบาท"
/>
</div>
<div class="col-12">
<q-toggle
color="primary"
class="q-pr-md"
v-model="formData.isAdminVisibled"
label="ผู้ดูแลระบบมองเห็น"
@update:model-value="onHandleChangeIsAdminVisibled"
/>
</div>
</div> </div>
<div class="col-8"> <div class="col-8">
<q-input <q-input
@ -498,7 +543,7 @@ onMounted(() => {
(props.row.attrPrivilege = 'ROOT') (props.row.attrPrivilege = 'ROOT')
" "
v-if="props.row.children.length === 0" v-if="props.row.children.length === 0"
:disable="!props.row.selected" :disable="!props.row.selected || formData.isAdminVisibled"
/> />
</q-td> </q-td>
<q-td style="text-align: center"> <q-td style="text-align: center">
@ -623,7 +668,7 @@ onMounted(() => {
(item.attrIsDelete = true), (item.attrIsDelete = true),
(item.attrPrivilege = 'ROOT') (item.attrPrivilege = 'ROOT')
" "
:disable="!item.selected" :disable="!item.selected || formData.isAdminVisibled"
/> />
</q-td> </q-td>
<q-td style="text-align: center"> <q-td style="text-align: center">

View file

@ -2,6 +2,7 @@
import { ref, onMounted, onUnmounted, watch, onBeforeMount } from "vue"; import { ref, onMounted, onUnmounted, watch, onBeforeMount } from "vue";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { usekeycloakPosition } from "@/stores/keycloakPosition";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import config from "@/app.config"; import config from "@/app.config";
@ -32,6 +33,7 @@ const configParam = {
const $q = useQuasar(); const $q = useQuasar();
const store = useDataStore(); const store = useDataStore();
const keycloakPositionStore = usekeycloakPosition();
const route = useRoute(); const route = useRoute();
const { loader } = storeToRefs(store); const { loader } = storeToRefs(store);
const { changeTab } = store; const { changeTab } = store;
@ -337,6 +339,8 @@ async function fetchKeycloakPosition() {
.get(config.API.keycloakPosition()) .get(config.API.keycloakPosition())
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
keycloakPositionStore.setDataPosition(data);
// //
if (data && data.avatarName) { if (data && data.avatarName) {
await getImg(data.profileId, data.avatarName); await getImg(data.profileId, data.avatarName);