เครื่องราชฯ จัดการคำขอปรับการแสดงเงื่อนไขตรงคอลัมน์แจ้งเตือน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-27 14:44:49 +07:00
parent f38b10becf
commit 2aa04422ae
5 changed files with 763 additions and 48 deletions

View file

@ -0,0 +1,232 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
/** importType*/
import type { QTableProps } from "quasar";
import type { DataDiscipline } from "@/modules/13_salary/interface/response/Main";
/** importStore*/
import { useResultsPerformDataStore } from "@/modules/04_registryPerson/stores/ResultsPerformance";
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const store = useResultsPerformDataStore();
const { textRangePoint, textPoint } = store;
const { date2Thai, showLoader, hideLoader, messageError, onSearchDataTable } =
useCounterMixin();
/** props*/
const profileId = defineModel<string>("profileId", { required: true });
const employeeClass = defineModel<string>("employeeClass", { required: true });
/** Table*/
const keyword = ref<string>("");
const rows = ref<DataDiscipline[]>([]);
const rowsData = ref<DataDiscipline[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "date",
align: "left",
label: "วันที่ได้รับ",
sortable: true,
field: "date",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
},
{
name: "point1Total",
align: "left",
label: "ส่วนที่1 (น้ำหนัก)",
sortable: true,
field: "point1Total",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "point1",
align: "left",
label: "ผลประเมินส่วนที่1 (คะแนน)",
sortable: true,
field: "point1",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "point2Total",
align: "left",
label: "ส่วนที่2 (น้ำหนัก)",
sortable: true,
field: "point2Total",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "point2",
align: "left",
label: "ผลประเมินส่วนที่2 (คะแนน)",
sortable: true,
field: "point2",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "pointSumTotal",
align: "left",
label: "ผลรวม (น้ำหนัก)",
sortable: true,
field: "pointSumTotal",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "pointSum",
align: "left",
label: "ผลประเมินรวม (คะแนน)",
sortable: true,
field: "pointSum",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "name",
align: "left",
label: "ผลประเมิน",
sortable: true,
field: "name",
format(val, row) {
return `${textPoint(row.pointSum)} ${textRangePoint(row.pointSum)}`;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"point1Total",
"point1",
"point2Total",
"point2",
"pointSumTotal",
"pointSum",
"name",
"date",
]);
/** function fetch รายการข้อมูลผลการประเมินการปฏิบัติราชการ*/
function fetchListAssessments() {
showLoader();
http
.get(
config.API.profileNewAssessmentsByProfileId(
profileId.value,
employeeClass.value
)
)
.then((res) => {
rows.value = res.data.result;
rowsData.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function onSearch() {
rows.value = onSearchDataTable(
keyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
onMounted(() => {
fetchListAssessments();
});
</script>
<template>
<q-card-section class="q-pt-none">
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-space />
<q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<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">
<d-table
ref="table"
row-key="id"
flat
bordered
dense
:paging="true"
:rows-per-page-options="[20, 50, 100]"
:visible-columns="visibleColumns"
:rows="rows"
:columns="columns"
>
<template v-slot:header="props">
<q-tr :props="props">
<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 v-for="col in props.cols" :key="col.id">
<div class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</q-card-section>
</template>
<style scoped></style>

View file

@ -0,0 +1,327 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
/**
* importType
*/
import type { QTableProps } from "quasar";
import type { DataDiscipline } from "@/modules/13_salary/interface/response/Main";
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const { date2Thai, showLoader, hideLoader, messageError, onSearchDataTable } =
useCounterMixin();
/** props*/
const profileId = defineModel<string>("profileId", { required: true });
const employeeClass = defineModel<string>("employeeClass", { required: true });
/** Table*/
const keyword = ref<string>("");
const rows = ref<DataDiscipline[]>([]);
const rowsData = ref<DataDiscipline[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "year",
align: "left",
label: "ปีที่ยื่นขอ",
sortable: true,
field: "year",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => v + 543,
},
{
name: "receiveDate",
align: "left",
label: "วันที่ได้รับ",
sortable: true,
field: "receiveDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "insignia",
align: "left",
label: "ชื่อเครื่องราชฯ",
sortable: true,
field: "insigniaId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => insigniaData.value.find((r) => r.id === v)?.name,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "insigniaType",
align: "left",
label: "ลำดับชั้น",
sortable: true,
field: "insigniaType",
format(val, row) {
return row.insignia.insigniaType.name;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "no",
align: "left",
label: "ลำดับที่",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "issue",
align: "left",
label: "ราชกิจจาฯ ฉบับที่",
sortable: true,
field: "issue",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "volumeNo",
align: "left",
label: "เล่มที่",
sortable: true,
field: "volumeNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "volume",
align: "left",
label: "เล่ม",
sortable: true,
field: "volume",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "section",
align: "left",
label: "ตอน",
sortable: true,
field: "section",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "page",
align: "left",
label: "หน้า",
sortable: true,
field: "page",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateAnnounce",
align: "left",
label: "วันที่ประกาศในราชกิจจาฯ",
sortable: true,
field: "dateAnnounce",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "note",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "note",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"insignia",
"insigniaType",
"year",
"no",
"issue",
"volumeNo",
"volume",
"section",
"page",
"receiveDate",
"dateAnnounce",
"refCommandNo",
"refCommandDate",
"note",
]);
const insigniaData = ref<any[]>([]);
/** fetch ข้อมูลรายการเครื่องราชอิสริยาภรณ์*/
async function fetchListInsignia() {
showLoader();
http
.get(
config.API.profileNewInsignByProfileId(
profileId.value,
employeeClass.value
)
)
.then((res) => {
rows.value = res.data.result;
rowsData.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** fetch ข้อมูลเครื่องราชอิสริยาภรณ์*/
async function fetchInsignia() {
showLoader();
http
.get(config.API.insigniaOrg)
.then(async (res) => {
insigniaData.value = res.data.result;
await fetchListInsignia();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function onSearch() {
rows.value = onSearchDataTable(
keyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
onMounted(async () => {
await fetchInsignia();
});
</script>
<template>
<q-card-section class="q-pt-none">
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-space />
<q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<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">
<d-table
ref="table"
row-key="id"
flat
dense
bordered
:paging="true"
:rows-per-page-options="[20, 50, 100]"
:visible-columns="visibleColumns"
:rows="rows"
:columns="columns"
>
<template v-slot:header="props">
<q-tr :props="props">
<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 v-for="col in props.cols" :key="col.id">
<div class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</q-card-section>
</template>
<style lang="sass" scoped></style>

View file

@ -28,6 +28,7 @@ import DialogInformation from "@/components/Dialogs/Information.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import btnDownloadFile from "@/modules/07_insignia/components/2_Manage/downloadFile.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
import DialogInfo from "@/modules/13_salary/components/DialogInfoMain.vue";
/**use*/
const myForm = ref<QForm>();
@ -106,7 +107,11 @@ const visibleColumns = ref<string[]>([
"insigniaLevel",
"dateSend",
"note",
"warn",
// "warn",
"discipline",
"leave",
"assessments",
"insignia",
]);
const columns = ref<QTableProps["columns"]>([
{
@ -217,10 +222,48 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
// {
// name: "warn",
// align: "left",
// label: "",
// sortable: false,
// field: "",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{
name: "warn",
name: "discipline",
align: "left",
label: "แจ้งเตือน",
label: "โทษทางวินัย",
sortable: true,
field: "",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "leave",
align: "left",
label: "ไม่ได้เลื่อนเงินเดือน/ไม่ได้เลื่อนขั้น เนื่องจากลาเกิน",
sortable: false,
field: "",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "assessments",
align: "left",
label:
"ผลการประเมินการปฏิบัติราชการในรอบ 5 ปี ต่ำกว่าระดับดี (น้อยกว่าร้อยละ 70)",
sortable: false,
field: "",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "insignia",
align: "left",
label: "ข้อมูลเครื่องราชฯ",
sortable: false,
field: "",
headerStyle: "font-size: 14px",
@ -675,11 +718,7 @@ function updatemodalPersonal(modal: boolean) {
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
};
const pagination = ref({
sortBy: "name",
descending: false,
@ -804,6 +843,23 @@ function onSearch() {
);
}
const infoType = ref<string>(""); //
const profileId = ref<string>(""); //id
const modalDialogInfo = ref<boolean>(false); // /popup
const employeeClass = ref<string>("");
/**
* function อมลสวนต
* @param type ประเภทขอม
* @param id id องการด
*/
function onClickViewInfo(type: string, id: string, empClass: string) {
infoType.value = type;
profileId.value = id;
modalDialogInfo.value = true;
employeeClass.value = empClass === "officer" ? "" : "-employee";
}
/** Hook*/
onMounted(async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
@ -1040,6 +1096,8 @@ onMounted(async () => {
/>
<q-th v-else auto-width></q-th>
<q-th auto-width></q-th>
<q-th auto-width></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>
@ -1230,6 +1288,81 @@ onMounted(async () => {
<q-tooltip>แจงเตอน</q-tooltip></q-btn
>
</q-td>
<q-td key="discipline" class="text-center">
<q-btn
v-if="
checkPermission($route)?.attrIsGet &&
props.row.markDiscipline
"
flat
dense
icon="info"
color="red"
@click.pervent="
onClickViewInfo(
'discipline',
props.row.profileId,
props.row.employeeClass
)
"
>
</q-btn>
</q-td>
<q-td key="leave" class="text-center">
<q-btn
v-if="
checkPermission($route)?.attrIsGet && props.row.markLeave
"
flat
dense
icon="info"
color="red"
@click.pervent="
onClickViewInfo(
'leave',
props.row.profileId,
props.row.employeeClass
)
"
>
</q-btn>
</q-td>
<q-td key="assessments" class="text-center">
<q-btn
v-if="
checkPermission($route)?.attrIsGet && props.row.markRate
"
flat
dense
icon="info"
color="red"
@click.pervent="
onClickViewInfo(
'assessments',
props.row.profileId,
props.row.employeeClass
)
"
>
</q-btn>
</q-td>
<q-td key="insignia" class="text-center">
<q-btn
v-if="checkPermission($route)?.attrIsGet"
flat
dense
icon="info"
color="info"
@click.pervent="
onClickViewInfo(
'insignia',
props.row.profileId,
props.row.employeeClass
)
"
>
</q-btn>
</q-td>
</q-tr>
</template>
</d-table>
@ -1543,4 +1676,11 @@ onMounted(async () => {
:id="personId"
@update:modal="updatemodalPersonal"
/>
<DialogInfo
v-model:modal="modalDialogInfo"
v-model:profile-id="profileId"
:type="infoType"
:employee-class="employeeClass"
/>
</template>

View file

@ -94,6 +94,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
dateSend: e.requestDate ? date2Thai(e.requestDate) : null,
requestNote: e.requestNote ? e.requestNote : "",
employeeType: profileType(e.profileType) || null,
employeeClass: e.profileType,
reason: e.reason ? e.reason : "",
markDiscipline: e.markDiscipline,
markLeave: e.markLeave,

View file

@ -12,6 +12,8 @@ import { checkPermissionGet } from "@/utils/permissions";
import InfoSalary from "@/modules/13_salary/components/InfoSalary.vue";
import InfoDiscipline from "@/modules/13_salary/components/InfoDiscipline.vue";
import InfoLeave from "@/modules/13_salary/components/InfoLeave.vue";
import InfoAssessments from "@/modules/07_insignia/components/2_Manage/InfoAssessments.vue";
import InfoInsignia from "@/modules/07_insignia/components/2_Manage/InfoInsignia.vue";
/**
* importStore
@ -42,11 +44,8 @@ const avatar = ref<string>("");
const fullName = ref<string>("");
const position = ref<string>("");
/**
* function เรยกขอมลสวนต
*/
/** function เรียกข้อมูลส่วนตัว*/
function fetchInformation() {
showLoader();
http
.get(config.API.orgProfileById(profileId.value, props.employeeClass))
.then(async (res) => {
@ -60,7 +59,6 @@ function fetchInformation() {
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
}
@ -69,7 +67,7 @@ function fetchInformation() {
* @param id profileId
* @param avatarName อไฟล
*/
function fetchProfile(id: string, avatarName: string) {
async function fetchProfile(id: string, avatarName: string) {
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
.then(async (res) => {
@ -155,41 +153,58 @@ watch(
</div>
</q-card>
<q-scroll-area style="height: 60vh; max-width: 100%">
<div class="q-gutter-md q-pa-sm">
<q-card bordered style="border: 1px solid #d6dee1">
<q-card-section style="padding-bottom: 0px">
<div class="text-weight-bold row items-center">
<span class="q-ml-md">
{{
type === "posSalary"
? "ข้อมูลเงินเดือน/ค่าจ้าง"
: type === "discipline"
? "ข้อมูลวินัย"
: "ข้อมูลการลา"
}}
</span>
</div>
</q-card-section>
<div class="q-gutter-md q-pa-sm">
<q-card bordered style="border: 1px solid #d6dee1">
<q-card-section style="padding-bottom: 0px">
<div class="text-weight-bold row items-center">
<span class="q-ml-md">
{{
type === "posSalary"
? "ข้อมูลเงินเดือน/ค่าจ้าง"
: type === "discipline"
? "ข้อมูลวินัย"
: type === "leave"
? "ข้อมูลการลา"
: type === "assessments"
? "ข้อมูลผลการประเมินการปฏิบัติราชการ"
: type === "insignia"
? "ข้อมูลเครื่องราชฯ"
: ""
}}
</span>
</div>
</q-card-section>
<InfoSalary
v-if="type === 'posSalary'"
v-model:profileId="profileId"
:employeeClass="employeeClass"
/>
<InfoDiscipline
v-if="type === 'discipline'"
v-model:profileId="profileId"
:employeeClass="employeeClass"
/>
<InfoLeave
v-if="type === 'leave'"
v-model:profileId="profileId"
:employeeClass="employeeClass"
/>
</q-card>
</div>
</q-scroll-area>
<InfoSalary
v-if="type === 'posSalary'"
v-model:profileId="profileId"
:employeeClass="employeeClass"
/>
<InfoDiscipline
v-if="type === 'discipline'"
v-model:profileId="profileId"
:employeeClass="employeeClass"
/>
<InfoLeave
v-if="type === 'leave'"
v-model:profileId="profileId"
:employeeClass="employeeClass"
/>
<InfoAssessments
v-if="type === 'assessments'"
v-model:profileId="profileId"
:employeeClass="employeeClass"
/>
<InfoInsignia
v-if="type === 'insignia'"
v-model:profileId="profileId"
:employeeClass="employeeClass"
/>
</q-card>
</div>
</div>
</q-card-section>
</q-card>