โครงสร้าง => refactor code
This commit is contained in:
parent
007df38109
commit
1412ea630b
13 changed files with 369 additions and 408 deletions
|
|
@ -1,26 +1,43 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { ref, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { HistoryPostType } 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";
|
||||
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { HistoryPostType } from "@/modules/02_organizationalNew/interface/index/Main";
|
||||
|
||||
/**
|
||||
* importComponrnts
|
||||
*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/**
|
||||
* use
|
||||
*/
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
const modal = defineModel<boolean>("history", { required: true });
|
||||
const type = defineModel<number>("type", { required: true });
|
||||
const orgId = defineModel<string>("orgId", { required: true });
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||
/**
|
||||
* ข้อมุล Table
|
||||
*/
|
||||
const rows = ref<HistoryPostType[]>([]);
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -67,6 +84,9 @@ const visibleColumns = ref<string[]>([
|
|||
"lastUpdatedAt",
|
||||
]);
|
||||
|
||||
/**
|
||||
* function เรียกข้อมูล ประวัติหน่วยงาน,ประวัติส่วนราชการ
|
||||
*/
|
||||
function postData() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -79,7 +99,9 @@ function postData() {
|
|||
const dataMap = dataList.map((item: HistoryPostType) => ({
|
||||
id: item.id ? item.id : "-",
|
||||
name: item.name ? item.name : "-",
|
||||
lastUpdatedAt: item.lastUpdatedAt ? date2Thai(item.lastUpdatedAt as Date,false,true) : "-",
|
||||
lastUpdatedAt: item.lastUpdatedAt
|
||||
? date2Thai(item.lastUpdatedAt as Date, false, true)
|
||||
: "-",
|
||||
orgRevisionName: item.orgRevisionName ? item.orgRevisionName : "-",
|
||||
}));
|
||||
rows.value = dataMap;
|
||||
|
|
@ -91,6 +113,10 @@ function postData() {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* callback function เมื่อ modal = true เรียกข้อมูล ประวัติหน่วยงาน,ประวัติส่วนราชการ
|
||||
*/
|
||||
watch(
|
||||
() => modal.value,
|
||||
() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue