Refactoring code module 01_masterdata
This commit is contained in:
parent
82f5380f3e
commit
71be6d095f
22 changed files with 272 additions and 209 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, watch } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -21,7 +21,6 @@ import { checkPermission } from "@/utils/permissions";
|
|||
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { showLoader, hideLoader, dialogRemove, success, messageError } =
|
||||
useCounterMixin();
|
||||
|
||||
|
|
@ -50,6 +49,7 @@ const visibleColumns = ref<string[]>(["including", "includingName"]);
|
|||
|
||||
/** Option รอบการประเมิน*/
|
||||
const roundOp = ref<DataOption[]>([
|
||||
{ id: "", name: "ทั้งหมด" },
|
||||
{ id: "APR", name: "รอบเมษายน" },
|
||||
{ id: "OCT", name: "รอบตุลาคม" },
|
||||
]);
|
||||
|
|
@ -230,9 +230,6 @@ onMounted(() => {
|
|||
dense
|
||||
outlined
|
||||
v-model="formFilter.period"
|
||||
:model-value="
|
||||
formFilter.period === '' ? 'ทั้งหมด' : formFilter.period
|
||||
"
|
||||
:options="roundOp"
|
||||
label="รอบการประเมิน"
|
||||
option-label="name"
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
// import type { ItemsMenu } from "@/modules/01_masterdata/interface/index/Main";
|
||||
import type { DataStrategic } from "@/modules/01_masterdata/interface/response/Strategic";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useRoute } from "vue-router";
|
||||
const $q = useQuasar();
|
||||
const {
|
||||
showLoader,
|
||||
|
|
@ -22,29 +21,7 @@ const {
|
|||
success,
|
||||
} = useCounterMixin();
|
||||
|
||||
// const ListMenu = ref<ItemsMenu[]>([
|
||||
// {
|
||||
// label: "เพิ่ม",
|
||||
// icon: "add",
|
||||
// value: "ADD",
|
||||
// color: "primary",
|
||||
// },
|
||||
// {
|
||||
// label: "แก้ไข",
|
||||
// icon: "edit",
|
||||
// value: "EDIT",
|
||||
// color: "edit",
|
||||
// },
|
||||
// {
|
||||
// label: "ลบ",
|
||||
// icon: "delete",
|
||||
// value: "DEL",
|
||||
// color: "red",
|
||||
// },
|
||||
// ]);
|
||||
|
||||
const route = useRoute();
|
||||
const nodes = ref<any[]>([]);
|
||||
const nodes = ref<DataStrategic[]>([]);
|
||||
const filter = ref<string>("");
|
||||
const expanded = ref<Array<string>>([]);
|
||||
const nodeId = ref<string>("");
|
||||
|
|
|
|||
|
|
@ -7,15 +7,6 @@ import ListLinkGroup from "@/modules/01_masterdata/components/competency/03ListL
|
|||
import ListCriteria from "@/modules/01_masterdata/components/competency/04ListCriteria.vue";
|
||||
import ListDetail from "@/modules/01_masterdata/components/competency/05ListDetail.vue";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar();
|
||||
const { showLoader, hideLoader, dialogRemove, success, messageError } =
|
||||
useCounterMixin();
|
||||
|
||||
const currentTab = ref<string>("list_competency");
|
||||
const tabs = ref<Array<any>>([]);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,26 +5,31 @@ import { useRouter, useRoute } from "vue-router";
|
|||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
import type {
|
||||
DataOption,
|
||||
IndicatorType,
|
||||
OrgTreeNode,
|
||||
DataHistory,
|
||||
} from "@/modules/01_masterdata/interface/index/Main";
|
||||
|
||||
import type { DataOption } from "@/modules/01_masterdata/interface/index/Main";
|
||||
import DialogHistory from "@/modules/01_masterdata/components/Indicators/DialogHistory.vue";
|
||||
import Summary from "@/modules/01_masterdata/components/Indicators/Summary.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
/** use*/
|
||||
const dataHistory = ref<any[]>([]);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
const isAll = ref<boolean>(false);
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { showLoader, hideLoader, dialogRemove, success, messageError } =
|
||||
useCounterMixin();
|
||||
|
||||
const dataHistory = ref<DataHistory[]>([]);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
const isAll = ref<boolean>(false);
|
||||
|
||||
/** หัวตาราง */
|
||||
const rows = ref<any[]>([]);
|
||||
const rows = ref<IndicatorType[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "including",
|
||||
|
|
@ -45,7 +50,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const node = ref<any>([]);
|
||||
const node = ref<OrgTreeNode[]>([]);
|
||||
const expanded = ref<any>([]);
|
||||
const filterMain = ref<string>("");
|
||||
const visibleColumns = ref<string[]>(["including", "includingName"]);
|
||||
|
|
@ -68,6 +73,7 @@ const nodeData = reactive<any>({
|
|||
keyword: "",
|
||||
});
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
function fetchList() {
|
||||
if (nodeData.nodeId) {
|
||||
showLoader();
|
||||
|
|
@ -96,6 +102,11 @@ function fetchList() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังชั่น add/edit
|
||||
* @param status true = edit / false = add
|
||||
* @param id id edit
|
||||
*/
|
||||
function onClickAddOrView(status: boolean = false, id: string = "") {
|
||||
status
|
||||
? router.push(`/masterdata/indicator-plan/${id}`)
|
||||
|
|
@ -120,6 +131,7 @@ function fetchActive() {
|
|||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลโครงสรร้าง */
|
||||
async function fetchTree(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -136,6 +148,7 @@ async function fetchTree(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/** เรียกข้อมูลตาม row โครงสร้าง*/
|
||||
function updateSelectedTreeMain(data: any) {
|
||||
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
|
||||
nodeData.node = null;
|
||||
|
|
@ -147,11 +160,13 @@ function updateSelectedTreeMain(data: any) {
|
|||
fetchListProjectNew();
|
||||
}
|
||||
|
||||
/** ดึงรายละเอียดโครงสร้าง */
|
||||
function fetchListProjectNew() {
|
||||
nodeData.page = 1;
|
||||
fetchList();
|
||||
}
|
||||
|
||||
/** delete */
|
||||
async function deleteData(idData: string) {
|
||||
dialogRemove($q, () =>
|
||||
http
|
||||
|
|
@ -169,6 +184,7 @@ async function deleteData(idData: string) {
|
|||
);
|
||||
}
|
||||
|
||||
/** clear input filter */
|
||||
function clearFilter() {
|
||||
nodeData.keyword = "";
|
||||
fetchActive();
|
||||
|
|
|
|||
|
|
@ -1,40 +1,42 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, watch } from "vue";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
import type { FormListMainByRole } from "@/modules/01_masterdata/interface/request/Main";
|
||||
import type {
|
||||
DataOption,
|
||||
NewPagination,
|
||||
KpiRoleData,
|
||||
IndicatorType,
|
||||
IndicatorTotal,
|
||||
} from "@/modules/01_masterdata/interface/index/Main";
|
||||
|
||||
import DialogHistory from "@/modules/01_masterdata/components/Indicators/DialogHistory.vue";
|
||||
import Summary from "@/modules/01_masterdata/components/Indicators/Summary.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
/** use*/
|
||||
const dataHistory = ref<any[]>([]);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
const total = ref<number>();
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { showLoader, hideLoader, dialogRemove, success, messageError } =
|
||||
useCounterMixin();
|
||||
|
||||
/** use*/
|
||||
const dataHistory = ref<KpiRoleData[]>([]);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
const total = ref<number>();
|
||||
|
||||
const positionOp = ref<DataOption[]>([{ id: "", name: "ทั้งหมด" }]);
|
||||
const positionMainOp = ref<DataOption[]>([{ id: "", name: "ทั้งหมด" }]);
|
||||
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
/** หัวตาราง */
|
||||
const rows = ref<any[]>([]);
|
||||
const rows = ref<IndicatorType[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "including",
|
||||
|
|
@ -70,7 +72,7 @@ const pagination = ref({
|
|||
rowsPerPage: formFilter.pageSize,
|
||||
});
|
||||
|
||||
const indicatorTotal = ref<any[]>([
|
||||
const indicatorTotal = ref<IndicatorTotal[]>([
|
||||
{
|
||||
value: "kpiPlan",
|
||||
label: "ตัวชี้วัดตามแผน",
|
||||
|
|
@ -103,7 +105,6 @@ const roundOp = ref<DataOption[]>([
|
|||
async function fetchList() {
|
||||
await http
|
||||
.post(config.API.kpiRoleMainList + `/search-edit`, {
|
||||
// ?page=${formFilter.page}&pageSize=${formFilter.pageSize}&period=${formFilter.round}&position=${formFilter.position}&keyword=${formFilter.keyword}&year=${formFilter.year}
|
||||
keyword: formFilter.keyword,
|
||||
position: formFilter.position,
|
||||
period: formFilter.round,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue