Commit a3cf6843 authored by co_dengxiongwen's avatar co_dengxiongwen

tj

parent 4808d319
...@@ -149,7 +149,7 @@ export default { ...@@ -149,7 +149,7 @@ export default {
isRouterAlive: true, isRouterAlive: true,
queryDetailVisible: false, queryDetailVisible: false,
urlPath: window.CONFIG.urlPath, urlPath: window.CONFIG.urlPath,
tipList: [], paramsList: [],
showList: [], showList: [],
takeoverInfo: '' takeoverInfo: ''
} }
...@@ -173,7 +173,7 @@ export default { ...@@ -173,7 +173,7 @@ export default {
mounted() { mounted() {
this.initWebSocket() this.initWebSocket()
this.initWebSocket2() this.initWebSocket2()
// this.getDateList() this.getDateList()
}, },
destroyed: function () { destroyed: function () {
this.websocketclose() this.websocketclose()
...@@ -222,24 +222,10 @@ export default { ...@@ -222,24 +222,10 @@ export default {
}, },
//接收后端返回的数据 //接收后端返回的数据
websocketonmessage(e) { websocketonmessage(e) {
console.log('takeover:', sessionStorage.getItem('takeover'))
if (
sessionStorage.getItem('takeover') != undefined &&
sessionStorage.getItem('takeover') == 'true'
) {
this.ishowAlarm = false
} else {
this.ishowAlarm = true
}
// 在这里使用后端返回的数据,对数据进行处理渲染
// this.tipList = []
this.showList = []
if ( if (
sessionStorage.getItem('token') && sessionStorage.getItem('token') &&
sessionStorage.getItem('token') != undefined sessionStorage.getItem('token') != undefined
) { ) {
// if (util.cookies.get('token') && util.cookies.get('token') != undefined) { //登录才能获取
// this.tipList = JSON.parse(e.data)
var alarmsInfo = JSON.parse(e.data) var alarmsInfo = JSON.parse(e.data)
//console.log(alarmsInfo, '-------') //console.log(alarmsInfo, '-------')
if (alarmsInfo.status != 1) { if (alarmsInfo.status != 1) {
...@@ -339,10 +325,6 @@ export default { ...@@ -339,10 +325,6 @@ export default {
websocketclose(e) { websocketclose(e) {
console.log('断开连接', e) console.log('断开连接', e)
}, },
send() {
this.websock.send('1')
},
// ==================================== // ====================================
//初始化weosocket2 //初始化weosocket2
initWebSocket2() { initWebSocket2() {
...@@ -470,9 +452,6 @@ export default { ...@@ -470,9 +452,6 @@ export default {
websocketclose2(e) { websocketclose2(e) {
console.log('断开连接2', e) console.log('断开连接2', e)
}, },
send2() {
this.websock.send('2')
},
// 同意被接管 // 同意被接管
agreed() { agreed() {
let item = this.takeoverInfo let item = this.takeoverInfo
...@@ -513,81 +492,21 @@ export default { ...@@ -513,81 +492,21 @@ export default {
//登录后页面刷新的时候获取 //登录后页面刷新的时候获取
getDateList() { getDateList() {
console.log('takeover:', sessionStorage.getItem('takeover'))
if (
sessionStorage.getItem('takeover') != undefined &&
sessionStorage.getItem('takeover') == 'true'
) {
this.ishowAlarm = false
} else {
this.ishowAlarm = true
}
console.log('ishowAlarm:', this.ishowAlarm)
this.tipList = []
this.showList = []
if ( if (
sessionStorage.getItem('token') && sessionStorage.getItem('token') &&
sessionStorage.getItem('token') != undefined sessionStorage.getItem('token') != undefined
) { ) {
this.$http({ this.$http({
url: this.$http.adornUrlAlarm('/alarmsInfo/queryList'), url: this.$http.adornUrl('/equipment/getListParam'),
method: 'post', method: 'get',
params: this.$http.adornParams({ params: this.$http.adornParams({})
status: 1,
stationId: localStorage.getItem('stationId')
})
}).then((data) => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.tipList = data.list this.paramsList = data.bean
console.log('paramsList:', this.paramsList)
if (this.tipList.length < 4) {
this.tipList.forEach((element) => {
this.showList.push(element)
})
} else if (this.tipList.length >= 4) {
for (let index = 0; index < 4; index++) {
this.showList.push(this.tipList[index])
}
}
if (this.showList) {
this.showList.sort(this.sortBy('occurrenceTime', true))
}
// console.log(this.tipList, '-------')
// console.log(this.showList, '-------')
//console.log(this.showList, '1----------1')
this.$store.dispatch('d2admin/toast/set', this.tipList.length)
} }
}) })
} else { } else {
//清空接管提示框
this.$store.dispatch('d2admin/takeover/setTakeover', null)
}
},
/**数组根据数组对象中的某个属性值进行排序的方法
* 使用例子:newArray.sort(sortBy('number',false)) //表示根据number属性降序排列;若第二个参数不传递,默认表示升序排序
* @param attr 排序的属性 如number属性
* @param rev true表示升序排列,false降序排序
* */
sortBy: function (attr, rev) {
//第二个参数没有传递 默认升序排列
if (rev == undefined) {
rev = 1
} else {
rev = rev ? 1 : -1
}
return function (a, b) {
a = a[attr]
b = b[attr]
if (a < b) {
return rev * -1
}
if (a > b) {
return rev * 1
}
return 0
} }
}, },
doBtn(item) { doBtn(item) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment