|
|
|
@ -3,9 +3,14 @@
|
|
|
|
<CardContainer>
|
|
|
|
<CardContainer>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<el-button v-if="isShowDuty" type="primary" style="display: block;margin: auto auto 20px;" @click="startDuty">开始值班</el-button>
|
|
|
|
<el-button v-if="isShowDuty" type="primary" style="display: block;margin: auto auto 20px;" @click="startDuty">开始值班</el-button>
|
|
|
|
<button class="sign-btn" @click="clockIn">
|
|
|
|
<div style="display: flex;">
|
|
|
|
<span>{{ isOutSign ? ' 外勤' : '' }}打卡</span>
|
|
|
|
<button class="sign-btn" v-if="signStatus === 1 || signStatus === 2" @click="clockIn(false)">
|
|
|
|
|
|
|
|
<span>打卡</span>
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button class="sign-btn" v-if="signStatus === 2 || signStatus === 0" @click="clockIn(true)">
|
|
|
|
|
|
|
|
<span>外勤打卡</span>
|
|
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="sign-info">
|
|
|
|
<div class="sign-info">
|
|
|
|
<div class="sign-statue">
|
|
|
|
<div class="sign-statue">
|
|
|
|
<div>打卡状态 <el-tag size="small" effect="dark" type="primary">{{ (isGetLocation || isIpSign) ? (isOutSign ? '外勤打卡' : '可打卡') : '不可打卡' }}</el-tag></div>
|
|
|
|
<div>打卡状态 <el-tag size="small" effect="dark" type="primary">{{ (isGetLocation || isIpSign) ? (isOutSign ? '外勤打卡' : '可打卡') : '不可打卡' }}</el-tag></div>
|
|
|
|
@ -86,6 +91,7 @@ export default {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
uploadSize,
|
|
|
|
uploadSize,
|
|
|
|
isInUni: false,
|
|
|
|
isInUni: false,
|
|
|
|
|
|
|
|
signStatus: 0,
|
|
|
|
// start 外勤打卡
|
|
|
|
// start 外勤打卡
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
action: process.env.VUE_APP_UPLOAD_API,
|
|
|
|
action: process.env.VUE_APP_UPLOAD_API,
|
|
|
|
@ -160,7 +166,8 @@ export default {
|
|
|
|
if (this.isIpSign) {
|
|
|
|
if (this.isIpSign) {
|
|
|
|
const res = await signIp({
|
|
|
|
const res = await signIp({
|
|
|
|
image_id: this.imageId,
|
|
|
|
image_id: this.imageId,
|
|
|
|
remark: this.remark
|
|
|
|
remark: this.remark,
|
|
|
|
|
|
|
|
status: 3
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const res = await sign({
|
|
|
|
const res = await sign({
|
|
|
|
@ -180,7 +187,7 @@ export default {
|
|
|
|
this.loading = false
|
|
|
|
this.loading = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 1000, true),
|
|
|
|
}, 1000, true),
|
|
|
|
clockIn: throttle(async function() {
|
|
|
|
clockIn: throttle(async function(isOut=true) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (!this.isInUni && !this.isIpSign) {
|
|
|
|
if (!this.isInUni && !this.isIpSign) {
|
|
|
|
await this.getLocation()
|
|
|
|
await this.getLocation()
|
|
|
|
@ -195,12 +202,14 @@ export default {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!this.isGetLocation && !this.isIpSign) return
|
|
|
|
if(!this.isGetLocation && !this.isIpSign) return
|
|
|
|
if(this.isOutSign) {
|
|
|
|
if(isOut) {
|
|
|
|
this.isShow = true
|
|
|
|
this.isShow = true
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.isIpSign) {
|
|
|
|
if (this.isIpSign) {
|
|
|
|
const res = await signIp()
|
|
|
|
const res = await signIp({
|
|
|
|
|
|
|
|
status: 1
|
|
|
|
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const res = await sign({
|
|
|
|
const res = await sign({
|
|
|
|
location: `${this.pos.lng},${this.pos.lat}`,
|
|
|
|
location: `${this.pos.lng},${this.pos.lat}`,
|
|
|
|
@ -262,10 +271,12 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
async preIp() {
|
|
|
|
async preIp() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const res = await preIp()
|
|
|
|
const { result } = await preIp()
|
|
|
|
this.isOutSign = false
|
|
|
|
this.signStatus = result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.isOutSign = false
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
this.isOutSign = true
|
|
|
|
// this.isOutSign = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async pos2Address(lat, lng) {
|
|
|
|
async pos2Address(lat, lng) {
|
|
|
|
|