ปรับ Code ประเมืน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-11 13:26:46 +07:00
parent f9c4bb3b80
commit 5b2be2af2b
24 changed files with 603 additions and 1398 deletions

View file

@ -1,52 +1,45 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import ViewPDF from "@/modules/12_evaluatePersonal/components/Detail/viewstep/viewPDF.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useRouter, useRoute } from "vue-router";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import type { FormCommand } from "@/modules/12_evaluatePersonal/interface/index/evalute";
import http from "@/plugins/http";
import config from "@/app.config";
const router = useRouter();
const route = useRoute();
const id = ref<string>(route.params.id as string);
const $q = useQuasar();
const dateEndPrepareDoc2 = ref<string | null>();
const mixin = useCounterMixin();
const { date2Thai, showLoader, hideLoader, messageError, success } = mixin;
const AnnouncementDate = ref<string | null>(date2Thai(new Date()));
const fileEvaluation1 = ref<any>();
/** importType*/
import type { FormCommand } from "@/modules/12_evaluatePersonal/interface/index/evalute";
const pdfSrc = ref<any>();
const modalView = ref<boolean>(false);
const emit = defineEmits(["update:form"]);
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/**use*/
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
const dateEndPrepareDoc2 = ref<string | null>();
const { date2Thai, showLoader, hideLoader, messageError } = mixin;
const id = ref<string>(route.params.id as string);
const formCommand = reactive<FormCommand>({
elementaryFullName: "",
elementaryPosition: "",
abovelevelFullname: "",
abovelevelPosition: "",
});
const author = ref<string>("");
const subject = ref<string>("");
const assignedPosition = ref<string>("");
function onClickViewPDF(file: any) {
pdfSrc.value = file.webkitRelativePath;
modalView.value = true;
}
const updateInput = (value: any) => {
emit("update:form", value, ref);
};
function getDate() {
/** function เรียกข้อมูลวันที่ประกาศ*/
async function getDate() {
showLoader();
http
await http
.get(config.API.evaluationDateAnnounce(id.value))
.then((res) => {
const data = res.data.result;
const endDate = new Date(data.dateEndAnnounce);
endDate.setDate(endDate.getDate() + 180);
dateEndPrepareDoc2.value = date2Thai(endDate);
// dateEndPrepareDoc2.value = dateEndPrepareDoc2.value;
})
.catch((e) => {
messageError($q, e);
@ -56,13 +49,10 @@ function getDate() {
});
}
const author = ref<string>("");
const subject = ref<string>("");
const assignedPosition = ref<string>("");
function getSigner() {
/** function เรียกข้อมูลผลงาน*/
async function getSigner() {
showLoader();
http
await http
.get(config.API.evaluationSigner(id.value, 2))
.then((res) => {
const data = res.data.result;
@ -74,17 +64,17 @@ function getSigner() {
subject.value = data.subjectDoc2;
assignedPosition.value = data.assignedPosition;
})
// .catch((e) => {
// messageError($q, e);
// })
.catch((e) => {
// messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
getSigner();
getDate();
onMounted(async () => {
await getSigner();
await getDate();
});
</script>
@ -99,6 +89,7 @@ onMounted(() => {
</q-banner>
</div>
<!-- ผลงาน -->
<div class="col-12">
<q-card bordered style="border: 1px solid #d6dee1">
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">ผลงาน</div>
@ -115,7 +106,6 @@ onMounted(() => {
outlined
label="ชื่อผลงาน"
v-model="subject"
@update:model-value="updateInput(formCommand)"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อผลงาน'}`]"
lazy-rules
/>
@ -125,7 +115,6 @@ onMounted(() => {
dense
outlined
v-model="author"
@update:model-value="updateInput(formCommand)"
label="เจ้าของผลงาน"
:rules="[(val) => !!val || `${'กรุณากรอกเจ้าของผลงาน'}`]"
lazy-rules
@ -136,7 +125,6 @@ onMounted(() => {
dense
outlined
v-model="assignedPosition"
@update:model-value="updateInput(formCommand)"
label="ตำแหน่งที่ได้รับ"
:rules="[
(val) => !!val || `${'กรุณากรอกตำแหน่งที่ได้รับ'}`,
@ -150,65 +138,8 @@ onMounted(() => {
</div>
</q-card>
</div>
<!-- <div class="col-6">
<q-card bordered style="border: 1px solid #d6dee1">
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">
เอกสารเล 2
</div>
<div class="col-12"><q-separator /></div>
<div class="row">
<div class="col-12 q-pa-sm">
<div class="row q-col-gutter-md col-12">
<div class="col-xs-12 col-sm-6 row">
<q-btn
class="col-12"
outline
icon="download"
label="ดาวน์โหลดต้นแบบ"
color="primary"
>
<q-tooltip> ดาวนโหลดตนแบบ </q-tooltip></q-btn
>
</div>
<div class="col-xs-12 col-sm-6 row">
<q-btn
v-if="fileEvaluation1"
class="col-12"
outline
icon="visibility"
label="ดูไฟล์เอกสาร"
color="primary"
@click="onClickViewPDF(fileEvaluation1)"
>
<q-tooltip> ไฟลเอกสาร </q-tooltip></q-btn
>
</div>
<div class="col-xs-12 col-sm-11 row">
<q-file
v-model="fileEvaluation1"
class="col-12"
outlined
dense
hide-bottom-space
lazy-rules
accept=".pdf"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
<div class="col-1 self-center text-center">
<q-btn flat round dense color="primary" icon="mdi-upload"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
</div>
</div>
</div>
</div>
</q-card>
</div> -->
<!-- เลอกผเซนเอกสาร -->
<div class="col-12">
<q-card bordered style="border: 1px solid #d6dee1">
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">
@ -231,7 +162,6 @@ onMounted(() => {
outlined
label="ชื่อ-นามสกุล"
v-model="formCommand.elementaryFullName"
@update:model-value="updateInput(formCommand)"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อ-นามสกุล'}`]"
lazy-rules
/>
@ -242,7 +172,6 @@ onMounted(() => {
dense
outlined
v-model="formCommand.elementaryPosition"
@update:model-value="updateInput(formCommand)"
label="ตำแหน่ง"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
lazy-rules
@ -267,7 +196,6 @@ onMounted(() => {
label="ชื่อ-นามสกุล"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อ-นามสกุล'}`]"
lazy-rules
@update:model-value="updateInput(formCommand)"
/>
<q-input
ref="abovelevelPositionRef"
@ -279,7 +207,6 @@ onMounted(() => {
label="ตำแหน่ง"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
lazy-rules
@update:model-value="updateInput(formCommand)"
/>
</div>
</div>
@ -289,33 +216,6 @@ onMounted(() => {
</q-card>
</div>
</div>
<!-- Dialog Full Screen -->
<q-dialog
v-model="modalView"
persistent
:maximized="true"
transition-show="slide-up"
transition-hide="slide-down"
>
<q-card class="bg-white">
<div class="flex justify-end items-center align-center q-mr-md q-mt-sm">
<q-btn
icon="close"
unelevated
round
dense
style="color: #ff8080; background-color: #ffdede"
size="12px"
v-close-popup
/>
</div>
<div class="q-pa-md">
<ViewPDF />
</div>
</q-card>
</q-dialog>
</template>
<style scoped></style>