NEZ-3242 fix:software type 查看二级页面显示错误

This commit is contained in:
zhangyu
2023-10-18 17:55:32 +08:00
parent 65e978de93
commit f8bf60f42b
4 changed files with 248 additions and 5 deletions

View File

@@ -84,8 +84,8 @@
<notebook-tab @getTableData="getTableData" v-if="from === fromRoute.notebook && targetTab === 'notebookTab'" :from="from" :obj="obj" :tabs="tabs.notebook" @changeTab="changeTab" :targetTab.sync="targetTab"></notebook-tab>
<!--softwareAsset列表的tab-->
<endpointTabNew v-if="from === fromRoute.softwareAsset && targetTab === 'endpoint'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.softwareAsset.softwareAssetTabTitle" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew>
<!--model 下滑-->
<asset-tab v-if="(from === fromRoute.softwareType) && targetTab === 'asset'" :tabs="tabs.softwareType" ref="assetTab" :from="from" :obj="obj" @changeTab="changeTab" @exit="closeSubList" :targetTab.sync="targetTab"></asset-tab>
<!--softwareType 下滑-->
<softwareAsset v-if="(from === fromRoute.softwareType) && targetTab === 'softwareAsset'" :tabs="tabs.softwareType" ref="assetTab" :from="from" :obj="obj" @changeTab="changeTab" @exit="closeSubList" :targetTab.sync="targetTab"></softwareAsset>
</div>
</div>
</div>
@@ -124,6 +124,7 @@ import discoveryTab from '@/components/common/bottomBox/tabs/discoveryTab'
import IpDetails from '@/components/common/bottomBox/tabs/IpDetails'
import recordRuleEvalLog from '@/components/common/bottomBox/tabs/recordRuleEvalLog'
import notebookTab from '@/components/common/bottomBox/tabs/notebookTab'
import softwareAsset from '@/components/common/bottomBox/tabs/softwareAsset'
export default {
name: 'bottomBox',
@@ -158,7 +159,8 @@ export default {
commentsBottomTab,
vsysBottomTab,
rolesTab,
notebookTab
notebookTab,
softwareAsset
},
props: {
isFullScreen: Boolean, // 是否全屏
@@ -278,7 +280,7 @@ export default {
{ prop: 'asset', name: this.$t('asset.asset'), active: true }
],
softwareType: [
{ prop: 'asset', name: this.$t('asset.asset'), active: true }
{ prop: 'softwareAsset', name: this.$t('softwareAsset.text'), active: true }
],
dc: {
cabinet: [

View File

@@ -0,0 +1,217 @@
<template>
<nz-bottom-data-list
:showTitle='showTitle'
:obj='obj'
:targetTab.sync="targetTab"
:api="url"
style="height: 100%"
:custom-table-title.sync="tools.customTableTitle"
:layout="['searchInput', 'elementSet']"
:search-msg="searchMsg"
:tableId="tableId"
:tabs="tabs"
@search="search"
@changeTab="changeTab"
>
<template v-slot:title><span :title="obj.name">{{obj.name}}</span></template>
<template v-slot>
<softwareAssetTable
ref="dataTable"
:orderByFa="orderBy"
v-my-loading="tools.loading"
:loading="tools.loading"
:api="url"
:custom-table-title="tools.customTableTitle"
:height="mainTableHeight"
:table-data="tableData"
@del="del"
@edit="edit"
@copy="copy"
@orderBy="tableDataSort"
@reload="getTableData"
@selectionChange="selectionChange"
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></softwareAssetTable>
</template>
<template v-slot:pagination>
<Pagination ref="Pagination" :pageObj="pageObj" :tableId="tableId" @pageNo='pageNo' @pageSize='pageSize'></Pagination>
</template>
</nz-bottom-data-list>
</template>
<script>
import dataListMixin from '@/components/common/mixin/dataList'
import subDataListMixin from '@/components/common/mixin/subDataList'
import nzBottomDataList from '@/components/common/bottomBox/nzBottomDataList'
import { fromRoute } from '@/components/common/js/constants'
import detailViewRightMixin from '@/components/common/mixin/detailViewRightMixin'
import softwareAssetTable from '@/components/common/table/settings/softwareAssetTable'
export default {
name: 'softwareAssetTab',
mixins: [dataListMixin, subDataListMixin, detailViewRightMixin],
components: {
nzBottomDataList,
softwareAssetTable
},
computed: {
externalTerminal () {
return this.$store.getters.getExternalTerminal
}
},
data () {
return {
url: '/asset/software',
blankObject: { // 空白对象
id: '',
name: '',
typeId: '',
assetId: '',
projectId: '',
params: {},
remark: ''
},
tableId: 'softwareAssetTable',
searchMsg: { // 给搜索框子组件传递的信息
searchLabelList: [{
name: 'ID',
type: 'input',
label: 'ids',
disabled: false
}, {
name: this.$t('overall.name'),
type: 'input',
label: 'name',
disabled: false
}]
},
blankSilenceObject: {
startAt: ''
},
objectSilence: {},
silenceBoxShow: false,
searchLabel: { dcIds: this.obj.id },
brandData: [],
modelData: [],
stateData: [],
typeData: [],
dcData: [],
snmpCredentialData: [],
fieldGroupData: [],
needAlertDaysData: true,
trendKey: 'assetId',
fromBottom: true
}
},
methods: {
getTableData (params) {
if (params && Object.keys(params).length > 0) {
for (const key in params) {
this.$set(this.searchLabel, key, params[key])
}
}
if (this.orderBy) {
this.$set(this.searchLabel, 'orderBy', this.orderBy)
} else {
delete this.searchLabel.orderBy
}
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true
const dataListParam = {
...this.searchLabel,
...this.searchCheckBox
}
if (this.switchTab) {
dataListParam.switchTab = this.switchTab
}
let path = this.$route.fullPath.match(/\/(\S*)\?/)
if (!path) {
path = ''
} else {
path = path[1]
}
this.updatePath(dataListParam, path)
this.$set(this.searchLabel, 'typeIds', this.obj.id)
this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false
if (response.code === 200) {
for (let i = 0; i < response.data.list.length; i++) {
response.data.list[i].status = response.data.list[i].status + ''
}
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
values: [[0, 0]]
},
{
metric: { priority: 'P2' },
values: [[0, 0]]
},
{
metric: { priority: 'P3' },
values: [[0, 0]]
}
]
})
}
this.tableData = response.data.list
const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = ''
if (this.tableId === 'notebookTable' && this.detailType === 'view') { // 防止详情视图编辑后切换到别的数据
const obj = this.tableData.find(item => item.id === this.detailViewRightObj.id)
if (obj) {
detailViewRightObj = obj
} else {
detailViewRightObj = this.tableData[0]
}
} else {
if (globalSearchId) {
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
} else {
detailViewRightObj = this.tableData[0]
}
}
this.detailViewRightObj = this.$lodash.cloneDeep(detailViewRightObj)
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)
})
}
if (this.detailType === 'view') {
this.$refs.dataDetail && (this.$refs.dataDetail.$refs.dataTable.scrollTop = 0)
}
} else {
this.$message.error(response.error || response.msg)
}
})
},
},
watch: {
obj: {
immediate: true,
deep: true,
async handler (n, o) {
this.searchLabel = {}
await this.getPreference()
this.$set(this.searchLabel, 'typeIds', this.obj.id)
this.getTableData()
}
}
},
mounted () {
}
}
</script>
<style scoped>
</style>

View File

@@ -146,6 +146,30 @@ export default {
{
value: 'logout',
label: i18n.t('overall.signOut')
},
{
value: 'cancel',
label: i18n.t('operationlog.cancel')
},
{
value: 'upload',
label: i18n.t('overall.upload')
},
{
value: 'download',
label: i18n.t('overall.download')
},
{
value: 'createTask',
label: i18n.t('operationlog.createTask')
},
{
value: 'sync',
label: i18n.t('operationlog.sync')
},
{
value: 'diagnosis',
label: i18n.t('overall.diagnosis')
}
],
alertMessageState: [

View File

@@ -76,7 +76,7 @@
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
<div slot-scope="scope" class="table-operation-items">
<!-- <button class="table-operation-item" v-has="'model_edit'" @click="$emit('edit', scope.row)" :title="$t('overall.edit')"><i class="nz-icon nz-icon-edit"></i></button> -->
<button class="table-operation-item" @click="showBottomBox('asset', scope.row)" :title="$t('overall.view')"><i class="nz-icon nz-icon-view1"></i></button>
<button class="table-operation-item" @click="showBottomBox('softwareAsset', scope.row)" :title="$t('overall.view')"><i class="nz-icon nz-icon-view1"></i></button>
<el-dropdown size="medium" v-has="['model_delete','main_edit','model_edit']" trigger="click" @command="tableOperation">
<div class="table-operation-item table-operation-item--more" :title="$t('overall.moreOperations')">
<i class="nz-icon nz-icon-more3"></i>