fix รายงานวินัย
This commit is contained in:
parent
0b1ec1f0a0
commit
95d744f2b9
1 changed files with 55 additions and 32 deletions
|
|
@ -121,30 +121,36 @@ function onSelectedNode(id: string, level: number) {
|
||||||
async function onUpdateFilter() {
|
async function onUpdateFilter() {
|
||||||
isLoadPDF.value = true;
|
isLoadPDF.value = true;
|
||||||
pdfSrc.value = undefined;
|
pdfSrc.value = undefined;
|
||||||
|
if (nodeId) {
|
||||||
const body = {
|
const body = {
|
||||||
nodeId: nodeId.value,
|
nodeId: nodeId.value,
|
||||||
node: nodeLevel.value,
|
node: nodeLevel.value,
|
||||||
year: year.value,
|
year: year.value,
|
||||||
offenseDetail: offenseDetail.value,
|
offenseDetail: offenseDetail.value,
|
||||||
disciplinaryFaultLevel: disciplinaryFaultLevel.value,
|
disciplinaryFaultLevel: disciplinaryFaultLevel.value,
|
||||||
status: status.value,
|
status: status.value,
|
||||||
posType: posType.value ? posType.value : null,
|
posType: posType.value
|
||||||
posLevel: posLevel.value ? posLevel.value : null,
|
? posTypeOp.value.find((e: any) => e.id === posType.value)?.posTypeName
|
||||||
};
|
: null,
|
||||||
await http
|
posLevel: posLevel.value
|
||||||
.post(config.API.disciplineReportByType(employeeClass.value), body)
|
? posLevelOp.value.find((e: any) => e.id === posLevel.value)
|
||||||
.then(async (res) => {
|
?.posLevelName
|
||||||
const data = res.data.result;
|
: null,
|
||||||
detailReport.value = data;
|
};
|
||||||
data && (await genReportPreview(data));
|
await http
|
||||||
})
|
.post(config.API.disciplineReportByType(employeeClass.value), body)
|
||||||
.catch(async (e) => {
|
.then(async (res) => {
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
const data = res.data.result;
|
||||||
})
|
detailReport.value = data;
|
||||||
.finally(() => {
|
data && (await genReportPreview(data));
|
||||||
isLoadPDF.value = false;
|
})
|
||||||
});
|
.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() {
|
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
|
await http
|
||||||
.get(config.API.orgPosType)
|
.get(apiPath)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
posTypeMainOp.value = await res.data.result;
|
posTypeMainOp.value = await res.data.result;
|
||||||
})
|
})
|
||||||
|
|
@ -226,7 +239,7 @@ function filterOption(val: string, update: any, typeOp: string) {
|
||||||
);
|
);
|
||||||
} else if (typeOp == "level") {
|
} else if (typeOp == "level") {
|
||||||
posLevelOp.value = posLevelMainOp.value.filter(
|
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) {
|
function updateLevel(val: string) {
|
||||||
if (val) {
|
if (val) {
|
||||||
const listData = posTypeMainOp.value.find(
|
const listData: any = posTypeMainOp.value.find(
|
||||||
(item: PosType) => item.id == val
|
(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 () => {
|
onMounted(async () => {
|
||||||
|
|
@ -263,15 +286,15 @@ onMounted(async () => {
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
style="width: 230px"
|
style="width: 230px"
|
||||||
@update:model-value="onUpdateFilter"
|
@update:model-value="getType"
|
||||||
>
|
>
|
||||||
</q-select>
|
</q-select>
|
||||||
|
|
||||||
<q-space />
|
<q-space />
|
||||||
<q-btn
|
<q-btn
|
||||||
|
:disable="!nodeId"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
:disable="!nodeId || !employeeClass"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="download"
|
icon="download"
|
||||||
v-if="checkPermission($route)?.attrIsGet"
|
v-if="checkPermission($route)?.attrIsGet"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue