Refactoring code module 12_evaluatePersonal
This commit is contained in:
parent
381ec04492
commit
490f02309e
33 changed files with 598 additions and 1036 deletions
|
|
@ -10,27 +10,16 @@ import config from "@/app.config";
|
|||
/** importComponents*/
|
||||
import DialogMeet from "@/modules/12_evaluatePersonal/components/Detail/viewTab2/DialogMeet.vue";
|
||||
|
||||
import type { Meeting } from "@/modules/12_evaluatePersonal/interface/index/Main";
|
||||
import type { Meetings } from "@/modules/12_evaluatePersonal/interface/response/Main";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** use*/
|
||||
const route = useRoute();
|
||||
const id = ref<string>(route.params.id as string);
|
||||
const mixin = useCounterMixin();
|
||||
const $q = useQuasar();
|
||||
|
||||
/** props*/
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
fetchdata: {
|
||||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
|
|
@ -40,6 +29,21 @@ const {
|
|||
success,
|
||||
} = mixin;
|
||||
|
||||
/** props*/
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
fetchData: {
|
||||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
});
|
||||
|
||||
const id = ref<string>(route.params.id as string);
|
||||
|
||||
const rows = ref<Meeting[]>([]); //รายการประชุม
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -109,26 +113,30 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const rows = ref<any[]>([]);
|
||||
|
||||
const modalAdd = ref<boolean>(false);
|
||||
const filter = ref<string>("");
|
||||
const page = ref<number>(1);
|
||||
const rowsPerPage = ref<number>(10);
|
||||
const maxPage = ref<number>(1);
|
||||
const listMeet = ref<any>([]);
|
||||
const modalAdd = ref<boolean>(false); //เพิ่มรายการประชุม
|
||||
const filter = ref<string>(""); //ค้นหารายการประชุม
|
||||
const page = ref<number>(1); //หน้า
|
||||
const rowsPerPage = ref<number>(10); //จำนวนต่อหน้า
|
||||
const maxPage = ref<number>(1); //จำนนวนหน้าทั้งหมด
|
||||
const listMeet = ref<Meetings[]>([]); //รายชื่อประชุม
|
||||
|
||||
/**
|
||||
* ฟังก์เปิด popup เพิ่มการประชุม
|
||||
*/
|
||||
function onClickAdd() {
|
||||
modalAdd.value = true;
|
||||
getList();
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ปิด popup เพิ่มการประชุม
|
||||
*/
|
||||
function onClickClose() {
|
||||
modalAdd.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* function อัดเดท Paging กรรมการ
|
||||
* function อัดเดท Paging การประชุม
|
||||
* @param rpp ต่อหน้า
|
||||
* @param p หน้า
|
||||
*/
|
||||
|
|
@ -141,8 +149,8 @@ async function updatePaging(rpp: number, p: number) {
|
|||
* function return รายชื่อกรรมการที่เลือก
|
||||
* @param data รายชื่อกรรมการที่เลือก
|
||||
*/
|
||||
function returnData(data: any) {
|
||||
const dataList = data.map((item: any) => item.id);
|
||||
function returnData(data: Meetings[]) {
|
||||
const dataList = data.map((item: Meetings) => item.id);
|
||||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -150,9 +158,9 @@ function returnData(data: any) {
|
|||
meetings: dataList,
|
||||
})
|
||||
.then(async () => {
|
||||
await props.fetchdata();
|
||||
await props.fetchData();
|
||||
await success($q, "บันทึกสำเร็จ");
|
||||
await onClickClose();
|
||||
onClickClose();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -170,7 +178,7 @@ async function getList() {
|
|||
.get(config.API.meeting() + `/admin`)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
listMeet.value = data.map((item: any) => ({
|
||||
listMeet.value = data.map((item: Meetings) => ({
|
||||
id: item.id,
|
||||
createdAt: item.createdAt,
|
||||
createdUserId: item.createdUserId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue