ปรับ code ประเมิน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-15 10:07:03 +07:00
parent ab4189e6ed
commit 53cd8e593c
10 changed files with 171 additions and 226 deletions

View file

@ -47,7 +47,7 @@ onMounted(async () => {
</script>
<template>
<div class="row col-12">
<div class="row col-12 q-pa-md">
<div class="toptitle">กรรมการและการประช</div>
<div class="row col-12 q-gutter-md">

View file

@ -1,15 +1,21 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/** importComponents */
import HeaderDialog from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/**use*/
const mixins = useCounterMixin();
const { showLoader, hideLoader, date2Thai } = mixins;
const $q = useQuasar();
const { showLoader, hideLoader, date2Thai, messageError } = mixins;
/** รับ props Tab 1 */
const props = defineProps({
@ -91,7 +97,9 @@ async function fetchListHistory(id: string) {
}));
row.value = list;
})
.catch((err) => {})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});

View file

@ -44,10 +44,9 @@ function getFile(volume: number) {
.then((res) => {
const link = res.data.downloadUrl;
const type = res.data.fileType;
getPDF(link, type);
})
.catch((e) => {
.catch(() => {
// messageError($q, e);
})
.finally(() => {
@ -116,8 +115,8 @@ function numToThai(val: number) {
}
}
onMounted(() => {
getFile(selectedItem.value);
onMounted(async () => {
await getFile(selectedItem.value);
});
</script>

View file

@ -3,25 +3,26 @@ import { ref, onMounted, defineProps, watch } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
/** importType*/
import type { QTableProps } from "quasar";
import type { Director } from "@/modules/11_discipline/interface/request/disciplinary";
import type {
responseType,
directorType,
} from "@/modules/11_discipline/interface/index/Main";
/** importComponents*/
import DialogDirector from "@/modules/12_evaluatePersonal/components/Detail/viewTab2/DialogDirector.vue";
/** import store*/
import { useCounterMixin } from "@/stores/mixin";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
/**use*/
const route = useRoute();
const id = ref<string>(route.params.id as string);
const mixin = useCounterMixin();
const $q = useQuasar();
const { showLoader, hideLoader, messageError, dialogConfirm, success } = mixin;
const props = defineProps({
data: {
type: Array,
@ -30,10 +31,10 @@ const props = defineProps({
fetchdata: {
type: Function,
default: () => "",
}
},
});
const { showLoader, hideLoader, messageError, dialogConfirm, success } = mixin;
/** คอลัมน์ กรรมการ */
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -98,40 +99,6 @@ function onClickClose() {
modalAddDirector.value = false;
}
/** function เรียกรายชื่อกรรมการ*/
async function fetchDListDirector() {
// showLoader();
// await http
// .get(config.API.directorList(page.value, rowsPerPage.value, filter.value))
// .then((res) => {
// maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
// const data = res.data.result.data;
// let datalistDirector: responseType[] = data.map((e: directorType) => ({
// id: e.id,
// directorId: e.directorId,
// name: `${e.prefix}${e.firstName} ${e.lastName}`,
// prefix: e.prefix,
// firstName: e.firstName,
// lastName: e.lastName,
// position: e.position,
// email: e.email,
// phone: e.phone,
// total: e.total,
// duty: e.duty,
// }));
// // /** */
// listDirector.value = datalistDirector.filter(
// (i) => !rows.value.some((e) => e.directorId === i.id)
// );
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
}
/**
* function ดเดท Paging กรรมการ
* @param rpp อหน
@ -154,28 +121,27 @@ function returnDirector(data: any) {
.put(config.API.evaluationChooseDirectors(id.value), {
directors: dataList,
})
.then((res) => {
success($q, "บันทึกสำเร็จ")
.then(() => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
props.fetchdata()
props.fetchdata();
onClickClose();
hideLoader();
});
});
}
function getList() {
/** function เรียกรายชื่อกรรมการ*/
async function getList() {
showLoader();
http
await http
.get(config.API.evaluateDirectorMain())
.then((res) => {
// maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
const data = res.data.result;
listDirector.value = data.map((item: any) => ({
id: item.id,
name: `${item.prefix}${item.firstName} ${item.lastName}`,
@ -206,15 +172,15 @@ watch(
() => {
if (props.data) {
rows.value = props.data.map((item: any) => ({
id:item.id,
name:`${item.prefix}${item.firstName} ${item.lastName}`,
prefix:item.prefix,
firstName:item.firstName,
lastName:item.lastName,
position:item.position,
positionName:item.positionName,
email:item.email,
phone:item.phone,
id: item.id,
name: `${item.prefix}${item.firstName} ${item.lastName}`,
prefix: item.prefix,
firstName: item.firstName,
lastName: item.lastName,
position: item.position,
positionName: item.positionName,
email: item.email,
phone: item.phone,
}));
}
}
@ -285,7 +251,6 @@ onMounted(() => {
:clickClose="onClickClose"
:rows2="listDirector"
v-model:filterKeyword2="filter"
:get-list="fetchDListDirector"
:rowsPerPage="rowsPerPage"
:page="page"
:maxPage="maxPage"

View file

@ -2,16 +2,23 @@
import { ref, onMounted, watch, defineProps } from "vue";
import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRouter, useRoute } from "vue-router";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
const router = useRouter();
/** importComponents*/
import DialogMeet from "@/modules/12_evaluatePersonal/components/Detail/viewTab2/DialogMeet.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/** use*/
const route = useRoute();
const id = ref<string>(route.params.id as string);
const mixin = useCounterMixin();
const $q = useQuasar();
/** props*/
const props = defineProps({
data: {
type: Array,
@ -20,11 +27,17 @@ const props = defineProps({
fetchdata: {
type: Function,
default: () => "",
}
},
});
const { showLoader, hideLoader, messageError, dialogConfirm, date2Thai, success } =
mixin;
import DialogMeet from "@/modules/12_evaluatePersonal/components/Detail/viewTab2/DialogMeet.vue";
const {
showLoader,
hideLoader,
messageError,
dialogConfirm,
date2Thai,
success,
} = mixin;
const columns = ref<QTableProps["columns"]>([
{
@ -90,8 +103,6 @@ function onClickClose() {
modalAdd.value = false;
}
async function fetchListMeet() {}
/**
* function ดเดท Paging กรรมการ
* @param rpp อหน
@ -115,32 +126,25 @@ function returnData(data: any) {
meetings: dataList,
})
.then((res) => {
success($q, "บันทึกสำเร็จ")
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
props.fetchdata()
props.fetchdata();
onClickClose();
hideLoader();
});
});
}
/** function เรียกข้อมูลการประชุม*/
async function getList() {
showLoader();
await http
.get(
config.API
.meeting
// currentPage.value,
// rowsPerPage.value,
// filterKeyword.value
()
)
.get(config.API.meeting())
.then((res) => {
// maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
const data = res.data.result;
listMeet.value = data.map((item: any) => ({
id: item.id,
@ -168,15 +172,11 @@ async function getList() {
hideLoader();
});
}
onMounted(() => {
getList();
});
watch(
() => props.data,
() => {
if (props.data) {
console.log(props.data)
rows.value = props.data.map((item: any) => ({
id: item.id,
date: `${date2Thai(item.dateStart as Date, false, true)} - ${date2Thai(
@ -192,6 +192,10 @@ watch(
}
}
);
onMounted(async () => {
await getList();
});
</script>
<template>
<q-card bordered class="row col-12" style="border: 1px solid #d6dee1">
@ -253,7 +257,6 @@ watch(
:clickClose="onClickClose"
:rows2="listMeet"
v-model:filterKeyword2="filter"
:get-list="fetchListMeet"
:rowsPerPage="rowsPerPage"
:page="page"
:maxPage="maxPage"

View file

@ -1,17 +1,50 @@
<script setup lang="ts">
import { ref, computed, watchEffect, watch, type PropType } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
/** importType*/
import type { QTableProps } from "quasar";
import type { directorType } from "@/modules/11_discipline/interface/index/Main";
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const selected = ref<directorType[]>([]);
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
Modal: Boolean,
clickClose: Function,
getData: Function,
rows2: Array,
filterKeyword2: String,
filterTable: {
type: String,
default: "",
},
maxPage: {
type: Number,
require: true,
},
rowsPerPage: {
type: Number,
require: true,
},
page: {
type: Number,
require: true,
},
getList: {
type: Function,
default: () => "",
},
selectedRow: {
type: Array as PropType<directorType[]>,
required: true,
},
});
const currentPage = ref<number>(1);
/** ค้นหาคอลัม */
const visibleColumns2 = ref<string[]>([
"no",
@ -70,39 +103,6 @@ const columns2 = ref<QTableProps["columns"]>([
},
]);
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
Modal: Boolean,
clickClose: Function,
getData: Function,
rows2: Array,
filterKeyword2: String,
filterTable: {
type: String,
default: "",
},
maxPage: {
type: Number,
require: true,
},
rowsPerPage: {
type: Number,
require: true,
},
page: {
type: Number,
require: true,
},
getList: {
type: Function,
default: () => "",
},
selectedRow: {
type: Array as PropType<directorType[]>,
required: true,
},
});
/** แสดงจำนวนในตาราง */
const pagination = ref({
descending: true,
@ -146,7 +146,6 @@ function updateProp(newPagination: any, page: number) {
watchEffect(() => {
if (props.Modal === true) {
selected.value = props.selectedRow;
props.getList();
}
});

View file

@ -1,26 +1,55 @@
<script setup lang="ts">
import { ref, computed, watchEffect, watch, type PropType } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
/** importType*/
import type { QTableProps } from "quasar";
import type { directorType } from "@/modules/11_discipline/interface/index/Main";
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const selected = ref<directorType[]>([]);
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
const currentPage = ref<number>(1);
/** ค้นหาคอลัม */
const visibleColumns2 = ref<string[]>([
"no",
"name",
"position",
"duty",
"email",
"phone",
"role",
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
Modal: Boolean,
clickClose: Function,
getData: Function,
rows2: Array,
filterKeyword2: String,
filterTable: {
type: String,
default: "",
},
maxPage: {
type: Number,
require: true,
},
rowsPerPage: {
type: Number,
require: true,
},
page: {
type: Number,
require: true,
},
getList: {
type: Function,
default: () => "",
},
selectedRow: {
type: Array as PropType<directorType[]>,
required: true,
},
});
/** emit*/
const emit = defineEmits([
"update:filterKeyword2",
"update:selected",
"update:pagination",
"returnDirector",
]);
/**ข้อมูลหัว ตาราง*/
@ -72,39 +101,6 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
Modal: Boolean,
clickClose: Function,
getData: Function,
rows2: Array,
filterKeyword2: String,
filterTable: {
type: String,
default: "",
},
maxPage: {
type: Number,
require: true,
},
rowsPerPage: {
type: Number,
require: true,
},
page: {
type: Number,
require: true,
},
getList: {
type: Function,
default: () => "",
},
selectedRow: {
type: Array as PropType<directorType[]>,
required: true,
},
});
/** แสดงจำนวนในตาราง */
const pagination = ref({
descending: true,
@ -118,13 +114,6 @@ const checkSelected = computed(() => {
}
});
const emit = defineEmits([
"update:filterKeyword2",
"update:selected",
"update:pagination",
"returnDirector",
]);
/** เลือกกรรมการ */
async function onClickAddMeet() {
emit("returnDirector", selected.value);
@ -148,7 +137,6 @@ function updateProp(newPagination: any, page: number) {
watchEffect(() => {
if (props.Modal === true) {
selected.value = props.selectedRow;
props.getList();
}
});

View file

@ -26,6 +26,7 @@ export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => {
const pdfSrcStore = ref<any>();
const numOfPagesStore = ref<any>();
/** คอลัมน์ ใบอนุญาตประกอบวิชาชีพ*/
const columnsCertificates = ref<QTableProps["columns"]>([
{
name: "certificateType",
@ -74,6 +75,7 @@ export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => {
},
]);
/** คอลัมน์ ประวัติการรับราชการ*/
const columnSalaries = ref<QTableProps["columns"]>([
{
name: "date",
@ -167,6 +169,7 @@ export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => {
},
]);
/** คอลัมน์ ประวัติการฝึกอบรมดูงาน*/
const columnTraining = ref<QTableProps["columns"]>([
{
name: "name",
@ -233,6 +236,7 @@ export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => {
},
]);
/** คอลัมน์ ผลงานที่เคยเสนอขอประเมิน*/
const columnProjectsProposed = ref<QTableProps["columns"]>([
{
name: "receivedDate",

View file

@ -1,10 +1,7 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import type {
DataResponseList,
MainList,
} from "@/modules/12_evaluatePersonal/interface/index/meeting";
import type { QTableProps } from "quasar";
// store ระบบวินัย >> ข้อมูลพื้นฐาน >> กรรมการ

View file

@ -5,6 +5,7 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType*/
import type { OptionStatus } from "@/modules/12_evaluatePersonal/interface/index/Main";
/** importStore*/
@ -18,6 +19,7 @@ const mixin = useCounterMixin();
const store = useEvalutuonStore();
const { showLoader, hideLoader, messageError } = mixin;
/** request body*/
const currentPage = ref<number>(1);
const maxPage = ref<number>(0);
const page = ref<number>(1);
@ -92,13 +94,13 @@ function resetFilter() {
/** function เรียกรายการคำขอประเมิน*/
async function fetchEvaluteList() {
showLoader();
const body = {
page: currentPage.value,
pageSize: pageSize.value,
keyword: filter.value,
status: selectedStatus.value,
};
showLoader();
await http
.put(config.API.evaluationMain(), body)
.then(async (res) => {
@ -109,7 +111,7 @@ async function fetchEvaluteList() {
store.fetchData(data);
})
.catch((e) => {
// messageError($q, e);
messageError($q, e);
})
.finally(() => {
hideLoader();
@ -269,47 +271,15 @@ onMounted(async () => {
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<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></q-th>
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width></q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<!-- <q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ (page - 1) * rowsPerPage + props.rowIndex + 1 }}
</div>
<div v-else>
{{ col.value }}
</div>
</q-td> -->
<q-td auto-width>
<q-icon
v-if="props.row.isDefault === true"
name="mdi-bookmark"
size="xs"
color="primary"
>
<q-tooltip>เวลา Default</q-tooltip>
</q-icon>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
@ -325,6 +295,18 @@ onMounted(async () => {
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="currentPage"
active-color="primary"
color="dark"
:max="Number(maxPage)"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</d-table>
</div>
</q-card>