diff --git a/src/modules/15_development/components/Record.vue b/src/modules/15_development/components/Record.vue index fe7123234..154d98498 100644 --- a/src/modules/15_development/components/Record.vue +++ b/src/modules/15_development/components/Record.vue @@ -21,6 +21,18 @@ const { date2Thai, } = mixin; const columns = ref([ + { + name: "type", + align: "left", + label: "ประเภท", + sortable: true, + field: "type", + headerStyle: "font-size: 14px; width: 50px;", + style: "font-size: 14px", + format: (v) => formBmaofficer(v), + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, { name: "idcard", align: "left", @@ -37,7 +49,7 @@ const columns = ref([ align: "left", label: "ชื่อ - นามสกุล", sortable: true, - field: "FullName", + field: "fullName", headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => @@ -99,22 +111,57 @@ const columns = ref([ a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { - name: "refCommandNo", + name: "startDate", align: "left", - label: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ", + label: "วันที่เริ่มต้น", sortable: true, - field: "refCommandNo", + field: "startDate", + format: (v) => date2Thai(v), headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { - name: "refCommandDate", + name: "endDate", + align: "left", + label: "วันที่สิ้นสุด", + sortable: true, + field: "endDate", + format: (v) => date2Thai(v), + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, + { + name: "trainingDays", + align: "left", + label: "จำนวนวันที่อบรม", + sortable: true, + field: "trainingDays", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, + { + name: "commandNumber", + align: "left", + label: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ", + sortable: true, + field: "commandNumber", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, + { + name: "commandDate", align: "left", label: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่", sortable: true, - field: "refCommandDate", + field: "commandDate", headerStyle: "font-size: 14px", style: "font-size: 14px", format: (v) => date2Thai(v), @@ -125,15 +172,19 @@ const columns = ref([ const fileList = ref([]); const visibleColumns = ref([ + "type", "idcard", "fullName", "position", "posTypeName", "posLevelName", "posExecutive", + "startDate", + "endDate", + "trainingDays", "org", - "refCommandNo", - "refCommandDate", + "commandNumber", + "commandDate", ]); const files = ref([]); const pagination = ref({ @@ -169,28 +220,20 @@ const row = [ refCommandDate: new Date(), }, ]; +const rows = ref([]); async function clickUpload(file: any) { - const fileName = { fileName: file.name }; - dialogConfirm( $q, async () => { const selectedFile = file; - const formdata = new FormData(); - formdata.append("file", selectedFile); + const formData = new FormData(); + formData.append("file", selectedFile); await http - .post(config.API.file("พัฒนาบุคลาการ", "บันทึกผล", id.value), { - replace: false, - fileList: fileName, - }) - .then(async (res) => { - const foundKey: string | undefined = Object.keys(res.data).find( - (key) => - res.data[key]?.fileName !== undefined && - res.data[key]?.fileName !== "" - ); - foundKey && uploadFileDoc(res.data[foundKey]?.uploadUrl, files.value); + .post(config.API.developmentMainTab("tab6", id.value), formData) + .then((res) => { + success($q, "อัปโหลดไฟล์สำเร็จ"); + getData(); }) .catch((err) => { messageError($q, err); @@ -201,12 +244,55 @@ async function clickUpload(file: any) { ); } +function formBmaofficer(val: string) { + switch (val) { + case "OFFICER": + return "ขรก.กทม. สามัญ"; + case "EMPLOYEE_PERM": + return "ลูกจ้างประจำ"; + case "EMPLOYEE_TEMP": + return "ลูกจ้างชั่วคราว"; + default: + return ""; + } +} + +// async function clickUpload(file: any) { +// const fileName = { fileName: file.name }; +// dialogConfirm( +// $q, +// async () => { +// const selectedFile = file; +// const formdata = new FormData(); +// formdata.append("file", selectedFile); +// await http +// .post(config.API.developmentMainTab("tab6", id.value)), { +// replace: false, +// fileList: fileName, +// }) +// .then(async (res:any) => { +// const foundKey: string | undefined = Object.keys(res.data).find( +// (key) => +// res.data[key]?.fileName !== undefined && +// res.data[key]?.fileName !== "" +// ); +// foundKey && uploadFileDoc(res.data[foundKey]?.uploadUrl, files.value); +// }) +// .catch((err) => { +// messageError($q, err); +// }); +// }, +// "ยืนยันการอัปโหลดไฟล์", +// "ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?" +// ); +// } + async function getData() { showLoader(); await http - .get(config.API.file("พัฒนาบุคลาการ", "บันทึกผล", id.value)) + .get(config.API.developmentMainTab("tab6", id.value)) .then((res) => { - fileList.value = res.data; + rows.value = res.data.result; }) .catch((e) => { messageError($q, e); @@ -246,8 +332,17 @@ function sendRecordRegistry() { async () => { showLoader(); // post - console.log("projectId===>", id.value); - hideLoader(); + await http + .get(config.API.developmentMainTab("tab6/done", id.value)) + .then((res) => { + success($q, "ส่งข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }, "ยืนยันการส่งข้อมูลไปบันทึกยังทะเบียนประวัติ", "ต้องการยืนยันการส่งข้อมูลไปบันทึกยังทะเบียนประวัติหรือไม่" @@ -255,7 +350,7 @@ function sendRecordRegistry() { } onMounted(() => { - // getData(); + getData(); }); @@ -328,7 +423,7 @@ onMounted(() => { bordered dense :columns="columns" - :rows="row" + :rows="rows" :paging="true" :filter="keyword" v-model:pagination="pagination" @@ -345,16 +440,7 @@ onMounted(() => {