2019-11-29 15:00:26 +08:00
|
|
|
|
<template>
|
2021-10-11 14:05:07 +08:00
|
|
|
|
<div>
|
2021-10-15 16:41:14 +08:00
|
|
|
|
<nzDetailView
|
2022-03-25 14:30:24 +08:00
|
|
|
|
v-my-loading="detailViewLoading || tools.loading"
|
2021-10-15 16:41:14 +08:00
|
|
|
|
v-if="detailType !== 'list'"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
ref="detailList"
|
|
|
|
|
|
:layout="dataListLayout"
|
|
|
|
|
|
:from="fromRoute.asset"
|
|
|
|
|
|
:search-msg="searchMsg"
|
|
|
|
|
|
:detailType="detailType"
|
|
|
|
|
|
:detailViewRightObj="detailViewRightObj"
|
2021-10-19 09:47:35 +08:00
|
|
|
|
:dataLength="tableData.length"
|
2021-10-15 16:41:14 +08:00
|
|
|
|
@search="search"
|
|
|
|
|
|
@changeDetailType="changeDetailType"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template v-slot:top-tool-left>
|
|
|
|
|
|
<detailViewTopSearch :selectValue.sync="selectValue" :detailSearchList="detailSearchList" @reload="reloadTable" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:top-tool-right>
|
2022-06-16 15:58:17 +08:00
|
|
|
|
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('asset.createAsset')" class="top-tool-btn" @click.stop="add">
|
2021-10-15 16:41:14 +08:00
|
|
|
|
<i class="nz-icon nz-icon-create-square"></i>
|
|
|
|
|
|
</button>
|
2021-11-02 15:47:17 +08:00
|
|
|
|
<top-tool-more-options
|
|
|
|
|
|
:delete-objs="batchDeleteObjs"
|
2021-10-15 16:41:14 +08:00
|
|
|
|
ref="export"
|
|
|
|
|
|
id="model"
|
|
|
|
|
|
:params="searchLabel"
|
|
|
|
|
|
:params2="searchCheckBox"
|
|
|
|
|
|
:permissions="{
|
|
|
|
|
|
import: 'asset_add',
|
2022-01-11 17:05:21 +08:00
|
|
|
|
export: 'asset_edit'
|
2021-10-15 16:41:14 +08:00
|
|
|
|
}"
|
|
|
|
|
|
class="top-tool-export margin-l-10 margin-r-10"
|
|
|
|
|
|
export-file-name="asset"
|
|
|
|
|
|
export-url="/asset/asset/export"
|
|
|
|
|
|
import-url="/asset/asset/import"
|
|
|
|
|
|
@afterImport="getTableData"
|
|
|
|
|
|
>
|
|
|
|
|
|
</top-tool-more-options>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:nz-detail-view-list>
|
|
|
|
|
|
<asset-detail
|
|
|
|
|
|
class="data-detail"
|
|
|
|
|
|
ref="dataDetail"
|
|
|
|
|
|
:orderByFa="orderBy"
|
2022-03-25 14:30:24 +08:00
|
|
|
|
v-my-loading="tools.loading"
|
2021-10-25 14:38:43 +08:00
|
|
|
|
:loading="tools.loading"
|
2021-10-15 16:41:14 +08:00
|
|
|
|
:detailViewRightObj="detailViewRightObj"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
|
@detailViewRightShow = 'detailViewRightShow'
|
|
|
|
|
|
@orderDetail="orderDetail"
|
|
|
|
|
|
>
|
|
|
|
|
|
</asset-detail>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
|
<template v-slot:pagination>
|
|
|
|
|
|
<el-pagination
|
|
|
|
|
|
@current-change="pageNo"
|
|
|
|
|
|
:current-page.sync="pageObj.pageNo"
|
|
|
|
|
|
:page-size="20"
|
|
|
|
|
|
:total="pageObj.total"
|
|
|
|
|
|
layout="prev, slot, next"
|
|
|
|
|
|
small
|
|
|
|
|
|
>
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<el-input-number ref="jumpInput" v-model="pageObj.pageNo" :controls="false" :min="1" :max="pageObj.pages" class="jump-input" @change="getTableData" @keyup.enter.native="getTableData" size="mini"/>
|
|
|
|
|
|
<span class="jump-pages">/ {{pageObj.pages}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-pagination>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</nzDetailView>
|
2021-04-22 12:25:23 +08:00
|
|
|
|
<nz-data-list
|
2022-03-25 14:30:24 +08:00
|
|
|
|
v-my-loading="detailViewLoading"
|
2022-03-01 15:19:43 +08:00
|
|
|
|
v-if="detailType === 'list'"
|
2021-04-22 12:25:23 +08:00
|
|
|
|
ref="dataList"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
2021-04-29 22:24:38 +08:00
|
|
|
|
:from="fromRoute.asset"
|
|
|
|
|
|
:layout="dataListLayout"
|
|
|
|
|
|
:search-msg="searchMsg"
|
2021-08-29 21:35:04 +08:00
|
|
|
|
:nz-table-height-offset="assetNzTableHeightOffset"
|
2021-04-29 22:24:38 +08:00
|
|
|
|
@search="search"
|
2021-10-11 14:05:07 +08:00
|
|
|
|
:detailType="detailType"
|
2021-10-09 16:47:38 +08:00
|
|
|
|
@changeDetailType="changeDetailType"
|
2021-07-29 16:23:15 +08:00
|
|
|
|
@getTableData="getTableData"
|
2021-04-29 22:24:38 +08:00
|
|
|
|
>
|
2021-04-22 12:25:23 +08:00
|
|
|
|
<template v-slot:top-tool-right>
|
2021-05-14 18:32:47 +08:00
|
|
|
|
<button id="asset-filter" :class="{ 'is-focus': dataListLayout.indexOf('clickSearch') > -1 }" class="top-tool-btn margin-r-10" @click.stop="showClickSearch">
|
|
|
|
|
|
<i class="nz-icon nz-icon-funnel"></i>
|
|
|
|
|
|
</button>
|
2022-06-16 15:58:17 +08:00
|
|
|
|
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('asset.createAsset')" class="top-tool-btn" @click.stop="add">
|
2021-05-14 17:09:57 +08:00
|
|
|
|
<i class="nz-icon nz-icon-create-square"></i>
|
2021-04-29 22:24:38 +08:00
|
|
|
|
</button>
|
2021-11-02 15:47:17 +08:00
|
|
|
|
<top-tool-more-options
|
|
|
|
|
|
:delete-objs="batchDeleteObjs"
|
2021-05-17 16:41:01 +08:00
|
|
|
|
ref="export"
|
2021-05-14 17:09:57 +08:00
|
|
|
|
id="model"
|
2021-05-17 16:41:01 +08:00
|
|
|
|
:params="searchLabel"
|
2021-07-16 09:56:18 +08:00
|
|
|
|
:params2="searchCheckBox"
|
2021-05-14 17:09:57 +08:00
|
|
|
|
:permissions="{
|
|
|
|
|
|
import: 'asset_add',
|
2022-01-11 17:05:21 +08:00
|
|
|
|
export: 'asset_edit'
|
2021-05-14 17:09:57 +08:00
|
|
|
|
}"
|
|
|
|
|
|
class="top-tool-export margin-l-10 margin-r-10"
|
2021-06-30 16:56:18 +08:00
|
|
|
|
export-file-name="asset"
|
2021-05-12 14:53:55 +08:00
|
|
|
|
export-url="/asset/asset/export"
|
|
|
|
|
|
import-url="/asset/asset/import"
|
2021-04-22 12:25:23 +08:00
|
|
|
|
@afterImport="getTableData"
|
2020-08-03 20:12:20 +08:00
|
|
|
|
>
|
2021-05-14 17:09:57 +08:00
|
|
|
|
<template v-slot:before>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-dropdown-item>
|
2021-11-03 18:09:56 +08:00
|
|
|
|
<div id="asset-batch-asset" v-has="'asset_edit'" @click="batchEdit"><i class="nz-icon nz-icon-batch-edit"></i>{{$t('overall.batchEdit')}}</div>
|
2021-05-14 17:09:57 +08:00
|
|
|
|
</el-dropdown-item>
|
2021-05-14 17:19:21 +08:00
|
|
|
|
<el-dropdown-item>
|
|
|
|
|
|
<delete-button :type="'link'" :title="$t('overall.batchDel')" id="asset-list-batch-delete" v-has="'asset_delete'" :api="url" :delete-objs="batchDeleteObjs" @after="getTableData" @before="delFlag=true"></delete-button>
|
|
|
|
|
|
</el-dropdown-item>
|
2021-05-14 17:09:57 +08:00
|
|
|
|
</div>
|
2020-09-08 11:18:18 +08:00
|
|
|
|
</template>
|
2021-05-14 17:09:57 +08:00
|
|
|
|
</top-tool-more-options>
|
2021-04-22 12:25:23 +08:00
|
|
|
|
</template>
|
2021-10-11 14:05:07 +08:00
|
|
|
|
<template v-slot:search >
|
2021-10-11 16:12:09 +08:00
|
|
|
|
<click-search ref="clickSearch" :select-value.sync="selectValue" :title-search-list="titleSearchList" @reload="reloadTable"/>
|
2021-04-23 19:58:08 +08:00
|
|
|
|
</template>
|
2021-04-22 12:25:23 +08:00
|
|
|
|
<template v-slot:default="slotProps">
|
|
|
|
|
|
<asset-table
|
|
|
|
|
|
ref="dataTable"
|
2021-10-13 18:24:09 +08:00
|
|
|
|
:orderByFa="orderBy"
|
2022-03-25 14:30:24 +08:00
|
|
|
|
v-my-loading="tools.loading"
|
2021-10-22 17:47:42 +08:00
|
|
|
|
:loading="tools.loading"
|
2021-04-22 12:25:23 +08:00
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title="tools.customTableTitle"
|
2021-08-29 21:35:04 +08:00
|
|
|
|
:height="mainTableHeight"
|
2021-04-22 12:25:23 +08:00
|
|
|
|
:table-data="tableData"
|
|
|
|
|
|
@cli="cli"
|
|
|
|
|
|
@del="del"
|
|
|
|
|
|
@edit="edit"
|
2021-04-26 21:42:15 +08:00
|
|
|
|
@duplicate="duplicate"
|
2021-04-22 12:25:23 +08:00
|
|
|
|
@orderBy="tableDataSort"
|
|
|
|
|
|
@reload="getTableData"
|
|
|
|
|
|
@selectionChange="selectionChange"
|
2021-06-01 14:26:09 +08:00
|
|
|
|
@addSilence="addSilence"
|
2022-03-17 16:42:56 +08:00
|
|
|
|
@topology="topology"
|
2021-04-22 12:25:23 +08:00
|
|
|
|
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></asset-table>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
|
<template v-slot:pagination>
|
|
|
|
|
|
<Pagination ref="Pagination" :pageObj="pageObj" :tableId="tableId" @pageNo='pageNo' @pageSize='pageSize'></Pagination>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</nz-data-list>
|
2021-10-09 16:47:38 +08:00
|
|
|
|
<transition name="right-box">
|
|
|
|
|
|
<asset-box v-if="rightBox.show"
|
|
|
|
|
|
ref="assetBox"
|
|
|
|
|
|
:dc-data="dcData"
|
|
|
|
|
|
:field-group-data="fieldGroupData"
|
|
|
|
|
|
:from="fromRoute.asset"
|
|
|
|
|
|
:obj="object"
|
|
|
|
|
|
:snmp-credential-data="snmpCredentialData"
|
|
|
|
|
|
:state-data="stateData"
|
|
|
|
|
|
:type-data="typeData"
|
|
|
|
|
|
@close="closeRightBox"
|
|
|
|
|
|
@refresh="getTableData"></asset-box>
|
|
|
|
|
|
</transition>
|
|
|
|
|
|
<transition name="right-box">
|
|
|
|
|
|
<asset-batch-edit-box v-if="rightBox.batchShow"
|
|
|
|
|
|
:field-group-data="fieldGroupData"
|
|
|
|
|
|
:snmp-credential-data="snmpCredentialData"
|
|
|
|
|
|
:state-data="stateData"
|
|
|
|
|
|
@close="closeRightBox"
|
|
|
|
|
|
@refresh="getTableData"></asset-batch-edit-box>
|
|
|
|
|
|
</transition>
|
|
|
|
|
|
<transition name="right-box"><alert-silence-box v-if='silenceBoxShow' :alert-silence="objectSilence" @close="closeSilenceBox"></alert-silence-box>
|
|
|
|
|
|
</transition>
|
2020-01-02 18:13:01 +08:00
|
|
|
|
</div>
|
2019-11-29 15:00:26 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-04-22 12:25:23 +08:00
|
|
|
|
import deleteButton from '@/components/common/deleteButton'
|
|
|
|
|
|
import assetBox from '@/components/common/rightBox/asset/assetBox'
|
|
|
|
|
|
import assetBatchEditBox from '@/components/common/rightBox/asset/assetBatchEditBox'
|
|
|
|
|
|
import nzDataList from '@/components/common/table/nzDataList'
|
2021-10-09 16:47:38 +08:00
|
|
|
|
import nzDetailView from '@/components/common/detailView/nzDetailView'
|
2021-04-22 12:25:23 +08:00
|
|
|
|
import dataListMixin from '@/components/common/mixin/dataList'
|
2021-10-09 16:47:38 +08:00
|
|
|
|
import detailViewMixin from '@/components/common/mixin/detailViewMixin'
|
2021-04-22 12:25:23 +08:00
|
|
|
|
import assetTable from '@/components/common/table/asset/assetTable'
|
2021-10-09 16:47:38 +08:00
|
|
|
|
import assetDetail from '@/components/common/detailView/list/asset/assetDetail'
|
2021-04-26 21:42:15 +08:00
|
|
|
|
import clickSearch from '@/components/common/labelFilter/clickSearch'
|
2021-05-14 17:09:57 +08:00
|
|
|
|
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
|
2021-06-01 15:19:47 +08:00
|
|
|
|
import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox'
|
2021-10-12 16:53:59 +08:00
|
|
|
|
import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch'
|
2021-12-22 14:20:13 +08:00
|
|
|
|
import routerPathParams from '@/components/common/mixin/routerPathParams'
|
2021-12-27 15:41:58 +08:00
|
|
|
|
import lodash from 'lodash'
|
2021-03-11 16:46:09 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'asset',
|
|
|
|
|
|
components: {
|
2021-04-22 12:25:23 +08:00
|
|
|
|
deleteButton,
|
|
|
|
|
|
assetBox,
|
|
|
|
|
|
nzDataList,
|
|
|
|
|
|
assetBatchEditBox,
|
|
|
|
|
|
assetTable,
|
2021-04-23 19:58:08 +08:00
|
|
|
|
clickSearch,
|
2021-06-01 14:26:09 +08:00
|
|
|
|
topToolMoreOptions,
|
2021-10-09 16:47:38 +08:00
|
|
|
|
alertSilenceBox,
|
|
|
|
|
|
nzDetailView,
|
2021-10-12 16:53:59 +08:00
|
|
|
|
assetDetail,
|
|
|
|
|
|
detailViewTopSearch
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-12-22 14:20:13 +08:00
|
|
|
|
mixins: [dataListMixin, detailViewMixin, routerPathParams],
|
2021-03-19 18:52:19 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2021-04-22 12:25:23 +08:00
|
|
|
|
url: 'asset/asset',
|
2021-10-27 17:36:59 +08:00
|
|
|
|
from: 'asset',
|
2021-05-17 16:41:01 +08:00
|
|
|
|
filter: {},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// 侧滑
|
|
|
|
|
|
rightBox: {
|
|
|
|
|
|
batchShow: false
|
|
|
|
|
|
},
|
2021-06-01 14:26:09 +08:00
|
|
|
|
silenceBoxShow: false,
|
2021-10-26 15:55:57 +08:00
|
|
|
|
dataListLayout: localStorage.getItem('dataList-layout' + 'assetTable') ? JSON.parse(localStorage.getItem('dataList-layout' + 'assetTable')) : ['searchInput', 'elementSet', 'clickSearch', 'pagination', 'detailViewSet'],
|
2021-12-07 17:01:42 +08:00
|
|
|
|
assetNzTableHeightOffset: 283, // 包含click-search时nz-table的高度
|
2021-04-22 12:25:23 +08:00
|
|
|
|
blankObject: {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
id: '',
|
2021-04-22 12:25:23 +08:00
|
|
|
|
name: '',
|
|
|
|
|
|
pid: '',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
sn: '',
|
2021-04-22 12:25:23 +08:00
|
|
|
|
manageIp: '',
|
2021-10-21 18:37:35 +08:00
|
|
|
|
stateId: 2,
|
2021-04-22 12:25:23 +08:00
|
|
|
|
purchaseDate: null,
|
|
|
|
|
|
dcId: '',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
cabinetId: '',
|
2021-04-22 12:25:23 +08:00
|
|
|
|
brandId: '',
|
|
|
|
|
|
brand: { id: '', name: '' },
|
2021-03-19 18:52:19 +08:00
|
|
|
|
modelId: '',
|
2021-04-22 12:25:23 +08:00
|
|
|
|
model: { id: '', name: '' },
|
|
|
|
|
|
type: { name: '', id: '' },
|
2022-02-15 09:30:30 +08:00
|
|
|
|
number: '',
|
2021-04-22 12:25:23 +08:00
|
|
|
|
brandAndModel: [],
|
|
|
|
|
|
typeId: '',
|
2022-01-10 17:15:09 +08:00
|
|
|
|
snmpCredentialId: '',
|
2021-08-16 10:48:58 +08:00
|
|
|
|
clientPort: '10092',
|
2021-08-18 15:27:53 +08:00
|
|
|
|
clientToken: '',
|
2021-04-22 12:25:23 +08:00
|
|
|
|
authProtocolPort: '',
|
|
|
|
|
|
authType: '',
|
|
|
|
|
|
authUsername: '',
|
|
|
|
|
|
authPin: '',
|
|
|
|
|
|
authPriKey: '',
|
|
|
|
|
|
authUserTip: '',
|
|
|
|
|
|
authPinTip: '',
|
|
|
|
|
|
fields: [],
|
2021-03-19 18:52:19 +08:00
|
|
|
|
accounts: []
|
|
|
|
|
|
},
|
2021-06-01 14:26:09 +08:00
|
|
|
|
blankSilenceObject: {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
startAt: '',
|
|
|
|
|
|
endAt: '',
|
|
|
|
|
|
ruleId: '',
|
|
|
|
|
|
type: 'asset',
|
|
|
|
|
|
linkId: '',
|
|
|
|
|
|
remark: '',
|
|
|
|
|
|
time: [],
|
|
|
|
|
|
matchers: [
|
|
|
|
|
|
{ name: '', value: '', regex: 0 }
|
|
|
|
|
|
],
|
|
|
|
|
|
name: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
objectSilence: {},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
tableId: 'assetTable', // 需要分页的table的id,用于记录每页数量
|
|
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
|
searchLabelList: [{
|
2021-10-13 18:24:09 +08:00
|
|
|
|
id: 'ids',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
name: 'ID',
|
|
|
|
|
|
type: 'input',
|
2021-05-10 15:59:39 +08:00
|
|
|
|
label: 'ids',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
2021-05-20 11:39:12 +08:00
|
|
|
|
name: this.$t('overall.name'),
|
2021-05-10 15:59:39 +08:00
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'name',
|
2021-10-13 18:24:09 +08:00
|
|
|
|
id: 'name',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
name: 'SN',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'sn',
|
2021-10-13 18:24:09 +08:00
|
|
|
|
id: 'sn',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
2021-05-10 15:59:39 +08:00
|
|
|
|
name: 'IP',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
type: 'input',
|
2021-05-10 15:59:39 +08:00
|
|
|
|
label: 'manageIp',
|
2021-10-13 18:24:09 +08:00
|
|
|
|
id: 'manageIp',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
2022-06-16 15:58:17 +08:00
|
|
|
|
name: this.$t('overall.state'),
|
2021-05-10 15:59:39 +08:00
|
|
|
|
type: 'assetState',
|
2022-06-08 14:18:09 +08:00
|
|
|
|
label: 'assetState',
|
2021-10-13 18:24:09 +08:00
|
|
|
|
id: 'stateIds',
|
2021-09-27 18:06:41 +08:00
|
|
|
|
readonly: true,
|
2021-03-19 18:52:19 +08:00
|
|
|
|
disabled: false
|
|
|
|
|
|
}]
|
|
|
|
|
|
},
|
2020-07-24 19:22:52 +08:00
|
|
|
|
|
2021-04-22 12:25:23 +08:00
|
|
|
|
modelData: [],
|
|
|
|
|
|
stateData: [],
|
|
|
|
|
|
typeData: [],
|
|
|
|
|
|
dcData: [],
|
|
|
|
|
|
snmpCredentialData: [],
|
2021-04-23 19:58:08 +08:00
|
|
|
|
fieldGroupData: [],
|
|
|
|
|
|
titleSearchList: {
|
|
|
|
|
|
dc: {
|
|
|
|
|
|
label: this.$t('overall.dc'),
|
|
|
|
|
|
key: 'dcIds',
|
|
|
|
|
|
type: 'checkBox',
|
|
|
|
|
|
children: [],
|
2021-07-19 16:34:24 +08:00
|
|
|
|
show: false,
|
2021-04-23 19:58:08 +08:00
|
|
|
|
showMore: false,
|
|
|
|
|
|
width: 0,
|
2021-06-07 15:09:11 +08:00
|
|
|
|
index: -1
|
2021-04-23 19:58:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
type: {
|
|
|
|
|
|
label: this.$t('overall.type'),
|
|
|
|
|
|
key: 'typeIds',
|
|
|
|
|
|
type: 'checkBox',
|
|
|
|
|
|
children: [],
|
2021-07-19 16:34:24 +08:00
|
|
|
|
show: false,
|
2021-04-23 19:58:08 +08:00
|
|
|
|
showMore: false,
|
|
|
|
|
|
width: 0,
|
2021-06-07 15:09:11 +08:00
|
|
|
|
index: -1
|
2021-04-23 19:58:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
ping: {
|
2021-10-13 11:12:26 +08:00
|
|
|
|
label: 'Ping',
|
2021-04-23 19:58:08 +08:00
|
|
|
|
key: 'ping',
|
|
|
|
|
|
type: 'checkBox',
|
|
|
|
|
|
children: [
|
|
|
|
|
|
{ key: 'Down', value: 0, name: 'Down' },
|
|
|
|
|
|
{ key: 'Up', value: 1, name: 'Up' }
|
|
|
|
|
|
],
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
showMore: false,
|
|
|
|
|
|
width: 0,
|
2021-06-07 15:09:11 +08:00
|
|
|
|
index: -1
|
2021-04-23 19:58:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
model: {
|
|
|
|
|
|
label: this.$t('asset.model'),
|
|
|
|
|
|
key: 'modelIds',
|
2021-10-18 17:40:21 +08:00
|
|
|
|
type: 'checkBox',
|
2021-04-23 19:58:08 +08:00
|
|
|
|
children: [],
|
2021-07-19 16:34:24 +08:00
|
|
|
|
show: false,
|
2021-04-26 21:42:15 +08:00
|
|
|
|
showMore: false,
|
2021-04-23 19:58:08 +08:00
|
|
|
|
width: 0,
|
2021-06-07 15:09:11 +08:00
|
|
|
|
index: -1
|
2021-04-23 19:58:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
assetLabel: {
|
2021-11-08 16:56:10 +08:00
|
|
|
|
label: this.$t('overall.more'),
|
2021-04-23 19:58:08 +08:00
|
|
|
|
key: 'fields',
|
|
|
|
|
|
type: 'dropdownCheckBox',
|
|
|
|
|
|
children: [],
|
2021-07-19 16:34:24 +08:00
|
|
|
|
show: false,
|
2021-04-26 21:42:15 +08:00
|
|
|
|
showMore: false,
|
2021-04-23 19:58:08 +08:00
|
|
|
|
width: 0,
|
2021-06-07 15:09:11 +08:00
|
|
|
|
index: -1
|
2021-04-23 19:58:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
selectValue: {
|
|
|
|
|
|
dcIds: [],
|
|
|
|
|
|
typeIds: [],
|
|
|
|
|
|
ping: [],
|
|
|
|
|
|
modelIds: [],
|
2021-10-13 11:12:26 +08:00
|
|
|
|
fields: '',
|
|
|
|
|
|
modelIdsDetail: [],
|
|
|
|
|
|
fieldsDetail: []
|
2021-10-12 16:53:59 +08:00
|
|
|
|
},
|
|
|
|
|
|
detailSearchList: {
|
|
|
|
|
|
dc: {
|
|
|
|
|
|
label: this.$t('overall.dc'),
|
|
|
|
|
|
key: 'dcIds',
|
|
|
|
|
|
type: 'checkBox',
|
|
|
|
|
|
children: [],
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
showMore: false,
|
2021-10-14 14:14:25 +08:00
|
|
|
|
dropShow: false,
|
2021-10-12 16:53:59 +08:00
|
|
|
|
width: 0,
|
|
|
|
|
|
index: -1
|
|
|
|
|
|
},
|
|
|
|
|
|
type: {
|
|
|
|
|
|
label: this.$t('overall.type'),
|
|
|
|
|
|
key: 'typeIds',
|
|
|
|
|
|
type: 'checkBox',
|
|
|
|
|
|
children: [],
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
showMore: false,
|
2021-10-14 14:14:25 +08:00
|
|
|
|
dropShow: false,
|
2021-10-12 16:53:59 +08:00
|
|
|
|
width: 0,
|
|
|
|
|
|
index: -1
|
|
|
|
|
|
},
|
|
|
|
|
|
ping: {
|
2021-10-13 11:12:26 +08:00
|
|
|
|
label: 'Ping',
|
2021-10-12 16:53:59 +08:00
|
|
|
|
key: 'ping',
|
|
|
|
|
|
type: 'checkBox',
|
|
|
|
|
|
children: [
|
|
|
|
|
|
{ key: 'Down', id: 0, name: 'Down' },
|
|
|
|
|
|
{ key: 'Up', id: 1, name: 'Up' }
|
|
|
|
|
|
],
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
showMore: false,
|
2021-10-14 14:14:25 +08:00
|
|
|
|
dropShow: false,
|
2021-10-12 16:53:59 +08:00
|
|
|
|
width: 0,
|
|
|
|
|
|
index: -1
|
|
|
|
|
|
},
|
|
|
|
|
|
model: {
|
|
|
|
|
|
label: this.$t('asset.model'),
|
2021-10-13 11:12:26 +08:00
|
|
|
|
key: 'modelIdsDetail',
|
2021-10-18 17:40:21 +08:00
|
|
|
|
type: 'checkBox',
|
2021-10-13 11:12:26 +08:00
|
|
|
|
children: [],
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
showMore: false,
|
2021-10-14 14:14:25 +08:00
|
|
|
|
dropShow: false,
|
2021-10-13 11:12:26 +08:00
|
|
|
|
width: 0,
|
|
|
|
|
|
index: -1
|
|
|
|
|
|
},
|
|
|
|
|
|
assetLabel: {
|
2022-03-25 14:12:03 +08:00
|
|
|
|
label: this.$t('overall.more'),
|
2021-10-13 11:12:26 +08:00
|
|
|
|
key: 'fieldsDetail',
|
2021-10-12 16:53:59 +08:00
|
|
|
|
type: 'dropdownCheckBox',
|
|
|
|
|
|
children: [],
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
showMore: false,
|
2021-10-14 14:14:25 +08:00
|
|
|
|
dropShow: false,
|
2021-10-12 16:53:59 +08:00
|
|
|
|
width: 0,
|
|
|
|
|
|
index: -1
|
|
|
|
|
|
}
|
2021-10-13 14:44:34 +08:00
|
|
|
|
},
|
2022-02-24 13:43:20 +08:00
|
|
|
|
timer: '',
|
|
|
|
|
|
needAlertDaysData: true,
|
|
|
|
|
|
trendKey: 'assetId'
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2021-05-25 14:21:14 +08:00
|
|
|
|
cli (row) {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
const consoleParam = {
|
2021-05-25 14:21:14 +08:00
|
|
|
|
id: row.id,
|
|
|
|
|
|
host: row.manageIp,
|
|
|
|
|
|
port: row.authProtocolPort
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.$store.commit('addConsole', consoleParam)
|
|
|
|
|
|
},
|
2021-04-26 21:42:15 +08:00
|
|
|
|
duplicate (row) {
|
2021-09-13 17:05:06 +08:00
|
|
|
|
this.$get(`${this.url}/${row.id}`).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.object = { ...response.data, id: '', name: `${row.name}-copy` }
|
|
|
|
|
|
if (this.object.name.length > 64) {
|
|
|
|
|
|
const length = this.object.name.length - 64
|
|
|
|
|
|
this.object.name = row.name.substring(0, row.name.length - length) + '-copy'
|
|
|
|
|
|
}
|
|
|
|
|
|
this.rightBox.show = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-04-23 19:58:08 +08:00
|
|
|
|
},
|
2021-04-22 12:25:23 +08:00
|
|
|
|
getStateData () {
|
|
|
|
|
|
return new Promise(resolve => {
|
2021-04-26 21:42:15 +08:00
|
|
|
|
this.$get('asset/stateConf?pageSize=-1').then(response => {
|
2021-04-22 12:25:23 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.stateData = response.data.list
|
2020-01-02 18:13:01 +08:00
|
|
|
|
}
|
2021-04-22 12:25:23 +08:00
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-04-22 12:25:23 +08:00
|
|
|
|
getTypeData () {
|
2021-04-23 19:58:08 +08:00
|
|
|
|
return new Promise(resolve => {
|
2021-04-26 21:42:15 +08:00
|
|
|
|
this.$get('asset/typeConf?pageSize=-1').then(response => {
|
2021-04-23 19:58:08 +08:00
|
|
|
|
if (response.code === 200) {
|
2021-06-07 15:09:11 +08:00
|
|
|
|
resolve(response.data.list.map(d => { return { ...d, value: d.id } }))
|
|
|
|
|
|
// this.titleSearchList.type.children = response.data.list.map(d => { return { ...d, value: d.id } })
|
2021-10-12 16:53:59 +08:00
|
|
|
|
// this.detailSearchList.type.children = response.data.list.map(d => { return { ...d, value: d.id } })
|
2021-04-23 19:58:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
getTypeTreeData () {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
return new Promise(resolve => {
|
2021-04-22 12:25:23 +08:00
|
|
|
|
this.$get('asset/typeConf/tree').then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
if (response.code === 200) {
|
2021-04-22 12:25:23 +08:00
|
|
|
|
this.typeData = response.data.list
|
2021-03-11 16:46:09 +08:00
|
|
|
|
}
|
2021-04-22 12:25:23 +08:00
|
|
|
|
resolve()
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-04-23 19:58:08 +08:00
|
|
|
|
reloadTable (obj) {
|
2021-11-15 10:25:30 +08:00
|
|
|
|
this.pageObj.pageNo = 1
|
2021-10-13 14:44:34 +08:00
|
|
|
|
const params = JSON.parse(JSON.stringify(obj))
|
|
|
|
|
|
if (this.detailType === 'view') {
|
|
|
|
|
|
const obj = {}
|
2021-10-18 17:40:21 +08:00
|
|
|
|
params.modelIds = params.modelIdsDetail
|
2021-10-13 14:44:34 +08:00
|
|
|
|
params.fieldsDetail.forEach(item => {
|
|
|
|
|
|
const arr = item.split('-')
|
|
|
|
|
|
if (obj[arr[0]]) {
|
|
|
|
|
|
obj[arr[0]].push(arr[1])
|
|
|
|
|
|
} else {
|
|
|
|
|
|
obj[arr[0]] = [arr[1]]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
params.fields = JSON.stringify(obj)
|
|
|
|
|
|
if (params.fields === '{}') {
|
|
|
|
|
|
params.fields = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
delete params.modelIdsDetail
|
|
|
|
|
|
delete params.fieldsDetail
|
|
|
|
|
|
}
|
|
|
|
|
|
Object.keys(params).forEach(key => {
|
|
|
|
|
|
if (typeof params[key] === 'string') {
|
|
|
|
|
|
this.searchCheckBox[key] = params[key] ? params[key] : null
|
2021-04-23 19:58:08 +08:00
|
|
|
|
} else {
|
2021-10-13 14:44:34 +08:00
|
|
|
|
params[key] && params[key].length > 0 ? this.searchCheckBox[key] = params[key].join(',') : this.searchCheckBox[key] = null
|
2021-04-23 19:58:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-10-13 14:44:34 +08:00
|
|
|
|
if (!this.timer) {
|
|
|
|
|
|
this.timer = setTimeout(() => {
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
clearTimeout(this.timer)
|
|
|
|
|
|
this.timer = ''
|
2021-11-17 15:56:55 +08:00
|
|
|
|
this.scrollbarToTop()
|
2021-10-13 14:44:34 +08:00
|
|
|
|
}, 1000)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
clearTimeout(this.timer)
|
|
|
|
|
|
this.timer = setTimeout(() => {
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
clearTimeout(this.timer)
|
|
|
|
|
|
this.timer = ''
|
2021-11-17 15:56:55 +08:00
|
|
|
|
this.scrollbarToTop()
|
2021-10-13 14:44:34 +08:00
|
|
|
|
}, 1000)
|
|
|
|
|
|
}
|
2021-04-23 19:58:08 +08:00
|
|
|
|
},
|
2021-11-17 15:56:55 +08:00
|
|
|
|
scrollbarToTop () {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
const wraps = document.querySelectorAll('.el-table__body-wrapper')
|
|
|
|
|
|
wraps.forEach(wrap => {
|
|
|
|
|
|
if (wrap) {
|
|
|
|
|
|
wrap.scrollTop = 0
|
|
|
|
|
|
wrap.scrollLeft = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-04-22 12:25:23 +08:00
|
|
|
|
getDcData () {
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
|
this.$get('dc', { pageSize: -1 }).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.dcData = response.data.list
|
2021-06-07 15:09:11 +08:00
|
|
|
|
resolve(response.data.list.map(d => { return { ...d, value: d.id } }))
|
|
|
|
|
|
// this.titleSearchList.dc.children = response.data.list.map(d => { return { ...d, value: d.id } })
|
2020-10-15 17:12:55 +08:00
|
|
|
|
}
|
2021-04-22 12:25:23 +08:00
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-04-22 12:25:23 +08:00
|
|
|
|
getSnmpCredentialData () {
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
|
this.$get('snmp/credential', { pageSize: -1 }).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.snmpCredentialData = response.data.list
|
|
|
|
|
|
}
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-04-22 12:25:23 +08:00
|
|
|
|
getFieldGroupData () {
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
|
this.$get('asset/field/group', { pageSize: -1 }).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.fieldGroupData = response.data.list
|
|
|
|
|
|
}
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-11-03 17:21:22 +08:00
|
|
|
|
getSearchableMetaData (metaData) {
|
2021-04-23 19:58:08 +08:00
|
|
|
|
return new Promise(resolve => {
|
2021-04-29 22:24:38 +08:00
|
|
|
|
this.$get('asset/field/meta', { pageSize: -1 }).then(response => {
|
2021-04-23 19:58:08 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
const data = []
|
2021-04-29 22:24:38 +08:00
|
|
|
|
const searchableData = response.data.list.filter(d => d.search === 1)
|
|
|
|
|
|
const showData = response.data.list.filter(d => d.display === 1).map(item => {
|
2021-06-02 16:55:17 +08:00
|
|
|
|
return { label: item.name, prop: item.name, show: false, allowed: true, type: 'label' }
|
2021-04-29 22:24:38 +08:00
|
|
|
|
})
|
|
|
|
|
|
searchableData.forEach(m => {
|
2021-04-23 19:58:08 +08:00
|
|
|
|
if (m.param) {
|
|
|
|
|
|
const param = JSON.parse(m.param)
|
|
|
|
|
|
if (param.items) {
|
2021-11-03 17:21:22 +08:00
|
|
|
|
// param.items.map(p => { return { ...p, id: p.name, metaId: m.id, num: metaData.find(meta => meta.id === m.id && meta.option === p.name).num } })
|
|
|
|
|
|
data.push({
|
|
|
|
|
|
...m,
|
|
|
|
|
|
children: param.items.map(p => {
|
|
|
|
|
|
const metaFind = metaData.find(meta => meta.id === m.id && meta.option === p.name)
|
|
|
|
|
|
return {
|
|
|
|
|
|
...p,
|
|
|
|
|
|
id: p.name,
|
|
|
|
|
|
name: p.name,
|
|
|
|
|
|
metaId: m.id,
|
|
|
|
|
|
num: metaFind ? metaFind.num : 0
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2021-04-23 19:58:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-06-07 15:09:11 +08:00
|
|
|
|
// this.titleSearchList.assetLabel.children = data
|
|
|
|
|
|
resolve(data)
|
2021-04-29 22:24:38 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
const title = this.tools.customTableTitle
|
2022-03-10 16:55:49 +08:00
|
|
|
|
if (!this.$refs.dataTable && !this.$refs.dataDetail) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2022-03-01 15:19:43 +08:00
|
|
|
|
const tableTitle = this.$refs.dataTable ? this.$refs.dataTable.tableTitle : this.$refs.dataDetail.tableTitle
|
|
|
|
|
|
const originalTitle = title.slice(0, tableTitle.length) // 原title
|
|
|
|
|
|
const oldLabelTitle = title.slice(tableTitle.length, title.length) // 旧labelTitle
|
2021-04-29 22:24:38 +08:00
|
|
|
|
|
|
|
|
|
|
const newLabel = showData.filter(item => { return !oldLabelTitle.find(t => { return item.label === t.label }) })
|
|
|
|
|
|
const keepLabel = oldLabelTitle.filter(item => showData.find(t => item.label === t.label))
|
|
|
|
|
|
|
2022-03-23 14:15:57 +08:00
|
|
|
|
let result = originalTitle.concat([{ label: this.$t('overall.labels'), show: false, NotSet: true, type: 'title', prop: 'table-label' }])
|
2021-04-29 22:24:38 +08:00
|
|
|
|
|
|
|
|
|
|
result = result.concat(keepLabel).concat(newLabel)
|
|
|
|
|
|
this.tools.customTableTitle = JSON.parse(JSON.stringify(result))
|
|
|
|
|
|
}, 200)
|
2021-04-23 19:58:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-10-15 15:59:46 +08:00
|
|
|
|
getModelData (data) {
|
2021-04-22 12:25:23 +08:00
|
|
|
|
return new Promise(resolve => {
|
2021-10-15 15:59:46 +08:00
|
|
|
|
// this.$get('asset/model?pageSize=-1').then(response => {
|
|
|
|
|
|
if (data) {
|
|
|
|
|
|
this.modelData = data
|
2021-10-18 17:40:21 +08:00
|
|
|
|
const arr = []
|
|
|
|
|
|
// const titleSearchData = {}
|
2021-10-15 15:59:46 +08:00
|
|
|
|
this.modelData.forEach(m => {
|
|
|
|
|
|
m.value = []
|
2021-11-03 17:21:22 +08:00
|
|
|
|
arr.push({ ...m, name: m.brand.name + '/' + m.name, value: m.id, num: m.num })
|
2021-10-18 17:40:21 +08:00
|
|
|
|
// if (titleSearchData[m.brand.name]) {
|
|
|
|
|
|
// titleSearchData[m.brand.name].children.push(m)
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// titleSearchData[m.brand.name] = { ...m.brand, children: [m] }
|
|
|
|
|
|
// }
|
2021-10-15 15:59:46 +08:00
|
|
|
|
})
|
2021-10-18 17:40:21 +08:00
|
|
|
|
// resolve(Object.keys(titleSearchData).map(b => titleSearchData[b]))
|
|
|
|
|
|
resolve(arr)
|
2021-10-15 15:59:46 +08:00
|
|
|
|
// this.titleSearchList.model.children = Object.keys(titleSearchData).map(b => titleSearchData[b])
|
|
|
|
|
|
}
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
// })
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
showEndpoint (asset) {
|
|
|
|
|
|
if (!this.hasButton('asset_endpoint_view')) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
this.bottomBox.asset = Object.assign({}, asset)
|
|
|
|
|
|
this.bottomBox.targetTab = 'endpoint'
|
|
|
|
|
|
this.bottomBox.showSubList = true
|
|
|
|
|
|
},
|
2021-04-22 12:25:23 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
batchEdit () {
|
|
|
|
|
|
this.rightBox.batchShow = true
|
|
|
|
|
|
},
|
|
|
|
|
|
closeRightBox (refresh) {
|
|
|
|
|
|
this.rightBox.show = false
|
|
|
|
|
|
this.rightBox.batchShow = false
|
|
|
|
|
|
if (refresh) {
|
|
|
|
|
|
this.delFlag = true
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getPrincipalName (data) {
|
|
|
|
|
|
for (const item in this.userData) {
|
|
|
|
|
|
if (this.userData[item].userId === data) {
|
|
|
|
|
|
return this.userData[item].username
|
2020-02-26 15:38:56 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
2021-10-15 15:59:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
getTableData (params) {
|
|
|
|
|
|
if (params && Object.keys(params).length > 0) {
|
|
|
|
|
|
for (const key in params) {
|
|
|
|
|
|
this.$set(this.searchLabel, key, params[key])
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.orderBy) {
|
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', this.orderBy)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
delete this.searchLabel.orderBy
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
|
2021-11-17 10:08:57 +08:00
|
|
|
|
if (this.$route.path === '/asset' && this.titleSearchList) {
|
2021-10-15 15:59:46 +08:00
|
|
|
|
this.$set(this.searchLabel, 'statistics', 1)
|
2021-10-18 17:40:21 +08:00
|
|
|
|
}/* else {
|
2021-10-15 15:59:46 +08:00
|
|
|
|
delete this.searchLabel.statistics
|
2021-10-18 17:40:21 +08:00
|
|
|
|
} */
|
2021-10-15 15:59:46 +08:00
|
|
|
|
this.tools.loading = true
|
2021-12-22 14:20:13 +08:00
|
|
|
|
const assetParam = {
|
|
|
|
|
|
...this.searchLabel,
|
|
|
|
|
|
...this.searchCheckBox
|
|
|
|
|
|
}
|
|
|
|
|
|
const path = this.fromRoute.asset
|
2021-12-27 15:41:58 +08:00
|
|
|
|
const routePathParams = lodash.cloneDeep(assetParam)
|
|
|
|
|
|
delete routePathParams.statistics
|
|
|
|
|
|
this.updatePath(routePathParams, path)
|
2021-10-15 15:59:46 +08:00
|
|
|
|
this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
|
|
|
|
|
|
this.tools.loading = false
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (response.statistics && this.$route.path === '/asset') {
|
|
|
|
|
|
this.setSearchData(response.statistics)
|
|
|
|
|
|
}
|
|
|
|
|
|
for (let i = 0; i < response.data.list.length; i++) {
|
|
|
|
|
|
response.data.list[i].status = response.data.list[i].status + ''
|
|
|
|
|
|
}
|
2022-02-24 13:43:20 +08:00
|
|
|
|
if (this.needAlertDaysData) {
|
|
|
|
|
|
response.data.list.forEach(item => {
|
|
|
|
|
|
item.trendLoading = true
|
2022-03-04 13:59:25 +08:00
|
|
|
|
item.left = 0
|
|
|
|
|
|
item.top = 0
|
|
|
|
|
|
item.alertNumtooltipShow = false
|
2022-02-24 17:43:34 +08:00
|
|
|
|
item.alertDaysData = [
|
|
|
|
|
|
{
|
|
|
|
|
|
metric: { priority: 'P1' },
|
|
|
|
|
|
values: [[0, 0]]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
metric: { priority: 'P2' },
|
|
|
|
|
|
values: [[0, 0]]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
metric: { priority: 'P3' },
|
|
|
|
|
|
values: [[0, 0]]
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
2022-02-24 13:43:20 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-10-15 15:59:46 +08:00
|
|
|
|
this.tableData = response.data.list
|
2022-01-18 10:06:33 +08:00
|
|
|
|
const globalSearchId = this.$store.getters.getGlobalSearchId
|
|
|
|
|
|
let detailViewRightObj = ''
|
|
|
|
|
|
if (globalSearchId) {
|
|
|
|
|
|
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
detailViewRightObj = this.tableData[0]
|
|
|
|
|
|
}
|
2022-07-06 17:49:53 +08:00
|
|
|
|
this.detailViewRightObj = this.$loadsh.cloneDeep(detailViewRightObj)
|
2021-10-15 15:59:46 +08:00
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
|
this.pageObj.pages = response.data.pages
|
2022-03-04 13:59:25 +08:00
|
|
|
|
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
|
2021-10-15 15:59:46 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
|
|
|
|
|
|
this.toTopBtnHandler(this.scrollbarWrap)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.detailType === 'view') {
|
|
|
|
|
|
this.$refs.dataDetail.$refs.dataTable.scrollTop = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
setSearchData (statistics) {
|
|
|
|
|
|
Object.keys(this.titleSearchList).forEach(key => {
|
|
|
|
|
|
const keys = key === 'assetLabel' ? 'meta' : key
|
|
|
|
|
|
if (key === 'assetLabel') {
|
|
|
|
|
|
this.getSearchableMetaData(statistics[keys]).then(res => {
|
|
|
|
|
|
this.titleSearchList.assetLabel.children = res
|
|
|
|
|
|
this.detailSearchList.assetLabel.children = res
|
|
|
|
|
|
this.titleSearchList.assetLabel.show = true
|
|
|
|
|
|
this.detailSearchList.assetLabel.show = true
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (key === 'model') {
|
|
|
|
|
|
this.getModelData(statistics[keys]).then(res => {
|
|
|
|
|
|
this.titleSearchList.model.children = res
|
|
|
|
|
|
this.detailSearchList.model.children = res
|
|
|
|
|
|
this.titleSearchList.model.show = true
|
|
|
|
|
|
this.detailSearchList.model.show = true
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
2021-10-15 16:41:14 +08:00
|
|
|
|
this.titleSearchList[key].children = statistics[keys].map(d => { return { ...d, value: d.id } })
|
|
|
|
|
|
this.detailSearchList[key].children = statistics[keys].map(d => { return { ...d, value: d.id } })
|
2021-10-15 15:59:46 +08:00
|
|
|
|
}
|
2021-10-18 14:55:16 +08:00
|
|
|
|
if (this.titleSearchList[key].children.length === 0) {
|
|
|
|
|
|
// delete this.titleSearchList[key]
|
|
|
|
|
|
// delete this.detailSearchList[key]
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.titleSearchList[key].show = true
|
|
|
|
|
|
this.detailSearchList[key].show = true
|
|
|
|
|
|
}
|
2021-10-15 15:59:46 +08:00
|
|
|
|
this.titleSearchList[key].show = true
|
|
|
|
|
|
this.detailSearchList[key].show = true
|
|
|
|
|
|
})
|
2022-01-05 18:01:30 +08:00
|
|
|
|
},
|
|
|
|
|
|
edit (u) {
|
|
|
|
|
|
this.$get(`${this.url}/${u.id}`).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (response.data.purchaseDate) {
|
|
|
|
|
|
response.data.purchaseDate += ' 00:00:00'
|
|
|
|
|
|
response.data.purchaseDate = new Date(response.data.purchaseDate)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.object = response.data
|
|
|
|
|
|
this.rightBox.show = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-06-02 15:23:38 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-12-22 14:20:13 +08:00
|
|
|
|
created () {
|
|
|
|
|
|
const searchKeys = {
|
|
|
|
|
|
// key: path 键
|
|
|
|
|
|
// value: vue set 参数
|
|
|
|
|
|
pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' },
|
|
|
|
|
|
pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' },
|
|
|
|
|
|
orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' },
|
2021-12-22 19:54:51 +08:00
|
|
|
|
ids: {
|
|
|
|
|
|
target: this.searchLabel,
|
|
|
|
|
|
propertyName: 'ids',
|
2022-01-05 10:34:22 +08:00
|
|
|
|
isSearchInput: true,
|
2021-12-22 19:54:51 +08:00
|
|
|
|
type: 'string',
|
|
|
|
|
|
defaultJson: {
|
|
|
|
|
|
disabled: false,
|
|
|
|
|
|
id: 'ids',
|
|
|
|
|
|
label: 'ids',
|
|
|
|
|
|
name: 'ID',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
val: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
jsonKey: 'val'
|
|
|
|
|
|
},
|
|
|
|
|
|
name: {
|
|
|
|
|
|
target: this.searchLabel,
|
2022-01-05 10:34:22 +08:00
|
|
|
|
isSearchInput: true,
|
2021-12-22 19:54:51 +08:00
|
|
|
|
propertyName: 'name',
|
|
|
|
|
|
type: 'string',
|
|
|
|
|
|
defaultJson: {
|
|
|
|
|
|
disabled: false,
|
|
|
|
|
|
id: 'name',
|
|
|
|
|
|
label: 'name',
|
|
|
|
|
|
name: 'Name',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
val: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
jsonKey: 'val'
|
|
|
|
|
|
},
|
|
|
|
|
|
sn: {
|
|
|
|
|
|
target: this.searchLabel,
|
2022-01-05 10:34:22 +08:00
|
|
|
|
isSearchInput: true,
|
2021-12-22 19:54:51 +08:00
|
|
|
|
propertyName: 'sn',
|
|
|
|
|
|
type: 'number',
|
|
|
|
|
|
defaultJson: {
|
|
|
|
|
|
disabled: false,
|
|
|
|
|
|
id: 'sn',
|
|
|
|
|
|
label: 'sn',
|
|
|
|
|
|
name: 'SN',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
val: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
jsonKey: 'val'
|
|
|
|
|
|
},
|
|
|
|
|
|
manageIp: {
|
|
|
|
|
|
target: this.searchLabel,
|
2022-01-05 10:34:22 +08:00
|
|
|
|
isSearchInput: true,
|
2021-12-22 19:54:51 +08:00
|
|
|
|
propertyName: 'manageIp',
|
|
|
|
|
|
type: 'number',
|
|
|
|
|
|
defaultJson: {
|
|
|
|
|
|
disabled: false,
|
|
|
|
|
|
id: 'manageIp',
|
|
|
|
|
|
label: 'manageIp',
|
|
|
|
|
|
name: 'IP',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
val: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
jsonKey: 'val'
|
|
|
|
|
|
},
|
2021-12-27 15:41:58 +08:00
|
|
|
|
stateIds: {
|
2021-12-22 19:54:51 +08:00
|
|
|
|
target: this.searchLabel,
|
2021-12-27 15:41:58 +08:00
|
|
|
|
propertyName: 'stateIds',
|
2021-12-22 19:54:51 +08:00
|
|
|
|
type: 'number',
|
2021-12-24 14:44:04 +08:00
|
|
|
|
isSearchInput: true,
|
2021-12-22 19:54:51 +08:00
|
|
|
|
defaultJson: {
|
|
|
|
|
|
disabled: false,
|
|
|
|
|
|
id: 'stateIds',
|
2022-06-08 14:18:09 +08:00
|
|
|
|
label: 'assetState',
|
2021-12-22 19:54:51 +08:00
|
|
|
|
name: 'State',
|
|
|
|
|
|
readonly: true,
|
|
|
|
|
|
type: 'assetState',
|
2021-12-24 14:44:04 +08:00
|
|
|
|
val: '',
|
|
|
|
|
|
valnum: '',
|
|
|
|
|
|
listStr: 'assetStateSelect'
|
2021-12-22 19:54:51 +08:00
|
|
|
|
},
|
2021-12-24 14:44:04 +08:00
|
|
|
|
jsonKey: 'valnum'
|
2021-12-23 14:54:00 +08:00
|
|
|
|
},
|
2021-12-23 19:53:17 +08:00
|
|
|
|
dcIds: { target: this.searchCheckBox, propertyName: 'dcIds', type: 'string', target2: this.selectValue, type2: 'array' },
|
|
|
|
|
|
fields: { target: this.searchCheckBox, propertyName: 'fields', type: 'json', target2: this.selectValue, type2: 'json' },
|
2021-12-24 14:44:04 +08:00
|
|
|
|
ping: { target: this.searchCheckBox, propertyName: 'ping', type: 'string', target2: this.selectValue, type2: 'array' },
|
|
|
|
|
|
modelIds: { target: this.searchCheckBox, propertyName: 'modelIds', type: 'string', target2: this.selectValue, type2: 'array' },
|
|
|
|
|
|
typeIds: { target: this.searchCheckBox, propertyName: 'typeIds', type: 'string', target2: this.selectValue, type2: 'array' }
|
2021-12-22 14:20:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.initQueryFromPath(searchKeys)
|
|
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
mounted () {
|
|
|
|
|
|
// 初始化数据
|
2021-04-22 12:25:23 +08:00
|
|
|
|
this.getStateData()
|
2021-04-23 19:58:08 +08:00
|
|
|
|
this.getTypeTreeData()
|
2021-04-22 12:25:23 +08:00
|
|
|
|
this.getSnmpCredentialData()
|
|
|
|
|
|
this.getFieldGroupData()
|
2021-05-12 16:19:43 +08:00
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
$route: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
handler () {
|
|
|
|
|
|
// 是否弹出侧滑
|
|
|
|
|
|
const add = this.$route.query.add
|
|
|
|
|
|
const importAsset = this.$route.query.importAsset
|
|
|
|
|
|
if (add) {
|
|
|
|
|
|
if (add === 'asset') {
|
|
|
|
|
|
this.add()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (importAsset) {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.export.showImportBox(1)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-05-11 22:29:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-12-04 13:45:37 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
2019-11-29 15:00:26 +08:00
|
|
|
|
</script>
|
2021-11-01 17:23:01 +08:00
|
|
|
|
<style scoped>
|
2021-10-18 17:40:21 +08:00
|
|
|
|
.list-page /deep/ .main-container{
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2021-11-01 17:23:01 +08:00
|
|
|
|
}
|
2022-06-09 13:18:09 +08:00
|
|
|
|
/deep/ .nz-table-list{
|
2021-11-01 17:23:01 +08:00
|
|
|
|
flex: 1;
|
2021-10-18 17:40:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|