2019-12-26 13:00:22 +08:00
|
|
|
|
<template>
|
2023-03-15 15:39:06 +08:00
|
|
|
|
<div class="panel list-page" v-my-loading="dashboardLoading">
|
2021-04-26 21:42:15 +08:00
|
|
|
|
<div class="main-list">
|
2021-08-26 14:38:03 +08:00
|
|
|
|
<div>
|
|
|
|
|
|
<transition name="el-zoom-in-center">
|
2021-11-01 17:23:01 +08:00
|
|
|
|
<div v-if="isLoading" class="panel-loading"></div>
|
2021-08-26 14:38:03 +08:00
|
|
|
|
</transition>
|
|
|
|
|
|
</div>
|
2021-11-15 14:00:54 +08:00
|
|
|
|
<div class="main-container">
|
2023-04-03 10:03:21 +08:00
|
|
|
|
<div class="top-tools panel-top-tools" :class="showTopLine? 'panel-top-tools-bottom' : ''">
|
2023-10-12 16:38:28 +08:00
|
|
|
|
<div class="top-tool-left" v-show="panelData.length === 0">
|
|
|
|
|
|
<button style="margin-left: 10px;" v-if="panelData.length === 0" id="dashboard-add-panel" class="nz-btn nz-btn-style-light nz-btn-size-small" v-has="'main_add'" @click="toAdd"><i class="nz-icon nz-icon-create-square"></i> {{$t("overall.addDashboard")}}</button>
|
2020-02-14 18:07:21 +08:00
|
|
|
|
</div>
|
2023-10-12 15:56:40 +08:00
|
|
|
|
<div v-if="panelData.length" class="top-tool-left" style="cursor: pointer;">
|
|
|
|
|
|
<select-dashboard
|
|
|
|
|
|
ref="selectDashboard"
|
|
|
|
|
|
:panel-data="panelData"
|
|
|
|
|
|
:panel-lock="panelLock"
|
|
|
|
|
|
:placement="'bottom-start'"
|
|
|
|
|
|
:show-panel="showPanel"
|
|
|
|
|
|
class="selectDashboard"
|
|
|
|
|
|
@deletePanel="del"
|
|
|
|
|
|
@editPanel="edit"
|
|
|
|
|
|
@selectDashboard="panelChange"
|
|
|
|
|
|
@startPlay="startPlay"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template v-slot:trigger>
|
|
|
|
|
|
<div class="selectDashboard-select">
|
|
|
|
|
|
<i style="color: #BEBEBE" class="el-icon-menu"></i>
|
|
|
|
|
|
<span :title="showPanel.name + ' (' + (showPanel.chartNum || 0) +' charts)' " class="show-panel-name">{{showPanel.name||$t('overall.notFound')}}</span>
|
|
|
|
|
|
<i @click.stop="delStarred(showPanel)" v-if="showPanel.starred===1" class="nz-icon nz-icon-a-xingzhuang2" :title ="$t('overall.starred')"></i>
|
|
|
|
|
|
<i @click.stop="addStarred(showPanel)" v-else class="nz-icon nz-icon-xingzhuang" :title ="$t('overall.unstarred')"></i>
|
|
|
|
|
|
<i class="el-icon-arrow-down"></i>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 按钮插槽 -->
|
|
|
|
|
|
<template slot="button">
|
2022-12-30 09:24:16 +08:00
|
|
|
|
<span class="dashboard-select-add" v-has="'main_add'" :title='$t("overall.addDashboard")' @click="toAdd">
|
2022-12-06 22:45:30 +08:00
|
|
|
|
<i class="nz-icon nz-icon-create-square"></i> {{$t('overall.addDashboard')}}
|
|
|
|
|
|
</span>
|
2023-10-12 15:56:40 +08:00
|
|
|
|
<!-- 通过dashboard模板创建 -->
|
|
|
|
|
|
<span v-has="'main_add'" @click="addByTemplate" :title='$t("dashboard.dashboard.addByTemplate")' class="dashboard-addBy-template">
|
2022-12-30 09:24:16 +08:00
|
|
|
|
<i class="nz-icon nz-icon-template1"></i>
|
|
|
|
|
|
</span>
|
2023-10-12 15:56:40 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</select-dashboard>
|
|
|
|
|
|
</div>
|
2022-06-03 11:44:53 +08:00
|
|
|
|
|
2023-10-12 15:56:40 +08:00
|
|
|
|
<div v-if="panelData.length" class="top-tool-right">
|
|
|
|
|
|
<!-- 仪表盘轮播 -->
|
|
|
|
|
|
<playlist v-if="playListControls" :playlistObj="playlistObj" :panelData="panelData" @stopPlaylist="stopPlaylist" @changePlay="panelChange"></playlist>
|
2020-02-14 18:07:21 +08:00
|
|
|
|
|
2023-10-12 15:56:40 +08:00
|
|
|
|
<pick-time id="panel" ref="pickTime" v-model="searchTime" :refresh-data-func="dateChange" :use-chart-unit="false" :show-locked="true" class="margin-r-10" :sign="showPanel.id" :from="fromRoute.dashboard"></pick-time>
|
2022-06-02 18:43:08 +08:00
|
|
|
|
|
2023-10-12 15:56:40 +08:00
|
|
|
|
<template v-if="!playListControls">
|
|
|
|
|
|
<!-- 切换查看模式 -->
|
|
|
|
|
|
<button class="top-tool-btn view-mode" :title="$t('overall.viewMode')" @click="cycle">
|
|
|
|
|
|
<i class="nz-icon nz-icon-moshiqiehuan"></i>
|
|
|
|
|
|
</button>
|
2022-06-01 15:26:05 +08:00
|
|
|
|
|
2023-10-12 15:56:40 +08:00
|
|
|
|
<!-- 新增图表 -->
|
|
|
|
|
|
<button id="panel-add-chart" v-has="'main_add'" :title="$t('overall.createChart')" class="top-tool-btn margin-r-10" type="button" @click="addChartBefore">
|
|
|
|
|
|
<i class="nz-icon-create-square nz-icon"></i>
|
|
|
|
|
|
</button>
|
2021-04-27 16:26:22 +08:00
|
|
|
|
|
2023-04-06 10:37:06 +08:00
|
|
|
|
<top-tool-more-options
|
2023-10-12 15:56:40 +08:00
|
|
|
|
:delete-objs="batchDeleteObjs"
|
|
|
|
|
|
ref="topTool"
|
|
|
|
|
|
id="panel"
|
|
|
|
|
|
:params="filter"
|
|
|
|
|
|
:permissions="{
|
2023-04-06 10:37:06 +08:00
|
|
|
|
import: 'main_add',
|
|
|
|
|
|
export: 'main_edit'
|
|
|
|
|
|
}"
|
2023-10-12 15:56:40 +08:00
|
|
|
|
:paramsType="'dashboard'"
|
|
|
|
|
|
class="top-tool-export"
|
|
|
|
|
|
export-file-name="chart"
|
|
|
|
|
|
export-url="/visual/dashboard/export"
|
|
|
|
|
|
import-url="/visual/dashboard/import"
|
|
|
|
|
|
:only-json="true"
|
|
|
|
|
|
@export="exportType"
|
|
|
|
|
|
@afterImport="afterImport"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template v-slot:before>
|
|
|
|
|
|
<el-dropdown-item v-has="'main_edit'">
|
|
|
|
|
|
<div id="panel-lock" @click="$store.dispatch('dispatchPanelLock',{flag:!panelLock})"><i :class="{'nz-icon nz-icon-lock':!panelLock,'nz-icon nz-icon-unlock':panelLock}"></i>{{!panelLock ? $t('overall.locked') : $t('overall.unlocked')}}</div>
|
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:after>
|
|
|
|
|
|
<el-dropdown-item v-has="'dashboard_view'">
|
|
|
|
|
|
<div id="chart-export-html" @click="exportType"><i class="nz-icon nz-icon-kuaizhao"></i>{{ $t('overall.snapshoot') }}</div>
|
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</top-tool-more-options>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
</div>
|
2021-12-21 18:05:36 +08:00
|
|
|
|
<div id="tableList" class="table-list" style='overflow-y: unset'>
|
2021-12-27 14:24:35 +08:00
|
|
|
|
<div class="table-list-box">
|
2023-06-01 17:00:14 +08:00
|
|
|
|
<div id="dashboardScrollbar" class="box-content" v-my-loading="chartListLoading" ref="dashboardScrollbar" style='overflow-y: scroll;display: flex;flex-direction: column;overflow-x: hidden'>
|
2022-07-04 14:46:46 +08:00
|
|
|
|
<panel-variables :labelArrs="variables" :time-range="searchTime" @getPanelData="getPanelData"></panel-variables>
|
2021-11-19 09:40:21 +08:00
|
|
|
|
<chart-list
|
|
|
|
|
|
ref="chartList"
|
2022-07-07 10:11:21 +08:00
|
|
|
|
:variablesInit="variablesInit"
|
2023-03-15 15:39:06 +08:00
|
|
|
|
name="dashboard"
|
|
|
|
|
|
:dashboardId="showPanel.id"
|
2022-07-05 18:45:03 +08:00
|
|
|
|
:class="{'show-top':showTopBtn, 'is-dashboard': true}"
|
2022-05-06 10:50:17 +08:00
|
|
|
|
:data-list="dataList"
|
|
|
|
|
|
:is-export-html="false"
|
2021-11-29 16:19:13 +08:00
|
|
|
|
:nowTimeType="nowTimeType"
|
2023-03-15 15:39:06 +08:00
|
|
|
|
:from="fromRoute.dashboard"
|
2021-11-26 20:13:54 +08:00
|
|
|
|
:time-range="searchTime"
|
2021-12-06 15:25:09 +08:00
|
|
|
|
@edit-chart="editChart"
|
2021-11-19 09:40:21 +08:00
|
|
|
|
@on-refresh-time="refreshTime"
|
|
|
|
|
|
@on-remove-chart="delChart"
|
|
|
|
|
|
@on-add-group-item-chart="addGroupItem"
|
2022-03-10 11:31:48 +08:00
|
|
|
|
@refreshPanel="refreshPanel"
|
2021-12-08 14:53:52 +08:00
|
|
|
|
:loading="chartListLoading"
|
2021-11-19 09:40:21 +08:00
|
|
|
|
></chart-list>
|
2021-04-26 21:42:15 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
</div>
|
2020-12-14 20:25:24 +08:00
|
|
|
|
</div>
|
2020-01-03 17:17:09 +08:00
|
|
|
|
</div>
|
2021-04-26 21:42:15 +08:00
|
|
|
|
|
2022-08-04 17:08:54 +08:00
|
|
|
|
<button :class="{'to-top-is-hover': tableHover}" @click="toTop(scrollbarWrap)" class="to-top" style="bottom: -10px;" v-show="showTopBtn" :title="$t('overall.backToTop')"><i class="nz-icon nz-icon-top"></i></button>
|
2019-12-26 13:00:22 +08:00
|
|
|
|
|
2020-07-30 18:37:04 +08:00
|
|
|
|
<transition name="right-box">
|
2021-11-30 17:51:09 +08:00
|
|
|
|
<chart-right-box
|
2021-12-08 16:20:03 +08:00
|
|
|
|
v-if="chartRightBoxShow"
|
2022-03-25 15:40:05 +08:00
|
|
|
|
v-my-loading="rightBox.loading"
|
2021-11-30 17:51:09 +08:00
|
|
|
|
ref="addChartModal"
|
|
|
|
|
|
:chart="chart"
|
2023-03-15 15:39:06 +08:00
|
|
|
|
:from="fromRoute.dashboard"
|
2021-11-30 17:51:09 +08:00
|
|
|
|
:panel-data="panelData"
|
|
|
|
|
|
:show-panel="showPanel"
|
|
|
|
|
|
@close="closeChartBox"
|
|
|
|
|
|
@reload="panelReload"
|
|
|
|
|
|
@reloadOnlyPanel="panelReloadOnlyPanel"
|
|
|
|
|
|
@on-create-success="createSuccess"
|
|
|
|
|
|
></chart-right-box>
|
2020-07-30 18:37:04 +08:00
|
|
|
|
</transition>
|
2021-04-25 18:35:35 +08:00
|
|
|
|
<transition name="right-box">
|
2023-03-15 15:39:06 +08:00
|
|
|
|
<chart-temp-box v-if="rightBox.chartTemp.show" :from="fromRoute.dashboard" :obj="chart" :panel-data="panelData" :show-panel="showPanel" @close="closeChartTempBox" @on-create-success="createSuccess"></chart-temp-box>
|
2021-04-25 18:35:35 +08:00
|
|
|
|
</transition>
|
2020-07-30 18:37:04 +08:00
|
|
|
|
<transition name="right-box">
|
2023-03-15 15:39:06 +08:00
|
|
|
|
<panel-box v-if="rightBox.panel.show" :from="fromRoute.dashboard" ref="panelBox" :obj="panel" @close="closePanelBox" @reload="panelReload" @reloadForDel="panelReloadForDel" ></panel-box>
|
2020-07-30 18:37:04 +08:00
|
|
|
|
</transition>
|
2022-12-06 22:45:30 +08:00
|
|
|
|
<!-- dashboard模板 -->
|
|
|
|
|
|
<transition name="right-box">
|
2023-03-15 15:39:06 +08:00
|
|
|
|
<dashboardTempBox v-if="rightBox.dashboardTemp.show" :from="fromRoute.dashboard" @close="closeDashboardTempBox"></dashboardTempBox>
|
2022-12-06 22:45:30 +08:00
|
|
|
|
</transition>
|
|
|
|
|
|
<!-- 快照进度 -->
|
2023-09-20 11:00:00 +08:00
|
|
|
|
<snapshotProgress v-if="snapshotVisible" :showPanel="showPanel" :searchTime="searchTime" :snapshotVisible.sync="snapshotVisible" api="dashboard"></snapshotProgress>
|
2020-02-03 21:30:07 +08:00
|
|
|
|
</div>
|
2020-01-03 17:17:09 +08:00
|
|
|
|
</template>
|
2020-01-17 16:50:17 +08:00
|
|
|
|
|
2020-01-03 17:17:09 +08:00
|
|
|
|
<script>
|
2022-11-22 19:16:59 +08:00
|
|
|
|
import * as echarts from 'echarts'
|
2023-04-06 17:48:31 +08:00
|
|
|
|
import { chartCache, clearTopology } from '@/components/common/js/common'
|
2022-07-13 14:38:10 +08:00
|
|
|
|
import { data as le5leData, observers as le5leObservers } from 'le5le-store/store/data.js'
|
2021-11-30 16:39:21 +08:00
|
|
|
|
import chartRightBox from '@/components/common/rightBox/chart/chartRightBox'
|
2021-03-19 18:52:19 +08:00
|
|
|
|
import bus from '../../../libs/bus'
|
|
|
|
|
|
import pickTime from '../../common/pickTime'
|
2022-06-03 11:44:53 +08:00
|
|
|
|
import selectDashboard from '../../common/popBox/selectDashboard'
|
2021-04-09 15:07:15 +08:00
|
|
|
|
import panelBox from '@/components/common/rightBox/panelBox'
|
2021-04-25 18:35:35 +08:00
|
|
|
|
import chartTempBox from '@/components/common/rightBox/chartTempBox'
|
2021-04-27 16:26:22 +08:00
|
|
|
|
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
|
2021-05-21 15:06:58 +08:00
|
|
|
|
import { fromRoute } from '@/components/common/js/constants'
|
2021-12-07 14:19:16 +08:00
|
|
|
|
import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
|
2021-12-23 14:54:00 +08:00
|
|
|
|
import routerPathParams from '@/components/common/mixin/routerPathParams'
|
2022-04-08 11:26:17 +08:00
|
|
|
|
import htmlToPdfMixin from '@/components/common/mixin/htmlToPdfMixin'
|
2022-04-11 15:49:10 +08:00
|
|
|
|
import exportHtmlMixin from '@/components/common/mixin/exportHtml'
|
2022-06-30 17:37:29 +08:00
|
|
|
|
import panelVariables from '@/components/common/panel/panelVariables'
|
2022-11-09 10:40:13 +08:00
|
|
|
|
import snapshotProgress from '@/components/common/snapshotProgress/snapshotProgress.vue'
|
2022-12-06 22:45:30 +08:00
|
|
|
|
import dashboardTempBox from '@/components/common/rightBox/dashboardTempBox'
|
2023-04-03 10:03:21 +08:00
|
|
|
|
import playlist from '@/components/common/playlist'
|
2023-04-06 17:48:31 +08:00
|
|
|
|
|
2022-06-13 14:47:25 +08:00
|
|
|
|
// import FileSaver from 'file-saver'
|
2021-12-17 10:11:31 +08:00
|
|
|
|
// import chartData from './testData'
|
2021-03-19 18:52:19 +08:00
|
|
|
|
export default {
|
2023-03-15 15:39:06 +08:00
|
|
|
|
name: 'dashboard',
|
2022-04-11 15:49:10 +08:00
|
|
|
|
mixins: [routerPathParams, htmlToPdfMixin, exportHtmlMixin],
|
2021-03-19 18:52:19 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2021-05-21 15:06:58 +08:00
|
|
|
|
fromRoute,
|
2022-04-08 11:26:17 +08:00
|
|
|
|
pdfId: 'pdfDom',
|
2023-03-15 15:39:06 +08:00
|
|
|
|
htmlTitle: 'dashboard',
|
|
|
|
|
|
dashboardLoading: false,
|
2021-04-28 15:32:50 +08:00
|
|
|
|
overScroll10: false,
|
2021-08-26 14:38:03 +08:00
|
|
|
|
isLoading: true,
|
2021-03-19 18:52:19 +08:00
|
|
|
|
showTopBtn: false, // top按钮
|
|
|
|
|
|
visible: false,
|
2021-10-28 15:16:57 +08:00
|
|
|
|
chartListLoading: true,
|
2021-03-19 18:52:19 +08:00
|
|
|
|
rightBox: { // 面板弹出框相关
|
|
|
|
|
|
chart: { show: false },
|
2021-04-25 18:35:35 +08:00
|
|
|
|
chartTemp: { show: false },
|
2022-12-06 22:45:30 +08:00
|
|
|
|
dashboardTemp: { show: false },
|
2021-12-09 14:15:06 +08:00
|
|
|
|
panel: { show: false },
|
|
|
|
|
|
loading: false
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
tableHover: false,
|
|
|
|
|
|
searchTime: bus.getTimezontDateRange(),
|
|
|
|
|
|
intervalTimer: null,
|
|
|
|
|
|
interval: 0,
|
|
|
|
|
|
showPanel: { // panel下拉列表
|
|
|
|
|
|
id: '',
|
2021-04-08 17:49:07 +08:00
|
|
|
|
name: '',
|
2023-03-15 15:39:06 +08:00
|
|
|
|
type: 'dashboard'
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
panel: { // 新增panel
|
|
|
|
|
|
id: '',
|
2022-06-15 17:25:14 +08:00
|
|
|
|
name: '',
|
|
|
|
|
|
remark: '',
|
|
|
|
|
|
param: {
|
|
|
|
|
|
report: {
|
|
|
|
|
|
enable: false,
|
2022-07-25 14:59:01 +08:00
|
|
|
|
receivers: [],
|
2022-06-15 17:25:14 +08:00
|
|
|
|
range: {
|
|
|
|
|
|
unit: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
schedule: {
|
|
|
|
|
|
repeat: 0,
|
|
|
|
|
|
nums: [],
|
|
|
|
|
|
type: 0
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
chart: {},
|
|
|
|
|
|
blankChart: {
|
|
|
|
|
|
id: '',
|
2021-04-07 16:41:11 +08:00
|
|
|
|
name: '',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
type: 'line',
|
2023-09-19 18:05:37 +08:00
|
|
|
|
span: 6,
|
2021-12-06 15:25:09 +08:00
|
|
|
|
datasource: 'metrics',
|
2023-09-19 18:05:37 +08:00
|
|
|
|
height: 2,
|
2021-03-19 18:52:19 +08:00
|
|
|
|
unit: 2,
|
2021-12-01 16:34:50 +08:00
|
|
|
|
param: {
|
|
|
|
|
|
stack: 0,
|
|
|
|
|
|
nullType: 'null',
|
|
|
|
|
|
legend: { placement: 'bottom', values: [], show: true },
|
2021-12-16 18:13:47 +08:00
|
|
|
|
enable: {
|
|
|
|
|
|
legend: true,
|
2021-12-17 11:18:49 +08:00
|
|
|
|
valueMapping: false,
|
2022-07-15 15:06:56 +08:00
|
|
|
|
thresholds: false,
|
2023-02-08 13:49:50 +08:00
|
|
|
|
visibility: false,
|
2023-08-18 13:58:35 +08:00
|
|
|
|
rightYAxis: false,
|
|
|
|
|
|
tooltip: true
|
2021-12-16 18:13:47 +08:00
|
|
|
|
},
|
2021-12-01 16:34:50 +08:00
|
|
|
|
thresholdShow: true,
|
2022-05-17 18:54:19 +08:00
|
|
|
|
thresholds: [{ value: undefined, color: randomcolor() }],
|
2022-07-15 15:06:56 +08:00
|
|
|
|
showHeader: 1,
|
|
|
|
|
|
visibility: {
|
|
|
|
|
|
varName: '',
|
2022-07-18 16:25:02 +08:00
|
|
|
|
operator: 'equal',
|
2022-07-15 15:06:56 +08:00
|
|
|
|
varValue: '',
|
2022-07-18 16:25:02 +08:00
|
|
|
|
result: 'show'
|
2023-02-08 13:49:50 +08:00
|
|
|
|
},
|
|
|
|
|
|
rightYAxis: {
|
|
|
|
|
|
elementNames: [],
|
|
|
|
|
|
style: 'line',
|
|
|
|
|
|
unit: 2,
|
|
|
|
|
|
label: '',
|
|
|
|
|
|
min: undefined,
|
|
|
|
|
|
max: undefined
|
2023-05-26 18:01:27 +08:00
|
|
|
|
},
|
2023-08-18 13:58:35 +08:00
|
|
|
|
dataLink: [],
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
mode: 'all',
|
|
|
|
|
|
sort: 'none'
|
2023-09-07 10:37:43 +08:00
|
|
|
|
},
|
2021-12-01 16:34:50 +08:00
|
|
|
|
},
|
2023-10-11 17:40:10 +08:00
|
|
|
|
elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1, orderNum: 0, step: undefined, queryType: 1 }],
|
2021-03-19 18:52:19 +08:00
|
|
|
|
panel: '',
|
2021-04-07 16:41:11 +08:00
|
|
|
|
sync: 0,
|
|
|
|
|
|
remark: '',
|
2023-01-05 17:53:42 +08:00
|
|
|
|
groupId: '',
|
|
|
|
|
|
varType: ''
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
pageObj: {
|
|
|
|
|
|
pageNo: 1,
|
2023-02-08 13:49:50 +08:00
|
|
|
|
pageSize: -1, // 此处获取所有数据
|
2021-03-19 18:52:19 +08:00
|
|
|
|
total: 0
|
|
|
|
|
|
},
|
|
|
|
|
|
panelData: [],
|
|
|
|
|
|
panelDataDragTmp: [],
|
|
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
|
searchLabelList: [
|
2021-05-10 15:59:39 +08:00
|
|
|
|
{
|
|
|
|
|
|
name: 'ID',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'ids',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: this.$t('overall.name'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'name',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: this.$t('overall.type'),
|
|
|
|
|
|
type: 'selectString',
|
|
|
|
|
|
label: 'chartType',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2023-03-17 12:46:56 +08:00
|
|
|
|
name: this.$t('dashboard.dashboard.chartForm.varType'),
|
2021-05-10 15:59:39 +08:00
|
|
|
|
type: 'select',
|
|
|
|
|
|
label: 'varType',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
searchLabel: {}, // 搜索参数
|
|
|
|
|
|
// ---图表相关参数--start
|
|
|
|
|
|
dataList: [], // 数据列表
|
|
|
|
|
|
filter: { // 过滤条件
|
2023-03-28 09:16:24 +08:00
|
|
|
|
dashboardId: 0
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2023-03-15 15:39:06 +08:00
|
|
|
|
dashboardId: 0,
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// ---图表相关参数--end
|
2021-11-02 15:47:17 +08:00
|
|
|
|
scrollbarWrap: null,
|
2021-11-24 09:38:06 +08:00
|
|
|
|
batchDeleteObjs: [],
|
2022-05-12 16:56:55 +08:00
|
|
|
|
nowTimeType: {},
|
2022-05-24 15:04:46 +08:00
|
|
|
|
showTopLine: false,
|
2022-06-01 15:26:05 +08:00
|
|
|
|
// 查看模式
|
2022-06-30 17:37:29 +08:00
|
|
|
|
mode: '',
|
2022-07-04 14:46:46 +08:00
|
|
|
|
variables: [],
|
2022-11-09 10:40:13 +08:00
|
|
|
|
variablesInit: false, // 判断variables 是否加载完成
|
2023-01-09 16:39:58 +08:00
|
|
|
|
snapshotVisible: false,
|
2023-03-28 09:16:24 +08:00
|
|
|
|
stableTime: null,
|
|
|
|
|
|
timeData: [
|
|
|
|
|
|
{ id: 1, text: this.$t('dashboard.dashboard.lastFiveMin'), type: 'minute', value: 5 },
|
|
|
|
|
|
{ id: 2, text: this.$t('dashboard.dashboard.lastFifteenMin'), type: 'minute', value: 15 },
|
|
|
|
|
|
{ id: 3, text: this.$t('dashboard.dashboard.lastThirtyMin'), type: 'minute', value: 30 },
|
|
|
|
|
|
{ id: 4, text: this.$t('dashboard.dashboard.lastOneHour'), type: 'hour', value: 1 },
|
|
|
|
|
|
{ id: 5, text: this.$t('dashboard.dashboard.lastThreeHour'), type: 'hour', value: 3 },
|
|
|
|
|
|
{ id: 6, text: this.$t('dashboard.dashboard.lastSixHour'), type: 'hour', value: 6 },
|
|
|
|
|
|
{ id: 7, text: this.$t('dashboard.dashboard.lastTwelveHour'), type: 'hour', value: 12 },
|
|
|
|
|
|
{ id: 8, text: this.$t('dashboard.dashboard.lastTwentyFourHour'), type: 'hour', value: 24 },
|
|
|
|
|
|
{ id: 9, text: this.$t('dashboard.dashboard.lastTwoDay'), type: 'date', value: 2 },
|
|
|
|
|
|
{ id: 10, text: this.$t('dashboard.dashboard.lastSevenDay'), type: 'date', value: 7 },
|
2023-09-01 15:01:31 +08:00
|
|
|
|
{ id: 11, text: this.$t('dashboard.dashboard.lastThirtyDay'), type: 'date', value: 30 },
|
|
|
|
|
|
{ id: 13, text: 'today', type: 'relative', value: 0 },
|
|
|
|
|
|
{ id: 14, text: 'Yesterday ', type: 'relative', value: 1 },
|
|
|
|
|
|
{ id: 15, text: 'The day before yesterday', type: 'relative', value: 2 },
|
|
|
|
|
|
{ id: 16, text: 'This day last week', type: 'relative', value: 7 },
|
|
|
|
|
|
{ id: 17, text: 'This week', type: 'relative', value: 0 },
|
|
|
|
|
|
{ id: 18, text: 'Previous week', type: 'relative', value: 1 },
|
|
|
|
|
|
{ id: 19, text: 'This month', type: 'relative', value: 0 },
|
|
|
|
|
|
{ id: 20, text: 'Previous month', type: 'relative', value: 1 }
|
2023-03-28 09:16:24 +08:00
|
|
|
|
],
|
|
|
|
|
|
intervalList: [
|
|
|
|
|
|
{ value: 0, label: this.$t('dashboard.dashboard.chartForm.lockList.off') },
|
|
|
|
|
|
{ value: 30, label: '30s' },
|
|
|
|
|
|
{ value: 60, label: '1m' },
|
|
|
|
|
|
{ value: 300, label: '5m' },
|
|
|
|
|
|
{ value: 900, label: '15m' },
|
|
|
|
|
|
{ value: 1800, label: '30m' }
|
2023-04-03 10:03:21 +08:00
|
|
|
|
],
|
|
|
|
|
|
playListControls: false, // 显示隐藏轮播按钮
|
|
|
|
|
|
playlistObj: {} // 轮播仪表盘配置
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
components: {
|
|
|
|
|
|
'pick-time': pickTime,
|
2021-04-25 18:35:35 +08:00
|
|
|
|
'panel-box': panelBox,
|
2021-04-27 16:26:22 +08:00
|
|
|
|
topToolMoreOptions,
|
2022-06-03 11:44:53 +08:00
|
|
|
|
selectDashboard,
|
2021-11-30 16:39:21 +08:00
|
|
|
|
chartTempBox,
|
2022-06-30 17:37:29 +08:00
|
|
|
|
chartRightBox,
|
2022-11-09 10:40:13 +08:00
|
|
|
|
panelVariables, // 处理panel变量的组件
|
2022-12-06 22:45:30 +08:00
|
|
|
|
snapshotProgress, // 快照进度
|
2023-04-03 10:03:21 +08:00
|
|
|
|
dashboardTempBox, // dashboard模板
|
|
|
|
|
|
playlist
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-12-08 16:20:03 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
chartRightBoxShow () {
|
|
|
|
|
|
return this.$store.getters.getShowRightBox
|
|
|
|
|
|
},
|
|
|
|
|
|
delChartFlag () {
|
|
|
|
|
|
return this.$store.getters.getDelChart
|
2022-02-14 17:48:13 +08:00
|
|
|
|
},
|
|
|
|
|
|
panelLock () {
|
|
|
|
|
|
return this.$store.getters.getPanelLock
|
2023-07-20 14:39:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
timePickerLocked () {
|
|
|
|
|
|
return this.$store.getters.getTimePickerLocked
|
|
|
|
|
|
},
|
|
|
|
|
|
timePickerRange () {
|
|
|
|
|
|
return this.$store.getters.getTimePickerRange
|
2021-12-08 16:20:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
methods: {
|
2023-04-03 10:03:21 +08:00
|
|
|
|
// 开始轮播列表
|
2023-04-06 10:37:06 +08:00
|
|
|
|
async startPlay (data) {
|
2023-04-03 10:03:21 +08:00
|
|
|
|
this.playlistObj = data
|
2023-04-06 10:37:06 +08:00
|
|
|
|
let mode = data.mode
|
|
|
|
|
|
if (!mode || mode == 'normal') {
|
|
|
|
|
|
mode = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
this.mode = mode
|
|
|
|
|
|
this.$store.commit('setMode', this.mode)
|
|
|
|
|
|
this.playListControls = true
|
2023-04-03 10:03:21 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 结束轮播列表
|
|
|
|
|
|
stopPlaylist () {
|
2023-04-06 10:37:06 +08:00
|
|
|
|
this.clearPlaylist()
|
|
|
|
|
|
const param = { ...this.$route.query }
|
|
|
|
|
|
if (param.mode) {
|
|
|
|
|
|
delete param.mode
|
|
|
|
|
|
const path = this.fromRoute.dashboard
|
|
|
|
|
|
this.updatePath(param, path)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
clearPlaylist () {
|
|
|
|
|
|
if (this.mode) {
|
|
|
|
|
|
this.mode = ''
|
|
|
|
|
|
this.$store.commit('setMode', this.mode)
|
|
|
|
|
|
}
|
2023-04-03 10:03:21 +08:00
|
|
|
|
this.playListControls = false
|
|
|
|
|
|
this.playlistObj = {}
|
|
|
|
|
|
},
|
2022-12-06 22:45:30 +08:00
|
|
|
|
closeDashboardTempBox (refresh) {
|
|
|
|
|
|
this.rightBox.dashboardTemp.show = false
|
|
|
|
|
|
if (refresh) {
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 通过dashboard模板创建
|
|
|
|
|
|
addByTemplate () {
|
|
|
|
|
|
this.rightBox.dashboardTemp.show = true
|
|
|
|
|
|
// 关闭selectDashboard弹框
|
|
|
|
|
|
this.$refs.selectDashboard && this.$refs.selectDashboard.esc()
|
|
|
|
|
|
},
|
2022-05-25 14:56:46 +08:00
|
|
|
|
// 新增收藏
|
|
|
|
|
|
addStarred (data) {
|
2022-06-03 11:44:53 +08:00
|
|
|
|
this.$refs.selectDashboard.addStarred(data)
|
2022-05-25 14:56:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 删除收藏
|
|
|
|
|
|
delStarred (data) {
|
2022-06-03 11:44:53 +08:00
|
|
|
|
this.$refs.selectDashboard.delStarred(data)
|
2022-05-25 14:56:46 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// 刷新
|
2022-03-10 11:31:48 +08:00
|
|
|
|
refreshPanel () {
|
|
|
|
|
|
this.getData(this.filter)
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-01-12 20:39:59 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
del (u) {
|
|
|
|
|
|
this.$confirm(this.$t('tip.confirmDelete'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
2023-04-03 10:03:21 +08:00
|
|
|
|
this.$delete('visual/dashboard?ids=' + u.id).then((response) => {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
duration: 1000,
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
message: this.$t('tip.deleteSuccess')
|
|
|
|
|
|
})
|
2023-03-28 09:16:24 +08:00
|
|
|
|
// 判断删除的是否是当前面板
|
|
|
|
|
|
if (this.showPanel.id == u.id) {
|
2023-04-06 10:37:06 +08:00
|
|
|
|
this.clearPlaylist()
|
2023-03-28 09:16:24 +08:00
|
|
|
|
const param = { t: +new Date() }
|
|
|
|
|
|
const path = this.fromRoute.dashboard
|
|
|
|
|
|
this.updatePath(param, path)
|
|
|
|
|
|
this.getTableData(true)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.getTableData(false)
|
2022-06-02 11:01:03 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg)
|
2022-03-23 15:06:36 +08:00
|
|
|
|
this.$store.dispatch('clearPanel')
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-03-23 15:06:36 +08:00
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
this.$store.dispatch('clearPanel')
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
edit (u) {
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.$get('visual/dashboard/' + u.id).then(res => {
|
2022-06-17 10:02:07 +08:00
|
|
|
|
if (res.code === 200) {
|
2022-07-05 16:52:52 +08:00
|
|
|
|
this.panel = res.data
|
2023-06-05 14:52:04 +08:00
|
|
|
|
if (!this.$lodash.get(this.panel, 'param.report', '')) {
|
2022-06-17 10:02:07 +08:00
|
|
|
|
this.panel = {
|
|
|
|
|
|
...this.panel,
|
|
|
|
|
|
param: {
|
|
|
|
|
|
report: {
|
|
|
|
|
|
enable: false,
|
|
|
|
|
|
range: {
|
2022-07-06 13:51:36 +08:00
|
|
|
|
unit: 'day'
|
2022-06-17 10:02:07 +08:00
|
|
|
|
},
|
|
|
|
|
|
schedule: {
|
2022-07-06 13:51:36 +08:00
|
|
|
|
type: '2',
|
2022-06-17 10:02:07 +08:00
|
|
|
|
repeat: 1,
|
|
|
|
|
|
nums: [],
|
|
|
|
|
|
stime: '',
|
|
|
|
|
|
etime: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
receivers: []
|
|
|
|
|
|
},
|
2023-03-28 09:16:24 +08:00
|
|
|
|
chartShare: 'none',
|
|
|
|
|
|
defaultTimeRange: 4,
|
|
|
|
|
|
refresh: 0
|
2022-06-17 10:02:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-16 13:55:45 +08:00
|
|
|
|
}
|
2022-06-17 10:02:07 +08:00
|
|
|
|
this.panel.param.report.schedule.type = this.panel.param.report.schedule.type + ''
|
2023-06-05 14:52:04 +08:00
|
|
|
|
const startTime = this.$lodash.get(this.panel, 'param.report.schedule.stime', '')
|
2022-06-17 10:02:07 +08:00
|
|
|
|
if (startTime !== '') {
|
|
|
|
|
|
this.panel.param.report.schedule.stime = this.utcTimeToTimezoneStr(this.panel.param.report.schedule.stime, 'YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.panel.param.report.schedule.stime = ''
|
|
|
|
|
|
}
|
2023-06-05 14:52:04 +08:00
|
|
|
|
const endTime = this.$lodash.get(this.panel, 'param.report.schedule.etime', '')
|
2022-06-17 10:02:07 +08:00
|
|
|
|
if (endTime !== '') {
|
|
|
|
|
|
this.panel.param.report.schedule.etime = this.utcTimeToTimezoneStr(this.panel.param.report.schedule.etime, 'YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.panel.param.report.schedule.etime = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
this.rightBox.panel.show = true
|
2022-06-16 13:55:45 +08:00
|
|
|
|
}
|
2022-06-17 10:02:07 +08:00
|
|
|
|
})
|
|
|
|
|
|
// this.panel = Object.assign({}, u)
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
toAdd () {
|
2023-03-15 15:39:06 +08:00
|
|
|
|
if (!this.hasButton('dashboard_view')) {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
return
|
|
|
|
|
|
}
|
2021-05-12 16:19:43 +08:00
|
|
|
|
this.rightBox.panel.show = true
|
2022-07-05 16:52:52 +08:00
|
|
|
|
// 关闭selectDashboard弹框
|
|
|
|
|
|
this.$refs.selectDashboard && this.$refs.selectDashboard.esc()
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.panel = {
|
|
|
|
|
|
id: '',
|
2022-06-15 17:25:14 +08:00
|
|
|
|
name: '',
|
|
|
|
|
|
remark: '',
|
|
|
|
|
|
param: {
|
|
|
|
|
|
report: {
|
|
|
|
|
|
enable: false,
|
2022-07-25 14:59:01 +08:00
|
|
|
|
receivers: [],
|
2022-06-15 17:25:14 +08:00
|
|
|
|
range: {
|
2022-07-06 13:51:36 +08:00
|
|
|
|
unit: 'day'
|
2022-06-15 17:25:14 +08:00
|
|
|
|
},
|
|
|
|
|
|
schedule: {
|
|
|
|
|
|
stime: '',
|
|
|
|
|
|
etime: '',
|
|
|
|
|
|
nums: [],
|
2022-07-06 13:51:36 +08:00
|
|
|
|
type: 2 + '',
|
2022-06-16 13:55:45 +08:00
|
|
|
|
repeat: 1
|
2022-06-15 17:25:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-03-28 09:16:24 +08:00
|
|
|
|
chartShare: 'none',
|
|
|
|
|
|
defaultTimeRange: 4,
|
|
|
|
|
|
refresh: 0
|
2022-06-15 17:25:14 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
panelReload (clearShowPanel) {
|
|
|
|
|
|
this.getTableData(clearShowPanel)
|
|
|
|
|
|
},
|
|
|
|
|
|
refreshTime (st, et) {
|
|
|
|
|
|
const startTime = bus.timeFormate(st, 'yyyy-MM-dd hh:mm')
|
|
|
|
|
|
const endTime = bus.timeFormate(et, 'yyyy-MM-dd hh:mm')
|
2021-03-31 10:02:12 +08:00
|
|
|
|
this.searchTime = [startTime, endTime, '']
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
panelReloadForDel: function () {
|
|
|
|
|
|
if (this.showPanel.id === this.panel.id) {
|
|
|
|
|
|
this.showPanel.id = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
},
|
|
|
|
|
|
/* 图表相关操作--start */
|
|
|
|
|
|
addChart () {
|
|
|
|
|
|
this.chart = this.newChart()
|
2021-12-09 10:39:16 +08:00
|
|
|
|
this.chart.param.thresholds = [{ value: undefined, color: randomcolor() }]
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.chart.dashboardId = this.showPanel.id
|
2021-04-08 17:49:07 +08:00
|
|
|
|
this.chart.panelName = this.showPanel.name
|
2023-01-05 17:53:42 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.addChartModal.isStable = 'stable'
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-04-08 17:49:07 +08:00
|
|
|
|
addGroupItem (groupId) {
|
|
|
|
|
|
this.chart = this.newChart()
|
|
|
|
|
|
this.chart.groupId = groupId
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.chart.dashboardId = this.showPanel.id
|
2021-04-08 17:49:07 +08:00
|
|
|
|
this.chart.panelName = this.showPanel.name
|
|
|
|
|
|
this.chart.isGroup = true
|
2023-01-05 17:53:42 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.addChartModal.isStable = 'stable'
|
|
|
|
|
|
})
|
2021-04-08 17:49:07 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
newChart () {
|
|
|
|
|
|
return JSON.parse(JSON.stringify(this.blankChart))
|
|
|
|
|
|
},
|
|
|
|
|
|
// 编辑图表信息,打开编辑弹窗
|
2021-06-18 16:57:49 +08:00
|
|
|
|
editChart (data, copy) {
|
|
|
|
|
|
if (copy) {
|
|
|
|
|
|
this.chart = JSON.parse(JSON.stringify(data))
|
2021-12-29 16:18:46 +08:00
|
|
|
|
this.chart.x = 0
|
|
|
|
|
|
this.chart.y = 0
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.chart.dashboardId = this.showPanel.id
|
2021-06-18 16:57:49 +08:00
|
|
|
|
this.chart.panelName = this.showPanel.name
|
2021-12-08 16:20:03 +08:00
|
|
|
|
this.chart.id = ''
|
2021-12-23 19:37:52 +08:00
|
|
|
|
this.chart.elements.forEach((item) => {
|
|
|
|
|
|
item.id = ''
|
|
|
|
|
|
item.chartId = ''
|
|
|
|
|
|
delete item.seq
|
|
|
|
|
|
})
|
2022-05-11 15:34:37 +08:00
|
|
|
|
if (this.chart.datasource !== 'metrics' && this.chart.datasource !== 'logs') {
|
2021-12-29 16:18:46 +08:00
|
|
|
|
delete this.chart.elements
|
|
|
|
|
|
}
|
2021-12-29 18:12:40 +08:00
|
|
|
|
if (!this.chart.groupId || this.chart.groupId == -1) {
|
|
|
|
|
|
this.chart.groupId = ''
|
|
|
|
|
|
}
|
2023-08-07 15:27:14 +08:00
|
|
|
|
if (this.chart.type === 'group' && !this.chart.param.collapse == undefined) {
|
|
|
|
|
|
this.chart.param.collapse = false
|
|
|
|
|
|
}
|
2023-09-19 18:05:37 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.$refs.addChartModal.isStable = 'stable'
|
|
|
|
|
|
})
|
2021-06-18 16:57:49 +08:00
|
|
|
|
} else {
|
2021-12-09 14:15:06 +08:00
|
|
|
|
this.rightBox.loading = true
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.$get('visual/dashboard/chart/' + data.id).then(res => {
|
2021-12-09 14:15:06 +08:00
|
|
|
|
this.rightBox.loading = false
|
2021-06-18 16:57:49 +08:00
|
|
|
|
if (res.code === 200) {
|
2022-03-02 10:46:57 +08:00
|
|
|
|
const chartData = res.data
|
2021-06-18 16:57:49 +08:00
|
|
|
|
this.chart = JSON.parse(JSON.stringify(chartData))
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.chart.dashboardId = this.showPanel.id
|
2021-06-18 16:57:49 +08:00
|
|
|
|
this.chart.panelName = this.showPanel.name
|
2022-03-10 11:08:40 +08:00
|
|
|
|
if (this.chart.param) {
|
|
|
|
|
|
this.chart.param = JSON.parse(this.chart.param)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.chart.param = {}
|
|
|
|
|
|
}
|
2023-05-26 18:01:27 +08:00
|
|
|
|
if (!this.chart.groupId || this.chart.groupId == -1) {
|
|
|
|
|
|
this.chart.groupId = ''
|
|
|
|
|
|
}
|
2023-08-07 15:27:14 +08:00
|
|
|
|
if (this.chart.type === 'group' && !this.chart.param.collapse == undefined) {
|
|
|
|
|
|
this.chart.param.collapse = false
|
|
|
|
|
|
}
|
2023-01-09 16:39:58 +08:00
|
|
|
|
setTimeout(() => {
|
2023-01-05 17:53:42 +08:00
|
|
|
|
this.$refs.addChartModal.isStable = 'stable'
|
|
|
|
|
|
})
|
2021-06-18 16:57:49 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(res.msg)
|
2021-06-03 17:12:45 +08:00
|
|
|
|
}
|
2021-06-18 16:57:49 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
closeChartBox (refresh) {
|
2021-12-09 14:15:06 +08:00
|
|
|
|
this.chart = {}
|
2021-12-08 16:20:03 +08:00
|
|
|
|
this.$store.dispatch('clearPanel')
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-05-18 19:18:14 +08:00
|
|
|
|
closeChartTempBox (refresh) {
|
2021-04-25 18:35:35 +08:00
|
|
|
|
this.rightBox.chartTemp.show = false
|
2021-05-18 19:18:14 +08:00
|
|
|
|
if (refresh) {
|
|
|
|
|
|
this.getData(this.filter)
|
|
|
|
|
|
}
|
2021-04-25 18:35:35 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
closePanelBox (refresh) {
|
|
|
|
|
|
this.rightBox.panel.show = false
|
2021-05-12 16:19:43 +08:00
|
|
|
|
if (refresh) {
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 移除图表:弹出确认框询问
|
|
|
|
|
|
delChart (data, from) {
|
|
|
|
|
|
this.$confirm(this.$t('tip.confirmDelete'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.$delete('visual/dashboard/chart?ids=' + data.id).then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
duration: 2000,
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
message: this.$t('tip.deleteSuccess')
|
|
|
|
|
|
})
|
2021-12-08 16:20:03 +08:00
|
|
|
|
this.getData(this.filter)
|
2021-12-09 14:15:06 +08:00
|
|
|
|
this.chart = {}
|
|
|
|
|
|
this.$store.dispatch('clearPanel')
|
2021-11-30 16:39:21 +08:00
|
|
|
|
// this.$refs.chartList.loadChartData(this.scrollbarWrap.scrollTop)
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// if(nextChart&&prevChart){ //删除图表为中间位置
|
|
|
|
|
|
// prevChart.next = nextChart.id;
|
|
|
|
|
|
// nextChart.prev = prevChart.id;
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
// if(!nextChart) prevChart.next = -1;
|
|
|
|
|
|
// if(!prevChart) nextChart.prev = 0;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// this.getTableData(); //删除相关图表后,刷新面板数据
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg)
|
2022-03-22 15:42:50 +08:00
|
|
|
|
this.$store.dispatch('clearPanel')
|
2020-02-03 21:30:07 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
2021-12-14 18:57:21 +08:00
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
this.chart = {}
|
|
|
|
|
|
this.$store.dispatch('clearPanel')
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 图表创建成功,回调panel页面,进行图表的刷新
|
|
|
|
|
|
createSuccess (msg, data, params, panel) {
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.filter.dashboardId = this.showPanel.id
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.getData(this.filter)
|
2022-03-11 10:45:19 +08:00
|
|
|
|
this.$store.dispatch('clearPanel')
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 获取数据,用在子页面
|
|
|
|
|
|
getData (params) {
|
2023-03-15 15:39:06 +08:00
|
|
|
|
if (!this.hasButton('dashboard_view')) {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
return
|
|
|
|
|
|
}
|
2022-07-13 14:38:10 +08:00
|
|
|
|
this.dataList = []
|
2021-11-19 09:40:21 +08:00
|
|
|
|
this.chartListLoading = true
|
2022-07-13 14:38:10 +08:00
|
|
|
|
if (le5leData) {
|
|
|
|
|
|
Object.keys(le5leData).forEach(key => {
|
|
|
|
|
|
le5leData[key] = null
|
|
|
|
|
|
delete le5leData[key]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
if (le5leObservers) {
|
|
|
|
|
|
Object.keys(le5leObservers).forEach(key => {
|
|
|
|
|
|
le5leObservers[key] = null
|
|
|
|
|
|
delete le5leObservers[key]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.$get('visual/dashboard/chart?dashboardId=' + params.dashboardId + '&groupId=0' + '&pageSize=-1').then(response => {
|
2021-11-19 09:40:21 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.chartListLoading = false
|
2021-12-08 14:37:57 +08:00
|
|
|
|
this.dataList = response.data.list.map(item => {
|
2021-11-19 09:40:21 +08:00
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
loaded: false
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-03-28 09:16:24 +08:00
|
|
|
|
// 面板相关操作
|
2023-04-03 10:03:21 +08:00
|
|
|
|
panelChange (val, type) {
|
2023-03-28 09:16:24 +08:00
|
|
|
|
if (!val) {
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
2023-04-06 17:48:31 +08:00
|
|
|
|
clearTopology()
|
2023-03-28 09:16:24 +08:00
|
|
|
|
const param = {
|
|
|
|
|
|
dashboardId: val.id
|
|
|
|
|
|
}
|
2023-04-06 10:37:06 +08:00
|
|
|
|
if (type === 'select') {
|
|
|
|
|
|
// 切换面板 则停止仪表盘轮播
|
|
|
|
|
|
this.clearPlaylist()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
param.mode = this.mode
|
|
|
|
|
|
}
|
2023-03-28 09:16:24 +08:00
|
|
|
|
const path = this.fromRoute.dashboard
|
|
|
|
|
|
this.updatePath(param, path)
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.variablesInit = false
|
|
|
|
|
|
this.showPanel = val
|
2023-06-05 14:52:04 +08:00
|
|
|
|
this.variables = this.$lodash.cloneDeep(this.$lodash.get(this, 'showPanel.param.variables', []) || [])
|
2023-03-28 09:16:24 +08:00
|
|
|
|
this.showPanel.type = 'dashboard'
|
|
|
|
|
|
this.filter.dashboardId = this.showPanel.id
|
|
|
|
|
|
this.dashboardId = this.showPanel.id
|
|
|
|
|
|
this.getData(this.filter)
|
|
|
|
|
|
this.$refs.chartList.cleanData()
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
/* 图表相关操作--end */
|
|
|
|
|
|
/* 时间条件查询--start */
|
|
|
|
|
|
// 选择日期变化
|
2023-09-19 18:05:37 +08:00
|
|
|
|
dateChange (timeRange) {
|
2023-04-06 17:48:31 +08:00
|
|
|
|
clearTopology()
|
2021-03-19 18:52:19 +08:00
|
|
|
|
const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
|
2021-11-24 09:38:06 +08:00
|
|
|
|
this.nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
|
2023-08-31 16:08:49 +08:00
|
|
|
|
this.setSearchTime('searchTime')
|
2022-07-07 10:11:21 +08:00
|
|
|
|
this.getData(this.filter)
|
2021-12-14 18:57:21 +08:00
|
|
|
|
this.$store.dispatch('dispatchPanelTime', {
|
2021-12-09 16:59:46 +08:00
|
|
|
|
time: this.searchTime,
|
|
|
|
|
|
nowTimeType: this.nowTimeType
|
|
|
|
|
|
})
|
2023-07-20 14:39:41 +08:00
|
|
|
|
this.$store.dispatch('dispatchTimePickerRange', {
|
|
|
|
|
|
time: this.searchTime,
|
|
|
|
|
|
nowTimeType: this.nowTimeType
|
|
|
|
|
|
})
|
2023-03-28 09:16:24 +08:00
|
|
|
|
// 选择时间范围时更新路由
|
2023-09-19 18:05:37 +08:00
|
|
|
|
if (timeRange) {
|
2023-03-28 09:16:24 +08:00
|
|
|
|
const param = { ...this.$route.query }
|
|
|
|
|
|
param.nowTimeType = JSON.stringify(this.nowTimeType)
|
|
|
|
|
|
param.searchTime = JSON.stringify(this.searchTime)
|
|
|
|
|
|
const path = this.fromRoute.dashboard
|
|
|
|
|
|
this.updatePath(param, path)
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2023-08-31 16:08:49 +08:00
|
|
|
|
storeDispatchPanelTime () { // 设置searchTime
|
2023-07-20 18:29:00 +08:00
|
|
|
|
this.$store.dispatch('dispatchPanelTime', {
|
|
|
|
|
|
time: this.searchTime,
|
|
|
|
|
|
nowTimeType: this.nowTimeType
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
/* 时间条件查询--end */
|
|
|
|
|
|
// 公用操作
|
|
|
|
|
|
jumpTo (data, id) {
|
|
|
|
|
|
bus.$emit('menu-change', data)
|
|
|
|
|
|
this.$router.push({
|
|
|
|
|
|
path: '/' + data,
|
|
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date()
|
2020-12-15 21:13:07 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
panelReloadOnlyPanel () { // 仅刷新panel数据
|
2023-03-15 15:39:06 +08:00
|
|
|
|
if (!this.hasButton('dashboard_view')) {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
return
|
|
|
|
|
|
}
|
2023-03-15 15:39:06 +08:00
|
|
|
|
this.$get('visual/dashboard?pageSize=-1').then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.panelData = response.data.list
|
|
|
|
|
|
for (let i = 0; i < this.panelData.length; i++) {
|
|
|
|
|
|
if (this.panelData[i].id == this.showPanel.id) {
|
2021-09-24 15:07:23 +08:00
|
|
|
|
this.showPanel = this.panelData[i]
|
2021-03-19 18:52:19 +08:00
|
|
|
|
break
|
2020-02-07 19:57:39 +08:00
|
|
|
|
}
|
2020-02-06 18:50:40 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-01-13 15:27:17 +08:00
|
|
|
|
|
2023-03-28 09:16:24 +08:00
|
|
|
|
async getTableData (clearShowPanel) {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
const vm = this
|
2023-03-28 09:16:24 +08:00
|
|
|
|
let response
|
|
|
|
|
|
try {
|
|
|
|
|
|
response = await this.$get('visual/dashboard?type=dashboard&pageSize=-1')
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
// console.log('error................'+JSON.stringify(error));
|
|
|
|
|
|
if (error) {
|
|
|
|
|
|
console.error(error)
|
|
|
|
|
|
this.$message.error(error.toString())
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
let isInitData = false
|
|
|
|
|
|
this.panelData = JSON.parse(JSON.stringify(response.data.list))
|
|
|
|
|
|
if (response.data.list.length > 0) {
|
|
|
|
|
|
if (this.$store.state.showPanel.id > 0 && this.$store.state.showPanel.name) {
|
|
|
|
|
|
this.showPanel = JSON.parse(JSON.stringify(this.$store.state.showPanel))
|
|
|
|
|
|
}
|
|
|
|
|
|
if (clearShowPanel) {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.showPanel.id = ''
|
2020-02-07 19:57:39 +08:00
|
|
|
|
}
|
2023-03-28 09:16:24 +08:00
|
|
|
|
if (!this.showPanel.id) {
|
|
|
|
|
|
this.showPanel = response.data.list[0]
|
|
|
|
|
|
this.filter.dashboardId = this.showPanel.id
|
2022-07-07 10:11:21 +08:00
|
|
|
|
this.getData(this.filter)
|
2023-03-28 09:16:24 +08:00
|
|
|
|
isInitData = true
|
2021-03-19 18:52:19 +08:00
|
|
|
|
} else {
|
2023-03-28 09:16:24 +08:00
|
|
|
|
handler(response.data.list)
|
|
|
|
|
|
this.filter.dashboardId = this.showPanel.id
|
2020-02-03 21:30:07 +08:00
|
|
|
|
}
|
2023-03-28 09:16:24 +08:00
|
|
|
|
this.isLoading = false
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.showPanel.id = ''
|
|
|
|
|
|
this.filter.dashboardId = ''
|
|
|
|
|
|
this.isLoading = !response.data.list.length === 0
|
2020-02-03 21:30:07 +08:00
|
|
|
|
}
|
2023-03-28 09:16:24 +08:00
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
|
if (!isInitData && (this.panel.id === '' || this.panel.id === this.showPanel.id)) {
|
|
|
|
|
|
this.getData(this.filter)
|
2020-04-27 22:17:31 +08:00
|
|
|
|
}
|
2023-03-28 09:16:24 +08:00
|
|
|
|
this.$store.state.showPanel.id = 0
|
|
|
|
|
|
this.$store.state.showPanel.name = ''
|
|
|
|
|
|
this.$store.state.showPanel.type = 'dashboard'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (response.msg) {
|
|
|
|
|
|
this.$message.error(response.msg)
|
|
|
|
|
|
} else if (response.error) {
|
|
|
|
|
|
this.$message.error(response.error)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-05 14:52:04 +08:00
|
|
|
|
this.variables = this.$lodash.get(this, 'showPanel.param.variables', []) || []
|
2021-03-19 18:52:19 +08:00
|
|
|
|
|
|
|
|
|
|
function handler (panelData) {
|
|
|
|
|
|
panelData.forEach(panel => {
|
|
|
|
|
|
if (panel.id == vm.showPanel.id) {
|
|
|
|
|
|
vm.showPanel = panel
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (panel.children && panel.children.length > 0) {
|
|
|
|
|
|
handler(panel.children)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 定期刷新
|
|
|
|
|
|
selectInterval (val) {
|
|
|
|
|
|
this.visible = false
|
|
|
|
|
|
clearInterval(this.intervalTimer)
|
|
|
|
|
|
if (val) {
|
|
|
|
|
|
this.interval = val
|
|
|
|
|
|
const start = new Date(this.searchTime[1])
|
|
|
|
|
|
const now = new Date()
|
|
|
|
|
|
const interval = Math.floor((now.getTime() - start.getTime()) / 1000) // 计算当前结束时间到现在的间隔(秒)
|
|
|
|
|
|
if (interval >= 60) { // 如果结束时间到现在超过1分钟,则
|
|
|
|
|
|
this.getIntervalData(interval)
|
2020-02-14 18:07:21 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.intervalTimer = setInterval(() => {
|
|
|
|
|
|
this.getIntervalData(this.interval)
|
|
|
|
|
|
}, val * 1000)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getIntervalData (interval) { // interval:结束时间到现在的秒数
|
|
|
|
|
|
const start = new Date(this.searchTime[0])
|
|
|
|
|
|
const end = new Date(this.searchTime[1])
|
|
|
|
|
|
start.setSeconds(start.getSeconds() + interval)
|
|
|
|
|
|
end.setSeconds(end.getSeconds() + interval)
|
|
|
|
|
|
const startTime = bus.timeFormate(start, 'yyyy-MM-dd hh:mm')
|
|
|
|
|
|
const endTime = bus.timeFormate(end, 'yyyy-MM-dd hh:mm')
|
|
|
|
|
|
this.searchTime = [startTime, endTime]
|
|
|
|
|
|
// 刷新数据
|
|
|
|
|
|
this.dateChange()
|
|
|
|
|
|
},
|
|
|
|
|
|
// 滚动事件触发下拉加载
|
|
|
|
|
|
onScroll () {
|
|
|
|
|
|
const _self = this
|
|
|
|
|
|
this.scrollbarWrap.addEventListener('scroll', bus.debounce(function () {
|
|
|
|
|
|
_self.showTopBtn = _self.scrollbarWrap.scrollTop > 50
|
2021-04-28 15:32:50 +08:00
|
|
|
|
_self.overScroll10 = _self.scrollbarWrap.scrollTop > 50
|
2021-12-21 18:05:36 +08:00
|
|
|
|
_self.$refs.chartList.onScroll(_self.scrollbarWrap.scrollTop)
|
2022-05-12 16:56:55 +08:00
|
|
|
|
}, 300, function () {
|
|
|
|
|
|
_self.showTopLine = _self.scrollbarWrap.scrollTop > 10
|
|
|
|
|
|
}))
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
tableListEnter () {
|
|
|
|
|
|
this.tableHover = true
|
2020-11-20 11:19:25 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
tableListLeave () {
|
|
|
|
|
|
this.tableHover = false
|
2021-09-15 17:29:34 +08:00
|
|
|
|
},
|
|
|
|
|
|
toTop (wrap) {
|
|
|
|
|
|
let currentTop = wrap.scrollTop
|
|
|
|
|
|
const interval = currentTop / 10
|
|
|
|
|
|
const intervalFunc = setInterval(function () { // 花200ms分10次回到顶部,模拟动画效果
|
|
|
|
|
|
if (currentTop === 0) {
|
|
|
|
|
|
clearInterval(intervalFunc)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
currentTop = (currentTop - interval) < interval * 0.5 ? 0 : currentTop - interval
|
|
|
|
|
|
wrap.scrollTop = currentTop
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 20)
|
2021-11-30 16:39:21 +08:00
|
|
|
|
},
|
|
|
|
|
|
load () {
|
|
|
|
|
|
|
2021-12-08 16:20:03 +08:00
|
|
|
|
},
|
|
|
|
|
|
addChartBefore () {
|
|
|
|
|
|
this.$store.dispatch('dispatchEditChart', {
|
|
|
|
|
|
chart: '',
|
|
|
|
|
|
type: 'add'
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
disposeChart () {
|
|
|
|
|
|
const chartInfo = this.$store.getters.getChart
|
|
|
|
|
|
const groupId = this.$store.getters.getGroupId
|
|
|
|
|
|
const type = this.$store.getters.getType
|
|
|
|
|
|
if (type === 'add') {
|
|
|
|
|
|
this.addChart()
|
|
|
|
|
|
}
|
|
|
|
|
|
if (type === 'edit') {
|
|
|
|
|
|
this.editChart(chartInfo)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (type === 'addGroupItem') {
|
|
|
|
|
|
this.addGroupItem(groupId)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (type === 'delete') {
|
|
|
|
|
|
this.delChart(chartInfo)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (type === 'duplicate') {
|
|
|
|
|
|
this.editChart(chartInfo, true)
|
|
|
|
|
|
}
|
2022-03-08 10:01:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
afterImport () {
|
|
|
|
|
|
this.dateChange()
|
|
|
|
|
|
this.panelReloadOnlyPanel()
|
2022-04-08 11:26:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
htmlToPdf () {
|
2022-04-11 15:49:10 +08:00
|
|
|
|
const dom = document.getElementsByClassName(this.pdfId)[0]
|
2022-04-08 11:26:17 +08:00
|
|
|
|
if (dom) {
|
2022-04-08 13:48:49 +08:00
|
|
|
|
// dom = dom.getElementsByClassName('vue-grid-layout')[0]
|
2022-04-15 16:29:23 +08:00
|
|
|
|
this.htmlTitle = this.showPanel.name
|
2022-04-08 11:26:17 +08:00
|
|
|
|
this.scrollbarWrap.scrollTop = this.scrollbarWrap.scrollHeight
|
|
|
|
|
|
this.$refs.chartList.onScroll(this.scrollbarWrap.scrollTop)
|
2022-04-13 09:31:18 +08:00
|
|
|
|
// const div = document.createElement('div')
|
|
|
|
|
|
// div.setAttribute('class', 'el-loading-spinner')
|
|
|
|
|
|
// div.innerText = '12321312312312321'
|
|
|
|
|
|
// dom.insertBefore(div,)
|
2022-04-08 11:26:17 +08:00
|
|
|
|
let flag = true
|
|
|
|
|
|
this.showScreenLoading(true)
|
|
|
|
|
|
let timer = setInterval(() => {
|
|
|
|
|
|
flag = true
|
|
|
|
|
|
this.$refs.chartList.copyDataList.forEach(chart => {
|
|
|
|
|
|
if (chart.type !== 'group') {
|
|
|
|
|
|
flag = flag && chart.loaded
|
|
|
|
|
|
} else if (chart.collapse) {
|
|
|
|
|
|
chart.children.forEach(groupChart => {
|
|
|
|
|
|
flag = flag && groupChart.loaded
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
if (flag) {
|
|
|
|
|
|
clearInterval(timer)
|
|
|
|
|
|
timer = null
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
document.body.style.height = 'auto'
|
2022-04-12 10:30:33 +08:00
|
|
|
|
document.getElementsByClassName('left-menu')[0].style.height = '100vh'
|
2022-04-08 13:48:49 +08:00
|
|
|
|
// document.getElementsByTagName('html')[0].style.overflow = 'visible'
|
2022-04-08 11:26:17 +08:00
|
|
|
|
const position = dom.getBoundingClientRect()
|
2022-04-13 10:48:00 +08:00
|
|
|
|
this.getPdf(dom, -1 * position.left, -1 * position.top, this.searchTime)
|
2022-04-08 13:48:49 +08:00
|
|
|
|
// this.getPdf(dom, 0, 0)
|
|
|
|
|
|
}, 2000)
|
2022-04-08 11:26:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
}, 200)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.showScreenLoading(false)
|
|
|
|
|
|
}
|
2022-05-24 15:04:46 +08:00
|
|
|
|
this.$refs.topTool.closeDialog()
|
2022-04-11 17:13:56 +08:00
|
|
|
|
},
|
2022-05-24 15:04:46 +08:00
|
|
|
|
exportType (type) {
|
|
|
|
|
|
if (type === 'PDF') {
|
|
|
|
|
|
this.htmlToPdf()
|
|
|
|
|
|
} else {
|
2022-11-09 10:40:13 +08:00
|
|
|
|
// this.exportToHtml(this.showPanel.name)
|
|
|
|
|
|
this.snapshotVisible = true
|
2022-05-24 15:04:46 +08:00
|
|
|
|
}
|
2022-06-01 15:26:05 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 切换查看模式
|
|
|
|
|
|
cycle () {
|
|
|
|
|
|
if (!this.mode) {
|
|
|
|
|
|
// TV模式(隐藏 menu,header)
|
|
|
|
|
|
this.mode = 'tv'
|
|
|
|
|
|
} else if (this.mode === 'tv') {
|
|
|
|
|
|
// 简易模式(隐藏 menu,header 和 操作栏)
|
|
|
|
|
|
this.mode = 'se'
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
message: this.$t('overall.toExit')
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (this.mode === 'se') {
|
|
|
|
|
|
// 默认模式
|
|
|
|
|
|
this.mode = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$store.commit('setMode', this.mode)
|
2023-03-28 09:16:24 +08:00
|
|
|
|
const param = { ...this.$route.query, mode: this.mode }
|
2023-03-15 15:39:06 +08:00
|
|
|
|
const path = this.fromRoute.dashboard
|
2022-06-01 15:26:05 +08:00
|
|
|
|
this.updatePath(param, path)
|
|
|
|
|
|
},
|
2022-06-01 18:00:13 +08:00
|
|
|
|
// 按ESC键退出查看模式
|
2022-06-01 15:26:05 +08:00
|
|
|
|
escExit (e) {
|
2023-04-06 10:37:06 +08:00
|
|
|
|
// 轮播时禁止esc
|
|
|
|
|
|
if (this.playListControls) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2022-06-01 18:00:13 +08:00
|
|
|
|
const message = document.querySelectorAll('.el-message-box__wrapper')
|
|
|
|
|
|
const showMessage = message.length && Array.from(message).some(item => {
|
|
|
|
|
|
return item.style.display !== 'none'
|
|
|
|
|
|
})
|
2023-04-06 10:37:06 +08:00
|
|
|
|
const dialog = document.querySelectorAll('.el-dialog__wrapper')
|
|
|
|
|
|
const showDialog = dialog.length && Array.from(dialog).some(item => {
|
|
|
|
|
|
return item.style.display !== 'none'
|
|
|
|
|
|
})
|
2022-06-01 18:00:13 +08:00
|
|
|
|
// 防止ESC键冲突
|
2023-04-06 10:37:06 +08:00
|
|
|
|
if (showMessage || showDialog) {
|
2022-06-01 18:00:13 +08:00
|
|
|
|
return false
|
|
|
|
|
|
}
|
2022-06-01 15:26:05 +08:00
|
|
|
|
if (e.keyCode === 27 && this.mode) {
|
|
|
|
|
|
// 默认模式
|
|
|
|
|
|
this.mode = ''
|
|
|
|
|
|
this.$store.commit('setMode', this.mode)
|
2023-03-28 09:16:24 +08:00
|
|
|
|
const param = { ...this.$route.query }
|
|
|
|
|
|
delete param.mode
|
2023-03-15 15:39:06 +08:00
|
|
|
|
const path = this.fromRoute.dashboard
|
2022-06-01 15:26:05 +08:00
|
|
|
|
this.updatePath(param, path)
|
|
|
|
|
|
}
|
2022-07-04 14:46:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
getPanelData () {
|
|
|
|
|
|
this.variablesInit = true
|
2023-02-15 17:46:15 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.chartList.onScroll(this.scrollbarWrap.scrollTop)
|
|
|
|
|
|
})
|
2023-03-28 09:16:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 时间选择器设置默认时间范围
|
|
|
|
|
|
setDefaultTimeRange () {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
if (this.$route.query.searchTime) return
|
2023-06-05 14:52:04 +08:00
|
|
|
|
let nowTimeType = this.$lodash.cloneDeep(this.timeData[3])
|
|
|
|
|
|
const defaultTimeRange = this.$lodash.get(this.showPanel, 'param.defaultTimeRange')
|
2023-03-28 09:16:24 +08:00
|
|
|
|
if (defaultTimeRange) {
|
|
|
|
|
|
nowTimeType = this.timeData.find(item => item.id == defaultTimeRange)
|
|
|
|
|
|
}
|
2023-06-05 14:52:04 +08:00
|
|
|
|
this.nowTimeType = this.$lodash.cloneDeep(nowTimeType)
|
2023-03-28 09:16:24 +08:00
|
|
|
|
// 刷新时间范围
|
|
|
|
|
|
this.$refs.pickTime.$refs.timePicker.setTimeRange(this.nowTimeType)
|
2023-08-31 16:08:49 +08:00
|
|
|
|
this.setSearchTime('searchTime')
|
2023-03-28 09:16:24 +08:00
|
|
|
|
this.$store.dispatch('dispatchPanelTime', {
|
|
|
|
|
|
time: this.searchTime,
|
|
|
|
|
|
nowTimeType: this.nowTimeType
|
|
|
|
|
|
})
|
2023-07-21 11:59:28 +08:00
|
|
|
|
// this.$store.dispatch('dispatchTimePickerRange', {
|
|
|
|
|
|
// time: this.searchTime,
|
|
|
|
|
|
// nowTimeType: this.nowTimeType
|
|
|
|
|
|
// })
|
2023-03-28 09:16:24 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-07-20 14:39:41 +08:00
|
|
|
|
setTimePickerRange () {
|
2023-07-20 18:02:58 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
if (this.$route.query.searchTime) return
|
|
|
|
|
|
if (!this.timePickerLocked || !this.timePickerRange.nowTimeType) {
|
|
|
|
|
|
this.setDefaultTimeRange()
|
|
|
|
|
|
}
|
|
|
|
|
|
const nowTimeType = this.nowTimeType = this.timePickerRange.nowTimeType
|
|
|
|
|
|
this.searchTime = this.timePickerRange.time
|
|
|
|
|
|
this.$refs.pickTime && this.$refs.pickTime.$refs.timePicker.setTimeRange(this.nowTimeType, this.searchTime)
|
2023-08-31 16:08:49 +08:00
|
|
|
|
this.setSearchTime('searchTime')
|
2023-07-20 18:02:58 +08:00
|
|
|
|
})
|
2023-07-20 14:39:41 +08:00
|
|
|
|
},
|
2023-03-28 09:16:24 +08:00
|
|
|
|
// 设置默认刷新
|
|
|
|
|
|
setDefaultRefresh () {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
if (this.$route.query.refresh) return
|
2023-06-05 14:52:04 +08:00
|
|
|
|
let refresh = this.$lodash.cloneDeep(this.intervalList[0])
|
|
|
|
|
|
const defaultRefresh = this.$lodash.get(this.showPanel, 'param.refresh')
|
2023-03-28 09:16:24 +08:00
|
|
|
|
if (defaultRefresh) {
|
|
|
|
|
|
refresh = this.intervalList.find(item => item.value == defaultRefresh)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$refs.pickTime.selectInterval(refresh)
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-03-28 09:16:24 +08:00
|
|
|
|
async created () {
|
2021-12-23 14:54:00 +08:00
|
|
|
|
const searchKeys = {
|
|
|
|
|
|
// key: path 键
|
|
|
|
|
|
// value: vue set 参数
|
2023-03-15 15:39:06 +08:00
|
|
|
|
dashboardId: { target: this, propertyName: 'dashboardId', type: 'number' },
|
2021-12-23 20:22:40 +08:00
|
|
|
|
searchTime: { target: this, propertyName: 'searchTime', type: 'jsonParse' },
|
2022-06-01 15:26:05 +08:00
|
|
|
|
nowTimeType: { target: this, propertyName: 'nowTimeType', type: 'jsonParse' },
|
|
|
|
|
|
mode: { target: this, propertyName: 'mode', type: 'string' }
|
2021-12-23 14:54:00 +08:00
|
|
|
|
}
|
2021-12-30 11:33:24 +08:00
|
|
|
|
this.initQueryFromPath(searchKeys)
|
2023-07-20 18:02:58 +08:00
|
|
|
|
if (this.$route.query.searchTime) {
|
|
|
|
|
|
this.$store.dispatch('dispatchTimePickerRange', {
|
|
|
|
|
|
time: this.searchTime,
|
|
|
|
|
|
nowTimeType: this.nowTimeType
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2023-03-28 09:16:24 +08:00
|
|
|
|
this.showPanel.id = this.dashboardId
|
|
|
|
|
|
this.filter.dashboardId = this.dashboardId
|
2022-06-01 15:26:05 +08:00
|
|
|
|
// 设置查看模式
|
|
|
|
|
|
this.$store.commit('setMode', this.mode)
|
2023-03-28 09:16:24 +08:00
|
|
|
|
await this.getTableData()
|
2021-12-23 20:22:40 +08:00
|
|
|
|
if (this.nowTimeType.type) {
|
2023-09-07 10:37:43 +08:00
|
|
|
|
this.setSearchTime('searchTime', this.nowTimeType)
|
2021-12-23 20:22:40 +08:00
|
|
|
|
}
|
2023-03-28 09:16:24 +08:00
|
|
|
|
if (this.nowTimeType) {
|
|
|
|
|
|
this.nowTimeType.start_time = this.searchTime[0]
|
|
|
|
|
|
this.nowTimeType.end_time = this.searchTime[1]
|
|
|
|
|
|
this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowTimeType)
|
|
|
|
|
|
}
|
2021-12-14 18:57:21 +08:00
|
|
|
|
this.$store.dispatch('dispatchPanelTime', {
|
2021-12-09 16:59:46 +08:00
|
|
|
|
time: this.searchTime,
|
2021-12-23 20:22:40 +08:00
|
|
|
|
nowTimeType: this.nowTimeType
|
2021-12-09 16:59:46 +08:00
|
|
|
|
})
|
2023-03-28 09:16:24 +08:00
|
|
|
|
if (this.$route.query.refresh) {
|
|
|
|
|
|
const refresh = this.intervalList.find(item => item.label == this.$route.query.refresh)
|
|
|
|
|
|
this.$refs.pickTime.selectInterval(refresh)
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
2022-06-01 15:26:05 +08:00
|
|
|
|
// 监听键盘ESC事件
|
|
|
|
|
|
document.addEventListener('keydown', this.escExit)
|
2022-03-10 16:51:51 +08:00
|
|
|
|
bus.$on('refreshPanel', this.refreshPanel)
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.scrollbarWrap = this.$refs.dashboardScrollbar
|
|
|
|
|
|
this.onScroll()
|
|
|
|
|
|
document.querySelector('#tableList').addEventListener('mouseenter', this.tableListEnter)
|
|
|
|
|
|
document.querySelector('#tableList').addEventListener('mouseleave', this.tableListLeave)
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
2023-03-28 09:16:24 +08:00
|
|
|
|
showPanel: {
|
|
|
|
|
|
handler () {
|
2023-07-21 11:59:28 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
if (this.timePickerLocked && this.timePickerRange && this.timePickerRange.nowTimeType) {
|
|
|
|
|
|
this.setTimePickerRange()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.setDefaultTimeRange()
|
|
|
|
|
|
}
|
|
|
|
|
|
this.setDefaultRefresh()
|
|
|
|
|
|
})
|
2023-03-28 09:16:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-11-22 19:16:59 +08:00
|
|
|
|
// 监听图表联动配置
|
2022-06-16 14:11:22 +08:00
|
|
|
|
'showPanel.param.chartShare': {
|
2022-06-15 17:44:51 +08:00
|
|
|
|
handler (value) {
|
|
|
|
|
|
// 每次切换联动模式 tooltip设置显示
|
|
|
|
|
|
const option = {
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
className: 'chart-time-series'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
for (const key in chartCache) {
|
|
|
|
|
|
if (!chartCache[key] || chartCache[key].group !== 'timeSeriesGroup') {
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
|
|
|
|
|
chartCache[key].setOption(option)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$store.commit('setCurrentMousemove', 0)
|
|
|
|
|
|
if (value && value !== 'none') {
|
|
|
|
|
|
this.$store.commit('setConnect', value)
|
|
|
|
|
|
echarts.connect('timeSeriesGroup')
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$store.commit('setConnect', value)
|
|
|
|
|
|
echarts.disconnect('timeSeriesGroup')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-07-16 09:56:48 +08:00
|
|
|
|
searchTime: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
2023-07-21 17:18:28 +08:00
|
|
|
|
// localStorage.setItem('dashboardTime', JSON.stringify(n))
|
2021-07-16 09:56:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-12-08 16:20:03 +08:00
|
|
|
|
chartRightBoxShow: {
|
|
|
|
|
|
immediate: false,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (n) {
|
|
|
|
|
|
this.disposeChart()
|
2023-01-05 17:53:42 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$refs.addChartModal.isStable = 'instability'
|
2023-01-09 16:39:58 +08:00
|
|
|
|
if (this.stableTime) {
|
|
|
|
|
|
clearTimeout(this.stableTime)
|
|
|
|
|
|
this.stableTime = null
|
|
|
|
|
|
}
|
2021-12-08 16:20:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
delChartFlag: {
|
|
|
|
|
|
immediate: false,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (n) {
|
|
|
|
|
|
this.disposeChart()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-05-12 16:19:43 +08:00
|
|
|
|
$route: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
handler () {
|
|
|
|
|
|
// 是否弹出侧滑
|
|
|
|
|
|
const add = this.$route.query.add
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
if (add) {
|
|
|
|
|
|
if (add === 'chart') {
|
2021-12-09 14:15:06 +08:00
|
|
|
|
this.addChartBefore()
|
2021-05-12 16:19:43 +08:00
|
|
|
|
}
|
2023-03-15 15:39:06 +08:00
|
|
|
|
if (add === 'dashboard') {
|
|
|
|
|
|
this.toAdd()
|
2021-05-12 16:19:43 +08:00
|
|
|
|
}
|
2023-03-02 11:34:42 +08:00
|
|
|
|
const newQuery = JSON.parse(JSON.stringify(this.$route.query)) // 深拷贝
|
|
|
|
|
|
delete newQuery.add
|
|
|
|
|
|
this.$router.replace({ query: newQuery })
|
2021-05-12 16:19:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeDestroy () {
|
2022-06-01 15:26:05 +08:00
|
|
|
|
// 移除键盘ESC事件
|
|
|
|
|
|
document.removeEventListener('keydown', this.escExit)
|
2023-04-12 10:36:22 +08:00
|
|
|
|
bus.$off('refreshPanel')
|
2022-04-13 10:48:00 +08:00
|
|
|
|
this.$store.dispatch('dispatchPanelLock', { flag: true })
|
2023-05-24 17:02:26 +08:00
|
|
|
|
this.$store.dispatch('dispatchPanelTime', {
|
|
|
|
|
|
time: [],
|
|
|
|
|
|
nowTimeType: {}
|
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
|
if (document.querySelector('#tableList')) {
|
|
|
|
|
|
document.querySelector('#tableList').removeEventListener('mouseenter', this.tableListEnter)
|
|
|
|
|
|
document.querySelector('#tableList').removeEventListener('mouseleave', this.tableListLeave)
|
2019-12-26 13:00:22 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
if (this.scrollbarWrap) {
|
|
|
|
|
|
this.scrollbarWrap.removeEventListener('scroll', bus.debounce)
|
2021-11-01 17:23:01 +08:00
|
|
|
|
}
|
2023-03-15 15:39:06 +08:00
|
|
|
|
localStorage.removeItem('dashboardTime')
|
2021-12-21 15:41:46 +08:00
|
|
|
|
if (!document.onmousemove) { // 添加鼠标移动事件监听
|
|
|
|
|
|
document.onmousemove = null
|
|
|
|
|
|
}
|
2022-06-16 14:11:22 +08:00
|
|
|
|
|
|
|
|
|
|
// 页面销毁 清除图表联动
|
2022-06-16 10:48:47 +08:00
|
|
|
|
this.$store.commit('setCurrentMousemove', 0)
|
|
|
|
|
|
this.$store.commit('setConnect', 'none')
|
|
|
|
|
|
echarts.disconnect('timeSeriesGroup')
|
2023-02-22 18:32:54 +08:00
|
|
|
|
|
|
|
|
|
|
this.$store.commit('setMode', '')
|
2023-04-06 17:48:31 +08:00
|
|
|
|
|
|
|
|
|
|
clearTopology()
|
2020-02-03 21:30:07 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
2019-12-26 13:00:22 +08:00
|
|
|
|
</script>
|