From 53b9b37d0a665c50f7977c4d1fe87019edcfc9c6 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Fri, 15 Mar 2024 10:12:13 +0700 Subject: [PATCH 01/12] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20ap?= =?UTF-8?q?i=20path=20period=20active?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/13_salary/api.salary.ts | 6 ++++-- src/modules/13_salary/views/salaryEmployeeLists.vue | 2 +- src/modules/13_salary/views/salaryLists.vue | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/api/13_salary/api.salary.ts b/src/api/13_salary/api.salary.ts index 7b484cfe0..8e0cc161c 100644 --- a/src/api/13_salary/api.salary.ts +++ b/src/api/13_salary/api.salary.ts @@ -20,6 +20,7 @@ export default { salaryRateListByid: (id: string) => `${salaryRate}/${id}`, salaryReportByid: (id: string) => `${salary}/report/${id}`, salaryPeriod: () => `${salary}/period`, + salaryPeriodActive: () => `${salary}/period/active`, /** รายการเงินเดือน*/ keycloakPositionByid: (id: string) => @@ -44,6 +45,7 @@ export default { salaryEmployeeRateList: `${salaryRate}/employee`, salaryEmployeeRateListByid: (id: string) => `${salaryRate}/employee/${id}`, - salaryEmployeePosType:()=>`${salaryOrg}/pos/type`, - salaryEmployeePositionType:(key:string)=>`${salaryOrg}/pos/position?keyword=${key}&type=positionType` + salaryEmployeePosType: () => `${salaryOrg}/pos/type`, + salaryEmployeePositionType: (key: string) => + `${salaryOrg}/pos/position?keyword=${key}&type=positionType`, }; diff --git a/src/modules/13_salary/views/salaryEmployeeLists.vue b/src/modules/13_salary/views/salaryEmployeeLists.vue index 09beb1080..b285ef056 100644 --- a/src/modules/13_salary/views/salaryEmployeeLists.vue +++ b/src/modules/13_salary/views/salaryEmployeeLists.vue @@ -52,7 +52,7 @@ function getRound() { showLoader(); http .get( - config.API.salaryPeriod() + + config.API.salaryPeriodActive() + `?page=${page.value}&pageSize=${pageSize.value}&keyword=&year=0` ) .then(async (res) => { diff --git a/src/modules/13_salary/views/salaryLists.vue b/src/modules/13_salary/views/salaryLists.vue index 589a4d1da..11228afba 100644 --- a/src/modules/13_salary/views/salaryLists.vue +++ b/src/modules/13_salary/views/salaryLists.vue @@ -51,7 +51,7 @@ function getRound() { showLoader(); http .get( - config.API.salaryPeriod() + + config.API.salaryPeriodActive() + `?page=${page.value}&pageSize=${pageSize.value}&keyword=&year=0` ) .then(async (res) => { From f78d8547ce2a32367e9bc89c18228ab1749e3d20 Mon Sep 17 00:00:00 2001 From: oat_dev Date: Fri, 15 Mar 2024 10:27:53 +0700 Subject: [PATCH 02/12] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A0?= =?UTF-8?q?=E0=B8=97=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=87:=20=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=AA?= =?UTF-8?q?=E0=B9=84=E0=B8=95=E0=B8=A5=E0=B9=8C/validate/=E0=B9=83?= =?UTF-8?q?=E0=B8=AA=E0=B9=88catch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/position/02ListType.vue | 124 +++++++++++------- .../components/position/05ListLevelDetail.vue | 53 +++++--- 2 files changed, 108 insertions(+), 69 deletions(-) diff --git a/src/modules/01_metadataNew/components/position/02ListType.vue b/src/modules/01_metadataNew/components/position/02ListType.vue index a07693bdf..c5caec7ef 100644 --- a/src/modules/01_metadataNew/components/position/02ListType.vue +++ b/src/modules/01_metadataNew/components/position/02ListType.vue @@ -85,16 +85,10 @@ const filterKeyword = ref(""); const dialog = ref(false); const posTypeName = ref(""); const posTypeNameRef = ref(null); -const posTypeRank = ref(); +const posTypeRank = ref(null); const posTypeRankRef = ref(null); const dialogStatus = ref(""); -const visibleColumns = ref([ - "posTypeName", - "posTypeRank", - // "createdAt", - // "lastUpdatedAt", - // "lastUpdateFullName", -]); +const visibleColumns = ref(["posTypeName", "posTypeRank"]); async function fetchData() { showLoader(); @@ -112,24 +106,53 @@ async function fetchData() { } async function addData() { - await http.post(config.API.orgPosType, { - posTypeName: posTypeName.value, - posTypeRank: posTypeRank.value, - }); - fetchData(); + await http + .post(config.API.orgPosType, { + posTypeName: posTypeName.value, + posTypeRank: posTypeRank.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function editData(id: string) { - await http.put(config.API.orgPosTypeId(id), { - posTypeName: posTypeName.value, - posTypeRank: posTypeRank.value, - }); - fetchData(); + await http + .put(config.API.orgPosTypeId(id), { + posTypeName: posTypeName.value, + posTypeRank: posTypeRank.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.orgPosTypeId(id)); - fetchData(); + await http + .delete(config.API.orgPosTypeId(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(async () => { @@ -151,14 +174,15 @@ function validateForm() { } async function onSubmit() { - if (posTypeName.value.length > 0) { + console.log(posTypeRank.value); + if (posTypeName.value.length > 0 && posTypeRank.value !== null) { dialogConfirm( $q, async () => { dialogStatus.value === "create" ? addData() : editData(editId.value); closeDialog(); posTypeName.value = ""; - posTypeRank.value = undefined; + posTypeRank.value = null; }, "ยืนยันการบันทึกข้อมูล", "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" @@ -276,7 +300,7 @@ async function onSubmit() { - +
- - +
+ +
+
+ +
diff --git a/src/modules/01_metadataNew/components/position/05ListLevelDetail.vue b/src/modules/01_metadataNew/components/position/05ListLevelDetail.vue index b4f7a0f34..4980d5974 100644 --- a/src/modules/01_metadataNew/components/position/05ListLevelDetail.vue +++ b/src/modules/01_metadataNew/components/position/05ListLevelDetail.vue @@ -13,16 +13,23 @@ import config from "@/app.config"; const store = usePositionDataStore(); const storeOption = useMainOptionDataStore(); const storeName = usePositionTypeDataStore(); -const router = useRouter(); + const mixin = useCounterMixin(); const posName = defineModel("posName", { required: true, }); -const { dialogRemove, dialogConfirm, showLoader, hideLoader, messageError } = - mixin; +const { + dialogRemove, + dialogConfirm, + showLoader, + hideLoader, + messageError, + success, +} = mixin; const $q = useQuasar(); + const columns = [ { name: "no", @@ -123,20 +130,15 @@ const editId = ref(""); const posLevelName = ref(""); const posLevelRank = ref(); const posLevelAuthority = ref(""); -const posTypeId = ref(); const posLevelNameRef = ref(null); const posLevelRankRef = ref(null); const posTypeIdRef = ref(null); -const name = ref(""); const visibleColumns = ref([ "no", "posTypeName", "posLevelName", "posLevelRank", "posLevelAuthority", - // "createdAt", - // "lastUpdatedAt", - // "lastUpdateFullName", ]); async function fetchData() { @@ -165,9 +167,13 @@ async function addData() { }) .then(() => { fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { messageError($q, err); + }) + .finally(() => { + hideLoader(); }); } @@ -182,9 +188,13 @@ async function editData(editId: string) { }) .then(() => { fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { messageError($q, err); + }) + .finally(() => { + hideLoader(); }); } @@ -196,19 +206,12 @@ async function deleteData(id: string) { }) .catch((err) => { messageError($q, err); + }) + .finally(() => { + hideLoader(); }); } -onMounted(async () => { - fetchName(); - storeName.row.forEach((e) => { - if (e.id === id.value) { - posName.value = e.posTypeName ? e.posTypeName : ""; - } - }); - fetchData(); -}); - function closeDialog() { dialog.value = false; } @@ -240,6 +243,11 @@ async function fetchName() { .get(config.API.orgPosType) .then(async (res) => { storeName.save(res.data.result); + storeName.row.forEach((e) => { + if (e.id === id.value) { + posName.value = e.posTypeName ? e.posTypeName : ""; + } + }); }) .catch((err) => { messageError($q, err); @@ -248,6 +256,11 @@ async function fetchName() { hideLoader(); }); } + +onMounted(async () => { + fetchName(); + fetchData(); +});