fix: 修复数个bug

1.asset-account exporter项在编辑时不可见;
2.asset cli下拉选择项中去掉snmp;
3.alert-rule 文字标题更改;
4.修复endpoint-query时会自己弹出chartbox的问题;
5.优化了asset-box代码逻辑
This commit is contained in:
chenjinsong
2020-07-06 19:49:04 +08:00
parent c8beabe69a
commit 09a50ffc60
9 changed files with 81 additions and 72 deletions

View File

@@ -512,7 +512,7 @@
this.dataList.push({
id: -10,
panelId: 0,
title: this.$t("dashboard.panel.chartForm.statistics"),
title: this.$t("alert.config.chart.affectEntity"),
span: 4,
height: 350,
type: "alertRuleInfo",
@@ -1425,7 +1425,7 @@
if (response.code == 200) {
response.data && function () {
if (response.data.project && response.data.project.length > 0) {
detail.push({title: vm.$t("project.project.project"), data: convert(response.data.project)});
detail.push({title: vm.$t("overall.entity"), data: convert(response.data.project)});
}
/*if (response.data.module && response.data.module.length > 0) {
detail.push({title: vm.$t("project.module.module"), data: convert(response.data.module)});

View File

@@ -107,7 +107,7 @@
<chart ref="endpointChart" :unit="chartUnit"></chart>
</el-dialog>
<chart-box ref="addChartModal" :panel-data="panelData" @on-create-success="createSuccess" @reloadOnlyPanel="getPanelData" @reload="getPanelData" :show-panel="{}"></chart-box>
<chart-box v-if="rightBox.show" ref="addChartModal" :panel-data="panelData" @on-create-success="createSuccess" @reloadOnlyPanel="getPanelData" @reload="getPanelData" :show-panel="{}"></chart-box>
</span>
</template>
@@ -155,7 +155,8 @@
panelData: [], //chart-box的panel下拉框数据,
hideSameLabels: true,
sameLabels:['instance','module','project','asset','endpoint','datacenter'],
chartUnit:5
chartUnit:5,
rightBox: {show: false}
}
},
methods: {
@@ -163,6 +164,8 @@
this.$emit('changeTab', tab);
},
saveChart() { //新增chart
this.rightBox.show = true;
this.$nextTick(() => {
this.$refs.addChartModal.setTitle(this.$t("dashboard.panel.createChartTitle"));
this.$refs.addChartModal.show(true);
let metricInfo = {};
@@ -179,6 +182,7 @@
}
this.$refs.addChartModal.createData(-1, metricInfo);
this.$refs.addChartModal.setUnit(this.chartUnit)
});
},
dropdownHandler(show) {
if (show) {

View File

@@ -147,7 +147,7 @@
ref="addEndpointBox"></add-endpoint-box>
<!--<asset-add-unit :add-unit-show='addUnitShow' @refreshData="refreshAsset" ref="assetAddUnit"
@sendStateData="closeAsset"></asset-add-unit>-->
<asset-box :edit-unit-show='addUnitShow' @refreshData="refreshAsset" @sendStateData="closeAsset"
<asset-box :edit-unit-show='addUnitShow' @refreshData="refreshAsset" @sendStateData="closeAsset" v-if="assetBoxShow"
ref="assetAddUnit"></asset-box>
<dc-box ref="dcBox" :dc="currentDc" :user-data="userDatas" @reload="getAssetData"></dc-box>
<alert-config-box :parentAlertRule="alertRule" @reload="" ref="alertConfigBox"></alert-config-box>
@@ -253,6 +253,7 @@
},
IDCOptionData: [],
addUnitShow: false,
assetBoxShow: false,
userDatas:[],
showChangePwd:false,
}
@@ -260,6 +261,7 @@
methods: {
closeAsset() {
this.addUnitShow = false;
this.assetBoxShow = false;
},
refreshAsset(flag) {
if (flag && this.$route.path == "/asset") {
@@ -323,9 +325,11 @@
} else if (item.type == 5) {
this.$refs.alertConfigBox.show(true, true);
} else if (item.type == 4) {
this.assetBoxShow = true;
this.$nextTick(() => {
this.addUnitShow = true;
this.$refs.assetAddUnit.show();
this.$refs.assetAddUnit.resetAsset();
});
} else if (item.type == 6) {
this.currentDc = {
id: '',

View File

@@ -27,6 +27,7 @@ const cn = {
signOut: "登出",
select: "选择",
ok: "Ok",
entity: "实体",
all: "全选",
value: "值",
other: "其他",

View File

@@ -32,6 +32,7 @@ const en = {
signOut: 'Logout',//'登出'
select: 'Select',//'选择'
ok: 'Ok',//OK
entity: 'Entity',
all: 'All',//'全选'
value: 'Value',
other: 'Others',//"其他"

View File

@@ -206,7 +206,7 @@
</div>
<account-config-box v-for="(account,index) in assetData.accounts" :account="account" v-show="account.protocol == accountType" :key="index" ref="accountConfigBox" @setValidateResult="setAccountValideResult" @protocol-type-change="protocolTypeChange"></account-config-box>
<template v-if="accountType == 'SSH'">
<template v-if="accountType == 'SSH' && !assetData.id">
<el-form-item :label="$t('asset.createAssetTab.exporter')" class="exporter-label">
<el-switch class="exporter-switch" v-model="assetData.exporter" active-color="#ee9d3f" active-value="1" inactive-value="0" :show="!exporterDisableSwitch"></el-switch>
</el-form-item>
@@ -415,7 +415,6 @@
modelClickData: '',
popState: true,
obj: null,
addUnitShow: false,
rules: {
sn: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
@@ -677,21 +676,22 @@
idc:this.obj.idc,
cabinet:this.obj.cabinet,
u:[this.obj.cabinetStart,this.obj.cabinetEnd]
}
this.$refs.locationCascader.initComponet(initLocationData)
this.assetViewData.moduleNum = this.obj.moduleNum
this.assetViewData.alertNum = this.obj.alertNum
this.assetViewData.cabinetName = this.obj.cabinet == null ? '' : this.obj.cabinet.name
this.getCabinetOptionData(this.obj.idc.id)
this.assetType = this.obj.model.type.code
};
this.$refs.locationCascader.initComponet(initLocationData);
this.assetViewData.moduleNum = this.obj.moduleNum;
this.assetViewData.alertNum = this.obj.alertNum;
this.assetViewData.cabinetName = this.obj.cabinet == null ? '' : this.obj.cabinet.name;
this.getCabinetOptionData(this.obj.idc.id);
this.assetType = this.obj.model.type.code;
this.assetData.impi=this.obj.impi?this.obj.impi:{host:'',port:''};
this.assetData.sn = this.obj.sn
this.assetData.host = this.obj.host
this.assetData.state = this.obj.state
this.assetData.sn = this.obj.sn;
this.assetData.host = this.obj.host;
this.assetData.state = this.obj.state;
this.assetData.idcId = this.obj.idc.id;
this.assetData.id = this.obj.id;
this.assetData.tags = this.obj.tags;
this.assetData.accounts = this.obj.accounts;
this.assetData.cabinetId = this.obj.cabinet == null ? '' : this.obj.cabinet.id
this.assetData.cabinetId = this.obj.cabinet == null ? '' : this.obj.cabinet.id;
this.assetData.purchaseDate = this.obj.purchaseDate;
if (this.assetData.accounts && this.assetData.accounts.length > 0) {
this.accountType = this.assetData.accounts[0].protocol.toUpperCase();
@@ -737,6 +737,7 @@
if (response.code === 200) {
this.IDCOptionData = response.data.list;
this.markOptionData(this.IDCOptionData);
console.info(this.IDCOptionData)
if (isUpdate) {
this.$store.commit('assetDcListChange');
this.$emit('refreshData');
@@ -1232,11 +1233,6 @@
})
});
},
tabControl(data) {
if (data === 'close') {
this.addUnitShow = false
}
},
editing() {
},
getSingleIDCData(data, item, itemData) {
@@ -1405,9 +1401,13 @@
},
mounted() {
this.getUserData()
this.getIDCOptionData();
this.getVendorOptionData();
this.getAssetTypeOptionData();
this.showAccountOp = false;
this.$nextTick(() => {
this.getIDCOptionData();
});
this.showAccountOp = false;
window.onresize = () => {
this.tableHeight = document.documentElement.clientHeight - 200;
}

View File

@@ -85,8 +85,7 @@
oldUChecked:[],
}
},
created(){
this.queryIdcInfos();
mounted(){
},
methods:{
toggleDropdown:function(){
@@ -366,11 +365,8 @@
}
}
},
mounted() {
},
computed:{
inputShowInfo:function(){
console.log(this.selectedData)
let idcName=this.selectedData.idc?this.selectedData.idc.name+'/':'';
let cabinetName=this.selectedData.cabinet?this.selectedData.cabinet.name+'/':'';
@@ -395,6 +391,13 @@
handler(n,o){
this.$emit('change',n);
}
},
idcOption: {
deep: true,
immediate: true,
handler(n, o) {
this.queryIdcInfos();
}
}
}
}

View File

@@ -98,8 +98,8 @@
<alert-config-box :parentAlertRule="alertRule" @reload="getTableData" ref="alertConfigBox"></alert-config-box>
<project-box :project="viewProjectData" ref="projectBox" @reload="getTableData"></project-box>
<module-box :module="viewModuleData" @reload="getTableData" ref="moduleBox"></module-box>
<asset-box :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl"
ref="assetEditUnit"></asset-box>
<!--<asset-box :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl" v-if="assetBoxShow"
ref="assetEditUnit"></asset-box>-->
<element-set
v-if="showElementSet"
@close="elementsetHide"
@@ -361,13 +361,6 @@
return value
}
},
//asset弹框控制
tabControl(data) {
if (data === 'close') {
this.viewAsset = false
this.$refs['assetEditUnit'].tabView = false
}
},
toAdd: function () {
this.cleanAlertRule();
this.$refs.alertConfigBox.show(true, true);

View File

@@ -176,7 +176,7 @@
class="nz-icon nz-icon-cli" :class="{'gray-filter': !scope.row.accounts || scope.row.accounts.length == 0}"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(account, index) in scope.row.accounts" :key="index" :command="[scope.row.id ,scope.row.host, account]">{{account.protocol}}</el-dropdown-item>
<el-dropdown-item v-for="(account, index) in scope.row.accounts" v-if="account && account.protocol != 'SNMP'" :key="index" :command="[scope.row.id ,scope.row.host, account]">{{account.protocol}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@@ -207,7 +207,7 @@
</div>
</left-menu>
<asset-box :edit-unit-show='editUnitShow' @refreshData="flushData" @sendStateData="tabControl"
<asset-box :edit-unit-show='editUnitShow' @refreshData="flushData" @sendStateData="tabControl" v-if="rightBox.show"
ref="assetEditUnit"></asset-box>
<element-set
v-if="showElementSet"
@@ -424,7 +424,6 @@
unitDisable: '',
modelClickData: '',
obj: null,
addUnitShow: false,
editUnitShow: false,
flag: false,
checkAllFlag: false,
@@ -706,9 +705,9 @@
},
tabControl(data) {
if (data === 'close') {
this.addUnitShow = false
this.editUnitShow = false
this.$refs['assetEditUnit'].tabView = false
this.editUnitShow = false;
this.$refs['assetEditUnit'].tabView = false;
this.rightBox.show = false;
}
},
indOf(a, b) {
@@ -729,17 +728,21 @@
},
tagShow(data, id, type) {
if (data === 'showAdd') {
//this.addUnitShow = true;
this.rightBox.show = true;
this.$nextTick(() => {
this.editUnitShow = true;
this.$refs['assetEditUnit'].show();
this.$refs['assetEditUnit'].accountSwitch=false;
this.$refs['assetEditUnit'].getAssetData('');
this.$refs['assetEditUnit'].resetAsset();
});
}
if (data === 'showEdit') {
this.rightBox.show = true;
this.$nextTick(() => {
this.editUnitShow = true;
this.$refs['assetEditUnit'].show();
this.$refs['assetEditUnit'].accountSwitch=false;
this.$refs['assetEditUnit'].getAssetData(id)
});
}
if (data === 'showView') {
this.alertMsgAsset = Object.assign({}, id);