ปรับ โค้ด รายละเอียดงานที่ได้รับมอบหมาย(ยังเก็บไม่หมด)

This commit is contained in:
setthawutttty 2023-11-13 17:55:39 +07:00
parent 0f1187ab1a
commit 77f6dff00f
7 changed files with 670 additions and 264 deletions

View file

@ -34,12 +34,12 @@ const probationlist = ref<any>([]);
const filterKeyword = ref<string>("");
const fillterStatus = ref<any>([]);
const filterKeyword2 = ref<string>("");
const Opfillter2 = ref<any[]>([]);
const storeFn = useTransferDataStore();
const mixin = useCounterMixin();
const { statusProbationMain } = storeFn;
const { messageError, success, showLoader, hideLoader, dialogConfirm } = mixin;
const pagination = ref({
sortBy: "desc",
descending: false,
@ -52,6 +52,8 @@ const pagination2 = ref({
page: 1,
rowsPerPage: 10,
});
/** ข้อมูลที่เเสดง */
const visibleColumns = ref<string[]>([
"no",
"name",
@ -63,7 +65,7 @@ const visibleColumns = ref<string[]>([
"probation_status",
]);
//
/** หัวตาราง */
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -139,7 +141,7 @@ const columns = ref<QTableProps["columns"]>([
},
]);
// 2
/** หัวตาราง2 */
const columns2 = ref<QTableProps["columns"]>([
{
name: "no",
@ -197,7 +199,8 @@ const columns2 = ref<QTableProps["columns"]>([
},
]);
const ProbationMainFilter = () => {
/** ฟังชั่น ฟิลเตอร์ หา status */
function ProbationMainFilter() {
const useStatus = new Set();
fillterStatus.value.forEach((item: any) => {
const ID = item.probation_status;
@ -212,9 +215,13 @@ const ProbationMainFilter = () => {
});
Opfillter.value.sort((a: any, b: any) => a.id - b.id);
Opfillter2.value = Opfillter.value;
};
}
const updateRows = (body: any) => {
/**
* พเดท rows ตาม status
* @param body {id:? , value: ?}
*/
function updateRows(body: any) {
if (body.value !== "ทั้งหมด") {
const filteredRows = dataUpdate.value.filter(
(item: FormMainProbation) => item.probation_status === body.value
@ -223,9 +230,10 @@ const updateRows = (body: any) => {
} else {
rows.value = dataUpdate.value;
}
};
}
const getpersonalList = async () => {
/** get ข้อมูล */
async function getpersonalList() {
showLoader();
await http
.get(config.API.probationPersonalList())
@ -251,9 +259,10 @@ const getpersonalList = async () => {
.finally(() => {
hideLoader();
});
};
// fecth profile
const fecthlistPersonal = async () => {
}
/** fecth profile */
async function fecthlistPersonal() {
showLoader();
await http
.get(config.API.profileOrganizRoot)
@ -267,8 +276,14 @@ const fecthlistPersonal = async () => {
messageError($q, e);
})
.finally(() => {});
};
const fecthlistProbation = async (id: string, data: any) => {
}
/**
* งขอมลเพ res
* @param id string
* @param data type
*/
async function fecthlistProbation(id: string, data: any) {
try {
probationlist.value = [];
const res = await http.post(
@ -283,9 +298,13 @@ const fecthlistProbation = async (id: string, data: any) => {
} finally {
hideLoader();
}
};
}
const findlist = async (id: string) => {
/**
* นหาขอมลตามไอด
* @param id string
*/
async function findlist(id: string) {
let data: CriteriaType[] = [
{ criteriaType: "is_retire", criteriaValue: "false" },
{ criteriaType: "is_probation", criteriaValue: "true" },
@ -312,8 +331,13 @@ const findlist = async (id: string) => {
status: e.probation,
}));
modal.value = true;
};
const clickAdd = (id: string) => {
}
/**
* เพมขอม ทดลองปฏหนาทราชการ
* @param id personal id
*/
function clickAdd(id: string) {
dialogConfirm(
$q,
async () => {
@ -338,35 +362,39 @@ const clickAdd = (id: string) => {
"ยันยันการเพิ่มข้อมูล",
"ต้องการเพิ่มข้อมูลนี้หรือไม่ ?"
);
};
const clickClose = async () => {
}
/** ปิด dialog */
async function clickClose() {
modal.value = false;
};
}
const resetFilter = () => {
/** reset ฟิลเตอร์ */
function resetFilter() {
filterKeyword.value = "";
filterRef.value.focus();
};
}
const resetFilter2 = () => {
/** reset ฟิลเตอร์ ใน dialog */
function resetFilter2() {
filterKeyword2.value = "";
filterRef2.value.focus();
};
}
const paginationLabel = (start: string, end: string, total: string) => {
function paginationLabel(start: string, end: string, total: string) {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
}
const paginationLabel2 = (start: string, end: string, total: string) => {
function paginationLabel2(start: string, end: string, total: string) {
if (paging2.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
onMounted(async () => {
getpersonalList();
});
}
const Opfillter2 = ref<any[]>([]);
/**
* นหาตาม text
* @param val าทนหา
* @param update fn
*/
function filterFn(val: string, update: any) {
if (val == "") {
update(() => {
@ -381,6 +409,11 @@ function filterFn(val: string, update: any) {
});
}
}
/** get ค่า เมื่อโหลดหน้า */
onMounted(async () => {
getpersonalList();
});
</script>
<template>
@ -420,6 +453,7 @@ function filterFn(val: string, update: any) {
</q-item>
</template>
</q-select>
<div>
<q-btn
@click="fecthlistPersonal"
@ -435,6 +469,7 @@ function filterFn(val: string, update: any) {
</div>
</div>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
@ -639,4 +674,4 @@ function filterFn(val: string, update: any) {
</q-form>
</q-card>
</q-dialog>
</template>
</template>