perf: 样式调整、中文国际化整理

This commit is contained in:
chenjinsong
2020-01-15 22:21:19 +08:00
parent 0e48c62c0c
commit 7f894f6b79
7 changed files with 460 additions and 176 deletions

View File

@@ -1,6 +1,7 @@
$global-text-color-active: #ee9d3f; // 全局文字active字色 $global-text-color-active: #ee9d3f; // 全局文字active字色
$header-text-color: #fff; // header默认字色 $header-text-color: #e5e5e5; // header默认字色
$header-text-color-active: #fff; // header高亮字色
$header-text-color-hover: #444; //header hover字色 $header-text-color-hover: #444; //header hover字色
$content-left-text-color: #666; //左侧菜单默认字色 $content-left-text-color: #666; //左侧菜单默认字色

View File

@@ -78,7 +78,6 @@ html {
cursor: pointer; cursor: pointer;
line-height: 18px; line-height: 18px;
font-size: 14px; font-size: 14px;
font-weight: 600;
padding: 4px 6px; padding: 4px 6px;
text-align: center; text-align: center;
box-sizing: border-box; box-sizing: border-box;
@@ -333,10 +332,11 @@ html {
display: flex; display: flex;
height: 36px; height: 36px;
min-width: 100px; min-width: 100px;
} }
.nz-table-gear .content-right .el-table__row td:first-of-type {
{ padding-left: 33px;
}
.nz-table-gear {
display: block; display: block;
width: 38px; width: 38px;
margin-left:-10px; margin-left:-10px;
@@ -346,6 +346,9 @@ html {
border-right:2px solid #d4d4d4; border-right:2px solid #d4d4d4;
box-sizing: border-box; box-sizing: border-box;
} }
.nz-table-gear>i {
cursor: pointer;
}
.nz-table-txt{ .nz-table-txt{
padding-left:10px; padding-left:10px;
display: flex; display: flex;
@@ -756,4 +759,4 @@ html {
.el-icon-setting:before { .el-icon-setting:before {
content: "\E6CA"; content: "\E6CA";
color: #BA3939; color: #BA3939;
} }

View File

@@ -38,11 +38,11 @@
<el-submenu index="2" popper-class="nz-submenu"> <el-submenu index="2" popper-class="nz-submenu">
<template slot="title"> <template slot="title">
<div @click="jumpToProject(projectData[0])" :class ="activeIndex == 'project' ? 'menu-active' :''" >{{$t('overall.project')}}</div> <div @click="jumpToProject(projectData[0], 0)" :class ="activeIndex == 'project' ? 'menu-active' :''" >{{$t('overall.project')}}</div>
</template> </template>
<template v-for="(item, index) in projectData"> <template v-for="(item, index) in projectData">
<el-menu-item :index="'2-' + index"> <el-menu-item :index="'2-' + index">
<div @click="jumpToProject(item)" :class="{'menu-item-active' :(activeIndex == 'project' && activeItemIndex == item )}"> <div @click="jumpToProject(item)" :class="{'menu-item-active' :(activeIndex == 'project' && activeItemIndex == item.id)}">
<span>{{item.name}}</span> <span>{{item.name}}</span>
<div @click.stop="toEditProject(item)" class="menu-edit"><i style="color: inherit" <div @click.stop="toEditProject(item)" class="menu-edit"><i style="color: inherit"
class="el-icon-edit-outline"></i></div> class="el-icon-edit-outline"></i></div>
@@ -56,7 +56,7 @@
</template> </template>
<template v-for="(item, index) in assetData"> <template v-for="(item, index) in assetData">
<el-menu-item :index="'3-' + index"> <el-menu-item :index="'3-' + index">
<div @click="jumpToAsset('asset',item.id)" :class="{'menu-item-active' : (activeIndex == 'asset' && activeItemIndex == item.id ) }"> <div @click="jumpToAsset(item.id)" :class="{'menu-item-active' : (activeIndex == 'asset' && indOf(activeItemIndexes, item.id) > -1) }">
<span>{{item.name}}</span> <span>{{item.name}}</span>
<idc-config-box :post-idc="item" ref="idcConfigBox" placement="left" @after="getIDCOptionData" :button-class="'menu-edit'"> <idc-config-box :post-idc="item" ref="idcConfigBox" placement="left" @after="getIDCOptionData" :button-class="'menu-edit'">
<template v-slot:optionZone> <template v-slot:optionZone>
@@ -71,18 +71,18 @@
</el-submenu> </el-submenu>
<el-submenu index="4-0" popper-class="nz-submenu"> <el-submenu index="4-0" popper-class="nz-submenu">
<template slot="title"> <template slot="title">
<div @click="jumpTo('alertList')" :class ="activeIndex == 'alertList' ? 'menu-active' :''">{{$t('overall.alert')}}</div> <div @click="jumpTo('alertList')" :class ="activeIndex == 'alertList' || activeIndex == 'alertConfig' ? 'menu-active' :''">{{$t('overall.alert')}}</div>
</template> </template>
<el-menu-item index="4-1"> <el-menu-item index="4-1">
<div @click="jumpTo('alertList')" :class ="activeIndex == 'alertList' ? 'menu-item-active' :''">{{$t('alert.alertList')}}</div> <div @click="jumpTo('alertList')" :class ="activeIndex == 'alertList' ? 'menu-item-active' :''">{{$t('alert.message')}}</div>
</el-menu-item> </el-menu-item>
<el-menu-item index="4-2"> <el-menu-item index="4-2">
<div @click="jumpTo('alertConfig')" :class ="activeIndex == 'alertConfig' ? 'menu-item-active' :''">{{$t('alert.alertConfig')}}</div> <div @click="jumpTo('alertConfig')" :class ="activeIndex == 'alertConfig' ? 'menu-item-active' :''">{{$t('alert.rule')}}</div>
</el-menu-item> </el-menu-item>
</el-submenu> </el-submenu>
<el-submenu index="5" popper-class="nz-submenu"> <el-submenu index="5" popper-class="nz-submenu">
<template slot="title"> <template slot="title">
<div @click="jumpTo('account')" :class ="activeIndex == 'account' ? 'menu-active' :''">{{$t('overall.config')}}</div> <div @click="jumpTo('account')" :class ="activeIndex == 'account' || activeIndex == 'promServer' ? 'menu-active' :''">{{$t('overall.config')}}</div>
</template> </template>
<el-menu-item index="5-0"> <el-menu-item index="5-0">
<div @click="jumpTo('account')" :class="{'menu-item-active' :(activeIndex == 'account' )}">{{$t('config.account.account')}}</div> <div @click="jumpTo('account')" :class="{'menu-item-active' :(activeIndex == 'account' )}">{{$t('config.account.account')}}</div>
@@ -129,6 +129,7 @@
assetData: [], assetData: [],
activeIndex:'', activeIndex:'',
activeItemIndex:'', activeItemIndex:'',
activeItemIndexes: [],
editPanel:{//新增or编辑的panel editPanel:{//新增or编辑的panel
id:'', id:'',
name: '' name: ''
@@ -165,32 +166,32 @@
}, },
createMenu: [ //新增按钮内容 createMenu: [ //新增按钮内容
{ {
label: this.$t('dashboard.panel.createPanelTitle'), label: this.$t('dashboard.panel.title'),
url: 'panel', url: 'panel',
type: 0 type: 0
}, },
{ {
label: this.$t('project.project.createProject'), label: this.$t('project.project.project'),
url: 'project', url: 'project',
type: 1 type: 1
}, },
{ {
label: this.$t('project.module.createModule'), label: this.$t('project.module.module'),
url: 'project', url: 'project',
type: 2 type: 2
}, },
{ {
label: this.$t('project.endpoint.createEndpoint'), label: this.$t('project.endpoint.endpoint'),
url: 'project', url: 'project',
type: 3 type: 3
}, },
{ {
label: this.$t('asset.createAsset'), label: this.$t('asset.asset'),
url: 'asset', url: 'asset',
type: 4 type: 4
}, },
{ {
label: this.$t('alert.config.createAlertConfig'), label: this.$t('alert.config.alertConfig'),
url: 'alertConfig', url: 'alertConfig',
type: 5 type: 5
} }
@@ -208,7 +209,10 @@
}, },
methods: { methods: {
jumpTo(data) { jumpTo(data) {
if (data != "asset") {
this.activeItemIndexes = [];
this.$store.state.assetData = {selectedData: [], step: 0, type: -1};
}
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {
@@ -244,19 +248,20 @@
this.$refs.alertConfigBox.show(true, true); this.$refs.alertConfigBox.show(true, true);
} }
}, },
jumpToAsset(data, id) { jumpToAsset(id) {
if (id != this.$store.state.assetData.selectedData) { let index = this.indOf(this.activeItemIndexes, id);
this.$store.state.assetData = {selectedData: id, step: this.$store.state.assetData.step+1}; if (index > -1) {
this.activeItemIndexes.splice(index, 1);
} else { } else {
this.$store.state.assetData.step = this.$store.state.assetData.step+1; this.activeItemIndexes.push(id);
} }
this.activeItemIndex = id this.$store.state.assetData = {selectedData: this.activeItemIndexes, step: this.$store.state.assetData.step+1, type: 1};
this.jumpTo(data); this.jumpTo('asset');
}, },
jumpToProject(p) { jumpToProject(p) {
this.currentProject = p; this.currentProject = p;
this.$store.commit('setProject', p); this.$store.commit('setProject', p);
this.activeItemIndex = p this.activeItemIndex = p.id;
this.jumpTo('project'); this.jumpTo('project');
}, },
getUserData() { getUserData() {
@@ -352,6 +357,7 @@
} }
if (!flag && this.projectData.length > 0) { if (!flag && this.projectData.length > 0) {
this.currentProject = this.projectData[0]; this.currentProject = this.projectData[0];
this.activeItemIndex = this.currentProject.id;
this.$store.commit('setProject', this.currentProject); this.$store.commit('setProject', this.currentProject);
} }
} }
@@ -361,6 +367,18 @@
this.$refs.projectBox.show(true,true); this.$refs.projectBox.show(true,true);
this.editProject = Object.assign({}, p); this.editProject = Object.assign({}, p);
}, },
indOf(a, b) {
let c = [];
for (let i = 0; i < a.length; i++) {
c.push(a[i]);
}
return c.indexOf(b);
/*if (c.indexOf(b) > -1) {
return true;
} else {
return false;
}*/
},
panelListReload(){ panelListReload(){
if(this.$route.path==='/panel'){ if(this.$route.path==='/panel'){
this.$store.commit('panelListChange',true);//新增panel之后,且当前页面为panel页面则更新panel列表 this.$store.commit('panelListChange',true);//新增panel之后,且当前页面为panel页面则更新panel列表
@@ -382,9 +400,8 @@
this.getAssetData(); this.getAssetData();
this.getProjectList(); this.getProjectList();
// 刷新后有高亮 // 刷新后有高亮
let activePath = this.$route.path.slice(1) let activePath = this.$route.path.slice(1);
this.activeIndex = activePath this.activeIndex = activePath;
// console.log(activePath,this.activeIndex)
}, },
computed: { computed: {
projectListReloadWatch() { projectListReloadWatch() {
@@ -393,9 +410,20 @@
getIdcData() { getIdcData() {
return this.$store.state.assetDcList; return this.$store.state.assetDcList;
}, },
getAssetDcData() {
return this.$store.state.assetData
},
}, },
watch: { watch: {
getAssetDcData: {
handler(newVal) {
if (newVal.type == 0) {
this.activeItemIndexes = newVal.selectedData;
}
},
deep: true,
immediate: true
},
getIdcData: { getIdcData: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
this.getAssetData() this.getAssetData()
@@ -418,7 +446,7 @@
background-color: transparent; background-color: transparent;
} }
.header .el-menu--horizontal>.el-submenu .el-submenu__title .menu-active{ .header .el-menu--horizontal>.el-submenu .el-submenu__title .menu-active{
border-bottom:$global-text-color-active solid 2px; border-bottom: $global-text-color-active solid 2px;
border-radius: 2px; border-radius: 2px;
height: 26px; height: 26px;
line-height: 16px; line-height: 16px;
@@ -426,7 +454,10 @@
font-size: 16px; font-size: 16px;
margin: 0 auto -8px; margin: 0 auto -8px;
font-weight: 500; font-weight: 500;
color: $header-text-color-active;
}
.header .el-menu--horizontal>.el-submenu .el-submenu__title .menu-active:hover {
color: $header-text-color-hover;
} }
.header .el-menu--horizontal>.el-submenu .el-submenu__title i { .header .el-menu--horizontal>.el-submenu .el-submenu__title i {
color: inherit; color: inherit;
@@ -447,7 +478,7 @@
padding: 0; padding: 0;
} }
.header .el-menu--horizontal>.el-submenu .el-submenu__title:hover { .header .el-menu--horizontal>.el-submenu .el-submenu__title:hover {
color: #444 !important; color: $header-text-color-hover !important;
} }
.el-menu.el-menu--horizontal { .el-menu.el-menu--horizontal {
@@ -522,6 +553,9 @@
</style> </style>
<style scoped> <style scoped>
.menu-create-title {
font-size: 14px;
}
.header { .header {
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;

View File

@@ -1,62 +1,71 @@
import zhLocale from 'element-ui/lib/locale/lang/zh-CN' //引入element语言包 import zhLocale from 'element-ui/lib/locale/lang/zh-CN' //引入element语言包
const cn = { const cn = {
overall: { overall:{
dashboard: '仪表盘', dashboard:'仪表盘',
project: '工程', project:'系统',
alert: "告警", alert: "告警",
asset: '资产', asset:'资产',
config: '设置', config:'设置',
create: '新增', create: '新增',
edit: '修改', edit: '编辑',
delete: '删除', delete: '删除',
esc: '取消', esc: '取消',
cancel: '取消', cancel: '取消',
save: '保存', save: '保存',
search: '搜索', search: '搜索',
add: '新增', add: "新增",
option: "操作" option: "操作",
clearAll: "清空",
clear: "清除",
name: '名称',
cover: '覆盖',
signOut: '登出',
select: '选择',
ok: 'Ok',
all: '全选',
other: "其他"
}, },
dashboard:{ dashboard:{
title:'仪表盘', title:'仪表盘',
panel:{ panel:{
title:'板', title:'板',
searchItem:{ searchItem:{
name:'标题' name:'名称'
}, },
//面板-侧滑框 //面板-侧滑框
createPanelTitle: "创建面板", createPanelTitle: "新增面板",
selectPanelTitle:"选择面板", selectPanelTitle:"选择面板",
createPanelTitleSec:"创建新面板", createPanelTitleSec:"新面板",
editPanelTitle: "编辑面板", editPanelTitle: "面板",
panelForm:{ panelForm:{
panelName:"面板名称" , panelName:"面板名称",
panelId:"ID" panelId:"ID"
} , },
//图表-侧滑框 //图表-侧滑框
createChartTitle: "Create Chart", createChartTitle: "新增图表",
editChartTitle: "Edit Chart", editChartTitle: "编辑图表",
chartForm:{ chartForm:{
chartId:"ID", chartId:"ID",
chartName:"图表名称", chartName:"图表名称",
type:"类", type:"类",
typeVal:{ typeVal:{
line:{ line:{
label:"线" label:"线"
}, },
bar:{ bar:{
label:"柱状图" label:"柱"
}, },
table:{ table:{
label:"表格", label:"表格"
} }
}, },
width:"宽", width:"宽",
high:"高", high:"高",
metric:"指标", metric:"Metric",
addMetric:"添加指标", addMetric:"新增Metric",
}, },
chartTableColumn:{ chartTableColumn:{
metric:'指标', metric:'metric',
label:'标签', label:'标签',
time:'时间', time:'时间',
value:'值', value:'值',
@@ -64,75 +73,245 @@ const cn = {
startTime:'开始时间', startTime:'开始时间',
endTime:'结束时间', endTime:'结束时间',
to:'至', to:'至',
recOne:'近1小时', recOne:'近1小时',
recFour:'近4小时', recFour:'近4小时',
recOneDay:'近1', recOneDay:'近1',
yesterday:'昨', yesterday:'昨',
recSevenDay:'近7日', recSevenDay:'最近1星期',
recOneMonth:'近一个月', recOneMonth:'最近1月',
curMonth:'本月', curMonth:'本月',
lastMonth:'上月', lastMonth:'上月',
refreshInterval:{ refreshInterval:{
never:'从不', never:'从不',
oneMinute:'1分', oneMinute:'1 分',
threeMinutes:'3分', threeMinutes:'3 分',
fiveMinutes:'5分', fiveMinutes:'5 分',
tenMinutes:'10分', tenMinutes:'10 分',
}, },
view:'查看', view:'查看',
confirm:'确 定', confirm:'Ok',
cancel:'取 消' cancel:'取消'
}, },
metric:{ metric:{
name:"指标名称", name:"Metric",
normal:"Normal", normal:"Normal",
expert:"Expert", expert:"Expert",
label:"指标标签", label:"MetricLabel",
addMetric:"添加指标", addMetric:"Create Metric",
expertTip:"请输入表达式", expertTip:"Please enter an expression",
goPanelTip:"是否前去看板,查看创建的图表?", goPanelTip:"Go to the panel to view the created chart ?",
previewChart:"预览图表", previewChart:"Preview Chart",
singleChartShow:"单图展示", singleChartShow:"Single Graph Display",
multiChartsShow:"多图展示", multiChartsShow:"Multi Graph Display",
createPanel:"创建面板", createPanel:"Create Panel",
selectPanel:"选择已有面板", selectPanel:"Select Panel",
saveChartToPanel:"保存图表到看板" saveChartToPanel:"Save Chart To Panel"
}, },
metricPreview:{ metricPreview:{
title:'指标预览', title:'Metric Preview',
}, },
refresh:'刷新', refresh:'refresh',
edit:'编辑', edit:'edit',
delete:'删除', delete:'delete',
screen:'全屏' screen:'fullScreen'
}, },
asset: { validate: { //校验规则
required: '必填项',
number: '必须是数字',
email:'不合法的E-mail地址',
tel:'不合法的电话号码',
host:'不合法的IP',
fileSize:'文件过大',
config: {
account: {
}
}
},
search: {
searchTip: '点击或回车执行搜索',
recentSearch: '搜索记录',
noRecentSearch: '无搜索记录'
},
tip: {
confirmDelete: "确认删除吗?",
assetConfirmDelete: '关联的Endpoint和告警将会被删除确认删除吗',
yes: "是",
no: "否",
deleteSuccess: "删除成功",
saveSuccess: "保存成功",
coverSuccess: '覆盖成功',
refreshLater:'请稍后刷新'
},
asset:{
asset: '资产',
EditAsset:'Edit Asset',
createAssetTab:{
title:'新增资产',
sn:'SN',
host:'Host',
state:'状态',
selectTip:'请选择',
inStock: '在库',
notInStock: '出库',
assetInfo:'资产信息',
assetType:'资产类型',
assetTypeTab:{
assetType:'资产类型',
addAssetType:'新增资产类型',
existAssetType:'已存在的资产类型'
},
vendor:'厂商/型号',
vendorTab:{
vendor:'厂商/型号',
vendorName:'新厂商',
existVendor:'已有厂商',
modelName:'新型号',
existModel:'已有型号'
},
purchaseDate:'购买日期',
dataSelectTip:'请选择日期',
dc:'DC',
dcName:'DC名称',
AddIdcTab:{
title:'新增DC',
dcName:'DC名称',
location:'地区',
principal:'负责人',
tel:'电话'
},
editIdcTab:{
title:'编辑DC',
dcName:'DC名称',
location:'地区',
principal:'负责人',
tel:'电话'
},
location:'地区',
principal:'负责人',
tel:'电话',
cabinet: '机柜',
AddCabinetTab:{
title:'新增机柜',
name:'名称',
uSize:'U位',
remark:'描述',
DC:'DC',
},
editCabinetTab:{
title:'编辑机柜',
name:'名称',
uSize:'U位',
remark:'描述',
DC:'DC',
},
uSize:'U位',
remark:'描述',
cli:'CLI账号',
loginType:'登录类型',
password:'密码',
ssh:'SSH-Key',
account:'用户名',
port:'端口',
upload:'上传',
clickToUpload:'上传',
clickToCover:'覆盖',
sshKeyWasConfig:'SSH-KEY已配置'
},
editAssetTab:{
title:'新增资产',
sn:'SN',
host:'Host',
state:'状态',
modelId:'组件',
alert:'告警信息',
assetInfo:'资产信息',
assetType:'资产类型',
vendor:'厂商/型号',
vendorTab:{
vendor:'厂商/型号',
vendorName:'新厂商',
existVendor:'已有厂商',
modelName:'新型号',
existModel:'已有型号'
},
purchaseDate:'购买日期',
dataSelectTip:'请选择日期',
dc:'DC',
dcName:'DC名称',
AddIdcTab:{
title:'新增DC',
dcName:'DC名称',
location:'地区',
principal:'负责人',
tel:'电话'
},
editIdcTab:{
title:'编辑DC',
dcName:'DC名称',
location:'地区',
principal:'负责人',
tel:'电话'
},
location:'地区',
principal:'负责人',
tel:'电话',
cabinet: '机柜',
AddCabinetTab:{
title:'新增机柜',
name:'名称',
uSize:'U位',
remark:'描述',
DC:'DC',
},
editCabinetTab:{
title:'编辑机柜',
name:'名称',
uSize:'U位',
remark:'描述',
DC:'DC',
},
uSize:'U位',
remark:'描述',
cli:'CLI账号',
loginType:'登录类型',
password:'密码',
ssh:'SSH-Key',
account:'用户名',
port:'端口',
upload:'上传',
clickToUpload:'上传',
},
tableTitle: { tableTitle: {
id: 'ID', id: 'ID',
assetType: '资产类型', assetType: '资产类型',
device: 'Device SN', device: 'SN',
ip: 'IP', host: 'Host',
assetState: '资产状态', assetState: '状态',
module: 'Module', modules: '组件',
alert: 'alert', alerts: '告警信息',
dataCenter: '数据中心', dataCenter: 'DC',
cabinet: '机柜', cabinet: '机柜',
model: '型号', model: '型号',
manufacturer: '厂商', manufacturer: '厂商',
procurementDate: '购日期', procurementDate: '购日期',
warrantyDate: '保修截止期', principal: '负责人',
deviceDuty: '设备责任人', principalTel: '电话',
option: '操作', option: "操作"
}, },
tagTableTitle: { tagTableTitle: {
projectName: '项目名称', projectName: '系统名称',
moduleName: 'Module Name', moduleName: '组件名称',
endPoint: 'EndPoint', endPoint: 'EndPoint',
alert: 'alert', alert: '告警',
}, },
}, },
config: { config: {
config: "设置",
account: { account: {
accountList: "用户列表",
//列表表头 //列表表头
account: "用户", account: "用户",
language: "语言", language: "语言",
@@ -144,52 +323,103 @@ const cn = {
//侧滑框 //侧滑框
accountId: "用户ID", accountId: "用户ID",
createAccount: "新增用户", createAccount: "新增用户",
editAccount: "修改用户", editAccount: "编辑用户",
notCurrentlySupport: '暂不支持' notCurrentlySupport: '暂不支持',
password: '密码'
}, },
promServer: { promServer: {
promServerList: "Prometheus Server",
//侧滑框 //侧滑框
promId: "Prometheus Server ID", promId: "Prometheus Server ID",
createProm: "新增Prometheus Server", createProm: "新增Prometheus Server",
editProm: "修改Prometheus Server" editProm: "修改Prometheus Server",
type: "类别"
}, },
}, },
alert: { alert: {
alert: "告警", alert: "告警",
alertList: "告警列表", message: '信息',
alertConfig: "告警设置", rule: '规则',
alertList: "告警信息",
alertConfig: "告警规则",
alertName: "告警名称",
severity: "等级",
description: "描述",
summary: "概要",
startAt: "开始时间",
endAt: "结束时间",
list: { list: {
alertName: "告警名称", //表头
linkedId: "关联ID", linked: "关联",
severity: "告警级别", type: "别",
type: "类型",
summary: "摘要",
description: "描述",
state: "状态", state: "状态",
startAt: "时间",
endAt: "消除时间",
charts: "图表", charts: "图表",
//表内容 //表内容
projectalert: "Project Alert", projectAlert: "系统告警",
modulealert: "Module Alert", moduleAlert: "组件告警",
devicealert: "Device Alert", deviceAlert: "设备告警",
pending: "Pending", pending: "待处理",
expired: "Expired" expired: "已过期"
},
config: {
name: "名称",
receiver: "用户组",
expr: "表达式",
for: "For (s)",
link: '关联',
option: "操作",
alertConfig: "告警规则",
createAlertConfig: "新增告警规则",
editAlertConfig: "修改告警规则",
medium: "中",
high: "高",
low: "低",
typeOption: {
project: '系统',
module: '组件',
asset: '设备'
}
} }
}, },
project: { project: {
project: {
project: "系统",
projectName: "系统名称",
editProject: "编辑系统",
description: "描述",
createProject: "新增系统"
},
module: {
module: "组件",
moduleName: "组件名称",
editModule: "编辑组件",
description: "描述",
createModule: "新增组件",
tip: {
defaultEndpointSet: "默认的Endpoint设置",
relation: "组件关联的Endpoint将默认配置以下端口/路径/参数"
}
},
endpoint: { endpoint: {
createEndpoint: "新增Endpoint",
editEndpoint: "编辑Endpoint",
endpoint: "Endpoint", endpoint: "Endpoint",
endpointId: "Endpoint ID", endpointId: "Endpoint ID",
host: "Host", host: "Host",
port: "Port", port: "端口",
param: "Param", param: "参数",
path: "Path", path: "路径",
asset: "Asset", asset: "设备",
lastUpdate: "Last Update", lastUpdate: "最后更新时间",
moduleParameter: "组件参数"
}, },
metrics: "Metrics", metrics: {
metrics: "Metrics",
name: '名称',
type: '类型',
description: '描述'
}
}, },
...zhLocale ...zhLocale
} }

View File

@@ -119,9 +119,9 @@ const en = {
validate: { //校验规则 validate: { //校验规则
required: 'Required', required: 'Required',
number: 'Must be a number', number: 'Must be a number',
email:'E-mail is invalide', email:'E-mail is invalid',
tel:'Phone number is invalide', tel:'Phone number is invalid',
host:'IP Address is invalide', host:'IP Address is invalid',
fileSize:'upload file is too large', fileSize:'upload file is too large',
config: { config: {
account: { account: {
@@ -146,7 +146,6 @@ const en = {
}, },
asset:{ asset:{
asset: 'Asset', asset: 'Asset',
createAsset: "Create Asset",
EditAsset:'Edit Asset', EditAsset:'Edit Asset',
createAssetTab:{ createAssetTab:{
title:'Create Asset', title:'Create Asset',
@@ -223,9 +222,8 @@ const en = {
editAssetTab:{ editAssetTab:{
title:'Create Asset', title:'Create Asset',
sn:'SN', sn:'SN',
host:'host', host:'Host',
state:'state', state:'State',
selectTip:'please select',
modelId:'ModelId', modelId:'ModelId',
alert:'Alert', alert:'Alert',
assetInfo:'资产信息', assetInfo:'资产信息',
@@ -340,6 +338,8 @@ const en = {
}, },
alert: { alert: {
alert: "Alert", alert: "Alert",
message: 'Message',
rule: 'Rule',
alertList: "Alert Message", alertList: "Alert Message",
alertConfig: "Alert Rule", alertConfig: "Alert Rule",
alertName: "Alert Name", alertName: "Alert Name",
@@ -398,7 +398,7 @@ const en = {
createModule: "Create Module", createModule: "Create Module",
tip: { tip: {
defaultEndpointSet: "Default Endpoint Set", defaultEndpointSet: "Default Endpoint Set",
relation: "Endpoints associated with Module will reference Port/Path/Param/Params by default" relation: "Endpoints associated with Module will reference Port/Path/Param by default"
} }
}, },
endpoint: { endpoint: {

View File

@@ -4,11 +4,11 @@
<div class="sidebar-title">Asset</div> <div class="sidebar-title">Asset</div>
<div class="sidebar-info"> <div class="sidebar-info">
<!--<div class="sidebar-info-header">ALL</div>--> <!--<div class="sidebar-info-header">ALL</div>-->
<el-checkbox :indeterminate="checkAllHandler" class="sidebar-info-item" :model="checkAllFlag" @change="dcSelectAll" :true-label="1" :false-label="0"> <el-checkbox :indeterminate="checkAllHandler" class="sidebar-info-item" v-model="checkAllFlag" @change="dcSelectAll" :true-label="1" :false-label="0">
<div class="sidebar-info-item-txt" style="font-weight: bold;">All</div> <div class="sidebar-info-item-txt" style="font-weight: bold;">All</div>
</el-checkbox> </el-checkbox>
<el-checkbox-group v-model="checkList" size="small" @change="getSingleAsset()"> <el-checkbox-group v-model="checkList" size="small" @change="changeCheckBox">
<el-checkbox class="sidebar-info-item" :class="{'sidebar-info-item-active': checkList.indexOf(item.id) != -1}" <el-checkbox class="sidebar-info-item" :class="{'sidebar-info-item-active': indOf(checkList, item.id)}"
v-for="(item,key) in checkListData" :key="key" :label=item.id> v-for="(item,key) in checkListData" :key="key" :label=item.id>
<div class="sidebar-info-item-txt">{{item.name}}</div> <div class="sidebar-info-item-txt">{{item.name}}</div>
<idc-config-box ref="idcConfigBox" :post-idc="item" placement="left" @after="getIDCOptionData" :button-class="'checkbox-edit'"> <idc-config-box ref="idcConfigBox" :post-idc="item" placement="left" @after="getIDCOptionData" :button-class="'checkbox-edit'">
@@ -28,7 +28,7 @@
<button @click.stop="tagShow('showAdd')" class="nz-btn nz-btn-size-normal nz-btn-style-normal float-right" id="asset-add"> <button @click.stop="tagShow('showAdd')" class="nz-btn nz-btn-size-normal nz-btn-style-normal float-right" id="asset-add">
<span class="top-tool-btn-txt"> <span class="top-tool-btn-txt">
<i class="nz-icon-create-square nz-icon"></i> <i class="nz-icon-create-square nz-icon"></i>
{{$t('overall.add')}}</span> {{$t('overall.add')}}</span>
<!-- ADD按钮 --> <!-- ADD按钮 -->
</button> </button>
<div class="top-tool-search float-right"><search-input :searchMsg="searchMsg" @search="search"></search-input></div> <div class="top-tool-search float-right"><search-input :searchMsg="searchMsg" @search="search"></search-input></div>
@@ -48,9 +48,9 @@
:key="`col_${index}`" :key="`col_${index}`"
:label="item.label" :label="item.label"
> >
<template slot="header" slot-scope="scope" class='nav-table-column-header'> <template slot="header" slot-scope="scope">
<span v-if="index==0" class='nav-tabel-header'> <span v-if="index==0" class='nav-tabel-header'>
<span @click.stop="elementsetShow('shezhi',$event)" class="nz-table-gear"> <span @click.stop="elementsetShow('shezhi',$event)" id="asset-tab-set" class="nz-table-gear">
<i class="nz-icon nz-icon-gear"></i> <i class="nz-icon nz-icon-gear"></i>
</span> </span>
<span class="nz-table-txt">{{item.label}}</span> <span class="nz-table-txt">{{item.label}}</span>
@@ -195,7 +195,7 @@
label: this.$t("asset.tableTitle.id"), label: this.$t("asset.tableTitle.id"),
prop: 'ID', prop: 'ID',
show: true, show: true,
width: 60 width: 90
}, { }, {
label: this.$t("asset.tableTitle.assetType"), label: this.$t("asset.tableTitle.assetType"),
prop: '资产类型', prop: '资产类型',
@@ -310,7 +310,8 @@
editUnitShow: false, editUnitShow: false,
flag: false, flag: false,
checkAllFlag: false, checkAllFlag: false,
checkAllHandler: false checkAllHandler: false,
assetClick: false,
} }
}, },
computed: { computed: {
@@ -324,14 +325,12 @@
watch: { watch: {
getData: { getData: {
handler(newVal) { handler(newVal) {
if (this.checkList.indexOf(newVal.selectedData) >= 0) { if (newVal.type == 1) {
this.checkList.splice(this.checkList.indexOf(newVal.selectedData), 1); this.checkList = newVal.selectedData;
} else { this.assetClick = false;
this.checkList.push(newVal.selectedData);
} }
this.getSingleAsset();
this.getAssetData();
}, },
immediate: true,
deep: true, deep: true,
}, },
getFlushData: { getFlushData: {
@@ -342,19 +341,22 @@
} }
} }
}, },
checkList(n) { checkList(n, o) {
if (n.length > 0 ) { setTimeout(()=>{
this.pageObj.idcIds = n.join(','); if (n.length > 0 ) {
} else { this.pageObj.idcIds = n.join(',');
this.pageObj.idcIds = ''; } else {
} this.pageObj.idcIds = '';
this.getAssetData(); }
if (this.assetClick) {
this.$store.state.assetData = {selectedData: n, step: this.$store.state.assetData.step+1, type: 0};
} else {
this.getSingleAsset();
}
this.getAssetData();
}, 50);
} }
}, },
created() {
this.checkList.push(this.$store.state.assetData.selectedData)
this.getSingleAsset()
},
methods: { methods: {
dcSelectAll(val) { //DC全选 dcSelectAll(val) { //DC全选
if (this.checkListData.length > 0) { if (this.checkListData.length > 0) {
@@ -526,6 +528,17 @@
this.$refs['assetEditUnit'].tabView = false this.$refs['assetEditUnit'].tabView = false
} }
}, },
indOf(a, b) {
let c = [];
for (let i = 0; i < a.length; i++) {
c.push(a[i]);
}
if (c.indexOf(b) > -1) {
return true;
} else {
return false;
}
},
tagShow(data, id, type) { tagShow(data, id, type) {
if (data === 'showAdd') { if (data === 'showAdd') {
this.addUnitShow = true this.addUnitShow = true
@@ -564,19 +577,17 @@
} }
}); });
} }
} },
,
changeCheckBox() {
this.assetClick = true;
this.getSingleAsset();
},
getSingleAsset() { getSingleAsset() {
let checkedCount = this.checkList.length; let checkedCount = this.checkList.length;
this.checkAllFlag = checkedCount === this.checkListData.length; let allCount = this.checkListData.length;
this.checkAllHandler = checkedCount > 0 && checkedCount < this.checkListData.length; this.checkAllFlag = ((checkedCount == allCount) && allCount > 0);
this.checkAllHandler = checkedCount > 0 && checkedCount < allCount;
/*if (this.checkList.length > 0 ) {
this.pageObj.idcIds = this.checkList.join(',');
} else {
this.pageObj.idcIds = '';
}
this.getAssetData();*/
}, },
pageNo(val) { pageNo(val) {
this.pageObj.pageNo = val; this.pageObj.pageNo = val;
@@ -604,8 +615,6 @@
} }
}, },
flushData() { flushData() {
// this.addUnitShow=false;
// this.editUnitShow=false;
this.getSingleAsset(); this.getSingleAsset();
this.getAssetData(); this.getAssetData();
this.getIDCOptionData(); this.getIDCOptionData();
@@ -630,8 +639,14 @@
} }
}, },
mounted() { mounted() {
setTimeout(()=>{
if (this.$store.state.assetData.selectedData.length > 0) {
this.checkList = [];
this.checkList = this.$store.state.assetData.selectedData;
}
}, 50);
this.getUserData(); this.getUserData();
this.getAssetData();
this.getIDCOptionData(); this.getIDCOptionData();
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)) ? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
@@ -662,7 +677,7 @@
display: inline-block; display: inline-block;
font-size: 12px; font-size: 12px;
margin-right:6px; margin-right:6px;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.asset .content-left .el-checkbox__input.is-focus .el-checkbox__inner, .asset .content-left .el-checkbox__input.is-focus .el-checkbox__inner,

View File

@@ -5,8 +5,9 @@ Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
assetData:{ assetData:{
selectedData:'', selectedData: [],
step: 0 step: 0,
type: -1 //0: asset 1: header
}, },
assetDcList: 0, //监听此值改变则刷新dc列表 assetDcList: 0, //监听此值改变则刷新dc列表
assetForAlertList: '', //asset页跳转alertList时传递的assetId assetForAlertList: '', //asset页跳转alertList时传递的assetId