ปรับ โค้ด ทดลองงาน

This commit is contained in:
STW_TTTY\stwtt 2024-08-16 14:42:11 +07:00
parent 51707646e7
commit 46af20233f
16 changed files with 167 additions and 339 deletions

View file

@ -7,9 +7,7 @@ import type { QTableProps } from "quasar";
import type {
FormMainProbation,
FormMainProbation2,
mapData,
OpfillterType,
CriteriaType,
} from "@/modules/05_placement/interface/request/Main";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
@ -20,33 +18,36 @@ import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
const $q = useQuasar(); // noti quasar
const rows = ref<FormMainProbation[]>([]);
const rows2 = ref<FormMainProbation2[]>([]);
const modal = ref<boolean>(false);
const attrs = ref<any>(useAttrs());
const paging = ref<boolean>(true);
const fillter = ref<number | null>(0);
const paging2 = ref<boolean>(true);
const Opfillter = ref<OpfillterType[]>([{ id: 0, value: "ทั้งหมด" }]);
const filterRef = ref<any>(null);
const filterRef2 = ref<any>(null);
const dataUpdate = ref<FormMainProbation[]>([]);
const probationlist = ref<any>([]);
const filterKeyword = ref<string>("");
const fillterStatus = ref<any>([]);
const filterKeyword2 = ref<string>("");
const Opfillter2 = ref<OpfillterType[]>([{ id: 0, value: "ทั้งหมด" }]);
const storeFn = useTransferDataStore();
const mixin = useCounterMixin();
const { statusProbationMain } = storeFn;
const { messageError, success, showLoader, hideLoader, dialogConfirm } = mixin;
const filterRef = ref<any>(null);
const modal = ref<boolean>(false);
const paging = ref<boolean>(true);
const filterRef2 = ref<any>(null);
const attrs = ref<any>(useAttrs());
const paging2 = ref<boolean>(true);
const fillterStatus = ref<any>([]);
const fillter = ref<number | null>(0);
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const rows = ref<FormMainProbation[]>([]);
const rows2 = ref<FormMainProbation2[]>([]);
const dataUpdate = ref<FormMainProbation[]>([]);
const Opfillter = ref<OpfillterType[]>([{ id: 0, value: "ทั้งหมด" }]);
const Opfillter2 = ref<OpfillterType[]>([{ id: 0, value: "ทั้งหมด" }]);
const formProbation = reactive({ keyword: "", pageSize: 10, page: 1 });
const maxPage = ref<number>(1);
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const pagination2 = ref({
sortBy: "desc",
descending: false,
@ -269,9 +270,6 @@ async function getpersonalList() {
});
}
const formProbation = reactive({ keyword: "", pageSize: 10, page: 1 });
const maxPage = ref<number>(1);
async function onclickAddProbation() {
modal.value = true;
modal.value && showLoader();
@ -289,10 +287,6 @@ async function onclickAddProbation() {
});
}
watch([() => formProbation.page, () => formProbation.pageSize], () => {
onclickAddProbation();
});
/**
* function updatePagination
* @param newPagination อม Pagination ใหม
@ -306,81 +300,9 @@ async function filterKeyword2Fn(page: number) {
page !== 1 ? (formProbation.page = 1) : await onclickAddProbation();
}
/** fecth profile */
// async function fecthlistPersonal() {
// showLoader();
// await http
// .get(config.API.profileOrganizRoot)
// .then((res) => {
// const id = res.data.result[0].id;
// if (id !== "") {
// findlist(id);
// }
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {});
// }
/**
* งขอมลเพ res
* @param id string
* @param data type
*/
// async function fecthlistProbation(id: string, data: any) {
// try {
// probationlist.value = [];
// const res = await http.post(
// config.API.profileSearchNewOcIdType(id, "officer"),
// {
// criterias: data,
// }
// );
// return res.data.result;
// } catch (err) {
// messageError($q, err);
// } finally {
// hideLoader();
// }
// }
/**
* นหาขอมลตามไอด
* @param id string
*/
// async function findlist(id: string) {
// let data: CriteriaType[] = [
// { criteriaType: "is_retire", criteriaValue: "false" },
// { criteriaType: "is_probation", criteriaValue: "true" },
// ];
// let data2: CriteriaType[] = [
// { criteriaType: "is_retire", criteriaValue: "false" },
// { criteriaType: "is_probation", criteriaValue: "false" },
// ];
// let response1 = await fecthlistProbation(id, data);
// let response2 = await fecthlistProbation(id, data2);
// response1.forEach((e: any) =>
// probationlist.value.push({ ...e, probation: true })
// );
// response2.forEach((e: any) =>
// probationlist.value.push({ ...e, probation: false })
// );
// rows2.value = probationlist.value.map((e: mapData) => ({
// id: e.id,
// fullname: e.fullname,
// position: e.position,
// level: e.positionEmployeeLevel,
// organizationOrganization: e.oc,
// status: e.probation,
// }));
// modal.value = true;
// }
/**
* เพมขอม ทดลองปฏหนาทราชการ
* @param id personal id
* @param data personal data
*/
function clickAdd(data: any) {
dialogConfirm(
@ -460,6 +382,10 @@ function filterFn(val: string, update: any) {
}
}
watch([() => formProbation.page, () => formProbation.pageSize], () => {
onclickAddProbation();
});
/** get ค่า เมื่อโหลดหน้า */
onMounted(async () => {
getpersonalList();
@ -593,9 +519,7 @@ onMounted(async () => {
color="info"
icon="mdi-eye"
@click="
router.push(
`/probation/detail/${props.row.personal_id}`
)
router.push(`/probation/detail/${props.row.personal_id}`)
"
>
<q-tooltip>รายละเอยด</q-tooltip>