โครงสร้าง => refactor code

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-07-25 11:06:43 +07:00
parent 007df38109
commit 1412ea630b
13 changed files with 369 additions and 408 deletions

View file

@ -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,
() => {