2019-11-29 15:00:26 +08:00
|
|
|
|
<template>
|
2020-01-19 18:31:18 +08:00
|
|
|
|
<div class="asset" ref="asset">
|
2020-04-14 19:33:57 +08:00
|
|
|
|
<left-menu >
|
|
|
|
|
|
<div slot="content-left" class="slot-content">
|
2020-03-09 18:05:43 +08:00
|
|
|
|
<div class="sidebar-title">{{$t('asset.asset')}}</div>
|
2020-04-07 22:30:36 +08:00
|
|
|
|
<div class="sidebar-info" style="height: 90%">
|
|
|
|
|
|
<el-scrollbar ref="leftScrollbar" style="height: 100%">
|
2020-07-15 10:58:45 +08:00
|
|
|
|
<el-collapse v-model="activeType" class="left-menu-bg">
|
|
|
|
|
|
<el-collapse-item name="dataCenter" :title="$t('asset.left.dataCenter')">
|
|
|
|
|
|
<el-checkbox-group v-model="checkList" size="small" @change="changeCheckBox">
|
|
|
|
|
|
<el-checkbox class="sidebar-info-item" :class="{'sidebar-info-item-active': indOf(checkList, item.id)}"
|
|
|
|
|
|
v-for="(item,key) in checkListData" :key="key" :label=item.id>
|
|
|
|
|
|
<div class="sidebar-info-item-txt">
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<el-popover v-if="item.name.length > 14" trigger="hover" placement="top-start" :content="item.name" >
|
2020-07-15 10:58:45 +08:00
|
|
|
|
<span slot="reference">{{item.name}}</span>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
<span v-else>{{item.name}}</span>
|
2020-04-01 21:45:05 +08:00
|
|
|
|
</div>
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<el-badge class="mark" :value="item.total" max="99"/>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</el-checkbox>
|
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
|
</el-collapse-item>
|
|
|
|
|
|
<el-collapse-item name="assetType" :title="$t('asset.left.assetType')">
|
|
|
|
|
|
<el-checkbox-group v-model="assetTypeCheckList" size="small" @change="changeAssetTypeCheckBox">
|
|
|
|
|
|
<el-checkbox class="sidebar-info-item" :class="{'sidebar-info-item-active': indOf(assetTypeCheckList, item.id)}" v-for="(item,key) in assetTypeCheckListData" :key="key" :label=item.id>
|
|
|
|
|
|
<div class="sidebar-info-item-txt">
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<el-popover v-if="item.name.length > 14" trigger="hover" placement="top-start" :content="item.name" >
|
|
|
|
|
|
<span slot="reference">{{item.name}}</span>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</el-popover>
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<span v-else>{{item.name}}</span>
|
2020-04-01 21:45:05 +08:00
|
|
|
|
</div>
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<el-badge class="mark" :value="item.total" max="99"/>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</el-checkbox>
|
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
|
</el-collapse-item>
|
|
|
|
|
|
<el-collapse-item name="vendor" :title="$t('asset.left.vendor')">
|
|
|
|
|
|
<el-checkbox-group v-model="vendorCheckList" size="small" @change="changeVendorCheckBox">
|
|
|
|
|
|
<el-checkbox class="sidebar-info-item" :class="{'sidebar-info-item-active': indOf(vendorCheckList, item.id)}" v-for="(item,key) in vendorCheckListData" :key="key" :label=item.id>
|
|
|
|
|
|
<div class="sidebar-info-item-txt">
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<el-popover v-if="item.name.length > 14" trigger="hover" placement="top-start" :content="item.name" >
|
|
|
|
|
|
<span slot="reference">{{item.name}}</span>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</el-popover>
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<span v-else>{{item.name}}</span>
|
2020-04-01 21:45:05 +08:00
|
|
|
|
</div>
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<el-badge class="mark" :value="item.total" max="99"/>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</el-checkbox>
|
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
|
</el-collapse-item>
|
|
|
|
|
|
<el-collapse-item name="ping" :title="$t('asset.left.ping')">
|
|
|
|
|
|
<el-checkbox-group v-model="pingCheckList" size="small" @change="changePingCheckBox">
|
|
|
|
|
|
<el-checkbox class="sidebar-info-item" :class="{'sidebar-info-item-active': indOf(pingCheckList, item.value)}" v-for="(item,key) in pingCheckListData" :key="key" :label=item.value>
|
|
|
|
|
|
<div class="sidebar-info-item-txt">
|
|
|
|
|
|
<el-popover v-if="item.label.length > 16" trigger="hover" placement="top-start" :content="item.label" >
|
|
|
|
|
|
<span slot="reference">{{item.label}}</span>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
<span v-else>{{item.label}}</span>
|
2020-04-01 21:45:05 +08:00
|
|
|
|
</div>
|
2020-07-17 19:00:00 +08:00
|
|
|
|
<el-badge class="mark" :value="item.total" max="99"/>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</el-checkbox>
|
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
|
</el-collapse-item>
|
|
|
|
|
|
</el-collapse>
|
|
|
|
|
|
</el-scrollbar>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div slot="content-right" class="slot-content">
|
|
|
|
|
|
<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 margin-r-20"><search-input :searchMsg="searchMsg" @search="search" :inTransform="inTransform"></search-input></div>
|
|
|
|
|
|
<export-excel
|
|
|
|
|
|
export-file-name="asset"
|
|
|
|
|
|
export-url="/asset/export"
|
|
|
|
|
|
import-url="/asset/import"
|
|
|
|
|
|
:params="searchLabel"
|
|
|
|
|
|
@afterImport="getAssetData"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot="optionZone">
|
|
|
|
|
|
<button @click.stop="tagShow('showAdd')" :title="$t('overall.createAsset')" class="nz-btn nz-btn-size-normal nz-btn-style-light" id="asset-create-asset">
|
|
|
|
|
|
<i class="nz-icon nz-icon-create-square"></i></button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</export-excel>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="pagination-top pagination-top-hide display-none"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2020-04-01 21:45:05 +08:00
|
|
|
|
<el-table
|
|
|
|
|
|
class="nz-table"
|
|
|
|
|
|
:height="mainTableHeight"
|
|
|
|
|
|
style="width: 100%;"
|
|
|
|
|
|
:data="tableData"
|
2020-04-19 21:48:03 +08:00
|
|
|
|
v-scrollBar:el-table="'large'"
|
2020-04-01 21:45:05 +08:00
|
|
|
|
v-show="mainResizeShow"
|
|
|
|
|
|
border
|
2020-04-19 21:48:03 +08:00
|
|
|
|
v-loading="loading"
|
2020-04-01 21:45:05 +08:00
|
|
|
|
tooltip-effect="light"
|
|
|
|
|
|
ref="assetTable"
|
2020-04-25 10:47:21 +08:00
|
|
|
|
:cell-class-name="messageStyle"
|
2020-07-15 18:32:25 +08:00
|
|
|
|
@sort-change="tableDataSort"
|
2020-04-01 21:45:05 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
v-for="(item, index) in tablelable"
|
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
|
:width="item.width"
|
|
|
|
|
|
:key="`col_${index}`"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
|
:show-overflow-tooltip="item.prop != 'Alert' || item.prop != 'Module'"
|
|
|
|
|
|
min-width="110px"
|
|
|
|
|
|
:class-name="item.prop == 'option' ? 'content-right-options' : ''"
|
2020-07-15 18:32:25 +08:00
|
|
|
|
:sortable="sortableShow(item.prop)"
|
|
|
|
|
|
:prop="propTitle(item.prop)"
|
2020-04-01 21:45:05 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
|
|
|
|
|
<div v-if="item.prop=='ID'">
|
|
|
|
|
|
<span>{{scope.row.id}}</span>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</div>
|
2020-04-01 21:45:05 +08:00
|
|
|
|
<div v-if="item.prop=='assetType'">
|
|
|
|
|
|
<span>{{scope.row.model.type.value}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<template v-if="item.prop=='SN'">{{scope.row.sn}}</template>
|
|
|
|
|
|
<div v-if="item.prop=='HOST'">
|
|
|
|
|
|
<span>{{scope.row.host}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="item.prop=='state'">
|
|
|
|
|
|
<span>{{scope.row.state==1 ? $t('asset.createAssetTab.inStock') : $t('asset.createAssetTab.notInStock')}}</span>
|
|
|
|
|
|
</div>
|
2020-03-24 19:22:24 +08:00
|
|
|
|
<div v-if="item.prop == 'pingStatus'">
|
|
|
|
|
|
<el-popover
|
|
|
|
|
|
placement="right"
|
|
|
|
|
|
width="200"
|
|
|
|
|
|
trigger="hover"
|
|
|
|
|
|
:content="formatPingTime(scope.row.pingLastUpdate)">
|
|
|
|
|
|
<div slot="reference" style="width: 20px">
|
|
|
|
|
|
<div :class="{'active-icon green':scope.row.pingState == 1,'active-icon red':scope.row.pingState == 0}"></div><span>{{scope.row.pingRtt?scope.row.pingRtt+'ms':''}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<template v-if="item.prop=='Module'">
|
2020-03-30 19:46:03 +08:00
|
|
|
|
<span class="link" @click="showEndpoint(scope.row)">{{scope.row.endpointNum}}</span>
|
2020-03-24 19:22:24 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-if="item.prop=='Alert'">
|
2020-07-14 18:11:57 +08:00
|
|
|
|
<span :id="'asset-alerts-'+scope.row.id" @click="jumpToAlertMsg(scope.row)" class="link">
|
|
|
|
|
|
{{(scope.row.alertNum < 99 ? scope.row.alertNum : 99)}}
|
|
|
|
|
|
<sup class="linkSup" v-if="scope.row.alertNum > 99">+</sup>
|
|
|
|
|
|
{{' ' + $t('overall.active')}}
|
|
|
|
|
|
</span>
|
2020-03-24 19:22:24 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<div v-if="item.prop=='dataCenter'">
|
|
|
|
|
|
<span >{{scope.row.idc.name}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<template v-if="item.prop=='cabinet'">
|
|
|
|
|
|
<span v-if="scope.row.cabinet&&scope.row.cabinet!='--'">{{returnData(scope.row.cabinet).name}}</span>
|
|
|
|
|
|
<span v-else >{{returnData(scope.row.cabinet)}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<div v-if="item.prop=='model'">
|
|
|
|
|
|
<span>{{scope.row.model.name}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="item.prop=='vendor'">
|
|
|
|
|
|
<span>{{scope.row.model.vendor.value}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="item.prop=='purchaseDate'">
|
|
|
|
|
|
<span>{{returnData(scope.row.purchaseDate)}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="item.prop=='principal'">
|
|
|
|
|
|
<span>{{getPrincipalName(scope.row.idc.principal)}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="item.prop=='tel'">
|
|
|
|
|
|
<span>{{scope.row.idc.tel}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<template v-if="item.prop == 'option'">
|
2020-03-28 20:44:29 +08:00
|
|
|
|
<span :title="$t('overall.view')" @click.stop="tagShow('showView',scope.row)" class="content-right-option" :id="'asset-detail-'+scope.row.id"><i
|
2020-03-24 19:22:24 +08:00
|
|
|
|
class="el-icon-view"></i>
|
|
|
|
|
|
</span>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
|
|
|
|
|
|
<span :title="$t('overall.edit')" @click.stop="tagShow('showEdit',scope.row)" class="content-right-option" :id="'asset-edit-'+scope.row.id"><i
|
|
|
|
|
|
class="nz-icon nz-icon-edit"></i>
|
2020-04-09 19:35:37 +08:00
|
|
|
|
</span>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
|
|
|
|
|
|
<span :title="$t('overall.delete')" @click.stop="deleteData('asset',scope.row.id)" class="content-right-option" :id="'asset-del-'+scope.row.id"><i
|
|
|
|
|
|
class="el-icon-delete"></i>
|
2020-04-09 19:35:37 +08:00
|
|
|
|
</span>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
|
|
|
|
|
|
<el-dropdown trigger="hover" @command="cli">
|
2020-06-23 18:46:52 +08:00
|
|
|
|
<span title="CLI" class="content-right-option" :id="'asset-ssh-'+scope.row.id"><i
|
|
|
|
|
|
class="nz-icon nz-icon-cli" :class="{'gray-filter': !scope.row.accounts || scope.row.accounts.length == 0}"></i>
|
|
|
|
|
|
</span>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
|
<el-dropdown-item v-for="(account, index) in scope.row.accounts" v-if="account && account.protocol != 'SNMP'" :key="index" :command="[scope.row.id ,scope.row.host, account]">{{account.protocol}}</el-dropdown-item>
|
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
</el-dropdown>
|
2020-06-23 18:46:52 +08:00
|
|
|
|
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</template>
|
2020-01-19 18:31:18 +08:00
|
|
|
|
</template>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column width="28" fixed="right" :resizable="false">
|
|
|
|
|
|
<template slot="header" slot-scope="scope">
|
2020-03-24 19:22:24 +08:00
|
|
|
|
<span @click.stop="elementsetShow('shezhi',$event)" class="nz-table-gear">
|
|
|
|
|
|
<i class="nz-icon nz-icon-gear"></i>
|
2020-01-06 20:57:49 +08:00
|
|
|
|
</span>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot="scope">
|
|
|
|
|
|
<button v-if="scope.$index == 0" class="to-top" :style="{top: toTopBtnTop}" :class="{'to-top-is-hover': tableHover}" v-show="showTopBtn && mainResizeShow" @click="$toTop('ps', 0)"><i class="nz-icon nz-icon-top"></i></button>
|
|
|
|
|
|
</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>
|
|
|
|
|
|
</div>
|
2020-03-24 19:22:24 +08:00
|
|
|
|
</div>
|
2020-07-15 10:58:45 +08:00
|
|
|
|
<transition name="el-zoom-in-bottom">
|
|
|
|
|
|
<bottom-box v-if="showSubList" :show-sub-list="showSubList" :subResizeShow="subResizeShow" :obj="alertMsgAsset" :isFullScreen="isFullScreen" :from="'asset'" :targetTab.sync="targetTab" :detail="assetDetail"
|
|
|
|
|
|
@reload="getAssetData"
|
|
|
|
|
|
@closeSubList="showSubList = false"
|
|
|
|
|
|
@fullScreen="fullScreen"
|
|
|
|
|
|
@exitFullScreen="exitFullScreen"
|
|
|
|
|
|
@listResize="listResize" ></bottom-box>
|
|
|
|
|
|
</transition>
|
2020-03-24 19:22:24 +08:00
|
|
|
|
</div>
|
2020-04-14 19:33:57 +08:00
|
|
|
|
</left-menu>
|
2020-01-06 20:57:49 +08:00
|
|
|
|
|
2020-07-06 19:49:04 +08:00
|
|
|
|
<asset-box :edit-unit-show='editUnitShow' @refreshData="flushData" @sendStateData="tabControl" v-if="rightBox.show"
|
2020-07-15 10:58:45 +08:00
|
|
|
|
ref="assetEditUnit"></asset-box>
|
2020-01-08 22:19:46 +08:00
|
|
|
|
<element-set
|
2020-03-24 19:22:24 +08:00
|
|
|
|
v-if="showElementSet"
|
|
|
|
|
|
@close="elementsetHide"
|
2020-01-08 22:19:46 +08:00
|
|
|
|
v-clickoutside="elementsetHide"
|
2020-01-16 15:48:49 +08:00
|
|
|
|
:drop-col="dropCol"
|
|
|
|
|
|
:table-title="tableTitle"
|
2020-01-08 22:19:46 +08:00
|
|
|
|
@tablelable="tablelabelEmit"
|
|
|
|
|
|
ref="elementset"
|
|
|
|
|
|
></element-set>
|
2020-01-09 19:30:43 +08:00
|
|
|
|
<module-box :module="module" @reload="getAssetData" ref="moduleBox"></module-box>
|
2020-01-02 18:13:01 +08:00
|
|
|
|
</div>
|
2019-11-29 15:00:26 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-02-11 11:30:56 +08:00
|
|
|
|
import bus from "../../../libs/bus";
|
2020-02-26 15:38:56 +08:00
|
|
|
|
import exportXLSX from "../../common/exportXLSX";
|
2020-02-28 08:29:52 +08:00
|
|
|
|
import endpointStatusPop from "./endpointStatusPop";
|
2020-03-30 14:14:09 +08:00
|
|
|
|
var vm;
|
2020-01-02 18:13:01 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: "asset",
|
2020-02-28 08:29:52 +08:00
|
|
|
|
components:{
|
|
|
|
|
|
'export-excel':exportXLSX,
|
2020-03-02 17:44:52 +08:00
|
|
|
|
'endpoint-status-pop':endpointStatusPop,
|
2020-02-28 08:29:52 +08:00
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
data() {
|
2020-03-30 14:14:09 +08:00
|
|
|
|
vm = this;
|
2020-01-02 18:13:01 +08:00
|
|
|
|
return {
|
2020-04-19 21:48:03 +08:00
|
|
|
|
loading: false,
|
2020-03-28 20:44:29 +08:00
|
|
|
|
/*二级页面相关*/
|
2020-06-17 19:52:03 +08:00
|
|
|
|
assetDetail: {}, //asset详情
|
2020-03-24 19:22:24 +08:00
|
|
|
|
alertMsgAsset: {}, //告警信息对应的asset对象
|
|
|
|
|
|
showElementSet: false, //控制自定义列的弹框
|
|
|
|
|
|
inTransform: false, //搜索框相关,搜索条件下拉框是否在transform里
|
|
|
|
|
|
mainResizeShow: true, //dom高度改变时部分内容是否展示
|
|
|
|
|
|
subResizeShow: true,
|
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
|
mainTableHeight: this.$tableHeight.normal, //主列表table高度
|
|
|
|
|
|
showSubList: false, //是否展示二级列表
|
2020-03-28 20:44:29 +08:00
|
|
|
|
targetTab: '', //展示二级列表中的哪个页签
|
|
|
|
|
|
|
2020-04-21 18:00:21 +08:00
|
|
|
|
toTopBtnTop: this.$tableHeight.toTopBtnTop, //to-top按钮的top属性
|
|
|
|
|
|
tableHover: false, //控制滚动条和top按钮同时出现
|
2020-03-24 19:22:24 +08:00
|
|
|
|
showElementSet: false, //自定义列弹框是否显示
|
2020-03-13 12:20:02 +08:00
|
|
|
|
tableId: 'assetTable', //需要分页的table的id,用于记录每页数量
|
2020-01-03 18:10:26 +08:00
|
|
|
|
searchMsg: { //给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
|
searchLabelList: [{
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
name: 'ID',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'id',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
},{
|
|
|
|
|
|
id: 20,
|
|
|
|
|
|
name: 'SN',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'sn',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
},{
|
|
|
|
|
|
id: 21,
|
|
|
|
|
|
name: 'Host',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'host',
|
|
|
|
|
|
disabled: false
|
2020-01-09 14:57:44 +08:00
|
|
|
|
},{
|
|
|
|
|
|
id: 22,
|
|
|
|
|
|
name: this.$t("asset.createAssetTab.state"),
|
|
|
|
|
|
type: 'select',
|
|
|
|
|
|
label: 'assetState',
|
|
|
|
|
|
disabled: false
|
2020-02-06 17:44:07 +08:00
|
|
|
|
},{
|
2020-05-19 18:22:22 +08:00
|
|
|
|
id: 23,
|
2020-02-06 17:44:07 +08:00
|
|
|
|
name: "pingStatus",
|
|
|
|
|
|
type: 'select',
|
|
|
|
|
|
label: 'pingStatus',
|
|
|
|
|
|
disabled: false
|
2020-01-03 18:10:26 +08:00
|
|
|
|
}],
|
|
|
|
|
|
},
|
2020-03-05 21:30:45 +08:00
|
|
|
|
showTopBtn: false,
|
2020-01-03 18:10:26 +08:00
|
|
|
|
searchLabel: {}, //搜索参数
|
2020-04-01 21:45:05 +08:00
|
|
|
|
activeType:'dataCenter',
|
2020-01-02 18:13:01 +08:00
|
|
|
|
checkList: [],
|
2020-04-01 21:45:05 +08:00
|
|
|
|
assetTypeCheckList:[],
|
|
|
|
|
|
vendorCheckList:[],
|
|
|
|
|
|
pingCheckList:[],
|
2020-01-08 22:19:46 +08:00
|
|
|
|
tablelable: [],
|
|
|
|
|
|
dropCol: [],
|
2020-01-02 18:13:01 +08:00
|
|
|
|
tableTitle: [
|
2020-02-17 18:41:38 +08:00
|
|
|
|
{
|
|
|
|
|
|
label: this.$t("asset.tableTitle.host"),
|
|
|
|
|
|
prop: 'HOST',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 130,
|
|
|
|
|
|
fixed:'left'
|
|
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
label: this.$t("asset.tableTitle.id"),
|
|
|
|
|
|
prop: 'ID',
|
2020-01-08 09:16:34 +08:00
|
|
|
|
show: true,
|
2020-01-19 18:31:18 +08:00
|
|
|
|
width: 110
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("asset.tableTitle.assetType"),
|
2020-01-16 15:48:49 +08:00
|
|
|
|
prop: 'assetType',
|
2020-01-02 18:13:01 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("asset.tableTitle.device"),
|
|
|
|
|
|
prop: 'SN',
|
|
|
|
|
|
show: true,
|
2020-01-17 16:06:35 +08:00
|
|
|
|
width: 130
|
2020-02-17 18:41:38 +08:00
|
|
|
|
}, {
|
2020-01-02 18:13:01 +08:00
|
|
|
|
label: this.$t("asset.tableTitle.assetState"),
|
2020-01-09 14:57:44 +08:00
|
|
|
|
prop: 'state',
|
2020-01-02 18:13:01 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
2020-02-06 17:44:07 +08:00
|
|
|
|
label:this.$t('asset.tableTitle.assetPing'),
|
2020-02-07 11:22:08 +08:00
|
|
|
|
prop:'pingStatus',
|
2020-02-06 17:44:07 +08:00
|
|
|
|
show:true,
|
|
|
|
|
|
},{
|
2020-01-10 20:09:33 +08:00
|
|
|
|
label: this.$t("asset.tableTitle.modules"),
|
2020-01-02 18:13:01 +08:00
|
|
|
|
prop: 'Module',
|
|
|
|
|
|
show: true,
|
2020-01-19 18:31:18 +08:00
|
|
|
|
width: 105
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}, {
|
2020-01-09 14:57:44 +08:00
|
|
|
|
label: this.$t("asset.tableTitle.alerts"),
|
2020-01-02 18:13:01 +08:00
|
|
|
|
prop: 'Alert',
|
|
|
|
|
|
show: true,
|
2020-03-24 19:22:24 +08:00
|
|
|
|
width: 80
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("asset.tableTitle.dataCenter"),
|
2020-01-09 14:57:44 +08:00
|
|
|
|
prop: 'dataCenter',
|
2020-01-02 18:13:01 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("asset.tableTitle.cabinet"),
|
2020-01-09 14:57:44 +08:00
|
|
|
|
prop: 'cabinet',
|
2020-01-02 18:13:01 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("asset.tableTitle.model"),
|
2020-01-09 14:57:44 +08:00
|
|
|
|
prop: 'model',
|
2020-01-02 18:13:01 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
2020-04-02 20:57:43 +08:00
|
|
|
|
label: this.$t("asset.tableTitle.vendor"),
|
2020-01-09 14:57:44 +08:00
|
|
|
|
prop: 'vendor',
|
2020-01-02 18:13:01 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("asset.tableTitle.procurementDate"),
|
2020-01-16 15:48:49 +08:00
|
|
|
|
prop: 'purchaseDate',
|
2020-04-14 19:33:57 +08:00
|
|
|
|
show: false,
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("asset.tableTitle.principal"),
|
2020-01-09 14:57:44 +08:00
|
|
|
|
prop: 'principal',
|
2020-02-28 08:29:52 +08:00
|
|
|
|
show: false,
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("asset.tableTitle.principalTel"),
|
2020-01-09 14:57:44 +08:00
|
|
|
|
prop: 'tel',
|
2020-02-28 08:29:52 +08:00
|
|
|
|
show: false,
|
2020-01-10 20:09:33 +08:00
|
|
|
|
width: 115
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.account.option'),
|
|
|
|
|
|
prop: 'option',
|
|
|
|
|
|
show: true,
|
2020-02-18 11:05:57 +08:00
|
|
|
|
width: 150,
|
2020-02-17 18:41:38 +08:00
|
|
|
|
fixed:'right'
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}],
|
|
|
|
|
|
tableData: [],
|
|
|
|
|
|
checkListData: [],
|
2020-04-01 21:45:05 +08:00
|
|
|
|
assetTypeCheckListData:[],
|
|
|
|
|
|
vendorCheckListData:[],
|
|
|
|
|
|
pingCheckListData:[],
|
2020-01-02 18:13:01 +08:00
|
|
|
|
IDCData: '',
|
|
|
|
|
|
IDCOptionData: [],
|
|
|
|
|
|
cabinetData: '',
|
|
|
|
|
|
cabinetOptionData: [],
|
|
|
|
|
|
input: '',
|
|
|
|
|
|
pageObj: {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
pageNo: 1,
|
2020-07-13 17:26:06 +08:00
|
|
|
|
pageSize: 50,
|
2020-01-02 18:13:01 +08:00
|
|
|
|
total: 0,
|
|
|
|
|
|
idcId: '',
|
|
|
|
|
|
idcIds: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
tabShow: false,
|
|
|
|
|
|
tabView: true,
|
|
|
|
|
|
tagType: 'add',
|
2020-01-09 19:30:43 +08:00
|
|
|
|
module: {},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
form: {
|
|
|
|
|
|
name: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
rightBox: { //弹出框相关
|
2019-12-12 17:07:33 +08:00
|
|
|
|
show: false,
|
2020-01-02 18:13:01 +08:00
|
|
|
|
isEdit: false, //false查看,true编辑
|
|
|
|
|
|
title: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
assetType: '',
|
|
|
|
|
|
idcSelectedData: {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
location: '',
|
|
|
|
|
|
principal: '',
|
|
|
|
|
|
tel: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
addIdcData: {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
popName: '',
|
|
|
|
|
|
location: '',
|
|
|
|
|
|
principal: '',
|
|
|
|
|
|
tel: ''
|
|
|
|
|
|
},
|
2020-02-06 12:35:29 +08:00
|
|
|
|
idcUserData: [],
|
2020-01-02 18:13:01 +08:00
|
|
|
|
modelCount: '',
|
|
|
|
|
|
isResourceShow: 0,
|
|
|
|
|
|
unitDisable: '',
|
|
|
|
|
|
modelClickData: '',
|
|
|
|
|
|
obj: null,
|
|
|
|
|
|
editUnitShow: false,
|
2020-01-13 21:42:14 +08:00
|
|
|
|
flag: false,
|
|
|
|
|
|
checkAllFlag: false,
|
2020-01-15 22:21:19 +08:00
|
|
|
|
checkAllHandler: false,
|
|
|
|
|
|
assetClick: false,
|
2020-04-09 16:14:32 +08:00
|
|
|
|
assetPingSwitch:localStorage.getItem('nz-sys-asset-ping-switch'),
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
2019-12-26 17:28:04 +08:00
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
getData() {
|
|
|
|
|
|
return this.$store.state.assetData
|
2019-12-06 15:53:50 +08:00
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
getFlushData() {
|
|
|
|
|
|
return this.$store.state.flushDataSign
|
|
|
|
|
|
}
|
2019-12-06 15:53:50 +08:00
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
getData: {
|
2020-01-08 09:16:34 +08:00
|
|
|
|
handler(newVal) {
|
2020-01-15 22:21:19 +08:00
|
|
|
|
if (newVal.type == 1) {
|
2020-04-01 21:45:05 +08:00
|
|
|
|
this.activeType='dataCenter'
|
2020-01-15 22:21:19 +08:00
|
|
|
|
this.checkList = newVal.selectedData;
|
|
|
|
|
|
this.assetClick = false;
|
2020-01-08 09:16:34 +08:00
|
|
|
|
}
|
2020-01-02 18:13:01 +08:00
|
|
|
|
},
|
2020-01-15 22:21:19 +08:00
|
|
|
|
immediate: true,
|
2020-01-02 18:13:01 +08:00
|
|
|
|
deep: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
getFlushData: {
|
|
|
|
|
|
handler(newVal, oldVal) {
|
|
|
|
|
|
if (newVal === true) {
|
2020-07-17 19:00:00 +08:00
|
|
|
|
this.getLeftMenuList();
|
2020-01-02 18:13:01 +08:00
|
|
|
|
this.getAssetData()
|
|
|
|
|
|
}
|
2019-12-18 16:55:49 +08:00
|
|
|
|
}
|
2020-01-02 18:13:01 +08:00
|
|
|
|
},
|
2020-01-15 22:21:19 +08:00
|
|
|
|
checkList(n, o) {
|
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
|
if (n.length > 0 ) {
|
|
|
|
|
|
this.pageObj.idcIds = n.join(',');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.pageObj.idcIds = '';
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.assetClick) {
|
|
|
|
|
|
this.$store.state.assetData = {selectedData: n, step: this.$store.state.assetData.step+1, type: 0};
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.getSingleAsset();
|
|
|
|
|
|
}
|
|
|
|
|
|
this.getAssetData();
|
|
|
|
|
|
}, 50);
|
2020-03-24 19:22:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
showSubList(n) {
|
2020-03-30 14:14:09 +08:00
|
|
|
|
this.$bottomBoxWindow.showSubListWatch(vm, n);
|
2020-03-28 20:44:29 +08:00
|
|
|
|
},
|
|
|
|
|
|
alertMsgAsset: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler(n) {
|
|
|
|
|
|
this.assetDetail = this.convertToDetail(n);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2019-12-18 16:55:49 +08:00
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
methods: {
|
2020-03-30 14:14:09 +08:00
|
|
|
|
fullScreen() {
|
|
|
|
|
|
this.$bottomBoxWindow.fullScreen(vm);
|
2020-03-24 19:22:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
exitFullScreen() {
|
2020-03-30 14:14:09 +08:00
|
|
|
|
this.$bottomBoxWindow.exitFullScreen(vm);
|
2020-03-24 19:22:24 +08:00
|
|
|
|
},
|
2020-03-30 14:14:09 +08:00
|
|
|
|
listResize(e) {
|
|
|
|
|
|
this.$bottomBoxWindow.listResize(vm, e);
|
2020-03-24 19:22:24 +08:00
|
|
|
|
},
|
2020-01-13 21:42:14 +08:00
|
|
|
|
dcSelectAll(val) { //DC全选
|
2020-01-10 20:09:33 +08:00
|
|
|
|
if (this.checkListData.length > 0) {
|
2020-01-13 21:42:14 +08:00
|
|
|
|
this.checkList = [];
|
|
|
|
|
|
if (val) {
|
2020-01-10 20:09:33 +08:00
|
|
|
|
for (let i = 0; i < this.checkListData.length; i++) {
|
|
|
|
|
|
this.checkList.push(this.checkListData[i].id);
|
2020-01-15 09:51:52 +08:00
|
|
|
|
this.$store.commit('assetItemIdChange',this.checkListData[i].id)
|
2020-01-10 20:09:33 +08:00
|
|
|
|
}
|
2020-01-15 09:51:52 +08:00
|
|
|
|
this.$store.commit('assetAllIdChange',this.checkListData)
|
2020-01-10 20:09:33 +08:00
|
|
|
|
}
|
2020-01-13 21:42:14 +08:00
|
|
|
|
this.checkAllHandler = false;
|
2020-01-10 20:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-01-09 19:30:43 +08:00
|
|
|
|
openModuleBox(module) {
|
2020-01-19 18:31:18 +08:00
|
|
|
|
if (module.param) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
let tempObj = JSON.parse(module.param);
|
|
|
|
|
|
this.$set(module, 'paramObj', []);
|
|
|
|
|
|
for (let k in tempObj) {
|
|
|
|
|
|
module.paramObj.push({key: k, value: tempObj[k]});
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.info(module, err);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-01-09 19:30:43 +08:00
|
|
|
|
this.module = module;
|
|
|
|
|
|
this.$refs.moduleBox.show(true);
|
|
|
|
|
|
},
|
|
|
|
|
|
getAssetModuleList(id) {
|
|
|
|
|
|
this.$refs['moduleListPop' + id][0].getModuleList();
|
|
|
|
|
|
},
|
2020-01-08 22:19:46 +08:00
|
|
|
|
elementsetShow(s, e) {
|
2020-03-24 19:22:24 +08:00
|
|
|
|
this.showElementSet = true;
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
var eventfixed = {
|
|
|
|
|
|
shezhi: 0,
|
|
|
|
|
|
screen: 0
|
|
|
|
|
|
};
|
|
|
|
|
|
eventfixed[s] = 1;
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
this.$store.commit('setHeaderTable', this.tablelable);
|
|
|
|
|
|
this.$store.commit('setEventfixed', eventfixed);
|
|
|
|
|
|
const h = document.documentElement.clientHeight;
|
|
|
|
|
|
const w = document.documentElement.clientWidth;
|
|
|
|
|
|
const dw = this.$refs.elementset.$el.offsetWidth;
|
|
|
|
|
|
const dh = this.$refs.elementset.$el.offsetHeight;
|
|
|
|
|
|
let positionx =
|
|
|
|
|
|
e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
|
|
|
|
|
|
let positiony =
|
|
|
|
|
|
e.clientY + dh <= h - 10
|
|
|
|
|
|
? e.clientY + 20
|
|
|
|
|
|
: e.clientY + 20 - (e.clientY + dh - h);
|
|
|
|
|
|
this.$store.commit('setPosition', { positionx, positiony });
|
|
|
|
|
|
});
|
2020-01-08 22:19:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
elementsetHide() {
|
|
|
|
|
|
//悬浮点击空白隐藏
|
|
|
|
|
|
this.$refs.elementset.elementsetHide();
|
|
|
|
|
|
},
|
|
|
|
|
|
tablelabelEmit(data) {
|
|
|
|
|
|
//获取子组件传过来的参数
|
|
|
|
|
|
this.$store.commit('setHeaderTable', data);
|
|
|
|
|
|
this.tablelable = data;
|
|
|
|
|
|
},
|
2020-06-23 18:46:52 +08:00
|
|
|
|
cli([id,host,account]){
|
2020-03-09 19:47:15 +08:00
|
|
|
|
const consoleParam = {
|
2020-06-23 18:46:52 +08:00
|
|
|
|
id: id,
|
|
|
|
|
|
host: host,
|
|
|
|
|
|
accountId: account.id,
|
|
|
|
|
|
port: account.port,
|
2020-03-09 19:47:15 +08:00
|
|
|
|
}
|
2020-06-23 18:46:52 +08:00
|
|
|
|
this.$store.commit('addConsole', consoleParam);
|
2020-03-09 19:47:15 +08:00
|
|
|
|
//this.$refs.webSsh.show(id,host,accountId,port);
|
2020-03-02 17:44:52 +08:00
|
|
|
|
},
|
2020-03-24 19:22:24 +08:00
|
|
|
|
jumpToAlertMsg(asset) {
|
2020-03-28 20:44:29 +08:00
|
|
|
|
this.targetTab = 'alertMessage';
|
2020-03-24 19:22:24 +08:00
|
|
|
|
this.alertMsgAsset = JSON.parse(JSON.stringify(asset));
|
|
|
|
|
|
this.showSubList = true;
|
2020-03-31 17:22:15 +08:00
|
|
|
|
/*this.$nextTick(() => {
|
|
|
|
|
|
this.$store.commit("assetForAlertListChange", this.$store.state.assetForAlertList+1);
|
|
|
|
|
|
});*/
|
2020-01-10 20:09:33 +08:00
|
|
|
|
},
|
2020-01-09 14:57:44 +08:00
|
|
|
|
getAssetData(data, flushRightBoxDc) {
|
|
|
|
|
|
this.searchLabel = Object.assign(this.searchLabel, this.pageObj);
|
2020-04-19 21:48:03 +08:00
|
|
|
|
this.loading = true;
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.$get('asset', this.searchLabel).then(response => {
|
2020-04-19 21:48:03 +08:00
|
|
|
|
this.loading = false;
|
2020-01-02 18:13:01 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.tableData = response.data.list;
|
|
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
|
}
|
2020-01-09 14:57:44 +08:00
|
|
|
|
});
|
|
|
|
|
|
if (flushRightBoxDc) {
|
|
|
|
|
|
this.$refs.assetAddUnit.getIDCOptionData();
|
|
|
|
|
|
this.$refs.assetEditUnit.getIDCOptionData();
|
|
|
|
|
|
}
|
2020-01-02 18:13:01 +08:00
|
|
|
|
},
|
2020-07-17 19:00:00 +08:00
|
|
|
|
// getIDCOptionData() {
|
|
|
|
|
|
// this.$get('idc').then(response => {
|
|
|
|
|
|
// if (response.code === 200) {
|
|
|
|
|
|
// // console.log(response.data);
|
|
|
|
|
|
// // this.checkListData = this.IDCOptionData = response.data.list;
|
|
|
|
|
|
// // this.markOptionData(this.IDCOptionData)
|
|
|
|
|
|
// }
|
|
|
|
|
|
// })
|
|
|
|
|
|
// },
|
2020-04-01 21:45:05 +08:00
|
|
|
|
getPingData:function(){
|
|
|
|
|
|
this.pingCheckListData=[
|
|
|
|
|
|
{label:'up',value:1},
|
2020-04-02 20:57:43 +08:00
|
|
|
|
{label:'down',value:0},
|
2020-04-01 21:45:05 +08:00
|
|
|
|
]
|
|
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
getUserData() {
|
|
|
|
|
|
this.$get('sys/user/list').then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.idcUserData = response.data.list
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2020-04-25 10:47:21 +08:00
|
|
|
|
messageStyle(e) {
|
|
|
|
|
|
if (e.column.label == this.$t("asset.tableTitle.alerts")) {
|
|
|
|
|
|
if (e.row.alertNum > 0) {
|
2020-04-25 12:07:36 +08:00
|
|
|
|
return 'danger';
|
2020-04-25 10:47:21 +08:00
|
|
|
|
} else {
|
2020-04-25 12:07:36 +08:00
|
|
|
|
return 'success';
|
2020-04-25 10:47:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return '';
|
|
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
editData(data, item) {
|
|
|
|
|
|
if (data === 'idc') {
|
|
|
|
|
|
item.name = this.addIdcData.popName
|
2019-12-23 10:16:36 +08:00
|
|
|
|
}
|
2020-01-02 18:13:01 +08:00
|
|
|
|
this.$put(data, item).then(res => {
|
2019-12-12 17:07:33 +08:00
|
|
|
|
if (res.code === 200) {
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
|
2020-01-02 18:13:01 +08:00
|
|
|
|
this.getAssetData();
|
|
|
|
|
|
} else {
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.$message.error(res.msg);
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
addNewData(type) {
|
|
|
|
|
|
if (type === 'IDC') {
|
|
|
|
|
|
this.$post('idc', this.addIdcData).then(res => {
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
const h = this.$createElement;
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
|
2020-07-17 19:00:00 +08:00
|
|
|
|
this.getLeftMenuList()
|
2020-01-02 18:13:01 +08:00
|
|
|
|
this.getAssetData()
|
|
|
|
|
|
} else {
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.$message.error(res.msg);
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
deleteData(data, item) {
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.$confirm(this.$t("tip.assetConfirmDelete"), {
|
|
|
|
|
|
confirmButtonText: this.$t("tip.yes"),
|
|
|
|
|
|
cancelButtonText: this.$t("tip.no"),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this.$delete(data + "?ids=" + item).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
|
|
|
|
|
this.getAssetData();
|
2020-07-17 19:00:00 +08:00
|
|
|
|
this.getLeftMenuList();
|
2020-01-08 09:16:34 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
});
|
2020-01-02 18:13:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
markOptionData(data) {
|
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
|
this.$set(item, 'isEdit', false);
|
|
|
|
|
|
this.$set(item, 'oldName', item.value);
|
|
|
|
|
|
this.$set(item, item.name, false)
|
|
|
|
|
|
this.$set(item, item.id, false)
|
|
|
|
|
|
this.$set(item, item.id + item.name, false)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
editOptionData(item) {
|
|
|
|
|
|
if (!item.isEdit) {
|
|
|
|
|
|
item.isEdit = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (item.name !== item.oldName) {
|
|
|
|
|
|
item.isEdit = false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
item.isEdit = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
delOptionData(data) {
|
|
|
|
|
|
},
|
|
|
|
|
|
tabControl(data) {
|
|
|
|
|
|
if (data === 'close') {
|
2020-07-06 19:49:04 +08:00
|
|
|
|
this.editUnitShow = false;
|
|
|
|
|
|
this.$refs['assetEditUnit'].tabView = false;
|
|
|
|
|
|
this.rightBox.show = false;
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-01-15 22:21:19 +08:00
|
|
|
|
indOf(a, b) {
|
|
|
|
|
|
let c = [];
|
|
|
|
|
|
for (let i = 0; i < a.length; i++) {
|
|
|
|
|
|
c.push(a[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (c.indexOf(b) > -1) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-03-30 19:46:03 +08:00
|
|
|
|
showEndpoint(asset) {
|
|
|
|
|
|
this.alertMsgAsset = Object.assign({}, asset);
|
|
|
|
|
|
this.targetTab = "endpoint";
|
|
|
|
|
|
this.showSubList = true;
|
|
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
tagShow(data, id, type) {
|
|
|
|
|
|
if (data === 'showAdd') {
|
2020-07-06 19:49:04 +08:00
|
|
|
|
this.rightBox.show = true;
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.editUnitShow = true;
|
|
|
|
|
|
this.$refs['assetEditUnit'].accountSwitch=false;
|
|
|
|
|
|
this.$refs['assetEditUnit'].getAssetData('');
|
|
|
|
|
|
this.$refs['assetEditUnit'].resetAsset();
|
|
|
|
|
|
});
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (data === 'showEdit') {
|
2020-07-06 19:49:04 +08:00
|
|
|
|
this.rightBox.show = true;
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.editUnitShow = true;
|
|
|
|
|
|
this.$refs['assetEditUnit'].accountSwitch=false;
|
|
|
|
|
|
this.$refs['assetEditUnit'].getAssetData(id)
|
|
|
|
|
|
});
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (data === 'showView') {
|
2020-03-28 20:44:29 +08:00
|
|
|
|
this.alertMsgAsset = Object.assign({}, id);
|
2020-05-20 19:30:22 +08:00
|
|
|
|
this.targetTab = "panel";
|
2020-03-28 20:44:29 +08:00
|
|
|
|
this.showSubList = true;
|
|
|
|
|
|
/*this.editUnitShow = true
|
2020-01-02 18:13:01 +08:00
|
|
|
|
this.$refs['assetEditUnit'].getAssetData(id)
|
2020-03-28 20:44:29 +08:00
|
|
|
|
this.$refs['assetEditUnit'].tabView = true*/
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
editing() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
getSingleIDCData(data, item) {
|
|
|
|
|
|
if (item !== 'edit') {
|
|
|
|
|
|
this.idcSelectedData = '';
|
|
|
|
|
|
this.IDCOptionData.forEach(item => {
|
|
|
|
|
|
if (item.id === data) {
|
|
|
|
|
|
this.idcSelectedData = item
|
|
|
|
|
|
}
|
2019-12-13 16:43:24 +08:00
|
|
|
|
});
|
2020-01-07 17:54:45 +08:00
|
|
|
|
return
|
2019-12-18 16:55:49 +08:00
|
|
|
|
} else {
|
2020-01-02 18:13:01 +08:00
|
|
|
|
this.IDCOptionData.forEach(item => {
|
|
|
|
|
|
if (item.id === data) {
|
2020-01-07 17:54:45 +08:00
|
|
|
|
this.addIdcData.id = item.id;
|
|
|
|
|
|
this.addIdcData.name = item.name;
|
|
|
|
|
|
this.addIdcData.popName = item.name;
|
|
|
|
|
|
this.addIdcData.location = item.location;
|
|
|
|
|
|
this.addIdcData.principal = item.principal;
|
|
|
|
|
|
this.addIdcData.tel = item.tel;
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
2019-12-18 16:55:49 +08:00
|
|
|
|
});
|
2019-12-13 16:43:24 +08:00
|
|
|
|
}
|
2020-01-15 22:21:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
changeCheckBox() {
|
|
|
|
|
|
this.assetClick = true;
|
|
|
|
|
|
this.getSingleAsset();
|
|
|
|
|
|
},
|
2020-04-01 21:45:05 +08:00
|
|
|
|
changeAssetTypeCheckBox:function(){
|
|
|
|
|
|
if(this.assetTypeCheckList && this.assetTypeCheckList.length > 0){
|
|
|
|
|
|
let assetTypeIds=this.assetTypeCheckList.join(',');
|
|
|
|
|
|
this.pageObj.typeIds=assetTypeIds;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
this.pageObj.typeIds='';
|
|
|
|
|
|
}
|
2020-04-02 20:57:43 +08:00
|
|
|
|
this.getAssetData();
|
2020-04-01 21:45:05 +08:00
|
|
|
|
},
|
|
|
|
|
|
changeVendorCheckBox:function(){
|
|
|
|
|
|
if(this.vendorCheckList && this.vendorCheckList.length > 0){
|
|
|
|
|
|
let vendorIds=this.vendorCheckList.join(',');
|
|
|
|
|
|
this.pageObj.vendorIds=vendorIds;
|
2020-04-02 20:57:43 +08:00
|
|
|
|
|
2020-04-01 21:45:05 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
this.pageObj.vendorIds='';
|
|
|
|
|
|
}
|
2020-04-02 20:57:43 +08:00
|
|
|
|
this.getAssetData();
|
2020-04-01 21:45:05 +08:00
|
|
|
|
},
|
|
|
|
|
|
changePingCheckBox:function(){
|
|
|
|
|
|
if(this.pingCheckList && this.pingCheckList.length > 0){
|
|
|
|
|
|
let pingStates=this.pingCheckList.join(',');
|
|
|
|
|
|
this.pageObj.pingStates=pingStates;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
this.pageObj.pingStates='';
|
|
|
|
|
|
}
|
2020-04-02 20:57:43 +08:00
|
|
|
|
this.getAssetData();
|
2020-04-01 21:45:05 +08:00
|
|
|
|
},
|
2020-01-08 09:16:34 +08:00
|
|
|
|
getSingleAsset() {
|
2020-01-13 21:42:14 +08:00
|
|
|
|
let checkedCount = this.checkList.length;
|
2020-01-15 22:21:19 +08:00
|
|
|
|
let allCount = this.checkListData.length;
|
|
|
|
|
|
this.checkAllFlag = ((checkedCount == allCount) && allCount > 0);
|
|
|
|
|
|
this.checkAllHandler = checkedCount > 0 && checkedCount < allCount;
|
2020-01-02 18:13:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
pageNo(val) {
|
|
|
|
|
|
this.pageObj.pageNo = val;
|
|
|
|
|
|
this.getAssetData()
|
2019-12-09 18:51:56 +08:00
|
|
|
|
}
|
2020-01-02 18:13:01 +08:00
|
|
|
|
,
|
|
|
|
|
|
pageSize(val) {
|
|
|
|
|
|
this.pageObj.pageSize = val;
|
2020-03-13 12:20:02 +08:00
|
|
|
|
localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val);
|
2020-03-13 19:12:54 +08:00
|
|
|
|
this.getAssetData();
|
2020-01-02 18:13:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
getPrincipalName(data) {
|
|
|
|
|
|
for (let item in this.idcUserData) {
|
|
|
|
|
|
if (this.idcUserData[item].userId === data) {
|
|
|
|
|
|
return this.idcUserData[item].username
|
2019-12-23 10:16:36 +08:00
|
|
|
|
}
|
2019-12-18 16:55:49 +08:00
|
|
|
|
}
|
2020-01-02 18:13:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
returnData(data) {
|
|
|
|
|
|
if (data && data !== '--') {
|
2020-02-17 18:41:38 +08:00
|
|
|
|
return data;
|
2020-01-02 18:13:01 +08:00
|
|
|
|
} else if (data === '--') {
|
2020-02-17 18:41:38 +08:00
|
|
|
|
return '--';
|
2020-01-02 18:13:01 +08:00
|
|
|
|
} else {
|
2020-02-17 18:41:38 +08:00
|
|
|
|
return "--";
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
flushData() {
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.getSingleAsset();
|
2020-01-02 18:13:01 +08:00
|
|
|
|
this.getAssetData();
|
|
|
|
|
|
},
|
2020-01-10 18:16:25 +08:00
|
|
|
|
closeAllPop:function(){
|
|
|
|
|
|
this.$refs.idcConfigBox.forEach((item)=>{
|
|
|
|
|
|
item.show(false)
|
|
|
|
|
|
})
|
|
|
|
|
|
this.$refs.cabinetConfigBox.forEach((item)=>{
|
|
|
|
|
|
item.show(false)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2020-01-08 09:16:34 +08:00
|
|
|
|
search(searchObj) {
|
2020-07-15 18:32:25 +08:00
|
|
|
|
let orderBy='';
|
|
|
|
|
|
if(this.searchLabel.orderBy){
|
|
|
|
|
|
orderBy=this.searchLabel.orderBy
|
|
|
|
|
|
}
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.searchLabel = {};
|
2020-01-09 14:57:44 +08:00
|
|
|
|
this.pageObj.pageNo = 1;
|
2020-01-08 09:16:34 +08:00
|
|
|
|
for (let item in searchObj) {
|
|
|
|
|
|
if (searchObj[item]) {
|
|
|
|
|
|
this.$set(this.searchLabel, item, searchObj[item]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-07-15 18:32:25 +08:00
|
|
|
|
if(orderBy){
|
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', orderBy);
|
|
|
|
|
|
}
|
2020-01-08 09:16:34 +08:00
|
|
|
|
this.getAssetData();
|
2020-02-26 15:38:56 +08:00
|
|
|
|
},
|
2020-03-28 20:44:29 +08:00
|
|
|
|
convertToDetail(obj) {
|
2020-06-17 19:52:03 +08:00
|
|
|
|
let detail = JSON.parse(JSON.stringify(obj));
|
|
|
|
|
|
detail.state = obj.state == 1 ? this.$t('asset.createAssetTab.inStock'): this.$t('asset.createAssetTab.notInStock');
|
|
|
|
|
|
detail.assetType = obj.model.type.value;
|
|
|
|
|
|
detail.vendorModel = obj.model.vendor.value + " " + obj.model.name;
|
|
|
|
|
|
detail.dataCenter = obj.idc ? obj.idc.name : "";
|
|
|
|
|
|
detail.location = obj.idc ? obj.idc.location : "";
|
|
|
|
|
|
detail.principal = obj.idc ? this.getPrincipalName(obj.idc.principal) : "";
|
|
|
|
|
|
detail.tel = obj.idc ? obj.idc.tel : "";
|
|
|
|
|
|
detail.cabinet = obj.cabinet ? obj.cabinet.name : "";
|
|
|
|
|
|
detail.uSize = obj.cabinet ? obj.cabinet.uSize : "";
|
|
|
|
|
|
detail.remark = obj.idc ? obj.idc.remark : "";
|
|
|
|
|
|
if (obj.accounts.length > 0) {
|
|
|
|
|
|
let account = obj.accounts[0];
|
|
|
|
|
|
detail.protocol = account.protocol;
|
|
|
|
|
|
detail.account = account.user;
|
|
|
|
|
|
let loginType = "";
|
|
|
|
|
|
if (account.authType == 1) {
|
|
|
|
|
|
loginType = this.$t('asset.createAssetTab.password');
|
|
|
|
|
|
} else if (account.authType == 2) {
|
|
|
|
|
|
loginType = this.$t('asset.createAssetTab.ssh');
|
|
|
|
|
|
}
|
|
|
|
|
|
detail.loginType = loginType;
|
|
|
|
|
|
detail.port = account.port;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*detail.push({label: this.$t("asset.createAssetTab.sn"), value: obj.sn});
|
2020-03-28 20:44:29 +08:00
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.host"), value: obj.host});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.state"), value: obj.state == 1 ? this.$t('asset.createAssetTab.inStock'): this.$t('asset.createAssetTab.notInStock')});
|
|
|
|
|
|
detail.push({label: this.$t("asset.tableTitle.modules"), value: obj.endpointNum});
|
|
|
|
|
|
detail.push({label: this.$t("asset.tableTitle.alerts"), value: obj.alertNum});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.assetType"), value: obj.model.type.value});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.vendorModel"), value: obj.model.vendor.value + " " + obj.model.name});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.purchaseDate"), value: obj.purchaseDate});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.dcName"), value: obj.idc ? obj.idc.name : ""});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.location"), value: obj.idc ? obj.idc.location : ""});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.principal"), value: obj.idc ? this.getPrincipalName(obj.idc.principal) : ""});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.tel"), value: obj.idc ? obj.idc.tel : ""});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.cabinet"), value: obj.cabinet ? obj.cabinet.name : ""});
|
|
|
|
|
|
detail.push({label: this.$t("asset.editAssetTab.uSize"), value: obj.cabinet ? obj.cabinet.uSize : ""});
|
|
|
|
|
|
detail.push({label: this.$t("asset.editAssetTab.remark"), value: obj.idc ? obj.idc.remark : ""});
|
|
|
|
|
|
if (obj.accounts.length > 0) {
|
|
|
|
|
|
let account = obj.accounts[0];
|
|
|
|
|
|
if (account.protocol == 'SSH') {
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.protocol"), value: 'SSH'});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.account"), value: account.user});
|
|
|
|
|
|
let loginType = "";
|
|
|
|
|
|
if (account.authType == 1) {
|
|
|
|
|
|
loginType = this.$t('asset.createAssetTab.password');
|
|
|
|
|
|
} else if (account.authType == 2) {
|
|
|
|
|
|
loginType = this.$t('asset.createAssetTab.ssh');
|
|
|
|
|
|
}
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.loginType"), value: loginType});
|
|
|
|
|
|
} else if (account.protocol == 'TELNET') {
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.protocol"), value: 'TELNET'});
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.account"), value: account.user});
|
|
|
|
|
|
}
|
|
|
|
|
|
detail.push({label: this.$t("asset.createAssetTab.port"), value: account.port});
|
2020-06-17 19:52:03 +08:00
|
|
|
|
}*/
|
2020-03-28 20:44:29 +08:00
|
|
|
|
return detail;
|
|
|
|
|
|
},
|
2020-02-26 15:38:56 +08:00
|
|
|
|
formatPingTime:function(str){
|
|
|
|
|
|
if(!str || str == ''){
|
2020-03-27 17:39:26 +08:00
|
|
|
|
return this.$t('asset.assetStatPre')+this.$t('asset.assetStatDown');
|
2020-02-26 15:38:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
let ds='-';
|
|
|
|
|
|
let ts=':';
|
|
|
|
|
|
let time=new Date(str);
|
|
|
|
|
|
let year=time.getFullYear();
|
|
|
|
|
|
let month=time.getMonth()+1 > 9 ? time.getMonth()+1 : ('0'+(time.getMonth()+1));
|
2020-04-27 19:00:36 +08:00
|
|
|
|
let day=time.getDate() > 9 ? time.getDate():('0'+time.getDate());
|
2020-02-26 15:38:56 +08:00
|
|
|
|
let hours=time.getHours() > 9? time.getHours():('0'+time.getHours());
|
|
|
|
|
|
let minutes=time.getMinutes() > 9 ?time.getMinutes():('0'+time.getMinutes());
|
|
|
|
|
|
let seconds=time.getSeconds() > 9 ? time.getSeconds():('0'+time.getSeconds());
|
2020-03-27 17:39:26 +08:00
|
|
|
|
return this.$t('asset.assetStatPre')+year+ds+month+ds+day+' '+hours+ts+minutes+ts+seconds;
|
2020-02-26 15:38:56 +08:00
|
|
|
|
|
2020-07-15 18:32:25 +08:00
|
|
|
|
},
|
|
|
|
|
|
//是否需要排序
|
|
|
|
|
|
sortableShow(prop){
|
|
|
|
|
|
switch(prop){
|
|
|
|
|
|
case 'ID':
|
|
|
|
|
|
case 'HOST':
|
|
|
|
|
|
case 'SN':
|
|
|
|
|
|
case 'purchaseDate':
|
|
|
|
|
|
return'custom';
|
|
|
|
|
|
default : return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// prop字段
|
|
|
|
|
|
propTitle(prop){
|
|
|
|
|
|
switch(prop){
|
|
|
|
|
|
case 'ID': return'ass.id';
|
|
|
|
|
|
case 'HOST': return'ass.host';
|
|
|
|
|
|
case 'SN': return'ass.sn';
|
|
|
|
|
|
case 'purchaseDate': return'ass.purchase_date';
|
|
|
|
|
|
default : return prop;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 数据排序
|
|
|
|
|
|
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.getAssetData();
|
2020-07-17 19:00:00 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 获取左侧菜单数据
|
|
|
|
|
|
getLeftMenuList(){
|
|
|
|
|
|
this.$get('asset/filter').then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
|
//dc
|
|
|
|
|
|
this.checkListData = this.IDCOptionData = response.data.dc;
|
|
|
|
|
|
this.markOptionData(this.IDCOptionData);
|
|
|
|
|
|
// AssetType
|
|
|
|
|
|
this.assetTypeCheckListData = response.data.assetType;
|
|
|
|
|
|
// vendor
|
|
|
|
|
|
this.vendorCheckListData = response.data.vendor;
|
|
|
|
|
|
// ping
|
|
|
|
|
|
this.pingCheckListData= response.data.ping.map(item=>{
|
|
|
|
|
|
item.label=item.name;
|
|
|
|
|
|
item.value=item.status;
|
|
|
|
|
|
return item
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2019-12-23 10:16:36 +08:00
|
|
|
|
},
|
2020-02-06 17:44:07 +08:00
|
|
|
|
created() {
|
|
|
|
|
|
this.getUserData();
|
2020-05-22 15:21:41 +08:00
|
|
|
|
this.flushData();
|
2020-04-01 21:45:05 +08:00
|
|
|
|
this.getPingData();
|
2020-02-06 17:44:07 +08:00
|
|
|
|
},
|
2020-01-02 18:13:01 +08:00
|
|
|
|
mounted() {
|
2020-07-17 19:00:00 +08:00
|
|
|
|
this.getLeftMenuList()//获取左侧菜单列表
|
2020-03-13 12:20:02 +08:00
|
|
|
|
//是否存在分页缓存
|
|
|
|
|
|
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
|
2020-03-20 18:22:44 +08:00
|
|
|
|
if (pageSize != 'undefined' && pageSize != null) {
|
2020-03-13 12:20:02 +08:00
|
|
|
|
this.pageObj.pageSize = pageSize
|
|
|
|
|
|
}
|
2020-03-04 21:27:41 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
//左侧dc列表初始选中状态
|
2020-01-15 22:21:19 +08:00
|
|
|
|
if (this.$store.state.assetData.selectedData.length > 0) {
|
|
|
|
|
|
this.checkList = [];
|
|
|
|
|
|
this.checkList = this.$store.state.assetData.selectedData;
|
|
|
|
|
|
}
|
2020-03-05 21:30:45 +08:00
|
|
|
|
//绑定滚动条事件,控制top按钮
|
|
|
|
|
|
let el = this.$refs.assetTable.$el.querySelector(".el-table__body-wrapper");
|
|
|
|
|
|
if (el._ps_) {
|
|
|
|
|
|
el.addEventListener("ps-scroll-y", () => {
|
2020-03-06 17:53:36 +08:00
|
|
|
|
if (el._ps_.scrollbarYTop > 50) {
|
2020-03-05 21:30:45 +08:00
|
|
|
|
this.showTopBtn = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.showTopBtn = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2020-04-21 18:00:21 +08:00
|
|
|
|
el.addEventListener("mouseenter", () => {
|
|
|
|
|
|
this.tableHover = true;
|
|
|
|
|
|
});
|
|
|
|
|
|
el.addEventListener("mouseleave", () => {
|
|
|
|
|
|
this.tableHover = false;
|
|
|
|
|
|
});
|
2020-03-05 21:30:45 +08:00
|
|
|
|
}
|
2020-03-09 18:05:43 +08:00
|
|
|
|
//resize时刷新左侧列表滚动条
|
|
|
|
|
|
let _this = this;
|
2020-04-09 16:14:32 +08:00
|
|
|
|
window.onresize = function () {
|
2020-03-09 18:05:43 +08:00
|
|
|
|
_this.$refs.leftScrollbar.update();
|
2020-04-16 21:34:44 +08:00
|
|
|
|
el._ps_.update();
|
|
|
|
|
|
};
|
2020-03-04 21:27:41 +08:00
|
|
|
|
});
|
2020-04-09 16:14:32 +08:00
|
|
|
|
let localStorageTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path);
|
2020-01-16 15:48:49 +08:00
|
|
|
|
this.tablelable = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle;
|
2020-04-09 16:14:32 +08:00
|
|
|
|
// this.assetPingSwit
|
2020-04-21 18:48:09 +08:00
|
|
|
|
|
2020-04-09 16:14:32 +08:00
|
|
|
|
if (this.assetPingSwitch == 'off') {
|
2020-04-21 18:48:09 +08:00
|
|
|
|
|
2020-04-09 16:14:32 +08:00
|
|
|
|
for (let i in this.tablelable) {
|
|
|
|
|
|
let label = this.tablelable[i];
|
|
|
|
|
|
|
|
|
|
|
|
if (label.prop == 'pingStatus') {
|
2020-07-15 10:58:45 +08:00
|
|
|
|
this.tablelable.splice(i, 1);
|
2020-04-09 16:14:32 +08:00
|
|
|
|
console.log(this.tablelable)
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-01-16 15:48:49 +08:00
|
|
|
|
this.dropCol = localStorageTitle ? JSON.parse(localStorageTitle) : this.tableTitle;
|
2020-03-09 18:05:43 +08:00
|
|
|
|
},
|
|
|
|
|
|
destroyed() {
|
|
|
|
|
|
window.onresize = null;
|
2019-12-27 17:08:39 +08:00
|
|
|
|
}
|
2019-12-04 13:45:37 +08:00
|
|
|
|
}
|
2019-11-29 15:00:26 +08:00
|
|
|
|
</script>
|
2019-12-04 13:45:37 +08:00
|
|
|
|
|
2020-01-13 21:42:14 +08:00
|
|
|
|
<style scoped lang="scss">
|
2020-01-03 18:10:26 +08:00
|
|
|
|
.asset {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
2020-01-02 18:13:01 +08:00
|
|
|
|
.tab-input-square {
|
2020-01-10 20:09:33 +08:00
|
|
|
|
border: 1px solid #606266;
|
2020-01-09 19:30:43 +08:00
|
|
|
|
height: 22px;
|
|
|
|
|
|
width: 50px;
|
2019-12-09 18:51:56 +08:00
|
|
|
|
border-radius: 3px;
|
2019-12-04 13:45:37 +08:00
|
|
|
|
text-align: center;
|
2020-01-09 19:30:43 +08:00
|
|
|
|
line-height: 20px;
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
2020-01-10 20:09:33 +08:00
|
|
|
|
.tab-input-square-high {
|
|
|
|
|
|
border: 1px solid #1166bb;
|
|
|
|
|
|
}
|
2020-07-14 18:11:57 +08:00
|
|
|
|
/deep/ .el-table .cell.el-tooltip{
|
|
|
|
|
|
min-width: 88px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.linkSup{
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: -15px;
|
|
|
|
|
|
left: 17px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.link{
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
2020-07-17 19:00:00 +08:00
|
|
|
|
/deep/ .el-badge__content{
|
|
|
|
|
|
width: 15px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.mark{
|
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
}
|
|
|
|
|
|
/*/deep/ .sidebar-info-item .el-checkbox__label{*/
|
|
|
|
|
|
/*padding-right: 15px;*/
|
|
|
|
|
|
/*width: calc(100% - 32px);*/
|
|
|
|
|
|
/*}*/
|
2020-01-02 18:13:01 +08:00
|
|
|
|
</style>
|