fixing insignia

This commit is contained in:
Warunee Tamkoo 2025-05-14 20:38:51 +07:00
parent dea45644d0
commit cc1927a2f4
8 changed files with 64 additions and 54 deletions

View file

@ -22,8 +22,10 @@ export default {
insigniaPeriodId: any, insigniaPeriodId: any,
ocId: string, ocId: string,
role: string, role: string,
status: any status: any,
) => `${insignia}/request/${insigniaPeriodId}/${ocId}/${role}/${status}`, isDeputy: boolean = false
) =>
`${insignia}/request/${insigniaPeriodId}/${ocId}/${role}/${status}/${isDeputy}`,
insigniaReject: (profileId: string) => insigniaReject: (profileId: string) =>
`${insignia}/request/status/reject/${profileId}`, `${insignia}/request/status/reject/${profileId}`,
insigniaDelete: (profileId: string) => insigniaDelete: (profileId: string) =>

View file

@ -54,6 +54,7 @@ interface DataStructureTree {
children: DataStructureTree[]; children: DataStructureTree[];
orgRootCode: string; orgRootCode: string;
orgRootShortName: string; orgRootShortName: string;
isDeputy?: boolean;
} }
interface DataStrategy { interface DataStrategy {

View file

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, computed, reactive, watch } from "vue"; import { onMounted, ref, computed, reactive, watch } from "vue";
import { useQuasar, QForm } from "quasar"; import { useQuasar, QForm, is } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store"; import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -77,6 +77,7 @@ const modalEdit = ref<boolean>(false); //popup แก้ไขเครื่อ
const modalPersonal = ref<boolean>(false); //popup const modalPersonal = ref<boolean>(false); //popup
const rowid = ref<string>(""); // id const rowid = ref<string>(""); // id
const organization = ref<string>(""); // const organization = ref<string>(""); //
const isDeputy = ref<boolean>(false); //
/** หมายเหตุ*/ /** หมายเหตุ*/
const dialogNote = ref<boolean>(false); // const dialogNote = ref<boolean>(false); //
@ -315,13 +316,17 @@ const checkStatus = computed(() => {
}); });
/** เลือกหน่วยงาน*/ /** เลือกหน่วยงาน*/
function changtypeOc() { async function changtypeOc() {
if (organization.value !== null) { if (organization.value !== null) {
isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1);
props.fecthInsigniaByOc?.( props.fecthInsigniaByOc?.(
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
} }
DataStore.typeOc = organization.value; DataStore.typeOc = organization.value;
@ -441,7 +446,8 @@ async function addlistperson(id: string) {
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
} }
modalAdd.value = false; modalAdd.value = false;
@ -536,7 +542,8 @@ async function clickSave() {
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
success($q, "แก้ไขเครื่องราชฯ ที่ยื่นขอสำเร็จ"); success($q, "แก้ไขเครื่องราชฯ ที่ยื่นขอสำเร็จ");
modalEdit.value = false; modalEdit.value = false;
@ -589,7 +596,8 @@ async function listreject(profileId: string, reason: string) {
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
@ -646,7 +654,8 @@ async function listdelete(id: string, reason: string) {
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
closemodelPopupDelete(); closemodelPopupDelete();
@ -884,11 +893,16 @@ onMounted(async () => {
if (organization.value !== "" || organization.value !== undefined) { if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) { if (props.fecthInsigniaByOc) {
isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1);
props.fecthInsigniaByOc( props.fecthInsigniaByOc(
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
DataStore.mainTab = props.tab; DataStore.mainTab = props.tab;
} }

View file

@ -3,7 +3,6 @@ import { onMounted, ref, watch } from "vue";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import { useInsigniaDataStore } from "@/modules/07_insignia/store"; import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
/** import Type*/ /** import Type*/
@ -17,7 +16,6 @@ import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { onSearchDataTable } = mixin; const { onSearchDataTable } = mixin;
/** useStore*/ /** useStore*/
const roleDataStore = useroleUserDataStore();
const DataStore = useInsigniaDataStore(); const DataStore = useInsigniaDataStore();
const props = defineProps({ const props = defineProps({
tab: { tab: {
@ -38,6 +36,7 @@ const organization = ref<string>("1");
const filterOrganizationOP = ref<OptionData[]>([]); // const filterOrganizationOP = ref<OptionData[]>([]); //
const typeinsigniaOptions = ref<OptionData[]>(DataStore.typeinsigniaOptions); // const typeinsigniaOptions = ref<OptionData[]>(DataStore.typeinsigniaOptions); //
const employeeClassOps = ref<OptionData[]>(DataStore.employeeClassOps); // const employeeClassOps = ref<OptionData[]>(DataStore.employeeClassOps); //
const isDeputy = ref<boolean>(false); //
/** หัวตาราง*/ /** หัวตาราง*/
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
@ -156,13 +155,18 @@ const visibleColumns = ref<string[]>([
]); ]);
/** function เลือกหน่วยงาน */ /** function เลือกหน่วยงาน */
function changtypeOc() { async function changtypeOc() {
if (organization.value !== null) { if (organization.value !== null) {
isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1);
props.fecthInsigniaByOc?.( props.fecthInsigniaByOc?.(
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
} }
DataStore.typeOc = organization.value; DataStore.typeOc = organization.value;
@ -268,11 +272,16 @@ onMounted(async () => {
organization.value = await DataStore.typeOc; organization.value = await DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) { if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) { if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc( isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1);
props.fecthInsigniaByOc(
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
DataStore.mainTab = props.tab; DataStore.mainTab = props.tab;
} }

View file

@ -37,7 +37,7 @@ const typeinsigniaOptions = ref<OptionData[]>(DataStore.typeinsigniaOptions); //
const employeeClassOps = ref<OptionData[]>(DataStore.employeeClassOps); // const employeeClassOps = ref<OptionData[]>(DataStore.employeeClassOps); //
const filterOrganizationOP = ref<OptionData[]>([]); // // const filterOrganizationOP = ref<OptionData[]>([]); // //
const organization = ref<string>("1"); const organization = ref<string>("1");
const organizationOptions = ref<OptionData[]>([{ id: "1", name: "ทั้งหมด" }]); const isDeputy = ref<boolean>(false); //
/** หัวตาราง*/ /** หัวตาราง*/
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
@ -158,11 +158,16 @@ const visibleColumns = ref<string[]>([
/** function เลือกหน่วยงาน */ /** function เลือกหน่วยงาน */
async function changtypeOc() { async function changtypeOc() {
if (props.fecthInsigniaByOc) { if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc( isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1);
props.fecthInsigniaByOc(
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
} }
DataStore.typeOc = organization.value; DataStore.typeOc = organization.value;
@ -277,11 +282,16 @@ onMounted(async () => {
organization.value = await DataStore.typeOc; organization.value = await DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) { if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) { if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc( isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1);
props.fecthInsigniaByOc(
props.roundId, props.roundId,
organization.value, organization.value,
"officer", "officer",
props.tab props.tab,
isDeputy.value
); );
DataStore.mainTab = props.tab; DataStore.mainTab = props.tab;
} }

View file

@ -1,10 +1,11 @@
interface OptionData { interface OptionData {
id: string | number; id: string | number;
name: string; name: string;
isDeputy?: boolean;
} }
interface OptionDataList { interface OptionDataList {
id:string id: string;
val: string | number; val: string | number;
name: string; name: string;
} }
@ -233,5 +234,5 @@ export type {
Pagination, Pagination,
DataManageList, DataManageList,
ResOrg, ResOrg,
OptionDataList OptionDataList,
}; };

View file

@ -133,6 +133,7 @@ async function fetchListOrg(id: string) {
(item: DataStructureTree) => ({ (item: DataStructureTree) => ({
id: item.orgTreeId, id: item.orgTreeId,
name: item.orgName, name: item.orgName,
isDeputy: item.isDeputy,
}) })
); );
@ -231,13 +232,14 @@ async function fecthInsigniaByOc(
roundId: string, roundId: string,
ocId: string, ocId: string,
role: string, role: string,
status: string status: string,
isDeputy: boolean = false
) { ) {
DataStore.rows = []; DataStore.rows = [];
if (roundId && ocId && role && status) { if (roundId && ocId && role && status) {
showLoader(); showLoader();
await http await http
.get(config.API.insigniaList(roundId, ocId, role, status)) .get(config.API.insigniaList(roundId, ocId, role, status, isDeputy))
.then(async (res) => { .then(async (res) => {
requestNote.value = res.data.result.requestNote; requestNote.value = res.data.result.requestNote;
requestStatus.value = res.data.result.requestStatus; requestStatus.value = res.data.result.requestStatus;

View file

@ -18,7 +18,6 @@ import type {
optionType, optionType,
} from "../interface/request/main/main"; } from "../interface/request/main/main";
import { tabList, tabListPlacement } from "../interface/request/main/main"; import { tabList, tabListPlacement } from "../interface/request/main/main";
import { useroleUserDataStore } from "@/stores/roleUser";
import LoginLinkage from "@/components/LoginLinkage.vue"; import LoginLinkage from "@/components/LoginLinkage.vue";
@ -41,9 +40,6 @@ const {
date2Thai, date2Thai,
dialogConfirm, dialogConfirm,
} = mixin; } = mixin;
const DataStore = useroleUserDataStore();
const { fetchroleUser } = DataStore;
const $q = useQuasar(); const $q = useQuasar();
const { tabData, loader } = storeToRefs(store); const { tabData, loader } = storeToRefs(store);
const { changeTab } = store; const { changeTab } = store;
@ -51,34 +47,12 @@ const miniState = ref<boolean>(true);
const drawerR = ref<boolean>(false); const drawerR = ref<boolean>(false);
const rightActive = ref<boolean>(false); const rightActive = ref<boolean>(false);
const resize = ref<number>(0); const resize = ref<number>(0);
const active = ref<number>(0);
const drawerL = ref<boolean>(false); const drawerL = ref<boolean>(false);
const fullname = ref<string>(""); const fullname = ref<string>("");
const role = ref<string[]>([]);
const notiTrigger = ref<boolean>(false); const notiTrigger = ref<boolean>(false);
const text = ref<string>(""); const text = ref<string>("");
const notiList = ref<notiType[]>([]); const notiList = ref<notiType[]>([]);
const options = ref<optionType[]>([
{
icon: "mdi-account-cog",
label: "ผู้ดูแลระบบ",
value: "op1",
color: "primary",
},
{
icon: "mdi-account-group",
label: "เจ้าหน้าที่",
value: "op2",
color: "blue",
},
{
icon: "mdi-account-circle",
label: "บุคคล",
value: "op3",
color: "indigo",
},
]);
const modalLoginLinkage = ref<boolean>(false); // Linkage Center const modalLoginLinkage = ref<boolean>(false); // Linkage Center
// landing page redirect // landing page redirect
@ -252,9 +226,6 @@ onMounted(async () => {
isSsoToken.value = SSO_TOKEN === "y" ? true : false; isSsoToken.value = SSO_TOKEN === "y" ? true : false;
if (user) { if (user) {
fullname.value = user.name; fullname.value = user.name;
role.value = user.role;
await fetchroleUser(user.role);
} }
fetchmsgNoread(); fetchmsgNoread();