เครื่องราช

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-14 13:42:31 +07:00
parent 6642e3f25b
commit a94bebd6d0
6 changed files with 136 additions and 77 deletions

View file

@ -45,4 +45,6 @@ export default {
insigniaTypeNewIdOrg: (id: string) => `${insigniaTypeOrg}${id}`,
insigniaNewIdOrg: (id: string) => `${insigniaOrg}${id}`,
insigniaSortOrg: (id: string) => `${insigniaOrg}sort/${id}`,
checkIsofficer: `${env.API_URI}/org/workflow/keycloak/isofficer/`,
};

View file

@ -255,7 +255,7 @@ const person = ref<any>([]);
/** เช็คสถานนะแสดงปุ่มเพิ่ม*/
const checkStatus = computed(() => {
if (
roleDataStore.insignia1Role &&
DataStore.isStaff &&
(DataStore.requestStatus == "st1" || DataStore.requestStatus == "st4")
) {
return true;
@ -789,8 +789,6 @@ function clearInsigniaFilters(name: string) {
/** Hook*/
onMounted(async () => {
console.log(DataStore.optionsTypeOc);
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = DataStore.typeOc;
@ -806,6 +804,14 @@ onMounted(async () => {
}
}
});
watch(
() => DataStore.typeOc,
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
}
);
</script>
<template>
@ -813,7 +819,7 @@ onMounted(async () => {
<div class="row col-12">
<div class="row col-12 q-col-gutter-sm">
<q-select
v-if="roleDataStore.adminRole"
v-if="DataStore.isOfficer"
v-model="organization"
label="หน่วยงาน"
dense
@ -869,7 +875,6 @@ onMounted(async () => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2"
/>
@ -877,7 +882,7 @@ onMounted(async () => {
<q-card bordered class="q-pa-sm col-12 bg-grey-1 q-mt-sm">
<div class="row col-12 q-col-gutter-sm">
<q-select
:class="roleDataStore.adminRole ? 'col-1' : 'col-3'"
:class="DataStore.isOfficer ? 'col-1' : 'col-3'"
v-model="DataStore.typeinsignia"
label="ประเภทเครื่องราชฯ ที่ยืนขอ"
dense
@ -993,7 +998,7 @@ onMounted(async () => {
v-if="
(DataStore.isLock == false &&
DataStore.requestStatus == 'st5' &&
roleDataStore.adminRole) ||
DataStore.isOfficer) ||
(checkStatus == true && checkPermission($route)?.attrIsCreate)
"
>
@ -1041,14 +1046,14 @@ onMounted(async () => {
v-if="
(DataStore.isLock == false &&
DataStore.requestStatus == 'st5' &&
roleDataStore.adminRole) ||
DataStore.isOfficer) ||
checkStatus == true
"
>
<q-btn
v-if="
roleDataStore.adminRole ||
(roleDataStore.insignia1Role &&
DataStore.isOfficer ||
(DataStore.isStaff &&
(requestStatus == 'st1' || requestStatus == 'st4') &&
(checkPermission($route)?.attrIsGet ||
checkPermission($route)?.attrIsUpdate))

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { onMounted, ref, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
@ -273,13 +273,21 @@ onMounted(async () => {
}
}
});
watch(
() => DataStore.typeOc,
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
}
);
</script>
<template>
<div class="col-12 row q-pa-md">
<div class="row col-12">
<div class="row col-12 q-col-gutter-sm">
<q-select
v-if="roleDataStore.adminRole"
v-if="DataStore.isOfficer"
v-model="organization"
label="หน่วยงาน"
dense
@ -335,7 +343,6 @@ onMounted(async () => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2"
/>

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { onMounted, ref, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
@ -273,6 +273,14 @@ onMounted(async () => {
}
}
});
watch(
() => DataStore.typeOc,
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
}
);
</script>
<template>
@ -280,7 +288,7 @@ onMounted(async () => {
<div class="row col-12">
<div class="row col-12 q-col-gutter-sm">
<q-select
v-if="roleDataStore.adminRole"
v-if="DataStore.isOfficer"
v-model="organization"
label="หน่วยงาน"
dense
@ -336,7 +344,6 @@ onMounted(async () => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2"
/>

View file

@ -31,6 +31,10 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
{ name: "ลูกจ้างประจำ", id: "perm" },
]);
const isOfficer = ref<boolean>(false);
const isStaff = ref<boolean>(false);
const isDirector = ref<boolean>(false);
/** option รายงาน */
const optionReport = ref<OptionReport[]>([
{
@ -48,7 +52,6 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
* @param data
*/
async function fetchData(data: any) {
if (data !== null) {
let datalist = await data.map((e: any) => ({
id: e.id,
@ -252,5 +255,8 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
optionReport,
convertStatus,
dataInsigniaType,
isStaff,
isOfficer,
isDirector,
};
});

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { onMounted, onUnmounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
@ -77,25 +77,25 @@ async function fecthlistRound() {
// UI
if (optionRound.value.length !== 0) {
DataStore.optionRound = optionRound.value;
const lastValue = optionRound.value[0];
await fetchListOrg(lastValue.period_revision);
await fecthAgency(lastValue.period_revision);
if (DataStore.roundId) {
round.value = DataStore.roundId; //
} else {
round.value = lastValue.id.toString(); //
}
await fecthStat(round.value);
DataStore.roundId = round.value;
roundName.value = lastValue.name;
// DataStore.optionRound = optionRound.value;
// const lastValue = optionRound.value[0];
// await fetchListOrg(lastValue.period_revision);
// await fecthAgency(lastValue.period_revision);
// if (DataStore.roundId) {
// round.value = DataStore.roundId; //
// } else {
// round.value = lastValue.id.toString(); //
// }
// // await fecthStat(round.value);
// DataStore.roundId = round.value;
// roundName.value = lastValue.name;
loadview.value = true;
} else {
hideLoader();
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -104,14 +104,16 @@ async function fecthlistRound() {
* function เรยกด Stat ของรอบการเสนอขอพระราชทานเครอง
*/
async function fecthStat(id: string) {
await http
.get(config.API.insigniaDashboard(id))
.then((res) => {
stat.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
});
if (DataStore.isOfficer) {
await http
.get(config.API.insigniaDashboard(id))
.then((res) => {
stat.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
});
}
}
/**
@ -119,24 +121,26 @@ async function fecthStat(id: string) {
* @param id โครงสรางปจจ
*/
async function fetchListOrg(id: string) {
await http
.get(config.API.orgByIdSystemRoot(id, route.meta.Key as string))
.then(async (res) => {
const data = res.data.result;
if (data.length !== 0) {
optiontypeOc.value = await res.data.result.map(
(item: DataStructureTree) => ({
id: item.orgTreeId,
name: item.orgName,
})
);
if (DataStore.isOfficer) {
await http
.get(config.API.orgByIdSystemRoot(id, route.meta.Key as string))
.then(async (res) => {
const data = res.data.result;
if (data.length !== 0) {
optiontypeOc.value = await res.data.result.map(
(item: DataStructureTree) => ({
id: item.orgTreeId,
name: item.orgName,
})
);
await DataStore.fetchOption(optiontypeOc.value); // DataStore
}
})
.catch((err) => {
messageError($q, err);
});
await DataStore.fetchOption(optiontypeOc.value); // DataStore
}
})
.catch((err) => {
messageError($q, err);
});
}
}
/**
@ -175,6 +179,20 @@ async function fecthInsignia() {
}
}
async function fetchCheckIsofficer() {
http
.get(config.API.checkIsofficer + `SYS_INSIGNIA_MANAGE`)
.then((res) => {
const data = res.data.result;
DataStore.isStaff = data.isStaff;
DataStore.isOfficer = data.isOfficer;
DataStore.isDirector = data.isDirector;
})
.catch((err) => {
messageError($q, err);
});
}
/**
* function เปลยนรอบการแสดง
*/
@ -433,7 +451,11 @@ async function uploadFile(event: any) {
*/
onMounted(async () => {
tab.value = DataStore.mainTab ?? "";
await Promise.all([fecthlistRound(), fecthInsignia(), fecthInsignia()]);
await Promise.all([fecthlistRound(), fecthInsignia(), fetchCheckIsofficer()]);
});
onUnmounted(() => {
DataStore.typeOc = "";
});
</script>
@ -441,7 +463,14 @@ onMounted(async () => {
<div class="toptitle text-dark col-12 row items-center">
รายชอขาราชการสามญฯ ทธนขอพระราชทานเครองราชอสรยาภรณ
</div>
<q-card bordered class="row col-12 q-mt-sm" v-if="loadview">
<q-card
bordered
class="row col-12 q-mt-sm"
v-if="
loadview &&
(DataStore.isDirector || DataStore.isOfficer || DataStore.isStaff)
"
>
<div class="row col-12 items-center bg-grey-1">
<div class="q-pl-md q-pr-sm text-weight-medium text-grey-7">รอบ</div>
<q-select
@ -458,10 +487,9 @@ onMounted(async () => {
<q-space />
<!-- สกจ. Freez อม -->
<q-btn
v-if="
roleDataStore.adminRole &&
DataStore.isOfficer &&
DataStore.isLock !== true &&
hideBottom &&
checkPermission($route)?.attrIsUpdate
@ -477,7 +505,7 @@ onMounted(async () => {
</q-btn>
</div>
<div class="col-12"><q-separator /></div>
<div v-if="roleDataStore.adminRole" class="col-12 row bg-white">
<div v-if="DataStore.isOfficer" class="col-12 row bg-white">
<div class="fit q-px-md q-py-sm">
<div class="row col-12 q-col-gutter-sm fit">
<!-- stat -->
@ -514,11 +542,19 @@ onMounted(async () => {
</div>
</q-card>
<q-card flat bordered class="col-12 q-mt-sm" v-if="loadview">
<q-card
flat
bordered
class="col-12 q-mt-sm"
v-if="
loadview &&
(DataStore.isDirector || DataStore.isOfficer || DataStore.isStaff)
"
>
<div
v-if="
(roleDataStore.insignia1Role && requestStatus == 'st4') ||
(roleDataStore.insignia2Role && requestStatus == 'st5')
(DataStore.isStaff && requestStatus == 'st4') ||
(DataStore.isDirector && requestStatus == 'st5')
"
class="q-pa-md q-gutter-sm"
>
@ -545,7 +581,7 @@ onMounted(async () => {
<q-tab name="reject" label="คนที่ไม่ยื่นขอ" />
<q-tab name="delete" label="คนที่ถูกลบออก" />
<q-tab
v-if="roleDataStore.adminRole"
v-if="DataStore.isOfficer"
name="organization"
label="หน่วยงานที่ยังไม่ได้ส่งรายชื่อ"
/>
@ -585,7 +621,7 @@ onMounted(async () => {
<!-- แทบหนวยงานทงไมไดงรายช -->
<q-tab-panel
v-if="roleDataStore.adminRole"
v-if="DataStore.isOfficer"
name="organization"
class="q-pa-none"
>
@ -595,9 +631,7 @@ onMounted(async () => {
<q-toolbar class="q-py-md text-right">
<q-file
v-if="
roleDataStore.insignia1Role && checkPermission($route)?.attrIsUpdate
"
v-if="DataStore.isStaff && checkPermission($route)?.attrIsUpdate"
bg-color="white"
clearable
outlined
@ -628,9 +662,7 @@ onMounted(async () => {
flat
round
color="primary"
v-if="
roleDataStore.insignia1Role && checkPermission($route)?.attrIsGet
"
v-if="DataStore.isStaff && checkPermission($route)?.attrIsGet"
:href="document"
target="_blank"
>
@ -651,7 +683,7 @@ onMounted(async () => {
<q-space />
<q-btn
v-if="
roleDataStore.insignia1Role &&
DataStore.isStaff &&
(requestStatus == 'st1' || requestStatus == 'st4') &&
checkPermission($route)?.attrIsUpdate
"
@ -664,7 +696,7 @@ onMounted(async () => {
/>
<q-btn
v-if="
roleDataStore.insignia2Role &&
DataStore.isDirector &&
(requestStatus == 'st3' || requestStatus == 'st5') &&
checkPermission($route)?.attrIsUpdate
"
@ -677,7 +709,7 @@ onMounted(async () => {
/>
<q-btn
v-if="
roleDataStore.insignia2Role &&
DataStore.isDirector &&
requestStatus == 'st3' &&
checkPermission($route)?.attrIsUpdate
"
@ -691,7 +723,7 @@ onMounted(async () => {
<q-btn
v-if="
requestStatus == 'st6' &&
roleDataStore.adminRole &&
DataStore.isOfficer &&
!DataStore.isLock &&
checkPermission($route)?.attrIsUpdate
"