fix director1_dated,director2_dated
This commit is contained in:
parent
d350e70e80
commit
e3ca5eb409
1 changed files with 22 additions and 83 deletions
|
|
@ -34,7 +34,7 @@ const assign = ref<any>([]);
|
||||||
const mentors = ref<any>([]);
|
const mentors = ref<any>([]);
|
||||||
const commander = ref<any>([]);
|
const commander = ref<any>([]);
|
||||||
const status = ref<boolean>(true);
|
const status = ref<boolean>(true);
|
||||||
const ID = ref<string>("");
|
const evaluateId = ref<string>("");
|
||||||
const date_start = ref<Date>(new Date());
|
const date_start = ref<Date>(new Date());
|
||||||
const date_finish = ref<Date>();
|
const date_finish = ref<Date>();
|
||||||
const develop = ref<number>();
|
const develop = ref<number>();
|
||||||
|
|
@ -139,13 +139,12 @@ async function fecthAssign() {
|
||||||
*/
|
*/
|
||||||
const fecthResult = async (id: string) => {
|
const fecthResult = async (id: string) => {
|
||||||
const noNumber = props?.tab ? Number(props?.tab.charAt(4)) : "";
|
const noNumber = props?.tab ? Number(props?.tab.charAt(4)) : "";
|
||||||
|
|
||||||
await http
|
await http
|
||||||
.get(config.API.createformReport(id) + `&evaluate_no=${noNumber}`)
|
.get(config.API.createformReport(id) + `&evaluate_no=${noNumber}`)
|
||||||
.then(async (res: any) => {
|
.then(async (res: any) => {
|
||||||
if (res.data.result != null) {
|
if (res.data.result != null) {
|
||||||
const data = await res.data.result.evaluate;
|
const data = await res.data.result.evaluate;
|
||||||
ID.value = data.id;
|
evaluateId.value = data.id;
|
||||||
date_start.value = data.date_start;
|
date_start.value = data.date_start;
|
||||||
date_finish.value = data.date_finish;
|
date_finish.value = data.date_finish;
|
||||||
develop.value = Number(data.develop_complete);
|
develop.value = Number(data.develop_complete);
|
||||||
|
|
@ -174,54 +173,19 @@ async function savaForm() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** แปลงรหัสไฟล์ */
|
|
||||||
function downloadFile(response: any, filename: string) {
|
|
||||||
const link = document.createElement("a");
|
|
||||||
var fileName = filename;
|
|
||||||
link.href = window.URL.createObjectURL(new Blob([response.data]));
|
|
||||||
link.setAttribute("download", fileName);
|
|
||||||
document.body.appendChild(link);
|
|
||||||
link.click();
|
|
||||||
document.body.removeChild(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ดาว์โหลดไฟล์
|
|
||||||
* @param type docx/pdf
|
|
||||||
*/
|
|
||||||
async function clickdownloadFile(type: string) {
|
|
||||||
showLoader();
|
|
||||||
await http
|
|
||||||
.get(config.API.reportEvaluateResult(type, assignId.value))
|
|
||||||
.then(async (res) => {
|
|
||||||
const data = res.data.result;
|
|
||||||
await genReport(
|
|
||||||
data,
|
|
||||||
`แบบรายงานการประเมินฯ_${person.value.name}.${type}`,
|
|
||||||
type
|
|
||||||
);
|
|
||||||
hideLoader();
|
|
||||||
})
|
|
||||||
.catch(async (e) => {
|
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
|
||||||
hideLoader();
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** post/put data
|
/** post/put data
|
||||||
* @param action post put
|
* @param action post put
|
||||||
*/
|
*/
|
||||||
async function postData(action: string) {
|
async function postData(action: string) {
|
||||||
const data = await {
|
const data = {
|
||||||
start_date: date_start.value,
|
start_date: date_start.value,
|
||||||
date_finish: date_finish.value,
|
date_finish: date_finish.value,
|
||||||
develop_complete: develop.value,
|
develop_complete: develop.value,
|
||||||
pass_result: result.value,
|
pass_result: result.value,
|
||||||
reson: reson.value,
|
reson: reson.value,
|
||||||
chairman_dated: chairman_dated.value,
|
chairman_dated: chairman_dated.value,
|
||||||
director1_dated: director1_dated.value ? director1_dated.value : new Date(),
|
// director1_dated: director1_dated.value ? director1_dated.value : new Date(),
|
||||||
director2_dated: director2_dated.value ? director2_dated.value : new Date(),
|
// director2_dated: director2_dated.value ? director2_dated.value : new Date(),
|
||||||
expand_month: expand_month.value ? expand_month.value : undefined,
|
expand_month: expand_month.value ? expand_month.value : undefined,
|
||||||
evaluate_no: props?.tab ? Number(props?.tab.charAt(4)) : undefined,
|
evaluate_no: props?.tab ? Number(props?.tab.charAt(4)) : undefined,
|
||||||
};
|
};
|
||||||
|
|
@ -241,23 +205,24 @@ async function postData(action: string) {
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
} else if (action === "put") {
|
|
||||||
showLoader();
|
|
||||||
await http
|
|
||||||
.put(config.API.createformReport(assignId.value), data)
|
|
||||||
.then(() => {
|
|
||||||
success($q, "บันทึกสำเร็จ");
|
|
||||||
fecthResult(assignId.value);
|
|
||||||
status.value = false;
|
|
||||||
router.push(`/probation/detail/${personalId.value}/${assignId.value}`);
|
|
||||||
})
|
|
||||||
.catch((e: any) => {
|
|
||||||
messageError($q, e);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
// else if (action === "put") {
|
||||||
|
// showLoader();
|
||||||
|
// await http
|
||||||
|
// .put(config.API.createformReport(assignId.value), data)
|
||||||
|
// .then(() => {
|
||||||
|
// success($q, "บันทึกสำเร็จ");
|
||||||
|
// fecthResult(assignId.value);
|
||||||
|
// status.value = false;
|
||||||
|
// router.push(`/probation/detail/${personalId.value}/${assignId.value}`);
|
||||||
|
// })
|
||||||
|
// .catch((e: any) => {
|
||||||
|
// messageError($q, e);
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// hideLoader();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ */
|
/** ผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ */
|
||||||
|
|
@ -299,32 +264,6 @@ onMounted(() => {
|
||||||
<div class="row col-12">
|
<div class="row col-12">
|
||||||
<div class="toptitle text-dark col-12 row items-center q-gutter-md">
|
<div class="toptitle text-dark col-12 row items-center q-gutter-md">
|
||||||
<div>แบบรายงานการประเมินฯ</div>
|
<div>แบบรายงานการประเมินฯ</div>
|
||||||
<!-- <q-btn
|
|
||||||
v-if="!status"
|
|
||||||
size="12px"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
icon="mdi-download"
|
|
||||||
color="primary"
|
|
||||||
>
|
|
||||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
|
||||||
<q-menu>
|
|
||||||
<q-list style="min-width: 150px">
|
|
||||||
<q-item clickable v-close-popup @click="clickdownloadFile('pdf')">
|
|
||||||
<q-item-section avatar
|
|
||||||
><q-icon color="red" name="mdi-file-pdf"
|
|
||||||
/></q-item-section>
|
|
||||||
<q-item-section>ไฟล์ .pdf</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
<q-item clickable v-close-popup @click="clickdownloadFile('docx')">
|
|
||||||
<q-item-section avatar
|
|
||||||
><q-icon color="blue" name="mdi-file-word"
|
|
||||||
/></q-item-section>
|
|
||||||
<q-item-section>ไฟล์ .docx</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</q-menu>
|
|
||||||
</q-btn> -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 row">
|
<div class="col-12 row">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue