api ผังบัญชีค่าจ้างลูกจ้างประจำ => บัญชีโครงสร้าง
This commit is contained in:
parent
20ad3b34e7
commit
94e5e136e6
9 changed files with 648 additions and 107 deletions
|
|
@ -1,11 +1,12 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, ref, reactive, watch } from "vue";
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type { ObjectSalaryRateRef } from "@/modules/13_salary/interface/index/Main";
|
||||
import type { ObjectReteRef } from "@/modules/13_salary/interface/index/EmployeeChart";
|
||||
import type { FormDataRate } from "@/modules/13_salary/interface/request/EmployeeChart";
|
||||
|
||||
import Header from "@/components/DialogHeader.vue";
|
||||
|
||||
|
|
@ -22,7 +23,7 @@ const {
|
|||
success,
|
||||
} = useCounterMixin();
|
||||
|
||||
const salaryId = ref<string>(route.params.id.toString());
|
||||
const salaryEmployeeId = ref<string>(route.params.id.toString());
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const props = defineProps({
|
||||
|
|
@ -34,6 +35,10 @@ const props = defineProps({
|
|||
type: Object,
|
||||
defult: [],
|
||||
},
|
||||
fetchData: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const formData = reactive<any>({
|
||||
|
|
@ -47,7 +52,7 @@ const salaryNoRef = ref<Object | null>(null);
|
|||
const salaryMonthRef = ref<Object | null>(null);
|
||||
const salaryDayRef = ref<Object | null>(null);
|
||||
|
||||
const ObjectRef: any = {
|
||||
const ObjectRef: ObjectReteRef = {
|
||||
salaryNo: salaryNoRef,
|
||||
salaryMonth: salaryMonthRef,
|
||||
salaryDay: salaryDayRef,
|
||||
|
|
@ -65,7 +70,6 @@ function clearFormData() {
|
|||
}
|
||||
|
||||
function onClickSubmit() {
|
||||
console.log(formData.salaryHalfSpecial);
|
||||
const hasError = [];
|
||||
for (const key in ObjectRef) {
|
||||
if (Object.prototype.hasOwnProperty.call(ObjectRef, key)) {
|
||||
|
|
@ -82,30 +86,57 @@ function onClickSubmit() {
|
|||
}
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
closeDialog();
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
const body: FormDataRate = {
|
||||
salaryEmployeeId: !props.isStatusEdit
|
||||
? salaryEmployeeId.value
|
||||
: undefined,
|
||||
step:
|
||||
typeof formData.salaryNo === "number"
|
||||
? formData.salaryNo
|
||||
: Number(formData.salaryNo.replace(/,/g, "")),
|
||||
|
||||
salaryMonth:
|
||||
typeof formData.salaryMonth === "number"
|
||||
? formData.salaryMonth
|
||||
: Number(formData.salaryMonth.replace(/,/g, "")), //*เงินเดือนฐาน
|
||||
|
||||
salaryDay:
|
||||
typeof formData.salaryDay === "number"
|
||||
? formData.salaryDay
|
||||
: Number(formData.salaryDay.replace(/,/g, "")), //0.5 ขั้น
|
||||
};
|
||||
try {
|
||||
const url = !props.isStatusEdit
|
||||
? config.API.salaryEmployeeRateList
|
||||
: config.API.salaryEmployeeRateListByid(props?.data?.id);
|
||||
await http[!props.isStatusEdit ? "post" : "put"](url, body);
|
||||
success($q, "บันทีกข้อมูลสำเร็จ");
|
||||
props.fetchData?.();
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
} finally {
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// watch(
|
||||
// () => modal.value,
|
||||
// () => {
|
||||
// if (modal.value && props.typeAction === "edit") {
|
||||
// if (props.data) {
|
||||
// const data = props.data;
|
||||
// formData.salaryId = data.id;
|
||||
// formData.salary = data.salary;
|
||||
// formData.salaryHalf = data.salaryHalf;
|
||||
// formData.salaryHalfSpecial = data.salaryHalfSpecial;
|
||||
// formData.salaryFull = data.salaryFull;
|
||||
// formData.salaryFullSpecial = data.salaryFullSpecial;
|
||||
// formData.salaryFullHalf = data.salaryFullHalf;
|
||||
// formData.salaryFullHalfSpecial = data.salaryFullHalfSpecial;
|
||||
// formData.isNext = data.isNext;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
watch(
|
||||
() => modal.value,
|
||||
() => {
|
||||
if (modal.value && props.isStatusEdit) {
|
||||
if (props.data) {
|
||||
const data = props.data;
|
||||
console.log(data);
|
||||
formData.salaryNo = data.step;
|
||||
formData.salaryMonth = data.salaryMonth;
|
||||
formData.salaryDay = data.salaryDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue