forked from github/dataease
feat(数据大屏、仪表板): 支持浏览器整体刷新#11378
This commit is contained in:
parent
600fcd343e
commit
6eee52b87f
@ -72,6 +72,56 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item class="form-item" :class="'form-item-' + themes" style="margin-bottom: 8px">
|
||||||
|
<el-checkbox
|
||||||
|
:effect="themes"
|
||||||
|
size="small"
|
||||||
|
v-model="canvasStyleData.refreshViewBrowserEnable"
|
||||||
|
@change="themeChange"
|
||||||
|
>
|
||||||
|
整体刷新
|
||||||
|
</el-checkbox>
|
||||||
|
<el-tooltip class="item" :effect="toolTip" placement="bottom">
|
||||||
|
<template #content>
|
||||||
|
<div>仅公共链接生效</div>
|
||||||
|
</template>
|
||||||
|
<el-icon
|
||||||
|
class="hint-icon"
|
||||||
|
style="margin-left: 4px"
|
||||||
|
:class="{ 'hint-icon--dark': themes === 'dark' }"
|
||||||
|
>
|
||||||
|
<Icon name="icon_info_outlined" />
|
||||||
|
</el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item class="form-item" :class="'form-item-' + themes" style="padding-left: 20px">
|
||||||
|
<el-input
|
||||||
|
v-model="canvasStyleData.refreshBrowserTime"
|
||||||
|
:effect="themes"
|
||||||
|
class="time-input-number"
|
||||||
|
:class="[dvInfo.type === 'dashboard' && 'padding20', themes === 'dark' && 'dv-dark']"
|
||||||
|
type="number"
|
||||||
|
:min="1"
|
||||||
|
:max="3600"
|
||||||
|
size="middle"
|
||||||
|
:disabled="!canvasStyleData.refreshViewBrowserEnable"
|
||||||
|
@change="onRefreshChange"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<el-select
|
||||||
|
v-model="canvasStyleData.refreshBrowserUnit"
|
||||||
|
size="middle"
|
||||||
|
:effect="themes"
|
||||||
|
:disabled="!canvasStyleData.refreshViewBrowserEnable"
|
||||||
|
style="width: 90px"
|
||||||
|
@change="themeChange"
|
||||||
|
>
|
||||||
|
<el-option :label="t('visualization.minute')" :value="'minute'" />
|
||||||
|
<el-option :label="t('visualization.second')" :value="'second'" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item class="form-item" :class="'form-item-' + themes">
|
<el-form-item class="form-item" :class="'form-item-' + themes">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
:effect="themes"
|
:effect="themes"
|
||||||
|
@ -216,6 +216,10 @@ export function historyAdaptor(
|
|||||||
canvasStyleResult.component['seniorStyleSetting'] =
|
canvasStyleResult.component['seniorStyleSetting'] =
|
||||||
canvasStyleResult.component['seniorStyleSetting'] || deepCopy(SENIOR_STYLE_SETTING_LIGHT)
|
canvasStyleResult.component['seniorStyleSetting'] || deepCopy(SENIOR_STYLE_SETTING_LIGHT)
|
||||||
canvasStyleResult['screenAdaptor'] = canvasStyleResult['screenAdaptor'] || 'widthFirst'
|
canvasStyleResult['screenAdaptor'] = canvasStyleResult['screenAdaptor'] || 'widthFirst'
|
||||||
|
canvasStyleResult['refreshBrowserEnable'] =
|
||||||
|
canvasStyleResult['refreshBrowserEnable'] !== undefined
|
||||||
|
canvasStyleResult['refreshBrowserUnit'] = canvasStyleResult['refreshBrowserUnit'] || 'minute'
|
||||||
|
canvasStyleResult['refreshBrowserTime'] = canvasStyleResult['refreshBrowserTime'] || 5
|
||||||
// 同步宽高比例(大屏使用)
|
// 同步宽高比例(大屏使用)
|
||||||
canvasStyleResult['scaleWidth'] = canvasStyleResult['scale']
|
canvasStyleResult['scaleWidth'] = canvasStyleResult['scale']
|
||||||
canvasStyleResult['scaleHeight'] = canvasStyleResult['scale']
|
canvasStyleResult['scaleHeight'] = canvasStyleResult['scale']
|
||||||
|
@ -80,6 +80,9 @@ export const DEFAULT_DASHBOARD_STYLE_DARK = {
|
|||||||
export const DEFAULT_CANVAS_STYLE_DATA_BASE = {
|
export const DEFAULT_CANVAS_STYLE_DATA_BASE = {
|
||||||
width: 1920,
|
width: 1920,
|
||||||
height: 1080,
|
height: 1080,
|
||||||
|
refreshBrowserEnable: false, // 开启浏览器刷新(默认关闭)
|
||||||
|
refreshBrowserUnit: 'minute', // 仪表板刷新时间带外 默认 分钟
|
||||||
|
refreshBrowserTime: 5, // 仪表板刷新时间 默认5分钟
|
||||||
refreshViewEnable: false, // 开启图表刷新(默认关闭)
|
refreshViewEnable: false, // 开启图表刷新(默认关闭)
|
||||||
refreshViewLoading: true, // 仪表板图表loading提示
|
refreshViewLoading: true, // 仪表板图表loading提示
|
||||||
refreshUnit: 'minute', // 仪表板刷新时间带外 默认 分钟
|
refreshUnit: 'minute', // 仪表板刷新时间带外 默认 分钟
|
||||||
|
@ -94,6 +94,17 @@ const loadCanvasDataAsync = async (dvId, dvType) => {
|
|||||||
ElMessage.error(t('visualization.outer_param_decode_error'))
|
ElMessage.error(t('visualization.outer_param_decode_error'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const initBrowserTimer = () => {
|
||||||
|
if (state.canvasStylePreview.refreshBrowserEnable) {
|
||||||
|
const gap = state.canvasStylePreview.refreshBrowserUnit === 'minute' ? 60 : 1
|
||||||
|
const browserRefreshTime = state.canvasStylePreview.refreshBrowserTime * gap * 1000
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload()
|
||||||
|
}, browserRefreshTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initCanvasData(
|
initCanvasData(
|
||||||
dvId,
|
dvId,
|
||||||
dvType,
|
dvType,
|
||||||
@ -120,6 +131,7 @@ const loadCanvasDataAsync = async (dvId, dvType) => {
|
|||||||
document.title = dvInfo.name
|
document.title = dvInfo.name
|
||||||
setTitle(dvInfo.name)
|
setTitle(dvInfo.name)
|
||||||
}
|
}
|
||||||
|
initBrowserTimer()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user