ประเมิน => permission รายการการประชุม
This commit is contained in:
parent
b3058bbd43
commit
c61e8b4805
6 changed files with 302 additions and 349 deletions
|
|
@ -118,7 +118,6 @@ onMounted(() => {
|
|||
<div v-if="checkPermission($route)?.attrIsCreate">
|
||||
<q-btn
|
||||
@click="router.push(`/evaluate/director/add`)"
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="add"
|
||||
|
|
@ -220,7 +219,6 @@ onMounted(() => {
|
|||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsDelete"
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="red"
|
||||
|
|
|
|||
|
|
@ -1,45 +1,57 @@
|
|||
<script setup lang="ts">
|
||||
import Form from "@/modules/12_evaluatePersonal/components/Meeting/Form.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
import type { FormDataPost } from "@/modules/11_discipline/interface/request/director";
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, showLoader, hideLoader, dialogConfirm, success } = mixin;
|
||||
const router = useRouter();
|
||||
|
||||
/**
|
||||
* บันทึกข้อมูลที่เเก้ไข
|
||||
* @param id ระบุ บุคคล
|
||||
* importType
|
||||
*/
|
||||
function onSubmit(formData: FormDataPost) {
|
||||
dialogConfirm($q, () => addData(formData));
|
||||
}
|
||||
import type { FormData } from "@/modules/12_evaluatePersonal/interface/index/meeting";
|
||||
|
||||
function addData(formData: any) {
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.meeting(), {
|
||||
round: formData.rounded ?? "",
|
||||
title: formData.title,
|
||||
dateEnd: formData.dateMeetingEnd,
|
||||
dateStart: formData.dateMeetingStart,
|
||||
result: formData.consider,
|
||||
duration: formData.period,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
router.push(`/evaluate/meeting`);
|
||||
});
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import Form from "@/modules/12_evaluatePersonal/components/Meeting/Form.vue";
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/**
|
||||
* use
|
||||
*/
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const { messageError, showLoader, dialogConfirm, success, hideLoader } =
|
||||
useCounterMixin();
|
||||
|
||||
/**
|
||||
* บันทึกข้อมูลการประชุม
|
||||
* @param formData ข้อมูลการประชุม
|
||||
*/
|
||||
function onSubmit(formData: FormData) {
|
||||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.meeting(), {
|
||||
round: formData.rounded ?? "",
|
||||
title: formData.title,
|
||||
dateEnd: formData.dateMeetingEnd,
|
||||
dateStart: formData.dateMeetingStart,
|
||||
result: formData.consider,
|
||||
duration: formData.period,
|
||||
})
|
||||
.then(() => {
|
||||
router.push(`/evaluate/meeting`);
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -1,42 +1,50 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive } from "vue";
|
||||
import Form from "@/modules/12_evaluatePersonal/components/Meeting/Form.vue";
|
||||
import type { FormData } from "@/modules/12_evaluatePersonal/interface/index/meeting";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { ref, onMounted, reactive, computed } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
import router from "@/router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import type { formData } from "@/modules/09_leave/interface/request/workTime";
|
||||
|
||||
/**
|
||||
* importTyep
|
||||
*/
|
||||
import type { FormData } from "@/modules/12_evaluatePersonal/interface/index/meeting";
|
||||
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import Form from "@/modules/12_evaluatePersonal/components/Meeting/Form.vue";
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/**
|
||||
* use
|
||||
*/
|
||||
const route = useRoute();
|
||||
const personalId = ref<string>(route.params.id as string);
|
||||
console.log(personalId.value);
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
dialogConfirm,
|
||||
success,
|
||||
date2Thai,
|
||||
dateToISO,
|
||||
} = mixin;
|
||||
} = useCounterMixin();
|
||||
|
||||
/**เมื่อเริ่มโหลดหน้า
|
||||
* เรียกใช้งาน fetchData เพื่อดึงข้อมูล
|
||||
*/
|
||||
onMounted(() => {
|
||||
fetchData();
|
||||
});
|
||||
const personalId = ref<string>(route.params.id as string);
|
||||
const routeName = ref<string>(route.name as string);
|
||||
const title = computed(() =>
|
||||
routeName.value === "evaluateMeetingdetail"
|
||||
? "รายละเอียดการประชุม"
|
||||
: "แก้ไขการประชุม"
|
||||
);
|
||||
|
||||
/**
|
||||
* get ข้อมูลเก่ากรณีแก้ไขข้อมูล
|
||||
*/
|
||||
const data = reactive<any>({
|
||||
//ข้อมูลการประชุม
|
||||
const data = reactive({
|
||||
rounded: "",
|
||||
dateMeeting: "",
|
||||
dateMeetingStart: Date,
|
||||
|
|
@ -48,11 +56,11 @@ const data = reactive<any>({
|
|||
});
|
||||
|
||||
/**
|
||||
* ดึงค่าจาก api
|
||||
* function fetch ข้อมูลการประชุม
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
function fetchData() {
|
||||
showLoader();
|
||||
await http
|
||||
http
|
||||
.get(config.API.meetingById(personalId.value))
|
||||
.then((res) => {
|
||||
const dataApi = res.data.result;
|
||||
|
|
@ -68,41 +76,48 @@ const fetchData = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* บันทึกข้อมูลที่เเก้ไข
|
||||
* @param id ระบุ บุคคล
|
||||
* @param formData ข้อมูลการประชุม
|
||||
*/
|
||||
function onSubmit(formData: FormData) {
|
||||
dialogConfirm($q, () => putData(formData));
|
||||
console.log(personalId.value);
|
||||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
http
|
||||
.put(config.API.meetingById(personalId.value), {
|
||||
round: formData.rounded ?? "",
|
||||
title: formData.title,
|
||||
dateStart: formData.dateMeetingStart
|
||||
? dateToISO(formData.dateMeetingStart)
|
||||
: null,
|
||||
dateEnd: formData.dateMeetingEnd
|
||||
? dateToISO(formData.dateMeetingEnd)
|
||||
: null,
|
||||
result: formData.consider,
|
||||
duration: formData.period,
|
||||
})
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
router.push(`/evaluate/meeting`);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function putData(formData: any) {
|
||||
showLoader();
|
||||
http
|
||||
.put(config.API.meetingById(personalId.value), {
|
||||
round: formData.rounded ?? "",
|
||||
title: formData.title,
|
||||
dateStart: dateToISO(formData.dateMeetingStart),
|
||||
dateEnd: dateToISO(formData.dateMeetingEnd),
|
||||
result: formData.consider,
|
||||
duration: formData.period,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
router.push(`/evaluate/meeting`);
|
||||
});
|
||||
}
|
||||
onMounted(() => {
|
||||
fetchData();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="col-xs-12 col-sm-12 col-md-11">
|
||||
|
|
@ -117,7 +132,7 @@ function putData(formData: any) {
|
|||
class="q-mr-sm"
|
||||
@click="router.push(`/evaluate/meeting`)"
|
||||
/>
|
||||
แก้ไขการประชุม
|
||||
{{ title }}
|
||||
</div>
|
||||
|
||||
<Form :on-submit="onSubmit" :data="data" />
|
||||
|
|
|
|||
|
|
@ -1,30 +1,32 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted } from "vue";
|
||||
import { ref, reactive, onMounted, computed } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
import axios from "axios";
|
||||
import type {
|
||||
FormData,
|
||||
FormRef,
|
||||
FileOj,
|
||||
} from "@/modules/12_evaluatePersonal/interface/index/meeting";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/**
|
||||
* importRtpe
|
||||
*/
|
||||
import type { FormData } from "@/modules/12_evaluatePersonal/interface/index/meeting";
|
||||
|
||||
/**
|
||||
* use
|
||||
*/
|
||||
|
||||
const route = useRoute();
|
||||
const id = ref<string>(route.params.id as string);
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
messageError,
|
||||
showLoader,
|
||||
dialogMessageNotify,
|
||||
dialogConfirm,
|
||||
success,
|
||||
date2Thai,
|
||||
hideLoader,
|
||||
dialogRemove,
|
||||
} = mixin;
|
||||
} = useCounterMixin();
|
||||
|
||||
/**
|
||||
* รับ props มาจาก page หลัก
|
||||
*/
|
||||
|
|
@ -38,15 +40,13 @@ const props = defineProps({
|
|||
default: () => "",
|
||||
},
|
||||
});
|
||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||
const emit = defineEmits(["formDataReturn"]);
|
||||
/**
|
||||
* ข้อมูลเลขประจำตัวประชาชน
|
||||
*/
|
||||
//
|
||||
const idCard = ref<string>("");
|
||||
const file = ref<any>();
|
||||
const fileOj = reactive<FileOj[]>([]);
|
||||
|
||||
const id = ref<string>(route.params.id as string);
|
||||
const routeName = ref<string>(route.name as string);
|
||||
const isReadonly = computed(() =>
|
||||
routeName.value === "evaluateMeetingdetail" ? true : false
|
||||
);
|
||||
|
||||
const formData = reactive<FormData>({
|
||||
id: "",
|
||||
|
|
@ -57,94 +57,41 @@ const formData = reactive<FormData>({
|
|||
consider: "",
|
||||
period: "",
|
||||
title: "",
|
||||
// file: fileOj,
|
||||
});
|
||||
const file = ref<any>();
|
||||
const fileData = ref<any>([]);
|
||||
const fileDataDownload = ref<any>([]);
|
||||
|
||||
/**
|
||||
* เช็คข้อมูลจาก props
|
||||
* เมื่อมีข้อมูล
|
||||
* เก็บข้อมูลลง formData
|
||||
*/
|
||||
watch(props.data, async () => {
|
||||
// console.log("data==>", props.data)
|
||||
formData.id = props.data.id;
|
||||
formData.rounded = props.data.rounded;
|
||||
formData.dateMeetingStart = props.data.dateMeetingStart;
|
||||
formData.dateMeetingEnd = props.data.dateMeetingEnd;
|
||||
formData.consider = props.data.consider;
|
||||
formData.period = props.data.period;
|
||||
formData.title = props.data.title;
|
||||
});
|
||||
|
||||
/**
|
||||
* ตรวจสอบข้อมูลก่อนส่งไปยัง api
|
||||
*/
|
||||
const roundedRef = ref<object | null>(null);
|
||||
const dateMeetingStartRef = ref<object | null>(null);
|
||||
const dateMeetingEndRef = ref<object | null>(null);
|
||||
const considerRef = ref<object | null>(null);
|
||||
const periodRef = ref<object | null>(null);
|
||||
const titleRef = ref<object | null>(null);
|
||||
|
||||
const formRef: FormRef = {
|
||||
rounded: roundedRef,
|
||||
dateMeetingStartRef: dateMeetingStartRef,
|
||||
dateMeetingEndRef: dateMeetingEndRef,
|
||||
consider: considerRef,
|
||||
period: periodRef,
|
||||
title: titleRef,
|
||||
};
|
||||
|
||||
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
|
||||
function onValidate() {
|
||||
const hasError = [];
|
||||
for (const key in formRef) {
|
||||
if (Object.prototype.hasOwnProperty.call(formRef, key)) {
|
||||
const property = formRef[key];
|
||||
if (property.value && typeof property.value.validate === "function") {
|
||||
const isValid = property.value.validate();
|
||||
hasError.push(isValid);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasError.every((result) => result === true)) {
|
||||
props.onSubmit(formData);
|
||||
}
|
||||
/** บันทึกข้อมูล */
|
||||
function submit() {
|
||||
props.onSubmit(formData);
|
||||
}
|
||||
|
||||
const fileData = ref<any>([]);
|
||||
/**
|
||||
* ดึงค่าจาก api
|
||||
* function fetch ข้อมูลไฟล์เอกสารหลักฐาน
|
||||
*/
|
||||
const fetchDataFile = async () => {
|
||||
function fetchDataFile() {
|
||||
if (id.value != undefined) {
|
||||
showLoader();
|
||||
await http
|
||||
http
|
||||
.get(config.API.meetingFilebyId("การประชุม", id.value))
|
||||
.then((res) => {
|
||||
const dataFile = res.data;
|
||||
// const dataFile = res.data.result;
|
||||
fileData.value = dataFile;
|
||||
})
|
||||
.catch((e) => {
|
||||
// messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* function download
|
||||
* function ดาวน์โหลดไฟล์เอกสารหลักฐาน
|
||||
*/
|
||||
const fileDataDownload = ref<any>([]);
|
||||
const fetchDataFileDownload = async (pathName: string) => {
|
||||
console.log(fileData.value[0].fileName);
|
||||
function fetchDataFileDownload(pathName: string) {
|
||||
if (id.value !== undefined) {
|
||||
showLoader();
|
||||
console.log(fileData.value[0].fileName);
|
||||
await http
|
||||
http
|
||||
.get(config.API.meetingFileDowloadbyId("การประชุม", id.value, pathName))
|
||||
.then((res) => {
|
||||
const dataFile = res.data;
|
||||
|
|
@ -158,13 +105,12 @@ const fetchDataFileDownload = async (pathName: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* addFiles
|
||||
* function สร้างลิงค์อัปโหลดไฟล์เอกสารหลักฐาน
|
||||
*/
|
||||
function uploadFile() {
|
||||
// fetchDataFile();
|
||||
if (file) {
|
||||
const fileList = [
|
||||
{
|
||||
|
|
@ -191,64 +137,56 @@ function uploadFile() {
|
|||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
file.value = null;
|
||||
// hideLoader();
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function uploadfileURL(uploadUrl: string, file: any) {
|
||||
await axios
|
||||
/**
|
||||
* function อัปโหลดไฟล์เอกสารหลักฐาน
|
||||
*/
|
||||
function uploadfileURL(uploadUrl: string, file: any) {
|
||||
axios
|
||||
.put(uploadUrl, file, {
|
||||
headers: {
|
||||
"Content-Type": file.type,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
success($q, "อัปโหลไฟล์สำเร็จ");
|
||||
setTimeout(async () => {
|
||||
await fetchDataFile();
|
||||
await success($q, "อัปโหลไฟล์สำเร็จ");
|
||||
file.value = null;
|
||||
}, 500);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(async () => {
|
||||
await setTimeout(() => fetchDataFile(), 500);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function deleteFile(id: string) {
|
||||
dialogRemove($q, () => confirmDelete(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* ยืนยัน ลบ ไฟล์
|
||||
* @param id id file
|
||||
* function ยืนยันการลบไฟล์เอกสารหลักฐาน
|
||||
* @param fileName file
|
||||
*/
|
||||
function confirmDelete(fileName: string) {
|
||||
showLoader();
|
||||
http
|
||||
.delete(config.API.meetingFileDowloadbyId("การประชุม", id.value, fileName))
|
||||
.then((res) => {
|
||||
success($q, `ลบไฟล์สำเร็จ`);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => fetchDataFile(), 1000);
|
||||
});
|
||||
}
|
||||
|
||||
//checkDate
|
||||
function checkDate() {
|
||||
if (formData.dateMeetingEnd !== null && formData.dateMeetingStart !== null) {
|
||||
if (formData.dateMeetingEnd <= formData.dateMeetingStart) {
|
||||
formData.dateMeetingEnd = null;
|
||||
}
|
||||
} else {
|
||||
console.log("One or both dates are null");
|
||||
}
|
||||
function deleteFile(fileName: string) {
|
||||
dialogRemove($q, () => {
|
||||
showLoader();
|
||||
http
|
||||
.delete(
|
||||
config.API.meetingFileDowloadbyId("การประชุม", id.value, fileName)
|
||||
)
|
||||
.then(() => {
|
||||
setTimeout(async () => {
|
||||
await fetchDataFile();
|
||||
await success($q, `ลบไฟล์สำเร็จ`);
|
||||
}, 1000);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function inputEdit(val: boolean) {
|
||||
|
|
@ -260,22 +198,32 @@ function inputEdit(val: boolean) {
|
|||
|
||||
/**Hook */
|
||||
onMounted(() => {
|
||||
setTimeout(() => fetchDataFile(), 500);
|
||||
// fetchDataFileDownload();
|
||||
setTimeout(() => {
|
||||
fetchDataFile();
|
||||
if (props.data) {
|
||||
formData.id = props.data.id;
|
||||
formData.rounded = props.data.rounded;
|
||||
formData.dateMeetingStart = props.data.dateMeetingStart;
|
||||
formData.dateMeetingEnd = props.data.dateMeetingEnd;
|
||||
formData.consider = props.data.consider;
|
||||
formData.period = props.data.period;
|
||||
formData.title = props.data.title;
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<form @submit.prevent.stop="onValidate">
|
||||
<q-form greedy @submit.prevent @validation-success="submit">
|
||||
<q-card bordered>
|
||||
<div class="col-12 row q-pa-md q-col-gutter-md">
|
||||
<div class="col-3">
|
||||
<q-input
|
||||
:class="inputEdit(isReadonly)"
|
||||
:readonly="isReadonly"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.rounded"
|
||||
label="ครั้งที่"
|
||||
ref="roundedRef"
|
||||
for="roundedRef"
|
||||
hide-bottom-space
|
||||
:rules="[(val: string) => val !== null && val !== '' || `${'กรุณากรอกครั้งที่'}`]"
|
||||
|
|
@ -283,13 +231,15 @@ onMounted(() => {
|
|||
</div>
|
||||
<div class="col-3">
|
||||
<datepicker
|
||||
:readonly="isReadonly"
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.dateMeetingStart"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="true"
|
||||
week-start="0"
|
||||
@update:model-value="checkDate"
|
||||
:class="inputEdit(isReadonly)"
|
||||
:max-date="formData.dateMeetingEnd"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
|
|
@ -297,8 +247,8 @@ onMounted(() => {
|
|||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
:readonly="isReadonly"
|
||||
for="selectDate"
|
||||
ref="dateMeetingStartRef"
|
||||
dense
|
||||
outlined
|
||||
:model-value="
|
||||
|
|
@ -327,6 +277,8 @@ onMounted(() => {
|
|||
:enableTimePicker="true"
|
||||
week-start="0"
|
||||
:min-date="formData.dateMeetingStart"
|
||||
:class="inputEdit(isReadonly)"
|
||||
:readonly="isReadonly"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
|
|
@ -334,8 +286,8 @@ onMounted(() => {
|
|||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
:readonly="isReadonly"
|
||||
for="selectDate"
|
||||
ref="dateMeetingEndRef"
|
||||
dense
|
||||
outlined
|
||||
:model-value="
|
||||
|
|
@ -358,11 +310,11 @@ onMounted(() => {
|
|||
<div class="col-6">
|
||||
<q-input
|
||||
:class="inputEdit(isReadonly)"
|
||||
:readonly="isReadonly"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.title"
|
||||
label="หัวข้อการประชุม"
|
||||
ref="titleRef"
|
||||
for="titleRef"
|
||||
hide-bottom-space
|
||||
:rules="[(val: string) => !!val || `${'กรุณากรอกหัวข้อการประชุม'}`]"
|
||||
|
|
@ -371,11 +323,11 @@ onMounted(() => {
|
|||
<div class="col-12">
|
||||
<q-input
|
||||
:class="inputEdit(isReadonly)"
|
||||
:readonly="isReadonly"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.consider"
|
||||
label="ผลการพิจารณาของคณะกรรมการประเมินผลงานแต่ละคณะ"
|
||||
ref="considerRef"
|
||||
for="considerRef"
|
||||
hide-bottom-space
|
||||
type="textarea"
|
||||
|
|
@ -385,11 +337,11 @@ onMounted(() => {
|
|||
<div class="col-12">
|
||||
<q-input
|
||||
:class="inputEdit(isReadonly)"
|
||||
:readonly="isReadonly"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.period"
|
||||
label="ระยะเวลาในการแก้ไขผลงาน"
|
||||
ref="periodRef"
|
||||
for="periodRef"
|
||||
hide-bottom-space
|
||||
type="textarea"
|
||||
|
|
@ -404,6 +356,7 @@ onMounted(() => {
|
|||
<div class="col-12"><q-separator /></div>
|
||||
<div class="col-12 q-pa-sm row">
|
||||
<q-file
|
||||
:readonly="isReadonly"
|
||||
for="inputFiles"
|
||||
class="col-11"
|
||||
outlined
|
||||
|
|
@ -434,7 +387,6 @@ onMounted(() => {
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-12 q-pa-sm row" v-if="fileData.length > 0">
|
||||
<!-- v-if="file.length > 0" v-else -->
|
||||
<q-list
|
||||
v-for="data in fileData"
|
||||
:key="data.id"
|
||||
|
|
@ -446,7 +398,6 @@ onMounted(() => {
|
|||
<q-item-section>{{ data.fileName }}</q-item-section>
|
||||
<q-space />
|
||||
<q-btn
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
dense
|
||||
|
|
@ -456,7 +407,7 @@ onMounted(() => {
|
|||
><q-tooltip>ดาวน์โหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
<q-btn
|
||||
size="12px"
|
||||
v-if="!isReadonly"
|
||||
flat
|
||||
round
|
||||
dense
|
||||
|
|
@ -476,8 +427,8 @@ onMounted(() => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<q-separator />
|
||||
<div class="row col-12 q-pa-sm">
|
||||
<q-separator v-if="!isReadonly" />
|
||||
<div class="row col-12 q-pa-sm" v-if="!isReadonly">
|
||||
<q-space />
|
||||
<q-btn
|
||||
for="ButtonOnSubmit"
|
||||
|
|
@ -489,5 +440,5 @@ onMounted(() => {
|
|||
>
|
||||
</div>
|
||||
</q-card>
|
||||
</form>
|
||||
</q-form>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,68 +1,30 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, useAttrs, onMounted, watch } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import router from "@/router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useEvaluateMeetingDataStore } from "@/modules/12_evaluatePersonal/store/MeetingStore";
|
||||
import router from "@/router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useEvaluateMeetingDataStore } from "@/modules/12_evaluatePersonal/store/MeetingStore";
|
||||
|
||||
const $q = useQuasar();
|
||||
const dataStore = useEvaluateMeetingDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
dialogConfirm,
|
||||
dialogRemove,
|
||||
success,
|
||||
} = mixin;
|
||||
|
||||
// const currentPage = ref<number>(1);
|
||||
// const maxPage = ref<number>(1);
|
||||
// const page = ref<number>(1);
|
||||
// const rowsPerPage = ref<number>(10);
|
||||
const { messageError, showLoader, hideLoader, dialogRemove, success } = mixin;
|
||||
|
||||
/**
|
||||
*pagination ของตาราง
|
||||
* function fetch ข้อมูลรายการการประชุม
|
||||
*/
|
||||
const pagination = ref({
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
// watch(
|
||||
// () => currentPage.value,
|
||||
// () => {
|
||||
// rowsPerPage.value = pagination.value.rowsPerPage;
|
||||
// getList();
|
||||
// }
|
||||
// );
|
||||
|
||||
// watch(
|
||||
// () => pagination.value.rowsPerPage,
|
||||
// () => {
|
||||
// rowsPerPage.value = pagination.value.rowsPerPage;
|
||||
// currentPage.value = 1;
|
||||
// getList();
|
||||
// }
|
||||
// );
|
||||
async function getList() {
|
||||
function getList() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API
|
||||
.meeting
|
||||
// currentPage.value,
|
||||
// rowsPerPage.value,
|
||||
// filterKeyword.value
|
||||
()
|
||||
)
|
||||
http
|
||||
.get(config.API.meeting())
|
||||
.then((res) => {
|
||||
// maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
|
||||
const data = res.data.result;
|
||||
dataStore.fetchData(data);
|
||||
})
|
||||
|
|
@ -75,31 +37,23 @@ async function getList() {
|
|||
}
|
||||
|
||||
/**
|
||||
* ลบข้อมูล
|
||||
* @param id ไอดีของข้อมูล
|
||||
* ลบรายการการประชุม
|
||||
* @param id รายการการประชุม
|
||||
*/
|
||||
function clickDelete(id: string) {
|
||||
dialogRemove($q, async () => deleteData(id), `ลบข้อมูล`);
|
||||
}
|
||||
|
||||
/**
|
||||
* ลบข้อมูล
|
||||
* @param id type
|
||||
*/
|
||||
async function deleteData(id: string) {
|
||||
console.log(id);
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.meetingById(id))
|
||||
.then((res) => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await getList();
|
||||
});
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
http
|
||||
.delete(config.API.meetingById(id))
|
||||
.then(async () => {
|
||||
await getList();
|
||||
await success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
showLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**เมื่อเริ่มโหลดหน้า
|
||||
|
|
@ -107,7 +61,6 @@ async function deleteData(id: string) {
|
|||
*/
|
||||
onMounted(() => {
|
||||
getList();
|
||||
// get ข้อมูลแล้วโยนใส่ store
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -122,19 +75,22 @@ function resetFilter() {
|
|||
}
|
||||
}
|
||||
|
||||
function filterFn() {
|
||||
getList();
|
||||
console.log("enter", filterKeyword.value);
|
||||
}
|
||||
/**
|
||||
*pagination ของตาราง
|
||||
*/
|
||||
const pagination = ref({
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">รายการการประชุม</div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
||||
<div class="row col-12 q-col-gutter-sm q-mb-sm">
|
||||
<div>
|
||||
<div v-if="checkPermission($route)?.attrIsCreate">
|
||||
<q-btn
|
||||
@click="router.push(`/evaluate/meeting/add`)"
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="add"
|
||||
|
|
@ -154,7 +110,6 @@ function filterFn() {
|
|||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
@keydown.enter.prevent="filterFn"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterKeyword == ''" name="search" />
|
||||
|
|
@ -197,17 +152,6 @@ function filterFn() {
|
|||
v-model:pagination="pagination"
|
||||
:visible-columns="dataStore.visibleColumns"
|
||||
>
|
||||
<!-- <template v-slot:pagination="scope">
|
||||
<q-pagination
|
||||
v-model="currentPage"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="Number(maxPage)"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template> -->
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
|
|
@ -217,26 +161,50 @@ function filterFn() {
|
|||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-tr :props="props">
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsGet"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
color="info"
|
||||
icon="mdi-eye"
|
||||
@click.pervent="
|
||||
router.push(`/evaluate/meeting-detail/${props.row.id}`)
|
||||
"
|
||||
>
|
||||
<q-tooltip>รายละเอียด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="
|
||||
checkPermission($route)?.attrIsGet &&
|
||||
checkPermission($route)?.attrIsUpdate
|
||||
"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
color="edit"
|
||||
icon="edit"
|
||||
@click.pervent="
|
||||
router.push(`/evaluate/meeting/${props.row.id}`)
|
||||
"
|
||||
>
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsDelete"
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="red"
|
||||
@click="clickDelete(props.row.id)"
|
||||
@click.pervent="clickDelete(props.row.id)"
|
||||
icon="mdi-delete"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
@click="router.push(`/evaluate/meeting/${props.row.id}`)"
|
||||
>
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
|
|
@ -244,7 +212,6 @@ function filterFn() {
|
|||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ const directorPage = () =>
|
|||
import("@/modules/12_evaluatePersonal/components/Director/MainPage.vue");
|
||||
const directorAddPage = () =>
|
||||
import("@/modules/12_evaluatePersonal/components/Director/AddPage.vue");
|
||||
const directorEditPage = () =>
|
||||
import("@/modules/12_evaluatePersonal/components/Director/EditPage.vue");
|
||||
// const directorEditPage = () =>
|
||||
// import("@/modules/12_evaluatePersonal/components/Director/EditPage.vue");
|
||||
|
||||
const meetingPage = () =>
|
||||
import("@/modules/12_evaluatePersonal/components/Meeting/MainPage.vue");
|
||||
|
|
@ -58,16 +58,16 @@ export default [
|
|||
Role: "STAFF",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/evaluate/director/:id",
|
||||
name: "evaluateDirectorEdit",
|
||||
component: directorEditPage,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: "SYS_EVA_INFO",
|
||||
Role: "STAFF",
|
||||
},
|
||||
},
|
||||
// {
|
||||
// path: "/evaluate/director/:id",
|
||||
// name: "evaluateDirectorEdit",
|
||||
// component: directorEditPage,
|
||||
// meta: {
|
||||
// Auth: true,
|
||||
// Key: "SYS_EVA_INFO",
|
||||
// Role: "STAFF",
|
||||
// },
|
||||
// },
|
||||
{
|
||||
path: "/evaluate/meeting",
|
||||
name: "evaluateMeeting",
|
||||
|
|
@ -98,4 +98,14 @@ export default [
|
|||
Role: "STAFF",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/evaluate/meeting-detail/:id",
|
||||
name: "evaluateMeetingdetail",
|
||||
component: meetingEditPage,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: "SYS_EVA_INFO",
|
||||
Role: "STAFF",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue