- เพิ่มรายละเอียดแบบฟอร์มลาไปปฏิบัติงานในองค์การระหว่างประเทศ และลาไปฟื้นฟูสมรรถภาพด้านอาชีพ
- เพิ่มฟังก์ชั่น convert จำนวนเงินเดือนที่เป็นตัวเลขมาเป็นข้อความตัวหนังสือ
This commit is contained in:
parent
ddbcb40488
commit
cb58de2ca3
3 changed files with 954 additions and 678 deletions
|
|
@ -15,6 +15,18 @@ const props = defineProps({
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">กรอกข้อมูล</div>
|
<div class="q-pl-sm text-weight-bold text-dark">กรอกข้อมูล</div>
|
||||||
<div>
|
<div>
|
||||||
ลาไปปฏิบัติงานในองค์การระหว่างประเทศ
|
ลาไปปฏิบัติงานในองค์การระหว่างประเทศ
|
||||||
<p>*หมายเหตุ รายละเอียดฟิลด์ในหัวข้อนี้มีเยอะยังไม่ทำรอ user confirm</p>
|
<ul>
|
||||||
|
<li>เขียนที่</li>
|
||||||
|
<li>ลาตั้งแต่วันที่</li>
|
||||||
|
<li>ลาถึงวันที่</li>
|
||||||
|
<li>รายละเอียด (ไม่บังคับกรอก)</li>
|
||||||
|
<li>*หลังจากบันทึก แสดงปุ่มดาวน์โหลดแบบฟอร์ม</li>
|
||||||
|
<li>*หลังจากบันทึก แสดง input ให้อัพโหลดเอกสารกลับเข้าระบบ</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>*หมายเหตุ
|
||||||
|
รายละเอียดฟิลด์ในหัวข้อนี้มีเยอะ หลังจากกดบันทึกแล้วแสดงเอกสาร docx ให้ดาวน์โหลด เพื่อกรอก
|
||||||
|
และเพิ่มให้อัพโหหลดเอกสารกลับเข้ามาในระบบ
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
const mixin = useCounterMixin()
|
||||||
|
const { arabicNumberToText } = mixin
|
||||||
|
|
||||||
const edit = ref<boolean>(false);
|
const edit = ref<boolean>(false);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -15,6 +19,20 @@ const props = defineProps({
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">กรอกข้อมูล</div>
|
<div class="q-pl-sm text-weight-bold text-dark">กรอกข้อมูล</div>
|
||||||
<div>
|
<div>
|
||||||
ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ
|
ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ
|
||||||
<p>*หมายเหตุ รายละเอียดฟิลด์ในหัวข้อนี้มีเยอะยังไม่ทำรอ user confirm</p>
|
<ul>
|
||||||
|
<li>เขียนที่</li>
|
||||||
|
<li>ลาตั้งแต่วันที่</li>
|
||||||
|
<li>ลาถึงวันที่</li>
|
||||||
|
<li>รายละเอียด (ไม่บังคับกรอก)</li>
|
||||||
|
<li>*หลังจากบันทึก แสดงปุ่มดาวน์โหลดแบบฟอร์ม</li>
|
||||||
|
<li>*หลังจากบันทึก แสดง input ให้อัพโหลดเอกสารกลับเข้าระบบ</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>*หมายเหตุ
|
||||||
|
รายละเอียดฟิลด์ในหัวข้อนี้มีเยอะ หลังจากกดบันทึกแล้วแสดงเอกสาร docx ให้ดาวน์โหลด เพื่อกรอก
|
||||||
|
และเพิ่มให้อัพโหหลดเอกสารกลับเข้ามาในระบบ
|
||||||
|
</p>
|
||||||
|
|
||||||
|
ตัวอย่างการ convert ตัวเลขเป็นข้อความ {{ arabicNumberToText(15500) }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,58 +1,61 @@
|
||||||
import { defineStore } from "pinia"
|
import { defineStore } from "pinia";
|
||||||
import moment from "moment"
|
import moment from "moment";
|
||||||
import CustomComponent from "@/components/CustomDialog.vue"
|
import CustomComponent from "@/components/CustomDialog.vue";
|
||||||
import { Loading, QSpinnerCube } from "quasar"
|
import { Loading, QSpinnerCube } from "quasar";
|
||||||
|
|
||||||
export const useCounterMixin = defineStore("mixin", () => {
|
export const useCounterMixin = defineStore("mixin", () => {
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันกลาง
|
* ฟังก์ชันกลาง
|
||||||
*/
|
*/
|
||||||
|
const calAge = (
|
||||||
const calAge = (srcDate: Date, birthCal: Date = new Date(), eng: boolean = false) => {
|
srcDate: Date,
|
||||||
const year = eng ? "years" : "ปี"
|
birthCal: Date = new Date(),
|
||||||
const month = eng ? "months" : "เดือน"
|
eng: boolean = false
|
||||||
const day = eng ? "days" : "วัน"
|
) => {
|
||||||
|
const year = eng ? "years" : "ปี";
|
||||||
|
const month = eng ? "months" : "เดือน";
|
||||||
|
const day = eng ? "days" : "วัน";
|
||||||
|
|
||||||
if (srcDate == null) {
|
if (srcDate == null) {
|
||||||
return `0 ${year} 0 ${month} 0 ${day}`
|
return `0 ${year} 0 ${month} 0 ${day}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const toDay = birthCal
|
const toDay = birthCal;
|
||||||
const birth = new Date(srcDate)
|
const birth = new Date(srcDate);
|
||||||
|
|
||||||
const yearNow = toDay.getFullYear()
|
const yearNow = toDay.getFullYear();
|
||||||
const monthNow = toDay.getMonth()
|
const monthNow = toDay.getMonth();
|
||||||
const dateNow = toDay.getDate()
|
const dateNow = toDay.getDate();
|
||||||
|
|
||||||
const yearDob = birth.getFullYear()
|
const yearDob = birth.getFullYear();
|
||||||
const monthDob = birth.getMonth()
|
const monthDob = birth.getMonth();
|
||||||
const dateDob = birth.getDate()
|
const dateDob = birth.getDate();
|
||||||
|
|
||||||
const lastYear = 12
|
const lastYear = 12;
|
||||||
const subtractDate: Object = moment().subtract(1, "months").endOf("month")
|
const subtractDate: Object = moment().subtract(1, "months").endOf("month");
|
||||||
|
|
||||||
const lastMonths = new Date(subtractDate.toString()).getDate()
|
const lastMonths = new Date(subtractDate.toString()).getDate();
|
||||||
|
|
||||||
let yearAge = yearNow - yearDob
|
let yearAge = yearNow - yearDob;
|
||||||
let monthAge = 0
|
let monthAge = 0;
|
||||||
let dateAge = 0
|
let dateAge = 0;
|
||||||
|
|
||||||
if (monthNow >= monthDob) {
|
if (monthNow >= monthDob) {
|
||||||
monthAge = monthNow - monthDob
|
monthAge = monthNow - monthDob;
|
||||||
} else {
|
} else {
|
||||||
yearAge--
|
yearAge--;
|
||||||
monthAge = lastYear + monthNow - monthDob
|
monthAge = lastYear + monthNow - monthDob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dateNow >= dateDob) {
|
if (dateNow >= dateDob) {
|
||||||
dateAge = dateNow - dateDob
|
dateAge = dateNow - dateDob;
|
||||||
} else {
|
} else {
|
||||||
monthAge--
|
monthAge--;
|
||||||
dateAge = lastMonths + dateNow - dateDob
|
dateAge = lastMonths + dateNow - dateDob;
|
||||||
|
|
||||||
if (monthAge < 0) {
|
if (monthAge < 0) {
|
||||||
monthAge = 11
|
monthAge = 11;
|
||||||
yearAge--
|
yearAge--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,148 +63,280 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
years: yearAge,
|
years: yearAge,
|
||||||
months: monthAge,
|
months: monthAge,
|
||||||
days: dateAge,
|
days: dateAge,
|
||||||
}
|
};
|
||||||
|
|
||||||
return `${yearAge} ${year} ${monthAge} ${month} ${dateAge} ${day}`
|
return `${yearAge} ${year} ${monthAge} ${month} ${dateAge} ${day}`;
|
||||||
}
|
};
|
||||||
|
|
||||||
function date2Thai(srcDate: Date, isFullMonth: boolean = false, isTime: boolean = false) {
|
function date2Thai(
|
||||||
|
srcDate: Date,
|
||||||
|
isFullMonth: boolean = false,
|
||||||
|
isTime: boolean = false
|
||||||
|
) {
|
||||||
if (srcDate == null) {
|
if (srcDate == null) {
|
||||||
return null
|
return null;
|
||||||
;`
|
|
||||||
`
|
`
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
const date = new Date(srcDate)
|
const date = new Date(srcDate);
|
||||||
const isValidDate = Boolean(+date)
|
const isValidDate = Boolean(+date);
|
||||||
if (!isValidDate) return srcDate.toString()
|
if (!isValidDate) return srcDate.toString();
|
||||||
if (isValidDate && date.getFullYear() < 1000) return srcDate.toString()
|
if (isValidDate && date.getFullYear() < 1000) return srcDate.toString();
|
||||||
const fullMonthThai = ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
|
const fullMonthThai = [
|
||||||
const abbrMonthThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
|
"มกราคม",
|
||||||
let dstYear = 0
|
"กุมภาพันธ์",
|
||||||
|
"มีนาคม",
|
||||||
|
"เมษายน",
|
||||||
|
"พฤษภาคม",
|
||||||
|
"มิถุนายน",
|
||||||
|
"กรกฎาคม",
|
||||||
|
"สิงหาคม",
|
||||||
|
"กันยายน",
|
||||||
|
"ตุลาคม",
|
||||||
|
"พฤศจิกายน",
|
||||||
|
"ธันวาคม",
|
||||||
|
];
|
||||||
|
const abbrMonthThai = [
|
||||||
|
"ม.ค.",
|
||||||
|
"ก.พ.",
|
||||||
|
"มี.ค.",
|
||||||
|
"เม.ย.",
|
||||||
|
"พ.ค.",
|
||||||
|
"มิ.ย.",
|
||||||
|
"ก.ค.",
|
||||||
|
"ส.ค.",
|
||||||
|
"ก.ย.",
|
||||||
|
"ต.ค.",
|
||||||
|
"พ.ย.",
|
||||||
|
"ธ.ค.",
|
||||||
|
];
|
||||||
|
let dstYear = 0;
|
||||||
if (date.getFullYear() > 2500) {
|
if (date.getFullYear() > 2500) {
|
||||||
dstYear = date.getFullYear()
|
dstYear = date.getFullYear();
|
||||||
} else {
|
} else {
|
||||||
dstYear = date.getFullYear() + 543
|
dstYear = date.getFullYear() + 543;
|
||||||
}
|
}
|
||||||
let dstMonth = ""
|
let dstMonth = "";
|
||||||
if (isFullMonth) {
|
if (isFullMonth) {
|
||||||
dstMonth = fullMonthThai[date.getMonth()]
|
dstMonth = fullMonthThai[date.getMonth()];
|
||||||
} else {
|
} else {
|
||||||
dstMonth = abbrMonthThai[date.getMonth()]
|
dstMonth = abbrMonthThai[date.getMonth()];
|
||||||
}
|
}
|
||||||
let dstTime = ""
|
let dstTime = "";
|
||||||
if (isTime) {
|
if (isTime) {
|
||||||
const H = date.getHours().toString().padStart(2, "0")
|
const H = date.getHours().toString().padStart(2, "0");
|
||||||
const M = date.getMinutes().toString().padStart(2, "0")
|
const M = date.getMinutes().toString().padStart(2, "0");
|
||||||
// const S = date.getSeconds().toString().padStart(2, "0")
|
// const S = date.getSeconds().toString().padStart(2, "0")
|
||||||
// dstTime = " " + H + ":" + M + ":" + S + " น."
|
// dstTime = " " + H + ":" + M + ":" + S + " น."
|
||||||
dstTime = " " + H + ":" + M + " น."
|
dstTime = " " + H + ":" + M + " น.";
|
||||||
}
|
}
|
||||||
return date.getDate().toString().padStart(2, "0") + " " + dstMonth + " " + dstYear + dstTime
|
return (
|
||||||
|
date.getDate().toString().padStart(2, "0") +
|
||||||
|
" " +
|
||||||
|
dstMonth +
|
||||||
|
" " +
|
||||||
|
dstYear +
|
||||||
|
dstTime
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateThai(srcDate: Date, isFullMonth: boolean = true, isTime: boolean = false) {
|
function dateThai(
|
||||||
|
srcDate: Date,
|
||||||
|
isFullMonth: boolean = true,
|
||||||
|
isTime: boolean = false
|
||||||
|
) {
|
||||||
if (srcDate == null) {
|
if (srcDate == null) {
|
||||||
return null
|
return null;
|
||||||
;`
|
|
||||||
`
|
`
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
const date = new Date(srcDate)
|
const date = new Date(srcDate);
|
||||||
const isValidDate = Boolean(+date)
|
const isValidDate = Boolean(+date);
|
||||||
if (!isValidDate) return srcDate.toString()
|
if (!isValidDate) return srcDate.toString();
|
||||||
if (isValidDate && date.getFullYear() < 1000) return srcDate.toString()
|
if (isValidDate && date.getFullYear() < 1000) return srcDate.toString();
|
||||||
const fullMonthThai = ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
|
const fullMonthThai = [
|
||||||
const abbrMonthThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
|
"มกราคม",
|
||||||
let dstYear = 0
|
"กุมภาพันธ์",
|
||||||
|
"มีนาคม",
|
||||||
|
"เมษายน",
|
||||||
|
"พฤษภาคม",
|
||||||
|
"มิถุนายน",
|
||||||
|
"กรกฎาคม",
|
||||||
|
"สิงหาคม",
|
||||||
|
"กันยายน",
|
||||||
|
"ตุลาคม",
|
||||||
|
"พฤศจิกายน",
|
||||||
|
"ธันวาคม",
|
||||||
|
];
|
||||||
|
const abbrMonthThai = [
|
||||||
|
"ม.ค.",
|
||||||
|
"ก.พ.",
|
||||||
|
"มี.ค.",
|
||||||
|
"เม.ย.",
|
||||||
|
"พ.ค.",
|
||||||
|
"มิ.ย.",
|
||||||
|
"ก.ค.",
|
||||||
|
"ส.ค.",
|
||||||
|
"ก.ย.",
|
||||||
|
"ต.ค.",
|
||||||
|
"พ.ย.",
|
||||||
|
"ธ.ค.",
|
||||||
|
];
|
||||||
|
let dstYear = 0;
|
||||||
if (date.getFullYear() > 2500) {
|
if (date.getFullYear() > 2500) {
|
||||||
dstYear = date.getFullYear()
|
dstYear = date.getFullYear();
|
||||||
} else {
|
} else {
|
||||||
dstYear = date.getFullYear() + 543
|
dstYear = date.getFullYear() + 543;
|
||||||
}
|
}
|
||||||
let dstMonth = ""
|
let dstMonth = "";
|
||||||
if (isFullMonth) {
|
if (isFullMonth) {
|
||||||
dstMonth = fullMonthThai[date.getMonth()]
|
dstMonth = fullMonthThai[date.getMonth()];
|
||||||
} else {
|
} else {
|
||||||
dstMonth = abbrMonthThai[date.getMonth()]
|
dstMonth = abbrMonthThai[date.getMonth()];
|
||||||
}
|
}
|
||||||
let dstTime = ""
|
let dstTime = "";
|
||||||
if (isTime) {
|
if (isTime) {
|
||||||
const H = date.getHours().toString().padStart(2, "0")
|
const H = date.getHours().toString().padStart(2, "0");
|
||||||
const M = date.getMinutes().toString().padStart(2, "0")
|
const M = date.getMinutes().toString().padStart(2, "0");
|
||||||
// const S = date.getSeconds().toString().padStart(2, "0")
|
// const S = date.getSeconds().toString().padStart(2, "0")
|
||||||
// dstTime = " " + H + ":" + M + ":" + S + " น."
|
// dstTime = " " + H + ":" + M + ":" + S + " น."
|
||||||
dstTime = " " + H + ":" + M + " น."
|
dstTime = " " + H + ":" + M + " น.";
|
||||||
}
|
}
|
||||||
return date.getDate().toString().padStart(2, "0") + " " + dstMonth + " " + dstYear + dstTime
|
return (
|
||||||
|
date.getDate().toString().padStart(2, "0") +
|
||||||
|
" " +
|
||||||
|
dstMonth +
|
||||||
|
" " +
|
||||||
|
dstYear +
|
||||||
|
dstTime
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateMonth2Thai(srcDate: Date, isFullMonth = false, isTime = false) {
|
function dateMonth2Thai(srcDate: Date, isFullMonth = false, isTime = false) {
|
||||||
if (!srcDate) return srcDate
|
if (!srcDate) return srcDate;
|
||||||
const date = new Date(srcDate)
|
const date = new Date(srcDate);
|
||||||
const isValidDate = Boolean(+date)
|
const isValidDate = Boolean(+date);
|
||||||
if (!isValidDate) return srcDate
|
if (!isValidDate) return srcDate;
|
||||||
if (isValidDate && date.getFullYear() < 1000) return srcDate
|
if (isValidDate && date.getFullYear() < 1000) return srcDate;
|
||||||
const fullMonthThai = ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
|
const fullMonthThai = [
|
||||||
const abbrMonthThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
|
"มกราคม",
|
||||||
let dstYear = 0
|
"กุมภาพันธ์",
|
||||||
|
"มีนาคม",
|
||||||
|
"เมษายน",
|
||||||
|
"พฤษภาคม",
|
||||||
|
"มิถุนายน",
|
||||||
|
"กรกฎาคม",
|
||||||
|
"สิงหาคม",
|
||||||
|
"กันยายน",
|
||||||
|
"ตุลาคม",
|
||||||
|
"พฤศจิกายน",
|
||||||
|
"ธันวาคม",
|
||||||
|
];
|
||||||
|
const abbrMonthThai = [
|
||||||
|
"ม.ค.",
|
||||||
|
"ก.พ.",
|
||||||
|
"มี.ค.",
|
||||||
|
"เม.ย.",
|
||||||
|
"พ.ค.",
|
||||||
|
"มิ.ย.",
|
||||||
|
"ก.ค.",
|
||||||
|
"ส.ค.",
|
||||||
|
"ก.ย.",
|
||||||
|
"ต.ค.",
|
||||||
|
"พ.ย.",
|
||||||
|
"ธ.ค.",
|
||||||
|
];
|
||||||
|
let dstYear = 0;
|
||||||
if (date.getFullYear() > 2500) {
|
if (date.getFullYear() > 2500) {
|
||||||
dstYear = date.getFullYear()
|
dstYear = date.getFullYear();
|
||||||
} else {
|
} else {
|
||||||
dstYear = date.getFullYear() + 543
|
dstYear = date.getFullYear() + 543;
|
||||||
}
|
}
|
||||||
let dstMonth = ""
|
let dstMonth = "";
|
||||||
if (isFullMonth) {
|
if (isFullMonth) {
|
||||||
dstMonth = fullMonthThai[date.getMonth()]
|
dstMonth = fullMonthThai[date.getMonth()];
|
||||||
} else {
|
} else {
|
||||||
dstMonth = abbrMonthThai[date.getMonth()]
|
dstMonth = abbrMonthThai[date.getMonth()];
|
||||||
}
|
}
|
||||||
let dstTime = ""
|
let dstTime = "";
|
||||||
if (isTime) {
|
if (isTime) {
|
||||||
const H = date.getHours().toString().padStart(2, "0")
|
const H = date.getHours().toString().padStart(2, "0");
|
||||||
const M = date.getMinutes().toString().padStart(2, "0")
|
const M = date.getMinutes().toString().padStart(2, "0");
|
||||||
// const S = date.getSeconds().toString().length === 1 ? "0" + date.getSeconds() : date.getSeconds()
|
// const S = date.getSeconds().toString().length === 1 ? "0" + date.getSeconds() : date.getSeconds()
|
||||||
// dstTime = " " + H + ":" + M + ":" + S + " น."
|
// dstTime = " " + H + ":" + M + ":" + S + " น."
|
||||||
dstTime = " " + H + ":" + M + " น."
|
dstTime = " " + H + ":" + M + " น.";
|
||||||
}
|
}
|
||||||
return date.getDate().toString().padStart(2, "0") + " " + dstMonth
|
return date.getDate().toString().padStart(2, "0") + " " + dstMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
function monthYear2Thai(month: number, year: number, isFullMonth = false) {
|
function monthYear2Thai(month: number, year: number, isFullMonth = false) {
|
||||||
const date = new Date(`${year}-${month + 1}-1`)
|
const date = new Date(`${year}-${month + 1}-1`);
|
||||||
const fullMonthThai = ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
|
const fullMonthThai = [
|
||||||
const abbrMonthThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
|
"มกราคม",
|
||||||
let dstYear = 0
|
"กุมภาพันธ์",
|
||||||
|
"มีนาคม",
|
||||||
|
"เมษายน",
|
||||||
|
"พฤษภาคม",
|
||||||
|
"มิถุนายน",
|
||||||
|
"กรกฎาคม",
|
||||||
|
"สิงหาคม",
|
||||||
|
"กันยายน",
|
||||||
|
"ตุลาคม",
|
||||||
|
"พฤศจิกายน",
|
||||||
|
"ธันวาคม",
|
||||||
|
];
|
||||||
|
const abbrMonthThai = [
|
||||||
|
"ม.ค.",
|
||||||
|
"ก.พ.",
|
||||||
|
"มี.ค.",
|
||||||
|
"เม.ย.",
|
||||||
|
"พ.ค.",
|
||||||
|
"มิ.ย.",
|
||||||
|
"ก.ค.",
|
||||||
|
"ส.ค.",
|
||||||
|
"ก.ย.",
|
||||||
|
"ต.ค.",
|
||||||
|
"พ.ย.",
|
||||||
|
"ธ.ค.",
|
||||||
|
];
|
||||||
|
let dstYear = 0;
|
||||||
if (date.getFullYear() > 2500) {
|
if (date.getFullYear() > 2500) {
|
||||||
dstYear = date.getFullYear()
|
dstYear = date.getFullYear();
|
||||||
} else {
|
} else {
|
||||||
dstYear = date.getFullYear() + 543
|
dstYear = date.getFullYear() + 543;
|
||||||
}
|
}
|
||||||
let dstMonth = ""
|
let dstMonth = "";
|
||||||
if (isFullMonth) {
|
if (isFullMonth) {
|
||||||
dstMonth = fullMonthThai[date.getMonth()]
|
dstMonth = fullMonthThai[date.getMonth()];
|
||||||
} else {
|
} else {
|
||||||
dstMonth = abbrMonthThai[date.getMonth()]
|
dstMonth = abbrMonthThai[date.getMonth()];
|
||||||
}
|
}
|
||||||
return dstMonth + " " + dstYear
|
return dstMonth + " " + dstYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateToISO(date: Date) {
|
function dateToISO(date: Date) {
|
||||||
return date.getFullYear() + "-" + appendLeadingZeroes(date.getMonth() + 1) + "-" + appendLeadingZeroes(date.getDate())
|
return (
|
||||||
|
date.getFullYear() +
|
||||||
|
"-" +
|
||||||
|
appendLeadingZeroes(date.getMonth() + 1) +
|
||||||
|
"-" +
|
||||||
|
appendLeadingZeroes(date.getDate())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendLeadingZeroes(n: Number) {
|
function appendLeadingZeroes(n: number) {
|
||||||
if (n <= 9) return "0" + n
|
if (n <= 9) return "0" + n;
|
||||||
return n
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
function textToPhone(n: string) {
|
function textToPhone(n: string) {
|
||||||
const p = n.substr(0, 3) + "-" + n.substr(3, 3) + "-" + n.substr(6, 4)
|
const p = n.substr(0, 3) + "-" + n.substr(3, 3) + "-" + n.substr(6, 4);
|
||||||
return p
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
function textToFax(n: string) {
|
function textToFax(n: string) {
|
||||||
const p = n.substr(0, 2) + "-" + n.substr(2, 3) + "-" + n.substr(5, 4)
|
const p = n.substr(0, 2) + "-" + n.substr(2, 3) + "-" + n.substr(5, 4);
|
||||||
return p
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
const success = (q: any, val: string) => {
|
const success = (q: any, val: string) => {
|
||||||
|
|
@ -216,9 +351,9 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
badgeColor: "positive",
|
badgeColor: "positive",
|
||||||
classes: "my-notif-class",
|
classes: "my-notif-class",
|
||||||
})
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const fails = (q: any, val: string) => {
|
const fails = (q: any, val: string) => {
|
||||||
// useQuasar ไม่สามารถใช้นอกไฟล์ .vue
|
// useQuasar ไม่สามารถใช้นอกไฟล์ .vue
|
||||||
|
|
@ -232,9 +367,9 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
badgeColor: "positive",
|
badgeColor: "positive",
|
||||||
classes: "my-notif-class",
|
classes: "my-notif-class",
|
||||||
})
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function notify(q: any, val: string) {
|
function notify(q: any, val: string) {
|
||||||
if (val !== "") {
|
if (val !== "") {
|
||||||
|
|
@ -246,7 +381,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
multiLine: true,
|
multiLine: true,
|
||||||
timeout: 7000,
|
timeout: 7000,
|
||||||
actions: [{ label: "ปิด", color: "white", handler: () => {} }],
|
actions: [{ label: "ปิด", color: "white", handler: () => {} }],
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function notifyError(q: any, val: string) {
|
function notifyError(q: any, val: string) {
|
||||||
|
|
@ -259,7 +394,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
multiLine: true,
|
multiLine: true,
|
||||||
timeout: 12000,
|
timeout: 12000,
|
||||||
actions: [{ label: "ปิด", color: "white", handler: () => {} }],
|
actions: [{ label: "ปิด", color: "white", handler: () => {} }],
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,7 +412,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
color: "red",
|
color: "red",
|
||||||
onlycancel: true,
|
onlycancel: true,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
q.dialog({
|
q.dialog({
|
||||||
component: CustomComponent,
|
component: CustomComponent,
|
||||||
|
|
@ -288,7 +423,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
color: "red",
|
color: "red",
|
||||||
onlycancel: true,
|
onlycancel: true,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (e.response.status == 401) {
|
if (e.response.status == 401) {
|
||||||
|
|
@ -302,7 +437,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
color: "red",
|
color: "red",
|
||||||
onlycancel: true,
|
onlycancel: true,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
q.dialog({
|
q.dialog({
|
||||||
component: CustomComponent,
|
component: CustomComponent,
|
||||||
|
|
@ -313,7 +448,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
color: "red",
|
color: "red",
|
||||||
onlycancel: true,
|
onlycancel: true,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -326,9 +461,9 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
color: "red",
|
color: "red",
|
||||||
onlycancel: true,
|
onlycancel: true,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const dialogMessage = (
|
const dialogMessage = (
|
||||||
// ไม่เอาใส่ undefined
|
// ไม่เอาใส่ undefined
|
||||||
|
|
@ -354,12 +489,12 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.onOk(() => {
|
.onOk(() => {
|
||||||
if (ok != undefined) ok()
|
if (ok != undefined) ok();
|
||||||
})
|
})
|
||||||
.onCancel(() => {
|
.onCancel(() => {
|
||||||
if (cancel != undefined) cancel()
|
if (cancel != undefined) cancel();
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const showLoader = () => {
|
const showLoader = () => {
|
||||||
Loading.show({
|
Loading.show({
|
||||||
|
|
@ -367,14 +502,20 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
spinnerSize: 140,
|
spinnerSize: 140,
|
||||||
spinnerColor: "primary",
|
spinnerColor: "primary",
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const hideLoader = () => {
|
const hideLoader = () => {
|
||||||
Loading.hide()
|
Loading.hide();
|
||||||
}
|
};
|
||||||
|
|
||||||
function modalDelete(q: any, title: string, message: string, ok: Function, cancel?: Function) {
|
function modalDelete(
|
||||||
|
q: any,
|
||||||
|
title: string,
|
||||||
|
message: string,
|
||||||
|
ok: Function,
|
||||||
|
cancel?: Function
|
||||||
|
) {
|
||||||
q.dialog({
|
q.dialog({
|
||||||
title: `<span class="text-red">${title}</span>`,
|
title: `<span class="text-red">${title}</span>`,
|
||||||
message: `<span class="text-black">${message}</span>`,
|
message: `<span class="text-black">${message}</span>`,
|
||||||
|
|
@ -390,15 +531,21 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
html: true,
|
html: true,
|
||||||
})
|
})
|
||||||
.onOk(() => {
|
.onOk(() => {
|
||||||
ok()
|
ok();
|
||||||
})
|
})
|
||||||
.onCancel(() => {
|
.onCancel(() => {
|
||||||
if (cancel != undefined) cancel()
|
if (cancel != undefined) cancel();
|
||||||
})
|
})
|
||||||
.onDismiss(() => {})
|
.onDismiss(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function modalConfirm(q: any, title: string, message: string, ok: Function, cancel?: Function) {
|
function modalConfirm(
|
||||||
|
q: any,
|
||||||
|
title: string,
|
||||||
|
message: string,
|
||||||
|
ok: Function,
|
||||||
|
cancel?: Function
|
||||||
|
) {
|
||||||
q.dialog({
|
q.dialog({
|
||||||
title: `<span class="text-primary">${title}</span>`,
|
title: `<span class="text-primary">${title}</span>`,
|
||||||
message: `<span class="text-black">${message}</span>`,
|
message: `<span class="text-black">${message}</span>`,
|
||||||
|
|
@ -414,12 +561,12 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
html: true,
|
html: true,
|
||||||
})
|
})
|
||||||
.onOk(() => {
|
.onOk(() => {
|
||||||
ok()
|
ok();
|
||||||
})
|
})
|
||||||
.onCancel(() => {
|
.onCancel(() => {
|
||||||
if (cancel != undefined) cancel()
|
if (cancel != undefined) cancel();
|
||||||
})
|
})
|
||||||
.onDismiss(() => {})
|
.onDismiss(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function modalWarning(q: any, title: string, message: string, ok?: Function) {
|
function modalWarning(q: any, title: string, message: string, ok?: Function) {
|
||||||
|
|
@ -449,7 +596,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
color: "warning",
|
color: "warning",
|
||||||
onlycancel: true,
|
onlycancel: true,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function modalError(q: any, title: string, message: string, ok?: Function) {
|
function modalError(q: any, title: string, message: string, ok?: Function) {
|
||||||
|
|
@ -479,16 +626,16 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
color: "red",
|
color: "red",
|
||||||
onlycancel: true,
|
onlycancel: true,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const dateText = (val: Date) => {
|
const dateText = (val: Date) => {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
return date2Thai(val)
|
return date2Thai(val);
|
||||||
} else {
|
} else {
|
||||||
return "-"
|
return "-";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* แปลงช่วงวันที่ถ้า2ค่าเป็นวันเดียวกันจะโชววันเดียวแต่ถ้าไม่เท่ากันจะแสดงเป็นช่วง
|
* แปลงช่วงวันที่ถ้า2ค่าเป็นวันเดียวกันจะโชววันเดียวแต่ถ้าไม่เท่ากันจะแสดงเป็นช่วง
|
||||||
|
|
@ -496,138 +643,138 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
*/
|
*/
|
||||||
const dateThaiRange = (val: [Date, Date]) => {
|
const dateThaiRange = (val: [Date, Date]) => {
|
||||||
if (val === null) {
|
if (val === null) {
|
||||||
return ""
|
return "";
|
||||||
} else if (date2Thai(val[0]) === date2Thai(val[1])) {
|
} else if (date2Thai(val[0]) === date2Thai(val[1])) {
|
||||||
return `${date2Thai(val[0])}`
|
return `${date2Thai(val[0])}`;
|
||||||
} else {
|
} else {
|
||||||
return `${date2Thai(val[0])} - ${date2Thai(val[1])}`
|
return `${date2Thai(val[0])} - ${date2Thai(val[1])}`;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const weekThai = (val: Number) => {
|
const weekThai = (val: Number) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 0:
|
case 0:
|
||||||
return "วันอาทิตย์"
|
return "วันอาทิตย์";
|
||||||
case 1:
|
case 1:
|
||||||
return "วันจันทร์"
|
return "วันจันทร์";
|
||||||
case 2:
|
case 2:
|
||||||
return "วันอังคาร"
|
return "วันอังคาร";
|
||||||
case 3:
|
case 3:
|
||||||
return "วันพุธ"
|
return "วันพุธ";
|
||||||
case 4:
|
case 4:
|
||||||
return "วันพฤหัสบดี"
|
return "วันพฤหัสบดี";
|
||||||
case 5:
|
case 5:
|
||||||
return "วันศุกร์"
|
return "วันศุกร์";
|
||||||
case 6:
|
case 6:
|
||||||
return "วันเสาร์"
|
return "วันเสาร์";
|
||||||
default:
|
default:
|
||||||
return "-"
|
return "-";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const genColor15 = (val: number) => {
|
const genColor15 = (val: number) => {
|
||||||
val = val % 15
|
val = val % 15;
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 1:
|
case 1:
|
||||||
return "pink"
|
return "pink";
|
||||||
case 2:
|
case 2:
|
||||||
return "purple"
|
return "purple";
|
||||||
case 3:
|
case 3:
|
||||||
return "deep-purple"
|
return "deep-purple";
|
||||||
case 4:
|
case 4:
|
||||||
return "indigo"
|
return "indigo";
|
||||||
case 5:
|
case 5:
|
||||||
return "blue"
|
return "blue";
|
||||||
case 6:
|
case 6:
|
||||||
return "light-blue"
|
return "light-blue";
|
||||||
case 7:
|
case 7:
|
||||||
return "cyan"
|
return "cyan";
|
||||||
case 8:
|
case 8:
|
||||||
return "teal"
|
return "teal";
|
||||||
case 9:
|
case 9:
|
||||||
return "green"
|
return "green";
|
||||||
case 10:
|
case 10:
|
||||||
return "light-green"
|
return "light-green";
|
||||||
case 11:
|
case 11:
|
||||||
return "amber"
|
return "amber";
|
||||||
case 12:
|
case 12:
|
||||||
return "orange"
|
return "orange";
|
||||||
case 13:
|
case 13:
|
||||||
return "deep-orange"
|
return "deep-orange";
|
||||||
case 14:
|
case 14:
|
||||||
return "brown"
|
return "brown";
|
||||||
case 0:
|
case 0:
|
||||||
return "blue-grey"
|
return "blue-grey";
|
||||||
default:
|
default:
|
||||||
return ""
|
return "";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const typeCategoryExam = (val: string) => {
|
const typeCategoryExam = (val: string) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "hygiene":
|
case "hygiene":
|
||||||
return "สำนักอนามัย"
|
return "สำนักอนามัย";
|
||||||
case "physician":
|
case "physician":
|
||||||
return "สำนักการแพทย์"
|
return "สำนักการแพทย์";
|
||||||
case "city":
|
case "city":
|
||||||
return "สำนักผังเมือง"
|
return "สำนักผังเมือง";
|
||||||
case "culture":
|
case "culture":
|
||||||
return "สำนักวัฒนธรรม กีฬา และการท่องเที่ยว"
|
return "สำนักวัฒนธรรม กีฬา และการท่องเที่ยว";
|
||||||
default:
|
default:
|
||||||
return "-"
|
return "-";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const typeRetire = (val: string) => {
|
const typeRetire = (val: string) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "retire":
|
case "retire":
|
||||||
return "เกษียณอายุราชการ"
|
return "เกษียณอายุราชการ";
|
||||||
case "resign":
|
case "resign":
|
||||||
return "ลาออก"
|
return "ลาออก";
|
||||||
case "transfer":
|
case "transfer":
|
||||||
return "ให้โอน"
|
return "ให้โอน";
|
||||||
case "death":
|
case "death":
|
||||||
return "ถึงแก่กรรม"
|
return "ถึงแก่กรรม";
|
||||||
case "layoff":
|
case "layoff":
|
||||||
return "ให้ออก"
|
return "ให้ออก";
|
||||||
case "discharge":
|
case "discharge":
|
||||||
return "ปลดออก"
|
return "ปลดออก";
|
||||||
case "dismiss":
|
case "dismiss":
|
||||||
return "ไล่ออก"
|
return "ไล่ออก";
|
||||||
case "other":
|
case "other":
|
||||||
return "อื่นๆ"
|
return "อื่นๆ";
|
||||||
default:
|
default:
|
||||||
return "-"
|
return "-";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const typeChangeName = (val: string) => {
|
const typeChangeName = (val: string) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "firstName":
|
case "firstName":
|
||||||
return "เปลี่ยนชื่อ"
|
return "เปลี่ยนชื่อ";
|
||||||
case "lastName":
|
case "lastName":
|
||||||
return "เปลี่ยนนามสกุล"
|
return "เปลี่ยนนามสกุล";
|
||||||
case "all":
|
case "all":
|
||||||
return "เปลี่ยนชื่อ-นามสกุล"
|
return "เปลี่ยนชื่อ-นามสกุล";
|
||||||
default:
|
default:
|
||||||
return "-"
|
return "-";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const statusLeave = (val: string) => {
|
const statusLeave = (val: string) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "waitting":
|
case "waitting":
|
||||||
return "รออนุมัติ"
|
return "รออนุมัติ";
|
||||||
case "reject":
|
case "reject":
|
||||||
return "ไม่ผ่านการอนุมัติ"
|
return "ไม่ผ่านการอนุมัติ";
|
||||||
case "approve":
|
case "approve":
|
||||||
return "ผ่านการอนุมัติ"
|
return "ผ่านการอนุมัติ";
|
||||||
case "cancel":
|
case "cancel":
|
||||||
return "ยกเลิก"
|
return "ยกเลิก";
|
||||||
default:
|
default:
|
||||||
return "-"
|
return "-";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
const dialogConfirm = (
|
const dialogConfirm = (
|
||||||
q: any,
|
q: any,
|
||||||
ok?: Function,
|
ok?: Function,
|
||||||
|
|
@ -685,6 +832,105 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
if (cancel) cancel();
|
if (cancel) cancel();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชั่นเช็คและแปลงตัวเลขก่อนส่งไป convert เป็นข้อความที่ฟังก์ชั่น arabicNumberToText
|
||||||
|
* @param Number จำนวนเงินเดือน
|
||||||
|
* @returns ตัวเลขที่ถูกแปลง format แล้ว
|
||||||
|
*/
|
||||||
|
function CheckNumber(Number: any) {
|
||||||
|
let decimal = false;
|
||||||
|
Number = Number.toString();
|
||||||
|
Number = Number.replace(/ |,|บาท|฿/gi, "");
|
||||||
|
for (var i = 0; i < Number.length; i++) {
|
||||||
|
if (Number[i] == ".") {
|
||||||
|
decimal = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (decimal == false) {
|
||||||
|
Number = Number + ".00";
|
||||||
|
}
|
||||||
|
return Number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชั่น convert จำนวนเงินเดือนที่เป็นตัวเลขมาเป็นข้อความตัวหนังสือ
|
||||||
|
* @param numberVal จำนวนเงินเดือน
|
||||||
|
* @returns เงินเดือนแบบข้อความ (คำอ่าน)
|
||||||
|
*/
|
||||||
|
function arabicNumberToText(numberVal: any) {
|
||||||
|
var numberVal = CheckNumber(numberVal);
|
||||||
|
const NumberArray = [
|
||||||
|
"ศูนย์",
|
||||||
|
"หนึ่ง",
|
||||||
|
"สอง",
|
||||||
|
"สาม",
|
||||||
|
"สี่",
|
||||||
|
"ห้า",
|
||||||
|
"หก",
|
||||||
|
"เจ็ด",
|
||||||
|
"แปด",
|
||||||
|
"เก้า",
|
||||||
|
"สิบ",
|
||||||
|
];
|
||||||
|
|
||||||
|
const DigitArray = ["", "สิบ", "ร้อย", "พัน", "หมื่น", "แสน", "ล้าน"];
|
||||||
|
|
||||||
|
let bahtText = "";
|
||||||
|
if (isNaN(numberVal)) {
|
||||||
|
return "ข้อมูลนำเข้าไม่ถูกต้อง";
|
||||||
|
} else {
|
||||||
|
if (numberVal - 0 > 9999999.9999) {
|
||||||
|
return "ข้อมูลนำเข้าเกินขอบเขตที่ตั้งไว้";
|
||||||
|
} else {
|
||||||
|
numberVal = numberVal.split(".");
|
||||||
|
if (numberVal[1].length > 0) {
|
||||||
|
numberVal[1] = numberVal[1].substring(0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const numberValLen = numberVal[0].length - 0;
|
||||||
|
for (let i = 0; i < numberValLen; i++) {
|
||||||
|
const tmp = numberVal[0].substring(i, i + 1) - 0;
|
||||||
|
if (tmp != 0) {
|
||||||
|
if (i == numberValLen - 1 && tmp == 1) {
|
||||||
|
bahtText += "เอ็ด";
|
||||||
|
} else if (i == numberValLen - 2 && tmp == 2) {
|
||||||
|
bahtText += "ยี่";
|
||||||
|
} else if (i == numberValLen - 2 && tmp == 1) {
|
||||||
|
bahtText += "";
|
||||||
|
} else {
|
||||||
|
bahtText += NumberArray[tmp];
|
||||||
|
}
|
||||||
|
bahtText += DigitArray[numberValLen - i - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bahtText += "บาท";
|
||||||
|
if (numberVal[1] == "0" || numberVal[1] == "00") {
|
||||||
|
bahtText += "ถ้วน";
|
||||||
|
} else {
|
||||||
|
let DecimalLen = numberVal[1].length - 0;
|
||||||
|
for (var i = 0; i < DecimalLen; i++) {
|
||||||
|
var tmp = numberVal[1].substring(i, i + 1) - 0;
|
||||||
|
if (tmp != 0) {
|
||||||
|
if (i == DecimalLen - 1 && tmp == 1) {
|
||||||
|
bahtText += "เอ็ด";
|
||||||
|
} else if (i == DecimalLen - 2 && tmp == 2) {
|
||||||
|
bahtText += "ยี่";
|
||||||
|
} else if (i == DecimalLen - 2 && tmp == 1) {
|
||||||
|
bahtText += "";
|
||||||
|
} else {
|
||||||
|
bahtText += NumberArray[tmp];
|
||||||
|
}
|
||||||
|
bahtText += DigitArray[DecimalLen - i - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bahtText += "สตางค์";
|
||||||
|
}
|
||||||
|
return bahtText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
calAge,
|
calAge,
|
||||||
date2Thai,
|
date2Thai,
|
||||||
|
|
@ -715,7 +961,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
modalWarning,
|
modalWarning,
|
||||||
fails,
|
fails,
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
dialogRemove
|
dialogRemove,
|
||||||
|
arabicNumberToText,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue