fix:修改 scope 为图标
This commit is contained in:
@@ -68,6 +68,9 @@
|
|||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0px 20px 20px 0;
|
padding: 0px 20px 20px 0;
|
||||||
|
.table-no-data {
|
||||||
|
height: calc(100% - 80px);
|
||||||
|
}
|
||||||
.time-line-header{
|
.time-line-header{
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
@@ -75,6 +78,26 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
.scope-icon-box {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
justify-content: right;
|
||||||
|
}
|
||||||
|
.scope-box {
|
||||||
|
cursor: pointer;
|
||||||
|
color: $--background-color-disabled;
|
||||||
|
.nz-icon {
|
||||||
|
margin-right: 5px;
|
||||||
|
color: $--background-color-disabled ;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.scope-box.is-select{
|
||||||
|
color: $--color-monitor;
|
||||||
|
.nz-icon {
|
||||||
|
color: $--color-monitor;
|
||||||
|
}
|
||||||
|
}
|
||||||
#time-line-scope{
|
#time-line-scope{
|
||||||
//float: right;
|
//float: right;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,25 +2,11 @@
|
|||||||
<div style="height: 100%;width: 100%">
|
<div style="height: 100%;width: 100%">
|
||||||
<div class="time-line-header">
|
<div class="time-line-header">
|
||||||
<span>{{$t('alert.relatedAlerts')}}</span>
|
<span>{{$t('alert.relatedAlerts')}}</span>
|
||||||
<el-select
|
<div class="scope-icon-box">
|
||||||
id="time-line-scope"
|
<div class="scope-box" v-for="item in scopeList" :class="item.isSelect ? 'is-select' : ''" :key="item.type" @click="scopeChange(item)" :title="item.label">
|
||||||
v-model="scope"
|
<i class="nz-icon" :class="selectIcon(item)" />
|
||||||
multiple
|
</div>
|
||||||
collapse-tags
|
</div>
|
||||||
:popper-append-to-body="false"
|
|
||||||
:placeholder="$t('el.select.placeholder')"
|
|
||||||
popper-class="right-box-select-top prevent-clickoutside"
|
|
||||||
size="small"
|
|
||||||
@change="changeScope"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in scopeList"
|
|
||||||
:key="item.key"
|
|
||||||
:label="$t(item.label)"
|
|
||||||
:value="item.key"
|
|
||||||
>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</div>
|
</div>
|
||||||
<el-timeline v-my-loading="loading" v-if="!noData && timeLineData.length">
|
<el-timeline v-my-loading="loading" v-if="!noData && timeLineData.length">
|
||||||
<el-timeline-item
|
<el-timeline-item
|
||||||
@@ -122,29 +108,37 @@ export default {
|
|||||||
stateOptions: alertMessageConstant.states,
|
stateOptions: alertMessageConstant.states,
|
||||||
scopeList: [{
|
scopeList: [{
|
||||||
key: 'asset',
|
key: 'asset',
|
||||||
|
isSelect: true,
|
||||||
label: this.$t('overall.asset')
|
label: this.$t('overall.asset')
|
||||||
}, {
|
}, {
|
||||||
key: 'datacenter',
|
key: 'datacenter',
|
||||||
|
isSelect: true,
|
||||||
label: this.$t('overall.dc')
|
label: this.$t('overall.dc')
|
||||||
}, {
|
}, {
|
||||||
key: 'project',
|
key: 'project',
|
||||||
|
isSelect: true,
|
||||||
label: this.$t('overall.project')
|
label: this.$t('overall.project')
|
||||||
}, {
|
}, {
|
||||||
key: 'module',
|
key: 'module',
|
||||||
|
isSelect: true,
|
||||||
label: this.$t('overall.module')
|
label: this.$t('overall.module')
|
||||||
}, {
|
}, {
|
||||||
key: 'endpoint',
|
key: 'endpoint',
|
||||||
|
isSelect: true,
|
||||||
label: this.$t('overall.endpoint')
|
label: this.$t('overall.endpoint')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'alertrule',
|
key: 'alertrule',
|
||||||
|
isSelect: true,
|
||||||
label: this.$t('alert.alertRule')
|
label: this.$t('alert.alertRule')
|
||||||
}, {
|
}, {
|
||||||
key: 'hash',
|
key: 'hash',
|
||||||
|
isSelect: true,
|
||||||
label: this.$t('overall.hash')
|
label: this.$t('overall.hash')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
total: 20
|
total: 20,
|
||||||
|
scopeChangeTimer: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -163,7 +157,7 @@ export default {
|
|||||||
const params = {
|
const params = {
|
||||||
pageNo: this.pageNo,
|
pageNo: this.pageNo,
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
scope: this.scope.join(','),
|
scope: this.scopeList.filter(item => item.isSelect).map(item => item.key).join(','),
|
||||||
id: this.infoData.id,
|
id: this.infoData.id,
|
||||||
state: '',
|
state: '',
|
||||||
startAt: this.timezoneToUtcTimeStr(this.time[0] * 1000, 'YYYY-MM-DD HH:mm:ss'),
|
startAt: this.timezoneToUtcTimeStr(this.time[0] * 1000, 'YYYY-MM-DD HH:mm:ss'),
|
||||||
@@ -203,10 +197,41 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeScope (value) {
|
selectIcon (item) {
|
||||||
console.log(value)
|
switch (item.key) {
|
||||||
this.pageNo = 1
|
case 'asset' : return 'nz-icon-overview-project'
|
||||||
this.getTimeLineData()
|
case 'datacenter' : return 'nz-icon-Datacenter2'
|
||||||
|
case 'project' : return 'nz-icon-project'
|
||||||
|
case 'module' : return 'nz-icon-overview-module'
|
||||||
|
case 'endpoint' : return 'nz-icon-overview-endpoint'
|
||||||
|
case 'alertrule' : return 'nz-icon-Alertrule'
|
||||||
|
case 'hash' : return 'nz-icon-module5'
|
||||||
|
}
|
||||||
|
return 'nz-icon-module5'
|
||||||
|
},
|
||||||
|
scopeChange (scope) {
|
||||||
|
if (this.scopeChangeTimer) {
|
||||||
|
clearInterval(this.scopeChangeTimer)
|
||||||
|
this.scopeChangeTimer = null
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
const isSelectArr = this.scopeList.filter(item => item.isSelect)
|
||||||
|
if (isSelectArr.length === this.scopeList.length) {
|
||||||
|
this.scopeList.forEach(item => {
|
||||||
|
item.isSelect = false
|
||||||
|
})
|
||||||
|
scope.isSelect = !scope.isSelect
|
||||||
|
} else if (isSelectArr.length === 1 && isSelectArr[0].type === scope.type) {
|
||||||
|
this.scopeList.forEach(item => {
|
||||||
|
item.isSelect = true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
scope.isSelect = !scope.isSelect
|
||||||
|
}
|
||||||
|
this.scopeChangeTimer = setTimeout(() => {
|
||||||
|
this.pageNo = 1
|
||||||
|
this.getTimeLineData()
|
||||||
|
}, 100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user