diff --git a/src/modules/15_development/components/ProjectDetail.vue b/src/modules/15_development/components/ProjectDetail.vue index 579de44b6..5efda6cb6 100644 --- a/src/modules/15_development/components/ProjectDetail.vue +++ b/src/modules/15_development/components/ProjectDetail.vue @@ -66,43 +66,22 @@ const formData = reactive({ developmentProjectTechniqueActuals: [], projectModalActual: null, projectModalPlanneds: null, + strategyChildPlannedId: null, //id ยุทธศาสตร์เป้าหมายตามแผน + strategyChildPlannedNode: 0, //node ยุทธศาสตร์เป้าหมายตามแผน + strategyChildActualId: null, //id ยุทธศาสตร์เป้าหมายตามจริง + strategyChildActualNode: 0, //node ยุทธศาสตร์เป้าหมายตามจริง }); -const nodes = ref([ - { - orgTreeName: " แผนพัฒนากรุงเทพมหานคร ระยะ 20 ปี ระยะที่ 3", - level: "0", - children: [ - { - orgTreeName: "ยุทธศาสตร์ที่ 1", - level: "1", - children: [ - { - orgTreeName: "ยุทธศาสตร์ที่ 2", - level: "2", - children: [ - { - orgTreeName: "ยุทธศาสตร์ที่ 3", - level: "3", - }, - ], - }, - ], - }, - ], - }, -]); +const nodes = ref([]); const filter = ref(""); const filter2 = ref(""); const notFound = ref("ไม่พบข้อมูลที่ค้นหา"); const noData = ref("ไม่มีข้อมูล"); const expanded = ref>([]); const expanded2 = ref>([]); -const nodeId = ref(""); -const nodeId2 = ref(""); -async function fetchData() { +function fetchData() { showLoader(); - await http + http .get(config.API.developmentMainTab("tab3", projectId.value)) .then((res) => { const data = res.data.result; @@ -123,6 +102,26 @@ async function fetchData() { formData.projectNigthHoldActual = data.projectNigthHoldActual; formData.developmentProjectTechniqueActuals = data.developmentProjectTechniqueActuals; + formData.strategyChildPlannedId = data.strategyChildPlannedId; + formData.strategyChildPlannedNode = data.strategyChildPlannedNode; + formData.strategyChildActualId = data.strategyChildActualId; + formData.strategyChildActualNode = data.strategyChildActualNode; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + +function fetchTree() { + showLoader(); + http + .get(config.API.devStrategy) + .then((res) => { + const data = res.data.result; + nodes.value = data; }) .catch((err) => { messageError($q, err); @@ -135,10 +134,9 @@ async function fetchData() { async function onSubmit() { dialogConfirm($q, async () => { showLoader(); - await http .put(config.API.developmentMainTab("tab3", projectId.value), formData) - .then((res) => { + .then(() => { success($q, "บันทึกข้อมูลสำเร็จ"); fetchData(); }) @@ -151,14 +149,17 @@ async function onSubmit() { function updateSelected(data: any, type: string) { if (type === "1") { - nodeId.value = data.orgTreeName; + formData.strategyChildPlannedId = data.id; + formData.strategyChildPlannedNode = data.level; } else if (type === "2") { - nodeId2.value = data.orgTreeName; + formData.strategyChildActualId = data.id; + formData.strategyChildActualNode = data.level; } } onMounted(() => { fetchData(); + fetchTree(); }); @@ -216,8 +217,8 @@ onMounted(() => { dense :nodes="nodes" selected-color="primary" - node-key="orgTreeName" - label-key="orgTreeName" + node-key="id" + label-key="id" :filter="filter" :no-results-label="notFound" :no-nodes-label="noData" @@ -227,13 +228,13 @@ onMounted(() => {
- {{ prop.node.orgTreeName }} + {{ prop.node.name }}
@@ -266,8 +267,8 @@ onMounted(() => { {
- {{ prop.node.orgTreeName }} + {{ prop.node.name }}
@@ -498,4 +499,12 @@ onMounted(() => { - + diff --git a/src/modules/15_development/interface/index/Main.ts b/src/modules/15_development/interface/index/Main.ts index 85250e452..1d179fe89 100644 --- a/src/modules/15_development/interface/index/Main.ts +++ b/src/modules/15_development/interface/index/Main.ts @@ -79,6 +79,10 @@ interface FormProjectDetail { developmentProjectTechniqueActuals: []; projectModalActual?: string | null; projectModalPlanneds?: string | null; + strategyChildPlannedId: string | null; //id ยุทธศาสตร์เป้าหมายตามแผน + strategyChildPlannedNode: number; //node ยุทธศาสตร์เป้าหมายตามแผน + strategyChildActualId: string | null; //id ยุทธศาสตร์เป้าหมายตามจริง + strategyChildActualNode: number; //node ยุทธศาสตร์เป้าหมายตามจริง } export type { diff --git a/src/modules/15_development/views/EmployeeHistory.vue b/src/modules/15_development/views/EmployeeHistory.vue index 00d7bb263..a18007bd0 100644 --- a/src/modules/15_development/views/EmployeeHistory.vue +++ b/src/modules/15_development/views/EmployeeHistory.vue @@ -127,28 +127,28 @@ const columns = ref([ }, ]); -function onAdd() { - store.statusEdit = false; - router.push(`/development/employee-history/add`); -} +// function onAdd() { +// store.statusEdit = false; +// router.push(`/development/employee-history/add`); +// } + function onDownload() { showLoader(); - http - .get(config.API.developmentReportHistoryOfficer()) - .then((res) => { - const dataList = res.data.result; - genReportXLSX( - dataList, - "รายการประวัติฝึกอบรม/ดูงานลูกจ้าง" - ); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); - + http + .post(config.API.developmentReportHistoryOfficer(), { + year: formFilter.year, + root: agency.value, + }) + .then((res) => { + const dataList = res.data.result; + genReportXLSX(dataList, "รายการประวัติฝึกอบรม/ดูงานลูกจ้าง"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); } function onEdit(id: string) { @@ -162,6 +162,7 @@ function getData() { pageSize: formFilter.pageSize, keyword: formFilter.keyword, year: formFilter.year, + root: agency.value, }; showLoader(); @@ -200,6 +201,7 @@ onMounted(() => { getData(); }); +