Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop

* 'develop' of github.com:Frappet/bma-ehr-frontend:
  KPI => refactor code
  refactor code
  โครงสร้างอัตรากำลัง =>  router
This commit is contained in:
Warunee Tamkoo 2024-07-23 14:09:56 +07:00
commit 3a61fe0efb
17 changed files with 180 additions and 140 deletions

View file

@ -0,0 +1,17 @@
interface DataPosType {
id: string;
posLevels: DataLevel[];
posTypeName: string;
posTypeRank: number;
posTypeShortName: string;
}
interface DataLevel {
id: string;
posLevelName: number;
posTypeName: string;
posTypeId: string;
posLevelAuthority: string;
}
export type { DataPosType };

View file

@ -1,5 +1,4 @@
const mainPage = () => import("@/modules/02_organizationalNew/views/main.vue");
const testPage = () => import("@/modules/02_organizationalNew/views/ExampleSearchTree.vue");
export default [
{
@ -12,15 +11,4 @@ export default [
Role: "organization",
},
},
{
path: "/organization-new/test",
name: "organizationalNewTest",
component: testPage,
meta: {
Auth: true,
Key: [7],
Role: "organization",
},
},
];

View file

@ -4,34 +4,49 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType*/
/**
* importType
*/
import type { DataOption } from "@/modules/02_organizationalNew/interface/index/Main";
import type { OrgRevision } from "@/modules/02_organizationalNew/interface/response/organizational";
/** importComponents*/
/**
* importComponents
*/
import TreeView from "@/modules/02_organizationalNew/components/TreeView.vue";
import StructureView from "@/modules/02_organizationalNew/components/StructureMain.vue";
import DialogFormNewStructure from "@/modules/02_organizationalNew/components/DialogNewStructure.vue";
import DialogDateTime from "@/modules/02_organizationalNew/components/DialogFormDateTime.vue";
/** importStore*/
/**
* importStore
*/
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
import { useCounterMixin } from "@/stores/mixin";
/** use*/
/**
* use
*/
const $q = useQuasar();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
const store = useOrganizational();
/** modalDialog*/
/**
* วแปร
*/
const modalNewStructure = ref<boolean>(false); //
const modalDateTime = ref<boolean>(false); //
/** สถานะ*/
const isStatusData = ref<boolean>(false); //
// const ishasActive = ref<boolean>(false); //
// const ishasDraft = ref<boolean>(false); //
/** List เพิ่มโครงสร้าง*/
const typeStructure = ref<string>(""); //
/** ประวัติโครงสร้าง*/
const itemHistory = ref<DataOption[]>([]); // List
const historyId = ref<string>(""); // ID
const labelHistory = ref<string>("ประวัติโครงสร้าง"); //
const count = ref<number>(0);
/**
* List เพมโครงสราง
*/
const itemStructure = ref<DataOption[]>([
{
id: "NEW",
@ -50,18 +65,13 @@ const itemStructure = ref<DataOption[]>([
name: "ทำสำเนาโครงสร้าง ตำแหน่งและคนครอง",
},
]);
const typeStructure = ref<string>(""); //
/** ประวัติโครงสร้าง*/
const itemHistory = ref<DataOption[]>([]); // List
const historyId = ref<string>(""); // ID
const labelHistory = ref<string>("ประวัติโครงสร้าง"); //
const count = ref<number>(0);
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
async function fetchOrganizationActive() {
/**
* function เรยกขอมลโครงสราง แบบปนและ แบบราง
*/
function fetchOrganizationActive() {
showLoader();
await http
http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
@ -73,10 +83,8 @@ async function fetchOrganizationActive() {
isStatusData.value = true;
if (isStatusData.value) {
if (data.activeName === null) {
// ishasActive.value = true;
store.typeOrganizational = "draft";
} else if (data.draftName === null) {
// ishasDraft.value = true;
store.typeOrganizational = "current";
}
}
@ -89,9 +97,11 @@ async function fetchOrganizationActive() {
});
}
/** function เรียกข้อมูลประวัติโครงสร้าง*/
async function fetchHistory() {
await http
/**
* function เรยกขอมลประวโครงสราง
*/
function fetchHistory() {
http
.get(config.API.organizationHistoryNew)
.then((res) => {
const data = res.data.result;
@ -118,7 +128,9 @@ function ocClickAddStructure(type: string) {
typeStructure.value = type;
}
/** function openPopup ตั้งเวลาเผยแพร่*/
/**
* function openPopup งเวลาเผยแพร
*/
function onClickDateTime() {
modalDateTime.value = !modalDateTime.value;
}
@ -135,7 +147,9 @@ function onClickHistory(id: string, name: string) {
count.value++;
}
/** lifecycleHook */
/**
* lifecycleHook
*/
onMounted(async () => {
store.typeOrganizational = "current";
await fetchOrganizationActive();

View file

@ -144,6 +144,12 @@ const pagination = ref({
rowsPerPage: pageSize.value,
});
/**
* วแปร
*/
const year = ref<number | null>(new Date().getFullYear()); //
const roundOp = ref<DataOption[]>([]); //
/**
* function fetch รายการแผนพฒนาการปฏราชการรายบคคลยอนหล
*/
@ -158,8 +164,6 @@ function fetcDataList() {
})
.then((res) => {
const data = res.data.result;
console.log(data);
rows.value = data.data;
total.value = data.total;
maxPage.value = Math.ceil(total.value / pageSize.value);
@ -172,8 +176,6 @@ function fetcDataList() {
});
}
const year = ref<number | null>(new Date().getFullYear());
const roundOp = ref<DataOption[]>([]);
/**
* function fetch รอบการประเม
*/
@ -205,6 +207,7 @@ function fetchRoundOption() {
} else {
roundOp.value = [];
store.formQuery.round = "";
rows.value = [];
}
})
.catch((err) => {
@ -215,6 +218,9 @@ function fetchRoundOption() {
});
}
/**
* function เปลยนรอบการประเม และ เรยกขอมลรายการแผนพฒนาการปฏราชการรายบคคลยอนหล
*/
function changRound() {
store.formQuery.page = 1;
fetcDataList();
@ -228,12 +234,6 @@ function onSearchData() {
fetcDataList();
}
function clearYear() {
year.value = null;
store.formQuery.round = "";
roundOp.value = [];
fetcDataList();
}
/**
* ทำงานเมอมการเปลยนแถวตอหน
*/
@ -251,6 +251,9 @@ function onClickView(id: string) {
devId.value = id;
}
/**
* HookLifecycle
*/
onMounted(() => {
store.formQuery.round = "";
fetchRoundOption();

View file

@ -46,12 +46,13 @@ const maxPage = defineModel<number>("maxPage", { required: true });
const total = defineModel<number>("total", { required: true });
const keyword = defineModel<string>("keyword", { required: true });
const porps = defineProps({
fetchData: { type: Function, required: true },
fetchData: { type: Function, required: true }, // function
});
/**
* Table
*/
const selected = ref<ResResults[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -172,7 +173,12 @@ const pagination = ref({
page: page.value,
rowsPerPage: pageSize.value,
});
const selected = ref<ResResults[]>([]);
/**
* วแปร
*/
const year = ref<number | null>(new Date().getFullYear()); //
const roundOp = ref<DataOption[]>([]); //
/**
* function นทกการประกาศผล
@ -202,8 +208,6 @@ function onAnnounce() {
);
}
const year = ref<number | null>(new Date().getFullYear());
const roundOp = ref<DataOption[]>([]);
/**
* function fetch รอบการประเม
*/
@ -233,6 +237,7 @@ function fetchRoundOption() {
} else {
roundOp.value = [];
store.formQuery.round = "";
rows.value = [];
}
})
.catch((err) => {
@ -243,6 +248,9 @@ function fetchRoundOption() {
});
}
/**
* function เปลยนรอบการประเม และ เรยกขอมลรายการแผนพฒนาการปฏราชการรายบคคลยอนหล
*/
function changRound() {
store.formQuery.page = 1;
porps.fetchData();
@ -256,12 +264,6 @@ function onSearchData() {
porps.fetchData();
}
// function clearYear() {
// year.value = null;
// store.formQuery.round = "";
// roundOp.value = [];
// porps.fetchData();
// }
/**
* ทำงานเมอมการเปลยนแถวตอหน
*/
@ -270,6 +272,9 @@ watch(pagination, () => {
pageSize.value = pagination.value.rowsPerPage;
});
/**
* ทำงานเมอมการเปลยนแถวตอหน
*/
onMounted(() => {
store.formQuery.round = "";
fetchRoundOption();

View file

@ -86,7 +86,7 @@ const listReportMain = ref<DataOption[]>([
name: "จัดทำประกาศผู้มีผลการปฏิบัติราชการระดับดีเด่นและดีมาก",
},
]);
const listReport = ref<DataOption[]>([]);
const listReport = ref<DataOption[]>([]); //
/**
* funtion fetchขอมลรอบการประเม
@ -335,7 +335,6 @@ const formFilter = reactive({
});
const maxPage = ref<number>(1);
const total = ref<number>(0);
const roundRef = ref<any>(null);
const rowsPerson = ref<ResPerson[]>([]);

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -59,9 +59,7 @@ function fetcDataList() {
})
.then((res) => {
const data = res.data.result;
dataList.value = data.data;
total.value = data.total;
maxPage.value = Math.ceil(total.value / pageSize.value);
})
@ -76,10 +74,9 @@ function fetcDataList() {
// /**
// * Tab
// */
watch(tab, (t) => {
watch(tab, () => {
page.value = 1;
keyword.value = "";
// t == "KP7" || t == "COMPLETE" ? fetcDataList() : "";
});
/**
@ -88,13 +85,6 @@ watch(tab, (t) => {
watch(pageSize, () => {
fetcDataList();
});
/**
* HooK
*/
onMounted(() => {
// fetcDataList();
});
</script>
<template>

View file

@ -1,11 +1,12 @@
<script setup lang="ts">
import { ref, reactive, onMounted, watch, nextTick } from "vue";
import { ref, reactive, onMounted, watch } from "vue";
import { useQuasar, type QTableProps } from "quasar";
import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType*/
/**
* importType
*/
import type {
DataOption,
ItemsMenu,
@ -17,15 +18,20 @@ import type {
} from "@/modules/14_KPI/interface/request/Main";
import type { ResRound } from "@/modules/14_KPI/interface/response/Main";
/** importComponents*/
/**
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
/** importStore*/
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
/** use*/
/**
* use
*/
const $q = useQuasar();
const router = useRouter();
const {
showLoader,
hideLoader,
@ -36,7 +42,9 @@ const {
dialogRemove,
} = useCounterMixin();
/** หัวตาราง */
/**
* อม Table
*/
const rows = ref<ResRound[]>([]);
const columns = ref<QTableProps["columns"]>([
{
@ -98,8 +106,26 @@ const visibleColumns = ref<string[]>([
"endDate",
"isActive",
]);
const formQuery = reactive<FormQueryRound>({
page: 1,
pageSize: 10,
year: new Date().getFullYear(),
keyword: "",
});
const totalList = ref<number>(1);
const total = ref<number>(0);
/** itemMenu*/
/**
* วแปร
*/
const modalDialog = ref<boolean>(false);
const isStatusEdit = ref<boolean>(false);
const formData = reactive<FormRound>({
durationKPI: "",
year: null,
startDate: null,
endDate: null,
}); // form
const itemMenu = ref<ItemsMenu[]>([
// {
// label: "",
@ -119,35 +145,18 @@ const itemMenu = ref<ItemsMenu[]>([
icon: "delete",
color: "red",
},
]);
/** Option รอบการประเมิน*/
]); // itemMenu
const roundOp = ref<DataOption[]>([
{ id: "APR", name: "รอบที่ 1 เมษายน" },
{
id: "OCT",
name: "รอบที่ 2 ตุลาคม",
},
]);
]); //Option
const formQuery = reactive<FormQueryRound>({
page: 1,
pageSize: 10,
year: new Date().getFullYear(),
keyword: "",
});
const totalList = ref<number>(1);
const formData = reactive<FormRound>({
durationKPI: "",
year: null,
startDate: null,
endDate: null,
});
const modalDialog = ref<boolean>(false);
const isStatusEdit = ref<boolean>(false);
const total = ref<number>(0);
/** function fetch ข้อมูลรายการรอบการประเมินผลการปฏิบัติหน้าที่ราชการ*/
/**
* function fetch อมลรายการรอบการประเมนผลการปฏหนาทราชการ
*/
function fetchList() {
showLoader();
http
@ -172,20 +181,23 @@ function fetchList() {
/**
* function opent Dialog เพมรอบการประเมนผลการปฏหนาทราชการ
* @param status เพ,แกไข
* @param id
*/
function onClickAddOrView(status: boolean = false, id: string = "") {
function onClickAddOrView(status: boolean = false) {
isStatusEdit.value = status;
modalDialog.value = true;
}
/** function close Dialog*/
/**
* function close Dialog
*/
function closeDialog() {
modalDialog.value = false;
clearFormData();
}
/** function Clear วันสิ้นสุด*/
/**
* function Clear นสนส
*/
function changeDateStart() {
if (formData?.startDate !== null && formData?.endDate !== null) {
const startDate = new Date(formData.startDate);
@ -196,7 +208,9 @@ function changeDateStart() {
}
}
/** function ClearForm เพิ่มรอบการประเมิน*/
/**
* function ClearForm เพมรอบการประเม
*/
function clearFormData() {
formData.durationKPI = "";
formData.startDate = null;
@ -204,7 +218,9 @@ function clearFormData() {
formData.year = null;
}
/** function บันทึกข้อมูลเพิ่มรอบการประเมิน*/
/**
* function นทกขอมลเพมรอบการประเม
*/
function onSubmit() {
dialogConfirm($q, async () => {
try {
@ -224,6 +240,11 @@ function onSubmit() {
});
}
/**
* function เลอกเมนแกไขรอบ
* @param action ดรอบ,ลบรอบ
* @param id รอบการประเม
*/
function onClickAction(action: string, id: string) {
switch (action) {
case "open":
@ -315,7 +336,9 @@ function onDeleteRound(id: string) {
});
}
/** function Convertname รอบการประเมิน */
/**
* function Convertname รอบการประเม
*/
function connvertName(val: string) {
const findData = roundOp.value.find((e: DataOption) => e.id === val);
return findData?.name;
@ -330,6 +353,9 @@ function updatePagination(newPagination: NewPagination) {
formQuery.pageSize = newPagination.rowsPerPage;
}
/**
* callback function fetch รายการรอบการประเมนผลการปฏหนาทราชการ เมอมการเปลยนแถวตอหน
*/
watch(
() => formQuery.pageSize,
() => {
@ -337,6 +363,9 @@ watch(
}
);
/**
* callback function เช นเรมต และวนสนส รอบการประเมนผลการปฏหนาทราชการ
*/
watch(
[() => formData.durationKPI, () => formData.year],
([newDurationKPI, newYear], [oldDurationKPI, oldYear]) => {
@ -352,12 +381,17 @@ watch(
}
);
async function handleUpdateYear() {
await nextTick();
/**
* function พเดทปงบประมาณ และ fetch รายการรอบการประเมนผลการปฏหนาทราชการ
*/
function handleUpdateYear() {
formQuery.page = 1;
fetchList();
}
/**
* hookLifecycle
*/
onMounted(() => {
fetchList();
});

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref, reactive, watch } from "vue";
import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";

View file

@ -12,11 +12,10 @@ import type {
import type { DataStrategic } from "@/modules/15_development/interface/response/Main";
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
import http from "@/plugins/http";
import config from "@/app.config";
const other1 = ref<boolean>(false);
const other2 = ref<boolean>(false);
const reasonPlanned70 = ref<string>("");
const reasonPlanned20 = ref<string>("");
const reasonPlanned10 = ref<string>("");
@ -58,6 +57,7 @@ const projectTypeOp = ref<String[]>([
"โครงการต่อเนื่อง",
]);
/** option */
const projectTechniquesOp1 = ref<DataOptionTechnique[]>([
{
value: "on_the_job_training",
@ -108,6 +108,7 @@ const projectTechniquesOp1 = ref<DataOptionTechnique[]>([
label: "อื่น ๆ (ระบุ)",
},
]);
const projectTechniquesOp2 = ref<DataOptionTechnique[]>([
{ value: "coaching", label: "การสอนงาน (Coaching)" },
{ value: "mentoring", label: "การเป็นพี่เลี้ยง (Mentoring)" },
@ -186,17 +187,16 @@ function fetchData() {
formData.projectDayBackPlanned = data.projectDayBackPlanned;
formData.projectDayHoldPlanned = data.projectDayHoldPlanned;
formData.projectNigthHoldPlanned = data.projectNigthHoldPlanned;
formData.developmentProjectTechniquePlanneds =
data.developmentProjectTechniquePlanneds;
formData.developmentProjectTechniquePlanneds = data.developmentProjectTechniquePlanneds;
formData.isBackActual = data.isBackActual;
formData.isHoldActual = data.isHoldActual;
formData.projectDayBackActual = data.projectDayBackActual;
formData.projectDayHoldActual = data.projectDayHoldActual;
formData.projectNigthHoldActual = data.projectNigthHoldActual;
formData.developmentProjectTechniqueActuals =
data.developmentProjectTechniqueActuals;
formData.developmentProjectTechniqueActuals = data.developmentProjectTechniqueActuals;
formData.projectModalPlanned = data.projectModalPlanned;
formData.projectModalActual = data.projectModalActual;
const arrayExpanded = [
data.strategyChild1Planned,
data.strategyChild2Planned,
@ -204,6 +204,7 @@ function fetchData() {
data.strategyChild4Planned,
data.strategyChild5Planned,
];
const arrayExpanded2 = [
data.strategyChild1Actual,
data.strategyChild2Actual,
@ -211,10 +212,12 @@ function fetchData() {
data.strategyChild4Actual,
data.strategyChild5Actual,
];
const filteredArray = arrayExpanded.filter((item) => item !== null);
const filteredArray2 = arrayExpanded2.filter((item) => item !== null);
const lastItem = filteredArray[filteredArray.length - 1];
const lastItem2 = filteredArray2[filteredArray2.length - 1];
formData.strategyChildPlannedId =
lastItem !== undefined ? lastItem : null;
formData.strategyChildPlannedNode =
@ -552,8 +555,9 @@ onMounted(() => {
<div class="col-12 q-py-md">
<div class="row q-col-gutter-md">
<div class="col-12">
<q-label class="text-bold">เทคนควการทใชในการพฒนา</q-label>
<q-label class="text-bold"
>เทคนควการทใชในการพฒนา</q-label
>
</div>
<div class="col-12 col-sm-6 col-md-4 align-top">
<q-label class="q-mb-sm text-weight-medium text-body2"

View file

@ -1,10 +1,9 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { ref, onMounted } from "vue";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import axios from "axios";
import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
import type { ResRecord } from "@/modules/15_development/interface/response/Main";

View file

@ -8,7 +8,6 @@ import { useDevelopmentDataStore } from "@/modules/15_development/store/developm
import type { QTableProps } from "quasar";
import type { DataOption } from "@/modules/15_development/interface/index/Main";
import type {
FormGroupTarget,
FormGroupRelate,
FormGroupTargetPlannedGoal,
} from "@/modules/15_development/interface/request/Main";
@ -21,7 +20,6 @@ import type {
} from "@/modules/15_development/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
const store = useDevelopmentDataStore();

View file

@ -12,14 +12,14 @@ import type {
import { useCounterMixin } from "@/stores/mixin";
const router = useRouter();
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const id = ref<string>(route.params.id as string);
const router = useRouter();
const route = useRoute();
const id = ref<string>(route.params.id as string);
const dateOrder = ref<Date | null>(null);
const order = ref<string>("");
@ -81,7 +81,6 @@ function fetchData() {
formMain.level = data.posLevelName ? data.posLevelName : null;
formMain.positionSide = data.posExecutive ? data.posExecutive : null;
formMain.oc = data.org ? data.org : null;
formMainProject.id = data.developmentId ? data.developmentId : null;
formMainProject.project = data.projectName ? data.projectName : null;
formMainProject.year = data.year ? data.year : null;
@ -92,10 +91,7 @@ function fetchData() {
? data.addressAcademic
: null;
formMainProject.topic = data.topicAcademic ? data.topicAcademic : null;
// formMainProject.studyStart = data.dateStudyStart;
// formMainProject.studyEnd = data.dateStudyEnd;
formMainProject.organizingTraining = data.org ? data.org : null;
dateOrder.value = data.dateOrder;
order.value = data.order;
})

View file

@ -6,7 +6,6 @@ import type {
FormFilter,
NewPagination,
} from "@/modules/15_development/interface/index/Main";
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
@ -44,11 +43,9 @@ const mixin = useCounterMixin();
const { messageError, dialogMessageNotify, showLoader, hideLoader } = mixin;
const modal = defineModel<boolean>("modal", { required: true });
const selected = ref<any[]>([]);
const search = ref<string>("citizenId");
const inputSearch = ref<any>("");
const govOp = ref<DataOption[]>([
{
id: "citizenId",

View file

@ -6,7 +6,6 @@ import type {
FormFilter,
NewPagination,
} from "@/modules/15_development/interface/index/Main";
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
@ -28,7 +27,6 @@ const {
showLoader,
hideLoader,
} = mixin;
const store = useDevelopmentDataStore();
const modal = defineModel<boolean>("modal", { required: true });

View file

@ -14,7 +14,6 @@ const props = defineProps({
});
const maxPage = ref<number>(1);
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 20,

View file

@ -13,7 +13,6 @@ import type { FormsSholarship } from "@/modules/15_development/interface/request
import type { DataSholarship } from "@/modules/15_development/interface/response/Scholarship";
import DialogGov from "@/modules/15_development/components/history/DialogGov.vue";
import { useCounterMixin } from "@/stores/mixin";
const fileBackReceived = ref<string>("");