diff --git a/src/modules/01_masterdata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue b/src/modules/01_masterdata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue index 24e93560f..afb3f7a64 100644 --- a/src/modules/01_masterdata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue +++ b/src/modules/01_masterdata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue @@ -506,21 +506,9 @@ onMounted(async () => { - + { node-key="orgTreeId" label-key="labelName" selected-color="primary" - :filter="filterAgency" + :filter="filterAgency.trim()" no-results-label="ไม่พบข้อมูลที่ค้นหา" no-nodes-label="ไม่มีข้อมูล" v-model:expanded="expandedAgency" @@ -575,21 +563,9 @@ onMounted(async () => { - + { selected-color="primary" node-key="id" label-key="name" - :filter="filter" + :filter="filter.trim()" no-results-label="ไม่พบข้อมูลที่ค้นหา" no-nodes-label="ไม่มีข้อมูล" v-model:expanded="expandedPlan" diff --git a/src/modules/01_masterdata/components/Indicators/indicatorByRole/DetailView.vue b/src/modules/01_masterdata/components/Indicators/indicatorByRole/DetailView.vue index 9eedebad1..9c3fe57bb 100644 --- a/src/modules/01_masterdata/components/Indicators/indicatorByRole/DetailView.vue +++ b/src/modules/01_masterdata/components/Indicators/indicatorByRole/DetailView.vue @@ -91,17 +91,17 @@ const roundOp = ref([ * @param update อัพเดทค่า * @param refData ดาต้าที่ต้องการฟิลเตอร์ */ -function filterOption(val: any, update: Function) { +function filterOption(val: string, update: Function) { update(() => { positionOp.value = positionMainOp.value.filter( - (v: any) => v.name.indexOf(val) > -1 + (v: DataOption) => v.name.indexOf(val) > -1 ); }); } /** ดึงข้อมูลตำแหน่ง */ async function getOptions() { - showLoader(); + // showLoader(); await http .get(config.API.orgSalaryPosition) .then((res) => { @@ -126,7 +126,7 @@ async function getOptions() { messageError($q, e); }) .finally(() => { - hideLoader(); + // hideLoader(); }); } @@ -438,13 +438,7 @@ onMounted(() => { class="inputgreen" > { node-key="orgTreeId" label-key="labelName" v-model:expanded="expanded" - :filter="filter" + :filter="filter.trim()" no-results-label="ไม่พบข้อมูลที่ค้นหา" no-nodes-label="ไม่มีข้อมูล" > diff --git a/src/modules/01_masterdata/components/competency/01ListCompetency.vue b/src/modules/01_masterdata/components/competency/01ListCompetency.vue index 1ea59d67a..b4b4066c5 100644 --- a/src/modules/01_masterdata/components/competency/01ListCompetency.vue +++ b/src/modules/01_masterdata/components/competency/01ListCompetency.vue @@ -78,7 +78,9 @@ async function fetchList() { await http .get( config.API.kpiCapacity + - `/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}&type=${store.competencyTypeVal}` + `/edit?page=${formQuery.page}&pageSize=${ + formQuery.pageSize + }&keyword=${formQuery.keyword.trim()}&type=${store.competencyTypeVal}` ) .then(async (res) => { total.value = res.data.result.total; @@ -103,11 +105,12 @@ async function onViewDetailPage(id: string) { } function deleteData(id: string) { - dialogRemove($q, () => { - http + showLoader(); + dialogRemove($q, async () => { + await http .delete(config.API.kpiCapacity + `/${id}`) - .then(() => { - fetchList(); + .then(async () => { + await fetchList(); success($q, "ลบข้อมูลสำเร็จ"); }) .catch((err) => { @@ -190,13 +193,7 @@ onMounted(() => { @keyup.enter="fetchNewList()" > { map-options :options="columns" option-value="name" - style="min-width: 140px" /> diff --git a/src/modules/01_masterdata/components/competency/02ListLinkPosition.vue b/src/modules/01_masterdata/components/competency/02ListLinkPosition.vue index bb9fd1b99..2552c2667 100644 --- a/src/modules/01_masterdata/components/competency/02ListLinkPosition.vue +++ b/src/modules/01_masterdata/components/competency/02ListLinkPosition.vue @@ -59,7 +59,9 @@ async function fetchData() { await http .get( config.API.kpiGroup + - `/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}` + `/edit?page=${formQuery.page}&pageSize=${ + formQuery.pageSize + }&keyword=${formQuery.keyword.trim()}` ) .then(async (res) => { total.value = res.data.result.total; @@ -77,12 +79,13 @@ async function fetchData() { /** เพิ่มข้อมูล */ async function addData() { + showLoader(); await http .post(config.API.kpiGroup, { nameGroupKPI: groupName.value, }) - .then(() => { - fetchData(); + .then(async () => { + await fetchData(); success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { @@ -95,12 +98,13 @@ async function addData() { /** save แก้ไขข้อมูล */ async function editData(id: string) { + showLoader(); await http .put(config.API.kpiGroupById(id), { nameGroupKPI: groupName.value, }) - .then(() => { - fetchData(); + .then(async () => { + await fetchData(); success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { @@ -113,10 +117,11 @@ async function editData(id: string) { /** ลบข้อมูล */ async function deleteData(id: string) { + showLoader(); await http .delete(config.API.kpiGroupById(id)) - .then(() => { - fetchData(); + .then(async () => { + await fetchData(); success($q, "ลบข้อมูลสำเร็จ"); }) .catch((err) => { @@ -151,7 +156,7 @@ async function onSubmit() { dialogConfirm( $q, async () => { - editStatus.value ? editData(editId.value) : addData(); + editStatus.value ? await editData(editId.value) : await addData(); closeDialog(); }, "ยืนยันการบันทึกข้อมูล", @@ -205,14 +210,7 @@ onMounted(async () => { label="ค้นหา" @keyup.enter="fetchNewList()" > - { map-options :options="columns" option-value="name" - style="min-width: 140px" /> diff --git a/src/modules/01_masterdata/components/competency/03ListLinkGroup.vue b/src/modules/01_masterdata/components/competency/03ListLinkGroup.vue index 31a64e616..ab446b64e 100644 --- a/src/modules/01_masterdata/components/competency/03ListLinkGroup.vue +++ b/src/modules/01_masterdata/components/competency/03ListLinkGroup.vue @@ -84,9 +84,6 @@ const { dialogConfirm, } = mixin; -const competencyType = ref("ID1"); -const filterKeyword = ref(""); - const visibleColumns = ref(["groupName", "positions", "capacitys"]); const formQuery = reactive({ @@ -102,7 +99,9 @@ async function getData() { http .get( config.API.kpiLink + - `/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}` + `/edit?page=${formQuery.page}&pageSize=${ + formQuery.pageSize + }&keyword=${formQuery.keyword.trim()}` ) .then((res) => { total.value = res.data.result.total; @@ -116,12 +115,13 @@ async function getData() { } async function deleteData(id: string) { + showLoader(); await http .delete(config.API.kpiLink + `/${id}`) - .then(() => { + .then(async () => { + await getData(); success($q, "ลบข้อมูลสำเร็จ"); close(); - getData(); }) .catch((err) => { messageError($q, err); @@ -211,7 +211,7 @@ async function onEdit(data: any) { editStatus.value = true; } -function getDataEdit(id: string) { +async function getDataEdit(id: string) { showLoader(); http .get(config.API.kpiLink + `/edit/${id}`) @@ -241,14 +241,20 @@ function onSubmit() { positions: position.value, kpiCapacityIds: competency.value?.map((i: any) => i.id), }; - dialogConfirm($q, () => { + dialogConfirm($q, async () => { + showLoader(); http[editStatus.value ? "put" : "post"](url, body) - .then(() => { + .then(async () => { + await getData(); success($q, "บันทึกสำเร็จ"); close(); - getData(); }) - .finally(() => {}); + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); }); } @@ -261,7 +267,7 @@ function close() { competency.value = []; } -function getOptions() { +async function getOptions() { http.get(config.API.orgSalaryPosition).then((res) => { const dataOp = res.data.result; const uniqueNames = new Set(); @@ -371,13 +377,7 @@ onMounted(async () => { @keyup.enter="fetchNewList()" > { map-options :options="columns" option-value="name" - - style="min-width: 140px" + style="min-width: 140px" > @@ -517,6 +516,8 @@ onMounted(async () => { option-value="id" :options="groupNameOp" use-input + hide-selected + fill-input @filter="(inputValue:any,doneFn:Function) => filterOptionGroup(inputValue, doneFn) " hide-bottom-space lazy-rules diff --git a/src/modules/01_masterdata/components/competency/04ListCriteria.vue b/src/modules/01_masterdata/components/competency/04ListCriteria.vue index c2f6ab8c7..be7d47851 100644 --- a/src/modules/01_masterdata/components/competency/04ListCriteria.vue +++ b/src/modules/01_masterdata/components/competency/04ListCriteria.vue @@ -11,7 +11,8 @@ import { useRoute } from "vue-router"; const $q = useQuasar(); const route = useRoute(); -const { showLoader, hideLoader, success } = useCounterMixin(); +const { showLoader, hideLoader, success, dialogConfirm, messageError } = + useCounterMixin(); const dataLevel = ref(); const fieldLabels = { @@ -23,28 +24,40 @@ const fieldLabels = { }; function onSubmit() { - const body = { - formScore: dataLevel.value.map((item: any) => { - const { level, ...rest } = item; - return rest; - }), - }; + dialogConfirm($q, async () => { + showLoader(); + const body = { + formScore: dataLevel.value.map((item: any) => { + const { level, ...rest } = item; + return rest; + }), + }; - http - .put(config.API.kpiEvaluation, body.formScore) - .then((res) => { - success($q, "บันทึกสำเร็จ"); - }) - .finally(() => {}); + await http + .put(config.API.kpiEvaluation, body.formScore) + .then(async () => { + await getData(); + success($q, "บันทึกสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + }); } -function getData() { +async function getData() { showLoader(); http .get(config.API.kpiEvaluation + `/edit`) .then((res) => { dataLevel.value = res.data.result.data; }) + .catch((err) => { + messageError($q, err); + }) .finally(() => { hideLoader(); }); diff --git a/src/modules/01_masterdata/views/Assignment.vue b/src/modules/01_masterdata/views/Assignment.vue index d05356167..853ca7bf0 100644 --- a/src/modules/01_masterdata/views/Assignment.vue +++ b/src/modules/01_masterdata/views/Assignment.vue @@ -92,7 +92,10 @@ function fetchList() { showLoader(); formFilter.year = formFilter.year ? formFilter.year.toString() : null; http - .post(config.API.kpiSpecial + `/search-edit`, formFilter) + .post(config.API.kpiSpecial + `/search-edit`, { + ...formFilter, + keyword: formFilter.keyword.trim(), + }) .then((res: ResAssignment) => { maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); totalList.value = res.data.result.total; @@ -258,13 +261,7 @@ onMounted(() => { @keydown.enter="fetchNewList" > { map-options :options="columns" option-value="name" - style="min-width: 140px" /> diff --git a/src/modules/01_masterdata/views/Strategic.vue b/src/modules/01_masterdata/views/Strategic.vue index f8bcb2ea1..59af3b146 100644 --- a/src/modules/01_masterdata/views/Strategic.vue +++ b/src/modules/01_masterdata/views/Strategic.vue @@ -190,13 +190,7 @@ onMounted(() => { @@ -208,7 +202,7 @@ onMounted(() => { :nodes="nodes" node-key="id" label-key="name" - :filter="filter" + :filter="filter.trim()" no-results-label="ไม่พบข้อมูลที่ค้นหา" no-nodes-label="ไม่มีข้อมูล" v-model:expanded="expanded" @@ -325,6 +319,7 @@ onMounted(() => {
-import { ref, reactive, onMounted,watch } from "vue"; +import { ref, reactive, onMounted, watch } from "vue"; import { useQuasar, type QTableProps } from "quasar"; import { useRouter, useRoute } from "vue-router"; @@ -87,7 +87,7 @@ function fetchList() { http .post(config.API.kpiPlan + `/search-edit`, { isAll: isAll.value, - keyword: nodeData.keyword, + keyword: nodeData.keyword.trim(), node: nodeData.node ? nodeData.node : 0, nodeId: nodeData.nodeId, period: nodeData.round, @@ -98,9 +98,9 @@ function fetchList() { .then((res) => { const data = res.data.result.data; totalList.value = Math.ceil( - res.data.result.total / pagination.value.rowsPerPage - ); - total.value = res.data.result.total; + res.data.result.total / pagination.value.rowsPerPage + ); + total.value = res.data.result.total; rows.value = data; }) .catch((err) => { @@ -127,20 +127,6 @@ function onClickView(id: string = "") { router.push(`/masterdata/indicator-plan/view/${id}`); } -function fetchActive() { - // showLoader(); - // http - // .get(config.API.activeOrganization) - // .then((res) => { - // const data = res.data.result; - // // fetchTree(data.activeId); - // }) - // .catch((err) => { - // messageError($q, err); - // hideLoader(); - // }); -} - /** ดึงข้อมูลโครงสรร้าง */ async function fetchTree() { node.value = await fetchStructureTree(route.meta.Key as string, true); @@ -206,7 +192,6 @@ function onClickHistory(id: string) { function updatePagination(newPagination: any) { pagination.value.page = 1; pagination.value.rowsPerPage = newPagination.rowsPerPage; - } function getSearch() { @@ -242,13 +227,7 @@ onMounted(() => { { node-key="orgTreeName" label-key="labelName" v-model:expanded="expanded" - :filter="filterMain" + :filter="filterMain.trim()" no-results-label="ไม่พบข้อมูลที่ค้นหา" no-nodes-label="ไม่มีข้อมูล" v-model:selected="nodeData.nodeId" @@ -329,9 +308,7 @@ onMounted(() => { @@ -354,9 +331,7 @@ onMounted(() => { @@ -393,18 +368,11 @@ onMounted(() => { v-model="nodeData.keyword" ref="filterRef" outlined - style="width: 150px" placeholder="ค้นหา" @keydown.enter.prevent="getSearch" > { map-options :options="columns" option-value="name" - style="min-width: 140px" />
diff --git a/src/modules/01_masterdata/views/indicatorByRole.vue b/src/modules/01_masterdata/views/indicatorByRole.vue index caf9f8771..cf8db9931 100644 --- a/src/modules/01_masterdata/views/indicatorByRole.vue +++ b/src/modules/01_masterdata/views/indicatorByRole.vue @@ -103,9 +103,11 @@ const roundOp = ref([ ]); async function fetchList() { + showLoader(); + rows.value = []; await http .post(config.API.kpiRoleMainList + `/search-edit`, { - keyword: formFilter.keyword, + keyword: formFilter.keyword.trim(), position: formFilter.position, period: formFilter.round, node: 0, @@ -407,13 +409,7 @@ onMounted(async () => { @keyup.enter="(formFilter.page = 1), fetchList()" > @@ -428,7 +424,6 @@ onMounted(async () => { map-options :options="columns" option-value="name" - style="min-width: 140px" /> diff --git a/src/modules/19_condition/view/Main.vue b/src/modules/19_condition/view/Main.vue index 140251df2..b231ce1d2 100644 --- a/src/modules/19_condition/view/Main.vue +++ b/src/modules/19_condition/view/Main.vue @@ -316,9 +316,9 @@ onMounted(async () => {
- +
@@ -329,7 +329,7 @@ onMounted(async () => { :nodes="nodeTree" node-key="orgTreeId" label-key="labelName" - :filter="filter" + :filter="filter.trim()" no-results-label="ไม่พบข้อมูลที่ค้นหา" no-nodes-label="ไม่มีข้อมูล" v-model:expanded="expanded"