From 459428979bfaa3ad9b29aa93f879e6ffab356b6f Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Mon, 2 Sep 2024 16:04:53 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/14_KPI/api.KPI.ts | 3 ++- .../indicatorByPlan/IndicatorByPlan.vue | 4 +-- .../Indicators/indicatorByRole/DetailView.vue | 2 +- .../competency/02ListLinkPosition.vue | 2 +- .../components/competency/03ListLinkGroup.vue | 4 +-- .../components/competency/04ListCriteria.vue | 2 +- .../01_masterdata/views/Assignment.vue | 2 +- src/modules/01_masterdata/views/Strategic.vue | 4 +-- .../01_masterdata/views/indicatorByRole.vue | 26 +++++++++---------- .../14_KPI/components/Tab/01_Assessment.vue | 2 +- .../Tab/Dialog/01_FormIndicator.vue | 17 +++++++----- .../components/ProjectDetail.vue | 2 +- 12 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/api/14_KPI/api.KPI.ts b/src/api/14_KPI/api.KPI.ts index 2788e2a11..225e4920d 100644 --- a/src/api/14_KPI/api.KPI.ts +++ b/src/api/14_KPI/api.KPI.ts @@ -33,7 +33,8 @@ export default { kpiEvaluation, kpiEvaluationUser, kpiPlan, - kpiPlanById: (id: string) => `${kpiPlan}/edit/${id}`, + kpiPlanByIdEdit: (id: string) => `${kpiPlan}/edit/${id}`, + kpiPlanById: (id: string) => `${kpiPlan}/${id}`, /** role */ kpiRole, diff --git a/src/modules/01_masterdata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue b/src/modules/01_masterdata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue index ee6c1a6da..48c5c4515 100644 --- a/src/modules/01_masterdata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue +++ b/src/modules/01_masterdata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue @@ -92,7 +92,7 @@ function fetchOrganizationActive() { function fetchTreeStrategy() { showLoader(); http - .get(config.API.devStrategy) + .get(config.API.devStrategy + `/edit`) .then((res) => { const data = res.data.result; nodeplan.value = data; @@ -127,7 +127,7 @@ function fetchTreeAgency(id: string) { function fetchDataById(id: string) { showLoader(); http - .get(config.API.kpiPlanById(id)) + .get(config.API.kpiPlanByIdEdit(id)) .then((res) => { const data = res.data.result; year.value = Number(data.year); diff --git a/src/modules/01_masterdata/components/Indicators/indicatorByRole/DetailView.vue b/src/modules/01_masterdata/components/Indicators/indicatorByRole/DetailView.vue index ef25438ce..f0c1c736c 100644 --- a/src/modules/01_masterdata/components/Indicators/indicatorByRole/DetailView.vue +++ b/src/modules/01_masterdata/components/Indicators/indicatorByRole/DetailView.vue @@ -127,7 +127,7 @@ function selectAgency() { /** บันทึกข้อมูล */ function onSubmit() { const url = id.value - ? config.API.kpiRoleMainEdit + `/${id.value}` + ? config.API.kpiRoleMainList + `/${id.value}` : config.API.kpiRoleMainList; const body = { diff --git a/src/modules/01_masterdata/components/competency/02ListLinkPosition.vue b/src/modules/01_masterdata/components/competency/02ListLinkPosition.vue index 692c9dbde..7eeeecec5 100644 --- a/src/modules/01_masterdata/components/competency/02ListLinkPosition.vue +++ b/src/modules/01_masterdata/components/competency/02ListLinkPosition.vue @@ -85,7 +85,7 @@ async function fetchData() { await http .get( config.API.kpiGroup + - `?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}` + `/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}` ) .then(async (res) => { total.value = res.data.result.total; diff --git a/src/modules/01_masterdata/components/competency/03ListLinkGroup.vue b/src/modules/01_masterdata/components/competency/03ListLinkGroup.vue index ce0988a64..a669d5182 100644 --- a/src/modules/01_masterdata/components/competency/03ListLinkGroup.vue +++ b/src/modules/01_masterdata/components/competency/03ListLinkGroup.vue @@ -98,7 +98,7 @@ async function getData() { http .get( config.API.kpiLink + - `?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}` + `/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}` ) .then((res) => { total.value = res.data.result.total; @@ -210,7 +210,7 @@ async function onEdit(data: any) { function getDataEdit(id: string) { showLoader(); http - .get(config.API.kpiLink + `/${id}`) + .get(config.API.kpiLink + `/edit/${id}`) .then((res) => { const data = res.data.result; groupName.value = { diff --git a/src/modules/01_masterdata/components/competency/04ListCriteria.vue b/src/modules/01_masterdata/components/competency/04ListCriteria.vue index b197b7303..3c83f405c 100644 --- a/src/modules/01_masterdata/components/competency/04ListCriteria.vue +++ b/src/modules/01_masterdata/components/competency/04ListCriteria.vue @@ -57,7 +57,7 @@ function onSubmit() { function getData() { showLoader(); http - .get(config.API.kpiEvaluation) + .get(config.API.kpiEvaluation+`/edit`) .then((res) => { dataLevel.value = res.data.result.data; }) diff --git a/src/modules/01_masterdata/views/Assignment.vue b/src/modules/01_masterdata/views/Assignment.vue index 3eee03ee3..734dc5ed0 100644 --- a/src/modules/01_masterdata/views/Assignment.vue +++ b/src/modules/01_masterdata/views/Assignment.vue @@ -115,7 +115,7 @@ function onClickDelete(id: string) { dialogRemove($q, () => { showLoader(); http - .delete(config.API.kpiSpecial + `/edit/${id}`) + .delete(config.API.kpiSpecial + `/${id}`) .then(() => { fetchList(); success($q, "ลบข้อมูลสำเร็จ"); diff --git a/src/modules/01_masterdata/views/Strategic.vue b/src/modules/01_masterdata/views/Strategic.vue index ddca8652c..377361c1c 100644 --- a/src/modules/01_masterdata/views/Strategic.vue +++ b/src/modules/01_masterdata/views/Strategic.vue @@ -58,7 +58,7 @@ const titleDialog = ref(""); function fetchDataTree() { showLoader(); http - .get(config.API.devStrategy) + .get(config.API.devStrategy + `/edit`) .then((res) => { const data: DataStrategic[] = res.data.result; nodes.value = data; @@ -154,7 +154,7 @@ function onSubmit() { }; try { const method = isStatusEdit.value ? "patch" : "post"; - await http[method](config.API.devStrategy+`/edit`, formData); + await http[method](config.API.devStrategy, formData); fetchDataTree(); success($q, "บันทึกข้อมูลสำเร็จ"); } catch (err) { diff --git a/src/modules/01_masterdata/views/indicatorByRole.vue b/src/modules/01_masterdata/views/indicatorByRole.vue index c8128e116..e0f8aed98 100644 --- a/src/modules/01_masterdata/views/indicatorByRole.vue +++ b/src/modules/01_masterdata/views/indicatorByRole.vue @@ -100,8 +100,8 @@ const roundOp = ref([ { id: "OCT", name: "รอบตุลาคม" }, ]); -function fetchList() { - http +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, @@ -118,13 +118,13 @@ function fetchList() { total.value = res.data.result.total; maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); rows.value = data; + hideLoader(); }) .catch((err) => { messageError($q, err); - }) - .finally(() => { hideLoader(); - }); + }) + .finally(() => {}); } function onClickAddOrView(status: boolean = false, id: string = "") { @@ -141,7 +141,7 @@ function onClickDelete(id: number) { dialogRemove($q, () => { showLoader(); http - .delete(config.API.kpiRoleMainEdit + `/${id}`) + .delete(config.API.kpiRoleMainList + `/${id}`) .then(() => { success($q, "ลบข้อมูลสำเร็จ"); fetchList(); @@ -187,9 +187,9 @@ function filterOption(val: any, update: Function) { } /** ดึงข้อมูลตำแหน่ง */ -function getOptions() { +async function getOptions() { showLoader(); - http + await http .get(config.API.orgSalaryPosition) .then((res) => { const dataOp = res.data.result; @@ -210,13 +210,13 @@ function getOptions() { positionMainOp.value.push(...filteredData); positionOp.value.push(...filteredData); + hideLoader(); }) .catch((err) => { messageError($q, err); - }) - .finally(() => { hideLoader(); - }); + }) + .finally(() => {}); } function setModel(val: string) { @@ -244,8 +244,8 @@ function onClickHistory(id: string) { }); } -function getTotal() { - http +async function getTotal() { + await http .post(config.API.indicatorSummary) .then((res) => { const data = res.data.result; diff --git a/src/modules/14_KPI/components/Tab/01_Assessment.vue b/src/modules/14_KPI/components/Tab/01_Assessment.vue index c8bb6abff..1af7de6af 100644 --- a/src/modules/14_KPI/components/Tab/01_Assessment.vue +++ b/src/modules/14_KPI/components/Tab/01_Assessment.vue @@ -148,7 +148,7 @@ async function fetchAssigned() { async function getCriteria() { await http - .get(config.API.KpiEvaluationInfo) + .get(config.API.KpiEvaluationInfo+`/edit`) .then(async (res) => { const data = await res.data.result.data; dataListCriteria.value = data; diff --git a/src/modules/14_KPI/components/Tab/Dialog/01_FormIndicator.vue b/src/modules/14_KPI/components/Tab/Dialog/01_FormIndicator.vue index 003059f92..98bf057e9 100644 --- a/src/modules/14_KPI/components/Tab/Dialog/01_FormIndicator.vue +++ b/src/modules/14_KPI/components/Tab/Dialog/01_FormIndicator.vue @@ -257,10 +257,10 @@ function clickList(id: string, isData: boolean = false) { showLoader(); const url = numpage.value === 1 - ? config.API.kpiPlan + ? config.API.kpiPlan + `/edit` : numpage.value === 2 - ? config.API.kpiRole - : config.API.kpiSpecial; + ? config.API.kpiRole + `/edit` + : config.API.kpiSpecial + `/edit`; http .get(`${url}/${id}`) .then((res) => { @@ -341,7 +341,7 @@ function closeDialog() { formFilter.page = 1; formFilter.pageSize = 20; - isStatusEdit.value = false + isStatusEdit.value = false; checkDetail.value = false; } @@ -427,7 +427,6 @@ watch( fetchListPlan(); isStatusEdit.value && fetchListPlanByid(kpiUserPlannedId.value); checkDetail.value && fetchListPlanByid(kpiUserPlannedId.value); - } else if (numpage.value === 2) { fetchListRole(); isStatusEdit.value && fetchRoleByid(kpiUserPlannedId.value); @@ -992,9 +991,13 @@ const title = computed(() => { - + - + บันทึกข้อมูล diff --git a/src/modules/15_development/components/ProjectDetail.vue b/src/modules/15_development/components/ProjectDetail.vue index 6a8f46cd2..6d5a1b6b3 100644 --- a/src/modules/15_development/components/ProjectDetail.vue +++ b/src/modules/15_development/components/ProjectDetail.vue @@ -294,7 +294,7 @@ function fetchData() { function fetchTree() { showLoader(); http - .get(config.API.devStrategy) + .get(config.API.devStrategy+`/edit`) .then((res) => { const data = res.data.result; nodes.value = data;