diff --git a/src/api/api.message.ts b/src/api/api.message.ts index be5d2c6..d7622a5 100644 --- a/src/api/api.message.ts +++ b/src/api/api.message.ts @@ -4,7 +4,8 @@ const message = `${env.API_URI}/message`; const reply = `${env.API_URI}/placement/noti`; export default { - msgNotificate: `${message}/my-notifications`, - msgInbox: `${message}/my-inboxes`, - replyMessage: (id: string) => `${reply}/${id}`, + msgNotificate: `${message}/my-notifications`, + msgInbox: `${message}/my-inboxes`, + msgId: (id: string) => `${message}/my-notifications/${id}`, + replyMessage: (id: string) => `${reply}/${id}`, }; diff --git a/src/modules/01_dashboard/views/Dashboard.vue b/src/modules/01_dashboard/views/Dashboard.vue index 13d67b7..35ce7da 100644 --- a/src/modules/01_dashboard/views/Dashboard.vue +++ b/src/modules/01_dashboard/views/Dashboard.vue @@ -214,9 +214,9 @@ async function onLoad(index: number, done: any) { flat bordered :style="$q.screen.gt.xs ? 'max-height: 74vh' : 'height: 100px;'" - class="q-pb-md col-12" + class="q-pb-sm col-12" > -
+
กล่องข้อความ
@@ -232,13 +232,12 @@ async function onLoad(index: number, done: any) {
(route.params.id as string); const leaveId = ref(""); const dataStore = useLeaveStore(); @@ -201,12 +205,12 @@ async function fetchDataDetail(id: string) { }); } +/**modal */ const model = computed(() => { return ( dataStore.options.find((x) => x.id == formData.leaveTypeId)?.code ?? "" ); }); - const modelSpecific = computed(() => { const code = dataStore.options.find( (x) => x.id == formData.leaveTypeId @@ -225,6 +229,11 @@ const modelSpecific = computed(() => { } }); +/** + * function บันทึกข้อมูล + * @param formData ข้อมูลใน formdata + * @param isLeave ตัวแปรเช็คว่าใช้หน้า edit หรือไม่ + */ function onSubmit(formData: FormData, isLeave: boolean = true) { if (isLeave) { dialogConfirm($q, async () => { @@ -232,6 +241,7 @@ function onSubmit(formData: FormData, isLeave: boolean = true) { await http .put(config.API.leaveUserId(personalId.value), formData) .then(() => { + fetchDataDetail(personalId.value); success($q, "บันทึกสำเร็จ"); }) .catch((e: any) => { @@ -239,7 +249,6 @@ function onSubmit(formData: FormData, isLeave: boolean = true) { }) .finally(() => { hideLoader(); - fetchDataDetail(personalId.value); }); }); } else { @@ -247,6 +256,10 @@ function onSubmit(formData: FormData, isLeave: boolean = true) { } } +/** + * funciotn ยื่นใบลา + * @param id id ของใบลา + */ function onConfirm(id: string) { dialogConfirm( $q, @@ -256,15 +269,14 @@ function onConfirm(id: string) { .put(config.API.leaveUserSendId(personalId.value), { reason: "" }) .then(() => { success($q, "ยื่นใบลาสำเร็จ"); - // router.push("/leave"); }) .catch((e: any) => { messageError($q, e); }) .finally(() => { - router.push("/leave"); - fetchDataDetail(personalId.value); hideLoader(); + router.push("/leave"); + // fetchDataDetail(personalId.value); }); }, "ยืนยันการยื่นใบลา", diff --git a/src/modules/06_evaluate/components/EvaluateStepMain.vue b/src/modules/06_evaluate/components/EvaluateStepMain.vue index d61fb09..4c9bd55 100644 --- a/src/modules/06_evaluate/components/EvaluateStepMain.vue +++ b/src/modules/06_evaluate/components/EvaluateStepMain.vue @@ -607,7 +607,7 @@ onMounted(async () => { }}
-
+
{
{{ store.step }}.{{ store.title[store.step - 1] }}
- -
+ +
{
-
+
- + { v-if="store.step === 2" @update:form="updateformCommand" /> - + - +
{
-
-
- +
+
+ - + - - -
+ + +
diff --git a/src/modules/07_appealComplain/views/Form.vue b/src/modules/07_appealComplain/views/Form.vue index fbd2c04..22ea4bd 100644 --- a/src/modules/07_appealComplain/views/Form.vue +++ b/src/modules/07_appealComplain/views/Form.vue @@ -228,12 +228,12 @@ function onSubmit(data: any) { :readonly="isReadOnly" ref="titleRef" :rules="[ - (val) => !!val || 'กรุณากรอกอุทธรณ์/ร้องทุกข์', + (val) => !!val || 'กรุณากรอกเรื่องอุทธรณ์/ร้องทุกข์', ]" v-model="formData.title" dense outlined - label="อุทธรณ์/ร้องทุกข์" + label="เรื่องอุทธรณ์/ร้องทุกข์" hide-bottom-space />
diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 8cab35c..46cab97 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -13,7 +13,14 @@ const router = useRouter(); const $q = useQuasar(); const mixin = useCounterMixin(); -const { date2Thai } = mixin; +const { + date2Thai, + dialogRemove, + showLoader, + hideLoader, + messageError, + success, +} = mixin; const fullname = ref(""); const notiList = ref([]); @@ -26,31 +33,53 @@ const link = ref(""); * เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้ */ onMounted(async () => { - await fetchlistNotification(1); + await fetchlistNotification(1, "NOMAL"); if (keycloak.tokenParsed != null) { fullname.value = keycloak.tokenParsed.name; } }); -const fetchlistNotification = async (index: number) => { +const fetchlistNotification = async (index: number, type: string) => { await http .get(config.API.msgNotificate + `?page=${index}&pageSize=${20}`) .then((res: any) => { const data = res.data.result.data; - totalInbox.value = res.data.result.total; + let list: any[] = []; - data.map((e: any) => { - list.push({ - id: e.id, - sender: - e.createdFullName == "" || e.createdFullName == null - ? "เจ้าหน้าที่"[0] - : e.createdFullName[0], - body: e.body ?? "", - timereceive: date2Thai(e.createdAt), + if (type === "DEL") { + totalInbox.value = res.data.result.total; + console.log(notiList.value.length); + + if (notiList.value.length === 14) { + notiList.value = []; + data.map((e: any) => { + list.push({ + id: e.id, + sender: + e.createdFullName == "" || e.createdFullName == null + ? "เจ้าหน้าที่"[0] + : e.createdFullName[0], + body: e.body ?? "", + timereceive: date2Thai(e.createdAt), + }); + }); + notiList.value.push(...list); + } + } else { + data.map((e: any) => { + list.push({ + id: e.id, + sender: + e.createdFullName == "" || e.createdFullName == null + ? "เจ้าหน้าที่"[0] + : e.createdFullName[0], + body: e.body ?? "", + timereceive: date2Thai(e.createdAt), + }); }); - }); - notiList.value.push(...list); + notiList.value.push(...list); + totalInbox.value = res.data.result.total; + } }) .catch((err) => { console.log(err); @@ -73,11 +102,32 @@ const doLogout = () => { }); }; +const clickDelete = async (id: string, index: number) => { + dialogRemove($q, async () => { + showLoader(); + await http + .delete(config.API.msgId(id)) + .then(() => { + notiList.value.splice(index, 1); + success($q, "ลบข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + fetchlistNotification(1, "DEL"); + hideLoader(); + }); + }); +}; + const totalInbox = ref(0); +const page = ref(1); function onLoad(index: any, done: any) { + page.value = index + 1; if (notiList.value.length < totalInbox.value) { setTimeout(() => { - fetchlistNotification(index + 1); + fetchlistNotification(page.value, "NOMAL"); done(); }, 2000); } @@ -159,24 +209,24 @@ function onLoad(index: any, done: any) { floating >{{ totalInbox }} - +
การแจ้งเตือน
- + /> -->
- +
-