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> <template>
<transition name="right-box"> <div class="right-box right-box-dc" v-clickoutside="clickos">
<div class="right-box right-box-dc" v-if="rightBox.show" v-clickoutside="clickos">
<!-- begin--顶部按钮--> <!-- begin--顶部按钮-->
<div class="right-box-top-btns"> <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-icon"><i class="el-icon-delete"></i></span>
<span class="right-box-top-btn-txt">{{$t('overall.delete')}}</span> <span class="right-box-top-btn-txt">{{$t('overall.delete')}}</span>
</button> </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> </div>
<!-- end--顶部按钮--> <!-- end--顶部按钮-->
<!-- begin--标题--> <!-- begin--标题-->
<div class="right-box-title">{{rightBox.title}}</div> <div class="right-box-title">{{}}</div>
<!-- end--标题--> <!-- end--标题-->
<!-- begin--表单--> <!-- begin--表单-->
@@ -73,12 +68,9 @@
</div> </div>
</div> </div>
</transition>
</template> </template>
<script> <script>
import {noSpecialChar} from "../js/validate";
export default { export default {
name: "dcBox", name: "dcBox",
props: { props: {

View File

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

View File

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

View File

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