comment code ส่วนเครื่องราช
This commit is contained in:
parent
e9b7cddf09
commit
7371689594
7 changed files with 745 additions and 766 deletions
|
|
@ -1,17 +1,22 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted } from "vue";
|
||||
import { QForm, useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** impotrType */
|
||||
import type { DataOption } from "@/modules/04_registry/components/profileType";
|
||||
import type { ItemType } from "@/modules/07_insignia/interface/request/Main";
|
||||
|
||||
/** impotrComponents */
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/** impotrStores */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useBrrowDataStore } from "@/modules/07_insignia/storeBrrow";
|
||||
|
||||
const $q = useQuasar();
|
||||
const myForm = ref<QForm>();
|
||||
|
||||
const DataStore = useBrrowDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
|
|
@ -39,17 +44,6 @@ const insigniaNoteProfileId = ref<string>("");
|
|||
const filterSelectRound = ref<any>();
|
||||
const selectRound = ref<any>();
|
||||
const type = ref<any>(DataStore.type);
|
||||
// เคลียร์ข้อมูลในฟอร์ม
|
||||
const clearData = () => {
|
||||
receivedate.value = null;
|
||||
returndate.value = null;
|
||||
OrganazationId.value = "";
|
||||
roundNo.value = "";
|
||||
cardid.value = "";
|
||||
fullName.value = "";
|
||||
brand.value = "";
|
||||
reason.value = "";
|
||||
};
|
||||
|
||||
const props = defineProps({
|
||||
modal: Boolean,
|
||||
|
|
@ -89,23 +83,20 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
// เช็ค props ถ้าเปิด dialog ให้ดึงรายการข้อมูล
|
||||
watch(props, () => {
|
||||
// type.value = props.type;
|
||||
if (props.modal == true && props.roundId != "all") {
|
||||
roundNo.value = props.roundId;
|
||||
fecthlistInsignia();
|
||||
fetchOrgList();
|
||||
/** function เคลียร์ข้อมูลในฟอร์ม*/
|
||||
function clearData() {
|
||||
receivedate.value = null;
|
||||
returndate.value = null;
|
||||
OrganazationId.value = "";
|
||||
roundNo.value = "";
|
||||
cardid.value = "";
|
||||
fullName.value = "";
|
||||
brand.value = "";
|
||||
reason.value = "";
|
||||
}
|
||||
|
||||
// ดึงข้อมูลการยืม-คืนมาแสดงเก็บไว้ก่อนเผื่อต้องเอาข้อมูลมาแสดงเพิ่ม
|
||||
// if (props.action == "editData") {
|
||||
// fetchData();
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
// ดึงข้อมูลรายการเครื่องราช
|
||||
const fecthlistInsignia = async () => {
|
||||
/** function เรียกข้อมูลรายการเครื่องราช */
|
||||
async function fecthlistInsignia() {
|
||||
if (roundNo.value !== "" && roundNo.value !== null) {
|
||||
showLoader();
|
||||
let data = {
|
||||
|
|
@ -130,10 +121,10 @@ const fecthlistInsignia = async () => {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// ดึงข้อมูลรายการหน่วยงาน
|
||||
const fetchOrgList = async () => {
|
||||
/** function ดึงข้อมูลรายการหน่วยงาน */
|
||||
async function fetchOrgList() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.typeOc())
|
||||
|
|
@ -142,18 +133,8 @@ const fetchOrgList = async () => {
|
|||
id: e.organizationId,
|
||||
name: e.organizationName,
|
||||
}));
|
||||
// if (props.action == "editData") {
|
||||
// OrgList.value = [
|
||||
// {
|
||||
// id: "00000000-0000-0000-0000-000000000000",
|
||||
// name: "สำนักนายกรัฐมนตรี",
|
||||
// },
|
||||
// ...orgArr,
|
||||
// ];
|
||||
// } else {
|
||||
OrgList.value = orgArr;
|
||||
filterOrgList.value = OrgList.value;
|
||||
// }
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -161,7 +142,7 @@ const fetchOrgList = async () => {
|
|||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// ดึงข้อมูลการยืม-คืนมาแสดงเก็บไว้ก่อนเผื่อต้องเอาข้อมูลมาแสดงเพิ่ม
|
||||
// const fetchData = async () => {
|
||||
|
|
@ -177,7 +158,9 @@ const fetchOrgList = async () => {
|
|||
// };
|
||||
|
||||
// บันทึกข้อมูลการยืม-คืน
|
||||
const clickSave = async () => {
|
||||
|
||||
/** function บันทึกการเพิ่มข้อมูล*/
|
||||
async function clickSave() {
|
||||
await myForm.value!.validate().then((result: boolean) => {
|
||||
if (result) {
|
||||
dialogConfirm($q, async () => {
|
||||
|
|
@ -219,10 +202,10 @@ const clickSave = async () => {
|
|||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// ค้นหาคนจากเลขประจำตัวประชาชน
|
||||
const searchcardid = async () => {
|
||||
/** function ค้นหาคนจากเลขประจำตัวประชาชน*/
|
||||
async function searchcardid() {
|
||||
if (cardid.value.length === 13) {
|
||||
showLoader();
|
||||
const node = await listPerson.value.find(
|
||||
|
|
@ -252,28 +235,31 @@ const searchcardid = async () => {
|
|||
clearReceiveDate();
|
||||
// OrganazationId.value = "";
|
||||
}
|
||||
};
|
||||
// watch(cardid,()=>{
|
||||
// if(cardid.value.length === 13)
|
||||
}
|
||||
|
||||
// })
|
||||
|
||||
// ปิด dialog
|
||||
const closeDialog = () => {
|
||||
/** function closePopup*/
|
||||
function closeDialog() {
|
||||
clearData();
|
||||
props.close();
|
||||
};
|
||||
}
|
||||
|
||||
// reset วันที่ยืม
|
||||
const clearReceiveDate = () => {
|
||||
/** function reset วันที่ยืม*/
|
||||
function clearReceiveDate() {
|
||||
receivedate.value = null;
|
||||
};
|
||||
}
|
||||
|
||||
// reset วันที่คืน
|
||||
const clearReturnDate = () => {
|
||||
/** function reset วันที่คืน*/
|
||||
function clearReturnDate() {
|
||||
returndate.value = null;
|
||||
};
|
||||
const filterSelector = (val: any, update: Function, name: any) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* function ค้นหาข้อมูลใน option
|
||||
* @param val คำค้นหา
|
||||
* @param update function
|
||||
* @param name ชื่อ Selec
|
||||
*/
|
||||
function filterSelector(val: any, update: Function, name: any) {
|
||||
update(() => {
|
||||
const needle = val.toLowerCase();
|
||||
if (name === "filterOrgList") {
|
||||
|
|
@ -289,14 +275,28 @@ const filterSelector = (val: any, update: Function, name: any) => {
|
|||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/** function setValue*/
|
||||
const setValue = () => {
|
||||
filterSelectRound.value = props.filterSelectRoundOption;
|
||||
selectRound.value = props.selectRoundOption;
|
||||
};
|
||||
|
||||
/** Hook*/
|
||||
onMounted(() => {
|
||||
setValue();
|
||||
});
|
||||
|
||||
/** function callback เช็ค props ถ้าเปิด dialog ให้ดึงรายการข้อมูล */
|
||||
watch(props, () => {
|
||||
// type.value = props.type;
|
||||
if (props.modal == true && props.roundId != "all") {
|
||||
roundNo.value = props.roundId;
|
||||
fecthlistInsignia();
|
||||
fetchOrgList();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -1,116 +1,27 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useBrrowDataStore } from "@/modules/07_insignia/storeBrrow";
|
||||
|
||||
import DialogForm from "@/modules/07_insignia/components/5_Borrow/DialogForm.vue";
|
||||
|
||||
/** impotrType */
|
||||
import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main";
|
||||
import type { QTableProps, QInput } from "quasar";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
/** impotrComponents */
|
||||
import DialogForm from "@/modules/07_insignia/components/5_Borrow/DialogForm.vue";
|
||||
|
||||
/** impotrStores */
|
||||
import { useBrrowDataStore } from "@/modules/07_insignia/storeBrrow";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
const DataStore = useBrrowDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError } = mixin;
|
||||
|
||||
const $q = useQuasar();
|
||||
const tab = ref<string>("");
|
||||
|
||||
const selectRound = ref<string>();
|
||||
const selectRoundOption = ref<OptionDataYear[]>([]);
|
||||
const filterSelectRoundOption = ref<any>([]);
|
||||
const selectRoundAllOption = ref<OptionDataYear[]>([]);
|
||||
const filterSelectRoundAllOption = ref<OptionDataYear[]>([]);
|
||||
const type = ref<any[]>(DataStore.type);
|
||||
const modal = ref<boolean>(false);
|
||||
const action = ref<string>("");
|
||||
const profileId = ref<string>("");
|
||||
const roundYear = ref<any>();
|
||||
const insigniaList = ref<any>([]);
|
||||
const fileterInsigniaList = ref<any>([]);
|
||||
const loadView = ref<boolean>(false);
|
||||
const employeeClassOps = ref<any>(DataStore.employeeClassOps);
|
||||
onMounted(async () => {
|
||||
await fecthRound();
|
||||
});
|
||||
// รอบการเสนอขอพระราชทานเครื่องราชฯ
|
||||
const fecthRound = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.noteround())
|
||||
.then(async (res) => {
|
||||
let data = res.data.result;
|
||||
if (data.length !== 0) {
|
||||
selectRoundAllOption.value = [
|
||||
{
|
||||
name: "ทั้งหมด",
|
||||
id: "0",
|
||||
year: 0,
|
||||
},
|
||||
];
|
||||
data.map((e: any) => {
|
||||
selectRoundOption.value.push({
|
||||
name: "รอบการเสนอขอพระราชทานเครื่องราชฯ ปี" + " " + (e.year + 543),
|
||||
id: e.id,
|
||||
year: e.year,
|
||||
});
|
||||
selectRoundAllOption.value.push({
|
||||
name: "รอบการเสนอขอพระราชทานเครื่องราชฯ ปี" + " " + (e.year + 543),
|
||||
id: e.id,
|
||||
year: e.year,
|
||||
});
|
||||
});
|
||||
filterSelectRoundAllOption.value = selectRoundAllOption.value;
|
||||
selectRound.value = data[0].id;
|
||||
filterSelectRoundOption.value = selectRoundOption.value;
|
||||
yearRound.value = data[0].year;
|
||||
roundYear.value = data[0].year;
|
||||
if (roundYear.value) {
|
||||
await fecthInsigniaType();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// เรียกประเภทเครื่องราชฯ
|
||||
const fecthInsignia = async () => {
|
||||
await http
|
||||
.get(config.API.insignia)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
DataStore.fetchDataInsignia(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(async () => {
|
||||
insigniaList.value = await DataStore.insigniaOp.filter(
|
||||
(x: any) => x.type == tab.value || x.type == ""
|
||||
);
|
||||
});
|
||||
};
|
||||
//ระดับเครื่องราชฯ Tab
|
||||
const fecthInsigniaType = async () => {
|
||||
await http(config.API.insigniaType)
|
||||
.then(async (res) => {
|
||||
let data = res.data.result;
|
||||
DataStore.fetchDatainsigniaType(data);
|
||||
tab.value = DataStore.insigniaType[0].name;
|
||||
loadView.value = true;
|
||||
await fecthInsignia();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {});
|
||||
};
|
||||
|
||||
/** ข้อมูล Table*/
|
||||
const visibleColumns = ref<String[]>([
|
||||
"no",
|
||||
"status",
|
||||
|
|
@ -324,24 +235,122 @@ const columns = ref<QTableProps["columns"]>([
|
|||
field: "",
|
||||
},
|
||||
]);
|
||||
|
||||
watch(tab, async () => {
|
||||
insigniaList.value = await DataStore.insigniaOp.filter(
|
||||
(x: any) => x.type == tab.value || x.type == ""
|
||||
);
|
||||
DataStore.insignia = "";
|
||||
fileterInsigniaList.value = insigniaList.value;
|
||||
fecthlistInsignia();
|
||||
const filterRef = ref<QInput>();
|
||||
const filter = ref<string>("");
|
||||
const pagination = ref({
|
||||
sortBy: "name",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const selectRound = ref<string>();
|
||||
const selectRoundOption = ref<OptionDataYear[]>([]);
|
||||
const filterSelectRoundOption = ref<any>([]);
|
||||
const selectRoundAllOption = ref<OptionDataYear[]>([]);
|
||||
const filterSelectRoundAllOption = ref<OptionDataYear[]>([]);
|
||||
const type = ref<any[]>(DataStore.type);
|
||||
const modal = ref<boolean>(false);
|
||||
const action = ref<string>("");
|
||||
const profileId = ref<string>("");
|
||||
const roundYear = ref<any>();
|
||||
const insigniaList = ref<any>([]);
|
||||
const fileterInsigniaList = ref<any>([]);
|
||||
const loadView = ref<boolean>(false);
|
||||
const employeeClassOps = ref<any>(DataStore.employeeClassOps);
|
||||
|
||||
/** function เรียกรอบการเสนอขอพระราชทานเครื่องราชฯ*/
|
||||
async function fecthRound() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.noteround())
|
||||
.then(async (res) => {
|
||||
let data = res.data.result;
|
||||
if (data.length !== 0) {
|
||||
selectRoundAllOption.value = [
|
||||
{
|
||||
name: "ทั้งหมด",
|
||||
id: "0",
|
||||
year: 0,
|
||||
},
|
||||
];
|
||||
data.map((e: any) => {
|
||||
selectRoundOption.value.push({
|
||||
name: "รอบการเสนอขอพระราชทานเครื่องราชฯ ปี" + " " + (e.year + 543),
|
||||
id: e.id,
|
||||
year: e.year,
|
||||
});
|
||||
selectRoundAllOption.value.push({
|
||||
name: "รอบการเสนอขอพระราชทานเครื่องราชฯ ปี" + " " + (e.year + 543),
|
||||
id: e.id,
|
||||
year: e.year,
|
||||
});
|
||||
});
|
||||
filterSelectRoundAllOption.value = selectRoundAllOption.value;
|
||||
selectRound.value = data[0].id;
|
||||
filterSelectRoundOption.value = selectRoundOption.value;
|
||||
yearRound.value = data[0].year;
|
||||
roundYear.value = data[0].year;
|
||||
if (roundYear.value) {
|
||||
await fecthInsigniaType();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** function เรียกประเภทเครื่องราชฯ*/
|
||||
async function fecthInsignia() {
|
||||
await http
|
||||
.get(config.API.insignia)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
DataStore.fetchDataInsignia(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(async () => {
|
||||
insigniaList.value = await DataStore.insigniaOp.filter(
|
||||
(x: any) => x.type == tab.value || x.type == ""
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/** function เรียกระดับเครื่องราชฯ Tab*/
|
||||
async function fecthInsigniaType() {
|
||||
await http(config.API.insigniaType)
|
||||
.then(async (res) => {
|
||||
let data = res.data.result;
|
||||
DataStore.fetchDatainsigniaType(data);
|
||||
tab.value = DataStore.insigniaType ? DataStore.insigniaType[0].name : "";
|
||||
loadView.value = true;
|
||||
await fecthInsignia();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
/** รอบการเสนอขอ*/
|
||||
const yearRound = ref<number>();
|
||||
// เลือกรอบ
|
||||
const selectorRound = async (round: number) => {
|
||||
/**
|
||||
* function เลือกรอบการเสนอขอ
|
||||
* @param round ปีการเสนอขอ
|
||||
*/
|
||||
async function selectorRound(round: number) {
|
||||
roundYear.value = round;
|
||||
await fecthlistInsignia();
|
||||
};
|
||||
// ราชชื่อการเสนอขอเครื่องราชฯ
|
||||
const fecthlistInsignia = async () => {
|
||||
}
|
||||
|
||||
/** function เรียกราชชื่อการเสนอขอเครื่องราชฯ */
|
||||
async function fecthlistInsignia() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
|
|
@ -356,48 +365,48 @@ const fecthlistInsignia = async () => {
|
|||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
const filterRef = ref<QInput>();
|
||||
const filter = ref<string>("");
|
||||
|
||||
const close = () => {
|
||||
/** function closePopup */
|
||||
function close() {
|
||||
modal.value = false;
|
||||
};
|
||||
}
|
||||
|
||||
const closeAndFecth = () => {
|
||||
/** function closePopup และเเรียกข้อมูลราชชื่อการเสนอขอเครื่องราชฯ */
|
||||
function closeAndFecth() {
|
||||
modal.value = false;
|
||||
fecthlistInsignia();
|
||||
};
|
||||
}
|
||||
|
||||
const addData = () => {
|
||||
/** function openPopup เพิ่มรายการ ยืม-คืนเครื่องราชฯ*/
|
||||
function addData() {
|
||||
modal.value = true;
|
||||
action.value = "addData";
|
||||
};
|
||||
}
|
||||
|
||||
const editData = (id: any) => {
|
||||
/**
|
||||
* function openPopup แก้ไขรายการ ยืม-คืนเครื่องราชฯ
|
||||
* @param id profileId
|
||||
*/
|
||||
function editData(id: any) {
|
||||
profileId.value = id;
|
||||
action.value = "editData";
|
||||
modal.value = true;
|
||||
};
|
||||
}
|
||||
|
||||
const resetFilter = () => {
|
||||
function resetFilter() {
|
||||
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
||||
filter.value = "";
|
||||
filterRef.value!.focus();
|
||||
};
|
||||
const pagination = ref({
|
||||
sortBy: "name",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const paging = ref<boolean>(true);
|
||||
const paginationLabel = (start: number, end: number, total: number) => {
|
||||
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
const filterSelector = (val: any, update: Function, name: any) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* function ค้นหาข้อมูลใน option
|
||||
* @param val คำค้นหา
|
||||
* @param update function
|
||||
* @param name ชื่อ Selec
|
||||
*/
|
||||
function filterSelector(val: any, update: Function, name: any) {
|
||||
update(() => {
|
||||
const needle = val.toLowerCase();
|
||||
if (name === "employeeClassOps") {
|
||||
|
|
@ -417,20 +426,32 @@ const filterSelector = (val: any, update: Function, name: any) => {
|
|||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
const clearInsigniaFilters = (name: string) => {
|
||||
if (name === "employeeClassOps") {
|
||||
DataStore.employeeClass = "all";
|
||||
employeeClassOps.value = DataStore.employeeClassOps;
|
||||
} else if (name === "fileterInsigniaList") {
|
||||
DataStore.insignia = "";
|
||||
fileterInsigniaList.value = insigniaList.value;
|
||||
}
|
||||
// else if (name === 'employeeClassOps') {
|
||||
// const clearInsigniaFilters = (name: string) => {
|
||||
// if (name === "employeeClassOps") {
|
||||
// DataStore.employeeClass = "all";
|
||||
// employeeClassOps.value = DataStore.employeeClassOps;
|
||||
// } else if (name === "fileterInsigniaList") {
|
||||
// DataStore.insignia = "";
|
||||
// fileterInsigniaList.value = insigniaList.value;
|
||||
// }
|
||||
// };
|
||||
|
||||
// }
|
||||
};
|
||||
/** Hook*/
|
||||
onMounted(async () => {
|
||||
await fecthRound();
|
||||
});
|
||||
|
||||
/** function callblack ทำงานเมือมีการเปลี่ยน Tab*/
|
||||
watch(tab, async () => {
|
||||
insigniaList.value = await DataStore.insigniaOp.filter(
|
||||
(x: any) => x.type == tab.value || x.type == ""
|
||||
);
|
||||
DataStore.insignia = "";
|
||||
fileterInsigniaList.value = insigniaList.value;
|
||||
fecthlistInsignia();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -650,7 +671,6 @@ const clearInsigniaFilters = (name: string) => {
|
|||
:visible-columns="visibleColumns"
|
||||
:filter="filter"
|
||||
row-key="id"
|
||||
:pagination-label="paginationLabel"
|
||||
v-model:pagination="pagination"
|
||||
:paging="true"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue