Merge branch 'develop' into dev-tee

This commit is contained in:
setthawutttty 2023-09-08 10:54:38 +07:00
commit b25fab71a4
4 changed files with 58 additions and 7 deletions

View file

@ -29,6 +29,7 @@ const position_level = ref<string>("");
const organization = ref<string>("");
const probation_status = ref<string>("");
const probation_statusold = ref<string>("");
const avatarprofile = ref<string>("");
const visibleColumns = ref<string[]>([
"no",
@ -152,12 +153,14 @@ const getpersonalList = async () => {
.get(config.API.personal(personalId.value))
.then((res) => {
const data = res.data.data;
// console.log(data);
name.value = data.name;
position_line.value = data.position_line;
position_level.value = data.position_level;
organization.value = data.organization;
probation_status.value = data.probation_status;
probation_statusold.value = data.probation_status;
avatarprofile.value = data.avatar;
})
.catch(() => {})
.finally(() => {
@ -250,7 +253,8 @@ const paginationLabel = (start: string, end: string, total: string) => {
<div class="row col-12 q-pa-md">
<div class="col-12 row bg-white q-col-gutter-md">
<div class="col-xs-3 col-sm-2 col-md-1 row">
<q-img src="@/assets/avatar_user.jpg" />
<q-img :src="avatarprofile" v-if="avatarprofile !== null" />
<q-img src="@/assets/avatar_user.jpg" v-else />
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12 q-pl-md">

View file

@ -2291,9 +2291,9 @@ const getClass = (val: boolean) => {
:rules="[
(val) =>
!!val ||
`${'กรุณากรอกครังที่ (เรื่องการดำเนินการทางวินัย)'}`,
`${'กรุณากรอกครังที่ (เรื่องการดำเนินการทางวินัย)'}`,
]"
:label="`${'ครังที่ (เรื่องการดำเนินการทางวินัย)'}`"
:label="`${'ครังที่ (เรื่องการดำเนินการทางวินัย)'}`"
hide-bottom-space
/>
</div>

41
src/stores/roleUser.ts Normal file
View file

@ -0,0 +1,41 @@
import { defineStore } from "pinia";
import { ref } from "vue";
export const useroleUserDataStore = defineStore("roleusers", () => {
const insignia1Role = ref<boolean>(false)
const insignia2Role = ref<boolean>(false)
const caregiverRole = ref<boolean>(false)
const chairmanRole = ref<boolean>(false)
const commanderRole = ref<boolean>(false)
const admin2Role = ref<boolean>(false)
const adminRole = ref<boolean>(false)
const oligarchRole = ref<boolean>(false)
const fetchroleUser = async (keycloak: any) => {
// console.log(keycloak);
if (keycloak != null) {
insignia1Role.value = await keycloak.includes("insignia1");
insignia2Role.value = await keycloak.includes("insignia2");
caregiverRole.value = await keycloak.includes("caregiver");
chairmanRole.value = await keycloak.includes("chairman");
commanderRole.value = await keycloak.includes("commander");
admin2Role.value = await keycloak.includes("admin2");
adminRole.value = await keycloak.includes("admin");
oligarchRole.value = await keycloak.includes("oligarch");
}
}
return {
fetchroleUser,
insignia1Role,
insignia2Role,
caregiverRole,
chairmanRole,
commanderRole,
admin2Role,
adminRole,
};
});

View file

@ -20,6 +20,7 @@ import {
tabList,
tabListPlacement,
} from "../interface/request/main/main";
import { useroleUserDataStore } from "@/stores/roleUser";
const { setVerticalScrollPosition, getVerticalScrollPosition } = scroll;
const store = useDataStore();
@ -35,6 +36,8 @@ const {
messageError,
date2Thai,
} = mixin;
const DataStore = useroleUserDataStore();
const { fetchroleUser } = DataStore;
const $q = useQuasar();
const { tabData, loader } = storeToRefs(store);
@ -211,7 +214,8 @@ const activeBtn = () => {
* งจ boolean งตอง set
*/
onMounted(async () => {
await getDataNotification();
await fetchroleUser(keycloak.tokenParsed.role);
await getDataNotification();
myEventHandler(null, false);
window.addEventListener("resize", (e: any) => {
myEventHandler(e, true);
@ -266,9 +270,11 @@ const myEventHandler = (e: any, setSCroll: boolean) => {
*/
const activeMenu = (path: string) => {
if (path == "dashboard" && route.fullPath == "/") return true;
if (path == "registry" && route.fullPath == "/registry-employee") return false;
if (path == "registry" && route.fullPath.includes(`/registry-employee/edit`)) return false;
if (path == "registry" && route.fullPath == "/registry-employee")
return false;
if (path == "registry" && route.fullPath.includes(`/registry-employee/edit`))
return false;
if (path == "registry" && route.fullPath == "/") return false;
// if (path != "registry" && path == "registryEmployee" && route.fullPath == "/registryEmployee") return true;
const bool = route.fullPath.includes(`/${path}`);