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

View File

@@ -55,7 +55,8 @@ export default {
postCabinet:{type:Object}, postCabinet:{type:Object},
placement:{type:String}, placement:{type:String},
buttonClass:{type:String}, buttonClass:{type:String},
isEdit:{type:Boolean,default:true} isEdit:{type:Boolean,default:true},
postIdcDatas:{type:Array}
}, },
created() { created() {
this.init(); this.init();
@@ -149,6 +150,17 @@ export default {
}, },
getIdcDatas:function(){ getIdcDatas:function(){
let temp=this; 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 => { temp.$get('idc').then(response => {
if (response.code === 200) { if (response.code === 200) {
temp.idcDatas = response.data.list; temp.idcDatas = response.data.list;

View File

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

View File

@@ -86,6 +86,17 @@
<div v-if="item.prop=='state'"> <div v-if="item.prop=='state'">
<span>{{scope.row.state==1 ? $t('asset.createAssetTab.inStock') : $t('asset.createAssetTab.notInStock')}}</span> <span>{{scope.row.state==1 ? $t('asset.createAssetTab.inStock') : $t('asset.createAssetTab.notInStock')}}</span>
</div> </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="item.prop=='Module'">
<template v-if="scope.row.moduleNum > 0" > <template v-if="scope.row.moduleNum > 0" >
<module-list-pop :asset-id="scope.row.id + ''" @openModuleBox="openModuleBox" placement="left" :ref="'moduleListPop' + scope.row.id"> <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> <span class="link" @click="closeAllPop">{{scope.row.idc.name}}</span>
</template> </template>
</idc-config-box> </idc-config-box>
<!--<span class="link">{{scope.row.idc.name}}</span>-->
</div> </div>
<template v-if="item.prop=='cabinet'"> <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> <span slot="optionZone" @click="closeAllPop" class="link">{{returnData(scope.row.cabinet)}}</span>
</cabinet-config-box> </cabinet-config-box>
<span v-else>{{returnData(scope.row.cabinet)}}</span> <span v-else>{{returnData(scope.row.cabinet)}}</span>
@@ -196,6 +206,12 @@
type: 'select', type: 'select',
label: 'assetState', label: 'assetState',
disabled: false disabled: false
},{
id: 22,
name: "pingStatus",
type: 'select',
label: 'pingStatus',
disabled: false
}], }],
}, },
searchLabel: {}, //搜索参数 searchLabel: {}, //搜索参数
@@ -226,6 +242,10 @@
label: this.$t("asset.tableTitle.assetState"), label: this.$t("asset.tableTitle.assetState"),
prop: 'state', prop: 'state',
show: true, show: true,
}, {
label:this.$t('asset.tableTitle.assetPing'),
prop:'ping',
show:true,
},{ },{
label: this.$t("asset.tableTitle.modules"), label: this.$t("asset.tableTitle.modules"),
prop: 'Module', prop: 'Module',
@@ -665,6 +685,10 @@
this.getAssetData(); this.getAssetData();
} }
}, },
created() {
this.getUserData();
this.getIDCOptionData();
},
mounted() { mounted() {
setTimeout(()=>{ setTimeout(()=>{
if (this.$store.state.assetData.selectedData.length > 0) { if (this.$store.state.assetData.selectedData.length > 0) {
@@ -672,9 +696,6 @@
this.checkList = this.$store.state.assetData.selectedData; this.checkList = this.$store.state.assetData.selectedData;
} }
}, 50); }, 50);
this.getUserData();
this.getIDCOptionData();
let localStorageTitle=localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path); let localStorageTitle=localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path);
this.tablelable = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle; this.tablelable = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle;
this.dropCol = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle; this.dropCol = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle;
@@ -703,3 +724,17 @@
margin-right:6px; margin-right:6px;
} }
</style> </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>