From ad66cacc1ebfecace8f00e93e645ab5a04cb4bbc Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Tue, 7 May 2024 15:18:52 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20?= =?UTF-8?q?=E0=B8=95=E0=B8=B1=E0=B8=A7=E0=B8=8A=E0=B8=B5=E0=B9=89=E0=B8=A7?= =?UTF-8?q?=E0=B8=B1=E0=B8=94=20=E0=B8=95=E0=B8=B2=E0=B8=A1=E0=B9=81?= =?UTF-8?q?=E0=B8=9C=E0=B8=99=20=E0=B8=A3=E0=B8=AD=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../14_KPI/components/DialogHistory.vue | 65 +++++++ .../indicatorByPlan/IndicatorByPlan.vue | 152 ++++++++-------- .../components/indicatorByRole/DetailView.vue | 66 +++---- src/modules/14_KPI/interface/request/Main.ts | 13 +- src/modules/14_KPI/views/indicatorByPlan.vue | 166 ++++++++++++------ src/modules/14_KPI/views/indicatorByRole.vue | 135 ++++++++------ 6 files changed, 385 insertions(+), 212 deletions(-) create mode 100644 src/modules/14_KPI/components/DialogHistory.vue diff --git a/src/modules/14_KPI/components/DialogHistory.vue b/src/modules/14_KPI/components/DialogHistory.vue new file mode 100644 index 000000000..485d0b4ce --- /dev/null +++ b/src/modules/14_KPI/components/DialogHistory.vue @@ -0,0 +1,65 @@ + + diff --git a/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue b/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue index 3e68d2140..11fda18d8 100644 --- a/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue +++ b/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue @@ -28,14 +28,15 @@ const { } = mixin; const id = ref(route.params.id ? route.params.id.toLocaleString() : ""); +const editCheck = ref(route.params.id ? true : false); /**form ตัวชี้วัดตามแผนฯ*/ const planData = reactive({ - kpiPeriodId: "", //รอบการประเมิน(เมษา->APR, ตุลา->OCT) + period: "", //รอบการประเมิน(เมษา->APR, ตุลา->OCT) including: "", //รหัสตัวชี้วัด includingName: "", //ชื่อตัวชี้วัด target: "", //ค่าเป้าหมาย - unit: null, //หน่วยนับ + unit: "", //หน่วยนับ weight: null, //น้ำหนัก achievement1: "", //ผลสำเร็จของงาน 1 achievement2: "", //ผลสำเร็จของงาน 2 @@ -49,10 +50,14 @@ const planData = reactive({ orgRevisionId: "", //RevisionId หน่วยงาน strategy: null, //ระดับยุทธศาสตร์ strategyId: "", //id ยุทธศาสตร์ + documentInfoEvidence: "", //ข้อมูลเอกสารหลักฐาน }); -const year = ref(0); // ปีงยประมาณ -const roundOp = ref([]); +const year = ref(0); // ปีงยประมาณ +const roundOp = ref([ + { id: "APR", name: "รอบเมษายน" }, + { id: "OCT", name: "รอบตุลาคม" }, +]); const nodeplan = ref([]); const nodeAgency = ref([]); @@ -64,36 +69,6 @@ const expandedAgency = ref([]); const editStatus = ref(false); const inputRef = ref(null); -/** functiopn fetch รอบการประเมิน*/ -function fetchRoundOption(isId: number | null = null) { - http - .get( - config.API.kpiPeriod + - `?page=${1}&pageSize=${10}&keyword=${""}&year=${year.value}` - ) - .then((res) => { - const data = res.data.result.data; - const list = data.map((e: any) => ({ - id: e.id, - name: - e.durationKPI === "OCT" - ? "รอบตุลาคม" - : e.durationKPI === "APR" - ? "รอบเมษายน" - : "", - })); - roundOp.value = list; - - if (isId) { - planData.kpiPeriodId = ""; - inputRef.value.resetValidation(); - } - }) - .catch((err) => { - messageError($q, err); - }); -} - /** function fetch หาโครงสร้างที่ใช้งาน*/ function fetchOrganizationActive() { http @@ -147,7 +122,7 @@ function fetchDataById(id: string) { .then((res) => { const data = res.data.result; year.value = data.year; - planData.kpiPeriodId = data.kpiPeriodId; + planData.period = data.round; planData.including = data.including; planData.includingName = data.includingName; planData.target = data.target; @@ -189,8 +164,6 @@ function fetchDataById(id: string) { expandedPlan.value = arrayexpandedPlan .filter((e) => e !== null) .slice(0, -1); - - fetchRoundOption(); }) .catch((err) => { messageError($q, err); @@ -235,6 +208,27 @@ function onSubmit() { dialogConfirm( $q, async () => { + const body = { + year: year.value == 0 ? null : year.value, + period: planData.period, + includingName: planData.includingName, + target: planData.target, + unit: planData.unit, + weight: planData.weight, + achievement1: planData.achievement1, + achievement2: planData.achievement2, + achievement3: planData.achievement3, + achievement4: planData.achievement4, + achievement5: planData.achievement5, + meaning: planData.meaning, + formula: planData.formula, + node: planData.node, + nodeId: planData.nodeId, + orgRevisionId: planData.orgRevisionId, + strategy: planData.strategy, + strategyId: planData.strategyId, + documentInfoEvidence: planData.documentInfoEvidence, + }; showLoader(); // editStatus.value ? editData(id.value) : addData(); try { @@ -242,7 +236,7 @@ function onSubmit() { ? config.API.kpiPlanById(id.value) : config.API.kpiPlan; const method = editStatus.value ? "put" : "post"; - const res = await http[method](url, planData); + const res = await http[method](url, body); success($q, "บันทึกข้อมูลสำเร็จ"); editStatus.value ? fetchDataById(id.value) @@ -272,6 +266,29 @@ onMounted(() => {
+
+ +
+
+ +
{ autoApply year-picker :enableTimePicker="false" - @update:modelValue="fetchRoundOption" + @update:modelValue="planData.period = ''" > + @@ -310,47 +338,17 @@ onMounted(() => {
-
-
- -
-
-
@@ -371,8 +369,8 @@ onMounted(() => { v-model="planData.unit" label="หน่วยนับ" bg-color="white" - type="number" dense + lazy-rules class="inputgreen" :rules="[(val) => !!val || `${'กรุณากรอกหน่วยนับ'}`]" hide-bottom-space @@ -644,6 +642,16 @@ onMounted(() => {
+
+ +
diff --git a/src/modules/14_KPI/components/indicatorByRole/DetailView.vue b/src/modules/14_KPI/components/indicatorByRole/DetailView.vue index faacbbbda..f869a39d2 100644 --- a/src/modules/14_KPI/components/indicatorByRole/DetailView.vue +++ b/src/modules/14_KPI/components/indicatorByRole/DetailView.vue @@ -45,6 +45,7 @@ const form = reactive({ weight: "", //น้ำหนัก meaning: "", //นิยามหรือความหมาย formula: "", //สูตรคำนวณ + documentInfoEvidence: "", //ข้อมูลเอกสารหลักฐาน node: null, nodeId: null, @@ -71,7 +72,10 @@ const positionOp = ref([]); const positionMainOp = ref([]); /** Option รอบการประเมิน*/ -const roundOp = ref([]); +const roundOp = ref([ + { id: "APR", name: "รอบเมษายน" }, + { id: "OCT", name: "รอบตุลาคม" }, +]); /** * function ต้นหาข้อมูลของ Option @@ -121,9 +125,9 @@ function onSubmit() { : config.API.kpiRoleMainList; const body = { + year: form.year == 0 ? null:form.year, position: form.position, //ตำแหน่ง - kpiPeriodId: form.round, //รอบการประเมิน(เมษา->APR, ตุลา->OCT) - including: form.including, //รหัสตัวชี้วัด + period: form.round, //รอบการประเมิน(เมษา->APR, ตุลา->OCT) includingName: form.includingName, //ชื่อตัวชี้วัด target: form.target, //ค่าเป้าหมาย unit: form.unit, //หน่วยนับ @@ -135,6 +139,7 @@ function onSubmit() { achievement5: formScore.score5, //ผลสำเร็จของงาน 5 meaning: form.meaning, //นิยามหรือความหมาย formula: form.formula, //สูตรคำนวณ + documentInfoEvidence: form.documentInfoEvidence, //ข้อมูลเอกสารหลักฐาน node: form.node, //ระดับหน่วยงาน nodeId: form.nodeId, //id หน่วยงาน @@ -171,7 +176,7 @@ function getDetail() { const data = res.data.result; form.position = data.position; form.year = data.year == null ? 0 : data.year; - form.round = data.kpiPeriodId; + form.round = data.round; form.including = data.including; form.includingName = data.includingName; form.target = data.target; @@ -244,21 +249,6 @@ function updateSelected(data: any) { form.orgRevisionId = data.orgRevisionId; } -function getRound() { - showLoader(); - http - .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), - })); - }) - .finally(() => { - hideLoader(); - }); -} function statusTothai(val: string) { switch (val) { @@ -284,7 +274,6 @@ function setModel(val: string) { onMounted(() => { fetchActive(); getOptions(); - getRound(); if (id.value !== "") { getDetail(); } @@ -345,7 +334,7 @@ onMounted(() => { autoApply year-picker :enableTimePicker="false" - @update:model-value="(form.round = ''), getRound()" + @update:model-value="form.round = ''" >
{ input-class="text-red" label="รอบการประเมิน" class="inputgreen" - lazy-rules - :rules="[(val:string) => !!val || `${'กรุณาเลือกรอบการประเมิน'}`,]" - hide-bottom-space />
-
+
@@ -632,6 +626,16 @@ onMounted(() => { type="textarea" />
+
+ +
diff --git a/src/modules/14_KPI/interface/request/Main.ts b/src/modules/14_KPI/interface/request/Main.ts index c8d8f976a..e578c5180 100644 --- a/src/modules/14_KPI/interface/request/Main.ts +++ b/src/modules/14_KPI/interface/request/Main.ts @@ -36,6 +36,7 @@ interface FormDataRole { weight: string; meaning: string; formula: string; + documentInfoEvidence: string; node: number | null; nodeId: string | null; orgRevisionId: string | null; @@ -48,6 +49,15 @@ interface NewPagination { sortBy: string; } +interface FormListMainByRole { + page:number + pageSize:number + position:string + round:string + keyword:string + year:number|null +} + interface ListGroup{ id:string nameGroupKPI:string @@ -66,5 +76,6 @@ export type { FormDataRole, NewPagination, FormQueryCapacity, - ListGroup + ListGroup, + FormListMainByRole }; diff --git a/src/modules/14_KPI/views/indicatorByPlan.vue b/src/modules/14_KPI/views/indicatorByPlan.vue index b263184df..3bfc6252b 100644 --- a/src/modules/14_KPI/views/indicatorByPlan.vue +++ b/src/modules/14_KPI/views/indicatorByPlan.vue @@ -4,6 +4,7 @@ import { useQuasar, type QTableProps } from "quasar"; import { useRouter } from "vue-router"; import type { DataOption } from "@/modules/14_KPI/interface/index/Main"; +import DialogHistory from '@/modules/14_KPI/components/DialogHistory.vue' /** importStore*/ import { useCounterMixin } from "@/stores/mixin"; @@ -11,6 +12,8 @@ import http from "@/plugins/http"; import config from "@/app.config"; /** use*/ +const modalHistory = ref(false) +const isAll = ref(false); const $q = useQuasar(); const router = useRouter(); const { showLoader, hideLoader, dialogRemove, success, messageError } = @@ -22,7 +25,7 @@ const columns = ref([ { name: "including", align: "left", - label: "รหัสตัวชี้วัด", + label: "ลำดับ/รหัสตัวชี้วัด", sortable: true, field: "including", headerStyle: "font-size: 14px", @@ -43,11 +46,14 @@ const expanded = ref([]); const filterMain = ref(""); const visibleColumns = ref(["including", "includingName"]); -const roundOp = ref([]); +const roundOp = ref([ + { id: "APR", name: "รอบเมษายน" }, + { id: "OCT", name: "รอบตุลาคม" }, +]); const totalList = ref(1); -const year = ref(new Date().getFullYear()); +const year = ref(new Date().getFullYear()); const nodeData = reactive({ page: 1, pageSize: 10, @@ -57,41 +63,12 @@ const nodeData = reactive({ keyword: "", }); -function fetchRoundOption() { - showLoader(); - http - .get( - config.API.kpiPeriod + - `?page=${1}&pageSize=${10}&keyword=${""}&year=${year.value}` - ) - .then((res) => { - const data = res.data.result.data; - const list = data.map((e: any) => ({ - id: e.id, - name: - e.durationKPI === "OCT" - ? "รอบตุลาคม" - : e.durationKPI === "APR" - ? "รอบเมษายน" - : "", - })); - roundOp.value = list; - nodeData.round = ""; - fetchListProjectNew(); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); -} function fetchList() { showLoader(); http .get( config.API.kpiPlan + - `?page=${nodeData.page}&pageSize=${nodeData.pageSize}&kpiPeriodId=${nodeData.round}&nodeId=${nodeData.nodeId}&node=${nodeData.node}&keyword=${nodeData.keyword}` + `?page=${nodeData.page}&pageSize=${nodeData.pageSize}&period=${nodeData.round}&nodeId=${nodeData.nodeId}&node=${nodeData.node}&keyword=${nodeData.keyword}&year=${year.value}&isAll=${isAll.value}` ) .then((res) => { const data = res.data.result.data; @@ -178,12 +155,20 @@ async function deleteData(idData: string) { function clearFilter() { nodeData.keyword = ""; fetchActive(); - fetchRoundOption(); + fetchListProjectNew(); } -onMounted(() => { - fetchActive(); - fetchRoundOption(); - // fetchData(); + +/** + * เปิด dialog history + * @param id + */ +function onClickHistory(id:string){ + modalHistory.value = true +} + +onMounted(async () => { + await fetchActive(); + await fetchList(); }); @@ -270,7 +255,7 @@ onMounted(() => { year-picker :enableTimePicker="false" style="width: 150px" - @update:model-value="fetchRoundOption" + @update:model-value="fetchListProjectNew" > @@ -323,7 +317,20 @@ onMounted(() => { +
+ + แสดงตำแหน่งทั้งหมดภายใต้หน่วยงาน/ส่วนราชการที่เลือก + + { ref="table" :columns="columns" :rows="rows" - row-key="subject" + row-key="id" flat bordered dense class="custom-header-table" + :rows-per-page-options="[10, 25, 50, 100]" :visible-columns="visibleColumns" > @@ -420,6 +465,11 @@ onMounted(() => {
+ + +