From 0a4aa8384adb5bcb59e1d2e350f6fe43a6ff3367 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 26 Jan 2024 15:20:32 +0700 Subject: [PATCH 1/4] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20popu?= =?UTF-8?q?p=20=20history?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DialogHistory.vue | 270 ++++++++++++------ .../interface/index/Main.ts | 24 +- 2 files changed, 207 insertions(+), 87 deletions(-) diff --git a/src/modules/02_organizationalNew/components/DialogHistory.vue b/src/modules/02_organizationalNew/components/DialogHistory.vue index d00af4e58..a0b481838 100644 --- a/src/modules/02_organizationalNew/components/DialogHistory.vue +++ b/src/modules/02_organizationalNew/components/DialogHistory.vue @@ -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([]); - +const { showLoader, hideLoader, messageError, date2Thai } = mixin; +const rows = ref([]); const columns = ref([ - { - 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([ - "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([ + "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(); + } + } +);