fix:registry

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-12-16 14:09:16 +07:00
parent 18101353a1
commit 4c569a1d3f
10 changed files with 502 additions and 127 deletions

View file

@ -8,13 +8,11 @@ import config from "@/app.config";
import type { QTableColumn } from "quasar";
import type { FormEmployee } from "@/modules/04_registryPerson/interface/request/Employee";
import type {
EmployeeHistory,
ResEmployee,
} from "@/modules/04_registryPerson/interface/response/Employee";
import type { ResEmployee } from "@/modules/04_registryPerson/interface/response/Employee";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
import CurruncyInput from "@/components/CurruncyInput.vue";
import { useCounterMixin } from "@/stores/mixin";
@ -27,7 +25,6 @@ const {
date2Thai,
messageError,
dialogConfirm,
onSearchDataTable,
} = useCounterMixin();
const profileId = ref<string>(
@ -60,11 +57,11 @@ const formData = reactive<FormEmployee>({
positionEmployeePositionId: "",
employeeOc: "",
employeeTypeIndividual: "",
employeeWage: "",
employeeMoneyIncrease: "",
employeeMoneyAllowance: "",
employeeMoneyEmployee: "",
employeeMoneyEmployer: "",
employeeWage: undefined,
employeeMoneyIncrease: undefined,
employeeMoneyAllowance: undefined,
employeeMoneyEmployee: undefined,
employeeMoneyEmployer: undefined,
});
/** function fetch ข้อมูลลูกจ้างชั่วคราว*/
@ -101,11 +98,15 @@ function onClickEdit() {
formData.positionEmployeePositionId = dataEmployee.positionEmployeePositionId;
formData.employeeOc = dataEmployee.employeeOc;
formData.employeeTypeIndividual = dataEmployee.employeeTypeIndividual;
formData.employeeWage = dataEmployee.employeeWage;
formData.employeeMoneyIncrease = dataEmployee.employeeMoneyIncrease;
formData.employeeMoneyAllowance = dataEmployee.employeeMoneyAllowance;
formData.employeeMoneyEmployee = dataEmployee.employeeMoneyEmployee;
formData.employeeMoneyEmployer = dataEmployee.employeeMoneyEmployer;
formData.employeeWage = Number(dataEmployee.employeeWage) || undefined;
formData.employeeMoneyIncrease =
Number(dataEmployee.employeeMoneyIncrease) || undefined;
formData.employeeMoneyAllowance =
Number(dataEmployee.employeeMoneyAllowance) || undefined;
formData.employeeMoneyEmployee =
Number(dataEmployee.employeeMoneyEmployee) || undefined;
formData.employeeMoneyEmployer =
Number(dataEmployee.employeeMoneyEmployer) || undefined;
}
/** function ปิด Dialog แก้ไขมูลลูกจ้างชั่วคราว*/
@ -116,11 +117,11 @@ function onCloseDialog() {
formData.positionEmployeePositionId = "";
formData.employeeOc = "";
formData.employeeTypeIndividual = "";
formData.employeeWage = "";
formData.employeeMoneyIncrease = "";
formData.employeeMoneyAllowance = "";
formData.employeeMoneyEmployee = "";
formData.employeeMoneyEmployer = "";
formData.employeeWage = undefined;
formData.employeeMoneyIncrease = undefined;
formData.employeeMoneyAllowance = undefined;
formData.employeeMoneyEmployee = undefined;
formData.employeeMoneyEmployer = undefined;
}
/** function บันทึกแก้ไขมูลลูกจ้างชั่วคราว*/
@ -128,7 +129,15 @@ function onSubmit() {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.informationEmployee(profileId.value), formData)
.put(config.API.informationEmployee(profileId.value), {
...formData,
employeeWage: formData.employeeWage?.toString() || "",
employeeMoneyIncrease: formData.employeeMoneyIncrease?.toString() || "",
employeeMoneyAllowance:
formData.employeeMoneyAllowance?.toString() || "",
employeeMoneyEmployee: formData.employeeMoneyEmployee?.toString() || "",
employeeMoneyEmployer: formData.employeeMoneyEmployer?.toString() || "",
})
.then(async () => {
await fetchData();
await success($q, "บันทึกข้อมูลสำเร็จ");
@ -533,7 +542,8 @@ onMounted(() => {
<!-- :rules="[(val: string) => !!val || `${'กรุณากรอกประเภทบุคคล'}`]" -->
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-input
<CurruncyInput
:edit="true"
dense
outlined
lazy-rules
@ -541,14 +551,18 @@ onMounted(() => {
v-model="formData.employeeWage"
class="inputgreen"
label="ค่าจ้าง"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'ค่าจ้างต้องไม่เกิน 10,000,000 บาท';
}]"
/>
<!-- :rules="[(val: string) => !!val || `${'กรุณากรอกค่าจ้าง'}`]" -->
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-input
<CurruncyInput
:edit="true"
dense
outlined
lazy-rules
@ -556,13 +570,17 @@ onMounted(() => {
v-model="formData.employeeMoneyIncrease"
class="inputgreen"
label="เงินเพิ่มการครองชีพชั่วคราว"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินเพิ่มการครองชีพชั่วคราวต้องไม่เกิน 10,000,000 บาท';
}]"
/>
<!-- :rules="[(val: string) => !!val || `${'กรุณากรอกเงินเพิ่มการครองชีพชั่วคราว'}`]" -->
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-input
<CurruncyInput
:edit="true"
dense
outlined
lazy-rules
@ -570,13 +588,17 @@ onMounted(() => {
v-model="formData.employeeMoneyAllowance"
class="inputgreen"
label="เงินช่วยเหลือการครองชีพชั่วคราว"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินเพิ่มการครองชีพชั่วคราวต้องไม่เกิน 10,000,000 บาท';
}]"
/>
<!-- :rules="[(val: string) => !!val || `${'กรุณากรอกเงินช่วยเหลือการครองชีพชั่วคราว'}`]" -->
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-input
<CurruncyInput
:edit="true"
dense
outlined
lazy-rules
@ -584,13 +606,17 @@ onMounted(() => {
v-model="formData.employeeMoneyEmployee"
class="inputgreen"
label="เงินสมทบประกันสังคม(ลูกจ้าง)"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินสมทบประกันสังคม(ลูกจ้าง)ต้องไม่เกิน 10,000,000 บาท';
}]"
/>
<!-- :rules="[(val: string) => !!val || `${'กรุณากรอกเงินสมทบประกันสังคม(ลูกจ้าง)'}`]" -->
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-input
<CurruncyInput
:edit="true"
dense
outlined
lazy-rules
@ -598,8 +624,11 @@ onMounted(() => {
v-model="formData.employeeMoneyEmployer"
class="inputgreen"
label="เงินสมทบประกันสังคม(นายจ้าง)"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินสมทบประกันสังคม(นายจ้าง)ต้องไม่เกิน 10,000,000 บาท';
}]"
/>
<!-- :rules="[(val: string) => !!val || `${'กรุณากรอกเงินสมทบประกันสังคม(นายจ้าง))'}`]" -->
</div>

View file

@ -27,6 +27,7 @@ import type { DataCardPos } from "@/modules/04_registryPerson/interface/index/go
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue";
import CurruncyInput from "@/components/CurruncyInput.vue";
const $q = useQuasar();
const route = useRoute();
@ -370,8 +371,8 @@ const formData = reactive<FormPostition>({
positionExecutive: "", //
positionExecutiveField: "", //
positionArea: "", ///
amount: null, //
amountSpecial: null, //
amount: undefined, //
amountSpecial: undefined, //
orgRoot: "", //
orgChild1: "", // 1
orgChild2: "", // 2
@ -685,8 +686,8 @@ async function onClickOpenDialog(
? data.positionExecutiveField
: "";
formData.positionArea = statusEdit ? data.positionArea : "";
formData.amount = statusEdit ? data.amount : null;
formData.amountSpecial = statusEdit ? data.amountSpecial : null;
formData.amount = statusEdit ? data.amount : undefined;
formData.amountSpecial = statusEdit ? data.amountSpecial : undefined;
formData.orgRoot = statusEdit ? data.orgRoot : "";
formData.orgChild1 = statusEdit ? data.orgChild1 : "";
formData.orgChild2 = statusEdit ? data.orgChild2 : "";
@ -1468,31 +1469,43 @@ onMounted(async () => {
<div class="col-xs-6 col-sm-6 col-md-4">
<!-- :rules="[(val:string) => !!val || `${'กรุณากรอกเงินเดือน'}`]" -->
<q-input
<CurruncyInput
:class="classInput(true)"
:edit="true"
ref="salaryRef"
dense
outlined
v-model="formData.amount"
:label="empType == '' ? 'เงินเดือน' : 'ค่าจ้าง'"
mask="###,###,###,###"
reverse-fill-mask
lazy-rules
hide-bottom-space
:rules="[
(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || ` ${empType == '' ? 'เงินเดือน' : 'ค่าจ้าง'} ต้องไม่เกิน 10,000,000 บาท`;
}
]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
<CurruncyInput
:class="classInput(true)"
:edit="true"
ref="amountSpecialRef"
dense
outlined
v-model="formData.amountSpecial"
label="เงินค่าตอบแทนพิเศษ"
mask="###,###,###,###"
reverse-fill-mask
hide-bottom-space
:rules="[
(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินค่าตอบแทนพิเศษต้องไม่เกิน 10,000,000 บาท';
}
]"
/>
</div>

View file

@ -26,6 +26,7 @@ import type { ResListSalary } from "@/modules/04_registryPerson/interface/respon
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue";
import CurruncyInput from "@/components/CurruncyInput.vue";
const { findOrgName } = useCounterMixin();
const $q = useQuasar();
@ -423,10 +424,10 @@ const formData = reactive<FormSalary>({
positionExecutive: "", //
positionExecutiveField: "", //
positionArea: "", ///
amount: null, //
amountSpecial: null, //
positionSalaryAmount: null, //
mouthSalaryAmount: null, //
amount: undefined, //
amountSpecial: undefined, //
positionSalaryAmount: undefined, //
mouthSalaryAmount: undefined, //
orgRoot: "", //
orgChild1: "", // 1
orgChild2: "", // 2
@ -666,10 +667,12 @@ async function onClickOpenDialog(
? data.positionExecutiveField
: "";
formData.positionArea = statusEdit ? data.positionArea : "";
formData.amount = statusEdit ? data.amount : null;
formData.amountSpecial = statusEdit ? data.amountSpecial : null;
formData.positionSalaryAmount = statusEdit ? data.positionSalaryAmount : null;
formData.mouthSalaryAmount = statusEdit ? data.mouthSalaryAmount : null;
formData.amount = statusEdit ? data.amount : undefined;
formData.amountSpecial = statusEdit ? data.amountSpecial : undefined;
formData.positionSalaryAmount = statusEdit
? data.positionSalaryAmount
: undefined;
formData.mouthSalaryAmount = statusEdit ? data.mouthSalaryAmount : undefined;
formData.orgRoot = statusEdit ? data.orgRoot : "";
formData.orgChild1 = statusEdit ? data.orgChild1 : "";
formData.orgChild2 = statusEdit ? data.orgChild2 : "";
@ -1433,60 +1436,75 @@ onMounted(async () => {
<div class="col-12">
<div class="row q-col-gutter-sm">
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
<CurruncyInput
:class="classInput(true)"
:edit="true"
ref="salaryRef"
dense
outlined
v-model="formData.amount"
:label="empType == '' ? 'เงินเดือน' : 'ค่าจ้าง'"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val:string) => !!val || `กรุณากรอก${empType == '' ? 'เงินเดือน' : 'ค่าจ้าง'}`]"
:rules="[(val:string) => !!val || `กรุณากรอก${empType == '' ? 'เงินเดือน' : 'ค่าจ้าง'}`, (val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || ` ${empType == '' ? 'เงินเดือน' : 'ค่าจ้าง'} ต้องไม่เกิน 10,000,000 บาท`;
}]"
lazy-rules
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
<CurruncyInput
:class="classInput(true)"
:edit="true"
ref="amountSpecialRef"
dense
outlined
v-model="formData.amountSpecial"
label="เงินค่าตอบแทนพิเศษ"
mask="###,###,###,###"
reverse-fill-mask
hide-bottom-space
:rules="[(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินค่าตอบแทนพิเศษต้องไม่เกิน 10,000,000 บาท';
}]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
<CurruncyInput
:class="classInput(true)"
:edit="true"
dense
outlined
v-model="formData.positionSalaryAmount"
label="เงินประจำตำแหน่ง"
mask="###,###,###,###"
reverse-fill-mask
lazy-rules
hide-bottom-space
:rules="[(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินประจำตำแหน่งต้องไม่เกิน 10,000,000 บาท';
}]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
<CurruncyInput
:class="classInput(true)"
:edit="true"
dense
outlined
v-model="formData.mouthSalaryAmount"
label="เงินค่าตอบแทนรายเดือน"
mask="###,###,###,###"
reverse-fill-mask
lazy-rules
hide-bottom-space
:rules="[(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินค่าตอบแทนรายเดือนต้องไม่เกิน 10,000,000 บาท';
}]"
/>
</div>
</div>