Merge remote-tracking branch 'origin/codeCheck' into codeCheck

# Conflicts:
#	nezha-fronted/src/components/page/asset/asset.vue
This commit is contained in:
陈劲松
2020-02-06 18:55:59 +08:00
4 changed files with 84 additions and 27 deletions

View File

@@ -58,13 +58,13 @@
<el-menu-item :index="'3-' + index">
<div @click="jumpToAsset(item.id)" :class="{'menu-item-active' : (activeIndex == 'asset' && indOf(activeItemIndexes, item.id) > -1) }">
<span class="too-long-split" style="width: 130px;">{{item.name}}</span>
<idc-config-box :post-idc="item" ref="idcConfigBox" placement="left" @after="getIDCOptionData">
<template v-slot:optionZone>
<div @click="closeAllPop" class="menu-edit">
<i class="nz-icon nz-icon-edit" @click="getIDCOptionData(item.id)" style="color: inherit"></i>
</div>
</template>
</idc-config-box>
<!-- <idc-config-box :post-idc="item" ref="idcConfigBox" placement="left" @after="getIDCOptionData" :user-data="userDatas">-->
<!-- <template v-slot:optionZone>-->
<!-- <div @click="closeAllPop" class="menu-edit">-->
<!-- <i class="nz-icon nz-icon-edit" @click="getIDCOptionData(item.id)" style="color: inherit"></i>-->
<!-- </div>-->
<!-- </template>-->
<!-- </idc-config-box>-->
</div>
</el-menu-item>
</template>
@@ -208,6 +208,7 @@
idcUserData: '',
IDCOptionData: [],
addUnitShow: false,
userDatas:[]
}
},
methods: {
@@ -400,13 +401,21 @@
logout() {
this.$get('logout');
this.jumpTo('login');
},
getUserData() {
this.$get('sys/user/list').then(response => {
if (response.code === 200) {
this.userDatas = response.data.list
}
})
},
},
created() {
if (!localStorage.getItem("nz-language")) {
localStorage.setItem("nz-language", "en");
}
this.language = localStorage.getItem("nz-language");
this.getUserData();
},
mounted() {
this.getUserData();

View File

@@ -55,7 +55,8 @@ export default {
postCabinet:{type:Object},
placement:{type:String},
buttonClass:{type:String},
isEdit:{type:Boolean,default:true}
isEdit:{type:Boolean,default:true},
postIdcDatas:{type:Array}
},
created() {
this.init();
@@ -149,6 +150,17 @@ export default {
},
getIdcDatas:function(){
let temp=this;
if(temp.postIdcDatas&&temp.postIdcDatas.length>0){
temp.idcDatas=temp.postIdcDatas;
for (let i in temp.idcDatas){
let item=temp.idcDatas[i];
if(item.id==temp.cabinet.idcId){
temp.idc=item;
break;
}
}
return;
}
temp.$get('idc').then(response => {
if (response.code === 200) {
temp.idcDatas = response.data.list;

View File

@@ -110,14 +110,15 @@
},
getUserData() {
let temp=this;
if(!temp.userData||temp.userData.length<1){
if(temp.userData&&temp.userData.length>0){
temp.principals=temp.userData;
return;
}
temp.$get('sys/user/list').then(response => {
if (response.code === 200) {
temp.principals = response.data.list
console.log("queryUserData")
}
})
}
},
saveOrToEdit:function(){
if (!this.popBox.isEdit) {

View File

@@ -86,6 +86,17 @@
<div v-if="item.prop=='state'">
<span>{{scope.row.state==1 ? $t('asset.createAssetTab.inStock') : $t('asset.createAssetTab.notInStock')}}</span>
</div>
<div v-if="item.prop == 'ping'">
<el-popover
placement="right"
width="200"
trigger="hover"
:content="scope.row.pingLastUpdate+'['+scope.row.pingRtt+']'">
<span slot="reference">
<i :class="{'active-icon green':scope.row.pingState==1,'active-icon red':scope.row.pingState != 1}"></i>
</span>
</el-popover>
</div>
<template v-if="item.prop=='Module'">
<template v-if="scope.row.moduleNum > 0" >
<module-list-pop :asset-id="scope.row.id + ''" @openModuleBox="openModuleBox" placement="left" :ref="'moduleListPop' + scope.row.id">
@@ -106,10 +117,9 @@
<span class="link" @click="closeAllPop">{{scope.row.idc.name}}</span>
</template>
</idc-config-box>
<!--<span class="link">{{scope.row.idc.name}}</span>-->
</div>
<template v-if="item.prop=='cabinet'">
<cabinet-config-box v-if="scope.row.cabinet&&scope.row.cabinet!='--'" ref="cabinetConfigBox" placement="left" :is-edit="false" :post-cabinet="JSON.parse(JSON.stringify(scope.row.cabinet))" @after="getAssetData(null, true)">
<cabinet-config-box v-if="scope.row.cabinet&&scope.row.cabinet!='--'" ref="cabinetConfigBox" placement="left" :is-edit="false" :post-cabinet="JSON.parse(JSON.stringify(scope.row.cabinet))" @after="getAssetData(null, true)" :post-idc-datas="IDCOptionData">
<span slot="optionZone" @click="closeAllPop" class="link">{{returnData(scope.row.cabinet)}}</span>
</cabinet-config-box>
<span v-else>{{returnData(scope.row.cabinet)}}</span>
@@ -196,6 +206,12 @@
type: 'select',
label: 'assetState',
disabled: false
},{
id: 22,
name: "pingStatus",
type: 'select',
label: 'pingStatus',
disabled: false
}],
},
searchLabel: {}, //搜索参数
@@ -226,6 +242,10 @@
label: this.$t("asset.tableTitle.assetState"),
prop: 'state',
show: true,
}, {
label:this.$t('asset.tableTitle.assetPing'),
prop:'ping',
show:true,
},{
label: this.$t("asset.tableTitle.modules"),
prop: 'Module',
@@ -665,6 +685,10 @@
this.getAssetData();
}
},
created() {
this.getUserData();
this.getIDCOptionData();
},
mounted() {
setTimeout(()=>{
if (this.$store.state.assetData.selectedData.length > 0) {
@@ -672,9 +696,6 @@
this.checkList = this.$store.state.assetData.selectedData;
}
}, 50);
this.getUserData();
this.getIDCOptionData();
let localStorageTitle=localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path);
this.tablelable = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle;
this.dropCol = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle;
@@ -703,3 +724,17 @@
margin-right:6px;
}
</style>
<style lang="scss">
.active-icon{
width:20px;
height:20px;
border-radius:50%;
}
.active-icon .red{
background-color:red;
}
.active-icon .green{
background-color:lightGreen;
}
</style>