Merge branch 'develop' into devTee

# Conflicts:
#	src/modules/12_evaluatePersonal/views/MainPage.vue
This commit is contained in:
setthawutttty 2023-12-21 16:35:16 +07:00
commit 4cbf6fa473
8 changed files with 230 additions and 110 deletions

View file

@ -18,6 +18,7 @@ const props = defineProps({
}, },
clickClose: { clickClose: {
type: Function, type: Function,
default: () => {},
}, },
type: { type: {
type: String, type: String,
@ -46,7 +47,7 @@ const rows = ref<any[]>([]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "degree", name: "degree",
align: "center", align: "left",
label: "คุณวุฒิ", label: "คุณวุฒิ",
sortable: false, sortable: false,
field: "degree", field: "degree",
@ -55,7 +56,7 @@ const columns = ref<QTableProps["columns"]>([
}, },
{ {
name: "level", name: "level",
align: "left", align: "center",
label: "ระดับ", label: "ระดับ",
sortable: true, sortable: true,
field: "level", field: "level",
@ -76,63 +77,137 @@ const columns = ref<QTableProps["columns"]>([
]); ]);
const visibleColumns = ref<String[]>(["degree", "level", "Expert"]); const visibleColumns = ref<String[]>(["degree", "level", "Expert"]);
const columnsSpecial = ref<QTableProps["columns"]>([
{
name: "degree",
align: "left",
label: "คุณวุฒิ",
sortable: false,
field: "degree",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "level",
align: "center",
label: "ระดับ",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "Special",
align: "center",
label: "ชำนาญการพิเศษ",
sortable: false,
field: "Special",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const visibleColumnsSpecial = ref<String[]>(["degree", "level", "Special"]);
</script> </script>
<template> <template>
<q-dialog v-model="props.modal" persistent> <q-dialog v-model="props.modal" persistent>
<q-card style="width: 35vw; max-width: 35vw"> <q-card style="width: 35vw; max-width: 35vw" v-if="props.type === 'EXPERT'">
<d-table <DialogHeader :tittle="props.title" :close="clickClose" />
ref="table" <q-separator />
:columns="columns" <q-card-section class="q-pa-sm bg-grey-1">
:rows="rows" <d-table
:filter="filter" ref="table"
row-key="interrogated" :columns="columns"
flat :rows="rows"
bordered :filter="filter"
:paging="true" row-key="interrogated"
dense flat
class="custom-header-table" bordered
v-bind="attrs" :paging="true"
:visible-columns="visibleColumns" dense
v-model:pagination="pagination" class="custom-header-table"
> v-bind="attrs"
<template v-slot:header="props"> :visible-columns="visibleColumns"
<q-tr :props="props"> v-model:pagination="pagination"
<q-th auto-width></q-th> >
<q-th <template v-slot:header="props">
v-for="col in props.cols" <q-tr :props="props">
:key="col.name" <q-th auto-width></q-th>
:props="props" <q-th
style="color: #000000; font-weight: 500" v-for="col in props.cols"
> :key="col.name"
<span class="text-weight-medium">{{ col.label }}</span> :props="props"
</q-th> style="color: #000000; font-weight: 500"
<!-- <q-th auto-width></q-th> -->
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-icon
v-if="props.row.isDefault === true"
name="mdi-bookmark"
size="xs"
color="primary"
> >
<q-tooltip>เวลา Default</q-tooltip> <span class="text-weight-medium">{{ col.label }}</span>
</q-icon> </q-th>
</q-td> <!-- <q-th auto-width></q-th> -->
<q-td v-for="col in props.cols" :key="col.name" :props="props"> </q-tr>
<div v-if="col.name == 'no'"> </template>
{{ props.rowIndex + 1 }} <template v-slot:body="props">
</div> <q-tr :props="props" class="cursor-pointer">
<div v-else> <q-td v-for="col in props.cols" :key="col.name" :props="props">
{{ col.value }} <div v-if="col.name == 'no'">
</div> {{ props.rowIndex + 1 }}
</q-td> </div>
</q-tr> <div v-else>
</template> {{ col.value }}
</d-table> </div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
<q-card style="width: 35vw; max-width: 35vw" v-else>
<DialogHeader :tittle="props.title" :close="clickClose" />
<q-separator />
<q-card-section class="q-pa-sm bg-grey-1">
<d-table
ref="table"
:columns="columnsSpecial"
:rows="rows"
:filter="filter"
row-key="interrogated"
flat
bordered
:paging="true"
dense
class="custom-header-table"
v-bind="attrs"
:visible-columns="visibleColumnsSpecial"
v-model:pagination="pagination"
>
<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"
style="color: #000000; font-weight: 500"
>
<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'">
{{ props.rowIndex + 1 }}
</div>
<div v-else>
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -525,9 +525,10 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
) )
" "
> >
<q-item-section class="text-blue" <q-item-section avatar
>ดาวนโหลดไฟล .docx</q-item-section ><q-icon color="blue" name="mdi-file-word"
> /></q-item-section>
<q-item-section>ไฟล .DOCX</q-item-section>
</q-item> </q-item>
<q-item <q-item
clickable clickable
@ -540,9 +541,10 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
) )
" "
> >
<q-item-section class="text-red" <q-item-section avatar
>ดาวนโหลดไฟล .pdf</q-item-section ><q-icon color="red" name="mdi-file-pdf"
> /></q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
</q-menu> </q-menu>

View file

@ -462,14 +462,15 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
@click=" @click="
onClickDownloadFile( onClickDownloadFile(
formData.id, formData.id,
formData.leaveTypeName, 'ยกเลิก' + formData.leaveTypeName,
typeDocx typeDocx
) )
" "
> >
<q-item-section class="text-blue" <q-item-section avatar
>ดาวนโหลดไฟล .docx</q-item-section ><q-icon color="blue" name="mdi-file-word"
> /></q-item-section>
<q-item-section>ไฟล .DOCX</q-item-section>
</q-item> </q-item>
<q-item <q-item
clickable clickable
@ -477,14 +478,15 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
@click=" @click="
onClickDownloadFile( onClickDownloadFile(
formData.id, formData.id,
formData.leaveTypeName, 'ยกเลิก' + formData.leaveTypeName,
typePdf typePdf
) )
" "
> >
<q-item-section class="text-red" <q-item-section avatar
>ดาวนโหลดไฟล .pdf</q-item-section ><q-icon color="red" name="mdi-file-pdf"
> /></q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
</q-menu> </q-menu>

View file

@ -24,12 +24,12 @@ function addData(formData: any) {
showLoader(); showLoader();
http http
.post(config.API.meeting(), { .post(config.API.meeting(), {
Round: formData.rounded ?? "", round: formData.rounded ?? "",
Tittle: formData.title, tittle: formData.title,
DateEnd: formData.dateMeetingEnd, dateEnd: formData.dateMeetingEnd,
DateStart: formData.dateMeetingStart, dateStart: formData.dateMeetingStart,
Result: formData.consider, result: formData.consider,
Duration: formData.period, duration: formData.period,
}) })
.then((res) => { .then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");

View file

@ -11,7 +11,9 @@ import config from "@/app.config";
import type { formData } from "@/modules/09_leave/interface/request/workTime"; import type { formData } from "@/modules/09_leave/interface/request/workTime";
const route = useRoute(); const route = useRoute();
const personalId = ref<string>(route.params.id.toString()); const personalId = ref<string>(route.params.id as string);
console.log(personalId.value);
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
@ -21,6 +23,7 @@ const {
dialogConfirm, dialogConfirm,
success, success,
date2Thai, date2Thai,
dateToISO,
} = mixin; } = mixin;
/** /**
@ -53,16 +56,13 @@ const fetchData = async () => {
.get(config.API.meetingById(personalId.value)) .get(config.API.meetingById(personalId.value))
.then((res) => { .then((res) => {
const dataApi = res.data.result; const dataApi = res.data.result;
personalId.value = dataApi.id; data.title = dataApi.tittle;
data.title = dataApi.Tittle; 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.dateStart;
data.dateMeetingStart = dataApi.DateStart; data.dateMeetingEnd = dataApi.dateEnd;
data.dateMeetingEnd = date2Thai(dataApi.DateEnd, false, true);
data.file = dataApi.file; data.file = dataApi.file;
console.log(data.dateMeetingStart);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -78,18 +78,19 @@ const fetchData = async () => {
*/ */
function onSubmit(formData: FormData) { function onSubmit(formData: FormData) {
dialogConfirm($q, () => putData(formData)); dialogConfirm($q, () => putData(formData));
console.log(personalId.value);
} }
function putData(formData: FormData) { function putData(formData: any) {
showLoader(); showLoader();
http http
.put(config.API.meetingById(personalId.value), { .put(config.API.meetingById(personalId.value), {
Round: formData.rounded ?? "", round: formData.rounded ?? "",
Tittle: formData.title, tittle: formData.title,
DateStart: formData.dateMeetingStart, dateStart: dateToISO(formData.dateMeetingStart),
DateEnd: formData.dateMeetingEnd, dateEnd: dateToISO(formData.dateMeetingEnd),
Result: formData.consider, result: formData.consider,
Duration: formData.period, duration: formData.period,
}) })
.then((res) => { .then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
@ -98,7 +99,8 @@ function putData(formData: FormData) {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(async () => {
router.push(`/discipline/meeting`); hideLoader();
router.push(`/evaluate/meeting`);
}); });
} }
</script> </script>

View file

@ -54,15 +54,16 @@ async function getList() {
showLoader(); showLoader();
await http await http
.get( .get(
config.API.meeting( config.API
.meeting
// currentPage.value, // currentPage.value,
// rowsPerPage.value, // rowsPerPage.value,
// filterKeyword.value // filterKeyword.value
) ()
) )
.then((res) => { .then((res) => {
// maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); // maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
const data = res.data.result const data = res.data.result;
dataStore.fetchData(data); dataStore.fetchData(data);
}) })
.catch((e) => { .catch((e) => {
@ -71,8 +72,6 @@ async function getList() {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
} }
/** /**
@ -88,6 +87,7 @@ function clickDelete(id: string) {
* @param id type * @param id type
*/ */
async function deleteData(id: string) { async function deleteData(id: string) {
console.log(id);
showLoader(); showLoader();
await http await http
.delete(config.API.meetingById(id)) .delete(config.API.meetingById(id))

View file

@ -60,22 +60,22 @@ export const useEvaluateMeetingDataStore = defineStore(
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
function fetchData(data: any[]) { function fetchData(data: any[]) {
const dataList: any[] = data.map((item: any) => ({ const dataList: any[] = data.map((item: any) => ({
id: item.Id, id: item.id,
createdAt: item.CreatedAt, createdAt: item.createdAt,
createdUserId: item.CreatedUserId, createdUserId: item.createdUserId,
lastUpdatedAt: item.LastUpdatedAt, lastUpdatedAt: item.lastUpdatedAt,
lastUpdateUserId: item.LastUpdateUserId, lastUpdateUserId: item.lastUpdateUserId,
createdFullName: item.CreatedFullName, createdFullName: item.createdFullName,
lastUpdateFullName: item.LastUpdateFullName, lastUpdateFullName: item.lastUpdateFullName,
title: item.Tittle, title: item.tittle,
round: item.Round, round: item.round,
date: `${date2Thai(item.DateStart as Date, false, true)} - ${date2Thai( date: `${date2Thai(item.dateStart as Date, false, true)} - ${date2Thai(
item.DateEnd as Date, item.dateEnd as Date,
false, false,
true true
)}`, )}`,
result: item.Result, result: item.result,
duration: item.Duration, duration: item.duration,
})); }));
rows.value = dataList; rows.value = dataList;
} }

View file

@ -56,6 +56,10 @@ watch(
} }
); );
function filterFn() {
getList();
console.log("enter", filter.value);
}
function getList() { function getList() {
showLoader(); showLoader();
http http
@ -92,6 +96,41 @@ onMounted(async () => {
รายการคำขอประเม รายการคำขอประเม
</div> </div>
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md"> <q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md">
<div class="row col-12 q-col-gutter-sm q-mb-sm">
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
id="filterTable"
for="filterTable"
dense
outlined
v-model="filter"
label="ค้นหา"
debounce="300"
@keydown.enter.prevent="filterFn"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
id="visibleColumns"
for="visibleColumns"
v-model="store.visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="store.columns"
option-value="name"
options-cover
class="col-xs-12 col-sm-3 col-md-2"
/>
</div>
<div> <div>
<d-table <d-table
ref="table" ref="table"