add mock location
This commit is contained in:
parent
386ab6480f
commit
9c68349983
4 changed files with 325 additions and 95 deletions
|
|
@ -32,6 +32,8 @@ const endTimeAfternoon = ref<string>('12:00:00') //เวลาเช็คเ
|
|||
|
||||
const isLoadingCheckTime = ref<boolean>(false) // ตัวแปรสำหรับการโหลด
|
||||
const disabledBtn = ref<boolean>(false)
|
||||
const locationGranted = ref<boolean>(false)
|
||||
const isMockLocationDetected = ref<boolean>(false)
|
||||
|
||||
/**
|
||||
* fetch เช็คเวลาต้องลงเวลาเข้าหรือออกงาน
|
||||
|
|
@ -113,6 +115,21 @@ async function updateLocation(
|
|||
formLocation.POI = namePOI
|
||||
}
|
||||
|
||||
/**
|
||||
* รับค่าสถานะ location จาก AscGISMap
|
||||
*/
|
||||
function onLocationStatus(status: boolean) {
|
||||
locationGranted.value = status
|
||||
}
|
||||
|
||||
/**
|
||||
* รับค่า mock location detection จาก AscGISMap
|
||||
*/
|
||||
function onMockDetected(result: any) {
|
||||
isMockLocationDetected.value = true
|
||||
disabledBtn.value = true
|
||||
}
|
||||
|
||||
const location = ref<string>('') // พื้นที่ใกล้เคียง
|
||||
const model = ref<string>('') // สถานที่ทำงาน
|
||||
// ตัวเลือกสถานที่ทำงาน
|
||||
|
|
@ -595,6 +612,16 @@ watch(
|
|||
}
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => locationGranted.value,
|
||||
(newVal) => {
|
||||
// Removed auto-reset of isMockLocationDetected to prevent
|
||||
// clearing mock detection state when permission is granted.
|
||||
// Mock detection state should only be reset after explicit user action
|
||||
// or after a successful validation without mock indicators.
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -667,6 +694,8 @@ watch(
|
|||
v-if="$q.screen.gt.xs"
|
||||
ref="mapRef"
|
||||
@update:location="updateLocation"
|
||||
@location-status="onLocationStatus"
|
||||
@mock-detected="onMockDetected"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -833,7 +862,12 @@ watch(
|
|||
</div>
|
||||
|
||||
<div class="col-12" v-if="$q.screen.xs">
|
||||
<MapCheck ref="mapRef" @update:location="updateLocation" />
|
||||
<MapCheck
|
||||
ref="mapRef"
|
||||
@update:location="updateLocation"
|
||||
@location-status="onLocationStatus"
|
||||
@mock-detected="onMockDetected"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- กรอกข้อมูล หน้ามือถือ -->
|
||||
|
|
@ -982,7 +1016,7 @@ watch(
|
|||
push
|
||||
size="18px"
|
||||
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
|
||||
:disable="disabledBtn ? true : camera && img ? false : true"
|
||||
:disable="disabledBtn || !locationGranted || isMockLocationDetected ? true : camera && img ? false : true"
|
||||
@click="validateForm"
|
||||
:loading="inQueue"
|
||||
/>
|
||||
|
|
@ -1097,7 +1131,7 @@ watch(
|
|||
push
|
||||
size="18px"
|
||||
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
|
||||
:disable="disabledBtn ? true : camera && img ? false : true"
|
||||
:disable="disabledBtn || !locationGranted || isMockLocationDetected ? true : camera && img ? false : true"
|
||||
@click="validateForm"
|
||||
:loading="inQueue"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue