Refactoring code module 12_evaluatePersonal
This commit is contained in:
parent
381ec04492
commit
490f02309e
33 changed files with 598 additions and 1036 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue