refactor code ส่วนของเครื่องราชฯ
This commit is contained in:
parent
33c2b338a2
commit
1ed9faebf2
11 changed files with 326 additions and 149 deletions
|
|
@ -33,7 +33,7 @@ const stat = ref<any>({
|
|||
contain: 0,
|
||||
disclaim: 0,
|
||||
});
|
||||
|
||||
// เรียกข้อมูล Stat
|
||||
const getStat = async () => {
|
||||
const examIdString = Array.isArray(examId) ? examId[0] : examId;
|
||||
await http
|
||||
|
|
@ -76,7 +76,7 @@ onMounted(async () => {
|
|||
|
||||
const fetchPlacementData = async () => {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.MainDetail(0))
|
||||
.then(async (res) => {
|
||||
DataStore.DataMainOrig = res.data.result;
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ const closeModal = () => {
|
|||
closeAndClear();
|
||||
}
|
||||
};
|
||||
|
||||
// clean ข้อมูล
|
||||
const closeAndClear = async () => {
|
||||
await props.close();
|
||||
editDataStatus.value = false;
|
||||
|
|
@ -346,7 +346,7 @@ const checkPosition = (val: string) => {
|
|||
};
|
||||
const personal = ref<any>();
|
||||
const expanded = ref<string[]>([]);
|
||||
|
||||
// เมื่อ props เปลี่ยนแปลงจะโหลดหน่วยงาน
|
||||
watch(props, () => {
|
||||
expanded.value = [];
|
||||
const dataPersonal = props.personal;
|
||||
|
|
@ -361,10 +361,10 @@ watch(props, () => {
|
|||
personal.value.draft === false &&
|
||||
personal.value.positionNumber !== null
|
||||
) {
|
||||
let findData: any = null;
|
||||
let findData: any = null;
|
||||
dataRespone.value.map((x: any) => {
|
||||
findData = findByPerson(x);
|
||||
|
||||
// ถ้ามีตำแต่งจะทำการ expandedTree
|
||||
if (findData != null) {
|
||||
selectedPosition(findData);
|
||||
for (let i = 3; i <= findData.keyId.length; i += 2) {
|
||||
|
|
@ -374,7 +374,7 @@ watch(props, () => {
|
|||
});
|
||||
}
|
||||
});
|
||||
// หาตำหน่วยงานที่เลือก
|
||||
// หาหน่วยงานที่เลือก
|
||||
function findByPerson(element: any): any {
|
||||
if (
|
||||
element.positionNumId &&
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||
const { showLoader, hideLoader, date2Thai } = mixin;
|
||||
const { showLoader, hideLoader, date2Thai, messageError } = mixin;
|
||||
const $q = useQuasar();
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -78,13 +78,13 @@ const columns = ref<QTableProps["columns"]>([
|
|||
const myForm = ref<any>([]);
|
||||
const personalForm = ref<any>([]);
|
||||
const selection = ref<any>([]);
|
||||
|
||||
// เมื่อ props.Modal จะเรียกข้อมูลการศึกษา
|
||||
watch(props, () => {
|
||||
if (props.Modal === true) {
|
||||
fetchData();
|
||||
}
|
||||
});
|
||||
|
||||
// ข้อมูลการศึกษา
|
||||
const fetchData = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -101,7 +101,7 @@ const fetchData = async () => {
|
|||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("e", e);
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
|
|
@ -120,7 +120,7 @@ const formBmaofficer = (val: string) => {
|
|||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
// ปิด POPUP ข้อมูล
|
||||
const close = async () => {
|
||||
props.close();
|
||||
selection.value = [];
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ const fecthlistRetire = async () => {
|
|||
messageError($q, e);
|
||||
});
|
||||
};
|
||||
// เรียกรายชื่อประกาศเกษียณอายุราชการเพิ่ม
|
||||
const findlist = async (id: string) => {
|
||||
let data = [{}];
|
||||
if (type.value === "officer") {
|
||||
|
|
@ -122,7 +123,7 @@ const findlist = async (id: string) => {
|
|||
});
|
||||
};
|
||||
|
||||
// putlist
|
||||
// ยืนยันการเพิ่มราชชื่อ
|
||||
const clickAdd = (props: any) => {
|
||||
if (retireld.value == undefined) {
|
||||
retireld.value = retireld_params;
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ const fecthlistprofile = async (id: string) => {
|
|||
statusReport.value = res.data.result.json;
|
||||
typeReport.value = res.data.result.typeReport;
|
||||
textReport.value = res.data.result.detail;
|
||||
// รายชื่อผู้เกษียณอายุราชการ
|
||||
rows.value = res.data.result.profile.map((e: any) => ({
|
||||
id: e.id,
|
||||
profileId: e.profileId,
|
||||
|
|
@ -266,6 +267,7 @@ const UpdateListId = (retireld: string, pId: string) => {
|
|||
profileId.value = pId;
|
||||
fecthlistprofile(retireld);
|
||||
};
|
||||
// กลับหน้าเดิม
|
||||
const backHistory = () => {
|
||||
window.history.back();
|
||||
};
|
||||
|
|
@ -274,6 +276,7 @@ const visibleNote = computed(() => {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
// อัปโหลดไฟล์
|
||||
const uploadFile = async (event: any) => {
|
||||
showLoader();
|
||||
const selectedFile = event;
|
||||
|
|
@ -294,7 +297,7 @@ const uploadFile = async (event: any) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
// downloadAttachment
|
||||
const downloadAttachment = async (type: string, id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -311,6 +314,7 @@ const downloadAttachment = async (type: string, id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
// downloadFile
|
||||
const downloadFile = (response: any, filename: string) => {
|
||||
const link = document.createElement("a");
|
||||
var fileName = filename;
|
||||
|
|
@ -320,7 +324,7 @@ const downloadFile = (response: any, filename: string) => {
|
|||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
|
||||
// ยืนยันการแก้ไขข้อมูล
|
||||
const saveEdiitReport = (reason: string) => {
|
||||
const formdata = new FormData();
|
||||
formdata.append("Detail", reason);
|
||||
|
|
@ -344,9 +348,11 @@ const saveEdiitReport = (reason: string) => {
|
|||
"ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
};
|
||||
// เปิด popup เหตุผล
|
||||
const openmodalEditReport = () => {
|
||||
modalEdit.value = true;
|
||||
};
|
||||
// ปิด popup เหตุผล
|
||||
const closemodalEditReport = () => {
|
||||
modalEdit.value = false;
|
||||
};
|
||||
|
|
@ -587,7 +593,7 @@ const paginationLabel = (start: number, end: number, total: number) => {
|
|||
<q-td class="table_ellipsis" key="bureau" :props="props">{{
|
||||
props.row.bureau
|
||||
}}</q-td>
|
||||
|
||||
<q-td auto-width></q-td>
|
||||
<q-td
|
||||
auto-width
|
||||
v-if="
|
||||
|
|
|
|||
|
|
@ -37,10 +37,11 @@ const options = ref([
|
|||
|
||||
onMounted(async () => {
|
||||
if (route.params.id) {
|
||||
// มี params id ให้ เรียกข้อมูลของรอบการเสนอขอ
|
||||
await fetchData();
|
||||
}
|
||||
});
|
||||
|
||||
// เรียกข้อมูลของรอบการเสนอขอ
|
||||
const fetchData = async () => {
|
||||
edit.value = true;
|
||||
showLoader();
|
||||
|
|
@ -77,7 +78,70 @@ const fileUploadDoc = async (files: any) => {
|
|||
const updateYear = async (e: number) => {
|
||||
yearly.value = e;
|
||||
};
|
||||
// แก้ไขข้อมูล
|
||||
|
||||
// คลิกบันทึก
|
||||
const checkSave = () => {
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then(async (success) => {
|
||||
if (success) {
|
||||
dialogConfirm($q, () => SaveData());
|
||||
} else if (Number(datelast.value) !== 0) {
|
||||
dialogMessageNotify($q, "กรุณาเลือกรอบการเสนอขอพระราชทานเครื่องราชฯ");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
// บันทึกข้อมูล
|
||||
const SaveData = async () => {
|
||||
if (edit.value) {
|
||||
await editData(id.value);
|
||||
} else {
|
||||
await addData();
|
||||
clickBack();
|
||||
}
|
||||
};
|
||||
// อัพเดทวันที่เริ่มต้น และ สิ้นสุด
|
||||
const updateDateRange = () => {
|
||||
if (roundInsig.value.value == 1) {
|
||||
dateStart.value = new Date(new Date().getFullYear(), 9, 1);
|
||||
dateEnd.value = new Date(new Date().getFullYear() + 1, 3, 29);
|
||||
} else if (roundInsig.value.value == 2) {
|
||||
dateStart.value = new Date(new Date().getFullYear(), 3, 29);
|
||||
dateEnd.value = new Date(new Date().getFullYear(), 4, 29);
|
||||
}
|
||||
};
|
||||
// เพิ่มข้อมูลรอบการเสนอขอพระราชทานเครื่องราชฯ
|
||||
const addData = async () => {
|
||||
const formData = new FormData();
|
||||
const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${
|
||||
roundInsig.value.value
|
||||
} ปี ${yearly.value + 543} `;
|
||||
formData.append("name", name);
|
||||
formData.append("year", yearly.value.toString());
|
||||
formData.append("amount", datelast.value.toString());
|
||||
formData.append("round", roundInsig.value.value);
|
||||
if (dateStart.value !== null) {
|
||||
formData.append("startDate", dateToISO(dateStart.value));
|
||||
}
|
||||
if (dateEnd.value !== null) {
|
||||
formData.append("endDate", dateToISO(dateEnd.value));
|
||||
}
|
||||
formData.append("file", files.value);
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.listRoundInsignia(), formData)
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// แก้ไขข้อมูล
|
||||
const editData = async (id: string) => {
|
||||
const formData = new FormData();
|
||||
const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${
|
||||
|
|
@ -108,66 +172,6 @@ const editData = async (id: string) => {
|
|||
clickBack();
|
||||
});
|
||||
};
|
||||
const checkSave = () => {
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then(async (success) => {
|
||||
if (success) {
|
||||
dialogConfirm($q, () => SaveData());
|
||||
} else {
|
||||
dialogMessageNotify($q, "กรุณาเลือกรอบการเสนอขอพระราชทานเครื่องราชฯ");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const SaveData = async () => {
|
||||
if (edit.value) {
|
||||
await editData(id.value);
|
||||
} else {
|
||||
await addData();
|
||||
clickBack();
|
||||
}
|
||||
};
|
||||
|
||||
const updateDateRange = () => {
|
||||
if (roundInsig.value.value == 1) {
|
||||
dateStart.value = new Date(new Date().getFullYear(), 9, 1);
|
||||
dateEnd.value = new Date(new Date().getFullYear() + 1, 3, 29);
|
||||
} else if (roundInsig.value.value == 2) {
|
||||
dateStart.value = new Date(new Date().getFullYear(), 3, 29);
|
||||
dateEnd.value = new Date(new Date().getFullYear(), 4, 29);
|
||||
}
|
||||
};
|
||||
|
||||
const addData = async () => {
|
||||
const formData = new FormData();
|
||||
const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${
|
||||
roundInsig.value.value
|
||||
} ปี ${yearly.value + 543} `;
|
||||
formData.append("name", name);
|
||||
formData.append("year", yearly.value.toString());
|
||||
formData.append("amount", datelast.value.toString());
|
||||
formData.append("round", roundInsig.value.value);
|
||||
if (dateStart.value !== null) {
|
||||
formData.append("startDate", dateToISO(dateStart.value));
|
||||
}
|
||||
if (dateEnd.value !== null) {
|
||||
formData.append("endDate", dateToISO(dateEnd.value));
|
||||
}
|
||||
formData.append("file", files.value);
|
||||
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.listRoundInsignia(), formData)
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const clickBack = () => {
|
||||
router.push({ name: "insigniaProposals" });
|
||||
|
|
@ -329,6 +333,11 @@ const clickBack = () => {
|
|||
v-model="datelast"
|
||||
label="จำนวนวันแจ้งเตือนก่อนวันสิ้นสุด"
|
||||
mask="###"
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val || `${'กรุณากรอกจำนวนวันแจ้งเตือนก่อนวันสิ้นสุด'}`,
|
||||
]"
|
||||
lazy-rules
|
||||
/>
|
||||
|
||||
<q-file
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
|
||||
// ข้อมูลตาราง (จำลอง)
|
||||
const rows = ref<FormProprsalsRound2[]>([]);
|
||||
|
||||
|
|
@ -118,11 +117,11 @@ const fetchData = async () => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
// redirect หน้าข้อมูลรอบการเสนอข้อ
|
||||
const clickEdit = (col: any) => {
|
||||
router.push(`/insignia/round-add/${col.period_id}`);
|
||||
};
|
||||
|
||||
// ยืนยันการลบรอบการเสนอขอ
|
||||
const clickDelete = (id: string) => {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
|
|
@ -144,15 +143,15 @@ const clickDelete = (id: string) => {
|
|||
const clickAdd = () => {
|
||||
router.push({ name: "roundAdd" });
|
||||
};
|
||||
|
||||
// คำนวณราชชื่อผู้ได้รับเครื่องราช
|
||||
const clickListInsignia = async (propsId: string) => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
await getRequest(propsId);
|
||||
},
|
||||
"ยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราช",
|
||||
"ต้องการยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราชนี้หรือไม่ ?"
|
||||
"ยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราชฯ",
|
||||
"ต้องการยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราชฯนี้หรือไม่ ?"
|
||||
);
|
||||
};
|
||||
// เรียกจาก API ข้อมูลผู้ได้รับเครื่องราชฯ
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ const checkStatus = computed(() => {
|
|||
return true;
|
||||
} else return false;
|
||||
});
|
||||
// เลืแกหน่วยงาน
|
||||
// เลือกหน่วยงาน
|
||||
const changtypeOc = () => {
|
||||
if (props.fecthInsigniaByOc) {
|
||||
props.fecthInsigniaByOc(
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ const clearAnnounceExam = () => {
|
|||
// reset วันที่ได้รับพระราชทานเครื่องราชอิสริยาภรณ์
|
||||
const clearDateReceivedate = () => {
|
||||
receivedate.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
// reset วันที่จ่ายใบกำกับ
|
||||
const clearDateInvoiceDate = () => {
|
||||
invoiceDate.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
const props = defineProps({
|
||||
modal: Boolean,
|
||||
|
|
@ -90,6 +90,7 @@ const props = defineProps({
|
|||
type: String,
|
||||
},
|
||||
});
|
||||
// เปิด popup เพิ่มราชชื่อบันทึกผล
|
||||
watch(props, () => {
|
||||
if (props.modal === true) {
|
||||
employeeClass.value = "";
|
||||
|
|
@ -111,7 +112,7 @@ watch(props, () => {
|
|||
payment.value = "";
|
||||
if (props.personId !== undefined) {
|
||||
if (props.action === "editData") {
|
||||
fectDataByid(props.personId);
|
||||
fectDataByid(props.personId); // เมือแก้ไข เรียกข้อมูลบันทึกผล
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -121,7 +122,7 @@ const disbleStatus = computed(() => {
|
|||
return false;
|
||||
} else return true;
|
||||
});
|
||||
|
||||
// เลือกประเภทลูกจ้าง
|
||||
const selectType = async () => {
|
||||
showLoader();
|
||||
cardid.value = "";
|
||||
|
|
@ -142,24 +143,27 @@ const selectType = async () => {
|
|||
payment.value = "";
|
||||
await fecthlistPerson();
|
||||
};
|
||||
|
||||
// เรียกหน่วยงาน
|
||||
const fecthlistPerson = async () => {
|
||||
await http
|
||||
.get(config.API.profileOrganizRoot)
|
||||
.then((res) => {
|
||||
const id = res.data.result[0].id;
|
||||
if (id !== "") {
|
||||
findlist(id);
|
||||
findlist(id); // id หน่วยงานไปเรียกราชชื่อ
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
};
|
||||
// เรียกราชชื่อลูกจ้างตาม id หน่วยงาน
|
||||
const findlist = async (id: string) => {
|
||||
let data = [{}];
|
||||
// ข้าราชการ
|
||||
if (employeeClass.value === "officer") {
|
||||
data = [{ criteriaType: "is_retire", criteriaValue: "false" }];
|
||||
// ลูกจ้างประจำ
|
||||
} else if (employeeClass.value === "employee") {
|
||||
data = [
|
||||
{ criteriaType: "is_retire", criteriaValue: "false" },
|
||||
|
|
@ -180,6 +184,7 @@ const findlist = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
// เรียกข้อมูลบันทึกผลตาม id
|
||||
const fectDataByid = async (id: string) => {
|
||||
showLoader();
|
||||
if (props.profileType !== undefined) {
|
||||
|
|
@ -215,6 +220,7 @@ const fectDataByid = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
// บักทึกผล
|
||||
const clickSave = async () => {
|
||||
let body = {
|
||||
citizanId: cardid.value, // เลขบัตร
|
||||
|
|
@ -233,6 +239,7 @@ const clickSave = async () => {
|
|||
typePayment: payment.value, // รูปแบบการจ่าย
|
||||
address: addressPayment.value, //ที่อยู่
|
||||
};
|
||||
// เช็คค่าว่าง
|
||||
await myForm.value!.validate().then((result: boolean) => {
|
||||
if (result) {
|
||||
dialogConfirm($q, async () => {
|
||||
|
|
@ -241,6 +248,7 @@ const clickSave = async () => {
|
|||
}
|
||||
});
|
||||
};
|
||||
// เพิ่มแก้ ข้อมูลบันทึกผล
|
||||
const addNote = async (body: any) => {
|
||||
if (props.roundId !== undefined) {
|
||||
await http
|
||||
|
|
@ -258,12 +266,13 @@ const addNote = async (body: any) => {
|
|||
});
|
||||
}
|
||||
};
|
||||
// หาเลขบัตรประจำตัวประชาชน
|
||||
const searchcardid = () => {
|
||||
if (cardid.value.length === 13) {
|
||||
let data = listPerson.value.find((e: any) => e.citizenId === cardid.value);
|
||||
if (data) {
|
||||
fullName.value = data.fullname;
|
||||
position.value = data.positionEmployeePosition;
|
||||
fullName.value = data.fullname; // ชื่อ
|
||||
position.value = data.positionEmployeePosition; // ตำแหน่ง
|
||||
} else notifyError($q, "ไม่พบข้อมูลเลขบัตรประชาชนนี้");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main"
|
|||
import type { QTableProps, QInput } from "quasar";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
|
||||
const DataStore = useAllocateDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, dialogRemove, success } = mixin;
|
||||
|
|
@ -47,7 +46,7 @@ const loadView = ref<boolean>(false);
|
|||
onMounted(async () => {
|
||||
await fecthRound();
|
||||
});
|
||||
|
||||
// เรียกรอบการเสนอขอ
|
||||
const fecthRound = async () => {
|
||||
await http
|
||||
.get(config.API.noteround())
|
||||
|
|
@ -78,7 +77,7 @@ const fecthRound = async () => {
|
|||
messageError($q, err);
|
||||
});
|
||||
};
|
||||
|
||||
// ประเภทเครื่องราช
|
||||
const fecthInsignia = async () => {
|
||||
await http
|
||||
.get(config.API.insignia)
|
||||
|
|
@ -95,7 +94,7 @@ const fecthInsignia = async () => {
|
|||
);
|
||||
});
|
||||
};
|
||||
|
||||
// tab
|
||||
const fecthInsigniaType = async () => {
|
||||
await http(config.API.insigniaType)
|
||||
.then((res) => {
|
||||
|
|
@ -167,6 +166,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
// เมื่อเปลี่ยน tab
|
||||
watch(tab, () => {
|
||||
insigniaOp.value = DataStore.insigniaOp.filter(
|
||||
(x: any) => x.type == tab.value || x.type === ""
|
||||
|
|
@ -178,23 +178,25 @@ watch(tab, () => {
|
|||
fecthlistInsignia();
|
||||
});
|
||||
|
||||
// เลือกรอบการเสนขอ
|
||||
const selectorRound = (round: string | undefined) => {
|
||||
selectRound.value = round;
|
||||
if (selectRound.value) {
|
||||
DataStore.roundId = selectRound.value;
|
||||
}
|
||||
const yearFilter = selectRoundOption.value.find((x: any) => x.id == round);
|
||||
const yearFilter = selectRoundOption.value.find((x: any) => x.id == round); // หาปีของรอบการเสนอขอ
|
||||
roundYear.value = yearFilter?.year;
|
||||
DataStore.roundYear = roundYear.value;
|
||||
fecthlistInsignia();
|
||||
};
|
||||
|
||||
// เรียกรายการเครืองราชฯ
|
||||
const fecthlistInsignia = async () => {
|
||||
DataStore.mainTab = tab.value;
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.insigniaManageType(tab.value, Number(roundYear.value)))
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
let data = res.data.result;
|
||||
DataStore.listinsignia(data);
|
||||
})
|
||||
|
|
@ -213,7 +215,7 @@ const close = () => {
|
|||
modal.value = false;
|
||||
modalEdit.value = false;
|
||||
};
|
||||
|
||||
// เปิด popup การเพิ่มการจัดสรรเครื่องราชฯ
|
||||
const addData = () => {
|
||||
modal.value = true;
|
||||
action.value = "addData";
|
||||
|
|
@ -227,7 +229,7 @@ const clickEditrow = (data: any) => {
|
|||
modalEdit.value = true;
|
||||
actionType.value = "insignia";
|
||||
};
|
||||
|
||||
// บันทึกการเพิ่มการจัดสรรเครื่องราชฯ
|
||||
const save = async (insigniaId: string, total: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -248,6 +250,7 @@ const save = async (insigniaId: string, total: string) => {
|
|||
close();
|
||||
});
|
||||
};
|
||||
// แก้ไขการจัดสรรเครื่องราชฯ
|
||||
const saveEdit = async (
|
||||
id: string,
|
||||
insigniaId: string,
|
||||
|
|
@ -274,6 +277,7 @@ const saveEdit = async (
|
|||
close();
|
||||
});
|
||||
};
|
||||
// ลบการจัดสรรเครื่องราชฯ
|
||||
const clickDelete = async (insigniaId: string) => {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
|
|
@ -303,16 +307,42 @@ const resetFilter = () => {
|
|||
<div class="toptitle text-dark col-12 row items-center">
|
||||
จัดสรรเครื่องราชอิสริยาภรณ์
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 q-my-md q-mt-sm rounded-borders" v-if="loadView">
|
||||
<q-card
|
||||
flat
|
||||
bordered
|
||||
class="col-12 q-my-md q-mt-sm rounded-borders"
|
||||
v-if="loadView"
|
||||
>
|
||||
<div class="bg-grey-1 col-12 row items-center">
|
||||
<div class="q-pl-md q-pr-sm text-weight-medium text-grey-7">รอบ</div>
|
||||
<q-select hide-bottom-space borderless dense lazy-rules emit-value map-options options-dense option-label="name"
|
||||
option-value="id" v-model="selectRound" :options="selectRoundOption" use-input input-debounce="0"
|
||||
input-class="text-bold text-grey" @update:model-value="selectorRound(selectRound)">
|
||||
<q-select
|
||||
hide-bottom-space
|
||||
borderless
|
||||
dense
|
||||
lazy-rules
|
||||
emit-value
|
||||
map-options
|
||||
options-dense
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="selectRound"
|
||||
:options="selectRoundOption"
|
||||
use-input
|
||||
input-debounce="0"
|
||||
input-class="text-bold text-grey"
|
||||
@update:model-value="selectorRound(selectRound)"
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
<q-separator />
|
||||
<q-tabs dense v-model="tab" align="left" class="bg-white text-grey" active-color="primary" indicator-color="primary">
|
||||
<q-tabs
|
||||
dense
|
||||
v-model="tab"
|
||||
align="left"
|
||||
class="bg-white text-grey"
|
||||
active-color="primary"
|
||||
indicator-color="primary"
|
||||
>
|
||||
<div v-for="item in DataStore.insigniaType">
|
||||
<q-tab :name="item.name" :label="item.label" />
|
||||
</div>
|
||||
|
|
@ -320,41 +350,105 @@ const resetFilter = () => {
|
|||
|
||||
<q-separator />
|
||||
<q-tab-panels v-model="tab" animated>
|
||||
<q-tab-panel v-for="item in DataStore.insigniaType" :key="item.name" :name="item.name" class="q-pa-none">
|
||||
<q-tab-panel
|
||||
v-for="item in DataStore.insigniaType"
|
||||
:key="item.name"
|
||||
:name="item.name"
|
||||
class="q-pa-none"
|
||||
>
|
||||
<div class="q-pa-md">
|
||||
<div class="row col-12 q-pb-sm q-col-gutter-x-xs">
|
||||
<div>
|
||||
<q-select v-model="DataStore.insignia" dense outlined lazy-rules hide-bottom-space
|
||||
:label="`${'เครื่องราชฯ'}`" emit-value map-options option-label="name" :options="insigniaOp"
|
||||
option-value="id" :readonly="false" :borderless="false" style="min-width: 200px" @update:model-value="
|
||||
<q-select
|
||||
v-model="DataStore.insignia"
|
||||
dense
|
||||
outlined
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:label="`${'เครื่องราชฯ'}`"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="insigniaOp"
|
||||
option-value="id"
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
style="min-width: 200px"
|
||||
@update:model-value="
|
||||
DataStore.selectInsignia(DataStore.insignia)
|
||||
" />
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<q-btn @click="addData()" size="12px" flat round color="add" icon="mdi-plus">
|
||||
<q-btn
|
||||
@click="addData()"
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="add"
|
||||
icon="mdi-plus"
|
||||
>
|
||||
<q-tooltip>เพิ่ม</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
<q-space />
|
||||
<div class="items-center" style="display: flex">
|
||||
<!-- ค้นหาข้อความใน table -->
|
||||
<q-input standout dense v-model="filter" ref="filterRef" outlined debounce="300" placeholder="ค้นหา"
|
||||
style="max-width: 200px" class="q-ml-sm">
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
v-model="filter"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
style="max-width: 200px"
|
||||
class="q-ml-sm"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filter == ''" name="search" />
|
||||
<q-icon v-if="filter !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
|
||||
<q-icon
|
||||
v-if="filter !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
<!-- แสดงคอลัมน์ใน table -->
|
||||
<q-select v-model="visibleColumns" :display-value="$q.lang.table.columns" multiple outlined dense
|
||||
:options="columns" options-dense option-value="name" map-options emit-value style="min-width: 150px"
|
||||
class="gt-xs q-ml-sm" />
|
||||
<q-select
|
||||
v-model="visibleColumns"
|
||||
:display-value="$q.lang.table.columns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
:options="columns"
|
||||
options-dense
|
||||
option-value="name"
|
||||
map-options
|
||||
emit-value
|
||||
style="min-width: 150px"
|
||||
class="gt-xs q-ml-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<d-table ref="table" :columns="columns" :rows="DataStore.rows" :filter="filter" row-key="id" flat bordered
|
||||
:paging="true" dense class="custom-header-table" v-bind="attrs" :visible-columns="visibleColumns"
|
||||
:pagination-label="paginationLabel" v-model:pagination="pagination">
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="DataStore.rows"
|
||||
:filter="filter"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
v-bind="attrs"
|
||||
:visible-columns="visibleColumns"
|
||||
:pagination-label="paginationLabel"
|
||||
v-model:pagination="pagination"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
|
|
@ -365,37 +459,88 @@ const resetFilter = () => {
|
|||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td key="no" :props="props" @click="redirectToPage(props.row.id, props.row.insignia)">
|
||||
<q-td
|
||||
key="no"
|
||||
:props="props"
|
||||
@click="redirectToPage(props.row.id, props.row.insignia)"
|
||||
>
|
||||
{{ props.rowIndex + 1 }}
|
||||
</q-td>
|
||||
<q-td key="year" :props="props" @click="redirectToPage(props.row.id, props.row.insignia)">
|
||||
<q-td
|
||||
key="year"
|
||||
:props="props"
|
||||
@click="redirectToPage(props.row.id, props.row.insignia)"
|
||||
>
|
||||
{{ props.row.year }}
|
||||
</q-td>
|
||||
<q-td key="insignia" :props="props" @click="redirectToPage(props.row.id, props.row.insignia)">
|
||||
<q-td
|
||||
key="insignia"
|
||||
:props="props"
|
||||
@click="redirectToPage(props.row.id, props.row.insignia)"
|
||||
>
|
||||
{{ props.row.insignia }}
|
||||
</q-td>
|
||||
<q-td key="total" :props="props" @click="redirectToPage(props.row.id, props.row.insignia)">
|
||||
<q-td
|
||||
key="total"
|
||||
:props="props"
|
||||
@click="redirectToPage(props.row.id, props.row.insignia)"
|
||||
>
|
||||
{{ props.row.total }}
|
||||
</q-td>
|
||||
<q-td key="allocate" :props="props" @click="redirectToPage(props.row.id, props.row.insignia)">
|
||||
<q-td
|
||||
key="allocate"
|
||||
:props="props"
|
||||
@click="redirectToPage(props.row.id, props.row.insignia)"
|
||||
>
|
||||
{{ props.row.allocate }}
|
||||
</q-td>
|
||||
<q-td key="remain" :props="props" @click="redirectToPage(props.row.id, props.row.insignia)">
|
||||
<q-td
|
||||
key="remain"
|
||||
:props="props"
|
||||
@click="redirectToPage(props.row.id, props.row.insignia)"
|
||||
>
|
||||
{{ props.row.remain }}
|
||||
</q-td>
|
||||
<q-td auto-width>
|
||||
<q-btn icon="mdi-dots-vertical" size="12px" color="grey-7" flat round dense @click.stop>
|
||||
<q-menu transition-show="jump-down" transition-hide="jump-up">
|
||||
<q-btn
|
||||
icon="mdi-dots-vertical"
|
||||
size="12px"
|
||||
color="grey-7"
|
||||
flat
|
||||
round
|
||||
dense
|
||||
@click.stop
|
||||
>
|
||||
<q-menu
|
||||
transition-show="jump-down"
|
||||
transition-hide="jump-up"
|
||||
>
|
||||
<q-list dense style="min-width: auto">
|
||||
<q-item clickable @click.stop="clickEditrow(props.row)">
|
||||
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
|
||||
<q-item-section
|
||||
style="min-width: 0px"
|
||||
avatar
|
||||
class="q-py-sm"
|
||||
>
|
||||
<q-tooltip>แก้ไข</q-tooltip>
|
||||
<q-icon color="primary" size="xs" name="mdi-pencil" />
|
||||
<q-icon
|
||||
color="primary"
|
||||
size="xs"
|
||||
name="mdi-pencil"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>แก้ไข</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click.stop="clickDelete(props.row.id)">
|
||||
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop="clickDelete(props.row.id)"
|
||||
>
|
||||
<q-item-section
|
||||
style="min-width: 0px"
|
||||
avatar
|
||||
class="q-py-sm"
|
||||
>
|
||||
<q-tooltip>ลบ</q-tooltip>
|
||||
<q-icon color="red" size="xs" name="mdi-delete" />
|
||||
</q-item-section>
|
||||
|
|
@ -408,8 +553,16 @@ const resetFilter = () => {
|
|||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination v-model="pagination.page" active-color="primary" color="dark" :max="scope.pagesNumber"
|
||||
:max-pages="5" size="sm" boundary-links direction-links></q-pagination>
|
||||
<q-pagination
|
||||
v-model="pagination.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="scope.pagesNumber"
|
||||
:max-pages="5"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
|
|
@ -424,8 +577,19 @@ const resetFilter = () => {
|
|||
</div>
|
||||
</q-card>
|
||||
|
||||
<DialogForm :modal="modal" :save="save" :close="close" :insignia-list="insigniaOp" />
|
||||
<DialogForm
|
||||
:modal="modal"
|
||||
:save="save"
|
||||
:close="close"
|
||||
:insignia-list="insigniaOp"
|
||||
/>
|
||||
|
||||
<DialogEdit :modal="modalEdit" :save="saveEdit" :close="close" :insigniadata="rowData" :actionType="actionType" />
|
||||
<DialogEdit
|
||||
:modal="modalEdit"
|
||||
:save="saveEdit"
|
||||
:close="close"
|
||||
:insigniadata="rowData"
|
||||
:actionType="actionType"
|
||||
/>
|
||||
</template>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ import DialogHeader from "@/modules/07_insignia/components/DialogHeader.vue";
|
|||
import cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogMessage } =
|
||||
mixin;
|
||||
const { dialogMessage } = mixin;
|
||||
const name = ref<string>("");
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const modal = ref<boolean>(false);
|
||||
|
|
@ -301,15 +300,9 @@ const saveNote = async () => {
|
|||
true
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
await saveTextNote();
|
||||
}
|
||||
};
|
||||
const saveTextNote = async () => {};
|
||||
|
||||
const redirectToPage = (id?: string) => {
|
||||
router.push({ name: "allocateDetail" });
|
||||
};
|
||||
// ค้นหาในตาราง
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
|
|
@ -483,11 +476,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
|
|||
</q-btn>
|
||||
</q-td>
|
||||
<q-td>
|
||||
<q-btn
|
||||
label="คืนแล้ว"
|
||||
@click="clickNote()"
|
||||
color="blue"
|
||||
/>
|
||||
<q-btn label="คืนแล้ว" @click="clickNote()" color="blue" />
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue