ใบประกอบวิชาชีพ
This commit is contained in:
parent
0cd390cde7
commit
d948a1a667
4 changed files with 47 additions and 76 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<!-- card ใบอนุญาตประกอบอาชีพ -->
|
||||
<!-- card ใบประกอบวิชาชีพ -->
|
||||
<template>
|
||||
<q-card flat bordered class="col-12 q-px-lg q-py-md q-mt-md">
|
||||
<q-form ref="myForm">
|
||||
|
|
@ -11,9 +11,7 @@
|
|||
v-model:inputvisible="visibleColumns"
|
||||
:add="clickAdd"
|
||||
:name="
|
||||
profileType == 'employee'
|
||||
? 'ใบอนุญาตของลูกจ้าง'
|
||||
: 'ใบอนุญาตประกอบอาชีพ'
|
||||
profileType == 'employee' ? 'ใบอนุญาตของลูกจ้าง' : 'ใบประกอบวิชาชีพ'
|
||||
"
|
||||
icon="mdi-book"
|
||||
:statusEdit="statusEdit"
|
||||
|
|
@ -27,11 +25,11 @@
|
|||
@click="selectData(props)"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<div
|
||||
v-if="col.name == 'issueDate' || col.name == 'expireDate'"
|
||||
class="table_ellipsis"
|
||||
>
|
||||
{{ date2Thai(col.value) }}
|
||||
<div v-if="col.name == 'issueDate'" class="table_ellipsis">
|
||||
{{ col.value ? date2Thai(col.value) : "-" }}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'expireDate'" class="table_ellipsis">
|
||||
{{ col.value ? date2Thai(col.value) : "-" }}
|
||||
</div>
|
||||
<div v-else class="table_ellipsis">
|
||||
{{ col.value }}
|
||||
|
|
@ -47,7 +45,7 @@
|
|||
icon="mdi-history"
|
||||
@click="clickHistory(props.row)"
|
||||
>
|
||||
<q-tooltip>ประวัติแก้ไขใบอนุญาตประกอบอาชีพ</q-tooltip>
|
||||
<q-tooltip>ประวัติแก้ไขใบประกอบวิชาชีพ</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
|
|
@ -61,9 +59,7 @@
|
|||
<q-form ref="myForm">
|
||||
<DialogHeader
|
||||
:tittle="
|
||||
profileType == 'employee'
|
||||
? 'ใบอนุญาตของลูกจ้าง'
|
||||
: 'ใบอนุญาตประกอบอาชีพ'
|
||||
profileType == 'employee' ? 'ใบอนุญาตของลูกจ้าง' : 'ใบประกอบวิชาชีพ'
|
||||
"
|
||||
:close="clickClose"
|
||||
/>
|
||||
|
|
@ -125,10 +121,6 @@
|
|||
label="วัน/เดือน/ปี ที่ออกใบอนุญาต"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:error="dayChecked"
|
||||
error-message="กรุณากรอก วัน/เดือน/ปี ที่ออกใบอนุญาต"
|
||||
/>
|
||||
<datepicker
|
||||
v-else
|
||||
|
|
@ -150,13 +142,8 @@
|
|||
:class="getClass(edit)"
|
||||
:outlined="edit"
|
||||
dense
|
||||
lazy-rules
|
||||
:borderless="!edit"
|
||||
:model-value="date2Thai(issueDate as Date)"
|
||||
:rules="[
|
||||
(val) => !!val || `${'กรุณาเลือกวันที่ออกใบอนุญาต'}`,
|
||||
]"
|
||||
hide-bottom-space
|
||||
:label="`${'วันที่ออกใบอนุญาต'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
|
|
@ -183,9 +170,6 @@
|
|||
label="วัน/เดือน/ปี ที่หมดอายุ"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
hide-bottom-space
|
||||
:error="dayChecked2"
|
||||
error-message="กรุณากรอก วัน/เดือน/ปี ที่หมดอายุ"
|
||||
/>
|
||||
<datepicker
|
||||
v-else
|
||||
|
|
@ -211,8 +195,6 @@
|
|||
lazy-rules
|
||||
:borderless="!edit"
|
||||
:model-value="date2Thai(expireDate as Date)"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่หมดอายุ'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'วันที่หมดอายุ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
|
|
@ -303,8 +285,6 @@ import type { QTableProps } from "quasar";
|
|||
|
||||
const inputIssueDate = ref<string>("");
|
||||
const inputExpireDate = ref<string>("");
|
||||
const dayChecked = ref<boolean>(false);
|
||||
const dayChecked2 = ref<boolean>(false);
|
||||
const props = defineProps({
|
||||
statusEdit: {
|
||||
type: Boolean,
|
||||
|
|
@ -335,8 +315,8 @@ const route = useRoute();
|
|||
const id = ref<string>("");
|
||||
const certificateNo = ref<string>();
|
||||
const issuer = ref<string>();
|
||||
const issueDate = ref<Date | string | null>(new Date());
|
||||
const expireDate = ref<Date | string | null>(new Date());
|
||||
const issueDate = ref<Date | string | null>(null);
|
||||
const expireDate = ref<Date | string | null>(null);
|
||||
const certificateType = ref<string>();
|
||||
const minDate = ref<Date>();
|
||||
const myForm = ref<any>(); //form data input
|
||||
|
|
@ -349,7 +329,7 @@ const previous = ref<boolean>(); //แสดงปุ่มดูข้อมู
|
|||
const next = ref<boolean>(); //แสดงปุ่มดูข้อมูลต่อไป
|
||||
const editRow = ref<boolean>(false); //เช็คมีการแก้ไขข้อมูล
|
||||
const rowsHistory = ref<RequestItemsObject[]>([]); //select data history
|
||||
const tittleHistory = ref<string>("ประวัติแก้ไขใบอนุญาตประกอบอาชีพ"); //
|
||||
const tittleHistory = ref<string>("ประวัติแก้ไขใบประกอบวิชาชีพ"); //
|
||||
const filterHistory = ref<string>(""); //search data table history
|
||||
const modalHistory = ref<boolean>(false); //modal ประวัติการแก้ไขข้อมูล
|
||||
const checkValidate = ref<boolean>(false); //validate data ผ่านหรือไม่
|
||||
|
|
@ -535,12 +515,14 @@ const fetchData = async () => {
|
|||
id: e.id,
|
||||
certificateNo: e.certificateNo,
|
||||
issuer: e.issuer,
|
||||
issueDate: new Date(e.issueDate),
|
||||
expireDate: new Date(e.expireDate),
|
||||
issueDate: e.issueDate !== null ? new Date(e.issueDate):null,
|
||||
expireDate: e.expireDate !== null ? new Date(e.expireDate):null,
|
||||
certificateType: e.certificateType,
|
||||
createdFullName: e.createdFullName,
|
||||
createdAt: new Date(e.createdAt),
|
||||
});
|
||||
console.log(rows.value)
|
||||
console.log(data)
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -582,8 +564,8 @@ const getData = () => {
|
|||
issuer.value = row.issuer;
|
||||
issueDate.value = row.issueDate;
|
||||
expireDate.value = row.expireDate;
|
||||
inputIssueDate.value = convertDateDisplay(row.issueDate);
|
||||
inputExpireDate.value = convertDateDisplay(row.expireDate);
|
||||
inputIssueDate.value = row.issueDate !== null ? convertDateDisplay(row.issueDate as Date):'';
|
||||
inputExpireDate.value = row.expireDate !== null ? convertDateDisplay(row.expireDate as Date):'';
|
||||
certificateType.value = row.certificateType;
|
||||
id.value = row.id;
|
||||
};
|
||||
|
|
@ -626,16 +608,10 @@ const clickAdd = async () => {
|
|||
const clickSave = async () => {
|
||||
myForm.value.validate().then(async (result: boolean) => {
|
||||
if (result) {
|
||||
if (inputIssueDate.value === "") {
|
||||
dayChecked.value = true;
|
||||
} else if (inputExpireDate.value === "") {
|
||||
dayChecked2.value = true;
|
||||
} else {
|
||||
if (modalEdit.value) {
|
||||
await editData();
|
||||
} else {
|
||||
await saveData();
|
||||
}
|
||||
if (modalEdit.value) {
|
||||
await editData();
|
||||
} else {
|
||||
await saveData();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -650,8 +626,8 @@ const saveData = async () => {
|
|||
id: id.value,
|
||||
certificateNo: certificateNo.value,
|
||||
issuer: issuer.value,
|
||||
issueDate: dateToISO(issueDate.value as Date),
|
||||
expireDate: dateToISO(expireDate.value as Date),
|
||||
issueDate: issueDate.value ? dateToISO(issueDate.value as Date):null,
|
||||
expireDate: expireDate.value ? dateToISO(expireDate.value as Date):null,
|
||||
certificateType: certificateType.value,
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
@ -676,8 +652,8 @@ const editData = async () => {
|
|||
id: id.value,
|
||||
certificateNo: certificateNo.value,
|
||||
issuer: issuer.value,
|
||||
issueDate: dateToISO(issueDate.value as Date),
|
||||
expireDate: dateToISO(expireDate.value as Date),
|
||||
issueDate: issueDate.value ? dateToISO(issueDate.value as Date):null,
|
||||
expireDate: expireDate.value ? dateToISO(expireDate.value as Date):null,
|
||||
certificateType: certificateType.value,
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
@ -760,8 +736,8 @@ const selectData = async (props: DataProps) => {
|
|||
issuer.value = props.row.issuer;
|
||||
issueDate.value = props.row.issueDate;
|
||||
expireDate.value = props.row.expireDate;
|
||||
inputIssueDate.value = convertDateDisplay(props.row.issueDate);
|
||||
inputExpireDate.value = convertDateDisplay(props.row.expireDate);
|
||||
inputIssueDate.value = props.row.issueDate !== null ? convertDateDisplay(props.row.issueDate as Date):'';
|
||||
inputExpireDate.value = props.row.expireDate !== null ? convertDateDisplay(props.row.expireDate as Date):'';
|
||||
certificateType.value = props.row.certificateType;
|
||||
id.value = props.row.id;
|
||||
await checkRowPage();
|
||||
|
|
@ -776,14 +752,11 @@ const addData = () => {
|
|||
edit.value = true;
|
||||
certificateNo.value = "";
|
||||
issuer.value = "";
|
||||
issueDate.value = new Date();
|
||||
expireDate.value = new Date();
|
||||
inputIssueDate.value = '';
|
||||
inputExpireDate.value = '';
|
||||
issueDate.value = null;
|
||||
expireDate.value = null;
|
||||
inputIssueDate.value = "";
|
||||
inputExpireDate.value = "";
|
||||
certificateType.value = "";
|
||||
|
||||
dayChecked.value = false
|
||||
dayChecked2.value = false
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -823,7 +796,7 @@ const clickHistory = async (row: RequestItemsObject) => {
|
|||
tittleHistory.value =
|
||||
props.profileType == "employee"
|
||||
? "ประวัติแก้ไขใบอนุญาตของลูกจ้าง"
|
||||
: "ประวัติแก้ไขใบอนุญาตประกอบอาชีพ";
|
||||
: "ประวัติแก้ไขใบประกอบวิชาชีพ";
|
||||
modalHistory.value = true;
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -881,10 +854,8 @@ watch(
|
|||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayChecked.value = false;
|
||||
issueDate.value = dateVal.value;
|
||||
} else {
|
||||
dayChecked.value = true;
|
||||
inputIssueDate.value = "";
|
||||
}
|
||||
}
|
||||
|
|
@ -897,17 +868,13 @@ watch(
|
|||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayChecked2.value = false;
|
||||
expireDate.value = dateVal.value;
|
||||
} else {
|
||||
dayChecked2.value = true;
|
||||
inputExpireDate.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.modalfix {
|
||||
|
|
|
|||
|
|
@ -1185,13 +1185,17 @@ const editData = async () => {
|
|||
dateOrder: dateOrder.value,
|
||||
isDate: isDate.value == "true" ? true : false,
|
||||
startDate:
|
||||
isDate.value == "true"
|
||||
? dateToISO(startDate2.value as Date)
|
||||
: new Date(`${startDate.value}-01-01`),
|
||||
endDate:
|
||||
isDate.value == "true"
|
||||
? dateToISO(endDate2.value as Date)
|
||||
: new Date(`${endDate.value}-01-01`),
|
||||
isDate.value == "true"
|
||||
? startDate2.value
|
||||
? dateToISO(startDate2.value as Date)
|
||||
: null
|
||||
: startDate.value !== 0 ? new Date(`${startDate.value}-01-01`):null,
|
||||
endDate:
|
||||
isDate.value == "true"
|
||||
? endDate2.value
|
||||
? dateToISO(endDate2.value as Date)
|
||||
: null
|
||||
: endDate.value !== 0 ? new Date(`${endDate.value}-01-01`):null,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ interface RequestItemsObject {
|
|||
id: string;
|
||||
certificateNo: string;
|
||||
issuer: string;
|
||||
issueDate: Date;
|
||||
expireDate: Date;
|
||||
issueDate: Date|null;
|
||||
expireDate: Date|null;
|
||||
certificateType: string;
|
||||
createdFullName: string;
|
||||
createdAt: Date;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue