feat: project、config、alert界面和交互
1.project、config、alert界面 2.和后端的交互,但部分接口/原型未定,包括: --1.Alert-config link查看、编辑框暂时直接回显id --2.用户保存操作后端报错 --3.endpoint弹框页面未定,暂按现版本原型实现
This commit is contained in:
@@ -361,7 +361,7 @@ html {
|
|||||||
/* end--endpoint->子弹框asset搜索框前缀和后缀*/
|
/* end--endpoint->子弹框asset搜索框前缀和后缀*/
|
||||||
/* begin--自定义可编辑的el-select下拉框样式*/
|
/* begin--自定义可编辑的el-select下拉框样式*/
|
||||||
.config-dropdown {
|
.config-dropdown {
|
||||||
width: 550px;
|
width: 520px;
|
||||||
}
|
}
|
||||||
.config-dropdown-btn {
|
.config-dropdown-btn {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|||||||
@@ -1,12 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="submenu">
|
<div class="submenu">
|
||||||
|
|
||||||
<el-menu
|
<el-menu
|
||||||
class="el-menu-demo"
|
class="el-menu-demo"
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
background-color="#ffffff"
|
background-color="#ffffff"
|
||||||
unique-opened
|
unique-opened
|
||||||
>
|
>
|
||||||
|
<el-submenu index="0">
|
||||||
|
<template slot="title">
|
||||||
|
<div class="menu-create">
|
||||||
|
<i class="el-icon-plus"></i>
|
||||||
|
<div>{{$t('overall.create')}}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-for="(item, index) in createMenu">
|
||||||
|
<el-menu-item :index="'0-' + index.toString()">
|
||||||
|
<div @click="createBox(item)">
|
||||||
|
<span>{{item.label}}</span>
|
||||||
|
</div>
|
||||||
|
</el-menu-item>
|
||||||
|
</template>
|
||||||
|
</el-submenu>
|
||||||
<el-menu-item index="1" @click="jumpTo('dashboard')">
|
<el-menu-item index="1" @click="jumpTo('dashboard')">
|
||||||
<div>
|
<div>
|
||||||
{{$t('overall.dashboard')}}
|
{{$t('overall.dashboard')}}
|
||||||
@@ -17,7 +33,7 @@
|
|||||||
<div @click="jumpToProject('project', projectData[0])">{{$t('overall.project')}}</div>
|
<div @click="jumpToProject('project', projectData[0])">{{$t('overall.project')}}</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(item, index) in projectData">
|
<template v-for="(item, index) in projectData">
|
||||||
<el-menu-item :index="index.toString()">
|
<el-menu-item :index="'2-' + index.toString()">
|
||||||
<div @click="jumpToProject('project', item)">
|
<div @click="jumpToProject('project', item)">
|
||||||
<span>{{item.name}}</span>
|
<span>{{item.name}}</span>
|
||||||
<div @click.stop="toEditProject(item)" class="menu-edit"><i class="el-icon-edit-outline"></i></div>
|
<div @click.stop="toEditProject(item)" class="menu-edit"><i class="el-icon-edit-outline"></i></div>
|
||||||
@@ -30,7 +46,7 @@
|
|||||||
<div @click="jumpToAsset('asset')">{{$t('overall.asset')}}</div>
|
<div @click="jumpToAsset('asset')">{{$t('overall.asset')}}</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(item, index) in assetData">
|
<template v-for="(item, index) in assetData">
|
||||||
<el-menu-item :index="index.toString()">
|
<el-menu-item :index="'3-' + index.toString()">
|
||||||
<div @click="jumpToAsset('asset',item.id)">{{item.name}}</div>
|
<div @click="jumpToAsset('asset',item.id)">{{item.name}}</div>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</template>
|
</template>
|
||||||
@@ -39,10 +55,10 @@
|
|||||||
<template slot="title">
|
<template slot="title">
|
||||||
<div @click="jumpTo('alertList')">{{$t('overall.alert')}}</div>
|
<div @click="jumpTo('alertList')">{{$t('overall.alert')}}</div>
|
||||||
</template>
|
</template>
|
||||||
<el-menu-item index="1">
|
<el-menu-item index="4-0">
|
||||||
<div @click="jumpTo('alertList')">{{$t('alert.alertList')}}</div>
|
<div @click="jumpTo('alertList')">{{$t('alert.alertList')}}</div>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="2">
|
<el-menu-item index="4-1">
|
||||||
<div @click="jumpTo('alertConfig')">{{$t('alert.alertConfig')}}</div>
|
<div @click="jumpTo('alertConfig')">{{$t('alert.alertConfig')}}</div>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-submenu>
|
</el-submenu>
|
||||||
@@ -50,10 +66,10 @@
|
|||||||
<template slot="title">
|
<template slot="title">
|
||||||
<div @click="jumpTo('account')">{{$t('overall.config')}}</div>
|
<div @click="jumpTo('account')">{{$t('overall.config')}}</div>
|
||||||
</template>
|
</template>
|
||||||
<el-menu-item index="1">
|
<el-menu-item index="5-0">
|
||||||
<div @click="jumpTo('account')">{{$t('config.account.account')}}</div>
|
<div @click="jumpTo('account')">{{$t('config.account.account')}}</div>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="2">
|
<el-menu-item index="5-1">
|
||||||
<div @click="jumpTo('promServer')">{{$t('config.promServer.promServerList')}}</div>
|
<div @click="jumpTo('promServer')">{{$t('config.promServer.promServerList')}}</div>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-submenu>
|
</el-submenu>
|
||||||
@@ -101,7 +117,32 @@ export default {
|
|||||||
return {
|
return {
|
||||||
language: localStorage.getItem("language"),
|
language: localStorage.getItem("language"),
|
||||||
assetData: [],
|
assetData: [],
|
||||||
projectData: []
|
projectData: [],
|
||||||
|
createMenu: [
|
||||||
|
{
|
||||||
|
label: this.$t('project.project.createProject'),
|
||||||
|
url: 'project',
|
||||||
|
type: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('project.module.createModule'),
|
||||||
|
url: 'project',
|
||||||
|
type: 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('project.endpoint.createEndpoint'),
|
||||||
|
url: 'project',
|
||||||
|
type: 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('asset.createAsset'),
|
||||||
|
url: 'asset'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('alert.config.createAlertConfig'),
|
||||||
|
url: 'alertConfig'
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -112,6 +153,9 @@ export default {
|
|||||||
t: +new Date()
|
t: +new Date()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
createBox(item) {
|
||||||
|
|
||||||
},
|
},
|
||||||
jumpToAsset(data, id) {
|
jumpToAsset(data, id) {
|
||||||
this.$store.state.assetData.moduleData = data;
|
this.$store.state.assetData.moduleData = data;
|
||||||
@@ -151,7 +195,7 @@ export default {
|
|||||||
this.getProjectData();
|
this.getProjectData();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
projectListReload() {
|
projectListReloadWatch() {
|
||||||
return this.$store.state.projectListReload;
|
return this.$store.state.projectListReload;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -159,7 +203,7 @@ export default {
|
|||||||
projectListReloadWatch(n, o) {
|
projectListReloadWatch(n, o) {
|
||||||
if (n) {
|
if (n) {
|
||||||
this.getProjectData();
|
this.getProjectData();
|
||||||
this.$store.commit('projectListReload', false);
|
this.$store.commit('projectListReloadChange', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,6 +310,20 @@ export default {
|
|||||||
.header-name-jiantou {
|
.header-name-jiantou {
|
||||||
position: static !important;
|
position: static !important;
|
||||||
}
|
}
|
||||||
|
.el-menu-demo>li:first-of-type {
|
||||||
|
position: fixed;
|
||||||
|
left: 40%;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
.menu-create {
|
||||||
|
line-height: 15px;
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
.menu-create .el-icon-plus {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 12px;
|
||||||
|
}
|
||||||
.menu-edit {
|
.menu-edit {
|
||||||
line-height: 36px;
|
line-height: 36px;
|
||||||
float: right;
|
float: right;
|
||||||
|
|||||||
@@ -15,9 +15,16 @@ const en = {
|
|||||||
search: 'Search',
|
search: 'Search',
|
||||||
add: "Add",
|
add: "Add",
|
||||||
option: "Option",
|
option: "Option",
|
||||||
clearAll: "Clear All"
|
clearAll: "Clear All",
|
||||||
|
},
|
||||||
|
tip: {
|
||||||
|
confirmDelete: "Confirm Delete?",
|
||||||
|
yes: "Yes",
|
||||||
|
no: "No",
|
||||||
|
deleteSuccess: "Successfully Deleted"
|
||||||
},
|
},
|
||||||
asset:{
|
asset:{
|
||||||
|
createAsset: "Create Asset",
|
||||||
tableTitle: {
|
tableTitle: {
|
||||||
id: 'ID',
|
id: 'ID',
|
||||||
assetType: '资产类型',
|
assetType: '资产类型',
|
||||||
@@ -65,7 +72,8 @@ const en = {
|
|||||||
//侧滑框
|
//侧滑框
|
||||||
promId: "Prometheus Server ID",
|
promId: "Prometheus Server ID",
|
||||||
createProm: "Create Prometheus Server",
|
createProm: "Create Prometheus Server",
|
||||||
editProm: "Edit Prometheus Server"
|
editProm: "Edit Prometheus Server",
|
||||||
|
type: "Type"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
alert: {
|
alert: {
|
||||||
@@ -86,9 +94,9 @@ const en = {
|
|||||||
charts: "Charts",
|
charts: "Charts",
|
||||||
|
|
||||||
//表内容
|
//表内容
|
||||||
projectalert: "Project Alert",
|
projectAlert: "Project Alert",
|
||||||
modulealert: "Module Alert",
|
moduleAlert: "Module Alert",
|
||||||
devicealert: "Device Alert",
|
deviceAlert: "Device Alert",
|
||||||
pending: "Pending",
|
pending: "Pending",
|
||||||
expired: "Expired"
|
expired: "Expired"
|
||||||
},
|
},
|
||||||
@@ -96,11 +104,20 @@ const en = {
|
|||||||
name: "Name",
|
name: "Name",
|
||||||
receiver: "Receiver",
|
receiver: "Receiver",
|
||||||
expr: "Expr",
|
expr: "Expr",
|
||||||
for: "For",
|
for: "For (s)",
|
||||||
|
link: 'Link',
|
||||||
option: "Option",
|
option: "Option",
|
||||||
alertConfig: "Alert Config",
|
alertConfig: "Alert Config",
|
||||||
createalertConfig: "Create Alert Config",
|
createAlertConfig: "Create Alert Config",
|
||||||
editalertConfig: "Edit Alert Config",
|
editAlertConfig: "Edit Alert Config",
|
||||||
|
medium: "Medium",
|
||||||
|
high: "High",
|
||||||
|
low: "Low",
|
||||||
|
typeOption: {
|
||||||
|
project: 'Project',
|
||||||
|
module: 'Module',
|
||||||
|
asset: 'Asset'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
project: {
|
project: {
|
||||||
@@ -108,13 +125,15 @@ const en = {
|
|||||||
project: "Project",
|
project: "Project",
|
||||||
projectName: "Project Name",
|
projectName: "Project Name",
|
||||||
editProject: "Edit Project",
|
editProject: "Edit Project",
|
||||||
description: "Description"
|
description: "Description",
|
||||||
|
createProject: "Create Project"
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
module: "Module",
|
module: "Module",
|
||||||
moduleName: "Module Name",
|
moduleName: "Module Name",
|
||||||
editModule: "Edit Module",
|
editModule: "Edit Module",
|
||||||
description: "Description",
|
description: "Description",
|
||||||
|
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/Params by default"
|
||||||
@@ -132,7 +151,12 @@ const en = {
|
|||||||
asset: "Asset",
|
asset: "Asset",
|
||||||
lastUpdate: "Last Update",
|
lastUpdate: "Last Update",
|
||||||
},
|
},
|
||||||
metrics: "Metrics"
|
metrics: {
|
||||||
|
metrics: "Metrics",
|
||||||
|
name: 'name',
|
||||||
|
type: 'Type',
|
||||||
|
description: 'Desc'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
...enLocale
|
...enLocale
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,8 +59,17 @@
|
|||||||
<div v-if="item.prop == 'option'" class="account-list-options">
|
<div v-if="item.prop == 'option'" class="account-list-options">
|
||||||
<span @click="del(scope.row)" class="account-list-option"><i class="el-icon-delete"></i></span>
|
<span @click="del(scope.row)" class="account-list-option"><i class="el-icon-delete"></i></span>
|
||||||
<span @click="detail(scope.row)" class="account-list-option"><i class="el-icon-view"></i></span>
|
<span @click="detail(scope.row)" class="account-list-option"><i class="el-icon-view"></i></span>
|
||||||
<span @click="edit(scope.row)" class="account-list-option"><i class="el-icon-edit-outline"></i></span>
|
<span @click="toEdit(scope.row)" class="account-list-option"><i class="el-icon-edit-outline"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
<span v-else-if="item.prop == 'severity'">
|
||||||
|
<span v-if="scope.row[item.prop] == 'high'"><i class="el-icon-arrow-up"></i> {{severityData[1].value}}</span>
|
||||||
|
<span style="padding-left: 18px;" v-if="scope.row[item.prop] == 'medium'">{{severityData[0].value}}</span>
|
||||||
|
<span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i> {{severityData[2].value}}</span>
|
||||||
|
</span>
|
||||||
|
<span v-else-if="item.prop == 'type'">
|
||||||
|
<template v-for="type in typeData" v-if="type.key == scope.row[item.prop]">{{type.value}}</template>
|
||||||
|
</span>
|
||||||
|
<span v-else-if="item.prop == 'linkObject'">{{scope.row[item.prop].name}}</span>
|
||||||
<span v-else>{{scope.row[item.prop]}}</span>
|
<span v-else>{{scope.row[item.prop]}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -85,7 +94,7 @@
|
|||||||
<span v-if="rightBox.isEdit">{{$t('overall.save')}}</span>
|
<span v-if="rightBox.isEdit">{{$t('overall.save')}}</span>
|
||||||
<span v-else>{{$t('overall.edit')}}</span>
|
<span v-else>{{$t('overall.edit')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-box-top-btn" v-if="rightBox.isEdit && alertRule.id != ''">
|
<div @click="del" class="right-box-top-btn" v-if="rightBox.isEdit && alertRule.id != ''">
|
||||||
<div class="right-box-btn-icon">
|
<div class="right-box-btn-icon">
|
||||||
<i class="el-icon-delete"></i>
|
<i class="el-icon-delete"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -100,6 +109,7 @@
|
|||||||
|
|
||||||
<!-- begin--表单-->
|
<!-- begin--表单-->
|
||||||
<div class="right-box-form">
|
<div class="right-box-form">
|
||||||
|
<!--name-->
|
||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">{{$t('alert.config.name')}}</div>
|
<div class="right-box-form-label">{{$t('alert.config.name')}}</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
@@ -115,6 +125,52 @@
|
|||||||
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.alertName}}</div>
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.alertName}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--type-->
|
||||||
|
<div class="right-box-form-row">
|
||||||
|
<div class="right-box-form-label">{{$t('alert.list.type')}}</div>
|
||||||
|
<div class="right-box-form-content">
|
||||||
|
<el-select popper-class="config-dropdown" v-model="alertRule.type" placeholder="" v-if="rightBox.isEdit" size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="item in typeData"
|
||||||
|
:key="item.key"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.key">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<div v-for="item in typeData" v-if="!rightBox.isEdit && item.key == alertRule.type" class="right-box-form-content-txt">{{item.value}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--linkedId-->
|
||||||
|
<div class="right-box-form-row">
|
||||||
|
<div class="right-box-form-label">{{$t('alert.config.link')}}</div>
|
||||||
|
<div class="right-box-form-content">
|
||||||
|
<el-input
|
||||||
|
v-if="rightBox.isEdit"
|
||||||
|
type="text"
|
||||||
|
v-model="alertRule.linkId"
|
||||||
|
size="mini"
|
||||||
|
></el-input>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.linkObject.name}}</div>
|
||||||
|
<!--<el-select popper-class="config-dropdown" v-model="alertRule.severity" placeholder="" v-if="rightBox.isEdit" size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="item in severityData"
|
||||||
|
:key="item.key"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.key">
|
||||||
|
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.value}}</span>
|
||||||
|
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop>
|
||||||
|
<el-input
|
||||||
|
type="text"
|
||||||
|
v-model="item.name"
|
||||||
|
size="mini"
|
||||||
|
></el-input>
|
||||||
|
</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.severity}}</div>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--expr-->
|
||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">{{$t('alert.config.expr')}}</div>
|
<div class="right-box-form-label">{{$t('alert.config.expr')}}</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
@@ -128,6 +184,7 @@
|
|||||||
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.expr}}</div>
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.expr}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--for-->
|
||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">{{$t('alert.config.for')}}</div>
|
<div class="right-box-form-label">{{$t('alert.config.for')}}</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
@@ -137,23 +194,36 @@
|
|||||||
placeholder=""
|
placeholder=""
|
||||||
v-model="alertRule.last"
|
v-model="alertRule.last"
|
||||||
size="small"
|
size="small"
|
||||||
></el-input>
|
>
|
||||||
|
<template slot="append">second</template>
|
||||||
|
</el-input>
|
||||||
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.last}}s</div>
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.last}}s</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--severity-->
|
||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">{{$t('alert.severity')}}</div>
|
<div class="right-box-form-label">{{$t('alert.severity')}}</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
|
<el-select popper-class="config-dropdown" v-model="alertRule.severity" placeholder="" v-if="rightBox.isEdit" size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="item in severityData"
|
||||||
|
:key="item.key"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.key">
|
||||||
|
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.value}}</span>
|
||||||
|
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop>
|
||||||
<el-input
|
<el-input
|
||||||
type="text"
|
type="text"
|
||||||
v-if="rightBox.isEdit"
|
v-model="item.name"
|
||||||
placeholder=""
|
size="mini"
|
||||||
v-model="alertRule.severity"
|
|
||||||
size="small"
|
|
||||||
></el-input>
|
></el-input>
|
||||||
|
</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.severity}}</div>
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.severity}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--summary-->
|
||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">{{$t('alert.summary')}}</div>
|
<div class="right-box-form-label">{{$t('alert.summary')}}</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
@@ -167,6 +237,7 @@
|
|||||||
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.summary}}</div>
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.summary}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--description-->
|
||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">{{$t('alert.description')}}</div>
|
<div class="right-box-form-label">{{$t('alert.description')}}</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
@@ -180,6 +251,7 @@
|
|||||||
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.description}}</div>
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.description}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--receiver-->
|
||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">{{$t('config.account.receiver')}}</div>
|
<div class="right-box-form-label">{{$t('config.account.receiver')}}</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
@@ -191,7 +263,7 @@
|
|||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item">
|
:value="item">
|
||||||
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.name}}</span>
|
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.name}}</span>
|
||||||
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop="stopFun">
|
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop>
|
||||||
<el-input
|
<el-input
|
||||||
type="text"
|
type="text"
|
||||||
v-model="item.name"
|
v-model="item.name"
|
||||||
@@ -217,7 +289,7 @@
|
|||||||
|
|
||||||
<!-- begin--底部按钮-->
|
<!-- begin--底部按钮-->
|
||||||
<div class="right-box-bottom-btns">
|
<div class="right-box-bottom-btns">
|
||||||
<div @click="esc()" :class="{'right-box-bottom-btn-50': rightBox.isEdit}" class="right-box-bottom-btn right-box-bottom-btn-cancel">{{$t('overall.cancel')}}</div><div v-if="rightBox.isEdit" class="right-box-bottom-btn right-box-bottom-btn-50">{{alertRule.id == '' ? $t('overall.create') : $t('overall.save')}}</div>
|
<div @click="esc()" :class="{'right-box-bottom-btn-50': rightBox.isEdit}" class="right-box-bottom-btn right-box-bottom-btn-cancel">{{$t('overall.cancel')}}</div><div @click="save" v-if="rightBox.isEdit" class="right-box-bottom-btn right-box-bottom-btn-50">{{alertRule.id == '' ? $t('overall.create') : $t('overall.save')}}</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- end--底部按钮-->
|
<!-- end--底部按钮-->
|
||||||
|
|
||||||
@@ -228,7 +300,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "account",
|
name: "alert-config",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
rightBox: { //弹出框相关
|
rightBox: { //弹出框相关
|
||||||
@@ -240,6 +312,7 @@ export default {
|
|||||||
id: '',
|
id: '',
|
||||||
alertName: '',
|
alertName: '',
|
||||||
type: '',
|
type: '',
|
||||||
|
linkObject: {id: '', name: ''},
|
||||||
linkId: '',
|
linkId: '',
|
||||||
expr: '',
|
expr: '',
|
||||||
last: '',
|
last: '',
|
||||||
@@ -253,6 +326,34 @@ export default {
|
|||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
total:0
|
total:0
|
||||||
},
|
},
|
||||||
|
severityData: [
|
||||||
|
{
|
||||||
|
key: 'medium',
|
||||||
|
value: this.$t("alert.config.medium")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'high',
|
||||||
|
value: this.$t("alert.config.high")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'low',
|
||||||
|
value: this.$t("alert.config.low")
|
||||||
|
}
|
||||||
|
],
|
||||||
|
typeData: [
|
||||||
|
{
|
||||||
|
key: 1,
|
||||||
|
value: this.$t('alert.config.typeOption.project')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 2,
|
||||||
|
value: this.$t('alert.config.typeOption.module')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 3,
|
||||||
|
value: this.$t('alert.config.typeOption.asset')
|
||||||
|
}
|
||||||
|
],
|
||||||
tableTitle: [
|
tableTitle: [
|
||||||
{
|
{
|
||||||
label: 'ID',
|
label: 'ID',
|
||||||
@@ -267,6 +368,14 @@ export default {
|
|||||||
label: this.$t("alert.config.expr"),
|
label: this.$t("alert.config.expr"),
|
||||||
prop: 'expr',
|
prop: 'expr',
|
||||||
show: true,
|
show: true,
|
||||||
|
}, {
|
||||||
|
label: this.$t("alert.list.type"),
|
||||||
|
prop: 'type',
|
||||||
|
show: true,
|
||||||
|
}, {
|
||||||
|
label: this.$t("alert.config.link"),
|
||||||
|
prop: 'linkObject',
|
||||||
|
show: true,
|
||||||
}, {
|
}, {
|
||||||
label: this.$t("alert.config.for"),
|
label: this.$t("alert.config.for"),
|
||||||
prop: 'last',
|
prop: 'last',
|
||||||
@@ -318,13 +427,27 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
edit: function(u) {
|
toEdit: function(u) {
|
||||||
this.alertRule = Object.assign({}, u);
|
this.alertRule = Object.assign({}, u);
|
||||||
this.rightBox.isEdit = true;
|
this.rightBox.isEdit = true;
|
||||||
this.rightBox.title = this.$t("alert.config.editalertConfig") + " ID:" + u.id;
|
this.rightBox.title = this.$t("alert.config.editAlertConfig") + " ID:" + u.id;
|
||||||
this.rightBox.show = true;
|
this.rightBox.show = true;
|
||||||
},
|
},
|
||||||
del: function(u) {
|
del: function(u) {
|
||||||
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||||
|
confirmButtonText: this.$t("tip.yes"),
|
||||||
|
cancelButtonText: this.$t("tip.no"),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$delete("alert/rule?ids=" + u.id).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message({type: 'success', message: this.$t("tip.deleteSuccess")});
|
||||||
|
this.getTableData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
toAdd: function() {
|
toAdd: function() {
|
||||||
this.cleanAlertRule();
|
this.cleanAlertRule();
|
||||||
@@ -338,10 +461,29 @@ export default {
|
|||||||
this.rightBox.title = this.$t("alert.config.alertConfig") + " ID:" + u.id;
|
this.rightBox.title = this.$t("alert.config.alertConfig") + " ID:" + u.id;
|
||||||
this.rightBox.show = true;
|
this.rightBox.show = true;
|
||||||
},
|
},
|
||||||
|
save: function() {
|
||||||
|
if (this.alertRule.id) {
|
||||||
|
this.$put('alert/rule', this.alertRule).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.getTableData();
|
||||||
|
this.rightBox.isEdit = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$post('alert/rule', this.alertRule).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.getTableData();
|
||||||
|
this.rightBox.isEdit = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
saveOrToEdit: function() {
|
saveOrToEdit: function() {
|
||||||
if (!this.rightBox.isEdit) {
|
if (!this.rightBox.isEdit) {
|
||||||
this.rightBox.isEdit = true;
|
this.rightBox.isEdit = true;
|
||||||
this.rightBox.title = this.$t("alert.config.editalertConfig") + " ID:" + this.alertRule.id;
|
this.rightBox.title = this.$t("alert.config.editAlertConfig") + " ID:" + this.alertRule.id;
|
||||||
|
} else {
|
||||||
|
this.save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toEditReceiver: function(item) {
|
toEditReceiver: function(item) {
|
||||||
@@ -391,9 +533,6 @@ export default {
|
|||||||
},
|
},
|
||||||
esc: function() {
|
esc: function() {
|
||||||
this.rightBox.show = false;
|
this.rightBox.show = false;
|
||||||
},
|
|
||||||
stopFun: function() {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
updateReceiverName: function(item) {
|
updateReceiverName: function(item) {
|
||||||
//TODO 请求接口改名
|
//TODO 请求接口改名
|
||||||
@@ -409,6 +548,7 @@ export default {
|
|||||||
alertName: '',
|
alertName: '',
|
||||||
type: '',
|
type: '',
|
||||||
linkId: '',
|
linkId: '',
|
||||||
|
linkObject: {id: '', name: ''},
|
||||||
expr: '',
|
expr: '',
|
||||||
last: '',
|
last: '',
|
||||||
severity: '',
|
severity: '',
|
||||||
@@ -418,8 +558,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
jumpTo(data,id) {
|
jumpTo(data,id) {
|
||||||
this.$store.state.assetData.moduleData = data
|
this.$store.state.assetData.moduleData = data;
|
||||||
this.$store.state.assetData.selectedData = id
|
this.$store.state.assetData.selectedData = id;
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: "/" + data,
|
path: "/" + data,
|
||||||
query: {
|
query: {
|
||||||
@@ -429,11 +569,11 @@ export default {
|
|||||||
},
|
},
|
||||||
pageNo(val) {
|
pageNo(val) {
|
||||||
this.pageObj.pageNo = val;
|
this.pageObj.pageNo = val;
|
||||||
this.getTableData()
|
this.getTableData();
|
||||||
},
|
},
|
||||||
pageSize(val) {
|
pageSize(val) {
|
||||||
this.pageObj.pageSize = val;
|
this.pageObj.pageSize = val;
|
||||||
this.getTableData()
|
this.getTableData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@@ -169,7 +169,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content-right">
|
<div class="content-right">
|
||||||
<div class="top-tools">
|
<div class="top-tools">
|
||||||
<el-button @click="toAdd" class="top-tool-btn top-tool-btn-active margin-l-10 top-tool top-tool-right" size="mini">
|
<el-button @click="" class="top-tool-btn top-tool-btn-active margin-l-10 top-tool top-tool-right" size="mini">
|
||||||
<span><i class="el-icon-plus"></i></span>
|
<span><i class="el-icon-plus"></i></span>
|
||||||
<span class="top-tool-btn-txt">{{$t('overall.add')}}</span>
|
<span class="top-tool-btn-txt">{{$t('overall.add')}}</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -289,6 +289,14 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
pageNo(val) {
|
||||||
|
this.pageObj.pageNo = val;
|
||||||
|
this.getAlertList();
|
||||||
|
},
|
||||||
|
pageSize(val) {
|
||||||
|
this.pageObj.pageSize = val;
|
||||||
|
this.getAlertList();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getAlertList();
|
this.getAlertList();
|
||||||
|
|||||||
@@ -176,7 +176,7 @@
|
|||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item">
|
:value="item">
|
||||||
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.name}}</span>
|
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.name}}</span>
|
||||||
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop="stopFun">
|
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop>
|
||||||
<el-input
|
<el-input
|
||||||
type="text"
|
type="text"
|
||||||
v-model="item.name"
|
v-model="item.name"
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
|
|
||||||
<!-- begin--底部按钮-->
|
<!-- begin--底部按钮-->
|
||||||
<div class="right-box-bottom-btns">
|
<div class="right-box-bottom-btns">
|
||||||
<div @click="esc()" :class="{'right-box-bottom-btn-50': rightBox.isEdit}" class="right-box-bottom-btn right-box-bottom-btn-cancel">{{$t('overall.cancel')}}</div><div v-if="rightBox.isEdit" class="right-box-bottom-btn right-box-bottom-btn-50">{{user.userId == '' ? $t('overall.create') : $t('overall.save')}}</div>
|
<div @click="esc()" :class="{'right-box-bottom-btn-50': rightBox.isEdit}" class="right-box-bottom-btn right-box-bottom-btn-cancel">{{$t('overall.cancel')}}</div><div @click="save" v-if="rightBox.isEdit" class="right-box-bottom-btn right-box-bottom-btn-50">{{user.userId == '' ? $t('overall.create') : $t('overall.save')}}</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- end--底部按钮-->
|
<!-- end--底部按钮-->
|
||||||
|
|
||||||
@@ -364,17 +364,24 @@ export default {
|
|||||||
this.rightBox.title = this.$t("config.account.createAccount");
|
this.rightBox.title = this.$t("config.account.createAccount");
|
||||||
this.rightBox.show = true;
|
this.rightBox.show = true;
|
||||||
},
|
},
|
||||||
|
save: function() {
|
||||||
|
this.$post('sys/user/update', this.user).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.rightBox.isEdit = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
saveOrToEdit: function() {
|
saveOrToEdit: function() {
|
||||||
if (!this.rightBox.isEdit) {
|
if (!this.rightBox.isEdit) {
|
||||||
this.rightBox.isEdit = true;
|
this.rightBox.isEdit = true;
|
||||||
this.rightBox.title = this.$t("config.account.editAccount") + " ID:" + this.user.userId;
|
this.rightBox.title = this.$t("config.account.editAccount") + " ID:" + this.user.userId;
|
||||||
} else {
|
} else {
|
||||||
|
this.save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jumpTo(data,id) {
|
jumpTo(data,id) {
|
||||||
this.$store.state.assetData.moduleData = data
|
this.$store.state.assetData.moduleData = data;
|
||||||
this.$store.state.assetData.selectedData = id
|
this.$store.state.assetData.selectedData = id;
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: "/" + data,
|
path: "/" + data,
|
||||||
query: {
|
query: {
|
||||||
@@ -421,9 +428,6 @@ export default {
|
|||||||
},
|
},
|
||||||
esc: function() {
|
esc: function() {
|
||||||
this.rightBox.show = false;
|
this.rightBox.show = false;
|
||||||
},
|
|
||||||
stopFun: function() {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
updateReceiverName: function(item) {
|
updateReceiverName: function(item) {
|
||||||
//TODO 请求接口改名
|
//TODO 请求接口改名
|
||||||
|
|||||||
@@ -60,6 +60,10 @@
|
|||||||
>
|
>
|
||||||
<template slot-scope="scope" :column="item">
|
<template slot-scope="scope" :column="item">
|
||||||
<span v-if="item.prop == 'idc'">{{scope.row[item.prop].name}}</span>
|
<span v-if="item.prop == 'idc'">{{scope.row[item.prop].name}}</span>
|
||||||
|
<span v-else-if="item.prop == 'type'">
|
||||||
|
{{scope.row[item.prop] == '1' ? 'Global' : ''}}
|
||||||
|
{{scope.row[item.prop] == '2' ? 'Per-Datacenter' : ''}}
|
||||||
|
</span>
|
||||||
<span v-else>{{scope.row[item.prop]}}</span>
|
<span v-else>{{scope.row[item.prop]}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -93,7 +97,7 @@
|
|||||||
<span v-if="rightBox.isEdit">{{$t('overall.save')}}</span>
|
<span v-if="rightBox.isEdit">{{$t('overall.save')}}</span>
|
||||||
<span v-else>{{$t('overall.edit')}}</span>
|
<span v-else>{{$t('overall.edit')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-box-top-btn" v-if="rightBox.isEdit && promServer.id != ''">
|
<div @click="del" class="right-box-top-btn" v-if="rightBox.isEdit && promServer.id != ''">
|
||||||
<div class="right-box-btn-icon">
|
<div class="right-box-btn-icon">
|
||||||
<i class="el-icon-delete"></i>
|
<i class="el-icon-delete"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -119,7 +123,7 @@
|
|||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item">
|
:value="item">
|
||||||
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.name}}</span>
|
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.name}}</span>
|
||||||
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop="stopFun">
|
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop>
|
||||||
<el-input
|
<el-input
|
||||||
type="text"
|
type="text"
|
||||||
v-model="item.name"
|
v-model="item.name"
|
||||||
@@ -153,6 +157,33 @@
|
|||||||
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{promServer.host}}</div>
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{promServer.host}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="right-box-form-row">
|
||||||
|
<div class="right-box-form-label">Port</div>
|
||||||
|
<div class="right-box-form-content">
|
||||||
|
<el-input
|
||||||
|
type="text"
|
||||||
|
v-if="rightBox.isEdit"
|
||||||
|
placeholder=""
|
||||||
|
v-model="promServer.port"
|
||||||
|
size="small"
|
||||||
|
></el-input>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{promServer.port}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="right-box-form-row">
|
||||||
|
<div class="right-box-form-label">{{$t('config.promServer.type')}}</div>
|
||||||
|
<div class="right-box-form-content">
|
||||||
|
<el-select popper-class="config-dropdown" v-model="promServer.type" placeholder="" v-if="rightBox.isEdit" size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="item in typeData"
|
||||||
|
:key="item.key"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.key">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<div v-for="item in typeData" v-if="!rightBox.isEdit && item.key == promServer.type" class="right-box-form-content-txt">{{item.value}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- end--表单-->
|
<!-- end--表单-->
|
||||||
|
|
||||||
@@ -201,53 +232,27 @@ export default {
|
|||||||
label: 'Host',
|
label: 'Host',
|
||||||
prop: 'host',
|
prop: 'host',
|
||||||
show: true,
|
show: true,
|
||||||
|
}, {
|
||||||
|
label: 'Port',
|
||||||
|
prop: 'port',
|
||||||
|
show: true,
|
||||||
|
}, {
|
||||||
|
label: this.$t("config.promServer.type"),
|
||||||
|
prop: 'type',
|
||||||
|
show: true,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
/*tableData: [
|
idcData: [],
|
||||||
|
typeData: [
|
||||||
{
|
{
|
||||||
id: '1',
|
key: 1,
|
||||||
host: '192.168.40.241',
|
value: 'Global'
|
||||||
idc: {id: '3', name: 'aerareqarew', location: 'zhaertaewr'}
|
}, {
|
||||||
},
|
key: 2,
|
||||||
{
|
value: 'Per-Datacenter'
|
||||||
id: '2',
|
}
|
||||||
host: '192.168.40.242',
|
]
|
||||||
idc: {id: '5', name: 'idc151654', location: 'bj'}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
host: '192.168.40.243',
|
|
||||||
idc: {id: '6', name: 'idc151655', location: 'sh'}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '4',
|
|
||||||
host: '192.168.40.244',
|
|
||||||
idc: {id: '6', name: 'idc151655', location: 'sh'}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '5',
|
|
||||||
host: '192.168.40.245',
|
|
||||||
idc: {id: '7', name: 'idc151656', location: 'gd'}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '6',
|
|
||||||
host: '192.168.40.246',
|
|
||||||
idc: {id: '9', name: 'idc151657', location: 'fj'}
|
|
||||||
},
|
|
||||||
],*/
|
|
||||||
idcData: []
|
|
||||||
/*idcData: [
|
|
||||||
{id: '1', name: 'idc151656', location: 'gd'},
|
|
||||||
{id: '2', name: 'idc151656', location: 'gd'},
|
|
||||||
{id: '3', name: 'aerareqarew', location: 'zhaertaewr'},
|
|
||||||
{id: '4', name: 'idc151656', location: 'gd'},
|
|
||||||
{id: '5', name: 'idc151654', location: 'bj'},
|
|
||||||
{id: '6', name: 'idc151655', location: 'sh'},
|
|
||||||
{id: '7', name: 'idc151656', location: 'gd'},
|
|
||||||
{id: '8', name: 'idc151656', location: 'gd'},
|
|
||||||
{id: '9', name: 'idc151657', location: 'fj'},
|
|
||||||
]*/
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -258,6 +263,20 @@ export default {
|
|||||||
this.rightBox.show = true;
|
this.rightBox.show = true;
|
||||||
},
|
},
|
||||||
del: function(u) {
|
del: function(u) {
|
||||||
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||||
|
confirmButtonText: this.$t("tip.yes"),
|
||||||
|
cancelButtonText: this.$t("tip.no"),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$delete("promServer?ids=" + u.id).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message({type: 'success', message: this.$t("tip.deleteSuccess")});
|
||||||
|
this.getTableData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getTableData: function() {
|
getTableData: function() {
|
||||||
this.$get('promServer', this.pageObj).then(response => {
|
this.$get('promServer', this.pageObj).then(response => {
|
||||||
@@ -285,6 +304,7 @@ export default {
|
|||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
this.rightBox.isEdit = false;
|
this.rightBox.isEdit = false;
|
||||||
|
this.esc();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -292,6 +312,7 @@ export default {
|
|||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
this.rightBox.isEdit = false;
|
this.rightBox.isEdit = false;
|
||||||
|
this.esc();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -316,8 +337,8 @@ export default {
|
|||||||
item.errorMessage = '';
|
item.errorMessage = '';
|
||||||
item.oldName = item.name;
|
item.oldName = item.name;
|
||||||
item.isEdit = false;
|
item.isEdit = false;
|
||||||
|
this.getIdcData();
|
||||||
} else {
|
} else {
|
||||||
console.info(response.msg)
|
|
||||||
this.$set(item, 'errorMessage', response.msg);
|
this.$set(item, 'errorMessage', response.msg);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -341,24 +362,21 @@ export default {
|
|||||||
this.blurEditIdc();
|
this.blurEditIdc();
|
||||||
//TODO 请求后台,删除
|
//TODO 请求后台,删除
|
||||||
},
|
},
|
||||||
getIdcData: async function() {
|
getIdcData: function() {
|
||||||
console.info(1)
|
this.$get('idc', this.pageObj).then(response => {
|
||||||
await this.$get('idc', this.pageObj).then(response => {
|
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.idcData = response.data.list;
|
this.idcData = response.data.list;
|
||||||
this.getTableData();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
for (var i = 0; i < this.idcData.length; i++) {
|
for (var i = 0; i < this.idcData.length; i++) {
|
||||||
this.$set(this.idcData[i], 'oldName', this.idcData[i].name);
|
this.$set(this.idcData[i], 'oldName', this.idcData[i].name);
|
||||||
this.$set(this.idcData[i], 'isEdit', false);
|
this.$set(this.idcData[i], 'isEdit', false);
|
||||||
}
|
}
|
||||||
|
this.getTableData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
esc: function() {
|
esc: function() {
|
||||||
this.rightBox.show = false;
|
this.rightBox.show = false;
|
||||||
},
|
|
||||||
stopFun: function() {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
jumpTo(data,id) {
|
jumpTo(data,id) {
|
||||||
this.$store.state.assetData.moduleData = data
|
this.$store.state.assetData.moduleData = data
|
||||||
@@ -374,10 +392,9 @@ export default {
|
|||||||
this.$get('promServer', this.pageObj).then(response => {
|
this.$get('promServer', this.pageObj).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
for (var i = 0; i < response.data.list.length; i++) {
|
for (var i = 0; i < response.data.list.length; i++) {
|
||||||
console.info(this.idcData)
|
|
||||||
for (var j = 0; j < this.idcData.length; j++) {
|
for (var j = 0; j < this.idcData.length; j++) {
|
||||||
if (response.data.list[i].idcId == this.idcData[j].id) {
|
if (response.data.list[i].idcId == this.idcData[j].id) {
|
||||||
response.data.list[i].idc = this.idcData[j];
|
response.data.list[i].idc = Object.assign({}, this.idcData[j]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,17 +246,57 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-right">
|
|
||||||
|
<!--metrics-->
|
||||||
|
<div class="content-right" v-if="tableShow == 2">
|
||||||
|
<div class="top-tools">
|
||||||
|
<el-button-group>
|
||||||
|
<el-button @click="tableShow = 1" class="top-tool-btn top-tool" size="mini">
|
||||||
|
<span class="top-tool-btn-txt">{{$t('project.endpoint.endpoint')}}</span>
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="" class="top-tool-btn top-tool top-tool-btn-active" size="mini">
|
||||||
|
<span class="top-tool-btn-txt">{{$t('project.metrics.metrics')}}</span>
|
||||||
|
</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
<el-input
|
||||||
|
class="top-tool-search top-tool top-tool-right"
|
||||||
|
type="text"
|
||||||
|
:placeholder="$t('overall.search')"
|
||||||
|
size="mini"
|
||||||
|
></el-input>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="metricsTableData"
|
||||||
|
border
|
||||||
|
height="calc(100% - 65px)"
|
||||||
|
style="width: 100%;">
|
||||||
|
<el-table-column
|
||||||
|
v-for="(item, index) in metricsTableTitle"
|
||||||
|
v-if="item.show"
|
||||||
|
:width="item.width"
|
||||||
|
:key="`col-${index}`"
|
||||||
|
:label="item.label"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope" :column="item">
|
||||||
|
<span>{{scope.row[item.prop]}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagination :pageObj="metricsPageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--endpoint-->
|
||||||
|
<div class="content-right" v-if="tableShow == 1">
|
||||||
<div class="top-tools">
|
<div class="top-tools">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button @click="" class="top-tool-btn top-tool top-tool-btn-active" size="mini">
|
<el-button @click="" class="top-tool-btn top-tool top-tool-btn-active" size="mini">
|
||||||
<span class="top-tool-btn-txt">{{$t('project.endpoint.endpoint')}}</span>
|
<span class="top-tool-btn-txt">{{$t('project.endpoint.endpoint')}}</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="" class="top-tool-btn top-tool" size="mini">
|
<el-button @click="tableShow = 2" class="top-tool-btn top-tool" size="mini">
|
||||||
<span class="top-tool-btn-txt">{{$t('project.metrics')}}</span>
|
<span class="top-tool-btn-txt">{{$t('project.metrics.metrics')}}</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
<el-button @click="toAdd" class="top-tool-btn top-tool-btn-active top-tool margin-l-10 top-tool-right" size="mini">
|
<el-button @click.stop="toAdd" class="top-tool-btn top-tool-btn-active top-tool margin-l-10 top-tool-right" size="mini">
|
||||||
<span><i class="el-icon-plus"></i></span>
|
<span><i class="el-icon-plus"></i></span>
|
||||||
<span class="top-tool-btn-txt">{{$t('overall.add')}}</span>
|
<span class="top-tool-btn-txt">{{$t('overall.add')}}</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -273,7 +313,7 @@
|
|||||||
height="calc(100% - 65px)"
|
height="calc(100% - 65px)"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-for="(item, index) in tableTitle"
|
v-for="(item, index) in endpointTableTitle"
|
||||||
v-if="item.show"
|
v-if="item.show"
|
||||||
:width="item.width"
|
:width="item.width"
|
||||||
:key="`col-${index}`"
|
:key="`col-${index}`"
|
||||||
@@ -287,8 +327,8 @@
|
|||||||
<el-table-column :label="$t('overall.option')" width="100">
|
<el-table-column :label="$t('overall.option')" width="100">
|
||||||
<template slot-scope="scope" :column="item">
|
<template slot-scope="scope" :column="item">
|
||||||
<div class="content-right-options">
|
<div class="content-right-options">
|
||||||
<span @click="detail(scope.row)" class="content-right-option"><i class="el-icon-view"></i></span>
|
<span @click.stop="detail(scope.row)" class="content-right-option"><i class="el-icon-view"></i></span>
|
||||||
<span @click="toEdit(scope.row)" class="content-right-option"><i class="el-icon-edit-outline"></i></span>
|
<span @click.stop="toEdit(scope.row)" class="content-right-option"><i class="el-icon-edit-outline"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -298,7 +338,7 @@
|
|||||||
|
|
||||||
<!-- begin--右弹框-->
|
<!-- begin--右弹框-->
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<div class="right-box right-box-endpoint" v-if="rightBox.show">
|
<div class="right-box right-box-endpoint" v-if="rightBox.show" @click.stop>
|
||||||
<!-- begin--顶部按钮-->
|
<!-- begin--顶部按钮-->
|
||||||
<div class="right-box-top-btns">
|
<div class="right-box-top-btns">
|
||||||
<div class="right-box-top-btn right-box-top-btn-full" @click="esc(1)">
|
<div class="right-box-top-btn right-box-top-btn-full" @click="esc(1)">
|
||||||
@@ -314,7 +354,7 @@
|
|||||||
<span v-if="rightBox.isEdit">{{$t('overall.save')}}</span>
|
<span v-if="rightBox.isEdit">{{$t('overall.save')}}</span>
|
||||||
<span v-else>{{$t('overall.edit')}}</span>
|
<span v-else>{{$t('overall.edit')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-box-top-btn" v-if="rightBox.isEdit && endpoint.id != ''">
|
<div class="right-box-top-btn" v-if="rightBox.isEdit && endpoint.id != ''" @click="del()">
|
||||||
<div class="right-box-btn-icon">
|
<div class="right-box-btn-icon">
|
||||||
<i class="el-icon-delete"></i>
|
<i class="el-icon-delete"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -343,7 +383,7 @@
|
|||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">{{$t("project.module.module")}}</div>
|
<div class="right-box-form-label">{{$t("project.module.module")}}</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
<el-select @change="((val) => {changeSelectedModule(val.id)})" value-key="id" popper-class="config-dropdown" v-model="selectedModule" placeholder="" v-if="rightBox.isEdit" size="small">
|
<el-select @change="((val) => {changeSelectedModule(val)})" value-key="id" popper-class="config-dropdown" v-model="selectedModule" placeholder="" v-if="rightBox.isEdit" size="small">
|
||||||
<el-option v-for="item in toSelectModuleData" :key="item.id" :label="item.name" :value="item"></el-option>
|
<el-option v-for="item in toSelectModuleData" :key="item.id" :label="item.name" :value="item"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{endpoint.module.name}}</div>
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{endpoint.module.name}}</div>
|
||||||
@@ -396,16 +436,16 @@
|
|||||||
<div class="right-box-form-row">
|
<div class="right-box-form-row">
|
||||||
<div class="right-box-form-label">
|
<div class="right-box-form-label">
|
||||||
{{$t("project.endpoint.param")}}
|
{{$t("project.endpoint.param")}}
|
||||||
<el-button class="param-btn param-btn-active margin-l-10" size="mini" @click="addParam"><i class="el-icon-plus"></i>{{$t('overall.add')}}</el-button>
|
<el-button v-if="rightBox.isEdit" class="param-btn param-btn-active margin-l-10" size="mini" @click="addParam"><i class="el-icon-plus"></i>{{$t('overall.add')}}</el-button>
|
||||||
<el-button class="param-btn param-btn-clear" size="mini" @click="clearAllParam">{{$t('overall.clearAll')}}</el-button>
|
<el-button v-if="rightBox.isEdit" class="param-btn param-btn-clear" size="mini" @click="clearAllParam">{{$t('overall.clearAll')}}</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-box-form-content">
|
<div class="right-box-form-content">
|
||||||
<div class="param-box param-box-endpoint">
|
<div class="param-box param-box-endpoint">
|
||||||
<div class="param-box-row" v-for="(item, index) in paramObj">
|
<div class="param-box-row" v-for="(item, index) in paramObj">
|
||||||
<el-input placeholder="key" class="param-box-row-key" size="mini" v-model="item.key"></el-input>
|
<el-input :disabled="!rightBox.isEdit" placeholder="key" class="param-box-row-key" size="mini" v-model="item.key"></el-input>
|
||||||
<span class="param-box-row-eq">=</span>
|
<span class="param-box-row-eq">=</span>
|
||||||
<el-input placeholder="value" class="param-box-row-value" size="mini" v-model="item.value"></el-input>
|
<el-input :disabled="!rightBox.isEdit" placeholder="value" class="param-box-row-value" size="mini" v-model="item.value"></el-input>
|
||||||
<span class="param-box-row-symbol" @click="removeParam(index)"><i class="el-icon-minus"></i></span>
|
<span v-if="rightBox.isEdit" class="param-box-row-symbol" @click="removeParam(index)"><i class="el-icon-minus"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -423,7 +463,7 @@
|
|||||||
|
|
||||||
<!-- begin--子弹框-->
|
<!-- begin--子弹框-->
|
||||||
<transition name="right-sub-box">
|
<transition name="right-sub-box">
|
||||||
<div class="right-sub-box" v-if="rightSubBox.show">
|
<div class="right-sub-box" @click.stop v-if="rightSubBox.show">
|
||||||
<!-- begin--标题-->
|
<!-- begin--标题-->
|
||||||
<div class="right-box-title">{{rightSubBox.title}}</div>
|
<div class="right-box-title">{{rightSubBox.title}}</div>
|
||||||
<!-- end--标题-->
|
<!-- end--标题-->
|
||||||
@@ -484,7 +524,7 @@
|
|||||||
|
|
||||||
<!-- begin--project弹框-->
|
<!-- begin--project弹框-->
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<div class="right-box right-box-endpoint" v-if="projectRightBox.show">
|
<div class="right-box right-box-endpoint" v-if="projectRightBox.show" @click.stop>
|
||||||
<!-- begin--顶部按钮-->
|
<!-- begin--顶部按钮-->
|
||||||
<div class="right-box-top-btns">
|
<div class="right-box-top-btns">
|
||||||
<div class="right-box-top-btn right-box-top-btn-full" @click="esc(2)">
|
<div class="right-box-top-btn right-box-top-btn-full" @click="esc(2)">
|
||||||
@@ -499,7 +539,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<span>{{$t('overall.save')}}</span>
|
<span>{{$t('overall.save')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-box-top-btn" v-if="project.id != ''">
|
<div class="right-box-top-btn" v-if="project.id != ''" @click="projectDel">
|
||||||
<div class="right-box-btn-icon">
|
<div class="right-box-btn-icon">
|
||||||
<i class="el-icon-delete"></i>
|
<i class="el-icon-delete"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -554,7 +594,7 @@
|
|||||||
|
|
||||||
<!-- begin--module弹框-->
|
<!-- begin--module弹框-->
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<div class="right-box right-box-endpoint" v-if="moduleRightBox.show">
|
<div class="right-box right-box-endpoint" v-if="moduleRightBox.show" @click.stop>
|
||||||
<!-- begin--顶部按钮-->
|
<!-- begin--顶部按钮-->
|
||||||
<div class="right-box-top-btns">
|
<div class="right-box-top-btns">
|
||||||
<div class="right-box-top-btn right-box-top-btn-full" @click="esc(3)">
|
<div class="right-box-top-btn right-box-top-btn-full" @click="esc(3)">
|
||||||
@@ -569,7 +609,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<span>{{$t('overall.save')}}</span>
|
<span>{{$t('overall.save')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-box-top-btn" v-if="currentModule.id != ''">
|
<div class="right-box-top-btn" v-if="currentModule.id != ''" @click="moduleDel">
|
||||||
<div class="right-box-btn-icon">
|
<div class="right-box-btn-icon">
|
||||||
<i class="el-icon-delete"></i>
|
<i class="el-icon-delete"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -688,6 +728,7 @@ export default {
|
|||||||
name: "project",
|
name: "project",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
tableShow: 1, // 1.endpoint; 2.metrics
|
||||||
projectRightBox: {
|
projectRightBox: {
|
||||||
show: false,
|
show: false,
|
||||||
title: ''
|
title: ''
|
||||||
@@ -719,6 +760,11 @@ export default {
|
|||||||
pageSize: 11,
|
pageSize: 11,
|
||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
|
metricsPageObj: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
endpoint: {
|
endpoint: {
|
||||||
id: '',
|
id: '',
|
||||||
host: '',
|
host: '',
|
||||||
@@ -727,7 +773,9 @@ export default {
|
|||||||
path: '',
|
path: '',
|
||||||
asset: {id: '', name: '', host: ''},
|
asset: {id: '', name: '', host: ''},
|
||||||
project: {id: '', name: ''},
|
project: {id: '', name: ''},
|
||||||
module: {id: '', name: '', param: '', paramObj: {}}
|
module: {id: '', name: '', param: '', paramObj: {}, projectId: ''},
|
||||||
|
moduleId: '',
|
||||||
|
assetId: ''
|
||||||
},
|
},
|
||||||
moduleRightBox: {
|
moduleRightBox: {
|
||||||
show: false,
|
show: false,
|
||||||
@@ -735,18 +783,20 @@ export default {
|
|||||||
},
|
},
|
||||||
currentModule: { //左侧列表当前选中的module
|
currentModule: { //左侧列表当前选中的module
|
||||||
id: '',
|
id: '',
|
||||||
name: ''
|
name: '',
|
||||||
|
projectId: ''
|
||||||
},
|
},
|
||||||
selectedModule: { //侧滑框中选中的module
|
selectedModule: { //侧滑框中选中的module
|
||||||
id: '',
|
id: '',
|
||||||
name: ''
|
name: '',
|
||||||
|
projectId: ''
|
||||||
},
|
},
|
||||||
selectedAsset: { //侧滑框中选中的asset
|
selectedAsset: { //侧滑框中选中的asset
|
||||||
id: '',
|
id: '',
|
||||||
host: '',
|
host: '',
|
||||||
sn: ''
|
sn: ''
|
||||||
},
|
},
|
||||||
tableTitle: [
|
endpointTableTitle: [
|
||||||
{
|
{
|
||||||
label: this.$t("project.endpoint.endpointId"),
|
label: this.$t("project.endpoint.endpointId"),
|
||||||
prop: 'id',
|
prop: 'id',
|
||||||
@@ -784,7 +834,31 @@ export default {
|
|||||||
moduleData: [], //左侧列表的module信息
|
moduleData: [], //左侧列表的module信息
|
||||||
toSelectModuleData: [], //侧滑框中可选的module
|
toSelectModuleData: [], //侧滑框中可选的module
|
||||||
paramObj: [], //侧滑框中的param信息
|
paramObj: [], //侧滑框中的param信息
|
||||||
assetData: [] //侧滑框中可选的asset
|
assetData: [], //侧滑框中可选的asset
|
||||||
|
metricsTableData: [
|
||||||
|
{
|
||||||
|
name: 'Topic.msg',
|
||||||
|
type: 'Counter',
|
||||||
|
desc: '10000'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
metricsTableTitle: [
|
||||||
|
{
|
||||||
|
label: this.$t("project.metrics.name"),
|
||||||
|
prop: 'name',
|
||||||
|
show: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t("project.metrics.type"),
|
||||||
|
prop: 'type',
|
||||||
|
show: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t("project.metrics.description"),
|
||||||
|
prop: 'desc',
|
||||||
|
show: true,
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -820,6 +894,9 @@ export default {
|
|||||||
this.$get('project').then(response => {
|
this.$get('project').then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.projectData = response.data.list;
|
this.projectData = response.data.list;
|
||||||
|
console.info(this.project);
|
||||||
|
this.project = this.projectData[0];
|
||||||
|
console.info(this.project);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -840,6 +917,8 @@ export default {
|
|||||||
// endpoint弹框中的asset子弹框里asset选择事件
|
// endpoint弹框中的asset子弹框里asset选择事件
|
||||||
selectAsset: function(obj) {
|
selectAsset: function(obj) {
|
||||||
this.selectedAsset = obj;
|
this.selectedAsset = obj;
|
||||||
|
this.endpoint.host = obj.host;
|
||||||
|
this.endpoint.assetId = obj.id;
|
||||||
},
|
},
|
||||||
// endpoint弹框中的asset子弹框搜索
|
// endpoint弹框中的asset子弹框搜索
|
||||||
searchAsset: function() {
|
searchAsset: function() {
|
||||||
@@ -905,12 +984,12 @@ export default {
|
|||||||
// 左侧module列表点击事件
|
// 左侧module列表点击事件
|
||||||
changeListModule: function(module) {
|
changeListModule: function(module) {
|
||||||
this.currentModule = Object.assign({}, module);
|
this.currentModule = Object.assign({}, module);
|
||||||
this.moduleRightBox.show = false;
|
this.esc(3);
|
||||||
this.getEndPointTableData();
|
this.getEndPointTableData();
|
||||||
},
|
},
|
||||||
// endpoint弹框中module下拉框点击事件
|
// endpoint弹框中module下拉框点击事件
|
||||||
changeSelectedModule: function(moduleId) {
|
changeSelectedModule: function(module) {
|
||||||
if (moduleId == this.endpoint.moduleId) {
|
if (module.id == this.endpoint.moduleId) {
|
||||||
try {
|
try {
|
||||||
this.paramObj = JSON.parse(JSON.stringify(this.endpoint.paramObj));
|
this.paramObj = JSON.parse(JSON.stringify(this.endpoint.paramObj));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
@@ -925,6 +1004,8 @@ export default {
|
|||||||
console.info(err);
|
console.info(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.endpoint.port = module.port;
|
||||||
|
this.endpoint.path = module.path;
|
||||||
},
|
},
|
||||||
// 打开endpoint编辑页
|
// 打开endpoint编辑页
|
||||||
toEdit: function(endpoint) {
|
toEdit: function(endpoint) {
|
||||||
@@ -956,13 +1037,71 @@ export default {
|
|||||||
this.moduleRightBox.title = this.$t('project.module.editModule') + " ID:" + module.id;
|
this.moduleRightBox.title = this.$t('project.module.editModule') + " ID:" + module.id;
|
||||||
},
|
},
|
||||||
// 删除endpoint
|
// 删除endpoint
|
||||||
del: function(u) {
|
del: function() {
|
||||||
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||||
|
confirmButtonText: this.$t("tip.yes"),
|
||||||
|
cancelButtonText: this.$t("tip.no"),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$delete("endpoint?ids=" + this.endpoint.id).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message({duration: 3000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
||||||
|
this.getEndPointTableData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 删除module
|
||||||
|
moduleDel: function() {
|
||||||
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||||
|
confirmButtonText: this.$t("tip.yes"),
|
||||||
|
cancelButtonText: this.$t("tip.no"),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$delete("module?ids=" + this.currentModule.id).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message({duration: 3000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
||||||
|
this.esc(3);
|
||||||
|
this.getModuleData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
projectDel: function() {
|
||||||
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||||
|
confirmButtonText: this.$t("tip.yes"),
|
||||||
|
cancelButtonText: this.$t("tip.no"),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$delete("project?ids=" + this.project.id).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message({duration: 3000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
||||||
|
this.$store.commit('projectRightBoxShow', false);
|
||||||
|
this.getProjectData();
|
||||||
|
this.getModuleData();
|
||||||
|
if (this.projectData.length > 0) {
|
||||||
|
this.$store.commit('setProject', this.projectData[0]);
|
||||||
|
}
|
||||||
|
this.$store.commit('projectListReloadChange', true);
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 打开endpoint新增页
|
// 打开endpoint新增页
|
||||||
toAdd: function() {
|
toAdd: function() {
|
||||||
this.cleanEndpoint();
|
this.cleanEndpoint();
|
||||||
this.paramObj = [];
|
this.endpoint.project = Object.assign({}, this.project);
|
||||||
this.toSelectModuleData = [];
|
this.paramObj = Object.assign([], this.currentModule.paramObj);
|
||||||
|
this.getToSelectModuleData(this.project.id);
|
||||||
|
this.selectedModule = Object.assign({}, this.currentModule);
|
||||||
|
this.endpoint.port = this.selectedModule.port;
|
||||||
|
this.endpoint.path = this.selectedModule.path;
|
||||||
this.rightBox.isEdit = true;
|
this.rightBox.isEdit = true;
|
||||||
this.rightBox.title = this.$t("project.endpoint.createEndpoint");
|
this.rightBox.title = this.$t("project.endpoint.createEndpoint");
|
||||||
this.rightBox.show = true;
|
this.rightBox.show = true;
|
||||||
@@ -970,6 +1109,7 @@ export default {
|
|||||||
// 打开endpoint详情页
|
// 打开endpoint详情页
|
||||||
detail: function(u) {
|
detail: function(u) {
|
||||||
this.endpoint = Object.assign({}, u);
|
this.endpoint = Object.assign({}, u);
|
||||||
|
this.paramObj = Object.assign([], u.paramObj);
|
||||||
this.rightBox.isEdit = false;
|
this.rightBox.isEdit = false;
|
||||||
this.rightBox.title = this.$t("project.endpoint.endpoint") + " ID:" + u.id;
|
this.rightBox.title = this.$t("project.endpoint.endpoint") + " ID:" + u.id;
|
||||||
this.rightBox.show = true;
|
this.rightBox.show = true;
|
||||||
@@ -978,25 +1118,67 @@ export default {
|
|||||||
saveOrToEdit: function() {
|
saveOrToEdit: function() {
|
||||||
if (!this.rightBox.isEdit) {
|
if (!this.rightBox.isEdit) {
|
||||||
this.rightBox.isEdit = true;
|
this.rightBox.isEdit = true;
|
||||||
|
this.getToSelectModuleData(this.endpoint.project.id);
|
||||||
|
this.selectedModule = Object.assign({}, this.currentModule);
|
||||||
this.rightBox.title = this.$t("project.endpoint.editEndpoint") + " ID:" + this.endpoint.id;
|
this.rightBox.title = this.$t("project.endpoint.editEndpoint") + " ID:" + this.endpoint.id;
|
||||||
|
} else {
|
||||||
|
this.save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 保存project
|
// 保存project
|
||||||
projectSave: function() {
|
projectSave: function() {
|
||||||
this.$put('project', this.project).then(response => {
|
this.$put('project', this.project).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$store.commit('projectListReload', true);
|
this.$store.commit('setProject', this.project);
|
||||||
this.projectRightBox.show = false;
|
this.$store.commit('projectListReloadChange', true);
|
||||||
|
this.$store.commit('projectRightBoxShow', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 保存module
|
// 保存module
|
||||||
moduleSave: function() {
|
moduleSave: function() {
|
||||||
|
this.currentModule.param = this.paramToJson();
|
||||||
|
this.currentModule.projectId = this.currentModule.project.id;
|
||||||
|
this.$put('module', this.currentModule).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.esc(3);
|
||||||
|
this.getModuleData();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 保存endpoint
|
// 保存endpoint
|
||||||
save: function() {
|
save: function() {
|
||||||
|
this.endpoint.param = this.paramToJson();
|
||||||
|
this.endpoint.moduleId = this.selectedModule.id;
|
||||||
|
if (this.endpoint.id) {
|
||||||
|
this.$put('endpoint', this.endpoint).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.rightBox.isEdit = false;
|
||||||
|
this.esc(1);
|
||||||
|
this.getEndPointTableData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$post('endpoint', this.endpoint).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.rightBox.isEdit = false;
|
||||||
|
this.esc(1);
|
||||||
|
this.getEndPointTableData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
paramToJson: function() {
|
||||||
|
let tempParam = {};
|
||||||
|
for (let i = 0; i < this.paramObj.length; i++) {
|
||||||
|
eval('tempParam.' + this.paramObj[i].key + '="' + this.paramObj[i].value + '"');
|
||||||
|
}
|
||||||
|
let jsonString = JSON.stringify(tempParam);
|
||||||
|
if (jsonString == '{}') {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return jsonString;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 清除module、endpoint弹框中的param
|
// 清除module、endpoint弹框中的param
|
||||||
clearAllParam: function() {
|
clearAllParam: function() {
|
||||||
@@ -1042,13 +1224,18 @@ export default {
|
|||||||
this.pageObj.pageSize = val;
|
this.pageObj.pageSize = val;
|
||||||
this.getEndPointTableData();
|
this.getEndPointTableData();
|
||||||
},
|
},
|
||||||
// endpoint弹框的子弹框顶部搜索条件选中事件
|
// endpoint弹框的asset子弹框顶部搜索条件选中事件
|
||||||
dropdownSelect: function(label) {
|
dropdownSelect: function(label) {
|
||||||
this.assetSearch.label = label;
|
this.assetSearch.label = label;
|
||||||
this.assetSearch.dropdownShow = false;
|
this.assetSearch.dropdownShow = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
|
window.addEventListener('click', () => {
|
||||||
|
this.esc(1);
|
||||||
|
this.$store.commit('projectRightBoxShow', false);
|
||||||
|
this.esc(3);
|
||||||
|
});
|
||||||
this.getModuleData();
|
this.getModuleData();
|
||||||
this.getProjectData();
|
this.getProjectData();
|
||||||
this.getAssetData();
|
this.getAssetData();
|
||||||
@@ -1064,11 +1251,12 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
sProject(n, o) {
|
sProject(n, o) {
|
||||||
this.project = Object.assign({}, n);
|
this.project = Object.assign({}, n);
|
||||||
|
this.esc(3);
|
||||||
|
this.esc(1);
|
||||||
this.projectRightBox.title = this.$t("project.project.editProject") + " ID:" + n.id;
|
this.projectRightBox.title = this.$t("project.project.editProject") + " ID:" + n.id;
|
||||||
this.getModuleData();
|
this.getModuleData();
|
||||||
},
|
},
|
||||||
projectBoxShow(n, o) {
|
projectBoxShow(n, o) {
|
||||||
console.info(n)
|
|
||||||
this.projectRightBox.show = n;
|
this.projectRightBox.show = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import router from './router'
|
|||||||
|
|
||||||
import qs from 'qs' //引入数据格式化
|
import qs from 'qs' //引入数据格式化
|
||||||
//axios.defaults.baseURL = 'http://localhost:8088/nz-admin';
|
//axios.defaults.baseURL = 'http://localhost:8088/nz-admin';
|
||||||
axios.defaults.baseURL = 'http://192.168.41.69:8080/nz-admin';
|
//axios.defaults.baseURL = 'http://192.168.41.69:8080/nz-admin';
|
||||||
// axios.defaults.baseURL = 'http://192.168.40.247:8080/nz-admin';
|
axios.defaults.baseURL = 'http://192.168.40.247:8080/nz-admin';
|
||||||
|
|
||||||
axios.interceptors.request.use(config => {
|
axios.interceptors.request.use(config => {
|
||||||
// config.headers = {
|
// config.headers = {
|
||||||
@@ -41,7 +41,7 @@ export function get(url, params) {
|
|||||||
}).then(response => {
|
}).then(response => {
|
||||||
resolve(response.data)
|
resolve(response.data)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
resolve(err.response.data)
|
//resolve(err.response.data)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -51,8 +51,7 @@ export function post(url, params) {
|
|||||||
axios.post(url, params).then(response => {
|
axios.post(url, params).then(response => {
|
||||||
resolve(response.data)
|
resolve(response.data)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.info(err)
|
resolve(err.response.data);
|
||||||
resolve('失败')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const store = new Vuex.Store({
|
|||||||
projectRightBoxShow(state, show) {
|
projectRightBoxShow(state, show) {
|
||||||
state.projectBoxShow = show;
|
state.projectBoxShow = show;
|
||||||
},
|
},
|
||||||
projectListReload(state, reload) {
|
projectListReloadChange(state, reload) {
|
||||||
state.projectListReload = reload;
|
state.projectListReload = reload;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user