From 96b24dbb311e30440753857586fc049ec52677e8 Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Tue, 23 Apr 2024 11:13:03 +0700 Subject: [PATCH 1/9] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=A7=E0=B8=8A=E0=B8=B5=E0=B9=89=E0=B8=A7=E0=B8=B1=E0=B8=94?= =?UTF-8?q?=E0=B8=95=E0=B8=B2=E0=B8=A1=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/indicatorByRole/DetailView.vue | 74 +++++++++++-------- src/modules/14_KPI/views/indicatorByRole.vue | 13 +++- 2 files changed, 52 insertions(+), 35 deletions(-) diff --git a/src/modules/14_KPI/components/indicatorByRole/DetailView.vue b/src/modules/14_KPI/components/indicatorByRole/DetailView.vue index 3e1bc03e7..121445d77 100644 --- a/src/modules/14_KPI/components/indicatorByRole/DetailView.vue +++ b/src/modules/14_KPI/components/indicatorByRole/DetailView.vue @@ -14,6 +14,7 @@ const $q = useQuasar(); const route = useRoute(); const router = useRouter(); +const heightSize = ref("224"); const filter = ref(""); const node = ref([]); const expanded = ref([]); @@ -32,6 +33,7 @@ const { success, date2Thai, calculateDurationYmd, + dialogMessageNotify, } = useCounterMixin(); const title = ref(route.params.id ? "แก้ไข" : "เพิ่ม"); @@ -119,7 +121,7 @@ function selectAgency() { /** บันทึกข้อมูล */ function onSubmit() { - showLoader(); + const url = id.value ? config.API.kpiRoleMainList + `/${id.value}` : config.API.kpiRoleMainList; @@ -145,14 +147,19 @@ function onSubmit() { orgRevisionId: form.orgRevisionId, //RevisionId หน่วยงาน }; - http[id.value ? "put" : "post"](url, body) - .then((res) => { - success($q, "บันทึกสำเร็จ"); - router.push(`/KPI-indicator-role`); - }) - .finally(() => { - hideLoader(); - }); + if (form.nodeId == null) { + dialogMessageNotify($q, "กรุณาเลือกหน่วยงาน/ส่วนราชการ"); + } else { + showLoader(); + http[id.value ? "put" : "post"](url, body) + .then((res) => { + success($q, "บันทึกสำเร็จ"); + router.push(`/KPI-indicator-role`); + }) + .finally(() => { + hideLoader(); + }); + } } // @@ -164,8 +171,8 @@ function getDetail() { .then((res) => { const data = res.data.result; form.position = data.position; - form.year = data.year == null ? 0:data.year; - form.round = data.round; + form.year = data.year == null ? 0 : data.year; + form.round = data.kpiPeriodId; form.including = data.including; form.includingName = data.includingName; form.target = data.target; @@ -223,14 +230,11 @@ async function fetchTree(id: string) { } function updateTicked(val: any) { - console.log(expanded.value); - ticked.value = []; ticked.value.push(val[val.length - 1]); } function updateSelected(data: any) { - console.log(data); nodeId.value = data.orgTreeId; orgName.value = data.orgTreeName; form.node = data.orgLevel; @@ -241,24 +245,19 @@ function updateSelected(data: any) { function getRound() { showLoader(); http - .get( - config.API.kpiPeriod + - `?year=${form.year}` - ) + .get(config.API.kpiPeriod + `?year=${form.year}`) .then((res) => { const data = res.data.result.data; roundOp.value = data.map((item: any) => ({ id: item.id, name: statusTothai(item.durationKPI), - })) - console.log(roundOp.value) + })); }) .finally(() => { - hideLoader() + hideLoader(); }); } - function statusTothai(val: string) { switch (val) { case "SPECIAL": @@ -272,12 +271,19 @@ function statusTothai(val: string) { } } +function onResize(size: any) { + heightSize.value = `${size.height - 99}`; +} + +function setModel(val: string) { + form.position = val; +} + onMounted(() => { fetchActive(); getOptions(); - getRound() + getRound(); if (id.value !== "") { - console.log("edit"); getDetail(); } }); @@ -302,11 +308,13 @@ onMounted(() => {
{ class="inputgreen" :options="positionOp" use-input + @input-value="setModel" @filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) " >