ต่อ api รายละเอียดการประเมินของ

This commit is contained in:
setthawutttty 2023-12-22 18:20:49 +07:00
parent cab89c78f3
commit 4521f80918
17 changed files with 1226 additions and 191 deletions

View file

@ -8,9 +8,17 @@ import keycloak from "@/plugins/keycloak";
import { useCounterMixin } from "@/stores/mixin";
import genReport from "@/plugins/genreport";
import { useQuasar } from "quasar";
import PopupReason from "@/components/Dialogs/PopupReason.vue";
const $q = useQuasar();
const mixin = useCounterMixin();
const { date2Thai, showLoader, hideLoader, messageError,success } = mixin;
const {
date2Thai,
showLoader,
hideLoader,
messageError,
success,
dialogConfirm,
} = mixin;
const router = useRouter();
const route = useRoute();
@ -18,7 +26,7 @@ const id = ref<string>(route.params.id as string);
const fullName = ref<string>(
keycloak.tokenParsed ? keycloak.tokenParsed.name!.toString() : ""
);
const mesasger = ref<string>("");
const messenger = ref<string>("");
const title = ref<string>("");
const modalEvaluation = ref<boolean>(false);
const fileEvaluationUpload = ref<any>();
@ -125,33 +133,24 @@ function getPDF(url: string, type: string, fileName: string) {
}
/** ส่งไปประกาศบนเว็บไซต์ */
function onWebSite() {}
// function getFileList() {
// showLoader();
// http
// .get(config.API.evaluationFilebyId(" 1", id.value))
// .then((res) => {
// const fileList = res.data;
// files.forEach((file, index) => {
// const apiFile = fileList[index];
// file.pathName = apiFile.pathname;
// });
// console.log(files);
// })
// .catch((e) => {})
// .finally(() => {
// hideLoader();
// });
// }
function onWebSite() {
showLoader();
http
.put(config.API.evaluationApproveDoc1(id.value))
.then((res) => {})
.catch((e) => {})
.finally(() => {
success($q, "ส่งไปประกาศบนเว็บไซต์ สำเร็จ");
hideLoader();
});
}
function upLoadFile() {
showLoader();
http
.post(config.API.evaluationFileListbyId("เล่ม 1", id.value), {
fileList: {
fileName: "4-แบบประเมินคุณลักษณะบุคคล",
fileName: "10-ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)",
metadata: {
tag: "value",
},
@ -175,15 +174,39 @@ function upLoadFile() {
}
function fileUpLoad(url: string) {
axios.put(url, fileEvaluationUpload.value, {
headers: { "Content-Type": fileEvaluationUpload.value?.type },
onUploadProgress: (e) => console.log(e),
}).catch((e)=>{
messageError($q,e)
}).finally(()=>{
fileEvaluationUpload.value = null
success($q, "อัปโหลดไฟล์สำเร็จ");
})
axios
.put(url, fileEvaluationUpload.value, {
headers: { "Content-Type": fileEvaluationUpload.value?.type },
onUploadProgress: (e) => console.log(e),
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fileEvaluationUpload.value = null;
success($q, "อัปโหลดไฟล์สำเร็จ");
});
}
function sentMessenger() {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.evaluationSentToContact(id.value), {
subject: title.value,
body: messenger.value,
})
.then((res) => {
console.log(res);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
modalEvaluation.value = false;
hideLoader();
});
});
}
</script>
@ -338,7 +361,7 @@ function fileUpLoad(url: string) {
</div>
<div class="col-12">
<q-input
v-model="mesasger"
v-model="messenger"
label="ข้อความ"
type="textarea"
outlined
@ -357,6 +380,7 @@ function fileUpLoad(url: string) {
id="onSubmit"
class="q-px-md q-py-xs"
label="ส่งข้อความ"
@click="sentMessenger"
>
</q-btn>
</div>