refactor code (ยังไม่หมด)
This commit is contained in:
parent
ab4189e6ed
commit
32d4de7075
21 changed files with 309 additions and 109 deletions
|
|
@ -192,7 +192,7 @@ async function getData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* บันทึกข้อมูล
|
* บันทึกข้อมูลเมื่อแก้ไข
|
||||||
* @param data ข้อมูลจากฟอร์ม
|
* @param data ข้อมูลจากฟอร์ม
|
||||||
*/
|
*/
|
||||||
async function onSubmit(data: any) {
|
async function onSubmit(data: any) {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,10 @@ const { showLoader, messageError, hideLoader, dialogConfirm, success } = mixin;
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
/** บันทึกข้อมูลเเละ route กลับหน้าหลัก */
|
/**
|
||||||
|
* บันทึกข้อมูล อุทธรณ์/ร้องทุกข์
|
||||||
|
* @param data ชุดข้อมูล
|
||||||
|
*/
|
||||||
async function onSubmit(data: any) {
|
async function onSubmit(data: any) {
|
||||||
console.log("add", data);
|
console.log("add", data);
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
@ -33,6 +36,7 @@ async function onSubmit(data: any) {
|
||||||
.post(config.API.appealAdd() + "/admin", formData)
|
.post(config.API.appealAdd() + "/admin", formData)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
//เปลี่ยนหน้าไปหน้ารายละเอียด
|
||||||
router.push(`/discipline-appealcomplain/${res.data.result}`);
|
router.push(`/discipline-appealcomplain/${res.data.result}`);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
@ -41,7 +45,6 @@ async function onSubmit(data: any) {
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
// router.push(`/discipline-appealcomplain`);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,12 @@ const data = reactive<EditDataList>({
|
||||||
historyStatus: [historyStatusOb],
|
historyStatus: [historyStatusOb],
|
||||||
disciplineComplaint_Appeal_Docs: [fileOb],
|
disciplineComplaint_Appeal_Docs: [fileOb],
|
||||||
});
|
});
|
||||||
/** บันทึกข้อมูลเเละ route กลับหน้าหลัก */
|
|
||||||
|
/**
|
||||||
|
* บันทึกข้อมูล อุทธรณ์/ร้องทุกข์
|
||||||
|
* @param data ชุดข้อมูล
|
||||||
|
*/
|
||||||
async function onSubmit(data: any) {
|
async function onSubmit(data: any) {
|
||||||
console.log(data)
|
|
||||||
const dataList = {
|
const dataList = {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
|
|
@ -69,17 +72,17 @@ async function onSubmit(data: any) {
|
||||||
.put(config.API.appealByID(id.value), dataList)
|
.put(config.API.appealByID(id.value), dataList)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
getData();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
getData();
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
// router.push(`/discipline-appealcomplain`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ดึงข้อมูลจาก API หน้ารายการ */
|
||||||
function getData() {
|
function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -112,8 +115,8 @@ function getData() {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// fetchData();
|
|
||||||
getData();
|
getData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -184,8 +184,11 @@ async function addPerson(data: any) {
|
||||||
toggleModal();
|
toggleModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* เก็บค่า list บุคคลไว้ใน row
|
||||||
|
* @param returnData ชุดข้อมูล บุคคล
|
||||||
|
*/
|
||||||
function handleSave(returnData: any) {
|
function handleSave(returnData: any) {
|
||||||
console.log(returnData);
|
|
||||||
modalPerson.value = false;
|
modalPerson.value = false;
|
||||||
dataStore.rowsAdd = returnData.map((item: any) => ({
|
dataStore.rowsAdd = returnData.map((item: any) => ({
|
||||||
profileId: item.personId,
|
profileId: item.personId,
|
||||||
|
|
@ -196,6 +199,10 @@ function handleSave(returnData: any) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ส่งค่า css ออกไปตามเงื่อนไข
|
||||||
|
* @param val true/false
|
||||||
|
*/
|
||||||
function inputEdit(val: boolean) {
|
function inputEdit(val: boolean) {
|
||||||
return {
|
return {
|
||||||
"full-width cursor-pointer inputgreen ": val,
|
"full-width cursor-pointer inputgreen ": val,
|
||||||
|
|
@ -203,6 +210,7 @@ function inputEdit(val: boolean) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** อัปโหลดเอกสาร */
|
||||||
function uploadFile() {
|
function uploadFile() {
|
||||||
/** uploadFile */
|
/** uploadFile */
|
||||||
const Data = new FormData();
|
const Data = new FormData();
|
||||||
|
|
@ -214,7 +222,6 @@ function uploadFile() {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
success($q, "อัปโหลดไฟล์สำเร็จ");
|
success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||||
props.getData();
|
props.getData();
|
||||||
// router.push(`/discipline/complaints`);
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -225,10 +232,18 @@ function uploadFile() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* เปิดไฟล์เอกสาร
|
||||||
|
* @param link link ของไฟล์
|
||||||
|
*/
|
||||||
function downloadFile(link: string) {
|
function downloadFile(link: string) {
|
||||||
window.open(link, "_blank");
|
window.open(link, "_blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ลบไฟลืจาก id
|
||||||
|
* @param id id ของไฟล์
|
||||||
|
*/
|
||||||
function deleteFile(id: string) {
|
function deleteFile(id: string) {
|
||||||
dialogRemove($q, () => confirmDelete(id));
|
dialogRemove($q, () => confirmDelete(id));
|
||||||
}
|
}
|
||||||
|
|
@ -284,14 +299,17 @@ watch(props.data, async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** ปิด popup */
|
||||||
function close() {
|
function close() {
|
||||||
modalHistory.value = false;
|
modalHistory.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** เปิด pop up history */
|
||||||
function historyStatus() {
|
function historyStatus() {
|
||||||
modalHistory.value = true;
|
modalHistory.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** save ข้อมูล */
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -318,6 +336,7 @@ function onSubmit() {
|
||||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
dataStore.columns = columns.value;
|
dataStore.columns = columns.value;
|
||||||
dataStore.visibleColumns = visibleColumns.value;
|
dataStore.visibleColumns = visibleColumns.value;
|
||||||
|
|
|
||||||
|
|
@ -193,25 +193,21 @@ function redirectToPageadd() {
|
||||||
router.push(`/discipline-appealcomplain/add`);
|
router.push(`/discipline-appealcomplain/add`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** เปิดหน้า แก้ไข */
|
||||||
function editPage(id: string) {
|
function editPage(id: string) {
|
||||||
router.push(`/discipline-appealcomplain/${id}`);
|
router.push(`/discipline-appealcomplain/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ดึงข้อมูลเมื่อ กด enter */
|
||||||
function filterFn() {
|
function filterFn() {
|
||||||
console.log("enter", filterKeyword.value);
|
|
||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ปิด pop up */
|
||||||
function close() {
|
function close() {
|
||||||
modalStatusEdit.value = false;
|
modalStatusEdit.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function editStatusReturn(data: any) {
|
|
||||||
dialogConfirm($q, () => {
|
|
||||||
console.log("saveStatus");
|
|
||||||
modalStatusEdit.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ดึงข้อมูลเริ่มต้น */
|
/** ดึงข้อมูลเริ่มต้น */
|
||||||
async function getData() {
|
async function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -249,6 +245,7 @@ function yearAll() {
|
||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังชั่น เคลียฟิลเตอร์ */
|
||||||
function resetFilter() {
|
function resetFilter() {
|
||||||
filterKeyword.value = "";
|
filterKeyword.value = "";
|
||||||
getData();
|
getData();
|
||||||
|
|
@ -470,7 +467,6 @@ onMounted(async () => {
|
||||||
:modal="modalStatusEdit"
|
:modal="modalStatusEdit"
|
||||||
:data="dataRow"
|
:data="dataRow"
|
||||||
:close="close"
|
:close="close"
|
||||||
@editStatusReturn="editStatusReturn"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,26 @@ const OrderType = ref<string>("");
|
||||||
const OrderTypeFilter1 = ref<any>([]);
|
const OrderTypeFilter1 = ref<any>([]);
|
||||||
const OrderTypeOption = ref<DataOption1[]>([{ id: "", name: "ทั้งหมด" }]);
|
const OrderTypeOption = ref<DataOption1[]>([{ id: "", name: "ทั้งหมด" }]);
|
||||||
|
|
||||||
const OrderTypeFilter = async () => {
|
// รายการข้อมูลสถานะคำสั่ง
|
||||||
|
const OrderStatus = ref<string>("ทั้งหมด");
|
||||||
|
const OrderStatusOption = ref<DataOption1[]>([
|
||||||
|
{ id: "ทั้งหมด", name: "ทั้งหมด" },
|
||||||
|
]);
|
||||||
|
const OrderStatusFilter1 = ref<DataOption1[]>([
|
||||||
|
{ id: "ทั้งหมด", name: "ทั้งหมด" },
|
||||||
|
]);
|
||||||
|
const addedOrderStatusValues: string[] = [];
|
||||||
|
|
||||||
|
// ค้นหาในตาราง
|
||||||
|
const filterKeyword = ref<string>("");
|
||||||
|
const filterRef = ref<any>(null);
|
||||||
|
|
||||||
|
function resetFilter(){
|
||||||
|
filterKeyword.value = "";
|
||||||
|
filterRef.value.focus();
|
||||||
|
};
|
||||||
|
|
||||||
|
async function OrderTypeFilter(){
|
||||||
await http
|
await http
|
||||||
.get(config.API.typeOrder())
|
.get(config.API.typeOrder())
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -218,16 +237,12 @@ const OrderTypeFilter = async () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// รายการข้อมูลสถานะคำสั่ง
|
/** ฟังชั่นฟิลเตอร์ตามค่า ประเภท สถานะ ปี */
|
||||||
const OrderStatus = ref<string>("ทั้งหมด");
|
async function searchFilterTable(){
|
||||||
const OrderStatusOption = ref<DataOption1[]>([
|
stroe.filterListOrder(OrderType.value, OrderStatus.value, fiscalyear.value);
|
||||||
{ id: "ทั้งหมด", name: "ทั้งหมด" },
|
};
|
||||||
]);
|
|
||||||
const OrderStatusFilter1 = ref<DataOption1[]>([
|
async function OrderStatusFilter(){
|
||||||
{ id: "ทั้งหมด", name: "ทั้งหมด" },
|
|
||||||
]);
|
|
||||||
const addedOrderStatusValues: string[] = [];
|
|
||||||
const OrderStatusFilter = async () => {
|
|
||||||
for (let data of stroe.mainData) {
|
for (let data of stroe.mainData) {
|
||||||
const OrderStatusValue = data.orderStatusName;
|
const OrderStatusValue = data.orderStatusName;
|
||||||
|
|
||||||
|
|
@ -248,19 +263,13 @@ const OrderStatusFilter = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ค้นหาในตาราง
|
/**
|
||||||
const filterKeyword = ref<string>("");
|
* ฟิลเตอร์ข้อมูลจาก input
|
||||||
const filterRef = ref<any>(null);
|
* @param val ค่าที่ป้อนให้ input
|
||||||
const resetFilter = () => {
|
* @param update function จาก quasar
|
||||||
filterKeyword.value = "";
|
* @param refData type ที่กำหนด ของ input นั้นๆ
|
||||||
filterRef.value.focus();
|
*/
|
||||||
};
|
function filterSelector(val: any, update: Function, refData: string){
|
||||||
|
|
||||||
const searchFilterTable = async () => {
|
|
||||||
stroe.filterListOrder(OrderType.value, OrderStatus.value, fiscalyear.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const filterSelector = (val: any, update: Function, refData: string) => {
|
|
||||||
switch (refData) {
|
switch (refData) {
|
||||||
case "fiscalyearOP":
|
case "fiscalyearOP":
|
||||||
update(() => {
|
update(() => {
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,11 @@ const pagination = ref({
|
||||||
rowsPerPage: 10,
|
rowsPerPage: 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
// redirect ไปยัง step ปัจจุบัน
|
/**
|
||||||
|
* ฟังชั่น redirect
|
||||||
|
* @param id id ออกคำสั่ง
|
||||||
|
* @param status status
|
||||||
|
*/
|
||||||
const redirectToPage = (id?: string, status?: string) => {
|
const redirectToPage = (id?: string, status?: string) => {
|
||||||
let step = 1;
|
let step = 1;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,10 @@ async function directorSave() {
|
||||||
emit("returnDirector", selected.value);
|
emit("returnDirector", selected.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ส่งค่า input กลับไปหน้าหลัก
|
||||||
|
* @param value ค่าจาก input ฟิลเตอร์
|
||||||
|
*/
|
||||||
function updateInput(value: any) {
|
function updateInput(value: any) {
|
||||||
emit("update:filterKeyword2", value);
|
emit("update:filterKeyword2", value);
|
||||||
}
|
}
|
||||||
|
|
@ -150,6 +154,11 @@ function Reset() {
|
||||||
emit("update:filterKeyword2", "");
|
emit("update:filterKeyword2", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ส่งเลขหน้า กลับไปหน้าหลัก
|
||||||
|
* @param newPagination จำนวนข้อมูลที่ต้องการแสดง
|
||||||
|
* @param page เลขหน้าปัจจุบัน
|
||||||
|
*/
|
||||||
function updateProp(newPagination: any, page: number) {
|
function updateProp(newPagination: any, page: number) {
|
||||||
// ส่ง event ไปยัง parent component เพื่ออัพเดทค่า props
|
// ส่ง event ไปยัง parent component เพื่ออัพเดทค่า props
|
||||||
emit("update:pagination", newPagination, page);
|
emit("update:pagination", newPagination, page);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import { ref, useAttrs } from "vue";
|
||||||
|
|
||||||
const attrs = ref<any>(useAttrs());
|
const attrs = ref<any>(useAttrs());
|
||||||
const table = ref<any>(null);
|
const table = ref<any>(null);
|
||||||
const filterRef = ref<any>(null);
|
|
||||||
|
|
||||||
/** รับ props มาจากหน้าหลัก */
|
/** รับ props มาจากหน้าหลัก */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const { dialogConfirm, dialogMessageNotify } = mixin;
|
const { dialogConfirm, dialogMessageNotify } = mixin;
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
@ -50,18 +48,15 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["returnPerson"]);
|
const emit = defineEmits(["returnPerson"]);
|
||||||
/** หัวตาราง */
|
|
||||||
|
|
||||||
const selected = ref<any>([]);
|
const selected = ref<any>([]);
|
||||||
const inspectionResults = ref<string>("");
|
const inspectionResults = ref<string>("");
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
// const inputRef = ref<any>(null);
|
|
||||||
|
|
||||||
const initialPagination = ref<any>({
|
const initialPagination = ref<any>({
|
||||||
descending: false,
|
descending: false,
|
||||||
rowsPerPage: 25,
|
rowsPerPage: 25,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** ฟังชั่นส่งคนไปออกคำสั่ง */
|
||||||
function onclickSend() {
|
function onclickSend() {
|
||||||
if (selected.value.length === 0) {
|
if (selected.value.length === 0) {
|
||||||
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 บุคคล");
|
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 บุคคล");
|
||||||
|
|
@ -69,7 +64,6 @@ function onclickSend() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
async () => {
|
||||||
// success($q, `ส่งข้อมูล${props.title}สำเร็จ`);
|
|
||||||
await emit("returnPerson", selected.value);
|
await emit("returnPerson", selected.value);
|
||||||
props.fetchData();
|
props.fetchData();
|
||||||
props.close?.();
|
props.close?.();
|
||||||
|
|
@ -80,6 +74,7 @@ function onclickSend() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ปิด pop up */
|
||||||
function onClickClose() {
|
function onClickClose() {
|
||||||
props.close?.();
|
props.close?.();
|
||||||
}
|
}
|
||||||
|
|
@ -161,12 +156,6 @@ watch([() => props.modal], () => {
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
<q-th auto-width>
|
<q-th auto-width>
|
||||||
<!-- <q-checkbox
|
|
||||||
keep-color
|
|
||||||
color="primary"
|
|
||||||
dense
|
|
||||||
v-model="props.selected"
|
|
||||||
/> -->
|
|
||||||
</q-th>
|
</q-th>
|
||||||
<q-th
|
<q-th
|
||||||
v-for="col in props.cols"
|
v-for="col in props.cols"
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,18 @@ async function uploadFile() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pop up ลบไฟล์
|
||||||
|
* @param id id ของไฟล์ที่จะลบ
|
||||||
|
*/
|
||||||
function popupRemove(id: string) {
|
function popupRemove(id: string) {
|
||||||
dialogRemove($q, () => removeFile(id));
|
dialogRemove($q, () => removeFile(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังชั่นลบไฟล์
|
||||||
|
* @param id id ของไฟล์
|
||||||
|
*/
|
||||||
async function removeFile(id: string) {
|
async function removeFile(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,6 @@ export const useAppealComplainStore = defineStore(
|
||||||
|
|
||||||
const mixin = useCounterMixin()
|
const mixin = useCounterMixin()
|
||||||
const { date2Thai } = mixin
|
const { date2Thai } = mixin
|
||||||
const typeConvert = (val: string) => {
|
|
||||||
switch (val) {
|
|
||||||
case "APPEAL":
|
|
||||||
return "อุทธรณ์";
|
|
||||||
case "COMPLAIN":
|
|
||||||
return "ร้องทุกข์";
|
|
||||||
default:
|
|
||||||
return "-";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const typeOptions = ref<DataOption[]>([
|
const typeOptions = ref<DataOption[]>([
|
||||||
{ id: "APPEAL", name: "อุทธรณ์" },
|
{ id: "APPEAL", name: "อุทธรณ์" },
|
||||||
{ id: "COMPLAIN", name: "ร้องทุกข์" },
|
{ id: "COMPLAIN", name: "ร้องทุกข์" },
|
||||||
|
|
@ -54,6 +43,26 @@ export const useAppealComplainStore = defineStore(
|
||||||
{ id: "DONE", name: "ปิดคำร้อง" },
|
{ id: "DONE", name: "ปิดคำร้อง" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังชั่นแปลง status เป็น ไทย
|
||||||
|
* @param val status ที่รับมา
|
||||||
|
* @returns ส่งที่เเปลงออกไป
|
||||||
|
*/
|
||||||
|
function typeConvert(val: string){
|
||||||
|
switch (val) {
|
||||||
|
case "APPEAL":
|
||||||
|
return "อุทธรณ์";
|
||||||
|
case "COMPLAIN":
|
||||||
|
return "ร้องทุกข์";
|
||||||
|
default:
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* จัดเรียงข้อมูล
|
||||||
|
* @param data ข้อมูลที่รับมาจาก API
|
||||||
|
*/
|
||||||
function fetchAppealComplain(data: MainList[]) {
|
function fetchAppealComplain(data: MainList[]) {
|
||||||
let dataList: RowList[] = data.map((e: MainList) => ({
|
let dataList: RowList[] = data.map((e: MainList) => ({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
|
|
@ -72,11 +81,22 @@ export const useAppealComplainStore = defineStore(
|
||||||
rows.value = dataList;
|
rows.value = dataList;
|
||||||
console.log(rows.value)
|
console.log(rows.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังชั่นเอาไว้เก็บข้อมูล
|
||||||
|
* @param data ข้อมูลจาก list ทั้งหมด
|
||||||
|
*/
|
||||||
function getRow(data: RowAddList[]) {
|
function getRow(data: RowAddList[]) {
|
||||||
if (data) {
|
if (data) {
|
||||||
rowsAdd.value = data
|
rowsAdd.value = data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง status เป็น Text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
function statusTothai(val: string) {
|
function statusTothai(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "NEW":
|
case "NEW":
|
||||||
|
|
@ -98,8 +118,6 @@ export const useAppealComplainStore = defineStore(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
rows,
|
rows,
|
||||||
visibleColumns,
|
visibleColumns,
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,11 @@ export const useDisciplineChannelDataStore = defineStore(
|
||||||
type.value = data
|
type.value = data
|
||||||
}
|
}
|
||||||
const rows = ref<ChannelRows[]>([]);
|
const rows = ref<ChannelRows[]>([]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* รับค่าจาก API เก็บไว้ใน rows
|
||||||
|
* @param data ค่าจาก API
|
||||||
|
*/
|
||||||
function fetchData(data: ChannelRows[]) {
|
function fetchData(data: ChannelRows[]) {
|
||||||
rows.value = data;
|
rows.value = data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,20 +43,6 @@ export const useComplainstDataStore = defineStore(
|
||||||
);
|
);
|
||||||
const consideredAgencytoptions = ref<DataOption[]>([]);
|
const consideredAgencytoptions = ref<DataOption[]>([]);
|
||||||
const organizationIdOp = ref<DataOption[]>([]);
|
const organizationIdOp = ref<DataOption[]>([]);
|
||||||
|
|
||||||
const statusTothai = (val: string) => {
|
|
||||||
switch (val) {
|
|
||||||
case "NEW":
|
|
||||||
return "ใหม่";
|
|
||||||
case "STOP":
|
|
||||||
return "ยุติเรื่อง";
|
|
||||||
case "SEND_INVESTIGATE":
|
|
||||||
return "มีมูลส่งไปสืบสวนแล้ว";
|
|
||||||
default:
|
|
||||||
return "-";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const levelConsiderationtOptions = ref<DataOption[]>([
|
const levelConsiderationtOptions = ref<DataOption[]>([
|
||||||
{ id: "NORMAL", name: "ปกติ" },
|
{ id: "NORMAL", name: "ปกติ" },
|
||||||
{ id: "URGENT", name: "ด่วน" },
|
{ id: "URGENT", name: "ด่วน" },
|
||||||
|
|
@ -74,6 +60,29 @@ export const useComplainstDataStore = defineStore(
|
||||||
{ id: "SEND_INVESTIGATE", name: "มีมูลส่งไปสืบสวนแล้ว" },
|
{ id: "SEND_INVESTIGATE", name: "มีมูลส่งไปสืบสวนแล้ว" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง status เป็น Text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
|
function statusTothai(val: string) {
|
||||||
|
switch (val) {
|
||||||
|
case "NEW":
|
||||||
|
return "ใหม่";
|
||||||
|
case "STOP":
|
||||||
|
return "ยุติเรื่อง";
|
||||||
|
case "SEND_INVESTIGATE":
|
||||||
|
return "มีมูลส่งไปสืบสวนแล้ว";
|
||||||
|
default:
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง option ที่รับมาเป็น ไทย
|
||||||
|
* @param val ค่าที่ได้จาก API
|
||||||
|
* @returns ส่ง name ที่ id ตรงกันออกไป
|
||||||
|
*/
|
||||||
function levelConsiderationTran(val: string) {
|
function levelConsiderationTran(val: string) {
|
||||||
return (
|
return (
|
||||||
levelConsiderationtOptions.value.find((v: any) => v.id === val)?.name ??
|
levelConsiderationtOptions.value.find((v: any) => v.id === val)?.name ??
|
||||||
|
|
@ -81,11 +90,21 @@ export const useComplainstDataStore = defineStore(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectComplainantTpye(list: any) {
|
/**
|
||||||
|
* ฟังชั่น เก็บค่า options โดยแบ่งเก็บไว้ ตัวหลัก กับตัวรอง
|
||||||
|
* @param list ชุดข้อมูล options
|
||||||
|
*/
|
||||||
|
function selectComplainantType(list: any) {
|
||||||
optionListNameMain.value = list;
|
optionListNameMain.value = list;
|
||||||
optionListName.value = list;
|
optionListName.value = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟิลเตอร์ตาม text ใน input
|
||||||
|
* @param val text
|
||||||
|
* @param update ฟังชั่น qursar
|
||||||
|
* @param type ค่า type ที่กำหนดไว้เอาไว้ แยกประเภท
|
||||||
|
*/
|
||||||
function filterSelector(val: string, update: Function, type: string) {
|
function filterSelector(val: string, update: Function, type: string) {
|
||||||
update(() => {
|
update(() => {
|
||||||
const needle = val.toLowerCase();
|
const needle = val.toLowerCase();
|
||||||
|
|
@ -105,6 +124,10 @@ export const useComplainstDataStore = defineStore(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ดึงข้อมูล เฉพาะ สังกัด โดย เก็บ id/name
|
||||||
|
* @param data ชุดข้อมูลรวม
|
||||||
|
*/
|
||||||
function ocListFn(data: ocListType[]) {
|
function ocListFn(data: ocListType[]) {
|
||||||
let dataList: DataOption[] = data.map((item: ocListType) => ({
|
let dataList: DataOption[] = data.map((item: ocListType) => ({
|
||||||
id: item.organizationId,
|
id: item.organizationId,
|
||||||
|
|
@ -118,7 +141,7 @@ export const useComplainstDataStore = defineStore(
|
||||||
visibleColumns,
|
visibleColumns,
|
||||||
columns,
|
columns,
|
||||||
fetchComplainst,
|
fetchComplainst,
|
||||||
selectComplainantTpye,
|
selectComplainantType,
|
||||||
filterSelector,
|
filterSelector,
|
||||||
complainantoptions,
|
complainantoptions,
|
||||||
consideredAgencytoptions,
|
consideredAgencytoptions,
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,10 @@ export const useDisciplineDirectorDataStore = defineStore(
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// ข้อมูลในตาราง
|
/**
|
||||||
|
* เก็บข้อมูลที่ได้จาก API เเล้วจัดเรียง
|
||||||
|
* @param data ข้อมูลจาก API
|
||||||
|
*/
|
||||||
function fetchData(data: DirectorRows[]) {
|
function fetchData(data: DirectorRows[]) {
|
||||||
const dataList: DirectorRowsResponse[] = data.map(
|
const dataList: DirectorRowsResponse[] = data.map(
|
||||||
(item: DirectorRows) => ({
|
(item: DirectorRows) => ({
|
||||||
|
|
|
||||||
|
|
@ -253,11 +253,20 @@ export const useInvestigateDisStore = defineStore(
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง status จาก id
|
||||||
|
* @param val id ที่รับมาจาก API เเล้วมาทำการ find จาก id
|
||||||
|
* @returns name
|
||||||
|
*/
|
||||||
function convertStatus(val: string) {
|
function convertStatus(val: string) {
|
||||||
const result = statusOps.value.find((x: any) => x.id == val)?.name;
|
const result = statusOps.value.find((x: any) => x.id == val)?.name;
|
||||||
return result ? result : "-";
|
return result ? result : "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* จัดเรียงข้อมูลจาก API
|
||||||
|
* @param data ข้อมูลจาก API
|
||||||
|
*/
|
||||||
async function fetchList(data: investigateDisDataRowType[]) {
|
async function fetchList(data: investigateDisDataRowType[]) {
|
||||||
let datalist: any[] = data.map((e: any) => ({
|
let datalist: any[] = data.map((e: any) => ({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
|
|
@ -274,6 +283,10 @@ export const useInvestigateDisStore = defineStore(
|
||||||
rows.value = datalist;
|
rows.value = datalist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* จัดเรียงข้อมูล กรรมการ จาก API
|
||||||
|
* @param data ข้อมูลจาก API
|
||||||
|
*/
|
||||||
async function fecthDirector(data: directorType[]) {
|
async function fecthDirector(data: directorType[]) {
|
||||||
let datalistDirector: responseType[] = data.map((e: directorType) => ({
|
let datalistDirector: responseType[] = data.map((e: directorType) => ({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
|
|
@ -290,6 +303,11 @@ export const useInvestigateDisStore = defineStore(
|
||||||
// console.log(rows2.value);
|
// console.log(rows2.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง status เป็น text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
function convertRespondentType(val: string) {
|
function convertRespondentType(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "PERSON":
|
case "PERSON":
|
||||||
|
|
@ -301,6 +319,11 @@ export const useInvestigateDisStore = defineStore(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง status เป็น text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
function convertFault(val: string) {
|
function convertFault(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "NOT_SPECIFIED":
|
case "NOT_SPECIFIED":
|
||||||
|
|
@ -314,6 +337,12 @@ export const useInvestigateDisStore = defineStore(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟิลเตอร์ข้อมูลจาก input
|
||||||
|
* @param val ค่าที่ป้อนให้ input
|
||||||
|
* @param update function จาก quasar
|
||||||
|
* @param type type ที่กำหนด ของ input นั้นๆ
|
||||||
|
*/
|
||||||
function filterFnOptionsType(
|
function filterFnOptionsType(
|
||||||
val: string | number,
|
val: string | number,
|
||||||
update: any,
|
update: any,
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,7 @@ const mixin = useCounterMixin();
|
||||||
const { date2Thai } = mixin;
|
const { date2Thai } = mixin;
|
||||||
const organizationIdOp = ref<DataOption[]>([]);
|
const organizationIdOp = ref<DataOption[]>([]);
|
||||||
const consideredAgencytoptions = ref<DataOption[]>([]);
|
const consideredAgencytoptions = ref<DataOption[]>([]);
|
||||||
function ocListFn(data: ocListType[]) {
|
|
||||||
let dataList: DataOption[] = data.map((item: ocListType) => ({
|
|
||||||
id: item.organizationId,
|
|
||||||
name: item.organizationName,
|
|
||||||
}));
|
|
||||||
consideredAgencytoptions.value = dataList;
|
|
||||||
organizationIdOp.value = dataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** store ของข้อมูลสืบสวนข้อเท็จจริง */
|
/*** store ของข้อมูลสืบสวนข้อเท็จจริง */
|
||||||
export const useInvestigateFactStore = defineStore(
|
export const useInvestigateFactStore = defineStore(
|
||||||
|
|
@ -177,6 +170,25 @@ export const useInvestigateFactStore = defineStore(
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ดึงข้อมูล เฉพาะ สังกัด โดย เก็บ id/name
|
||||||
|
* @param data ชุดข้อมูลรวม
|
||||||
|
*/
|
||||||
|
function ocListFn(data: ocListType[]) {
|
||||||
|
let dataList: DataOption[] = data.map((item: ocListType) => ({
|
||||||
|
id: item.organizationId,
|
||||||
|
name: item.organizationName,
|
||||||
|
}));
|
||||||
|
consideredAgencytoptions.value = dataList;
|
||||||
|
organizationIdOp.value = dataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟิลเตอร์ข้อมูลจาก input
|
||||||
|
* @param val ค่าที่ป้อนให้ input
|
||||||
|
* @param update function จาก quasar
|
||||||
|
* @param type type ที่กำหนด ของ input นั้นๆ
|
||||||
|
*/
|
||||||
function filterFnOptionsType(
|
function filterFnOptionsType(
|
||||||
val: string | number,
|
val: string | number,
|
||||||
update: any,
|
update: any,
|
||||||
|
|
@ -199,7 +211,12 @@ export const useInvestigateFactStore = defineStore(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟิลเตอร์ข้อมูลจาก input
|
||||||
|
* @param val ค่าที่ป้อนให้ input
|
||||||
|
* @param update function จาก quasar
|
||||||
|
* @param type type ที่กำหนด ของ input นั้นๆ
|
||||||
|
*/
|
||||||
function filterSelector(val: string, update: Function, type: string) {
|
function filterSelector(val: string, update: Function, type: string) {
|
||||||
console.log(val);
|
console.log(val);
|
||||||
update(() => {
|
update(() => {
|
||||||
|
|
@ -213,6 +230,11 @@ export const useInvestigateFactStore = defineStore(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* จัดเรียงข้อมูลจาก API
|
||||||
|
* @param data ข้อมูลจาก API
|
||||||
|
*/
|
||||||
async function fecthList(data: ListData[]) {
|
async function fecthList(data: ListData[]) {
|
||||||
rows.value = await data.map((e: ListData) => {
|
rows.value = await data.map((e: ListData) => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -227,15 +249,20 @@ export const useInvestigateFactStore = defineStore(
|
||||||
e.investigationDateEnd
|
e.investigationDateEnd
|
||||||
)}`
|
)}`
|
||||||
: "-",
|
: "-",
|
||||||
investigationStatusResult:e.investigationStatusResult ? mainStore.convertStatusResult(
|
investigationStatusResult: e.investigationStatusResult ? mainStore.convertStatusResult(
|
||||||
e.investigationStatusResult
|
e.investigationStatusResult
|
||||||
):'-',
|
) : '-',
|
||||||
createdAt: e.createdAt ? date2Thai(e.createdAt as Date):'-',
|
createdAt: e.createdAt ? date2Thai(e.createdAt as Date) : '-',
|
||||||
status: e.status ? convertStatus(e.status):'-',
|
status: e.status ? convertStatus(e.status) : '-',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง status เป็น text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
function convertInvestigationDetail(val: string) {
|
function convertInvestigationDetail(val: string) {
|
||||||
const result = investigationDetailOps.value.find(
|
const result = investigationDetailOps.value.find(
|
||||||
(x: any) => x.id == val
|
(x: any) => x.id == val
|
||||||
|
|
@ -243,6 +270,11 @@ export const useInvestigateFactStore = defineStore(
|
||||||
return result ? result : "-";
|
return result ? result : "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง status เป็น text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
function convertStatus(val: string) {
|
function convertStatus(val: string) {
|
||||||
const result = faultOps.value.find((x: any) => x.id == val)?.name;
|
const result = faultOps.value.find((x: any) => x.id == val)?.name;
|
||||||
return result ? result : "-";
|
return result ? result : "-";
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,12 @@ export const useReportDataStore = defineStore("DisciplineReport11", () => {
|
||||||
{ id: "8", name: "รายงานจำนวนข้าราชการสามัญฯ ที่กระทำความผิดทางวินัยแต่ยุติเรื่อง แยกตามตำแหน่ง" },
|
{ id: "8", name: "รายงานจำนวนข้าราชการสามัญฯ ที่กระทำความผิดทางวินัยแต่ยุติเรื่อง แยกตามตำแหน่ง" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟิลเตอร์ข้อมูลจาก input
|
||||||
|
* @param val ค่าที่ป้อนให้ input
|
||||||
|
* @param update function จาก quasar
|
||||||
|
* @param type type ที่กำหนด ของ input นั้นๆ
|
||||||
|
*/
|
||||||
function filterFnOptionsType(val: string, update: any, type: string) {
|
function filterFnOptionsType(val: string, update: any, type: string) {
|
||||||
update(() => {
|
update(() => {
|
||||||
const needle = val.toLowerCase();
|
const needle = val.toLowerCase();
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,12 @@ export const useDisciplineResultStore = defineStore(
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟิลเตอร์ข้อมูลจาก input
|
||||||
|
* @param val ค่าที่ป้อนให้ input
|
||||||
|
* @param update function จาก quasar
|
||||||
|
* @param type type ที่กำหนด ของ input นั้นๆ
|
||||||
|
*/
|
||||||
function filterSelector(val: string, update: Function, type: string) {
|
function filterSelector(val: string, update: Function, type: string) {
|
||||||
update(() => {
|
update(() => {
|
||||||
const needle = val.toLowerCase();
|
const needle = val.toLowerCase();
|
||||||
|
|
@ -256,6 +262,10 @@ export const useDisciplineResultStore = defineStore(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* จัดเรียงข้อมูลจาก API
|
||||||
|
* @param data ข้อมูลจาก API
|
||||||
|
*/
|
||||||
async function fetchList(data: DataResult[]) {
|
async function fetchList(data: DataResult[]) {
|
||||||
const datalist: DataResultList[] = data.map((e: DataResult) => ({
|
const datalist: DataResultList[] = data.map((e: DataResult) => ({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
|
|
@ -282,7 +292,11 @@ export const useDisciplineResultStore = defineStore(
|
||||||
rows.value = datalist;
|
rows.value = datalist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function สถานะ*/
|
/**
|
||||||
|
* แปลง status เป็น text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
function convertStatus(val: string) {
|
function convertStatus(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "DONE":
|
case "DONE":
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ export const useDisciplineSuspendStore = defineStore(
|
||||||
{ id: "DEADLY", name: "ร้ายแรง" },
|
{ id: "DEADLY", name: "ร้ายแรง" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* จัดเรียงข้อมูลจาก API
|
||||||
|
* @param data ข้อมูลจาก API
|
||||||
|
*/
|
||||||
function getData(data: listData[]) {
|
function getData(data: listData[]) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
const dataList: dataType[] = data.map((item: listData) => ({
|
const dataList: dataType[] = data.map((item: listData) => ({
|
||||||
|
|
@ -49,6 +53,11 @@ export const useDisciplineSuspendStore = defineStore(
|
||||||
rows.value = dataList
|
rows.value = dataList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง status เป็น text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
const statusTothai = (val: string) => {
|
const statusTothai = (val: string) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "WAITTING":
|
case "WAITTING":
|
||||||
|
|
@ -68,10 +77,6 @@ export const useDisciplineSuspendStore = defineStore(
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function convertOffenseDetails(val: string) {
|
|
||||||
const result = offenseDetailsOps.value.find((x: any) => x.id == val)?.name;
|
|
||||||
return result ? result : "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
rows,
|
rows,
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,11 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
||||||
"organization",
|
"organization",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง option ที่รับมาเป็น ไทย
|
||||||
|
* @param val ค่าที่ได้จาก API
|
||||||
|
* @returns ส่ง name ที่ id ตรงกันออกไป
|
||||||
|
*/
|
||||||
function convertComplaintType(val: string) {
|
function convertComplaintType(val: string) {
|
||||||
const result = complainantoptionsMain.value.find(
|
const result = complainantoptionsMain.value.find(
|
||||||
(x: any) => x.id == val
|
(x: any) => x.id == val
|
||||||
|
|
@ -224,7 +229,11 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
||||||
return result ? result : "-";
|
return result ? result : "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function ลักษณะความผิด*/
|
/**
|
||||||
|
* แปลง status เป็น text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
function convertFault(val: string) {
|
function convertFault(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "NOT_SPECIFIED":
|
case "NOT_SPECIFIED":
|
||||||
|
|
@ -238,7 +247,11 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function สถานะ*/
|
/**
|
||||||
|
* แปลง status เป็น text
|
||||||
|
* @param val status
|
||||||
|
* @returns text
|
||||||
|
*/
|
||||||
function convertStatus(val: string) {
|
function convertStatus(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "NEW":
|
case "NEW":
|
||||||
|
|
@ -252,12 +265,22 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง option ที่รับมาเป็น ไทย
|
||||||
|
* @param val ค่าที่ได้จาก API
|
||||||
|
* @returns ส่ง name ที่ id ตรงกันออกไป
|
||||||
|
*/
|
||||||
function convertOffenseDetailst(val: string) {
|
function convertOffenseDetailst(val: string) {
|
||||||
return (
|
return (
|
||||||
offenseDetailstOptions.value.find((x: any) => x.id == val)?.name ?? "-"
|
offenseDetailstOptions.value.find((x: any) => x.id == val)?.name ?? "-"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* แปลง option ที่รับมาเป็น ไทย
|
||||||
|
* @param val ค่าที่ได้จาก API
|
||||||
|
* @returns ส่ง name ที่ id ตรงกันออกไป
|
||||||
|
*/
|
||||||
function convertStatusResult(val: string) {
|
function convertStatusResult(val: string) {
|
||||||
const result = statusResultOptions.value.find(
|
const result = statusResultOptions.value.find(
|
||||||
(x: any) => x.id == val
|
(x: any) => x.id == val
|
||||||
|
|
@ -265,7 +288,10 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
||||||
return result ? result : "-";
|
return result ? result : "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* จัดเก็บข้อมูลไว้ เพื่อใช้ใน POPUP
|
||||||
|
* @param data ข้อมูลรายการบุคคล
|
||||||
|
*/
|
||||||
function fetchData(data: ArrayPersonAdd[]) {
|
function fetchData(data: ArrayPersonAdd[]) {
|
||||||
rowsAdd.value = data;
|
rowsAdd.value = data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue