feat(仪表板): 仪表板公共链接支持设置浏览器整体刷新
This commit is contained in:
parent
6c094919c4
commit
517bca9d57
@ -92,6 +92,8 @@ export function panelDataPrepare(componentData, componentStyle, callback) {
|
||||
componentStyle.refreshViewLoading = (componentStyle.refreshViewLoading || false)
|
||||
componentStyle.refreshUnit = (componentStyle.refreshUnit || 'minute')
|
||||
componentStyle.refreshViewEnable = (componentStyle.refreshViewEnable === undefined ? true : componentStyle.refreshViewEnable)
|
||||
componentStyle.refreshBrowserEnable = (componentStyle.refreshBrowserEnable || false)
|
||||
componentStyle.refreshBrowserTime = (componentStyle.refreshBrowserTime || 5)
|
||||
componentStyle.aidedDesign = (componentStyle.aidedDesign || deepCopy(AIDED_DESIGN))
|
||||
componentStyle.pdfPageLine = (componentStyle.pdfPageLine || deepCopy(PAGE_LINE_DESIGN))
|
||||
componentStyle.chartInfo = (componentStyle.chartInfo || deepCopy(PANEL_CHART_INFO))
|
||||
|
||||
@ -2144,6 +2144,8 @@ export default {
|
||||
theme_color_dark: 'Dark',
|
||||
theme_color_light: 'Light',
|
||||
refresh_frequency: 'Refresh Frequency',
|
||||
refresh_browser_frequency: 'Refresh Browser',
|
||||
refresh_browser_tips: 'Only public links are effective',
|
||||
card_color_matching: 'Card Color Matching',
|
||||
table_color_matching: 'Table Color Matching',
|
||||
background_color: 'Background Color',
|
||||
|
||||
@ -2136,6 +2136,8 @@ export default {
|
||||
theme_color_dark: '深色',
|
||||
theme_color_light: '淺色',
|
||||
refresh_frequency: '刷新頻率',
|
||||
refresh_browser_frequency: '浏览器刷新',
|
||||
refresh_browser_tips: '仅公共链接生效',
|
||||
card_color_matching: '卡片配色',
|
||||
table_color_matching: '表格配色',
|
||||
background_color: '背景顏色',
|
||||
|
||||
@ -2139,6 +2139,8 @@ export default {
|
||||
theme_color_dark: '深色',
|
||||
theme_color_light: '浅色',
|
||||
refresh_frequency: '刷新频率',
|
||||
refresh_browser_frequency: '浏览器刷新',
|
||||
refresh_browser_tips: '仅公共链接生效',
|
||||
card_color_matching: '卡片配色',
|
||||
table_color_matching: '表格配色',
|
||||
background_color: '背景颜色',
|
||||
|
||||
@ -76,6 +76,12 @@ export default {
|
||||
|
||||
})
|
||||
},
|
||||
initBrowserTimer() {
|
||||
if (this.canvasStyleData.refreshBrowserEnable) {
|
||||
const browserRefreshTime = this.canvasStyleData.refreshBrowserTime * 60 * 1000
|
||||
setTimeout(() => { window.location.reload() }, browserRefreshTime)
|
||||
}
|
||||
},
|
||||
setPanelInfo() {
|
||||
loadResource(this.resourceId, this.user).then(res => {
|
||||
this.show = false
|
||||
@ -99,6 +105,7 @@ export default {
|
||||
this.$store.dispatch('panel/setPanelInfo', this.panelInfo)
|
||||
|
||||
panelInit(JSON.parse(res.data.panelData), JSON.parse(res.data.panelStyle))
|
||||
this.initBrowserTimer()
|
||||
// 设置浏览器title为当前仪表板名称
|
||||
document.title = res.data.name
|
||||
// 刷新联动信息
|
||||
|
||||
@ -81,6 +81,8 @@ export const CANVAS_STYLE = {
|
||||
refreshViewLoading: true, // 仪表板视图loading提示
|
||||
refreshUnit: 'minute', // 仪表板刷新时间带外 默认 分钟
|
||||
refreshTime: 5, // 仪表板刷新时间 默认5分钟
|
||||
refreshBrowserEnable: false, // 开启视图刷新(默认关闭)
|
||||
refreshBrowserTime: 5, // 仪表板刷新时间 默认5分钟(浏览器刷新仅保留分钟)
|
||||
themeId: 'system_1', // 当前所选主题ID 默认系统主题1
|
||||
chartInfo: PANEL_CHART_INFO
|
||||
}
|
||||
|
||||
@ -83,6 +83,49 @@
|
||||
</el-select>
|
||||
</el-row>
|
||||
</el-row>
|
||||
|
||||
<el-row class="margin-top20">
|
||||
<el-row class="custom-item-text-row">
|
||||
<span class="custom-item-text el-input-refresh-browser-inner bl">
|
||||
<el-checkbox
|
||||
v-model="overallSettingForm.refreshBrowserEnable"
|
||||
class="el-input-refresh-browser"
|
||||
@change="themeChange"
|
||||
>{{ $t('panel.refresh_browser_frequency') }}
|
||||
</el-checkbox>
|
||||
<span class="custom-item-text bl">
|
||||
<span>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
placement="bottom"
|
||||
>
|
||||
<div slot="content">
|
||||
{{ $t('panel.refresh_browser_tips') }}
|
||||
</div>
|
||||
<i
|
||||
class="el-icon-info"
|
||||
style="cursor: pointer;"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<el-input
|
||||
v-model="overallSettingForm.refreshBrowserTime"
|
||||
class="el-input-refresh-time"
|
||||
type="number"
|
||||
size="mini"
|
||||
controls-position="right"
|
||||
:min="1"
|
||||
:max="3600"
|
||||
:disabled="!overallSettingForm.refreshBrowserEnable"
|
||||
@change="refreshBrowserTimeChange"
|
||||
>
|
||||
<template slot="append">{{ $t('panel.minute') }}</template>
|
||||
</el-input>
|
||||
</el-row>
|
||||
</el-row>
|
||||
<el-row class="margin-top20 margin-bottom20">
|
||||
<el-row class="custom-item-text-row">
|
||||
<span class="custom-item-text bl">
|
||||
@ -186,6 +229,13 @@ export default {
|
||||
initForm() {
|
||||
this.overallSettingForm = this.canvasStyleData
|
||||
},
|
||||
refreshBrowserTimeChange(val) {
|
||||
if (val < 1) {
|
||||
this.overallSettingForm.refreshBrowserTime = 1
|
||||
} else if (val > 3600) {
|
||||
this.overallSettingForm.refreshBrowserTime = 3600
|
||||
}
|
||||
},
|
||||
themeChange(modifyName) {
|
||||
if (modifyName === 'themeColor') {
|
||||
// 主题变更
|
||||
@ -238,6 +288,15 @@ export default {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.el-input-refresh-browser {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.el-input-refresh-browser-inner {
|
||||
width: calc(50% + 4px);
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.margin-left4 {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user