รายการโครงการ => ปรับ interface
This commit is contained in:
parent
854ee54396
commit
1757de73ff
4 changed files with 141 additions and 290 deletions
|
|
@ -2,30 +2,22 @@
|
||||||
import { reactive, ref, onMounted } from "vue";
|
import { reactive, ref, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
|
|
||||||
import type { FormBasicinfo } from "@/modules/15_development/interface/request/Main";
|
|
||||||
|
|
||||||
import DialogSelectAgency from "@/modules/15_development/components/DialogSelectAgency.vue";
|
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
|
||||||
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
const $q = useQuasar();
|
/** importType*/
|
||||||
const store = useDevelopmentDataStore();
|
import type { FormBasicinfo } from "@/modules/15_development/interface/request/Main";
|
||||||
const mixin = useCounterMixin();
|
import type { DataTree } from "@/modules/15_development/interface/response/Main";
|
||||||
|
|
||||||
const {
|
/** importStore*/
|
||||||
dialogRemove,
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
dialogConfirm,
|
|
||||||
showLoader,
|
/** use*/
|
||||||
hideLoader,
|
const $q = useQuasar();
|
||||||
messageError,
|
|
||||||
success,
|
|
||||||
date2Thai,
|
|
||||||
} = mixin;
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
|
||||||
|
|
||||||
const projectId = ref<string>(route.params.id.toLocaleString());
|
const projectId = ref<string>(route.params.id.toLocaleString());
|
||||||
|
|
||||||
const formData = reactive<FormBasicinfo>({
|
const formData = reactive<FormBasicinfo>({
|
||||||
|
|
@ -41,8 +33,12 @@ const formData = reactive<FormBasicinfo>({
|
||||||
const orgName = ref<string>("");
|
const orgName = ref<string>("");
|
||||||
const node = ref<any>([]);
|
const node = ref<any>([]);
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
const expanded = ref<any>([]);
|
const expanded = ref<string[]>([]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch ข้อมูลเบื้องต้น
|
||||||
|
* @param id ProjectId
|
||||||
|
*/
|
||||||
function fetchData(id: string) {
|
function fetchData(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -76,29 +72,26 @@ function fetchData(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function editData(id: string) {
|
/** function บันทึกข้อมูล*/
|
||||||
await http
|
|
||||||
.put(config.API.developmentMainTab("tab1", id), formData)
|
|
||||||
.then(() => {
|
|
||||||
fetchData(id);
|
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
messageError($q, err);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm($q, async () => {
|
dialogConfirm($q, () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
editData(projectId.value);
|
http
|
||||||
hideLoader();
|
.put(config.API.developmentMainTab("tab1", projectId.value), formData)
|
||||||
|
.then(() => {
|
||||||
|
fetchData(projectId.value);
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function fetch หา Id หน่วยงานที่ Active*/
|
||||||
function fetchActive() {
|
function fetchActive() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -113,11 +106,15 @@ function fetchActive() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchTree(id: string) {
|
/**
|
||||||
|
* function fetch โครงสร้างปจุบัน
|
||||||
|
* @param id โครงสร้างปจุบัน
|
||||||
|
*/
|
||||||
|
function fetchTree(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.orgByid(id.toString()))
|
.get(config.API.orgByid(id.toString()))
|
||||||
.then(async (res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
node.value = data;
|
node.value = data;
|
||||||
fetchData(projectId.value);
|
fetchData(projectId.value);
|
||||||
|
|
@ -130,13 +127,19 @@ async function fetchTree(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSelected(data: any) {
|
/** function เลือกหน่วยงาน*/
|
||||||
|
function updateSelected(data: DataTree) {
|
||||||
orgName.value = data.orgTreeName;
|
orgName.value = data.orgTreeName;
|
||||||
formData.node = data.orgLevel;
|
formData.node = data.orgLevel;
|
||||||
formData.nodeId = data.orgTreeId;
|
formData.nodeId = data.orgTreeId;
|
||||||
formData.orgRevisionId = data.orgRevisionId;
|
formData.orgRevisionId = data.orgRevisionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function หาหน่วยงานที่รับผิดชอบ
|
||||||
|
* @param orgTreeData ข้อมูล nodeTree
|
||||||
|
* @param treeId tree ID
|
||||||
|
*/
|
||||||
async function searchAndReplace(orgTreeData: any, treeId: string | null) {
|
async function searchAndReplace(orgTreeData: any, treeId: string | null) {
|
||||||
if (orgTreeData) {
|
if (orgTreeData) {
|
||||||
for (let orgTree of orgTreeData) {
|
for (let orgTree of orgTreeData) {
|
||||||
|
|
@ -154,9 +157,6 @@ async function searchAndReplace(orgTreeData: any, treeId: string | null) {
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
fetchActive();
|
fetchActive();
|
||||||
// setTimeout(() => {
|
|
||||||
// fetchData(projectId.value);
|
|
||||||
// }, 500);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,220 +1,43 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
import type {
|
/** importComponents*/
|
||||||
ResDataProject,
|
import BasicInfo from "@/modules/15_development/components/BasicInfo.vue"; // ข้อมูลเบื้องต้น
|
||||||
ResPlannedGoals,
|
import Target from "@/modules/15_development/components/Target.vue"; // เป้าหมาย
|
||||||
ResActualGoals,
|
import ProjectDetail from "@/modules/15_development/components/ProjectDetail.vue"; // ลักษณะโครงการ
|
||||||
ResPeople,
|
import FollowResult from "@/modules/15_development/components/FollowResult.vue"; // การติดตามประเมินผล
|
||||||
} from "@/modules/15_development/interface/response/Main";
|
import Other from "@/modules/15_development/components/Other.vue"; // อื่นๆ
|
||||||
|
import Record from "@/modules/15_development/components/Record.vue"; // บันทึกผล
|
||||||
import BasicInfo from "@/modules/15_development/components/BasicInfo.vue";
|
|
||||||
import Target from "@/modules/15_development/components/Target.vue";
|
|
||||||
import ProjectDetail from "@/modules/15_development/components/ProjectDetail.vue";
|
|
||||||
import FollowResult from "@/modules/15_development/components/FollowResult.vue";
|
|
||||||
import Other from "@/modules/15_development/components/Other.vue";
|
|
||||||
import Record from "@/modules/15_development/components/Record.vue";
|
|
||||||
|
|
||||||
|
/** importStore*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
||||||
|
|
||||||
|
/** use*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = useDevelopmentDataStore();
|
const store = useDevelopmentDataStore();
|
||||||
const {
|
const { success, showLoader, hideLoader, messageError, dialogConfirm } =
|
||||||
success,
|
useCounterMixin();
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
messageError,
|
|
||||||
dialogConfirm,
|
|
||||||
dialogMessageNotify,
|
|
||||||
} = useCounterMixin();
|
|
||||||
|
|
||||||
const title = ref<string>(route.params.id ? "แก้ไข" : "เพิ่ม");
|
const title = ref<string>(route.params.id ? "แก้ไข" : "เพิ่ม");
|
||||||
const projectId = ref<string>(route.params.id.toLocaleString());
|
const projectId = ref<string>(route.params.id.toLocaleString());
|
||||||
const tab = ref<string>("BasicInfo");
|
const tab = ref<string>("BasicInfo");
|
||||||
|
|
||||||
const status = ref<string>("ONGOING");
|
const status = ref<string>("ONGOING");
|
||||||
// function fetchDataProject(id: string) {
|
|
||||||
// showLoader();
|
|
||||||
// http
|
|
||||||
// .get(config.API.developmentMainById(id))
|
|
||||||
// .then((res) => {
|
|
||||||
// const data: ResDataProject = res.data.result;
|
|
||||||
// /** ข้อมูลเบื้องต้น*/
|
|
||||||
// status.value = data.status ? data.status : "ONGOING";
|
|
||||||
// store.formAddProject.year = data.year;
|
|
||||||
// store.formAddProject.projectName = data.projectName;
|
|
||||||
// store.formAddProject.reason = data.reason;
|
|
||||||
// store.formAddProject.objective = data.objective;
|
|
||||||
// /**เป้าหมาย*/
|
|
||||||
// const plannedGoals = data.plannedGoals.map((e: any) => ({
|
|
||||||
// groupTarget: e.groupTarget,
|
|
||||||
// groupTargetSub: e.groupTargetSub,
|
|
||||||
// positions: e.plannedGoalPositions.map((v: any) => ({
|
|
||||||
// position: v.position,
|
|
||||||
// posTypePlannedId: v.posTypePlannedId,
|
|
||||||
// posLevelPlannedId: v.posLevelPlannedId,
|
|
||||||
// })),
|
|
||||||
// type: e.type ? e.type : null,
|
|
||||||
// amount: e.amount,
|
|
||||||
// }));
|
|
||||||
// const plannedPeoples = data.plannedPeoples.map((e: ResPeople) => ({
|
|
||||||
// groupTarget: e.groupTarget,
|
|
||||||
// amount: e.amount,
|
|
||||||
// }));
|
|
||||||
// store.formAddProject.plannedGoals = plannedGoals;
|
|
||||||
// store.formAddProject.plannedPeoples = plannedPeoples;
|
|
||||||
|
|
||||||
// const actualGoals = data.actualGoals.map((e: ResActualGoals) => ({
|
|
||||||
// groupTarget: e.groupTarget,
|
|
||||||
// groupTargetSub: e.groupTargetSub,
|
|
||||||
// position: e.position,
|
|
||||||
// posTypeActualId: e.posTypeActualId,
|
|
||||||
// posLevelActualId: e.posLevelActualId,
|
|
||||||
// type: e.type,
|
|
||||||
// amount: e.amount,
|
|
||||||
// }));
|
|
||||||
// const actualPeoples = data.actualPeoples.map((e: ResPeople) => ({
|
|
||||||
// groupTarget: e.groupTarget,
|
|
||||||
// amount: e.amount,
|
|
||||||
// }));
|
|
||||||
// store.formAddProject.actualGoals = actualGoals;
|
|
||||||
// store.formAddProject.actualPeoples = actualPeoples;
|
|
||||||
|
|
||||||
// // ลักษณะโครงการ
|
|
||||||
// store.formAddProject.projectType = data.projectType;
|
|
||||||
// store.formAddProject.projectCharacteristics = data.projectCharacteristics;
|
|
||||||
// store.formAddProject.projectDay = data.projectDay;
|
|
||||||
// store.formAddProject.projectNigth = data.projectNigth;
|
|
||||||
// store.formAddProject.projectTechniques = data.projectTechniques;
|
|
||||||
// store.formAddProject.projectModal = data.projectModal;
|
|
||||||
|
|
||||||
// /** การติดตามผลดารประเมิน*/
|
|
||||||
// store.formAddProject.metricType = data.metricType;
|
|
||||||
// store.formAddProject.indicators = data.indicators;
|
|
||||||
// store.formAddProject.target = data.target;
|
|
||||||
// store.formAddProject.calculation = data.calculation;
|
|
||||||
// store.formAddProject.measuRement = data.measuRement;
|
|
||||||
// store.formAddProject.results = data.results;
|
|
||||||
// store.formAddProject.obstacles = data.obstacles;
|
|
||||||
// store.formAddProject.suggestions = data.suggestions;
|
|
||||||
// store.formAddProject.project = data.project;
|
|
||||||
// store.formAddProject.isPassAllocate = data.isPassAllocate;
|
|
||||||
// store.formAddProject.isPassNoAllocate = data.isPassNoAllocate;
|
|
||||||
// store.formAddProject.isNoPass = data.isNoPass;
|
|
||||||
// store.formAddProject.isBudget = data.isBudget;
|
|
||||||
// store.formAddProject.isOutBudget = data.isOutBudget;
|
|
||||||
|
|
||||||
// /** อื่นๆ*/
|
|
||||||
// store.formAddProject.dateStart = data.dateStart;
|
|
||||||
// store.formAddProject.dateEnd = data.dateEnd;
|
|
||||||
// store.formAddProject.totalDate = data.totalDate;
|
|
||||||
// store.formAddProject.address = data.address;
|
|
||||||
|
|
||||||
// const provinces = data.provinces.map((e: any) => e.id);
|
|
||||||
// const provincesId = [...provinces];
|
|
||||||
// store.formAddProject.provinceIds = provincesId;
|
|
||||||
|
|
||||||
// store.formAddProject.budget = data.budget;
|
|
||||||
// store.formAddProject.accept = data.accept;
|
|
||||||
// store.formAddProject.receive = data.receive;
|
|
||||||
// store.formAddProject.approved = data.approved;
|
|
||||||
// store.formAddProject.budgetPay = data.budgetPay;
|
|
||||||
// store.formAddProject.issues = data.issues;
|
|
||||||
// store.formAddProject.chance = Number(data.chance);
|
|
||||||
// store.formAddProject.effects = Number(data.effects);
|
|
||||||
// store.formAddProject.riskLevel = data.riskLevel;
|
|
||||||
// store.formAddProject.riskManagement = data.riskManagement;
|
|
||||||
// store.formAddProject.expect = data.expect;
|
|
||||||
// store.formAddProject.topicAcademic = data.topicAcademic;
|
|
||||||
// store.formAddProject.addressAcademic = data.addressAcademic;
|
|
||||||
// store.formAddProject.provinceActualId = data.provinceActualId;
|
|
||||||
// })
|
|
||||||
// .catch((err) => {
|
|
||||||
// messageError($q, err);
|
|
||||||
// })
|
|
||||||
// .finally(() => {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// hideLoader();
|
|
||||||
// }, 1000);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function onSubmit() {
|
|
||||||
// if (store.formAddProject.projectName === "" && tab.value !== "BasicInfo") {
|
|
||||||
// dialogMessageNotify($q, "ชื่อโครงการ/กิจกรรม/หลักสูตร");
|
|
||||||
// tab.value = "BasicInfo";
|
|
||||||
// } else {
|
|
||||||
// dialogConfirm($q, async () => {
|
|
||||||
// showLoader();
|
|
||||||
// /** การติดตามผลดารประเมิน*/
|
|
||||||
// if (store.formAddProject.project === "OFFER") {
|
|
||||||
// store.formAddProject.isBudget = false;
|
|
||||||
// store.formAddProject.isOutBudget = false;
|
|
||||||
// } else {
|
|
||||||
// store.formAddProject.isPassAllocate = false;
|
|
||||||
// store.formAddProject.isPassNoAllocate = false;
|
|
||||||
// store.formAddProject.isNoPass = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // ลักษณะโครงการ;
|
|
||||||
// store.formAddProject.projectDay = store.formAddProject.projectDay
|
|
||||||
// ? Number(store.formAddProject.projectDay)
|
|
||||||
// : null;
|
|
||||||
// store.formAddProject.projectNigth = store.formAddProject.projectNigth
|
|
||||||
// ? Number(store.formAddProject.projectNigth)
|
|
||||||
// : null;
|
|
||||||
// store.formAddProject.projectModal = store.formAddProject.projectModal
|
|
||||||
// ? Number(store.formAddProject.projectModal)
|
|
||||||
// : null;
|
|
||||||
|
|
||||||
// /** อื่นๆ*/
|
|
||||||
// store.formAddProject.totalDate = Number(store.formAddProject.totalDate);
|
|
||||||
// store.formAddProject.accept =
|
|
||||||
// typeof store.formAddProject.accept === "string"
|
|
||||||
// ? Number(store.formAddProject.accept.replace(/,/g, ""))
|
|
||||||
// : store.formAddProject.accept;
|
|
||||||
// store.formAddProject.receive =
|
|
||||||
// typeof store.formAddProject.receive === "string"
|
|
||||||
// ? Number(store.formAddProject.receive.replace(/,/g, ""))
|
|
||||||
// : store.formAddProject.receive;
|
|
||||||
// store.formAddProject.approved =
|
|
||||||
// typeof store.formAddProject.approved === "string"
|
|
||||||
// ? Number(store.formAddProject.approved.replace(/,/g, ""))
|
|
||||||
// : store.formAddProject.approved;
|
|
||||||
// store.formAddProject.budgetPay =
|
|
||||||
// typeof store.formAddProject.budgetPay === "string"
|
|
||||||
// ? Number(store.formAddProject.budgetPay.replace(/,/g, ""))
|
|
||||||
// : store.formAddProject.budgetPay;
|
|
||||||
|
|
||||||
// const url = projectId.value
|
|
||||||
// ? config.API.developmentMainById(projectId.value)
|
|
||||||
// : config.API.developmentMain;
|
|
||||||
// const method = projectId.value ? "put" : "post";
|
|
||||||
// try {
|
|
||||||
// const res = await http[method](url, store.formAddProject);
|
|
||||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
|
||||||
// !projectId.value && router.push(`/development/${res.data.result}`);
|
|
||||||
// projectId.value && fetchDataProject(projectId.value);
|
|
||||||
// } catch (e) {
|
|
||||||
// messageError($q, e);
|
|
||||||
// } finally {
|
|
||||||
// hideLoader();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch สถานะ Project
|
||||||
|
* @param id projectId
|
||||||
|
*/
|
||||||
function getStatus(id: string) {
|
function getStatus(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.developmentMainStatus(id)) // change path
|
.get(config.API.developmentMainStatus(id))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
status.value = res.data.result.status;
|
status.value = res.data.result.status;
|
||||||
store.projectStatus = res.data.result.status;
|
store.projectStatus = res.data.result.status;
|
||||||
|
|
@ -227,14 +50,15 @@ function getStatus(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function ยืนยันการเสร็จสิ้นโครงการ*/
|
||||||
function onFinish(id: string) {
|
function onFinish(id: string) {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.developmentMainFinish(id)) // change path
|
.get(config.API.developmentMainFinish(id))
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
getStatus(id);
|
getStatus(id);
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
|
|
@ -250,16 +74,12 @@ function onFinish(id: string) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** hooklifecycle*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
projectId.value && getStatus(projectId.value);
|
projectId.value && getStatus(projectId.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
store.clearFormAddProject();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<!-- <q-form greedy @submit.prevent @validation-success="onSubmit"> -->
|
|
||||||
<div class="toptitle text-dark col-12 row items-center">
|
<div class="toptitle text-dark col-12 row items-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
flat
|
flat
|
||||||
|
|
@ -272,17 +92,6 @@ onUnmounted(() => {
|
||||||
/>
|
/>
|
||||||
{{ `${title}โครงการ/หลักสูตรการฝึกอบรม` }}
|
{{ `${title}โครงการ/หลักสูตรการฝึกอบรม` }}
|
||||||
<q-space />
|
<q-space />
|
||||||
<!-- <q-btn
|
|
||||||
dense
|
|
||||||
unelevated
|
|
||||||
label="บันทึก"
|
|
||||||
id="onSubmit"
|
|
||||||
type="submit"
|
|
||||||
color="public"
|
|
||||||
class="q-px-md"
|
|
||||||
>
|
|
||||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
|
||||||
</q-btn> -->
|
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="status === 'ONGOING'"
|
v-if="status === 'ONGOING'"
|
||||||
unelevated
|
unelevated
|
||||||
|
|
@ -329,7 +138,6 @@ onUnmounted(() => {
|
||||||
</q-tab-panels>
|
</q-tab-panels>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
<!-- </q-form> -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,36 @@ interface DataStrategic {
|
||||||
children: DataStrategic;
|
children: DataStrategic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DataTree {
|
||||||
|
labelName: string;
|
||||||
|
orgCode: string;
|
||||||
|
orgLevel: number | null;
|
||||||
|
orgName: string;
|
||||||
|
orgRevisionId: string;
|
||||||
|
orgRootName: string;
|
||||||
|
orgTreeCode: string;
|
||||||
|
orgTreeFax: string;
|
||||||
|
orgTreeId: string;
|
||||||
|
orgTreeName: string;
|
||||||
|
orgTreeOrder: number | null;
|
||||||
|
orgTreePhoneEx: string;
|
||||||
|
orgTreePhoneIn: string;
|
||||||
|
orgTreeRank: string;
|
||||||
|
orgTreeRankSub: string | null;
|
||||||
|
orgTreeShortName: string;
|
||||||
|
totalPosition: number | null;
|
||||||
|
totalPositionCurrentUse: number | null;
|
||||||
|
totalPositionCurrentVacant: number | null;
|
||||||
|
totalPositionNextUse: number | null;
|
||||||
|
totalPositionNextVacant: number | null;
|
||||||
|
totalRootPosition: number | null;
|
||||||
|
totalRootPositionCurrentUse: number | null;
|
||||||
|
totalRootPositionCurrentVacant: number | null;
|
||||||
|
totalRootPositionNextUse: number | null;
|
||||||
|
totalRootPositionNextVacant: number | null;
|
||||||
|
children: DataTree;
|
||||||
|
}
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
ResGroup,
|
ResGroup,
|
||||||
ResLevel,
|
ResLevel,
|
||||||
|
|
@ -145,4 +175,5 @@ export type {
|
||||||
ResPlannedGoals,
|
ResPlannedGoals,
|
||||||
ResRecord,
|
ResRecord,
|
||||||
DataStrategic,
|
DataStrategic,
|
||||||
|
DataTree,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ import type {
|
||||||
FormQueryListProject,
|
FormQueryListProject,
|
||||||
FormProject,
|
FormProject,
|
||||||
} from "@/modules/15_development/interface/request/Main";
|
} from "@/modules/15_development/interface/request/Main";
|
||||||
import type { ResListProject } from "@/modules/15_development/interface/response/Main";
|
import type {
|
||||||
|
ResListProject,
|
||||||
|
DataTree,
|
||||||
|
} from "@/modules/15_development/interface/response/Main";
|
||||||
|
|
||||||
/** importStore*/
|
/** importStore*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
@ -28,9 +31,8 @@ const router = useRouter();
|
||||||
const { showLoader, hideLoader, messageError, dialogMessageNotify } =
|
const { showLoader, hideLoader, messageError, dialogMessageNotify } =
|
||||||
useCounterMixin();
|
useCounterMixin();
|
||||||
|
|
||||||
const ticked = ref<any>([]);
|
|
||||||
const node = ref<any>([]);
|
const node = ref<any>([]);
|
||||||
const expanded = ref<any>([]);
|
const expanded = ref<string[]>([]);
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
const filterMain = ref<string>("");
|
const filterMain = ref<string>("");
|
||||||
const splitterModel = ref<number>(60);
|
const splitterModel = ref<number>(60);
|
||||||
|
|
@ -77,6 +79,14 @@ const statusOpt = ref<DataOption[]>([
|
||||||
{ id: "ONGOING", name: "กำลังดำเนินการ" },
|
{ id: "ONGOING", name: "กำลังดำเนินการ" },
|
||||||
{ id: "FINISH", name: "เสร็จสิ้นโครงการ" },
|
{ id: "FINISH", name: "เสร็จสิ้นโครงการ" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const formProject = reactive<FormProject>({
|
||||||
|
year: null,
|
||||||
|
projectName: "",
|
||||||
|
node: null,
|
||||||
|
nodeId: null,
|
||||||
|
orgRevisionId: null,
|
||||||
|
});
|
||||||
/** formQuery*/
|
/** formQuery*/
|
||||||
const formQuery = reactive<FormQueryListProject>({
|
const formQuery = reactive<FormQueryListProject>({
|
||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
|
|
@ -88,7 +98,6 @@ const formQuery = reactive<FormQueryListProject>({
|
||||||
node: null,
|
node: null,
|
||||||
nodeId: null,
|
nodeId: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
||||||
|
|
||||||
/** funciton fetch รายการโครงการ*/
|
/** funciton fetch รายการโครงการ*/
|
||||||
|
|
@ -121,31 +130,18 @@ function onClickAddOrView(status: boolean = false, id: string = "") {
|
||||||
status ? router.push(`/development/${id}`) : router.push("/development/add");
|
status ? router.push(`/development/${id}`) : router.push("/development/add");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function เปิด Dialog เพิ่มโครงการ/หลักสูตรการฝึกอบรม*/
|
||||||
function onAdd() {
|
function onAdd() {
|
||||||
modal.value = true;
|
modal.value = true;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* function updatePagination
|
|
||||||
* @param newPagination ข้อมูล Pagination ใหม่
|
|
||||||
*/
|
|
||||||
function updatePagination(newPagination: NewPagination) {
|
|
||||||
formQuery.page = 1;
|
|
||||||
formQuery.pageSize = newPagination.rowsPerPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
|
|
||||||
watch(
|
|
||||||
() => formQuery.pageSize,
|
|
||||||
() => {
|
|
||||||
fetchListProject();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
/** function fetchข้อมูลหน้าแรกใหม่*/
|
||||||
function fetchListProjectNew() {
|
function fetchListProjectNew() {
|
||||||
formQuery.page = 1;
|
formQuery.page = 1;
|
||||||
fetchListProject();
|
fetchListProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function Download รายการโครงการ*/
|
||||||
function onDownload() {
|
function onDownload() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -165,6 +161,7 @@ function onDownload() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function ปิด Dialog เพิ่มโครงการ/หลักสูตรการฝึกอบรม*/
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
year.value = 0;
|
year.value = 0;
|
||||||
|
|
@ -172,14 +169,6 @@ function closeDialog() {
|
||||||
projectName.value = "";
|
projectName.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const formProject = reactive<FormProject>({
|
|
||||||
year: null,
|
|
||||||
projectName: "",
|
|
||||||
node: null,
|
|
||||||
nodeId: null,
|
|
||||||
orgRevisionId: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** dialog submit */
|
/** dialog submit */
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
if (formProject.nodeId) {
|
if (formProject.nodeId) {
|
||||||
|
|
@ -198,6 +187,7 @@ function onSubmit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function fetch หา Id หน่วยงานที่ Active*/
|
||||||
function fetchActive() {
|
function fetchActive() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -212,7 +202,11 @@ function fetchActive() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchTree(id: string) {
|
/**
|
||||||
|
* function fetch โครงสร้างปจุบัน
|
||||||
|
* @param id โครงสร้างปจุบัน
|
||||||
|
*/
|
||||||
|
function fetchTree(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.orgByid(id.toString()))
|
.get(config.API.orgByid(id.toString()))
|
||||||
|
|
@ -228,13 +222,15 @@ async function fetchTree(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSelected(data: any) {
|
/** function เลือกหน่วยงานที่รับผิดชอบ*/
|
||||||
|
function updateSelected(data: DataTree) {
|
||||||
formProject.node = data.orgLevel;
|
formProject.node = data.orgLevel;
|
||||||
formProject.nodeId = data.orgTreeId;
|
formProject.nodeId = data.orgTreeId;
|
||||||
formProject.orgRevisionId = data.orgRevisionId;
|
formProject.orgRevisionId = data.orgRevisionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSelectedTreeMain(data: any) {
|
/** function เลือกหน่วยงานที่จะค้นหาโครงการ */
|
||||||
|
function updateSelectedTreeMain(data: DataTree) {
|
||||||
if (formQuery.node === data.orgLevel && formQuery.nodeId === data.orgTreeId) {
|
if (formQuery.node === data.orgLevel && formQuery.nodeId === data.orgTreeId) {
|
||||||
formQuery.node = null;
|
formQuery.node = null;
|
||||||
formQuery.nodeId = null;
|
formQuery.nodeId = null;
|
||||||
|
|
@ -242,10 +238,26 @@ function updateSelectedTreeMain(data: any) {
|
||||||
formQuery.node = data.orgLevel;
|
formQuery.node = data.orgLevel;
|
||||||
formQuery.nodeId = data.orgTreeId;
|
formQuery.nodeId = data.orgTreeId;
|
||||||
}
|
}
|
||||||
|
fetchListProjectNew(); // fetch โครงการ
|
||||||
fetchListProjectNew();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function updatePagination
|
||||||
|
* @param newPagination ข้อมูล Pagination ใหม่
|
||||||
|
*/
|
||||||
|
function updatePagination(newPagination: NewPagination) {
|
||||||
|
formQuery.page = 1;
|
||||||
|
formQuery.pageSize = newPagination.rowsPerPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
|
||||||
|
watch(
|
||||||
|
() => formQuery.pageSize,
|
||||||
|
() => {
|
||||||
|
fetchListProject();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchActive();
|
fetchActive();
|
||||||
fetchListProject();
|
fetchListProject();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue