fix:salary

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-12-16 09:53:36 +07:00
parent 6cc8b7da84
commit 18101353a1
2 changed files with 46 additions and 8 deletions

View file

@ -7,6 +7,7 @@ import config from "@/app.config";
/** importComponents*/
import Header from "@/components/DialogHeader.vue";
import CurruncyInput from "@/components/CurruncyInput.vue";
/** use*/
const $q = useQuasar();
@ -15,7 +16,7 @@ const { dialogConfirm, success, messageError, showLoader, hideLoader } = mixin;
/** props*/
const modal = defineModel<boolean>("modal", { required: true });
const amount = defineModel<number | null>("amount", { required: true });
const amount = defineModel<number | undefined>("amount", { required: true });
const profileId = defineModel<string>("profileId", { required: true });
const props = defineProps({
fetchData: {
@ -28,7 +29,7 @@ const props = defineProps({
*/
function close() {
modal.value = false;
amount.value = null;
amount.value = undefined;
}
/**
@ -36,7 +37,7 @@ function close() {
*/
function onSubmit() {
dialogConfirm($q, async () => {
if (amount.value !== null) {
if (amount.value !== undefined) {
showLoader();
const amountString: string = amount.value.toString();
const body = {
@ -73,7 +74,7 @@ function onSubmit() {
<q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm">
<q-input
<!-- <q-input
ref="amountRef"
dense
outlined
@ -85,6 +86,24 @@ function onSubmit() {
lazy-rules
hide-bottom-space
class="inputgreen"
/> -->
<CurruncyInput
class="inputgreen"
v-model="amount"
:edit="true"
dense
outlined
hide-bottom-space
lazy-rules
label="เงินเดือนฐาน"
:rules="[
(val:string) => !!val || 'กรุณากรอกเงินเดือนฐาน',
(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินเดือนฐานต้องไม่เกิน 10,000,000 บาท';
}
]"
/>
</div>
</q-card-section>

View file

@ -7,6 +7,7 @@ import config from "@/app.config";
/** importComponents*/
import Header from "@/components/DialogHeader.vue";
import CurruncyInput from "@/components/CurruncyInput.vue";
/** use*/
const $q = useQuasar();
@ -15,7 +16,7 @@ const { dialogConfirm, success, messageError, showLoader, hideLoader } = mixin;
/** props*/
const modal = defineModel<boolean>("modal", { required: true });
const amount = defineModel<number | null>("amount", { required: true });
const amount = defineModel<number | undefined>("amount", { required: true });
const profileId = defineModel<string>("profileId", { required: true });
const props = defineProps({
fetchData: {
@ -26,7 +27,7 @@ const props = defineProps({
/** function ปิด Popup */
function close() {
modal.value = false;
amount.value = null;
amount.value = undefined;
}
/**
@ -34,7 +35,7 @@ function close() {
*/
function onSubmit() {
dialogConfirm($q, async () => {
if (amount.value !== null) {
if (amount.value !== undefined) {
showLoader();
const amountString: string = amount.value.toString();
const body = {
@ -71,7 +72,7 @@ function onSubmit() {
<q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm">
<q-input
<!-- <q-input
ref="amountRef"
dense
outlined
@ -83,6 +84,24 @@ function onSubmit() {
lazy-rules
hide-bottom-space
class="inputgreen"
/> -->
<CurruncyInput
class="inputgreen"
v-model="amount"
:edit="true"
dense
outlined
hide-bottom-space
lazy-rules
label="เงินเดือนฐาน"
:rules="[
(val:string) => !!val || 'กรุณากรอกเงินเดือนฐาน',
(val:number) => {
if (!val) return true;
const numVal = typeof val === 'number' ? val : Number(String(val).replace(/,/g, ''));
return numVal <= 10000000 || 'เงินเดือนฐานต้องไม่เกิน 10,000,000 บาท';
}
]"
/>
</div>
</q-card-section>