Refactoring code module 12_evaluatePersonal

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-20 13:13:43 +07:00
parent 381ec04492
commit 490f02309e
33 changed files with 598 additions and 1036 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed, watchEffect, watch, type PropType } from "vue";
import { ref, watchEffect, watch, type PropType } from "vue";
/** importType*/
import type { QTableProps } from "quasar";
@ -43,7 +43,7 @@ const props = defineProps({
},
});
const currentPage = ref<number>(1);
const currentPage = ref<number>(1); //
/** ค้นหาคอลัม */
const visibleColumns2 = ref<string[]>([
@ -53,7 +53,6 @@ const visibleColumns2 = ref<string[]>([
"email",
"phone",
]);
//
const columns2 = ref<QTableProps["columns"]>([
{
@ -109,13 +108,6 @@ const pagination = ref({
page: Number(props.page),
rowsPerPage: props.rowsPerPage,
});
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
const emit = defineEmits([
"update:filterKeyword2",
"update:selected",
@ -128,21 +120,34 @@ async function directorSave() {
emit("returnDirector", selected.value);
}
/**
* งกนอปเดทคำคนหา
* @param value คำคนหา
*/
function updateInput(value: any) {
emit("update:filterKeyword2", value);
}
/**รีเซ็ตค่าในช่องค้นหา */
/**
* เซตคาในชองคนหา
*/
function Reset() {
emit("update:filterKeyword2", "");
}
function updateProp(newPagination: any, page: number) {
/**
*
* @param newPagination
* @param page
*/
function updateProp(newPagination: number, page: number) {
// event parent component props
emit("update:pagination", newPagination, page);
}
/** เช็คค่า props.Modal === true */
/**
* เชคค props.Modal === true
*/
watchEffect(() => {
if (props.Modal === true) {
selected.value = props.selectedRow;
@ -152,7 +157,9 @@ watchEffect(() => {
watch(
() => currentPage.value,
() => {
updateProp(pagination.value.rowsPerPage, currentPage.value);
if (pagination.value.rowsPerPage) {
updateProp(pagination.value.rowsPerPage, currentPage.value);
}
}
);
@ -160,7 +167,9 @@ watch(
() => pagination.value.rowsPerPage,
() => {
currentPage.value = 1;
updateProp(pagination.value.rowsPerPage, currentPage.value);
if (pagination.value.rowsPerPage) {
updateProp(pagination.value.rowsPerPage, currentPage.value);
}
}
);
</script>
@ -241,7 +250,7 @@ watch(
<q-btn
label="เพิ่มรายชื่อกรรมการ"
@click="directorSave"
:disable="checkSelected"
:disable="selected.length === 0"
color="public"
/>
</q-card-actions>