feat: system => link,apiKey,notification 路由携带参数

This commit is contained in:
@changcode
2021-12-23 19:10:52 +08:00
parent 59d35b2ea5
commit 3e6cd3e985
8 changed files with 292 additions and 24 deletions

View File

@@ -4,6 +4,12 @@ import { fromRoute } from '@/components/common/js/constants'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default {
mixins: [routerPathParams],
props: {
showTab: {
type: String,
default: ''
}
},
data () {
return {
fromRoute: fromRoute,
@@ -81,11 +87,14 @@ 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' || this.$route.fullPath.match(/\/(\S*)\?/)[1] !== 'template') {
if (this.$route.fullPath.match(/\/(\S*)\?/)[1] !== 'snmp') {
const dataListParam = {
...this.searchLabel,
...this.searchCheckBox
}
if (this.showTab) {
dataListParam.showTab = this.showTab
}
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
this.updatePath(dataListParam, path)
}
@@ -298,21 +307,6 @@ export default {
}
},
created () {
// {
// // 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: 'number' },
// severityIds: { target: this.searchLabel, propertyName: 'severityIds', type: 'string' },
// type: { target: this.searchLabel, propertyName: 'type', type: 'number' },
// name: { target: this.searchLabel, propertyName: 'name', type: 'string' },
// typeIds: { target: this.searchCheckBox, propertyName: 'typeIds', type: 'number' },
// ping: { target: this.searchCheckBox, propertyName: 'ping', type: 'string' },
// modelIds: { target: this.searchCheckBox, propertyName: 'modelIds', type: 'number' },
// fields: { target: this.searchCheckBox, propertyName: 'fields', type: 'json' }
// }
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
let searchKeys = {}
if (path === 'dc') {
@@ -675,6 +669,54 @@ export default {
jsonKey: 'val'
}
}
} else if (path === 'template' && this.$route.query.showTab) {
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'
},
gname: {
target: this.searchLabel,
propertyName: 'gname',
type: 'string',
defaultJson: {
disabled: false,
label: 'gname',
name: 'Group',
type: 'input',
val: ''
},
jsonKey: 'val'
}
}
}
this.initQueryFromPath(searchKeys)
},

View File

@@ -340,13 +340,13 @@
</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'"></notify-method>
<notify-method v-if="activeTab === 'notification'" :active-tab="activeTab"></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'"></link-tab>
<link-tab v-if="activeTab === 'link'" :active-tab="activeTab"></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'"></api-key-tab>
<api-key-tab v-if="activeTab === 'apiKey'" :active-tab="activeTab"></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'">
@@ -385,9 +385,11 @@ import linkTab from './system/linkTab'
import apiKeyTab from './system/apiKeyTab'
import moment from 'moment-timezone'
import License from './system/license'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default {
name: 'system',
components: { draggable, latlngPicker, notifyMethod, linkTab, apiKeyTab, License },
mixins: [routerPathParams],
data () {
return {
imageFormatErr: false,
@@ -612,6 +614,10 @@ export default {
console.error('type is required')
return
}
if (type !== 'link' && type !== 'notification' && type !== 'apiKey') {
const t = +new Date()
this.updatePath({ t })
}
if (type == 'reset' || type == 'link' || type == 'notification' || type == 'apiKey' || type == 'license') {
return
}
@@ -1041,6 +1047,9 @@ export default {
mounted () {
this.querySetInfo(this.activeTab)
this.queryTimezone()
},
created () {
this.activeTab = this.$route.query.activeTab || 'basic'
}
}
</script>

View File

@@ -48,6 +48,9 @@ export default {
name: 'apiKeyTab',
components: { nzDataList, apiKeyTable },
mixins: [dataListMixin, parentTableCommon],
props: {
activeTab: String
},
data () {
return {
url: '/sys/apiKey',

View File

@@ -48,6 +48,9 @@ export default {
name: 'linkTab',
components: { nzDataList, linkTable },
mixins: [dataListMixin, parentTableCommon],
props: {
activeTab: String
},
data () {
return {
url: '/link',

View File

@@ -85,6 +85,9 @@ export default {
name: 'notifyMethodTab',
components: { nzDataList, notifyMethodTable },
mixins: [dataListMixin, parentTableCommon],
props: {
activeTab: String
},
data () {
return {
url: 'alert/notify/method',

View File

@@ -1,4 +1,5 @@
import { file } from '@topology/core/src/middles/nodes/file'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export const tableCommon = {
data () {
@@ -93,10 +94,25 @@ export const tableCommon = {
}
}
export const parentTableCommon = {
mixins: [routerPathParams],
props: {
activeTab: {
type: String,
default: ''
}
},
methods: {
getTableData: function () {
this.searchLabel.pageSize = -1
this.tools.loading = true
const systemParam = {
...this.searchLabel
}
if (this.activeTab) {
systemParam.activeTab = this.activeTab
}
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
this.updatePath(systemParam, path)
this.$get(this.url, this.searchLabel).then(response => {
this.tools.loading = false
if (response.code === 200) {
@@ -111,5 +127,128 @@ export const parentTableCommon = {
}
})
}
},
created () {
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
let searchKeys = {}
if (path === 'system' && this.$route.query.activeTab == 'link') {
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'
}
}
} else if (path === 'system' && this.$route.query.activeTab == 'apiKey') {
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'
}
}
} else if (path === 'system' && this.$route.query.activeTab == 'notification') {
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

@@ -95,7 +95,6 @@
</template>
<script>
import bus from '@/libs/bus'
import exportXLSX from '@/components/common/exportXLSX'
import chartBox from '@/components/page/dashboard/chartBox'
import deleteButton from '@/components/common/deleteButton'
@@ -218,6 +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.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox, panelId: 0, returnChildren: 0, groupId: 0 }).then(response => {
this.tools.loading = false
if (response.code === 200) {
@@ -256,6 +256,72 @@ export default {
},
panelReload () {},
panelReloadOnlyPanel () {}
},
created () {
const 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,
id: 'ids',
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: 'chartType',
name: 'Type',
readonly: true,
type: 'selectString',
val: ''
},
jsonKey: 'val'
},
state: {
target: this.searchLabel,
propertyName: 'state',
type: 'string',
defaultJson: {
disabled: false,
label: 'varType',
name: 'Variable type',
readonly: true,
type: 'select',
val: ''
},
jsonKey: 'val'
}
}
this.initQueryFromPath(searchKeys)
}
}
</script>

View File

@@ -8,15 +8,17 @@
<script>
import exprTemp from './exprTemp'
import chartTemp from './chartTemp'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default {
name: 'v-template',
components: {
exprTemp,
chartTemp
},
mixins: [routerPathParams],
data () {
return {
showTab: ''
showTab: 'exprTemp'
}
},
methods: {
@@ -43,12 +45,13 @@ export default {
},
changeShowTab (showTab) {
this.showTab = showTab
this.updatePath({ showTab })
}
},
created () {
this.showTab = this.$route.query.showTab || 'exprTemp'
},
mounted () {
this.$nextTick(() => {
this.showTab = 'exprTemp'
})
}
}
</script>