From 909744b8149a8b88c6a7b75e7b94b636e204fded Mon Sep 17 00:00:00 2001 From: whychdw <49690745@qq.com> Date: 星期二, 09 三月 2021 15:51:44 +0800 Subject: [PATCH] 提交内容 --- src/components/PageHeader.vue | 1414 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 707 insertions(+), 707 deletions(-) diff --git a/src/components/PageHeader.vue b/src/components/PageHeader.vue index c6ae972..5cd1de3 100644 --- a/src/components/PageHeader.vue +++ b/src/components/PageHeader.vue @@ -1,105 +1,106 @@ <template> - <div class="page-header"> - <div class="page-header-container"> - <flex-layout direction="row"> - <div class="page-header-left" slot="header"> - <img class="header-first-logo" src="../assets/images/gjdw-log.png"> - <!-- <img class="header-first-logo" src="../assets/images/nfdw-log.png">--> - <span class="header-carve-up"></span> - <span>钃勭數姹犵洃鎺у钩鍙�</span> -<!-- <span>缁煎悎鐢靛姏鐩戞帶骞冲彴</span>--> - <span class="sys-version">V{{ version }}</span> - </div> - <div class="page-header-content"> - <div class="header-info-list"> - <el-tooltip class="item" effect="dark" :content="serverInfo.disk.message" placement="bottom"> - <div class="header-info-item"> - <progress-bar v-if="showProgress" :options="options" :value="serverInfo.disk.progress"> - </progress-bar> - </div> - </el-tooltip> - <el-tooltip class="item" effect="dark" :content="serverInfo.cpu.message" placement="bottom"> - <div class="header-info-item"> - <progress-bar v-if="showProgress" :options="options" :value="serverInfo.cpu.progress"> - </progress-bar> - </div> - </el-tooltip> - <el-tooltip class="item" effect="dark" :content="serverInfo.memory.message" placement="bottom"> - <div class="header-info-item"> - <progress-bar v-if="showProgress" :options="options" - :value="serverInfo.memory.progress"></progress-bar> - </div> - </el-tooltip> - <el-tooltip class="item" effect="dark" :content="serverInfo.linkNum.message" placement="bottom"> - <div class="header-info-item"> - <progress-bar v-if="showProgress" :options="options" - :value="serverInfo.linkNum.progress"></progress-bar> - </div> - </el-tooltip> - <div class="header-info-item" style="margin-left: 60px;"> - <progress-state icon="el-icon-fuwuqi" :state="processInfo.sql" :content="processSqlMsg"> - </progress-state> - <progress-state icon="el-icon-WIFIwofi" :state="processInfo.link" :content="processLinkMsg"> - </progress-state> - <progress-state icon="el-icon-dianchi" :state="processInfo.behind" - :content="processBehindMsg"></progress-state> - <progress-state icon="el-icon-gaojing" :state="processInfo.alarm" - :content="processAlarmMsg"></progress-state> - <progress-state icon="el-icon-jihua" :state="processInfo.displan" - :content="processDisplanMsg"></progress-state> - <progress-state icon="el-icon-tingdian" :state="processInfo.power" - :content="processPowerMsg"></progress-state> - <progress-state icon="el-icon-jiankong" :state="processInfo.control" - :content="processControlMsg"></progress-state> - <progress-state icon="el-icon-pifu" :state="1" :content="themeInfo" - @handleClick="handleClick"></progress-state> - </div> - </div> - <div class="data-totals"> - <hdw-badge-btn text="鐢垫簮鍛婅鏁�" :value="numbers.powerWarn" @click="goPages('powerWarn')"></hdw-badge-btn> - <hdw-badge-btn text="鏈烘埧鍋滅數鏁�" :value="numbers.powerOff" @click="goPages('powerOff')"> - </hdw-badge-btn> - <hdw-badge-btn text="鐢垫睜鍛婅鏁�" :value="numbers.battWarn" @click="goPages('battWarn')"> - </hdw-badge-btn> - <hdw-badge-btn text="璁惧鍛婅鏁�" :value="numbers.devWarn" @click="goPages('devWarn')"> - </hdw-badge-btn> - <!-- <hdw-badge-btn text="瀹归噺钀藉悗鍗曚綋鏁伴噺" :value="numbers.lowMon" @click="goPages('lowMon')"></hdw-badge-btn>--> - <!-- <hdw-badge-btn text="鏈畬鎴愭斁鐢佃鍒掓暟" :value="numbers.plan" @click="goPages('plan')"></hdw-badge-btn>--> - <hdw-badge-btn text="鏍稿娴嬭瘯璁惧" :value="numbers.nuclear" @click="goPages('nuclear')"> - </hdw-badge-btn> - </div> - <!-- <div class="system-tools">--> - <!-- <div class="tools-item"><i class="iconfont el-icon-pifu-"></i></div>--> - <!-- </div>--> - </div> - <div class="page-header-right" slot="footer"> - <div class="hdw-avatar"> + <div class="page-header"> + <div class="page-header-container"> + <flex-layout direction="row"> + <div class="page-header-left" slot="header"> + <!-- <img class="header-first-logo" src="../assets/images/gjdw-log.png">--> + <img class="header-first-logo" src="../assets/images/nfdw-log.png"> + <span class="header-carve-up"></span> + <span>钃勭數姹犵洃鎺у钩鍙�</span> + <!-- <span>缁煎悎鐢靛姏鐩戞帶骞冲彴</span>--> + <span class="sys-version">V{{ version }}</span> + </div> + <div class="page-header-content"> + <div class="header-info-list"> + <el-tooltip class="item" effect="dark" :content="serverInfo.disk.message" placement="bottom"> + <div class="header-info-item"> + <progress-bar v-if="showProgress" :options="options" :value="serverInfo.disk.progress"> + </progress-bar> + </div> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="serverInfo.cpu.message" placement="bottom"> + <div class="header-info-item"> + <progress-bar v-if="showProgress" :options="options" :value="serverInfo.cpu.progress"> + </progress-bar> + </div> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="serverInfo.memory.message" placement="bottom"> + <div class="header-info-item"> + <progress-bar v-if="showProgress" :options="options" + :value="serverInfo.memory.progress"></progress-bar> + </div> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="serverInfo.linkNum.message" placement="bottom"> + <div class="header-info-item"> + <progress-bar v-if="showProgress" :options="options" + :value="serverInfo.linkNum.progress"></progress-bar> + </div> + </el-tooltip> + <div class="header-info-item" style="margin-left: 60px;"> + <progress-state icon="el-icon-fuwuqi" :state="processInfo.sql" :content="processSqlMsg"> + </progress-state> + <progress-state icon="el-icon-WIFIwofi" :state="processInfo.link" :content="processLinkMsg"> + </progress-state> + <progress-state icon="el-icon-dianchi" :state="processInfo.behind" + :content="processBehindMsg"></progress-state> + <progress-state icon="el-icon-gaojing" :state="processInfo.alarm" + :content="processAlarmMsg"></progress-state> + <progress-state icon="el-icon-jihua" :state="processInfo.displan" + :content="processDisplanMsg"></progress-state> + <progress-state icon="el-icon-tingdian" :state="processInfo.power" + :content="processPowerMsg"></progress-state> + <progress-state icon="el-icon-jiankong" :state="processInfo.control" + :content="processControlMsg"></progress-state> + <progress-state icon="el-icon-pifu" :state="1" :content="themeInfo" + @handleClick="handleClick"></progress-state> + </div> + </div> + <div class="data-totals"> + <hdw-badge-btn text="鐢垫簮鍛婅鏁�" :value="numbers.powerWarn" + @click="goPages('powerWarn')"></hdw-badge-btn> + <hdw-badge-btn text="鏈烘埧鍋滅數鏁�" :value="numbers.powerOff" @click="goPages('powerOff')"> + </hdw-badge-btn> + <hdw-badge-btn text="鐢垫睜鍛婅鏁�" :value="numbers.battWarn" @click="goPages('battWarn')"> + </hdw-badge-btn> + <hdw-badge-btn text="璁惧鍛婅鏁�" :value="numbers.devWarn" @click="goPages('devWarn')"> + </hdw-badge-btn> + <!-- <hdw-badge-btn text="瀹归噺钀藉悗鍗曚綋鏁伴噺" :value="numbers.lowMon" @click="goPages('lowMon')"></hdw-badge-btn>--> + <!-- <hdw-badge-btn text="鏈畬鎴愭斁鐢佃鍒掓暟" :value="numbers.plan" @click="goPages('plan')"></hdw-badge-btn>--> + <hdw-badge-btn text="鏍稿娴嬭瘯璁惧" :value="numbers.nuclear" @click="goPages('nuclear')"> + </hdw-badge-btn> + </div> + <!-- <div class="system-tools">--> + <!-- <div class="tools-item"><i class="iconfont el-icon-pifu-"></i></div>--> + <!-- </div>--> + </div> + <div class="page-header-right" slot="footer"> + <div class="hdw-avatar"> <span class="hdw-avatar-icon"> <i class="iconfont el-icon-Userselect"></i> </span> - <el-dropdown @command="commandClick"> + <el-dropdown @command="commandClick"> <span class="hdw-avatar-text"> {{ username }}<i class="el-icon-arrow-down el-icon--right"></i> </span> - <el-dropdown-menu slot="dropdown"> - <el-dropdown-item command="passwordChange">瀵嗙爜淇敼</el-dropdown-item> - <el-dropdown-item command="outSystem">瀹夊叏閫�鍑�</el-dropdown-item> - </el-dropdown-menu> - </el-dropdown> - <img v-if="showLogo" src="../assets/images/fuguang_logo.jpg" class="fuguang-logo"> - </div> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item command="passwordChange">瀵嗙爜淇敼</el-dropdown-item> + <el-dropdown-item command="outSystem">瀹夊叏閫�鍑�</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> + <img v-if="showLogo" src="../assets/images/fuguang_logo.jpg" class="fuguang-logo"> + </div> + </div> + </flex-layout> </div> - </flex-layout> + <el-drawer title="鎴戞槸鏍囬" :visible.sync="pifuDrawer" size="360px" :with-header="false"> + <pifu-list></pifu-list> + </el-drawer> + <!-- 瀵嗙爜淇敼 --> + <el-dialog title="瀵嗙爜淇敼" width="400px" :visible.sync="pwd.show" :close-on-click-modal="false" top="0" + class="dialog-center" :modal-append-to-body="false"> + <pwd-change v-if="pwd.show" :visible.sync="pwd.show"></pwd-change> + </el-dialog> </div> - <el-drawer title="鎴戞槸鏍囬" :visible.sync="pifuDrawer" size="360px" :with-header="false"> - <pifu-list></pifu-list> - </el-drawer> - <!-- 瀵嗙爜淇敼 --> - <el-dialog title="瀵嗙爜淇敼" width="400px" :visible.sync="pwd.show" :close-on-click-modal="false" top="0" - class="dialog-center" :modal-append-to-body="false"> - <pwd-change v-if="pwd.show" :visible.sync="pwd.show"></pwd-change> - </el-dialog> - </div> </template> <script> @@ -109,717 +110,716 @@ import PifuList from "@/pages/dataTest/PifuList"; import PwdChange from "@/components/PwdChange"; import { - Timeout + Timeout } from '../assets/js/tools' export default { - components: { - HdwBadgeBtn, - ProgressState, - PifuList, - PwdChange - }, - data() { - return { - skinActive: 'science-blue', - showProgress: false, - pifuDrawer: false, - showLogo: false, - version: config.version, - username: sessionStorage.getItem('username'), - options: { - text: { - color: '#041F6C', - shadowEnable: true, - shadowColor: 'transparent', - fontSize: 12, - fontWeight: 'bold', - fontFamily: 'Helvetica', - dynamicPosition: false, - hideText: false - }, - progress: { - color: '#f06824', - backgroundColor: '#FFE329' - }, - layout: { - height: 15, - width: 60, - verticalTextAlign: 70, - horizontalTextAlign: 35, - zeroOffset: 0, - strokeWidth: 30, - progressPadding: 0, - type: 'line' - } - }, - numbers: { - lowMon: 0, - powerOff: 0, - battWarn: 0, - devWarn: 0, - plan: 0, - nuclear: 0, - powerWarn: 0, - }, - serverInfo: { - disk: { - progress: 0, - message: '鏈嶅姟鍣ㄦ暟鎹鐩樻�婚噺锛氭湭鐭�;鍓╀綑锛氭湭鐭�' - }, - cpu: { - progress: 0, - message: 'TM:鏈煡' - }, - memory: { - progress: 0, - message: 'FM:鏈煡', - }, - linkNum: { - progress: 0, - message: 'DBC:鏈煡' - }, - }, - processInfo: { - // 0:寮傚父 1:姝e父 2:鏆傛湭寮�鍚� - alarm: 0, //鍛婅鏍囪瘑浣� - behind: 0, //钀藉悗鏍囪瘑浣� - displan: 0, //鏀剧數璁″垝鏍囪瘑浣� - power: 0, //鏈烘埧鍋滅數鏍囪瘑浣� - control: 0, //绾跨▼鐩戞帶鏍囪瘑浣� - sql: 0, //鏈嶅姟鍣ㄦ暟鎹疄鏃舵洿鏂� - link: 0, //鏈嶅姟鍣ㄨ繛鎺� - }, - value: 0, - timer: new Timeout(), - pwd: { - show: false, - } - } - }, - methods: { - handleClick() { - this.pifuDrawer = true; + components: { + HdwBadgeBtn, + ProgressState, + PifuList, + PwdChange }, - outSystem() { - this.$router.push('/login'); - }, - passwordChange() { - this.pwd.show = true; - }, - commandClick(name) { - switch (name) { - case 'outSystem': - this.outSystem(); - break; - case "passwordChange": - this.passwordChange(); - break; - default: - this.$layer.msg('璇ュ姛鑳芥殏鏈紑鏀撅紒'); - break; - } - }, - startSearch() { - this.timer.start(() => { - this.$axios.all([ - this.searchAlmNum(), this.searchLowMonNum(), - this.searchPowerOffNum(), this.searchDevAlarmNum(), - this.searchNotComplanNum(), this.searchServerState(), - this.searchProcessState(), this.search61850Nuclear(), - this.searchPowerWarnNum(), - ]).then(() => { - this.timer.open(); - }).catch(error => { - console.log(error); - }) - }, 4000); - }, - // 鏌ヨ鐢垫睜鍛婅鎬绘暟 - searchAlmNum() { - this.$apis.top.searchAlmNum().then(res => { - let rs = JSON.parse(res.data.result); - this.numbers.battWarn = rs.sum; - }).catch(error => { - console.log(error); - }) - }, - // 鏌ヨ钀藉悗鍗曚綋鎬绘暟 - searchLowMonNum() { - this.$apis.top.searchLowMonNum().then(res => { - let rs = JSON.parse(res.data.result); - this.numbers.lowMon = rs.sum; - }).catch(error => { - console.log(error); - }) - }, - // 鏌ヨ鏈烘埧鍋滅數鎬绘暟 - searchPowerOffNum() { - this.$apis.top.searchPowerOffNum().then(res => { - let rs = JSON.parse(res.data.result); - this.numbers.powerOff = rs.sum; - }).catch(error => { - console.log(error); - }); - }, - // 鏌ヨ璁惧瀹炴椂鍛婅鎬绘暟 - searchDevAlarmNum() { - this.$apis.top.searchDevAlarmNum().then(res => { - let rs = JSON.parse(res.data.result); - this.numbers.devWarn = rs.sum; - }).catch(error => { - console.log(error); - }) - }, - searchNotComplanNum() { - this.$apis.top.searchNotComplanNum().then(res => { - let rs = JSON.parse(res.data.result); - - this.numbers.plan = rs.sum; - }).catch(error => { - console.log(error); - }) - }, - // 鏌ヨ姝e湪鏍稿娴嬭瘯鐨勪俊鎭� - search61850Nuclear() { - this.$apis.top.search61850Nuclear().then(res => { - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - let data = rs.data; - this.numbers.nuclear = data.length; - } else { - this.numbers.nuclear = 0; - } - - }).catch(error => { - - }); - }, - // 鏌ヨ鐢垫簮鍛婅涓暟 - searchPowerWarnNum() { - this.$apis.top.searchPowerWarnNum().then(res => { - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - this.numbers.powerWarn = rs.data; - } else { - this.numbers.powerWarn = 0; - } - }).catch(error => { - - }); - }, - // 鏌ヨ鏈嶅姟鍣ㄤ俊鎭� - searchServerState() { - this.$apis.top.searchServerState().then(res => { - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - let data = rs.data[0]; - console.log(data); - let totalDiscSpace = data.total_disc_space; - // 璁剧疆鏈嶅姟鍣ㄧ鐩樹俊鎭� - let disc_spance_percent = totalDiscSpace?((data.total_disc_space - data.free_disc_space) * 100 /totalDiscSpace ).toFixed(0):0; - this.serverInfo.disk.progress = parseInt(disc_spance_percent); - this.serverInfo.disk.message = '鏈嶅姟鍣ㄦ暟鎹鐩樻�婚噺' + (data.total_disc_space / 1024).toFixed(1) + - 'GB;鍓╀綑锛�' + (data.free_disc_space / - 1024).toFixed(1) + 'GB'; - // 璁剧疆鏈嶅姟鍣╟pu淇℃伅 - let cpu_percent = (data.total_mem * 100 / data.max_mem).toFixed(0); - this.serverInfo.cpu.progress = parseInt(cpu_percent); - this.serverInfo.cpu.message = 'TM:' + (data.total_mem / (1024 * 1024 * 1024)).toFixed(2) + - 'GB/' + (data.max_mem / - (1024 * 1024 * 1024)).toFixed(2) + 'GB'; - // 璁剧疆鏈嶅姟鍣ㄥ唴瀛樼殑淇℃伅 - let memory_percent = ((data.total_mem - data.free_men) * 100 / data.total_mem).toFixed(0); - this.serverInfo.memory.progress = parseInt(memory_percent); - this.serverInfo.memory.message = 'FM:' + ((data.total_mem - data.free_men) / (1024 * 1024)) - .toFixed(0) + 'MB/' + - (data.total_mem / (1024 * 1024)).toFixed(0) + "MB"; - // 璁剧疆鏈嶅姟鍣ㄧ殑杩炴帴鏁� - let link_percent = (data.db_conn_count * 100 / data.db_conn_max).toFixed(0); - this.serverInfo.linkNum.progress = parseInt(link_percent); - this.serverInfo.linkNum.message = 'DBC:' + data.db_conn_count + '/' + data.db_conn_max; - // 鏇存柊鏈嶅姟鍣ㄦ洿鏂板拰杩炴帴鐘舵�� - var nowtime = new Date((data.note).replace(/\-/g, "/")); - var sertime = new Date((data.server_datetime).replace(/\-/g, "/")); - var timelong = Math.abs(parseInt(sertime - nowtime)); - if ((timelong / (1000 * 60)) > 2) { - this.processInfo.sql = 0; - } else { - this.processInfo.sql = 1; - } - this.processInfo.link = 1; - } else { - this.processInfo.sql = 0; - this.processInfo.link = 0; - } - }).catch(error => { - console.log(error); - this.processInfo.sql = 0; - this.processInfo.link = 0; - }) - }, - // 鏌ヨ绾跨▼鐘舵�� - searchProcessState() { - this.$apis.dataMager.threadMager.search().then(res => { - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - let alarm_batt = false; //鐢垫睜鍛婅 - let alarm_dev = false; //璁惧鍛婅 - let alarm_cap = false; //瀹归噺鍛婅 - let badmon = false; //钀藉悗鍗曚綋 - //console.log(rs.data); - // 閬嶅巻骞跺鐞嗘暟鎹� - rs.data.forEach(item => { - switch (item.ServerName) { - // 鍛婅绾跨▼ - case 'BMS_FBSDEV_ALARM': - if (item.ProcessName == 'BMS_FBSDEV_ALARM_BATT') { - if (item.ServerFlag == 0) { - alarm_batt = 0; - } else { - alarm_batt = this.checkTimeOut2(item); - } - } else if (item.ProcessName == 'BMS_FBSDEV_ALARM_DEV') { - if (item.ServerFlag == 0) { - alarm_dev = 0; - } else { - alarm_dev = this.checkTimeOut2(item); - } + data() { + return { + skinActive: 'science-blue', + showProgress: false, + pifuDrawer: false, + showLogo: false, + version: config.version, + username: sessionStorage.getItem('username'), + options: { + text: { + color: '#041F6C', + shadowEnable: true, + shadowColor: 'transparent', + fontSize: 12, + fontWeight: 'bold', + fontFamily: 'Helvetica', + dynamicPosition: false, + hideText: false + }, + progress: { + color: '#f06824', + backgroundColor: '#FFE329' + }, + layout: { + height: 15, + width: 60, + verticalTextAlign: 70, + horizontalTextAlign: 35, + zeroOffset: 0, + strokeWidth: 30, + progressPadding: 0, + type: 'line' } + }, + numbers: { + lowMon: 0, + powerOff: 0, + battWarn: 0, + devWarn: 0, + plan: 0, + nuclear: 0, + powerWarn: 0, + }, + serverInfo: { + disk: { + progress: 0, + message: '鏈嶅姟鍣ㄦ暟鎹鐩樻�婚噺锛氭湭鐭�;鍓╀綑锛氭湭鐭�' + }, + cpu: { + progress: 0, + message: 'TM:鏈煡' + }, + memory: { + progress: 0, + message: 'FM:鏈煡', + }, + linkNum: { + progress: 0, + message: 'DBC:鏈煡' + }, + }, + processInfo: { + // 0:寮傚父 1:姝e父 2:鏆傛湭寮�鍚� + alarm: 0, //鍛婅鏍囪瘑浣� + behind: 0, //钀藉悗鏍囪瘑浣� + displan: 0, //鏀剧數璁″垝鏍囪瘑浣� + power: 0, //鏈烘埧鍋滅數鏍囪瘑浣� + control: 0, //绾跨▼鐩戞帶鏍囪瘑浣� + sql: 0, //鏈嶅姟鍣ㄦ暟鎹疄鏃舵洿鏂� + link: 0, //鏈嶅姟鍣ㄨ繛鎺� + }, + value: 0, + timer: new Timeout(), + pwd: { + show: false, + } + } + }, + methods: { + handleClick() { + this.pifuDrawer = true; + }, + outSystem() { + this.$router.push('/login'); + }, + passwordChange() { + this.pwd.show = true; + }, + commandClick(name) { + switch (name) { + case 'outSystem': + this.outSystem(); + break; + case "passwordChange": + this.passwordChange(); + break; + default: + this.$layer.msg('璇ュ姛鑳芥殏鏈紑鏀撅紒'); + break; + } + }, + startSearch() { + this.timer.start(() => { + this.$axios.all([ + this.searchAlmNum(), this.searchLowMonNum(), + this.searchPowerOffNum(), this.searchDevAlarmNum(), + this.searchNotComplanNum(), this.searchServerState(), + this.searchProcessState(), this.search61850Nuclear(), + this.searchPowerWarnNum(), + ]).then(() => { + this.timer.open(); + }).catch(error => { + console.log(error); + }) + }, 4000); + }, + // 鏌ヨ鐢垫睜鍛婅鎬绘暟 + searchAlmNum() { + this.$apis.top.searchAlmNum().then(res => { + let rs = JSON.parse(res.data.result); + this.numbers.battWarn = rs.sum; + }).catch(error => { + console.log(error); + }) + }, + // 鏌ヨ钀藉悗鍗曚綋鎬绘暟 + searchLowMonNum() { + this.$apis.top.searchLowMonNum().then(res => { + let rs = JSON.parse(res.data.result); + this.numbers.lowMon = rs.sum; + }).catch(error => { + console.log(error); + }) + }, + // 鏌ヨ鏈烘埧鍋滅數鎬绘暟 + searchPowerOffNum() { + this.$apis.top.searchPowerOffNum().then(res => { + let rs = JSON.parse(res.data.result); + this.numbers.powerOff = rs.sum; + }).catch(error => { + console.log(error); + }); + }, + // 鏌ヨ璁惧瀹炴椂鍛婅鎬绘暟 + searchDevAlarmNum() { + this.$apis.top.searchDevAlarmNum().then(res => { + let rs = JSON.parse(res.data.result); + this.numbers.devWarn = rs.sum; + }).catch(error => { + console.log(error); + }) + }, + searchNotComplanNum() { + this.$apis.top.searchNotComplanNum().then(res => { + let rs = JSON.parse(res.data.result); - if (this.processInfo.alarm == 2 || item.ServerFlag == 2) { - this.processInfo.alarm = 2; + this.numbers.plan = rs.sum; + }).catch(error => { + console.log(error); + }) + }, + // 鏌ヨ姝e湪鏍稿娴嬭瘯鐨勪俊鎭� + search61850Nuclear() { + this.$apis.top.search61850Nuclear().then(res => { + let rs = JSON.parse(res.data.result); + if (rs.code == 1) { + let data = rs.data; + this.numbers.nuclear = data.length; } else { - this.processInfo.alarm = alarm_batt && alarm_batt; + this.numbers.nuclear = 0; } - break; - // 鐢垫睜钀藉悗 - case 'BMS_FBSDEV_BADBATT': - if (item.ProcessName == 'BMS_FBSDEV_BADBATT_MON') { - //钀藉悗鍗曚綋绾跨▼ - if (item.ServerFlag == 0) { - badmon = 0; - } else { - badmon = this.checkTimeOut2(item); - } - } else if (item.ProcessName == 'BMS_FBSDEV_BADBATT_CAP') { - //瀹归噺鍛婅绾跨▼ - if (item.ServerFlag == 0) { - alarm_cap = 0; - } else { - alarm_cap = this.checkTimeOut2(item); - } - } - if (this.processInfo.behind == 2 || item.ServerFlag == 2) { - this.processInfo.behind = 2; + }).catch(error => { + + }); + }, + // 鏌ヨ鐢垫簮鍛婅涓暟 + searchPowerWarnNum() { + this.$apis.top.searchPowerWarnNum().then(res => { + let rs = JSON.parse(res.data.result); + if (rs.code == 1) { + this.numbers.powerWarn = rs.data; } else { - this.processInfo.behind = badmon && alarm_cap; + this.numbers.powerWarn = 0; } - break; - // 鏀剧數璁″垝绾跨▼ - case 'BMS_FBSDEV_PLAN': - if (item.ProcessName == 'BMS_FBSDEV_PLAN') { - if (item.ServerFlag == 0) { - this.processInfo.displan = 0; - } else { - this.processInfo.displan = this.checkTimeOut2(item); - } + }).catch(error => { + + }); + }, + // 鏌ヨ鏈嶅姟鍣ㄤ俊鎭� + searchServerState() { + this.$apis.top.searchServerState().then(res => { + let rs = JSON.parse(res.data.result); + if (rs.code == 1) { + let data = rs.data[0]; + let totalDiscSpace = data.total_disc_space; + // 璁剧疆鏈嶅姟鍣ㄧ鐩樹俊鎭� + let disc_spance_percent = totalDiscSpace ? ((data.total_disc_space - data.free_disc_space) * 100 / totalDiscSpace).toFixed(0) : 0; + this.serverInfo.disk.progress = parseInt(disc_spance_percent); + this.serverInfo.disk.message = '鏈嶅姟鍣ㄦ暟鎹鐩樻�婚噺' + (data.total_disc_space / 1024).toFixed(1) + + 'GB;鍓╀綑锛�' + (data.free_disc_space / + 1024).toFixed(1) + 'GB'; + // 璁剧疆鏈嶅姟鍣╟pu淇℃伅 + let cpu_percent = (data.total_mem * 100 / data.max_mem).toFixed(0); + this.serverInfo.cpu.progress = parseInt(cpu_percent); + this.serverInfo.cpu.message = 'TM:' + (data.total_mem / (1024 * 1024 * 1024)).toFixed(2) + + 'GB/' + (data.max_mem / + (1024 * 1024 * 1024)).toFixed(2) + 'GB'; + // 璁剧疆鏈嶅姟鍣ㄥ唴瀛樼殑淇℃伅 + let memory_percent = ((data.total_mem - data.free_men) * 100 / data.total_mem).toFixed(0); + this.serverInfo.memory.progress = parseInt(memory_percent); + this.serverInfo.memory.message = 'FM:' + ((data.total_mem - data.free_men) / (1024 * 1024)) + .toFixed(0) + 'MB/' + + (data.total_mem / (1024 * 1024)).toFixed(0) + "MB"; + // 璁剧疆鏈嶅姟鍣ㄧ殑杩炴帴鏁� + let link_percent = (data.db_conn_count * 100 / data.db_conn_max).toFixed(0); + this.serverInfo.linkNum.progress = parseInt(link_percent); + this.serverInfo.linkNum.message = 'DBC:' + data.db_conn_count + '/' + data.db_conn_max; + // 鏇存柊鏈嶅姟鍣ㄦ洿鏂板拰杩炴帴鐘舵�� + var nowtime = new Date((data.note).replace(/\-/g, "/")); + var sertime = new Date((data.server_datetime).replace(/\-/g, "/")); + var timelong = Math.abs(parseInt(sertime - nowtime)); + if ((timelong / (1000 * 60)) > 2) { + this.processInfo.sql = 0; + } else { + this.processInfo.sql = 1; + } + this.processInfo.link = 1; + } else { + this.processInfo.sql = 0; + this.processInfo.link = 0; } - if (this.processInfo.displan == 2 || item.ServerFlag == 2) { - this.processInfo.displan = 2; + }).catch(error => { + console.log(error); + this.processInfo.sql = 0; + this.processInfo.link = 0; + }) + }, + // 鏌ヨ绾跨▼鐘舵�� + searchProcessState() { + this.$apis.dataMager.threadMager.search().then(res => { + let rs = JSON.parse(res.data.result); + if (rs.code == 1) { + let alarm_batt = false; //鐢垫睜鍛婅 + let alarm_dev = false; //璁惧鍛婅 + let alarm_cap = false; //瀹归噺鍛婅 + let badmon = false; //钀藉悗鍗曚綋 + //console.log(rs.data); + // 閬嶅巻骞跺鐞嗘暟鎹� + rs.data.forEach(item => { + switch (item.ServerName) { + // 鍛婅绾跨▼ + case 'BMS_FBSDEV_ALARM': + if (item.ProcessName == 'BMS_FBSDEV_ALARM_BATT') { + if (item.ServerFlag == 0) { + alarm_batt = 0; + } else { + alarm_batt = this.checkTimeOut2(item); + } + } else if (item.ProcessName == 'BMS_FBSDEV_ALARM_DEV') { + if (item.ServerFlag == 0) { + alarm_dev = 0; + } else { + alarm_dev = this.checkTimeOut2(item); + } + } + + if (this.processInfo.alarm == 2 || item.ServerFlag == 2) { + this.processInfo.alarm = 2; + } else { + this.processInfo.alarm = alarm_batt && alarm_batt; + } + break; + // 鐢垫睜钀藉悗 + case 'BMS_FBSDEV_BADBATT': + if (item.ProcessName == 'BMS_FBSDEV_BADBATT_MON') { + //钀藉悗鍗曚綋绾跨▼ + if (item.ServerFlag == 0) { + badmon = 0; + } else { + badmon = this.checkTimeOut2(item); + } + } else if (item.ProcessName == 'BMS_FBSDEV_BADBATT_CAP') { + //瀹归噺鍛婅绾跨▼ + if (item.ServerFlag == 0) { + alarm_cap = 0; + } else { + alarm_cap = this.checkTimeOut2(item); + } + } + if (this.processInfo.behind == 2 || item.ServerFlag == 2) { + this.processInfo.behind = 2; + + } else { + this.processInfo.behind = badmon && alarm_cap; + } + break; + // 鏀剧數璁″垝绾跨▼ + case 'BMS_FBSDEV_PLAN': + if (item.ProcessName == 'BMS_FBSDEV_PLAN') { + if (item.ServerFlag == 0) { + this.processInfo.displan = 0; + } else { + this.processInfo.displan = this.checkTimeOut2(item); + } + } + if (this.processInfo.displan == 2 || item.ServerFlag == 2) { + this.processInfo.displan = 2; + } + break; + case 'BMS_FBSDEV_POWER_FAIL': + if (item.ProcessName == 'BMS_FBSDEV_POWER_FAIL') { + if (item.ServerFlag == 0) { + this.processInfo.power = 0; + } else { + this.processInfo.power = this.checkTimeOut2(item); + } + } + if (this.processInfo.power == 2 || item.ServerFlag == 2) { + this.processInfo.power = 2; + } + break; + // 绾跨▼鐩戞帶绾跨▼ + case 'BMS_FBSDEV_LISTEN': + if (item.ProcessName == 'BMS_FBSDEV_LISTEN') { + if (item.ServerFlag == 0) { + this.processInfo.control = 0; + } else { + this.processInfo.control = this.checkTimeOut2(item); + } + } + if (this.processInfo.control == 2 || item.ServerFlag == 2) { + this.processInfo.control = 2; + } + break; + } + }); } - break; - case 'BMS_FBSDEV_POWER_FAIL': - if (item.ProcessName == 'BMS_FBSDEV_POWER_FAIL') { - if (item.ServerFlag == 0) { - this.processInfo.power = 0; - } else { - this.processInfo.power = this.checkTimeOut2(item); - } + }).catch(error => { + console.log(error); + }); + }, + checkTimeOut2(temp) { + var flag = 0; + if (temp != undefined) { + let startTime = new Date(temp.ProcessTime); + let endTime = new Date(temp.note); + let totalms = (endTime.getTime() - startTime.getTime()) / 1000; + if (totalms < temp.OutTime) { + flag = 1; } - if (this.processInfo.power == 2 || item.ServerFlag == 2) { - this.processInfo.power = 2; - } - break; - // 绾跨▼鐩戞帶绾跨▼ - case 'BMS_FBSDEV_LISTEN': - if (item.ProcessName == 'BMS_FBSDEV_LISTEN') { - if (item.ServerFlag == 0) { - this.processInfo.control = 0; - } else { - this.processInfo.control = this.checkTimeOut2(item); - } - } - if (this.processInfo.control == 2 || item.ServerFlag == 2) { - this.processInfo.control = 2; - } - break; } - }); + return flag; + }, + goPages(type) { + let message = { + cmd: 'syncPage', + params: {} + }; + switch (type) { + case 'powerOff': + message.params = { + pageInfo: { + label: "鏈烘埧鍋滅數鏌ヨ", + name: "powercutMager", + src: "#/dataMager/powercut", + closable: true + } + }; + break; + case 'battWarn': + message.params = { + pageInfo: { + label: "鐢垫睜鍛婅瀹炴椂鏌ヨ", + name: "batteryrTimequery", + src: "#/batteryrTimequery", + closable: true + } + }; + break; + case 'devWarn': + message.params = { + pageInfo: { + label: "璁惧鍛婅瀹炴椂鏌ヨ", + name: "deviceTimequery", + src: "#/deviceTimequery", + closable: true + } + }; + break; + case "nuclear": + message.params = { + pageInfo: { + label: "鏍稿娴嬭瘯鏁版嵁", + name: "btsStatusTest", + src: "#/dataMager/btsStatus?workStauts=2", + closable: true + } + }; + break; + case "powerWarn": + message.params = { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: "#/powerRealtimeInfo", + closable: true + } + }; + break; + default: + message = false; + this.$layer.msg('璇ュ姛鑳芥殏鏈紑鏀撅紒'); + break; + } + if (message) { + this.$emit('handle-message', message); + } + }, + changeSkin() { + this.$nextTick(() => { + this.showProgress = true; + if (this.skinActive == 'science-black') { + this.options.progress.color = '#fb8d1a'; + this.options.progress.backgroundColor = '#1ccfe5'; + } else { + this.options.progress.color = '#f06824'; + this.options.progress.backgroundColor = '#FFE329'; + } + }) } - }).catch(error => { - console.log(error); - }); }, - checkTimeOut2(temp) { - var flag = 0; - if (temp != undefined) { - let startTime = new Date(temp.ProcessTime); - let endTime = new Date(temp.note); - let totalms = (endTime.getTime() - startTime.getTime()) / 1000; - if (totalms < temp.OutTime) { - flag = 1; + computed: { + processAlarmMsg() { + let result = '鏈煡'; + switch (this.processInfo.alarm) { + case 0: + result = '鍛婅鐩戞祴绾跨▼锛氬紓甯�'; + break; + case 1: + result = '鍛婅鐩戞祴绾跨▼锛氭甯�'; + break; + case 2: + result = '鍛婅鐩戞祴绾跨▼锛氭湭鍚敤'; + break; + } + return result; + }, + processBehindMsg() { + let result = '鏈煡'; + switch (this.processInfo.behind) { + case 0: + result = '钀藉悗鍗曚綋鐩戞祴绾跨▼锛氬紓甯�'; + break; + case 1: + result = '钀藉悗鍗曚綋鐩戞祴绾跨▼锛氭甯�'; + break; + case 2: + result = '钀藉悗鍗曚綋鐩戞祴绾跨▼锛氭湭鍚敤'; + break; + } + return result; + }, + processDisplanMsg() { + let result = '鏈煡'; + switch (this.processInfo.displan) { + case 0: + result = '鏀剧數璁″垝鐩戞祴绾跨▼锛氬紓甯�'; + break; + case 1: + result = '鏀剧數璁″垝鐩戞祴绾跨▼锛氭甯�'; + break; + case 2: + result = '鏀剧數璁″垝鐩戞祴绾跨▼锛氭湭鍚敤'; + break; + } + return result; + }, + processPowerMsg() { + let result = '鏈煡'; + switch (this.processInfo.power) { + case 0: + result = '鏈烘埧鍋滅數鐩戞祴绾跨▼锛氬紓甯�'; + break; + case 1: + result = '鏈烘埧鍋滅數鐩戞祴绾跨▼锛氭甯�'; + break; + case 2: + result = '鏈烘埧鍋滅數鐩戞祴绾跨▼锛氭湭鍚敤'; + break; + } + return result; + }, + processControlMsg() { + let result = '鏈煡'; + switch (this.processInfo.control) { + case 0: + result = '绾跨▼鐩戞帶绋嬪簭杩愯锛氬紓甯�'; + break; + case 1: + result = '绾跨▼鐩戞帶绋嬪簭杩愯锛氭甯�'; + break; + case 2: + result = '绾跨▼鐩戞帶绋嬪簭杩愯锛氭湭鍚敤'; + break; + } + return result; + }, + processSqlMsg() { + let result = '鏈煡'; + switch (this.processInfo.sql) { + case 0: + result = '鏈嶅姟鍣ㄥ疄鏃舵洿鏂版暟鎹細寮傚父'; + break; + case 1: + result = '鏈嶅姟鍣ㄥ疄鏃舵洿鏂版暟鎹細姝e父'; + break; + } + return result; + }, + processLinkMsg() { + let result = '鏈煡'; + switch (this.processInfo.link) { + case 0: + result = '鏈嶅姟鍣ㄨ繛鎺ワ細寮傚父'; + break; + case 1: + result = '鏈嶅姟鍣ㄨ繛鎺ワ細姝e父'; + break; + } + return result; + }, + themeInfo() { + return "褰撳墠涓婚锛�" + this.$store.state.theme.themeName; } - } - return flag; }, - goPages(type) { - let message = { - cmd: 'syncPage', - params: {} - }; - switch (type) { - case 'powerOff': - message.params = { - pageInfo: { - label: "鏈烘埧鍋滅數鏌ヨ", - name: "powercutMager", - src: "#/dataMager/powercut", - closable: true - } - }; - break; - case 'battWarn': - message.params = { - pageInfo: { - label: "鐢垫睜鍛婅瀹炴椂鏌ヨ", - name: "batteryrTimequery", - src: "#/batteryrTimequery", - closable: true - } - }; - break; - case 'devWarn': - message.params = { - pageInfo: { - label: "璁惧鍛婅瀹炴椂鏌ヨ", - name: "deviceTimequery", - src: "#/deviceTimequery", - closable: true - } - }; - break; - case "nuclear": - message.params = { - pageInfo: { - label: "鏍稿娴嬭瘯鏁版嵁", - name: "btsStatusTest", - src: "#/dataMager/btsStatus?workStauts=2", - closable: true - } - }; - break; - case "powerWarn": - message.params = { - pageInfo: { - label: "鐢垫簮瀹炴椂鍛婅", - name: "powerRealtimeInfo", - src: "#/powerRealtimeInfo", - closable: true - } - }; - break; - default: - message = false; - this.$layer.msg('璇ュ姛鑳芥殏鏈紑鏀撅紒'); - break; - } - if (message) { - this.$emit('handle-message', message); - } + created() { + this.skinActive = localStorage.getItem('setSkinItem'); + window.addEventListener('setSkinItem', (e) => { + this.showProgress = false; + this.skinActive = e.newValue; + this.changeSkin(); + }); + this.changeSkin(); }, - changeSkin() { - this.$nextTick(() => { - this.showProgress = true; - if (this.skinActive == 'science-black') { - this.options.progress.color = '#fb8d1a'; - this.options.progress.backgroundColor = '#1ccfe5'; - } else { - this.options.progress.color = '#f06824'; - this.options.progress.backgroundColor = '#FFE329'; - } - }) + mounted() { + // 鍚姩璇锋眰 + this.startSearch(); + }, + destroyed() { + this.timer.stop(); } - }, - computed: { - processAlarmMsg() { - let result = '鏈煡'; - switch (this.processInfo.alarm) { - case 0: - result = '鍛婅鐩戞祴绾跨▼锛氬紓甯�'; - break; - case 1: - result = '鍛婅鐩戞祴绾跨▼锛氭甯�'; - break; - case 2: - result = '鍛婅鐩戞祴绾跨▼锛氭湭鍚敤'; - break; - } - return result; - }, - processBehindMsg() { - let result = '鏈煡'; - switch (this.processInfo.behind) { - case 0: - result = '钀藉悗鍗曚綋鐩戞祴绾跨▼锛氬紓甯�'; - break; - case 1: - result = '钀藉悗鍗曚綋鐩戞祴绾跨▼锛氭甯�'; - break; - case 2: - result = '钀藉悗鍗曚綋鐩戞祴绾跨▼锛氭湭鍚敤'; - break; - } - return result; - }, - processDisplanMsg() { - let result = '鏈煡'; - switch (this.processInfo.displan) { - case 0: - result = '鏀剧數璁″垝鐩戞祴绾跨▼锛氬紓甯�'; - break; - case 1: - result = '鏀剧數璁″垝鐩戞祴绾跨▼锛氭甯�'; - break; - case 2: - result = '鏀剧數璁″垝鐩戞祴绾跨▼锛氭湭鍚敤'; - break; - } - return result; - }, - processPowerMsg() { - let result = '鏈煡'; - switch (this.processInfo.power) { - case 0: - result = '鏈烘埧鍋滅數鐩戞祴绾跨▼锛氬紓甯�'; - break; - case 1: - result = '鏈烘埧鍋滅數鐩戞祴绾跨▼锛氭甯�'; - break; - case 2: - result = '鏈烘埧鍋滅數鐩戞祴绾跨▼锛氭湭鍚敤'; - break; - } - return result; - }, - processControlMsg() { - let result = '鏈煡'; - switch (this.processInfo.control) { - case 0: - result = '绾跨▼鐩戞帶绋嬪簭杩愯锛氬紓甯�'; - break; - case 1: - result = '绾跨▼鐩戞帶绋嬪簭杩愯锛氭甯�'; - break; - case 2: - result = '绾跨▼鐩戞帶绋嬪簭杩愯锛氭湭鍚敤'; - break; - } - return result; - }, - processSqlMsg() { - let result = '鏈煡'; - switch (this.processInfo.sql) { - case 0: - result = '鏈嶅姟鍣ㄥ疄鏃舵洿鏂版暟鎹細寮傚父'; - break; - case 1: - result = '鏈嶅姟鍣ㄥ疄鏃舵洿鏂版暟鎹細姝e父'; - break; - } - return result; - }, - processLinkMsg() { - let result = '鏈煡'; - switch (this.processInfo.link) { - case 0: - result = '鏈嶅姟鍣ㄨ繛鎺ワ細寮傚父'; - break; - case 1: - result = '鏈嶅姟鍣ㄨ繛鎺ワ細姝e父'; - break; - } - return result; - }, - themeInfo() { - return "褰撳墠涓婚锛�" + this.$store.state.theme.themeName; - } - }, - created() { - this.skinActive = localStorage.getItem('setSkinItem'); - window.addEventListener('setSkinItem', (e) => { - this.showProgress = false; - this.skinActive = e.newValue; - this.changeSkin(); - }); - this.changeSkin(); - }, - mounted() { - // 鍚姩璇锋眰 - this.startSearch(); - }, - destroyed() { - this.timer.stop(); - } } </script> <style scoped> .page-header-container { - height: 70px; + height: 70px; } .page-header-content { - position: relative; - height: 100%; - overflow: hidden; - padding-top: 5px; - box-sizing: border-box; + position: relative; + height: 100%; + overflow: hidden; + padding-top: 5px; + box-sizing: border-box; } .page-header-left { - height: 100%; - display: flex; - align-items: center; - padding-right: 130px; + height: 100%; + display: flex; + align-items: center; + padding-right: 130px; } .page-header-left img { - height: 40px; - vertical-align: middle; + height: 40px; + vertical-align: middle; } .page-header-left span { - font-size: 33px; - font-weight: bold; - letter-spacing: 4px; + font-size: 33px; + font-weight: bold; + letter-spacing: 4px; } .page-header-left span.sys-version { - font-size: 24px; - margin-left: 4px; - font-weight: normal; - padding-top: 8px; + font-size: 24px; + margin-left: 4px; + font-weight: normal; + padding-top: 8px; } .data-totals { - padding-left: 18px; + padding-left: 18px; } .data-totals-item { - margin-right: 18px; + margin-right: 18px; } .header-info-list { - padding-left: 18px; - display: flex; - align-items: center; + padding-left: 18px; + display: flex; + align-items: center; } .header-info-item { - display: inline-block; - min-width: 85Px; - padding-top: 4px; - padding-bottom: 2px; + display: inline-block; + min-width: 85Px; + padding-top: 4px; + padding-bottom: 2px; } .info-banner { - display: inline-block; - color: #FFFFFF; - background-color: blue; + display: inline-block; + color: #FFFFFF; + background-color: blue; } .info-banner-text { - display: inline-block; - padding-top: 8px; - padding-bottom: 8px; + display: inline-block; + padding-top: 8px; + padding-bottom: 8px; } .hdw-avatar { - display: inline-block; - margin-top: 10px; - margin-right: 16px; - cursor: pointer; - color: #e4e3e3; + display: inline-block; + margin-top: 10px; + margin-right: 16px; + cursor: pointer; + color: #e4e3e3; } .hdw-avatar:hover { - color: #FFFFFF; + color: #FFFFFF; } .hdw-avatar:hover .el-icon-arrow-down { - transform: rotate(180deg); + transform: rotate(180deg); } .hdw-avatar-icon { - display: inline-flex; - width: 38px; - height: 38px; - border-radius: 50%; - justify-content: center; - background-color: #4ba1fa; - align-items: center; - color: #032c8f; + display: inline-flex; + width: 38px; + height: 38px; + border-radius: 50%; + justify-content: center; + background-color: #4ba1fa; + align-items: center; + color: #032c8f; } .hdw-avatar-icon .iconfont { - font-size: 16px; + font-size: 16px; } .hdw-avatar-text { - color: #4ba1fa; - margin-left: 8px; + color: #4ba1fa; + margin-left: 8px; } .hdw-avatar-text .el-icon-arrow-down { - margin-left: 4px; + margin-left: 4px; } .fuguang-logo { - height: 45px; - margin-left: 8px; - vertical-align: middle; + height: 45px; + margin-left: 8px; + vertical-align: middle; } .header-first-logo { - margin-left: 20px; + margin-left: 20px; } .header-carve-up { - display: inline-block; - height: 28px; - width: 1px; - background-color: #00FEFF; - margin-left: 12px; - margin-right: 12px; + display: inline-block; + height: 28px; + width: 1px; + background-color: #00FEFF; + margin-left: 12px; + margin-right: 12px; } .system-tools { - position: absolute; - top: 8px; - right: 8px; + position: absolute; + top: 8px; + right: 8px; } .tools-item { - display: inline-block; - padding: 8px; - border-radius: 50%; - background-color: #4ba1fa; + display: inline-block; + padding: 8px; + border-radius: 50%; + background-color: #4ba1fa; } .system-tools .iconfont { - font-size: 20px; - color: #041f6c; + font-size: 20px; + color: #041f6c; } </style> \ No newline at end of file -- Gitblit v1.9.1