tab บันทึกผล clean code+interface

This commit is contained in:
oat_dev 2024-04-17 15:08:30 +07:00
parent 9844202c29
commit 0e1bb1ccf9
2 changed files with 23 additions and 85 deletions

View file

@ -7,6 +7,7 @@ import config from "@/app.config";
import axios from "axios";
import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
import type { ResRecord } from "@/modules/15_development/interface/response/Main";
const mixin = useCounterMixin();
const route = useRoute();
const $q = useQuasar();
@ -17,7 +18,6 @@ const {
showLoader,
hideLoader,
dialogConfirm,
dialogRemove,
date2Thai,
} = mixin;
const columns = ref<QTableProps["columns"]>([
@ -170,7 +170,6 @@ const columns = ref<QTableProps["columns"]>([
},
]);
const fileList = ref<File[]>([]);
const visibleColumns = ref<string[]>([
"type",
"idcard",
@ -192,35 +191,7 @@ const pagination = ref({
rowsPerPage: 10,
});
const keyword = ref<string>("");
const row = [
{
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[]>([]);
const rows = ref<ResRecord[]>([]);
async function clickUpload(file: any) {
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() {
showLoader();
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() {
//
dialogConfirm(
@ -382,7 +300,7 @@ onMounted(() => {
<q-tooltip>ปโหลดไฟล</q-tooltip>
</q-btn>
<q-btn
v-if="row.length > 0"
v-if="rows.length > 0"
size="md"
icon="mdi-clipboard-account-outline"
round

View file

@ -109,6 +109,25 @@ interface ResPlannedGoals {
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 {
ResGroup,
ResLevel,
@ -117,4 +136,5 @@ export type {
ResPeople,
ResActualGoals,
ResPlannedGoals,
ResRecord
};