From b76d93b734d2b071ced07602b1685df26dd36eb3 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 28 Mar 2024 16:00:41 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/13_salary/api.salary.ts | 1 + src/api/registry/api.registry.ts | 6 +- .../detail/Salary/01_PositionSalary.vue | 67 +++++----- .../SalaryEmployeeLists/Dashboard.vue | 119 ++++++++++++++++- .../components/SalaryLists/Dashboard.vue | 125 ++++++++++++++++-- .../13_salary/views/salaryEmployeeLists.vue | 1 + src/modules/13_salary/views/salaryLists.vue | 1 + 7 files changed, 267 insertions(+), 53 deletions(-) diff --git a/src/api/13_salary/api.salary.ts b/src/api/13_salary/api.salary.ts index 0c023d038..e71c8bb80 100644 --- a/src/api/13_salary/api.salary.ts +++ b/src/api/13_salary/api.salary.ts @@ -36,6 +36,7 @@ export default { salaryReportListsByid: (type: string, rootId: string, periodId: string) => `${salary}/report/${type}/${rootId}/${periodId}`, salaryProperty: (id: string) => `${salaryPeriod}/org/property/${id}`, + salaryDashboard: `${salaryPeriod}/summary/all`, /** รายการเงินเดือนลูกจ้างประจำ*/ salaryEmployeeChart: `${salary}/employee`, diff --git a/src/api/registry/api.registry.ts b/src/api/registry/api.registry.ts index b23bb1ee7..7084059df 100644 --- a/src/api/registry/api.registry.ts +++ b/src/api/registry/api.registry.ts @@ -150,6 +150,8 @@ export default { profileListSalaryNew: (id: string) => `${salaryNew}/${id}`, profileListSalaryHistoryNew: (profileId: string) => `${salaryNew}/history/${profileId}`, + profileSalarySwapNew: (type: string, id: string) => + `${salaryNew}/swap/${type}/${id}`, // ประวัติการเปลี่ยนชื่อ-นามสกุล profileNewChangeName: `${registryNew}changeName`, @@ -159,8 +161,4 @@ export default { `${registryNew}changeName/${changeNameId}`, profileNewChangeNameHisByChangeNameId: (changeNameId: string) => `${registryNew}changeName/history/${changeNameId}`, - profileSalaryNew: `${salaryNew}`, - profileListSalaryNew: (id: string) => `${salaryNew}/${id}`, - profileListSalaryHistoryNew: (profileId: string) => - `${salaryNew}/history/${profileId}`, }; diff --git a/src/modules/04_registryNew/components/detail/Salary/01_PositionSalary.vue b/src/modules/04_registryNew/components/detail/Salary/01_PositionSalary.vue index 853cf295f..a392b5bf1 100644 --- a/src/modules/04_registryNew/components/detail/Salary/01_PositionSalary.vue +++ b/src/modules/04_registryNew/components/detail/Salary/01_PositionSalary.vue @@ -147,41 +147,7 @@ const pagination = ref({ rowsPerPage: 10, }); -const rows = ref([ - // { - // date: new Date(), - // amount: 20000, - // positionSalaryAmount: 20000, - // mouthSalaryAmount: 20000, - // posNo: "1", - // postionTypeName: "คำแหน่งประเภท", - // positionLevelName: "ระดับ", - // salaryRef: "เอกสารอ้างอิง", - // refCommandNo: "เลขที่คำสั่ง", - // }, - // { - // date: new Date(), - // amount: 20000, - // positionSalaryAmount: 20000, - // mouthSalaryAmount: 20000, - // posNo: "1", - // postionTypeName: "คำแหน่งประเภท", - // positionLevelName: "ระดับ", - // salaryRef: "เอกสารอ้างอิง", - // refCommandNo: "เลขที่คำสั่ง", - // }, - // { - // date: new Date(), - // amount: 20000, - // positionSalaryAmount: 20000, - // mouthSalaryAmount: 20000, - // posNo: "1", - // postionTypeName: "คำแหน่งประเภท", - // positionLevelName: "ระดับ", - // salaryRef: "เอกสารอ้างอิง", - // refCommandNo: "เลขที่คำสั่ง", - // }, -]); +const rows = ref([]); const formDataSalary = reactive({ date: null, @@ -392,6 +358,35 @@ async function submit() { } } +function onSwapUp(id: string) { + showLoader(); + http + .get(config.API.profileSalarySwapNew("up", id)) + .then(() => { + fetchListSalary(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} +function onSwapDown(id: string) { + showLoader(); + http + .get(config.API.profileSalarySwapNew("down", id)) + .then(() => { + fetchListSalary(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + const modalHistory = ref(false); function onClikcHistory(id: string) { salaryId.value = id; @@ -476,6 +471,7 @@ onMounted(() => { :color="props.rowIndex + 1 == 1 ? 'grey' : 'green'" :disable="props.rowIndex + 1 == 1" icon="mdi-arrow-up-bold" + @click="onSwapUp(props.row.id)" > @@ -489,6 +485,7 @@ onMounted(() => { :color="rows.length == props.rowIndex + 1 ? 'grey' : 'red'" :disable="rows.length == props.rowIndex + 1" icon="mdi-arrow-down-bold" + @click="onSwapDown(props.row.id)" > diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/Dashboard.vue b/src/modules/13_salary/components/SalaryEmployeeLists/Dashboard.vue index 6906d91e2..726b954b4 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/Dashboard.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/Dashboard.vue @@ -99,13 +99,34 @@ const itemsCardOCT = ref([ }, ]); +const itemsCardSpeciel = ref([ + { + lable: "จำนวนคนทั้งหมด", + name: "group1", + color: "secondary", + total: 0, + }, + { + lable: "เลือกไปแล้ว", + name: "group2", + color: "primary", + total: 0, + }, + { + lable: "สำรอง", + name: "group2", + color: "red-6", + total: 0, + }, +]); + const itemsCard = computed(() => { const items = store.roundMainCode === "APR" ? itemsCardAPR.value : store.roundMainCode === "OCT" ? itemsCardOCT.value - : []; + : itemsCardSpeciel.value; return items; }); @@ -185,6 +206,11 @@ const columnsOCT = ref([ field: "currentAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { @@ -195,6 +221,11 @@ const columnsOCT = ref([ field: "sixPercentAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { name: "spentAmount", @@ -204,6 +235,11 @@ const columnsOCT = ref([ field: "spentAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { name: "sixPercentSpentAmount", @@ -213,6 +249,11 @@ const columnsOCT = ref([ field: "sixPercentSpentAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { @@ -223,6 +264,11 @@ const columnsOCT = ref([ field: "useAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { name: "remainingAmount", @@ -232,6 +278,11 @@ const columnsOCT = ref([ field: "remainingAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { name: "totalBackup", @@ -243,13 +294,54 @@ const columnsOCT = ref([ style: "font-size: 14px", }, ]); + +const columnsSpeciel = ref([ + { + name: "org", + align: "left", + label: "หน่วยงาน", + sortable: true, + field: "org", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "total", + align: "left", + label: "จำนวนคนทั้งหมด", + sortable: true, + field: "total", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + + { + name: "chosen", + align: "left", + label: "เลือกไปแล้ว", + sortable: true, + field: "chosen", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + + { + name: "totalBackup", + align: "left", + label: "สำรอง", + sortable: true, + field: "totalBackup", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); const columns = computed(() => { const columnsss = store.roundMainCode === "APR" ? columnsAPR.value : store.roundMainCode === "OCT" ? columnsOCT.value - : []; + : columnsSpeciel.value; return columnsss; }); const visibleColumns = ref( @@ -270,9 +362,10 @@ const visibleColumns = ref( ); function fetchDataDashboard() { + showLoader(); const formData = { year: props?.year, - group: "", + group: "GROUP1", period: props?.roundFilter?.id, snapshot: props?.snapShot, }; @@ -294,10 +387,17 @@ function fetchDataDashboard() { itemsCardOCT.value[5].total = quota.remainingAmount; itemsCardOCT.value[6].total = quota.totalBackup; + itemsCardSpeciel.value[0].total = quota.total; + itemsCardSpeciel.value[1].total = quota.chosen; + itemsCardSpeciel.value[2].total = quota.totalBackup; + rows.value = res.data.result.salaryOrg; }) .catch((err) => { messageError($q, err); + }) + .finally(() => { + hideLoader(); }); } onMounted(() => { @@ -331,7 +431,16 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
- {{ item.total ? item.total.toLocaleString() : 0 }} + {{ + item.total + ? store.roundMainCode === "OCT" + ? item.total.toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : item.total + : 0 + }}
@@ -384,7 +493,7 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
- {{ col.value ? col.value : "-" }} + {{ col.value }}
diff --git a/src/modules/13_salary/components/SalaryLists/Dashboard.vue b/src/modules/13_salary/components/SalaryLists/Dashboard.vue index b2051636f..fb7719183 100644 --- a/src/modules/13_salary/components/SalaryLists/Dashboard.vue +++ b/src/modules/13_salary/components/SalaryLists/Dashboard.vue @@ -19,11 +19,11 @@ const props = defineProps({ roundFilter: Object, }); -const gruup = ref("ALL"); +const gruup = ref(""); const options = ref([ - { id: "ALL", name: "ทั้งหมด" }, - { id: "group1", name: "กลุ่ม 1" }, - { id: "group2", name: "กลุ่ม 2" }, + { id: "", name: "ทั้งหมด" }, + { id: "GROUP1", name: "กลุ่ม 1" }, + { id: "GROUP2", name: "กลุ่ม 2" }, ]); /** itemsCard*/ @@ -104,6 +104,26 @@ const itemsCardOCT = ref([ total: 0, }, ]); +const itemsCardSpeciel = ref([ + { + lable: "จำนวนคนทั้งหมด", + name: "group1", + color: "secondary", + total: 0, + }, + { + lable: "เลือกไปแล้ว", + name: "group2", + color: "primary", + total: 0, + }, + { + lable: "สำรอง", + name: "group2", + color: "red-6", + total: 0, + }, +]); const itemsCard = computed(() => { const items = @@ -111,7 +131,7 @@ const itemsCard = computed(() => { ? itemsCardAPR.value : store.roundMainCode === "OCT" ? itemsCardOCT.value - : []; + : itemsCardSpeciel.value; return items; }); @@ -191,6 +211,11 @@ const columnsOCT = ref([ field: "currentAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { @@ -201,6 +226,11 @@ const columnsOCT = ref([ field: "sixPercentAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { name: "spentAmount", @@ -210,6 +240,11 @@ const columnsOCT = ref([ field: "spentAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { name: "sixPercentSpentAmount", @@ -219,6 +254,11 @@ const columnsOCT = ref([ field: "sixPercentSpentAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { @@ -229,6 +269,11 @@ const columnsOCT = ref([ field: "useAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { name: "remainingAmount", @@ -238,6 +283,11 @@ const columnsOCT = ref([ field: "remainingAmount", headerStyle: "font-size: 14px", style: "font-size: 14px", + format: (v) => + Number(v).toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), }, { name: "totalBackup", @@ -249,13 +299,54 @@ const columnsOCT = ref([ style: "font-size: 14px", }, ]); +const columnsSpeciel = ref([ + { + name: "org", + align: "left", + label: "หน่วยงาน", + sortable: true, + field: "org", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "total", + align: "left", + label: "จำนวนคนทั้งหมด", + sortable: true, + field: "total", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + + { + name: "chosen", + align: "left", + label: "เลือกไปแล้ว", + sortable: true, + field: "chosen", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + + { + name: "totalBackup", + align: "left", + label: "สำรอง", + sortable: true, + field: "totalBackup", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); + const columns = computed(() => { const columnsss = store.roundMainCode === "APR" ? columnsAPR.value : store.roundMainCode === "OCT" ? columnsOCT.value - : []; + : columnsSpeciel.value; return columnsss; }); @@ -277,6 +368,7 @@ const visibleColumns = ref( ); function fetchDataDashboard() { + showLoader(); const formData = { year: props?.year, group: gruup.value, @@ -284,7 +376,7 @@ function fetchDataDashboard() { snapshot: props?.snapShot, }; http - .post(config.API.salaryDashboardEmp, formData) + .post(config.API.salaryDashboard, formData) .then((res) => { const quota = res.data.result.dashboard; itemsCardAPR.value[0].total = quota.total; @@ -301,10 +393,16 @@ function fetchDataDashboard() { itemsCardOCT.value[5].total = quota.remainingAmount; itemsCardOCT.value[6].total = quota.totalBackup; + itemsCardSpeciel.value[0].total = quota.total; + itemsCardSpeciel.value[1].total = quota.chosen; + itemsCardSpeciel.value[2].total = quota.totalBackup; rows.value = res.data.result.salaryOrg; }) .catch((err) => { messageError($q, err); + }) + .finally(() => { + hideLoader(); }); } @@ -353,7 +451,16 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
- {{ item.total ? item.total.toLocaleString() : 0 }} + {{ + item.total + ? store.roundMainCode === "OCT" + ? item.total.toLocaleString("en", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : item.total + : 0 + }}
@@ -405,7 +512,7 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
- {{ col.value ? col.value : "-" }} + {{ col.value }}
diff --git a/src/modules/13_salary/views/salaryEmployeeLists.vue b/src/modules/13_salary/views/salaryEmployeeLists.vue index a975ce0ad..7d462d9f1 100644 --- a/src/modules/13_salary/views/salaryEmployeeLists.vue +++ b/src/modules/13_salary/views/salaryEmployeeLists.vue @@ -455,6 +455,7 @@ onMounted(() => { class="row col-12 q-mt-xs" > { class="row col-12 q-mt-xs" >