feat: dc-机柜二级页面

This commit is contained in:
陈劲松
2020-03-25 18:38:13 +08:00
parent 329287c1ac
commit 7990c1ee8d
6 changed files with 560 additions and 275 deletions

View File

@@ -801,7 +801,7 @@ li{
}
/*此处自定义弹框尺寸,不同功能可能需要的尺寸不一样,需自行添加*/
.right-box-account, .right-box-prom, .right-box-alert-config, .right-box-project, .right-box-module,
.right-box-account, .right-box-prom, .right-box-alert-config, .right-box-project, .right-box-module, .right-box-cabinet,
.right-box-edit-endpoint, .right-box-panel, .right-box-dc, .right-box-model, .right-box-add-asset, .right-box-add-chart {
width: 520px;
}
@@ -811,9 +811,6 @@ li{
.right-box-add-endpoint {
width: 850px;
}
.right-box-cabinet{
width: 400px
}
/* begin--右侧弹框--顶部按钮*/
.right-box-top-btns {
text-align: center;

View File

@@ -312,7 +312,8 @@
if (this.from == "alertRule") {
this.searchLabel.alertName = this.obj.alertName;
} else if (this.from == "asset") {
this.searchLabel.type = 3;
this.searchLabel.linkId = this.obj.id;
}
this.pageObj.pageNo = 1;
for (let item in searchObj) {
@@ -389,13 +390,13 @@
this.searchMsg.searchLabelList = this.searchMsg.searchLabelList.filter((item, index) => {
return item.label != "alertName" && item.label != "severity"
});
this.searchLabel.alertName = this.obj.alertName;
this.searchLabel.alertName = n.alertName;
} else if (this.from == "asset") {
this.searchMsg.searchLabelList = this.searchMsg.searchLabelList.filter((item, index) => {
return item.label != "alertType" && item.label != "asset"
});
this.searchLabel.type = 3;
this.searchLabel.linkId = this.obj.id;
this.searchLabel.linkId = n.id;
}
this.getAlertList();
}

View File

@@ -0,0 +1,295 @@
<template>
<span>
<!-- 副列表 endpoint query-->
<div @mousedown="listResize" class="sub-list-resize" v-if="showSubList && !isFullScreen"></div>
<div class="sub-list" v-if="showSubList">
<div class="sub-top-tools" v-show="subResizeShow">
<div class="sub-list-tabs margin-l-20" style="width: calc(100% - 780px);">
<div class="sub-list-tab">{{$t("overall.query")}}</div>
<span class="sub-list-tab-txt">{{$t("asset.createAssetTab.dcName")}}{{obj.name}}</span>
</div>
<div class="top-tool-right">
<div class="top-tool-search">
<search-input :searchMsg="searchMsg" @search="search"></search-input>
</div>
<button type="button" @click="toAddCabinet" :title="$t('overall.createCabinet')"
class="nz-btn nz-btn-size-normal nz-btn-style-light float-right margin-l-20" id="cab-add">
<i class="nz-icon-create-square nz-icon"></i>
</button>
<div class="sub-list-window-control">
<!--半屏-->
<div class="window-control-btn" v-if="isFullScreen" @click="exitFullScreen"><i class="nz-icon nz-icon-exit-full-screen"></i></div>
<!--全屏-->
<div class="window-control-btn" v-if="!isFullScreen" @click="fullScreen"><i class="el-icon-full-screen"></i></div>
<!--关闭-->
<div class="window-control-btn" @click="closeSubList"><i class="el-icon-close"></i></div>
</div>
</div>
</div>
<el-table
class="nz-table"
:data="tableData"
border
v-loading="loading"
ref="cabTable"
v-scrollBar:el-table
:height="$tableHeight.noPagination"
style="width: 100%;">
<el-table-column
:resizable="false"
v-for="(item, index) in tableTitle"
v-if="item.show"
:width="item.width"
:key="`col-${index}`"
:label="item.label"
>
<template slot-scope="scope" :column="item">
<div v-if="item.prop == 'option'" class="content-right-options">
<span :title="$t('overall.edit')" @click="editCabinet(scope.row)" class="content-right-option" :id="'dc-edit-'+scope.row.id"><i class="nz-icon nz-icon-edit"></i></span>
&nbsp;
<span :title="$t('overall.delete')" @click="delCabinet(scope.row)" class="content-right-option" :id="'dc-del-'+scope.row.id"><i class="el-icon-delete"></i></span>
</div>
<template v-else-if="item.prop == 'assetStat'">
<el-popover
placement="top-start"
offset="-100"
trigger="hover"
:content="$t('overall.result.total') + '' + scope.row.assetStat.total + '' + $t('asset.createAssetTab.inStock') + '' + scope.row.assetStat.inStock + '' + $t('asset.createAssetTab.notInStock') + '' + scope.row.assetStat.outStock">
<div slot="reference" class="dc-asset-states">
<span class="dc-asset-state dc-asset-state-total">{{scope.row.assetStat.total}}</span>
<span class="dc-asset-state dc-asset-state-in">{{scope.row.assetStat.inStock}}</span>
<span class="dc-asset-state dc-asset-state-out">{{scope.row.assetStat.outStock}}</span>
</div>
</el-popover>
</template >
<template v-else-if="item.prop == 'alertStat'">
<el-popover
placement="top-start"
offset="-128"
trigger="hover"
:content="$t('overall.result.total') + '' + scope.row.alertStat.total + '' + $t('alert.config.high') + '' + scope.row.alertStat.high + '' + $t('alert.config.medium') + '' + scope.row.alertStat.medium+ '' + $t('alert.config.low') + '' + scope.row.alertStat.low">
<div slot="reference" class="dc-asset-states">
<span class="dc-asset-state dc-asset-state-total">{{scope.row.alertStat.total}}</span>
<span class="dc-asset-state dc-asset-state-high">{{scope.row.alertStat.high}}</span>
<span class="dc-asset-state dc-asset-state-out">{{scope.row.alertStat.medium}}</span>
<span class="dc-asset-state dc-asset-state-in">{{scope.row.alertStat.low}}</span>
</div>
</el-popover>
</template >
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
<template v-else>-</template>
</template>
</el-table-column>
</el-table>
<cabinet-box :cur-cabinet="currentCabinet" :cur-idc="currentDc" ref="cabinetEditBox" @after="getCabinetList"></cabinet-box>
<button class="to-top" v-show="showTopBtn && subResizeShow" @click="toTop('ps', 1)"><i class="nz-icon nz-icon-top"></i></button>
</div>
</span>
</template>
<script>
import cabinetBox from "../../common/rightBox/cabinetBox";
export default {
name: "cabinetBox",
components:{
'cabinet-box':cabinetBox
},
props: {
isFullScreen: false, //是否全屏
showSubList: Boolean, //是否显示
subResizeShow: Boolean, //resize时用v-show="subResizeShow"控制页面内容是否显示
obj: Object, //关联的实体对象,有:"asset"、"alertRule"
},
data() {
return {
currentCabinet: {
id:'',
idcId:'',
name:'',
remark:'',
seq:'',
uSize:0
},
showTopBtn: false, //top按钮是否显示
loading: false,
currentDc: {},
tableTitle: [
{
label: 'ID',
prop: 'id',
show: true,
width: 80
},
{
label:this.$t('overall.name'),
prop:'name',
show:true
},
{
label:this.$t('asset.createAssetTab.uSize'),
prop:'uSize',
show:true
},
{
label:this.$t('config.dc.assets'),
prop:'assetStat',
show:true
},
{
label:this.$t('alert.alert'),
prop:'alertStat',
show:true
},
{
label:this.$t('config.dc.remark'),
prop:'remark',
show:true
},
{
label: this.$t('config.account.option'),
prop: 'option',
show: true,
width: 120
}
],
searchMsg: { //给搜索框子组件传递的信息
zheze_none: true,
searchLabelList: [
{
id: 11,
name: this.$t('overall.name'),
type: 'input',
label: 'name',
disabled: false
},
{
id:12,
name:this.$t('asset.createAssetTab.uSize'),
label:'uSize',
disabled: false
},
{
id:13,
name:this.$t('config.dc.remark'),
label:'remark',
disabled: false
}
],
},
searchLabel: { //搜索参数
},
tableData: [],
}
},
methods: {
toAddCabinet:function(){
this.$refs.cabinetEditBox.show(true,true);
this.$refs.cabinetEditBox.reset();
},
editCabinet(cabinet) {
this.currentCabinet = JSON.parse(JSON.stringify(cabinet));
console.info(this.$refs.cabinetEditBox)
this.$refs.cabinetEditBox.show(true, true);
},
getCabinetList() {
this.tableData = [];
this.loading = true;
this.$set(this.searchLabel, "pageNo", 1);
this.$set(this.searchLabel, "pageSize", -1);
this.$get("/cabinet", this.searchLabel).then(response => {
if (response.code == 200) {
this.loading = false;
this.tableData = response.data.list;
}
});
},
search: function (searchObj) {
this.searchLabel = {idcId: this.currentDc.id, pageNo: 1, pageSize: -1};
for (let item in searchObj) {
if (searchObj[item]) {
this.$set(this.searchLabel, item, searchObj[item]);
}
}
this.getCabinetList();
},
exitFullScreen() {
this.$emit("exitFullScreen");
},
fullScreen() {
this.$emit("fullScreen");
},
closeSubList() {
this.$emit("closeSubList");
this.tableData = [];
},
listResize(e) {
this.$emit('listResize', e);
},
delCabinet:function(cabinet){
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'warning'
}).then(() => {
this.$delete('/cabinet?ids='+cabinet.id).then(response=>{
if(response.code == 200){
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.getCabinetList();
}else{
this.$message.error(response.msg);
}
})
})
},
},
watch: {
obj: {
immediate: true,
deep: true,
handler(n) {
if (n) {
this.currentDc = JSON.parse(JSON.stringify(n));
this.searchLabel = {idcId: this.currentDc.id};
this.getCabinetList();
}
}
}
},
mounted() {
this.$nextTick(() => {
//绑定滚动条事件控制top按钮
let el = this.$refs.cabTable.$el.querySelector(".el-table__body-wrapper");
if (el._ps_) {
el.addEventListener("ps-scroll-y", () => {
if (el._ps_.scrollbarYTop > 50) {
this.showTopBtn = true;
} else {
this.showTopBtn = false;
}
});
}
});
}
}
</script>
<style lang="scss">
/*重写el-loading样式*/
.nz-table .el-loading-spinner .circular{
width: 42px;
height: 42px;
animation: loading-rotate 2s linear infinite;
display: none;
}
.nz-table .el-loading-spinner{
background: url(../../../assets/img/loading.gif) no-repeat;
background-size: 48px 48px;
width: 100%;
height: 100%;
position: relative;
top: 50%;
left: 48.5%;
}
</style>

View File

@@ -186,8 +186,10 @@
deep:true,
immediate:true,
handler:function(n,o){
if (n) {
this.cabinet=JSON.parse(JSON.stringify(n));
}
}
},
cabinet:{
deep:true,

View File

@@ -1,4 +1,4 @@
<style scoped>
<style>
.dc {
height: 100%;
}
@@ -51,24 +51,27 @@
</div>
</div>
<!--dc table start-->
<div class="content-right" v-if="tabShow==1">
<div class="top-tools">
<div class="top-tool-main-right">
<div class="content-right">
<div class="main-list" :class="{'main-list-with-sub': showSubList}">
<div class="top-tools" v-show="mainResizeShow">
<div class="top-tool-main-right" :class="{'top-tool-main-right-to-left': showSubList}">
<div class="top-tool-search">
<search-input ref="searchInput" :searchMsg="searchMsg" @search="search" v-if="tabShow==1"></search-input>
<search-input ref="searchInput" :searchMsg="searchMsg" @search="search" :inTransform="inTransform"></search-input>
</div>
<button type="button" @click="toAdd" :title="$t('overall.createDatacenter')"
class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="dc-add">
<i class="nz-icon-create-square nz-icon"></i>
</button>
</div>
<div class="pagination-top pagination-top-hide display-none"></div>
</div>
<el-table
class="nz-table"
:data="tableData"
border
v-show="mainResizeShow"
v-scrollBar:el-table
:height="$tableHeight.normal"
:height="mainTableHeight"
ref="dcTable"
style="width: 100%;">
<el-table-column
@@ -113,7 +116,7 @@
</template >
<template v-else-if="item.prop == 'cabinetNum'">
<span class="clickable" @click="showCabinet(scope.row)">{{scope.row[item.prop]}}</span>
<span class="link" @click="showCabinet(scope.row)">{{scope.row[item.prop]}}</span>
</template>
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
<template v-else>-</template>
@@ -127,8 +130,14 @@
</template>
</el-table-column>
</el-table>
<div class="pagination-bottom" v-show="!showSubList">
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
<button class="to-top" v-show="showTopBtn1" @click="toTop"><i class="nz-icon nz-icon-top"></i></button>
</div>
<button class="to-top" v-show="showTopBtn" @click="toTop"><i class="nz-icon nz-icon-top"></i></button>
</div>
<cabinet-bottom-box v-if="showSubList" @listResize="listResize" :show-sub-list="showSubList" :subResizeShow="subResizeShow" :obj="cabinetDc" :isFullScreen="isFullScreen"
@closeSubList="showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen"></cabinet-bottom-box>
</div>
<!--dc table end-->
<element-set
v-clickoutside="elementsetHide"
@@ -139,101 +148,21 @@
></element-set>
<dc-box ref="dcBox" :dc="currentDc" :user-data="userData" @reload="getTableData"></dc-box>
</div>
<!--cabinet table start-->
<div v-if="tabShow==2" class="content-right">
<div class="top-tools">
<div>
<div @click="back">
<button class="nz-btn nz-btn-size-normal nz-btn-style-light float-right nz-btn-min-width-82">
<span class='top-tool-btn-txt'>{{$t('overall.back')}}</span>
</button>
</div>
</div>
<div>
<button type="button" @click="toAddCabinet" :title="$t('overall.createCabinet')"
class="nz-btn nz-btn-size-normal nz-btn-style-light float-right margin-l-20" id="cab-add">
<i class="nz-icon-create-square nz-icon"></i>
</button>
<div class="top-tool-search float-right">
<search-input ref="cabSearchInput" :searchMsg="cabSearchMsg" @search="cabSearch" v-if="tabShow==2"></search-input>
</div>
</div>
</div>
<el-table
class="nz-table"
:data="cabinetDatas"
border
ref="cabTable"
v-scrollBar:el-table
:height="$tableHeight.normal"
style="width: 100%;">
<el-table-column
:resizable="false"
v-for="(item, index) in cabinetLabel"
v-if="item.show"
:width="item.width"
:key="`col-${index}`"
:label="item.label"
>
<template slot-scope="scope" :column="item">
<div v-if="item.prop == 'option'" class="content-right-options">
<span :title="$t('overall.edit')" @click="editCabinet(scope.row)" class="content-right-option" :id="'dc-edit-'+scope.row.id"><i class="nz-icon nz-icon-edit"></i></span>
&nbsp;
<span :title="$t('overall.delete')" @click="delCabinet(scope.row)" class="content-right-option" :id="'dc-del-'+scope.row.id"><i class="el-icon-delete"></i></span>
</div>
<template v-else-if="item.prop == 'assetStat'">
<el-popover
placement="top-start"
offset="-100"
trigger="hover"
:content="$t('overall.result.total') + '' + scope.row.assetStat.total + '' + $t('asset.createAssetTab.inStock') + '' + scope.row.assetStat.inStock + '' + $t('asset.createAssetTab.notInStock') + '' + scope.row.assetStat.outStock">
<div slot="reference" class="dc-asset-states">
<span class="dc-asset-state dc-asset-state-total">{{scope.row.assetStat.total}}</span>
<span class="dc-asset-state dc-asset-state-in">{{scope.row.assetStat.inStock}}</span>
<span class="dc-asset-state dc-asset-state-out">{{scope.row.assetStat.outStock}}</span>
</div>
</el-popover>
</template >
<template v-else-if="item.prop == 'alertStat'">
<el-popover
placement="top-start"
offset="-128"
trigger="hover"
:content="$t('overall.result.total') + '' + scope.row.alertStat.total + '' + $t('alert.config.high') + '' + scope.row.alertStat.high + '' + $t('alert.config.medium') + '' + scope.row.alertStat.medium+ '' + $t('alert.config.low') + '' + scope.row.alertStat.low">
<div slot="reference" class="dc-asset-states">
<span class="dc-asset-state dc-asset-state-total">{{scope.row.alertStat.total}}</span>
<span class="dc-asset-state dc-asset-state-high">{{scope.row.alertStat.high}}</span>
<span class="dc-asset-state dc-asset-state-out">{{scope.row.alertStat.medium}}</span>
<span class="dc-asset-state dc-asset-state-in">{{scope.row.alertStat.low}}</span>
</div>
</el-popover>
</template >
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
<template v-else>-</template>
</template>
</el-table-column>
</el-table>
</div>
<!--cabinet table end-->
<cabinet-box :cur-cabinet="curCabinet" :cur-idc="currentShowDc" ref="cabinetEditBox" @after="getCabinetDatas"></cabinet-box>
<button class="to-top" v-show="showTopBtn2" @click="toTop()"><i class="nz-icon nz-icon-top"></i></button>
</div>
</template>
<script>
import cabinetBox from "../../common/rightBox/cabinetBox";
export default {
name: "dc",
components:{
'cabinet-box':cabinetBox
},
data() {
return {
showElementSet: false, //控制自定义列的弹框
inTransform: false, //搜索框相关搜索条件下拉框是否在transform里
mainResizeShow: true, //dom高度改变时部分内容是否展示
subResizeShow: true,
isFullScreen: false,
showSubList: false, //是否展示二级列表
tableId: 'dcTable', //需要分页的table的id用于记录每页数量
showTopBtn1: false,
showTopBtn2: false,
showTopBtn: false,
mainTableHeight: this.$tableHeight.normal, //主列表table高度
currentDc: {
id: '',
name: '',
@@ -245,6 +174,7 @@
name: ''
}
},
cabinetDc: {},
pageObj: {
pageNo: 1,
pageSize: 20,
@@ -308,81 +238,7 @@
searchLabel: {}, //搜索参数
tabShow:1, // 控制显示一级页面和二级页面 1 dc 2cabinet
cabinetDatas:[],//显示的机柜信息
cabinetLabel:[
{
label: 'ID',
prop: 'id',
show: true,
width: 80
},
{
label:this.$t('overall.name'),
prop:'name',
show:true
},
{
label:this.$t('asset.createAssetTab.uSize'),
prop:'uSize',
show:true
},
{
label:this.$t('config.dc.assets'),
prop:'assetStat',
show:true
},
{
label:this.$t('alert.alert'),
prop:'alertStat',
show:true
},
{
label:this.$t('config.dc.remark'),
prop:'remark',
show:true
},
{
label: this.$t('config.account.option'),
prop: 'option',
show: true,
width: 120
}
],
curCabinet:{
id:'',
idcId:'',
name:'',
remark:'',
seq:'',
uSize:0
},
currentShowDc:{},
cabSearchMsg: { //给搜索框子组件传递的信息
zheze_none: true,
searchLabelList: [
{
id: 11,
name: this.$t('overall.name'),
type: 'input',
label: 'name',
disabled: false
},
{
id:12,
name:this.$t('asset.createAssetTab.uSize'),
label:'uSize',
disabled: false
},
{
id:13,
name:this.$t('config.dc.remark'),
label:'remark',
disabled: false
}
],
},
cabSearchLabel: {
}, //搜索参数
}
},
methods: {
@@ -416,6 +272,102 @@
this.$store.commit('setHeaderTable', data);
this.tablelable = data;
},
// 鼠标拖动二级列表
listResize(e) {
let mainListDom = document.querySelector(".main-list-with-sub"); //主列表
let subListDom = document.querySelector(".sub-list"); //副列表
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
//得到点击时俩dom的初始高度
let mainInitialHeight = mainListDom.offsetHeight;
let subInitialHeight = subListDom.offsetHeight;
//点击时鼠标的Y轴位置
let mouseInitialY = e.clientY;
let _this = this;
document.onmousemove = (e) => {
e.preventDefault();
//得到鼠标拖动的距离
let mouseMoveY = Math.abs(e.clientY - mouseInitialY);
//往上方拖动:
if (e.clientY < mouseInitialY) {
mainListDom.style.height = mainInitialHeight-mouseMoveY+'px';
subListDom.style.height = subInitialHeight+mouseMoveY+'px';
}
//往下方拖动:
if (e.clientY > mouseInitialY) {
mainListDom.style.height = mainInitialHeight+mouseMoveY+'px';
subListDom.style.height = subInitialHeight-mouseMoveY+'px';
}
// 主、副列表最小高度限制为15px
if(parseInt(mainListDom.style.height) >= contentRightHeight-15){
mainListDom.style.height = contentRightHeight-15+'px';
}
if(parseInt(mainListDom.style.height) <= 15){
mainListDom.style.height = 15+'px';
}
if(parseInt(subListDom.style.height) >= contentRightHeight-15){
subListDom.style.height = contentRightHeight-15+'px';
}
if(parseInt(subListDom.style.height) <= 15){
subListDom.style.height = 15+'px';
}
//当主副列表可视区域小于一定值时,不展示内容
if(parseInt(mainListDom.style.height) <= 100){
if (_this.mainResizeShow) {
_this.mainResizeShow = false;
}
} else {
if (!_this.mainResizeShow) {
_this.mainResizeShow = true;
}
}
if(parseInt(subListDom.offsetHeight) <= 100){
if (_this.subResizeShow) {
_this.subResizeShow = false;
}
} else {
if (!_this.subResizeShow) {
_this.subResizeShow = true;
}
}
};
document.onmouseup = () => {
document.onmousemove = null;
}
},
exitFullScreen() {
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
//主列表
document.querySelector(".main-list-with-sub").style.height = this.mainListHeight ? this.mainListHeight + 'px' : 'calc(50% - 4px)';
//副列表
document.querySelector(".sub-list").style.height = this.mainListHeight ? contentRightHeight-this.mainListHeight-9 + 'px' : 'calc(50% - 4px)';
setTimeout(() => {
this.isFullScreen = false;
if (document.querySelector(".main-list-with-sub").offsetHeight >= 100) {
this.mainResizeShow = true;
}
if (document.querySelector(".sub-list").offsetHeight >= 100) {
this.subResizeShow = true;
}
}, 210);
},
fullScreen() {
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
this.isFullScreen = true;
//主列表
this.mainListHeight = document.querySelector(".main-list-with-sub").offsetHeight; //记录全屏前主列表的高度
document.querySelector(".main-list-with-sub").style.height = '0';
this.mainResizeShow = false;
//副列表
document.querySelector(".sub-list").style.height = contentRightHeight + 'px';
},
jumpTo(data, id) {
this.$router.push({
path: "/" + data,
@@ -507,14 +459,16 @@
this.getTableData();
},
showCabinet:function(dc){
this.tabShow=2;
this.currentShowDc=dc;
this.cabSearchLabel={idcId:this.currentShowDc.id};
this.getCabinetDatas();
let temp=this;
setTimeout(function(){temp.$refs.cabSearchInput.clear_input();},100)
//this.currentShowDc=dc;
//this.tabShow=2;
this.cabinetDc = JSON.parse(JSON.stringify(dc));
this.showSubList = true;
//this.cabSearchLabel={idcId:this.currentShowDc.id};
//this.getCabinetDatas();
/*let temp=this;
setTimeout(function(){temp.$refs.cabSearchInput.clear_input();},100)*/
},
getCabinetDatas:function(){
/*getCabinetDatas:function(){
this.$get('/cabinet',this.cabSearchLabel).then(response=>{
if(response.code==200 && response.msg=='success'){
this.cabinetDatas=response.data.list;
@@ -528,8 +482,8 @@
toAddCabinet:function(){
this.$refs.cabinetEditBox.show(true,true);
this.$refs.cabinetEditBox.reset();
},
delCabinet:function(cabinet){
},*/
/*delCabinet:function(cabinet){
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
@@ -544,8 +498,8 @@
}
})
})
},
back:function(){
},*/
/*back:function(){
this.tabShow=1;
this.getTableData();
let temp=this;
@@ -561,15 +515,60 @@
}
}
this.getCabinetDatas();
}*/
},
watch: {
showSubList(n) {
this.inTransform = n;
if (!n) {
this.mainTableHeight = this.$tableHeight.normal; //重置table的高度
this.isFullScreen = false;
//移动分页组件的位置
let paginationTop = document.querySelector(".pagination-top");
let paginationBottom = document.querySelector(".pagination-bottom");
paginationTop.classList.remove("display-none");
if (paginationTop.classList.contains("pagination-top-show")) {
paginationTop.classList.remove("pagination-top-show");
}
if (!paginationTop.classList.contains("pagination-top-hide")) {
paginationTop.classList.add("pagination-top-hide");
}
setTimeout(() => {
paginationTop.classList.add("display-none");
paginationBottom.appendChild(paginationTop.removeChild(document.querySelector(".pagination")));
}, 210);
// 主列表恢复全屏
this.mainResizeShow = this.subResizeShow = true;
document.querySelector('.main-list').style.height = "";
//副列表高度清空
document.querySelector(".sub-list").style.height = '';
} else {
this.mainTableHeight = this.$tableHeight.openSubList.mainList; //重置table高度
//移动分页组件的位置
let paginationTop = document.querySelector(".pagination-top");
paginationTop.appendChild(document.querySelector(".pagination-bottom").removeChild(document.querySelector(".pagination")));
paginationTop.classList.remove("display-none");
setTimeout(() => {
if (paginationTop.classList.contains("pagination-top-hide")) {
paginationTop.classList.remove("pagination-top-hide");
}
if (!paginationTop.classList.contains("pagination-top-show")) {
paginationTop.classList.add("pagination-top-show");
}
}, 210);
}
}
},
destroyed() {
window.onresize = null;
},
mounted() {
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
this.pageObj.pageSize = pageSize;
}
this.getTableData();
this.$nextTick(function(){
this.getUserData();//绑定滚动条事件控制top按钮
@@ -577,23 +576,12 @@
if (el._ps_) {
el.addEventListener("ps-scroll-y", () => {
if (el._ps_.scrollbarYTop > 100) {
this.showTopBtn1 = true;
this.showTopBtn = true;
} else {
this.showTopBtn1 = false;
this.showTopBtn = false;
}
});
}
let el2 = this.$refs.cabTable.$el.querySelector(".el-table__body-wrapper");
if (el2._ps_) {
el2.addEventListener("ps-scroll-y", () => {
if (el2._ps_.scrollbarYTop > 100) {
this.showTopBtn2 = true;
} else {
this.showTopBtn2 = false;
}
});
}
});
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))

View File

@@ -35,7 +35,8 @@ import cabinetConfigBox from "./components/common/popBox/cabinetConfig"; //面
import dcBox from "./components/common/rightBox/dcBox"; //dc弹框
import modelBox from "./components/common/rightBox/modelBox"; //model弹框
import selectArea from "./components/common/popBox/selectArea"; //dc弹框
import alertMessageBox from "./components/common/bottomBox/alertMessageBox"; //dc弹
import alertMessageBox from "./components/common/bottomBox/alertMessageBox"; //alertMessage上滑
import cabinetBottomBox from "./components/common/bottomBox/cabinetBottomBox"; //机柜上滑框
import PerfectScrollbar from "perfect-scrollbar";
import "perfect-scrollbar/css/perfect-scrollbar.css";
import loading from "./components/common/loading";
@@ -60,6 +61,7 @@ Vue.component("model-box", modelBox);
Vue.component("select-area", selectArea);
Vue.component('loading',loading);
Vue.component('alert-message-box',alertMessageBox);
Vue.component('cabinet-bottom-box',cabinetBottomBox);
Vue.prototype.$axios = axios;
Vue.prototype.$post = post;
@@ -72,7 +74,7 @@ Vue.prototype.$tableHeight = { //列表页表格的高度
mainList: 'calc(100% - 60px)',
subList: 'calc(100% - 86px)'
},
noPagination: 'calc(100% - 60px)', //特例:endpoint query页没有翻页组件
noPagination: 'calc(100% - 60px)', //特例:没有翻页组件
};
Vue.prototype.toTop = (type, wrap) => { //top按钮公共方法
if (type == 'el') {
@@ -88,7 +90,7 @@ Vue.prototype.toTop = (type, wrap) => { //top按钮公共方法
}, 20);
} else {
let els = document.querySelectorAll(".el-table__body-wrapper");
if (wrap || wrap == 0) {
if (wrap || wrap == 0) { //指定index的table__body
let currentTop = els[wrap].scrollTop;
let interval = currentTop/10;
let intervalFunc = setInterval(function(){ //花200ms分10次回到顶部模拟动画效果
@@ -99,7 +101,7 @@ Vue.prototype.toTop = (type, wrap) => { //top按钮公共方法
els[wrap].scrollTop = currentTop;
}
}, 20);
} else {
} else { //所有table__body
for (let i = 0; i < els.length; i++) {
let currentTop = els[i].scrollTop;
let interval = currentTop/10;