'socket'
parent
191fc0d9d4
commit
2c5b4ea8a4
|
|
@ -55,11 +55,8 @@ export default {
|
||||||
window.websocket.onerror = this.websocketonerror;
|
window.websocket.onerror = this.websocketonerror;
|
||||||
window.websocket.onmessage = this.setOnmessageMessage;
|
window.websocket.onmessage = this.setOnmessageMessage;
|
||||||
window.websocket.onclose = this.websocketclose;
|
window.websocket.onclose = this.websocketclose;
|
||||||
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
|
|
||||||
// window.onbeforeunload = that.onbeforeunload
|
|
||||||
},
|
},
|
||||||
start() {
|
start() {
|
||||||
// console.log("start");
|
|
||||||
//清除延时器
|
//清除延时器
|
||||||
this.timeoutObj && clearTimeout(this.timeoutObj);
|
this.timeoutObj && clearTimeout(this.timeoutObj);
|
||||||
this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
|
this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
|
||||||
|
|
@ -117,20 +114,18 @@ export default {
|
||||||
},
|
},
|
||||||
websocketonerror(e) {
|
websocketonerror(e) {
|
||||||
console.log("WebSocket连接发生错误" + e + ",重启socket");
|
console.log("WebSocket连接发生错误" + e + ",重启socket");
|
||||||
this.initWebSocket();
|
|
||||||
},
|
},
|
||||||
websocketclose(e) {
|
websocketclose(e) {
|
||||||
window.websocket.close();
|
window.websocket.close();
|
||||||
clearTimeout(this.timeoutObj);
|
clearTimeout(this.timeoutObj);
|
||||||
clearTimeout(this.serverTimeoutObj);
|
clearTimeout(this.serverTimeoutObj);
|
||||||
console.log("WebSocket连接关闭,重启socket");
|
console.log("WebSocket连接关闭,重启socket");
|
||||||
this.initWebSocket();
|
this.reconnect();
|
||||||
},
|
},
|
||||||
websocketsend(messsage) {
|
websocketsend(messsage) {
|
||||||
window.websocket.send(messsage);
|
window.websocket.send(messsage);
|
||||||
},
|
},
|
||||||
closeWebSocket() {
|
closeWebSocket() {
|
||||||
// 关闭websocket
|
|
||||||
window.websocket.close();
|
window.websocket.close();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -20,7 +20,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapState,mapGetters } from "vuex";
|
import { mapState,mapGetters } from "vuex";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { postMethodCommon,getMethodCommon } from '@/api/common.js';
|
import { getMethodCommon } from '@/api/common.js';
|
||||||
let BASE_URL = process.env.VUE_APP_BASE_API;
|
let BASE_URL = process.env.VUE_APP_BASE_API;
|
||||||
import AppConfig from '../../../../public/config/app.json'
|
import AppConfig from '../../../../public/config/app.json'
|
||||||
import { parse } from '../lib/handleGeojson.js';
|
import { parse } from '../lib/handleGeojson.js';
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let BASE_URL = process.env.VUE_APP_BASE_API
|
let BASE_URL = process.env.VUE_APP_BASE_API
|
||||||
import AppConfigInfo from "../../../../public/config/app.json"
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { parse } from '../lib/handleGeojson';
|
|
||||||
export default {
|
export default {
|
||||||
name: 'taskDelivery',
|
name: 'taskDelivery',
|
||||||
props: ['globalmap','lng','lat'],
|
props: ['globalmap','lng','lat'],
|
||||||
|
|
@ -197,56 +195,36 @@
|
||||||
},
|
},
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
|
||||||
|
var querys = {
|
||||||
|
content: this.content,
|
||||||
let url = "https://restapi.amap.com/v3/geocode/regeo?key=4f992c089f9496201f6e4ea39ff3ab60&location=" + this.lng + "," + this.lat + "&extensions=base"
|
lng: this.lng,
|
||||||
axios({
|
lat: this.lat,
|
||||||
method: 'get',
|
}
|
||||||
url: url,
|
if (this.lng == '') {
|
||||||
}).then(res => {
|
this.$message.warning("请选择位置");
|
||||||
let address = res.data.regeocode.formatted_address
|
return;
|
||||||
this.submitForm(address);
|
}
|
||||||
}).catch(err =>{
|
var url = process.env.VUE_APP_BASE_API + '/FireManagement/FireClueTask'
|
||||||
console.log('ee',err)
|
var _this = this
|
||||||
})
|
axios({
|
||||||
|
method: "post",
|
||||||
|
url: url,
|
||||||
|
data: querys,
|
||||||
|
headers: {
|
||||||
|
'X-Token': localStorage.getItem("X-Token")
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
this.$message.success(res.data.msg);
|
||||||
|
_this.close()
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.data.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
submitForm(address){
|
|
||||||
let recipientUsers = [];
|
|
||||||
this.multipleSelection.forEach((item,index)=>{
|
|
||||||
recipientUsers.push(item.id)
|
|
||||||
})
|
|
||||||
|
|
||||||
var querys = {
|
|
||||||
content: this.content,
|
|
||||||
address:address,
|
|
||||||
lng: this.lng,
|
|
||||||
lat: this.lat,
|
|
||||||
recipientUsers:recipientUsers,
|
|
||||||
}
|
|
||||||
if(this.lng == ''){
|
|
||||||
this.$message.warning("请选择位置");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var url = process.env.VUE_APP_BASE_API + '/FireManagement/FireClueTask'
|
|
||||||
var _this = this
|
|
||||||
axios({
|
|
||||||
method: "post",
|
|
||||||
url: url,
|
|
||||||
data: querys,
|
|
||||||
headers: {
|
|
||||||
'X-Token': localStorage.getItem("X-Token")
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.code == 200) {
|
|
||||||
this.$message.success(res.data.msg);
|
|
||||||
_this.close()
|
|
||||||
}else{
|
|
||||||
this.$message.success(res.data.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue