Refactoring code module 01_masterdata

This commit is contained in:
STW_TTTY\stwtt 2024-09-12 15:42:47 +07:00
parent 82f5380f3e
commit 71be6d095f
22 changed files with 272 additions and 209 deletions

View file

@ -2,12 +2,15 @@
import { ref, reactive, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType*/
import type { FormDataRole } from "@/modules/01_masterdata/interface/request/Main";
import type { DataOption } from "@/modules/01_masterdata/interface/index/Main";
import type {
DataOption,
SizeType,
} from "@/modules/01_masterdata/interface/index/Main";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
@ -40,15 +43,29 @@ const form = reactive<FormDataRole>({
date: [null, null],
});
const fieldLabels = {
const fieldLabels = reactive<{
score5: string;
score4: string;
score3: string;
score2: string;
score1: string;
}>({
score5: "5",
score4: "4",
score3: "3",
score2: "2",
score1: "1",
};
});
const formScore = reactive<any>({
/** กำหนด type ให้ ScoreField*/
type ScoreField = "score5" | "score4" | "score3" | "score2" | "score1";
const formScore = reactive<{
score5: string;
score4: string;
score3: string;
score2: string;
score1: string;
}>({
score5: "",
score4: "",
score3: "",
@ -62,12 +79,15 @@ const roundOp = ref<DataOption[]>([
{ id: "OCT", name: "รอบตุลาคม" },
]);
/**
* งขอมลยทธศาสตร
* @param id id rows
*/
function fetchspecialByid(id: string) {
showLoader();
http
.get(config.API.kpiSpecial + `/edit/${id}`)
.then((res) => {
console.log(res);
const data = res.data.result;
form.year = data.year;
form.round = data.period;
@ -96,10 +116,15 @@ function fetchspecialByid(id: string) {
});
}
function onResize(size: any) {
/**
* resize ตาม ขนาดของ box ไดบมา
* @param size size { width,height}
*/
function onResize(size: SizeType) {
heightSize.value = `${size.height - 99}`;
}
/** ทำงานเมื่อโหลด component */
onMounted(() => {
fetchspecialByid(id.value);
});
@ -258,7 +283,7 @@ onMounted(() => {
<div class="col-8 text-left">
<q-input
readonly
v-model="formScore[field]"
v-model="formScore[field as ScoreField]"
dense
outlined
class="inputgreen"

View file

@ -2,10 +2,13 @@
import { ref } from "vue";
import type { QTableProps } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const modal = defineModel<boolean>("modal", { required: true });
const rows = defineModel<any[]>("rows", { required: true });

View file

@ -6,10 +6,12 @@ import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import type { CompetencySumary } from "@/modules/01_masterdata/interface/index/Main";
const $q = useQuasar();
const { showLoader, hideLoader, dialogRemove, success, messageError } =
useCounterMixin();
const indicatorTotal = ref<any[]>([
const { messageError } = useCounterMixin();
const indicatorTotal = ref<CompetencySumary[]>([
{
value: "kpiPlan",
label: "ตัวชี้วัดตามแผน",

View file

@ -1,11 +1,14 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
import { checkPermission } from "@/utils/permissions";
import type {
DataOption,
@ -14,18 +17,15 @@ import type {
import type { FormQueryCapacity } from "@/modules/01_masterdata/interface/request/Main";
import type { ResDataCapacity } from "@/modules/01_masterdata/interface/response/Main";
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
import { checkPermission } from "@/utils/permissions";
import CompetencyTotal from "@/modules/01_masterdata/components/competency/Summary.vue";
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin;
const total = ref<number>();
const store = useKPIDataStore();
const router = useRouter();
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin;
const competencyTypeOp = ref<DataOption[]>([
{

View file

@ -1,50 +1,24 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import dialogHeader from "@/components/DialogHeader.vue";
import type {
DataOption,
NewPagination,
} from "@/modules/14_KPI/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import type { NewPagination } from "@/modules/14_KPI/interface/index/Main";
import dialogHeader from "@/components/DialogHeader.vue";
const total = ref<number>();
const modal = ref<boolean>(false);
const rows = ref<any[]>([]);
const groupName = ref<string>("");
const route = useRoute();
const editStatus = ref<boolean>(false);
const editId = ref<string>("");
// const competencyTypeOp = ref<DataOption[]>([
// {
// id: "ID1",
// name: "",
// },
// {
// id: "ID2",
// name: "",
// },
// {
// id: "ID3",
// name: "",
// },
// {
// id: "ID4",
// name: " . .. .",
// },
// {
// id: "ID5",
// name: " . ",
// },
// ]);
const columns = ref<QTableProps["columns"]>([
{
name: "nameGroupKPI",
@ -101,6 +75,7 @@ async function fetchData() {
});
}
/** เพิ่มข้อมูล */
async function addData() {
await http
.post(config.API.kpiGroup, {
@ -118,6 +93,7 @@ async function addData() {
});
}
/** save แก้ไขข้อมูล */
async function editData(id: string) {
await http
.put(config.API.kpiGroupById(id), {
@ -135,6 +111,7 @@ async function editData(id: string) {
});
}
/** ลบข้อมูล */
async function deleteData(id: string) {
await http
.delete(config.API.kpiGroupById(id))
@ -161,6 +138,7 @@ function closeDialog() {
groupName.value = "";
}
/** เปิด dialog แก้ไข */
function onEdit(data: any) {
modal.value = true;
editStatus.value = true;
@ -168,6 +146,7 @@ function onEdit(data: any) {
editId.value = data.id;
}
/** บันทึกข้อมูล */
async function onSubmit() {
dialogConfirm(
$q,

View file

@ -1,29 +1,33 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import Header from "@/components/DialogHeader.vue";
import type {
DataOption,
NewPagination,
ListLinkGroup,
Position,
} from "@/modules/01_masterdata/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
const total = ref<number>();
const id = ref<string>("");
const modal = ref<boolean>(false);
const rows = ref<any[]>([]);
const rows = ref<ListLinkGroup[]>([]);
const editStatus = ref<boolean>(false);
const groupName = ref<any>();
const position = ref<any>();
const competency = ref<any>();
const groupName = ref<Position | null>();
const position = ref<string[]>();
const competency = ref<Position[]>();
const route = useRoute();
const groupNameOp = ref<DataOption[]>([]);
@ -233,9 +237,9 @@ function onSubmit() {
? config.API.kpiLink + `/${id.value}`
: config.API.kpiLink;
const body = {
kpiGroupId: groupName.value.id,
kpiGroupId: groupName.value?.id,
positions: position.value,
kpiCapacityIds: competency.value.map((i: any) => i.id),
kpiCapacityIds: competency.value?.map((i: any) => i.id),
};
dialogConfirm($q, () => {
http[editStatus.value ? "put" : "post"](url, body)
@ -248,12 +252,13 @@ function onSubmit() {
});
}
/** ปิด dialog */
function close() {
modal.value = false;
editStatus.value = false;
groupName.value = "";
position.value = null;
competency.value = null;
groupName.value = null;
position.value = [];
competency.value = [];
}
function getOptions() {

View file

@ -10,9 +10,10 @@ import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
const $q = useQuasar();
const dataLevel = ref<any>();
const route = useRoute();
const { showLoader, hideLoader, success } = useCounterMixin();
const dataLevel = ref<any>();
const fieldLabels = {
score5: "5",
score4: "4",
@ -21,23 +22,6 @@ const fieldLabels = {
score1: "1",
};
const formScore = reactive<any>({
score5: "",
score4: "",
score3: "",
score2: "",
score1: "",
});
interface FormScore {
score5: string;
score4: string;
score3: string;
score2: string;
score1: string;
[key: string]: any;
}
function onSubmit() {
const body = {
formScore: dataLevel.value.map((item: any) => {

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive } from "vue";
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import Main from "@/modules/01_masterdata/components/competency/Forms/Main.vue";
@ -7,24 +7,12 @@ import Main from "@/modules/01_masterdata/components/competency/Forms/Main.vue";
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
import type { DataOption } from "@/modules/01_masterdata/interface/index/Main";
import type { FormCompetency } from "@/modules/01_masterdata/interface/request/Main";
const router = useRouter();
const route = useRoute();
const store = useKPIDataStore();
const checkRoute = ref<boolean>(route.name == "KPICompetencyDetailByid");
const formData = reactive<FormCompetency>({
competencyType: "",
competencyName: "",
definition: "",
level_1: ["", "", "", "", "", ""],
level_2: "",
level_3: "",
level_4: "",
level_5: "",
evaluation: "",
});
const competencyTypeOp = ref<DataOption[]>([
{
@ -48,28 +36,6 @@ const competencyTypeOp = ref<DataOption[]>([
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
},
]);
const itemsFormCard = ref<any>([
{
id: "",
name: "",
},
]);
function ocClickAdd() {
if (itemsFormCard.value.length !== 6) {
const data = {
id: "",
name: "",
};
itemsFormCard.value.push(data);
}
}
/** บันทึก */
function onSubmit() {
console.log(formData);
}
</script>
<template>

View file

@ -1,18 +1,13 @@
<script setup lang="ts">
import { reactive } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
import { useRouter } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, success, messageError } = mixin;
const router = useRouter();
const { dialogConfirm } = mixin;
const store = useKPIDataStore();
const formData = reactive({

View file

@ -1,17 +1,15 @@
<script setup lang="ts">
import { ref, reactive } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
import { useRouter } from "vue-router";
import { reactive } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
import type {} from
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, success, messageError } = mixin;
const router = useRouter;
const { dialogConfirm } = mixin;
const store = useKPIDataStore();
interface DetailLevelType {

View file

@ -2,6 +2,7 @@
import { ref, reactive, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -34,6 +35,7 @@ const formData = reactive({
],
});
/** ดึงข้อมูลรายละเอียด */
function fetchDetail() {
showLoader();
http
@ -53,6 +55,7 @@ function fetchDetail() {
});
}
/** เพิ่ม ระดับ สมรรถนะ */
function onClickAddLevels() {
const levelName = formData.levels.length + 1;
const data = {
@ -67,6 +70,7 @@ function onClickAddLevels() {
levelName <= 6 && formData.levels.push(data);
}
/** บันทึกข้อมูล */
function onSubmit() {
dialogConfirm($q, async () => {
const formBody = {
@ -95,9 +99,12 @@ function onSubmit() {
});
}
/** ลบ ระดับ สมรรถนะ*/
function onDeleteLevels(index: number) {
formData.levels.splice(index, 1);
}
/** ทำงานเมื่อ โหลด component */
onMounted(() => {
if (competencyId.value) {
fetchDetail();

View file

@ -1,16 +1,16 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import type { CompetencySumary } from "@/modules/01_masterdata/interface/index/Main";
const $q = useQuasar();
const { showLoader, hideLoader, dialogRemove, success, messageError } =
useCounterMixin();
const { messageError } = useCounterMixin();
const competencyTotal = ref<any[]>([
const competencyTotal = ref<CompetencySumary[]>([
{
value: "HEAD",
label: "สมรรถนะหลัก",
@ -49,13 +49,17 @@ function getTotal() {
.get(config.API.capacitySummary)
.then((res) => {
const data = res.data.result;
competencyTotal.value.forEach((i) => {
competencyTotal.value.forEach((i: CompetencySumary) => {
const map = data.find((item: any) => item.type === i.value);
if (map) i.total = map.total;
});
const totalSum = data.reduce((i: any, j: any) => i + +j.total, 0);
competencyTotal.value.find((i) => i.value === "total").total =
totalSum.toString();
const totalItem = competencyTotal.value.find(
(i: CompetencySumary) => i.value === "total"
);
if (totalItem) {
totalItem.total = totalSum.toString();
}
})
.catch((e) => {
messageError($q, e);

View file

@ -28,10 +28,126 @@ interface DataAssignment {
year: string;
}
interface IndicatorType {
id: string;
createdAt: string;
including: number;
includingName: string;
kpiPeriod: any;
}
interface OrgTreeNode {
orgTreeId: string;
orgRootId: string;
orgLevel: number;
orgName: string;
orgTreeName: string;
orgTreeShortName: string;
orgTreeCode: string;
orgCode: string;
orgTreeRank: string;
orgTreeRankSub: string | null;
orgTreeOrder: number;
orgRootCode: string;
orgTreePhoneEx: string;
orgTreePhoneIn: string;
orgTreeFax: string;
orgRevisionId: string;
orgRootName: string;
responsibility: string | null;
labelName: string;
totalPosition: number;
totalPositionCurrentUse: number;
totalPositionCurrentVacant: number;
totalPositionNextUse: number;
totalPositionNextVacant: number;
totalRootPosition: number;
totalRootPositionCurrentUse: number;
totalRootPositionCurrentVacant: number;
totalRootPositionNextUse: number;
totalRootPositionNextVacant: number;
children: OrgTreeNode[];
}
interface DataHistory {
id: string;
createdAt: Date | null;
createdUserId: string;
lastUpdatedAt: Date | null;
lastUpdateUserId: string;
createdFullName: string;
lastUpdateFullName: string;
kpiPlanId: string;
}
interface NodePlan {
id: string;
level: number;
name: string;
children: NodePlan[];
}
interface KpiRoleData {
id: string;
createdAt: Date | null;
createdUserId: string;
lastUpdatedAt: Date | null;
lastUpdateUserId: string;
createdFullName: string;
lastUpdateFullName: string;
kpiRoleId: string;
}
interface IndicatorTotal {
value: string;
label: string;
color: string;
}
interface CompetencySumary {
value: string;
label: string;
color: string;
total?:string
}
interface Position {
id: string;
name: string;
}
interface Capacity {
id: string;
name: string;
type: string;
description: string;
}
interface ListLinkGroup {
id: string;
groupName: string;
groupId: string;
positions: Position[];
capacitys: Capacity[];
}
interface SizeType{
width:number
height:number
}
export type {
Pagination,
DataOption,
NewPagination,
ItemsMenu,
DataAssignment,
IndicatorType,
OrgTreeNode,
DataHistory,
NodePlan,
KpiRoleData,
IndicatorTotal,
ListLinkGroup,
Position,
CompetencySumary,
SizeType
};

View file

@ -2,7 +2,7 @@ interface DataStrategic {
id: string;
name: string;
level: number;
children: DataStrategic;
children: DataStrategic[];
}
export type { DataStrategic };

View file

@ -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"

View file

@ -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>("");

View file

@ -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>>([]);

View file

@ -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();

View file

@ -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,

View file

@ -1818,7 +1818,6 @@ export const useManageDataStore = defineStore("manage", () => {
.get(apiInsignia)
.then((res) => {
const data = res.data.result;
console.log(data);
let rows: InsigniaResponse[] = [];
let version: string = "";
let id: string = "";

View file

@ -226,7 +226,6 @@ const fetchData = async () => {
.get(config.API.periodExamType("all"))
.then((res) => {
const data = res.data.result;
console.log("🚀 ~ .then ~ data:", data);
let result: ResponsePeriodExam[] = [];
if (data.length > 0) {
data.map((r: RequestPeriodExam) => {

View file

@ -209,7 +209,6 @@ const detailPage = (id: string) => {
};
function onSave(data: any) {
console.log("🚀 ~ onSave ~ data:", data);
showLoader();
http
.put(