Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-08-14 13:20:50 +07:00
commit fd68ca9a3c
12 changed files with 80 additions and 58 deletions

View file

@ -37,8 +37,8 @@ function handleItemClick(itemNumber: number) {
* @param volume index item
*/
function getFile(volume: number) {
const fileText = numToThai(volume);
showLoader();
const fileText = numToThai(volume);
http
.get(config.API.evaluationFilebyId("เล่ม 1", id.value, fileText))
.then((res) => {
@ -46,10 +46,8 @@ function getFile(volume: number) {
const type = res.data.fileType;
getPDF(link, type);
})
.catch(() => {
// messageError($q, e);
})
.finally(() => {
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
@ -76,7 +74,6 @@ function getPDF(url: string, type: string) {
const objectUrl = URL.createObjectURL(blob);
const pdfData = await usePDF(`${objectUrl}`);
showLoader();
setTimeout(() => {
store.log = 1;
store.pdfSrcStore = pdfData.pdf.value;
@ -84,8 +81,8 @@ function getPDF(url: string, type: string) {
hideLoader();
}, 1500);
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
.catch(() => {
hideLoader();
})
.finally(() => {
store.log = 0;

View file

@ -265,9 +265,10 @@ async function upLoadFile(file: any) {
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {
hideLoader();
// hideLoader();
});
}
}
@ -282,12 +283,13 @@ function fileUpLoad(url: string) {
headers: { "Content-Type": fileEvaluationUpload.value?.type },
onUploadProgress: (e) => console.log(e),
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
.then(() => {
checkDoc10();
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
@ -333,6 +335,7 @@ async function checkDoc10() {
)
.then((res: any) => {
download10Url.value = res.data.downloadUrl;
fetchProfile();
})
.catch(() => {
// messageError($q, e);
@ -340,12 +343,11 @@ async function checkDoc10() {
.finally(() => {
hideLoader();
});
fetchProfile();
}
/** function เรียกข้แมูลคุณสมบัติ*/
async function fetchProfile() {
showLoader();
// showLoader();
await http
.get(config.API.evaluateGetDetail(id.value))
.then((res) => {
@ -356,7 +358,7 @@ async function fetchProfile() {
messageError($q, err);
})
.finally(() => {
hideLoader();
// hideLoader();
});
}
@ -430,14 +432,14 @@ onMounted(async () => {
</div>
<!-- ประกาศผลการคดเลอกบคคล (เอกสารหมายเลข 10) -->
<div class="col-12" >
<div class="col-12">
<q-card bordered style="border: 1px solid #d6dee1">
<div
class="text-weight-medium row col-12 bg-grey-1 q-py-sm q-px-md items-center"
>
<div>ประกาศผลการคดเลอกบคคล (เอกสารหมายเลข 10)</div>
<q-space />
<div v-if="store.currentStep == 4 ">
<div v-if="store.currentStep == 4">
<q-btn
icon="download"
color="indigo"
@ -473,7 +475,12 @@ onMounted(async () => {
</div>
<div class="col-12" v-if="store.currentStep == 4"><q-separator /></div>
<div class="row">
<div class="col-12 q-pa-sm" v-if="store.currentStep == 4 && checkPermission($route)?.attrIsUpdate">
<div
class="col-12 q-pa-sm"
v-if="
store.currentStep == 4 && checkPermission($route)?.attrIsUpdate
"
>
<q-file
ref="fileEvaluationUploadRef"
v-model="fileEvaluationUpload"
@ -482,6 +489,7 @@ onMounted(async () => {
dense
hide-bottom-space
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
:rules="
download10Url === '' ? [(val) => !!val || 'กรุณาเลือกไฟล์'] : []
@ -508,7 +516,10 @@ onMounted(async () => {
</div>
<!-- ดตอผขอประเม -->
<div class="col-12" v-if="store.currentStep == 4 && checkPermission($route)?.attrIsUpdate">
<div
class="col-12"
v-if="store.currentStep == 4 && checkPermission($route)?.attrIsUpdate"
>
<div class="q-mt-xs q-gutter-md" align="right">
<q-btn label="ติดต่อผู้ขอประเมิน" color="info" @click="openPopUp" />
<q-btn

View file

@ -117,8 +117,6 @@ function upLoadFile(file: any) {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
@ -134,14 +132,15 @@ function fileUpLoad(url: string) {
headers: { "Content-Type": fileEvaluation5.value?.type },
onUploadProgress: (e) => console.log(e),
})
.then(() => {
success($q, "อัปโหลดไฟล์สำเร็จ");
.then(async () => {
await checkDocResult();
await success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
checkDocResult();
hideLoader();
});
}
@ -197,7 +196,7 @@ async function getDate() {
const download10Url = ref<string>("");
/** function เช็คไฟล์อัปโหลด*/
async function checkDocResult() {
showLoader();
// showLoader();
await http
.get(
config.API.evaluationPatchData(
@ -213,7 +212,7 @@ async function checkDocResult() {
// messageError($q, e);
})
.finally(() => {
hideLoader();
// hideLoader();
});
}

View file

@ -113,20 +113,18 @@ function upLoadFile(name: string, file: any) {
},
},
})
.then((res) => {
.then(async (res) => {
const foundKey: any = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
const link = res.data[foundKey]?.uploadUrl;
fileUpLoad(link, file);
await fileUpLoad(link, file);
await downloadFileList(name);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
downloadFileList(name);
hideLoader();
});
}
@ -143,11 +141,14 @@ function fileUpLoad(url: string, file: any) {
headers: { "Content-Type": file?.type },
onUploadProgress: (e) => console.log(e),
})
.then(() => {
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
success($q, "อัปโหลดไฟล์สำเร็จ");
hideLoader();
});
}
@ -191,6 +192,7 @@ async function confirmApprove() {
dialogConfirm(
$q,
() => {
showLoader();
const data = {
metadata: {
additionalProp1: nameOfWork.value,
@ -198,7 +200,6 @@ async function confirmApprove() {
additionalProp3: position.value,
},
};
showLoader();
http
.patch(
config.API.evaluationPatchData(
@ -208,13 +209,14 @@ async function confirmApprove() {
),
data
)
.then(() => {})
.then(() => {
nextStep();
modalConfirm.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
nextStep();
modalConfirm.value = false;
hideLoader();
});
},
@ -294,7 +296,7 @@ const downloadFile6 = ref<string>("");
* @param fileName อไฟล
*/
async function downloadFileList(fileName: string) {
showLoader();
// showLoader();
await http
.get(config.API.evaluationFilebyId("เล่ม 2", id.value, fileName))
.then((res) => {
@ -314,10 +316,10 @@ async function downloadFileList(fileName: string) {
} else if (fileName === "แบบสรุปผลการประเมิน (เอกสารแบบ ง)") {
downloadFile6.value = res.data.downloadUrl;
}
})
.finally(() => {
hideLoader();
});
// .finally(() => {
// hideLoader();
// });
}
const author = ref<string>("");

View file

@ -84,7 +84,7 @@ const columns = ref<QTableProps["columns"]>([
field: "createdAt",
headerStyle: "font-size: 14px",
format(val, row) {
return date2Thai(val);
return date2Thai(val, false, true);
},
style: "font-size: 14px",
},
@ -380,7 +380,7 @@ onMounted(() => {
:paging="true"
:visible-columns="visibleColumns"
>
<template v-slot:header-selection="scope" v-if="tab === 'COMPLETE'">
<template v-slot:header-selection="scope" v-if="tab === 'COMPLETE'">
<q-checkbox
v-if="tab === 'COMPLETE' && checkPermission($route)?.attrIsUpdate"
keep-color

View file

@ -53,7 +53,7 @@ const columns = ref<QTableProps["columns"]>([
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
format: (v) => date2Thai(v, false, true),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},

View file

@ -16,7 +16,7 @@ import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const { showLoader, hideLoader, messageError, success } = mixin;
/**
* props
@ -93,6 +93,7 @@ function onSubmit() {
.then(() => {
fetchData(projectId.value);
isChangeData.value = false;
success($q, "บันทึกข้อมูลแล้ว");
})
.catch((err) => {
messageError($q, err);

View file

@ -20,7 +20,7 @@ import { useCounterMixin } from "@/stores/mixin";
* use
*/
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const { showLoader, hideLoader, messageError, success } = useCounterMixin();
const route = useRoute();
/**
@ -123,7 +123,9 @@ function onSubmit() {
: formData.budgetPay;
http
.put(config.API.developmentMainTab("tab7", projectId.value), formData)
.then(() => {})
.then(() => {
success($q, "บันทึกข้อมูลแล้ว");
})
.catch((err) => {
messageError($q, err);
})

View file

@ -179,7 +179,9 @@ function onSubmit() {
progressTracking: progressTracking.value,
projectEvaluation: projectEvaluation.value,
})
.then(() => {})
.then(() => {
!modalDialog.value && success($q, "บันทึกข้อมูลแล้ว");
})
.catch((err) => {
messageError($q, err);
})
@ -199,6 +201,8 @@ function onClickAddIndicator(
data: DevelopmentEvaluations | null = null,
type: string = ""
) {
modalDialog.value = true;
isChangeData.value && onSubmit();
isEdit.value = statusEdit;
typeAction.value = type;
if (statusEdit) {
@ -214,7 +218,6 @@ function onClickAddIndicator(
formIndicators.suggestions = data.suggestions;
}
}
modalDialog.value = true;
}
/**

View file

@ -195,7 +195,9 @@ function onSubmit() {
http
.put(config.API.developmentMainTab("tab5", projectId.value), formData)
.then(() => {})
.then(() => {
!modalAcademic.value && success($q, "บันทึกข้อมูลแล้ว");
})
.catch((err) => {
messageError($q, err);
})
@ -207,6 +209,7 @@ function onSubmit() {
function onClickAddAcademic(status: boolean = false, data: any | null = null) {
modalAcademic.value = true;
isChangeData.value && onSubmit();
isEdit.value = status;
if (data && status) {
academicId.value = data.id;
@ -272,7 +275,7 @@ defineExpose({
});
</script>
<template>
<q-form greedy @submit.prevent @validation-success="props.prevStep()">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<div class="q-pa-sm q-my-sm">
<q-card bordered style="border: 1px solid #d6dee1">
<div
@ -492,13 +495,12 @@ defineExpose({
color="public"
class="q-mr-xs"
style="width: 120px"
@click="() => props.prevStep()"
>
</q-btn>
<q-btn
disabled
rounded
label="ถัดไป"
icon-right="mdi-chevron-right"
label="บันทึก"
id="onSubmit"
type="submit"
color="public"

View file

@ -56,7 +56,7 @@ const $q = useQuasar();
const store = useDevelopmentDataStore();
const route = useRoute();
const projectId = ref<string>(route.params.id.toLocaleString());
const { showLoader, hideLoader, messageError, date2Thai, diffDay } =
const { showLoader, hideLoader, messageError, date2Thai, diffDay, success } =
useCounterMixin();
const checkRoutePermission = ref<boolean>(
route.name == "developmentDetailPage"
@ -322,7 +322,9 @@ function onSubmit() {
reasonActual20: reasonActual20.value,
reasonActual10: reasonActual10.value,
})
.then(() => {})
.then(() => {
success($q, "บันทึกข้อมูลแล้ว");
})
.catch((err) => {
messageError($q, err);
hideLoader();
@ -567,7 +569,7 @@ defineExpose({
<div
class="col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
>
เวลาและสถานทดำเนนการ
ระยะเวลาและสถานทดำเนนการ
</div>
<q-separator />
<q-card-section>

View file

@ -173,7 +173,9 @@ function onSubmit() {
.put(config.API.developmentMainTab("tab8", projectId.value), {
expect: expect.value,
})
.then(() => {})
.then(() => {
!modalRisk.value && success($q, "บันทึกข้อมูลแล้ว");
})
.catch((err) => {
messageError($q, err);
})
@ -190,6 +192,7 @@ function onSubmit() {
*/
function onClickAddRisk(status: boolean = false, data: ResRisk | null = null) {
modalRisk.value = true;
isChangeData.value && onSubmit();
isEdit.value = status;
if (data) {
riskId.value = data.id;