รายงานพัฒนา เพิ่มส่ง ปี / แก้ รายงานเครื่องราชอิสริยาภรณ์

This commit is contained in:
setthawutttty 2025-02-13 18:11:26 +07:00
parent 00699a4ff8
commit f6285a1ed7
3 changed files with 61 additions and 23 deletions

View file

@ -3,6 +3,12 @@ interface OptionData {
name: string;
}
interface OptionDataList {
id:string
val: string | number;
name: string;
}
interface OptionDataYear {
id: string;
name: string;
@ -225,5 +231,6 @@ export type {
DataProfileOtherSystem,
Pagination,
DataManageList,
ResOrg
ResOrg,
OptionDataList
};

View file

@ -14,7 +14,10 @@ import genReport from "@/plugins/genreport";
import genReportXLSX from "@/plugins/genreportxlsx";
import type { DataStructureTree } from "@/interface/main";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import type {
OptionData,
OptionDataList,
} from "@/modules/07_insignia/interface/index/Main";
import LoadView from "@/components/LoadView.vue";
@ -29,32 +32,38 @@ const employeeClassOption = ref<OptionData[]>([
{ id: "employee", name: "ลูกจ้างประจำ กทม." },
]);
const typeReport = ref<string>("");
const optionReport = ref<OptionData[]>([
const typeReport = ref<any>();
const optionReport = ref<OptionDataList[]>([
{
id: "report1",
id: "1",
val: "report1",
name: "บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชอิสริยาภรณ์",
},
{
id: "report2",
id: "2",
val: "report2",
name: "บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี",
},
{ id: "report3", name: "บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" },
{ id: "3", val: "report3", name: "บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" },
{
id: "report4",
id: "4",
val: "report4",
name: "รายชื่อข้าราชการฯ ที่ได้รับ/ไม่ได้รับการจ่ายใบกำกับฯ",
},
{
id: "report5",
id: "5",
val: "report5",
name: "รายงานสถิติการได้รับเครื่องราชอิสริยาภรณ์ข้าราชการฯ",
},
{
id: "report6",
id: "6",
val: "report6",
name: "รายงานผลการจ่ายประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์ แยกรายหน่วยงาน",
},
{
id: "report7",
name: "รายงานแสดงรายชื่อลูกจ้างประจำที่ได้รับ/ไมได้รับ การจ่ายใบกำกับฯ เครื่องราชอิสริยาภรณที่ได้รับพระราชทาน (ลูกจ้าง)",
id: "7",
val: "report4",
name: "รายงานแสดงรายชื่อลูกจ้างประจำที่ได้รับ/ไม่ได้รับ การจ่ายใบกำกับฯ เครื่องราชอิสริยาภรณที่ได้รับพระราชทาน (ลูกจ้าง)",
},
]);
@ -137,6 +146,23 @@ const detailReport = ref<any>();
* @param download
*/
async function onUpdateFilter() {
if (
(employeeClass.value == "employee" && typeReport.value.id == "4") ||
(employeeClass.value == "officer" && typeReport.value.id == "7")
) {
typeReport.value =
employeeClass.value == "officer"
? {
id: "4",
val: "report4",
name: "รายชื่อข้าราชการฯ ที่ได้รับ/ไม่ได้รับการจ่ายใบกำกับฯ",
}
: {
id: "7",
val: "report4",
name: "รายงานแสดงรายชื่อลูกจ้างประจำที่ได้รับ/ไม่ได้รับ การจ่ายใบกำกับฯ เครื่องราชอิสริยาภรณที่ได้รับพระราชทาน (ลูกจ้าง)",
};
}
if (typeReport.value && roundId.value && nodeId.value) {
isLoadPDF.value = true;
pdfSrc.value = undefined;
@ -144,7 +170,7 @@ async function onUpdateFilter() {
await http
.post(
config.API.reportInsigniaNew +
`/${typeReport.value}/${employeeClass.value}`,
`/${typeReport.value.val}/${employeeClass.value}`,
{
roundId: roundId.value,
node: nodeLevel.value,
@ -155,10 +181,9 @@ async function onUpdateFilter() {
const data = await res.data.result;
detailReport.value = data;
const type =
typeReport.value === "report4" ||
typeReport.value === "report5" ||
typeReport.value === "report6" ||
typeReport.value === "report7"
typeReport.value.val === "report4" ||
typeReport.value.val === "report5" ||
typeReport.value.val === "report6"
? "xlsx"
: "docx";
await fetchDocumentTemplate(data, type);
@ -216,7 +241,7 @@ function backPage() {
function downloadReport(type: string) {
const fileName =
optionReport.value.find((e) => e.id === typeReport.value)?.name || "";
optionReport.value.find((e) => e.id === typeReport.value.id)?.name || "";
if (type === "xlsx") {
genReportXLSX(detailReport.value, fileName, type);
@ -282,7 +307,7 @@ onMounted(async () => {
clickable
v-close-popup
@click="downloadReport('xlsx')"
v-if="typeReport !== 'report1'"
v-if="typeReport.val !== 'report1'"
>
<q-item-section avatar
><q-icon color="green" name="mdi-file-excel"
@ -307,9 +332,8 @@ onMounted(async () => {
borderless
v-model="typeReport"
:label="`${'รายงาน'}`"
emit-value
map-options
:options="optionReport"
:options="employeeClass == 'officer' ? optionReport.filter((item:any)=>item.id !== '7'):optionReport.filter((item:any)=>item.id !== '4')"
option-value="id"
option-label="name"
@update:model-value="onUpdateFilter"
@ -377,7 +401,7 @@ onMounted(async () => {
@click.stop="
onSelectedNode(prop.node.orgTreeDnaId, prop.node.orgLevel)
"
:active="nodeId === prop.node.orgTreeId"
:active="nodeId === prop.node.orgTreeDnaId"
clickable
active-class="my-list-link text-primary text-weight-medium"
class="row col-12 items-center text-dark q-py-xs q-pl-sm rounded-borders my-list"

View file

@ -87,7 +87,14 @@ async function getReport() {
loadingBtn.value = true;
pdfSrc.value = undefined;
await http
.get(config.API.developmentReport() + `${typeReport.value}${typeReport.value == 'main' || typeReport.value == 'report3' ? `?rootId=${organization.value}`:``}`)
.get(
config.API.developmentReport() +
`${typeReport.value}${
typeReport.value == "main" || typeReport.value == "report3"
? `?rootId=${organization.value}&year=${year.value}`
: `?year=${year.value}`
}`
)
.then(async (res) => {
const data = res.data.result;
detailReport.value = data;