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

@ -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,