ปรับ popup history
This commit is contained in:
parent
9e1386c052
commit
0a4aa8384a
2 changed files with 207 additions and 87 deletions
|
|
@ -3,7 +3,14 @@ import { ref, reactive, watch } from "vue";
|
|||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { HistoryType } from "@/modules/02_organizationalNew/interface/index/Main";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import Modal from "@/modules/05_placement/components/AppointEmployee/Modal.vue";
|
||||
import { getDateMeta } from "@fullcalendar/core/internal";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const props = defineProps({
|
||||
modal: Boolean,
|
||||
|
|
@ -12,102 +19,193 @@ const props = defineProps({
|
|||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm } = mixin;
|
||||
|
||||
const rows = ref<any[]>([]);
|
||||
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||
const rows = ref<HistoryType[]>([]);
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: false,
|
||||
field: "no",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
align: "left",
|
||||
label: "ชื่อ",
|
||||
sortable: true,
|
||||
field: "name",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "lastUpdatedAt",
|
||||
align: "left",
|
||||
label: "วันที่แก้ไข",
|
||||
sortable: true,
|
||||
field: "lastUpdatedAt",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
|
||||
]);
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"name",
|
||||
"lastUpdatedAt",
|
||||
]);
|
||||
{
|
||||
name: "no",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: false,
|
||||
field: "no",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "orgRevisionName",
|
||||
align: "left",
|
||||
label: "ชื่อโครงสร้าง",
|
||||
sortable: true,
|
||||
field: "orgRevisionName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "lastUpdatedAt",
|
||||
align: "left",
|
||||
label: "วันที่แก้ไข",
|
||||
sortable: true,
|
||||
field: "lastUpdatedAt",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "orgRevisionIsCurrent",
|
||||
align: "center",
|
||||
label: "โครงสร้างที่ใช้อยู่",
|
||||
sortable: false,
|
||||
field: "orgRevisionIsCurrent",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "orgRevisionIsDraft",
|
||||
align: "center",
|
||||
label: "โครงสร้างแบบร่าง",
|
||||
sortable: false,
|
||||
field: "orgRevisionIsDraft",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "orgRevisionCreatedAt",
|
||||
align: "left",
|
||||
label: "วันเริ่มใช้โครงสร้าง",
|
||||
sortable: true,
|
||||
field: "orgRevisionCreatedAt",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"orgRevisionName",
|
||||
"orgRevisionIsCurrent",
|
||||
"orgRevisionIsDraft",
|
||||
"orgRevisionCreatedAt",
|
||||
]);
|
||||
|
||||
function getDate() {
|
||||
const dataDraft: HistoryType[] = [
|
||||
{
|
||||
orgRevisionId: "00000000-0000-0000-0000-000000000000",
|
||||
orgRevisionName: "xxxx",
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionCreatedAt: date2Thai(new Date(),false,true),
|
||||
},
|
||||
{
|
||||
orgRevisionId: "00000000-0000-0000-0000-000000000001",
|
||||
orgRevisionName: "xxx1",
|
||||
orgRevisionIsCurrent: false,
|
||||
orgRevisionIsDraft: true,
|
||||
orgRevisionCreatedAt: date2Thai(new Date(),false,true),
|
||||
},
|
||||
];
|
||||
rows.value = dataDraft;
|
||||
// รอ API
|
||||
// showLoader()
|
||||
// http
|
||||
// .get(config.API.organizationHistoryNew)
|
||||
// .then((res)=>{
|
||||
// const dataList = res.data.result
|
||||
// dataList.map((item:HistoryType)=>(
|
||||
// {
|
||||
// orgRevisionId:item.orgRevisionId ? item.orgRevisionId:'-',
|
||||
// orgRevisionName:item.orgRevisionName ? item.orgRevisionName:'-',
|
||||
// orgRevisionIsCurrent:item.orgRevisionIsCurrent ? item.orgRevisionIsCurrent:'-',
|
||||
// orgRevisionIsDraft:item.orgRevisionIsDraft ? item.orgRevisionIsDraft:'-',
|
||||
// orgRevisionCreatedAt:item.orgRevisionCreatedAt ? date2Thai(item.orgRevisionCreatedAt):'-',
|
||||
// }
|
||||
// ))
|
||||
// rows.value = dataList
|
||||
// }).catch((e)=>{
|
||||
// messageError($q,e)
|
||||
// })
|
||||
// .finally(()=>{
|
||||
// hideLoader()
|
||||
// })
|
||||
}
|
||||
watch(
|
||||
() => props.modal,
|
||||
() => {
|
||||
if (props.modal == true) {
|
||||
getDate();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<template>
|
||||
<q-dialog v-model="props.modal" persistent>
|
||||
<q-card style="min-width: 40vw">
|
||||
<DialogHeader :tittle="`ประวัติโครงสร้าง`" :close="props.close" />
|
||||
<q-separator />
|
||||
<DialogHeader :tittle="`ประวัติโครงสร้าง`" :close="props.close" />
|
||||
<q-separator />
|
||||
|
||||
<q-card-section>
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="idcard"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="visibleColumns"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<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-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>
|
||||
</div>
|
||||
<q-card-section>
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="idcard"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="visibleColumns"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<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-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-if="col.name == 'orgRevisionIsCurrent'">
|
||||
<q-icon
|
||||
:name="props.row.orgRevisionIsCurrent == true ? 'mdi-check':'mdi-close'"
|
||||
:color="props.row.orgRevisionIsCurrent == true ? 'positive':'red'"
|
||||
class="text-h5"
|
||||
/>
|
||||
</div>
|
||||
<div v-else-if="col.name == 'orgRevisionIsDraft'">
|
||||
<q-icon
|
||||
:name="props.row.orgRevisionIsDraft == true ? 'mdi-check':'mdi-close'"
|
||||
:color="props.row.orgRevisionIsDraft == true ? 'positive':'red'"
|
||||
class="text-h5"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -40,18 +40,40 @@ interface FormAgencyRef {
|
|||
tel: object | null;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface FormPositionRef {
|
||||
prefixNo: object | null;
|
||||
positionNo: object | null;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface FormDateTimeRef {
|
||||
dateTime: object | null;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface FormNewStructureRef {
|
||||
orgRevisionName: object | null;
|
||||
type: object | null;
|
||||
[key: string]: any;
|
||||
}
|
||||
export type { Pagination, DataOption, FormDataAgency, FormDataPosition, FormAgencyRef, FormPositionRef, FormDateTimeRef,FormDataNewStructure,FormNewStructureRef };
|
||||
|
||||
interface HistoryType {
|
||||
orgRevisionId: string
|
||||
orgRevisionName: string
|
||||
orgRevisionIsCurrent: boolean
|
||||
orgRevisionIsDraft: boolean
|
||||
orgRevisionCreatedAt: any
|
||||
}
|
||||
export type {
|
||||
Pagination,
|
||||
DataOption,
|
||||
FormDataAgency,
|
||||
FormDataPosition,
|
||||
FormAgencyRef,
|
||||
FormPositionRef,
|
||||
FormDateTimeRef,
|
||||
FormDataNewStructure,
|
||||
FormNewStructureRef,
|
||||
HistoryType
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue