fix รายงานวินัย

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-11 18:22:42 +07:00
parent 0b1ec1f0a0
commit 95d744f2b9

View file

@ -121,30 +121,36 @@ function onSelectedNode(id: string, level: number) {
async function onUpdateFilter() {
isLoadPDF.value = true;
pdfSrc.value = undefined;
const body = {
nodeId: nodeId.value,
node: nodeLevel.value,
year: year.value,
offenseDetail: offenseDetail.value,
disciplinaryFaultLevel: disciplinaryFaultLevel.value,
status: status.value,
posType: posType.value ? posType.value : null,
posLevel: posLevel.value ? posLevel.value : null,
};
await http
.post(config.API.disciplineReportByType(employeeClass.value), body)
.then(async (res) => {
const data = res.data.result;
detailReport.value = data;
data && (await genReportPreview(data));
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
isLoadPDF.value = false;
});
if (nodeId) {
const body = {
nodeId: nodeId.value,
node: nodeLevel.value,
year: year.value,
offenseDetail: offenseDetail.value,
disciplinaryFaultLevel: disciplinaryFaultLevel.value,
status: status.value,
posType: posType.value
? posTypeOp.value.find((e: any) => e.id === posType.value)?.posTypeName
: null,
posLevel: posLevel.value
? posLevelOp.value.find((e: any) => e.id === posLevel.value)
?.posLevelName
: null,
};
await http
.post(config.API.disciplineReportByType(employeeClass.value), body)
.then(async (res) => {
const data = res.data.result;
detailReport.value = data;
data && (await genReportPreview(data));
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
isLoadPDF.value = false;
});
}
}
/**
@ -195,14 +201,21 @@ function backPage() {
}
}
function downloadReport(type: string) {}
/**
* งกเรยกขอมลรายการประเภทตำแหน
*/
async function getType() {
posType.value = "";
posLevel.value = "";
posTypeMainOp.value = [];
posTypeOp.value = [];
posLevelOp.value = [];
const apiPath =
employeeClass.value === "officer"
? config.API.orgPosType
: config.API.orgEmployeeType;
await http
.get(config.API.orgPosType)
.get(apiPath)
.then(async (res) => {
posTypeMainOp.value = await res.data.result;
})
@ -226,7 +239,7 @@ function filterOption(val: string, update: any, typeOp: string) {
);
} else if (typeOp == "level") {
posLevelOp.value = posLevelMainOp.value.filter(
(v: any) => v.posLevelName.toLowerCase().indexOf(needle) > -1
(v: any) => v.posLevelName.toString().toLowerCase().indexOf(needle) > -1
);
}
});
@ -234,10 +247,20 @@ function filterOption(val: string, update: any, typeOp: string) {
function updateLevel(val: string) {
if (val) {
const listData = posTypeMainOp.value.find(
const listData: any = posTypeMainOp.value.find(
(item: PosType) => item.id == val
);
posLevelMainOp.value = listData ? listData.posLevels : [];
console.log(listData);
if (employeeClass.value === "officer") {
posLevelMainOp.value = listData ? listData.posLevels : [];
} else {
posLevelMainOp.value = listData
? listData.posLevels.map((e: any) => ({
...e,
posLevelName: `${listData?.posTypeShortName} ${e.posLevelName}`,
}))
: [];
}
}
}
onMounted(async () => {
@ -263,15 +286,15 @@ onMounted(async () => {
option-label="name"
option-value="id"
style="width: 230px"
@update:model-value="onUpdateFilter"
@update:model-value="getType"
>
</q-select>
<q-space />
<q-btn
:disable="!nodeId"
flat
round
:disable="!nodeId || !employeeClass"
color="primary"
icon="download"
v-if="checkPermission($route)?.attrIsGet"