Refactoring code module 04_registryPerson

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-18 17:24:21 +07:00
parent 1164d79122
commit eeb92dfb5d
46 changed files with 1935 additions and 2230 deletions

View file

@ -1,15 +1,15 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import { onMounted, ref, reactive } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps, QForm } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/04_registryPerson/stores/insignia";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type {
DataOption,
DataOptionInsignia,
@ -18,6 +18,8 @@ import type {
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/Insignia";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Insignia";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const route = useRoute();
const store = useInsigniaDataStore();
@ -32,54 +34,46 @@ const {
dialogConfirm,
pathRegistryEmp,
} = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const id = ref<string>("");
const insigniaType = ref<string>("");
const id = ref<string>(""); //id
const insigniaType = ref<string>(""); //
const insigniaForm = reactive<RequestItemsObject>({
year: 0,
no: "",
volume: "",
section: "",
page: "",
receiveDate: null,
insigniaId: "",
dateAnnounce: null,
issue: "",
volumeNo: "",
refCommandDate: null,
refCommandNo: "",
note: "",
year: 0, //
receiveDate: null, //
insigniaId: "", //
no: "", //
issue: "", //
volumeNo: "", //
volume: "", //
section: "", //
page: "", //
dateAnnounce: null, //
refCommandNo: "", //
refCommandDate: null, //' ( //)'
note: "", //
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const isEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modeView = ref<string>("table");
const filterSearch = ref("");
const filterHistory = ref<string>("");
const modalHistory = ref<boolean>(false);
const rowsHistory = ref<RequestItemsObject[]>([]);
const Ops = ref<InsigniaOps>({
insigniaOptions: [],
});
const isEdit = ref<boolean>(false); //
const modal = ref<boolean>(false); // popup
const modeView = ref<string>("table"); // Table,Card
const modalHistory = ref<boolean>(false); // popup
//
const OpsFilter = ref<InsigniaOps>({
insigniaOptions: [],
});
//
const Ops = ref<InsigniaOps>({
insigniaOptions: [],
});
//Table Main
const rows = ref<ResponseObject[]>([]);
const filterSearch = ref("");
const columns = ref<QTableProps["columns"]>([
{
name: "year",
@ -239,6 +233,30 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"insignia",
"insigniaType",
"year",
"no",
"issue",
"volumeNo",
"volume",
"section",
"page",
"receiveDate",
"dateAnnounce",
"refCommandNo",
"refCommandDate",
"note",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
//Table
const rowsHistory = ref<RequestItemsObject[]>([]);
const filterHistory = ref<string>("");
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "year",
@ -410,22 +428,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"insignia",
"insigniaType",
"year",
"no",
"issue",
"volumeNo",
"volume",
"section",
"page",
"receiveDate",
"dateAnnounce",
"refCommandNo",
"refCommandDate",
"note",
]);
const visibleColumnsHistory = ref<String[]>([
"insignia",
"insigniaType",
@ -443,6 +445,10 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
/**
* fetch อมลรายการเครองราชอสรยาภรณ
@ -629,6 +635,9 @@ function clearData() {
insigniaForm.note = "";
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(async () => {
await fetchData();
store.insigniaOption.length === 0 ? await fetchInsignia() : "";
@ -1145,7 +1154,7 @@ onMounted(async () => {
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขเครื่องราชอิสริยาภรณ์"
:close="() => (modalHistory = false)"
:close="() => ((modalHistory = false), (rowsHistory = []))"
/>
<q-separator />