Refactoring code module 13_salary

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-20 18:09:26 +07:00
parent c9dd0202c6
commit 4af366c03b
43 changed files with 1215 additions and 1167 deletions

View file

@ -276,3 +276,5 @@ watch(
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>
<style scoped></style>

View file

@ -213,7 +213,7 @@ onBeforeMount(async () => {
<PopupHistory :modal="modalHistory" :close="onClickPopupHistory" :id="id" /> <PopupHistory :modal="modalHistory" :close="onClickPopupHistory" :id="id" />
</template> </template>
<style scoped> <style>
.q-stepper--vertical .q-stepper__step-inner { .q-stepper--vertical .q-stepper__step-inner {
padding: 0; padding: 0;
} }

View file

@ -44,7 +44,7 @@ const props = defineProps({
}, },
}); });
const salaryId = ref<string>(""); const salaryId = ref<string>(""); //id
const formData = reactive<FormData>({ const formData = reactive<FormData>({
name: "", //* name: "", //*
posTypeId: "", //* posTypeId: "", //*
@ -57,12 +57,13 @@ const formData = reactive<FormData>({
isSpecial: false, isSpecial: false,
}); });
const posType = ref<SalaryPosType[]>([]); const posType = ref<SalaryPosType[]>([]); //
const salaryPosTypeOptionMain = ref<DataOption[]>([]); const salaryPosTypeOptionMain = ref<DataOption[]>([]); //
const salaryPosTypeOption = ref<DataOption[]>([]); const salaryPosTypeOption = ref<DataOption[]>([]); //
const salaryPosLevelOptionMain = ref<DataOption[]>([]); const salaryPosLevelOptionMain = ref<DataOption[]>([]); //
const salaryPosLevelOption = ref<DataOption[]>([]); const salaryPosLevelOption = ref<DataOption[]>([]); //
// popup
const title = computed(() => { const title = computed(() => {
const name = const name =
props.typeAction === "add" props.typeAction === "add"
@ -150,7 +151,7 @@ watch(
() => modal.value, () => modal.value,
async () => { async () => {
if (modal.value) { if (modal.value) {
await fetchPosType(); fetchPosType();
if (props.typeAction === "edit" || props.typeAction === "view") { if (props.typeAction === "edit" || props.typeAction === "view") {
showLoader(); showLoader();

View file

@ -39,20 +39,21 @@ const props = defineProps({
}, },
}); });
const isReadonly = ref<boolean>(false); const salaryId = ref<string>(route.params.id.toString()); //id
const salaryId = ref<string>(route.params.id.toString()); const isReadonly = ref<boolean>(false); //
const formData = reactive<FormSalaryRate>({ const formData = reactive<FormSalaryRate>({
salaryId: "", salaryId: "",
salary: null, salary: null, //
salaryHalf: null, salaryHalf: null, // 0.5
salaryHalfSpecial: null, salaryHalfSpecial: null, //
salaryFull: null, salaryFull: null, // 1
salaryFullSpecial: null, salaryFullSpecial: null, //
salaryFullHalf: null, salaryFullHalf: null, // 1.5
salaryFullHalfSpecial: null, salaryFullHalfSpecial: null, //
isNext: false, isNext: false, //
}); });
// Popup
const title = computed(() => { const title = computed(() => {
const name = const name =
props.typeAction === "add" props.typeAction === "add"
@ -155,6 +156,17 @@ function onSubmit() {
}); });
} }
/**
* class ดรปแบบแสดงระหวางขอมลทแกไขหรอแสดงเฉยๆ
* @param val อม input สำหรบแกไขหรอไม
*/
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
/** callbackFunction ทำการ fetch ข้อมูลไฟล์เมื่อเปิด Dialog*/ /** callbackFunction ทำการ fetch ข้อมูลไฟล์เมื่อเปิด Dialog*/
watch( watch(
() => modal.value, () => modal.value,
@ -175,17 +187,6 @@ watch(
} }
} }
); );
/**
* class ดรปแบบแสดงระหวางขอมลทแกไขหรอแสดงเฉยๆ
* @param val อม input สำหรบแกไขหรอไม
*/
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
</script> </script>
<template> <template>

View file

@ -39,17 +39,6 @@ const props = defineProps({
}); });
const salaryId = ref<string>(""); const salaryId = ref<string>("");
const formData = reactive({
salaryType: "", //* (OFFICER->"",EMPLOYEE->"")
posTypeId: "", //*
posLevelId: "", //*
isActive: false, //*
date: null, //
startDate: null, //
endDate: null, //
details: "", //
isSpecial: false,
});
const documentFile = ref<any>(null); const documentFile = ref<any>(null);
const itemsDocument = ref<any>([]); const itemsDocument = ref<any>([]);
@ -58,12 +47,12 @@ const itemsDocument = ref<any>([]);
* function fetch อมลรายการ ไฟล * function fetch อมลรายการ ไฟล
* @param id ไฟล * @param id ไฟล
*/ */
function fetchDocumentFile(id: string) { async function fetchDocumentFile(id: string) {
showLoader(); showLoader();
http await http
.get(config.API.salaryChartFile(id)) .get(config.API.salaryChartFile(id))
.then((res) => { .then(async (res) => {
const list = res.data.map((e: any) => ({ name: e.fileName })); const list = await res.data.map((e: any) => ({ name: e.fileName }));
itemsDocument.value = list; itemsDocument.value = list;
}) })
.catch((err) => { .catch((err) => {
@ -79,22 +68,6 @@ function fetchDocumentFile(id: string) {
*/ */
function closeDialog() { function closeDialog() {
modal.value = !modal.value; modal.value = !modal.value;
clearFormData();
}
/**
* function เคลยขอม form*
*/
function clearFormData() {
formData.salaryType = "";
formData.posTypeId = "";
formData.posLevelId = "";
formData.isSpecial = false;
formData.isActive = false;
formData.date = null;
formData.startDate = null;
formData.endDate = null;
formData.details = "";
documentFile.value = null; documentFile.value = null;
itemsDocument.value = []; itemsDocument.value = [];
} }
@ -133,7 +106,7 @@ async function uploadDocumentFile() {
* function ปโหลดไฟล * function ปโหลดไฟล
* @param url link ปโหลด * @param url link ปโหลด
*/ */
function fileUpLoad(url: string) { async function fileUpLoad(url: string) {
axios axios
.put(url, documentFile.value, { .put(url, documentFile.value, {
headers: { "Content-Type": documentFile.value?.type }, headers: { "Content-Type": documentFile.value?.type },

View file

@ -43,11 +43,13 @@ const props = defineProps({
}, },
}); });
const isReadonly = ref<boolean>(false); //
/** form อัตราค่าจ้าง */ /** form อัตราค่าจ้าง */
const formData = reactive<FormDataRateEpm>({ const formData = reactive<FormDataRateEpm>({
salaryNo: null, salaryNo: null, //
salaryMonth: null, salaryMonth: null, /// ()
salaryDay: null, salaryDay: null, /// ()
}); });
/** function ปืด Dialog*/ /** function ปืด Dialog*/
@ -119,8 +121,6 @@ watch(
} }
); );
const isReadonly = ref<boolean>(false);
/** /**
* class ดรปแบบแสดงระหวางขอมลทแกไขหรอแสดงเฉยๆ * class ดรปแบบแสดงระหวางขอมลทแกไขหรอแสดงเฉยๆ
* @param val อม input สำหรบแกไขหรอไม * @param val อม input สำหรบแกไขหรอไม

View file

@ -89,8 +89,8 @@ async function uploadDocumentFile() {
* function ปโหลดไฟล * function ปโหลดไฟล
* @param url link ปโหลด * @param url link ปโหลด
*/ */
function fileUpLoad(url: string) { async function fileUpLoad(url: string) {
axios await axios
.put(url, documentFile.value, { .put(url, documentFile.value, {
headers: { "Content-Type": documentFile.value?.type }, headers: { "Content-Type": documentFile.value?.type },
onUploadProgress: (e) => console.log(e), onUploadProgress: (e) => console.log(e),
@ -118,7 +118,7 @@ function onClickDeleteFile(fileName: string) {
await http await http
.delete(config.API.salaryEmployeeChartDelFile(salaryId.value, fileName)) .delete(config.API.salaryEmployeeChartDelFile(salaryId.value, fileName))
.then(async () => { .then(async () => {
await setTimeout(async () => { setTimeout(async () => {
await fetchDocumentFile(salaryId.value); await fetchDocumentFile(salaryId.value);
await success($q, "ลบไฟล์สำเร็จ"); await success($q, "ลบไฟล์สำเร็จ");
}, 1500); }, 1500);

View file

@ -1,4 +1,3 @@
div
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, watch } from "vue"; import { ref, reactive, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
@ -33,15 +32,15 @@ const props = defineProps({
getDataMain: Function, getDataMain: Function,
}); });
const posTypeOp = ref<DataOptions[]>([]); const posTypeOp = ref<DataOptions[]>([]); //
const posTypeOpMain = ref<DataOptions[]>([]); const posTypeOpMain = ref<DataOptions[]>([]); //
const posNameOp = ref<DataOptions[]>([]); const posNameOp = ref<DataOptions[]>([]); //
const posNameOpMain = ref<DataOptions[]>([]); const posNameOpMain = ref<DataOptions[]>([]); //
const groupOldOp = ref<DataOptions[]>([]); const groupOldOp = ref<DataOptions[]>([]); //
const groupOldOpMain = ref<DataOptions[]>([]); const groupOldOpMain = ref<DataOptions[]>([]); //
const posLevelOp = ref<any[]>([]); const posLevelOp = ref<any[]>([]); //
const posNameListOp = ref<DataListOptions[]>([]); const posNameListOp = ref<DataListOptions[]>([]); //
const isReadonly = ref<boolean>(false); const isReadonly = ref<boolean>(false); //
const formData = reactive<any>({ const formData = reactive<any>({
id: "", id: "",
@ -265,23 +264,6 @@ function getDataEdit() {
}, 1500); }, 1500);
}); });
} }
watch(
() => modal.value,
(check) => {
if (check) {
getPosType();
getSalaryGroup();
if (isEdit.value) {
isReadonly.value = actionsType.value === "view" ? true : false;
formData.id = props.data?.id ? props.data.id : null;
getDataEdit();
} else {
isReadonly.value = false;
}
}
}
);
/** /**
* function นหาขอมลของ Option * function นหาขอมลของ Option
@ -289,7 +271,7 @@ watch(
* @param update พเดทค * @param update พเดทค
* @param refData ดาตาทองการฟลเตอร * @param refData ดาตาทองการฟลเตอร
*/ */
function filterOption(val: any, update: Function, type: string) { function filterOption(val: string, update: Function, type: string) {
switch (type) { switch (type) {
case "group": case "group":
update(() => { update(() => {
@ -330,6 +312,26 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; };
/**
* ทำงานเม modal เป true
*/
watch(
() => modal.value,
async (check) => {
if (check) {
await Promise.all([getPosType(), getSalaryGroup()]);
if (isEdit.value) {
isReadonly.value = actionsType.value === "view" ? true : false;
formData.id = props.data?.id ? props.data.id : null;
getDataEdit();
} else {
isReadonly.value = false;
}
}
}
);
</script> </script>
<template> <template>
@ -358,7 +360,7 @@ const getClass = (val: boolean) => {
outlined outlined
v-model="formData.posType" v-model="formData.posType"
label="กลุ่มงาน" label="กลุ่มงาน"
:rules="[(val) => !!val || 'กรุณาเลือกกลุ่มงาน']" :rules="[(val:string) => !!val || 'กรุณาเลือกกลุ่มงาน']"
:options="posTypeOp" :options="posTypeOp"
option-label="name" option-label="name"
option-value="id" option-value="id"
@ -387,7 +389,7 @@ const getClass = (val: boolean) => {
outlined outlined
v-model="formData.posName" v-model="formData.posName"
label="ตำแหน่ง" label="ตำแหน่ง"
:rules="[(val) => !!val || 'กรุณาเลือกตำแหน่ง']" :rules="[(val:string) => !!val || 'กรุณาเลือกตำแหน่ง']"
:options="posNameOp" :options="posNameOp"
option-label="name" option-label="name"
option-value="name" option-value="name"
@ -420,7 +422,7 @@ const getClass = (val: boolean) => {
option-value="id" option-value="id"
map-options map-options
label="ระดับชั้นงาน" label="ระดับชั้นงาน"
:rules="[(val) => !!val || 'กรุณาเลือกระดับชั้นงาน']" :rules="[(val:string) => !!val || 'กรุณาเลือกระดับชั้นงาน']"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
> >
@ -459,7 +461,7 @@ const getClass = (val: boolean) => {
mask="###,###,###,###,###,###,###,###" mask="###,###,###,###,###,###,###,###"
reverse-fill-mask reverse-fill-mask
:rules="[ :rules="[
(val) => !!val || `${'กรุณากรอกอัตราค่าจ้าง ขั้นต่ำสุด'}`, (val:string) => !!val || `${'กรุณากรอกอัตราค่าจ้าง ขั้นต่ำสุด'}`,
]" ]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
@ -476,7 +478,7 @@ const getClass = (val: boolean) => {
v-model="formData.groupOld" v-model="formData.groupOld"
label="กลุ่มของผังบัญชีอัตราค่าจ้าง" label="กลุ่มของผังบัญชีอัตราค่าจ้าง"
:rules="[ :rules="[
(val) => (val:string) =>
!!val || !!val ||
`${'กรุณาเลือกอัตราค่าจ้าง กลุ่มของผังบัญชีอัตราค่าจ้าง'}`, `${'กรุณาเลือกอัตราค่าจ้าง กลุ่มของผังบัญชีอัตราค่าจ้าง'}`,
]" ]"
@ -510,7 +512,7 @@ const getClass = (val: boolean) => {
mask="###,###,###,###,###,###,###,###" mask="###,###,###,###,###,###,###,###"
reverse-fill-mask reverse-fill-mask
:rules="[ :rules="[
(val) => !!val || `${'กรุณากรอกอัตราค่าจ้าง ขั้นสูงสุดเดิม'}`, (val:string) => !!val || `${'กรุณากรอกอัตราค่าจ้าง ขั้นสูงสุดเดิม'}`,
]" ]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
@ -530,7 +532,7 @@ const getClass = (val: boolean) => {
v-model="formData.groupRateHigh" v-model="formData.groupRateHigh"
label="กลุ่มบัญชีค่าจ้าง" label="กลุ่มบัญชีค่าจ้าง"
:rules="[ :rules="[
(val) => !!val || `${'กรุณากรอกเลือกกลุ่มบัญชีค่าจ้าง'}`, (val:string) => !!val || `${'กรุณากรอกเลือกกลุ่มบัญชีค่าจ้าง'}`,
]" ]"
lazy-rules lazy-rules
:options="groupOldOp" :options="groupOldOp"
@ -563,7 +565,7 @@ const getClass = (val: boolean) => {
mask="###,###,###,###,###,###,###,###" mask="###,###,###,###,###,###,###,###"
reverse-fill-mask reverse-fill-mask
:rules="[ :rules="[
(val) => !!val || `${'กรุณากรอกอัตราค่าจ้างขั้นสูงใหม่'}`, (val:string) => !!val || `${'กรุณากรอกอัตราค่าจ้างขั้นสูงใหม่'}`,
]" ]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space

View file

@ -18,7 +18,7 @@ import type {
import type { PosType } from "@/modules/13_salary/interface/response/salaryEmployeeChart"; import type { PosType } from "@/modules/13_salary/interface/response/salaryEmployeeChart";
/** importCompopnents*/ /** importCompopnents*/
import DialogFormCriteria from "@/modules/13_salary/components/salaryEmployeeChart/DialogFormCriteria.vue"; import DialogFormCriteria from "@/modules/13_salary/components/02_salaryEmployee/DialogFormCriteria.vue";
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -138,19 +138,21 @@ const formFilter = reactive({
pageSize: 10, pageSize: 10,
keyword: "", keyword: "",
}); });
const maxPage = ref<number>(1); //
const totalList = ref<number>(0); //
const modalForm = ref<boolean>(false); const modalForm = ref<boolean>(false); //Popup
const isStatusEdit = ref<boolean>(false); const isStatusEdit = ref<boolean>(false); //
const actionsType = ref<string>(""); const actionsType = ref<string>("");
const dataRow = ref<ListData>(); const dataRow = ref<ListData>(); //
const posTypeOpMain = ref<DataOption[]>([]); const posTypeOpMain = ref<DataOption[]>([]); //
const posTypeOp = ref<DataOption[]>([]); const posTypeOp = ref<DataOption[]>([]); //
const posType = ref<string | null>(""); const posType = ref<string | null>(""); //
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
/** ดึงข้อมูลกลุ่มงาน */ /**
* งขอมลกลมงาน
*/
function getPosType() { function getPosType() {
http http
.get(config.API.salaryEmployeePosType()) .get(config.API.salaryEmployeePosType())
@ -176,7 +178,9 @@ function getPosType() {
}); });
} }
/** ดึงข้อมูลรายการหลักเกณฑ์ */ /**
* งขอมลรายการหลกเกณฑ
*/
function getData() { function getData() {
showLoader(); showLoader();
http http
@ -229,7 +233,9 @@ function updatePage(val: number) {
getData(); getData();
} }
/** function อัปเดทแถวต่อหน้า*/ /**
* function ปเดทแถวตอหน
*/
function updatePageSize(newPagination: NewPagination) { function updatePageSize(newPagination: NewPagination) {
formFilter.page = 1; formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage; formFilter.pageSize = newPagination.rowsPerPage;
@ -271,7 +277,9 @@ function filterSelector(val: string, update: Function) {
}); });
} }
/** callbackFuntioon ทำงานเมื่อมี่การอัปเดทแถว */ /**
* callbackFuntioon ทำงานเมอมการอปเดทแถว
*/
watch( watch(
() => formFilter.pageSize, () => formFilter.pageSize,
() => { () => {
@ -279,7 +287,9 @@ watch(
} }
); );
/** functionn fetch ข้อมูลรายการหน้าแรก*/ /**
* functionn fetch อมลรายการหนาแรก
*/
function filterFn() { function filterFn() {
formFilter.page = 1; formFilter.page = 1;
getData(); getData();
@ -290,9 +300,8 @@ const pagination = ref({
rowsPerPage: formFilter.pageSize, rowsPerPage: formFilter.pageSize,
}); });
onMounted(() => { onMounted(async () => {
getData(); await Promise.all([getData(), getPosType()]);
getPosType();
}); });
</script> </script>

View file

@ -13,8 +13,8 @@ import type { FormFilter } from "@/modules/13_salary/interface/request/EmployeeC
import type { EmployeeSalary } from "@/modules/13_salary/interface/response/salaryEmployeeChart"; import type { EmployeeSalary } from "@/modules/13_salary/interface/response/salaryEmployeeChart";
/** importComponents*/ /** importComponents*/
import DialogEmployeeChart from "@/modules/13_salary/components/salaryEmployeeChart/DialogEmployeeChart.vue"; // import DialogEmployeeChart from "@/modules/13_salary/components/02_salaryEmployee/DialogEmployeeChart.vue"; //
import DialogEmployeeUpload from "@/modules/13_salary/components/salaryEmployeeChart/DialogEmployeeUpload.vue"; // import DialogEmployeeUpload from "@/modules/13_salary/components/02_salaryEmployee/DialogEmployeeUpload.vue"; //
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -32,20 +32,23 @@ const {
} = useCounterMixin(); } = useCounterMixin();
const formFilter = reactive<FormFilter>({ const formFilter = reactive<FormFilter>({
page: 1, page: 1, //*
pageSize: 10, pageSize: 10, //*
keyword: "", keyword: "", //keyword
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1); //
const totalList = ref<number>(0); const totalList = ref<number>(0); //
const modalDialogEmployeeChart = ref<boolean>(false); const modalDialogEmployeeChart = ref<boolean>(false); //popup
const isStatusEdit = ref<boolean>(false); const isStatusEdit = ref<boolean>(false); //
const activeType = ref<string>(""); const activeType = ref<string>(""); //
const dataRow = ref<EmployeeSalary>(); const dataRow = ref<EmployeeSalary>(); //
const modalDialogUpload = ref<boolean>(false); //popup
const salaryChartId = ref<string>(""); //id
const isActive = ref<boolean>(false); //
/** ข้อมูล Table*/ /** ข้อมูล Table*/
const rows = ref<EmployeeSalary[]>([]); const rows = ref<EmployeeSalary[]>([]); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "name", name: "name",
@ -94,9 +97,9 @@ const visibleColumns = ref<string[]>([
/** /**
* fetch แมลรายาการผงบญชาจางลกจางประจำ * fetch แมลรายาการผงบญชาจางลกจางประจำ
*/ */
function fetchListChart() { async function fetchListChart() {
showLoader(); showLoader();
http await http
.get( .get(
config.API.salaryEmployeeChart + config.API.salaryEmployeeChart +
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}` `?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}`
@ -125,10 +128,6 @@ function onEdit(data: EmployeeSalary, type: string) {
modalDialogEmployeeChart.value = true; modalDialogEmployeeChart.value = true;
} }
const modalDialogUpload = ref<boolean>(false);
const salaryChartId = ref<string>("");
const isActive = ref<boolean>(false);
/** /**
* function เป Dialog ปโหลดเอกสารอางอ * function เป Dialog ปโหลดเอกสารอางอ
* @param id งบญชาจางลกจางประจำ * @param id งบญชาจางลกจางประจำ
@ -455,20 +454,20 @@ onMounted(() => {
</template> </template>
</d-table> </d-table>
<!-- งบญชาจางลกจางประจำ -->
<DialogEmployeeChart
v-model:modal="modalDialogEmployeeChart"
:isStatusEdit="isStatusEdit"
:data="dataRow as EmployeeSalary"
:fetchData="fetchListChart"
:activeType="activeType"
/>
<!-- ปโหลดเอกสารอางอ --> <!-- ปโหลดเอกสารอางอ -->
<DialogEmployeeUpload <DialogEmployeeUpload
v-model:modal="modalDialogUpload" v-model:modal="modalDialogUpload"
:id="salaryChartId" :id="salaryChartId"
:isActive="isActive" :is-active="isActive"
/>
<!-- งบญชาจางลกจางประจำ -->
<DialogEmployeeChart
v-model:modal="modalDialogEmployeeChart"
:is-status-edit="isStatusEdit"
:active-type="activeType"
:fetch-data="fetchListChart"
:data="dataRow as EmployeeSalary"
/> />
</template> </template>

View file

@ -41,16 +41,19 @@ const props = defineProps({
isRead: Boolean, isRead: Boolean,
}); });
const period = ref<string>(""); const period = ref<string>(""); //
const isActive = ref<boolean>(false); const isActive = ref<boolean>(false); //
const effectiveDate = ref<Date | null>(null); const effectiveDate = ref<Date | null>(null); //
//
const typeOptions = ref<DataOption[]>([ const typeOptions = ref<DataOption[]>([
{ id: "SPECIAL", name: "รอบพิเศษ" }, { id: "SPECIAL", name: "รอบพิเศษ" },
{ id: "APR", name: "รอบเมษายน" }, { id: "APR", name: "รอบเมษายน" },
{ id: "OCT", name: "รอบตุลาคม" }, { id: "OCT", name: "รอบตุลาคม" },
]); ]);
/** function เคลียข้อมูล form*/ /**
* function เคลยขอม form
*/
function clearForm() { function clearForm() {
isActive.value = false; isActive.value = false;
period.value = ""; period.value = "";
@ -59,13 +62,17 @@ function clearForm() {
isRead.value = false; isRead.value = false;
} }
/** function ปืด Dialog*/ /**
* function Dialog
*/
function close() { function close() {
modal.value = false; modal.value = false;
clearForm(); clearForm();
} }
/** function บัยทึกข้อมูลรอบการขึ้นเงินเดือน*/ /**
* function ยทกขอมลรอบการขนเงนเดอน
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
@ -82,8 +89,7 @@ function onSubmit() {
await http[!props.edit ? "post" : "put"](url, body); await http[!props.edit ? "post" : "put"](url, body);
await props.getData?.(); await props.getData?.();
await success($q, "บันทีกข้อมูลสำเร็จ"); await success($q, "บันทีกข้อมูลสำเร็จ");
modal.value = false; close();
clearForm();
} catch (err) { } catch (err) {
messageError($q, err); messageError($q, err);
} finally { } finally {
@ -107,7 +113,9 @@ function onUpdatePeriod(val: string) {
} }
} }
/** callbackFunction ทำการ fetch ข้อมูลไฟล์เมื่อเปิด Dialog*/ /**
* callbackFunction ทำการ fetch อมลไฟลเมอเป Dialog
*/
watch( watch(
() => modal.value, () => modal.value,
() => { () => {
@ -244,20 +252,14 @@ watch(
</template> </template>
</datepicker> </datepicker>
<div class="col q-pa-sm bg-white border_custom text-weight-medium"> <div class="col q-pa-sm bg-white border_custom text-weight-medium">
<div class="row items-center q-my-sm justify-between"> <div class="row items-center justify-between">
<p class="q-ma-none">สถานะการใชงาน</p> <p class="q-ma-none">สถานะการใชงาน</p>
<label <label>
:class=" <q-toggle
isRead == true ? 'toggle-control noClick' : 'toggle-control'
"
>
<input
type="checkbox"
v-model="isActive" v-model="isActive"
:disable="period === 'SPECIAL' || isRead"
:readonly="isRead" :readonly="isRead"
:disabled="period === 'SPECIAL'"
/> />
<span class="control"></span>
</label> </label>
</div> </div>
</div> </div>
@ -279,71 +281,4 @@ watch(
border-radius: 6px !important; border-radius: 6px !important;
border: 1px solid #e1e1e1; border: 1px solid #e1e1e1;
} }
$toggle-background-color-on: #06884d;
$toggle-background-color-off: darkgray;
$toggle-control-color: white;
$toggle-width: 40px;
$toggle-height: 25px;
$toggle-gutter: 3px;
$toggle-radius: 50%;
$toggle-control-speed: 0.15s;
$toggle-control-ease: ease-in;
// These are our computed variables
// change at your own risk.
$toggle-radius: $toggle-height / 2;
$toggle-control-size: $toggle-height - ($toggle-gutter * 2);
.toggle-control {
display: block;
position: relative;
padding-left: $toggle-width;
margin-bottom: 12px;
cursor: pointer;
font-size: 22px;
user-select: none;
input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
input:checked ~ .control {
background-color: $toggle-background-color-on;
&:after {
left: $toggle-width - $toggle-control-size - $toggle-gutter;
}
}
.control {
position: absolute;
top: -7px;
left: -15px;
height: $toggle-height;
width: $toggle-width;
border-radius: $toggle-radius;
background-color: $toggle-background-color-off;
transition: background-color $toggle-control-speed $toggle-control-ease;
&:after {
content: "";
position: absolute;
left: $toggle-gutter;
top: $toggle-gutter;
width: $toggle-control-size;
height: $toggle-control-size;
border-radius: $toggle-radius;
background: $toggle-control-color;
transition: left $toggle-control-speed $toggle-control-ease;
}
}
}
.noClick {
pointer-events: none;
}
</style> </style>

View file

@ -1,8 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, computed, watch } from "vue"; import { ref, onMounted, computed, watch } from "vue";
import { useQuasar } from "quasar"; 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 { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import { useCounterMixin } from "@/stores/mixin";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
@ -13,8 +16,6 @@ import type {
import type { ResSalaryOrg } from "@/modules/13_salary/interface/response/SalaryList"; import type { ResSalaryOrg } from "@/modules/13_salary/interface/response/SalaryList";
/** importStore*/ /** importStore*/
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
@ -145,6 +146,7 @@ const itemsCard = computed(() => {
/** ข้อมูล Table*/ /** ข้อมูล Table*/
const rows = ref<ResSalaryOrg[]>([]); const rows = ref<ResSalaryOrg[]>([]);
const filter = ref<string>("");
const columnsAPR = ref<QTableProps["columns"]>([ const columnsAPR = ref<QTableProps["columns"]>([
{ {
name: "org", name: "org",
@ -385,10 +387,11 @@ const columns = computed(() => {
: columnsSpeciel.value; : columnsSpeciel.value;
return columnsss; return columnsss;
}); });
const filter = ref<string>("");
/** function fetch ข้อมูลสถิติ*/ /**
function fetchDataDashboard() { * function fetch อมลสถ
*/
async function fetchDataDashboard() {
showLoader(); showLoader();
const formData = { const formData = {
year: props?.year, year: props?.year,
@ -396,10 +399,10 @@ function fetchDataDashboard() {
period: props?.roundFilter?.id, period: props?.roundFilter?.id,
snapshot: props?.snapShot, snapshot: props?.snapShot,
}; };
http await http
.post(config.API.salaryDashboard, formData) .post(config.API.salaryDashboard, formData)
.then((res) => { .then(async (res) => {
const quota = res.data.result.dashboard; const quota = await res.data.result.dashboard;
itemsCardAPR.value[0].total = quota.total; itemsCardAPR.value[0].total = quota.total;
itemsCardAPR.value[1].total = quota.fifteenPercent.toLocaleString("en", { itemsCardAPR.value[1].total = quota.fifteenPercent.toLocaleString("en", {
minimumFractionDigits: 2, minimumFractionDigits: 2,

View file

@ -1,6 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, watch } from "vue"; import { ref, reactive, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -14,10 +17,6 @@ import type { DataPerson } from "@/modules/13_salary/interface/response/SalaryLi
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryListSDataStore(); const store = useSalaryListSDataStore();
@ -33,6 +32,7 @@ const props = defineProps({
}); });
/** Table*/ /** Table*/
const rows = ref<DataPerson[]>([]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -89,8 +89,6 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
const rows = ref<DataPerson[]>([]);
/** ข้อมูุลค้นหา*/ /** ข้อมูุลค้นหา*/
const formFilter = reactive<DataFilterPerson>({ const formFilter = reactive<DataFilterPerson>({
page: 1, page: 1,
@ -102,14 +100,18 @@ const formFilter = reactive<DataFilterPerson>({
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
/** function close popup*/ /**
* function close popup
*/
function closeModal() { function closeModal() {
modal.value = false; modal.value = false;
formFilter.page = 1; formFilter.page = 1;
formFilter.keyword = ""; formFilter.keyword = "";
} }
/** function เรียกรายชื่อ คนเลื่อนเงินเดือน*/ /**
* function เรยกรายช คนเลอนเงนเดอน
*/
function fetchListPerson() { function fetchListPerson() {
showLoader(); showLoader();
formFilter.rootId = store.rootId; formFilter.rootId = store.rootId;
@ -164,24 +166,32 @@ function onClickAddPerson(data: DataPerson) {
); );
} }
/** function updatePage*/ /**
* function updatePage
*/
async function updatePagePagination() { async function updatePagePagination() {
fetchListPerson(); fetchListPerson();
} }
/** function updatePageSize*/ /**
* function updatePageSize
*/
function updatePageSizePagination(newPagination: NewPagination) { function updatePageSizePagination(newPagination: NewPagination) {
formFilter.page = 1; formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage; formFilter.pageSize = newPagination.rowsPerPage;
} }
/** function ค้นหาข้อมูลตาม keyword*/ /**
* function นหาขอมลตาม keyword
*/
function searchData() { function searchData() {
formFilter.page = 1; formFilter.page = 1;
fetchListPerson(); fetchListPerson();
} }
/** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปิด Popup*/ /**
* callblack function เรยกขอมลรายชอคนเลอนเงนเดอน เมอมการเป Popup
*/
watch( watch(
() => modal.value, () => modal.value,
() => { () => {
@ -191,7 +201,9 @@ watch(
} }
); );
/** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปลี่ยน PageSize*/ /**
* callblack function เรยกขอมลรายชอคนเลอนเงนเดอน เมอมการเปลยน PageSize
*/
watch( watch(
() => formFilter.pageSize, () => formFilter.pageSize,
() => { () => {

View file

@ -1,15 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
@ -25,24 +23,19 @@ const props = defineProps({
}, },
}); });
const amountRef = ref<any>(); /**
* function Popup
/** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ */
function validateForm() {
if (amountRef.value.validate()) {
onSubmit();
}
}
/** function ปืด Popup */
function close() { function close() {
modal.value = false; modal.value = false;
amount.value = null; amount.value = null;
} }
/** function ยืนยันการบันทึกข้อมูล*/ /**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
if (amount.value !== null) { if (amount.value !== null) {
showLoader(); showLoader();
const amountString: string = amount.value.toString(); const amountString: string = amount.value.toString();
@ -53,7 +46,7 @@ function onSubmit() {
? amount.value ? amount.value
: Number(amountString.replace(/,/g, "")), : Number(amountString.replace(/,/g, "")),
}; };
http await http
.post(config.API.salaryPeriod() + `/change/amount`, body) .post(config.API.salaryPeriod() + `/change/amount`, body)
.then(async () => { .then(async () => {
await props.fetchData?.(); await props.fetchData?.();
@ -74,28 +67,29 @@ function onSubmit() {
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 30%"> <q-card class="col-12" style="width: 30%">
<Header :tittle="`แก้ไขเงินเดือน`" :close="close" /> <q-form greedy @submit.prevent @validation-success="onSubmit">
<q-separator /> <Header :tittle="`แก้ไขเงินเดือน`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm">
<q-input
ref="amountRef"
dense
outlined
v-model="amount"
label="เงินเดือนฐาน"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val) => !!val || `${'กรุณากรอกเงินเดือนฐาน'}`]"
lazy-rules
hide-bottom-space
class="inputgreen"
/>
</div>
</q-card-section>
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm">
<q-input
ref="amountRef"
dense
outlined
v-model="amount"
label="เงินเดือนฐาน"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val) => !!val || `${'กรุณากรอกเงินเดือนฐาน'}`]"
lazy-rules
hide-bottom-space
class="inputgreen"
/>
</div>
</q-card-section>
<q-separator />
<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 <q-btn
type="submit" type="submit"
@ -104,7 +98,7 @@ function onSubmit() {
label="บันทึก" label="บันทึก"
/> />
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -1,10 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const separator = ref<any>("cell"); const separator = ref<any>("cell");
/** ปิด Dialog */ /**
* Dialog
*/
function closeDialog() { function closeDialog() {
modal.value = !modal.value; modal.value = !modal.value;
} }

View file

@ -1,16 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, defineModel, watch } from "vue"; import { ref, defineModel, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryListSDataStore(); const store = useSalaryListSDataStore();
@ -28,32 +27,28 @@ const props = defineProps({
}); });
/** ตัวแปร*/ /** ตัวแปร*/
const group = ref<string>(""); const group = ref<string>(""); //
const groupRef = ref<any>(null);
const isReadonly = ref<boolean>(false); // const isReadonly = ref<boolean>(false); //
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ /**
function validateForm() { * function Popup
if (groupRef.value.validate()) { */
onSubmit();
}
}
/** function ปืด Popup */
function close() { function close() {
modal.value = false; modal.value = false;
group.value = ""; group.value = "";
} }
/** function ยืนยันการบันทึกข้อมูล*/ /**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
const body = { const body = {
profileId: profileId.value, profileId: profileId.value,
groupId: group.value, groupId: group.value,
}; };
http await http
.post(config.API.salaryPeriod() + `/change/group`, body) .post(config.API.salaryPeriod() + `/change/group`, body)
.then(async () => { .then(async () => {
await props.fetchData?.(); await props.fetchData?.();
@ -90,32 +85,33 @@ function inputEdit(val: boolean) {
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 30%"> <q-card class="col-12" style="width: 30%">
<Header :tittle="`ย้ายกลุ่ม`" :close="close" /> <q-form greedy @submit.prevent @validation-success="onSubmit">
<q-separator /> <Header :tittle="`ย้ายกลุ่ม`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh"> <q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<q-select <q-select
ref="groupRef" ref="groupRef"
:class="inputEdit(isReadonly)" :class="inputEdit(isReadonly)"
v-model="group" v-model="group"
label="กลุ่ม" label="กลุ่ม"
dense dense
outlined outlined
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
option-value="id" option-value="id"
:options="store.groupOp.filter((e) => e.name !== props.group)" :options="store.groupOp.filter((e) => e.name !== props.group)"
:rules="[(val) => !!val || `${'กรุณากลุ่ม'}`]" :rules="[(val:string) => !!val || `${'กรุณากลุ่ม'}`]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
/> />
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<form @submit.prevent="validateForm">
<q-card-actions align="right" class="bg-white text-teal"> <q-card-actions align="right">
<q-btn <q-btn
type="submit" type="submit"
for="#submitForm" for="#submitForm"
@ -123,7 +119,7 @@ function inputEdit(val: boolean) {
label="บันทึก" label="บันทึก"
/> />
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -1,27 +1,20 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch } from "vue"; import { ref, computed, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryListSDataStore(); const store = useSalaryListSDataStore();
const { const { dialogConfirm, success, messageError, showLoader, hideLoader } =
dialogConfirm, useCounterMixin();
success,
messageError,
showLoader,
hideLoader,
dialogMessageNotify,
} = useCounterMixin();
/**porps*/ /**porps*/
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
@ -35,9 +28,8 @@ const props = defineProps({
}, },
}); });
const type = ref<string>(""); const type = ref<string>(""); //
const note = ref<string>(""); const note = ref<string>(""); //
const typeRef = ref<any>(null);
const isReadonly = ref<boolean>(false); // const isReadonly = ref<boolean>(false); //
const isChange = ref<boolean>(false); // const isChange = ref<boolean>(false); //
const isReserve = ref<boolean>(false); // const isReserve = ref<boolean>(false); //
@ -62,22 +54,19 @@ const typeRangeOps = computed(() => {
]; ];
}); });
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ /**
function validateForm() { * function Popup
if (typeRef.value.validate()) { */
onSubmit();
}
}
/** function ปืด Popup */
function close() { function close() {
modal.value = false; modal.value = false;
type.value = ""; type.value = "";
} }
/** function ยืนยันการบันทึกข้อมูล*/ /**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
const body = { const body = {
profileId: profileId.value, profileId: profileId.value,
@ -85,7 +74,7 @@ function onSubmit() {
isReserve: isReserve.value, isReserve: isReserve.value,
remark: type.value === "NONE" ? note.value : undefined, remark: type.value === "NONE" ? note.value : undefined,
}; };
http await http
.post(config.API.salaryPeriod() + `/change/type`, body) .post(config.API.salaryPeriod() + `/change/type`, body)
.then(async () => { .then(async () => {
await props.fetchData?.(); await props.fetchData?.();
@ -101,80 +90,81 @@ function onSubmit() {
}); });
} }
/**
* function เปลยนระด
*/
function chengType() { function chengType() {
note.value = props.typeLevel === "NONE" ? props.remark : ""; note.value = props.typeLevel === "NONE" ? props.remark : "";
} }
watch(
() => modal.value,
() => {
console.log(props.remark);
type.value = props.typeLevel == "PENDING" ? "" : props.typeLevel;
note.value = props.typeLevel === "NONE" ? props.remark : "";
isReserve.value = props.isReserve;
isChange.value = false;
}
);
function inputEdit(val: boolean) { function inputEdit(val: boolean) {
return { return {
"full-width cursor-pointer inputgreen ": val, "full-width cursor-pointer inputgreen ": val,
"full-width cursor-pointer inputgreen": !val, "full-width cursor-pointer inputgreen": !val,
}; };
} }
watch(
() => modal.value,
() => {
type.value = props.typeLevel == "PENDING" ? "" : props.typeLevel;
note.value = props.typeLevel === "NONE" ? props.remark : "";
isReserve.value = props.isReserve;
isChange.value = false;
}
);
</script> </script>
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 30%"> <q-card class="col-12" style="width: 30%">
<Header :tittle="`เลื่อนขั้น`" :close="close" /> <q-form greedy @submit.prevent @validation-success="onSubmit">
<q-separator /> <Header :tittle="`เลื่อนขั้น`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh"> <q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<q-select <q-select
ref="typeRef" ref="typeRef"
:class="inputEdit(isReadonly)" :class="inputEdit(isReadonly)"
v-model="type" v-model="type"
label="เลื่อนขั้น" label="เลื่อนขั้น"
dense dense
outlined outlined
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
option-value="id" option-value="id"
:options="typeRangeOps" :options="typeRangeOps"
:rules="[(val) => !!val || `${'กรุณาเลือก ขั้น'}`]" :rules="[(val) => !!val || `${'กรุณาเลือก ขั้น'}`]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
@update:model-value="(isChange = true), chengType()" @update:model-value="(isChange = true), chengType()"
/> />
<q-checkbox <q-checkbox
v-if="type === 'FULL'" v-if="type === 'FULL'"
keep-color keep-color
label="สำรอง" label="สำรอง"
dense dense
v-model="isReserve" v-model="isReserve"
@update:model-value="isChange = true" @update:model-value="isChange = true"
/> />
<q-input <q-input
v-if="type === 'NONE'" v-if="type === 'NONE'"
outlined outlined
dense dense
v-model="note" v-model="note"
label="หมายเหตุ" label="หมายเหตุ"
type="textarea" type="textarea"
:class="inputEdit(isReadonly)" :class="inputEdit(isReadonly)"
@update:model-value="isChange = true" @update:model-value="isChange = true"
/> />
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<form @submit.prevent="validateForm"> <q-card-actions align="right">
<q-card-actions align="right" class="bg-white text-teal">
<q-btn <q-btn
:disabled="!isChange" :disabled="!isChange"
type="submit" type="submit"
@ -183,7 +173,7 @@ function inputEdit(val: boolean) {
label="บันทึก" label="บันทึก"
/> />
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -1,27 +1,20 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch } from "vue"; import { ref, watch } from "vue";
import { useQuasar } from "quasar"; 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 { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryListSDataStore(); const store = useSalaryListSDataStore();
const { const { dialogConfirm, success, messageError, showLoader, hideLoader } =
dialogConfirm, useCounterMixin();
success,
messageError,
showLoader,
hideLoader,
dialogMessageNotify,
} = useCounterMixin();
/**porps*/ /**porps*/
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
@ -37,41 +30,24 @@ const props = defineProps({
}); });
const type = ref<string>(""); const type = ref<string>("");
const isPunish = ref<boolean>(false); // const isPunish = ref<boolean>(false); //
const isSuspension = ref<boolean>(false); // const isSuspension = ref<boolean>(false); //
const isAbsent = ref<boolean>(false); // const isAbsent = ref<boolean>(false); //
const isLeave = ref<boolean>(false); // const isLeave = ref<boolean>(false); //
const typeRangeOps = computed(() => { /**
return store.roundMainCode == "OCT" * function Popup
? [ */
{ id: "NONE", name: "ไม่ได้เลื่อน" },
{ id: "HAFT", name: "0.5 ขั้น" },
{ id: "FULL", name: "1 ขั้น" },
{ id: "FULLHAFT", name: "1.5 ขั้น" },
]
: [
{ id: "NONE", name: "ไม่ได้เลื่อน" },
{ id: "HAFT", name: "0.5 ขั้น" },
{ id: "FULL", name: "1 ขั้น" },
];
});
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
function validateForm() {
onSubmit();
}
/** function ปืด Popup */
function close() { function close() {
modal.value = false; modal.value = false;
type.value = ""; type.value = "";
} }
/** function ยืนยันการบันทึกข้อมูล*/ /**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
const body = { const body = {
isPunish: isPunish.value, isPunish: isPunish.value,
@ -79,7 +55,7 @@ function onSubmit() {
isAbsent: isAbsent.value, isAbsent: isAbsent.value,
isLeave: isLeave.value, isLeave: isLeave.value,
}; };
http await http
.put(config.API.salaryProperty(profileId.value), body) .put(config.API.salaryProperty(profileId.value), body)
.then(async () => { .then(async () => {
await props.fetchData?.(); await props.fetchData?.();
@ -111,34 +87,40 @@ watch(
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 20%"> <q-card class="col-12" style="width: 20%">
<Header :tittle="`แก้ไขคุณสมบัติ`" :close="close" /> <q-form greedy @submit.prevent @validation-success="onSubmit">
<q-separator /> <Header :tittle="`แก้ไขคุณสมบัติ`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm column">
<q-checkbox
keep-color
label="ไม่ถูกลงโทษทางวินัย"
dense
v-model="isPunish"
/>
<q-checkbox
keep-color
label="ไม่ถูกพักราชการ"
dense
v-model="isSuspension"
/>
<q-checkbox
keep-color
label="ไม่ขาดราชการ"
dense
v-model="isAbsent"
/>
<q-checkbox
keep-color
label="วันลาไม่เกิน"
dense
v-model="isLeave"
/>
</div>
</q-card-section>
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm column">
<q-checkbox
keep-color
label="ไม่ถูกลงโทษทางวินัย"
dense
v-model="isPunish"
/>
<q-checkbox
keep-color
label="ไม่ถูกพักราชการ"
dense
v-model="isSuspension"
/>
<q-checkbox
keep-color
label="ไม่ขาดราชการ"
dense
v-model="isAbsent"
/>
<q-checkbox keep-color label="วันลาไม่เกิน" dense v-model="isLeave" />
</div>
</q-card-section>
<q-separator />
<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 <q-btn
type="submit" type="submit"
@ -147,7 +129,7 @@ watch(
label="บันทึก" label="บันทึก"
/> />
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -1,8 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import axios from "axios"; import axios from "axios";
import { checkPermission } from "@/utils/permissions";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
@ -10,8 +13,6 @@ import config from "@/app.config";
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; // import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //
/** importStore*/ /** importStore*/
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import { useCounterMixin } from "@/stores/mixin";
/* use**/ /* use**/
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
@ -32,13 +33,13 @@ const props = defineProps({
getData: Function, getData: Function,
}); });
const modalRecommend = ref<boolean>(false); const modalRecommend = ref<boolean>(false); //popup
const titleRecommend = ref<string>(""); const titleRecommend = ref<string>(""); // Popup
const listFile = ref<any>([]); const listFile = ref<any[]>([]); //
const type = ref<string>(""); const type = ref<string>(""); //
const sendStep = ref<number>(1); const sendStep = ref<number>(1);
const fileUpload = ref<any>(null); const fileUpload = ref<any>(null); //
const document = ref<string>(""); const document = ref<string>(""); //
/** /**
* function ปโหลดไฟลเจาหนาท * function ปโหลดไฟลเจาหนาท
@ -112,10 +113,10 @@ function uploadfile(uploadUrl: string, file: any) {
} }
/** /**
* fetchList ไฟล * fetch รายการไฟล
*/ */
function getListFile() { async function getListFile() {
http await http
.get( .get(
config.API.subFile( config.API.subFile(
"ระบบเงินเดือน", "ระบบเงินเดือน",

View file

@ -15,9 +15,9 @@ import type {
} from "@/modules/13_salary/interface/response/SalaryList"; } from "@/modules/13_salary/interface/response/SalaryList";
/** importComponents*/ /** importComponents*/
import TableTabType1 from "@/modules/13_salary/components/SalaryLists/TableTypePending.vue"; import TableTabType1 from "@/modules/13_salary/components/04_salaryLists/TableTypePending.vue";
import TableTabType2 from "@/modules/13_salary/components/SalaryLists/TableTypeOther.vue"; import TableTabType2 from "@/modules/13_salary/components/04_salaryLists/TableTypeOther.vue";
import DialogInfoCriteria from "@/modules/13_salary/components/SalaryLists/DialogInfoCriteria.vue"; import DialogInfoCriteria from "@/modules/13_salary/components/04_salaryLists/DialogInfoCriteria.vue";
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";

View file

@ -11,10 +11,10 @@ import type { NewPagination } from "@/modules/13_salary/interface/index/Main";
import type { DataFilter } from "@/modules/13_salary/interface/index/SalaryList"; import type { DataFilter } from "@/modules/13_salary/interface/index/SalaryList";
/** importComponents*/ /** importComponents*/
import DialogAddPerson from "@/modules/13_salary/components/SalaryLists//DialogAddPerson.vue"; import DialogAddPerson from "@/modules/13_salary/components/04_salaryLists//DialogAddPerson.vue";
import DialogFormEdit from "@/modules/13_salary/components/SalaryLists/DialogFormEdit.vue"; import DialogFormEdit from "@/modules/13_salary/components/04_salaryLists/DialogFormEditSalary.vue";
import DialogMoveGroup from "@/modules/13_salary/components/SalaryLists/DialogMoveGroup.vue"; import DialogMoveGroup from "@/modules/13_salary/components/04_salaryLists/DialogMoveGroup.vue";
import DialogMoveLevel from "@/modules/13_salary/components/SalaryLists/DialogMoveLevel.vue"; import DialogMoveLevel from "@/modules/13_salary/components/04_salaryLists/DialogMoveLevel.vue";
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -155,7 +155,6 @@ const baseColumns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"no", "no",
"posNo", "posNo",
@ -170,27 +169,30 @@ const visibleColumns = ref<string[]>([
"isRetired", "isRetired",
"remark", "remark",
]); ]);
const columns = computed(() => { const columns = computed(() => {
if (props.type !== "NONE") { if (props.type !== "NONE") {
if (baseColumns.value) { if (baseColumns.value) {
return baseColumns.value.filter((column) => column.name !== "remark"); return baseColumns.value.filter((column) => column.name !== "remark");
} }
} }
return baseColumns.value; return baseColumns.value;
}); });
/** modalDialog*/ /** modalDialog*/
const modalDialogAddPerson = ref<boolean>(false); const modalDialogAddPerson = ref<boolean>(false); //popup
const modalDialogForm = ref<boolean>(false); const modalDialogForm = ref<boolean>(false); //popup
const modalDialogMoveGroup = ref<boolean>(false); const modalDialogMoveGroup = ref<boolean>(false); //popup
const modalDialogMoveLeve = ref<boolean>(false); const modalDialogMoveLeve = ref<boolean>(false); //popup
const profileId = ref<string>(""); const profileId = ref<string>(""); //id
const amount = ref<number>(0); const amount = ref<number>(0); //
const typeLevel = ref<string>(""); //
const isReserve = ref<boolean>(false);
const remark = ref<string>(""); //
/** function openPopup เพิ่มคนเลื่อนเงินเดือน*/ /**
* function openPopup เพมคนเลอนเงนเดอน
*/
function onClickAddPerson() { function onClickAddPerson() {
modalDialogAddPerson.value = !modalDialogAddPerson.value; modalDialogAddPerson.value = !modalDialogAddPerson.value;
} }
@ -217,12 +219,8 @@ function onClickMovieGroup(id: string) {
modalDialogMoveGroup.value = !modalDialogMoveGroup.value; modalDialogMoveGroup.value = !modalDialogMoveGroup.value;
} }
const typeLevel = ref<string>("");
const isReserve = ref<boolean>(false);
const remark = ref<string>("");
/** /**
* function openPopup ายก * function openPopup ายกล
* @param id profileId * @param id profileId
* *
*/ */
@ -261,24 +259,32 @@ function onClickDelete(id: string) {
}); });
} }
/** function updatePageTable*/ /**
* function updatePageTable
*/
function updatePagePagination() { function updatePagePagination() {
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/** function updatePageSizeTable*/ /**
* function updatePageSizeTable
*/
function updatePageSizePagination(newPagination: NewPagination) { function updatePageSizePagination(newPagination: NewPagination) {
formFilter.value.page = 1; formFilter.value.page = 1;
formFilter.value.pageSize = newPagination.rowsPerPage; formFilter.value.pageSize = newPagination.rowsPerPage;
} }
/** function ค้นหาข้อมูล Table*/ /**
* function นหาขอม Table
*/
function searchData() { function searchData() {
formFilter.value.page = 1; formFilter.value.page = 1;
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/** callblack function เรียกข้อมูลรายชื่อใหม่ เมื่อมีการเปลี่ยน PageSize*/ /**
* callblack function เรยกขอมลรายชอใหม เมอมการเปลยน PageSize
*/
watch( watch(
() => formFilter.value.pageSize, () => formFilter.value.pageSize,
() => { () => {
@ -515,27 +521,27 @@ watch(
<DialogAddPerson <DialogAddPerson
v-model:modal="modalDialogAddPerson" v-model:modal="modalDialogAddPerson"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
/> />
<DialogFormEdit <DialogFormEdit
v-model:modal="modalDialogForm" v-model:modal="modalDialogForm"
v-model:profileId="profileId" v-model:profile-id="profileId"
v-model:amount="amount" v-model:amount="amount"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
/> />
<DialogMoveGroup <DialogMoveGroup
v-model:modal="modalDialogMoveGroup" v-model:modal="modalDialogMoveGroup"
v-model:profileId="profileId" v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable"
:group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'" :group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'"
:fetchData="props.fetchDataTable"
/> />
<DialogMoveLevel <DialogMoveLevel
:typeLevel="typeLevel"
:isReserve="isReserve"
v-model:modal="modalDialogMoveLeve" v-model:modal="modalDialogMoveLeve"
v-model:profileId="profileId" v-model:profile-id="profileId"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
:type-level="typeLevel"
:is-reserve="isReserve"
:type="store.tabType" :type="store.tabType"
:remark="remark" :remark="remark"
/> />

View file

@ -9,11 +9,11 @@ import type { NewPagination } from "@/modules/13_salary/interface/index/Main";
import type { DataFilter } from "@/modules/13_salary/interface/index/SalaryList"; import type { DataFilter } from "@/modules/13_salary/interface/index/SalaryList";
/** importComponents*/ /** importComponents*/
import DialogAddPerson from "@/modules/13_salary/components/SalaryLists//DialogAddPerson.vue"; // import DialogAddPerson from "@/modules/13_salary/components/04_salaryLists//DialogAddPerson.vue"; //
import DialogFormEdit from "@/modules/13_salary/components/SalaryLists/DialogFormEdit.vue"; // import DialogFormEdit from "@/modules/13_salary/components/04_salaryLists/DialogFormEditSalary.vue"; //
import DialogMoveGroup from "@/modules/13_salary/components/SalaryLists/DialogMoveGroup.vue"; // import DialogMoveGroup from "@/modules/13_salary/components/04_salaryLists/DialogMoveGroup.vue"; //
import DialogMoveLevel from "@/modules/13_salary/components/SalaryLists/DialogMoveLevel.vue"; // import DialogMoveLevel from "@/modules/13_salary/components/04_salaryLists/DialogMoveLevel.vue"; //
import DialogProperties from "@/modules/13_salary/components/SalaryLists/DialogProperties.vue"; // import DialogProperties from "@/modules/13_salary/components/04_salaryLists/DialogProperties.vue"; //
import DialogInfo from "@/modules/13_salary/components/DialogInfoMain.vue"; import DialogInfo from "@/modules/13_salary/components/DialogInfoMain.vue";
/** importStore*/ /** importStore*/
@ -181,20 +181,23 @@ const visibleColumns = ref<string[]>([
]); ]);
/** modalDialog*/ /** modalDialog*/
const modalDialogAddPerson = ref<boolean>(false); const modalDialogAddPerson = ref<boolean>(false); //popup
const modalDialogForm = ref<boolean>(false); const modalDialogForm = ref<boolean>(false); //popup
const modalDialogMoveGroup = ref<boolean>(false); const modalDialogMoveGroup = ref<boolean>(false); //popup
const modalDialogMoveLeve = ref<boolean>(false); const modalDialogMoveLeve = ref<boolean>(false); //popup
const modalDialogProperties = ref<boolean>(false); const modalDialogProperties = ref<boolean>(false);
const modalDialogInfo = ref<boolean>(false); const modalDialogInfo = ref<boolean>(false); // /popup
/** ตัวแปร*/ /** ตัวแปร*/
const profileId = ref<string>(""); const profileId = ref<string>(""); //id
const amount = ref<number>(0); const amount = ref<number>(0); //
const typeLevel = ref<string>(""); //
const isReserve = ref<boolean>(false);
const isPunish = ref<boolean>(false); const isPunish = ref<boolean>(false);
const isSuspension = ref<boolean>(false); const isSuspension = ref<boolean>(false);
const isAbsent = ref<boolean>(false); const isAbsent = ref<boolean>(false);
const isLeave = ref<boolean>(false); const isLeave = ref<boolean>(false);
/** /**
* function นยนการลบรายช * function นยนการลบรายช
* @param id profileId * @param id profileId
@ -217,7 +220,9 @@ function onClickDelete(id: string) {
}); });
} }
/** function openPopup เพิ่มคนเลื่อนเงินเดือน*/ /**
* function openPopup เพมคนเลอนเงนเดอน
*/
function onClickAddPerson() { function onClickAddPerson() {
modalDialogAddPerson.value = !modalDialogAddPerson.value; modalDialogAddPerson.value = !modalDialogAddPerson.value;
} }
@ -244,9 +249,6 @@ function onClickMovieGroup(id: string) {
modalDialogMoveGroup.value = !modalDialogMoveGroup.value; modalDialogMoveGroup.value = !modalDialogMoveGroup.value;
} }
const typeLevel = ref<string>("");
const isReserve = ref<boolean>(false);
/** /**
* function openPopup ายกข * function openPopup ายกข
* @param id profileId * @param id profileId
@ -259,23 +261,33 @@ function onClickMoveLevel(id: string, typeVal: string, isReserveVal: boolean) {
isReserve.value = isReserveVal; isReserve.value = isReserveVal;
} }
/** function updatePageTable*/ /**
* function updatePageTable
*/
function updatePagePagination() { function updatePagePagination() {
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/** function updatePageSizeTable*/ /**
* function updatePageSizeTable
*/
function updatePageSizePagination(newPagination: NewPagination) { function updatePageSizePagination(newPagination: NewPagination) {
formFilter.value.page = 1; formFilter.value.page = 1;
formFilter.value.pageSize = newPagination.rowsPerPage; formFilter.value.pageSize = newPagination.rowsPerPage;
} }
/** function ค้นหาข้อมูล Table*/ /**
* function นหาขอม Table
*/
function searchData() { function searchData() {
formFilter.value.page = 1; formFilter.value.page = 1;
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/**
* function เป popup ณสมบ
* @param data อมลคณสมบ
*/
function onProperties(data: any) { function onProperties(data: any) {
modalDialogProperties.value = true; modalDialogProperties.value = true;
profileId.value = data.id; profileId.value = data.id;
@ -293,7 +305,12 @@ watch(
} }
); );
const infoType = ref<string>(""); const infoType = ref<string>(""); //
/**
* function อมลสวนต
* @param type ประเภทขอม
* @param id id องการด
*/
function onClickViewInfo(type: string, id: string) { function onClickViewInfo(type: string, id: string) {
infoType.value = type; infoType.value = type;
profileId.value = id; profileId.value = id;
@ -513,13 +530,13 @@ function onClickViewInfo(type: string, id: string) {
<!-- เพมคนเลอนเงนเดอน --> <!-- เพมคนเลอนเงนเดอน -->
<DialogAddPerson <DialogAddPerson
v-model:modal="modalDialogAddPerson" v-model:modal="modalDialogAddPerson"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
/> />
<!-- แกไขเงนเดอน --> <!-- แกไขเงนเดอน -->
<DialogFormEdit <DialogFormEdit
v-model:modal="modalDialogForm" v-model:modal="modalDialogForm"
v-model:profileId="profileId" v-model:profile-id="profileId"
v-model:amount="amount" v-model:amount="amount"
:fetchData="props.fetchDataTable" :fetchData="props.fetchDataTable"
/> />
@ -527,18 +544,18 @@ function onClickViewInfo(type: string, id: string) {
<!-- ายกล --> <!-- ายกล -->
<DialogMoveGroup <DialogMoveGroup
v-model:modal="modalDialogMoveGroup" v-model:modal="modalDialogMoveGroup"
v-model:profileId="profileId" v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable"
:group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'" :group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'"
:fetchData="props.fetchDataTable"
/> />
<!-- เลอนข --> <!-- เลอนข -->
<DialogMoveLevel <DialogMoveLevel
:typeLevel="typeLevel"
:isReserve="isReserve"
v-model:modal="modalDialogMoveLeve" v-model:modal="modalDialogMoveLeve"
v-model:profileId="profileId" v-model:profile-id="profileId"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
:type-level="typeLevel"
:is-reserve="isReserve"
:remark="''" :remark="''"
/> />
@ -555,9 +572,9 @@ function onClickViewInfo(type: string, id: string) {
<DialogInfo <DialogInfo
v-model:modal="modalDialogInfo" v-model:modal="modalDialogInfo"
v-model:profileId="profileId" v-model:profile-id="profileId"
:type="infoType" :type="infoType"
:employeeClass="''" :employee-class="''"
/> />
</template> </template>

View file

@ -1,6 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, watch } from "vue"; import { ref, reactive, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -14,10 +17,6 @@ import type { DataPerson } from "@/modules/13_salary/interface/response/SalaryLi
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryEmployeeListSDataStore(); const store = useSalaryEmployeeListSDataStore();
@ -33,6 +32,7 @@ const props = defineProps({
}); });
/** Table*/ /** Table*/
const rows = ref<DataPerson[]>([]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -89,8 +89,6 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
const rows = ref<DataPerson[]>([]);
/** ข้อมูุลค้นหา*/ /** ข้อมูุลค้นหา*/
const formFilter = reactive<DataFilterPerson>({ const formFilter = reactive<DataFilterPerson>({
page: 1, page: 1,
@ -102,21 +100,25 @@ const formFilter = reactive<DataFilterPerson>({
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
/** function close popup*/ /**
* function close popup
*/
function closeModal() { function closeModal() {
modal.value = false; modal.value = false;
formFilter.page = 1; formFilter.page = 1;
formFilter.keyword = ""; formFilter.keyword = "";
} }
/** function เรียกรายชื่อ คนเลื่อนเงินเดือน*/ /**
function fetchListPerson() { * function เรยกรายช คนเลอนเงนเดอน
*/
async function fetchListPerson() {
showLoader(); showLoader();
formFilter.rootId = store.rootId; formFilter.rootId = store.rootId;
formFilter.period = store.roundMainCode; formFilter.period = store.roundMainCode;
formFilter.year = store.roundYear; formFilter.year = store.roundYear;
http await http
.post(config.API.salaryListPersonEmp, formFilter) .post(config.API.salaryListPersonEmp, formFilter)
.then((res) => { .then((res) => {
const data = res.data.result.data; const data = res.data.result.data;
@ -168,24 +170,32 @@ function onClickAddPerson(data: DataPerson) {
); );
} }
/** function updatePage*/ /**
* function updatePage
*/
async function updatePagePagination() { async function updatePagePagination() {
fetchListPerson(); fetchListPerson();
} }
/** function updatePageSize*/ /**
* function updatePageSize
*/
function updatePageSizePagination(newPagination: NewPagination) { function updatePageSizePagination(newPagination: NewPagination) {
formFilter.page = 1; formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage; formFilter.pageSize = newPagination.rowsPerPage;
} }
/** function ค้นหาข้อมูลตาม keyword*/ /**
* function นหาขอมลตาม keyword
*/
function searchData() { function searchData() {
formFilter.page = 1; formFilter.page = 1;
fetchListPerson(); fetchListPerson();
} }
/** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปิด Popup*/ /**
* callblack function เรยกขอมลรายชอคนเลอนเงนเดอน เมอมการเป Popup
*/
watch( watch(
() => modal.value, () => modal.value,
() => { () => {
@ -195,7 +205,9 @@ watch(
} }
); );
/** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปลี่ยน PageSize*/ /**
* callblack function เรยกขอมลรายชอคนเลอนเงนเดอน เมอมการเปลยน PageSize
*/
watch( watch(
() => formFilter.pageSize, () => formFilter.pageSize,
() => { () => {
@ -302,17 +314,6 @@ watch(
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<!-- <q-card-actions align="right" class="bg-white text-teal">
<q-btn
type="submit"
unelevated
dense
class="q-px-md items-center"
color="light-blue-10"
label="บันทึก"
/>
</q-card-actions> -->
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -1,15 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
@ -25,24 +23,17 @@ const props = defineProps({
}, },
}); });
const amountRef = ref<any>();
/** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
function validateForm() {
if (amountRef.value.validate()) {
onSubmit();
}
}
/** function ปืด Popup */ /** function ปืด Popup */
function close() { function close() {
modal.value = false; modal.value = false;
amount.value = null; amount.value = null;
} }
/** function ยืนยันการบันทึกข้อมูล*/ /**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
if (amount.value !== null) { if (amount.value !== null) {
showLoader(); showLoader();
const amountString: string = amount.value.toString(); const amountString: string = amount.value.toString();
@ -53,7 +44,7 @@ function onSubmit() {
? amount.value ? amount.value
: Number(amountString.replace(/,/g, "")), : Number(amountString.replace(/,/g, "")),
}; };
http await http
.post(config.API.salaryPeriodEmp() + `/change/amount`, body) .post(config.API.salaryPeriodEmp() + `/change/amount`, body)
.then(async () => { .then(async () => {
await props.fetchData?.(); await props.fetchData?.();
@ -74,29 +65,30 @@ function onSubmit() {
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 30%"> <q-card class="col-12" style="width: 30%">
<Header :tittle="`แก้ไขเงินเดือน`" :close="close" /> <q-form greedy @submit.prevent @validation-success="onSubmit">
<q-separator /> <Header :tittle="`แก้ไขเงินเดือน`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh"> <q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<q-input <q-input
ref="amountRef" ref="amountRef"
dense dense
outlined outlined
v-model="amount" v-model="amount"
label="เงินเดือนฐาน" label="เงินเดือนฐาน"
mask="###,###,###,###" mask="###,###,###,###"
reverse-fill-mask reverse-fill-mask
:rules="[(val) => !!val || `${'กรุณากรอกเงินเดือนฐาน'}`]" :rules="[(val) => !!val || `${'กรุณากรอกเงินเดือนฐาน'}`]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
/> />
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<form @submit.prevent="validateForm">
<q-card-actions align="right" class="bg-white text-teal"> <q-card-actions align="right">
<q-btn <q-btn
type="submit" type="submit"
for="#submitForm" for="#submitForm"
@ -104,7 +96,7 @@ function onSubmit() {
label="บันทึก" label="บันทึก"
/> />
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -4,7 +4,10 @@ import Header from "@/components/DialogHeader.vue";
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const separator = ref<any>("cell"); const separator = ref<any>("cell");
/** ปิด Dialog */
/**
* Dialog
*/
function closeDialog() { function closeDialog() {
modal.value = !modal.value; modal.value = !modal.value;
} }

View file

@ -1,16 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, defineModel, watch } from "vue"; import { ref, defineModel, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryEmployeeListSDataStore(); const store = useSalaryEmployeeListSDataStore();
@ -28,32 +27,29 @@ const props = defineProps({
}); });
/** ตัวแปร*/ /** ตัวแปร*/
const group = ref<string>(""); const group = ref<string>(""); //
const groupRef = ref<any>(null);
const isReadonly = ref<boolean>(false); // const isReadonly = ref<boolean>(false); //
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ /**
function validateForm() { * function Popup
if (groupRef.value.validate()) { */
onSubmit();
}
}
/** function ปืด Popup */
function close() { function close() {
modal.value = false; modal.value = false;
group.value = ""; group.value = "";
} }
/** function ยืนยันการบันทึกข้อมูล*/ /**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
const body = { const body = {
profileId: profileId.value, profileId: profileId.value,
groupId: group.value, groupId: group.value,
}; };
http await http
.post(config.API.salaryPeriod() + `/change/group`, body) .post(config.API.salaryPeriod() + `/change/group`, body)
.then(async () => { .then(async () => {
await props.fetchData?.(); await props.fetchData?.();
@ -69,6 +65,13 @@ function onSubmit() {
}); });
} }
function inputEdit(val: boolean) {
return {
"full-width cursor-pointer inputgreen ": val,
"full-width cursor-pointer inputgreen": !val,
};
}
watch( watch(
() => modal.value, () => modal.value,
() => { () => {
@ -78,45 +81,38 @@ watch(
} }
} }
); );
function inputEdit(val: boolean) {
return {
"full-width cursor-pointer inputgreen ": val,
"full-width cursor-pointer inputgreen": !val,
};
}
</script> </script>
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 30%"> <q-card class="col-12" style="width: 30%">
<Header :tittle="`ย้ายกลุ่ม`" :close="close" /> <q-form greedy @submit.prevent @validation-success="onSubmit">
<q-separator /> <Header :tittle="`ย้ายกลุ่ม`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh"> <q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<q-select <q-select
ref="groupRef" ref="groupRef"
:class="inputEdit(isReadonly)" :class="inputEdit(isReadonly)"
v-model="group" v-model="group"
label="กลุ่ม" label="กลุ่ม"
dense dense
outlined outlined
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
option-value="id" option-value="id"
:options="store.groupOp.filter((e) => e.name !== props.group)" :options="store.groupOp.filter((e) => e.name !== props.group)"
:rules="[(val) => !!val || `${'กรุณากลุ่ม'}`]" :rules="[(val) => !!val || `${'กรุณากลุ่ม'}`]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
/> />
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<form @submit.prevent="validateForm">
<q-card-actions align="right" class="bg-white text-teal"> <q-card-actions align="right">
<!-- <q-btn flat label="OK" v-close-popup /> -->
<q-btn <q-btn
type="submit" type="submit"
for="#submitForm" for="#submitForm"
@ -124,7 +120,7 @@ function inputEdit(val: boolean) {
label="บันทึก" label="บันทึก"
/> />
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -1,16 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch } from "vue"; import { ref, computed, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryEmployeeListSDataStore(); const store = useSalaryEmployeeListSDataStore();
@ -29,13 +28,11 @@ const props = defineProps({
}, },
}); });
const type = ref<string>(""); const type = ref<string>(""); //
const note = ref<string>(""); const note = ref<string>(""); //
const typeRef = ref<any>(null);
const isReadonly = ref<boolean>(false); // const isReadonly = ref<boolean>(false); //
const isChange = ref<boolean>(false); // const isChange = ref<boolean>(false); //
const isReserve = ref<boolean>(false); // const isReserve = ref<boolean>(false); //
const typeRangeOps = computed(() => { const typeRangeOps = computed(() => {
return store.roundMainCode === "OCT" return store.roundMainCode === "OCT"
? [ ? [
@ -56,22 +53,19 @@ const typeRangeOps = computed(() => {
]; ];
}); });
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ /**
function validateForm() { * function Popup
if (typeRef.value.validate()) { */
onSubmit();
}
}
/** function ปืด Popup */
function close() { function close() {
modal.value = false; modal.value = false;
type.value = ""; type.value = "";
} }
/** function ยืนยันการบันทึกข้อมูล*/ /**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
const body = { const body = {
profileId: profileId.value, profileId: profileId.value,
@ -79,7 +73,7 @@ function onSubmit() {
isReserve: isReserve.value, isReserve: isReserve.value,
remark: type.value === "NONE" ? note.value : undefined, remark: type.value === "NONE" ? note.value : undefined,
}; };
http await http
.post(config.API.salaryPeriodEmp() + `/change/type`, body) .post(config.API.salaryPeriodEmp() + `/change/type`, body)
.then(async () => { .then(async () => {
await props.fetchData?.(); await props.fetchData?.();
@ -95,10 +89,20 @@ function onSubmit() {
}); });
} }
/**
* function เปลยนระด
*/
function chengType() { function chengType() {
note.value = props.typeLevel === "NONE" ? props.remark : ""; note.value = props.typeLevel === "NONE" ? props.remark : "";
} }
function inputEdit(val: boolean) {
return {
"full-width cursor-pointer inputgreen ": val,
"full-width cursor-pointer inputgreen": !val,
};
}
watch( watch(
() => modal.value, () => modal.value,
() => { () => {
@ -108,66 +112,60 @@ watch(
isChange.value = false; isChange.value = false;
} }
); );
function inputEdit(val: boolean) {
return {
"full-width cursor-pointer inputgreen ": val,
"full-width cursor-pointer inputgreen": !val,
};
}
</script> </script>
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 30%"> <q-card class="col-12" style="width: 30%">
<Header :tittle="`เลื่อนขั้น`" :close="close" /> <q-form greedy @submit.prevent @validation-success="onSubmit">
<q-separator /> <Header :tittle="`เลื่อนขั้น`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh"> <q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<q-select <q-select
ref="typeRef" ref="typeRef"
:class="inputEdit(isReadonly)" :class="inputEdit(isReadonly)"
v-model="type" v-model="type"
label="เลื่อนขั้น" label="เลื่อนขั้น"
dense dense
outlined outlined
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
option-value="id" option-value="id"
:options="typeRangeOps" :options="typeRangeOps"
:rules="[(val) => !!val || `${'กรุณาเลือก ขั้น'}`]" :rules="[(val) => !!val || `${'กรุณาเลือก ขั้น'}`]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
@update:model-value="(isChange = true), chengType()" @update:model-value="(isChange = true), chengType()"
/> />
<!-- :options="typeRangeOps.filter((e) => e.id !== store.tabType)" --> <!-- :options="typeRangeOps.filter((e) => e.id !== store.tabType)" -->
<q-checkbox <q-checkbox
v-if="type === 'FULL'" v-if="type === 'FULL'"
keep-color keep-color
label="สำรอง" label="สำรอง"
dense dense
v-model="isReserve" v-model="isReserve"
@update:model-value="isChange = true" @update:model-value="isChange = true"
/> />
<q-input <q-input
v-if="type === 'NONE'" v-if="type === 'NONE'"
:class="inputEdit(isReadonly)" :class="inputEdit(isReadonly)"
outlined outlined
dense dense
v-model="note" v-model="note"
label="หมายเหตุ" label="หมายเหตุ"
type="textarea" type="textarea"
@update:model-value="isChange = true" @update:model-value="isChange = true"
/> />
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<form @submit.prevent="validateForm">
<q-card-actions align="right" class="bg-white text-teal"> <q-card-actions align="right">
<q-btn <q-btn
:disabled="!isChange" :disabled="!isChange"
type="submit" type="submit"
@ -176,7 +174,7 @@ function inputEdit(val: boolean) {
label="บันทึก" label="บันทึก"
/> />
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -1,6 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch } from "vue"; import { ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
@ -8,8 +11,6 @@ import config from "@/app.config";
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
@ -43,20 +44,19 @@ const isSuspension = ref<boolean>(false); // สำรองหรือไม
const isAbsent = ref<boolean>(false); // const isAbsent = ref<boolean>(false); //
const isLeave = ref<boolean>(false); // const isLeave = ref<boolean>(false); //
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ /**
function validateForm() { * function Popup
onSubmit(); */
}
/** function ปืด Popup */
function close() { function close() {
modal.value = false; modal.value = false;
type.value = ""; type.value = "";
} }
/** function ยืนยันการบันทึกข้อมูล*/ /**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
const body = { const body = {
isPunish: isPunish.value, isPunish: isPunish.value,
@ -64,7 +64,7 @@ function onSubmit() {
isAbsent: isAbsent.value, isAbsent: isAbsent.value,
isLeave: isLeave.value, isLeave: isLeave.value,
}; };
http await http
.put(config.API.salaryPropertyEmp(profileId.value), body) .put(config.API.salaryPropertyEmp(profileId.value), body)
.then(async () => { .then(async () => {
await props.fetchData?.(); await props.fetchData?.();
@ -94,43 +94,44 @@ watch(
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 20%"> <q-card class="col-12" style="width: 20%">
<Header :tittle="`แก้ไขคุณสมบัติ`" :close="close" /> <q-form greedy @submit.prevent @validation-success="onSubmit">
<q-separator /> <Header :tittle="`แก้ไขคุณสมบัติ`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm column">
<q-checkbox
toggle-indeterminate
keep-color
label="ไม่ถูกลงโทษทางวินัย"
dense
v-model="isPunish"
/>
<q-checkbox
toggle-indeterminate
keep-color
label="ไม่ถูกพักราชการ"
dense
v-model="isSuspension"
/>
<q-checkbox
toggle-indeterminate
keep-color
label="ไม่ขาดราชการ"
dense
v-model="isAbsent"
/>
<q-checkbox
toggle-indeterminate
keep-color
label="วันลาไม่เกิน"
dense
v-model="isLeave"
/>
</div>
</q-card-section>
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm column">
<q-checkbox
toggle-indeterminate
keep-color
label="ไม่ถูกลงโทษทางวินัย"
dense
v-model="isPunish"
/>
<q-checkbox
toggle-indeterminate
keep-color
label="ไม่ถูกพักราชการ"
dense
v-model="isSuspension"
/>
<q-checkbox
toggle-indeterminate
keep-color
label="ไม่ขาดราชการ"
dense
v-model="isAbsent"
/>
<q-checkbox
toggle-indeterminate
keep-color
label="วันลาไม่เกิน"
dense
v-model="isLeave"
/>
</div>
</q-card-section>
<q-separator />
<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 <q-btn
type="submit" type="submit"
@ -139,7 +140,7 @@ watch(
label="บันทึก" label="บันทึก"
/> />
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -1,16 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import axios from "axios"; import axios from "axios";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
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 DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const store = useSalaryEmployeeListSDataStore(); const store = useSalaryEmployeeListSDataStore();
@ -29,11 +29,12 @@ const props = defineProps({
getData: Function, getData: Function,
}); });
const modalRecommend = ref<boolean>(false); //popup
const titleRecommend = ref<string>(""); // Popup
const sendStep = ref<number>(1); const sendStep = ref<number>(1);
const fileUpload = ref<any>(null); const fileUpload = ref<any>(null); //
const document = ref<string>(""); const type = ref<string>(""); //
const type = ref<string>(""); const listFile = ref<any[]>([]); //
const listFile = ref<any>([]);
/** /**
* function ปโหลดไฟลเจาหนาท * function ปโหลดไฟลเจาหนาท
* @param event file * @param event file
@ -79,6 +80,10 @@ async function uploadFile(event: any) {
); );
} }
/**
* functoin ปโหลดไฟล
* @param uploadUrl link ปโหลด
*/
function fileUpLoad(url: string) { function fileUpLoad(url: string) {
axios axios
.put(url, fileUpload.value, { .put(url, fileUpload.value, {
@ -98,6 +103,10 @@ function fileUpLoad(url: string) {
}); });
} }
/**
* นยนการบนทกคำแนะนำ
* @param reason คำแนะนำ
*/
function saveReccommend(reason: string) { function saveReccommend(reason: string) {
dialogConfirm( dialogConfirm(
$q, $q,
@ -131,6 +140,11 @@ function saveReccommend(reason: string) {
); );
} }
/**
* นยนการส
* @param msg งเอกสารให ผอ. ตรวจสอบ,นยนและสงเอกสารให,นยนการตรวจสอบ
* @param type officer, head,owner
*/
function sendToDirector(msg: string, type: string) { function sendToDirector(msg: string, type: string) {
dialogConfirm( dialogConfirm(
$q, $q,
@ -160,16 +174,22 @@ function sendToDirector(msg: string, type: string) {
); );
} }
const modalRecommend = ref<boolean>(false); /**
const titleRecommend = ref<string>(""); * งคำแนะนำให ผอ. ตรวจสอบ
* @param title วข
* @param typeOrder ประเภทคำส
*/
function sendAndRecommend(title: string, typeOrder: string) { function sendAndRecommend(title: string, typeOrder: string) {
modalRecommend.value = true; modalRecommend.value = true;
titleRecommend.value = title; titleRecommend.value = title;
type.value = typeOrder; type.value = typeOrder;
} }
function fetchListFile() { /**
http * fetch รายการไฟล
*/
async function fetchListFile() {
await http
.get( .get(
config.API.subFile( config.API.subFile(
"ระบบเงินเดือน", "ระบบเงินเดือน",
@ -186,6 +206,10 @@ function fetchListFile() {
}); });
} }
/**
* ลบไฟล
* @param fileName อไฟล
*/
function onDeleteFile(fileName: string) { function onDeleteFile(fileName: string) {
dialogRemove($q, () => { dialogRemove($q, () => {
showLoader(); showLoader();
@ -213,6 +237,10 @@ function onDeleteFile(fileName: string) {
}); });
} }
/**
* โหลดไฟล
* @param fileName อไฟล
*/
function downloadFile(fileName: string) { function downloadFile(fileName: string) {
showLoader(); showLoader();
http http
@ -236,6 +264,7 @@ function downloadFile(fileName: string) {
hideLoader(); hideLoader();
}); });
} }
onMounted(() => { onMounted(() => {
if (props.rootId) { if (props.rootId) {
fetchListFile(); fetchListFile();

View file

@ -15,9 +15,9 @@ import type {
} from "@/modules/13_salary/interface/response/SalaryList"; } from "@/modules/13_salary/interface/response/SalaryList";
/** importComponents*/ /** importComponents*/
import TableTabType1 from "@/modules/13_salary/components/SalaryEmployeeLists/TableTypePending.vue"; import TableTabType1 from "@/modules/13_salary/components/05_salaryListsEmployee/TableTypePending.vue";
import TableTabType2 from "@/modules/13_salary/components/SalaryEmployeeLists/TableTypeOther.vue"; import TableTabType2 from "@/modules/13_salary/components/05_salaryListsEmployee/TableTypeOther.vue";
import DialogInfoCriteria from "@/modules/13_salary/components/SalaryEmployeeLists/DialogInfoCriteria.vue"; import DialogInfoCriteria from "@/modules/13_salary/components/05_salaryListsEmployee/DialogInfoCriteria.vue";
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -36,11 +36,14 @@ const props = defineProps({
roundFilter: { type: Object, require: true }, roundFilter: { type: Object, require: true },
}); });
const total = ref<number>();
const splitterModel = ref<number>(13); const splitterModel = ref<number>(13);
const rows = ref<DataPeriod[]>([]); const modalDialogInfoCriteria = ref<boolean>(false); //popup
const isRetire = ref<boolean | string>(false); //
const rows = ref<DataPeriod[]>([]); //
const total = ref<number>(0); //
const maxPage = ref<number>(1); //
/** itemsTab กลุ่ม*/ //itemsTab
const itemsTabGroup = ref([ const itemsTabGroup = ref([
{ {
lable: "กลุ่ม 1", lable: "กลุ่ม 1",
@ -51,8 +54,7 @@ const itemsTabGroup = ref([
name: "group2", name: "group2",
}, },
]); ]);
//itemsTab
/** itemsTab ขั้น*/
const itemsTabType = computed(() => { const itemsTabType = computed(() => {
return store.roundMainCode === "OCT" return store.roundMainCode === "OCT"
? [ ? [
@ -61,11 +63,6 @@ const itemsTabType = computed(() => {
name: "tab1", name: "tab1",
type: "PENDING", type: "PENDING",
}, },
// {
// lable: "",
// name: "tab5",
// type: "RETIRE",
// },
{ {
lable: "1 ขั้น", lable: "1 ขั้น",
name: "tab2", name: "tab2",
@ -128,8 +125,7 @@ const itemsTabType = computed(() => {
}, },
]; ];
}); });
//itemsCard
/** itemsCard*/
const itemsCard = ref([ const itemsCard = ref([
{ {
lable: "จำนวนคนทั้งหมด", lable: "จำนวนคนทั้งหมด",
@ -205,15 +201,13 @@ const itemsCard = ref([
total: 0, total: 0,
}, },
]); ]);
//
/** ข้อมูลค้นหารายชื่อคยขึ้นเงินเดือน*/
const formFilter = reactive<DataFilter>({ const formFilter = reactive<DataFilter>({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
keyword: "", keyword: "",
type: store.tabType, type: store.tabType,
}); });
const maxPage = ref<number>(1);
/** /**
* function เรยกขอมลจำนวนโควต * function เรยกขอมลจำนวนโควต
@ -250,7 +244,7 @@ function fetchDataQuota(id: string) {
* function เรยกขอมลรายช * function เรยกขอมลรายช
* @param id กล * @param id กล
*/ */
function fetchDataPeriod(id: string) { async function fetchDataPeriod(id: string) {
showLoader(); showLoader();
rows.value = []; rows.value = [];
let formData = { let formData = {
@ -266,7 +260,7 @@ function fetchDataPeriod(id: string) {
: "0", : "0",
}; };
http await http
.put(config.API.salaryListPeriodORGEmp(id), formData) .put(config.API.salaryListPeriodORGEmp(id), formData)
.then((res) => { .then((res) => {
rows.value = res.data.result.data; rows.value = res.data.result.data;
@ -283,7 +277,9 @@ function fetchDataPeriod(id: string) {
}); });
} }
/**function เปลี่ยนขั้น*/ /**
* function เปลยนข
*/
function changeTabType() { function changeTabType() {
formFilter.page = 1; formFilter.page = 1;
formFilter.pageSize = 10; formFilter.pageSize = 10;
@ -291,13 +287,20 @@ function changeTabType() {
store.groupId && fetchDataPeriod(store.groupId); store.groupId && fetchDataPeriod(store.groupId);
} }
/** function เรียกข้อมูลรายชื่ออีกครั้ง*/ /**
* function เรยกขอมลรายชออกคร
*/
function fetchDataPeriodNew() { function fetchDataPeriodNew() {
store.groupId && fetchDataPeriod(store.groupId); store.groupId && fetchDataPeriod(store.groupId);
store.groupId && fetchDataQuota(store.groupId); store.groupId && fetchDataQuota(store.groupId);
} }
function onClickDownload(data: DataOption, type: string = "xlsx") { /**
* function โหลดไฟล
* @param data อมลทองการโหล
* @param type ประเภทไฟล docx,xlsx
*/
async function onClickDownload(data: DataOption, type: string = "xlsx") {
showLoader(); showLoader();
if (data.id === "emp-08" || data.id === "emp2-08") { if (data.id === "emp-08" || data.id === "emp2-08") {
const formData = { const formData = {
@ -311,11 +314,11 @@ function onClickDownload(data: DataOption, type: string = "xlsx") {
? `${props?.roundFilter?.year}-03-31` ? `${props?.roundFilter?.year}-03-31`
: `${props?.roundFilter?.year}-09-30`, : `${props?.roundFilter?.year}-09-30`,
}; };
http await http
.post(config.API.leaveReportLeaveday("employee"), formData) .post(config.API.leaveReportLeaveday("employee"), formData)
.then((res) => { .then(async (res) => {
const dataList = res.data.result; const dataList = await res.data.result;
genReportXLSX(dataList, data.name); await genReportXLSX(dataList, data.name);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -325,7 +328,7 @@ function onClickDownload(data: DataOption, type: string = "xlsx") {
}); });
} else { } else {
if (props.rootId && props.periodId) { if (props.rootId && props.periodId) {
http await http
.get( .get(
config.API.salaryReportListsByid( config.API.salaryReportListsByid(
data.id, data.id,
@ -333,15 +336,9 @@ function onClickDownload(data: DataOption, type: string = "xlsx") {
props.periodId props.periodId
) )
) )
.then((res) => { .then(async (res) => {
const dataList = res.data.result; const dataList = await res.data.result;
// if (type === "pdf") { await genReportXLSX(dataList, data.name, type);
// console.log(type);
// genReport(dataList, data.name, type);
// } else {
genReportXLSX(dataList, data.name, type);
// }
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -353,7 +350,14 @@ function onClickDownload(data: DataOption, type: string = "xlsx") {
} }
} }
const modalDialogInfoCriteria = ref<boolean>(false); /**
* funrion แสดงเฉพาะผเกษยณอายราชการ
*/
function updateIsShowRetire() {
isRetire.value = !isRetire.value;
fetchDataPeriodNew();
}
onMounted(() => { onMounted(() => {
if (props.rootId) { if (props.rootId) {
fetchDataQuota(store.groupId); fetchDataQuota(store.groupId);
@ -361,12 +365,6 @@ onMounted(() => {
splitterModel.value = store.roundMainCode === "APR" ? 13 : 16; splitterModel.value = store.roundMainCode === "APR" ? 13 : 16;
} }
}); });
const isRetire = ref<boolean | string>(false);
const updateIsShowRetire = () => {
isRetire.value = !isRetire.value;
fetchDataPeriodNew();
};
</script> </script>
<template> <template>
@ -505,18 +503,18 @@ const updateIsShowRetire = () => {
> >
<TableTabType1 <TableTabType1
v-if="index === 0" v-if="index === 0"
v-model:max-page="maxPage"
v-model:form-filter="formFilter"
:fetch-data-table="fetchDataPeriodNew"
:rows="rows" :rows="rows"
v-model:maxPage="maxPage"
v-model:formFilter="formFilter"
:fetchDataTable="fetchDataPeriodNew"
:total="total" :total="total"
/> />
<TableTabType2 <TableTabType2
v-else v-else
:rows="rows" :rows="rows"
v-model:maxPage="maxPage" v-model:max-page="maxPage"
v-model:formFilter="formFilter" v-model:form-filter="formFilter"
:fetchDataTable="fetchDataPeriodNew" :fetch-data-table="fetchDataPeriodNew"
:total="total" :total="total"
:type="item.type" :type="item.type"
/> />

View file

@ -1,7 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, computed } from "vue"; import { ref, watch, computed } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -11,14 +14,10 @@ import type { NewPagination } from "@/modules/13_salary/interface/index/Main";
import type { DataFilter } from "@/modules/13_salary/interface/index/SalaryList"; import type { DataFilter } from "@/modules/13_salary/interface/index/SalaryList";
/** importComponents*/ /** importComponents*/
import DialogAddPerson from "@/modules/13_salary/components/SalaryEmployeeLists//DialogAddPerson.vue"; import DialogAddPerson from "@/modules/13_salary/components/05_salaryListsEmployee//DialogAddPerson.vue";
import DialogFormEdit from "@/modules/13_salary/components/SalaryEmployeeLists/DialogFormEdit.vue"; import DialogFormEdit from "@/modules/13_salary/components/05_salaryListsEmployee/DialogFormEditSalary.vue";
import DialogMoveGroup from "@/modules/13_salary/components/SalaryEmployeeLists/DialogMoveGroup.vue"; import DialogMoveGroup from "@/modules/13_salary/components/05_salaryListsEmployee/DialogMoveGroup.vue";
import DialogMoveLevel from "@/modules/13_salary/components/SalaryEmployeeLists/DialogMoveLevel.vue"; import DialogMoveLevel from "@/modules/13_salary/components/05_salaryListsEmployee/DialogMoveLevel.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
@ -167,7 +166,6 @@ const baseColumns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"no", "no",
"posNo", "posNo",
@ -183,7 +181,6 @@ const visibleColumns = ref<string[]>([
"isRetired", "isRetired",
"remark", "remark",
]); ]);
const columns = computed(() => { const columns = computed(() => {
if (props.type !== "NONE") { if (props.type !== "NONE") {
if (baseColumns.value) { if (baseColumns.value) {
@ -194,15 +191,20 @@ const columns = computed(() => {
}); });
/** modalDialog*/ /** modalDialog*/
const modalDialogAddPerson = ref<boolean>(false); const modalDialogAddPerson = ref<boolean>(false); //popup
const modalDialogForm = ref<boolean>(false); const modalDialogForm = ref<boolean>(false); //popup
const modalDialogMoveGroup = ref<boolean>(false); const modalDialogMoveGroup = ref<boolean>(false); //popup
const modalDialogMoveLeve = ref<boolean>(false); const modalDialogMoveLeve = ref<boolean>(false); //popup
const profileId = ref<string>(""); const profileId = ref<string>(""); //id
const amount = ref<number>(0); const amount = ref<number>(0); //
const typeLevel = ref<string>(""); //
const isReserve = ref<boolean>(false); //
const remark = ref<string>(""); //
/** function openPopup เพิ่มคนเลื่อนค่าจ้าง*/ /**
* function openPopup เพมคนเลอนคาจาง
*/
function onClickAddPerson() { function onClickAddPerson() {
modalDialogAddPerson.value = !modalDialogAddPerson.value; modalDialogAddPerson.value = !modalDialogAddPerson.value;
} }
@ -229,10 +231,6 @@ function onClickMovieGroup(id: string) {
modalDialogMoveGroup.value = !modalDialogMoveGroup.value; modalDialogMoveGroup.value = !modalDialogMoveGroup.value;
} }
const typeLevel = ref<string>("");
const isReserve = ref<boolean>(false);
const remark = ref<string>("");
/** /**
* function openPopup ายกข * function openPopup ายกข
* @param id profileId * @param id profileId
@ -273,24 +271,32 @@ function onClickDelete(id: string) {
}); });
} }
/** function updatePageTable*/ /**
* function updatePageTable
*/
function updatePagePagination() { function updatePagePagination() {
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/** function updatePageSizeTable*/ /**
* function updatePageSizeTable
*/
function updatePageSizePagination(newPagination: NewPagination) { function updatePageSizePagination(newPagination: NewPagination) {
formFilter.value.page = 1; formFilter.value.page = 1;
formFilter.value.pageSize = newPagination.rowsPerPage; formFilter.value.pageSize = newPagination.rowsPerPage;
} }
/** function ค้นหาข้อมูล Table*/ /**
* function นหาขอม Table
*/
function searchData() { function searchData() {
formFilter.value.page = 1; formFilter.value.page = 1;
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/** callblack function เรียกข้อมูลรายชื่อใหม่ เมื่อมีการเปลี่ยน PageSize*/ /**
* callblack function เรยกขอมลรายชอใหม เมอมการเปลยน PageSize
*/
watch( watch(
() => formFilter.value.pageSize, () => formFilter.value.pageSize,
() => { () => {
@ -528,27 +534,27 @@ watch(
<DialogAddPerson <DialogAddPerson
v-model:modal="modalDialogAddPerson" v-model:modal="modalDialogAddPerson"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
/> />
<DialogFormEdit <DialogFormEdit
v-model:modal="modalDialogForm" v-model:modal="modalDialogForm"
v-model:profileId="profileId" v-model:profile-id="profileId"
v-model:amount="amount" v-model:amount="amount"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
/> />
<DialogMoveGroup <DialogMoveGroup
v-model:modal="modalDialogMoveGroup" v-model:modal="modalDialogMoveGroup"
v-model:profileId="profileId" v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable"
:group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'" :group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'"
:fetchData="props.fetchDataTable"
/> />
<DialogMoveLevel <DialogMoveLevel
:typeLevel="typeLevel"
:isReserve="isReserve"
v-model:modal="modalDialogMoveLeve" v-model:modal="modalDialogMoveLeve"
v-model:profileId="profileId" v-model:profile-id="profileId"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
:type-level="typeLevel"
:is-reserve="isReserve"
:type="store.tabType" :type="store.tabType"
:remark="remark" :remark="remark"
/> />

View file

@ -1,7 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
@ -9,19 +14,13 @@ import type { NewPagination } from "@/modules/13_salary/interface/index/Main";
import type { DataFilter } from "@/modules/13_salary/interface/index/SalaryList"; import type { DataFilter } from "@/modules/13_salary/interface/index/SalaryList";
/** importComponents*/ /** importComponents*/
import DialogAddPerson from "@/modules/13_salary/components/SalaryEmployeeLists//DialogAddPerson.vue"; import DialogAddPerson from "@/modules/13_salary/components/05_salaryListsEmployee//DialogAddPerson.vue";
import DialogFormEdit from "@/modules/13_salary/components/SalaryEmployeeLists/DialogFormEdit.vue"; import DialogFormEdit from "@/modules/13_salary/components/05_salaryListsEmployee/DialogFormEditSalary.vue";
import DialogMoveGroup from "@/modules/13_salary/components/SalaryEmployeeLists/DialogMoveGroup.vue"; import DialogMoveGroup from "@/modules/13_salary/components/05_salaryListsEmployee/DialogMoveGroup.vue";
import DialogMoveLevel from "@/modules/13_salary/components/SalaryEmployeeLists/DialogMoveLevel.vue"; import DialogMoveLevel from "@/modules/13_salary/components/05_salaryListsEmployee/DialogMoveLevel.vue";
import DialogProperties from "@/modules/13_salary/components/SalaryEmployeeLists/DialogProperties.vue"; import DialogProperties from "@/modules/13_salary/components/05_salaryListsEmployee/DialogProperties.vue";
import DialogInfo from "@/modules/13_salary/components/DialogInfoMain.vue"; import DialogInfo from "@/modules/13_salary/components/DialogInfoMain.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import http from "@/plugins/http";
import config from "@/app.config";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryEmployeeListSDataStore(); const store = useSalaryEmployeeListSDataStore();
@ -194,20 +193,23 @@ const visibleColumns = ref<string[]>([
]); ]);
/** modalDialog*/ /** modalDialog*/
const modalDialogAddPerson = ref<boolean>(false); const modalDialogAddPerson = ref<boolean>(false); //popup
const modalDialogForm = ref<boolean>(false); const modalDialogForm = ref<boolean>(false); //popup
const modalDialogMoveGroup = ref<boolean>(false); const modalDialogMoveGroup = ref<boolean>(false); //popup
const modalDialogMoveLeve = ref<boolean>(false); const modalDialogMoveLeve = ref<boolean>(false); //popup
const modalDialogProperties = ref<boolean>(false); const modalDialogProperties = ref<boolean>(false); //popup
const modalDialogInfo = ref<boolean>(false); const modalDialogInfo = ref<boolean>(false); //popup
/** ตัวแปร*/ /** ตัวแปร*/
const profileId = ref<string>(""); const profileId = ref<string>(""); //id
const amount = ref<number>(0); const amount = ref<number>(0); //
const typeLevel = ref<string>(""); //
const isReserve = ref<boolean>(false); //
const isPunish = ref<boolean>(false); const isPunish = ref<boolean>(false);
const isSuspension = ref<boolean>(false); const isSuspension = ref<boolean>(false);
const isAbsent = ref<boolean>(false); const isAbsent = ref<boolean>(false);
const isLeave = ref<boolean>(false); const isLeave = ref<boolean>(false);
/** /**
* function นยนการลบรายช * function นยนการลบรายช
* @param id profileId * @param id profileId
@ -230,7 +232,9 @@ function onClickDelete(id: string) {
}); });
} }
/** function openPopup เพิ่มคนเลื่อนค่าจ้าง*/ /**
* function openPopup เพมคนเลอนคาจาง
*/
function onClickAddPerson() { function onClickAddPerson() {
modalDialogAddPerson.value = !modalDialogAddPerson.value; modalDialogAddPerson.value = !modalDialogAddPerson.value;
} }
@ -257,8 +261,6 @@ function onClickMovieGroup(id: string) {
modalDialogMoveGroup.value = !modalDialogMoveGroup.value; modalDialogMoveGroup.value = !modalDialogMoveGroup.value;
} }
const typeLevel = ref<string>("");
const isReserve = ref<boolean>(false);
/** /**
* function openPopup ายกข * function openPopup ายกข
* @param id profileId * @param id profileId
@ -271,23 +273,33 @@ function onClickMoveLevel(id: string, typeVal: string, isReserveVal: boolean) {
isReserve.value = isReserveVal; isReserve.value = isReserveVal;
} }
/** function updatePageTable*/ /**
* function updatePageTable
*/
function updatePagePagination() { function updatePagePagination() {
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/** function updatePageSizeTable*/ /**
* function updatePageSizeTable
*/
function updatePageSizePagination(newPagination: NewPagination) { function updatePageSizePagination(newPagination: NewPagination) {
formFilter.value.page = 1; formFilter.value.page = 1;
formFilter.value.pageSize = newPagination.rowsPerPage; formFilter.value.pageSize = newPagination.rowsPerPage;
} }
/** function ค้นหาข้อมูล Table*/ /**
* function นหาขอม Table
*/
function searchData() { function searchData() {
formFilter.value.page = 1; formFilter.value.page = 1;
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/**
* function เป popup ณสมบ
* @param data อมลคณสมบ
*/
function onProperties(data: any) { function onProperties(data: any) {
modalDialogProperties.value = true; modalDialogProperties.value = true;
profileId.value = data.id; profileId.value = data.id;
@ -296,20 +308,28 @@ function onProperties(data: any) {
isAbsent.value = data.isAbsent; isAbsent.value = data.isAbsent;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
} }
/** callblack function เรียกข้อมูลรายชื่อใหม่ เมื่อมีการเปลี่ยน PageSize*/
const infoType = ref<string>(""); //
/**
* function อมลสวนต
* @param type ประเภทขอม
* @param id id องการด
*/
function onClickViewInfo(type: string, id: string) {
infoType.value = type;
profileId.value = id;
modalDialogInfo.value = true;
}
/**
* callblack function เรยกขอมลรายชอใหม เมอมการเปลยน PageSize
*/
watch( watch(
() => formFilter.value.pageSize, () => formFilter.value.pageSize,
() => { () => {
updatePagePagination(); updatePagePagination();
} }
); );
const infoType = ref<string>("");
function onClickViewInfo(type: string, id: string) {
infoType.value = type;
profileId.value = id;
modalDialogInfo.value = true;
}
</script> </script>
<template> <template>
@ -531,44 +551,44 @@ function onClickViewInfo(type: string, id: string) {
<DialogAddPerson <DialogAddPerson
v-model:modal="modalDialogAddPerson" v-model:modal="modalDialogAddPerson"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
/> />
<DialogFormEdit <DialogFormEdit
v-model:modal="modalDialogForm" v-model:modal="modalDialogForm"
v-model:profileId="profileId" v-model:profile-id="profileId"
v-model:amount="amount" v-model:amount="amount"
:fetchData="props.fetchDataTable" :fetch-data="props.fetchDataTable"
/> />
<DialogMoveGroup <DialogMoveGroup
v-model:modal="modalDialogMoveGroup" v-model:modal="modalDialogMoveGroup"
v-model:profileId="profileId" v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable"
:group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'" :group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'"
:fetchData="props.fetchDataTable"
/> />
<DialogMoveLevel <DialogMoveLevel
:typeLevel="typeLevel"
:isReserve="isReserve"
v-model:modal="modalDialogMoveLeve" v-model:modal="modalDialogMoveLeve"
v-model:profileId="profileId" v-model:profile-id="profileId"
:fetchData="props.fetchDataTable" :type-level="typeLevel"
:is-reserve="isReserve"
:fetch-data="props.fetchDataTable"
:remark="''" :remark="''"
/> />
<DialogProperties <DialogProperties
v-model:modal="modalDialogProperties" v-model:modal="modalDialogProperties"
v-model:id="profileId" v-model:id="profileId"
:fetch-data="props.fetchDataTable"
:is-punish="isPunish" :is-punish="isPunish"
:is-suspension="isSuspension" :is-suspension="isSuspension"
:is-absent="isAbsent" :is-absent="isAbsent"
:is-leave="isLeave" :is-leave="isLeave"
:fetch-data="props.fetchDataTable"
/> />
<DialogInfo <DialogInfo
v-model:modal="modalDialogInfo" v-model:modal="modalDialogInfo"
v-model:profileId="profileId" v-model:profile-id="profileId"
:type="infoType" :type="infoType"
:employeeClass="'-employee'" :employee-class="'-employee'"
/> />
</template> </template>

View file

@ -1,20 +1,32 @@
const salaryChart = () => import("@/modules/13_salary/views/salaryChart.vue"); // รายการผังบัญชีเงินเดือน
const salaryChart = () => import("@/modules/13_salary/views/01_salaryMain.vue");
const salaryRate = () =>
import("@/modules/13_salary/views/page01_salaryRate.vue");
// ผังบัญชีค่าจ้างลูกจ้างประจำ
const salaryEmployeeChart = () => const salaryEmployeeChart = () =>
import("@/modules/13_salary/views/salaryEmployeeChart.vue"); import("@/modules/13_salary/views/02_salaryEmployeeMain.vue");
const salaryEmployeeRate = () => const salaryEmployeeRate = () =>
import("@/modules/13_salary/views/salaryEmployeeRate.vue"); import("@/modules/13_salary/views/page02_salaryEmployeeRate.vue");
const salaryRate = () => import("@/modules/13_salary/views/salaryRate.vue");
const salaryRound = () => import("@/modules/13_salary/views/salaryRound.vue"); // รอบการขึ้นเงินเดือน
const salaryLists = () => import("@/modules/13_salary/views/salaryLists.vue"); const salaryRound = () =>
import("@/modules/13_salary/views/03_salaryRound.vue");
// รายการเลื่อนเงินเดือนข้าราชการ ฯ
const salaryLists = () =>
import("@/modules/13_salary/views/04_salaryLists.vue");
// รายการเลื่อนค่าจ้างลูกจ้างประจำ
const salaryEmployeeLists = () => const salaryEmployeeLists = () =>
import("@/modules/13_salary/views/salaryEmployeeLists.vue"); import("@/modules/13_salary/views/05_salaryListsEmployee.vue");
//ออกคำสั่ง
const commandSalary = () => const commandSalary = () =>
import("@/modules/13_salary/views/commandSalary.vue"); import("@/modules/13_salary/views/commandSalary.vue");
const commandSalaryAdd = () => const commandSalaryAdd = () =>
import("@/modules/13_salary/components/Command/detail.vue"); import("@/modules/13_salary/components/Command/detail.vue");
// const commandSalary = () => import("@/modules/13_salary/views/commandSalary.vue");
// const commandSalary = () => import("@/modules/13_salary/views/commandSalary.vue");
export default [ export default [
{ {
path: "/salary", path: "/salary",

View file

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue"; import { ref, onMounted, reactive, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
@ -17,13 +19,8 @@ import type { FormQuerySalary } from "@/modules/13_salary/interface/request/Main
/** /**
* importComponents * importComponents
*/ */
import DialogFormMain from "@/modules/13_salary/components/SalaryChart/DialogFormMain.vue"; // import DialogFormMain from "@/modules/13_salary/components/01_Salary/DialogFormMain.vue"; //
import DialogFormUpload from "@/modules/13_salary/components/SalaryChart/DialogUpload.vue"; // import DialogFormUpload from "@/modules/13_salary/components/01_Salary/DialogUpload.vue"; //
/**
*importStore
*/
import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
@ -38,12 +35,12 @@ const {
} = useCounterMixin(); } = useCounterMixin();
/** modalDialog*/ /** modalDialog*/
const modalDialogFormMain = ref<boolean>(false); const modalDialogFormMain = ref<boolean>(false); //popup ,
const modalUpload = ref<boolean>(false); const modalUpload = ref<boolean>(false); //popup
const rowId = ref<string>(""); const rowId = ref<string>(""); // id
/** Table*/ /** Table*/
const rows = ref<Salary[]>([]); const rows = ref<Salary[]>([]); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "name", name: "name",
@ -95,30 +92,30 @@ const formQuery = reactive<FormQuerySalary>({
pageSize: 10, //* pageSize: 10, //*
keyword: "", //keyword keyword: "", //keyword
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1); //
const total = ref<number>(); const total = ref<number>(); //
const isActive = ref<boolean>(false); const isActive = ref<boolean>(false); //
const typeAction = ref<string>(""); const typeAction = ref<string>(""); //
const dataRow = ref<Salary>(); const dataSalary = ref<Salary>(); //
/** /**
* fetch อมลรายการผงบญชเงนเดอน * fetch อมลรายการผงบญชเงนเดอน
*/ */
function fetchListSalaly() { async function fetchListSalaly() {
showLoader(); showLoader();
const page = formQuery.page.toString(); const page = formQuery.page.toString();
const pageSize = formQuery.pageSize.toString(); const pageSize = formQuery.pageSize.toString();
const keyword = formQuery.keyword.toString(); const keyword = formQuery.keyword.toString();
http await http
.get( .get(
config.API.salaryChart + config.API.salaryChart +
`?page=${page}&pageSize=${pageSize}&keyword=${keyword}` `?page=${page}&pageSize=${pageSize}&keyword=${keyword}`
) )
.then(async (res) => { .then(async (res) => {
total.value = res.data.result.total; const data = await res.data.result;
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize); rows.value = data.data;
const data = await res.data.result.data; total.value = data.total;
rows.value = await data; maxPage.value = Math.ceil(data.total / formQuery.pageSize);
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -137,7 +134,7 @@ function onClickSalary(type: string, data: Salary | null) {
modalDialogFormMain.value = !modalDialogFormMain.value; modalDialogFormMain.value = !modalDialogFormMain.value;
typeAction.value = type; typeAction.value = type;
if (data) { if (data) {
dataRow.value = data; dataSalary.value = data;
} }
} }
@ -204,13 +201,6 @@ function onClickUpload(type: string, id: string, active: boolean) {
isActive.value = active; isActive.value = active;
} }
/**
* callbackFunction ทำงานเมอมการ เปลยนหนาหร แถว
*/
watch([() => formQuery.page, () => formQuery.pageSize], () => {
fetchListSalaly();
});
/** /**
* function updatePagination * function updatePagination
* @param newPagination อม Pagination ใหม * @param newPagination อม Pagination ใหม
@ -227,6 +217,13 @@ function filterFn(page: number) {
page !== 1 ? (formQuery.page = 1) : fetchListSalaly(); page !== 1 ? (formQuery.page = 1) : fetchListSalaly();
} }
/**
* callbackFunction ทำงานเมอมการ เปลยนหนาหร แถว
*/
watch([() => formQuery.page, () => formQuery.pageSize], () => {
fetchListSalaly();
});
/** hooklifecycle*/ /** hooklifecycle*/
onMounted(() => { onMounted(() => {
fetchListSalaly(); fetchListSalaly();
@ -497,17 +494,17 @@ onMounted(() => {
<!-- popup งบญชเงนเดอน --> <!-- popup งบญชเงนเดอน -->
<DialogFormMain <DialogFormMain
v-model:modal="modalDialogFormMain" v-model:modal="modalDialogFormMain"
:typeAction="typeAction" :fetch-data="fetchListSalaly"
:data="dataRow" :type-action="typeAction"
:fetchData="fetchListSalaly" :data="dataSalary"
/> />
<!-- popup ปโหลดเอกสารอางอ --> <!-- popup ปโหลดเอกสารอางอ -->
<DialogFormUpload <DialogFormUpload
v-model:modal="modalUpload" v-model:modal="modalUpload"
:typeAction="typeAction" :type-action="typeAction"
:fetch-data="fetchListSalaly"
:id="rowId" :id="rowId"
:fetchData="fetchListSalaly"
:isActive="isActive" :isActive="isActive"
/> />
</template> </template>

View file

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
/** importComponents*/ /** importComponents*/
import TabStructure from "@/modules/13_salary/components/salaryEmployeeChart/TabStructure.vue"; import TabStructure from "@/modules/13_salary/components/02_salaryEmployee/TabStructure.vue"; //
import TabCriteris from "@/modules/13_salary/components/salaryEmployeeChart/TabCriteria.vue"; import TabCriteris from "@/modules/13_salary/components/02_salaryEmployee/TabCriteria.vue"; //
/** importStore*/ /** importStore*/
import { useSalaryEmployeeChartDataStore } from "@/modules/13_salary/store/SalaryEmployeeChart"; import { useSalaryEmployeeChartDataStore } from "@/modules/13_salary/store/SalaryEmployeeChart";

View file

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, onMounted } from "vue"; import { ref, watch, onMounted } from "vue";
import { useSalaryDataStore } from "@/modules/13_salary/store/SalaryStore"; import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useSalaryDataStore } from "@/modules/13_salary/store/SalaryStore";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -12,10 +14,7 @@ import type { NewPagination } from "@/modules/13_salary/interface/index/Main";
import type { RowList } from "@/modules/13_salary/interface/response/Main"; import type { RowList } from "@/modules/13_salary/interface/response/Main";
/** importComponents*/ /** importComponents*/
import Dialog from "@/modules/13_salary/components/SalaryRound/DialogForm.vue"; import Dialog from "@/modules/13_salary/components/03_salaryRound/DialogForm.vue";
/** importStore*/
import { useQuasar } from "quasar";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
@ -30,24 +29,24 @@ const {
success, success,
} = useCounterMixin(); } = useCounterMixin();
const idRound = ref<string>(""); const idRound = ref<string>(""); //id
const year = ref<number>(0);
const filterKeyword = ref<string>("");
const editCheck = ref<boolean>(false);
const dialog = ref<boolean>(false);
const period = ref<string>("");
const isActive = ref<boolean>(false);
const isRead = ref<boolean>(false);
const effectiveDate = ref<Date | null>(null);
const yearData = ref<number | null>(0); const editCheck = ref<boolean>(false); //
const maxPage = ref<number>(1); const dialog = ref<boolean>(false); //popup
const totalList = ref<number>(0); const period = ref<string>("");
const currentPage = ref<number>(1); const isActive = ref<boolean>(false); //
const page = ref<number>(1); const isRead = ref<boolean>(false); //
const rowsPerPage = ref<number>(10); const effectiveDate = ref<Date | null>(null); //
const yearData = ref<number | null>(0); //
/** Table*/ /** Table*/
const year = ref<number>(0); //
const filterKeyword = ref<string>(""); //
const currentPage = ref<number>(1); //
const maxPage = ref<number>(1); //
const totalList = ref<number>(0); //
const page = ref<number>(1); //
const rowsPerPage = ref<number>(10); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -118,7 +117,9 @@ const pagination = ref({
rowsPerPage: rowsPerPage.value, rowsPerPage: rowsPerPage.value,
}); });
/** function เปืด Dialog เพิ่มรอบการขึ้นเงินเดือน */ /**
* function เป Dialog เพมรอบการขนเงนเดอน
*/
function clickAdd() { function clickAdd() {
dialog.value = true; dialog.value = true;
editCheck.value = false; editCheck.value = false;
@ -127,17 +128,18 @@ function clickAdd() {
/** /**
* fetch รายการรอบการขนเงนเดอน * fetch รายการรอบการขนเงนเดอน
*/ */
function getData() { async function getData() {
showLoader(); showLoader();
http await http
.get( .get(
config.API.salaryPeriod() + config.API.salaryPeriod() +
`?page=${page.value}&pageSise=${rowsPerPage.value}&keyword=${filterKeyword.value}&year=${year.value}` `?page=${page.value}&pageSise=${rowsPerPage.value}&keyword=${filterKeyword.value}&year=${year.value}`
) )
.then((res) => { .then(async (res) => {
dataStore.fetchDataMap(res.data.result.data); const data = await res.data.result;
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); dataStore.fetchDataMap(data.data);
totalList.value = res.data.result.total; maxPage.value = Math.ceil(data.total / rowsPerPage.value);
totalList.value = data.total;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -147,12 +149,16 @@ function getData() {
}); });
} }
/** function เลือกปีงบประมาณ*/ /**
* function เลอกปงบประมาณ
*/
function updateYear() { function updateYear() {
page.value = 1; page.value = 1;
getData(); getData();
} }
/** set ปี ทั้งหมด */ /**
* set งหมด
*/
function yearAll() { function yearAll() {
year.value = 0; year.value = 0;
getData(); getData();
@ -234,7 +240,9 @@ function updatePageSize(newPagination: NewPagination) {
rowsPerPage.value = newPagination.rowsPerPage; rowsPerPage.value = newPagination.rowsPerPage;
} }
/** callbackFunction ทำเมื่อมีการอัปเดท แถวต่อหน้า แล้ว fetch รายการรอบการขึ้นเงินเดือน*/ /**
* callbackFunction ทำเมอมการอปเดท แถวตอหน แล fetch รายการรอบการขนเงนเดอน
*/
watch( watch(
() => rowsPerPage.value, () => rowsPerPage.value,
() => { () => {
@ -246,7 +254,6 @@ watch(
onMounted(async () => { onMounted(async () => {
year.value = new Date().getFullYear(); year.value = new Date().getFullYear();
getData(); getData();
dataStore.visibleColumns = visibleColumns.value; dataStore.visibleColumns = visibleColumns.value;
dataStore.columns = columns.value; dataStore.columns = columns.value;
}); });
@ -518,14 +525,14 @@ onMounted(async () => {
<Dialog <Dialog
v-model:modal="dialog" v-model:modal="dialog"
:edit="editCheck"
:get-data="getData"
:idRound="idRound"
:period="period"
v-model:effective="effectiveDate"
:isActive="isActive"
v-model:is-read="isRead" v-model:is-read="isRead"
v-model:year="yearData" v-model:year="yearData"
v-model:effective="effectiveDate"
:edit="editCheck"
:get-data="getData"
:id-round="idRound"
:period="period"
:is-active="isActive"
/> />
</template> </template>

View file

@ -1,10 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import { useCounterMixin } from "@/stores/mixin";
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 PageDashBoard from "@/modules/13_salary/components/SalaryLists/Dashboard.vue";
/** importType*/ /** importType*/
import type { import type {
@ -18,11 +19,11 @@ import type {
} from "@/modules/13_salary/interface/response/SalaryList"; } from "@/modules/13_salary/interface/response/SalaryList";
/** importComponents*/ /** importComponents*/
import TabGroup from "@/modules/13_salary/components/SalaryLists/TabMain.vue"; import TabGroup from "@/modules/13_salary/components/04_salaryLists/TabMain.vue";
import ProcessStep from "@/modules/13_salary/components/04_salaryLists/ProcessStep.vue";
import PageDashBoard from "@/modules/13_salary/components/04_salaryLists/Dashboard.vue";
/** importStore*/ /** importStore*/
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const store = useSalaryListSDataStore(); const store = useSalaryListSDataStore();
@ -30,16 +31,18 @@ const $q = useQuasar();
const { messageError, showLoader, hideLoader } = useCounterMixin(); const { messageError, showLoader, hideLoader } = useCounterMixin();
/** ตัวแปร*/ /** ตัวแปร*/
const year = ref<number>(new Date().getFullYear()); const year = ref<number>(new Date().getFullYear()); //
const roundFilter = ref<any>(); const roundFilter = ref<any>(); //
const roundOptions = ref<DataOptionShort[]>([]); const agencyFilter = ref<string>(""); //
const agencyFilter = ref<string>(""); const snapFilter = ref<string>(""); //
const agencyOptionsMain = ref<DataOption[]>([]);
const agencyOptions = ref<DataOption[]>([]);
const snapFilter = ref<string>("");
const snapOptions = ref<DataOption[]>([]);
const periodLatest = ref<DataPeriodLatest>(); const periodLatest = ref<DataPeriodLatest>();
//
const roundOptions = ref<DataOptionShort[]>([]); //
const snapOptions = ref<DataOption[]>([]); //
const agencyOptionsMain = ref<DataOption[]>([]); //
const agencyOptions = ref<DataOption[]>([]); //
const isLoad = ref<boolean>(false); const isLoad = ref<boolean>(false);
const isDisable = ref<boolean>(false); const isDisable = ref<boolean>(false);
@ -48,11 +51,13 @@ const page = ref<number>(1);
const pageSize = ref<number>(50); const pageSize = ref<number>(50);
const lastPage = ref<number>(0); const lastPage = ref<number>(0);
/**function เรียกข้อมูลรอบการขึ้นเงินเดือน*/ /**
function getRound() { * function เรยกขอมลรอบการขนเงนเดอน
*/
async function getRound() {
showLoader(); showLoader();
isDisable.value = false; isDisable.value = false;
http await http
.get( .get(
config.API.salaryPeriodActive(year.value.toString()) + config.API.salaryPeriodActive(year.value.toString()) +
`?page=${page.value}&pageSize=${pageSize.value}&keyword=&year=0` `?page=${page.value}&pageSize=${pageSize.value}&keyword=&year=0`
@ -105,7 +110,9 @@ function getRound() {
}); });
} }
/** function เรียกรอบ*/ /**
* function เรยกรอบ
*/
function getSnap(code: string) { function getSnap(code: string) {
snapOptions.value = snapOptions.value =
code == "OCT" code == "OCT"
@ -147,9 +154,9 @@ function getSnap(code: string) {
* function เรยกขอมลหนยวงาน * function เรยกขอมลหนยวงาน
* @param id revisionId * @param id revisionId
*/ */
function getAgency(id: string) { async function getAgency(id: string) {
if (id) { if (id) {
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;
@ -181,9 +188,9 @@ function getAgency(id: string) {
* function เรยกขอมลหนยวงานปจ * function เรยกขอมลหนยวงานปจ
* @param id revisionId * @param id revisionId
*/ */
function getAgencyPosition(id: string) { async function getAgencyPosition(id: string) {
if (id) { if (id) {
http await http
.get(config.API.keycloakPositionByid(id)) .get(config.API.keycloakPositionByid(id))
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
@ -213,7 +220,11 @@ function getAgencyPosition(id: string) {
* @param periodId id รอบการขนเงนเดอน * @param periodId id รอบการขนเงนเดอน
* @param snap id รอบ * @param snap id รอบ
*/ */
function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) { async function fetchSalalyPeriod(
rootId: string,
periodId: string,
snap: string
) {
if (rootId) { if (rootId) {
showLoader(); showLoader();
isLoad.value = false; isLoad.value = false;
@ -223,10 +234,10 @@ function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
snapshot: snap, snapshot: snap,
}; };
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 = await res.data.result;
if (roundFilter.value.shortCode !== "SPECIAL") { if (roundFilter.value.shortCode !== "SPECIAL") {
if (Object.values(data).includes(null)) { if (Object.values(data).includes(null)) {
@ -253,7 +264,9 @@ function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
} }
} }
/** function เปลี่ยนรอบการขั้นเงินเดือน*/ /**
* function เปลยนรอบการขนเงนเดอน
*/
async function onChangeRound() { async function onChangeRound() {
// isClosedRound // isClosedRound
store.isClosedRound = roundFilter.value.isClose; store.isClosedRound = roundFilter.value.isClose;
@ -272,7 +285,9 @@ async function onChangeRound() {
} }
} }
/** function เปลี่ยนรอบ*/ /**
* function เปลยนรอบ
*/
async function onChangeSnap() { async function onChangeSnap() {
// agencyFilter.value = ""; // agencyFilter.value = "";
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
@ -284,7 +299,9 @@ async function onChangeSnap() {
} }
} }
/** function เปลี่ยนหน่วยงาน*/ /**
* function เปลยนหนวยงาน
*/
async function onChangeAgency() { async function onChangeAgency() {
store.rootId = agencyFilter.value; store.rootId = agencyFilter.value;
if ( if (
@ -300,7 +317,9 @@ async function onChangeAgency() {
} }
} }
/** function fetch PeriodQuota*/ /**
* function fetch PeriodQuota
*/
function getQuota() { function getQuota() {
http http
.get(config.API.salaryListPeriodQuota(store.groupId)) .get(config.API.salaryListPeriodQuota(store.groupId))
@ -323,7 +342,7 @@ function filterSelector(val: string, update: Function, refData: string) {
switch (refData) { switch (refData) {
case "agencyFilter": case "agencyFilter":
update(() => { update(() => {
agencyFilter.value = ""; agencyFilter.value = val === "" ? agencyFilter.value : "";
agencyOptions.value = agencyOptionsMain.value.filter( agencyOptions.value = agencyOptionsMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
@ -462,10 +481,10 @@ onMounted(() => {
<div v-if="agencyFilter !== 'ALL'"> <div v-if="agencyFilter !== 'ALL'">
<TabGroup <TabGroup
v-if="isLoad" v-if="isLoad"
:periodLatest="periodLatest" :period-latest="periodLatest"
:periodId="roundFilter.id" :period-id="roundFilter.id"
:rootId="agencyFilter" :root-id="agencyFilter"
:roundFilter="roundFilter" :round-filter="roundFilter"
/> />
<q-card v-else class="q-pa-sm"> <q-card v-else class="q-pa-sm">
<div class="q-pa-sm"> <div class="q-pa-sm">
@ -478,8 +497,8 @@ onMounted(() => {
<div v-else> <div v-else>
<PageDashBoard <PageDashBoard
:year="year" :year="year"
:snapShot="snapFilter" :snap-shot="snapFilter"
:roundFilter="roundFilter" :round-filter="roundFilter"
/> />
</div> </div>
</q-card> </q-card>
@ -492,8 +511,8 @@ onMounted(() => {
> >
<ProcessStep <ProcessStep
v-if="agencyFilter !== 'ALL'" v-if="agencyFilter !== 'ALL'"
:periodId="roundFilter.id" :period-id="roundFilter.id"
:rootId="agencyFilter" :root-id="agencyFilter"
:get-data="getQuota" :get-data="getQuota"
/> />
</q-card> </q-card>

View file

@ -1,6 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, nextTick } from "vue"; import { onMounted, ref, nextTick } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import { useCounterMixin } from "@/stores/mixin";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -16,13 +19,9 @@ import type {
} from "@/modules/13_salary/interface/response/SalaryList"; } from "@/modules/13_salary/interface/response/SalaryList";
/** importComponents*/ /** importComponents*/
import TabGroup from "@/modules/13_salary/components/SalaryEmployeeLists/TabMain.vue"; import TabGroup from "@/modules/13_salary/components/05_salaryListsEmployee/TabMain.vue";
import ProcessStep from "@/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue"; import ProcessStep from "@/modules/13_salary/components/05_salaryListsEmployee/ProcessStep.vue";
import PageDashBoard from "@/modules/13_salary/components/SalaryEmployeeLists/Dashboard.vue"; import PageDashBoard from "@/modules/13_salary/components/05_salaryListsEmployee/Dashboard.vue";
/** importStore*/
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const store = useSalaryEmployeeListSDataStore(); const store = useSalaryEmployeeListSDataStore();
@ -30,17 +29,18 @@ const $q = useQuasar();
const { messageError, showLoader, hideLoader } = useCounterMixin(); const { messageError, showLoader, hideLoader } = useCounterMixin();
/** ตัวแปร*/ /** ตัวแปร*/
const year = ref<number>(new Date().getFullYear()); const year = ref<number>(new Date().getFullYear()); //
const roundFilter = ref<any>(); const roundFilter = ref<any>(); //
const roundOptions = ref<DataOptionShort[]>([]); const agencyFilter = ref<string>(""); //
const agencyFilter = ref<string>(""); const snapFilter = ref<string>(""); //
const agencyOptions = ref<DataOption[]>([]);
const agencyOptionsMain = ref<DataOption[]>([]);
const snapFilter = ref<string>("");
const snapOptions = ref<DataOption[]>([]);
const periodLatest = ref<DataPeriodLatest>(); const periodLatest = ref<DataPeriodLatest>();
//
const roundOptions = ref<DataOptionShort[]>([]); //
const snapOptions = ref<DataOption[]>([]); //
const agencyOptionsMain = ref<DataOption[]>([]); //
const agencyOptions = ref<DataOption[]>([]); //
const isLoad = ref<boolean>(false); const isLoad = ref<boolean>(false);
const isDisable = ref<boolean>(false); const isDisable = ref<boolean>(false);
@ -51,11 +51,13 @@ const lastPage = ref<number>(0);
const loading = ref(false); const loading = ref(false);
const nextPage = ref<number>(1); const nextPage = ref<number>(1);
/**function เรียกข้อมูลรอบการขึ้นค่าจ้าง*/ /**
function getRound() { * function เรยกขอมลรอบการขนคาจาง
*/
async function getRound() {
showLoader(); showLoader();
isDisable.value = false; isDisable.value = false;
http await http
.get( .get(
config.API.salaryPeriodActive(year.value.toString()) + config.API.salaryPeriodActive(year.value.toString()) +
`?page=${page.value}&pageSize=${pageSize.value}&keyword=&year=0` `?page=${page.value}&pageSize=${pageSize.value}&keyword=&year=0`
@ -107,8 +109,10 @@ function getRound() {
}); });
} }
/** function เรียกรอบ*/ /**
function getSnap(code: string) { * function เรยกรอบ
*/
async function getSnap(code: string) {
snapOptions.value = snapOptions.value =
code == "OCT" code == "OCT"
? [ ? [
@ -213,7 +217,11 @@ async function getAgencyPosition(id: string) {
* @param periodId id รอบการขนคาจาง * @param periodId id รอบการขนคาจาง
* @param snap id รอบ * @param snap id รอบ
*/ */
function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) { async function fetchSalalyPeriod(
rootId: string,
periodId: string,
snap: string
) {
if (rootId) { if (rootId) {
showLoader(); showLoader();
isLoad.value = false; isLoad.value = false;
@ -223,14 +231,12 @@ function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
snapshot: snap, snapshot: snap,
}; };
http await http
.post(config.API.salaryListPeriodLatestEmp, body) .post(config.API.salaryListPeriodLatestEmp, body)
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
data && store.fetchPeriodLatest(data, store.tabGroup); data && store.fetchPeriodLatest(data, store.tabGroup);
periodLatest.value = data; periodLatest.value = data;
isLoad.value = data.group1id ? true : false; isLoad.value = data.group1id ? true : false;
}) })
.catch((err) => { .catch((err) => {
@ -244,7 +250,9 @@ function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
} }
} }
/** function เปลี่ยนรอบการขั้นค่าจ้าง*/ /**
* function เปลยนรอบการขนคาจาง
*/
async function onChangeRound() { async function onChangeRound() {
// isClosedRound // isClosedRound
store.isClosedRound = roundFilter.value.isClose; store.isClosedRound = roundFilter.value.isClose;
@ -260,7 +268,9 @@ async function onChangeRound() {
} }
} }
/** function เปลี่ยนรอบ*/ /**
* 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(
@ -271,7 +281,9 @@ async function onChangeSnap() {
} }
} }
/** function เปลี่ยนหน่วยงาน*/ /**
* function เปลยนหนวยงาน
*/
async function onChangeAgency() { async function onChangeAgency() {
store.rootId = agencyFilter.value; store.rootId = agencyFilter.value;
@ -288,7 +300,9 @@ async function onChangeAgency() {
} }
} }
/** function onScrollSelect รอบการขึ้นค่าจ้าง*/ /**
* function onScrollSelect รอบการขนคาจาง
*/
function onScroll({ to, ref }: { to: number; ref: any }) { function onScroll({ to, ref }: { to: number; ref: any }) {
const lastIndex = roundOptions.value.length - 1; const lastIndex = roundOptions.value.length - 1;
@ -311,15 +325,24 @@ function onScroll({ to, ref }: { to: number; ref: any }) {
} }
} }
/**
* function fetch PeriodQuota
*/
function getQuota() { function getQuota() {
fetchSalalyPeriod(agencyFilter.value, roundFilter.value.id, snapFilter.value); fetchSalalyPeriod(agencyFilter.value, roundFilter.value.id, snapFilter.value);
} }
function filterSelector(val: any, update: Function, refData: string) { /**
* functioon นหาขอมลรายการหนวยงาน
* @param val คำคนหา
* @param update function
* @param refData typeSelector
*/
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) { switch (refData) {
case "agencyFilter": case "agencyFilter":
update(() => { update(() => {
agencyFilter.value = ""; agencyFilter.value = val === "" ? agencyFilter.value : "";
agencyOptions.value = agencyOptionsMain.value.filter( agencyOptions.value = agencyOptionsMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
@ -455,10 +478,10 @@ onMounted(() => {
<div v-if="agencyFilter !== 'ALL'"> <div v-if="agencyFilter !== 'ALL'">
<TabGroup <TabGroup
v-if="isLoad" v-if="isLoad"
:periodLatest="periodLatest" :period-latest="periodLatest"
:periodId="roundFilter.id" :period-id="roundFilter.id"
:rootId="agencyFilter" :root-id="agencyFilter"
:roundFilter="roundFilter" :round-filter="roundFilter"
/> />
<q-card v-else class="q-pa-sm"> <q-card v-else class="q-pa-sm">
<div class="q-pa-sm"> <div class="q-pa-sm">
@ -471,8 +494,8 @@ onMounted(() => {
<div v-else> <div v-else>
<PageDashBoard <PageDashBoard
:year="year" :year="year"
:snapShot="snapFilter" :snap-shot="snapFilter"
:roundFilter="roundFilter" :round-filter="roundFilter"
/> />
</div> </div>
</q-card> </q-card>
@ -485,8 +508,8 @@ onMounted(() => {
> >
<ProcessStep <ProcessStep
v-if="agencyFilter !== 'ALL'" v-if="agencyFilter !== 'ALL'"
:periodId="roundFilter.id" :period-id="roundFilter.id"
:rootId="agencyFilter" :root-id="agencyFilter"
:get-data="getQuota" :get-data="getQuota"
/> />
</q-card> </q-card>

View file

@ -21,7 +21,7 @@ import type { FormQuerySalary } from "@/modules/13_salary/interface/request/Main
/** /**
* importComponents * importComponents
*/ */
import DialogFormRate from "@/modules/13_salary/components/SalaryChart/DialogFormRate.vue"; import DialogFormRate from "@/modules/13_salary/components/01_Salary/DialogFormRate.vue";
/** /**
* importStore * importStore
@ -125,30 +125,34 @@ const formQuery = reactive<FormQuerySalary>({
pageSize: 100, //* pageSize: 100, //*
keyword: "", //keyword keyword: "", //keyword
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1); //
const totalRow = ref<number>(0); const totalRow = ref<number>(0); //
const pagination = ref({ const pagination = ref({
page: 1, page: 1,
rowsPerPage: 100, rowsPerPage: 100,
}); });
const typeAction = ref<string>(""); //
const dataSalaryRate = ref<SalaryRate>(); //
/** /**
* fetch รายการอตราเงนเดอน * fetch รายการอตราเงนเดอน
*/ */
async function fetchListSalalyRate() { async function fetchListSalalyRate() {
showLoader(); showLoader();
const page = await formQuery.page.toString(); const page = formQuery.page.toString();
const pageSize = await formQuery.pageSize.toString(); const pageSize = formQuery.pageSize.toString();
const keyword = await formQuery.keyword.toString(); const keyword = formQuery.keyword.toString();
await http await http
.get( .get(
config.API.salaryRateListByid(salaryId.value) + config.API.salaryRateListByid(salaryId.value) +
`?page=${page}&pageSize=${pageSize}&keyword=${keyword}` `?page=${page}&pageSize=${pageSize}&keyword=${keyword}`
) )
.then((res) => { .then(async (res) => {
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize); const data = await res.data.result;
totalRow.value = res.data.result.total; rows.value = data.data;
rows.value = res.data.result.data; totalRow.value = data.total;
maxPage.value = Math.ceil(data.total / formQuery.pageSize);
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -158,13 +162,16 @@ async function fetchListSalalyRate() {
}); });
} }
const typeAction = ref<string>(""); /**
const dataRow = ref<SalaryRate>(); * function openDialog เพ,แกไข ตราเงนเดอน
* @param type ประเภท แกไข,เพ
* @param data อมลอตราเงนเดอน
*/
function onClickSalaryRate(type: string, data: SalaryRate | null) { function onClickSalaryRate(type: string, data: SalaryRate | null) {
modalDialogFormRate.value = !modalDialogFormRate.value; modalDialogFormRate.value = !modalDialogFormRate.value;
typeAction.value = type; typeAction.value = type;
if (data) { if (data) {
dataRow.value = data; dataSalaryRate.value = data;
} }
} }
@ -215,9 +222,10 @@ function clickDownload() {
function fetchDataSalary() { function fetchDataSalary() {
http http
.get(config.API.salaryChartByid(salaryId.value)) .get(config.API.salaryChartByid(salaryId.value))
.then((res) => { .then(async (res) => {
isActive.value = res.data.result.isActive; const data = await res.data.result;
posType.value = `${res.data.result.posTypeName}(${res.data.result.posLevelName})`; isActive.value = data.isActive;
posType.value = `${data.posTypeName}(${data.posLevelName})`;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -233,13 +241,15 @@ function updatePagination(newPagination: NewPagination) {
formQuery.pageSize = newPagination.rowsPerPage; formQuery.pageSize = newPagination.rowsPerPage;
} }
onMounted(async () => { /**
fetchDataSalary(); * ทำงานเมอมการ เปลยนหนาหร แถว
*/
watch([() => formQuery.page, () => formQuery.pageSize], async () => {
await fetchListSalalyRate(); await fetchListSalalyRate();
}); });
watch([() => formQuery.page, () => formQuery.pageSize], async () => { onMounted(async () => {
await fetchListSalalyRate(); await Promise.all([fetchDataSalary(), fetchListSalalyRate()]);
}); });
</script> </script>
@ -259,6 +269,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
ตราเงนเดอนของ{{ posType }} ตราเงนเดอนของ{{ posType }}
</div> </div>
</div> </div>
<q-card flat bordered class="q-pa-md"> <q-card flat bordered class="q-pa-md">
<div class="col-12 row"> <div class="col-12 row">
<q-btn <q-btn
@ -402,9 +413,9 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
<DialogFormRate <DialogFormRate
v-model:modal="modalDialogFormRate" v-model:modal="modalDialogFormRate"
:typeAction="typeAction" :type-action="typeAction"
:data="dataRow" :fetch-data="fetchListSalalyRate"
:fetchData="fetchListSalalyRate" :data="dataSalaryRate"
/> />
</template> </template>

View file

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted, watch } from "vue"; import { ref, reactive, onMounted, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
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";
@ -17,10 +19,7 @@ import type { FormFilter } from "@/modules/13_salary/interface/request/EmployeeC
import type { EmployeeRateSalary } from "@/modules/13_salary/interface/response/salaryEmployeeChart"; import type { EmployeeRateSalary } from "@/modules/13_salary/interface/response/salaryEmployeeChart";
/** importComponts*/ /** importComponts*/
import DialogEmployeeRate from "@/modules/13_salary/components/salaryEmployeeChart/DialogEmployeeRate.vue"; import DialogEmployeeRate from "@/modules/13_salary/components/02_salaryEmployee/DialogEmployeeRate.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const route = useRoute(); const route = useRoute();
@ -29,9 +28,21 @@ const $q = useQuasar();
const { dialogRemove, messageError, showLoader, hideLoader, success } = const { dialogRemove, messageError, showLoader, hideLoader, success } =
useCounterMixin(); useCounterMixin();
const salaryEmployeeId = ref<string>(route.params.id.toString()); const salaryEmployeeId = ref<string>(route.params.id.toString()); //id
const modalDialogEmployeeRate = ref<boolean>(false); //;
const isStatusEdit = ref<boolean>(false); //
const dataRow = ref<EmployeeRateSalary>(); //
/** ข้อมูล Table*/ /** ข้อมูล Table*/
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 100,
keyword: "",
});
const rows = ref<EmployeeRateSalary[]>([]); //
const maxPage = ref<number>(1); //
const totalList = ref<number>(0); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "step", name: "step",
@ -75,9 +86,11 @@ const columns = ref<QTableProps["columns"]>([
}), }),
}, },
]); ]);
const rows = ref<EmployeeRateSalary[]>([]);
const visibleColumns = ref<string[]>(["step", "salaryMonth", "salaryDay"]); const visibleColumns = ref<string[]>(["step", "salaryMonth", "salaryDay"]);
const pagination = ref({
page: formFilter.page,
rowsPerPage: formFilter.pageSize,
});
/** List Mune*/ /** List Mune*/
const itemMenu = ref<ItemsMenu[]>([ const itemMenu = ref<ItemsMenu[]>([
{ {
@ -94,27 +107,14 @@ const itemMenu = ref<ItemsMenu[]>([
type: "delete", type: "delete",
}, },
]); ]);
const isActive = ref<boolean>(false); //
const formFilter = reactive<FormFilter>({ const groupSalary = ref<string>(""); //
page: 1,
pageSize: 100,
keyword: "",
});
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
const pagination = ref({
page: formFilter.page,
rowsPerPage: formFilter.pageSize,
});
const isActive = ref<boolean>(false);
const groupSalary = ref<string>("");
/** /**
* fetch อมลอตราคาจาง * fetch อมลอตราคาจาง
*/ */
function fetchDataDetail() { async function fetchDataDetail() {
http await http
.get(config.API.salaryEmployeeChartByid(salaryEmployeeId.value)) .get(config.API.salaryEmployeeChartByid(salaryEmployeeId.value))
.then((res) => { .then((res) => {
isActive.value = res.data.result.isActive; isActive.value = res.data.result.isActive;
@ -128,17 +128,18 @@ function fetchDataDetail() {
/** /**
* fetch ตราคาจาง * fetch ตราคาจาง
*/ */
function fetchSalalyEmployeeRate() { async function fetchSalalyEmployeeRate() {
showLoader(); showLoader();
http await http
.get( .get(
config.API.salaryEmployeeRateListByid(salaryEmployeeId.value) + config.API.salaryEmployeeRateListByid(salaryEmployeeId.value) +
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}` `?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}`
) )
.then((res) => { .then(async (res) => {
rows.value = res.data.result.data; const data = res.data.result;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); rows.value = data.data;
totalList.value = res.data.result.total; maxPage.value = Math.ceil(data.total / formFilter.pageSize);
totalList.value = data.total;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -148,10 +149,6 @@ function fetchSalalyEmployeeRate() {
}); });
} }
const modalDialogEmployeeRate = ref<boolean>(false);
const isStatusEdit = ref<boolean>(false);
const dataRow = ref<EmployeeRateSalary>();
/** /**
* แกไขขอมลรายการอตราคาจาง * แกไขขอมลรายการอตราคาจาง
* @param data อมลรายการอตราคาจาง * @param data อมลรายการอตราคาจาง
@ -192,17 +189,27 @@ function onClickAdd() {
isStatusEdit.value = false; isStatusEdit.value = false;
} }
/**
* งกนเปลยนหนาขอม
* @param val หนาทองการไป
*/
function updatePage(val: number) { function updatePage(val: number) {
formFilter.page = val; formFilter.page = val;
fetchSalalyEmployeeRate(); fetchSalalyEmployeeRate();
} }
/**
* งกนเปลยนแถวตอหน
* @param newPagination จำนวนแถว
*/
function updatePageSize(newPagination: NewPagination) { function updatePageSize(newPagination: NewPagination) {
formFilter.page = 1; formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage; formFilter.pageSize = newPagination.rowsPerPage;
} }
/** click download */ /**
* click download
*/
function clickDownload() { function clickDownload() {
showLoader(); showLoader();
http http
@ -337,8 +344,8 @@ onMounted(async () => {
<DialogEmployeeRate <DialogEmployeeRate
v-model:modal="modalDialogEmployeeRate" v-model:modal="modalDialogEmployeeRate"
:isStatusEdit="isStatusEdit" :is-status-edit="isStatusEdit"
:fetchData="fetchSalalyEmployeeRate" :fetch-data="fetchSalalyEmployeeRate"
:data="dataRow as EmployeeRateSalary" :data="dataRow as EmployeeRateSalary"
/> />
</template> </template>

View file

@ -350,3 +350,5 @@ defineExpose({
:saveData="onSubmitPerson" :saveData="onSubmitPerson"
/> />
</template> </template>
<style scoped></style>