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: {
type: Function,
default: () => {},
},
type: {
type: String,
@ -46,7 +47,7 @@ const rows = ref<any[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "degree",
align: "center",
align: "left",
label: "คุณวุฒิ",
sortable: false,
field: "degree",
@ -55,7 +56,7 @@ const columns = ref<QTableProps["columns"]>([
},
{
name: "level",
align: "left",
align: "center",
label: "ระดับ",
sortable: true,
field: "level",
@ -76,63 +77,137 @@ const columns = ref<QTableProps["columns"]>([
]);
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>
<template>
<q-dialog v-model="props.modal" persistent>
<q-card style="width: 35vw; max-width: 35vw">
<d-table
ref="table"
:columns="columns"
:rows="rows"
:filter="filter"
row-key="interrogated"
flat
bordered
:paging="true"
dense
class="custom-header-table"
v-bind="attrs"
:visible-columns="visibleColumns"
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 auto-width>
<q-icon
v-if="props.row.isDefault === true"
name="mdi-bookmark"
size="xs"
color="primary"
<q-card style="width: 35vw; max-width: 35vw" v-if="props.type === 'EXPERT'">
<DialogHeader :tittle="props.title" :close="clickClose" />
<q-separator />
<q-card-section class="q-pa-sm bg-grey-1">
<d-table
ref="table"
:columns="columns"
:rows="rows"
:filter="filter"
row-key="interrogated"
flat
bordered
:paging="true"
dense
class="custom-header-table"
v-bind="attrs"
:visible-columns="visibleColumns"
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"
>
<q-tooltip>เวลา Default</q-tooltip>
</q-icon>
</q-td>
<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>
<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 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-dialog>
</template>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -56,6 +56,10 @@ watch(
}
);
function filterFn() {
getList();
console.log("enter", filter.value);
}
function getList() {
showLoader();
http
@ -92,6 +96,41 @@ onMounted(async () => {
รายการคำขอประเม
</div>
<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>
<d-table
ref="table"