API ประเมินบุคคล

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-04 13:39:43 +07:00
parent fbcd0b8ec0
commit 0e033bffd3
11 changed files with 835 additions and 631 deletions

View file

@ -3,7 +3,7 @@ import env from "../index";
const evaluation = `${env.API_URI}/evaluation`; const evaluation = `${env.API_URI}/evaluation`;
export default { export default {
evaluationList:() =>`${evaluation}/user`, evaluationList: () => `${evaluation}/user`,
evaluationCheckStatus: () => `${evaluation}/check-status`, evaluationCheckStatus: () => `${evaluation}/check-status`,
evaluationCheckStep: (id: string) => `${evaluation}/check/${id}`, evaluationCheckStep: (id: string) => `${evaluation}/check/${id}`,
evaluationCheckById: (id: string) => `${evaluation}/check/${id}`, evaluationCheckById: (id: string) => `${evaluation}/check/${id}`,
@ -29,6 +29,8 @@ export default {
evaluationDirectorMeetring: (id: string) => evaluationDirectorMeetring: (id: string) =>
`${evaluation}/director-meeting/${id}`, `${evaluation}/director-meeting/${id}`,
evaluationCheckDate: (id: string) => `${evaluation}/check-date/${id}`, evaluationCheckDate: (id: string) => `${evaluation}/check-date/${id}`,
evaluationUpdateAuthor: (id: string, type: string) =>
`${evaluation}/update-author-${type}/${id}`,
/**document */ /**document */
loadPathDocument: (val: string, id: string) => loadPathDocument: (val: string, id: string) =>

View file

@ -5,11 +5,13 @@ import { useQuasar } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateStore } from "@/modules/06_evaluate/store";
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from "vue";
const router = useRouter(); const router = useRouter();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const store = useEvaluateStore();
const { dialogConfirm } = mixin; const { dialogConfirm } = mixin;
@ -40,6 +42,8 @@ function onCklicNext() {
$q, $q,
() => { () => {
const type = props.menu ? props.menu.val?.toLowerCase() : ""; const type = props.menu ? props.menu.val?.toLowerCase() : "";
store.step = 1;
store.currentStep = 1;
router.push(`/evaluate/add/${type}`); router.push(`/evaluate/add/${type}`);
}, },
"ยืนยันการดำเนินการ", "ยืนยันการดำเนินการ",

View file

@ -92,13 +92,8 @@ async function onCilckNextStep() {
} }
async function validateForm() { async function validateForm() {
console.log(downloadFileRef.value);
store.checkFileupload = !store.checkFileupload; store.checkFileupload = !store.checkFileupload;
console.log(store.checkFileupload);
const emptyValues = downloadFileRef.value.filter((e: any) => e === ""); const emptyValues = downloadFileRef.value.filter((e: any) => e === "");
const hasError = []; const hasError = [];
for (const key in formCommandRef) { for (const key in formCommandRef) {
if (Object.prototype.hasOwnProperty.call(formCommandRef, key)) { if (Object.prototype.hasOwnProperty.call(formCommandRef, key)) {
@ -109,11 +104,22 @@ async function validateForm() {
} }
} }
} }
if (hasError.every((result) => result === true)) { if (hasError.every((result) => result === true)) {
if (emptyValues.length > 0) { if (emptyValues.length > 0 && store.statusUpload === true) {
console.log("There are empty values in the array."); console.log("There are empty values in the array.");
} else if (store.step === 2) {
if (store.statusUpload === false) {
saveStep2();
} else {
nextTostep3();
}
} else { } else {
store.step === 2 ? saveStep2() : saveStep6(); if (store.statusUpload === false) {
saveStep6();
} else {
nextTostep7();
}
} }
// store.step === 2 && emptyValues.length > 0 ? saveStep2() : saveStep6(); // store.step === 2 && emptyValues.length > 0 ? saveStep2() : saveStep6();
@ -308,11 +314,15 @@ async function saveStep1() {
} }
/** STEP 2*/ /** STEP 2*/
const statusUpload = ref<boolean>(false);
const formCommand = reactive<FormCommand>({ const formCommand = reactive<FormCommand>({
commanderFullname: "", commanderFullname: "",
commanderPosition: "", commanderPosition: "",
commanderAboveFullname: "", commanderAboveFullname: "",
commanderAbovePosition: "", commanderAbovePosition: "",
author: "",
subject: "",
assignedPosition: "",
}); });
const commanderFullnameRef = ref<object | null>(null); const commanderFullnameRef = ref<object | null>(null);
const commanderPositionRef = ref<object | null>(null); const commanderPositionRef = ref<object | null>(null);
@ -324,6 +334,9 @@ const fileEvaluation3Ref = ref<object | null>(null);
const fileEvaluation4Ref = ref<object | null>(null); const fileEvaluation4Ref = ref<object | null>(null);
const fileEvaluation5Ref = ref<object | null>(null); const fileEvaluation5Ref = ref<object | null>(null);
const fileEvaluation6Ref = ref<object | null>(null); const fileEvaluation6Ref = ref<object | null>(null);
const performanceRef = ref<object | null>(null);
const performanceOwnerRef = ref<object | null>(null);
const assignedPositionRef = ref<object | null>(null);
const formCommandRef: FormCommandRef = { const formCommandRef: FormCommandRef = {
commanderFullname: commanderFullnameRef, commanderFullname: commanderFullnameRef,
commanderPosition: commanderPositionRef, commanderPosition: commanderPositionRef,
@ -335,6 +348,9 @@ const formCommandRef: FormCommandRef = {
fileEvaluation4: fileEvaluation4Ref, fileEvaluation4: fileEvaluation4Ref,
fileEvaluation5: fileEvaluation5Ref, fileEvaluation5: fileEvaluation5Ref,
fileEvaluation6: fileEvaluation6Ref, fileEvaluation6: fileEvaluation6Ref,
performance: performanceRef,
performanceOwner: performanceOwnerRef,
assignedPosition: assignedPositionRef,
}; };
const downloadFileRef = ref<any>(); const downloadFileRef = ref<any>();
@ -343,6 +359,9 @@ function updateformCommand(val: any, ref: any) {
formCommand.commanderPosition = val.commanderPosition; formCommand.commanderPosition = val.commanderPosition;
formCommand.commanderAboveFullname = val.commanderAboveFullname; formCommand.commanderAboveFullname = val.commanderAboveFullname;
formCommand.commanderAbovePosition = val.commanderAbovePosition; formCommand.commanderAbovePosition = val.commanderAbovePosition;
formCommand.author = val.author;
formCommand.subject = val.subject;
formCommand.assignedPosition = val.assignedPosition;
commanderFullnameRef.value = ref.commanderFullnameRef; commanderFullnameRef.value = ref.commanderFullnameRef;
commanderPositionRef.value = ref.commanderPositionRef; commanderPositionRef.value = ref.commanderPositionRef;
commanderAboveFullnameRef.value = ref.commanderAboveFullnameRef; commanderAboveFullnameRef.value = ref.commanderAboveFullnameRef;
@ -354,20 +373,59 @@ function updateformCommand(val: any, ref: any) {
fileEvaluation5Ref.value = ref.fileEvaluation5Ref; fileEvaluation5Ref.value = ref.fileEvaluation5Ref;
fileEvaluation6Ref.value = ref.fileEvaluation6Ref; fileEvaluation6Ref.value = ref.fileEvaluation6Ref;
downloadFileRef.value = ref.downloadFile; downloadFileRef.value = ref.downloadFile;
performanceRef.value = ref.performance;
performanceOwnerRef.value = ref.performanceOwner;
assignedPositionRef.value = ref.assignedPosition;
statusUpload.value = ref.statusUpload;
} }
async function saveStep2() { async function saveStep2() {
const body = {
commanderFullname: formCommand.commanderFullname,
commanderPosition: formCommand.commanderPosition,
commanderAboveFullname: formCommand.commanderAboveFullname,
commanderAbovePosition: formCommand.commanderAbovePosition,
author: formCommand.author,
subject: formCommand.subject,
};
dialogConfirm(
$q,
async () => {
statusUpload.value = true;
store.statusUpload = statusUpload.value;
showLoader();
await http
.put(
config.API.evaluationUpdateAuthor(
route.params.id.toString(),
"director"
),
body
)
.then(() => {
route.params.id && fetchCheckStep(route.params.id.toString());
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?"
);
}
async function nextTostep3() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
showLoader(); showLoader();
await http await http
.put( .put(
config.API.evaluationPreparedoc( config.API.evaluationPreparedoc(route.params.id.toString(), "approve")
route.params.id.toString(),
"approve"
),
formCommand
) )
.then(() => { .then(() => {
route.params.id && fetchCheckStep(route.params.id.toString()); route.params.id && fetchCheckStep(route.params.id.toString());
@ -384,6 +442,7 @@ async function saveStep2() {
); );
} }
/** STEP3*/
async function saveStep3() { async function saveStep3() {
showLoader(); showLoader();
await http await http
@ -404,19 +463,54 @@ async function saveStep4() {
async function saveStep5() { async function saveStep5() {
console.log("Save 5"); console.log("Save 5");
} }
/** STEP 6*/
async function saveStep6() { async function saveStep6() {
const body = { const body = {
commanderAboveFullnameDoc2: formCommand.commanderAboveFullname, commanderAboveFullnameDoc2: formCommand.commanderAboveFullname,
commanderAbovePositionDoc2: formCommand.commanderAbovePosition, commanderAbovePositionDoc2: formCommand.commanderAbovePosition,
commanderFullnameDoc2: formCommand.commanderFullname, commanderFullnameDoc2: formCommand.commanderFullname,
commanderPositionDoc2: formCommand.commanderPosition, commanderPositionDoc2: formCommand.commanderPosition,
authorDoc2: formCommand.author,
subjectDoc2: formCommand.subject,
assignedPosition: formCommand.assignedPosition,
}; };
dialogConfirm(
$q,
async () => {
statusUpload.value = true;
store.statusUpload = statusUpload.value;
showLoader();
await http
.put(
config.API.evaluationUpdateAuthor(
route.params.id.toString(),
"director2"
),
body
)
.then(() => {
route.params.id && fetchCheckStep(route.params.id.toString());
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?"
);
}
async function nextTostep7() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
showLoader(); showLoader();
await http await http
.put(config.API.evaluationCheckdocV2(route.params.id.toString()), body) .put(config.API.evaluationCheckdocV2(route.params.id.toString()))
.then(() => { .then(() => {
route.params.id && fetchCheckStep(route.params.id.toString()); route.params.id && fetchCheckStep(route.params.id.toString());
}) })
@ -431,6 +525,7 @@ async function saveStep6() {
"ต้องการยืนยันการดำเนินการต่อใช่หรือไม่?" "ต้องการยืนยันการดำเนินการต่อใช่หรือไม่?"
); );
} }
async function saveStep7() { async function saveStep7() {
showLoader(); showLoader();
await http await http
@ -576,7 +671,6 @@ onMounted(async () => {
class="col-xs-12 col-sm-7 row" class="col-xs-12 col-sm-7 row"
v-if="store.step === 1 || store.step === 3 || store.step === 7" v-if="store.step === 1 || store.step === 3 || store.step === 7"
> >
<!-- <q-card flat bordered class="col-12"> -->
<div class="col-12"> <div class="col-12">
<ViewStep1 <ViewStep1
v-if="store.step === 1" v-if="store.step === 1"
@ -594,14 +688,13 @@ onMounted(async () => {
:urlDownloadFile="urlDownloadFile" :urlDownloadFile="urlDownloadFile"
/> />
</div> </div>
<!-- </q-card> -->
</div> </div>
</div> </div>
<div class="q-mt-md q-gutter-md" align="right"> <div class="q-mt-md q-gutter-md" align="right">
<q-btn <q-btn
v-if=" v-if="
store.step >= store.currentStep && store.step >= store.currentStep &&
store.statusUpload === false &&
store.step !== 3 && store.step !== 3 &&
store.step !== 4 && store.step !== 4 &&
store.step !== 5 && store.step !== 5 &&
@ -610,10 +703,15 @@ onMounted(async () => {
store.step !== 9 store.step !== 9
" "
unelevated unelevated
label="ดำเนินการต่อ" :label="
store.step === 2 || store.step === 6
? 'บันทึกข้อมูล'
: 'ดำเนินการต่อ'
"
color="public" color="public"
@click="onCilckNextStep()" @click="onCilckNextStep()"
/> />
<q-btn <q-btn
v-else-if=" v-else-if="
store.step >= store.currentStep && store.step >= store.currentStep &&
@ -624,6 +722,29 @@ onMounted(async () => {
color="public" color="public"
@click="onCilckNextStep()" @click="onCilckNextStep()"
/> />
<q-btn
v-if="
store.step >= store.currentStep &&
store.step == 2 &&
store.statusUpload
"
unelevated
label="ดำเนินการต่อ"
color="public"
@click="onCilckNextStep()"
/>
<q-btn
v-if="
store.step >= store.currentStep &&
store.step == 6 &&
store.statusUpload
"
unelevated
label="ดำเนินการต่อ"
color="public"
@click="onCilckNextStep()"
/>
</div> </div>
</div> </div>
</q-card> </q-card>

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from "vue"; import { ref, onMounted, watch } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
@ -8,6 +8,23 @@ import { useEvaluateStore } from "@/modules/06_evaluate/store";
const store = useEvaluateStore(); const store = useEvaluateStore();
const router = useRouter(); const router = useRouter();
const props = defineProps({
page: {
type: Number,
require: true,
},
pageSize: {
type: Number,
require: true,
},
maxPage: {
type: Number,
require: true,
},
});
const emit = defineEmits(["update:pagination"]);
/** ค้นหาคอลัม */ /** ค้นหาคอลัม */
const visibleColumns = ref<string[]>(["no", "type", "dateSend", "status"]); const visibleColumns = ref<string[]>(["no", "type", "dateSend", "status"]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
@ -51,10 +68,25 @@ const columns = ref<QTableProps["columns"]>([
const pagination = ref({ const pagination = ref({
sortBy: "", sortBy: "",
descending: true, descending: true,
page: 1, page: props.page,
rowsPerPage: 10, rowsPerPage: props.pageSize,
}); });
const currentPage = ref<number>(1);
function updateProp(newPagination: any, page: number) {
emit("update:pagination", newPagination, page);
}
/**
* function updatePageSize
* @param newPagination PageSize
*/
function updateRowsPerPagen(newPagination: any) {
pagination.value.rowsPerPage = newPagination.rowsPerPage;
currentPage.value = 1;
}
function redirectToDetail(data: any) { function redirectToDetail(data: any) {
router.push(`/evaluate/detail/${data.typeparam.toLowerCase()}/${data.id}`); router.push(`/evaluate/detail/${data.typeparam.toLowerCase()}/${data.id}`);
} }
@ -63,6 +95,11 @@ onMounted(() => {
store.columns = columns.value; store.columns = columns.value;
store.visibleColumns = visibleColumns.value; store.visibleColumns = visibleColumns.value;
}); });
/** function Callblck ทำงานเมื่อ pagination มีการเปลี่ยนแปลง */
watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
updateProp(pagination.value, currentPage.value);
});
</script> </script>
<template> <template>
<q-table <q-table
@ -77,6 +114,7 @@ onMounted(() => {
:visible-columns="store.visibleColumns" :visible-columns="store.visibleColumns"
:filter="store.filterKeyword" :filter="store.filterKeyword"
v-model:pagination="pagination" v-model:pagination="pagination"
@update:pagination="updateRowsPerPagen"
> >
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
@ -104,13 +142,13 @@ onMounted(() => {
</template> </template>
<template v-slot:pagination="scope"> <template v-slot:pagination="scope">
<q-pagination <q-pagination
v-model="pagination.page" v-model="currentPage"
active-color="primary" active-color="primary"
color="dark" color="dark"
size="sm" size="sm"
boundary-links boundary-links
direction-links direction-links
:max="scope.pagesNumber" :max="Number(props.maxPage)"
></q-pagination> ></q-pagination>
</template> </template>
</q-table> </q-table>

File diff suppressed because it is too large Load diff

View file

@ -123,7 +123,7 @@ onMounted(async () => {
icon="mdi-clipboard-outline" icon="mdi-clipboard-outline"
@click="onClickfetchDocument(item.fileName, 'COPPY')" @click="onClickfetchDocument(item.fileName, 'COPPY')"
> >
<q-tooltip>ดลอกล</q-tooltip> <q-tooltip>ดลอกล</q-tooltip>
</q-btn> </q-btn>
</q-item-section> </q-item-section>
</q-item> </q-item>
@ -160,7 +160,7 @@ onMounted(async () => {
) )
" "
> >
<q-tooltip>ดลอกล</q-tooltip> <q-tooltip>ดลอกล</q-tooltip>
</q-btn> </q-btn>
</q-item-section> </q-item-section>
</q-item> </q-item>

View file

@ -31,15 +31,14 @@ const performance = ref<string>("");
const performanceOwner = ref<string>(""); const performanceOwner = ref<string>("");
const position = ref<string>(""); const position = ref<string>("");
const performanceRef = ref<object | null>(null);
const performanceOwnerRef = ref<object | null>(null);
const positionRef = ref<object | null>(null);
const formCommand = reactive<FormCommand>({ const formCommand = reactive<FormCommand>({
commanderFullname: "", commanderFullname: "",
commanderPosition: "", commanderPosition: "",
commanderAboveFullname: "", commanderAboveFullname: "",
commanderAbovePosition: "", commanderAbovePosition: "",
author: "",
subject: "",
assignedPosition: "",
}); });
const commanderFullnameRef = ref<object | null>(null); const commanderFullnameRef = ref<object | null>(null);
@ -47,6 +46,9 @@ const commanderPositionRef = ref<object | null>(null);
const commanderAboveFullnameRef = ref<object | null>(null); const commanderAboveFullnameRef = ref<object | null>(null);
const commanderAbovePositionRef = ref<object | null>(null); const commanderAbovePositionRef = ref<object | null>(null);
const fileEvaluation1Ref = ref<object | null>(null); const fileEvaluation1Ref = ref<object | null>(null);
const performanceRef = ref<object | null>(null);
const performanceOwnerRef = ref<object | null>(null);
const assignedPositionRef = ref<object | null>(null);
const modalView = ref<boolean>(false); const modalView = ref<boolean>(false);
function onClickViewPDF(file: any) { function onClickViewPDF(file: any) {
@ -62,6 +64,9 @@ const updateInput = (value: any) => {
commanderAbovePositionRef: commanderAbovePositionRef.value, commanderAbovePositionRef: commanderAbovePositionRef.value,
fileEvaluation1Ref: fileEvaluation1Ref.value, fileEvaluation1Ref: fileEvaluation1Ref.value,
downloadFile: [downloadUrl.value], downloadFile: [downloadUrl.value],
performance: performanceRef.value,
performanceOwner: performanceOwnerRef.value,
assignedPosition: assignedPositionRef.value,
}; };
emit("update:form", value, ref); emit("update:form", value, ref);
}; };
@ -78,7 +83,7 @@ async function fetchPathUpload(
metadata: { metadata: {
subject: performance.value, subject: performance.value,
author: performanceOwner.value, author: performanceOwner.value,
position: position.value position: position.value,
}, },
}, },
}; };
@ -104,7 +109,6 @@ async function fetchPathUpload(
} }
async function uploadfile(uploadUrl: string, file: any) { async function uploadfile(uploadUrl: string, file: any) {
console.log(uploadUrl);
await axios await axios
.put(uploadUrl, file, { .put(uploadUrl, file, {
headers: { headers: {
@ -130,10 +134,15 @@ async function fetcheSigner(id: string) {
formCommand.commanderPosition = data.commanderPositionDoc2; formCommand.commanderPosition = data.commanderPositionDoc2;
formCommand.commanderAboveFullname = data.commanderAboveFullnameDoc2; formCommand.commanderAboveFullname = data.commanderAboveFullnameDoc2;
formCommand.commanderAbovePosition = data.commanderAbovePositionDoc2; formCommand.commanderAbovePosition = data.commanderAbovePositionDoc2;
formCommand.author = data.authorDoc2;
formCommand.subject = data.subjectDoc2;
formCommand.assignedPosition = data.assignedPosition;
store.statusUpload = true;
})
.catch(() => {
store.statusUpload = false;
}) })
// .catch((err) => {
// messageError($q, err);
// })
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
@ -159,19 +168,6 @@ async function fetchCheckDate() {
.catch((err) => {})); .catch((err) => {}));
} }
onMounted(async () => {
if (keycloak.tokenParsed != null) {
performanceOwner.value = keycloak.tokenParsed.name;
}
checkDoc();
if (store.currentStep > 2) {
fetcheSigner(evaluateId.value);
}
await fetchCheckDate();
// props.evaluateId && (await fetchPathUpload(" 2", props.evaluateId));
});
const downloadUrl = ref<string>(""); const downloadUrl = ref<string>("");
function checkDoc() { function checkDoc() {
showLoader(); showLoader();
@ -194,12 +190,28 @@ function checkDoc() {
commanderAbovePositionRef: commanderAbovePositionRef.value, commanderAbovePositionRef: commanderAbovePositionRef.value,
fileEvaluation1Ref: fileEvaluation1Ref.value, fileEvaluation1Ref: fileEvaluation1Ref.value,
downloadFile: [downloadUrl.value], downloadFile: [downloadUrl.value],
performance: performanceRef.value,
performanceOwner: performanceOwnerRef.value,
assignedPosition: assignedPositionRef.value,
}; };
emit("update:form", formCommand, ref); emit("update:form", formCommand, ref);
}); });
} }
onMounted(async () => {
if (keycloak.tokenParsed != null) {
formCommand.author = keycloak.tokenParsed.name;
}
checkDoc();
if (store.currentStep > 2) {
fetcheSigner(evaluateId.value);
}
await fetchCheckDate();
// props.evaluateId && (await fetchPathUpload(" 2", props.evaluateId));
});
watch( watch(
() => store.checkFileupload, () => store.checkFileupload,
() => { () => {
@ -208,8 +220,14 @@ watch(
: fileEvaluation1.value; : fileEvaluation1.value;
} }
); );
watch(
// onMounted(() => {}); () => store.statusUpload,
() => {
setTimeout(() => {
store.statusUpload && updateInput(formCommand);
}, 200);
}
);
</script> </script>
<template> <template>
@ -242,7 +260,7 @@ watch(
class="col-xs-12 col-sm-6" class="col-xs-12 col-sm-6"
outlined outlined
label="ชื่อผลงาน" label="ชื่อผลงาน"
v-model="performance" v-model="formCommand.subject"
@update:model-value="updateInput(formCommand)" @update:model-value="updateInput(formCommand)"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อผลงาน'}`]" :rules="[(val) => !!val || `${'กรุณากรอกชื่อผลงาน'}`]"
lazy-rules lazy-rules
@ -253,7 +271,7 @@ watch(
class="col-xs-12 col-sm-6" class="col-xs-12 col-sm-6"
dense dense
outlined outlined
v-model="performanceOwner" v-model="formCommand.author"
@update:model-value="updateInput(formCommand)" @update:model-value="updateInput(formCommand)"
label="เจ้าของผลงาน" label="เจ้าของผลงาน"
:rules="[(val) => !!val || `${'กรุณากรอกเจ้าของผลงาน'}`]" :rules="[(val) => !!val || `${'กรุณากรอกเจ้าของผลงาน'}`]"
@ -261,11 +279,11 @@ watch(
/> />
<q-input <q-input
:readonly="store.currentStep != 6" :readonly="store.currentStep != 6"
ref="positionRef" ref="assignedPositionRef"
class="col-xs-12 col-sm-6" class="col-xs-12 col-sm-6"
dense dense
outlined outlined
v-model="position" v-model="formCommand.assignedPosition"
@update:model-value="updateInput(formCommand)" @update:model-value="updateInput(formCommand)"
label="ตำแหน่งที่ได้รับ" label="ตำแหน่งที่ได้รับ"
:rules="[ :rules="[
@ -281,7 +299,7 @@ watch(
</q-card> </q-card>
</div> </div>
<div class="col-6" v-if="store.currentStep === 6"> <div class="col-6" v-if="store.statusUpload && store.currentStep === 6">
<q-card bordered style="border: 1px solid #d6dee1"> <q-card bordered style="border: 1px solid #d6dee1">
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md"> <div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">
เอกสารเล 2 เอกสารเล 2

View file

@ -41,11 +41,11 @@ function copyLink() {
class="q-mt-md" class="q-mt-md"
outline outline
icon="mdi-clipboard-outline" icon="mdi-clipboard-outline"
label="คัดลอกลิง์" label="คัดลอกลิง์"
color="primary" color="primary"
@click="copyLink" @click="copyLink"
> >
<q-tooltip> ดลอกล </q-tooltip></q-btn <q-tooltip> ดลอกล </q-tooltip></q-btn
> >
</div> </div>
</div> </div>

View file

@ -13,6 +13,9 @@ interface FormCommand {
commanderPosition: string; commanderPosition: string;
commanderAboveFullname: string; commanderAboveFullname: string;
commanderAbovePosition: string; commanderAbovePosition: string;
author: string;
subject: string;
assignedPosition: string;
} }
interface FormCommandRef { interface FormCommandRef {
@ -26,6 +29,8 @@ interface FormCommandRef {
fileEvaluation4: object | null; fileEvaluation4: object | null;
fileEvaluation5: object | null; fileEvaluation5: object | null;
fileEvaluation6: object | null; fileEvaluation6: object | null;
performance: object | null;
performanceOwner: object | null;
[key: string]: any; [key: string]: any;
} }

View file

@ -29,6 +29,7 @@ export const useEvaluateStore = defineStore("evaluateStore", () => {
const showLoadStatus = ref<boolean>(false); const showLoadStatus = ref<boolean>(false);
const step = ref<number>(1); const step = ref<number>(1);
const currentStep = ref<number>(1); const currentStep = ref<number>(1);
const statusUpload = ref<boolean>(false);
const title = ref<string[]>([ const title = ref<string[]>([
"ตรวจสอบคุณสมบัติ", "ตรวจสอบคุณสมบัติ",
"จัดเตรียมเอกสารเล่ม 1", "จัดเตรียมเอกสารเล่ม 1",
@ -65,7 +66,6 @@ export const useEvaluateStore = defineStore("evaluateStore", () => {
} }
const tabPanels = ref<string>("1"); const tabPanels = ref<string>("1");
const evaluateId = ref<string>(""); const evaluateId = ref<string>("");
return { return {
@ -79,6 +79,7 @@ export const useEvaluateStore = defineStore("evaluateStore", () => {
checkFileupload, checkFileupload,
step, step,
currentStep, currentStep,
statusUpload,
title, title,
tabPanels, tabPanels,
evaluateId, evaluateId,

View file

@ -36,12 +36,19 @@ function onclickAddEvaluate(data: ListMenu) {
modal.value = !modal.value; modal.value = !modal.value;
menu.value = data; menu.value = data;
} }
const page = ref<number>(1);
const pageSize = ref<number>(25);
const maxPage = ref<number>(10);
async function fetchEvaluteList() { async function fetchEvaluteList() {
showLoader(); showLoader();
await http await http
.get(config.API.evaluationList()) .get(
config.API.evaluationList() +
`?page=${page.value}&pageSize=${pageSize.value}`
)
.then((res) => { .then((res) => {
maxPage.value = Math.ceil(res.data.result.total / pageSize.value);
store.fetchEvaluateList(res.data.result.data); store.fetchEvaluateList(res.data.result.data);
}) })
.catch((err) => { .catch((err) => {
@ -52,6 +59,13 @@ async function fetchEvaluteList() {
}); });
} }
async function updatePaging(newPagination: any, currentPage: number) {
page.value = currentPage;
pageSize.value = newPagination.rowsPerPage;
await fetchEvaluteList();
}
onMounted(() => { onMounted(() => {
fetchEvaluteList(); fetchEvaluteList();
}); });
@ -128,7 +142,12 @@ onMounted(() => {
</div> </div>
</div> </div>
<div class="col-12"> <div class="col-12">
<TableListEvaluate /> <TableListEvaluate
:page="page"
:pageSize="pageSize"
:maxPage="maxPage"
@update:pagination="updatePaging"
/>
</div> </div>
</q-card> </q-card>
</div> </div>