add mock location
This commit is contained in:
parent
386ab6480f
commit
9c68349983
4 changed files with 325 additions and 95 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
|
|
@ -11,8 +11,8 @@ import { useCounterMixin } from '@/stores/mixin'
|
|||
import { usePrivacyStore } from '@/stores/privacy'
|
||||
import { usePositionKeycloakStore } from '@/stores/positionKeycloak'
|
||||
|
||||
import type { notiType } from '@/interface/index/Main'
|
||||
import type { Noti } from '@/interface/response/Main'
|
||||
// import type { notiType } from '@/interface/index/Main'
|
||||
// import type { Noti } from '@/interface/response/Main'
|
||||
|
||||
import DialogHeader from '@/components/DialogHeader.vue'
|
||||
import PopupPrivacy from '@/components/PopupPrivacy.vue'
|
||||
|
|
@ -22,10 +22,10 @@ const mixin = useCounterMixin()
|
|||
const privacyStore = usePrivacyStore()
|
||||
const positionKeycloakStore = usePositionKeycloakStore()
|
||||
const {
|
||||
date2Thai,
|
||||
// date2Thai,
|
||||
hideLoader,
|
||||
messageError,
|
||||
dialogRemove,
|
||||
// dialogRemove,
|
||||
success,
|
||||
showLoader,
|
||||
} = mixin
|
||||
|
|
@ -40,17 +40,17 @@ const configParam = {
|
|||
|
||||
const modalReset = ref<boolean>(false) //ตัวแปร popup reset password
|
||||
const fullName = ref<string>('') //ชื่อผู้ใช้งาน
|
||||
const notiTrigger = ref<boolean>(false) // เปิด,ปิดรายการ
|
||||
const notiList = ref<notiType[]>([]) // รายการแจ้งเตือน
|
||||
// const notiTrigger = ref<boolean>(false) // เปิด,ปิดรายการ
|
||||
// const notiList = ref<notiType[]>([]) // รายการแจ้งเตือน
|
||||
// const totalNotiList = ref<number>(0) //จำนวนการรายการแจ้งเตือน
|
||||
// const totalNoti = ref<number>(0) //จำนวนการแจ้งเตือน
|
||||
const statusLoad = ref<boolean>(false) // สถานะการโหลด
|
||||
// const statusLoad = ref<boolean>(false) // สถานะการโหลด
|
||||
const modalDebug = ref<boolean>(false) // ตัวแปร popup debug
|
||||
//รูปแบบการแสดงผลของวันที่และเวลา
|
||||
const thaiOptions: Intl.DateTimeFormatOptions = {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
}
|
||||
// const thaiOptions: Intl.DateTimeFormatOptions = {
|
||||
// hour: '2-digit',
|
||||
// minute: '2-digit',
|
||||
// }
|
||||
|
||||
const oldPassWord = ref<string>('')
|
||||
|
||||
|
|
@ -76,63 +76,63 @@ const isPwdReNewOld = ref<boolean>(true)
|
|||
// })
|
||||
// }
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่นดึงข้อมูลรายการแจ้งเตือน
|
||||
* @param index page ที่ต้องการโหลดข้อมูล
|
||||
* @param type DEL คือโหลดหลังลบข้อความ, NOMAL คือกรณีโหลดข้อมูลปกติ
|
||||
*/
|
||||
async function fetchNotifications(index: number, type: string) {
|
||||
await http
|
||||
.get(config.API.msgNotificate + `?page=${index}&pageSize=${20}`)
|
||||
.then((res) => {
|
||||
const response = res.data.result.data
|
||||
totalNotiList.value = res.data.result.total
|
||||
const list: notiType[] = []
|
||||
if (type === 'DEL') {
|
||||
notiList.value = []
|
||||
}
|
||||
response.map((e: Noti) => {
|
||||
list.push({
|
||||
id: e.id,
|
||||
sender:
|
||||
e.createdFullName == '' || e.createdFullName == null
|
||||
? 'เจ้าหน้าที่'[0]
|
||||
: e.createdFullName[0],
|
||||
body: e.body ?? '',
|
||||
timereceive: e.receiveDate,
|
||||
isOpen: e.isOpen,
|
||||
})
|
||||
})
|
||||
notiList.value.push(...list)
|
||||
statusLoad.value = totalNotiList.value === 0 ? true : false
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err)
|
||||
})
|
||||
}
|
||||
// /**
|
||||
// * ฟังก์ชั่นดึงข้อมูลรายการแจ้งเตือน
|
||||
// * @param index page ที่ต้องการโหลดข้อมูล
|
||||
// * @param type DEL คือโหลดหลังลบข้อความ, NOMAL คือกรณีโหลดข้อมูลปกติ
|
||||
// */
|
||||
// async function fetchNotifications(index: number, type: string) {
|
||||
// await http
|
||||
// .get(config.API.msgNotificate + `?page=${index}&pageSize=${20}`)
|
||||
// .then((res) => {
|
||||
// const response = res.data.result.data
|
||||
// totalNotiList.value = res.data.result.total
|
||||
// const list: notiType[] = []
|
||||
// if (type === 'DEL') {
|
||||
// notiList.value = []
|
||||
// }
|
||||
// response.map((e: Noti) => {
|
||||
// list.push({
|
||||
// id: e.id,
|
||||
// sender:
|
||||
// e.createdFullName == '' || e.createdFullName == null
|
||||
// ? 'เจ้าหน้าที่'[0]
|
||||
// : e.createdFullName[0],
|
||||
// body: e.body ?? '',
|
||||
// timereceive: e.receiveDate,
|
||||
// isOpen: e.isOpen,
|
||||
// })
|
||||
// })
|
||||
// notiList.value.push(...list)
|
||||
// statusLoad.value = totalNotiList.value === 0 ? true : false
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err)
|
||||
// })
|
||||
// }
|
||||
|
||||
/**
|
||||
* function ลบรายการแจ้งเตือน
|
||||
* @param id noti
|
||||
*/
|
||||
async function onClickDelete(id: string, index: number) {
|
||||
dialogRemove($q, async () => {
|
||||
await http
|
||||
.delete(config.API.msgId(id))
|
||||
.then(async () => {
|
||||
notiList.value.splice(index, 1)
|
||||
totalNotiList.value--
|
||||
notiList.value.length === 14 && (await fetchNotifications(1, 'DEL'))
|
||||
success($q, 'ลบข้อมูลสำเร็จ')
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e)
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader()
|
||||
})
|
||||
})
|
||||
}
|
||||
// /**
|
||||
// * function ลบรายการแจ้งเตือน
|
||||
// * @param id noti
|
||||
// */
|
||||
// async function onClickDelete(id: string, index: number) {
|
||||
// dialogRemove($q, async () => {
|
||||
// await http
|
||||
// .delete(config.API.msgId(id))
|
||||
// .then(async () => {
|
||||
// notiList.value.splice(index, 1)
|
||||
// totalNotiList.value--
|
||||
// notiList.value.length === 14 && (await fetchNotifications(1, 'DEL'))
|
||||
// success($q, 'ลบข้อมูลสำเร็จ')
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e)
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// hideLoader()
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
|
||||
/*** function logout */
|
||||
function onClickLogout() {
|
||||
|
|
@ -148,25 +148,25 @@ function onClickLogout() {
|
|||
})
|
||||
}
|
||||
|
||||
const page = ref<number>(0)
|
||||
// const page = ref<number>(0)
|
||||
|
||||
/**
|
||||
* โหลดรายการแจ้งเตือนเพิ่มเมื่อ scroll
|
||||
* @param index
|
||||
* @param done
|
||||
*/
|
||||
function onLoad(index: number, done: Function) {
|
||||
if (
|
||||
notiList.value.length < totalNotiList.value ||
|
||||
(notiList.value.length == 0 && totalNotiList.value === 0)
|
||||
) {
|
||||
page.value++
|
||||
setTimeout(async () => {
|
||||
await fetchNotifications(page.value, 'NOMAL')
|
||||
await done()
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * โหลดรายการแจ้งเตือนเพิ่มเมื่อ scroll
|
||||
// * @param index
|
||||
// * @param done
|
||||
// */
|
||||
// function onLoad(index: number, done: Function) {
|
||||
// if (
|
||||
// notiList.value.length < totalNotiList.value ||
|
||||
// (notiList.value.length == 0 && totalNotiList.value === 0)
|
||||
// ) {
|
||||
// page.value++
|
||||
// setTimeout(async () => {
|
||||
// await fetchNotifications(page.value, 'NOMAL')
|
||||
// await done()
|
||||
// }, 1500)
|
||||
// }
|
||||
// }
|
||||
|
||||
// landing page redirect
|
||||
const landingPageUrl = ref<string>(configParam.landingPageUrl)
|
||||
|
|
@ -247,7 +247,7 @@ async function onSubmit() {
|
|||
})
|
||||
}
|
||||
|
||||
function ruleNewPassWord(val: string) {
|
||||
function ruleNewPassWord(val: string): Promise<string | boolean> {
|
||||
return new Promise((resolve) => {
|
||||
if (!val) {
|
||||
return resolve('กรุณากรอกรหัสผ่านใหม่')
|
||||
|
|
@ -268,7 +268,7 @@ function ruleNewPassWord(val: string) {
|
|||
})
|
||||
}
|
||||
|
||||
function ruleReNewPassWord(val: string) {
|
||||
function ruleReNewPassWord(val: string): Promise<string | boolean> {
|
||||
return new Promise((resolve) => {
|
||||
if (!val) {
|
||||
return resolve('กรุณายืนยันรหัสผ่านใหม่')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue