Merge branch 'develop' into devTee
This commit is contained in:
commit
8ae3c19148
8 changed files with 172 additions and 45 deletions
|
|
@ -82,6 +82,7 @@ const formData = reactive<FormDataAgency>({
|
|||
responsibility: "",
|
||||
isOfficer: false,
|
||||
isDeputy: false,
|
||||
misId: "",
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -120,26 +121,25 @@ function onSubmit() {
|
|||
["org" + type + "Fax"]: formData.orgFax,
|
||||
["org" + type + "Rank"]: formData.orgLevel,
|
||||
["org" + type + "RankSub"]: formData.orgLevelSub,
|
||||
misId: formData.misId ? formData.misId : "",
|
||||
isDeputy:
|
||||
type === "Root"
|
||||
? formData.isDeputy
|
||||
? formData.isDeputy
|
||||
: false
|
||||
: undefined,
|
||||
isOfficer:
|
||||
type === "Child1"
|
||||
? formData.isOfficer
|
||||
? formData.isOfficer
|
||||
: false
|
||||
: undefined,
|
||||
|
||||
[nameId]: rootId,
|
||||
responsibility:
|
||||
formData.responsibility != null ? formData.responsibility : "",
|
||||
};
|
||||
|
||||
if (type === "Root") {
|
||||
body = {
|
||||
...body,
|
||||
isDeputy:
|
||||
formData.isDeputy !== undefined ? String(formData.isDeputy) : "",
|
||||
};
|
||||
}
|
||||
if (type === "Child1") {
|
||||
body = {
|
||||
...body,
|
||||
isOfficer:
|
||||
formData.isOfficer !== undefined ? String(formData.isOfficer) : "",
|
||||
};
|
||||
}
|
||||
|
||||
//เพิ่มข้อมูล
|
||||
if (actionType.value === "ADD") {
|
||||
await http
|
||||
|
|
@ -205,6 +205,8 @@ function closeClear() {
|
|||
formData.orgLevel = "";
|
||||
formData.responsibility = "";
|
||||
formData.isOfficer = false;
|
||||
formData.isDeputy = false;
|
||||
formData.misId = "";
|
||||
props.close?.();
|
||||
}
|
||||
|
||||
|
|
@ -402,6 +404,7 @@ watch(
|
|||
formData.responsibility = props.dataNode.responsibility;
|
||||
formData.isOfficer = props.dataNode.isOfficer ?? false;
|
||||
formData.isDeputy = props.dataNode.isDeputy ?? false;
|
||||
formData.misId = props.dataNode.misId;
|
||||
orgLevelOption.value =
|
||||
props.dataNode.orgTreeRank === "DEPARTMENT"
|
||||
? orgLevelOptionMain.value
|
||||
|
|
@ -596,6 +599,18 @@ watch(
|
|||
:class="classInput(false)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<q-input
|
||||
v-model="formData.misId"
|
||||
ref="orgMisIdRef"
|
||||
dense
|
||||
outlined
|
||||
for="#misId"
|
||||
label="MisId"
|
||||
hide-bottom-space
|
||||
:class="classInput(false)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
v-model="formData.responsibility"
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ interface FormDataAgency {
|
|||
responsibility: string;
|
||||
isOfficer?: boolean;
|
||||
isDeputy?: boolean;
|
||||
misId: string;
|
||||
}
|
||||
|
||||
interface FormDataPosition {
|
||||
|
|
|
|||
|
|
@ -108,6 +108,33 @@ interface TreeMain {
|
|||
totalRootPositionNextUse: number;
|
||||
totalRootPositionNextVacant: number;
|
||||
}
|
||||
|
||||
interface ResponseDececased {
|
||||
child1: string;
|
||||
child1ShortName: string;
|
||||
child2: string;
|
||||
child2ShortName: string;
|
||||
child3: string;
|
||||
child3ShortName: string;
|
||||
child4: string;
|
||||
child4ShortName: string;
|
||||
citizenId: string;
|
||||
createdAt: string;
|
||||
firstName: string;
|
||||
id: string;
|
||||
isActive: boolean;
|
||||
lastName: string;
|
||||
posLevelName: string;
|
||||
posMasterNo: number;
|
||||
posTypeName: string;
|
||||
position: string;
|
||||
prefix: string;
|
||||
profileId: string;
|
||||
profileType: string;
|
||||
root: string;
|
||||
rootShortName: string;
|
||||
}
|
||||
|
||||
export type {
|
||||
requestSendNoti,
|
||||
DataCopyOrder,
|
||||
|
|
@ -116,4 +143,5 @@ export type {
|
|||
FormActive,
|
||||
OrgTree,
|
||||
TreeMain,
|
||||
ResponseDececased,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ import config from "@/app.config";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
import type { DataOption } from "@/modules/06_retirement/interface/index/Main";
|
||||
import type { ResponseDececased } from "@/modules/06_retirement/interface/response/Deceased";
|
||||
|
||||
/** Use */
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
|
|
@ -23,8 +26,8 @@ const {
|
|||
} = mixin;
|
||||
|
||||
/** คอลัมน์ */
|
||||
const rows = ref<any[]>([]);
|
||||
const rowsData = ref<any[]>([]);
|
||||
const rows = ref<ResponseDececased[]>([]);
|
||||
const rowsData = ref<ResponseDececased[]>([]);
|
||||
const pagination = ref({
|
||||
sortBy: "createdAt",
|
||||
descending: true,
|
||||
|
|
@ -126,8 +129,6 @@ const columns = ref<QTableProps["columns"]>([
|
|||
format: (val) => date2Thai(val),
|
||||
},
|
||||
]);
|
||||
|
||||
/** คอลัมน์ที่แสดง */
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"fullname",
|
||||
|
|
@ -140,6 +141,13 @@ const visibleColumns = ref<string[]>([
|
|||
"profileType",
|
||||
]);
|
||||
|
||||
const employeeClass = ref<string>("");
|
||||
const employeeClassOp = ref<DataOption[]>([
|
||||
{ id: "", name: "ทั้งหมด" },
|
||||
{ id: "OFFICER", name: "ขรก.กทม. สามัญ" },
|
||||
{ id: "EMPLOYEE", name: "ลูกจ้างประจำ กทม." },
|
||||
]);
|
||||
|
||||
/**เรียกข้อมูลจาก APi */
|
||||
async function fectListDecased() {
|
||||
showLoader();
|
||||
|
|
@ -147,6 +155,8 @@ async function fectListDecased() {
|
|||
.get(config.API.listDeceased())
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
console.log(data);
|
||||
|
||||
rows.value = data;
|
||||
rowsData.value = data;
|
||||
})
|
||||
|
|
@ -172,6 +182,12 @@ function onSearch() {
|
|||
rowsData.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
|
||||
if (employeeClass.value) {
|
||||
rows.value = rows.value.filter(
|
||||
(e: ResponseDececased) => e.profileType === employeeClass.value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**Hook */
|
||||
|
|
@ -188,6 +204,24 @@ onMounted(() => {
|
|||
<div class="col-12 row q-pa-md">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="row col-12">
|
||||
<div>
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
v-model="employeeClass"
|
||||
:options="employeeClassOp"
|
||||
emit-value
|
||||
map-options
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
label="สถานภาพ"
|
||||
:clearable="employeeClass !== ''"
|
||||
style="width: 200px"
|
||||
@clear="employeeClass = ''"
|
||||
@update:model-value="onSearch"
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
<q-space />
|
||||
<div class="row q-col-gutter-sm">
|
||||
<q-input
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||
import axios from "axios";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
|
@ -9,6 +10,8 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import { useStructureTree } from "@/stores/structureTree";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
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";
|
||||
|
|
@ -29,11 +32,14 @@ const employeeClassOption = ref<OptionData[]>([
|
|||
const typeReport = ref<string>("");
|
||||
const optionReport = ref<OptionData[]>([
|
||||
{
|
||||
id: "45",
|
||||
id: "report1",
|
||||
name: "บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชอิสริยาภรณ์",
|
||||
},
|
||||
{ id: "44", name: " บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี" },
|
||||
{ id: "43", name: " บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" },
|
||||
{
|
||||
id: "report2",
|
||||
name: " บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี",
|
||||
},
|
||||
{ id: "report3", name: " บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" },
|
||||
]);
|
||||
|
||||
const roundId = ref<string>("");
|
||||
|
|
@ -54,21 +60,11 @@ const pdfSrc = ref<any>();
|
|||
|
||||
const isLoadPDF = ref<boolean>(false);
|
||||
|
||||
// /**
|
||||
// * ฟังก์ชัน Redirect ไปหน้ารายงานที่เลือก
|
||||
// * @param type ประเภทรายงาน
|
||||
// */
|
||||
// function nextPage(type: string) {
|
||||
// router.push(`/insignia/report/${type}`);
|
||||
// }
|
||||
|
||||
async function fetchDataTree() {
|
||||
node.value = await fetchStructureTree(route.meta.Key as string, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันคึงข้อมูลรอบการเสนอขอ
|
||||
*/
|
||||
/** ฟังก์ชันคึงข้อมูลรอบการเสนอขอ*/
|
||||
async function fecthlistRound() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -106,12 +102,19 @@ function filterSelector(val: string, update: Function, name: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function เลือกหน่วยงาน
|
||||
* @param id id หน่วยงาน
|
||||
* @param level ระดับหน่วยงาน
|
||||
*/
|
||||
function onSelectedNode(id: string, level: number) {
|
||||
nodeId.value = id;
|
||||
nodeLevel.value = level;
|
||||
onUpdateFilter();
|
||||
}
|
||||
|
||||
const detailReport = ref<any>();
|
||||
|
||||
/**
|
||||
* ฟังก์ชันโหลดไฟล์
|
||||
* @param type ประเภทไฟล์
|
||||
|
|
@ -123,16 +126,19 @@ async function onUpdateFilter() {
|
|||
pdfSrc.value = undefined;
|
||||
|
||||
await http
|
||||
.get(config.API.reportInsignia(typeReport.value, "pdf", roundId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.post(
|
||||
config.API.reportInsigniaNew +
|
||||
`/${typeReport.value}/${employeeClass.value}`,
|
||||
{
|
||||
roundId: roundId.value,
|
||||
node: nodeLevel.value,
|
||||
nodeId: nodeId.value,
|
||||
}
|
||||
)
|
||||
.then(async (res) => {
|
||||
const url = URL.createObjectURL(new Blob([res.data]));
|
||||
const pdfData = await usePDF(url);
|
||||
await setTimeout(() => {
|
||||
pdfSrc.value = pdfData.pdf.value;
|
||||
numOfPages.value = pdfData.pages.value;
|
||||
}, 1000);
|
||||
const data = await res.data.result;
|
||||
detailReport.value = data;
|
||||
await fetchDocumentTemplate(data);
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
|
|
@ -143,6 +149,34 @@ async function onUpdateFilter() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียกไฟล์ PDF
|
||||
* @param data ข้อมูลบัญชีวันลา
|
||||
*/
|
||||
async function fetchDocumentTemplate(data: any) {
|
||||
await axios
|
||||
.post(`${config.API.reportTemplate}/docx`, data, {
|
||||
headers: {
|
||||
accept: "application/pdf",
|
||||
"content-Type": "application/json",
|
||||
},
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
const blob = new Blob([res.data]);
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
const pdfData = usePDF(`${objectUrl}`);
|
||||
|
||||
setTimeout(() => {
|
||||
pdfSrc.value = pdfData.pdf.value;
|
||||
numOfPages.value = pdfData.pages.value;
|
||||
}, 1500);
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
});
|
||||
}
|
||||
|
||||
/** ไปหน้าต่อไปของรายงาน */
|
||||
function nextPage() {
|
||||
if (page.value < numOfPages.value) {
|
||||
|
|
@ -157,7 +191,16 @@ function backPage() {
|
|||
}
|
||||
}
|
||||
|
||||
function downloadReport(type: string) {}
|
||||
function downloadReport(type: string) {
|
||||
const fileName =
|
||||
optionReport.value.find((e) => e.id === typeReport.value)?.name || "";
|
||||
|
||||
if (type === "xlsx") {
|
||||
genReportXLSX(detailReport.value, fileName, type);
|
||||
} else {
|
||||
genReport(detailReport.value, fileName, type);
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([fetchDataTree(), fecthlistRound()]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue