เชื่อมAPI tab บันทึกผล
This commit is contained in:
parent
3d60f25246
commit
9844202c29
1 changed files with 125 additions and 39 deletions
|
|
@ -21,6 +21,18 @@ const {
|
||||||
date2Thai,
|
date2Thai,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
const columns = ref<QTableProps["columns"]>([
|
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",
|
name: "idcard",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -37,7 +49,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ชื่อ - นามสกุล",
|
label: "ชื่อ - นามสกุล",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "FullName",
|
field: "fullName",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
|
|
@ -99,22 +111,57 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "refCommandNo",
|
name: "startDate",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ",
|
label: "วันที่เริ่มต้น",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "refCommandNo",
|
field: "startDate",
|
||||||
|
format: (v) => date2Thai(v),
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
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",
|
align: "left",
|
||||||
label: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่",
|
label: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "refCommandDate",
|
field: "commandDate",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format: (v) => date2Thai(v),
|
format: (v) => date2Thai(v),
|
||||||
|
|
@ -125,15 +172,19 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
||||||
const fileList = ref<File[]>([]);
|
const fileList = ref<File[]>([]);
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
|
"type",
|
||||||
"idcard",
|
"idcard",
|
||||||
"fullName",
|
"fullName",
|
||||||
"position",
|
"position",
|
||||||
"posTypeName",
|
"posTypeName",
|
||||||
"posLevelName",
|
"posLevelName",
|
||||||
"posExecutive",
|
"posExecutive",
|
||||||
|
"startDate",
|
||||||
|
"endDate",
|
||||||
|
"trainingDays",
|
||||||
"org",
|
"org",
|
||||||
"refCommandNo",
|
"commandNumber",
|
||||||
"refCommandDate",
|
"commandDate",
|
||||||
]);
|
]);
|
||||||
const files = ref<any>([]);
|
const files = ref<any>([]);
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
|
|
@ -169,28 +220,20 @@ const row = [
|
||||||
refCommandDate: new Date(),
|
refCommandDate: new Date(),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const rows = ref<any[]>([]);
|
||||||
|
|
||||||
async function clickUpload(file: any) {
|
async function clickUpload(file: any) {
|
||||||
const fileName = { fileName: file.name };
|
|
||||||
|
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
async () => {
|
||||||
const selectedFile = file;
|
const selectedFile = file;
|
||||||
const formdata = new FormData();
|
const formData = new FormData();
|
||||||
formdata.append("file", selectedFile);
|
formData.append("file", selectedFile);
|
||||||
await http
|
await http
|
||||||
.post(config.API.file("พัฒนาบุคลาการ", "บันทึกผล", id.value), {
|
.post(config.API.developmentMainTab("tab6", id.value), formData)
|
||||||
replace: false,
|
.then((res) => {
|
||||||
fileList: fileName,
|
success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||||
})
|
getData();
|
||||||
.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);
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, 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() {
|
async function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.file("พัฒนาบุคลาการ", "บันทึกผล", id.value))
|
.get(config.API.developmentMainTab("tab6", id.value))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
fileList.value = res.data;
|
rows.value = res.data.result;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -246,8 +332,17 @@ function sendRecordRegistry() {
|
||||||
async () => {
|
async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
// post
|
// post
|
||||||
console.log("projectId===>", id.value);
|
await http
|
||||||
hideLoader();
|
.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(() => {
|
onMounted(() => {
|
||||||
// getData();
|
getData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -328,7 +423,7 @@ onMounted(() => {
|
||||||
bordered
|
bordered
|
||||||
dense
|
dense
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="row"
|
:rows="rows"
|
||||||
:paging="true"
|
:paging="true"
|
||||||
:filter="keyword"
|
:filter="keyword"
|
||||||
v-model:pagination="pagination"
|
v-model:pagination="pagination"
|
||||||
|
|
@ -345,16 +440,7 @@ onMounted(() => {
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="props" class="cursor-pointer">
|
<q-tr :props="props" class="cursor-pointer">
|
||||||
<q-td v-for="col in props.cols" :key="col.id">
|
<q-td v-for="col in props.cols" :key="col.id">
|
||||||
<div v-if="col.name === 'fullName'">
|
<div>{{ col.value ? col.value : "-" }}</div>
|
||||||
{{
|
|
||||||
props.row.prefix +
|
|
||||||
" " +
|
|
||||||
props.row.firstName +
|
|
||||||
" " +
|
|
||||||
props.row.lastName
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div v-else>{{ col.value ? col.value : "-" }}</div>
|
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue