2020-01-13 19:04:03 +08:00
|
|
|
|
//import "./assets/css/main.css";
|
2020-01-17 16:50:17 +08:00
|
|
|
|
import './assets/stylus/index.scss'
|
2019-12-27 17:53:17 +08:00
|
|
|
|
import "./assets/css/nzIcon.css";
|
2020-02-12 12:06:37 +08:00
|
|
|
|
import "./assets/css/main.css";
|
2019-11-29 15:00:26 +08:00
|
|
|
|
import 'element-ui/lib/theme-chalk/index.css';
|
|
|
|
|
|
import ElementUI from 'element-ui';
|
2019-12-26 17:28:04 +08:00
|
|
|
|
import 'xterm/dist/xterm.css'
|
2019-12-02 16:16:26 +08:00
|
|
|
|
import i18n from './components/common/i18n'
|
2019-11-29 15:00:26 +08:00
|
|
|
|
|
2019-11-28 18:23:49 +08:00
|
|
|
|
import Vue from 'vue'
|
2019-12-05 16:48:23 +08:00
|
|
|
|
import Vuex from 'vuex'
|
|
|
|
|
|
import store from './store/index';
|
2019-11-28 18:23:49 +08:00
|
|
|
|
import App from './App'
|
|
|
|
|
|
import router from './router'
|
2020-01-08 22:19:46 +08:00
|
|
|
|
import VueResource from 'vue-resource'
|
2019-12-02 16:16:26 +08:00
|
|
|
|
import axios from 'axios';
|
2020-12-04 20:53:58 +08:00
|
|
|
|
import "./permission";
|
2020-12-08 21:53:37 +08:00
|
|
|
|
import {hasPermission, hasButton} from "./permission";
|
2020-04-15 22:01:56 +08:00
|
|
|
|
|
|
|
|
|
|
import plTable from 'pl-table'
|
|
|
|
|
|
import 'pl-table/themes/index.css'
|
|
|
|
|
|
|
2019-12-09 19:23:20 +08:00
|
|
|
|
import {post, get, put, del} from './http.js'
|
2020-12-14 20:25:24 +08:00
|
|
|
|
import {clickoutside, bottomBoxWindow, stringTimeParseToUnix, unixTimeParseToString, chartResizeTool, tableSet} from './components/common/js/tools.js';
|
2020-07-17 19:39:48 +08:00
|
|
|
|
import * as tools from './components/common/js/tools.js';
|
2020-07-15 20:43:19 +08:00
|
|
|
|
import * as constants from './components/common/js/constants.js'
|
2019-12-02 16:16:26 +08:00
|
|
|
|
|
2020-04-15 22:01:56 +08:00
|
|
|
|
|
2019-12-02 16:16:26 +08:00
|
|
|
|
import Pagination from "./components/common/pagination"; //引入全局分页组件
|
2019-12-17 17:17:30 +08:00
|
|
|
|
import searchInput from "./components/common/searchInput"; //搜索框组件
|
2020-01-08 22:19:46 +08:00
|
|
|
|
import elementSet from "./components/common/elementSet"; //自定义表头组件
|
|
|
|
|
|
|
2019-12-18 17:00:44 +08:00
|
|
|
|
import projectBox from './components/common/rightBox/projectBox'; //project弹框组件
|
|
|
|
|
|
import moduleBox from './components/common/rightBox/moduleBox'; //module弹框组件
|
2019-12-20 17:18:30 +08:00
|
|
|
|
import editEndpointBox from './components/common/rightBox/editEndpointBox'; //endpoint弹框组件
|
|
|
|
|
|
import addEndpointBox from './components/common/rightBox/addEndpointBox'; //endpoint弹框组件
|
2020-02-19 16:33:01 +08:00
|
|
|
|
import assetBox from "./components/common/rightBox/assetBox"; //资产添加组件
|
2020-11-04 17:54:55 +08:00
|
|
|
|
import batchEditAsset from "./components/common/rightBox/batchEditAsset"; //资产批量修改组件
|
2019-12-24 17:31:51 +08:00
|
|
|
|
import alertConfigBox from "./components/common/rightBox/alertConfigBox"; //告警规则弹框组件
|
2020-01-03 17:17:09 +08:00
|
|
|
|
import panelBox from "./components/common/rightBox/panelBox"; //面板弹框组件
|
2020-01-09 19:30:43 +08:00
|
|
|
|
import moduleListPop from "./components/page/asset/moduleListPop"; //面板弹框组件
|
2020-01-10 18:16:25 +08:00
|
|
|
|
import cabinetConfigBox from "./components/common/popBox/cabinetConfig"; //面板弹框组件
|
2020-03-11 12:27:00 +08:00
|
|
|
|
import modelBox from "./components/common/rightBox/modelBox"; //model弹框
|
2020-03-28 20:44:29 +08:00
|
|
|
|
import bottomBox from "./components/common/bottomBox/bottomBox"; //上滑框
|
2020-03-18 19:22:45 +08:00
|
|
|
|
import loading from "./components/common/loading";
|
2020-03-26 19:58:09 +08:00
|
|
|
|
import mibBox from "./components/common/rightBox/mibBox";
|
2020-04-14 19:33:57 +08:00
|
|
|
|
import leftMenu from "./components/common/leftMenu";
|
2020-04-24 12:42:58 +08:00
|
|
|
|
import pickTime from "./components/common/pickTime";
|
2020-10-16 19:26:50 +08:00
|
|
|
|
import bus from "./libs/bus";
|
2021-01-18 18:58:57 +08:00
|
|
|
|
import {cancelWithChange} from "./components/common/js/tools";
|
2019-12-16 17:14:58 +08:00
|
|
|
|
|
2019-12-02 16:16:26 +08:00
|
|
|
|
Vue.component("Pagination", Pagination);
|
2019-12-16 17:14:58 +08:00
|
|
|
|
Vue.component("searchInput", searchInput);
|
2020-01-08 22:19:46 +08:00
|
|
|
|
Vue.component("element-set", elementSet);
|
2019-12-18 17:00:44 +08:00
|
|
|
|
Vue.component("project-box", projectBox);
|
|
|
|
|
|
Vue.component("module-box", moduleBox);
|
2019-12-19 17:22:18 +08:00
|
|
|
|
Vue.component("edit-endpoint-box", editEndpointBox);
|
2019-12-20 17:18:30 +08:00
|
|
|
|
Vue.component("add-endpoint-box", addEndpointBox);
|
2020-02-19 16:33:01 +08:00
|
|
|
|
Vue.component("asset-box", assetBox);
|
2020-11-04 17:54:55 +08:00
|
|
|
|
Vue.component("batch-edit-asset", batchEditAsset);
|
2019-12-24 17:31:51 +08:00
|
|
|
|
Vue.component("alert-config-box", alertConfigBox);
|
2020-01-03 17:17:09 +08:00
|
|
|
|
Vue.component("panel-box", panelBox);
|
2020-01-09 19:30:43 +08:00
|
|
|
|
Vue.component("module-list-pop", moduleListPop);
|
2020-01-10 18:16:25 +08:00
|
|
|
|
Vue.component("cabinet-config-box", cabinetConfigBox);
|
2020-03-11 12:27:00 +08:00
|
|
|
|
Vue.component("model-box", modelBox);
|
2020-03-18 19:22:45 +08:00
|
|
|
|
Vue.component('loading',loading);
|
2020-03-27 15:41:26 +08:00
|
|
|
|
Vue.component('bottom-box', bottomBox);
|
2020-03-26 19:58:09 +08:00
|
|
|
|
Vue.component('mib-box',mibBox);
|
2020-04-14 19:33:57 +08:00
|
|
|
|
Vue.component('left-menu',leftMenu);
|
2020-04-24 12:42:58 +08:00
|
|
|
|
Vue.component('pick-time',pickTime);
|
2019-12-02 16:16:26 +08:00
|
|
|
|
|
2019-12-17 17:17:30 +08:00
|
|
|
|
Vue.prototype.$axios = axios;
|
2019-12-02 16:16:26 +08:00
|
|
|
|
Vue.prototype.$post = post;
|
|
|
|
|
|
Vue.prototype.$get = get;
|
2019-12-09 19:23:20 +08:00
|
|
|
|
Vue.prototype.$put = put;
|
|
|
|
|
|
Vue.prototype.$delete = del;
|
2020-07-15 20:43:19 +08:00
|
|
|
|
Vue.prototype.$CONSTANTS = constants;
|
2020-07-17 19:39:48 +08:00
|
|
|
|
Vue.prototype.$TOOLS = tools;
|
2020-03-30 14:14:09 +08:00
|
|
|
|
Vue.prototype.$bottomBoxWindow = bottomBoxWindow; //底部上滑框控制
|
2020-05-15 14:54:51 +08:00
|
|
|
|
Vue.prototype.$stringTimeParseToUnix = stringTimeParseToUnix;
|
2020-05-15 15:03:42 +08:00
|
|
|
|
Vue.prototype.$unixTimeParseToString = unixTimeParseToString;
|
2020-05-29 21:06:55 +08:00
|
|
|
|
Vue.prototype.$chartResizeTool = chartResizeTool;
|
2020-08-07 11:11:43 +08:00
|
|
|
|
Vue.prototype.$tableSet = tableSet;
|
2020-03-09 18:05:43 +08:00
|
|
|
|
Vue.prototype.$tableHeight = { //列表页表格的高度
|
|
|
|
|
|
normal: 'calc(100% - 100px)', //常规高度,特例在下方定义
|
2020-03-18 16:00:06 +08:00
|
|
|
|
openSubList: { //打开二级列表后的高度
|
|
|
|
|
|
mainList: 'calc(100% - 60px)',
|
2020-04-21 18:00:21 +08:00
|
|
|
|
subList: 'calc(100% - 86px)',
|
|
|
|
|
|
toTopBtnTop: 'calc(50% - 11px)'
|
2020-03-18 16:00:06 +08:00
|
|
|
|
},
|
2020-04-21 18:00:21 +08:00
|
|
|
|
toTopBtnTop: 'calc(100% - 73px)',
|
2020-03-25 18:38:13 +08:00
|
|
|
|
noPagination: 'calc(100% - 60px)', //特例:没有翻页组件
|
2020-03-09 18:05:43 +08:00
|
|
|
|
};
|
2019-11-28 18:23:49 +08:00
|
|
|
|
|
2020-10-16 19:26:50 +08:00
|
|
|
|
Vue.mixin({
|
2020-12-21 11:51:58 +08:00
|
|
|
|
data:function(){
|
|
|
|
|
|
return {
|
|
|
|
|
|
prevent_opt:{
|
2020-12-21 11:59:49 +08:00
|
|
|
|
save:false,
|
2020-12-21 11:51:58 +08:00
|
|
|
|
import:false,
|
|
|
|
|
|
dumplicate:false,
|
|
|
|
|
|
delete:false,
|
|
|
|
|
|
refresh:false,
|
|
|
|
|
|
query:false,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-12-17 11:07:57 +08:00
|
|
|
|
methods: {
|
|
|
|
|
|
utcTimeToTimezone:function(time){
|
|
|
|
|
|
if(time){
|
|
|
|
|
|
return bus.UTCTimeToConfigTimezone(time)
|
2020-12-04 20:53:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-12-17 11:07:57 +08:00
|
|
|
|
utcTimeToTimezoneStr:function(time,format='yyyy-MM-dd hh:mm:ss'){
|
|
|
|
|
|
if(time){
|
|
|
|
|
|
return bus.timeFormate(bus.UTCTimeToConfigTimezone(time),format)
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return '-'
|
2020-12-04 20:53:58 +08:00
|
|
|
|
}
|
2020-12-17 11:07:57 +08:00
|
|
|
|
},
|
|
|
|
|
|
timezoneToUtcTime:function(time){
|
|
|
|
|
|
if(time){
|
|
|
|
|
|
return bus.configTimezoneToUTCTime(time)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
timezoneToUtcTimeStr:function(time,format='yyyy-MM-dd hh:mm:ss'){
|
|
|
|
|
|
if(time){
|
|
|
|
|
|
return bus.timeFormate(this.timezoneToUtcTime(time),format)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
tableTitleReset:function(src,dist){
|
|
|
|
|
|
dist.forEach(item=>{
|
|
|
|
|
|
let title=src.find(t=>t.prop == item.prop)
|
|
|
|
|
|
if(title&&title.label){
|
|
|
|
|
|
item.label=title.label;
|
|
|
|
|
|
}
|
2021-03-05 20:34:58 +08:00
|
|
|
|
});
|
2020-12-17 11:07:57 +08:00
|
|
|
|
},
|
|
|
|
|
|
hasButton(code) {
|
|
|
|
|
|
return hasButton(this.$store.getters.buttonList, code);
|
|
|
|
|
|
},
|
|
|
|
|
|
toTop(wrap) {
|
|
|
|
|
|
let currentTop = wrap.scrollTop;
|
|
|
|
|
|
let interval = currentTop/10;
|
|
|
|
|
|
let intervalFunc = setInterval(function(){ //花200ms分10次回到顶部,模拟动画效果
|
|
|
|
|
|
if (currentTop == 0) {
|
|
|
|
|
|
clearInterval(intervalFunc);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
currentTop = (currentTop - interval) < interval*0.5 ? 0 : currentTop - interval;
|
|
|
|
|
|
wrap.scrollTop = currentTop;
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 20);
|
|
|
|
|
|
},
|
|
|
|
|
|
toTopBtnHandler(wrap) {
|
|
|
|
|
|
let vm = this;
|
|
|
|
|
|
wrap.addEventListener('scroll', bus.debounce(function() {
|
|
|
|
|
|
vm.tools.showTopBtn = wrap.scrollTop > 50;
|
|
|
|
|
|
vm.tools.tableHover = wrap.scrollTop > 50;
|
|
|
|
|
|
}, 100));
|
2020-12-24 18:45:12 +08:00
|
|
|
|
},
|
|
|
|
|
|
numberWithEConvent(num) {
|
|
|
|
|
|
if (num) {
|
|
|
|
|
|
if ((("" + num).indexOf('E') != -1) || (("" + num).indexOf('e') != -1)) {
|
|
|
|
|
|
let regExp = new RegExp('^((\\d+.?\\d+)[Ee]{1}(\\d+))$', 'ig');
|
|
|
|
|
|
let result = regExp.exec(num);
|
|
|
|
|
|
let resultValue = "";
|
|
|
|
|
|
let power = "";
|
|
|
|
|
|
if (result != null) {
|
|
|
|
|
|
resultValue = result[2];
|
|
|
|
|
|
power = result[3];
|
|
|
|
|
|
result = regExp.exec(num);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (resultValue != "") {
|
|
|
|
|
|
if (power != "") {
|
|
|
|
|
|
let powVer = Math.pow(10, power);
|
|
|
|
|
|
resultValue = resultValue * powVer;
|
|
|
|
|
|
return resultValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return num;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
},
|
2021-03-05 20:34:58 +08:00
|
|
|
|
translation(key) {
|
|
|
|
|
|
return i18n.t(key);
|
|
|
|
|
|
},
|
2021-03-12 18:04:17 +08:00
|
|
|
|
copyRow(row,rightBoxValKey,idKey= 'id',show = false,format,callback){
|
|
|
|
|
|
/*
|
|
|
|
|
|
row 表格当前行
|
|
|
|
|
|
rightBoxValKey 右侧弹窗绑定的 data
|
|
|
|
|
|
idKey 当前数据的唯一标识
|
|
|
|
|
|
show 打开对应的弹窗 函数
|
|
|
|
|
|
format 是否需要对当前行进行处理
|
|
|
|
|
|
callBack 回调
|
|
|
|
|
|
*/
|
|
|
|
|
|
let rowCopy={...row};
|
|
|
|
|
|
if(format){
|
|
|
|
|
|
rowCopy=format(rowCopy)
|
|
|
|
|
|
}
|
|
|
|
|
|
delete rowCopy[idKey];
|
|
|
|
|
|
this[rightBoxValKey]=rowCopy;
|
|
|
|
|
|
if(typeof show==='function'){
|
|
|
|
|
|
show()
|
|
|
|
|
|
}else if(typeof show==='string'){
|
|
|
|
|
|
this[show]=true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this['rightBox']['show']=true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(callback){
|
|
|
|
|
|
callback()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-12-17 11:07:57 +08:00
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
getMenuList() {
|
|
|
|
|
|
return this.$store.state.user.menuList;
|
|
|
|
|
|
},
|
|
|
|
|
|
getButtonList() {
|
|
|
|
|
|
return this.$store.state.buttonList;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-12-04 20:53:58 +08:00
|
|
|
|
});
|
2020-10-16 19:26:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
2019-12-17 17:17:30 +08:00
|
|
|
|
Vue.config.productionTip = false;
|
|
|
|
|
|
Vue.use(ElementUI);
|
|
|
|
|
|
Vue.use(Vuex);
|
2020-01-08 22:19:46 +08:00
|
|
|
|
Vue.use(VueResource);
|
2020-04-15 22:01:56 +08:00
|
|
|
|
Vue.use(plTable);
|
2020-12-08 21:53:37 +08:00
|
|
|
|
Vue.use(hasPermission);
|
2019-12-04 13:45:37 +08:00
|
|
|
|
|
2020-03-27 18:44:59 +08:00
|
|
|
|
/*指令*/
|
2021-01-18 18:58:57 +08:00
|
|
|
|
Vue.directive('cancel',cancelWithChange)
|
2020-03-27 18:44:59 +08:00
|
|
|
|
Vue.directive('clickoutside', clickoutside);
|
2020-05-07 18:36:39 +08:00
|
|
|
|
window.resizing = false;
|
2019-12-26 17:28:04 +08:00
|
|
|
|
window.vm = new Vue({
|
2019-11-28 18:23:49 +08:00
|
|
|
|
el: '#app',
|
|
|
|
|
|
router,
|
2019-12-02 16:16:26 +08:00
|
|
|
|
i18n,
|
2019-12-05 16:48:23 +08:00
|
|
|
|
store,
|
|
|
|
|
|
components: {App},
|
2020-12-04 20:53:58 +08:00
|
|
|
|
template: '<App/>',
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
//store.commit()
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-12-12 17:07:33 +08:00
|
|
|
|
|
2020-03-05 21:30:45 +08:00
|
|
|
|
export default vm;
|
2020-03-19 20:44:14 +08:00
|
|
|
|
|
|
|
|
|
|
/* 重写组件内容 */
|
2020-12-14 20:25:24 +08:00
|
|
|
|
/*const elUi = require("element-ui");
|
2020-04-15 22:01:56 +08:00
|
|
|
|
const pl = require("pl-table");
|
2020-03-20 21:05:31 +08:00
|
|
|
|
//去掉el-table表头右侧的滚动条预留空间
|
2020-03-19 20:44:14 +08:00
|
|
|
|
elUi.Table.components.TableHeader.computed.hasGutter = () => {return false;};
|
2020-12-14 20:25:24 +08:00
|
|
|
|
pl.PlTable.components.ElTable.components.TableHeader.computed.hasGutter = () => {return false;};*/
|