Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-01-23 10:50:05 +07:00
commit 911a887011
4 changed files with 66 additions and 102 deletions

View file

@ -1145,11 +1145,12 @@ onMounted(async () => {
</q-menu>
</q-btn>
<div v-if="!isEdit && !isCheckFile">
<div v-if="!isEdit">
<q-btn
v-if="
!checkRoutePermisson &&
probationStore.dataPermissions?.tab1.isEdit
probationStore.dataPermissions?.tab1.isEdit &&
!isCheckFile
"
dense
flat

View file

@ -129,6 +129,29 @@ const achievement_result: any = computed(() => {
}
return 0;
});
const score1Per60 = computed(() => {
if (
etc.value === true &&
achievement_other.value.text !== undefined &&
achievement_other.value.level !== undefined
) {
return (
((learn_level.value +
apply_level.value +
success_level.value +
achievement_other.value.level) /
achievement_score_total.value) *
60
);
}
return (
((learn_level.value + apply_level.value + success_level.value) /
achievement_score_total.value) *
60
);
});
const score2 = computed(() => {
let sum_conduct = conduct_level.value.reduce(
(sum: number, level: number) => sum + level,
@ -430,7 +453,8 @@ onMounted(async () => {
<q-btn
v-if="
!checkRoutePermisson &&
probationStore.dataPermissions?.tab5.isEdit && !isCheckFile
probationStore.dataPermissions?.tab5.isEdit &&
!isCheckFile
"
dense
flat
@ -924,7 +948,7 @@ onMounted(async () => {
</q-item-label>
<q-item-label caption style="color: #464444">
<div class="row text-weight-bold">
<div class="col">{{ score1 }}</div>
<div class="col">{{ score1Per60 }}</div>
<div class="col">{{ percent_score1 }}</div>
</div>
</q-item-label>
@ -987,7 +1011,7 @@ onMounted(async () => {
</q-item-label>
<q-item-label caption style="color: #464444">
<div class="row text-weight-bold">
<div class="col">{{ score1 + score2 }}</div>
<div class="col">{{ (score1Per60 + score2) / 2 }}</div>
<div class="col">{{ percent_sum }}</div>
</div>
</q-item-label>
@ -1360,7 +1384,6 @@ onMounted(async () => {
</div>
<FormUploadFile
:group="`ประเมินผลคณะกรรมการครั้งที่${props.tab?.charAt(4)}`"
:check-route-permisson="checkRoutePermisson"
:data-permissions="

View file

@ -34,7 +34,7 @@ const assign = ref<any>([]);
const mentors = ref<any>([]);
const commander = ref<any>([]);
const status = ref<boolean>(true);
const ID = ref<string>("");
const evaluateId = ref<string>("");
const date_start = ref<Date>(new Date());
const date_finish = ref<Date>();
const develop = ref<number>();
@ -139,13 +139,12 @@ async function fecthAssign() {
*/
const fecthResult = async (id: string) => {
const noNumber = props?.tab ? Number(props?.tab.charAt(4)) : "";
await http
.get(config.API.createformReport(id) + `&evaluate_no=${noNumber}`)
.then(async (res: any) => {
if (res.data.result != null) {
const data = await res.data.result.evaluate;
ID.value = data.id;
evaluateId.value = data.id;
date_start.value = data.date_start;
date_finish.value = data.date_finish;
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
* @param action post put
*/
async function postData(action: string) {
const data = await {
const data = {
start_date: date_start.value,
date_finish: date_finish.value,
develop_complete: develop.value,
pass_result: result.value,
reson: reson.value,
chairman_dated: chairman_dated.value,
director1_dated: director1_dated.value,
director2_dated: director2_dated.value,
// director1_dated: director1_dated.value ? director1_dated.value : new Date(),
// director2_dated: director2_dated.value ? director2_dated.value : new Date(),
expand_month: expand_month.value ? expand_month.value : undefined,
evaluate_no: props?.tab ? Number(props?.tab.charAt(4)) : undefined,
};
@ -233,31 +197,32 @@ async function postData(action: string) {
success($q, "บันทึกสำเร็จ");
fecthResult(assignId.value);
router.push(`/probation/detail/${personalId.value}/${assignId.value}`);
status.value = false;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
status.value = false;
hideLoader();
});
} else if (action === "put") {
showLoader();
await http
.put(config.API.createformReport(assignId.value), data)
.then(() => {
success($q, "บันทึกสำเร็จ");
fecthResult(assignId.value);
router.push(`/probation/detail/${personalId.value}/${assignId.value}`);
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
status.value = false;
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="toptitle text-dark col-12 row items-center q-gutter-md">
<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 class="col-12 row">
@ -795,17 +734,6 @@ onMounted(() => {
</div>
</q-form>
<FormUploadFile
:group="`รายงานผลครั้งที่${props.tab?.charAt(4)}`"
v-model:is-check-file="isCheckFile"
:check-route-permisson="checkRoutePermisson"
:data-permissions="
probationStore.dataPermissions?.tab6.isEdit
? probationStore.dataPermissions?.tab6.isEdit
: false
"
/>
<q-toolbar
class="text-primary"
v-if="
@ -817,6 +745,18 @@ onMounted(() => {
<q-space />
<q-btn label="บันทึก" color="secondary" @click="savaForm" />
</q-toolbar>
<FormUploadFile
v-else
:group="`รายงานผลครั้งที่${props.tab?.charAt(4)}`"
v-model:is-check-file="isCheckFile"
:check-route-permisson="checkRoutePermisson"
:data-permissions="
probationStore.dataPermissions?.tab6.isEdit
? probationStore.dataPermissions?.tab6.isEdit
: false
"
/>
</div>
</template>

View file

@ -193,7 +193,7 @@ onMounted(async () => {
v-model="filterKeyword"
ref="filterRef"
outlined
placeholder="ค้นหา ชื่อ - นามสกุลผู้ทดลองฯ /ตำแหน่ง"
placeholder="ค้นหาจากชื่อ - นามสกุล /ตำแหน่ง"
@keydown.enter.prevent="getData()"
style="width: 350px"
>