Refactoring code module 12_evaluatePersonal
This commit is contained in:
parent
381ec04492
commit
490f02309e
33 changed files with 598 additions and 1036 deletions
|
|
@ -1,16 +1,13 @@
|
|||
<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";
|
||||
import type { directorType } from "@/modules/11_discipline/interface/index/Main";
|
||||
import type { Meeting } from "@/modules/12_evaluatePersonal/interface/index/Main";
|
||||
|
||||
/** importComponents*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const selected = ref<directorType[]>([]);
|
||||
const currentPage = ref<number>(1);
|
||||
|
||||
/** รับ props มาจากหน้าหลัก */
|
||||
const props = defineProps({
|
||||
Modal: Boolean,
|
||||
|
|
@ -39,7 +36,7 @@ const props = defineProps({
|
|||
default: () => "",
|
||||
},
|
||||
selectedRow: {
|
||||
type: Array as PropType<directorType[]>,
|
||||
type: Array as PropType<Meeting[]>,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
|
@ -52,6 +49,9 @@ const emit = defineEmits([
|
|||
"returnDirector",
|
||||
]);
|
||||
|
||||
const selected = ref<Meeting[]>([]);
|
||||
const currentPage = ref<number>(1);
|
||||
|
||||
/**ข้อมูลหัว ตาราง*/
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -130,12 +130,6 @@ const pagination = ref({
|
|||
rowsPerPage: props.rowsPerPage,
|
||||
});
|
||||
|
||||
const checkSelected = computed(() => {
|
||||
if (selected.value.length === 0) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
/** เลือกกรรมการ */
|
||||
async function onClickAddMeet() {
|
||||
emit("returnDirector", selected.value);
|
||||
|
|
@ -150,7 +144,7 @@ function Reset() {
|
|||
emit("update:filterKeyword2", "");
|
||||
}
|
||||
|
||||
function updateProp(newPagination: any, page: number) {
|
||||
function updateProp(newPagination: number, page: number) {
|
||||
// ส่ง event ไปยัง parent component เพื่ออัพเดทค่า props
|
||||
emit("update:pagination", newPagination, page);
|
||||
}
|
||||
|
|
@ -165,7 +159,9 @@ watchEffect(() => {
|
|||
watch(
|
||||
() => currentPage.value,
|
||||
() => {
|
||||
updateProp(pagination.value.rowsPerPage, currentPage.value);
|
||||
if (pagination.value.rowsPerPage) {
|
||||
updateProp(pagination.value.rowsPerPage, currentPage.value);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -173,7 +169,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>
|
||||
|
|
@ -253,7 +251,7 @@ watch(
|
|||
<q-btn
|
||||
label="เพิ่มการประชุม"
|
||||
@click="onClickAddMeet"
|
||||
:disable="checkSelected"
|
||||
:disable="selected.length === 0"
|
||||
color="public"
|
||||
/>
|
||||
</q-card-actions>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue