-
+
@@ -109,7 +229,14 @@ div
-
@@ -123,12 +250,24 @@ div
-
+
-
+
{{ col.label }}
@@ -138,17 +277,33 @@ div
-
+
- {{ col.name == "no" ? props.rowIndex + 1 :
- col.value }}
+ {{ col.name == "no" ? props.rowIndex + 1 : col.value }}
-
@@ -183,15 +338,25 @@ const props = defineProps({
const next = () => props.next();
const previous = () => props.previous();
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
-const { dialogMessageNotify, dialogConfirm, dialogRemove, messageError, showLoader, hideLoader, success } = mixin;
+const {
+ dialogMessageNotify,
+ dialogConfirm,
+ dialogRemove,
+ messageError,
+ showLoader,
+ hideLoader,
+ success,
+} = mixin;
const route = useRoute();
const $q = useQuasar();
-
+const salaryAmount = ref
();
+const positionSalaryAmount = ref();
+const mouthSalaryAmount = ref();
const modalData = ref({
- salaryAmount: 0,
- positionSalaryAmount: 0,
- mouthSalaryAmount: 0,
+ salaryAmount: null,
+ positionSalaryAmount: null,
+ mouthSalaryAmount: null,
});
const myForm = ref(null);
const myFormAdd = ref(null);
@@ -251,8 +416,8 @@ const conditionData = async () => {
const id = route.params.orderid
? route.params.orderid.toString()
: localStorage.getItem("orderId")
- ? localStorage.getItem("orderId")
- : null;
+ ? localStorage.getItem("orderId")
+ : null;
if (id !== null) {
await getData(id);
}
@@ -275,9 +440,12 @@ const getData = async (id: string) => {
selectStatus: r.selectStatus !== null ? r.selectStatus : false,
sequence: r.sequence !== null ? r.sequence : 0,
refRecordId: r.refRecordId,
+ salaryAmount: r.salaryAmount !== 0 ? r.salaryAmount : null,
+ positionSalaryAmount: r.positionSalaryAmount!== 0 ? r.positionSalaryAmount : null,
+ monthSalaryAmount: r.monthSalaryAmount!== 0 ? r.monthSalaryAmount : null,
});
});
- // console.log("list", list);
+ console.log("list", list);
rows.value = list;
selected.value = rows.value;
})
@@ -306,10 +474,7 @@ const getData = async (id: string) => {
// };
const dialogDeleteData = async (id: string) => {
- dialogRemove(
- $q,
- () => deleteData(id),
- );
+ dialogRemove($q, () => deleteData(id));
};
const deleteData = async (id: string) => {
@@ -415,12 +580,13 @@ const fetchSalary = async (personalId: string) => {
.get(config.API.salaryOrder(personalId))
.then((res: any) => {
console.log(res);
- let salary = res.data.result;
+ const data = res.data.result;
modalData.value = {
- salaryAmount: salary.salaryAmount,
- positionSalaryAmount: salary.positionSalaryAmount,
- mouthSalaryAmount: salary.monthSalaryAmount,
+ salaryAmount: data.salaryAmount !== 0 ? data.salaryAmount:null,
+ positionSalaryAmount: data.positionSalaryAmount !== 0 ? data.salaryAmount:null,
+ mouthSalaryAmount: data.monthSalaryAmount !== 0 ? data.salaryAmount:null,
};
+ console.log("data", modalData.value);
})
.catch((e) => {
console.log(e);
@@ -436,27 +602,24 @@ const putSalary = async (salary: any) => {
positionSalaryAmount: Number(salary.positionSalaryAmount),
monthSalaryAmount: Number(salary.mouthSalaryAmount),
};
- dialogConfirm(
- $q,
- async () => {
- showLoader()
- await http
- .put(config.API.salaryOrder(personalId.value), modalData.value)
- .then((res: any) => {
- console.log(res);
- success($q, "บันทึกข้อมูลสำเร็จ");
- })
- .catch((e) => {
- console.log(e);
- messageError($q, e);
- })
- .finally(async () => {
- await conditionData();
- modal.value = false;
- hideLoader()
- });
- },
- );
+ dialogConfirm($q, async () => {
+ showLoader();
+ await http
+ .put(config.API.salaryOrder(personalId.value), modalData.value)
+ .then((res: any) => {
+ console.log(res);
+ success($q, "บันทึกข้อมูลสำเร็จ");
+ })
+ .catch((e) => {
+ console.log(e);
+ messageError($q, e);
+ })
+ .finally(async () => {
+ await conditionData();
+ modal.value = false;
+ hideLoader();
+ });
+ });
};
const modalAddChange = async () => {
@@ -465,8 +628,8 @@ const modalAddChange = async () => {
const id = route.params.orderid
? route.params.orderid.toString()
: localStorage.getItem("orderId")
- ? localStorage.getItem("orderId")
- : null;
+ ? localStorage.getItem("orderId")
+ : null;
if (id !== null) {
await fetchaddlist(id);
}
@@ -512,9 +675,8 @@ const saveModalAdd = () => {
addlist(data);
},
"ยืนยันการเพิ่มรายชื่อออกคำสั่ง",
- "ต้องการยืนยันการเพิ่มรายชื่อออกคำสั่งนี้ใช่หรือไม่?",
+ "ต้องการยืนยันการเพิ่มรายชื่อออกคำสั่งนี้ใช่หรือไม่?"
);
-
}
});
}
@@ -523,8 +685,8 @@ const addlist = async (data: Object) => {
const id = route.params.orderid
? route.params.orderid.toString()
: localStorage.getItem("orderId")
- ? localStorage.getItem("orderId")
- : null;
+ ? localStorage.getItem("orderId")
+ : null;
if (id !== null) {
await http
.post(config.API.personsOrder(id), data)
@@ -548,19 +710,12 @@ const click = (e: any) => {
const save = () => {
if (selected.value.length > 0) {
- dialogConfirm(
- $q,
- () => {
- success($q, "บันทึกข้อมูลสำเร็จ");
- next();
- },
- );
-
+ dialogConfirm($q, () => {
+ success($q, "บันทึกข้อมูลสำเร็จ");
+ next();
+ });
} else {
- dialogMessageNotify(
- $q,
- "กรุณาเลือกรายชื่อ",
- );
+ dialogMessageNotify($q, "กรุณาเลือกรายชื่อ");
}
};
@@ -583,4 +738,4 @@ const getClass = (val: boolean) => {
};
};
-
\ No newline at end of file
+