temp: dc重构(部分)

This commit is contained in:
陈劲松
2020-07-15 22:11:33 +08:00
parent 9a9f44779f
commit 44769006d0
4 changed files with 53 additions and 69 deletions

View File

@@ -1,21 +1,16 @@
<template>
<transition name="right-box">
<div class="right-box right-box-dc" v-if="rightBox.show" v-clickoutside="clickos">
<div class="right-box right-box-dc" v-clickoutside="clickos">
<!-- begin--顶部按钮-->
<div class="right-box-top-btns">
<button id="dc-del" type="button" v-if="currentDc.id != '' && rightBox.isEdit" @click="del" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-style-light nz-btn-min-width-82">
<button id="dc-del" type="button" v-if="currentDc.id" @click="del" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-style-light">
<span class="right-box-top-btn-icon"><i class="el-icon-delete"></i></span>
<span class="right-box-top-btn-txt">{{$t('overall.delete')}}</span>
</button>
<button v-if="!rightBox.isEdit" id="dc-save" type="button" @click="saveOrToEdit" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-style-light nz-btn-min-width-82">
<span class="right-box-top-btn-icon"><i class="nz-icon nz-icon-edit"></i></span>
<span class="right-box-top-btn-txt">{{$t('overall.edit')}}</span>
</button>
</div>
<!-- end--顶部按钮-->
<!-- begin--标题-->
<div class="right-box-title">{{rightBox.title}}</div>
<div class="right-box-title">{{}}</div>
<!-- end--标题-->
<!-- begin--表单-->
@@ -73,12 +68,9 @@
</div>
</div>
</transition>
</template>
<script>
import {noSpecialChar} from "../js/validate";
export default {
name: "dcBox",
props: {

View File

@@ -325,7 +325,7 @@
})
},
add() {
this.cleanUser();
this.user = this.newUser();
this.rightBox.show = true;
},
statusChange(user) {
@@ -350,8 +350,8 @@
esc() {
this.rightBox.show = false;
},
cleanUser() {
this.user = JSON.parse(JSON.stringify(this.blankUser));
newUser() {
return JSON.parse(JSON.stringify(this.blankUser));
},
pageNo(val) {
this.pageObj.pageNo = val;
@@ -374,12 +374,12 @@
},
// 数据排序
tableDataSort(item){
let orderBy='';
if(item.order==='ascending'){
orderBy=item.prop;
let orderBy = '';
if(item.order === 'ascending') {
orderBy = item.prop;
}
if(item.order==='descending'){
orderBy='-'+item.prop;
if(item.order === 'descending') {
orderBy = '-' + item.prop;
}
this.$set(this.searchLabel, "orderBy", orderBy);
this.getTableData();

View File

@@ -143,12 +143,13 @@
:table-title="tableTitle"
ref="elementset"
></element-set>
<transition name="right-box">
<dc-box ref="dcBox" :dc="currentDc" :user-data="userData" @reload="getTableData"></dc-box>
</transition>
<traffic-setting-box :dc-obj="currentDc" ref="trafficBox"></traffic-setting-box>
</div>
</template>
<script>
var vm;
import bus from '../../../libs/bus';
import trafficSettingBox from "../../common/rightBox/trafficSetting/trafficSettingBox";
export default {
@@ -157,7 +158,6 @@
'traffic-setting-box':trafficSettingBox,
},
data() {
vm = this;
return {
/*二级列表相关*/
targetTab: '', //展示二级列表中的哪个页签
@@ -177,7 +177,8 @@
showTopBtn: false,
mainTableHeight: this.$tableHeight.normal, //主列表table高度
loading: false,
currentDc: {
dc: {},
blankDc: {
id: '',
name: '',
location: '',
@@ -321,22 +322,23 @@
if (!tempDc.area) {
this.$set(tempDc, 'area', {id: '', name: ''});
}
//this.currentDc = tempDc;
//this.$refs.dcBox.show(true, false);
this.cabinetDc = tempDc;
this.targetTab = "detail";
this.showSubList = true;
},
// 全屏
fullScreen() {
let vm = this;
this.$bottomBoxWindow.fullScreen(vm);
},
// 退出全屏
exitFullScreen() {
let vm = this;
this.$bottomBoxWindow.exitFullScreen(vm);
},
// 鼠标拖动二级列表
listResize(e) {
let vm = this;
this.$bottomBoxWindow.listResize(vm, e);
},
convertToDetail(obj) {
@@ -358,19 +360,12 @@
detail.push({label: this.$t("asset.createAssetTab.principal"), value: principal});
return detail;
},
toAdd() {
this.currentDc = {
id: '',
name: '',
location: '',
tel: '',
principal: '',
area: {
id: '',
name: ''
}
add() {
this.dc = this.newDc();
this.rightBox.show = true;
},
this.$refs.dcBox.show(true, true);
newDc() {
return JSON.parse(JSON.stringify(this.blankDc));
},
del: function (u) {
this.$confirm(this.$t("tip.confirmDelete"), {
@@ -401,11 +396,14 @@
})
},
getUserData() {
return new Promise(resolve => {
this.$get('sys/user/list', {pageSize: -1, pageNo: 1}).then(response => {
if (response.code === 200) {
this.userData = response.data.list;
}
})
resolve();
});
});
},
pageNo(val) {
this.pageObj.pageNo = val;
@@ -416,10 +414,10 @@
this.pageObj.pageSize = val;
this.getTableData();
},
search: function (searchObj) {
let orderBy='';
if(this.searchLabel.orderBy){
orderBy=this.searchLabel.orderBy
search(searchObj) {
let orderBy = '';
if(this.searchLabel.orderBy) {
orderBy = this.searchLabel.orderBy;
}
this.searchLabel = {};
this.pageObj.pageNo = 1;
@@ -433,20 +431,14 @@
}
this.getTableData();
},
showCabinet:function(dc){
//this.currentShowDc=dc;
//this.tabShow=2;
showCabinet(dc) {
this.targetTab = 'cabinet';
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)*/
},
//是否需要排序
sortableShow(prop){
switch(prop){
sortableShow(prop) {
switch(prop) {
case 'id':
case 'name':
case 'area':
@@ -465,12 +457,12 @@
},
// 数据排序
tableDataSort(item){
let orderBy='';
if(item.order==='ascending'){
orderBy=item.prop;
let orderBy = '';
if(item.order === 'ascending'){
orderBy = item.prop;
}
if(item.order==='descending'){
orderBy='-'+item.prop;
if(item.order === 'descending'){
orderBy = '-' + item.prop;
}
this.$set(this.searchLabel, "orderBy", orderBy);
this.getTableData();

View File

@@ -338,7 +338,7 @@
this.showSubList = true;
},
add() {
this.cleanPromServer();
this.promServer = this.newPromServer();
this.rightBox.show = true;
},
closeRightBox(refresh) {
@@ -378,8 +378,8 @@
}
})
},
cleanPromServer() {
this.promServer = JSON.parse(JSON.stringify(this.blankPromServer));
newPromServer() {
return JSON.parse(JSON.stringify(this.blankPromServer));
},
pageNo(val) {
this.pageObj.pageNo = val;
@@ -443,12 +443,12 @@
},
// 数据排序
tableDataSort(item){
let orderBy='';
if(item.order==='ascending'){
orderBy=item.prop;
let orderBy = '';
if(item.order === 'ascending') {
orderBy = item.prop;
}
if(item.order==='descending'){
orderBy='-'+item.prop;
if(item.order === 'descending') {
orderBy = '-' + item.prop;
}
this.$set(this.searchLabel, "orderBy", orderBy);
this.getTableData();