From b4126340961b31f4ff9b69dc87220f9b92fd7fc7 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 18 Aug 2023 11:11:37 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../08_registryEmployee/views/Assessment.vue | 26 ++++--- .../08_registryEmployee/views/Discipline.vue | 26 ++++--- .../08_registryEmployee/views/Document.vue | 38 +++++++++- .../08_registryEmployee/views/Education.vue | 25 ++++--- .../views/Information/Address.vue | 6 +- .../views/Information/Certicate.vue | 26 ++++--- .../views/Information/Family.vue | 8 +- .../views/Information/Information.vue | 6 +- .../08_registryEmployee/views/Leave.vue | 25 ++++--- .../08_registryEmployee/views/Main.vue | 74 +++++++++---------- .../08_registryEmployee/views/Other.vue | 24 +++--- .../views/SalaryEmployee.vue | 32 +++++--- .../08_registryEmployee/views/Talent.vue | 26 ++++--- .../08_registryEmployee/views/Train.vue | 26 ++++--- .../08_registryEmployee/views/Work.vue | 26 ++++--- .../08_registryEmployee/views/information.vue | 8 +- src/views/MainLayout.vue | 56 +++++++------- 17 files changed, 264 insertions(+), 194 deletions(-) diff --git a/src/modules/08_registryEmployee/views/Assessment.vue b/src/modules/08_registryEmployee/views/Assessment.vue index 981e8cc44..2ff696e02 100644 --- a/src/modules/08_registryEmployee/views/Assessment.vue +++ b/src/modules/08_registryEmployee/views/Assessment.vue @@ -260,7 +260,6 @@ :cancel="clickCancel" :edit="clickEdit" :save="clickSave" - :validate="validateData" :clickNext="clickNext" :clickPrevious="clickPrevious" :clickDelete="clickDelete" @@ -340,7 +339,7 @@ const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader,dialogConfirm } = mixin; const route = useRoute(); const id = ref(""); @@ -700,8 +699,11 @@ const clickAdd = async () => { /** * กดบันทึกใน dialog */ -const clickSave = async () => { - myForm.value.validate().then(async (result: boolean) => { +const clickSave = () =>{ + dialogConfirm($q,()=>SaveData()) +} +const SaveData = async () => { + await myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { await editData(); @@ -934,14 +936,14 @@ const clickHistory = async (row: RequestItemsObject) => { /** * validate input ใน dialog */ -const validateData = async () => { - checkValidate.value = true; - await myForm.value.validate().then((result: boolean) => { - if (result == false) { - checkValidate.value = false; - } - }); -}; +// const validateData = async () => { +// checkValidate.value = true; +// await myForm.value.validate().then((result: boolean) => { +// if (result == false) { +// checkValidate.value = false; +// } +// }); +// }; /** * class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ diff --git a/src/modules/08_registryEmployee/views/Discipline.vue b/src/modules/08_registryEmployee/views/Discipline.vue index b2c4f2bc0..d7a66f07a 100644 --- a/src/modules/08_registryEmployee/views/Discipline.vue +++ b/src/modules/08_registryEmployee/views/Discipline.vue @@ -230,7 +230,6 @@ :cancel="clickCancel" :edit="clickEdit" :save="clickSave" - :validate="validateData" :clickNext="clickNext" :clickPrevious="clickPrevious" :clickDelete="clickDelete" @@ -309,7 +308,7 @@ const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader, dialogConfirm } = mixin; const route = useRoute(); const id = ref(""); @@ -689,8 +688,11 @@ const clickAdd = async () => { /** * กดบันทึกใน dialog */ -const clickSave = async () => { - myForm.value.validate().then(async (result: boolean) => { +const clickSave = () => { + dialogConfirm($q,()=>SaveData()) +} +const SaveData = async () => { + await myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { await editData(); @@ -915,14 +917,14 @@ const clickHistory = async (row: RequestItemsObject) => { /** * validate input ใน dialog */ -const validateData = async () => { - checkValidate.value = true; - await myForm.value.validate().then((result: boolean) => { - if (result == false) { - checkValidate.value = false; - } - }); -}; +// const validateData = async () => { +// checkValidate.value = true; +// await myForm.value.validate().then((result: boolean) => { +// if (result == false) { +// checkValidate.value = false; +// } +// }); +// }; /** * class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ diff --git a/src/modules/08_registryEmployee/views/Document.vue b/src/modules/08_registryEmployee/views/Document.vue index f9f5f32fb..bcc2c1204 100644 --- a/src/modules/08_registryEmployee/views/Document.vue +++ b/src/modules/08_registryEmployee/views/Document.vue @@ -1,11 +1,13 @@ diff --git a/src/modules/08_registryEmployee/views/Other.vue b/src/modules/08_registryEmployee/views/Other.vue index 5acb4b600..977265bec 100644 --- a/src/modules/08_registryEmployee/views/Other.vue +++ b/src/modules/08_registryEmployee/views/Other.vue @@ -122,7 +122,6 @@ :cancel="clickCancel" :edit="clickEdit" :save="clickSave" - :validate="validateData" :clickNext="clickNext" :clickPrevious="clickPrevious" :clickDelete="clickDelete" @@ -193,7 +192,7 @@ const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; const mixin = useCounterMixin(); -const { date2Thai, success, messageError, showLoader, hideLoader } = mixin; +const { date2Thai, success, messageError, showLoader, hideLoader ,dialogConfirm} = mixin; const route = useRoute(); const id = ref(""); const date = ref(new Date()); @@ -394,7 +393,10 @@ const clickAdd = async () => { /** * กดบันทึกใน dialog */ -const clickSave = async () => { + const clickSave = () => { + dialogConfirm($q,()=>SaveData()) + } +const SaveData = async () => { myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { @@ -597,14 +599,14 @@ const clickHistory = async (row: RequestItemsObject) => { /** * validate input ใน dialog */ -const validateData = async () => { - checkValidate.value = true; - await myForm.value.validate().then((result: boolean) => { - if (result == false) { - checkValidate.value = false; - } - }); -}; +// const validateData = async () => { +// checkValidate.value = true; +// await myForm.value.validate().then((result: boolean) => { +// if (result == false) { +// checkValidate.value = false; +// } +// }); +// }; /** * class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ diff --git a/src/modules/08_registryEmployee/views/SalaryEmployee.vue b/src/modules/08_registryEmployee/views/SalaryEmployee.vue index e7df68c72..1d5834c90 100644 --- a/src/modules/08_registryEmployee/views/SalaryEmployee.vue +++ b/src/modules/08_registryEmployee/views/SalaryEmployee.vue @@ -204,6 +204,7 @@ :borderless="!edit" v-model="posNoEmployee" :label="`${'ตำแหน่งเลขที่'}`" + :rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่งเลขที่'}`]" @update:modelValue="clickEditRow" hide-bottom-space autogrow @@ -242,6 +243,7 @@ lazy-rules :readonly="!edit" :borderless="!edit" + :rules="[(val:string) => !!val || `${'กรุณาเลือกด้านของตำแหน่ง'}`]" v-model="employeePositionSideId" :label="`${'ด้านของตำแหน่ง'}`" @update:modelValue="clickEditRow" @@ -271,6 +273,7 @@ @update:modelValue="clickEditRow" emit-value map-options + :rules="[(val:string) => !!val || `${'กรุณาเลือกระดับ'}`]" option-label="name" :options="employeeLevelOptions" option-value="id" @@ -297,6 +300,7 @@ map-options option-label="name" :options="employeeGroupOptions" + :rules="[(val:string) => !!val || `${'กรุณาเลือกกุ่มงาน'}`]" option-value="id" hide-bottom-space use-input @@ -339,6 +343,7 @@ :readonly="!edit" :borderless="!edit" v-model="amount" + :rules="[(val:string) => !!val || `${'กรุณากรอกค่าจ้าง'}`]" :label="`${'ค่าจ้าง'}`" @update:modelValue="clickEditRow" type="number" @@ -429,6 +434,7 @@ option-label="name" :options="refOptions" option-value="id" + :rules="[(val:string) => !!val || `${'กรุณาเลือกต้นแบบ (template) เอกสารอ้างอิง'}`]" hide-bottom-space use-input input-debounce="0" @@ -447,6 +453,7 @@ :borderless="!edit" v-model="salaryRef" :label="`${'เอกสารอ้างอิง'}`" + :rules="[(val:string) => !!val || `${'กรุณากรอกเอกสารอ้างอิง'}`]" @update:modelValue="clickEditRow" type="textarea" hide-bottom-space @@ -509,7 +516,6 @@ :cancel="clickCancel" :edit="clickEdit" :save="clickSave" - :validate="validateData" :clickNext="clickNext" :clickPrevious="clickPrevious" :clickDelete="clickDelete" @@ -602,6 +608,7 @@ const { dialogMessage, showLoader, hideLoader, + dialogConfirm } = mixin; const route = useRoute(); const id = ref(""); @@ -1686,8 +1693,11 @@ const templateDetail = async () => { /** * กดบันทึกใน dialog */ -const clickSave = async () => { - myForm.value.validate().then(async (result: boolean) => { +const clickSave = () =>{ + dialogConfirm($q,() => SaveData()) +} +const SaveData = async () => { + await myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { await editData(); @@ -1988,14 +1998,14 @@ const clickHistory = async (row: RequestItemsEmployee) => { /** * validate input ใน dialog */ -const validateData = async () => { - checkValidate.value = true; - await myForm.value.validate().then((result: boolean) => { - if (result == false) { - checkValidate.value = false; - } - }); -}; +// const validateData = async () => { +// checkValidate.value = true; +// await myForm.value.validate().then((result: boolean) => { +// if (result == false) { +// checkValidate.value = false; +// } +// }); +// }; /** * class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ diff --git a/src/modules/08_registryEmployee/views/Talent.vue b/src/modules/08_registryEmployee/views/Talent.vue index 868a2305e..a3d4d6b4a 100644 --- a/src/modules/08_registryEmployee/views/Talent.vue +++ b/src/modules/08_registryEmployee/views/Talent.vue @@ -123,7 +123,6 @@ :cancel="clickCancel" :edit="clickEdit" :save="clickSave" - :validate="validateData" :clickNext="clickNext" :clickPrevious="clickPrevious" :clickDelete="clickDelete" @@ -191,7 +190,7 @@ const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader,dialogConfirm } = mixin; const route = useRoute(); const id = ref(""); @@ -449,8 +448,11 @@ const clickAdd = async () => { /** * กดบันทึกใน dialog */ -const clickSave = async () => { - myForm.value.validate().then(async (result: boolean) => { + const clickSave = () => { + dialogConfirm($q,()=>SaveData()) + } +const SaveData = async () => { + await myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { await editData(); @@ -662,14 +664,14 @@ const clickHistory = async (row: RequestItemsObject) => { /** * validate input ใน dialog */ -const validateData = async () => { - checkValidate.value = true; - await myForm.value.validate().then((result: boolean) => { - if (result == false) { - checkValidate.value = false; - } - }); -}; +// const validateData = async () => { +// checkValidate.value = true; +// await myForm.value.validate().then((result: boolean) => { +// if (result == false) { +// checkValidate.value = false; +// } +// }); +// }; /** * class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ diff --git a/src/modules/08_registryEmployee/views/Train.vue b/src/modules/08_registryEmployee/views/Train.vue index 8928f623c..d06149fde 100644 --- a/src/modules/08_registryEmployee/views/Train.vue +++ b/src/modules/08_registryEmployee/views/Train.vue @@ -351,7 +351,6 @@ :cancel="clickCancel" :edit="clickEdit" :save="clickSave" - :validate="validateData" :clickNext="clickNext" :clickPrevious="clickPrevious" :clickDelete="clickDelete" @@ -430,7 +429,7 @@ const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader,dialogConfirm } = mixin; const route = useRoute(); const id = ref(""); @@ -860,8 +859,8 @@ const clickAdd = async () => { /** * กดบันทึกใน dialog */ -const clickSave = async () => { - myForm.value.validate().then(async (result: boolean) => { +const SaveData = async () => { + await myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { await editData(); @@ -875,6 +874,9 @@ const clickSave = async () => { /** * บันทึกเพิ่มข้อมูล */ +const clickSave = () => { + dialogConfirm($q,() => SaveData()) +} const saveData = async () => { if (profileId.value) { showLoader(); @@ -1103,14 +1105,14 @@ const clickHistory = async (row: RequestItemsObject) => { /** * validate input ใน dialog */ -const validateData = async () => { - checkValidate.value = true; - await myForm.value.validate().then((result: boolean) => { - if (result == false) { - checkValidate.value = false; - } - }); -}; +// const validateData = async () => { +// checkValidate.value = true; +// await myForm.value.validate().then((result: boolean) => { +// if (result == false) { +// checkValidate.value = false; +// } +// }); +// }; /** * class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ diff --git a/src/modules/08_registryEmployee/views/Work.vue b/src/modules/08_registryEmployee/views/Work.vue index 1754fcaa6..91e579e91 100644 --- a/src/modules/08_registryEmployee/views/Work.vue +++ b/src/modules/08_registryEmployee/views/Work.vue @@ -255,7 +255,6 @@ :cancel="clickCancel" :edit="clickEdit" :save="clickSave" - :validate="validateData" :clickNext="clickNext" :clickPrevious="clickPrevious" :clickDelete="clickDelete" @@ -331,7 +330,7 @@ const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; const mixin = useCounterMixin(); -const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = +const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader,dialogConfirm } = mixin; const route = useRoute(); const id = ref(""); @@ -654,8 +653,11 @@ const clickAdd = async () => { /** * กดบันทึกใน dialog */ -const clickSave = async () => { - myForm.value.validate().then(async (result: boolean) => { + const clickSave = () => { + dialogConfirm($q,() => SaveData()) + } +const SaveData = async () => { + await myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { await editData(); @@ -880,14 +882,14 @@ const clickHistory = async (row: RequestItemsObject) => { /** * validate input ใน dialog */ -const validateData = async () => { - checkValidate.value = true; - await myForm.value.validate().then((result: boolean) => { - if (result == false) { - checkValidate.value = false; - } - }); -}; +// const validateData = async () => { +// checkValidate.value = true; +// await myForm.value.validate().then((result: boolean) => { +// if (result == false) { +// checkValidate.value = false; +// } +// }); +// }; /** * class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ diff --git a/src/modules/08_registryEmployee/views/information.vue b/src/modules/08_registryEmployee/views/information.vue index 9a6d6644d..0f83e7fbe 100644 --- a/src/modules/08_registryEmployee/views/information.vue +++ b/src/modules/08_registryEmployee/views/information.vue @@ -439,6 +439,7 @@ const { dialogMessage, showLoader, hideLoader, + dialogConfirm } = mixin; const profileStore = useProfileDataStore(); @@ -1090,6 +1091,7 @@ const addData = async () => { emit("update:statusEdit", false); await fetchData(); await changeBirth(informaData.value.birthDate ?? new Date()); + await clickBack() hideLoader(); }); console.log(body); @@ -1101,8 +1103,10 @@ const saveData = async () => { if (myform.value != null) { await myform.value.validate().then(async (saveDataTest: Boolean) => { if (saveDataTest) { - await addData(); - await clickBack(); + dialogConfirm( + $q, + () => addData() + ) } }); } diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 73622e73e..d0b672c84 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -79,34 +79,34 @@ const options = ref([ }, ]); -const getDataNotification = async () => { - showLoader(); - await http - .get(config.API.msgNotificate) - .then((res: any) => { - const response = res.data.result; - // console.log("response", response); - let list: notiType[] = []; - response.map((e: any) => { - list.push({ - id: e.id, - sender: - e.createdFullName == "" || e.createdFullName == null - ? "เจ้าหน้าที่"[0] - : e.createdFullName[0], - body: e.body ?? "", - timereceive: new Date(e.createdAt), - }); - }); - notiList.value = list; - }) - .catch((e) => { - // messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -}; +// const getDataNotification = async () => { +// showLoader(); +// await http +// .get(config.API.msgNotificate) +// .then((res: any) => { +// const response = res.data.result; +// // console.log("response", response); +// let list: notiType[] = []; +// response.map((e: any) => { +// list.push({ +// id: e.id, +// sender: +// e.createdFullName == "" || e.createdFullName == null +// ? "เจ้าหน้าที่"[0] +// : e.createdFullName[0], +// body: e.body ?? "", +// timereceive: new Date(e.createdAt), +// }); +// }); +// notiList.value = list; +// }) +// .catch((e) => { +// // messageError($q, e); +// }) +// .finally(() => { +// hideLoader(); +// }); +// }; /** * ให้แสดง แทปด้านขวา เมื่อเข้าหน้า รายละเอียดทะเบียนประวัติ