feat:列表页 列上 添加详情预览
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<button type="button" v-if="alertRule.id != ''" @click="del" class="nz-btn nz-btn-size-normal nz-btn-style-light">
|
<button type="button" v-if="alertRule.id != ''" @click="del" class="nz-btn nz-btn-size-normal nz-btn-style-light">
|
||||||
<span class="top-tool-btn-txt">{{$t('overall.delete')}}</span>
|
<span class="top-tool-btn-txt">{{$t('overall.delete')}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" @click="save" class="nz-btn nz-btn-size-normal nz-btn-style-normal">
|
<button type="button" @click="saveOrToEdit" class="nz-btn nz-btn-size-normal nz-btn-style-normal">
|
||||||
<span v-if="rightBox.isEdit" class="top-tool-btn-txt">{{$t('overall.save')}}</span>
|
<span v-if="rightBox.isEdit" class="top-tool-btn-txt">{{$t('overall.save')}}</span>
|
||||||
<span v-else class="top-tool-btn-txt">{{$t('overall.edit')}}</span>
|
<span v-else class="top-tool-btn-txt">{{$t('overall.edit')}}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
<button type="button" v-if="module.id != ''" @click="del" class="nz-btn nz-btn-size-normal nz-btn-style-light">
|
<button type="button" v-if="module.id != ''" @click="del" class="nz-btn nz-btn-size-normal nz-btn-style-light">
|
||||||
<span class="top-tool-btn-txt">{{$t('overall.delete')}}</span>
|
<span class="top-tool-btn-txt">{{$t('overall.delete')}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" @click="save" class="nz-btn nz-btn-size-normal nz-btn-style-normal">
|
<button type="button" @click="saveOrToEdit" class="nz-btn nz-btn-size-normal nz-btn-style-normal">
|
||||||
<span class="top-tool-btn-txt">{{$t('overall.save')}}</span>
|
<span v-if="rightBox.isEdit" class="top-tool-btn-txt">{{$t('overall.save')}}</span>
|
||||||
|
<span v-else class="top-tool-btn-txt">{{$t('overall.edit')}}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button type="button" @click="esc" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-style-square">
|
<button type="button" @click="esc" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-style-square">
|
||||||
@@ -42,31 +43,36 @@
|
|||||||
<el-scrollbar class="right-box-form-box">
|
<el-scrollbar class="right-box-form-box">
|
||||||
<el-form class="right-box-form" :model="module" label-position="top" :rules="rules" ref="moduleForm">
|
<el-form class="right-box-form" :model="module" label-position="top" :rules="rules" ref="moduleForm">
|
||||||
<el-form-item :label='$t("project.project.project")' prop="project">
|
<el-form-item :label='$t("project.project.project")' prop="project">
|
||||||
<el-select value-key="id" popper-class="config-dropdown" v-model="module.project" placeholder="" size="small">
|
<el-select v-if="rightBox.isEdit" value-key="id" popper-class="config-dropdown" v-model="module.project" placeholder="" size="small">
|
||||||
<el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item"></el-option>
|
<el-option v-for="item in projectList" :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">{{module.project.name}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label='$t("project.module.moduleName")' prop="name">
|
<el-form-item :label='$t("project.module.moduleName")' prop="name">
|
||||||
<el-input placeholder="" maxlength="64" show-word-limit v-model="module.name" size="small"></el-input>
|
<el-input v-if="rightBox.isEdit" placeholder="" maxlength="64" show-word-limit v-model="module.name" size="small"></el-input>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{module.name}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label='$t("project.module.description")' prop="remark">
|
<el-form-item :label='$t("project.module.description")' prop="remark">
|
||||||
<el-input type="textarea" placeholder="" maxlength="1024" show-word-limit v-model="module.remark" size="small"></el-input>
|
<el-input v-if="rightBox.isEdit" type="textarea" placeholder="" maxlength="1024" show-word-limit v-model="module.remark" size="small"></el-input>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{module.remark}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="right-box-form-tip">
|
<div class="right-box-form-tip" v-if="rightBox.isEdit">
|
||||||
{{$t('project.module.tip.defaultEndpointSet')}}
|
{{$t('project.module.tip.defaultEndpointSet')}}
|
||||||
<div class="line-100"></div>
|
<div class="line-100"></div>
|
||||||
{{$t('project.module.tip.relation')}}
|
{{$t('project.module.tip.relation')}}
|
||||||
</div>
|
</div>
|
||||||
<el-form-item :label='$t("project.endpoint.port")' prop="port">
|
<el-form-item :label='$t("project.endpoint.port")' prop="port">
|
||||||
<el-input placeholder="" v-model.number="module.port" size="small"></el-input>
|
<el-input v-if="rightBox.isEdit" placeholder="" v-model.number="module.port" size="small"></el-input>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{module.port}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label='$t("project.endpoint.path")' prop="path">
|
<el-form-item :label='$t("project.endpoint.path")' prop="path">
|
||||||
<el-input placeholder="" v-model="module.path" size="small"></el-input>
|
<el-input v-if="rightBox.isEdit" placeholder="" v-model="module.path" size="small"></el-input>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{module.path}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item class="right-box-form-param">
|
<el-form-item class="right-box-form-param">
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<span>{{$t('project.endpoint.param')}}</span>
|
<span>{{$t('project.endpoint.param')}}</span>
|
||||||
<div class="right-box-form-btns">
|
<div class="right-box-form-btns" v-if="rightBox.isEdit">
|
||||||
<button style="display: none;">第一个button会出现意料之外的hover样式,找不到原因,只好加个不可见的button规避问题</button>
|
<button style="display: none;">第一个button会出现意料之外的hover样式,找不到原因,只好加个不可见的button规避问题</button>
|
||||||
<button type="button" @click="clearAllParam" class="nz-btn nz-btn-size-small nz-btn-style-light">
|
<button type="button" @click="clearAllParam" class="nz-btn nz-btn-size-small nz-btn-style-light">
|
||||||
<span class="top-tool-btn-txt">{{$t('overall.clearAll')}}</span>
|
<span class="top-tool-btn-txt">{{$t('overall.clearAll')}}</span>
|
||||||
@@ -77,7 +83,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="param-box param-box-module">
|
<div class="param-box param-box-module">
|
||||||
<div class="param-box-row" v-for="(item, index) in module.paramObj">
|
<div class="param-box-row" v-for="(item, index) in module.paramObj" v-if="rightBox.isEdit">
|
||||||
<el-form-item class="param-box-row-key" :rules="{required: true, message: $t('validate.required'), trigger: 'blur'}" :prop="'paramObj.' + index + '.key'">
|
<el-form-item class="param-box-row-key" :rules="{required: true, message: $t('validate.required'), trigger: 'blur'}" :prop="'paramObj.' + index + '.key'">
|
||||||
<el-input placeholder="key" size="mini" v-model="item.key"></el-input>
|
<el-input placeholder="key" size="mini" v-model="item.key"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -87,7 +93,11 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<span class="param-box-row-symbol" @click="removeParam(index)"><i class="nz-icon nz-icon-minus-square"></i></span>
|
<span class="param-box-row-symbol" @click="removeParam(index)"><i class="nz-icon nz-icon-minus-square"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="param-box-row" v-for="(item, index) in module.paramObj" v-if="!rightBox.isEdit">
|
||||||
|
<div class="right-box-form-content-txt">{{item.key}}={{item.value}}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -180,7 +190,8 @@
|
|||||||
return {
|
return {
|
||||||
rightBox: {
|
rightBox: {
|
||||||
show: false,
|
show: false,
|
||||||
title: ''
|
title: '',
|
||||||
|
isEdit:false
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
@@ -197,8 +208,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
show(show) {
|
show(show,isEdit) {
|
||||||
this.rightBox.show = show;
|
this.rightBox.show = show;
|
||||||
|
this.rightBox.isEdit=isEdit
|
||||||
},
|
},
|
||||||
|
|
||||||
/*关闭弹框*/
|
/*关闭弹框*/
|
||||||
@@ -238,7 +250,14 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
saveOrToEdit: function() {
|
||||||
|
if (!this.rightBox.isEdit) {
|
||||||
|
this.rightBox.isEdit = true;
|
||||||
|
this.rightBox.title = this.$t("project.module.editModule") + " ID:" + this.module.id;
|
||||||
|
} else {
|
||||||
|
this.save();
|
||||||
|
}
|
||||||
|
},
|
||||||
/*删除*/
|
/*删除*/
|
||||||
del() {
|
del() {
|
||||||
this.$confirm(this.$t("tip.confirmDelete"), {
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||||
@@ -317,9 +336,10 @@
|
|||||||
watch: {
|
watch: {
|
||||||
module: {
|
module: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
deep:true,
|
||||||
handler(n, o) {
|
handler(n, o) {
|
||||||
if (n && n.id) {
|
if (n && n.id) {
|
||||||
this.rightBox.title = this.$t("project.module.editModule") + " ID:" + n.id;
|
this.rightBox.title =this.rightBox.isEdit? this.$t("project.module.editModule") + " ID:" + n.id : this.$t("project.module.module") + " ID:" + n.id ;
|
||||||
} else {
|
} else {
|
||||||
this.rightBox.title = this.$t("project.module.createModule");
|
this.rightBox.title = this.$t("project.module.createModule");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
<button type="button" v-if="project.id != ''" @click="del" class="nz-btn nz-btn-size-normal nz-btn-style-light">
|
<button type="button" v-if="project.id != ''" @click="del" class="nz-btn nz-btn-size-normal nz-btn-style-light">
|
||||||
<span class="top-tool-btn-txt">{{$t('overall.delete')}}</span>
|
<span class="top-tool-btn-txt">{{$t('overall.delete')}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" @click="save" class="nz-btn nz-btn-size-normal nz-btn-style-normal">
|
<button type="button" @click="saveOrToEdit" class="nz-btn nz-btn-size-normal nz-btn-style-normal">
|
||||||
<span class="top-tool-btn-txt">{{$t('overall.save')}}</span>
|
<span v-if="rightBox.isEdit" class="top-tool-btn-txt">{{$t('overall.save')}}</span>
|
||||||
|
<span v-else class="top-tool-btn-txt">{{$t('overall.edit')}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" @click="esc" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-style-square">
|
<button type="button" @click="esc" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-style-square">
|
||||||
<span class="top-tool-btn-txt"><i class="el-icon-close"></i></span>
|
<span class="top-tool-btn-txt"><i class="el-icon-close"></i></span>
|
||||||
@@ -21,10 +22,12 @@
|
|||||||
<el-scrollbar class="right-box-form-box">
|
<el-scrollbar class="right-box-form-box">
|
||||||
<el-form class="right-box-form" :model="project" label-position="top" :rules="rules" ref="projectForm">
|
<el-form class="right-box-form" :model="project" label-position="top" :rules="rules" ref="projectForm">
|
||||||
<el-form-item :label='$t("project.project.projectName")' prop="name">
|
<el-form-item :label='$t("project.project.projectName")' prop="name">
|
||||||
<el-input size="mini" maxlength="64" show-word-limit v-model="project.name"></el-input>
|
<el-input v-if="rightBox.isEdit" size="mini" maxlength="64" show-word-limit v-model="project.name"></el-input>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{project.name}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label='$t("project.project.description")'>
|
<el-form-item :label='$t("project.project.description")'>
|
||||||
<el-input size="mini" type="textarea" maxlength="1024" show-word-limit v-model="project.remark"></el-input>
|
<el-input v-if="rightBox.isEdit" size="mini" type="textarea" maxlength="1024" show-word-limit v-model="project.remark"></el-input>
|
||||||
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{project.remark}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
@@ -48,7 +51,8 @@
|
|||||||
rightBox: {
|
rightBox: {
|
||||||
show: false,
|
show: false,
|
||||||
title: '',
|
title: '',
|
||||||
isCreate: false
|
isCreate: false,
|
||||||
|
isEdit:false
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
@@ -58,8 +62,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
show(show) {
|
show(show,isEdit) {
|
||||||
this.rightBox.show = show;
|
this.rightBox.show = show;
|
||||||
|
this.rightBox.isEdit=isEdit;
|
||||||
},
|
},
|
||||||
|
|
||||||
/*关闭弹框*/
|
/*关闭弹框*/
|
||||||
@@ -99,7 +104,14 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
saveOrToEdit: function() {
|
||||||
|
if (!this.rightBox.isEdit) {
|
||||||
|
this.rightBox.isEdit = true;
|
||||||
|
this.rightBox.title = this.$t("project.module.editProject") + " ID:" + this.project.id;
|
||||||
|
} else {
|
||||||
|
this.save();
|
||||||
|
}
|
||||||
|
},
|
||||||
/*删除*/
|
/*删除*/
|
||||||
del() {
|
del() {
|
||||||
this.$confirm(this.$t("tip.confirmDelete"), {
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||||
@@ -124,7 +136,7 @@
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
handler(n, o) {
|
handler(n, o) {
|
||||||
if (n && n.id) {
|
if (n && n.id) {
|
||||||
this.rightBox.title = this.$t("project.project.editProject") + " ID:" + n.id;
|
this.rightBox.title =this.rightBox.isEdit? this.$t("project.project.editProject") + " ID:" + n.id : this.$t("project.project.project") + " ID:" + n.id;
|
||||||
} else {
|
} else {
|
||||||
this.rightBox.title = this.$t("project.project.createProject");
|
this.rightBox.title = this.$t("project.project.createProject");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,11 @@
|
|||||||
<span v-else-if="item.prop == 'type'">
|
<span v-else-if="item.prop == 'type'">
|
||||||
<template v-for="type in typeData" v-if="type.key == scope.row[item.prop]">{{type.value}}</template>
|
<template v-for="type in typeData" v-if="type.key == scope.row[item.prop]">{{type.value}}</template>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.prop == 'linkObject' && scope.row[item.prop]">{{scope.row.type != 3 && scope.row.linkObject ? scope.row[item.prop].name : scope.row[item.prop].host}}</span>
|
<!-- <span v-else-if="item.prop == 'linkObject' && scope.row[item.prop]">{{scope.row.type != 3 && scope.row.linkObject ? scope.row[item.prop].name : scope.row[item.prop].host}}</span>-->
|
||||||
|
<div v-else-if="item.prop == 'linkObject'">
|
||||||
|
<span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="account-list-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop])">{{scope.row[item.prop].name}}</span>
|
||||||
|
<span v-if="scope.row['type'] == 3 && scope.row[item.prop]" class="account-list-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span>
|
||||||
|
</div>
|
||||||
<span v-else>{{scope.row[item.prop]}}</span>
|
<span v-else>{{scope.row[item.prop]}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -89,6 +93,9 @@
|
|||||||
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||||
</div>
|
</div>
|
||||||
<alert-config-box :parentAlertRule="alertRule" @reload="getTableData" ref="alertConfigBox"></alert-config-box>
|
<alert-config-box :parentAlertRule="alertRule" @reload="getTableData" ref="alertConfigBox"></alert-config-box>
|
||||||
|
<project-box :project="viewProjectData" ref="projectBox"></project-box>
|
||||||
|
<module-box :module="viewModuleData" @reload="" ref="moduleBox"></module-box>
|
||||||
|
<asset-edit-unit :edit-unit-show='viewAsset' @refreshData="" @sendStateData="" ref="assetEditUnit"></asset-edit-unit>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@@ -219,7 +226,10 @@ export default {
|
|||||||
show: true,
|
show: true,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
tableData: []
|
tableData: [],
|
||||||
|
viewProjectData:null,
|
||||||
|
viewModuleData:null,
|
||||||
|
viewAsset:false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -309,6 +319,45 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
|
},
|
||||||
|
viewAlertType:function(type,typeObj){
|
||||||
|
console.log(typeObj)
|
||||||
|
this.closeViews();
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
this.viewProjectData=typeObj;
|
||||||
|
this.$refs.projectBox.show(true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.fillProject(typeObj);
|
||||||
|
let tempObj=JSON.parse(typeObj.param)
|
||||||
|
this.$set(typeObj, 'paramObj', []);
|
||||||
|
for (let k in tempObj) {
|
||||||
|
typeObj.paramObj.push({key: k, value: tempObj[k]});
|
||||||
|
}
|
||||||
|
this.viewModuleData=typeObj;
|
||||||
|
|
||||||
|
this.$refs.moduleBox.show(true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.viewAsset=true;
|
||||||
|
this.$refs.assetEditUnit.getAssetData(typeObj);
|
||||||
|
this.$refs.assetEditUnit.tabView=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fillProject:function(module){
|
||||||
|
this.$get('project', {"id":module.projectId}).then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
module.project = response.data.list[0];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closeViews:function(){
|
||||||
|
this.$refs.alertConfigBox.show(false,false);
|
||||||
|
this.$refs.projectBox.show(false,false);
|
||||||
|
this.$refs.moduleBox.show(false,false);
|
||||||
|
this.viewAsset=false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@@ -185,10 +185,13 @@
|
|||||||
:label="item.label"
|
:label="item.label"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope" :column="item">
|
<template slot-scope="scope" :column="item">
|
||||||
<div v-if="item.prop == 'type'" class="account-list-options">
|
<span v-if="item.prop == 'alertRule'" class="account-list-option" @click="viewRule(scope.row[item.prop].id)">
|
||||||
<span v-if="scope.row[item.prop] == 1" class="account-list-option">Project</span>
|
{{scope.row[item.prop].alertName}}
|
||||||
<span v-if="scope.row[item.prop] == 2" class="account-list-option">Module</span>
|
</span>
|
||||||
<span v-if="scope.row[item.prop] == 3" class="account-list-option">Device</span>
|
<div v-else-if="item.prop == 'type'" class="account-list-options">
|
||||||
|
<span v-if="scope.row[item.prop] == 1" >Project</span>
|
||||||
|
<span v-if="scope.row[item.prop] == 2" >Module</span>
|
||||||
|
<span v-if="scope.row[item.prop] == 3" >Device</span>
|
||||||
</div>
|
</div>
|
||||||
<span v-else-if="item.prop == 'severity'">
|
<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 v-if="scope.row[item.prop] == 'high'"><i class="el-icon-arrow-up"></i> {{severityData[1].value}}</span>
|
||||||
@@ -196,8 +199,8 @@
|
|||||||
<span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i> {{severityData[2].value}}</span>
|
<span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i> {{severityData[2].value}}</span>
|
||||||
</span>
|
</span>
|
||||||
<div v-else-if="item.prop == 'linkObject'">
|
<div v-else-if="item.prop == 'linkObject'">
|
||||||
<span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="account-list-option">{{scope.row[item.prop].name}}</span>
|
<span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="account-list-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop])">{{scope.row[item.prop].name}}</span>
|
||||||
<span v-if="scope.row['type'] == 3 && scope.row[item.prop]" class="account-list-option">{{scope.row[item.prop].host}}</span>
|
<span v-if="scope.row['type'] == 3 && scope.row[item.prop]" class="account-list-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="item.prop == 'state'">
|
<div v-else-if="item.prop == 'state'">
|
||||||
<span class="account-list-option">
|
<span class="account-list-option">
|
||||||
@@ -211,7 +214,10 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||||
</div>
|
</div>
|
||||||
|
<alert-config-box :parentAlertRule="viewRuleData" @reload="" ref="alertConfigBox"></alert-config-box>
|
||||||
|
<project-box :project="viewProjectData" ref="projectBox"></project-box>
|
||||||
|
<module-box :module="viewModuleData" @reload="" ref="moduleBox"></module-box>
|
||||||
|
<asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="" @sendStateData="" ref="assetEditUnit"></asset-edit-unit>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@@ -226,9 +232,14 @@ export default {
|
|||||||
total:13
|
total:13
|
||||||
},
|
},
|
||||||
tableTitle: [
|
tableTitle: [
|
||||||
|
{
|
||||||
|
label:'ID',
|
||||||
|
prop:'id',
|
||||||
|
show:false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: this.$t("alert.alertName"),
|
label: this.$t("alert.alertName"),
|
||||||
prop: 'alertName',
|
prop: 'alertRule',
|
||||||
show: true
|
show: true
|
||||||
}, {
|
}, {
|
||||||
label: this.$t("alert.list.type"),
|
label: this.$t("alert.list.type"),
|
||||||
@@ -303,7 +314,11 @@ export default {
|
|||||||
value: this.$t("alert.config.low")
|
value: this.$t("alert.config.low")
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
tableData: []
|
tableData: [],
|
||||||
|
viewRuleData:null,
|
||||||
|
viewProjectData:null,
|
||||||
|
viewModuleData:null,
|
||||||
|
viewAssetState:false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -343,6 +358,54 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getAlertList();
|
this.getAlertList();
|
||||||
|
},
|
||||||
|
viewRule:function(id){
|
||||||
|
this.closeViews();
|
||||||
|
this.$get('alert/rule', {"id":id}).then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
this.viewRuleData = response.data.list[0];
|
||||||
|
this.$refs.alertConfigBox.show(true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
viewAlertType:function(type,typeObj){
|
||||||
|
console.log(typeObj)
|
||||||
|
this.closeViews();
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
this.viewProjectData=typeObj;
|
||||||
|
this.$refs.projectBox.show(true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.fillProject(typeObj);
|
||||||
|
let tempObj=JSON.parse(typeObj.param)
|
||||||
|
this.$set(typeObj, 'paramObj', []);
|
||||||
|
for (let k in tempObj) {
|
||||||
|
typeObj.paramObj.push({key: k, value: tempObj[k]});
|
||||||
|
}
|
||||||
|
this.viewModuleData=typeObj;
|
||||||
|
|
||||||
|
this.$refs.moduleBox.show(true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.viewAssetState=true;
|
||||||
|
this.$refs.assetEditUnit.getAssetData(typeObj);
|
||||||
|
this.$refs.assetEditUnit.tabView=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fillProject:function(module){
|
||||||
|
this.$get('project', {"id":module.projectId}).then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
module.project = response.data.list[0];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closeViews:function(){
|
||||||
|
this.$refs.alertConfigBox.show(false,false);
|
||||||
|
this.$refs.projectBox.show(false,false);
|
||||||
|
this.$refs.moduleBox.show(false,false);
|
||||||
|
this.viewAssetState=false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
:label="item.label"
|
:label="item.label"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope" :column="item">
|
<template slot-scope="scope" :column="item">
|
||||||
<span v-if="item.prop == 'asset' && scope.row[item.prop]">{{scope.row[item.prop].host}}</span>
|
<span v-if="item.prop == 'asset' && scope.row[item.prop]" @click="viewAsset(scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span>
|
||||||
<span v-else-if="item.prop == 'param'">
|
<span v-else-if="item.prop == 'param'">
|
||||||
<span v-for="p in scope.row.paramObj">{{p.key}}={{p.value}},</span>
|
<span v-for="p in scope.row.paramObj">{{p.key}}={{p.value}},</span>
|
||||||
</span>
|
</span>
|
||||||
@@ -103,6 +103,7 @@
|
|||||||
<module-box :currentProject="currentProject" :module="editModule" @reload="getModuleList" ref="moduleBox"></module-box>
|
<module-box :currentProject="currentProject" :module="editModule" @reload="getModuleList" ref="moduleBox"></module-box>
|
||||||
<edit-endpoint-box :currentProject="currentProject" :currentModule="currentModule" :endpoint="editEndpoint" @reload="getEndpointTableData" ref="editEndpointBox"></edit-endpoint-box>
|
<edit-endpoint-box :currentProject="currentProject" :currentModule="currentModule" :endpoint="editEndpoint" @reload="getEndpointTableData" ref="editEndpointBox"></edit-endpoint-box>
|
||||||
<add-endpoint-box :currentProject="currentProject" :currentModule="currentModule" @reload="getEndpointTableData" ref="addEndpointBox"></add-endpoint-box>
|
<add-endpoint-box :currentProject="currentProject" :currentModule="currentModule" @reload="getEndpointTableData" ref="addEndpointBox"></add-endpoint-box>
|
||||||
|
<asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="" @sendStateData="" ref="assetEditUnit"></asset-edit-unit>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -211,6 +212,7 @@
|
|||||||
disabled: false
|
disabled: false
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
|
viewAssetState:false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -413,7 +415,7 @@
|
|||||||
if (!time) {
|
if (!time) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let date = new Date(time*1000);
|
let date = new Date(time * 1000);
|
||||||
let year = date.getFullYear();
|
let year = date.getFullYear();
|
||||||
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||||
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||||
@@ -422,8 +424,12 @@
|
|||||||
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||||
|
|
||||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||||
|
},
|
||||||
|
viewAsset:function(id){
|
||||||
|
this.viewAssetState=true;
|
||||||
|
this.$refs.assetEditUnit.getAssetData(id);
|
||||||
|
this.$refs.assetEditUnit.tabView=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.currentProject = this.$store.state.currentProject;
|
this.currentProject = this.$store.state.currentProject;
|
||||||
|
|||||||
Reference in New Issue
Block a user