api ผังบัญชีค่าจ้างลูกจ้างประจำ => บัญชีโครงสร้าง
This commit is contained in:
parent
20ad3b34e7
commit
94e5e136e6
9 changed files with 648 additions and 107 deletions
|
|
@ -1,11 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue";
|
||||
import { ref, reactive, onMounted, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** importType*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { ItemsMenu } from "@/modules/13_salary/interface/index/Main";
|
||||
import type {
|
||||
ItemsMenu,
|
||||
NewPagination,
|
||||
} from "@/modules/13_salary/interface/index/Main";
|
||||
import type { FormFilter } from "@/modules/13_salary/interface/request/EmployeeChart";
|
||||
import type { EmployeeRateSalary } from "@/modules/13_salary/interface/response/salaryEmployeeChart";
|
||||
|
||||
/** importComponts*/
|
||||
import DialogEmployeeRate from "@/modules/13_salary/components/salaryEmployeeChart/DialogEmployeeRate.vue";
|
||||
|
|
@ -14,49 +21,46 @@ import DialogEmployeeRate from "@/modules/13_salary/components/salaryEmployeeCha
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** use*/
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const $q = useQuasar();
|
||||
const { dialogRemove, messageError, showLoader, hideLoader, success } =
|
||||
useCounterMixin();
|
||||
|
||||
const salaryEmployeeId = ref<string>(route.params.id.toString());
|
||||
|
||||
/** ข้อมูล Table*/
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
name: "step",
|
||||
align: "left",
|
||||
label: "ลำดับขั้น",
|
||||
sortable: true,
|
||||
field: "no",
|
||||
field: "step",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "month",
|
||||
name: "salaryMonth",
|
||||
align: "left",
|
||||
label: "อัตราค่าจ้าง/ชั้นวิ่ง (รายเดือน)",
|
||||
sortable: true,
|
||||
field: "month",
|
||||
field: "salaryMonth",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "day",
|
||||
name: "salaryDay",
|
||||
align: "left",
|
||||
label: "อัตราค่าจ้าง/ชั้นวิ่ง (รายวัน)",
|
||||
sortable: true,
|
||||
field: "day",
|
||||
field: "salaryDay",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const rows = ref<any>([
|
||||
{
|
||||
no: "1",
|
||||
month: 100000,
|
||||
day: 5000,
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<string[]>(["no", "month", "day"]);
|
||||
const rows = ref<EmployeeRateSalary[]>([]);
|
||||
const visibleColumns = ref<string[]>(["step", "salaryMonth", "salaryDay"]);
|
||||
|
||||
/** List Mune*/
|
||||
const itemMenu = ref<ItemsMenu[]>([
|
||||
|
|
@ -75,26 +79,48 @@ const itemMenu = ref<ItemsMenu[]>([
|
|||
},
|
||||
]);
|
||||
|
||||
const formFilter = reactive({
|
||||
const formFilter = reactive<FormFilter>({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
keyword: "",
|
||||
});
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
const pagination = ref({
|
||||
page: formFilter.page,
|
||||
rowsPerPage: formFilter.pageSize,
|
||||
});
|
||||
|
||||
function fetchSalalyEmployeeRate() {
|
||||
showLoader();
|
||||
http
|
||||
.get(
|
||||
config.API.salaryEmployeeRateListByid(salaryEmployeeId.value) +
|
||||
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}`
|
||||
)
|
||||
.then((res) => {
|
||||
rows.value = res.data.result.data;
|
||||
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
const modalDialogEmployeeRate = ref<boolean>(false);
|
||||
const isStatusEdit = ref<boolean>(false);
|
||||
const dataRow = ref<EmployeeRateSalary>();
|
||||
|
||||
function onClickAction(type: string, data: any) {
|
||||
function onClickAction(type: string, data: EmployeeRateSalary) {
|
||||
switch (type) {
|
||||
case "edit":
|
||||
onEdit();
|
||||
onEdit(data);
|
||||
break;
|
||||
case "delete":
|
||||
onDelete();
|
||||
onDelete(data.id);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -102,19 +128,58 @@ function onClickAction(type: string, data: any) {
|
|||
}
|
||||
}
|
||||
|
||||
function onEdit() {
|
||||
function onEdit(data: EmployeeRateSalary) {
|
||||
modalDialogEmployeeRate.value = true;
|
||||
isStatusEdit.value = true;
|
||||
dataRow.value = data;
|
||||
}
|
||||
|
||||
function onDelete() {
|
||||
dialogRemove($q, () => {});
|
||||
function onDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
http
|
||||
.delete(config.API.salaryEmployeeRateListByid(id))
|
||||
.then(() => {
|
||||
fetchSalalyEmployeeRate();
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
function onClickAdd() {
|
||||
modalDialogEmployeeRate.value = true;
|
||||
isStatusEdit.value = false;
|
||||
}
|
||||
|
||||
function filterFn() {
|
||||
formFilter.page = 1;
|
||||
fetchSalalyEmployeeRate();
|
||||
}
|
||||
|
||||
function updatePage(val: number) {
|
||||
formFilter.page = val;
|
||||
fetchSalalyEmployeeRate();
|
||||
}
|
||||
|
||||
function updatePageSize(newPagination: NewPagination) {
|
||||
formFilter.page = 1;
|
||||
formFilter.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formFilter.pageSize,
|
||||
() => {
|
||||
fetchSalalyEmployeeRate();
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
fetchSalalyEmployeeRate();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="row items-center">
|
||||
|
|
@ -141,9 +206,9 @@ function onClickAdd() {
|
|||
<q-input
|
||||
borderless
|
||||
dense
|
||||
debounce="300"
|
||||
outlined
|
||||
v-model="formFilter.keyword"
|
||||
@keydown.enter.pervrnt="filterFn"
|
||||
placeholder="ค้นหา"
|
||||
>
|
||||
<template v-slot:append>
|
||||
|
|
@ -175,9 +240,9 @@ function onClickAdd() {
|
|||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="name"
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[10, 20, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
@update:pagination="updatePageSize"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
|
|
@ -191,10 +256,10 @@ function onClickAdd() {
|
|||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<div v-if="col.name === 'month'">
|
||||
<div v-if="col.name === 'salaryMonth'">
|
||||
{{ col.value ? col.value.toLocaleString() : "-" }}
|
||||
</div>
|
||||
<div v-else-if="col.name === 'day'">
|
||||
<div v-else-if="col.name === 'salaryDay'">
|
||||
{{ col.value ? col.value.toLocaleString() : "-" }}
|
||||
</div>
|
||||
<div v-else>{{ col.value ? col.value : "-" }}</div>
|
||||
|
|
@ -239,11 +304,12 @@ function onClickAdd() {
|
|||
v-model="formFilter.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="1"
|
||||
:max="maxPage"
|
||||
:max-pages="5"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
@update:model-value="updatePage"
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
|
|
@ -253,6 +319,8 @@ function onClickAdd() {
|
|||
<DialogEmployeeRate
|
||||
v-model:modal="modalDialogEmployeeRate"
|
||||
:isStatusEdit="isStatusEdit"
|
||||
:fetchData="fetchSalalyEmployeeRate"
|
||||
:data="dataRow as EmployeeRateSalary"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue