提交 34fc25d1 编写于 作者: 钟一霄's avatar 钟一霄

设置打卡位置

上级 e23b2be2
此差异已折叠。
......@@ -466,9 +466,9 @@ export function AttendanceSave(data) {
});
}
// 删除考勤
export function AttendanceDel() {
export function AttendanceDel(id) {
return request({
url: `/api/Attendance/AttendanceDel`,
url: `/api/Attendance/AttendanceDel?id=${id}`,
method: 'get',
});
}
......
......@@ -11,11 +11,12 @@
</Table>
<!-- <div id="tmap"></div> -->
<!-- 编辑Modal -->
<!-- 编辑(位置选择)Modal -->
<Modal
v-model="editModalShow"
mask-closable
:title="`${isEdit ? '编辑' : '添加'}考勤地点`">
:title="`${isEdit ? '编辑' : '添加'}考勤地点`"
@on-cancle="address = undefined">
<template>
<iframe
id="mapPage"
......@@ -27,7 +28,41 @@
<!-- <div id="tmap"></div> -->
</template>
<template #footer>
<Button type="primary" @click="nextStep">下一步</Button>
<Button type="primary" :disabled="address == undefined" @click="nextStep">下一步</Button>
</template>
</Modal>
<!-- 地点设置Modal -->
<Modal
v-model="locSetModalShow"
mask-closable
title="地点设置">
<template>
<Form label-colon :label-width="100">
<Row>
<Col span="24">
<FormItem label="标题">
<Input v-model="addrTitle" type="text"/>
</FormItem>
</Col>
<Col span="24">
<FormItem label="地点名称">
<Input v-model="addrName" type="text"/>
</FormItem>
</Col>
<Col span="24">
<FormItem label="打卡范围">
<Select v-model="addrRange">
<Option v-for="item in addrRangeList" :key="item.value" :value="item.value">{{ item.label }}</Option>
</Select>
</FormItem>
</Col>
</Row>
</Form>
</template>
<template #footer>
<Button @click="locSetModalShow = false">上一步</Button>
<Button type="primary" :loading="btSaveLoading" @click="saveAttendance">确定</Button>
</template>
</Modal>
</div>
......@@ -55,8 +90,28 @@ export default {
// true.编辑 false.添加
isEdit: false,
editModalShow: false,
addrTitle: '',
addrName: undefined,
addrRange: 50,
address: undefined,
addrRangeList: [
{ label: '50米', value: 50 },
{ label: '100米', value: 100 },
{ label: '200米', value: 200 },
{ label: '300米', value: 300 },
{ label: '400米', value: 400 },
{ label: '500米', value: 500 },
{ label: '600米', value: 600 },
{ label: '700米', value: 700 },
{ label: '800米', value: 800 },
{ label: '900米', value: 900 },
{ label: '1000米', value: 1000 },
{ label: '2000米', value: 2000 },
{ label: '3000米', value: 3000 },
],
locSetModalShow: false,
// 保存按钮loading
btSaveLoading: false,
}
},
computed: {},
......@@ -69,14 +124,49 @@ export default {
// 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息
var loc = event.data;
if (loc && loc.module == 'locationPicker') {//防止其他应用也会向该页面post信息,需判断module是否为'locationPicker'
console.log('location', loc);
// console.log('location', loc);
that.address = loc
}
}, false);
},
methods: {
// 添加考勤下一步
nextStep() {
// console.log('输出地址测试', this.address)
this.addrName = this.address.poiname
this.addrTitle = this.address.poiname
this.locSetModalShow = true
},
// 保存考勤
saveAttendance() {
let data = {
// attendanceid: "string",
title: this.addrTitle,
address: this.addrName,
latitude: this.address.latlng.lat,
longitude: this.address.latlng.lng,
offset: this.addrRange,
// accuracy: 0,
// createtime: "2023-11-18T08:35:09.494Z"
}
this.btSaveLoading = true
api.AttendanceSave(data).then(res => {
// console.log('保存考勤', res)
if (res.code == 1) {
this.globalMessage('success', res.response)
this.getAttendanceList()
this.editModalShow = false
this.locSetModalShow = false
this.address = undefined
this.addrName = undefined
} else {
this.globalMessage('error', res.msg_detail)
}
}).catch(e => {
this.globalMessage('error', e)
}).finally(() => {
this.btSaveLoading = false
})
},
// rowEdit(row) {
......@@ -118,7 +208,26 @@ export default {
// })
// },
rowDelete(row) {
console.log('删除',row)
// console.log('删除',row)
this.$Modal.confirm({
title: '提示',
content: `是否确认删除考勤 ${row.title} ?`,
loading: true,
onOk: () => {
api.AttendanceDel(row.attendanceid).then(res => {
// console.log('删除考勤', res)
if (res.code == 1) {
this.globalMessage('success', res.response)
this.$Modal.remove()
this.getAttendanceList()
} else {
this.globalMessage('error', res.msg_detail)
}
}).catch(e => {
this.globalMessage('error', e)
})
}
})
},
// 获取考勤列表
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或