fix: 切换详细视图时 未默认选中第一条的问题
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.type === 'dropdownCheckBox'&& key !== 'assetLabel'">
|
<span v-else-if="item.type === 'dropdownCheckBox'&& key !== 'assetLabel' && key !== 'state'">
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
:placement="'bottom-start'"
|
:placement="'bottom-start'"
|
||||||
class="detail-dropdown"
|
class="detail-dropdown"
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.type === 'dropdownCheckBox'&& key === 'assetLabel'">
|
<span v-else-if="item.type === 'dropdownCheckBox'&& (key === 'assetLabel' || key === 'state')">
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
:placement="'bottom-start'"
|
:placement="'bottom-start'"
|
||||||
class="detail-dropdown"
|
class="detail-dropdown"
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
<el-checkbox-group v-model="selectValue[item.key]">
|
<el-checkbox-group v-model="selectValue[item.key]">
|
||||||
<el-dropdown-item v-for="(item3,index3) in item.children" :key="index3" >
|
<el-dropdown-item v-for="(item3,index3) in item.children" :key="index3" >
|
||||||
<span :title="item3.name" class="children-title-name"> {{item3.name}}</span>
|
<span :title="item3.name" class="children-title-name"> {{item3.name}}</span>
|
||||||
<el-checkbox :label="item3.id+'-'+item4.id" :key="index4" v-for="(item4,index4) in item3.children" :title="item4.name">{{item4.name}}</el-checkbox>
|
<el-checkbox :label="item3.id+'-'+item4.id" :key="index4" v-for="(item4,index4) in item3.children" :title="item4.name" :a="item3.id+'-'+item4.id">{{item4.name}}</el-checkbox>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$refs.dataList.bottomBox.showSubList = false
|
this.$refs.dataList.bottomBox.showSubList = false
|
||||||
|
if (this.orderBy) {
|
||||||
this.detailViewRightObj = ''
|
this.detailViewRightObj = ''
|
||||||
|
}
|
||||||
this.detailType = flag
|
this.detailType = flag
|
||||||
let dataList = ''
|
let dataList = ''
|
||||||
localStorage.setItem('detail-view-' + this.tableId, this.detailType)
|
localStorage.setItem('detail-view-' + this.tableId, this.detailType)
|
||||||
@@ -25,11 +27,15 @@ export default {
|
|||||||
dataList = 'detailList'
|
dataList = 'detailList'
|
||||||
if (this.from === this.fromRoute.asset) {
|
if (this.from === this.fromRoute.asset) {
|
||||||
this.setAsset(true)
|
this.setAsset(true)
|
||||||
|
} else if (this.from === this.fromRoute.endpoint) {
|
||||||
|
this.setEndpoint(true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dataList = 'dataList'
|
dataList = 'dataList'
|
||||||
if (this.from === this.fromRoute.asset) {
|
if (this.from === this.fromRoute.asset) {
|
||||||
this.setAsset(false)
|
this.setAsset(false)
|
||||||
|
} else if (this.from === this.fromRoute.endpoint) {
|
||||||
|
this.setEndpoint(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -109,6 +115,33 @@ export default {
|
|||||||
this.selectValue.fields = ''
|
this.selectValue.fields = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setEndpoint (flag) {
|
||||||
|
if (flag) {
|
||||||
|
this.selectValue.stateDetail = []
|
||||||
|
if (this.selectValue.state) {
|
||||||
|
const obj = JSON.parse(this.selectValue.state)
|
||||||
|
Object.keys(obj).forEach(key => {
|
||||||
|
obj[key].forEach(item => {
|
||||||
|
this.selectValue.stateDetail.push(key + '-' + item)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const obj = {}
|
||||||
|
this.selectValue.stateDetail.forEach(item => {
|
||||||
|
const arr = item.split('-')
|
||||||
|
if (obj[arr[0]]) {
|
||||||
|
obj[arr[0]].push(arr[1])
|
||||||
|
} else {
|
||||||
|
obj[arr[0]] = [arr[1]]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.selectValue.state = JSON.stringify(obj)
|
||||||
|
if (this.selectValue.state === '{}') {
|
||||||
|
this.selectValue.state = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:search>
|
<template v-slot:search>
|
||||||
<click-search :select-value.sync="selectValue" :title-search-list="titleSearchList" @reload="reloadTable"></click-search>
|
<click-search ref="clickSearch" :select-value.sync="selectValue" :title-search-list="titleSearchList" @reload="reloadTable"></click-search>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:default="slotProps">
|
<template v-slot:default="slotProps">
|
||||||
<endpoint-table
|
<endpoint-table
|
||||||
@@ -413,7 +413,7 @@ export default {
|
|||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
label: 'State',
|
label: 'State',
|
||||||
key: 'state',
|
key: 'stateDetail',
|
||||||
type: 'dropdownCheckBox',
|
type: 'dropdownCheckBox',
|
||||||
children: [],
|
children: [],
|
||||||
show: false,
|
show: false,
|
||||||
@@ -436,6 +436,7 @@ export default {
|
|||||||
projectIds: [],
|
projectIds: [],
|
||||||
moduleIds: [],
|
moduleIds: [],
|
||||||
state: '',
|
state: '',
|
||||||
|
stateDetail: [],
|
||||||
type: []
|
type: []
|
||||||
},
|
},
|
||||||
searchCheckBox: {},
|
searchCheckBox: {},
|
||||||
@@ -610,9 +611,25 @@ export default {
|
|||||||
const params = JSON.parse(JSON.stringify(obj))
|
const params = JSON.parse(JSON.stringify(obj))
|
||||||
delete this.searchCheckBox.metricsStates
|
delete this.searchCheckBox.metricsStates
|
||||||
delete this.searchCheckBox.logsStates
|
delete this.searchCheckBox.logsStates
|
||||||
|
if (this.detailType === 'view') {
|
||||||
|
const obj = {}
|
||||||
|
params.stateDetail.forEach(item => {
|
||||||
|
const arr = item.split('-')
|
||||||
|
if (obj[arr[0]]) {
|
||||||
|
obj[arr[0]].push(arr[1])
|
||||||
|
} else {
|
||||||
|
obj[arr[0]] = [arr[1]]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
params.state = JSON.stringify(obj)
|
||||||
|
if (params.state === '{}') {
|
||||||
|
params.state = ''
|
||||||
|
}
|
||||||
|
delete params.stateDetail
|
||||||
|
}
|
||||||
Object.keys(params).forEach(key => {
|
Object.keys(params).forEach(key => {
|
||||||
if (typeof params[key] === 'string') {
|
if (typeof params[key] === 'string') {
|
||||||
if (key === 'state') {
|
if (key === 'state' && params[key]) {
|
||||||
const state = JSON.parse(params[key])
|
const state = JSON.parse(params[key])
|
||||||
if (state.metrics) {
|
if (state.metrics) {
|
||||||
this.searchCheckBox.metricsStates = state.metrics.join(',')
|
this.searchCheckBox.metricsStates = state.metrics.join(',')
|
||||||
@@ -649,11 +666,19 @@ export default {
|
|||||||
this.modelData.forEach(m => {
|
this.modelData.forEach(m => {
|
||||||
m.value = []
|
m.value = []
|
||||||
m.metaId = m.type
|
m.metaId = m.type
|
||||||
if (titleSearchData[m.type]) {
|
if (!titleSearchData[m.type]) {
|
||||||
titleSearchData[m.type].children.push(m)
|
titleSearchData[m.type] = { ...m, children: [], name: m.type, id: m.type }
|
||||||
} else {
|
|
||||||
titleSearchData[m.type] = { ...m, children: [m], name: m.type, id: m.type }
|
|
||||||
}
|
}
|
||||||
|
if (m.id == '1') {
|
||||||
|
titleSearchData[m.type].children[0] = m
|
||||||
|
} else if (m.id == '0') {
|
||||||
|
titleSearchData[m.type].children[1] = m
|
||||||
|
} else if (m.id == '2') {
|
||||||
|
titleSearchData[m.type].children[2] = m
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.modelData.forEach(m => {
|
||||||
|
titleSearchData[m.type].children = titleSearchData[m.type].children.filter(item => item)
|
||||||
})
|
})
|
||||||
resolve(Object.keys(titleSearchData).map(b => titleSearchData[b]))
|
resolve(Object.keys(titleSearchData).map(b => titleSearchData[b]))
|
||||||
// this.titleSearchList.model.children = Object.keys(titleSearchData).map(b => titleSearchData[b])
|
// this.titleSearchList.model.children = Object.keys(titleSearchData).map(b => titleSearchData[b])
|
||||||
|
|||||||
Reference in New Issue
Block a user