Merge branch 'oat_dev' into develop

This commit is contained in:
oat_dev 2024-04-17 14:42:13 +07:00
commit 1e393e5dfc

View file

@ -21,6 +21,18 @@ const {
date2Thai,
} = mixin;
const columns = ref<QTableProps["columns"]>([
{
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<QTableProps["columns"]>([
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<QTableProps["columns"]>([
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<QTableProps["columns"]>([
const fileList = ref<File[]>([]);
const visibleColumns = ref<string[]>([
"type",
"idcard",
"fullName",
"position",
"posTypeName",
"posLevelName",
"posExecutive",
"startDate",
"endDate",
"trainingDays",
"org",
"refCommandNo",
"refCommandDate",
"commandNumber",
"commandDate",
]);
const files = ref<any>([]);
const pagination = ref({
@ -169,28 +220,20 @@ const row = [
refCommandDate: new Date(),
},
];
const rows = ref<any[]>([]);
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();
});
</script>
@ -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(() => {
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'fullName'">
{{
props.row.prefix +
" " +
props.row.firstName +
" " +
props.row.lastName
}}
</div>
<div v-else>{{ col.value ? col.value : "-" }}</div>
<div>{{ col.value ? col.value : "-" }}</div>
</q-td>
</q-tr>
</template>