From b663eedb092042001c672f0002a3edb24dbf068a Mon Sep 17 00:00:00 2001 From: Thanit Konmek Date: Fri, 4 Aug 2023 10:04:59 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=20loader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/information/Address.vue | 30 +- src/components/information/Assessment.vue | 22 +- src/components/information/Certicate.vue | 21 +- src/components/information/Coin.vue | 22 +- src/components/information/Discipline.vue | 22 +- src/components/information/Document.vue | 14 +- src/components/information/Education.vue | 29 +- src/components/information/Family.vue | 21 +- src/components/information/Government.vue | 22 +- src/components/information/Information.vue | 39 +- src/components/information/Insignia.vue | 25 +- src/components/information/Leave.vue | 24 +- src/components/information/OldName.vue | 24 +- src/components/information/Other.vue | 21 +- src/components/information/Record.vue | 21 +- src/components/information/Salary.vue | 38 +- src/components/information/SalaryEmployee.vue | 39 +- .../information/SalaryEmployeeTemp.vue | 40 +- src/components/information/Talent.vue | 21 +- src/components/information/Train.vue | 20 +- src/components/information/Work.vue | 21 +- .../01_metadata/components/Calendar.vue | 9 +- .../01_metadata/components/CalendarList.vue | 12 +- .../components/insignia/Insignia.vue | 3 - .../components/insignia/InsigniaType.vue | 3 - .../components/organization/Agency.vue | 3 - .../components/organization/Fax.vue | 3 - .../organization/GovernmentAgency.vue | 3 - .../components/organization/Level.vue | 3 - .../components/organization/Organization.vue | 3 - .../components/organization/ShortName.vue | 3 - .../components/organization/Status.vue | 3 - .../components/organization/TelExternal.vue | 3 - .../components/organization/TelInternal.vue | 3 - .../components/organization/Type.vue | 3 - .../01_metadata/components/person/Blood.vue | 3 - .../components/person/District.vue | 16 +- .../components/person/Education.vue | 3 - .../01_metadata/components/person/Gender.vue | 3 - .../01_metadata/components/person/Prefix.vue | 3 - .../components/person/Province.vue | 4 +- .../components/person/Relationship.vue | 3 - .../components/person/Religion.vue | 3 - .../components/person/SubDistrict.vue | 23 +- .../components/position/Executive.vue | 3 - .../components/position/ExecutiveSide.vue | 3 - .../01_metadata/components/position/Level.vue | 3 - .../01_metadata/components/position/Line.vue | 3 - .../01_metadata/components/position/Path.vue | 3 - .../components/position/PathSide.vue | 3 - .../components/position/Status.vue | 3 - .../01_metadata/components/position/Type.vue | 3 - .../components/positionEmployee/Group.vue | 3 - .../components/positionEmployee/Level.vue | 3 - .../components/positionEmployee/Line.vue | 3 - .../components/positionEmployee/Position.vue | 3 - .../positionEmployee/PositionSide.vue | 3 - .../components/positionEmployee/Status.vue | 3 - src/modules/01_metadata/views/Main.vue | 3 - .../01_metadata/views/MainCalendar.vue | 21 +- .../components/AddMappingPositions.vue | 46 +- .../components/Tree/MappingPositions.vue | 14 +- .../components/Tree/OrganizationDialog.vue | 62 +- .../Tree/OrganizationDialogAddEdit.vue | 70 +- .../02_organizational/views/MainOrgChart.vue | 16 +- .../02_organizational/views/MainReport.vue | 411 +++--- .../views/MainStructChart.vue | 327 ++--- .../02_organizational/views/MainTree.vue | 65 +- .../views/MainTreeEmployee.vue | 46 +- .../02_organizational/views/ManageReport2.vue | 23 +- .../views/ManageReport2Add.vue | 56 +- .../views/ManageReport2History.vue | 16 +- .../02_organizational/views/Report.vue | 228 ++- .../03_recruiting/components/Address.vue | 18 +- .../03_recruiting/components/Career.vue | 17 +- .../03_recruiting/components/Document.vue | 19 +- .../03_recruiting/components/Education.vue | 21 +- .../03_recruiting/components/ExamFinished.vue | 11 +- .../03_recruiting/components/Family.vue | 11 +- .../03_recruiting/components/Information.vue | 18 +- .../03_recruiting/components/Occupation.vue | 11 +- .../03_recruiting/components/Profile.vue | 27 +- .../components/TableCandidate.vue | 25 +- .../03_recruiting/views/01_compete/Detail.vue | 30 +- .../views/01_compete/DetailEx.vue | 20 +- .../03_recruiting/views/01_compete/Period.vue | 1242 ++++++++--------- .../views/01_compete/PeriodAdd.vue | 37 +- .../views/02_qualify/DisableDetail.vue | 29 +- .../views/02_qualify/DisableDetailEx.vue | 20 +- .../views/02_qualify/DisablePeriod.vue | 1232 ++++++++-------- .../views/02_qualify/DisablePeriodAdd.vue | 39 +- .../views/02_qualify/ExamForm.vue | 21 +- .../03_recruiting/views/02_qualify/Manage.vue | 13 +- .../views/02_qualify/Payment.vue | 19 +- .../03_recruiting/views/02_qualify/Period.vue | 23 +- .../views/02_qualify/PeriodAdd.vue | 43 +- .../views/02_qualify/manageDetail.vue | 39 +- .../03_recruiting/views/03_editor/index.vue | 35 +- .../04_registry/components/Assessment.vue | 22 +- src/modules/04_registry/components/Coin.vue | 22 +- .../04_registry/components/Discipline.vue | 22 +- .../04_registry/components/Document.vue | 14 +- .../04_registry/components/Education.vue | 30 +- .../components/Information/Address.vue | 31 +- .../components/Information/Certicate.vue | 19 +- .../components/Information/Family.vue | 23 +- .../components/Information/Government.vue | 22 +- .../components/Information/Information.vue | 39 +- .../components/Information/OldName.vue | 25 +- .../04_registry/components/Insignia.vue | 26 +- src/modules/04_registry/components/Leave.vue | 25 +- src/modules/04_registry/components/Other.vue | 21 +- .../04_registry/components/Profile.vue | 46 +- src/modules/04_registry/components/Record.vue | 28 +- src/modules/04_registry/components/Salary.vue | 38 +- .../04_registry/components/SalaryEmployee.vue | 41 +- .../components/SalaryEmployeeTemp.vue | 41 +- src/modules/04_registry/components/Talent.vue | 22 +- src/modules/04_registry/components/Train.vue | 22 +- src/modules/04_registry/components/Work.vue | 22 +- src/modules/04_registry/views/Main.vue | 13 +- .../OrderPlacement/MainOrderPlacement.vue | 4 +- .../OrderPlacement/addOrderPlacement.vue | 7 +- .../components/RepatriationOrder/List.vue | 4 +- .../components/DismissOrder/DismissOrder.vue | 4 +- .../components/resign/ResignOrder.vue | 4 +- .../08_registryEmployee/views/Assessment.vue | 22 +- .../08_registryEmployee/views/Detail.vue | 38 +- .../08_registryEmployee/views/Discipline.vue | 22 +- .../08_registryEmployee/views/Document.vue | 14 +- .../08_registryEmployee/views/EditDetail.vue | 42 +- .../08_registryEmployee/views/Education.vue | 30 +- .../views/Information/Address.vue | 31 +- .../views/Information/Certicate.vue | 22 +- .../views/Information/Family.vue | 23 +- .../views/Information/Government.vue | 22 +- .../views/Information/Information.vue | 39 +- .../views/Information/OldName.vue | 25 +- .../08_registryEmployee/views/Leave.vue | 25 +- .../08_registryEmployee/views/Other.vue | 21 +- .../08_registryEmployee/views/Record.vue | 28 +- .../08_registryEmployee/views/Salary.vue | 38 +- .../views/SalaryEmployee.vue | 41 +- .../08_registryEmployee/views/Talent.vue | 22 +- .../08_registryEmployee/views/Train.vue | 22 +- .../08_registryEmployee/views/Work.vue | 22 +- .../08_registryEmployee/views/information.vue | 45 +- 147 files changed, 3095 insertions(+), 3256 deletions(-) diff --git a/src/components/information/Address.vue b/src/components/information/Address.vue index 0e0af573c..525e7ad64 100644 --- a/src/components/information/Address.vue +++ b/src/components/information/Address.vue @@ -289,7 +289,7 @@ diff --git a/src/modules/02_organizational/views/MainStructChart.vue b/src/modules/02_organizational/views/MainStructChart.vue index 457afb226..faff8192b 100644 --- a/src/modules/02_organizational/views/MainStructChart.vue +++ b/src/modules/02_organizational/views/MainStructChart.vue @@ -5,84 +5,88 @@ import { ref, onMounted } from "vue"; import http from "@/plugins/http"; import config from "@/app.config"; +import { StructChart } from "structure-chart"; +import "structure-chart/structure-chart.css"; +import { useCounterMixin } from "@/stores/mixin"; -import { StructChart } from 'structure-chart' -import 'structure-chart/structure-chart.css' +const mixin = useCounterMixin(); +const { showLoader, hideLoader } = mixin; // import chartData from '@/assets/structChartData' // const dataSource = ref(chartData) -const dataSource = ref() // ข้อมูล Chart -const rootOrgID = ref() // org id ของ root ตัวปัจจุบันที่เลือกอยู่ -const dataSourceLock = ref() // ข้อมูลตั้งต้นของ Chart ใช้ให้กดกลับไปที่ home -const chartRef = ref() // อ้างอิงไปที่ตัว chart +const dataSource = ref(); // ข้อมูล Chart +const rootOrgID = ref(); // org id ของ root ตัวปัจจุบันที่เลือกอยู่ +const dataSourceLock = ref(); // ข้อมูลตั้งต้นของ Chart ใช้ให้กดกลับไปที่ home +const chartRef = ref(); // อ้างอิงไปที่ตัว chart const savePNG = () => { - chartRef.value.savePNG() -} + chartRef.value.savePNG(); +}; const savePDF = () => { - chartRef.value.savePDF() -} + chartRef.value.savePDF(); +}; -const loader = ref(false) // Loader +const loader = ref(false); // Loader -onMounted(async() => { - await fetchTreeRoot() - await fetchStructChart() -}) +onMounted(async () => { + await fetchTreeRoot(); + await fetchStructChart(); +}); /** * อ่าน Root ของข้อมูลทั้งหมดจาก ​​API ต้องทำเป็นอันดับแรก เพื่อจะได้รู้รากของข้อมูล */ const fetchTreeRoot = async () => { - loader.value = true - let urlRequest = config.API.chartGetTreeRoot - await http.get(urlRequest) - .then((response) => { - if (response.data.result.length > 0) { - rootOrgID.value = response.data.result[0].organizationId - } - }) - .catch((e) => { - console.log(e) - }) - .finally(() => { - loader.value = false - }) + showLoader(); + let urlRequest = config.API.chartGetTreeRoot; + await http + .get(urlRequest) + .then((response) => { + if (response.data.result.length > 0) { + rootOrgID.value = response.data.result[0].organizationId; + } + }) + .catch((e) => { + console.log(e); + }) + .finally(() => { + hideLoader(); + }); }; /** * อ่านข้อมูล organization id ปัจจุบันจาก API ข้อมูลที่ได้เอามาสร้าง Structure Chart */ const fetchStructChart = async () => { - loader.value = true - let urlRequest = config.API.chartGetStructure(rootOrgID.value) - await http.get(urlRequest) - .then((response) => { - if (response.data.result.length > 0) { - dataSource.value = response.data.result[0] - if (dataSourceLock.value === undefined) - dataSourceLock.value = dataSource.value - breadcrumbsGen() - } - }) - .catch((e) => { - console.log(e) - }) - .finally(() => { - loader.value = false - }) -} + showLoader(); + let urlRequest = config.API.chartGetStructure(rootOrgID.value); + await http + .get(urlRequest) + .then((response) => { + if (response.data.result.length > 0) { + dataSource.value = response.data.result[0]; + if (dataSourceLock.value === undefined) + dataSourceLock.value = dataSource.value; + breadcrumbsGen(); + } + }) + .catch((e) => { + console.log(e); + }) + .finally(() => { + hideLoader(); + }); +}; /** * เมื่อมีการคลิกที่ Chart ให้อ่าน ID ของหน่วยงานที่ถูกคลิก แล้วดึงข้อมูล Chart ของหน่วยงานนั้น ๆ จาก API * @param data */ const refreshChart = async (data: any) => { - if (data.value !== undefined) - rootOrgID.value = data.value - else rootOrgID.value = data - if (rootOrgID.value !== 0) await fetchStructChart() - if (data.value !== undefined) data.value = 0 -} + if (data.value !== undefined) rootOrgID.value = data.value; + else rootOrgID.value = data; + if (rootOrgID.value !== 0) await fetchStructChart(); + if (data.value !== undefined) data.value = 0; +}; /** * === กระบวนการสร้าง Path === @@ -93,133 +97,142 @@ const refreshChart = async (data: any) => { * @param chart Array ของ Object ของหน่วยงานย่อยใน Tree นั้น ๆ */ const chartTraverse = (id: any, chart: any): any => { - let _returnPath = [] - for (const child of chart) { - if (child.deptID === id) { - _returnPath.push({ - label: child.departmentName, - id: child.deptID - }) - return _returnPath - } else { - if (typeof child.children !== "undefined" && - child.children !== null && - child.children.length > 0) { - let _result = chartTraverse(id, child.children) - if (typeof _result !== "undefined" && _result !== null) { - _returnPath.push({ - label: child.departmentName, - id: child.deptID - }) - return [..._returnPath, ...(_result ?? [])] - } - } - } - } -} + let _returnPath = []; + for (const child of chart) { + if (child.deptID === id) { + _returnPath.push({ + label: child.departmentName, + id: child.deptID, + }); + return _returnPath; + } else { + if ( + typeof child.children !== "undefined" && + child.children !== null && + child.children.length > 0 + ) { + let _result = chartTraverse(id, child.children); + if (typeof _result !== "undefined" && _result !== null) { + _returnPath.push({ + label: child.departmentName, + id: child.deptID, + }); + return [..._returnPath, ...(_result ?? [])]; + } + } + } + } +}; const findPath = (id: any) => { - let _path = [] - _path.push({ - label: dataSourceLock.value.departmentName, - id: dataSourceLock.value.deptID - }) - if (dataSourceLock.value.deptID === id) return _path - if (dataSourceLock.value.children.length > 0) { - let _returnPath = chartTraverse(id, dataSourceLock.value.children) - return [..._path, ...(_returnPath ?? [])] - } -} + let _path = []; + _path.push({ + label: dataSourceLock.value.departmentName, + id: dataSourceLock.value.deptID, + }); + if (dataSourceLock.value.deptID === id) return _path; + if (dataSourceLock.value.children.length > 0) { + let _returnPath = chartTraverse(id, dataSourceLock.value.children); + return [..._path, ...(_returnPath ?? [])]; + } +}; -const theBreadcrumb = ref() +const theBreadcrumb = ref(); /** * สร้าง Path Breadcrumbs */ const breadcrumbsGen = () => { - if (rootOrgID.value !== 0) { - theBreadcrumb.value = [] - const newPath = findPath(rootOrgID.value) - theBreadcrumb.value = newPath - } -} + if (rootOrgID.value !== 0) { + theBreadcrumb.value = []; + const newPath = findPath(rootOrgID.value); + theBreadcrumb.value = newPath; + } +}; diff --git a/src/modules/02_organizational/views/MainTree.vue b/src/modules/02_organizational/views/MainTree.vue index 9d5441556..c81ff4cbe 100644 --- a/src/modules/02_organizational/views/MainTree.vue +++ b/src/modules/02_organizational/views/MainTree.vue @@ -820,7 +820,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import type { OrganizaOption } from "../interface/index/Main"; -import { useDataStore } from "@/stores/data"; + // import manageApiErrorMsg from "@/global/user_response_msg"; import HistoryTable from "@/components/TableHistory.vue"; import type { QTableProps } from "quasar"; @@ -857,11 +857,10 @@ const filterHistory = ref(""); //search data table history const modalHistory = ref(false); //modal ประวัติการแก้ไขข้อมูล //Global Variable -const store = useDataStore(); + const mixin = useCounterMixin(); -const { loaderPage } = store; //แสดง load windows ขณะเรียก api -const { success, messageError, dialogMessage } = mixin; +const { success, messageError, dialogMessage, showLoader, hideLoader } = mixin; //Notification Component Variable const $q = useQuasar(); // show dialog @@ -1029,7 +1028,7 @@ const loadJsonTree = async (fileName: string) => { manageApiErrorMsg(e); }) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; @@ -1051,12 +1050,12 @@ const loadFileServer = async (node: any) => { manageApiErrorMsg(e); }) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; const isTreeHasDraft = async () => { - // loaderPage(true); + // showLoader(); let orgHasDraft = false; let orgPoHasDraft = false; await http @@ -1072,7 +1071,7 @@ const isTreeHasDraft = async () => { messageError($q, e); }) .finally(() => { - // loaderPage(false); + // hideLoader(); }); await http @@ -1088,7 +1087,7 @@ const isTreeHasDraft = async () => { messageError($q, e); }) .finally(() => { - // loaderPage(false); + // hideLoader(); }); if (orgHasDraft || orgPoHasDraft) { @@ -1103,7 +1102,7 @@ const isTreeHasDraft = async () => { */ const fetchTreeRoot = async (isDraft: boolean) => { // console.log(isDraft); - loaderPage(true); + showLoader(); console.log("Call API14 GetTreeRoot"); isShowEditTree.value = isDraft; // to show same tree that we fetch let request = ""; @@ -1130,7 +1129,7 @@ const fetchTreeRoot = async (isDraft: boolean) => { // messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); if (isDraft) { // ถ้าไม่ต้องการให้แตก node root on first load ก็ไม่ต้องใส่ // ต้องอยู่ตรงนี้ ถ้าอยู่ตรง .then จะ error คาดว่ามันทำงานก่อนที่ tree จะ render เสร็จ แต่ก็อาจจะไม่ใช่ @@ -1148,7 +1147,7 @@ const fetchTreeRoot = async (isDraft: boolean) => { const fetchChildrenByParentId = async (node: any) => { // console.log(isDraft); console.log("Call API4"); - loaderPage(true); + showLoader(); let request = ""; if (isShowEditTree.value) { request = config.API.getDraftTreeNode(node.organizationId, node.keyId); @@ -1168,12 +1167,12 @@ const fetchChildrenByParentId = async (node: any) => { manageApiErrorMsg(e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchPublishFile = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.getPublishFileHistory) .then((res) => { @@ -1191,7 +1190,7 @@ const fetchPublishFile = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; @@ -1207,7 +1206,7 @@ const onLazyLoad = (node: any) => { */ console.log("Call LazyLoad"); await fetchChildrenByParentId(node.node); - /** loaderPage(true); + /** showLoader(); let request = ""; if (isShowEditTree.value) { request = config.API.getDraftTreeNode( @@ -1244,7 +1243,7 @@ const onLazyLoad = (node: any) => { // messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); });*/ node.done(node.node.children); //return ค่าให้ q-tree generate children @@ -1299,7 +1298,7 @@ const apiDeleteOrg = () => { // console.log("isShowEditTree", isShowEditTree.value); setTimeout(async () => { //delay for lazyLoad to be able to tricker again - loaderPage(true); + showLoader(); isShowEditTree.value = true; await http .delete(config.API.delTreeOrgDraft(delStructureId.value)) @@ -1318,7 +1317,7 @@ const apiDeleteOrg = () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); await isTreeHasDraft(); }); }, 20); @@ -1347,7 +1346,7 @@ const apiDeletePosition = () => { isShowEditTree.value = false; setTimeout(async () => { //delay for lazyLoad to be able to tricker again - loaderPage(true); + showLoader(); isShowEditTree.value = true; await http .delete(config.API.delTreePositionDraft(delStructureId.value)) @@ -1364,7 +1363,7 @@ const apiDeletePosition = () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); await isTreeHasDraft(); }); }, 20); @@ -1377,7 +1376,7 @@ const apiDeletePosition = () => { * ฟังก์ชัน clear data แบบร่าง */ const deleteDraft = async () => { - loaderPage(true); + showLoader(); await http .put(config.API.delTreeOrgPoDraft) .then((res) => { @@ -1389,7 +1388,7 @@ const deleteDraft = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); router.go(0); await isTreeHasDraft(); }); @@ -1399,7 +1398,7 @@ const deleteDraft = async () => { * ฟังก์ชันเผยแพร่แบบร่าง */ const publishDraft = async () => { - loaderPage(true); + showLoader(); await http .put(config.API.publishOrgPoDraft) .then((res) => { @@ -1425,7 +1424,7 @@ const publishDraft = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); await isTreeHasDraft(); }); }; @@ -1536,7 +1535,7 @@ const addStructure = async (node: any) => { }); // console.log(node.organizationId); console.log("Call API1"); - loaderPage(true); + showLoader(); isShowEditTree.value = true; //ต้องกลับมาแสดง editTree อีกครั้ง & trigger lazyLoad โดย setExpanded await http .post(config.API.addTreeDraft, { @@ -1557,7 +1556,7 @@ const addStructure = async (node: any) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); popupAddOrganization.value = false; await isTreeHasDraft(); @@ -1589,7 +1588,7 @@ const editOrgStructure = async (node: any) => { if (organizCheck == true) { // console.log(node.organizationId); console.log("Call API13"); - loaderPage(true); + showLoader(); isShowEditTree.value = true; //end prepare for tricker LazyLoad await http .put(config.API.editTreeOrgDraft(node.organizationId), { @@ -1629,7 +1628,7 @@ const editOrgStructure = async (node: any) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); popupEditSelectedOrganization.value = false; await isTreeHasDraft(); }); @@ -1655,7 +1654,7 @@ const editPositionStructure = async (node: any) => { if (positionCheck == true) { console.log("Call API3"); - loaderPage(true); + showLoader(); isShowEditTree.value = true; //end prepare for tricker LazyLoad await http .put(config.API.editTreePositionDraft(node.organizationPositionId), { @@ -1680,7 +1679,7 @@ const editPositionStructure = async (node: any) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); popupEditSelectedPosition.value = false; await isTreeHasDraft(); }); @@ -1696,7 +1695,7 @@ const clickHistory = async () => { modalHistory.value = true; // rowsHistory.value = rawHistory.value.filter((f: any) => f.id == row.id); - loaderPage(true); + showLoader(); await http .get(config.API.getTreeHistory) .then((res) => { @@ -1722,7 +1721,7 @@ const clickHistory = async () => { // messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/02_organizational/views/MainTreeEmployee.vue b/src/modules/02_organizational/views/MainTreeEmployee.vue index dd56b1aa5..8278e3329 100644 --- a/src/modules/02_organizational/views/MainTreeEmployee.vue +++ b/src/modules/02_organizational/views/MainTreeEmployee.vue @@ -674,15 +674,13 @@ import type { import type { Pagination } from "@/modules/03_recruiting/interface/index/Main"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; -import type { QTableProps } from "quasar"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; +import type { QTableProps } from "quasar"; const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); -const { date2Thai, success, modalError, messageError } = mixin; +const { date2Thai, success, modalError, messageError, showLoader, hideLoader } = + mixin; const store = useOrganizationalDataStore(); const { organizationalData, changeOrganizationalColumns } = store; const initialPagination = ref({ @@ -893,7 +891,7 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => { }); onMounted(async () => { - loaderPage(false); + hideLoader(); await fetchOrganization(); await fetchOrganizationAgency(); await fetchOrganizationGovernmentAgency(); @@ -906,7 +904,7 @@ onMounted(async () => { * ฟังก์ชัน get data ล่าสุด */ const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.organizationEmployee) .then((res) => { @@ -1008,7 +1006,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1016,7 +1014,7 @@ const fetchData = async () => { * get รายการ โครงสร้าง */ const fetchOrganization = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.organizationMain) .then((res) => { @@ -1075,7 +1073,7 @@ const fetchOrganization = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1083,7 +1081,7 @@ const fetchOrganization = async () => { * หน่วยงานต้นสังกัด */ const fetchOrganizationAgency = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.listOrganizationHistoryAgency("หน่วยงาน")) .then((res) => { @@ -1102,7 +1100,7 @@ const fetchOrganizationAgency = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1110,7 +1108,7 @@ const fetchOrganizationAgency = async () => { * ส่วนราชการต้นสังกัด */ const fetchOrganizationGovernmentAgency = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.listOrganizationHistoryAgency("ส่วนราชการ")) .then((res) => { @@ -1129,7 +1127,7 @@ const fetchOrganizationGovernmentAgency = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1137,7 +1135,7 @@ const fetchOrganizationGovernmentAgency = async () => { * รหัสหน่วยงาน */ const fetchOrganizationAgencyCode = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.organizationCode) .then((res) => { @@ -1158,13 +1156,13 @@ const fetchOrganizationAgencyCode = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchAgencyCode = async (val: string) => { let option: GovermentOption[] = []; - loaderPage(true); + showLoader(); await http .get(config.API.organizationAgencyCode(val)) .then((res) => { @@ -1184,7 +1182,7 @@ const fetchAgencyCode = async (val: string) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); return option; }; @@ -1193,7 +1191,7 @@ const fetchAgencyCode = async (val: string) => { * get รายการ ตำแหน่ง */ const fetchPosition = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.positionEmployee) .then((res) => { @@ -1285,7 +1283,7 @@ const fetchPosition = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1309,7 +1307,7 @@ const clickSave = async () => { */ const saveData = async () => { modal.value = false; - loaderPage(true); + showLoader(); await http .post(config.API.organizationEmployee, { organizationOrganizationId: organizationOrganizationId.value, @@ -1361,7 +1359,7 @@ const saveData = async () => { */ const editData = async () => { modal.value = false; - loaderPage(true); + showLoader(); await http .put(config.API.organizationEmployeeId(id.value), { organizationOrganizationId: organizationOrganizationId.value, @@ -1426,7 +1424,7 @@ const clickDelete = (id: string) => { }; const deleteData = async (id: string) => { - loaderPage(true); + showLoader(); await http .delete(config.API.organizationEmployeeId(id)) .then((res) => { @@ -1436,7 +1434,7 @@ const deleteData = async (id: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); await fetchData(); }); }; diff --git a/src/modules/02_organizational/views/ManageReport2.vue b/src/modules/02_organizational/views/ManageReport2.vue index 7e73944a7..c8a146dc6 100644 --- a/src/modules/02_organizational/views/ManageReport2.vue +++ b/src/modules/02_organizational/views/ManageReport2.vue @@ -108,7 +108,7 @@ import { onMounted, computed, ref, watch } from "vue"; import { useQuasar, QForm } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import { useRouter, useRoute } from "vue-router"; -import { useDataStore } from "@/stores/data"; + import TableReport from "@/modules/02_organizational/components/TableReport.vue"; import type { Columns } from "@/modules/02_organizational/interface/index/Main"; import http from "@/plugins/http"; @@ -116,13 +116,12 @@ import config from "@/app.config"; import type { treeTab } from "@/modules/04_registry/interface/index/Main"; import type { ResponseTree } from "@/modules/02_organizational/interface/response/Mapping"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); const router = useRouter(); const route = useRoute(); -const { date2Thai, success, dateToISO, modalError } = mixin; +const { date2Thai, success, dateToISO, modalError, showLoader, hideLoader } = + mixin; const filter = ref(""); //search data table const visibleColumns = ref([]); @@ -273,7 +272,7 @@ onMounted(async () => { }); const nodeTree = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.profileOrganizRoot) .then((res: any) => { @@ -292,7 +291,7 @@ const nodeTree = async () => { }) .catch((e: any) => {}) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -306,7 +305,7 @@ const clickTree = () => { }; const onHistory = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.report2HistoryId(selected.value)) .then((res) => { @@ -329,13 +328,13 @@ const onHistory = async () => { ); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; const doSearch = async () => { //ทำไว้แล้ว เหลือ ใส่ type - loaderPage(true); + showLoader(); await http .get(config.API.report2TreeId(selected.value)) .then((res) => { @@ -370,7 +369,7 @@ const doSearch = async () => { }) .catch((e) => {}) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -386,7 +385,7 @@ const onConfirm = async () => { ok: "ยืนยัน", persistent: true, }).onOk(async () => { - loaderPage(true); + showLoader(); await http .get(config.API.report2DoneId(selected.value)) .then((res) => { @@ -394,7 +393,7 @@ const onConfirm = async () => { }) .catch((e) => {}) .finally(async () => { - loaderPage(false); + hideLoader(); await doSearch(); }); }); diff --git a/src/modules/02_organizational/views/ManageReport2Add.vue b/src/modules/02_organizational/views/ManageReport2Add.vue index bb0d3e27b..ea5e8c89a 100644 --- a/src/modules/02_organizational/views/ManageReport2Add.vue +++ b/src/modules/02_organizational/views/ManageReport2Add.vue @@ -574,7 +574,7 @@ import { onMounted, computed, ref, watch } from "vue"; import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import { useRouter, useRoute } from "vue-router"; -import { useDataStore } from "@/stores/data"; + import TableReport from "@/modules/02_organizational/components/TableReport.vue"; import DialogHeader from "@/modules/02_organizational/components/DialogHeader.vue"; import DialogFooter from "@/modules/02_organizational/components/DialogFooter.vue"; @@ -585,13 +585,11 @@ import type { RequestReport2 } from "@/modules/02_organizational/interface/reque import http from "@/plugins/http"; import config from "@/app.config"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); const router = useRouter(); const route = useRoute(); -const { date2Thai, success, dateToISO } = mixin; +const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin; const id = ref(""); const myForm = ref(null); //form data input @@ -669,10 +667,10 @@ const sideWorkOPfilter = ref([]); const levelOPfilter = ref([]); onMounted(async () => { - loaderPage(false); + hideLoader(); if (route.params.id != undefined) { id.value = route.params.id.toString(); - loaderPage(true); + showLoader(); await fetchGoverment(); // await fetchAgency(); @@ -685,12 +683,12 @@ onMounted(async () => { await fetchLevel(); await fetchData(); - loaderPage(false); + hideLoader(); } }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.report2Id(id.value)) .then(async (res) => { @@ -750,7 +748,7 @@ const fetchData = async () => { }) .catch((e) => {}) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -766,7 +764,7 @@ const checkSave = async () => { const saveData = async () => { // console.log(myData.value); - loaderPage(true); + showLoader(); const body: RequestReport2 = { organizationShortNameId: myData.value.goverment2, organizationOrganizationId: myData.value.agency2, @@ -787,7 +785,7 @@ const saveData = async () => { }) .catch((e) => {}) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -797,7 +795,7 @@ const clickBack = () => { //รหัสส่วนราชการ const fetchGoverment = async () => { - // loaderPage(true); + // showLoader(); await http .get(config.API.organizationShortName) .then((res) => { @@ -823,12 +821,12 @@ const fetchGoverment = async () => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; const updateGoverment = async (id: string) => { - // loaderPage(true); + // showLoader(); await http .get(config.API.getPositionMasterPositionNumberId(id)) .then((res) => { @@ -917,13 +915,13 @@ const updateGoverment = async (id: string) => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; // //ตำแหน่งเลขที่ const fetchPositionNum = async () => { - // loaderPage(true); + // showLoader(); await http .get(config.API.getPositionMasterPositionNumber) .then((res) => { @@ -937,13 +935,13 @@ const fetchPositionNum = async () => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; //ตำแหน่งประเภท const fetchCategory = async () => { - // loaderPage(true); + // showLoader(); await http .get(config.API.positionType) .then((res) => { @@ -957,13 +955,13 @@ const fetchCategory = async () => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; //ตำแหน่งทางการบริหาร const fetchPositionManage = async () => { - // loaderPage(true); + // showLoader(); await http .get(config.API.positionExecutive) .then((res) => { @@ -977,13 +975,13 @@ const fetchPositionManage = async () => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; //ด้านทางบริหาร const fetchSideManage = async () => { - // loaderPage(true); + // showLoader(); await http .get(config.API.positionExecutiveSide) .then((res) => { @@ -997,13 +995,13 @@ const fetchSideManage = async () => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; //ตำแหน่งในสายงาน const fetchPositionWork = async () => { - // loaderPage(true); + // showLoader(); await http .get(config.API.positionPath) .then((res) => { @@ -1017,13 +1015,13 @@ const fetchPositionWork = async () => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; //ด้าน/สาขา const fetchSideWork = async () => { - // loaderPage(true); + // showLoader(); await http .get(config.API.positionSide) .then((res) => { @@ -1037,13 +1035,13 @@ const fetchSideWork = async () => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; //ระดับตำแหน่ง const fetchLevel = async () => { - // loaderPage(true); + // showLoader(); await http .get(config.API.positionLevel) .then((res) => { @@ -1057,7 +1055,7 @@ const fetchLevel = async () => { }) .catch((e) => {}) .finally(() => { - // loaderPage(false); + // hideLoader(); }); }; diff --git a/src/modules/02_organizational/views/ManageReport2History.vue b/src/modules/02_organizational/views/ManageReport2History.vue index ae8be4187..89983c82d 100644 --- a/src/modules/02_organizational/views/ManageReport2History.vue +++ b/src/modules/02_organizational/views/ManageReport2History.vue @@ -336,7 +336,7 @@ import { onMounted, ref } from "vue"; import { useCounterMixin } from "@/stores/mixin"; import { useRouter, useRoute } from "vue-router"; import { useQuasar } from "quasar"; -import { useDataStore } from "@/stores/data"; + import http from "@/plugins/http"; import config from "@/app.config"; import type { @@ -344,14 +344,12 @@ import type { ResponseHistoryHead, } from "@/modules/02_organizational/interface/response/Mapping"; -const dataStore = useDataStore(); const $q = useQuasar(); // show dia const mixin = useCounterMixin(); const router = useRouter(); const route = useRoute(); -const { loaderPage } = dataStore; -const { date2Thai, success, dateToISO } = mixin; +const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin; const id = ref(""); const previous = ref(false); const next = ref(false); @@ -360,7 +358,7 @@ const historyHead = ref([]); const historyData = ref([]); onMounted(async () => { - loaderPage(false); + hideLoader(); if (route.params.id != undefined) { id.value = route.params.id.toString(); @@ -386,7 +384,7 @@ const clickPreviousNext = async (page: string) => { }; const fetchHistory = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.report2HistoryId(id.value)) .then((res) => { @@ -402,7 +400,7 @@ const fetchHistory = async () => { }) .catch((e) => {}) .finally(async () => { - loaderPage(false); + hideLoader(); if (historyHead.value.length > 1) { next.value = true; previous.value = false; @@ -414,7 +412,7 @@ const fetchHistory = async () => { }; const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get( config.API.report2HistoryDetailId( @@ -455,7 +453,7 @@ const fetchData = async () => { }) .catch((e) => {}) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/02_organizational/views/Report.vue b/src/modules/02_organizational/views/Report.vue index 4e8b2998a..ccc0d7cc5 100644 --- a/src/modules/02_organizational/views/Report.vue +++ b/src/modules/02_organizational/views/Report.vue @@ -1,116 +1,98 @@ diff --git a/src/modules/03_recruiting/components/Address.vue b/src/modules/03_recruiting/components/Address.vue index 4ee38e840..7d58fa270 100644 --- a/src/modules/03_recruiting/components/Address.vue +++ b/src/modules/03_recruiting/components/Address.vue @@ -245,7 +245,6 @@ import HeaderTop from "@/modules/03_recruiting/components/top.vue"; import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; -import { useDataStore } from "@/stores/data"; const props = defineProps({ provinceOptions: { @@ -266,15 +265,14 @@ const route = useRoute(); const candidateId = ref(route.params.candidateId.toString()); const edit = ref(true); const myform = ref({}); -const loader = ref(false); + const districtOptions = ref([]); const districtCOptions = ref([]); const subdistrictOptions = ref([]); const subdistrictCOptions = ref([]); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { messageError } = mixin; +const { messageError, showLoader, hideLoader } = mixin; const emit = defineEmits(["update:form"]); watch(myform, async (count: any, prevCount: any) => { @@ -319,7 +317,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -362,7 +360,7 @@ const selectSubDistrict = (e: string, name: string) => { }; const fetchDistrict = async (id: string, position: string) => { - loader.value = true; + showLoader(); await http .get(config.API.listDistrict(id)) .then((res) => { @@ -381,12 +379,12 @@ const fetchDistrict = async (id: string, position: string) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchSubDistrict = async (id: string, position: string) => { - loader.value = true; + showLoader(); await http .get(config.API.listSubDistrict(id)) .then((res) => { @@ -409,7 +407,7 @@ const fetchSubDistrict = async (id: string, position: string) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/components/Career.vue b/src/modules/03_recruiting/components/Career.vue index ea833743b..a77a38f83 100644 --- a/src/modules/03_recruiting/components/Career.vue +++ b/src/modules/03_recruiting/components/Career.vue @@ -202,7 +202,6 @@ import Table from "@/modules/03_recruiting/components/TableCan.vue"; import DialogHeader from "@/modules/03_recruiting/components/DialogHeader.vue"; import DialogFooter from "@/modules/03_recruiting/components/DialogFooter.vue"; import { useRoute } from "vue-router"; -import { useDataStore } from "@/stores/data"; const props = defineProps({ status: { @@ -229,7 +228,7 @@ const modalEdit = ref(false); //modal ที่แสดงใช้ส const rawItem = ref(); //ข้อมูลเดิมที่เลือกใน row นั้น const rowIndex = ref(0); //indexข้อมูลเดิมที่เลือกใน row นั้น const previous = ref(); //แสดงปุ่มดูข้อมูลก่อนหน้า -const dataStore = useDataStore(); + const next = ref(); //แสดงปุ่มดูข้อมูลต่อไป const editRow = ref(false); //เช็คมีการแก้ไขข้อมูล const checkValidate = ref(false); //validate data ผ่านหรือไม่ @@ -237,8 +236,8 @@ const route = useRoute(); const candidateId = ref(route.params.candidateId.toString()); const rows = ref([]); const filter = ref(""); //search data table -const { messageError } = mixin; -const { loaderPage } = dataStore; +const { messageError, showLoader, hideLoader } = mixin; + const visibleColumns = ref([]); examData.career.columns.length == 0 @@ -318,7 +317,7 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateCareer(candidateId.value)) .then((res) => { @@ -336,7 +335,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -415,7 +414,7 @@ const checkDelete = (row: RequestItemsObject) => { */ const clickDeleteRow = async () => { if (rawItem.value != null) { - loaderPage(true); + showLoader(); await http .delete(config.API.candidateAdminCareer(rawItem.value.id)) .then(() => { @@ -451,7 +450,7 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); + showLoader(); await http .post(config.API.candidateAdminCareer(candidateId.value), { name: location.value, @@ -477,7 +476,7 @@ const saveData = async () => { * บันทึกแก้ไขข้อมูล */ const editData = async () => { - loaderPage(true); + showLoader(); await http .put(config.API.candidateAdminCareer(id.value), { name: location.value, diff --git a/src/modules/03_recruiting/components/Document.vue b/src/modules/03_recruiting/components/Document.vue index 03ab790a9..ff6e9a764 100644 --- a/src/modules/03_recruiting/components/Document.vue +++ b/src/modules/03_recruiting/components/Document.vue @@ -146,7 +146,7 @@ import HeaderTop from "@/modules/03_recruiting/components/top.vue"; import http from "@/plugins/http"; import config from "@/app.config"; import { useRoute } from "vue-router"; -import { useDataStore } from "@/stores/data"; + import type { UploadType } from "@/modules/03_recruiting/interface/index/Main"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; @@ -161,14 +161,13 @@ const $q = useQuasar(); const route = useRoute(); const candidateId = ref(route.params.candidateId.toString()); const uploader = ref(); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const edit = ref(props.status == "checkRegister"); const name = ref(""); const files = ref([]); const file = ref([]); const mixin = useCounterMixin(); -const { messageError } = mixin; +const { messageError, showLoader, hideLoader } = mixin; onMounted(async () => { await getData(); @@ -180,7 +179,7 @@ const fileAdd = async (val: any) => { }; const getData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateUpload(candidateId.value)) .then((res) => { @@ -191,7 +190,7 @@ const getData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -199,7 +198,7 @@ const deleteData = async (id: string) => { const params = { documentId: id, }; - loaderPage(true); + showLoader(); await http .delete(config.API.candidateUpload(candidateId.value), { params, @@ -211,7 +210,7 @@ const deleteData = async (id: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); await getData(); }); }; @@ -223,7 +222,7 @@ const uploadData = async () => { }); const formData = new FormData(); formData.append("", newFile); - loaderPage(true); + showLoader(); await http .put(config.API.candidateUpload(candidateId.value), formData) .then((res) => { @@ -233,7 +232,7 @@ const uploadData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); name.value = ""; uploader.value.reset(); await getData(); diff --git a/src/modules/03_recruiting/components/Education.vue b/src/modules/03_recruiting/components/Education.vue index b7f73f24e..c55d7a4bf 100644 --- a/src/modules/03_recruiting/components/Education.vue +++ b/src/modules/03_recruiting/components/Education.vue @@ -193,7 +193,7 @@ import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; + import { useExamDataStore } from "@/modules/03_recruiting/store"; import type { RequestItemsObject, @@ -238,9 +238,8 @@ const editRow = ref(false); //เช็คมีการแก้ไ const checkValidate = ref(false); //validate data ผ่านหรือไม่ const rows = ref([]); const route = useRoute(); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; -const { messageError } = mixin; + +const { messageError, showLoader, hideLoader } = mixin; const candidateId = ref(route.params.candidateId.toString()); const filter = ref(""); //search data table @@ -324,7 +323,7 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateEducation(candidateId.value)) .then((res) => { @@ -343,12 +342,12 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetcheducationLevel = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.educationLevel) .then((res) => { @@ -363,7 +362,7 @@ const fetcheducationLevel = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -444,7 +443,7 @@ const checkDelete = (row: RequestItemsObject) => { */ const clickDeleteRow = async () => { if (rawItem.value != null) { - loaderPage(true); + showLoader(); await http .delete(config.API.candidateAdminEducation(rawItem.value.id)) .then(() => { @@ -480,7 +479,7 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); + showLoader(); await http .post(config.API.candidateAdminEducation(candidateId.value), { educationLevelId: educationLevelId.value, @@ -506,7 +505,7 @@ const saveData = async () => { * บันทึกแก้ไขข้อมูล */ const editData = async () => { - loaderPage(true); + showLoader(); await http .put(config.API.candidateAdminEducation(id.value), { educationLevelId: educationLevelId.value, diff --git a/src/modules/03_recruiting/components/ExamFinished.vue b/src/modules/03_recruiting/components/ExamFinished.vue index 99060e6f1..4deab82d5 100644 --- a/src/modules/03_recruiting/components/ExamFinished.vue +++ b/src/modules/03_recruiting/components/ExamFinished.vue @@ -113,7 +113,7 @@ import { onMounted, ref } from "vue"; import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; + import { useQuasar } from "quasar"; const props = defineProps({ @@ -129,9 +129,8 @@ const props = defineProps({ const $q = useQuasar(); const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง -const { messageError, date2Thai } = mixin; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; +const { messageError, date2Thai, showLoader, hideLoader } = mixin; + const fullName = ref(""); const examNumber = ref(""); const citizenId = ref(""); @@ -152,7 +151,7 @@ onMounted(async () => { }); const fetchCard = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateCard(props.candidateId)) .then((res) => { @@ -194,7 +193,7 @@ const fetchCard = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/components/Family.vue b/src/modules/03_recruiting/components/Family.vue index 7d0f903d9..6dc72adc8 100644 --- a/src/modules/03_recruiting/components/Family.vue +++ b/src/modules/03_recruiting/components/Family.vue @@ -282,7 +282,7 @@ import { import HeaderTop from "@/modules/03_recruiting/components/top.vue"; import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; -import { useDataStore } from "@/stores/data"; + import { useQuasar } from "quasar"; const props = defineProps({ @@ -300,10 +300,9 @@ const props = defineProps({ }, }); const $q = useQuasar(); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { messageError } = mixin; +const { messageError, showLoader, hideLoader } = mixin; const edit = ref(true); const myform = ref({}); const route = useRoute(); @@ -324,7 +323,7 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateFamily(candidateId.value)) .then((res) => { @@ -351,7 +350,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/components/Information.vue b/src/modules/03_recruiting/components/Information.vue index cf1bc5f3c..9c289d913 100644 --- a/src/modules/03_recruiting/components/Information.vue +++ b/src/modules/03_recruiting/components/Information.vue @@ -403,7 +403,6 @@ import HeaderTop from "@/modules/03_recruiting/components/top.vue"; import { useRoute } from "vue-router"; import keycloak from "@/plugins/keycloak"; import { useQuasar } from "quasar"; -import { useDataStore } from "@/stores/data"; const props = defineProps({ prefixOptions: { @@ -438,9 +437,8 @@ const edit = ref(true); const myform = ref({}); const img = ref(""); const fileProfile = ref([]); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; -const { messageError } = mixin; + +const { messageError, showLoader, hideLoader } = mixin; const emit = defineEmits(["update:form"]); @@ -463,7 +461,7 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateInformation(candidateId.value)) .then((res) => { @@ -494,12 +492,12 @@ const fetchData = async () => { keycloak.tokenParsed == null ? "" : keycloak.tokenParsed.family_name; }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchImgData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateProfile(candidateId.value)) .then((res) => { @@ -510,7 +508,7 @@ const fetchImgData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; @@ -542,7 +540,7 @@ const selectProvince = (val: string) => { }; const fetchDistrict = async (id: string) => { - loaderPage(true); + showLoader(); await http .get(config.API.listDistrict(id)) .then((res) => { @@ -557,7 +555,7 @@ const fetchDistrict = async (id: string) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/components/Occupation.vue b/src/modules/03_recruiting/components/Occupation.vue index fce1b52a6..f80810242 100644 --- a/src/modules/03_recruiting/components/Occupation.vue +++ b/src/modules/03_recruiting/components/Occupation.vue @@ -260,7 +260,7 @@ import { } from "@/modules/03_recruiting/interface/index/Main"; import HeaderTop from "@/modules/03_recruiting/components/top.vue"; import { useRoute } from "vue-router"; -import { useDataStore } from "@/stores/data"; + import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; @@ -280,10 +280,9 @@ const edit = ref(true); const myform = ref({}); const route = useRoute(); const candidateId = ref(route.params.candidateId.toString()); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { messageError } = mixin; +const { messageError, showLoader, hideLoader } = mixin; const emit = defineEmits(["update:form"]); @@ -300,7 +299,7 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateOccupation(candidateId.value)) .then((res) => { @@ -327,7 +326,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/components/Profile.vue b/src/modules/03_recruiting/components/Profile.vue index 0d70ca2d0..8914ba286 100644 --- a/src/modules/03_recruiting/components/Profile.vue +++ b/src/modules/03_recruiting/components/Profile.vue @@ -21,7 +21,11 @@
- +
@@ -56,7 +60,7 @@ import Occupation from "@/modules/03_recruiting/components/Occupation.vue"; import Education from "@/modules/03_recruiting/components/Education.vue"; import Career from "@/modules/03_recruiting/components/Career.vue"; import Document from "@/modules/03_recruiting/components/Document.vue"; -import { useDataStore } from "@/stores/data"; + import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; @@ -84,8 +88,7 @@ const props = defineProps({ }); const $q = useQuasar(); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const prefixOptions = ref([]); const relationshipOptions = ref([]); const provinceOptions = ref([]); @@ -94,7 +97,7 @@ const formAddress = ref({}); const formFamily = ref({}); const formOccupation = ref({}); const mixin = useCounterMixin(); -const { messageError } = mixin; +const { messageError, showLoader, hideLoader } = mixin; const emit = defineEmits([ "update:formInformation", @@ -120,14 +123,14 @@ watch(formOccupation, async (count: Object, prevCount: Object) => { }); onMounted(() => { - loaderPage(false); + hideLoader(); fetchPrefix(); fetchRelationship(); fetchProvince(); }); const fetchPrefix = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.prefix) .then((res) => { @@ -142,12 +145,12 @@ const fetchPrefix = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchRelationship = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.relationship) .then((res) => { @@ -162,12 +165,12 @@ const fetchRelationship = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchProvince = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.province) .then((res) => { @@ -182,7 +185,7 @@ const fetchProvince = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/components/TableCandidate.vue b/src/modules/03_recruiting/components/TableCandidate.vue index 717b31e44..da528e9b1 100644 --- a/src/modules/03_recruiting/components/TableCandidate.vue +++ b/src/modules/03_recruiting/components/TableCandidate.vue @@ -149,7 +149,7 @@ diff --git a/src/modules/03_recruiting/views/01_compete/Period.vue b/src/modules/03_recruiting/views/01_compete/Period.vue index 6ba96b5e6..596fc4af5 100644 --- a/src/modules/03_recruiting/views/01_compete/Period.vue +++ b/src/modules/03_recruiting/views/01_compete/Period.vue @@ -1,408 +1,362 @@ diff --git a/src/modules/03_recruiting/views/01_compete/PeriodAdd.vue b/src/modules/03_recruiting/views/01_compete/PeriodAdd.vue index fc0d44ffb..d1ddda8e6 100644 --- a/src/modules/03_recruiting/views/01_compete/PeriodAdd.vue +++ b/src/modules/03_recruiting/views/01_compete/PeriodAdd.vue @@ -806,15 +806,14 @@ import type { } from "@/modules/02_organizational/interface/index/Main"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + + const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); const router = useRouter(); const route = useRoute(); -const { date2Thai, success, dateToISO, notifyError } = mixin; +const { date2Thai, success, dateToISO, notifyError, showLoader, hideLoader } = mixin; const myForm = ref(null); //form data input const name = ref(""); const note = ref(""); @@ -925,7 +924,7 @@ watch(organizationName, (count: DataOption, prevCount: DataOption) => { }); onMounted(async () => { - loaderPage(false); + hideLoader(); if (route.params.id != undefined) { edit.value = true; id.value = route.params.id.toString(); @@ -940,7 +939,7 @@ const clickBack = () => { }; const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.getPeriodById(id.value)) .then((res) => { @@ -992,7 +991,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1019,7 +1018,7 @@ const uploadDocData = async () => { fileDocDataUpload.value.forEach((file: any) => { formData.append("", file); }); - loaderPage(true); + showLoader(); await http .put(config.API.periodRecruitDoc(id.value), formData) .then((res) => {}) @@ -1027,7 +1026,7 @@ const uploadDocData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); success($q, "บันทึกข้อมูลสำเร็จ"); clickBack(); }); @@ -1043,7 +1042,7 @@ const uploadImgData = async () => { fileImgDataUpload.value.forEach((file: any) => { formData.append("", file); }); - loaderPage(true); + showLoader(); await http .put(config.API.periodRecruitImg(id.value), formData) .then((res) => {}) @@ -1051,7 +1050,7 @@ const uploadImgData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); } }; @@ -1132,7 +1131,7 @@ const sendData = () => { }; const deleteDocData = async (docId: string) => { - loaderPage(true); + showLoader(); await http .delete(config.API.periodDeleteDoc(docId)) .then(async () => { @@ -1142,12 +1141,12 @@ const deleteDocData = async (docId: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; const deleteImgData = async (docId: string) => { - loaderPage(true); + showLoader(); await http .delete(config.API.periodDeleteImg(docId)) .then(async () => { @@ -1157,12 +1156,12 @@ const deleteImgData = async (docId: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; const addData = async () => { - loaderPage(true); + showLoader(); await http .post(config.API.savePeriod, sendData()) .then(async (res) => { @@ -1175,12 +1174,12 @@ const addData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; const editData = async (id: string) => { - loaderPage(true); + showLoader(); await http .put(config.API.editPeriod(id), sendData()) .then(async () => { @@ -1191,7 +1190,7 @@ const editData = async (id: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue b/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue index 91b22c7ed..774081eb1 100644 --- a/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue +++ b/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue @@ -121,15 +121,14 @@ import { ref, onMounted } from "vue"; import { useRouter, useRoute } from "vue-router"; import type { RecruitDetailResponse } from "@/modules/03_recruiting/interface/response/Period"; import Table from "@/modules/03_recruiting/components/Table.vue"; -import { useDataStore } from "@/stores/data"; + import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; const $q = useQuasar(); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const year = ref("2566"); const round = ref("1"); const name = ref(""); @@ -140,7 +139,7 @@ const pass = ref(0); const notpass = ref(0); const importId = ref(route.params.id as string); // Period Import Id const mixin = useCounterMixin(); -const { messageError, success } = mixin; +const { messageError, success, showLoader, hideLoader } = mixin; const filter = ref(""); //search data table const visibleColumns = ref([ "examID", @@ -328,12 +327,12 @@ const clickDetail = (examID: string) => { }; onMounted(async () => { - loaderPage(false); + hideLoader(); await fetchData(); }); const downloadExam = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.exportDisableExam(importId.value), { responseType: "blob", @@ -349,12 +348,12 @@ const downloadExam = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const downloadPassExam = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.exportDisablePassExam(importId.value), { responseType: "blob", @@ -370,12 +369,12 @@ const downloadPassExam = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const downloadPassResultExam = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.exportDisablePassResultExam(importId.value), { responseType: "blob", @@ -391,12 +390,12 @@ const downloadPassResultExam = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchData = async () => { - loaderPage(true); + showLoader(); await http .post(config.API.getDisableExamResultById(importId.value), { examAttribute: "", @@ -427,7 +426,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -442,7 +441,7 @@ const candidateToPlacement = async () => { persistent: true, }) .onOk(async () => { - loaderPage(true); + showLoader(); await http .get(config.API.periodDisableToPlacement(importId.value)) .then((res) => { @@ -452,7 +451,7 @@ const candidateToPlacement = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); router.go(-1); }); }) diff --git a/src/modules/03_recruiting/views/02_qualify/DisableDetailEx.vue b/src/modules/03_recruiting/views/02_qualify/DisableDetailEx.vue index 2908324fb..60d5f3982 100644 --- a/src/modules/03_recruiting/views/02_qualify/DisableDetailEx.vue +++ b/src/modules/03_recruiting/views/02_qualify/DisableDetailEx.vue @@ -237,19 +237,19 @@ import type { QTableProps } from "quasar"; import { ref, onMounted } from "vue"; import { useRouter, useRoute } from "vue-router"; -import { useDataStore } from "@/stores/data"; + import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; const $q = useQuasar(); -const dataStore = useDataStore(); + const router = useRouter(); const route = useRoute(); const mixin = useCounterMixin(); -const { messageError } = mixin; -const { loaderPage } = dataStore; +const { messageError, showLoader, hideLoader } = mixin; + const date = ref(); const profile_id = ref(""); const birthdate = ref(""); @@ -289,7 +289,7 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.getDisableExamDetail(importId.value, examId.value)) .then((res) => { @@ -328,12 +328,12 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const downloadScore = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.downloadDisableScoreReport(importId.value, examId.value), { responseType: "blob", @@ -349,12 +349,12 @@ const downloadScore = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const downloadCertificate = async () => { - loaderPage(true); + showLoader(); await http .get( config.API.downloadDisableExamReport(importId.value, examId.value, 2), @@ -373,7 +373,7 @@ const downloadCertificate = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue b/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue index ccb021623..bf72c934b 100644 --- a/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue +++ b/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue @@ -1,406 +1,360 @@ diff --git a/src/modules/03_recruiting/views/02_qualify/DisablePeriodAdd.vue b/src/modules/03_recruiting/views/02_qualify/DisablePeriodAdd.vue index 8630c1005..1b1b106cc 100644 --- a/src/modules/03_recruiting/views/02_qualify/DisablePeriodAdd.vue +++ b/src/modules/03_recruiting/views/02_qualify/DisablePeriodAdd.vue @@ -669,15 +669,20 @@ import type { } from "@/modules/02_organizational/interface/index/Main"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); const router = useRouter(); const route = useRoute(); -const { date2Thai, success, dateToISO, notifyError, messageError } = mixin; +const { + date2Thai, + success, + dateToISO, + notifyError, + messageError, + showLoader, + hideLoader, +} = mixin; const myForm = ref(null); //form data input const name = ref(""); const note = ref(""); @@ -725,7 +730,7 @@ onMounted(async () => { if (route.params.id != undefined) { edit.value = true; id.value = route.params.id.toString(); - loaderPage(false); + hideLoader(); await fetchData(); } else { edit.value = false; @@ -737,7 +742,7 @@ const clickBack = () => { }; const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.getDisablePeriodById(id.value)) .then((res) => { @@ -774,7 +779,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -829,7 +834,7 @@ const sendData = () => { }; const addData = async () => { - loaderPage(true); + showLoader(); await http .post(config.API.saveDisablePeriod, sendData()) .then(async (res) => { @@ -844,12 +849,12 @@ const addData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; const editData = async (id: string) => { - loaderPage(true); + showLoader(); await http .put(config.API.editDisablePeriod(id), sendData()) .then(async () => { @@ -862,7 +867,7 @@ const editData = async (id: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; @@ -889,7 +894,7 @@ const uploadImgData = async () => { fileImgDataUpload.value.forEach((file: any) => { formData.append("", file); }); - loaderPage(true); + showLoader(); await http .put(config.API.periodExamImg(id.value), formData) .then((res) => {}) @@ -897,7 +902,7 @@ const uploadImgData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); } }; @@ -906,7 +911,7 @@ const deleteDocData = async (docId: string) => { const params = { documentId: docId, }; - loaderPage(true); + showLoader(); await http .delete(config.API.periodExamDoc(id.value.toString()), { params, @@ -919,7 +924,7 @@ const deleteDocData = async (docId: string) => { }) .finally(async () => { await fetchData(); - loaderPage(false); + hideLoader(); }); }; @@ -950,7 +955,7 @@ const uploadDocData = async () => { fileDocDataUpload.value.forEach((file: any) => { formData.append("", file); }); - loaderPage(true); + showLoader(); await http .put(config.API.periodExamDoc(id.value), formData) .then((res) => {}) @@ -958,7 +963,7 @@ const uploadDocData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); } else { clickBack(); diff --git a/src/modules/03_recruiting/views/02_qualify/ExamForm.vue b/src/modules/03_recruiting/views/02_qualify/ExamForm.vue index 1f8ee5efa..1ba95a2f0 100644 --- a/src/modules/03_recruiting/views/02_qualify/ExamForm.vue +++ b/src/modules/03_recruiting/views/02_qualify/ExamForm.vue @@ -138,14 +138,11 @@ import { useRoute, useRouter } from "vue-router"; import { useQuasar } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const router = useRouter(); const $q = useQuasar(); const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง -const { success, dateToISO, messageError } = mixin; +const { success, dateToISO, messageError, showLoader, hideLoader } = mixin; const route = useRoute(); const examId = ref(route.params.examId.toString()); const candidateId = ref(route.params.candidateId.toString()); @@ -163,7 +160,7 @@ onMounted(async () => { }); const fetchStatus = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateId(candidateId.value)) .then((res) => { @@ -174,12 +171,12 @@ const fetchStatus = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; const confirm = async (status: boolean, reason: string) => { - loaderPage(true); + showLoader(); await http .put(config.API.candidateCheckRegister(candidateId.value), { status: status, @@ -190,14 +187,14 @@ const confirm = async (status: boolean, reason: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); success($q, "ตรวจสอบข้อมูลสำเร็จ"); router.push(`/qualify/manage/${examId.value}`); }); }; const reject = async (reason: string) => { - loaderPage(true); + showLoader(); await http .put(config.API.candidateRejectRegister(candidateId.value), { reason: reason, @@ -207,7 +204,7 @@ const reject = async (reason: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); success($q, "ตรวจสอบข้อมูลสำเร็จ"); router.push(`/qualify/manage/${examId.value}`); }); @@ -253,7 +250,7 @@ const clickSave = async () => { type.value = defaultOccupation.value.employee; if (defaultOccupation.value.status == "other") type.value = defaultOccupation.value.other; - loaderPage(true); + showLoader(); await http .post(config.API.candidateId(candidateId.value), { prefixId: defaultInformation.value.prefixId, @@ -329,7 +326,7 @@ const clickSave = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); } }); diff --git a/src/modules/03_recruiting/views/02_qualify/Manage.vue b/src/modules/03_recruiting/views/02_qualify/Manage.vue index 6702dd063..479849cb3 100644 --- a/src/modules/03_recruiting/views/02_qualify/Manage.vue +++ b/src/modules/03_recruiting/views/02_qualify/Manage.vue @@ -55,17 +55,16 @@ import { useCounterMixin } from "@/stores/mixin"; import type { Pagination } from "@/modules/03_recruiting/interface/index/Main"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; + import type { RequestPeriodExam } from "@/modules/03_recruiting/interface/request/Period"; import type { ResponsePeriodExam } from "@/modules/03_recruiting/interface/response/Period"; import { useQuasar } from "quasar"; const $q = useQuasar(); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const router = useRouter(); const mixin = useCounterMixin(); -const { date2Thai, messageError } = mixin; +const { date2Thai, messageError, showLoader, hideLoader } = mixin; const rows = ref([]); const initialPagination = ref({ rowsPerPage: 0, @@ -163,12 +162,12 @@ const columns = ref([ ]); onMounted(async () => { - loaderPage(false); + hideLoader(); await fetchData(); }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.periodExamType("exam")) .then((res) => { @@ -223,7 +222,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/views/02_qualify/Payment.vue b/src/modules/03_recruiting/views/02_qualify/Payment.vue index 3891cea5f..6e276cc1f 100644 --- a/src/modules/03_recruiting/views/02_qualify/Payment.vue +++ b/src/modules/03_recruiting/views/02_qualify/Payment.vue @@ -278,17 +278,14 @@ import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const filePayment = ref([]); const bank = ref([]); const fee = ref(); const $q = useQuasar(); const router = useRouter(); const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง -const { success, messageError } = mixin; +const { success, messageError, showLoader, hideLoader } = mixin; const route = useRoute(); const examId = ref(route.params.examId.toString()); const candidateId = ref(route.params.candidateId.toString()); @@ -308,13 +305,13 @@ const props = defineProps({ }); onMounted(async () => { - loaderPage(false); + hideLoader(); await fetchPaymentExam(); await fetchData(); }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidatePayment(candidateId.value)) .then((res) => { @@ -325,12 +322,12 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchPaymentExam = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.periodExamPayment(examId.value)) .then((res) => { @@ -342,12 +339,12 @@ const fetchPaymentExam = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; const confirm = async (status: boolean, reason: string) => { - loaderPage(true); + showLoader(); await http .put(config.API.candidateCheckPayment(candidateId.value), { status: status, @@ -358,7 +355,7 @@ const confirm = async (status: boolean, reason: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); success($q, "ตรวจสอบข้อมูลชำระเงินสำเร็จ"); router.push(`/qualify/manage/${examId.value}`); }); diff --git a/src/modules/03_recruiting/views/02_qualify/Period.vue b/src/modules/03_recruiting/views/02_qualify/Period.vue index 724d935ef..5e860fef2 100644 --- a/src/modules/03_recruiting/views/02_qualify/Period.vue +++ b/src/modules/03_recruiting/views/02_qualify/Period.vue @@ -94,15 +94,20 @@ import type { Pagination } from "@/modules/03_recruiting/interface/index/Main"; import Table from "@/modules/03_recruiting/components/Table.vue"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; + import { useRouter } from "vue-router"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); const router = useRouter(); -const { date2Thai, success, typeCategoryExam, messageError } = mixin; +const { + date2Thai, + success, + typeCategoryExam, + messageError, + showLoader, + hideLoader, +} = mixin; const filter = ref(""); //search data table const initialPagination = ref({ rowsPerPage: 0, @@ -205,12 +210,12 @@ const columns = ref([ ]); onMounted(async () => { - loaderPage(false); + hideLoader(); await fetchData(); }); const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.periodExamType("all")) .then((res) => { @@ -292,7 +297,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -322,7 +327,7 @@ const clickAdd = () => { }; const deleteData = async (id: string) => { - loaderPage(true); + showLoader(); await http .delete(config.API.periodExamId(id)) .then((res) => { @@ -332,7 +337,7 @@ const deleteData = async (id: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); await fetchData(); }); }; diff --git a/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue b/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue index 83381a653..90be47bd8 100644 --- a/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue +++ b/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue @@ -986,16 +986,15 @@ import type { } from "@/modules/02_organizational/interface/index/Main"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; + import ProfileTable from "@/modules/04_registry/components/Table.vue"; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); const router = useRouter(); const route = useRoute(); -const { date2Thai, success, dateToISO, messageError } = mixin; +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = + mixin; const myForm = ref(null); //form data input const name = ref(""); const note = ref(""); @@ -1137,7 +1136,7 @@ watch(organizationName, (count: DataOption, prevCount: DataOption) => { }); onMounted(async () => { - loaderPage(false); + hideLoader(); if (route.params.id != undefined) { edit.value = true; id.value = route.params.id.toString(); @@ -1160,7 +1159,7 @@ const clickBack = () => { }; const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.periodExamId(id.value)) .then((res) => { @@ -1239,7 +1238,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1247,7 +1246,7 @@ const fetchData = async () => { * get รายการ รหัสหน่วยงาน */ const fetchOrganizationShortName = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.organizationShortName) .then((res) => { @@ -1265,7 +1264,7 @@ const fetchOrganizationShortName = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1273,7 +1272,7 @@ const fetchOrganizationShortName = async () => { * get รายการ หน่วยงาน */ const fetchOrganizationOrganization = async (val: string) => { - loaderPage(true); + showLoader(); await http .get(config.API.organization) .then((res) => { @@ -1291,7 +1290,7 @@ const fetchOrganizationOrganization = async (val: string) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1299,7 +1298,7 @@ const fetchOrganizationOrganization = async (val: string) => { * get รายการ ตำแหน่งในสายงาน */ const fetchPositionPath = async (val: string) => { - loaderPage(true); + showLoader(); await http .get(config.API.positionPath) .then((res) => { @@ -1317,7 +1316,7 @@ const fetchPositionPath = async (val: string) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1410,7 +1409,7 @@ const sendData = () => { }; const addData = async () => { - loaderPage(true); + showLoader(); await http .post(config.API.periodExam, sendData()) .then(async (res) => { @@ -1425,12 +1424,12 @@ const addData = async () => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; const editData = async (id: string) => { - loaderPage(true); + showLoader(); await http .put(config.API.periodExamId(id), sendData()) .then(async (res) => { @@ -1443,7 +1442,7 @@ const editData = async (id: string) => { messageError($q, e); }) .finally(async () => { - loaderPage(false); + hideLoader(); }); }; @@ -1470,13 +1469,13 @@ const uploadDocData = async () => { fileDocDataUpload.value.forEach((file: any) => { formData.append("", file); }); - loaderPage(true); + showLoader(); await http .put(config.API.periodExamDoc(id.value), formData) .then((res) => {}) .catch((e) => {}) .finally(async () => { - loaderPage(false); + hideLoader(); }); } else { clickBack(); @@ -1506,13 +1505,13 @@ const uploadImgData = async () => { fileImgDataUpload.value.forEach((file: any) => { formData.append("", file); }); - loaderPage(true); + showLoader(); await http .put(config.API.periodExamImg(id.value), formData) .then((res) => {}) .catch((e) => {}) .finally(async () => { - loaderPage(false); + hideLoader(); }); } }; @@ -1521,7 +1520,7 @@ const deleteDocData = async (docId: string) => { const params = { documentId: docId, }; - loaderPage(true); + showLoader(); await http .delete(config.API.periodExamDoc(id.value.toString()), { params, diff --git a/src/modules/03_recruiting/views/02_qualify/manageDetail.vue b/src/modules/03_recruiting/views/02_qualify/manageDetail.vue index 91a8195ee..f6c7b6e85 100644 --- a/src/modules/03_recruiting/views/02_qualify/manageDetail.vue +++ b/src/modules/03_recruiting/views/02_qualify/manageDetail.vue @@ -37,7 +37,9 @@
-
+
{{ @@ -282,7 +285,7 @@ import { useCounterMixin } from "@/stores/mixin"; import type { Pagination } from "@/modules/03_recruiting/interface/index/Main"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useDataStore } from "@/stores/data"; + import TableCandidate from "@/modules/03_recruiting/components/TableCandidate.vue"; import ExamFinished from "@/modules/03_recruiting/components/ExamFinished.vue"; import type { DataNumObject } from "@/modules/01_metadata/interface/request/Calendar"; @@ -290,9 +293,15 @@ import { useQuasar } from "quasar"; const $q = useQuasar(); const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง -const { genColor15, dateToISO, date2Thai, messageError } = mixin; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; +const { + genColor15, + dateToISO, + date2Thai, + messageError, + showLoader, + hideLoader, +} = mixin; + const router = useRouter(); const route = useRoute(); const status = ref("all"); @@ -483,7 +492,7 @@ watch(status, (count: String, prevCount: String) => { }); onMounted(async () => { - loaderPage(false); + hideLoader(); await fetchDataCom(); }); @@ -502,7 +511,7 @@ const fetchDataCom = async () => { }; const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.candidateOfPeriodExam(status.value, examId.value)) .then((res) => { @@ -530,12 +539,12 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchPeriodExam = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.periodExamStatus(examId.value)) .then((res) => { @@ -550,7 +559,7 @@ const fetchPeriodExam = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -559,7 +568,7 @@ const fetchPeriodExam = async () => { */ const fetchDataSummary = async () => { dataNum.value = []; - loaderPage(true); + showLoader(); await http .get(config.API.countDashbordPeriodExam(examId.value)) .then((res) => { @@ -577,12 +586,12 @@ const fetchDataSummary = async () => { dataNum.value = []; }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const downloadFileDashboard = async () => { - loaderPage(true); + showLoader(); await http .put( config.API.periodExamDownloadDashboard(examId.value), @@ -606,7 +615,7 @@ const downloadFileDashboard = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/03_recruiting/views/03_editor/index.vue b/src/modules/03_recruiting/views/03_editor/index.vue index 2e52b3840..167e0c0be 100644 --- a/src/modules/03_recruiting/views/03_editor/index.vue +++ b/src/modules/03_recruiting/views/03_editor/index.vue @@ -571,14 +571,13 @@ import http from "@/plugins/http"; import config from "@/app.config"; import HeaderTop from "@/modules/04_registry/components/Information/top.vue"; import ProfileTable from "@/modules/04_registry/components/Table.vue"; -import { useDataStore } from "@/stores/data"; + import { useQuasar } from "quasar"; const $q = useQuasar(); const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง -const store = useDataStore(); -const { loaderPage } = store; -const { date2Thai, messageError } = mixin; + +const { date2Thai, messageError, showLoader, hideLoader } = mixin; const previous = ref(false); const next = ref(false); const addDialog = ref(false); @@ -870,7 +869,7 @@ const saveEdit = async () => { }; const saveDataAgency = async (data: DataLink[]) => { - loaderPage(true); + showLoader(); await http .post(config.API.cmsAgency, data) .then((res) => {}) @@ -883,7 +882,7 @@ const saveDataAgency = async (data: DataLink[]) => { }; const saveDataGoverment = async (data: DataLink[]) => { - loaderPage(true); + showLoader(); await http .post(config.API.cmsGoverment, data) @@ -897,7 +896,7 @@ const saveDataGoverment = async (data: DataLink[]) => { }; const fetchData = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.cms) .then((res) => { @@ -952,12 +951,12 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const takeLogo = async () => { - loaderPage(true); + showLoader(); const formData = new FormData(); formData.append("FileData", imageFileLogo.value); await http @@ -974,7 +973,7 @@ const takeLogo = async () => { }; const takeBanner = async () => { - loaderPage(true); + showLoader(); const formData = new FormData(); formData.append("FileData", imageFile.value); await http @@ -999,7 +998,7 @@ const sendDataDetail = async () => { description: web.value.descripstion, shortName: web.value.by, }; - loaderPage(true); + showLoader(); await http .post(config.API.cmsDeatail, data) .then((res) => {}) @@ -1026,7 +1025,7 @@ const sendDataAbout = async () => { zipCode: address.value.code, telephone: address.value.tel, }; - loaderPage(true); + showLoader(); await http .post(config.API.cmsAbout, data) .then((res) => {}) @@ -1042,7 +1041,7 @@ const sendDataAbout = async () => { }; const fetchProvince = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.province) .then((res) => { @@ -1057,13 +1056,13 @@ const fetchProvince = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchDistrict = async (id: string | null) => { if (id !== null && id != "") { - loaderPage(true); + showLoader(); await http .get(config.API.listDistrict(id)) .then((res) => { @@ -1078,14 +1077,14 @@ const fetchDistrict = async (id: string | null) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; const fetchSubDistrict = async (id: string | null) => { if (id !== null && id != "") { - loaderPage(true); + showLoader(); await http .get(config.API.listSubDistrict(id)) .then((res) => { @@ -1104,7 +1103,7 @@ const fetchSubDistrict = async (id: string | null) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; diff --git a/src/modules/04_registry/components/Assessment.vue b/src/modules/04_registry/components/Assessment.vue index 5d42ad985..981e8cc44 100644 --- a/src/modules/04_registry/components/Assessment.vue +++ b/src/modules/04_registry/components/Assessment.vue @@ -308,7 +308,7 @@ import { onMounted, ref, watch } from "vue"; import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useProfileDataStore } from "@/modules/04_registry/store"; -import { useDataStore } from "@/stores/data"; + import ProfileTable from "@/modules/04_registry/components/Table.vue"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue"; @@ -338,10 +338,10 @@ const props = defineProps({ const $q = useQuasar(); const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError } = mixin; +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = + mixin; const route = useRoute(); const id = ref(""); const name = ref(); @@ -598,7 +598,7 @@ onMounted(async () => { const fetchData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .get(config.API.profileAssessmentId(profileId.value)) .then((res) => { @@ -624,7 +624,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; @@ -717,7 +717,7 @@ const clickSave = async () => { */ const saveData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .post(config.API.profileAssessmentId(profileId.value), { id: id.value, @@ -747,7 +747,7 @@ const saveData = async () => { * บันทึกแก้ไขข้อมูล */ const editData = async () => { - loaderPage(true); + showLoader(); await http .put(config.API.profileAssessmentId(id.value), { id: id.value, @@ -784,7 +784,7 @@ const clickDelete = async () => { persistent: true, }) .onOk(async () => { - loaderPage(true); + showLoader(); await http .delete(config.API.profileAssessmentId(id.value)) .then((res) => { @@ -901,7 +901,7 @@ const clickEditRow = () => { const clickHistory = async (row: RequestItemsObject) => { tittleHistory.value = "ประวัติแก้ไขผลการประเมินการปฏิบัติราชการ"; modalHistory.value = true; - loaderPage(true); + showLoader(); await http .get(config.API.profileAssessmentHisId(row.id)) .then((res) => { @@ -927,7 +927,7 @@ const clickHistory = async (row: RequestItemsObject) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/04_registry/components/Coin.vue b/src/modules/04_registry/components/Coin.vue index a478b85b7..f189eff8b 100644 --- a/src/modules/04_registry/components/Coin.vue +++ b/src/modules/04_registry/components/Coin.vue @@ -264,7 +264,7 @@ import { onMounted, ref, watch } from "vue"; import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useProfileDataStore } from "@/modules/04_registry/store"; -import { useDataStore } from "@/stores/data"; + import ProfileTable from "@/modules/04_registry/components/Table.vue"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue"; @@ -294,10 +294,10 @@ const props = defineProps({ const $q = useQuasar(); const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError } = mixin; +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = + mixin; const route = useRoute(); const id = ref(""); const issuer = ref(); @@ -490,7 +490,7 @@ onMounted(async () => { const fetchData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .get(config.API.profileHonorId(profileId.value)) .then((res) => { @@ -514,7 +514,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; @@ -604,7 +604,7 @@ const clickSave = async () => { */ const saveData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .post(config.API.profileHonorId(profileId.value), { id: id.value, @@ -632,7 +632,7 @@ const saveData = async () => { * บันทึกแก้ไขข้อมูล */ const editData = async () => { - loaderPage(true); + showLoader(); await http .put(config.API.profileHonorId(id.value), { id: id.value, @@ -667,7 +667,7 @@ const clickDelete = async () => { persistent: true, }) .onOk(async () => { - loaderPage(true); + showLoader(); await http .delete(config.API.profileHonorId(id.value)) .then((res) => { @@ -781,7 +781,7 @@ const clickHistory = async (row: RequestItemsObject) => { ? "ประวัติแก้ไขประกาศลูกจ้างดีเด่น" : "ประวัติแก้ไขประกาศเกียรติคุณ"; modalHistory.value = true; - loaderPage(true); + showLoader(); await http .get(config.API.profileHonorHisId(row.id)) .then((res) => { @@ -805,7 +805,7 @@ const clickHistory = async (row: RequestItemsObject) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/04_registry/components/Discipline.vue b/src/modules/04_registry/components/Discipline.vue index ae43a8383..b2c4f2bc0 100644 --- a/src/modules/04_registry/components/Discipline.vue +++ b/src/modules/04_registry/components/Discipline.vue @@ -278,7 +278,7 @@ import { onMounted, ref, watch } from "vue"; import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useProfileDataStore } from "@/modules/04_registry/store"; -import { useDataStore } from "@/stores/data"; + import ProfileTable from "@/modules/04_registry/components/Table.vue"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue"; @@ -307,10 +307,10 @@ const props = defineProps({ const $q = useQuasar(); const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError } = mixin; +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = + mixin; const route = useRoute(); const id = ref(""); const level = ref(); @@ -590,7 +590,7 @@ const filterSelector = (val: string, update: Function, refData: string) => { const fetchData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .get(config.API.profileDisId(profileId.value)) .then((res) => { @@ -615,7 +615,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; @@ -706,7 +706,7 @@ const clickSave = async () => { */ const saveData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .post(config.API.profileDisId(profileId.value), { id: id.value, @@ -735,7 +735,7 @@ const saveData = async () => { * บันทึกแก้ไขข้อมูล */ const editData = async () => { - loaderPage(true); + showLoader(); await http .put(config.API.profileDisId(id.value), { id: id.value, @@ -771,7 +771,7 @@ const clickDelete = async () => { persistent: true, }) .onOk(async () => { - loaderPage(true); + showLoader(); await http .delete(config.API.profileDisId(id.value)) .then((res) => { @@ -883,7 +883,7 @@ const clickEditRow = () => { */ const clickHistory = async (row: RequestItemsObject) => { modalHistory.value = true; - loaderPage(true); + showLoader(); await http .get(config.API.profileDisHisId(row.id)) .then((res) => { @@ -908,7 +908,7 @@ const clickHistory = async (row: RequestItemsObject) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/04_registry/components/Document.vue b/src/modules/04_registry/components/Document.vue index 4b6bfe21b..f9f5f32fb 100644 --- a/src/modules/04_registry/components/Document.vue +++ b/src/modules/04_registry/components/Document.vue @@ -138,7 +138,7 @@ import { onMounted, computed, ref, watch } from "vue"; import { useQuasar, QForm } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import { useRoute } from "vue-router"; -import { useDataStore } from "@/stores/data"; + import HeaderTop from "@/modules/04_registry/components/Information/top.vue"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -156,12 +156,10 @@ const props = defineProps({ }); const emit = defineEmits(["update:statusEdit"]); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); const route = useRoute(); -const { success, messageError } = mixin; +const { success, messageError, showLoader, hideLoader } = mixin; const profileId = ref( route.params.id ? route.params.id.toString() : "" ); @@ -177,7 +175,7 @@ onMounted(async () => { const getData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .get(config.API.profilePaperId(profileId.value)) .then((res) => { @@ -188,13 +186,13 @@ const getData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; const deleteData = async (id: string) => { - loaderPage(true); + showLoader(); await http .delete(config.API.profilePaperId(id)) .then((res) => { @@ -219,7 +217,7 @@ const uploadData = async () => { formData.append("avatar", newFile); formData.append("moss", "newFile"); console.log(formData); - loaderPage(true); + showLoader(); await http .post(config.API.profilePaperId(profileId.value), formData) .then((res) => { diff --git a/src/modules/04_registry/components/Education.vue b/src/modules/04_registry/components/Education.vue index e3c38afce..75756891b 100644 --- a/src/modules/04_registry/components/Education.vue +++ b/src/modules/04_registry/components/Education.vue @@ -582,7 +582,7 @@ import { onMounted, ref, watch } from "vue"; import { useRoute } from "vue-router"; import { useProfileDataStore } from "@/modules/04_registry/store"; import { useCounterMixin } from "@/stores/mixin"; -import { useDataStore } from "@/stores/data"; + import ProfileTable from "@/modules/04_registry/components/Table.vue"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue"; @@ -609,10 +609,10 @@ const props = defineProps({ const $q = useQuasar(); const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { success, dateToISO, date2Thai, messageError } = mixin; +const { success, dateToISO, date2Thai, messageError, showLoader, hideLoader } = + mixin; const route = useRoute(); const id = ref(""); const levelId = ref(); @@ -1047,7 +1047,7 @@ onMounted(async () => { }); const fetchLevel = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.educationLevel) .then((res) => { @@ -1063,12 +1063,12 @@ const fetchLevel = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchPositionPath = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.positionPath) .then((res) => { @@ -1085,7 +1085,7 @@ const fetchPositionPath = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1113,7 +1113,7 @@ const filterSelector = (val: any, update: Function, refData: string) => { const fetchData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .get(config.API.profileEduId(profileId.value)) .then((res) => { @@ -1150,7 +1150,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; @@ -1258,7 +1258,7 @@ const saveData = async () => { // (r: any) => r.id == isEducation.value // ); if (profileId.value) { - loaderPage(true); + showLoader(); await http .post(config.API.profileEduId(profileId.value), { id: id.value, @@ -1308,7 +1308,7 @@ const editData = async () => { // const filterPositionPath = OpsFilter.value.positionPathOptions.filter( // (r: any) => r.id == isEducation.value // ); - loaderPage(true); + showLoader(); await http .put(config.API.profileEduId(id.value), { id: id.value, @@ -1359,7 +1359,7 @@ const clickDelete = async () => { persistent: true, }) .onOk(async () => { - loaderPage(true); + showLoader(); await http .delete(config.API.profileEduId(id.value)) .then((res) => { @@ -1493,7 +1493,7 @@ const clickEditRow = () => { */ const clickHistory = async (row: RequestItemsObject) => { modalHistory.value = true; - loaderPage(true); + showLoader(); await http .get(config.API.profileEduHisId(row.id)) .then((res) => { @@ -1530,7 +1530,7 @@ const clickHistory = async (row: RequestItemsObject) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/04_registry/components/Information/Address.vue b/src/modules/04_registry/components/Information/Address.vue index 8881a3505..95c6d657e 100644 --- a/src/modules/04_registry/components/Information/Address.vue +++ b/src/modules/04_registry/components/Information/Address.vue @@ -289,7 +289,7 @@ diff --git a/src/modules/08_registryEmployee/views/Discipline.vue b/src/modules/08_registryEmployee/views/Discipline.vue index ae43a8383..b2c4f2bc0 100644 --- a/src/modules/08_registryEmployee/views/Discipline.vue +++ b/src/modules/08_registryEmployee/views/Discipline.vue @@ -278,7 +278,7 @@ import { onMounted, ref, watch } from "vue"; import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useProfileDataStore } from "@/modules/04_registry/store"; -import { useDataStore } from "@/stores/data"; + import ProfileTable from "@/modules/04_registry/components/Table.vue"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue"; @@ -307,10 +307,10 @@ const props = defineProps({ const $q = useQuasar(); const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError } = mixin; +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = + mixin; const route = useRoute(); const id = ref(""); const level = ref(); @@ -590,7 +590,7 @@ const filterSelector = (val: string, update: Function, refData: string) => { const fetchData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .get(config.API.profileDisId(profileId.value)) .then((res) => { @@ -615,7 +615,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; @@ -706,7 +706,7 @@ const clickSave = async () => { */ const saveData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .post(config.API.profileDisId(profileId.value), { id: id.value, @@ -735,7 +735,7 @@ const saveData = async () => { * บันทึกแก้ไขข้อมูล */ const editData = async () => { - loaderPage(true); + showLoader(); await http .put(config.API.profileDisId(id.value), { id: id.value, @@ -771,7 +771,7 @@ const clickDelete = async () => { persistent: true, }) .onOk(async () => { - loaderPage(true); + showLoader(); await http .delete(config.API.profileDisId(id.value)) .then((res) => { @@ -883,7 +883,7 @@ const clickEditRow = () => { */ const clickHistory = async (row: RequestItemsObject) => { modalHistory.value = true; - loaderPage(true); + showLoader(); await http .get(config.API.profileDisHisId(row.id)) .then((res) => { @@ -908,7 +908,7 @@ const clickHistory = async (row: RequestItemsObject) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/08_registryEmployee/views/Document.vue b/src/modules/08_registryEmployee/views/Document.vue index 4b6bfe21b..f9f5f32fb 100644 --- a/src/modules/08_registryEmployee/views/Document.vue +++ b/src/modules/08_registryEmployee/views/Document.vue @@ -138,7 +138,7 @@ import { onMounted, computed, ref, watch } from "vue"; import { useQuasar, QForm } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import { useRoute } from "vue-router"; -import { useDataStore } from "@/stores/data"; + import HeaderTop from "@/modules/04_registry/components/Information/top.vue"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -156,12 +156,10 @@ const props = defineProps({ }); const emit = defineEmits(["update:statusEdit"]); -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const $q = useQuasar(); // show dialog const mixin = useCounterMixin(); const route = useRoute(); -const { success, messageError } = mixin; +const { success, messageError, showLoader, hideLoader } = mixin; const profileId = ref( route.params.id ? route.params.id.toString() : "" ); @@ -177,7 +175,7 @@ onMounted(async () => { const getData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .get(config.API.profilePaperId(profileId.value)) .then((res) => { @@ -188,13 +186,13 @@ const getData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; const deleteData = async (id: string) => { - loaderPage(true); + showLoader(); await http .delete(config.API.profilePaperId(id)) .then((res) => { @@ -219,7 +217,7 @@ const uploadData = async () => { formData.append("avatar", newFile); formData.append("moss", "newFile"); console.log(formData); - loaderPage(true); + showLoader(); await http .post(config.API.profilePaperId(profileId.value), formData) .then((res) => { diff --git a/src/modules/08_registryEmployee/views/EditDetail.vue b/src/modules/08_registryEmployee/views/EditDetail.vue index 0a123b88d..031332411 100644 --- a/src/modules/08_registryEmployee/views/EditDetail.vue +++ b/src/modules/08_registryEmployee/views/EditDetail.vue @@ -521,9 +521,17 @@ import config from "@/app.config"; const $q = useQuasar(); const store = useDataStore(); -const { changeTab, loaderPage } = store; +const { changeTab } = store; const mixin = useCounterMixin(); -const { date2Thai, dateToISO, messageError, dialogMessage, success } = mixin; +const { + date2Thai, + dateToISO, + messageError, + dialogMessage, + success, + showLoader, + hideLoader, +} = mixin; const route = useRoute(); const router = useRouter(); const imageUrl = ref(null); @@ -603,7 +611,7 @@ onMounted(async () => { const fetchData = async () => { if (profileId.value !== "") { - loaderPage(true); + showLoader(); await http .get(config.API.profileAvatarId(profileId.value)) .then((res) => { @@ -627,14 +635,14 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; const checkProfileData = async () => { if (profileId.value !== "") { - loaderPage(true); + showLoader(); await http .get(config.API.profileCheckId(profileId.value)) .then((res) => { @@ -645,14 +653,14 @@ const checkProfileData = async () => { router.push("/registry"); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; const fetchAvatarHistory = async () => { if (profileId.value !== "") { - loaderPage(true); + showLoader(); await http .get(config.API.profileAvatarHistoryId(profileId.value)) .then((res) => { @@ -672,7 +680,7 @@ const fetchAvatarHistory = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; @@ -683,7 +691,7 @@ const uploadImage = async (e: any) => { if (input.length > 0) { const formData = new FormData(); formData.append("FileData", input[0]); - loaderPage(true); + showLoader(); await http .post(config.API.profileAvatarId(profileId.value), formData) .then((res) => {}) @@ -700,7 +708,7 @@ const uploadImage = async (e: any) => { }; const fetchDataDelete = async (id: string) => { - loaderPage(true); + showLoader(); await http .delete(config.API.profileAvatarHistoryId(id)) .then((res) => { @@ -746,7 +754,7 @@ const selectAvatarHistory = async () => { return; } if (profileId.value !== "") { - loaderPage(true); + showLoader(); await http .put(config.API.profileAvatarId(profileId.value), { avatar: activeImage.value.avatarId, @@ -817,7 +825,7 @@ const clickKp7 = async () => { if (profileId.value !== "") { window.open(config.API.profileReportId(profileId.value)); } - // loaderPage(true); + // showLoader(); // await http // .get(config.API.profileReportId(profileId.value)) // .then((res) => { @@ -830,7 +838,7 @@ const clickKp7 = async () => { // }) // .catch((e) => {messageError($q, e);}) // .finally(() => { - // loaderPage(false); + // hideLoader(); // }); }; @@ -851,7 +859,7 @@ const clickKp7Short = async () => { if (profileId.value !== "") { window.open(config.API.profileKp7ShortId(profileId.value)); } - // loaderPage(true); + // showLoader(); // await http // .get(config.API.profileKp7ShortId(profileId.value)) // .then((res) => { @@ -864,7 +872,7 @@ const clickKp7Short = async () => { // }) // .catch((e) => {messageError($q, e);}) // .finally(() => { - // loaderPage(false); + // hideLoader(); // }); }; @@ -894,7 +902,7 @@ const clickRetire = async () => { const Retire = async () => { if (profileId.value !== "") { if (reasonStatus.value == true) { - loaderPage(true); + showLoader(); await http .put(config.API.profileReactive(profileId.value)) .then((res) => { @@ -909,7 +917,7 @@ const Retire = async () => { router.push("/registry"); }); } else { - loaderPage(true); + showLoader(); await http .put(config.API.profileDeactive(profileId.value), { leaveDate: dateToISO(leaveDate.value), diff --git a/src/modules/08_registryEmployee/views/Education.vue b/src/modules/08_registryEmployee/views/Education.vue index e3c38afce..75756891b 100644 --- a/src/modules/08_registryEmployee/views/Education.vue +++ b/src/modules/08_registryEmployee/views/Education.vue @@ -582,7 +582,7 @@ import { onMounted, ref, watch } from "vue"; import { useRoute } from "vue-router"; import { useProfileDataStore } from "@/modules/04_registry/store"; import { useCounterMixin } from "@/stores/mixin"; -import { useDataStore } from "@/stores/data"; + import ProfileTable from "@/modules/04_registry/components/Table.vue"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue"; @@ -609,10 +609,10 @@ const props = defineProps({ const $q = useQuasar(); const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); -const { success, dateToISO, date2Thai, messageError } = mixin; +const { success, dateToISO, date2Thai, messageError, showLoader, hideLoader } = + mixin; const route = useRoute(); const id = ref(""); const levelId = ref(); @@ -1047,7 +1047,7 @@ onMounted(async () => { }); const fetchLevel = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.educationLevel) .then((res) => { @@ -1063,12 +1063,12 @@ const fetchLevel = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; const fetchPositionPath = async () => { - loaderPage(true); + showLoader(); await http .get(config.API.positionPath) .then((res) => { @@ -1085,7 +1085,7 @@ const fetchPositionPath = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; @@ -1113,7 +1113,7 @@ const filterSelector = (val: any, update: Function, refData: string) => { const fetchData = async () => { if (profileId.value) { - loaderPage(true); + showLoader(); await http .get(config.API.profileEduId(profileId.value)) .then((res) => { @@ -1150,7 +1150,7 @@ const fetchData = async () => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); } }; @@ -1258,7 +1258,7 @@ const saveData = async () => { // (r: any) => r.id == isEducation.value // ); if (profileId.value) { - loaderPage(true); + showLoader(); await http .post(config.API.profileEduId(profileId.value), { id: id.value, @@ -1308,7 +1308,7 @@ const editData = async () => { // const filterPositionPath = OpsFilter.value.positionPathOptions.filter( // (r: any) => r.id == isEducation.value // ); - loaderPage(true); + showLoader(); await http .put(config.API.profileEduId(id.value), { id: id.value, @@ -1359,7 +1359,7 @@ const clickDelete = async () => { persistent: true, }) .onOk(async () => { - loaderPage(true); + showLoader(); await http .delete(config.API.profileEduId(id.value)) .then((res) => { @@ -1493,7 +1493,7 @@ const clickEditRow = () => { */ const clickHistory = async (row: RequestItemsObject) => { modalHistory.value = true; - loaderPage(true); + showLoader(); await http .get(config.API.profileEduHisId(row.id)) .then((res) => { @@ -1530,7 +1530,7 @@ const clickHistory = async (row: RequestItemsObject) => { messageError($q, e); }) .finally(() => { - loaderPage(false); + hideLoader(); }); }; diff --git a/src/modules/08_registryEmployee/views/Information/Address.vue b/src/modules/08_registryEmployee/views/Information/Address.vue index 8881a3505..95c6d657e 100644 --- a/src/modules/08_registryEmployee/views/Information/Address.vue +++ b/src/modules/08_registryEmployee/views/Information/Address.vue @@ -289,7 +289,7 @@