feat: 增加 snmp => credential , mib file

This commit is contained in:
@changcode
2021-12-23 20:24:18 +08:00
parent df7cdd72f4
commit e5f8c42dff
13 changed files with 157 additions and 60 deletions

View File

@@ -5,7 +5,7 @@ import routerPathParams from '@/components/common/mixin/routerPathParams'
export default {
mixins: [routerPathParams],
props: {
showTab: {
switchTab: {
type: String,
default: ''
}
@@ -87,17 +87,15 @@ export default {
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true
if (this.$route.fullPath.match(/\/(\S*)\?/)[1] !== 'snmp') {
const dataListParam = {
...this.searchLabel,
...this.searchCheckBox
}
if (this.showTab) {
dataListParam.showTab = this.showTab
if (this.switchTab) {
dataListParam.switchTab = this.switchTab
}
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
this.updatePath(dataListParam, path)
}
this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false
if (response.code === 200) {
@@ -669,7 +667,7 @@ export default {
jsonKey: 'val'
}
}
} else if (path === 'template' && this.$route.query.showTab) {
} else if (path === 'template' && this.switchTab) {
searchKeys = {
// key: path 键
// value: vue set 参数
@@ -717,6 +715,90 @@ export default {
jsonKey: 'val'
}
}
} else if (path === 'snmp' && this.switchTab == 'credentials') {
searchKeys = {
// key: path 键
// value: vue set 参数
pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' },
pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' },
orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' },
ids: {
target: this.searchLabel,
propertyName: 'ids',
type: 'string',
defaultJson: {
disabled: false,
label: 'ids',
name: 'ID',
type: 'input',
val: ''
},
jsonKey: 'val'
},
name: {
target: this.searchLabel,
propertyName: 'name',
type: 'string',
defaultJson: {
disabled: false,
id: 'name',
label: 'name',
name: 'Name',
type: 'input',
val: ''
},
jsonKey: 'val'
},
type: {
target: this.searchLabel,
propertyName: 'type',
type: 'string',
defaultJson: {
disabled: false,
label: 'credentialType',
name: 'Type',
readonly: true,
type: 'select',
val: ''
},
jsonKey: 'val'
}
}
} else if (path === 'snmp' && this.switchTab == 'file') {
searchKeys = {
// key: path 键
// value: vue set 参数
pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' },
pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' },
orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' },
ids: {
target: this.searchLabel,
propertyName: 'ids',
type: 'string',
defaultJson: {
disabled: false,
label: 'ids',
name: 'ID',
type: 'input',
val: ''
},
jsonKey: 'val'
},
name: {
target: this.searchLabel,
propertyName: 'name',
type: 'string',
defaultJson: {
disabled: false,
id: 'name',
label: 'name',
name: 'Name',
type: 'input',
val: ''
},
jsonKey: 'val'
}
}
}
this.initQueryFromPath(searchKeys)
},

View File

@@ -374,7 +374,7 @@ export default {
valString: '',
listStr: 'severitySelect'
},
jsonKey: 'valnum',
jsonKey: 'valnum'
},
type: {
target: this.searchLabel,
@@ -392,7 +392,7 @@ export default {
valnum: '',
valString: ''
},
jsonKey: 'valnum',
jsonKey: 'valnum'
},
name: {
target: this.searchLabel,

View File

@@ -1,7 +1,7 @@
<template>
<div style="height: 100%">
<nz-data-list
v-show="showTab === 'credentials'"
v-show="switchTab === 'credentials'"
ref="dataList"
:api="url"
:custom-table-title.sync="tools.customTableTitle"
@@ -11,13 +11,13 @@
@search="search"
>
<template v-slot:top-tool-left>
<div id="module-type-7" class="nz-tab-item-box" @click="toBrowserTab"><!--v-has="'snmp_browser_view'"-->
<div id="module-type-7" class="nz-tab-item-box" @click="clickTab(['mib','browser'],'browser')"><!--v-has="'snmp_browser_view'"-->
<div class="nz-tab-item">{{$t("config.mib.mibBrowser")}}</div>
</div>
<div id="module-type-8" class="nz-tab-item-box" >
<div id="module-type-8" class="nz-tab-item-box">
<div class="nz-tab-item nz-tab-item-active">{{$t("config.mib.credentials")}}</div>
</div>
<div id="module-type-6" class="nz-tab-item-box" @click="toFileTab">
<div id="module-type-6" class="nz-tab-item-box" @click="clickTab(['mib','file'],'file')">
<div class="nz-tab-item ">{{$t("config.mib.mibFiles")}}</div>
</div>
</template>
@@ -64,7 +64,7 @@ import snmpCredentialBox from '../../common/rightBox/snmpCredentialBox'
export default {
name: 'credentials',
props: {
showTab: String
switchTab: String
},
components: {
deleteButton,
@@ -115,6 +115,9 @@ export default {
toBrowserTab () {
this.$emit('toBrowserTab')
},
toCredentialTab () {
this.$emit('toCredentialTab')
},
closeSnmpBox (refresh) {
this.rightBox.show = false
if (refresh) {

View File

@@ -1,7 +1,7 @@
<template>
<div style="height: 100%">
<nz-data-list
v-if="showTab === 'file'"
v-if="switchTab === 'file'"
ref="dataList"
:api="url"
:custom-table-title.sync="tools.customTableTitle"
@@ -70,7 +70,7 @@ export default {
},
mixins: [dataListMixin],
props: {
showTab: String
switchTab: String
},
data () {
return {

View File

@@ -1,7 +1,7 @@
<template>
<div class="mib-browser" style="height: 100%">
<nz-data-list
v-if="showTab === 'browser'"
v-if="switchTab === 'browser'"
ref="dataList"
>
<template v-slot:top-tool-left>
@@ -171,7 +171,7 @@ import xlsx from 'xlsx'
export default {
name: 'mibBrowser',
props: {
showTab: String
switchTab: String
},
components: {
nzDataList

View File

@@ -1,8 +1,8 @@
<template>
<div>
<mib-file v-if="showTab === 'file'" :show-tab="showTab" @changeShowTab="changeShowTab" @toBrowserTab="changeTab(['mib','browser'],'browser')" @toCredentialTab="changeTab(['mib','credentials'],'credentials')"></mib-file>
<mib-browser v-if="showTab === 'browser'" :show-tab="showTab" @changeShowTab="changeShowTab" @toCredentialTab="changeTab(['mib','credentials'],'credentials')" @toFileTab="changeTab(['mib','file'],'file')"></mib-browser>
<credentials v-if="showTab === 'credentials'" :show-tab="showTab" @changeShowTab="changeShowTab" @toBrowserTab="changeTab(['mib','browser'],'browser')" @toFileTab="changeTab(['mib','file'],'file')"></credentials>
<mib-file v-if="switchTab === 'file'" :switch-tab="switchTab" @changeShowTab="changeShowTab" @toBrowserTab="changeTab(['mib','browser'],'browser')" @toCredentialTab="changeTab(['mib','credentials'],'credentials')"></mib-file>
<mib-browser v-if="switchTab === 'browser'" :switch-tab="switchTab" @changeShowTab="changeShowTab" @toCredentialTab="changeTab(['mib','credentials'],'credentials')" @toFileTab="changeTab(['mib','file'],'file')"></mib-browser>
<credentials v-if="switchTab === 'credentials'" :switch-tab="switchTab" @changeShowTab="changeShowTab" @toBrowserTab="changeTab(['mib','browser'],'browser')" @toFileTab="changeTab(['mib','file'],'file')"></credentials>
</div>
</template>
@@ -10,6 +10,7 @@
import mibBrowser from './mibBrowser'
import credentials from './credentials'
import mibFile from './mib'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default {
name: 'snmp',
components: {
@@ -17,9 +18,10 @@ export default {
mibBrowser,
mibFile
},
mixins: [routerPathParams],
data () {
return {
showTab: 'browser'
switchTab: 'browser'
}
},
methods: {
@@ -33,7 +35,7 @@ export default {
} else {
path = paths
} */
this.showTab = tab // 此处需要组建中有showTab 属性
this.switchTab = tab // 此处需要组建中有showTab 属性
// this.toPath(path)
},
toPath: function (path) {
@@ -44,8 +46,14 @@ export default {
}
})
},
changeShowTab (showTab) {
this.showTab = showTab
changeShowTab (switchTab) {
this.switchTab = switchTab
if (switchTab !== 'browser') {
this.updatePath({ switchTab })
} else {
const t = +new Date()
this.updatePath({ t })
}
}
},
watch: {
@@ -53,10 +61,13 @@ export default {
immediate: true,
handler (n, o) {
if (n.indexOf('mib') != -1 && this.$route.params.tab) {
this.$set(this, 'showTab', this.$route.params.tab)
this.$set(this, 'switchTab', this.$route.params.tab)
}
}
}
},
created () {
this.switchTab = this.$route.query.switchTab || 'browser'
}
}
</script>

View File

@@ -1,8 +1,8 @@
<template>
<div class="system">
<el-tabs v-model="activeTab" :class="{'full-table':activeTab == 'notification'||activeTab == 'link'||activeTab === 'apiKey'}" class="system-tabs" style="overflow: auto" type="border-card" @tab-click="selectTab">
<el-tabs v-model="switchTab" :class="{'full-table':switchTab == 'notification'||switchTab == 'link'||switchTab === 'apiKey'}" class="system-tabs" style="overflow: auto" type="border-card" @tab-click="selectTab">
<el-tab-pane :label="$t('config.system.basic.basic')" name="basic">
<div class="system-config-form basicForm" v-if="activeTab === 'basic'">
<div class="system-config-form basicForm" v-if="switchTab === 'basic'">
<el-form :model="basic" label-width="180px" size="small" ref="basicForm" :rules="basicRules" :validate-on-rule-change="false">
<div class="system-title">{{$t('config.system.basic.title')}}</div>
<el-form-item :label="$t('config.system.basic.language')" prop="language">
@@ -112,7 +112,7 @@
</div >
</el-tab-pane>
<el-tab-pane :label="$t('config.system.monitor.monitor')" name="monitor">
<div class="system-config-form basicForm" v-if="activeTab === 'monitor'">
<div class="system-config-form basicForm" v-if="switchTab === 'monitor'">
<div class="system-title">{{$t('config.system.basic.title')}}</div>
<el-form :model="monitor" label-width="180px" size="small" ref="monitorForm" :rules="monitorRules" :validate-on-rule-change="false">
<el-form-item :label="$t('config.system.monitor.prometheusFederation')" prop="prometheus_federation_enabled">
@@ -224,7 +224,7 @@
</div>
</el-tab-pane>
<el-tab-pane :label="$t('config.system.email.email')" name="email" >
<div class="system-config-form" v-if="activeTab === 'email'">
<div class="system-config-form" v-if="switchTab === 'email'">
<div class="system-title">{{$t('config.system.basic.title')}}</div>
<el-form :model="email" label-width="180px" size="small" ref="emailForm" :rules="email.email_enable=='on'?emailRules:{}" :validate-on-rule-change="false">
<el-form-item :label="$t('config.system.email.enable')" prop="email_enable">
@@ -272,7 +272,7 @@
</div>
</el-tab-pane>
<el-tab-pane :label="$t('config.system.terminal.terminal')" name="terminal">
<div class="system-config-form terminal" v-if="activeTab === 'terminal'">
<div class="system-config-form terminal" v-if="switchTab === 'terminal'">
<div class="system-title">{{$t('config.system.basic.title')}}</div>
<el-form :model="terminal" label-width="180px" size="small" ref="terminalForm" :rules="terminalRules">
<!-- <el-form-item :label="$t('config.system.terminal.timeout')" prop="terminal_timeout">-->
@@ -298,7 +298,7 @@
</div>
</el-tab-pane>
<el-tab-pane :label="$t('config.system.ldap.ldap')" name="ldap">
<div class="system-config-form" v-if="activeTab === 'ldap'">
<div class="system-config-form" v-if="switchTab === 'ldap'">
<div class="system-title">{{$t('config.system.basic.title')}}</div>
<el-form :model="ldap" label-width="180px" size="small" ref="ldapForm" :rules="ldap.ldap_enable == 'on'?ldapRules:{}" :validate-on-rule-change="false">
<el-form-item :label="$t('config.system.ldap.active')" prop="ldap_enable">
@@ -340,16 +340,16 @@
</div>
</el-tab-pane>
<el-tab-pane :label="$t('config.system.notification.notification')" name="notification" style="height: 100%;"><!--$t('config.system.reset.reset')-->
<notify-method v-if="activeTab === 'notification'" :active-tab="activeTab"></notify-method>
<notify-method v-if="switchTab === 'notification'" :switch-tab="switchTab"></notify-method>
</el-tab-pane>
<el-tab-pane :label="$t('config.system.link.link')" name="link" style="height: 100%;"><!--$t('config.system.reset.reset')-->
<link-tab v-if="activeTab === 'link'" :active-tab="activeTab"></link-tab>
<link-tab v-if="switchTab === 'link'" :switch-tab="switchTab"></link-tab>
</el-tab-pane>
<el-tab-pane :label="$t('config.system.apiKey.apiKey')" name="apiKey" style="height: 100%;"><!--$t('config.system.reset.reset')-->
<api-key-tab v-if="activeTab === 'apiKey'" :active-tab="activeTab"></api-key-tab>
<api-key-tab v-if="switchTab === 'apiKey'" :switch-tab="switchTab"></api-key-tab>
</el-tab-pane>
<el-tab-pane :label="$t('config.system.reset.reset')" name="reset">
<div class="system-config-form" v-if="activeTab === 'reset'">
<div class="system-config-form" v-if="switchTab === 'reset'">
<div class="system-title">{{$t('config.system.basic.title')}}</div>
<el-form :model="reset" label-width="180px" size="small" ref="resetForm" :rules="resetRules" :validate-on-rule-change="false" class="reset-form">
<el-form-item prop="type" :label="$t('config.system.reset.type')">
@@ -369,7 +369,7 @@
</div>
</el-tab-pane>
<el-tab-pane :label="$t('config.system.license.license')" name="license">
<license v-if="activeTab === 'license'"></license>
<license v-if="switchTab === 'license'"></license>
</el-tab-pane>
</el-tabs>
</div>
@@ -575,7 +575,7 @@ export default {
value: 'sysconfig'
}
],
activeTab: 'basic',
switchTab: 'basic',
languageList: [
{ value: 'en', label: 'English' },
{ value: 'zh', label: '简体中文' }
@@ -1045,11 +1045,11 @@ export default {
}
},
mounted () {
this.querySetInfo(this.activeTab)
this.querySetInfo(this.switchTab)
this.queryTimezone()
},
created () {
this.activeTab = this.$route.query.activeTab || 'basic'
this.switchTab = this.$route.query.switchTab || 'basic'
}
}
</script>

View File

@@ -49,7 +49,7 @@ export default {
components: { nzDataList, apiKeyTable },
mixins: [dataListMixin, parentTableCommon],
props: {
activeTab: String
switchTab: String
},
data () {
return {

View File

@@ -49,7 +49,7 @@ export default {
components: { nzDataList, linkTable },
mixins: [dataListMixin, parentTableCommon],
props: {
activeTab: String
switchTab: String
},
data () {
return {

View File

@@ -86,7 +86,7 @@ export default {
components: { nzDataList, notifyMethodTable },
mixins: [dataListMixin, parentTableCommon],
props: {
activeTab: String
switchTab: String
},
data () {
return {

View File

@@ -96,7 +96,7 @@ export const tableCommon = {
export const parentTableCommon = {
mixins: [routerPathParams],
props: {
activeTab: {
switchTab: {
type: String,
default: ''
}
@@ -108,8 +108,8 @@ export const parentTableCommon = {
const systemParam = {
...this.searchLabel
}
if (this.activeTab) {
systemParam.activeTab = this.activeTab
if (this.switchTab) {
systemParam.switchTab = this.switchTab
}
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
this.updatePath(systemParam, path)

View File

@@ -217,7 +217,7 @@ export default {
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true
this.updatePath({ ...this.searchLabel, ...this.searchCheckBox, showTab: this.showTab })
this.updatePath({ ...this.searchLabel, ...this.searchCheckBox, switchTab: this.switchTab })
this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox, panelId: 0, returnChildren: 0, groupId: 0 }).then(response => {
this.tools.loading = false
if (response.code === 200) {

View File

@@ -1,7 +1,7 @@
<template>
<div class="temp">
<exprTemp class="template-tab" :show-tab="showTab" v-if="showTab == 'exprTemp'" @changeShowTab="changeShowTab"></exprTemp>
<chartTemp class="template-tab" :show-tab="showTab" v-if="showTab == 'chartTemp'" @changeShowTab="changeShowTab"></chartTemp>
<exprTemp class="template-tab" :switch-tab="switchTab" v-if="switchTab == 'exprTemp'" @changeShowTab="changeShowTab"></exprTemp>
<chartTemp class="template-tab" :switch-tab="switchTab" v-if="switchTab == 'chartTemp'" @changeShowTab="changeShowTab"></chartTemp>
</div>
</template>
@@ -18,7 +18,7 @@ export default {
mixins: [routerPathParams],
data () {
return {
showTab: 'exprTemp'
switchTab: 'exprTemp'
}
},
methods: {
@@ -32,7 +32,7 @@ export default {
} else {
path = paths
}
this.showTab = tab // 此处需要组建中有showTab 属性
this.switchTab = tab // 此处需要组建中有showTab 属性
this.toPath(path)
},
toPath: function (path) {
@@ -43,13 +43,14 @@ export default {
}
})
},
changeShowTab (showTab) {
this.showTab = showTab
this.updatePath({ showTab })
changeShowTab (switchTab) {
this.switchTab = switchTab
this.updatePath({ switchTab })
}
},
created () {
this.showTab = this.$route.query.showTab || 'exprTemp'
console.log(this.$route.query)
this.switchTab = this.$route.query.switchTab || 'exprTemp'
},
mounted () {
}