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