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