ต่อ api แก้ไข meeting

This commit is contained in:
AnandaTon 2023-12-20 12:43:08 +07:00
parent 1e85217bb3
commit 93dc84f95e
7 changed files with 126 additions and 153 deletions

View file

@ -4,8 +4,10 @@ const evaluation = `${env.API_URI}/evaluation`;
export default { export default {
evaluateDirectorMain: () => `${evaluateDirectorMain}`, evaluateDirectorMain: () => `${evaluateDirectorMain}`,
evaluateDirectorById: (id:string) => `${evaluateDirectorMain}/${id}`, evaluateDirectorById: (id: string) => `${evaluateDirectorMain}/${id}`,
evaluationMain: (page: number, pageSize: number, keyword: string) =>
`${evaluation}?page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
meeting: () => `${evaluation}/meeting`, meeting: () => `${evaluation}/meeting`,
meetingById: (id: string) => `${evaluation}/meeting/${id}`, meetingById: (id: string) => `${evaluation}/meeting/${id}`,
}; };

View file

@ -26,7 +26,8 @@ function addData(formData: any) {
.post(config.API.meeting(), { .post(config.API.meeting(), {
Round: formData.rounded ?? "", Round: formData.rounded ?? "",
Tittle: formData.title, Tittle: formData.title,
Date: formData.dateMeetingStart, DateEnd: formData.dateMeetingEnd,
DateStart: formData.dateMeetingStart,
Result: formData.consider, Result: formData.consider,
Duration: formData.period, Duration: formData.period,
}) })

View file

@ -33,10 +33,10 @@ onMounted(() => {
/** /**
* get อมลเกากรณแกไขขอม * get อมลเกากรณแกไขขอม
*/ */
const data = reactive<FormData>({ const data = reactive<any>({
rounded: "", rounded: "",
dateMeeting: "", dateMeeting: "",
dateMeetingStart: null, dateMeetingStart: Date,
dateMeetingEnd: new Date(), dateMeetingEnd: new Date(),
consider: "", consider: "",
period: "", period: "",
@ -58,8 +58,10 @@ const fetchData = async () => {
data.rounded = dataApi.Round; data.rounded = dataApi.Round;
data.consider = dataApi.Result; data.consider = dataApi.Result;
data.period = dataApi.Duration; data.period = dataApi.Duration;
data.dateMeetingStart = dataApi.Date; data.dateMeetingStart = dataApi.DateStart;
data.dateMeetingEnd = date2Thai(dataApi.DateEnd, false, true);
data.file = dataApi.file; data.file = dataApi.file;
console.log(data.dateMeetingStart); console.log(data.dateMeetingStart);
}) })
.catch((e) => { .catch((e) => {
@ -84,7 +86,8 @@ function putData(formData: FormData) {
.put(config.API.meetingById(personalId.value), { .put(config.API.meetingById(personalId.value), {
Round: formData.rounded ?? "", Round: formData.rounded ?? "",
Tittle: formData.title, Tittle: formData.title,
Date: formData.dateMeetingStart, DateStart: formData.dateMeetingStart,
DateEnd: formData.dateMeetingEnd,
Result: formData.consider, Result: formData.consider,
Duration: formData.period, Duration: formData.period,
}) })

View file

@ -42,7 +42,6 @@ const emit = defineEmits(["formDataReturn"]);
*/ */
// //
const idCard = ref<string>(""); const idCard = ref<string>("");
const idCardRef = ref<any>(null);
const fileOj = reactive<FileOj[]>([]); const fileOj = reactive<FileOj[]>([]);
@ -65,63 +64,66 @@ const formData = reactive<FormData>({
watch(props.data, async () => { watch(props.data, async () => {
// console.log("data==>", props.data) // console.log("data==>", props.data)
formData.rounded = props.data.rounded; formData.rounded = props.data.rounded;
formData.dateMeeting = props.data.dateMeeting; formData.dateMeetingStart = props.data.dateMeetingStart;
formData.dateMeetingEnd = props.data.dateMeetingEnd;
formData.consider = props.data.consider; formData.consider = props.data.consider;
formData.period = props.data.period; formData.period = props.data.period;
formData.title = props.data.title; formData.title = props.data.title;
}); });
/** // /**
* เพมบคลาก // *
*/ // */
function addEmployee() { // function addEmployee() {
if (idCard.value.length === 13) { // if (idCard.value.length === 13) {
console.log("idCard===>", idCard.value); // console.log("idCard===>", idCard.value);
showLoader(); // showLoader();
http // http
.post(config.API.profileSearchPersonal(), { // .post(config.API.profileSearchPersonal(), {
fieldName: "idcard", // fieldName: "idcard",
keyword: idCard.value, // keyword: idCard.value,
}) // })
.then((res) => { // .then((res) => {
const dataApi = res.data.result; // const dataApi = res.data.result;
if (dataApi.length > 0) { // if (dataApi.length > 0) {
const dataList = dataApi[0]; // const dataList = dataApi[0];
formData.rounded = dataList.rounded; // formData.rounded = dataList.rounded;
formData.dateMeeting = dataList.dateMeeting; // formData.dateMeeting = dataList.dateMeeting;
formData.consider = dataList.consider; // formData.consider = dataList.consider;
formData.period = dataList.period; // formData.period = dataList.period;
} else { // } else {
dialogMessageNotify($q, "ไม่มีข้อมูลบุคคลากรที่ต้องการค้นหา"); // dialogMessageNotify($q, "");
} // }
}) // })
.catch((e) => { // .catch((e) => {
messageError($q, e); // messageError($q, e);
}) // })
.finally(async () => { // .finally(async () => {
hideLoader(); // hideLoader();
}); // });
} // }
if (idCard.value.length !== 13) { // if (idCard.value.length !== 13) {
hideLoader(); // hideLoader();
dialogMessageNotify($q, "กรุณากรอกเลขบัตรประชาชนให้ครบ 13 หลัก"); // dialogMessageNotify($q, " 13 ");
} else { // } else {
console.log("nodata"); // console.log("nodata");
} // }
} // }
/** /**
* ตรวจสอบขอมลกอนสงไปย api * ตรวจสอบขอมลกอนสงไปย api
*/ */
const roundedRef = ref<object | null>(null); const roundedRef = ref<object | null>(null);
const dateMeetingRef = ref<object | null>(null); const dateMeetingStartRef = ref<object | null>(null);
const dateMeetingEndRef = ref<object | null>(null);
const considerRef = ref<object | null>(null); const considerRef = ref<object | null>(null);
const periodRef = ref<object | null>(null); const periodRef = ref<object | null>(null);
const titleRef = ref<object | null>(null); const titleRef = ref<object | null>(null);
const formRef: FormRef = { const formRef: FormRef = {
rounded: roundedRef, rounded: roundedRef,
dateMeeting: dateMeetingRef, dateMeetingStartRef: dateMeetingStartRef,
dateMeetingEndRef: dateMeetingEndRef,
consider: considerRef, consider: considerRef,
period: periodRef, period: periodRef,
title: titleRef, title: titleRef,
@ -228,17 +230,6 @@ function inputEdit(val: boolean) {
/> />
</div> </div>
<div class="col-3"> <div class="col-3">
<!-- <q-input
:class="inputEdit(isReadonly)"
dense
outlined
v-model="formData.dateMeeting"
label="วันเวลาในการประชุม"
ref="dateMeetingRef"
for="dateMeetingRef"
hide-bottom-space
:rules="[(val: string) => val !== null && val !== '' || `${'กรุณากรอกวันเวลาในการประชุม'}`]"
/> -->
<datepicker <datepicker
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="formData.dateMeetingStart" v-model="formData.dateMeetingStart"

View file

@ -32,7 +32,8 @@ interface FileOj {
interface FormRef { interface FormRef {
rounded: object | null; rounded: object | null;
dateMeeting: object | null; dateMeetingEndRef: object | null;
dateMeetingStartRef: object | null;
consider: object | null; consider: object | null;
period: object | null; period: object | null;
[key: string]: any; [key: string]: any;

View file

@ -53,15 +53,16 @@ export const useEvalutuonStore = defineStore("EvalutuonStore", () => {
]); ]);
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
function fetchData(data: any[]) { function fetchData(data: any[]) {
console.log(data);
const dataList: any[] = data.map((data: any) => ({ const dataList: any[] = data.map((data: any) => ({
id: data.id, id: data.id,
citizanId: data.citizanId, citizanId: data.CitizenId,
fullName: data.fullName, fullName: data.FullName,
position: data.position, position: data.Position,
level: data.level, level: data.Type,
positionNumber: data.positionNumber, positionNumber: data.PosNo,
agency: data.agency, agency: data.Oc,
status: convertStatus(data.status), status: convertStatus(data.Step),
})); }));
rows.value = dataList; rows.value = dataList;
console.log(dataList); console.log(dataList);

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -20,101 +20,70 @@ const { showLoader, hideLoader, messageError } = mixin;
const initialPagination = ref<Pagination>({ const initialPagination = ref<Pagination>({
rowsPerPage: 0, rowsPerPage: 0,
}); });
function Detailpage(id:string) { function Detailpage(id: string) {
router.push(`/evaluate/detail/${id}`); router.push(`/evaluate/detail/${id}`);
} }
const page = ref<number>(1); const currentPage = ref<number>(1);
const pageSize = ref<number>(10); const pageSize = ref<number>(10);
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
const page = ref<number>(1);
const filter = ref<string>(""); const filter = ref<string>("");
const rowsPerPage = ref<number>(10);
/**
*pagination ของตาราง
*/
const pagination = ref({
descending: false,
page: page.value,
rowsPerPage: rowsPerPage.value,
});
watch(
() => currentPage.value,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
getList();
}
);
watch(
() => pagination.value.rowsPerPage,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
currentPage.value = 1;
getList();
}
);
function getList() {
showLoader();
http
.get(
config.API.evaluationMain(
currentPage.value,
rowsPerPage.value,
filter.value
)
)
.then((res) => {
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
const data = res.data.result;
store.fetchData(data);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/** /**
* งขอมลจำลองไปย store * งขอมลจำลองไปย store
*/ */
onMounted(async () => { onMounted(async () => {
store.fetchData([ getList();
{
id:'xxx1',
citizanId: "1230030004001",
fullName: "นางวัศยา ศรีสร้อย",
position: "ผู้อำนวยการสถาบัน",
level: "ปฏิบัติการ",
positionNumber: "สก.ก412",
agency: "กลุ่มงานกฎหมาย",
status: "WAIT_CHECK_DOC_V1",
},
{
id:'xxx2',
citizanId: "122222000401",
fullName: "นายสิริศักดิ์ พรมบุตร",
position: "นักบริหาร",
level: "ชำนาญการพิเศษ",
positionNumber: "สก.ก412",
agency: "กลุ่มงานกฎหมายอาคาร",
status: "WAIT_CHECK_DOC_V2",
},
{
id:'xxx3',
citizanId: "111111100401",
fullName: "นายเอกฉัท วีระโชติ ",
position: "นักบริหาร",
level: "อำนวยการ",
positionNumber: "สก.ก412",
agency: "กลุ่มงานการคลัง",
status: "DONE",
},
{
id:'xxx4',
citizanId: "122203000401",
fullName: "นางธนิดา มั่นคงประสิทธิ์",
position: "ผู้อำนวยการกอง",
level: "อาวุโส",
positionNumber: "สก.ก412",
agency: "กลุ่มกิจการสภา",
status: "WAIT_CHECK_DOC_V1",
},
{
id:'xxx5',
citizanId: "123003111401",
fullName: "นางณิชมน ลือขำ ",
position: "ผู้อำนวยการสถาบัน",
level: "ชำนาญงาน",
positionNumber: "สก.ก412",
agency: "กลุ่มกิจการสภา",
status: "WAIT_CHECK_DOC_V2",
},
{
id:'xxx6',
citizanId: "111111100401",
fullName: "นายเอกฉัท วีระโชติ ",
position: "นักบริหาร",
level: "อำนวยการ",
positionNumber: "สก.ก412",
agency: "กลุ่มงานการคลัง",
status: "ANNOUNCE_WEB",
},
{
id:'xxx7',
citizanId: "111111100401",
fullName: "นายเอกฉัท วีระโชติ ",
position: "นักบริหาร",
level: "อำนวยการ",
positionNumber: "สก.ก412",
agency: "กลุ่มงานการคลัง",
status: "PREPARE_DOC_V2",
},
{
id:'xxx8',
citizanId: "111111100401",
fullName: "นายเอกฉัท วีระโชติ ",
position: "นักบริหาร",
level: "อำนวยการ",
positionNumber: "สก.ก412",
agency: "กลุ่มงานการคลัง",
status: "CHECK_DOC_V2",
},
]);
}); });
</script> </script>
@ -141,7 +110,12 @@ onMounted(async () => {
> >
<template #columns="props"> <template #columns="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.name" :props="props" @click="Detailpage(props.row.id)"> <q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="Detailpage(props.row.id)"
>
<div v-if="col.name == 'no'"> <div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</div> </div>