Merge branch 'develop'

This commit is contained in:
Warunee Tamkoo 2025-03-31 18:05:33 +07:00
commit 2af52f3781
11 changed files with 912 additions and 7 deletions

View file

@ -101,7 +101,9 @@ export default {
/** กำหนดสิทธิ์จัดการโครงสร้าง */
permissionOrg: `${organization}/permission-org`,
permissioProfileOrg: `${organization}/permission-profile`,
permissionOrgProfile: `${organization}/permission-org/profile`, // คนที่มีสิทธิ์จัดการโครงสร้าง
permissionProfile: `${organization}/permission-profile/profile`, // คนที่มีสิทธิ์จัดการโครงสร้าง
/** หมอบหมาย*/
commandSysAssign: `${organization}/commandSys/assign`,

View file

@ -128,6 +128,12 @@ const menuList = readonly<any[]>([
path: "responsibilities",
role: ["SUPER_ADMIN", "ADMIN"],
},
{
key: 2.0,
label: "ทะเบียนประวัติตำแหน่ง/เงินเดือน",
path: "rolePositionSalary",
role: ["SUPER_ADMIN", "ADMIN"],
},
],
},
{

View file

@ -130,7 +130,7 @@ function onSubmitPerson() {
.post(config.API.permissionOrg, body)
.then(async () => {
await props.fetchData?.(false);
success($q, "เพิ่มราชื่อสำเร็จ");
success($q, "เพิ่มราชื่อสำเร็จ");
onClose();
})
.catch((err) => {

View file

@ -0,0 +1,333 @@
<script setup lang="ts">
import { reactive, ref, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStoreUser } from "@/modules/02_users/stores/main";
import type { QTableProps } from "quasar";
import type {
DataProfile,
Pagination,
} from "@/modules/02_users/interface/index/Main";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const store = useDataStoreUser();
const {
showLoader,
hideLoader,
messageError,
success,
dialogConfirm,
dialogMessageNotify,
} = useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true });
const orgId = defineModel<string>("orgId", { required: true });
const props = defineProps({
fetchData: {
type: Function,
required: true,
},
});
const qurey = reactive({
searchKeyword: "", //
searchField: "fullName", // field
page: 1, //
pageSize: 10, //
});
const isEdit = ref<boolean>(false); //
const isCheck = ref<boolean>(false); //
const selected = ref<DataProfile[]>([]); //
const rows = ref<DataProfile[]>([]); //
const total = ref<number>(0); //
const maxPage = ref<number>(0); //
const columns = ref<QTableProps["columns"]>([
{
name: "fullName",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: (row) => `${row.prefix}${row.firstName} ${row.lastName}`,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNo",
align: "left",
label: "เลขที่ตำแหน่ง",
sortable: true,
field: "posNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่งในสายงาน",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posType",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: (row) =>
`${row.posType ? row.posType : "-"} ${
row.posLevel ? `(${row.posLevel})` : ``
} `,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/**
* งกนดงขอมลรายช
* @param newPage โหลดหนาแรก าเป true โหลดหนาแรก false ใหโหลดหนาปจจ
*
* เกบมลรายชอไวใน rows.value
*/
async function onSearchListPerson(newPage: boolean = false) {
qurey.page = newPage ? 1 : qurey.page;
selected.value = [];
showLoader();
await http
.get(config.API.permissionProfile, {
params: qurey,
})
.then((res) => {
const data = res.data.result;
maxPage.value = Math.ceil(data.total / qurey.pageSize);
total.value = data.total;
rows.value = data.data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* งกนยนยนการเพมราช
*
* เมอเพมเสรจจะดงขอมลรายชอคนททธดการโครงสรางตามหนวยงาน
*/
function onSubmitPerson() {
const arrayId = selected.value.map((e: DataProfile) => e.id);
if (isEdit.value == false && isCheck.value == false) {
dialogMessageNotify($q, "กรุณาเลือกสิทธิ์อย่างน้อย 1 สิทธิ์");
} else {
dialogConfirm(
$q,
async () => {
showLoader();
const body = {
nodeId: orgId.value,
isEdit: isEdit.value,
isCheck: isCheck.value,
personId: arrayId,
};
await http
.post(config.API.permissioProfileOrg, body)
.then(async () => {
await props.fetchData?.(false);
success($q, "เพิ่มรายชื่อสำเร็จ");
onClose();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการเพิ่มรายชื่อ",
"ต้องการยืนยันการเพิ่มรายชื่อนี้หรือไม่ ?"
);
}
}
/**
* function updatePagination
* @param newPagination อม Pagination ใหม
*/
function updatePagination(newPagination: Pagination) {
qurey.pageSize = newPagination.rowsPerPage;
}
/**
* งกนป popup ราชช
*
* และกำหนดคาของ qurey ไปเปนค defult rows.value และ selected.value ไปเปนคาวาง
*/
function onClose() {
modal.value = false;
qurey.page = 1;
qurey.pageSize = 10;
qurey.searchField = "fullName";
qurey.searchKeyword = "";
rows.value = [];
selected.value = [];
isEdit.value = false;
isCheck.value = false;
}
/**
* การเปลยนแปลงของ pageSize ใน queryBody
*
* เม pageSize การเปลยนแปลงใหโหลดขอมลหนาแรก
*/
watch(
() => qurey.pageSize,
() => {
onSearchListPerson(true);
}
);
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 60%">
<DialogHeader :tittle="'รายชื่อ'" :close="onClose" />
<q-separator />
<q-card-section style="max-height: 50vh" class="scroll">
<div class="col-12">
<div class="row q-gutter-sm">
<q-checkbox
v-model="isEdit"
label="สิทธิ์แก้ไขข้อมูล"
@update:model-value="isCheck = false"
/>
<q-separator vertical inset />
<q-checkbox
v-model="isCheck"
label="สิทธิ์ตรวจสอบข้อมูล"
@update:model-value="isEdit = false"
/>
</div>
<q-toolbar style="padding: 0">
<q-select
outlined
dense
v-model="qurey.searchField"
:options="store.searchFieldOption"
label="ค้นหาจาก"
emit-value
map-options
option-label="name"
option-value="id"
style="width: 250px"
/>
<q-toolbar-title>
<q-input
outlined
dense
v-model="qurey.searchKeyword"
label="คำค้น"
>
<!-- <template v-slot:append>
<q-icon name="search" />
</template> -->
</q-input>
</q-toolbar-title>
<q-btn
outline
icon="search"
class="full-height"
label="ค้นหา"
color="primary"
@click="onSearchListPerson(true)"
/>
</q-toolbar>
</div>
<div class="col-12">
<d-table
:columns="columns"
:rows="rows"
:paging="true"
row-key="id"
flat
bordered
dense
:rows-per-page-options="[10, 25, 50, 100]"
selection="multiple"
v-model:selected="selected"
@update:pagination="updatePagination"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-th>
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<td auto-width>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="qurey.page"
active-color="primary"
color="dark"
:max="maxPage"
:max-pages="5"
size="sm"
boundary-links
direction-links
@update:model-value="onSearchListPerson(false)"
></q-pagination>
</template>
</d-table>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
label="เพิ่ม"
color="public"
:disable="selected.length === 0"
@click="onSubmitPerson"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<style scoped></style>

View file

@ -58,6 +58,7 @@ interface DataTree {
createdFullName: string;
createdUserId: string;
id: string | null;
orgTreeId?: string | null;
lastUpdateFullName: string;
lastUpdateUserId: string;
lastUpdatedAt: string;

View file

@ -21,6 +21,10 @@ const roleOrgview = () =>
const responsIbilitiesView = () =>
import("@/modules/02_users/views/05_responsIbilities.vue");
/** roleOrganization */
const rolePositionSalary = () =>
import("@/modules/02_users/views/06_rolePositionSalary.vue");
export default [
{
path: "/users",
@ -73,6 +77,14 @@ export default [
Role: ["SUPER_ADMIN", "ADMIN"],
},
},
{
path: "/roles-position-salary",
name: "rolePositionSalary",
component: rolePositionSalary,
meta: {
Role: ["SUPER_ADMIN", "ADMIN"],
},
},
{
path: "/responsibilities",

View file

@ -0,0 +1,546 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStoreUser } from "@/modules/02_users/stores/main";
import { tokenParsed } from "@/plugins/auth";
import type { QTableProps } from "quasar";
import type {
DataTree,
DataProfile,
Pagination,
} from "@/modules/02_users/interface/index/Main";
import type { QueryProfile } from "@/modules/02_users/interface/request/Main";
import DialogAddPerson from "@/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue";
import PopupPersonal from "@/modules/02_users/components/RoleOrganization/DialogPersonal.vue";
const $q = useQuasar();
const store = useDataStoreUser();
const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin();
/******* โครงสร้าง *******/
const filter = ref<string>(""); //
const nodeTree = ref<DataTree[]>([
{
ancestorDNA: "",
createdAt: "",
createdFullName: "",
createdUserId: "",
id: "",
orgTreeId: "",
lastUpdateFullName: "",
lastUpdateUserId: "",
lastUpdatedAt: "",
orgRevisionId: "",
orgRootCode: "",
orgRootFax: "",
orgRootName: "หน่วยงานทั้งหมด",
orgRootOrder: 0,
orgRootPhoneEx: "",
orgRootPhoneIn: "",
orgRootRank: "",
orgRootRankSub: "",
orgRootShortName: "",
responsibility: "",
isDeputy: false,
labelName: "หน่วยงานทั้งหมด",
},
]); //
const expanded = ref<Array<string>>([]); //
const orgId = ref<string>(""); // id
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
/**
* งกนดงขอมลโครงสราง
* เกบขอมลโครงสรางไวใน nodeTree
*/
async function fatchOrg() {
showLoader();
await http
.get(config.API.activeOrganization)
.then(async (res) => {
const data = await res.data.result;
if (data) {
await fetchDataTree(data.activeId);
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function fetch อมลของ Tree
* @param id id โครงสราง
*/
async function fetchDataTree(id: string) {
const tokenParsedData = await tokenParsed();
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
if (!isSuperAdmin) {
nodeTree.value = [];
}
showLoader();
await http
.get(config.API.orgByid(id.toString()))
.then(async (res) => {
const data = await res.data.result;
nodeTree.value.push(...data);
if (data.length === 1) {
selectedOrg(data[0].orgTreeId);
} else if (data.length > 1) {
await fetchListPerson(); //
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* งกนเลอกหนวยงาน
* @param id หนวยงานทเลอก
* กำหนดคาของ qureyBody ใหเปนค defult และกำหนดคาของ qureyBody.id เปนหนวยงานทเลอก
* และดงขอมลรายชอคนททธดการโครงสรางในหนวยงานทเลอก
*/
function selectedOrg(id: string) {
orgId.value = id;
qureyBody.id = id ? id : null;
qureyBody.searchKeyword = "";
qureyBody.searchField = "fullName";
qureyBody.page = 1;
fetchListPerson(true);
}
/******* รายชื่อคนที่มีสิทธิ์จัดการโครงสร้าง *******/
const qureyBody = reactive<QueryProfile>({
searchKeyword: "", //
searchField: "fullName", // field
page: 1, //
pageSize: 10, //
id: null, //
});
const rows = ref<DataProfile[]>([]); //
const total = ref<number>(0); //
const maxPage = ref<number>(0); //
const columns = ref<QTableProps["columns"]>([
{
name: "fullName",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: (row) => `${row.prefix}${row.firstName} ${row.lastName}`,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "orgNew",
align: "left",
label: "หน่วยงานที่รับผิดชอบ",
sortable: true,
field: "orgNew",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "isEdit",
align: "center",
label: "สิทธิ์แก้ไขข้อมูล",
sortable: false,
field: "isEdit",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "isCheck",
align: "center",
label: "สิทธิ์ตรวจสอบข้อมูล",
sortable: false,
field: "isCheck",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const visibleColumns = ref<string[]>([
"fullName",
"orgNew",
"isEdit",
"isCheck",
]);
const modalAdd = ref<boolean>(false); // modal
/**
* งกนดงขอมลรายชอคนททธดการโครงสราง
* @param newPage โหลดหนาแรก าเป true โหลดหนาแรก false ใหโหลดหนาปจจ
*
* เกบมลรายชอคนททธดการโครงสรางไวใน rows.value
*/
async function fetchListPerson(newPage: boolean = false) {
qureyBody.page = newPage ? 1 : qureyBody.page;
showLoader();
await http
.post(config.API.permissionProfile, qureyBody)
.then(async (res) => {
const data = await res.data.result;
maxPage.value = Math.ceil(data.total / qureyBody.pageSize); //
total.value = data.total; //
rows.value = data.data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* งกนยนยนการลบรายชอคนททธดการโครงสราง
* @param id รายชอคนททธดการโครงสราง
* ลบเสรจจะโหลดขอมลรายชอคนททธดการโครงสราง
*/
function onDeletePerson(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.permissioProfileOrg + `/${id}`)
.then(async () => {
// maxPage.value 1
if (maxPage.value !== 1) {
// page 1
if (rows.value.length === 1) {
qureyBody.page = qureyBody.page - 1;
}
await fetchListPerson(false); //
} else {
await fetchListPerson(true); //
}
success($q, "ลบข้อมูสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* function updatePagination
* @param newPagination อม Pagination ใหม
*/
function updatePagination(newPagination: Pagination) {
qureyBody.pageSize = newPagination.rowsPerPage;
}
function onOpenModalPersonal(id: string) {
personId.value = id;
modalPersonal.value = true;
}
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
/**
* การเปลยนแปลงของ pageSize ใน queryBody
* เม pageSize การเปลยนแปลงใหโหลดขอมลหนาแรก
*/
watch(
() => qureyBody.pageSize,
() => {
fetchListPerson(true);
}
);
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => {
await fatchOrg(); //
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
ทธแกไขขอมลทะเบยนประวตำแหน/เงนเดอน
</div>
<q-card style="height: 100%">
<q-card-section :horizontal="$q.screen.gt.sm">
<q-card-section class="col-lg-3 col-md-4 col-xs-12 q-gutter-sm">
<div>
<q-input dense outlined v-model="filter" label="ค้นหา">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
</div>
<div class="bg-white tree-container q-pa-xs">
<q-tree
class="q-pa-sm q-gutter-sm"
dense
:nodes="nodeTree"
node-key="orgRootName"
label-key="labelName"
:filter="filter?.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล"
v-model:expanded="expanded"
>
<template v-slot:default-header="prop">
<q-item
clickable
class="row col-12 items-center text-dark q-py-xs q-pl-sm rounded-borders my-list"
:active="orgId == prop.node.orgTreeId"
active-class="my-list-link text-primary text-weight-medium"
@click.stop="selectedOrg(prop.node.orgTreeId)"
>
<div>
<div
v-if="prop.node.isDeputy == true"
class="text-info text-weight-medium"
>
{{ prop.node.orgRootName }}
</div>
<div v-else class="text-weight-medium">
{{ prop.node.orgRootName }}
</div>
<div class="text-weight-light text-grey-8">
{{
prop.node.orgRootCode == null
? null
: prop.node.orgRootCode
}}
{{
prop.node.orgRootShortName == null
? null
: prop.node.orgRootShortName
}}
</div>
</div>
</q-item>
</template>
</q-tree>
</div>
</q-card-section>
<q-separator :vertical="$q.screen.gt.sm" />
<q-card-section class="col-lg-9 col-md-8 col-xs-12" style="height: 85vh">
<q-card bordered style="height: 100%; border: 1px solid #d6dee1">
<div class="col-12 text-weight-medium bg-grey-1 q-py-sm q-px-md">
รายชอคนททธแกไขขอมลทะเบยนประวตำแหน/เงนเดอน
</div>
<div class="col-12"><q-separator /></div>
<q-card-section style="height: 92%" class="scroll">
<div class="row col-12 q-col-md">
<q-btn
v-if="orgId"
flat
dense
color="primary"
icon="add"
round
@click="modalAdd = true"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
</div>
<div class="row q-mt-sm q-col-gutter-sm">
<div class="col-12 col-sm-3 col-md-4 col-lg-2">
<q-select
outlined
dense
v-model="qureyBody.searchField"
:options="store.searchFieldOption"
label="เลือกที่ต้องการค้นหา"
emit-value
map-options
option-label="name"
option-value="id"
/>
</div>
<div class="col-12 col-sm-6 col-md-5 col-lg-3">
<q-input
v-model="qureyBody.searchKeyword"
outlined
dense
lazy-rules
label="คำค้น"
hide-bottom-space
>
</q-input>
</div>
<div class="col-12 col-sm-3 col-md-3 col-lg-2">
<q-btn
outline
color="primary"
icon="search"
label="ค้นหา"
class="full-width full-height"
@click="fetchListPerson(true)"
/>
</div>
<q-space v-if="$q.screen.gt.md" />
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
<div class="col-12 q-mt-sm">
<d-table
:columns="columns"
:rows="rows"
:paging="true"
row-key="id"
flat
bordered
dense
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-btn
flat
dense
color="red"
icon="delete"
round
@click.pervent="onDeletePerson(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name === 'fullName'">
{{ col.value ? col.value : "-" }}
<q-btn
flat
dense
color="info"
icon="info"
round
@click.pervent="
onOpenModalPersonal(props.row.profileId)
"
>
<q-tooltip>อม</q-tooltip>
</q-btn>
</div>
<div v-else-if="col.name == 'isEdit'">
<q-icon
v-if="props.row.isEdit"
name="mdi-check"
size="sm"
color="primary"
></q-icon>
<div v-else>-</div>
</div>
<div v-else-if="col.name == 'isCheck'">
<q-icon
v-if="props.row.isCheck"
name="mdi-check"
size="sm"
color="primary"
></q-icon>
<div v-else>-</div>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="qureyBody.page"
active-color="primary"
color="dark"
:max="maxPage"
:max-pages="5"
size="sm"
boundary-links
direction-links
@update:model-value="fetchListPerson(false)"
>
</q-pagination>
</template>
</d-table>
</div>
</q-card-section>
</q-card>
</q-card-section>
</q-card-section>
</q-card>
<DialogAddPerson
v-model:modal="modalAdd"
v-model:org-id="orgId"
:fetch-data="fetchListPerson"
/>
<PopupPersonal
:modal="modalPersonal"
:id="personId"
@update:modal="updatemodalPersonal"
/>
</template>
<style scoped>
.tree-container {
overflow: auto;
height: 76vh;
border: 1px solid #e6e6e7;
border-radius: 10px;
}
.my-list-link {
color: rgb(118, 168, 222);
border-radius: 5px;
background: #a3d3fb48 !important;
font-weight: 600;
border: 1px solid rgba(175, 185, 196, 0.217);
}
</style>

View file

@ -10,8 +10,9 @@ interface AuthResponse {
const authenticated = async () => ((await getToken()) ? true : false);
async function setAuthen(r: AuthResponse) {
async function setAuthen(r: AuthResponse, val: string) {
await setCookie(ACCESS_TOKEN, r.access_token, r.expires_in);
setCookie("SSO", val, r.expires_in);
window.location.href = "/";
}
@ -70,4 +71,4 @@ async function tokenParsed() {
return JSON.parse(jsonPayload);
}
export { getToken, authenticated, logout, setAuthen, tokenParsed };
export { getToken, authenticated, logout, setAuthen, tokenParsed, getCookie };

View file

@ -6,7 +6,7 @@ import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import config from "@/app.config";
import http from "@/plugins/http";
import { logout, tokenParsed } from "@/plugins/auth";
import { logout, tokenParsed, getCookie } from "@/plugins/auth";
import checkPermission from "@/plugins/checkPermission";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
@ -372,6 +372,8 @@ watch(
}
);
const isSsoToken = ref<boolean>(false);
/**
* กนจะถกเรยกกอนทคอมโพเนนตจะถ onMounted
* กำหนดบทบาทและชอผใชงานจาก Keycloak
@ -381,6 +383,8 @@ onBeforeMount(async () => {
// keycloak
const tokenParsedData: any = await tokenParsed();
const SSO_TOKEN = await getCookie("SSO");
isSsoToken.value = SSO_TOKEN === "y" ? true : false;
if (tokenParsedData != null) {
fullname.value = tokenParsedData.name;
role.value = tokenParsedData.role;
@ -623,7 +627,7 @@ onUnmounted(() => {
</div> -->
<!-- <q-option-group v-model="group" :options="options" color="primary"/> -->
<q-list dense>
<q-item clickable :href="landingPageUrl">
<q-item clickable :href="landingPageUrl" v-if="isSsoToken">
<q-item-section avatar>
<q-avatar
color="blue"

View file

@ -13,7 +13,7 @@ onMounted(async () => {
expires_in: route.query.expires ? route.query.expires : 36000,
refresh_token: route.query.accessToken,
};
setAuthen(params);
setAuthen(params, "y");
}
});
</script>

View file

@ -36,7 +36,7 @@ async function onSubmit() {
},
})
.then((res) => {
setAuthen(res.data.result);
setAuthen(res.data.result, "n");
})
.catch((err) => {
$q.dialog({