2021-04-07 09:58:34 +08:00
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
@import '@/assets/css/common/tableCommon.scss';
|
2020-02-21 17:57:19 +08:00
|
|
|
|
</style>
|
|
|
|
|
|
<template>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
<div class="dc list-page">
|
2020-07-16 17:33:20 +08:00
|
|
|
|
<!--dc table start-->
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div class="main-list" :class="{'main-list-with-sub': bottomBox.showSubList}">
|
|
|
|
|
|
<div class="main-modal"></div>
|
|
|
|
|
|
<div class="top-tools" v-show="bottomBox.mainResizeShow">
|
2020-10-30 12:49:30 +08:00
|
|
|
|
<div class="top-tool-main-right" :class="{'top-tool-main-right-to-left-small': bottomBox.showSubList}">
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div class="top-tool-search">
|
|
|
|
|
|
<search-input ref="searchInput" :searchMsg="searchMsg" @search="search" :inTransform="bottomBox.inTransform"></search-input>
|
2020-03-02 19:47:57 +08:00
|
|
|
|
</div>
|
2020-12-08 21:53:37 +08:00
|
|
|
|
<button :title="$t('overall.createDatacenter')" @click="add" type="button" v-has="'dc_toAdd'"
|
2021-04-07 09:58:34 +08:00
|
|
|
|
id="dc-add" class="top-tool-btn margin-l-20">
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<i class="nz-icon-create-square nz-icon"></i>
|
|
|
|
|
|
</button>
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<delete-button :delete-objs="batchDeleteObjs" @before="delFlag=true" @after="getTableData" api="idc" v-has="'dc_delete'" id="dc-list-batch-delete"></delete-button>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
<button id="account-column-setting" class="top-tool-btn margin-l-10"
|
|
|
|
|
|
type="button" @click="!tools.showCustomTableTitle && (tools.showCustomTableTitle = true)">
|
|
|
|
|
|
<i class="nz-icon-gear nz-icon"></i>
|
|
|
|
|
|
</button>
|
2020-07-16 17:33:20 +08:00
|
|
|
|
</div>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div class="pagination-top pagination-top-hide display-none"></div>
|
|
|
|
|
|
</div>
|
2020-08-04 21:53:06 +08:00
|
|
|
|
<!-- 自定义table列 -->
|
|
|
|
|
|
<transition name="el-zoom-in-top">
|
|
|
|
|
|
<element-set
|
2021-02-04 11:21:00 +08:00
|
|
|
|
id="dc-list"
|
2020-08-04 21:53:06 +08:00
|
|
|
|
v-if="tools.showCustomTableTitle"
|
|
|
|
|
|
@close="tools.showCustomTableTitle = false"
|
|
|
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
|
|
|
|
|
:original-table-title="tableTitle"
|
|
|
|
|
|
ref="customTableTitle"
|
|
|
|
|
|
></element-set>
|
|
|
|
|
|
</transition>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
<div class="nz-table2">
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
v-show="bottomBox.mainResizeShow"
|
|
|
|
|
|
id="dc-list-table"
|
|
|
|
|
|
ref="dcTable"
|
|
|
|
|
|
v-loading="tools.loading"
|
|
|
|
|
|
:cell-class-name="assetStatClassName"
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
:height="mainTableHeight"
|
|
|
|
|
|
border
|
|
|
|
|
|
tooltip-effect="light"
|
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
|
@selection-change="(selection)=>{this.batchDeleteObjs=selection}"
|
2020-08-02 22:43:53 +08:00
|
|
|
|
>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
type="selection"
|
|
|
|
|
|
width="55">
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
v-for="(item, index) in tools.customTableTitle"
|
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:prop="$tableSet.propTitle(item.prop,'dc')"
|
|
|
|
|
|
:resizable="true"
|
|
|
|
|
|
:sortable="sortableShow(item.prop,'dc')"
|
|
|
|
|
|
show-overflow-tooltip
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
|
|
|
|
|
<template v-if="item.prop == 'principal'">
|
|
|
|
|
|
<template v-if="scope.row.principal">
|
|
|
|
|
|
<template v-for="item in userData">
|
|
|
|
|
|
<template v-if="scope.row.principal == item.userId">{{item.username}}</template>
|
|
|
|
|
|
</template>
|
2020-03-25 18:38:13 +08:00
|
|
|
|
</template>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
<template v-else>-</template>
|
2020-02-21 17:57:19 +08:00
|
|
|
|
</template>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
<template v-else-if="item.prop == 'state'">
|
|
|
|
|
|
<el-switch
|
|
|
|
|
|
v-model="scope.row.state"
|
|
|
|
|
|
:disabled="!hasButton('dc_toEdit') || !hasButton('dc_toEdit')"
|
|
|
|
|
|
active-color="#ee9d3f"
|
|
|
|
|
|
active-value="ON"
|
|
|
|
|
|
inactive-value="OFF"
|
|
|
|
|
|
@change="(val)=>{statusChange(scope.row)}"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="item.prop == 'longitude'">
|
|
|
|
|
|
<template v-if="regNumTest(scope.row.longitude)">{{scope.row.longitude}}</template>
|
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="item.prop == 'latitude'">
|
|
|
|
|
|
<template v-if="regNumTest(scope.row.latitude)">{{scope.row.latitude}}</template>
|
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="item.prop == 'assetStat' && scope.row.assetStat">
|
|
|
|
|
|
<el-popover
|
|
|
|
|
|
:content="$t('overall.result.total') + ':' + scope.row.assetStat.total + ',' + $t('asset.inStock') + ':' + scope.row.assetStat.inStock + ',' + $t('asset.notInStock') + ':' + scope.row.assetStat.outStock + ',' + $t('asset.suspended') + ':' + scope.row.assetStat.suspended"
|
|
|
|
|
|
placement="top"
|
|
|
|
|
|
trigger="hover">
|
|
|
|
|
|
<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>
|
|
|
|
|
|
<span class="dc-asset-state dc-asset-state-suspended">{{scope.row.assetStat.suspended}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-popover>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
|
2021-04-07 09:58:34 +08:00
|
|
|
|
</template >
|
|
|
|
|
|
<template v-else-if="item.prop == 'cabinetNum'">
|
|
|
|
|
|
<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>
|
2020-07-16 17:33:20 +08:00
|
|
|
|
</template>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
</div>
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<button :class="{'to-top-is-hover': tools.tableHover}" :style="{top: tools.toTopBtnTop}" @click="toTop(scrollbarWrap)" class="to-top" v-show="tools.showTopBtn && bottomBox.mainResizeShow" id="dc-list-totop"><i class="nz-icon nz-icon-top"></i></button>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div class="pagination-bottom" v-show="!bottomBox.showSubList">
|
|
|
|
|
|
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
2020-03-25 18:38:13 +08:00
|
|
|
|
</div>
|
2020-02-21 17:57:19 +08:00
|
|
|
|
</div>
|
2020-10-15 19:28:43 +08:00
|
|
|
|
<transition name="el-zoom-in-bottom">
|
2020-12-08 21:53:37 +08:00
|
|
|
|
<bottom-box :detail="bottomBox.dcDetail" :from="$CONSTANTS.fromRoute.dc" :is-full-screen="bottomBox.isFullScreen" :obj="bottomBox.dc" :sub-resize-show="bottomBox.subResizeShow" :target-tab.sync="bottomBox.targetTab" v-if="bottomBox.showSubList"
|
2020-10-15 19:28:43 +08:00
|
|
|
|
@closeSubList="bottomBox.showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen" @listResize="listResize" ></bottom-box>
|
|
|
|
|
|
</transition>
|
2020-07-16 17:33:20 +08:00
|
|
|
|
<!--dc table end-->
|
|
|
|
|
|
<transition name="right-box">
|
|
|
|
|
|
<dc-box @close="closeDcBox" :dc="dc" :user-data="userData" @reload="getTableData" v-if="rightBox.dc.show"></dc-box>
|
|
|
|
|
|
</transition>
|
|
|
|
|
|
<transition name="right-box">
|
|
|
|
|
|
<traffic-setting-box @close="closeTrafficBox" :dc="dc" ref="trafficBox" v-if="rightBox.trafficSetting.show"></traffic-setting-box>
|
|
|
|
|
|
</transition>
|
2020-12-25 11:52:27 +08:00
|
|
|
|
<span v-if="dcDataRefresh" style="display: none"></span>
|
2020-07-16 17:33:20 +08:00
|
|
|
|
</div>
|
2020-02-21 17:57:19 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
2021-03-19 18:52:19 +08:00
|
|
|
|
import bus from '../../../libs/bus'
|
|
|
|
|
|
import dcBox from '../../common/rightBox/dcBox' // dc弹框
|
|
|
|
|
|
import trafficSettingBox from '../../common/rightBox/trafficSetting/trafficSettingBox'
|
|
|
|
|
|
import deleteButton from '../../common/deleteButton'
|
|
|
|
|
|
const regNum = /^[0-9]+.?[0-9]*/
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'dc',
|
|
|
|
|
|
components: {
|
|
|
|
|
|
'traffic-setting-box': trafficSettingBox,
|
|
|
|
|
|
'dc-box': dcBox,
|
|
|
|
|
|
'delete-button': deleteButton
|
|
|
|
|
|
},
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
/* 二级页面相关 */
|
|
|
|
|
|
bottomBox: {
|
|
|
|
|
|
dcDetail: {},
|
2020-07-15 22:11:33 +08:00
|
|
|
|
dc: {},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
mainResizeShow: true, // dom高度改变时是否展示|隐藏
|
|
|
|
|
|
subResizeShow: true,
|
|
|
|
|
|
isFullScreen: false, // 全屏状态
|
|
|
|
|
|
showSubList: false, // 是否显示二级列表
|
|
|
|
|
|
targetTab: '', // 显示二级列表中的哪个页签
|
|
|
|
|
|
inTransform: false // 搜索框相关,搜索条件下拉框是否在transform里
|
2020-12-25 11:52:27 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
mainTableHeight: this.$tableHeight.normal, // 主列表table高度
|
|
|
|
|
|
/* 工具参数 */
|
|
|
|
|
|
tools: {
|
|
|
|
|
|
loading: false, // 是否显示table加载动画
|
|
|
|
|
|
toTopBtnTop: this.$tableHeight.toTopBtnTop, // to-top按钮的top属性
|
|
|
|
|
|
tableHover: false, // 控制滚动条和top按钮同时出现
|
|
|
|
|
|
showTopBtn: false, // 显示To top按钮
|
|
|
|
|
|
showCustomTableTitle: false, // 自定义列弹框是否显示
|
|
|
|
|
|
customTableTitle: [] // 自定义列工具的数据
|
2020-04-16 18:49:55 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
batchDeleteObjs: [],
|
|
|
|
|
|
tableId: 'dcTable', // 需要分页的table的id,用于记录每页数量
|
|
|
|
|
|
dc: {},
|
|
|
|
|
|
blankDc: {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
location: '',
|
|
|
|
|
|
tel: '',
|
|
|
|
|
|
principal: '',
|
|
|
|
|
|
// area: {
|
|
|
|
|
|
// id: 0,
|
|
|
|
|
|
// name: ''
|
|
|
|
|
|
// }
|
|
|
|
|
|
state: 'ON',
|
|
|
|
|
|
longitude: undefined,
|
|
|
|
|
|
latitude: undefined
|
2020-02-21 17:57:19 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
rightBox: {
|
|
|
|
|
|
dc: { show: false },
|
|
|
|
|
|
trafficSetting: { show: false }
|
2020-02-21 17:57:19 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
pageObj: {
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: this.$CONSTANTS.defaultPageSize,
|
|
|
|
|
|
total: 0
|
2020-04-28 17:39:54 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
tableTitle: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'ID',
|
|
|
|
|
|
prop: 'id',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 80
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('overall.name'),
|
|
|
|
|
|
prop: 'name',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('asset.location'),
|
|
|
|
|
|
prop: 'location',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.dc.cabinetNum'),
|
|
|
|
|
|
prop: 'cabinetNum',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.dc.assets'),
|
|
|
|
|
|
prop: 'assetStat',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('asset.tel'),
|
|
|
|
|
|
prop: 'tel',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('asset.principal'),
|
|
|
|
|
|
prop: 'principal',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.dc.longitude'),
|
|
|
|
|
|
prop: 'longitude',
|
|
|
|
|
|
show: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.dc.latitude'),
|
|
|
|
|
|
prop: 'latitude',
|
|
|
|
|
|
show: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.dc.state'),
|
|
|
|
|
|
prop: 'state',
|
|
|
|
|
|
show: true
|
2020-02-24 20:27:14 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
tableData: [],
|
|
|
|
|
|
userData: [],
|
|
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
|
searchLabelList: [{
|
|
|
|
|
|
id: 10,
|
|
|
|
|
|
name: this.$t('overall.name'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'name',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}]
|
2020-03-30 14:14:09 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
searchLabel: {}, // 搜索参数
|
|
|
|
|
|
tabShow: 1, // 控制显示一级页面和二级页面 1 dc 2cabinet
|
|
|
|
|
|
scrollbarWrap: null,
|
|
|
|
|
|
delFlag: false
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
dcDataRefresh () { // 通过vuex更新dc 需要该属性到页面 否则不被监听
|
|
|
|
|
|
if (this.$store.getters.getDcDataRefresh) {
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
}
|
|
|
|
|
|
return this.$store.getters.getDcDataRefresh
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
assetStatClassName (param) {
|
|
|
|
|
|
if (param.column.label == this.$t('config.dc.assets')) {
|
|
|
|
|
|
return 'asset-state'
|
|
|
|
|
|
}
|
|
|
|
|
|
return ''
|
|
|
|
|
|
},
|
|
|
|
|
|
jumpTo (data, id) {
|
|
|
|
|
|
bus.$emit('menu-change', data)
|
|
|
|
|
|
this.$router.push({
|
|
|
|
|
|
path: '/' + data,
|
|
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
edit (u) {
|
|
|
|
|
|
this.dc = JSON.parse(JSON.stringify(u))
|
|
|
|
|
|
if (!regNum.test(this.dc.longitude)) {
|
|
|
|
|
|
this.dc.longitude = undefined
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!regNum.test(this.dc.latitude)) {
|
|
|
|
|
|
this.dc.latitude = undefined
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!this.dc.area) {
|
|
|
|
|
|
this.$set(this.dc, 'area', { id: '', name: '' })
|
|
|
|
|
|
}
|
|
|
|
|
|
this.rightBox.dc.show = true
|
|
|
|
|
|
},
|
|
|
|
|
|
configTraffic (u) {
|
|
|
|
|
|
this.dc = JSON.parse(JSON.stringify(u))
|
|
|
|
|
|
this.rightBox.trafficSetting.show = true
|
|
|
|
|
|
},
|
|
|
|
|
|
detail (u) {
|
|
|
|
|
|
this.bottomBox.dc = JSON.parse(JSON.stringify(u))
|
|
|
|
|
|
if (!this.bottomBox.dc.area) {
|
|
|
|
|
|
this.$set(this.bottomBox.dc, 'area', { id: '', name: '' })
|
|
|
|
|
|
}
|
|
|
|
|
|
this.bottomBox.targetTab = 'detail'
|
|
|
|
|
|
this.bottomBox.showSubList = true
|
|
|
|
|
|
},
|
|
|
|
|
|
// 全屏
|
|
|
|
|
|
fullScreen () {
|
|
|
|
|
|
const vm = this
|
|
|
|
|
|
this.$bottomBoxWindow.fullScreen(vm)
|
|
|
|
|
|
},
|
|
|
|
|
|
// 退出全屏
|
|
|
|
|
|
exitFullScreen () {
|
|
|
|
|
|
const vm = this
|
|
|
|
|
|
this.$bottomBoxWindow.exitFullScreen(vm)
|
|
|
|
|
|
},
|
|
|
|
|
|
// 鼠标拖动二级列表
|
|
|
|
|
|
listResize (e) {
|
|
|
|
|
|
const vm = this
|
|
|
|
|
|
this.$bottomBoxWindow.listResize(vm, e)
|
|
|
|
|
|
},
|
|
|
|
|
|
convertToDetail (obj) {
|
|
|
|
|
|
const detail = JSON.parse(JSON.stringify(obj))
|
|
|
|
|
|
return detail
|
|
|
|
|
|
/* let detail = [];
|
2020-03-27 15:41:26 +08:00
|
|
|
|
detail.push({label: this.$t("overall.name"), value: obj.name});
|
2020-03-28 20:44:29 +08:00
|
|
|
|
detail.push({label: this.$t("config.dc.area"), value: obj.area.name});
|
2020-07-24 19:22:52 +08:00
|
|
|
|
detail.push({label: this.$t("asset.location"), value: obj.location});
|
2020-03-28 20:44:29 +08:00
|
|
|
|
detail.push({label: this.$t("config.dc.cabinetNum"), value: obj.cabinetNum});
|
2020-07-24 19:22:52 +08:00
|
|
|
|
let assets = this.$t('overall.result.total') + ' ' + obj.assetStat.total + ',' + this.$t('asset.inStock') + ' ' + obj.assetStat.inStock + ',' + this.$t('asset.notInStock') + ' ' + obj.assetStat.outStock;
|
2020-03-28 20:44:29 +08:00
|
|
|
|
detail.push({label: this.$t("config.dc.assets"), value: assets});
|
2020-07-24 19:22:52 +08:00
|
|
|
|
detail.push({label: this.$t("asset.tel"), value: obj.tel});
|
2020-03-27 15:41:26 +08:00
|
|
|
|
let principal = '';
|
|
|
|
|
|
for (let i = 0; i < this.userData.length; i++) {
|
|
|
|
|
|
if (this.userData[i].userId == obj.principal) {
|
|
|
|
|
|
principal = this.userData[i].username;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-07-24 19:22:52 +08:00
|
|
|
|
detail.push({label: this.$t("asset.principal"), value: principal});
|
2021-03-19 18:52:19 +08:00
|
|
|
|
return detail; */
|
|
|
|
|
|
},
|
|
|
|
|
|
add () {
|
|
|
|
|
|
this.dc = this.newDc()
|
|
|
|
|
|
this.rightBox.dc.show = true
|
|
|
|
|
|
},
|
|
|
|
|
|
newDc () {
|
|
|
|
|
|
return JSON.parse(JSON.stringify(this.blankDc))
|
|
|
|
|
|
},
|
|
|
|
|
|
closeDcBox (refresh) {
|
|
|
|
|
|
this.rightBox.dc.show = false
|
|
|
|
|
|
if (refresh) {
|
|
|
|
|
|
this.delFlag = true
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
bus.$emit('dc-list-change')
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
closeTrafficBox (refresh) {
|
|
|
|
|
|
this.rightBox.trafficSetting.show = false
|
|
|
|
|
|
if (refresh) {
|
|
|
|
|
|
this.delFlag = true
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
del (u) {
|
|
|
|
|
|
this.$confirm(this.$t('tip.confirmDelete'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this.$delete('idc?ids=' + u.id).then(response => {
|
2020-11-11 14:30:34 +08:00
|
|
|
|
if (response.code === 200) {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.delFlag = true
|
|
|
|
|
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.deleteSuccess') })
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
bus.$emit('dc-list-change')
|
2020-11-11 14:30:34 +08:00
|
|
|
|
} else {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.$message.error(response.msg)
|
2020-02-21 17:57:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
statusChange (idc) {
|
|
|
|
|
|
this.$put('idc', idc).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.rightBox.show = false
|
|
|
|
|
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg)
|
2020-07-15 18:32:25 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.getTableData()
|
|
|
|
|
|
})
|
2020-03-25 18:38:13 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
getTableData () {
|
|
|
|
|
|
if (!this.hasButton('dc_view')) {
|
|
|
|
|
|
this.$message.error(this.$t('tip.noAccess'))
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
|
|
|
|
|
|
this.tools.loading = true
|
|
|
|
|
|
this.$get('idc', this.searchLabel).then(response => {
|
|
|
|
|
|
this.tools.loading = false
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.tableData = response.data.list
|
|
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
|
if (!this.scrollbarWrap) {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.scrollbarWrap = this.$refs.dcTable.bodyWrapper
|
|
|
|
|
|
this.toTopBtnHandler(this.scrollbarWrap)
|
|
|
|
|
|
})
|
2020-07-16 17:33:20 +08:00
|
|
|
|
}
|
2020-03-27 15:41:26 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
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
|
2020-12-31 17:41:40 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
pageNo (val) {
|
|
|
|
|
|
this.pageObj.pageNo = val
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
},
|
|
|
|
|
|
pageSize (val) {
|
|
|
|
|
|
localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val)
|
|
|
|
|
|
this.pageObj.pageSize = val
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
},
|
|
|
|
|
|
search (searchObj) {
|
|
|
|
|
|
let orderBy = ''
|
|
|
|
|
|
if (this.searchLabel.orderBy) {
|
|
|
|
|
|
orderBy = this.searchLabel.orderBy
|
|
|
|
|
|
}
|
|
|
|
|
|
this.searchLabel = {}
|
|
|
|
|
|
this.pageObj.pageNo = 1
|
|
|
|
|
|
for (const item in searchObj) {
|
|
|
|
|
|
if (searchObj[item]) {
|
|
|
|
|
|
this.$set(this.searchLabel, item, searchObj[item])
|
2020-12-29 15:38:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
if (orderBy) {
|
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', orderBy)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.$refs.dcTable && this.$refs.dcTable.bodyWrapper) {
|
|
|
|
|
|
this.$refs.dcTable.bodyWrapper.scrollTop = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
this.getTableData()
|
2020-02-21 17:57:19 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
showCabinet (dc) {
|
|
|
|
|
|
this.bottomBox.targetTab = 'cabinet'
|
|
|
|
|
|
this.bottomBox.dc = JSON.parse(JSON.stringify(dc))
|
|
|
|
|
|
this.bottomBox.showSubList = true
|
2020-11-20 10:15:17 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
sortableShow (label, form) {
|
|
|
|
|
|
if (label === 'state') {
|
|
|
|
|
|
return false
|
2020-11-21 12:21:27 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
return this.$tableSet.sortableShow(label, form)
|
2020-11-21 12:21:27 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// 数据排序
|
|
|
|
|
|
tableDataSort (item) {
|
|
|
|
|
|
let orderBy = ''
|
|
|
|
|
|
if (item.order === 'ascending') {
|
|
|
|
|
|
orderBy = item.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.order === 'descending') {
|
|
|
|
|
|
orderBy = '-' + item.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', orderBy)
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
},
|
|
|
|
|
|
regNumTest (val) { // 校验是否是数字
|
|
|
|
|
|
return regNum.test(val)
|
|
|
|
|
|
},
|
|
|
|
|
|
initEvent () {
|
|
|
|
|
|
bus.$on('dc-list-change', () => {
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
'bottomBox.dc': {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (n.id) {
|
|
|
|
|
|
this.bottomBox.dcDetail = this.convertToDetail(n)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-03-25 18:38:13 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
'bottomBox.showSubList': function (n) {
|
|
|
|
|
|
const vm = this
|
|
|
|
|
|
this.$bottomBoxWindow.showSubListWatch(vm, n)
|
2020-11-20 15:02:36 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
tableData: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (n.length === 0 && this.pageObj.pageNo > 1) {
|
|
|
|
|
|
this.pageNo(this.pageObj.pageNo - 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.delFlag) { // 不是删除时回到顶部
|
|
|
|
|
|
this.$refs.dcTable.bodyWrapper.scrollTop = 0
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.delFlag = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeDestroy () {
|
|
|
|
|
|
bus.$off('dc-list-change')
|
|
|
|
|
|
if (this.scrollbarWrap) {
|
|
|
|
|
|
this.scrollbarWrap.removeEventListener('scroll', bus.debounce)
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
created () {
|
|
|
|
|
|
// 是否存在分页缓存
|
|
|
|
|
|
const pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId)
|
|
|
|
|
|
if (pageSize != 'undefined' && pageSize != null) {
|
|
|
|
|
|
this.pageObj.pageSize = pageSize
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
destroyed () {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
|
|
|
|
|
this.getUserData()
|
|
|
|
|
|
// 初始化表头
|
|
|
|
|
|
this.tools.customTableTitle = localStorage.getItem('nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.$route.path)
|
|
|
|
|
|
? JSON.parse(localStorage.getItem('nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.$route.path))
|
|
|
|
|
|
: this.tableTitle
|
|
|
|
|
|
this.tableTitleReset(this.tableTitle, this.tools.customTableTitle)
|
|
|
|
|
|
this.getTableData()
|
2020-02-21 17:57:19 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
2020-02-21 17:57:19 +08:00
|
|
|
|
</script>
|
2020-10-12 13:46:31 +08:00
|
|
|
|
<style scoped>
|
2020-10-16 14:13:02 +08:00
|
|
|
|
/deep/ td .nz-icon-gear:before{
|
2020-10-12 13:46:31 +08:00
|
|
|
|
color: #606266;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|