diff --git a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue
index 575f7c77c..705210e7b 100644
--- a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue
+++ b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue
@@ -15,7 +15,7 @@
-
@@ -23,6 +23,11 @@
+
+
@@ -51,6 +56,8 @@
from: String, //来自哪个页面
targetTab: String, //展示哪个页签
detail: Array, //对象详情内容
+
+ assetDetail: Array, //endpoint页的asset详情
},
data() {
return {}
diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/commonDetailTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/commonDetailTab.vue
index 14fa59f8d..15d083093 100644
--- a/nezha-fronted/src/components/common/bottomBox/tabs/commonDetailTab.vue
+++ b/nezha-fronted/src/components/common/bottomBox/tabs/commonDetailTab.vue
@@ -9,12 +9,13 @@
{{$t("alert.alertName")}}:{{obj.alertName}}
{{$t("asset.tableTitle.host")}}:{{obj.host}}
{{$t("project.endpoint.endpointId")}}: {{obj.id}}
-
{{$t("overall.detail")}}
+ {{$t("overall.detail")}}
{{$t("config.dc.cabinets")}}
{{$t("alert.message")}}
- {{$t("overall.query")}}
+ {{$t("overall.query")}}
{{$t("project.endpoint.asset")}}
@@ -39,7 +40,8 @@
props: {
obj: Object,
from: String,
- detail: Array
+ detail: Array,
+ targetTab: String
},
methods: {
changeTab(tab) {
diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue
index b49a53d4e..8399cf1ac 100644
--- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue
+++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue
@@ -10,7 +10,8 @@
{{$t("project.endpoint.endpointId")}}: {{currentEndpoint ? currentEndpoint.id : ''}}
{{$t("overall.detail")}}
{{$t("overall.query")}}
+ class="sub-list-tab sub-list-tab-active">{{$t("overall.query")}}
{{$t("project.endpoint.asset")}}
-
@@ -140,8 +141,8 @@
-
+
@@ -161,6 +162,7 @@
vm = this;
let temp = this;
return {
+ assetDetail: [], //asset详情
endpointDetail: [],
targetTab: '',
mainTableHeight: this.$tableHeight.normal, //主列表table高度
@@ -171,6 +173,7 @@
mainListHeight: '', //主列表dom的高度
showSubList: false,
+ userData: [],
showTopBtn: false, //主列表top按钮
editEndpoint: {id: '', host: '', port: '', param: '', path: '', asset: {}, project: {}, module: {}, moduleId: '', assetId: '', paramObj: []},
endpointTableTitle: [
@@ -246,7 +249,7 @@
disabled: false
}],
},
- viewAssetState:false,
+ /*viewAssetState:false,*/
curEndpoint:null,
endpointQueryTabData:[],//endpoint 查询列表数据
showTableData:[],
@@ -684,12 +687,12 @@
},
//asset弹框控制
- tabControl(data) {
+ /*tabControl(data) {
if (data === 'close') {
this.viewAssetState = false
this.$refs['assetEditUnit'].tabView = false
}
- },
+ },*/
//搜索
endpointSearch: function(searchObj) {
this.endpointSearchLabel = {};
@@ -751,10 +754,13 @@
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
},
- viewAsset:function(id){
- this.viewAssetState=true;
+ viewAsset(endpoint) {
+ this.curEndpoint = endpoint;
+ this.targetTab = 'assetDetail';
+ this.showSubList = true;
+ /*this.viewAssetState=true;
this.$refs.assetEditUnit.getAssetData(id);
- this.$refs.assetEditUnit.tabView=true;
+ this.$refs.assetEditUnit.tabView=true;*/
},
showEndpoint(endpoint) {
this.curEndpoint = endpoint;
@@ -801,11 +807,65 @@
}
}
}
- }
+ },
+ assetConvertToDetail(obj) {
+ let detail = [];
+ detail.push({label: this.$t("asset.createAssetTab.sn"), value: obj.sn});
+ detail.push({label: this.$t("asset.createAssetTab.host"), value: obj.host});
+ detail.push({label: this.$t("asset.createAssetTab.state"), value: obj.state == 1 ? this.$t('asset.createAssetTab.inStock'): this.$t('asset.createAssetTab.notInStock')});
+ detail.push({label: this.$t("asset.tableTitle.modules"), value: obj.endpointNum});
+ detail.push({label: this.$t("asset.tableTitle.alerts"), value: obj.alertNum});
+ detail.push({label: this.$t("asset.createAssetTab.assetType"), value: obj.model.type.value});
+ detail.push({label: this.$t("asset.createAssetTab.vendorModel"), value: obj.model.vendor.value + " " + obj.model.name});
+ detail.push({label: this.$t("asset.createAssetTab.assetType"), value: obj.model.type.value});
+ detail.push({label: this.$t("asset.createAssetTab.purchaseDate"), value: obj.purchaseDate});
+ detail.push({label: this.$t("asset.createAssetTab.dcName"), value: obj.idc ? obj.idc.name : ""});
+ detail.push({label: this.$t("asset.createAssetTab.location"), value: obj.idc ? obj.idc.location : ""});
+ detail.push({label: this.$t("asset.createAssetTab.principal"), value: obj.idc ? this.getPrincipalName(obj.idc.principal) : ""});
+ detail.push({label: this.$t("asset.createAssetTab.location"), value: obj.idc ? obj.idc.location : ""});
+ detail.push({label: this.$t("asset.createAssetTab.tel"), value: obj.idc ? obj.idc.tel : ""});
+ detail.push({label: this.$t("asset.createAssetTab.cabinet"), value: obj.cabinet ? obj.cabinet.name : ""});
+ detail.push({label: this.$t("asset.editAssetTab.uSize"), value: obj.cabinet ? obj.cabinet.uSize : ""});
+ detail.push({label: this.$t("asset.editAssetTab.remark"), value: obj.idc ? obj.idc.remark : ""});
+ if (obj.accounts.length > 0) {
+ let account = obj.accounts[0];
+ if (account.protocol == 'SSH') {
+ detail.push({label: this.$t("asset.createAssetTab.protocol"), value: 'SSH'});
+ detail.push({label: this.$t("asset.createAssetTab.account"), value: account.user});
+ let loginType = "";
+ if (account.authType == 1) {
+ loginType = this.$t('asset.createAssetTab.password');
+ } else if (account.authType == 2) {
+ loginType = this.$t('asset.createAssetTab.ssh');
+ }
+ detail.push({label: this.$t("asset.createAssetTab.loginType"), value: loginType});
+ } else if (account.protocol == 'TELNET') {
+ detail.push({label: this.$t("asset.createAssetTab.protocol"), value: 'TELNET'});
+ detail.push({label: this.$t("asset.createAssetTab.account"), value: account.user});
+ }
+ detail.push({label: this.$t("asset.createAssetTab.port"), value: account.port});
+ }
+ return detail;
+ },
+ getPrincipalName(data) {
+ for (let item in this.userData) {
+ if (this.userData[item].userId === data) {
+ return this.userData[item].username
+ }
+ }
+ },
+ getUserData() {
+ this.$get('sys/user/list').then(response => {
+ if (response.code === 200) {
+ this.userData = response.data.list
+ }
+ })
+ },
},
created() {
this.currentProject = this.$store.state.currentProject;
this.getModuleList();
+ this.getUserData();
},
mounted() {
//是否存在分页缓存
@@ -877,6 +937,11 @@
deep: true,
handler(n) {
this.endpointDetail = this.convertToDetail(n);
+ this.$get('asset', {id: n.assetId}).then(response => {
+ if (response.code === 200) {
+ this.assetDetail = this.assetConvertToDetail(response.data.list[0]);
+ }
+ });
}
},
},
diff --git a/nezha-fronted/src/tools.js b/nezha-fronted/src/tools.js
index c08074db9..b8deadc05 100644
--- a/nezha-fronted/src/tools.js
+++ b/nezha-fronted/src/tools.js
@@ -168,11 +168,10 @@ export const scrollBar = {
},
};
+// 底部上滑框窗口控制
export const bottomBoxWindow = {
// 鼠标拖动二级列表
listResize(vm, e) {
- console.info(vm);
- console.info(e);
let mainListDom = document.querySelector(".main-list-with-sub"); //主列表
let subListDom = document.querySelector(".sub-list"); //副列表
let contentRightDom = document.querySelector(".content-right"); //右侧内容区