Commit aacebaea authored by yanzhongrong's avatar yanzhongrong

bug fix

parent 650387f1
<template> <template>
<div id="app"> <div id="app">
<router-view />
<router-view /> <audio id="my_audio" ref="audio" src="./assets/audio/urgent.wav" muted autoplay />
<audio ref="audio" id="my_audio" src="./assets/audio/urgent.wav" muted autoplay />
<transition name="tipalerm"> <transition name="tipalerm">
<div class="tips" v-if="tflag"> <div v-if="tflag" class="tips">
<p>提示</p> <p>提示</p>
<span <span>系统新增{{ msg.count }}
>系统新增{{ msg.count }}<span <span v-text="msg.type == 1 ? '设备连接' : '漏缆监测'" />
v-text="msg.type == 1 ? '设备连接' : '漏缆监测'" <span id="alevel" :style="alevel">{{ msg.level }}</span>告警消息,请及时查看!
></span </span>
><span id="alevel" :style="alevel">{{ msg.level }}</span
>告警消息,请及时查看!</span
>
</div> </div>
</transition> </transition>
</div> </div>
</template> </template>
<script> <script>
import { receiveMessage } from "@/utils/websocket"; import { receiveMessage } from '@/utils/websocket'
import socket from "@/utils/websocket"; import socket from '@/utils/websocket'
import { mapState } from "vuex"; import { mapState } from 'vuex'
import EventBus from "@/utils/bus"; import EventBus from '@/utils/bus'
export default { export default {
name: "App", name: 'App',
data() { data() {
return { return {
websocket: null, websocket: null,
tflag: false, tflag: false,
msg: "", msg: '',
alevel: { alevel: {
color: "", color: ''
}, },
audioUrl: '', audioUrl: '',
audioObj: { audioObj: {
'一般': 'commonly.wav', '一般': 'commonly.wav',
'重要': 'importang.wav', '重要': 'importang.wav',
'紧急': 'urgent.wav', '紧急': 'urgent.wav',
'连接异常': 'urgent.wav'
} }
}; }
}, },
computed: { computed: {
...mapState("user", ["userBaseInfo", "token"]), ...mapState('user', ['userBaseInfo', 'token']),
userId() { userId() {
return this.userBaseInfo.userId; return this.userBaseInfo.userId
}, },
usertoken() { usertoken() {
return this.token; return this.token
}, }
},
methods: {
receiveMessage,
closeWebsocket() {
if (this.websocket) {
this.websocket.close();
}
},
levelcolor() {
if (this.msg.level == "正常" || this.msg.level == "连接正常") {
this.alevel.color = "green";
} else if (this.msg.level == "紧急" || this.msg.level == "连接异常") {
this.alevel.color = "#f00";
} else if (this.msg.level == "重要") {
this.alevel.color = "#f89850";
} else if (this.msg.level == "一般") {
this.alevel.color = "#ead906";
}
},
},
mounted() {
let audioPlay = document.getElementById("my_audio");
EventBus.$on("dialogAlarm", (data) => {
// 接收消息之后 声音弹窗显示
this.msg = data;
this.audioUrl = './assets/audio/' + this.audioObj[data.level]
setTimeout(() => {
audioPlay.play();
},500)
this.levelcolor();
this.tflag = true;
setTimeout(() => {
this.tflag = false;
}, 3000);
});
EventBus.$on("cancelWS", () => {
this.websocket.close();
console.log('关闭ws');
});
}, },
watch: { watch: {
$route(to, from) { $route(to, from) {
if (to.path == "/login") { if (to.path === '/login') {
setTimeout(this.closeWebsocket(),300) setTimeout(this.closeWebsocket(), 300)
// this.websocket.close() // this.websocket.close()
console.log("在登录页"); console.log('在登录页')
} }
}, },
usertoken: { usertoken: {
immediate: true, immediate: true,
handler(newV) { handler(newV) {
if (newV) { if (newV) {
if (newV !== '') {
if (newV != '') { this.websocket = socket({ onmessage: this.receiveMessage })
this.websocket = socket({ } else {
onmessage: this.receiveMessage, this.closeWebsocket();
});
} else{
this.closeWebsocket();
} }
} }
}, }
}, }
},
mounted() {
let audioPlay = document.getElementById('my_audio')
EventBus.$on('dialogAlarm', (data) => {
// 接收消息之后 声音弹窗显示
this.msg = data
this.levelcolor()
this.tflag = true
setTimeout(() => {
this.tflag = false
}, 3000)
})
EventBus.$on('autioPlay', (data) => {
this.audioUrl = './assets/audio/' + this.audioObj[data.level]
setTimeout(() => {
audioPlay.play()
}, 500)
})
EventBus.$on('cancelWS', () => {
this.websocket.close()
console.log('关闭ws')
})
}, },
}; methods: {
receiveMessage,
closeWebsocket() {
if (this.websocket) {
this.websocket.close()
}
},
levelcolor() {
if (this.msg.level === '正常' || this.msg.level === '连接正常') {
this.alevel.color = 'green'
} else if (this.msg.level === '紧急' || this.msg.level === '连接异常') {
this.alevel.color = '#f00'
} else if (this.msg.level === '重要') {
this.alevel.color = '#f89850'
} else if (this.msg.level === '一般') {
this.alevel.color = '#ead906'
}
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#app { #app {}
// & ::v-deep .el-table__body tr:hover>td{
// background-color: #bed5ff !important;
// }
// & ::v-deep .el-table__body tr.current-row>td{
// background-color: #bed5ff !important;
// }
}
.tipalerm-enter-active { .tipalerm-enter-active {
transition: 0.5s; transition: 0.5s;
} }
......
...@@ -9,7 +9,7 @@ export function login(data) { ...@@ -9,7 +9,7 @@ export function login(data) {
} }
export function getInfo() { export function getInfo() {
return request.post('/user/selectUserBaseInfo', ...arguments) return request.post('/user/getUser', ...arguments)
} }
export function logout() { export function logout() {
......
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
methods: { methods: {
getBreadcrumb() { getBreadcrumb() {
// only show routes with meta.title // only show routes with meta.title
let matched = this.$route.matched.filter(item => item.meta && item.meta.title) const matched = this.$route.matched.filter(item => item.meta && item.meta.title)
const first = matched[0] const first = matched[0]
// if (!this.isDashboard(first)) { // if (!this.isDashboard(first)) {
......
export const alarmLeval = { export const alarmLeval = {
1: '紧急', 1: '紧急',
2: '重要', 2: '重要',
3: '一般', 3: '一般'
} }
export const ConnectStatusEnum = { export const ConnectStatusEnum = {
...@@ -13,5 +13,5 @@ export const levelStyle = { ...@@ -13,5 +13,5 @@ export const levelStyle = {
'-1': 'level_G', '-1': 'level_G',
'0': 'level_Y', '0': 'level_Y',
'1': 'level_O', '1': 'level_O',
'2': 'level_R', '2': 'level_R'
} }
\ No newline at end of file
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
<section class="app-main"> <section class="app-main">
<transition name="fade-transform" mode="out-in"> <transition name="fade-transform" mode="out-in">
<!-- <keep-alive include="Dashboard"> --> <!-- <keep-alive include="Dashboard"> -->
<router-view :key="key" /> <router-view :key="key" />
<!-- </keep-alive> --> <!-- </keep-alive> -->
</transition> </transition>
</section> </section>
</template> </template>
......
...@@ -96,7 +96,7 @@ export default { ...@@ -96,7 +96,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar { .navbar {
overflow: hidden; overflow: hidden;
position: fixed; // position: fixed;
top: 0; top: 0;
left: 0; left: 0;
z-index: 5; z-index: 5;
......
...@@ -13,20 +13,16 @@ ...@@ -13,20 +13,16 @@
</template> </template>
<script> <script>
import Breadcrumb from '@/components/Breadcrumb' import Breadcrumb from '@/components/Breadcrumb/index.vue'
import { Navbar, Sidebar, AppMain, Topbar } from './components' import { Navbar, AppMain } from './components'
import ResizeMixin from './mixin/ResizeHandler' import ResizeMixin from './mixin/ResizeHandler'
import orgTree from '@/components/orgTree.vue'
export default { export default {
name: 'Layout', name: 'Layout',
components: { components: {
Breadcrumb, Breadcrumb,
Navbar, Navbar,
Sidebar, AppMain
AppMain,
Topbar,
orgTree
}, },
mixins: [ResizeMixin], mixins: [ResizeMixin],
computed: { computed: {
......
...@@ -10,9 +10,7 @@ import router from './router' ...@@ -10,9 +10,7 @@ import router from './router'
import '@/icons' // icon import '@/icons' // icon
import '@/permission' // permission control import '@/permission' // permission control
import performLoader from '@/utils/global_main_loader.js' import performLoader from '@/utils/global_main_loader.js'
import WS from '@/utils/websocket'
import WS from '@/utils/websocket'
Vue.prototype.$ws = WS Vue.prototype.$ws = WS
Vue.use(ElementUI, { locale }) Vue.use(ElementUI, { locale })
performLoader(Vue) // 所有的第三方插件性质的东西都放到这里面了 performLoader(Vue) // 所有的第三方插件性质的东西都放到这里面了
......
...@@ -22,11 +22,10 @@ router.beforeEach(async(to, from, next) => { ...@@ -22,11 +22,10 @@ router.beforeEach(async(to, from, next) => {
if (hasToken) { if (hasToken) {
if (to.path === '/login') { if (to.path === '/login') {
// if is logged in, redirect to the home page
next({ path: '/' }) next({ path: '/' })
NProgress.done() NProgress.done()
} else { } else {
const hasGetUserInfo = store.getters.name const hasGetUserInfo = store.getters.userName
if (hasGetUserInfo) { if (hasGetUserInfo) {
next() next()
} else { } else {
...@@ -46,12 +45,9 @@ router.beforeEach(async(to, from, next) => { ...@@ -46,12 +45,9 @@ router.beforeEach(async(to, from, next) => {
} }
} else { } else {
/* has no token*/ /* has no token*/
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
// in the free login whitelist, go directly
next() next()
} else { } else {
// other pages that do not have permission to access are redirected to the login page.
next(`/login?redirect=${to.path}`) next(`/login?redirect=${to.path}`)
NProgress.done() NProgress.done()
} }
...@@ -59,6 +55,5 @@ router.beforeEach(async(to, from, next) => { ...@@ -59,6 +55,5 @@ router.beforeEach(async(to, from, next) => {
}) })
router.afterEach(() => { router.afterEach(() => {
// finish progress bar
NProgress.done() NProgress.done()
}) })
import { deptList } from '@/api/baseData'
const getDefaultState = () => {
return {
cableList: null,
deviceList: null
}
}
const state = getDefaultState()
const mutations = {
RESET_STATE: state => {
Object.assign(state, getDefaultState())
},
SET_DEPART: (state, payload) => {
state.departList = handleDepart(payload)
state.departMap = listToMap(payload)
}
}
const actions = {
getDepart({ commit }) {
deptList({}).then(res => {
if (!res) return
commit('SET_DEPART', res)
})
}
}
const getters = {
departMap(state) {
return state.departMap
},
departList(state) {
return state.departList
}
}
function handleDepart(list) {
if (!list) return
return list.map(item => {
const data = {}
data.label = item.dictValue
data.name = item.dictValue
data.id = item.id
data.value = item.id
data.data = item
return data
})
}
function listToMap(arr, mapKey = 'id') {
const map = {}
arr.forEach(item => {
map[item[mapKey]] = item
})
return map
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
...@@ -16,7 +16,7 @@ const mutations = { ...@@ -16,7 +16,7 @@ const mutations = {
SET_DEPART: (state, payload) => { SET_DEPART: (state, payload) => {
state.departList = handleDepart(payload) state.departList = handleDepart(payload)
state.departMap = listToMap(payload) state.departMap = listToMap(payload)
}, }
} }
const actions = { const actions = {
...@@ -25,7 +25,7 @@ const actions = { ...@@ -25,7 +25,7 @@ const actions = {
if (!res) return if (!res) return
commit('SET_DEPART', res) commit('SET_DEPART', res)
}) })
}, }
} }
const getters = { const getters = {
...@@ -34,7 +34,7 @@ const getters = { ...@@ -34,7 +34,7 @@ const getters = {
}, },
departList(state) { departList(state) {
return state.departList return state.departList
}, }
} }
function handleDepart(list) { function handleDepart(list) {
......
import { login, getInfo } from '@/api/user' import { login, getInfo } from '@/api/user'
import { getToken, setToken, removeToken, getUserName, getUserId, removeUserName, removeUserId } from '@/utils/auth' import { getToken, setToken, removeToken, removeUserName, removeUserId } from '@/utils/auth'
import { resetRouter } from '@/router' import { resetRouter } from '@/router'
const getDefaultState = () => { const getDefaultState = () => {
return { return {
token: getToken(), token: getToken(),
userBaseInfo: {} userBaseInfo: {},
userId: ''
} }
} }
...@@ -17,11 +18,13 @@ const mutations = { ...@@ -17,11 +18,13 @@ const mutations = {
}, },
SET_TOKEN: (state, token) => { SET_TOKEN: (state, token) => {
state.token = token state.token = token
console.log(token);
}, },
SET_BASEINFO: (state, data) => { SET_BASEINFO: (state, data) => {
state.userBaseInfo = data state.userBaseInfo = data
}, },
SET_USERID: (state, data) => {
state.userId = data
}
} }
const actions = { const actions = {
...@@ -43,7 +46,7 @@ const actions = { ...@@ -43,7 +46,7 @@ const actions = {
// get user info // get user info
getInfo({ commit }) { getInfo({ commit }) {
getInfo({type: 0}).then(res => { getInfo({ type: 0 }).then(res => {
if (!res) return if (!res) return
commit('SET_BASEINFO', res) commit('SET_BASEINFO', res)
}) })
...@@ -54,10 +57,10 @@ const actions = { ...@@ -54,10 +57,10 @@ const actions = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
removeToken() // must remove token first removeToken() // must remove token first
removeUserName() // must remove token first removeUserName() // must remove token first
// removeUserId() // must remove token first removeUserId() // must remove token first
resetRouter() resetRouter()
commit("SET_TOKEN", "") commit('SET_TOKEN', '')
commit("SET_BASEINFO", {}) commit('SET_BASEINFO', {})
commit('RESET_STATE') commit('RESET_STATE')
resolve() resolve()
}) })
...@@ -67,8 +70,8 @@ const actions = { ...@@ -67,8 +70,8 @@ const actions = {
resetToken({ commit }) { resetToken({ commit }) {
return new Promise(resolve => { return new Promise(resolve => {
removeToken() // must remove token first removeToken() // must remove token first
removeUserName() // must remove token first removeUserName()
// removeUserId() // must remove token first removeUserId()
commit('RESET_STATE') commit('RESET_STATE')
resolve() resolve()
}) })
...@@ -81,7 +84,7 @@ const getters = { ...@@ -81,7 +84,7 @@ const getters = {
}, },
userBaseInfo(state) { userBaseInfo(state) {
return state.userBaseInfo return state.userBaseInfo
}, }
} }
export default { export default {
......
...@@ -42,9 +42,11 @@ ...@@ -42,9 +42,11 @@
} }
.el-table{ .el-table{
height: 613px; height: calc(88vh - 150px);
overflow-y: auto; overflow-y: auto;
} }
.el-dialog__header{ .el-dialog__header{
text-align: center; text-align: center;
} }
......
...@@ -90,13 +90,6 @@ ...@@ -90,13 +90,6 @@
top: 53%; top: 53%;
} }
.el-table__body tr:active > td{
background-color:#bed5ff !important;
}
.el-table__body tr.hover-row>td {
background-color:#bed5ff !important;
}
.el-scrollbar { .el-scrollbar {
height: 100%; height: 100%;
...@@ -106,4 +99,18 @@ ...@@ -106,4 +99,18 @@
overflow: scroll; overflow: scroll;
width: 110%; width: 110%;
height: 98%; height: 98%;
}
.el-table__body-wrapper::-webkit-scrollbar{
width: 2px;
}
.el-table__body-wrapper::-webkit-scrollbar-thumb{
border-radius: 2px;
height: 50px;
background: #eee;
}
.el-table__body-wrapper::-webkit-scrollbar-track{
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 2px;
background: rgba(0,0,0,0.4);
} }
\ No newline at end of file
...@@ -13,12 +13,27 @@ export function setToken(token) { ...@@ -13,12 +13,27 @@ export function setToken(token) {
export function removeToken() { export function removeToken() {
return Cookies.remove(TokenKey) return Cookies.remove(TokenKey)
} }
export function setUserName(username){
return Cookies.set('userName',username) export function setUserName(username) {
return Cookies.set('userName', username)
} }
export function getUserName(){
export function getUserName() {
return Cookies.get('userName') return Cookies.get('userName')
} }
export function removeUserName(){
export function removeUserName() {
return Cookies.remove('userName') return Cookies.remove('userName')
} }
export function setUserId(username) {
return Cookies.set('userId', username)
}
export function getUserId() {
return Cookies.get('userId')
}
export function removeUserId() {
return Cookies.remove('userId')
}
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import delids from '@/components/Del/index.vue' import delids from '@/components/Del/index.vue'
// import VueSocketIO from 'vue-socket.io'
export default function performLoader(Vue) { export default function performLoader(Vue) {
// self component // self component
...@@ -9,5 +8,4 @@ export default function performLoader(Vue) { ...@@ -9,5 +8,4 @@ export default function performLoader(Vue) {
Vue.component('delids', delids) Vue.component('delids', delids)
} }
Vue.use(plugins) Vue.use(plugins)
} }
import axios from 'axios' import axios from 'axios'
import { MessageBox, Message } from 'element-ui' import { Message } from 'element-ui'
import store from '@/store' import store from '@/store'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import socket from "@/utils/websocket";
import Vue from 'vue' import Vue from 'vue'
import EventBus from '@/utils/bus' import EventBus from '@/utils/bus'
...@@ -62,13 +61,13 @@ service.interceptors.response.use( ...@@ -62,13 +61,13 @@ service.interceptors.response.use(
let resFinal = res.rsp || res || {} let resFinal = res.rsp || res || {}
let code = resFinal.errorCode || resFinal.code let code = resFinal.errorCode || resFinal.code
let message = resFinal.message || resFinal.errorMsg || resFinal.error || '接口错误' let message = resFinal.message || resFinal.errorMsg || resFinal.error || '接口错误'
if(code) { if (code) {
if (code == 201) { if (code === 201) {
location.href = location.href.replace(/#.+/, '') + '#/login' location.href = location.href.replace(/#.+/, '') + '#/login'
EventBus.$emit('cancelWS') EventBus.$emit('cancelWS')
return return
} }
if (code == 501 ) { if (code === 501) {
// !config.silence && !errorShowing && Message.error(message) // !config.silence && !errorShowing && Message.error(message)
errorShowing = true errorShowing = true
setTimeout(() => { errorShowing = false }, 3000) setTimeout(() => { errorShowing = false }, 3000)
...@@ -76,7 +75,7 @@ service.interceptors.response.use( ...@@ -76,7 +75,7 @@ service.interceptors.response.use(
EventBus.$emit('cancelWS') EventBus.$emit('cancelWS')
location.href = location.href.replace(/#.+/, '') + '#/login' location.href = location.href.replace(/#.+/, '') + '#/login'
return return
} }
if (code !== 200) { if (code !== 200) {
!config.silence && Message.error(message) !config.silence && Message.error(message)
return Promise.reject(new Error(message)) return Promise.reject(new Error(message))
...@@ -92,11 +91,6 @@ service.interceptors.response.use( ...@@ -92,11 +91,6 @@ service.interceptors.response.use(
Message.error(error.message) Message.error(error.message)
} }
} }
// Message({
// message: error.message,
// type: 'error',
// duration: 5 * 1000
// })
return Promise.reject(error) return Promise.reject(error)
} }
) )
......
...@@ -65,16 +65,9 @@ function heartCheck(websocket) { ...@@ -65,16 +65,9 @@ function heartCheck(websocket) {
//消息处理 //消息处理
export function receiveMessage(message) { export function receiveMessage(message) {
// 消息接收后处理逻辑 接口访问 // 消息接收后处理逻辑 接口访问
// console.log(message, '接收到的信息');
if (message != '连接成功') { if (message != '连接成功') {
let obj =JSON.parse( JSON.parse(message)) let obj = JSON.parse( JSON.parse(message))
EventBus.$emit('dialogAlarm', obj) EventBus.$emit('dialogAlarm', obj)
EventBus.$emit('autioPlay', obj)
} }
// return obj
} }
\ No newline at end of file
...@@ -7,11 +7,10 @@ ...@@ -7,11 +7,10 @@
:key="item.key" :key="item.key"
:type="confirmStatus === item.key ? 'primary' : ''" :type="confirmStatus === item.key ? 'primary' : ''"
@click="changeType(item)" @click="changeType(item)"
>{{ item.label }}</el-button >{{ item.label }}</el-button>
>
</el-button-group> </el-button-group>
<div class="leakage-top"> <div class="leakage-top">
<div style="color: #666666"></div> <div style="color: #666666" />
<div class="operate-btn"> <div class="operate-btn">
<el-button type="primary" @click="refresh">刷新</el-button> <el-button type="primary" @click="refresh">刷新</el-button>
<el-button type="primary" @click="isQuery = !isQuery">查询</el-button> <el-button type="primary" @click="isQuery = !isQuery">查询</el-button>
...@@ -19,7 +18,7 @@ ...@@ -19,7 +18,7 @@
</div> </div>
</div> </div>
<div v-show="isQuery"> <div v-show="isQuery">
<search @search="search" ref="reset" /> <search ref="reset" @search="search" />
</div> </div>
<el-table <el-table
:data="tableData" :data="tableData"
...@@ -45,8 +44,7 @@ ...@@ -45,8 +44,7 @@
label="告警级别" label="告警级别"
width="150" width="150"
align="center" align="center"
> />
</el-table-column>
<el-table-column <el-table-column
prop="alarmInfo" prop="alarmInfo"
label="告警信息" label="告警信息"
...@@ -77,20 +75,17 @@ ...@@ -77,20 +75,17 @@
<el-table-column label="操作" align="center" width="100"> <el-table-column label="操作" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
type="text"
v-if=" v-if="
scope.row.confirmStatus === 1 && scope.row.confirmStatus === 1 && scope.row.alarmLevelName == '正常'
scope.row.alarmLevelName == '正常'
" "
type="text"
@click="cancel2(scope.row)" @click="cancel2(scope.row)"
>取消</el-button >取消</el-button>
>
<el-button <el-button
type="text"
v-else-if="scope.row.confirmStatus === 0" v-else-if="scope.row.confirmStatus === 0"
type="text"
@click="confirm2(scope.row)" @click="confirm2(scope.row)"
>确认</el-button >确认</el-button>
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -106,7 +101,7 @@ ...@@ -106,7 +101,7 @@
<label class="particulars">基站名称:</label> <label class="particulars">基站名称:</label>
</td> </td>
<td style="width: 180px; text-align: left"> <td style="width: 180px; text-align: left">
<label v-text="dialogInfo.siteName"></label> <label v-text="dialogInfo.siteName" />
</td> </td>
</tr> </tr>
<tr style="line-height: 50px"> <tr style="line-height: 50px">
...@@ -114,7 +109,7 @@ ...@@ -114,7 +109,7 @@
<label class="particulars">告警对象:</label> <label class="particulars">告警对象:</label>
</td> </td>
<td style="width: 180px; text-align: left"> <td style="width: 180px; text-align: left">
<label v-text="dialogInfo.alarmTarget"></label> <label v-text="dialogInfo.alarmTarget" />
</td> </td>
</tr> </tr>
<tr style="line-height: 50px"> <tr style="line-height: 50px">
...@@ -122,7 +117,7 @@ ...@@ -122,7 +117,7 @@
<label class="particulars">告警级别:</label> <label class="particulars">告警级别:</label>
</td> </td>
<td style="width: 180px; text-align: left"> <td style="width: 180px; text-align: left">
<label v-text="dialogInfo.alarmLevelName"></label> <label v-text="dialogInfo.alarmLevelName" />
</td> </td>
</tr> </tr>
<tr style="line-height: 50px"> <tr style="line-height: 50px">
...@@ -130,7 +125,11 @@ ...@@ -130,7 +125,11 @@
<label class="particulars">告警信息:</label> <label class="particulars">告警信息:</label>
</td> </td>
<td style="width: 180px; text-align: left"> <td style="width: 180px; text-align: left">
<label v-text="dialogInfo.alarmInfo"></label> <div v-for="(item, index) in dialogInfo.alarmInfo" style="font-weight:700" :key="index">
<span>距离:{{ item.distance }}</span>&nbsp;&nbsp;
<span>驻波比:{{ item.value }}</span>&nbsp;
</div>
<div style="font-weight:700">漏缆百米损耗: {{ dialogInfo.lossValue }}</div>
</td> </td>
</tr> </tr>
<tr style="line-height: 50px"> <tr style="line-height: 50px">
...@@ -138,7 +137,7 @@ ...@@ -138,7 +137,7 @@
<label class="particulars">最新上传时间:</label> <label class="particulars">最新上传时间:</label>
</td> </td>
<td style="width: 180px; text-align: left"> <td style="width: 180px; text-align: left">
<label v-text="dialogInfo.lateUploadTime"></label> <label v-text="dialogInfo.lateUploadTime" />
</td> </td>
</tr> </tr>
<tr style="line-height: 50px"> <tr style="line-height: 50px">
...@@ -146,26 +145,23 @@ ...@@ -146,26 +145,23 @@
<label class="particulars">状态变化时间:</label> <label class="particulars">状态变化时间:</label>
</td> </td>
<td style="width: 180px; text-align: left"> <td style="width: 180px; text-align: left">
<label v-text="dialogInfo.statusTimeChange"></label> <label v-text="dialogInfo.statusTimeChange" />
</td> </td>
</tr> </tr>
</table> </table>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button <el-button
type="primary"
v-if=" v-if="
dialogInfo.confirmStatus === 1 && dialogInfo.confirmStatus === 1 && dialogInfo.alarmLevelName === '正常'
dialogInfo.alarmLevelName === '正常'
" "
type="primary"
@click="cancel(dialogInfo)" @click="cancel(dialogInfo)"
>取消告警</el-button >取消告警</el-button>
>
<el-button <el-button
v-else-if="dialogInfo.confirmStatus !== 1" v-else-if="dialogInfo.confirmStatus !== 1"
type="primary" type="primary"
@click="confirm(dialogInfo)" @click="confirm(dialogInfo)"
>确认告警</el-button >确认告警</el-button>
>
</span> </span>
</el-dialog> </el-dialog>
<Pagination <Pagination
...@@ -179,149 +175,149 @@ ...@@ -179,149 +175,149 @@
</template> </template>
<script> <script>
import { cableTimeList, cableConfirm, cableCancel } from "../api"; import { cableTimeList, cableConfirm, cableCancel } from '../api'
import { exportLeakyCable } from "@/api/export"; import { exportLeakyCable } from '@/api/export'
import search from "@/views/monitor/leakageCable/components/search.vue"; import search from '@/views/monitor/leakageCable/components/search.vue'
import download from "@/utils/download"; import download from '@/utils/download'
import { successAlert, warningAlert } from "@/utils/alert"; import { successAlert, warningAlert } from '@/utils/alert'
import { levelStyle } from '@/const/index' import { levelStyle } from '@/const/index'
export default { export default {
components: { search },
data() { data() {
return { return {
confirmStatus: 1, confirmStatus: 0,
dialogInfo: [], dialogInfo: [],
centerDialogVisible: false, centerDialogVisible: false,
params: { params: {
current: 1, current: 1,
size: 10, size: 10
}, },
total: 10, total: 10,
tableData: [], tableData: [],
tabs: [ tabs: [
{ {
label: "已确认", label: '未确认',
key: 1, key: 0
}, },
{ {
label: "未确认", label: '已确认',
key: 0, key: 1
}, }
], ],
isQuery: false, isQuery: false,
istrue: 0, istrue: 0,
searchOption: {}, searchOption: {},
exids: [], exids: [],
levelStyle levelStyle
}; }
},
mounted() {
this.getTableData()
},
created() {
console.log(this.$route.query)
this.searchOption = this.$route.query
}, },
components: { search },
methods: { methods: {
// 表格背景图颜色 // 表格背景图颜色
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
if (row.alarmLevelName == "紧急" && column.label == "告警级别") { if (row.alarmLevelName === '紧急' && column.property === 'alarmLevelName') {
return "emergency"; return 'emergency'
} else if (row.alarmLevelName == "重要" && column.label == "告警级别") { } else if (row.alarmLevelName === '重要' && column.property === 'alarmLevelName') {
return "important"; return 'important'
} else if (row.alarmLevelName == "一般" && column.label == "告警级别") { } else if (row.alarmLevelName === '一般' && column.property === 'alarmLevelName') {
return "common"; return 'common'
} else if (row.alarmLevelName == "正常" && column.label == "告警级别") { } else if (row.alarmLevelName === '正常' && column.property === 'alarmLevelName') {
return "normal"; return 'normal'
} }
if (rowIndex % 2 == 1) { if (rowIndex % 2 === 1) {
return "stripe"; return 'stripe'
} }
}, },
refresh() { refresh() {
this.$refs.reset != undefined this.$refs.reset !== undefined
? this.$refs.reset.reset() ? this.$refs.reset.reset()
: this.getTableData(); : this.getTableData()
}, },
handlePageChange(pageData) { handlePageChange(pageData) {
this.params.size = pageData.size; this.params.size = pageData.size
this.params.current = pageData.page; this.params.current = pageData.page
this.getTableData(); this.getTableData()
}, },
search(option) { search(option) {
this.istrue = 1; this.istrue = 1
this.searchOption = option; this.searchOption = option
this.getTableData(); this.getTableData()
}, },
getTableData() { getTableData() {
let param = { let param = {
confirmStatus: this.confirmStatus, confirmStatus: this.confirmStatus,
...this.params, ...this.params,
...this.searchOption, ...this.searchOption
}; }
cableTimeList(param).then((res) => { cableTimeList(param).then((res) => {
let list = res.records || []; let list = res.records || []
list.forEach(item => { list.forEach(item => {
if(item.alarmInfo != '' && item.alarmInfo != null) { if (item.alarmInfo !== '' && item.alarmInfo != null) {
item.alarmInfo = JSON.parse(item.alarmInfo) item.alarmInfo = JSON.parse(item.alarmInfo)
item.lossValue = eval(item.alarmInfo.map(k => k.lossValue).join('+')) item.lossValue = eval(item.alarmInfo.map(k => k.lossValue).join('+'))
} }
}); })
this.tableData = list; this.tableData = list
this.total = res.total; this.total = res.total
this.exids = list.map(i => i.id); this.exids = list.map(i => i.id)
if (this.istrue == 1) { if (this.istrue == 1) {
if (this.tableData.length != 0) { if (this.tableData.length != 0) {
successAlert("操作成功"); successAlert('操作成功')
} else { } else {
warningAlert("查询结果为空"); warningAlert('查询结果为空')
} }
this.istrue = 0; this.istrue = 0
} }
}); })
}, },
confirm(dialogInfo) { confirm(dialogInfo) {
let id = dialogInfo.id; let id = dialogInfo.id
cableConfirm({ id: id }).then((res) => { cableConfirm({ id: id }).then((res) => {
this.getTableData(); this.getTableData()
}); })
this.centerDialogVisible = false; this.centerDialogVisible = false
}, },
confirm2(row) { confirm2(row) {
this.centerDialogVisible = true; this.centerDialogVisible = true
this.dialogInfo = row; this.dialogInfo = row
}, },
cancel(dialogInfo) { cancel(dialogInfo) {
let query = { let query = {
alarmLevelName: dialogInfo.alarmLevelName, alarmLevelName: dialogInfo.alarmLevelName,
id: dialogInfo.id, id: dialogInfo.id
}; }
cableCancel(query).then((res) => { cableCancel(query).then((res) => {
this.getTableData(); this.getTableData()
}); })
this.centerDialogVisible = false; this.centerDialogVisible = false
}, },
cancel2(row) { cancel2(row) {
this.centerDialogVisible = true; this.centerDialogVisible = true
this.dialogInfo = row; this.dialogInfo = row
}, },
changeType(item) { changeType(item) {
this.confirmStatus = item.key; this.confirmStatus = item.key
this.getTableData(); this.getTableData()
}, },
exportList() { exportList() {
if (this.exids.length == 0) { if (this.exids.length === 0) {
this.$message.warning("暂无数据"); this.$message.warning('暂无数据')
return false; return false
} else { } else {
exportLeakyCable({ ids: this.exids }).then((res) => { exportLeakyCable({ ids: this.exids }).then((res) => {
download(res, "vnd.ms-excel", `漏缆监测告警.xls`); download(res, 'vnd.ms-excel', `漏缆监测告警.xls`)
}); })
} }
}, }
}, }
mounted() { }
this.getTableData();
},
created() {
console.log(this.$route.query);
this.searchOption =this.$route.query
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -351,16 +347,16 @@ export default { ...@@ -351,16 +347,16 @@ export default {
background-color: #eaf1fe; background-color: #eaf1fe;
} }
& ::v-deep .emergency { & ::v-deep .emergency {
background-color: #f00; background-color: #f00!important;
} }
& ::v-deep .important { & ::v-deep .important {
background-color: #f89850; background-color: #f89850!important;
} }
& ::v-deep .common { & ::v-deep .common {
background-color: #ead906; background-color: #ead906!important;
} }
& ::v-deep .normal { & ::v-deep .normal {
background-color: green; background-color: green!important;
} }
.page { .page {
display: flex; display: flex;
......
...@@ -141,52 +141,51 @@ import download from "@/utils/download"; ...@@ -141,52 +141,51 @@ import download from "@/utils/download";
import { successAlert, warningAlert } from "@/utils/alert"; import { successAlert, warningAlert } from "@/utils/alert";
export default { export default {
name:'device', name:'device',
components: { search },
data() { data() {
return { return {
alarmInfo: "", alarmInfo: "",
dialogInfo: [], dialogInfo: [],
centerDialogVisible: false, centerDialogVisible: false,
confirmStatus: 1, confirmStatus: 0,
params: { params: {
current: 1, current: 1,
size: 10, size: 10
}, },
total: 10, total: 10,
tableData: [], tableData: [],
tabs: [ tabs: [
{
label: "已确认",
key: 1,
},
{ {
label: "未确认", label: "未确认",
key: 0, key: 0
}, },
{
label: "已确认",
key: 1
}
], ],
isQuery: false, isQuery: false,
istrue: 0, istrue: 0,
searchOption: {}, searchOption: {},
exids: [], exids: []
}; }
}, },
components: { search },
methods: { methods: {
// 表格背景图颜色 // 表格背景图颜色
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
if ( if (
row.connectStatusName == "连接正常" && row.connectStatusName === "连接正常" &&
column.property == "connectStatusName" column.property === "connectStatusName"
) { ) {
return "green"; return "green";
} }
if ( if (
row.connectStatusName == "连接异常" && row.connectStatusName === "连接异常" &&
column.property == "connectStatusName" column.property == "connectStatusName"
) { ) {
return "red"; return "red";
} }
if (rowIndex % 2 == 1) { if (rowIndex % 2 === 1) {
return "stripe"; return "stripe";
} }
}, },
......
...@@ -53,19 +53,17 @@ ...@@ -53,19 +53,17 @@
<el-col :span="10" class="value_handle" :style="acolor3">{{ <el-col :span="10" class="value_handle" :style="acolor3">{{
form.status.connectAlarm form.status.connectAlarm
}}</el-col> }}</el-col>
<el-col :span="10" <el-col :span="10">
><el-button <el-button
v-if="
form.status.connectAlarm == '告警' || form.status.connectAlarm == '连接异常'
"
class="alarmbtn" class="alarmbtn"
type="primary" type="primary"
size="mini" size="mini"
v-if="
form.status.connectAlarm == '告警' ||
form.status.connectAlarm == '连接异常'
"
@click="toalarm(form.status.connectAlarm)" @click="toalarm(form.status.connectAlarm)"
>处理告警</el-button >处理告警</el-button>
></el-col </el-col>
>
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
...@@ -78,20 +76,15 @@ ...@@ -78,20 +76,15 @@
<el-col :span="10" class="value_handle" :style="acolor">{{ <el-col :span="10" class="value_handle" :style="acolor">{{
form.status.monitorAlarm form.status.monitorAlarm
}}</el-col> }}</el-col>
<el-col :span="10" <el-col :span="10">
><el-button <el-button
v-if="form.status.monitorAlarm != '正常' && form.status.monitorAlarm != '' && form.status.monitorAlarm != undefined"
class="alarmbtn" class="alarmbtn"
type="primary" type="primary"
size="mini" size="mini"
v-if="
form.status.monitorAlarm != '正常' &&
form.status.monitorAlarm != '' &&
form.status.monitorAlarm != undefined
"
@click="toalarm(form.status.monitorAlarm)" @click="toalarm(form.status.monitorAlarm)"
>处理告警</el-button >处理告警</el-button>
></el-col </el-col>
>
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
...@@ -153,21 +146,19 @@ ...@@ -153,21 +146,19 @@
<span>基础信息</span> <span>基础信息</span>
<el-button <el-button
v-if="flag == true"
style="float: right; padding: 3px 0; margin-right: 20px" style="float: right; padding: 3px 0; margin-right: 20px"
type="text" type="text"
class="savebtn" class="savebtn"
v-if="flag == true"
@click="editbtn()" @click="editbtn()"
><svg-icon icon-class="edit" /> 编辑</el-button ><svg-icon icon-class="edit" /> 编辑</el-button>
>
<el-button <el-button
v-else
style="float: right; padding: 3px 0; margin-right: 20px" style="float: right; padding: 3px 0; margin-right: 20px"
type="text" type="text"
class="savebtn" class="savebtn"
v-else
@click="savebtn()" @click="savebtn()"
><svg-icon icon-class="save" /> 保存</el-button ><svg-icon icon-class="save" /> 保存</el-button>
>
</div> </div>
<div> <div>
<el-row class="text" :gutter="24"> <el-row class="text" :gutter="24">
...@@ -181,7 +172,7 @@ ...@@ -181,7 +172,7 @@
clearable clearable
placeholder="请输入内容" placeholder="请输入内容"
:disabled="flag" :disabled="flag"
></el-input> />
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
...@@ -196,7 +187,7 @@ ...@@ -196,7 +187,7 @@
clearable clearable
placeholder="请输入内容" placeholder="请输入内容"
:disabled="flag" :disabled="flag"
></el-input> />
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
...@@ -246,7 +237,7 @@ ...@@ -246,7 +237,7 @@
:key="item.key" :key="item.key"
:label="item.label" :label="item.label"
:value="item.key" :value="item.key"
></el-option> />
</el-select> </el-select>
</div> </div>
</el-col> </el-col>
...@@ -259,29 +250,44 @@ ...@@ -259,29 +250,44 @@
</template> </template>
<script> <script>
import { DetailMixins } from "./mixins"; import { DetailMixins } from './mixins'
import { getUserName } from "@/utils/auth"; import { getUserName } from '@/utils/auth'
import { railWayOpen } from '../api'
import { railWayOpen } from "../api";
export default { export default {
name: "Dashboard", name: 'Type1',
mixins: [DetailMixins], mixins: [DetailMixins],
data() { data() {
return { return {
colspan: 14, colspan: 14,
acolor: { acolor: {
color: "" color: ''
}, },
acolor3: { acolor3: {
color: "" color: ''
}, }
}; }
},
computed: {
userName() {
return getUserName()
}
},
watch: {
form: {
immediate: true,
handler(newV) {
if (newV) {
this.waylevelcolor()
this.waylevelcolor2()
}
}
},
deep: true
}, },
methods: { methods: {
savebtn() { savebtn() {
this.flag = true; this.flag = true
const params = {
let params = {
id: this.form.baseInfo.id, id: this.form.baseInfo.id,
name: this.form.baseInfo.name, name: this.form.baseInfo.name,
isOpen: this.form.baseInfo.isOpen, isOpen: this.form.baseInfo.isOpen,
...@@ -290,34 +296,34 @@ export default { ...@@ -290,34 +296,34 @@ export default {
totalLong: this.form.baseInfo.totalLong totalLong: this.form.baseInfo.totalLong
} }
railWayOpen(params).then((res) => { railWayOpen(params).then((res) => {
this.$message.success("修改成功"); this.$message.success('修改成功')
}); })
}, },
waylevelcolor() { waylevelcolor() {
if (this.form.status.monitorAlarm == '正常') { if (this.form.status.monitorAlarm === '正常') {
this.acolor.color = 'green' this.acolor.color = 'green'
} else if (this.form.status.monitorAlarm == '紧急') { } else if (this.form.status.monitorAlarm === '紧急') {
this.acolor.color = '#f00' this.acolor.color = '#f00'
this.form.status.monitorAlarm = '紧急告警' this.form.status.monitorAlarm = '紧急告警'
} else if (this.form.status.monitorAlarm == '重要') { } else if (this.form.status.monitorAlarm === '重要') {
this.acolor.color = '#f89850' this.acolor.color = '#f89850'
this.form.status.monitorAlarm = '重要告警' this.form.status.monitorAlarm = '重要告警'
} else if (this.form.status.monitorAlarm == '一般') { } else if (this.form.status.monitorAlarm === '一般') {
this.acolor.color = '#ead906' this.acolor.color = '#ead906'
this.form.status.monitorAlarm = '一般告警' this.form.status.monitorAlarm = '一般告警'
} }
}, },
waylevelcolor2() { waylevelcolor2() {
if (this.form.status.connectAlarm == '连接正常') { if (this.form.status.connectAlarm === '连接正常') {
this.acolor3.color = 'green' this.acolor3.color = 'green'
} else if (this.form.status.connectAlarm == '连接异常') { } else if (this.form.status.connectAlarm === '连接异常') {
this.acolor3.color = '#f00' this.acolor3.color = '#f00'
this.form.status.connectAlarm = '告警' this.form.status.connectAlarm = '告警'
} }
}, },
toalarm(data) { toalarm(data) {
let topath = '' let topath = ''
if (data == '告警') { if (data === '告警') {
topath = '/alarm/device' topath = '/alarm/device'
} else { } else {
topath = '/alarm/cableTime' topath = '/alarm/cableTime'
...@@ -327,28 +333,11 @@ export default { ...@@ -327,28 +333,11 @@ export default {
query: { query: {
wayId: this.form.baseInfo.id wayId: this.form.baseInfo.id
},
});
},
},
computed: {
userName() {
return getUserName();
},
},
watch: {
form: {
immediate: true,
handler(newV) {
if (newV) {
this.waylevelcolor()
this.waylevelcolor2()
} }
}, })
}, }
deep: true, }
}, }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<!-- 首页 --> <!-- 首页 -->
<header class="header_title">FSU({{ form.baseInfo.equipName }})</header> <header class="header_title">FSU({{ form.baseInfo.equipName }})</header>
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="11" class="mb20"> <el-col :span="12" class="mb20">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>管理范围</span> <span>管理范围</span>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="11" class="mb20"> <el-col :span="12" class="mb20">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>基础信息</span> <span>基础信息</span>
...@@ -209,31 +209,35 @@ ...@@ -209,31 +209,35 @@
:key="item.key" :key="item.key"
:label="item.label" :label="item.label"
:value="item.key" :value="item.key"
></el-option> />
</el-select> </el-select>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="11" class="mb20 specialCard"> <el-col :span="12" class="mb20 specialCard">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>当前状态</span> <span>当前状态</span>
</div> </div>
<div> <div>
<el-row v-for="(item, i) in statusList" class="text" :gutter="24"> <el-row v-for="(item, i) in statusList" :key="i" class="text" :gutter="24">
<el-col :span="10"> <el-col :span="10">
<div class="item_name">{{ item.name }}</div> <div class="item_name">{{ item.name }}</div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="item_data levelData">{{ item.value }}</div> <div class="item_data levelData">{{ item.value }}</div>
</el-col> </el-col>
<el-col :span="6" > <el-col :span="6">
<el-button class="alarmbtn" type="primary" size="mini" <el-button
v-if="item.value == '连接异常' || item.value == '紧急' || item.value == '重要' || item.value == '一般'" v-if="item.value == '连接异常' || item.value == '紧急' || item.value == '重要' || item.value == '一般'"
@click="toalarm(item)" >处理告警</el-button> class="alarmbtn"
</el-col> type="primary"
size="mini"
@click="toalarm(item)"
>处理告警</el-button>
</el-col>
</el-row> </el-row>
</div> </div>
</el-card> </el-card>
...@@ -243,56 +247,52 @@ ...@@ -243,56 +247,52 @@
</template> </template>
<script> <script>
import { DetailMixins } from "./mixins"; import { DetailMixins } from './mixins'
import { fsuOpen } from '../api'
import { fsuOpen } from "../api";
export default { export default {
name: "Dashboard", name: 'Type5',
mixins: [DetailMixins],
data() { data() {
return { return {
colspan:14, colspan: 14
}; }
}, },
mixins: [DetailMixins],
methods: {
savebtn() {
this.flag = true;
fsuOpen(this.info()).then((res) => {
this.$message.success("修改成功");
});
},
toalarm(item){
let topath = ''
let toquery = {}
if (item.name == '设备状态') {
topath = '/alarm/device'
toquery = { fsuId:this.form.baseInfo.id }
} else{
topath = '/alarm/cableTime'
toquery = { alarmTargetName:item.name }
}
this.$router.push({
path: topath,
query: toquery,
});
},
},
watch: { watch: {
statusList: { statusList: {
immediate: true, immediate: true,
handler(newV) { handler(newV) {
if (newV) { if (newV) {
this.$nextTick(function () { this.$nextTick(function() {
this.levelcolor(); this.levelcolor()
}); })
} }
}, }
}, }
}, },
mounted() {}, methods: {
}; savebtn() {
this.flag = true
fsuOpen(this.info()).then((res) => {
this.$message.success('修改成功')
})
},
toalarm(item) {
let topath = ''
let toquery = {}
if (item.name === '设备状态') {
topath = '/alarm/device'
toquery = { fsuId: this.form.baseInfo.id }
} else {
topath = '/alarm/cableTime'
toquery = { alarmTargetName: item.name }
}
this.$router.push({
path: topath,
query: toquery
})
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
监测设备({{ form.baseInfo.equipName }}) 监测设备({{ form.baseInfo.equipName }})
</header> </header>
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="11" class="mb20"> <el-col :span="12" class="mb20">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>管理范围</span> <span>管理范围</span>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="11" class="mb20"> <el-col :span="12" class="mb20">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>基础信息</span> <span>基础信息</span>
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="11" class="mb20 specialCard"> <el-col :span="12" class="mb20 specialCard">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>当前状态</span> <span>当前状态</span>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
漏缆({{ form.baseInfo.leakyCableDescribe }}) 漏缆({{ form.baseInfo.leakyCableDescribe }})
</header> </header>
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="11" class="mb20"> <el-col :span="12" class="mb20">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>记录信息</span> <span>记录信息</span>
...@@ -19,9 +19,11 @@ ...@@ -19,9 +19,11 @@
<div class="item_data">{{ form.log.all }}</div> <div class="item_data">{{ form.log.all }}</div>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-button class="picbtn" type="success" size="mini" <el-button
>趋势分析图形</el-button class="picbtn"
> type="success"
size="mini"
>趋势分析图形</el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-row class="text" :gutter="24"> <el-row class="text" :gutter="24">
...@@ -31,32 +33,30 @@ ...@@ -31,32 +33,30 @@
<el-col :span="7"> <el-col :span="7">
<div class="item_data">{{ form.log.monitor }}</div> <div class="item_data">{{ form.log.monitor }}</div>
</el-col> </el-col>
<el-col :span="7"> </el-col> <el-col :span="7" />
</el-row> </el-row>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="11" class="mb20"> <el-col :span="12" class="mb20">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>基础信息</span> <span>基础信息</span>
<el-button <el-button
v-if="flag == true"
style="float: right; padding: 3px 0; margin-right: 20px" style="float: right; padding: 3px 0; margin-right: 20px"
type="text" type="text"
class="savebtn" class="savebtn"
v-if="flag == true"
@click="editbtn()" @click="editbtn()"
><svg-icon icon-class="edit" /> 编辑</el-button ><svg-icon icon-class="edit" /> 编辑</el-button>
>
<el-button <el-button
v-else
style="float: right; padding: 3px 0; margin-right: 20px" style="float: right; padding: 3px 0; margin-right: 20px"
type="text" type="text"
class="savebtn" class="savebtn"
v-else
@click="savebtn()" @click="savebtn()"
><svg-icon icon-class="save" /> 保存</el-button ><svg-icon icon-class="save" /> 保存</el-button>
>
</div> </div>
<div> <div>
<el-row class="text" :gutter="24"> <el-row class="text" :gutter="24">
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
clearable clearable
placeholder="请输入内容" placeholder="请输入内容"
:disabled="flag" :disabled="flag"
></el-input> />
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
<el-col :span="10"> <el-col :span="10">
<div class="item_name">开通状态</div> <div class="item_name">开通状态</div>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="colspan">
<el-select <el-select
v-model="form.baseInfo.isOpen" v-model="form.baseInfo.isOpen"
:disabled="flag" :disabled="flag"
...@@ -208,14 +208,14 @@ ...@@ -208,14 +208,14 @@
:key="item.key" :key="item.key"
:label="item.label" :label="item.label"
:value="item.key" :value="item.key"
></el-option> />
</el-select> </el-select>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="11" class="mb20 specialCard"> <el-col :span="12" class="mb20 specialCard">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix posa"> <div slot="header" class="clearfix posa">
<span>当前状态</span> <span>当前状态</span>
...@@ -228,26 +228,21 @@ ...@@ -228,26 +228,21 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div <div
v-if="statusl.length != 0"
class="item_data levelData" class="item_data levelData"
:style="acolor" :style="acolor"
v-if="statusl.length != 0" />
>
{{ this.statusl[0].value }}
</div>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-button <el-button
v-if="
timeStatus.level == '紧急告警' || timeStatus.level == '重要告警' || timeStatus.level == '一般告警'
"
class="alarmbtn" class="alarmbtn"
type="primary" type="primary"
size="mini" size="mini"
v-if="
this.timeStatus.level == '紧急告警' ||
this.timeStatus.level == '重要告警' ||
this.timeStatus.level == '一般告警'
"
@click="toalarm()" @click="toalarm()"
>处理告警</el-button >处理告警</el-button>
>
</el-col> </el-col>
</el-row> </el-row>
<el-row class="text" :gutter="24"> <el-row class="text" :gutter="24">
...@@ -255,12 +250,17 @@ ...@@ -255,12 +250,17 @@
<div class="item_name">最后更新时间</div> <div class="item_name">最后更新时间</div>
</el-col> </el-col>
<el-col :span="colspan"> <el-col :span="colspan">
<div class="item_data" v-if="statusl.length != 0"> <div v-if="statusl.length != 0" class="item_data">
{{ this.statusl[1].value }} {{ statusl[1].value }}
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-for="(item, i) in long" class="text" :gutter="24"> <el-row
v-for="(item, i) in long"
:key="i"
class="text"
:gutter="24"
>
<el-col :span="10"> <el-col :span="10">
<div class="item_name"> <div class="item_name">
距({{ form.baseInfo.leakyCableDescribe }}方向){{ 距({{ form.baseInfo.leakyCableDescribe }}方向){{
...@@ -285,9 +285,11 @@ ...@@ -285,9 +285,11 @@
</div> </div>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-button class="picbtn" type="success" size="mini" <el-button
>生成图形</el-button class="picbtn"
> type="success"
size="mini"
>生成图形</el-button>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
...@@ -298,110 +300,103 @@ ...@@ -298,110 +300,103 @@
</template> </template>
<script> <script>
import { DetailMixins } from "./mixins"; import { DetailMixins } from './mixins'
import { leakyCableOpen } from "../api"; import { leakyCableOpen } from '../api'
export default { export default {
mixins: [DetailMixins],
data() { data() {
return { return {
colspan: 14, colspan: 14,
acolor: { acolor: {
color: "" color: ''
}, },
leakyList: [], leakyList: [],
timeStatus: {}, timeStatus: {},
zhubobi: [], zhubobi: [],
long: [], long: [],
statusl: [] statusl: []
}; }
},
computed: {
statusAlarmfun() {
return this.form.status || []
}
},
watch: {
statusAlarmfun: {
immediate: true,
handler(newV) {
if (newV) {
this.trans()
this.$nextTick(function() {
this.leakylevelcolor()
})
}
}
},
deep: true
}, },
mixins: [DetailMixins],
methods: { methods: {
savebtn() { savebtn() {
this.flag = true; this.flag = true
let params = { const params = {
id: this.form.baseInfo.id, id: this.form.baseInfo.id,
isOpen: this.form.baseInfo.isOpen, isOpen: this.form.baseInfo.isOpen,
hundredMetersLoss: this.form.baseInfo.hundredMetersLoss hundredMetersLoss: this.form.baseInfo.hundredMetersLoss
} }
leakyCableOpen(params).then((res) => { leakyCableOpen(params).then((res) => {
this.$message.success("修改成功"); this.$message.success('修改成功')
}); })
}, },
leakylevelcolor() { leakylevelcolor() {
if (this.timeStatus.level == '正常') { if (this.timeStatus.level === '正常') {
this.acolor.color = 'green' this.acolor.color = 'green'
} else if (this.timeStatus.level == '紧急') { } else if (this.timeStatus.level === '紧急') {
this.acolor.color = '#f00' this.acolor.color = '#f00'
this.timeStatus.level = '紧急告警' this.timeStatus.level = '紧急告警'
} else if (this.timeStatus.level == '重要') { } else if (this.timeStatus.level === '重要') {
this.acolor.color = '#f89850' this.acolor.color = '#f89850'
this.timeStatus.level = '重要告警' this.timeStatus.level = '重要告警'
} else if (this.timeStatus.level == '一般') { } else if (this.timeStatus.level === '一般') {
this.acolor.color = '#ead906' this.acolor.color = '#ead906'
this.timeStatus.level = '一般告警' this.timeStatus.level = '一般告警'
} }
}, },
toalarm() { toalarm() {
this.$router.push({ this.$router.push({
path: "/alarm/cableTime", path: '/alarm/cableTime',
query: { query: {
alarmTargetName: this.form.baseInfo.leakyCableDescribe alarmTargetName: this.form.baseInfo.leakyCableDescribe
}, }
}); })
}, },
trans() { trans() {
let arr1 = [], arr2 = [], arr3 = [] const arr1 = []; const arr2 = []; const arr3 = []
if (this.statusAlarmfun.length != 0) { if (this.statusAlarmfun.length !== 0) {
for (let i = 0; i < this.statusAlarmfun.length; i++) { for (let i = 0; i < this.statusAlarmfun.length; i++) {
if (i % 2 != 0) { if (i % 2 !== 0) {
if (this.statusAlarmfun[i].name == '最后更新时间') { if (this.statusAlarmfun[i].name === '最后更新时间') {
arr1.push(this.statusAlarmfun[i]) arr1.push(this.statusAlarmfun[i])
} else { } else {
arr2.push(this.statusAlarmfun[i]) arr2.push(this.statusAlarmfun[i])
} }
} else { } else {
if (this.statusAlarmfun[i].name == '漏缆状态') { if (this.statusAlarmfun[i].name === '漏缆状态') {
arr1.push(this.statusAlarmfun[i]) arr1.push(this.statusAlarmfun[i])
} else { } else {
arr3.push(this.statusAlarmfun[i]) arr3.push(this.statusAlarmfun[i])
} }
} }
} }
this.statusl = arr1 this.statusl = arr1
this.zhubobi = arr2 this.zhubobi = arr2
this.long = arr3 this.long = arr3
} }
}, }
}, }
computed: { }
statusAlarmfun() {
if (this.form.status) {
return this.form.status;
}
},
},
watch: {
statusAlarmfun: {
immediate: true,
handler(newV) {
if (newV) {
this.trans();
this.$nextTick(function () {
this.leakylevelcolor();
});
}
},
},
deep: true,
},
mounted() {
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -2,19 +2,17 @@ ...@@ -2,19 +2,17 @@
<div class="leakage-cable"> <div class="leakage-cable">
<!-- 设备连接维修历史 --> <!-- 设备连接维修历史 -->
<div class="leakage-top"> <div class="leakage-top">
<div style="color: #666666"></div> <div style="color: #666666" key=""/>
<div class="operate-btn"> <div class="operate-btn">
<delids :multipleSelection2="multipleSelection" @del="toDelete" <delids :multipleSelection2="multipleSelection" @del="toDelete">删除</delids>
>删除</delids
>
<el-button type="primary" @click="refresh">刷新</el-button> <el-button type="primary" @click="refresh">刷新</el-button>
<el-button type="primary" @click="isQuery = !isQuery">查询</el-button> <el-button type="primary" @click="isQuery = !isQuery">查询</el-button>
<el-button type="primary" @click="toExport">导出</el-button> <el-button type="primary" @click="toExport">导出</el-button>
<el-button type="primary" @click="delAll">清空数据</el-button> <el-button :type="isPermit==false ? 'primary' : 'info'" :disabled="isPermit" @click="delAll">清空数据</el-button>
</div> </div>
</div> </div>
<div v-if="isQuery"> <div v-if="isQuery">
<search @search="search" ref="reset" /> <search ref="reset" @search="search" />
</div> </div>
<el-table <el-table
:data="tableData" :data="tableData"
...@@ -34,16 +32,13 @@ ...@@ -34,16 +32,13 @@
label="连接状态" label="连接状态"
width="150" width="150"
align="center" align="center"
> />
</el-table-column>
<el-table-column <el-table-column
prop="endPointDeviceName" prop="endPointDeviceName"
label="网元设备" label="网元设备"
align="center" align="center"
> />
</el-table-column> <el-table-column prop="userName" label="维修人员信息" align="center"/>
<el-table-column prop="userName" label="维修人员信息" align="center">
</el-table-column>
<el-table-column <el-table-column
prop="connectAlarmMaintainTime" prop="connectAlarmMaintainTime"
label="连接告警维修时间" label="连接告警维修时间"
...@@ -63,130 +58,139 @@ ...@@ -63,130 +58,139 @@
import { import {
ConnectMaintainList, ConnectMaintainList,
ConnectMaintainDelete, ConnectMaintainDelete,
ConnectMaintainDeleteAll, ConnectMaintainDeleteAll
} from "../api"; } from '../api'
import { ConnectStatusEnum } from "@/const/index"; import { ConnectStatusEnum } from '@/const/index'
import search from "./components/search.vue"; import search from './components/search.vue'
import download from "@/utils/download"; import download from '@/utils/download'
import { exportConnectMaintainHistory } from "@/api/export"; import { exportConnectMaintainHistory } from '@/api/export'
import { successAlert, warningAlert } from "@/utils/alert"; import { successAlert, warningAlert } from '@/utils/alert'
import { mapState } from 'vuex'
export default { export default {
components: {
search
},
data() { data() {
return { return {
multipleSelection: [], multipleSelection: [],
ConnectStatusEnum, ConnectStatusEnum,
params: { params: {
current: 1, current: 1,
size: 10, size: 10
}, },
total: 14, total: 14,
tableData: [], tableData: [],
isQuery: false, isQuery: false,
istrue: 0, istrue: 0,
searchOption: {}, searchOption: {},
exids: [], exids: []
}; }
}, },
components: { computed: {
search, ...mapState('user', ['userBaseInfo']),
isPermit() {
if (this.userBaseInfo.userId === 1) {
return false
} else {
return true
}
}
},
mounted() {
this.getTableData()
}, },
methods: { methods: {
handleSelectionChange(val) { handleSelectionChange(val) {
let deleteIds = val.map((item) => item.id); let deleteIds = val.map((item) => item.id)
this.multipleSelection = deleteIds; this.multipleSelection = deleteIds
}, },
handlePageChange(pageData) { handlePageChange(pageData) {
this.params.size = pageData.size; this.params.size = pageData.size
this.params.current = pageData.page; this.params.current = pageData.page
this.getTableData(); this.getTableData()
}, },
refresh() { refresh() {
this.$refs.reset != undefined this.$refs.reset !== undefined
? this.$refs.reset.reset() ? this.$refs.reset.reset()
: this.getTableData(); : this.getTableData()
}, },
search(option) { search(option) {
this.istrue = 1; this.istrue = 1
this.searchOption = option; this.searchOption = option
this.getTableData(); this.getTableData()
}, },
getTableData() { getTableData() {
let params = { let params = {
...this.params, ...this.params,
...this.searchOption, ...this.searchOption
}; }
ConnectMaintainList(params).then((res) => { ConnectMaintainList(params).then((res) => {
let list = res.records || []; let list = res.records || []
list.forEach((item) => { list.forEach((item) => {
item.pointConnectStatus_text = item.pointConnectStatus_text =
this.ConnectStatusEnum[item.pointConnectStatus]; this.ConnectStatusEnum[item.pointConnectStatus]
}); })
this.tableData = list; this.tableData = list
this.total = res.total; this.total = res.total
this.exids = list.map((i) => i.id); this.exids = list.map((i) => i.id)
if (this.istrue == 1) { if (this.istrue === 1) {
if (this.tableData.length != 0) { if (this.tableData.length !== 0) {
successAlert("操作成功"); successAlert('操作成功')
} else { } else {
warningAlert("查询结果为空"); warningAlert('查询结果为空')
} }
this.istrue = 0; this.istrue = 0
} }
}); })
}, },
toDelete() { toDelete() {
ConnectMaintainDelete({ ids: this.multipleSelection }).then((res) => { ConnectMaintainDelete({ ids: this.multipleSelection }).then((res) => {
this.$message.success("删除成功!"); this.$message.success('删除成功!')
this.getTableData(); this.getTableData()
}); })
}, },
delAll() { delAll() {
this.$confirm('继续操作将永久删除, 是否继续?', '提示', { this.$confirm('继续操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
ConnectMaintainDeleteAll().then((res) => { ConnectMaintainDeleteAll().then((res) => {
this.$message.success("清空成功!"); this.$message.success('清空成功!')
this.getTableData(); this.getTableData()
}); })
}).catch(() => { }).catch(() => {
warningAlert("取消删除") warningAlert('取消删除')
}); })
}, },
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
if ( if (
row.pointConnectStatus_text == "连接异常" && row.pointConnectStatus_text === '连接异常' &&
column.label == "连接状态" column.label === '连接状态'
) { ) {
return "emergency"; return 'emergency'
} else if ( } else if (
row.pointConnectStatus_text == "连接正常" && row.pointConnectStatus_text === '连接正常' &&
column.label == "连接状态" column.label === '连接状态'
) { ) {
return "normal"; return 'normal'
} }
if (rowIndex % 2 == 1) { if (rowIndex % 2 === 1) {
return "stripe"; return 'stripe'
} }
}, },
toExport() { toExport() {
if (this.exids.length == 0) { if (this.exids.length === 0) {
this.$message.warning("暂无数据"); this.$message.warning('暂无数据')
return false; return false
} else { } else {
exportConnectMaintainHistory({ ids: this.exids }).then((res) => { exportConnectMaintainHistory({ ids: this.exids }).then((res) => {
download(res, "vnd.ms-excel", `设备连接维修历史.xls`); download(res, 'vnd.ms-excel', `设备连接维修历史.xls`)
}); })
} }
}, }
}, }
mounted() { }
this.getTableData();
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.leakage-cable { .leakage-cable {
...@@ -204,13 +208,13 @@ export default { ...@@ -204,13 +208,13 @@ export default {
background-color: #eaf1fe; background-color: #eaf1fe;
} }
& ::v-deep .emergency { & ::v-deep .emergency {
background-color: #f00; background-color: #f00 !important;
} }
& ::v-deep .important { & ::v-deep .important {
background-color: #f89850; background-color: #f89850 !important;
} }
& ::v-deep .normal { & ::v-deep .normal {
background-color: green; background-color: green !important;
} }
.page { .page {
...@@ -223,4 +227,4 @@ export default { ...@@ -223,4 +227,4 @@ export default {
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -2,23 +2,22 @@ ...@@ -2,23 +2,22 @@
<div class="leakage-cable"> <div class="leakage-cable">
<!-- 设备连接状态 --> <!-- 设备连接状态 -->
<div class="leakage-top"> <div class="leakage-top">
<div style="color: #666666"></div> <div style="color: #666666" />
<div class="operate-btn"> <div class="operate-btn">
<delids :multipleSelection2="multipleSelection" @del="toDelete" <delids :multipleSelection2="multipleSelection" @del="toDelete">删除</delids>
>删除</delids
>
<el-button type="primary" @click="refresh">刷新</el-button> <el-button type="primary" @click="refresh">刷新</el-button>
<el-button type="primary" @click="isQuery = !isQuery">查询</el-button> <el-button type="primary" @click="isQuery = !isQuery">查询</el-button>
<el-button type="primary" @click="toExport">导出</el-button> <el-button type="primary" @click="toExport">导出</el-button>
<el-button type="primary" @click="delAll">清空数据</el-button> <el-button :type="isPermit==false ? 'primary' : 'info'" :disabled="isPermit" @click="delAll">清空数据</el-button>
</div> </div>
</div> </div>
<div v-if="isQuery"> <div v-if="isQuery">
<search @search="search" ref="reset" /> <search ref="reset" @search="search" />
</div> </div>
<el-table <el-table
:data="tableData" :data="tableData"
style="width: 100%" style="width: 100%"
height="calc(88vh - 150px)"
:cell-class-name="cellClassFn" :cell-class-name="cellClassFn"
:header-cell-style="{ background: '#EAF1FE', color: '#666666' }" :header-cell-style="{ background: '#EAF1FE', color: '#666666' }"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
...@@ -34,14 +33,12 @@ ...@@ -34,14 +33,12 @@
label="连接状态" label="连接状态"
width="150" width="150"
align="center" align="center"
> />
</el-table-column>
<el-table-column <el-table-column
prop="endPointDeviceName" prop="endPointDeviceName"
label="网元设备" label="网元设备"
align="center" align="center"
> />
</el-table-column>
<el-table-column prop="uploadTime" label="上传时间" align="center" /> <el-table-column prop="uploadTime" label="上传时间" align="center" />
<el-table-column prop="cancelTime" label="取消时间" align="center" /> <el-table-column prop="cancelTime" label="取消时间" align="center" />
<el-table-column <el-table-column
...@@ -63,14 +60,19 @@ ...@@ -63,14 +60,19 @@
import { import {
ConnectStatusList, ConnectStatusList,
ConnectStatusDelete, ConnectStatusDelete,
ConnectStatusDeleteAll, ConnectStatusDeleteAll
} from "../api"; } from '../api'
import { ConnectStatusEnum } from "@/const/index"; import { ConnectStatusEnum } from '@/const/index'
import search from "./components/search.vue"; import search from './components/search.vue'
import { exportConnectStatusHistory } from "@/api/export"; import { exportConnectStatusHistory } from '@/api/export'
import download from "@/utils/download"; import download from '@/utils/download'
import { successAlert, warningAlert } from "@/utils/alert"; import { successAlert, warningAlert } from '@/utils/alert'
import { mapState } from 'vuex'
export default { export default {
components: {
search
},
props: [], props: [],
data() { data() {
return { return {
...@@ -78,115 +80,121 @@ export default { ...@@ -78,115 +80,121 @@ export default {
ConnectStatusEnum, ConnectStatusEnum,
params: { params: {
current: 1, current: 1,
size: 10, size: 10
}, },
total: 10, total: 10,
tableData: [], tableData: [],
isQuery: false, isQuery: false,
istrue: 0, istrue: 0,
searchOption: {}, searchOption: {},
exids: [], exids: []
}; }
}, },
components: { computed: {
search, ...mapState('user', ['userBaseInfo']),
isPermit() {
if (this.userBaseInfo.userId === 1) {
return false
} else {
return true
}
}
},
mounted() {
this.getTableData()
}, },
methods: { methods: {
handleSelectionChange(val) { handleSelectionChange(val) {
let deleteIds = val.map((item) => item.id); let deleteIds = val.map((item) => item.id)
this.multipleSelection = deleteIds; this.multipleSelection = deleteIds
}, },
handlePageChange(pageData) { handlePageChange(pageData) {
this.params.size = pageData.size; this.params.size = pageData.size
this.params.current = pageData.page; this.params.current = pageData.page
this.getTableData(); this.getTableData()
}, },
refresh() { refresh() {
this.$refs.reset != undefined this.$refs.reset !== undefined
? this.$refs.reset.reset() ? this.$refs.reset.reset()
: this.getTableData(); : this.getTableData()
}, },
search(option) { search(option) {
this.istrue = 1; this.istrue = 1
this.searchOption = option; this.searchOption = option
this.getTableData(); this.getTableData()
}, },
getTableData() { getTableData() {
let params = { let params = {
...this.params, ...this.params,
...this.searchOption, ...this.searchOption
}; }
ConnectStatusList(params).then((res) => { ConnectStatusList(params).then((res) => {
let list = res.records || []; let list = res.records || []
list.forEach((item) => { list.forEach((item) => {
item.pointConnectStatus_text = item.pointConnectStatus_text =
this.ConnectStatusEnum[item.pointConnectStatus]; this.ConnectStatusEnum[item.pointConnectStatus]
}); })
this.tableData = list; this.tableData = list
this.total = res.total; this.total = res.total
this.exids = list.map((i) => i.id); this.exids = list.map((i) => i.id)
if (this.istrue == 1) { if (this.istrue === 1) {
if (this.tableData.length != 0) { if (this.tableData.length !== 0) {
successAlert("操作成功"); successAlert('操作成功')
} else { } else {
warningAlert("查询结果为空"); warningAlert('查询结果为空')
} }
this.istrue = 0; this.istrue = 0
} }
}); })
}, },
toDelete() { toDelete() {
ConnectStatusDelete({ ids: this.multipleSelection }).then((res) => { ConnectStatusDelete({ ids: this.multipleSelection }).then((res) => {
this.$message.success("删除成功!"); this.$message.success('删除成功!')
this.getTableData(); this.getTableData()
}); })
}, },
delAll() { delAll() {
this.$confirm('继续操作将永久删除, 是否继续?', '提示', { this.$confirm('继续操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
ConnectStatusDeleteAll().then((res)=>{ ConnectStatusDeleteAll().then((res) => {
this.$message.success("清空成功!"); this.$message.success('清空成功!')
this.getTableData(); this.getTableData()
}); })
}).catch(() => { }).catch(() => {
warningAlert("取消删除") warningAlert('取消删除')
}); })
}, },
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
if ( if (
row.pointConnectStatus_text == "连接异常" && row.pointConnectStatus_text === '连接异常' &&
column.label == "连接状态" column.label === '连接状态'
) { ) {
return "emergency"; return 'emergency'
} else if ( } else if (
row.pointConnectStatus_text == "连接正常" && row.pointConnectStatus_text === '连接正常' &&
column.label == "连接状态" column.label === '连接状态'
) { ) {
return "normal"; return 'normal'
} }
if (rowIndex % 2 == 1) { if (rowIndex % 2 === 1) {
return "stripe"; return 'stripe'
} }
}, },
toExport() { toExport() {
if (this.exids.length == 0) { if (this.exids.length === 0) {
this.$message.warning("暂无数据"); this.$message.warning('暂无数据')
return false; return false
} else { } else {
exportConnectStatusHistory({ ids: this.exids }).then((res) => { exportConnectStatusHistory({ ids: this.exids }).then((res) => {
download(res, "vnd.ms-excel", `设备连接历史状态.xls`); download(res, 'vnd.ms-excel', `设备连接历史状态.xls`)
}); })
} }
}, }
}, }
mounted() { }
this.getTableData();
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.leakage-cable { .leakage-cable {
...@@ -204,13 +212,13 @@ export default { ...@@ -204,13 +212,13 @@ export default {
background-color: #eaf1fe; background-color: #eaf1fe;
} }
& ::v-deep .emergency { & ::v-deep .emergency {
background-color: #f00; background-color: #f00!important;
} }
& ::v-deep .important { & ::v-deep .important {
background-color: #f89850; background-color: #f89850!important;
} }
& ::v-deep .normal { & ::v-deep .normal {
background-color: green; background-color: green!important;
} }
.page { .page {
......
...@@ -4,19 +4,18 @@ ...@@ -4,19 +4,18 @@
<div class="leakage-top"> <div class="leakage-top">
<div style="color: #666666"></div> <div style="color: #666666"></div>
<div class="operate-btn"> <div class="operate-btn">
<delids :multipleSelection2="multipleSelection" @del="deleteCable" <delids :multipleSelection2="multipleSelection" @del="deleteCable">删除</delids>
>删除</delids
>
<el-button type="primary" @click="refresh">刷新</el-button> <el-button type="primary" @click="refresh">刷新</el-button>
<el-button type="primary" @click="isQuery = !isQuery">查询</el-button> <el-button type="primary" @click="isQuery = !isQuery">查询</el-button>
<el-button type="primary" @click="toExport">导出</el-button> <el-button type="primary" @click="toExport">导出</el-button>
</div> </div>
</div> </div>
<div v-if="isQuery"> <div v-if="isQuery">
<search @search="search" ref="reset" /> <search ref="reset" @search="search" />
</div> </div>
<el-table <el-table
:data="tableData" :data="tableData"
height="calc(88vh - 150px)"
style="width: 100%" style="width: 100%"
:cell-class-name="cellClassFn" :cell-class-name="cellClassFn"
:header-cell-style="{ background: '#EAF1FE', color: '#666666' }" :header-cell-style="{ background: '#EAF1FE', color: '#666666' }"
...@@ -41,10 +40,8 @@ ...@@ -41,10 +40,8 @@
label="告警级别" label="告警级别"
width="150" width="150"
align="center" align="center"
> />
</el-table-column> <el-table-column prop="alarmInfo" label="告警信息" align="center"/>
<el-table-column prop="alarmInfo" label="告警信息" align="center">
</el-table-column>
<el-table-column <el-table-column
prop="alarmMaintainTime" prop="alarmMaintainTime"
label="告警维修时间" label="告警维修时间"
...@@ -61,104 +58,104 @@ ...@@ -61,104 +58,104 @@
</div> </div>
</template> </template>
<script> <script>
import { MonitorMaintainList, MonitorMaintainDelete } from "../api"; import { MonitorMaintainList, MonitorMaintainDelete } from '../api'
import search from "./components/search.vue"; import search from './components/search.vue'
import download from "@/utils/download"; import download from '@/utils/download'
import { exportLeakyMaintainHistory } from "@/api/export"; import { exportLeakyMaintainHistory } from '@/api/export'
import { successAlert, warningAlert } from "@/utils/alert"; import { successAlert, warningAlert } from '@/utils/alert'
export default { export default {
components: {
search
},
props: [], props: [],
data() { data() {
return { return {
multipleSelection: [], multipleSelection: [],
params: { params: {
current: 1, current: 1,
size: 10, size: 10
}, },
total: 10, total: 10,
tableData: [], tableData: [],
isQuery: false, isQuery: false,
istrue:0, istrue: 0,
searchOption: {}, searchOption: {},
exids: [], exids: []
}; }
}, },
components: { mounted() {
search, this.getTableData()
}, },
methods: { methods: {
handleSelectionChange(val) { handleSelectionChange(val) {
let deleteIds = val.map((item) => item.id); let deleteIds = val.map((item) => item.id)
this.multipleSelection = deleteIds; this.multipleSelection = deleteIds
}, },
handlePageChange(pageData) { handlePageChange(pageData) {
this.params.size = pageData.size; this.params.size = pageData.size
this.params.current = pageData.page; this.params.current = pageData.page
this.getTableData(); this.getTableData()
}, },
refresh() { refresh() {
this.$refs.reset != undefined this.$refs.reset !== undefined
? this.$refs.reset.reset() ? this.$refs.reset.reset()
: this.getTableData(); : this.getTableData()
}, },
search(option){ search(option) {
this.istrue=1 this.istrue = 1
this.searchOption = option this.searchOption = option
this.getTableData() this.getTableData()
}, },
getTableData() { getTableData() {
let params = { let params = {
...this.params, ...this.params,
...this.searchOption, ...this.searchOption
}; }
MonitorMaintainList(params).then((res) => { MonitorMaintainList(params).then((res) => {
let list = res.records || []; let list = res.records || []
this.tableData = list; this.tableData = list
this.total = res.total; this.total = res.total
this.exids = list.map((i) => i.id); this.exids = list.map((i) => i.id)
if (this.istrue==1) { if (this.istrue === 1) {
if (this.tableData.length != 0) { if (this.tableData.length !== 0) {
successAlert("操作成功"); successAlert('操作成功')
} else { } else {
warningAlert("查询结果为空"); warningAlert('查询结果为空')
} }
this.istrue=0 this.istrue = 0
} }
}); })
}, },
deleteCable() { deleteCable() {
MonitorMaintainDelete({ ids: this.multipleSelection }).then((res) => { MonitorMaintainDelete({ ids: this.multipleSelection }).then((res) => {
this.$message.success("删除成功!"); this.$message.success('删除成功!')
this.getTableData(); this.getTableData()
}); })
}, },
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
if (row.alarmLevelName == "紧急" && column.label == "告警级别") { if (row.alarmLevelName === '紧急' && column.label === '告警级别') {
return "emergency"; return 'emergency'
} else if (row.alarmLevelName == "重要" && column.label == "告警级别") { } else if (row.alarmLevelName === '重要' && column.label === '告警级别') {
return "important"; return 'important'
} else if (row.alarmLevelName == "一般" && column.label == "告警级别") { } else if (row.alarmLevelName === '一般' && column.label === '告警级别') {
return "common"; return 'common'
} }
if (rowIndex % 2 == 1) { if (rowIndex % 2 === 1) {
return "stripe"; return 'stripe'
} }
}, },
toExport() { toExport() {
if (this.exids.length == 0) { if (this.exids.length === 0) {
this.$message.warning("暂无数据"); this.$message.warning('暂无数据')
return false; return false
} else { } else {
exportLeakyMaintainHistory({ ids: this.exids }).then((res) => { exportLeakyMaintainHistory({ ids: this.exids }).then((res) => {
download(res, "vnd.ms-excel", `漏缆监测维修历史.xls`); download(res, 'vnd.ms-excel', `漏缆监测维修历史.xls`)
}); })
} }
}, }
}, }
mounted() { }
this.getTableData();
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.leakage-cable { .leakage-cable {
......
...@@ -69,109 +69,101 @@ ...@@ -69,109 +69,101 @@
class="loginbtn" class="loginbtn"
style="width: 100%; margin-top: 30px; margin-bottom: 30px" style="width: 100%; margin-top: 30px; margin-bottom: 30px"
@click.native.prevent="handleLogin" @click.native.prevent="handleLogin"
>登录</el-button >登录</el-button>
>
</el-form> </el-form>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { login } from "@/api/user"; import { login } from '@/api/user'
import { setToken, setUserName } from "@/utils/auth"; import { setToken, setUserName } from '@/utils/auth'
import EventBus from "@/utils/bus";
export default { export default {
name: "Login", name: 'Login',
data() { data() {
const validatePassword = (rule, value, callback) => { const validatePassword = (rule, value, callback) => {
if (value.length < 6) { if (value.length < 6) {
callback(new Error("密码不能少于6位")); callback(new Error('密码不能少于6位'))
} else { } else {
callback(); callback()
} }
}; }
return { return {
loginForm: { loginForm: {
username: "", username: '',
password: "", password: ''
}, },
loginRules: { loginRules: {
username: [ username: [
{ required: true, trigger: "blur", message: "请输入用户名" }, { required: true, trigger: 'blur', message: '请输入用户名' }
], ],
password: [ password: [
{ required: true, trigger: "blur", validator: validatePassword }, { required: true, trigger: 'blur', validator: validatePassword }
], ]
}, },
loading: false, loading: false,
passwordType: "password", passwordType: 'password',
redirect: undefined, redirect: undefined
}; }
}, },
watch: { watch: {
$route: { $route: {
handler: function (route) { handler: function(route) {
this.redirect = route.query && route.query.redirect; this.redirect = route.query && route.query.redirect
}, },
immediate: true, immediate: true
}, }
}, },
created() { created() {
var that = this; var that = this
document.onkeydown = function (e) { document.onkeydown = function(e) {
var key = window.event.keyCode; var key = window.event.keyCode
if (key == 13) { if (key === 13) {
that.handleLogin(); that.handleLogin()
} }
}; }
}, },
methods: { methods: {
showPwd() { showPwd() {
if (this.passwordType === "password") { if (this.passwordType === 'password') {
this.passwordType = ""; this.passwordType = ''
} else { } else {
this.passwordType = "password"; this.passwordType = 'password'
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.password.focus(); this.$refs.password.focus()
}); })
}, },
async toLogin() { async toLogin() {
const { username, password } = this.loginForm; const { username, password } = this.loginForm
let { token } = await login( const { token, userId } = await login(
{ {
userName: username, userName: username,
password: password, password: password
}, },
{ {
el: ".el-button", el: '.el-button'
} }
); )
if (!token) return; if (!token) return
this.$store.commit("user/SET_TOKEN", token); this.$store.commit('user/SET_TOKEN', token)
setToken(token); this.$store.commit('user/SET_USERID', userId)
this.$router.push({ path: "/" }); setToken(token)
// setTimeout(() => { this.$router.push({ path: '/' })
// location.reload()
// }, 10)
}, },
handleLogin() { handleLogin() {
this.$refs.loginForm.validate((valid) => { this.$refs.loginForm.validate((valid) => {
if (valid) { if (valid) {
setUserName(this.loginForm.username); setUserName(this.loginForm.username)
this.toLogin()
this.toLogin();
// EventBus.$emit('wsOpen')
} else { } else {
console.log("error submit!!"); return false
return false;
} }
}); })
}, }
}, }
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</div> </div>
</div> </div>
<div v-if="isQuery"> <div v-if="isQuery">
<search @search="search" ref="reset" /> <search ref="reset" @search="search" />
</div> </div>
<el-table <el-table
:data="tableData" :data="tableData"
...@@ -56,116 +56,116 @@ ...@@ -56,116 +56,116 @@
</template> </template>
<script> <script>
import { DeviceStatusList } from "../api"; import { DeviceStatusList } from '../api'
import { ConnectStatusEnum } from "@/const/index"; import { ConnectStatusEnum } from '@/const/index'
import search from "./components/search.vue"; import search from './components/search.vue'
import download from "@/utils/download"; import download from '@/utils/download'
import { exportConnetTime } from "@/api/export"; import { exportConnetTime } from '@/api/export'
import { successAlert, warningAlert } from "@/utils/alert"; import { successAlert, warningAlert } from '@/utils/alert'
export default { export default {
components: { search },
data() { data() {
return { return {
ConnectStatusEnum, ConnectStatusEnum,
params: { params: {
current: 1, current: 1,
size: 10, size: 10
}, },
total: 10, total: 10,
tableData: [], tableData: [],
isQuery: false, isQuery: false,
istrue:0, istrue: 0,
searchOption: {}, searchOption: {},
exids: [], exids: []
}; }
},
mounted() {
this.getTableData()
}, },
components: { search },
methods: { methods: {
// 表格背景图颜色 // 表格背景图颜色
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
if ( if (
row.startPointConnectStatus_text == "连接正常" && row.startPointConnectStatus_text === '连接正常' &&
column.property == "startPointConnectStatus_text" column.property === 'startPointConnectStatus_text'
) { ) {
return "green"; return 'green'
} }
if ( if (
row.startPointConnectStatus_text == "连接异常" && row.startPointConnectStatus_text === '连接异常' &&
column.property == "startPointConnectStatus_text" column.property === 'startPointConnectStatus_text'
) { ) {
return "red"; return 'red'
} }
if ( if (
row.endPointConnectStatus_text == "连接正常" && row.endPointConnectStatus_text === '连接正常' &&
column.property == "endPointConnectStatus_text" column.property === 'endPointConnectStatus_text'
) { ) {
return "green"; return 'green'
} else if ( } else if (
row.endPointConnectStatus_text == "连接异常" && row.endPointConnectStatus_text === '连接异常' &&
column.property == "endPointConnectStatus_text" column.property === 'endPointConnectStatus_text'
) { ) {
return "red"; return 'red'
} }
if (rowIndex % 2 == 1) { if (rowIndex % 2 === 1) {
return "stripe"; return 'stripe'
} }
}, },
refresh() { refresh() {
this.$refs.reset != undefined this.$refs.reset !== undefined
? this.$refs.reset.reset() ? this.$refs.reset.reset()
: this.getTableData(); : this.getTableData()
}, },
handlePageChange(pageData) { handlePageChange(pageData) {
this.params.size = pageData.size; this.params.size = pageData.size
this.params.current = pageData.page; this.params.current = pageData.page
this.getTableData(); this.getTableData()
}, },
search(option) { search(option) {
this.istrue=1 this.istrue = 1
this.searchOption = option; this.searchOption = option
this.getTableData(); this.getTableData()
}, },
getTableData() { getTableData() {
let params = { let params = {
...this.params, ...this.params,
...this.searchOption, ...this.searchOption
}; }
DeviceStatusList(params).then((res) => { DeviceStatusList(params).then((res) => {
let list = res.records || []; let list = res.records || []
list.forEach((item) => { list.forEach((item) => {
item.startPointConnectStatus_text = item.startPointConnectStatus_text =
this.ConnectStatusEnum[item.startPointConnectStatus]; this.ConnectStatusEnum[item.startPointConnectStatus]
item.endPointConnectStatus_text = item.endPointConnectStatus_text =
this.ConnectStatusEnum[item.endPointConnectStatus]; this.ConnectStatusEnum[item.endPointConnectStatus]
}); })
this.tableData = list; this.tableData = list
this.total = res.total; this.total = res.total
this.exids = list.map((i) => i.id); this.exids = list.map((i) => i.id)
if (this.istrue==1) { if (this.istrue === 1) {
if (this.tableData.length != 0) { if (this.tableData.length !== 0) {
successAlert("操作成功"); successAlert('操作成功')
} else { } else {
warningAlert("查询结果为空"); warningAlert('查询结果为空')
} }
this.istrue=0 this.istrue = 0
} }
}); })
}, },
toExport() { toExport() {
if (this.exids.length == 0) { if (this.exids.length === 0) {
this.$message.warning("暂无数据"); this.$message.warning('暂无数据')
return false; return false
} else { } else {
exportConnetTime({ ids: this.exids }).then((res) => { exportConnetTime({ ids: this.exids }).then((res) => {
download(res, "vnd.ms-excel", `设备实时.xls`); download(res, 'vnd.ms-excel', `设备实时.xls`)
}); })
} }
}, }
}, }
mounted() { }
this.getTableData();
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -183,10 +183,10 @@ export default { ...@@ -183,10 +183,10 @@ export default {
background-color: #eaf1fe; background-color: #eaf1fe;
} }
& ::v-deep .red { & ::v-deep .red {
background-color: #f00; background-color: #f00!important;
} }
& ::v-deep .green { & ::v-deep .green {
background-color: green; background-color: green!important;
} }
.page { .page {
display: flex; display: flex;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<el-table <el-table
:data="tableData" :data="tableData"
style="width: 100%" style="width: 100%"
height="calc(88vh - 150px)"
:cell-class-name="cellClassFn" :cell-class-name="cellClassFn"
:header-cell-style="{ background: '#EAF1FE', color: '#666666' }" :header-cell-style="{ background: '#EAF1FE', color: '#666666' }"
> >
...@@ -36,8 +37,7 @@ ...@@ -36,8 +37,7 @@
label="告警级别" label="告警级别"
width="150" width="150"
align="center" align="center"
> />
</el-table-column>
<el-table-column prop="alarmInfo" label="告警信息" align="center"> <el-table-column prop="alarmInfo" label="告警信息" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="(item, index) in scope.row.alarmInfo" :key="index" :class="levelStyle[item.level]"> <div v-for="(item, index) in scope.row.alarmInfo" :key="index" :class="levelStyle[item.level]">
...@@ -64,103 +64,103 @@ ...@@ -64,103 +64,103 @@
</template> </template>
<script> <script>
import { CableStatusList } from "../api"; import { CableStatusList } from '../api'
import { ConnectStatusEnum, levelStyle} from "@/const/index"; import { ConnectStatusEnum, levelStyle } from '@/const/index'
import search from "./components/search.vue"; import search from './components/search.vue'
import { exportLeakyCableTime } from "@/api/export"; import { exportLeakyCableTime } from '@/api/export'
import download from "@/utils/download"; import download from '@/utils/download'
import { successAlert, warningAlert } from "@/utils/alert"; import { successAlert, warningAlert } from '@/utils/alert'
export default { export default {
components: { search },
data() { data() {
return { return {
ConnectStatusEnum, ConnectStatusEnum,
levelStyle, levelStyle,
params: { params: {
curent: 1, curent: 1,
size: 10, size: 10
}, },
total: 10, total: 10,
tableData: [], tableData: [],
isQuery: false, isQuery: false,
istrue:0, istrue: 0,
searchOption: {}, searchOption: {},
exids: [], exids: []
}; }
},
mounted() {
this.getTableData();
}, },
components: { search },
methods: { methods: {
// 表格背景图颜色 // 表格背景图颜色
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
if (row.alarmLevelName == "紧急" && column.label == "告警级别") { if (row.alarmLevelName === '紧急' && column.label === '告警级别') {
return "emergency"; return 'emergency'
} else if (row.alarmLevelName == "重要" && column.label == "告警级别") { } else if (row.alarmLevelName === '重要' && column.label === '告警级别') {
return "important"; return 'important'
} else if (row.alarmLevelName == "一般" && column.label == "告警级别") { } else if (row.alarmLevelName === '一般' && column.label === '告警级别') {
return "common"; return 'common'
} else if (row.alarmLevelName == "正常" && column.label == "告警级别") { } else if (row.alarmLevelName === '正常' && column.label === '告警级别') {
return "normal" return 'normal'
} }
if (rowIndex % 2 == 1) { if (rowIndex % 2 === 1) {
return "stripe"; return 'stripe'
} }
}, },
refresh() { refresh() {
this.searchOption = {}; this.searchOption = {}
this.$refs.reset != undefined this.$refs.reset !== undefined
? this.$refs.reset.reset() ? this.$refs.reset.reset()
: this.getTableData(); : this.getTableData()
}, },
handlePageChange(pageData) { handlePageChange(pageData) {
this.params.size = pageData.size this.params.size = pageData.size
this.params.curent = pageData.page this.params.curent = pageData.page
this.getTableData(); this.getTableData()
}, },
search(option) { search(option) {
this.istrue=1 this.istrue = 1
this.searchOption = option this.searchOption = option
this.getTableData(); this.getTableData()
}, },
getTableData() { getTableData() {
let params = { let params = {
...this.params, ...this.params,
...this.searchOption, ...this.searchOption,
}; }
CableStatusList(params).then((res) => { CableStatusList(params).then((res) => {
let list = res.records || []; let list = res.records || []
this.tableData = list; this.tableData = list
list.forEach(item => { list.forEach(item => {
if(item.alarmInfo != '' && item.alarmInfo != null) { if (item.alarmInfo !== '' && item.alarmInfo != null) {
item.alarmInfo = JSON.parse(item.alarmInfo) item.alarmInfo = JSON.parse(item.alarmInfo)
item.lossValue = eval(item.alarmInfo.map(k => k.lossValue).join('+')) item.lossValue = eval(item.alarmInfo.map(k => k.lossValue).join('+'))
} }
}); })
this.total = res.records.length; this.total = res.records.length
this.exids = list.map(i => i.id); this.exids = list.map(i => i.id)
if (this.istrue==1) { if (this.istrue === 1) {
if (this.tableData.length != 0) { if (this.tableData.length !== 0) {
successAlert("操作成功"); successAlert('操作成功')
} else { } else {
warningAlert("查询结果为空"); warningAlert('查询结果为空')
} }
this.istrue=0 this.istrue = 0
} }
}); })
}, },
toExport() { toExport() {
if (this.exids.length == 0) { if (this.exids.length === 0) {
this.$message.warning("暂无数据"); this.$message.warning('暂无数据')
return false; return false
} else { } else {
exportLeakyCableTime({ ids: this.exids }).then((res) => { exportLeakyCableTime({ ids: this.exids }).then((res) => {
download(res, "vnd.ms-excel", `漏缆实时.xls`); download(res, 'vnd.ms-excel', `漏缆实时.xls`)
}); })
} }
}, }
}, }
mounted() { }
this.getTableData();
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -190,16 +190,16 @@ export default { ...@@ -190,16 +190,16 @@ export default {
background-color: #eaf1fe; background-color: #eaf1fe;
} }
& ::v-deep .emergency { & ::v-deep .emergency {
background-color: #f00; background-color: #f00!important;
} }
& ::v-deep .important { & ::v-deep .important {
background-color: #f89850; background-color: #f89850!important;
} }
& ::v-deep .common { & ::v-deep .common {
background-color: #ead906; background-color: #ead906!important;
} }
& ::v-deep .normal { & ::v-deep .normal {
background-color: green; background-color: green!important;
} }
.page { .page {
display: flex; display: flex;
......
...@@ -122,8 +122,6 @@ ...@@ -122,8 +122,6 @@
import { fsusave, selectFsuItem, selectForSite, railWaylist } from "../../api"; import { fsusave, selectFsuItem, selectForSite, railWaylist } from "../../api";
import { successAlert, warningAlert } from "@/utils/alert"; import { successAlert, warningAlert } from "@/utils/alert";
export default { export default {
props: [],
components: {},
data() { data() {
return { return {
type: 1, type: 1,
...@@ -137,53 +135,63 @@ export default { ...@@ -137,53 +135,63 @@ export default {
FSUForm: formInit(), FSUForm: formInit(),
params: { params: {
current: 1, current: 1,
size: 10, size: 10
}, },
rules: { rules: {
wayId: [{ required: true, message: "请选择铁路线", trigger: "blur" }], wayId: [{ required: true, message: "请选择铁路线", trigger: "blur" }],
siteId: [{ required: true, message: "请选择站点", trigger: "blur" }], siteId: [{ required: true, message: "请选择站点", trigger: "blur" }],
fsuCode: [ fsuCode: [
{ required: true, message: "请输入FSU身份编号", trigger: "blur" }, { required: true, message: "请输入FSU身份编号", trigger: "blur" }
], ],
fsuPort: [ fsuPort: [
{ required: true, pattern : /^(([^0][0-9]+|0)$)|^(([1-9]+)$)/, message: "请输入FSU端口数", trigger: "blur" }, { required: true, pattern: /^(([^0][0-9]+|0)$)|^(([1-9]+)$)/, message: "请输入FSU端口数", trigger: "blur" }
], ],
equipName: [ equipName: [
{ required: true, message: "请输入设备名称", trigger: "blur" }, { required: true, message: "请输入设备名称", trigger: "blur" }
], ],
ip: [{ required: true, pattern : /^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.((1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.){2}(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$/ , message: "请输入正确的IP地址", trigger: "blur" }], ip: [{ required: true, pattern: /^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.((1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.){2}(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$/, message: "请输入正确的IP地址", trigger: "blur" }],
equipFactory: [ equipFactory: [
{ required: true, message: "请输入设备厂商", trigger: "blur" }, { required: true, message: "请输入设备厂商", trigger: "blur" }
], ],
backupMode: [ backupMode: [
{ required: true, message: "请选择设备备用方式", trigger: "blur" }, { required: true, message: "请选择设备备用方式", trigger: "blur" }
], ],
connectMode: [ connectMode: [
{ required: true, message: "请选择通信方式", trigger: "blur" }, { required: true, message: "请选择通信方式", trigger: "blur" }
], ],
equipType: [ equipType: [
{ required: true, message: "请选择设备类型", trigger: "blur" }, { required: true, message: "请选择设备类型", trigger: "blur" }
], ],
equipSubType: [ equipSubType: [
{ required: true, message: "请选择设备子类型", trigger: "blur" }, { required: true, message: "请选择设备子类型", trigger: "blur" }
], ],
softVersion: [ softVersion: [
{ required: true, message: "请输入软件版本号", trigger: "blur" }, { required: true, message: "请输入软件版本号", trigger: "blur" }
], ],
equipSerialNumber: [ equipSerialNumber: [
{ required: true, message: "请输入设备生产序列号", trigger: "blur" }, { required: true, message: "请输入设备生产序列号", trigger: "blur" }
], ],
kmSign: [ kmSign: [
{ {
required: true, required: true,
message: "请输入设备所在铁路公里标", message: "请输入设备所在铁路公里标",
trigger: "blur", trigger: "blur"
}, }
], ]
}, }
}; }
},
created() {
selectFsuItem().then((res) => {
this.backupModeSelect = res["01"]
this.connectModeSelect = res["02"]
this.equipTypeSelect = res["03"]
this.equipSubTypeSelect = res["04"]
})
},
mounted() {
this.getAllWay()
}, },
computed: {},
methods: { methods: {
changerailWay() { changerailWay() {
selectForSite({ wayId: this.FSUForm.wayId }).then((res) => { selectForSite({ wayId: this.FSUForm.wayId }).then((res) => {
...@@ -192,55 +200,40 @@ export default { ...@@ -192,55 +200,40 @@ export default {
}, },
readNodes(aaa = [], arrarea = []) { readNodes(aaa = [], arrarea = []) {
for (let item of aaa) { for (let item of aaa) {
arrarea.push({ id: item.id, siteName: item.name }); arrarea.push({ id: item.id, siteName: item.name })
if (item.children) { if (item.children) {
this.readNodes(item.children, arrarea); this.readNodes(item.children, arrarea)
} }
} }
return arrarea; return arrarea
}, },
reset() { reset() {
this.$refs.FSUForm.resetFields(); this.$refs.FSUForm.resetFields()
}, },
submit() { submit() {
this.$refs.FSUForm.validate((valid) => { this.$refs.FSUForm.validate((valid) => {
if (valid) { if (valid) {
this.FSUForm.parentId = this.FSUForm.siteId; this.FSUForm.parentId = this.FSUForm.siteId
this.FSUForm.fsuPort = Number(this.FSUForm.fsuPort); this.FSUForm.fsuPort = Number(this.FSUForm.fsuPort)
fsusave(this.FSUForm).then((res) => { fsusave(this.FSUForm).then((res) => {
if (res.code == 200) { successAlert('操作成功')
successAlert("添加成功"); })
} else {
warningAlert("添加失败");
}
});
} }
this.FSUForm = formInit(); this.FSUForm = formInit()
}); })
}, },
getAllWay() { getAllWay() {
railWaylist(this.params).then((res) => { railWaylist(this.params).then((res) => {
this.railWaySelect = res.records; this.railWaySelect = res.records || []
if (res.total > this.params.size) { if (res.total > this.params.size) {
this.params.size = res.total; this.params.size = res.total
this.getAllWay(); this.getAllWay()
} }
}); })
}, }
}, }
created() { }
selectFsuItem().then((res) => {
this.backupModeSelect = res["01"];
this.connectModeSelect = res["02"];
this.equipTypeSelect = res["03"];
this.equipSubTypeSelect = res["04"];
});
},
mounted() {
this.getAllWay();
},
};
function formInit(data = {}) { function formInit(data = {}) {
return { return {
parentId: "", parentId: "",
...@@ -258,7 +251,7 @@ function formInit(data = {}) { ...@@ -258,7 +251,7 @@ function formInit(data = {}) {
equipSerialNumber: "", equipSerialNumber: "",
kmSign: "", kmSign: "",
...data, ...data,
}; }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -268,10 +261,7 @@ function formInit(data = {}) { ...@@ -268,10 +261,7 @@ function formInit(data = {}) {
margin: 0 auto; margin: 0 auto;
} }
.btn { .btn {
padding-top: 50px; padding: 20px 0 50px 0;
text-align: center; text-align: center;
button {
width: 120px;
}
} }
</style> </style>
\ No newline at end of file
...@@ -285,10 +285,7 @@ function formInit(data = {}) { ...@@ -285,10 +285,7 @@ function formInit(data = {}) {
margin: 0 auto; margin: 0 auto;
} }
.btn { .btn {
padding-top: 50px; padding: 20px 0 50px 0;
text-align: center; text-align: center;
button {
width: 120px;
}
} }
</style> </style>
\ No newline at end of file
...@@ -274,10 +274,7 @@ function formInit(data = {}) { ...@@ -274,10 +274,7 @@ function formInit(data = {}) {
margin: 0 auto; margin: 0 auto;
} }
.btn { .btn {
padding-top: 50px; padding: 20px 0 50px 0;
text-align: center; text-align: center;
button {
width: 120px;
}
} }
</style> </style>
\ No newline at end of file
...@@ -99,10 +99,8 @@ function formInit(data = {}) { ...@@ -99,10 +99,8 @@ function formInit(data = {}) {
margin: 0 auto; margin: 0 auto;
} }
.btn { .btn {
padding-top: 50px;
text-align: center; text-align: center;
button { padding: 20px 0 50px 0;
width: 120px;
}
} }
</style> </style>
\ No newline at end of file
...@@ -187,10 +187,7 @@ function formInit(data = {}) { ...@@ -187,10 +187,7 @@ function formInit(data = {}) {
margin: 0 auto; margin: 0 auto;
} }
.btn { .btn {
padding-top: 50px;
text-align: center; text-align: center;
button { padding: 20px 0 50px 0;
width: 120px;
}
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="add"> <div class="add">
<div class="add-tab"> <div class="add-tab">
<el-tabs v-model="activeName" :stretc="true" @tab-click="handleClick"> <el-tabs v-model="activeName" :stretc="true">
<el-tab-pane label="铁路线" name="0"> <el-tab-pane label="铁路线" name="0">
<div class="content" v-if="activeName === '0'"> <div v-if="activeName === '0'" class="content">
<div class="content-title">添加铁路线</div> <div class="content-title">添加铁路线</div>
<railWay></railWay> <railWay />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="站点" name="1"> <el-tab-pane label="站点" name="1">
<div class="content" v-if="activeName === '1'"> <div v-if="activeName === '1'" class="content">
<div class="content-title">添加站点</div> <div class="content-title">添加站点</div>
<station></station> <station />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="FSU" name="2"> <el-tab-pane label="FSU" name="2">
<div class="content" v-if="activeName === '2'"> <div v-if="activeName === '2'" class="content">
<div class="content-title">添加FSU</div> <div class="content-title">添加FSU</div>
<FSU></FSU> <FSU />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="监测设备" name="3"> <el-tab-pane label="监测设备" name="3">
<div class="content" v-if="activeName === '3'"> <div v-if="activeName === '3'" class="content">
<div class="content-title">添加监测设备</div> <div class="content-title">添加监测设备</div>
<monitorEquip></monitorEquip> <monitorEquip />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="漏缆" name="4"> <el-tab-pane label="漏缆" name="4">
<div class="content" v-if="activeName === '4'"> <div v-if="activeName === '4'" class="content">
<div class="content-title">添加漏缆</div> <div class="content-title">添加漏缆</div>
<leakyCable></leakyCable> <leakyCable />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="天馈线" name="5"> <el-tab-pane label="天馈线" name="5">
<div class="content" v-if="activeName === '5'"> <div v-if="activeName === '5'" class="content">
<div class="content-title">添加天馈线</div> <div class="content-title">添加天馈线</div>
</div> </div>
</el-tab-pane> </el-tab-pane>
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
</template> </template>
<script> <script>
import { railWaysave, sitesave } from "../api";
import railWay from "./comp/railWay.vue"; import railWay from "./comp/railWay.vue";
import monitorEquip from "./comp/monitorEquip.vue"; import monitorEquip from "./comp/monitorEquip.vue";
import station from "./comp/station.vue"; import station from "./comp/station.vue";
...@@ -56,7 +55,7 @@ export default { ...@@ -56,7 +55,7 @@ export default {
station, station,
railWay, railWay,
FSU, FSU,
leakyCable, leakyCable
}, },
data() { data() {
return { return {
...@@ -64,35 +63,34 @@ export default { ...@@ -64,35 +63,34 @@ export default {
tabs: [ tabs: [
{ {
label: "铁路线", label: "铁路线",
key: "0", key: "0"
}, },
{ {
label: "站点", label: "站点",
key: "1", key: "1"
}, },
{ {
label: "FSU", label: "FSU",
key: "2", key: "2"
}, },
{ {
label: "监测设备", label: "监测设备",
key: "3", key: "3"
}, },
{ {
label: "漏缆", label: "漏缆",
key: "4", key: "4"
}, },
{ {
label: "天馈线", label: "天馈线",
key: "5", key: "5"
}, }
], ]
}; }
}, },
methods: { methods: {
handleClick(tab, event) {}, }
}, }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
<div style="color: #666666"></div> <div style="color: #666666"></div>
<div class="operate-btn"> <div class="operate-btn">
<delids :multipleSelection2="multipleSelection" @del="del()" <delids :multipleSelection2="multipleSelection" @del="del()">删除</delids>
>删除</delids
>
<el-button type="primary" @click="refresh">刷新</el-button> <el-button type="primary" @click="refresh">刷新</el-button>
<el-button type="primary" @click="block = !block">查询</el-button> <el-button type="primary" @click="block = !block">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button> <el-button type="primary" @click="exportData">导出</el-button>
...@@ -79,6 +77,7 @@ ...@@ -79,6 +77,7 @@
:data="tableData" :data="tableData"
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%" style="width: 100%"
height="100%"
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
:row-style="{ height: '50px' }" :row-style="{ height: '50px' }"
:header-cell-style="{ :header-cell-style="{
......
...@@ -6,18 +6,17 @@ ...@@ -6,18 +6,17 @@
v-for="item in tabs" v-for="item in tabs"
:key="item.key" :key="item.key"
:type="activeName === item.key ? 'primary' : ''" :type="activeName === item.key ? 'primary' : ''"
style="width: 100px"
@click="changeType(item)" @click="changeType(item)"
>{{ item.label }}</el-button >{{ item.label }}</el-button>
>
</el-button-group> </el-button-group>
<railWayTable v-if="activeName == '0'"></railWayTable> <railWayTable v-if="activeName == '0'" />
<stationTable v-if="activeName == '1'"></stationTable> <stationTable v-if="activeName == '1'" />
<fsuTable v-if="activeName == '2'"></fsuTable> <fsuTable v-if="activeName == '2'" />
<monitorTable v-if="activeName == '3'"></monitorTable> <monitorTable v-if="activeName == '3'" />
<leakyTable v-if="activeName == '4'"></leakyTable> <leakyTable v-if="activeName == '4'" />
</div> </div>
</template> </template>
<script> <script>
...@@ -26,22 +25,20 @@ import stationTable from "./comp/stationTable.vue"; ...@@ -26,22 +25,20 @@ import stationTable from "./comp/stationTable.vue";
import fsuTable from "./comp/fsuTable.vue"; import fsuTable from "./comp/fsuTable.vue";
import monitorTable from "./comp/monitorTable.vue"; import monitorTable from "./comp/monitorTable.vue";
import leakyTable from "./comp/leakyTable.vue"; import leakyTable from "./comp/leakyTable.vue";
import Pagination from "@/components/Pagination";
export default { export default {
components: { components: {
Pagination,
railWayTable, railWayTable,
stationTable, stationTable,
fsuTable, fsuTable,
monitorTable, monitorTable,
leakyTable, leakyTable
}, },
data() { data() {
return { return {
params: { params: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10
}, },
total: 10, total: 10,
activeName: "0", activeName: "0",
...@@ -69,28 +66,27 @@ export default { ...@@ -69,28 +66,27 @@ export default {
{ {
label: "天馈线", label: "天馈线",
key: "5", key: "5",
}, }
], ],
tableData2: [], tableData2: [],
tableData: [], tableData: [],
multipleSelection: [], multipleSelection: [],
ids: [], ids: []
}; }
}, },
methods: { methods: {
tableRowClassName({ row, rowIndex }) { tableRowClassName({ row, rowIndex }) {
return rowIndex % 2 === 0 ? "" : "single-row"; return rowIndex % 2 === 0 ? "" : "single-row";
}, },
changeType(item) { changeType(item) {
this.activeName = item.key; this.activeName = item.key
}, },
refresh() {}, refresh() {},
query() {}, query() {},
exportData() {}, exportData() {}
}, }
mounted() {}, }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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