API รายการผังบัญชีเงินเดือน
This commit is contained in:
parent
3b0dea6b52
commit
7ca7518c23
7 changed files with 461 additions and 129 deletions
|
|
@ -1,6 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, 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";
|
||||
|
||||
|
|
@ -9,6 +12,7 @@ import Header from "@/components/DialogHeader.vue";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const {
|
||||
date2Thai,
|
||||
dialogConfirm,
|
||||
|
|
@ -18,6 +22,8 @@ const {
|
|||
success,
|
||||
} = useCounterMixin();
|
||||
|
||||
const salaryId = ref<string>(route.params.id.toString());
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const props = defineProps({
|
||||
typeAction: {
|
||||
|
|
@ -77,7 +83,6 @@ function closeDialog() {
|
|||
}
|
||||
|
||||
function onClickSubmit() {
|
||||
// console.log(Number(formData.salary.replace(/,/g, "")));
|
||||
const hasError = [];
|
||||
for (const key in ObjectRef) {
|
||||
if (Object.prototype.hasOwnProperty.call(ObjectRef, key)) {
|
||||
|
|
@ -94,22 +99,46 @@ function onClickSubmit() {
|
|||
}
|
||||
|
||||
function createSalaryRate() {
|
||||
dialogConfirm($q, () => {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
const body: any = {
|
||||
salary: Number(formData.salary.replace(/,/g, "")), //*เงินเดือนฐาน
|
||||
salaryHalf: Number(formData.salaryHalf.replace(/,/g, "")), //0.5 ขั้น
|
||||
salaryHalfSpecial: Number(formData.salaryHalfSpecial.replace(/,/g, "")), //0.5 ขั้น(เงินพิเศษ)
|
||||
salaryFull: Number(formData.salaryFull.replace(/,/g, "")), //1 ขั้น
|
||||
salaryFullSpecial: Number(formData.salaryFullSpecial.replace(/,/g, "")), //1 ขั้น(เงินพิเศษ)
|
||||
salaryFullHalf: Number(formData.salaryFullHalf.replace(/,/g, "")), //1.formData5 ขั้น
|
||||
salaryFullHalfSpecial: Number(
|
||||
formData.salaryFullHalfSpecial.replace(/,/g, "")
|
||||
), //1.5 ขั้น(เงินพิเศษ)
|
||||
isNext: formData.isNext, //*ทะลุขั้น
|
||||
};
|
||||
if (props.typeAction === "add") {
|
||||
success($q, "add");
|
||||
} else {
|
||||
success($q, "edit");
|
||||
body.salaryId = salaryId.value;
|
||||
}
|
||||
try {
|
||||
const url =
|
||||
props.typeAction === "add"
|
||||
? config.API.salaryRateList
|
||||
: config.API.salaryRateListByid(salaryId.value);
|
||||
await http[props.typeAction === "add" ? "post" : "put"](url, body);
|
||||
success($q, "บันทีกข้อมูลสำเร็จ");
|
||||
// props.fetchData?.();
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
} finally {
|
||||
hideLoader();
|
||||
closeDialog();
|
||||
}
|
||||
closeDialog();
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => modal.value,
|
||||
() => {
|
||||
console.log(salaryId.value);
|
||||
if (modal.value && props.typeAction === "edit") {
|
||||
if (props.data) {
|
||||
console.log(props.data);
|
||||
const data = props.data;
|
||||
|
||||
// formData.salaryId = data.id;
|
||||
|
|
@ -151,7 +180,7 @@ watch(
|
|||
/>
|
||||
</div>
|
||||
<div class="col-6 row items-center">
|
||||
<q-checkbox dense v-model="formData.isNext" label="ทำลุขั้น" />
|
||||
<q-checkbox dense v-model="formData.isNext" label="ทะลุขั้น" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue