tab บันทึกผล clean code+interface
This commit is contained in:
parent
9844202c29
commit
0e1bb1ccf9
2 changed files with 23 additions and 85 deletions
|
|
@ -7,6 +7,7 @@ import config from "@/app.config";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
import type { ResRecord } from "@/modules/15_development/interface/response/Main";
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -17,7 +18,6 @@ const {
|
||||||
showLoader,
|
showLoader,
|
||||||
hideLoader,
|
hideLoader,
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
dialogRemove,
|
|
||||||
date2Thai,
|
date2Thai,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
@ -170,7 +170,6 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const fileList = ref<File[]>([]);
|
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"type",
|
"type",
|
||||||
"idcard",
|
"idcard",
|
||||||
|
|
@ -192,35 +191,7 @@ const pagination = ref({
|
||||||
rowsPerPage: 10,
|
rowsPerPage: 10,
|
||||||
});
|
});
|
||||||
const keyword = ref<string>("");
|
const keyword = ref<string>("");
|
||||||
const row = [
|
const rows = ref<ResRecord[]>([]);
|
||||||
{
|
|
||||||
idcard: "1234567890121",
|
|
||||||
prefix: "นาง",
|
|
||||||
firstName: "ณัฐนิชา",
|
|
||||||
lastName: "เป็งกำปอง",
|
|
||||||
position: "นักวิชาการสถิติ",
|
|
||||||
posTypeName: "วิชาการ",
|
|
||||||
posLevelName: "ชำนาญการ",
|
|
||||||
posExecutive: "นักบริหาร",
|
|
||||||
org: "สาขาสถิติ",
|
|
||||||
refCommandNo: "25/2566",
|
|
||||||
refCommandDate: new Date(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idcard: "2222222222222",
|
|
||||||
prefix: "นาย",
|
|
||||||
firstName: "สมศักดิ์",
|
|
||||||
lastName: "กำแหง",
|
|
||||||
position: "นักการไฟฟ้า",
|
|
||||||
posTypeName: "วิชาการ",
|
|
||||||
posLevelName: "สูง",
|
|
||||||
posExecutive: "นักการช่าง",
|
|
||||||
org: "อิเล็กทรอนิกส์",
|
|
||||||
refCommandNo: "12/2565",
|
|
||||||
refCommandDate: new Date(),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const rows = ref<any[]>([]);
|
|
||||||
|
|
||||||
async function clickUpload(file: any) {
|
async function clickUpload(file: any) {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
|
|
@ -257,36 +228,6 @@ function formBmaofficer(val: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
@ -302,29 +243,6 @@ async function getData() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadFileDoc(uploadUrl: string, file: any) {
|
|
||||||
const Data = new FormData();
|
|
||||||
Data.append("file", files.value);
|
|
||||||
showLoader();
|
|
||||||
await axios
|
|
||||||
.put(uploadUrl, file, {
|
|
||||||
headers: {
|
|
||||||
"Content-Type": file.type,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
success($q, "อัปโหลดไฟล์สำเร็จ");
|
|
||||||
getData();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
messageError($q, e);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
files.value = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendRecordRegistry() {
|
function sendRecordRegistry() {
|
||||||
// ส่งไปบันทึกที่ทะเบียนประวัติ
|
// ส่งไปบันทึกที่ทะเบียนประวัติ
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
|
|
@ -382,7 +300,7 @@ onMounted(() => {
|
||||||
<q-tooltip>อัปโหลดไฟล์</q-tooltip>
|
<q-tooltip>อัปโหลดไฟล์</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="row.length > 0"
|
v-if="rows.length > 0"
|
||||||
size="md"
|
size="md"
|
||||||
icon="mdi-clipboard-account-outline"
|
icon="mdi-clipboard-account-outline"
|
||||||
round
|
round
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,25 @@ interface ResPlannedGoals {
|
||||||
amount: number | null;
|
amount: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ResRecord {
|
||||||
|
commandDate: Date | null;
|
||||||
|
commandNumber: string |null;
|
||||||
|
firstName: string;
|
||||||
|
fullName: string;
|
||||||
|
id: string;
|
||||||
|
idcard: string;
|
||||||
|
isDone: boolean;
|
||||||
|
lastName: string;
|
||||||
|
org: string;
|
||||||
|
posExecutive: string | null;
|
||||||
|
posLevelName :string;
|
||||||
|
posTypeName: string;
|
||||||
|
position: string;
|
||||||
|
prefix: string;
|
||||||
|
trainingDays: number | null;
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
ResGroup,
|
ResGroup,
|
||||||
ResLevel,
|
ResLevel,
|
||||||
|
|
@ -117,4 +136,5 @@ export type {
|
||||||
ResPeople,
|
ResPeople,
|
||||||
ResActualGoals,
|
ResActualGoals,
|
||||||
ResPlannedGoals,
|
ResPlannedGoals,
|
||||||
|
ResRecord
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue