แก้ ผลการทดลองปฏิบัติหน้าที่ราชการและแบบสำรวจความคิดเห็น

This commit is contained in:
setthawutttty 2025-01-28 17:26:29 +07:00
parent 07cba8bb70
commit adfbe1a2f8
4 changed files with 188 additions and 78 deletions

View file

@ -3,7 +3,7 @@ import env from "./index";
const development = `${env.API_URI}/development`;
const urlFile = `${env.API_URI}/salary`;
const orgProfile = `${env.API_URI}/org/profile`;
const url = `${env.API_URI}/salary`;
export default {
// portfolio
portfolio: `${development}/portfolio`,
@ -21,5 +21,7 @@ export default {
subId: string,
fileName: string
) => `${urlFile}/sub-file/${name}/${group}/${id}/${subId}/${fileName}`,
developmentRequest:`${orgProfile}/development-request`
developmentRequest:`${orgProfile}/development-request`,
fileByPath:(path:string)=> `${url}/file/${path}`,
};

View file

@ -1,19 +1,170 @@
<script setup lang="ts">
import { ref } from "vue";
import { onMounted, ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useProbationReport } from "@/modules/15_probationReport/store";
import type {
FileType,
ProbationReportType,
} from "@/modules/15_probationReport/interface/Main";
import { useQuasar } from "quasar";
const $q = useQuasar();
const store = useProbationReport();
const dataResult1 = defineModel<FileType[]>("dataResult1", { required: true });
const dataResult2 = defineModel<FileType[]>("dataResult2", { required: true });
const props = defineProps({
page: Number,
});
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const {
date2Thai,
dateToISO,
success,
messageError,
showLoader,
hideLoader,
dialogConfirm,
} = mixin;
const formData = defineModel<any>("formData", { required: true });
const dev_options = defineModel<any>("dev_options", { required: true });
const result_option = defineModel<any>("result_option", { required: true });
const status = ref<boolean>(false);
const formData = ref<ProbationReportType>({
develop_orientation_score: 0,
develop_self_learning_score: 0,
develop_training_seminar_score: 0,
develop_other_training_score: 0,
develop_total_score: 0,
develop_orientation_percent: 0,
develop_self_learning_percent: 0,
develop_training_seminar_percent: 0,
develop_other_training_percent: 0,
develop_total_percent: 0,
develop_result: 0,
achievement_score: 0,
achievement_score_total: 0,
achievement_percent: 0,
achievement_result: 0,
behavior_score: 0,
behavior_score_total: 0,
behavior_percent: 0,
behavior_result: 0,
sum_score: 0,
sum_percent: 0,
reason: "",
pass_result: 0,
evaluate_date: new Date(),
});
/**
* download file
* @param type type file
*/
async function clickdownloadFile() {
console.log(props.page);
showLoader();
await http
.get(
config.API.fileByPath(
props.page == 1
? dataResult1.value[0].pathname
: dataResult2.value[0].pathname
)
)
.then(async (res) => {
const data = res.data.downloadUrl;
window.open(data);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
hideLoader();
})
.finally(() => {});
}
async function getData() {
showLoader();
http
.get(
config.API.summaryReportDetail(store.assignId) +
`&evaluate_no=${props.page}`
)
.then((res) => {
const data = res.data.result;
formData.value.develop_orientation_score = data.develop_orientation_score;
formData.value.develop_self_learning_score =
data.develop_self_learning_score;
formData.value.develop_training_seminar_score =
data.develop_training_seminar_score;
formData.value.develop_other_training_score =
data.develop_other_training_score;
formData.value.develop_total_score = data.develop_total_score;
formData.value.develop_orientation_percent =
data.develop_orientation_percent;
formData.value.develop_self_learning_percent =
data.develop_self_learning_percent;
formData.value.develop_training_seminar_percent =
data.develop_training_seminar_percent;
formData.value.develop_other_training_percent =
data.develop_other_training_percent;
formData.value.develop_total_percent = data.develop_total_percent;
formData.value.develop_result =
data.develop_result == 0 ? 2 : data.develop_result;
formData.value.achievement_score = data.achievement_score;
formData.value.achievement_score_total = data.achievement_score_total;
formData.value.achievement_percent = data.achievement_percent;
formData.value.achievement_result = data.achievement_result;
formData.value.behavior_score = data.behavior_score;
formData.value.behavior_score_total = data.behavior_score_total;
formData.value.behavior_percent = data.behavior_percent;
formData.value.behavior_result = data.behavior_result;
formData.value.sum_score = data.sum_score;
formData.value.sum_percent = data.sum_percent;
formData.value.reason = data.reason;
formData.value.pass_result = data.pass_result;
formData.value.evaluate_date = data.evaluate_date;
hideLoader();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(async () => {
await getData();
});
</script>
<template>
<div class="row col-12 q-ma-xs">
<div class="toptitle text-dark col-12 row items-center q-gutter-md">
<div>ผลการประเมนการทดลองปฏหนาทราชการ</div>
<q-btn
icon="download"
color="primary"
clickable
v-close-popup
outlined
flat
round
dense
@click="clickdownloadFile()"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
</div>
<div class="row col-12 q-pt-lg q-px-lg no-margin">
<div class="col-12 row justify-center">

View file

@ -12,10 +12,15 @@ import { useDataStore } from "@/stores/data";
import type {
AppointTopic,
AppointTopicMain,
FileType,
} from "@/modules/15_probationReport/interface/Main";
import genReport from "@/plugins/genreport";
const dataProbation = defineModel<FileType[]>("dataProbation", {
required: true,
});
const $q = useQuasar();
const isEdit = ref<boolean>(false);
const router = useRouter();
@ -871,17 +876,13 @@ function downloadFile(response: any, filename: string) {
* download file
* @param type type file
*/
async function clickdownloadFile(type: string) {
async function clickdownloadFile() {
showLoader();
await http
.get(config.API.reportAssign(type, probationStore.assignId))
.get(config.API.fileByPath(dataProbation.value[0].pathname))
.then(async (res) => {
const data = res.data.result;
await genReport(
data,
`แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-${fullname.value}`,
type
);
const data = res.data.downloadUrl;
window.open(data);
hideLoader();
})
.catch(async (e) => {
@ -1099,32 +1100,18 @@ onMounted(async () => {
<div class="toptitle text-dark col-12 row items-center">
<div class="col-12 row q-gutter-md">
<div>แบบมอบหมายงานการทดลองปฏหนาทราชการ</div>
<q-btn size="12px" flat dense icon="mdi-download" color="primary">
<q-btn
icon="download"
color="primary"
clickable
v-close-popup
outlined
flat
round
dense
@click="clickdownloadFile()"
>
<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>

View file

@ -8,11 +8,7 @@ import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useProbationReport } from "@/modules/15_probationReport/store";
import type {
DataSurvey,
ProbationReportType,
FileType,
} from "@/modules/15_probationReport/interface/Main";
import type { FileType } from "@/modules/15_probationReport/interface/Main";
import SurveyPage from "@/modules/15_probationReport/components/01_SurveyPage.vue";
import ResultPage from "@/modules/15_probationReport/components/02_ResultPage.vue";
@ -29,36 +25,6 @@ const isData = ref<boolean>(true);
const dataProbation = ref<FileType[]>([]);
const dataResult1 = ref<FileType[]>([]);
const dataResult2 = ref<FileType[]>([]);
// const dataProbation = ref<string>("");
// const dataResult1 = ref<string>("");
// const dataResult2 = ref<string>("");
const formDataResult = ref<ProbationReportType>({
develop_orientation_score: 0,
develop_self_learning_score: 0,
develop_training_seminar_score: 0,
develop_other_training_score: 0,
develop_total_score: 0,
develop_orientation_percent: 0,
develop_self_learning_percent: 0,
develop_training_seminar_percent: 0,
develop_other_training_percent: 0,
develop_total_percent: 0,
develop_result: 0,
achievement_score: 0,
achievement_score_total: 0,
achievement_percent: 0,
achievement_result: 0,
behavior_score: 0,
behavior_score_total: 0,
behavior_percent: 0,
behavior_result: 0,
sum_score: 0,
sum_percent: 0,
reason: "",
pass_result: 0,
evaluate_date: new Date(),
});
const dev_options = reactive([
{ value: 1, label: "พัฒนาครบ 3 ส่วน" },
@ -92,13 +58,13 @@ async function getSurveyData() {
getSalary(
res.data.result.assignId,
"ทดลองงาน",
"รายงานผลครั้งที่ 1",
"ประเมินผลคณะกรรมการครั้งที่ 1",
dataResult1
),
getSalary(
res.data.result.assignId,
"ทดลองงาน",
"รายงานผลครั้งที่ 2",
"ประเมินผลคณะกรรมการครั้งที่ 2",
dataResult2
),
]);
@ -202,20 +168,24 @@ onMounted(async () => {
</q-tab-panel>
<q-tab-panel name="RESULT1" class="q-pa-sm">
<ResultPage
v-model:form-data="formDataResult"
:page="1"
v-model:dev_options="dev_options"
v-model:result_option="result_option"
v-model:dataResult1="dataResult1"
v-model:dataResult2="dataResult2"
/>
</q-tab-panel>
<q-tab-panel name="RESULT2" class="q-pa-sm">
<ResultPage
v-model:form-data="formDataResult"
:page="2"
v-model:dev_options="dev_options"
v-model:result_option="result_option"
v-model:dataResult1="dataResult1"
v-model:dataResult2="dataResult2"
/>
</q-tab-panel>
<q-tab-panel name="ASSIGN">
<AssignPage />
<AssignPage v-model:dataProbation="dataProbation" />
</q-tab-panel>
</q-tab-panels>
</q-card>