fix ConverDate เงินเดือน
This commit is contained in:
parent
9aee295a3f
commit
5450a034b7
6 changed files with 32 additions and 34 deletions
|
|
@ -26,6 +26,7 @@ const {
|
||||||
hideLoader,
|
hideLoader,
|
||||||
messageError,
|
messageError,
|
||||||
success,
|
success,
|
||||||
|
convertDateToAPI,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
|
|
@ -77,9 +78,7 @@ const title = computed(() => {
|
||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/** fiunction fetch ข้อมูลประเภทตำแหน่ง*/
|
||||||
* fiunction fetch ข้อมูลประเภทตำแหน่ง
|
|
||||||
*/
|
|
||||||
function fetchPosType() {
|
function fetchPosType() {
|
||||||
http
|
http
|
||||||
.get(config.API.salaryPosType)
|
.get(config.API.salaryPosType)
|
||||||
|
|
@ -97,9 +96,7 @@ function fetchPosType() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** fiunction fetch ข้อมูลระดับตำแหน่ง*/
|
||||||
* fiunction fetch ข้อมูลระดับตำแหน่ง
|
|
||||||
*/
|
|
||||||
function fetchPosLevel(id: string) {
|
function fetchPosLevel(id: string) {
|
||||||
const filterLevel = posType.value.find((e: SalaryPosType) => e.id === id);
|
const filterLevel = posType.value.find((e: SalaryPosType) => e.id === id);
|
||||||
const listOption =
|
const listOption =
|
||||||
|
|
@ -144,9 +141,7 @@ function fetchSalaryDetail(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**callbackFunction ทำการ fetch ข้อมูลไฟล์เมื่อเปิด Dialog*/
|
||||||
* callbackFunction ทำการ fetch ข้อมูลไฟล์เมื่อเปิด Dialog
|
|
||||||
*/
|
|
||||||
watch(
|
watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
async () => {
|
async () => {
|
||||||
|
|
@ -167,17 +162,13 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/** function ปืด Dialog*/
|
||||||
* function ปืด Dialog
|
|
||||||
*/
|
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
modal.value = !modal.value;
|
modal.value = !modal.value;
|
||||||
clearFormData();
|
clearFormData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** function เคลียข้อมูล form*/
|
||||||
* function เคลียข้อมูล form
|
|
||||||
*/
|
|
||||||
function clearFormData() {
|
function clearFormData() {
|
||||||
formData.name = "";
|
formData.name = "";
|
||||||
formData.posTypeId = "";
|
formData.posTypeId = "";
|
||||||
|
|
@ -191,9 +182,7 @@ function clearFormData() {
|
||||||
isReadonly.value = false;
|
isReadonly.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** function บันทึกข้อมูลผังบัญชีเงินเดือน*/
|
||||||
* function บันทึกข้อมูลผังบัญชีเงินเดือน
|
|
||||||
*/
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm($q, async () => {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -202,7 +191,12 @@ function onSubmit() {
|
||||||
props.typeAction === "add"
|
props.typeAction === "add"
|
||||||
? config.API.salaryChart
|
? config.API.salaryChart
|
||||||
: config.API.salaryChartByid(salaryId.value);
|
: config.API.salaryChartByid(salaryId.value);
|
||||||
await http[props.typeAction === "add" ? "post" : "put"](url, formData);
|
await http[props.typeAction === "add" ? "post" : "put"](url, {
|
||||||
|
...formData,
|
||||||
|
date: convertDateToAPI(formData.date),
|
||||||
|
startDate: convertDateToAPI(formData.startDate),
|
||||||
|
endDate: convertDateToAPI(formData.endDate),
|
||||||
|
});
|
||||||
await props.fetchData?.();
|
await props.fetchData?.();
|
||||||
await success($q, "บันทีกข้อมูลสำเร็จ");
|
await success($q, "บันทีกข้อมูลสำเร็จ");
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
|
@ -214,9 +208,7 @@ function onSubmit() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** function checkEndDate*/
|
||||||
* function checkEndDate
|
|
||||||
*/
|
|
||||||
function checkEndDate() {
|
function checkEndDate() {
|
||||||
if (formData.endDate !== null && formData.startDate !== null) {
|
if (formData.endDate !== null && formData.startDate !== null) {
|
||||||
if (formData.endDate < formData.startDate) {
|
if (formData.endDate < formData.startDate) {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ const {
|
||||||
hideLoader,
|
hideLoader,
|
||||||
messageError,
|
messageError,
|
||||||
success,
|
success,
|
||||||
|
convertDateToAPI,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
|
||||||
/** props*/
|
/** props*/
|
||||||
|
|
@ -85,7 +86,12 @@ function onSubmit() {
|
||||||
const url = !props.isStatusEdit
|
const url = !props.isStatusEdit
|
||||||
? config.API.salaryEmployeeChart
|
? config.API.salaryEmployeeChart
|
||||||
: config.API.salaryEmployeeChartByid(props.data.id);
|
: config.API.salaryEmployeeChartByid(props.data.id);
|
||||||
await http[!props.isStatusEdit ? "post" : "put"](url, formData);
|
await http[!props.isStatusEdit ? "post" : "put"](url, {
|
||||||
|
...formData,
|
||||||
|
date: convertDateToAPI(formData.date),
|
||||||
|
startDate: convertDateToAPI(formData.startDate),
|
||||||
|
endDate: convertDateToAPI(formData.endDate),
|
||||||
|
});
|
||||||
await props.fetchData?.();
|
await props.fetchData?.();
|
||||||
success($q, "บันทีกข้อมูลสำเร็จ");
|
success($q, "บันทีกข้อมูลสำเร็จ");
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
|
|
||||||
|
|
@ -156,8 +156,8 @@ const getClass = (val: boolean) => {
|
||||||
v-model="formData.salaryNo"
|
v-model="formData.salaryNo"
|
||||||
label="ลำดับชั้น"
|
label="ลำดับชั้น"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => !!val || 'กรุณากรอกลำดับชั้น',
|
(val:number) => !!val || 'กรุณากรอกลำดับชั้น',
|
||||||
(val) =>
|
(val:number) =>
|
||||||
Number(val) === Math.floor(val) ||
|
Number(val) === Math.floor(val) ||
|
||||||
Number(val) === Math.floor(val) + 0.5 ||
|
Number(val) === Math.floor(val) + 0.5 ||
|
||||||
`กรุณากรอกจำนวนเต็มเท่านั้ หรือ .5`,
|
`กรุณากรอกจำนวนเต็มเท่านั้ หรือ .5`,
|
||||||
|
|
@ -179,7 +179,7 @@ const getClass = (val: boolean) => {
|
||||||
mask="###,###,###,###"
|
mask="###,###,###,###"
|
||||||
reverse-fill-mask
|
reverse-fill-mask
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) =>
|
(val:string) =>
|
||||||
!!val || `${'กรุณากรอกอัตราค่าจ้าง/ขั้นวิ่ง (รายเดือน)'}`,
|
!!val || `${'กรุณากรอกอัตราค่าจ้าง/ขั้นวิ่ง (รายเดือน)'}`,
|
||||||
]"
|
]"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
|
@ -201,7 +201,7 @@ const getClass = (val: boolean) => {
|
||||||
lazy-rules
|
lazy-rules
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) =>
|
(val:string) =>
|
||||||
!!val || `${'กรุณากรอกอัตราค่าจ้าง/ขั้นวิ่ง (รายวัน)'}`,
|
!!val || `${'กรุณากรอกอัตราค่าจ้าง/ขั้นวิ่ง (รายวัน)'}`,
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,12 @@ const {
|
||||||
success,
|
success,
|
||||||
showLoader,
|
showLoader,
|
||||||
hideLoader,
|
hideLoader,
|
||||||
|
convertDateToAPI,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
|
||||||
/** props*/
|
/** props*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const effective = defineModel<Date | null | string>("effective", {
|
const effective = defineModel<Date | null>("effective", {
|
||||||
required: true,
|
required: true,
|
||||||
});
|
});
|
||||||
const isRead = defineModel<boolean>("isRead", { required: true });
|
const isRead = defineModel<boolean>("isRead", { required: true });
|
||||||
|
|
@ -79,7 +80,7 @@ function onSubmit() {
|
||||||
const body = {
|
const body = {
|
||||||
period: period.value,
|
period: period.value,
|
||||||
isActive: isActive.value,
|
isActive: isActive.value,
|
||||||
effectiveDate: effective.value,
|
effectiveDate: convertDateToAPI(effective.value),
|
||||||
year: year.value,
|
year: year.value,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,6 @@ function onClickAddPerson(data: DataPerson) {
|
||||||
const body: DataPersonReq = {
|
const body: DataPersonReq = {
|
||||||
id: store.groupId,
|
id: store.groupId,
|
||||||
type: store.tabType,
|
type: store.tabType,
|
||||||
|
|
||||||
...data,
|
...data,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,12 +211,12 @@ function editPopup(data: RowList, status: string) {
|
||||||
function dialogClose(id: string) {
|
function dialogClose(id: string) {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
() => {
|
async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(config.API.salaryPeriod() + `/close/${id}`)
|
.get(config.API.salaryPeriod() + `/close/${id}`)
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
getData();
|
await getData();
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue