รายการเงินเดือน
This commit is contained in:
parent
9955bc4fe0
commit
42badd9978
3 changed files with 105 additions and 36 deletions
|
|
@ -11,33 +11,28 @@ import type { DataFilterPerson } from "@/modules/13_salary/interface/index/Salar
|
||||||
import type { DataPersonReq } from "@/modules/13_salary/interface/request/SalaryList";
|
import type { DataPersonReq } from "@/modules/13_salary/interface/request/SalaryList";
|
||||||
import type { DataPerson } from "@/modules/13_salary/interface/response/SalaryList";
|
import type { DataPerson } from "@/modules/13_salary/interface/response/SalaryList";
|
||||||
|
|
||||||
|
/** importComponents*/
|
||||||
import Header from "@/components/DialogHeader.vue";
|
import Header from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
/** importStore*/
|
/** importStore*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
|
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
|
||||||
|
|
||||||
const store = useSalaryListSDataStore();
|
/** use*/
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const {
|
const store = useSalaryListSDataStore();
|
||||||
date2Thai,
|
const { messageError, showLoader, hideLoader, dialogConfirm, success } =
|
||||||
dialogRemove,
|
useCounterMixin();
|
||||||
messageError,
|
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
dialogConfirm,
|
|
||||||
success,
|
|
||||||
} = useCounterMixin();
|
|
||||||
|
|
||||||
|
/** props*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
fetchData: {
|
fetchData: {
|
||||||
type: Function,
|
type: Function,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** Table*/
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "no",
|
name: "no",
|
||||||
|
|
@ -96,6 +91,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
]);
|
]);
|
||||||
const rows = ref<DataPerson[]>([]);
|
const rows = ref<DataPerson[]>([]);
|
||||||
|
|
||||||
|
/** ข้อมูุลค้นหา*/
|
||||||
const formFilter = reactive<DataFilterPerson>({
|
const formFilter = reactive<DataFilterPerson>({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
@ -103,10 +99,13 @@ const formFilter = reactive<DataFilterPerson>({
|
||||||
});
|
});
|
||||||
const maxPage = ref<number>(1);
|
const maxPage = ref<number>(1);
|
||||||
|
|
||||||
|
/** function close popup*/
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
|
formFilter.page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function เรียกรายชื่อ คนเลื่อนเงินเดือน*/
|
||||||
async function fetchListPerson() {
|
async function fetchListPerson() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
|
|
@ -125,6 +124,10 @@ async function fetchListPerson() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ยืนยันการเพิ่มคนเลื่อนเงินเดือน
|
||||||
|
* @param data ข้อมูลคนที่เพิ่ม
|
||||||
|
*/
|
||||||
async function onClickAddPerson(data: DataPerson) {
|
async function onClickAddPerson(data: DataPerson) {
|
||||||
const body: DataPersonReq = {
|
const body: DataPersonReq = {
|
||||||
id: store.groupId,
|
id: store.groupId,
|
||||||
|
|
@ -154,22 +157,24 @@ async function onClickAddPerson(data: DataPerson) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function updatePage*/
|
||||||
async function updatePagePagination() {
|
async function updatePagePagination() {
|
||||||
fetchListPerson();
|
fetchListPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function updatePageSize*/
|
||||||
function updatePageSizePagination(newPagination: NewPagination) {
|
function updatePageSizePagination(newPagination: NewPagination) {
|
||||||
console.log("teset");
|
|
||||||
|
|
||||||
formFilter.page = 1;
|
formFilter.page = 1;
|
||||||
formFilter.pageSize = newPagination.rowsPerPage;
|
formFilter.pageSize = newPagination.rowsPerPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function ค้นหาข้อมูลตาม keyword*/
|
||||||
function searchData() {
|
function searchData() {
|
||||||
formFilter.page = 1;
|
formFilter.page = 1;
|
||||||
fetchListPerson();
|
fetchListPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปิด Popup*/
|
||||||
watch(
|
watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
async () => {
|
async () => {
|
||||||
|
|
@ -179,6 +184,7 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปลี่ยน PageSize*/
|
||||||
watch(
|
watch(
|
||||||
() => formFilter.pageSize,
|
() => formFilter.pageSize,
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,38 @@ interface DataPeriodQuota {
|
||||||
remaining: number; //คงเหลือโควตาnumber
|
remaining: number; //คงเหลือโควตาnumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DataRound {
|
||||||
|
effectiveDate: string;
|
||||||
|
id: string;
|
||||||
|
isActive: boolean;
|
||||||
|
period: string;
|
||||||
|
revisionId: string;
|
||||||
|
status: string;
|
||||||
|
year: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DataAgency {
|
||||||
|
ancestorDNA: string;
|
||||||
|
createdAt: string;
|
||||||
|
createdFullName: string;
|
||||||
|
createdUserId: string;
|
||||||
|
id: string;
|
||||||
|
lastUpdateFullName: string;
|
||||||
|
lastUpdateUserId: string;
|
||||||
|
lastUpdatedAt: string;
|
||||||
|
orgChild1s: any[];
|
||||||
|
orgRevision: any[];
|
||||||
|
orgRevisionId: string;
|
||||||
|
orgRootCode: string;
|
||||||
|
orgRootFax: string;
|
||||||
|
orgRootName: string;
|
||||||
|
orgRootOrder: number;
|
||||||
|
orgRootPhoneEx: string;
|
||||||
|
orgRootPhoneIn: string;
|
||||||
|
orgRootRank: string;
|
||||||
|
orgRootShortName: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface DataPerson {
|
interface DataPerson {
|
||||||
amount: number;
|
amount: number;
|
||||||
child1: string;
|
child1: string;
|
||||||
|
|
@ -42,4 +74,10 @@ interface DataPerson {
|
||||||
root: string;
|
root: string;
|
||||||
rootId: string;
|
rootId: string;
|
||||||
}
|
}
|
||||||
export type { DataPeriodLatest, DataPeriodQuota, DataPerson };
|
export type {
|
||||||
|
DataPeriodLatest,
|
||||||
|
DataPeriodQuota,
|
||||||
|
DataRound,
|
||||||
|
DataAgency,
|
||||||
|
DataPerson,
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,51 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { DataPeriodLatest } from "@/modules/13_salary/interface/response/SalaryList";
|
|
||||||
import TabGroup from "@/modules/13_salary/components/SalaryLists/TabMain.vue";
|
|
||||||
|
|
||||||
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
|
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
|
||||||
|
/** importType*/
|
||||||
import type {
|
import type {
|
||||||
DataOption,
|
DataOption,
|
||||||
DataOptionShort,
|
DataOptionShort,
|
||||||
} from "@/modules/13_salary/interface/index/Main";
|
} from "@/modules/13_salary/interface/index/Main";
|
||||||
import config from "@/app.config";
|
import type {
|
||||||
import http from "@/plugins/http";
|
DataRound,
|
||||||
|
DataAgency,
|
||||||
|
DataPeriodLatest,
|
||||||
|
} from "@/modules/13_salary/interface/response/SalaryList";
|
||||||
|
|
||||||
|
/** importComponents*/
|
||||||
|
import TabGroup from "@/modules/13_salary/components/SalaryLists/TabMain.vue";
|
||||||
|
|
||||||
|
/** importStore*/
|
||||||
|
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useQuasar } from "quasar";
|
|
||||||
|
|
||||||
const { messageError, showLoader, hideLoader } = useCounterMixin();
|
|
||||||
|
|
||||||
|
/** use*/
|
||||||
const store = useSalaryListSDataStore();
|
const store = useSalaryListSDataStore();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
const { messageError, showLoader, hideLoader } = useCounterMixin();
|
||||||
|
|
||||||
|
/** ตัวแปร*/
|
||||||
const roundFilter = ref<any>();
|
const roundFilter = ref<any>();
|
||||||
const roundOptions = ref<DataOptionShort[]>([]);
|
const roundOptions = ref<DataOptionShort[]>([]);
|
||||||
const agencyFilter = ref<string>("");
|
const agencyFilter = ref<string>("");
|
||||||
const agencyOptions = ref<DataOption[]>();
|
const agencyOptions = ref<DataOption[]>();
|
||||||
const snapFilter = ref<string>("");
|
const snapFilter = ref<string>("");
|
||||||
const snapOptions = ref<DataOption[]>();
|
const snapOptions = ref<DataOption[]>();
|
||||||
// const tabMain = ref<string>("first_snapshot");
|
|
||||||
const periodLatest = ref<DataPeriodLatest>();
|
const periodLatest = ref<DataPeriodLatest>();
|
||||||
|
|
||||||
const isLoad = ref<boolean>(false);
|
const isLoad = ref<boolean>(false);
|
||||||
|
|
||||||
|
/**function เรียกข้อมูลรอบการขึ้นเงินเดือน*/
|
||||||
async function getRound() {
|
async function getRound() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.salaryPeriod() + `?page=1&pageSise=10&keyword=&year=0`)
|
.get(config.API.salaryPeriod() + `?page=1&pageSise=10&keyword=&year=0`)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result.data;
|
const data = res.data.result.data;
|
||||||
|
roundOptions.value = await data.map((x: DataRound) => ({
|
||||||
roundOptions.value = await data.map((x: any) => ({
|
|
||||||
id: x.id,
|
id: x.id,
|
||||||
revisionId: x.revisionId,
|
revisionId: x.revisionId,
|
||||||
shortCode: x.period,
|
shortCode: x.period,
|
||||||
|
|
@ -73,6 +82,7 @@ async function getRound() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function เรียกรอบ*/
|
||||||
function getSnap(code: string) {
|
function getSnap(code: string) {
|
||||||
snapOptions.value =
|
snapOptions.value =
|
||||||
code === "OCT"
|
code === "OCT"
|
||||||
|
|
@ -110,17 +120,19 @@ function getSnap(code: string) {
|
||||||
snapFilter.value = snapOptions.value[0].id;
|
snapFilter.value = snapOptions.value[0].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เรียกข้อมูลหน่ยวงาน
|
||||||
|
* @param id revisionId
|
||||||
|
*/
|
||||||
async function getAgency(id: string) {
|
async function getAgency(id: string) {
|
||||||
await http
|
await http
|
||||||
.get(config.API.activeOrganizationRootById(id))
|
.get(config.API.activeOrganizationRootById(id))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
|
agencyOptions.value = await data.map((x: DataAgency) => ({
|
||||||
agencyOptions.value = await data.map((x: any) => ({
|
|
||||||
id: x.id,
|
id: x.id,
|
||||||
name: x.orgRootName,
|
name: x.orgRootName,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
agencyFilter.value = store.rootId;
|
agencyFilter.value = store.rootId;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -128,13 +140,18 @@ async function getAgency(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เรียกข้อมูลหน่ยวงานปจุบัน
|
||||||
|
* @param id revisionId
|
||||||
|
*/
|
||||||
async function getAgencyPosition(id: string) {
|
async function getAgencyPosition(id: string) {
|
||||||
await http
|
await http
|
||||||
.get(config.API.keycloakPositionByid(id))
|
.get(config.API.keycloakPositionByid(id))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
|
|
||||||
const position = agencyOptions.value?.find(
|
const position = agencyOptions.value?.find(
|
||||||
(e: any) => e.id === data.rootId
|
(e: DataOption) => e.id === data.rootId
|
||||||
);
|
);
|
||||||
agencyFilter.value = position ? position.id : "";
|
agencyFilter.value = position ? position.id : "";
|
||||||
})
|
})
|
||||||
|
|
@ -143,12 +160,19 @@ async function getAgencyPosition(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param rootId id หน่วยงาน
|
||||||
|
* @param periodId id รอบการขึ้นเงินเดือน
|
||||||
|
* @param snap id รอบ
|
||||||
|
*/
|
||||||
async function fetchSalalyPeriod(
|
async function fetchSalalyPeriod(
|
||||||
rootId: string,
|
rootId: string,
|
||||||
periodId: string,
|
periodId: string,
|
||||||
snap: string
|
snap: string
|
||||||
) {
|
) {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
isLoad.value = false;
|
||||||
const body = {
|
const body = {
|
||||||
rootId: rootId,
|
rootId: rootId,
|
||||||
salaryPeriodId: periodId,
|
salaryPeriodId: periodId,
|
||||||
|
|
@ -157,12 +181,9 @@ async function fetchSalalyPeriod(
|
||||||
|
|
||||||
await http
|
await http
|
||||||
.post(config.API.salaryListPeriodLatest, body)
|
.post(config.API.salaryListPeriodLatest, body)
|
||||||
|
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
|
|
||||||
if (Object.values(data).includes(null)) {
|
if (Object.values(data).includes(null)) {
|
||||||
console.log("มีค่า null ในคุณสมบัติบางอย่าง");
|
|
||||||
isLoad.value = false;
|
isLoad.value = false;
|
||||||
} else {
|
} else {
|
||||||
data && store.fetchPeriodLatest(data, store.tabGroup);
|
data && store.fetchPeriodLatest(data, store.tabGroup);
|
||||||
|
|
@ -177,6 +198,8 @@ async function fetchSalalyPeriod(
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function เปลี่ยนรอบการขั้นเงินเดือน*/
|
||||||
async function onChangeRound() {
|
async function onChangeRound() {
|
||||||
await getSnap(roundFilter.value.shortCode);
|
await getSnap(roundFilter.value.shortCode);
|
||||||
await getAgency(roundFilter.value.revisionId);
|
await getAgency(roundFilter.value.revisionId);
|
||||||
|
|
@ -190,6 +213,7 @@ async function onChangeRound() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function เปลี่ยนรอบ*/
|
||||||
async function onChangeSnap() {
|
async function onChangeSnap() {
|
||||||
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
|
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
|
||||||
await fetchSalalyPeriod(
|
await fetchSalalyPeriod(
|
||||||
|
|
@ -200,6 +224,7 @@ async function onChangeSnap() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function เปลี่ยนหน่วยงาน*/
|
||||||
async function onChangeAgency() {
|
async function onChangeAgency() {
|
||||||
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
|
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
|
||||||
await fetchSalalyPeriod(
|
await fetchSalalyPeriod(
|
||||||
|
|
@ -210,8 +235,8 @@ async function onChangeAgency() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
getRound();
|
await getRound();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue