Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-05-15 13:42:06 +07:00
commit 36d0c61b25
16 changed files with 162 additions and 143 deletions

View file

@ -283,6 +283,8 @@ async function getData() {
if (res.data.result.birthDate) {
//
age.value = calculateAge(res.data.result.birthDate);
} else {
age.value = null;
}
})
.catch((e) => {

View file

@ -78,9 +78,11 @@ const baseColumns = ref<QTableColumn[]>([
sortable: true,
field: "startDate",
format(val, row) {
return row.isDate
? date2Thai(row.startDate)
: (new Date(row.startDate).getFullYear() + 543).toString();
return row.startDate
? row.isDate
? date2Thai(row.startDate)
: (new Date(row.startDate).getFullYear() + 543).toString()
: "-";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
@ -94,9 +96,11 @@ const baseColumns = ref<QTableColumn[]>([
sortable: true,
field: "endDate",
format(val, row) {
return row.isDate
? date2Thai(row.endDate)
: (new Date(row.endDate).getFullYear() + 543).toString();
return row.endDate
? row.isDate
? date2Thai(row.endDate)
: (new Date(row.endDate).getFullYear() + 543).toString()
: "-";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",

View file

@ -1,6 +1,6 @@
<script setup lang="ts">
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 { useCounterMixin } from "@/stores/mixin";
@ -77,6 +77,7 @@ const modalEdit = ref<boolean>(false); //popup แก้ไขเครื่อ
const modalPersonal = ref<boolean>(false); //popup
const rowid = ref<string>(""); // id
const organization = ref<string>(""); //
const isDeputy = ref<boolean>(false); //
/** หมายเหตุ*/
const dialogNote = ref<boolean>(false); //
@ -307,7 +308,11 @@ const person = ref<DataManageList>();
/** เช็คสถานนะแสดงปุ่มเพิ่ม*/
const checkStatus = computed(() => {
if (
DataStore.isStaff &&
((DataStore.isOfficer &&
DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1) ||
DataStore.isStaff) &&
(DataStore.requestStatus == "st1" || DataStore.requestStatus == "st4")
) {
return true;
@ -315,13 +320,17 @@ const checkStatus = computed(() => {
});
/** เลือกหน่วยงาน*/
function changtypeOc() {
async function changtypeOc() {
if (organization.value !== null) {
isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1);
props.fecthInsigniaByOc?.(
props.roundId,
organization.value,
"officer",
props.tab
props.tab,
isDeputy.value
);
}
DataStore.typeOc = organization.value;
@ -441,7 +450,8 @@ async function addlistperson(id: string) {
props.roundId,
organization.value,
"officer",
props.tab
props.tab,
isDeputy.value
);
}
modalAdd.value = false;
@ -536,7 +546,8 @@ async function clickSave() {
props.roundId,
organization.value,
"officer",
props.tab
props.tab,
isDeputy.value
);
success($q, "แก้ไขเครื่องราชฯ ที่ยื่นขอสำเร็จ");
modalEdit.value = false;
@ -589,7 +600,8 @@ async function listreject(profileId: string, reason: string) {
props.roundId,
organization.value,
"officer",
props.tab
props.tab,
isDeputy.value
);
success($q, "บันทึกข้อมูลสำเร็จ");
@ -646,7 +658,8 @@ async function listdelete(id: string, reason: string) {
props.roundId,
organization.value,
"officer",
props.tab
props.tab,
isDeputy.value
);
success($q, "บันทึกข้อมูลสำเร็จ");
closemodelPopupDelete();
@ -837,9 +850,10 @@ function clearInsigniaFilters(name: string) {
watch(
() => DataStore.typeOc,
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
() => {
filterOrganizationOP.value = DataStore.optionsTypeOc;
organization.value = DataStore.typeOc;
DataStore.selectOrganization = DataStore.typeOc;
}
);
@ -881,14 +895,20 @@ function onClickViewInfo(type: string, id: string, empClass: string) {
onMounted(async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = DataStore.typeOc;
DataStore.selectOrganization = DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1);
props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
props.tab,
isDeputy.value
);
DataStore.mainTab = props.tab;
}

View file

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

View file

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

View file

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

View file

@ -47,6 +47,8 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
const isOfficer = ref<boolean>(false);
const isStaff = ref<boolean>(false);
const isDirector = ref<boolean>(false);
const isDeputy = ref<boolean>(false);
const selectOrganization = ref<string>("");
/** option รายงาน */
const optionReport = ref<OptionReport[]>([
@ -285,5 +287,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
isStaff,
isOfficer,
isDirector,
isDeputy,
selectOrganization,
};
});

View file

@ -32,7 +32,6 @@ const {
const rows = ref<FormProprsalsRound2[]>([]); //
const rowsData = ref<FormProprsalsRound2[]>([]); //
const filterKeyword = ref<string>(""); //
const filterRef = ref<HTMLInputElement | null>(null);
const columns = ref<QTableProps["columns"]>([
{
name: "period_name",
@ -103,9 +102,7 @@ const modalForm = ref<boolean>(false); //แสดงรายละเอีย
const actionType = ref<string>(""); // ,
const roundId = ref<string>(""); //id ,
/**
* Function เรยกรายการรอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
*/
/** Function เรียกรายการรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์*/
async function fetchData() {
showLoader();
await http
@ -149,7 +146,7 @@ function clickDelete(id: string) {
.delete(config.API.RoundInsignia(id))
.then(async () => {
await fetchData();
await success($q, "ลบข้อมูลสำเร็จ");
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
@ -160,16 +157,6 @@ function clickDelete(id: string) {
});
}
/**
* Function กำหนดค filterKeyword เปนคาวาง
*/
function resetFilter() {
filterKeyword.value = "";
if (filterRef.value) {
filterRef.value.focus();
}
}
/**
* function อมลรายละเอยดรอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
* @param action ประเภท รายละเอยด,แกไข
@ -189,9 +176,7 @@ function onSearch() {
);
}
/**
* ทำงานเม Componenets กเรยกใชงาน
*/
/** ทำงานเมื่อ Componenets ถูกเรียกใช้งาน*/
onMounted(async () => {
await fetchData();
});
@ -201,6 +186,7 @@ onMounted(async () => {
<div class="toptitle text-dark col-12 row items-center">
รายการรอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
</div>
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
<div class="row q-col-gutter-sm">
<div class="row col-12 q-col-gutter-sm">
@ -222,7 +208,6 @@ onMounted(async () => {
standout
dense
v-model="filterKeyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"

View file

@ -40,7 +40,7 @@ const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
* วแปร
*/
const loadview = ref<boolean>(false); // View
const hideBottom = ref<boolean>(false);
// const hideBottom = ref<boolean>(false);
const round = ref<string>(""); //
const roundName = ref<string>(""); //
const optionRound = ref<OptionRound[]>([]);
@ -133,6 +133,7 @@ async function fetchListOrg(id: string) {
(item: DataStructureTree) => ({
id: item.orgTreeId,
name: item.orgName,
isDeputy: item.isDeputy,
})
);
@ -157,6 +158,7 @@ async function fecthAgency(id: string) {
})
.then((res) => {
DataStore.agency = res.data.result.rootId;
DataStore.selectOrganization = res.data.result.rootId;
DataStore.typeOc = DataStore.agency;
})
.catch((err) => {
@ -189,6 +191,7 @@ async function fetchCheckIsofficer() {
DataStore.isStaff = data.isStaff;
DataStore.isOfficer = data.isOfficer;
DataStore.isDirector = data.isDirector;
DataStore.isDeputy = data.isDeputy;
})
.catch((err) => {
messageError($q, err);
@ -231,13 +234,14 @@ async function fecthInsigniaByOc(
roundId: string,
ocId: string,
role: string,
status: string
status: string,
isDeputy: boolean = false
) {
DataStore.rows = [];
if (roundId && ocId && role && status) {
showLoader();
await http
.get(config.API.insigniaList(roundId, ocId, role, status))
.get(config.API.insigniaList(roundId, ocId, role, status, isDeputy))
.then(async (res) => {
requestNote.value = res.data.result.requestNote;
requestStatus.value = res.data.result.requestStatus;
@ -246,11 +250,11 @@ async function fecthInsigniaByOc(
await DataStore.fetchData(res.data.result.items); //
await DataStore.fetchDataInsignia(res.data.result); //
//
if (res.data.result.items !== null) {
if (res.data.result.items.length !== 0) {
hideBottom.value = true;
} else hideBottom.value = false;
}
// if (res.data.result.items !== null) {
// if (res.data.result.items.length !== 0) {
// hideBottom.value = true;
// } else hideBottom.value = false;
// }
})
.catch((err) => {
messageError($q, err);
@ -493,7 +497,6 @@ onUnmounted(() => {
v-if="
DataStore.isOfficer &&
DataStore.isLock !== true &&
hideBottom &&
checkPermission($route)?.attrIsUpdate
"
dense
@ -555,7 +558,7 @@ onUnmounted(() => {
>
<div
v-if="
(DataStore.isStaff && requestStatus == 'st4') ||
(((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex((v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) && requestStatus == 'st4') ||
(DataStore.isDirector && requestStatus == 'st5')
"
class="q-pa-md q-gutter-sm"
@ -633,7 +636,7 @@ onUnmounted(() => {
<q-toolbar class="q-py-md text-right">
<q-file
v-if="DataStore.isStaff && checkPermission($route)?.attrIsUpdate"
v-if="((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex((v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) && checkPermission($route)?.attrIsUpdate"
bg-color="white"
clearable
outlined
@ -664,7 +667,7 @@ onUnmounted(() => {
flat
round
color="primary"
v-if="DataStore.isStaff && checkPermission($route)?.attrIsGet"
v-if="checkPermission($route)?.attrIsGet"
:href="document"
target="_blank"
>
@ -683,9 +686,11 @@ onUnmounted(() => {
>
</div>
<q-space />
<q-btn
v-if="
DataStore.isStaff &&
((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) &&
(requestStatus == 'st1' || requestStatus == 'st4') &&
checkPermission($route)?.attrIsUpdate
"

View file

@ -220,7 +220,6 @@ const isEdit = ref<boolean>(false); // สถานะการแก้ไข
const insigniaReclaimId = ref<string>(""); // ID
const insigniaReclaimData = ref<DataReclaim>(); //
const yearRound = ref<number>(); //
const insigniaType = ref<string>("all"); //
const employeeType = ref<string>("all"); //
@ -234,8 +233,8 @@ async function fetchInsigniaRound() {
let data = res.data.result;
roundData.value.push(...data);
roundOps.value = roundData.value;
yearRound.value = data[0].year;
if (data.length > 0) {
yearRound.value = data[0].year;
isInsigniaRound.value = true;
}
})

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from "vue";
import { ref, reactive, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useQuasar } from "quasar";
@ -49,18 +49,18 @@ const router = useRouter();
const route = useRoute();
const paramsId = route.params.id.toString();
const keycloakId = ref<string>("");
const myProfileId = ref<string>("");
const typeDocx = ref<string>("docx");
const typePdf = ref<string>("pdf");
const modalApprove = ref(false);
const dialogTitle = ref<string>("อนุญาต");
const approveCheck = computed(() => {
return (
rows.value?.commanders?.every(
(commander) => commander.approveStatus === "APPROVE"
) ?? false
);
});
// const approveCheck = computed(() => {
// return (
// rows.value?.commanders?.every(
// (commander) => commander.approveStatus === "APPROVE"
// ) ?? false
// );
// });
/**
* consolelog ไวอน
@ -470,12 +470,12 @@ async function checkOfficer() {
}
async function fetchKeycloakPosition() {
if (keycloakId.value == "") {
if (myProfileId.value == "") {
await http
.get(config.API.keycloakPosition())
.then(async (res) => {
const data = await res.data.result;
keycloakId.value = data.profileId;
myProfileId.value = data.profileId;
})
.catch((err) => {
messageError($q, err);
@ -830,23 +830,17 @@ async function fetchKeycloakPosition() {
</div>
<q-separator
v-if="
checkPermission($route)?.attrIsUpdate &&
formData.reasonOligarch === '-' &&
rows &&
rows.approvers[0]?.profileId == keycloakId &&
rows.approvers[0]?.approveStatus == 'PENDING' &&
approveCheck
rows.approvers[0]?.profileId == myProfileId &&
rows.approvers[0]?.approveStatus == 'PENDING'
"
/>
<div
class="row q-pa-md q-gutter-sm justify-end"
v-if="
checkPermission($route)?.attrIsUpdate &&
formData.reasonOligarch === '-' &&
rows &&
rows.approvers[0]?.profileId == keycloakId &&
rows.approvers[0]?.approveStatus == 'PENDING' &&
approveCheck
rows.approvers[0]?.profileId == myProfileId &&
rows.approvers[0]?.approveStatus == 'PENDING'
"
>
<q-btn

View file

@ -238,24 +238,6 @@ function updatePagination(newPagination: any) {
pagination.value.rowsPerPage = newPagination.rowsPerPage;
}
/**
* แปลง สถานะ เป text
* @param val
*/
function convert(val: any) {
const filtertype = props.dataToobar?.find(
(e: any) => e.id === val.leaveTypeId
);
const type = filtertype?.code;
if (type == "LV-006" && val.hajjDayStatus == false) {
return "ลาอุปสมบท";
} else if (type == "LV-006" && val.hajjDayStatus == true) {
return "ลาประกอบพิธีฮัจญ์";
} else {
return val.leaveTypeName;
}
}
/** Hook*/
onMounted(() => {
if (leaveStore.tabMenu === "1") {
@ -306,7 +288,23 @@ onMounted(() => {
<q-tooltip>รายละเอยด</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props" :class="props.row.statusText == 'REJECT' || props.row.statusText == 'DELETE' ? 'text-red':props.row.statusText == 'PENDING' ? 'text-orange':props.row.statusText == 'APPROVE' ? 'text-green':''">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
:class="
props.row.statusText == 'REJECT'
? 'text-red'
: props.row.statusText == 'NEW'
? 'text-blue'
: props.row.statusText == 'PENDING'
? 'text-warning'
: props.row.statusText == 'DELETE' ||
props.row.statusText == 'DELETING'
? 'text-orange'
: ''
"
>
<div v-if="col.name == 'no'">
{{
(pagination.page - 1) * pagination.rowsPerPage +
@ -315,7 +313,15 @@ onMounted(() => {
}}
</div>
<div v-else-if="col.name == 'leaveTypeName'">
{{ props.row.leaveTypeName ? `${props.row.leaveTypeName} ${props.row.leaveSubTypeName ? `(${props.row.leaveSubTypeName})`:''}`: '-' }}
{{
props.row.leaveTypeName
? `${props.row.leaveTypeName} ${
props.row.leaveSubTypeName
? `(${props.row.leaveSubTypeName})`
: ""
}`
: "-"
}}
</div>
<div v-else-if="col.name == 'profileType'">
{{

View file

@ -131,8 +131,10 @@ export const useLeavelistDataStore = defineStore("leave", () => {
return "อนุญาต";
case "REJECT":
return "ไม่อนุญาต";
case "DELETING":
return "กำลังดำเนินการยกเลิก";
case "DELETE":
return "ยกเลิก";
return "ยกเลิกสำเร็จ";
}
}