ปรับ code => เงินเดือน/ค่าจ้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-30 16:21:27 +07:00
parent 068769e317
commit 72590f3ac9
9 changed files with 133 additions and 134 deletions

View file

@ -4,15 +4,24 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type {
DataOption,
ItemsCards,
} from "@/modules/13_salary/interface/index/Main";
import type { ResSalaryOrg } from "@/modules/13_salary/interface/response/SalaryList";
/** importStore*/
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore"; import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
/** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryListSDataStore(); const store = useSalaryListSDataStore();
const { messageError, showLoader, hideLoader } = useCounterMixin(); const { messageError, showLoader, hideLoader } = useCounterMixin();
/** props*/
const props = defineProps({ const props = defineProps({
year: Number, year: Number,
snapShot: String, snapShot: String,
@ -20,111 +29,110 @@ const props = defineProps({
}); });
const gruup = ref<string>(""); const gruup = ref<string>("");
const options = ref([ const options = ref<DataOption[]>([
{ id: "", name: "ทั้งหมด" }, { id: "", name: "ทั้งหมด" },
{ id: "GROUP1", name: "กลุ่ม 1" }, { id: "GROUP1", name: "กลุ่ม 1" },
{ id: "GROUP2", name: "กลุ่ม 2" }, { id: "GROUP2", name: "กลุ่ม 2" },
]); ]);
/** itemsCard*/ /** itemsCard*/
const itemsCardAPR = ref([ const itemsCardAPR = ref<ItemsCards[]>([
{ {
lable: "จำนวนคนทั้งหมด", label: "จำนวนคนทั้งหมด",
name: "group1", name: "group1",
color: "secondary", color: "secondary",
total: 0, total: 0,
}, },
{ {
lable: "15% ของจำนวนคน", label: "15% ของจำนวนคน",
name: "group2", name: "group2",
color: "light-blue-4", color: "light-blue-4",
total: 0, total: 0,
}, },
{ {
lable: "เลือกไปแล้ว", label: "เลือกไปแล้ว",
name: "group2", name: "group2",
color: "primary", color: "primary",
total: 0, total: 0,
}, },
{ {
lable: "คงเหลือโควตา", label: "คงเหลือโควตา",
name: "group2", name: "group2",
color: "indigo-6", color: "indigo-6",
total: 0, total: 0,
}, },
{ {
lable: "สำรอง", label: "สำรอง",
name: "group2", name: "group2",
color: "red-6", color: "red-6",
total: 0, total: 0,
}, },
]); ]);
const itemsCardOCT = ref([ const itemsCardOCT = ref<ItemsCards[]>([
{ {
lable: "จำนวนเงินคนครองปัจจุบัน", label: "จำนวนเงินคนครองปัจจุบัน",
name: "group1", name: "group1",
color: "secondary", color: "secondary",
total: 0, total: 0,
}, },
{ {
lable: "วงเงิน 6%", label: "วงเงิน 6%",
name: "group2", name: "group2",
color: "light-blue-4", color: "light-blue-4",
total: 0, total: 0,
}, },
{ {
lable: "ยอดเงินที่ใช้ไป", label: "ยอดเงินที่ใช้ไป",
name: "group2", name: "group2",
color: "primary", color: "primary",
total: 0, total: 0,
}, },
{ {
lable: "วงเงิน 6%-ยอดเงินที่ใช้ไป", label: "วงเงิน 6%-ยอดเงินที่ใช้ไป",
name: "group2", name: "group2",
color: "indigo-6", color: "indigo-6",
total: 0, total: 0,
}, },
{ {
lable: "ใช้ไปเท่าไหร่", label: "ใช้ไปเท่าไหร่",
name: "group2", name: "group2",
color: "blue-6", color: "blue-6",
total: 0, total: 0,
}, },
{ {
lable: "เหลือเท่าไหร่", label: "เหลือเท่าไหร่",
name: "group2", name: "group2",
color: "green-6", color: "green-6",
total: 0, total: 0,
}, },
{ {
lable: "สำรอง", label: "สำรอง",
name: "group2", name: "group2",
color: "red-6", color: "red-6",
total: 0, total: 0,
}, },
]); ]);
const itemsCardSpeciel = ref([ const itemsCardSpeciel = ref<ItemsCards[]>([
{ {
lable: "จำนวนคนทั้งหมด", label: "จำนวนคนทั้งหมด",
name: "group1", name: "group1",
color: "secondary", color: "secondary",
total: 0, total: 0,
}, },
{ {
lable: "เลือกไปแล้ว", label: "เลือกไปแล้ว",
name: "group2", name: "group2",
color: "primary", color: "primary",
total: 0, total: 0,
}, },
{ {
lable: "สำรอง", label: "สำรอง",
name: "group2", name: "group2",
color: "red-6", color: "red-6",
total: 0, total: 0,
}, },
]); ]);
const itemsCard = computed(() => { const itemsCard = computed(() => {
const items = const items =
store.roundMainCode === "APR" store.roundMainCode === "APR"
@ -135,7 +143,8 @@ const itemsCard = computed(() => {
return items; return items;
}); });
const rows = ref<any>([]); /** ข้อมูล Table*/
const rows = ref<ResSalaryOrg[]>([]);
const columnsAPR = ref<QTableProps["columns"]>([ const columnsAPR = ref<QTableProps["columns"]>([
{ {
name: "org", name: "org",
@ -351,7 +360,6 @@ const columnsSpeciel = ref<QTableProps["columns"]>([
format: (v) => Number(v).toLocaleString(), format: (v) => Number(v).toLocaleString(),
}, },
]); ]);
const columns = computed(() => { const columns = computed(() => {
const columnsss = const columnsss =
store.roundMainCode === "APR" store.roundMainCode === "APR"
@ -362,23 +370,7 @@ const columns = computed(() => {
return columnsss; return columnsss;
}); });
const visibleColumns = ref<string[]>( /** function fetch ข้อมูลสถิติ*/
store.roundMainCode === "APR"
? ["org", "total", "fifteenPercent", "chosen", "remaining", "totalBackup"]
: store.roundMainCode === "OCT"
? [
"org",
"currentAmount",
"sixPercentAmount",
"spentAmount",
"sixPercentSpentAmount",
"useAmount",
"remainingAmount",
"totalBackup",
]
: []
);
function fetchDataDashboard() { function fetchDataDashboard() {
showLoader(); showLoader();
const formData = { const formData = {
@ -435,6 +427,8 @@ function fetchDataDashboard() {
itemsCardSpeciel.value[0].total = quota.total; itemsCardSpeciel.value[0].total = quota.total;
itemsCardSpeciel.value[1].total = quota.chosen; itemsCardSpeciel.value[1].total = quota.chosen;
itemsCardSpeciel.value[2].total = quota.totalBackup; itemsCardSpeciel.value[2].total = quota.totalBackup;
console.log(res.data.result.salaryOrg);
rows.value = res.data.result.salaryOrg; rows.value = res.data.result.salaryOrg;
}) })
.catch((err) => { .catch((err) => {
@ -445,6 +439,7 @@ function fetchDataDashboard() {
}); });
} }
/** HookLifecycle*/
onMounted(() => { onMounted(() => {
fetchDataDashboard(); fetchDataDashboard();
}); });
@ -486,7 +481,7 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
<q-card-section> <q-card-section>
<div class="row items-center no-wrap"> <div class="row items-center no-wrap">
<div class="col"> <div class="col">
<div class="">{{ item.lable }}</div> <div class="">{{ item.label }}</div>
</div> </div>
<div :class="`text-${item.color} text-bold`"> <div :class="`text-${item.color} text-bold`">

View file

@ -141,7 +141,6 @@ function onClickAddPerson(data: DataPerson) {
type: store.tabType, type: store.tabType,
...data, ...data,
}; };
dialogConfirm( dialogConfirm(
$q, $q,
() => { () => {

View file

@ -63,15 +63,7 @@ const typeRangeOps = computed(() => {
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ /*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
function validateForm() { function validateForm() {
if (typeRef.value.validate()) { if (typeRef.value.validate()) {
// if (
// store.roundMainCode === "APR" &&
// store.remaining === 0 &&
// type.value === "FULL"
// ) {
// dialogMessageNotify($q, "");
// } else {
onSubmit(); onSubmit();
// }
} }
} }

View file

@ -62,9 +62,8 @@ const typeRangeOps = computed(() => {
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ /*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
function validateForm() { function validateForm() {
onSubmit(); onSubmit();
} }
/** function ปืด Popup */ /** function ปืด Popup */
function close() { function close() {
@ -77,10 +76,10 @@ function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
showLoader(); showLoader();
const body = { const body = {
isPunish: isPunish.value, isPunish: isPunish.value,
isSuspension: isSuspension.value, isSuspension: isSuspension.value,
isAbsent: isAbsent.value, isAbsent: isAbsent.value,
isLeave: isLeave.value, isLeave: isLeave.value,
}; };
http http
.put(config.API.salaryProperty(profileId.value), body) .put(config.API.salaryProperty(profileId.value), body)
@ -107,13 +106,6 @@ watch(
isLeave.value = props.isLeave; isLeave.value = props.isLeave;
} }
); );
function inputEdit(val: boolean) {
return {
"full-width cursor-pointer inputgreen ": val,
"full-width cursor-pointer inputgreen": !val,
};
}
</script> </script>
<template> <template>
@ -125,28 +117,28 @@ function inputEdit(val: boolean) {
<q-card-section class="scroll" style="max-height: 70vh"> <q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm column"> <div class="q-gutter-y-sm column">
<q-checkbox <q-checkbox
toggle-indeterminate toggle-indeterminate
keep-color keep-color
label="ไม่ถูกลงโทษทางวินัย" label="ไม่ถูกลงโทษทางวินัย"
dense dense
v-model="isPunish" v-model="isPunish"
/> />
<q-checkbox <q-checkbox
toggle-indeterminate toggle-indeterminate
keep-color keep-color
label="ไม่ถูกพักราชการ" label="ไม่ถูกพักราชการ"
dense dense
v-model="isSuspension" v-model="isSuspension"
/> />
<q-checkbox <q-checkbox
toggle-indeterminate toggle-indeterminate
keep-color keep-color
label="ไม่ขาดราชการ" label="ไม่ขาดราชการ"
dense dense
v-model="isAbsent" v-model="isAbsent"
/> />
<q-checkbox <q-checkbox
toggle-indeterminate toggle-indeterminate
keep-color keep-color
label="วันลาไม่เกิน" label="วันลาไม่เกิน"
dense dense
@ -157,7 +149,6 @@ function inputEdit(val: boolean) {
<q-separator /> <q-separator />
<form @submit.prevent="validateForm"> <form @submit.prevent="validateForm">
<q-card-actions align="right" class="bg-white text-teal"> <q-card-actions align="right" class="bg-white text-teal">
<!-- <q-btn flat label="OK" v-close-popup /> -->
<q-btn <q-btn
type="submit" type="submit"
for="#submitForm" for="#submitForm"

View file

@ -1,37 +1,50 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, defineProps,onMounted } from "vue"; import { ref, defineProps, onMounted } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import axios from "axios";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
const store = useSalaryListSDataStore();
import { useCounterMixin } from "@/stores/mixin";
import axios from "axios";
const modalRecommend = ref<boolean>(false); /** importComponents*/
const titleRecommend = ref<string>(""); import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //
const listFile = ref<any>([])
/** importStore*/
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import { useCounterMixin } from "@/stores/mixin";
/* use**/
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin(); const store = useSalaryListSDataStore();
const { messageError, dialogConfirm, showLoader, hideLoader, success,dialogRemove } = mixin; const {
const type = ref<string>(""); messageError,
const sendStep = ref<number>(1); dialogConfirm,
const fileUpload = ref<any>(null); showLoader,
const document = ref<string>(""); hideLoader,
success,
dialogRemove,
} = useCounterMixin();
/** props*/
const props = defineProps({ const props = defineProps({
rootId: String, rootId: String,
periodId: String, periodId: String,
getData: Function, getData: Function,
}); });
const modalRecommend = ref<boolean>(false);
const titleRecommend = ref<string>("");
const listFile = ref<any>([]);
const type = ref<string>("");
const sendStep = ref<number>(1);
const fileUpload = ref<any>(null);
const document = ref<string>("");
/** /**
* function ปโหลดไฟลเจาหนาท * function ปโหลดไฟลเจาหนาท
* @param event file * @param event file
*/ */
async function uploadFile(event: any) { async function uploadFile(event: any) {
const fileName = { fileName: event.name }; const fileName = { fileName: event.name };
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
@ -57,7 +70,8 @@ async function uploadFile(event: any) {
res.data[key]?.fileName !== undefined && res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== "" res.data[key]?.fileName !== ""
); );
foundKey && uploadfile(res.data[foundKey]?.uploadUrl, fileUpload.value); foundKey &&
uploadfile(res.data[foundKey]?.uploadUrl, fileUpload.value);
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -93,6 +107,7 @@ async function uploadfile(uploadUrl: string, file: any) {
}); });
} }
/** function fetchList ไฟล์*/
function getListFile() { function getListFile() {
http http
.get( .get(
@ -104,12 +119,11 @@ function getListFile() {
) )
) )
.then((res) => { .then((res) => {
listFile.value = res.data listFile.value = res.data;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) });
.finally(() => {});
} }
function saveReccommend(reason: string) { function saveReccommend(reason: string) {
@ -128,7 +142,7 @@ function saveReccommend(reason: string) {
titleRecommend: reason, titleRecommend: reason,
} }
) )
.then((res) => { .then(() => {
props.getData?.(); props.getData?.();
}) })
.catch((e) => { .catch((e) => {
@ -158,7 +172,7 @@ function sendToDirector(msg: string, type: string) {
props.rootId ? props.rootId : "" props.rootId ? props.rootId : ""
) )
) )
.then((res) => { .then(() => {
props.getData?.(); props.getData?.();
}) })
.catch((e) => { .catch((e) => {
@ -173,6 +187,10 @@ function sendToDirector(msg: string, type: string) {
); );
} }
/**
* function โหลดไฟล
* @param fileName อไฟล
*/
function downloadFile(fileName: string) { function downloadFile(fileName: string) {
showLoader(); showLoader();
http http
@ -197,6 +215,10 @@ function downloadFile(fileName: string) {
}); });
} }
/**
* function ลบไฟล
* @param fileName อไฟล
*/
function deleteFile(fileName: string) { function deleteFile(fileName: string) {
dialogRemove($q, () => { dialogRemove($q, () => {
showLoader(); showLoader();
@ -230,9 +252,9 @@ function sendAndRecommend(title: string, typeOrder: string) {
type.value = typeOrder; type.value = typeOrder;
} }
onMounted(()=>{ onMounted(() => {
getListFile() getListFile();
}) });
</script> </script>
<template> <template>

View file

@ -4,7 +4,6 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import genReportXLSX from "@/plugins/genreportxlsx"; import genReportXLSX from "@/plugins/genreportxlsx";
import DialogInfoCriteria from "@/modules/13_salary/components/SalaryLists/DialogInfoCriteria.vue";
/** importType*/ /** importType*/
import type { DataOption } from "@/modules/13_salary/interface/index/Main"; import type { DataOption } from "@/modules/13_salary/interface/index/Main";
@ -17,6 +16,7 @@ import type {
/** importComponents*/ /** importComponents*/
import TableTabType1 from "@/modules/13_salary/components/SalaryLists/TableTypePending.vue"; import TableTabType1 from "@/modules/13_salary/components/SalaryLists/TableTypePending.vue";
import TableTabType2 from "@/modules/13_salary/components/SalaryLists/TableTypeOther.vue"; import TableTabType2 from "@/modules/13_salary/components/SalaryLists/TableTypeOther.vue";
import DialogInfoCriteria from "@/modules/13_salary/components/SalaryLists/DialogInfoCriteria.vue";
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -64,11 +64,7 @@ const itemsTabType = computed(() => {
name: "tab1", name: "tab1",
type: "PENDING", type: "PENDING",
}, },
// {
// lable: "",
// name: "tab5",
// type: "RETIRE",
// },
{ {
lable: "1 ขั้น", lable: "1 ขั้น",
name: "tab2", name: "tab2",
@ -223,7 +219,6 @@ const maxPage = ref<number>(1);
* @param id กล * @param id กล
*/ */
function fetchDataQuota(id: string) { function fetchDataQuota(id: string) {
// showLoader();
http http
.get(config.API.salaryListPeriodQuota(id)) .get(config.API.salaryListPeriodQuota(id))
.then((res) => { .then((res) => {
@ -249,9 +244,6 @@ function fetchDataQuota(id: string) {
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
}); });
// .finally(() => {
// hideLoader();
// });
} }
/** /**

View file

@ -23,6 +23,13 @@ interface ItemsMenu {
type: string; type: string;
} }
interface ItemsCards {
label: string;
name: string;
color: string;
total: number;
}
interface FormData { interface FormData {
name: string; name: string;
posTypeId: string; posTypeId: string;
@ -47,4 +54,12 @@ interface FormSalaryRate {
isNext: boolean; isNext: boolean;
} }
export type { DataOption, NewPagination, ItemsMenu, DataOptionShort, FormData ,FormSalaryRate}; export type {
DataOption,
NewPagination,
ItemsMenu,
DataOptionShort,
FormData,
FormSalaryRate,
ItemsCards,
};

View file

@ -121,6 +121,22 @@ interface DataPeriod {
status: string; status: string;
type: string; type: string;
} }
interface ResSalaryOrg {
chosen: number;
currentAmount: number;
fifteenPercent: number;
org: string;
remaining: number;
remainingAmount: number;
sixPercentAmount: number;
sixPercentSpentAmount: number;
spentAmount: number;
total: number;
totalAmountSpecial: number;
totalBackup: number;
useAmount: number;
}
export type { export type {
DataPeriodLatest, DataPeriodLatest,
DataPeriodQuota, DataPeriodQuota,
@ -128,4 +144,5 @@ export type {
DataAgency, DataAgency,
DataPerson, DataPerson,
DataPeriod, DataPeriod,
ResSalaryOrg,
}; };

View file

@ -1,10 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, computed, nextTick } from "vue"; import { onMounted, ref, nextTick } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
import ProcessStep from "@/modules/13_salary/components/SalaryLists/ProcessStep.vue"; import ProcessStep from "@/modules/13_salary/components/SalaryLists/ProcessStep.vue";
import PageDashBoard from "@/modules/13_salary/components/SalaryLists/Dashboard.vue"; import PageDashBoard from "@/modules/13_salary/components/SalaryLists/Dashboard.vue";
/** importType*/ /** importType*/
import type { import type {
DataOption, DataOption,
@ -164,7 +165,6 @@ async function getAgency(id: string) {
name: x.orgRootName, name: x.orgRootName,
})) }))
); );
// agencyFilter.value = store.rootId;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -240,7 +240,6 @@ function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
// isLoad.value = true;
}) })
.finally(() => { .finally(() => {
setTimeout(() => { setTimeout(() => {
@ -259,7 +258,6 @@ async function onChangeRound() {
} }
getSnap(roundFilter.value.shortCode); getSnap(roundFilter.value.shortCode);
await getAgency(roundFilter.value.revisionId); await getAgency(roundFilter.value.revisionId);
// await getAgencyPosition(roundFilter.value.revisionId);
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
fetchSalalyPeriod( fetchSalalyPeriod(
agencyFilter.value, agencyFilter.value,
@ -288,7 +286,6 @@ async function onChangeSnap() {
/** function เปลี่ยนหน่วยงาน*/ /** function เปลี่ยนหน่วยงาน*/
async function onChangeAgency() { async function onChangeAgency() {
store.rootId = agencyFilter.value; store.rootId = agencyFilter.value;
if ( if (
agencyFilter.value !== "ALL" && agencyFilter.value !== "ALL" &&
roundFilter.value.id && roundFilter.value.id &&
@ -325,11 +322,11 @@ function onScroll({ to, ref }: { to: number; ref: any }) {
} }
} }
/** function fetch PeriodQuota*/
function getQuota() { function getQuota() {
http http
.get(config.API.salaryListPeriodQuota(store.groupId)) .get(config.API.salaryListPeriodQuota(store.groupId))
.then((res) => { .then((res) => {
console.log("q", res);
const data = res.data.result; const data = res.data.result;
store.statusQuota = data.status; store.statusQuota = data.status;
}) })
@ -338,8 +335,8 @@ function getQuota() {
}) })
.finally(() => {}); .finally(() => {});
} }
onMounted(async () => { onMounted(() => {
await getRound(); getRound();
}); });
</script> </script>
@ -445,25 +442,6 @@ onMounted(async () => {
/> />
</div> </div>
<!-- <q-card> -->
<!-- <q-tabs
v-model="tabMain"
dense
class="text-grey"
active-color="secondary"
indicator-color="secondary"
align="justify"
>
<q-tab
name="first_snapshot"
:label="store.titelPage === 'OCT' ? '1 มีนาคม' : '1 กันยายน'"
/>
<q-tab
name="two_snapshot"
:label="store.titelPage === 'OCT' ? '1 เมษายน' : '1 ตุลาคม'"
/>
</q-tabs>
<q-separator /> -->
<q-card flat bordered> <q-card flat bordered>
<div v-if="agencyFilter !== 'ALL'"> <div v-if="agencyFilter !== 'ALL'">
<TabGroup <TabGroup
@ -503,8 +481,6 @@ onMounted(async () => {
:get-data="getQuota" :get-data="getQuota"
/> />
</q-card> </q-card>
<!-- </q-card> -->
</template> </template>
<style lang="sass" scoped> <style lang="sass" scoped>