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