Compare commits

...

2 Commits

3 changed files with 108 additions and 33 deletions

View File

@ -48,13 +48,18 @@
<el-button type="primary" size="mini" @click="getClockInList()"></el-button>
</div>
<div class="forestlistbox">
<div class="forestUl" v-for="(item,index) in clockInList" :key="index">
<div class="forestUl cursor" v-for="(item,index) in clockInList" :key="index" @click="gofly(item)">
<div class="flex max-h jc-sb ai-c">
<div class="flex-1 fc-w fz-16">
<div>{{ item.pointname }}</div>
<div class="fz-14 mt-1">责任人{{ item.usernames }}</div>
</div>
<el-button type="primary" size="mini" @click="gofly(item)"></el-button>
<div class="flex column jc-c ai-c" style="height:70px">
<span>
<el-button type="danger" size="mini" @click.stop="delItem(item)">删除</el-button>
</span>
<el-button type="success" class="mt-1" size="mini" @click.stop="editClock(item)">编辑</el-button>
</div>
</div>
</div>
</div>
@ -78,7 +83,7 @@
<el-dialog width="40%" height="60%" top=" calc(50vh - 340px)" class="dialog-mini"
v-el-drag-dialog title="打卡" :close-on-click-modal="false" :close-on-press-escape="false"
:visible.sync="clockInVisible ">
<clockInDia :lnglat="clocklnglat" @clockInSuccess="clockInSuccess" @close="clockInVisible = false"></clockInDia>
<clockInDia :lnglat="clocklnglat" :clockdata="clockDetail" @clockInSuccess="clockInSuccess" @close="clockInVisible = false" v-if="clockInVisible"></clockInDia>
</el-dialog>
</div>
@ -140,7 +145,8 @@
clockInName: '',
clockInVisible: false,
rowdataKey: 1,
flyCenter:[]
flyCenter:[],
clockDetail:{}
}
},
@ -162,11 +168,45 @@
console.log('getLocation',e)
this.clockInVisible = true
this.clocklnglat = e
this.clockDetail = null
},
editClock(e){
console.log('223311',e)
this.clockDetail = e
this.clockInVisible = true
},
gofly(item){
console.log('iii',item)
this.flyCenter = [item.lng,item.lat]
},
delItem(item){
console.log('123',item)
let param = {
id: item.id
}
this.$confirm('确定删除本条数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
postMethodCommon("/FireGrid/DeleteCheckPoint?id="+param.id).then(res => {
if (res.code == 200) {
this.$message({
type: "success",
message: "删除成功",
})
}
this.rowdataKey++
this.getClockInList()
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
clockInSuccess(){
console.log('231321')
this.rowdataKey++

View File

@ -16,13 +16,12 @@
</div>
</template>
<script>
import { listToTreeSelect } from '@/utils'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { postMethodCommon, getMethodCommon } from '../../../../api/common';
export default {
name: "AddForm",
props: ['lnglat'],
props: ['lnglat','clockdata'],
components: {
Treeselect
},
@ -44,10 +43,15 @@ export default {
watch:{
lnglat:function(e){
this.gethlyList();
},
clockdata:function(e){
}
},
created() {
console.log('clockdata',this.clockdata)
this.treelist = []
this.gethlyList()
},
mounted() {
@ -68,29 +72,54 @@ export default {
gethlyList(){
getMethodCommon("/FireGrid/LoadUsers").then(res =>{
this.hlyList = res.data
if(this.clockdata){
this.paramForm.address = this.clockdata.pointname
this.paramForm.user = this.clockdata.userid.split(',')
}
console.log('this.paramForm',this.paramForm)
})
},
submitForm(){
this.$refs['form'].validate((valid) => {
if (valid) {
let param = {
id: 0,
lng: this.lnglat.lngLat.lng,
lat: this.lnglat.lngLat.lat,
pointname: this.paramForm.address,
userid: this.paramForm.user
}
postMethodCommon("/FireGrid/AddCheckPoint", param).then(response => {
if (response.code == 200) {
// shp
this.$emit("clockInSuccess");
this.$emit("close");
this.$message({
type: "success",
message: response.message
})
if(this.clockdata){
let param = {
id: this.clockdata.id,
lng: this.clockdata.lng,
lat: this.clockdata.lat,
pointname: this.paramForm.address,
userid: this.paramForm.user
}
})
postMethodCommon("/FireGrid/EditCheckPoint", param).then(response => {
if (response.code == 200) {
this.$emit("clockInSuccess");
this.$emit("close");
this.$message({
type: "success",
message: response.message
})
}
})
}else{
let param = {
id: 0,
lng: this.lnglat.lngLat.lng,
lat: this.lnglat.lngLat.lat,
pointname: this.paramForm.address,
userid: this.paramForm.user
}
postMethodCommon("/FireGrid/AddCheckPoint", param).then(response => {
if (response.code == 200) {
this.$emit("clockInSuccess");
this.$emit("close");
this.$message({
type: "success",
message: response.message
})
}
})
}
} else {
console.log('error submit!!');
return false;

View File

@ -14,18 +14,13 @@ export default {
return {
map: null,
clockInList: [],
markerArr:[]
};
},
watch: {
rowkey: function (e) {
const el = document.createElement("img"); //
el.className = "marker";
el.src = "/img/dakadian.png"; //
el.style.width = "40px";
//
new mapboxgl.Marker(el)
.setLngLat([this.lnglat.lngLat.lng, this.lnglat.lngLat.lat])
.addTo(this.map);
console.log('123',e)
this.getClockInList()
},
lnglat: function (e) {},
flyCenter: function (e) {
@ -49,19 +44,30 @@ export default {
getClockInList() {
getMethodCommon("/FireGrid/GetTotalCheckPoint").then((res) => {
this.clockInList = res.result;
console.log("this.clockInList", this.clockInList);
for (var i = this.markerArr.length - 1; i >= 0; i--) {
this.markerArr[i].remove();
}
this.addPointLayer();
});
},
addPointLayer() {
let _this = this
this.clockInList.forEach((item) => {
console.log("iii", item);
let el = document.createElement("img"); //
el.className = "marker";
el.src = "/img/dakadian.png"; //
el.style.width = "40px";
// el.onclick = function(){
// console.log('123item',item)
// _this.$emit("editClock",item)
// }
//
new mapboxgl.Marker(el).setLngLat([item.lng, item.lat]).addTo(this.map);
let marker = new mapboxgl.Marker(el).setLngLat([item.lng, item.lat]).addTo(this.map);
this.markerArr.push(marker)
});
},
initMap(url, jwd) {