Merge pull request #4145 from dataease/pr@dev@feat_view-refresh

feat(视图): 视图可以单独设置刷新频率
This commit is contained in:
王嘉豪 2022-12-21 12:08:32 +08:00 committed by GitHub
commit 4cb5752f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 652 additions and 504 deletions

View File

@ -8,14 +8,11 @@
<result column="privileges" property="privileges"/>
</resultMap>
<select id ="findByPanelId" resultMap="BaseResultMapDTO">
SELECT
chart_view.*
FROM
chart_view
LEFT JOIN panel_view ON chart_view.id = panel_view.chart_view_id
WHERE
panel_view.panel_id = #{panelId}
<select id="findByPanelId" resultMap="BaseResultMapDTO">
SELECT chart_view.*
FROM chart_view
LEFT JOIN panel_view ON chart_view.id = panel_view.chart_view_id
WHERE panel_view.panel_id = #{panelId}
</select>
<select id="searchOneWithPrivileges" resultMap="BaseResultMapDTO">
@ -25,198 +22,210 @@
</select>
<select id="searchOne" resultMap="BaseResultMapDTO">
select
chart_view.*
from chart_view where id = #{id}
select chart_view.*
from chart_view
where id = #{id}
</select>
<insert id="copyToCache">
INSERT INTO chart_view_cache (
id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from
) SELECT
id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from from chart_view
WHERE
chart_view.id = #{id}
INSERT INTO chart_view_cache (id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from,
refresh_view_enable,
refresh_unit,
refresh_time)
SELECT id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from,
refresh_view_enable,
refresh_unit,
refresh_time
from chart_view
WHERE chart_view.id = #{id}
</insert>
<insert id="copyCache">
INSERT INTO chart_view_cache (
id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from
) SELECT
#{newViewId} as id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from from chart_view_cache
WHERE
chart_view_cache.id = #{sourceViewId}
INSERT INTO chart_view_cache (id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from,
refresh_view_enable,
refresh_unit,
refresh_time)
SELECT #{newViewId} as id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from,
refresh_view_enable,
refresh_unit,
refresh_time
from chart_view_cache
WHERE chart_view_cache.id = #{sourceViewId}
</insert>
<insert id="initPanelChartViewCache">
INSERT INTO chart_view_cache (
id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from
) SELECT
id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from from chart_view
WHERE
chart_view.scene_id = #{panelId}
INSERT INTO chart_view_cache (id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from,
refresh_view_enable,
refresh_unit,
refresh_time)
SELECT id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from,
refresh_view_enable,
refresh_unit,
refresh_time
from chart_view
WHERE chart_view.scene_id = #{panelId}
</insert>
<select id="search" resultMap="BaseResultMapDTO">
@ -299,11 +308,11 @@
`senior`,
`data_from`)
SELECT #{newChartId},
GET_CHART_VIEW_COPY_NAME(#{oldChartId},#{panelId}) as `name`,
GET_CHART_VIEW_COPY_NAME(#{oldChartId}, #{panelId}) as `name`,
#{panelId},
`table_id`,
`type`,
GET_CHART_VIEW_COPY_NAME(#{oldChartId},#{panelId}) as `title`,
GET_CHART_VIEW_COPY_NAME(#{oldChartId}, #{panelId}) as `title`,
`x_axis`,
`x_axis_ext`,
`y_axis`,
@ -312,8 +321,8 @@
`custom_filter`,
`drill_fields`,
`create_by`,
unix_timestamp()*1000 as `create_time`,
unix_timestamp()*1000 as `update_time`,
unix_timestamp() * 1000 as `create_time`,
unix_timestamp() * 1000 as `update_time`,
`snapshot`,
`style_priority`,
`ext_stack`,
@ -405,13 +414,11 @@
SNAPSHOT,
senior,
data_from
FROM (
SELECT panel_id,
copy_from_view,
chart_view_id
FROM panel_view
WHERE copy_id = #{copyId}
) pv_copy
FROM (SELECT panel_id,
copy_from_view,
chart_view_id
FROM panel_view
WHERE copy_id = #{copyId}) pv_copy
INNER JOIN chart_view ON chart_view.id = pv_copy.copy_from_view
</insert>
@ -459,16 +466,11 @@
<select id="searchViewsWithPanelId" resultMap="BaseResultMapDTO">
SELECT * FROM chart_view
WHERE
id IN (
SELECT
chart_view_id
FROM
panel_view
WHERE
panel_id = #{panelId}
)
SELECT *
FROM chart_view
WHERE id IN (SELECT chart_view_id
FROM panel_view
WHERE panel_id = #{panelId})
</select>
<delete id="deleteCacheWithPanel">
@ -480,10 +482,12 @@
#{viewId}
</foreach>
</if>
</delete>
</delete>
<delete id="deleteViewCache">
delete from chart_view_cache where id = #{viewId}
</delete>
delete
from chart_view_cache
where id = #{viewId}
</delete>
<update id="copyCacheToView">
UPDATE chart_view cv,
@ -514,7 +518,10 @@
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from
cv.data_from = cve.data_from,
cv.refresh_view_enable = cve.refresh_view_enable,
cv.refresh_unit = cve.refresh_unit,
cv.refresh_time = cve.refresh_time
where cve.id = cv.id and cv.id in
<foreach collection="viewIds" item="viewId" open='(' separator=',' close=')'>
#{viewId}
@ -523,69 +530,75 @@
<update id="updateToCache">
UPDATE chart_view_cache cv,
chart_view cve
chart_view cve
SET cv.`name` = cve.`name`,
cv.title = cve.title,
cv.scene_id = cve.scene_id,
cv.table_id = cve.table_id,
cv.`type` = cve.`type`,
cv.render = cve.render,
cv.result_count = cve.result_count,
cv.result_mode = cve.result_mode,
cv.create_by = cve.create_by,
cv.create_time = cve.create_time,
cv.update_time = cve.update_time,
cv.style_priority = cve.style_priority,
cv.chart_type = cve.chart_type,
cv.is_plugin = cve.is_plugin,
cv.x_axis = cve.x_axis,
cv.x_axis_ext = cve.x_axis_ext,
cv.y_axis = cve.y_axis,
cv.y_axis_ext = cve.y_axis_ext,
cv.ext_stack = cve.ext_stack,
cv.ext_bubble = cve.ext_bubble,
cv.custom_attr = cve.custom_attr,
cv.custom_style = cve.custom_style,
cv.custom_filter = cve.custom_filter,
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from
where cve.id = cv.id and cv.id =#{viewId}
cv.title = cve.title,
cv.scene_id = cve.scene_id,
cv.table_id = cve.table_id,
cv.`type` = cve.`type`,
cv.render = cve.render,
cv.result_count = cve.result_count,
cv.result_mode = cve.result_mode,
cv.create_by = cve.create_by,
cv.create_time = cve.create_time,
cv.update_time = cve.update_time,
cv.style_priority = cve.style_priority,
cv.chart_type = cve.chart_type,
cv.is_plugin = cve.is_plugin,
cv.x_axis = cve.x_axis,
cv.x_axis_ext = cve.x_axis_ext,
cv.y_axis = cve.y_axis,
cv.y_axis_ext = cve.y_axis_ext,
cv.ext_stack = cve.ext_stack,
cv.ext_bubble = cve.ext_bubble,
cv.custom_attr = cve.custom_attr,
cv.custom_style = cve.custom_style,
cv.custom_filter = cve.custom_filter,
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from,
cv.refresh_view_enable = cve.refresh_view_enable,
cv.refresh_unit = cve.refresh_unit,
cv.refresh_time = cve.refresh_time
where cve.id = cv.id and cv.id =#{viewId}
</update>
<update id="updateToViewFromCache">
UPDATE chart_view_cache cve,
chart_view cv
chart_view cv
SET cv.`name` = cve.`name`,
cv.title = cve.title,
cv.scene_id = cve.scene_id,
cv.table_id = cve.table_id,
cv.`type` = cve.`type`,
cv.render = cve.render,
cv.result_count = cve.result_count,
cv.result_mode = cve.result_mode,
cv.create_by = cve.create_by,
cv.create_time = cve.create_time,
cv.update_time = cve.update_time,
cv.style_priority = cve.style_priority,
cv.chart_type = cve.chart_type,
cv.is_plugin = cve.is_plugin,
cv.x_axis = cve.x_axis,
cv.x_axis_ext = cve.x_axis_ext,
cv.y_axis = cve.y_axis,
cv.y_axis_ext = cve.y_axis_ext,
cv.ext_stack = cve.ext_stack,
cv.ext_bubble = cve.ext_bubble,
cv.custom_attr = cve.custom_attr,
cv.custom_style = cve.custom_style,
cv.custom_filter = cve.custom_filter,
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from
where cve.id = cv.id and cv.id =#{viewId}
cv.title = cve.title,
cv.scene_id = cve.scene_id,
cv.table_id = cve.table_id,
cv.`type` = cve.`type`,
cv.render = cve.render,
cv.result_count = cve.result_count,
cv.result_mode = cve.result_mode,
cv.create_by = cve.create_by,
cv.create_time = cve.create_time,
cv.update_time = cve.update_time,
cv.style_priority = cve.style_priority,
cv.chart_type = cve.chart_type,
cv.is_plugin = cve.is_plugin,
cv.x_axis = cve.x_axis,
cv.x_axis_ext = cve.x_axis_ext,
cv.y_axis = cve.y_axis,
cv.y_axis_ext = cve.y_axis_ext,
cv.ext_stack = cve.ext_stack,
cv.ext_bubble = cve.ext_bubble,
cv.custom_attr = cve.custom_attr,
cv.custom_style = cve.custom_style,
cv.custom_filter = cve.custom_filter,
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from,
cv.refresh_view_enable = cve.refresh_view_enable,
cv.refresh_unit = cve.refresh_unit,
cv.refresh_time = cve.refresh_time
where cve.id = cv.id and cv.id =#{viewId}
</update>
<delete id="deleteNoUseView">
@ -600,55 +613,49 @@
</delete>
<select id="chartOptions" resultType="io.dataease.dto.chart.ViewOption">
select id, title as name from chart_view where scene_id = #{panelId}
select id, title as name
from chart_view
where scene_id = #{panelId}
</select>
<insert id='chartFiledCopyWithPanel'>
INSERT INTO chart_view_field (
id,
table_id,
chart_id,
origin_name,
`name`,
dataease_name,
group_type,
`type`,
`size`,
de_type,
de_type_format,
de_extract_type,
ext_field,
`checked`,
column_index,
last_sync_time
) SELECT
uuid() AS id,
chart_view_field.table_id,
chart_view_field.pv_copy.chart_view_id AS chart_id,
chart_view_field.origin_name,
chart_view_field.`name`,
chart_view_field.dataease_name,
chart_view_field.group_type,
chart_view_field.`type`,
chart_view_field.`size`,
chart_view_field.de_type,
chart_view_field.de_type_format,
chart_view_field.de_extract_type,
chart_view_field.ext_field,
chart_view_field.`checked`,
chart_view_field.column_index,
chart_view_field.last_sync_time
FROM
(
SELECT
panel_id,
copy_from_view,
chart_view_id
FROM
panel_view
WHERE
copy_id = #{copyId}
) pv_copy
INNER JOIN chart_view_field ON chart_view_field.chart_id = pv_copy.copy_from_view
INSERT INTO chart_view_field (id,
table_id,
chart_id,
origin_name,
`name`,
dataease_name,
group_type,
`type`,
`size`,
de_type,
de_type_format,
de_extract_type,
ext_field,
`checked`,
column_index,
last_sync_time)
SELECT uuid() AS id,
chart_view_field.table_id,
chart_view_field.pv_copy.chart_view_id AS chart_id,
chart_view_field.origin_name,
chart_view_field.`name`,
chart_view_field.dataease_name,
chart_view_field.group_type,
chart_view_field.`type`,
chart_view_field.`size`,
chart_view_field.de_type,
chart_view_field.de_type_format,
chart_view_field.de_extract_type,
chart_view_field.ext_field,
chart_view_field.`checked`,
chart_view_field.column_index,
chart_view_field.last_sync_time
FROM (SELECT panel_id,
copy_from_view,
chart_view_id
FROM panel_view
WHERE copy_id = #{copyId}) pv_copy
INNER JOIN chart_view_field ON chart_view_field.chart_id = pv_copy.copy_from_view
</insert>
</mapper>

View File

@ -10,8 +10,25 @@ ALTER TABLE `sys_task`
ADD COLUMN `status` tinyint(1) NULL DEFAULT 1 COMMENT '运行状态' AFTER `create_time`;
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`) VALUES (1100, 1, 0, 1, '血缘关系', 'sys-relationship', 'system/relationship/index', 1002, 'sys-relationship', 'relationship', 0, 0, 0, 'relationship:read');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`,
`path`, `i_frame`, `cache`, `hidden`, `permission`)
VALUES (1100, 1, 0, 1, '血缘关系', 'sys-relationship', 'system/relationship/index', 1002, 'sys-relationship',
'relationship', 0, 0, 0, 'relationship:read');
UPDATE `sys_menu` SET `menu_sort` = 1003 WHERE (`menu_id` = 101);
UPDATE `sys_menu`
SET `menu_sort` = 1003
WHERE (`menu_id` = 101);
UPDATE `my_plugin` SET `version` = '1.18.0' where `plugin_id` > 0;
UPDATE `my_plugin`
SET `version` = '1.18.0'
where `plugin_id` > 0;
ALTER TABLE `chart_view`
ADD COLUMN `refresh_view_enable` tinyint(1) NULL DEFAULT 0 COMMENT '是否开启刷新' AFTER `view_fields`,
ADD COLUMN `refresh_unit` varchar(255) NULL DEFAULT 'minute' COMMENT '刷新时间单位' AFTER `refresh_view_enable`,
ADD COLUMN `refresh_time` int(13) NULL DEFAULT 5 COMMENT '刷新时间' AFTER `refresh_unit`;
ALTER TABLE `chart_view_cache`
ADD COLUMN `refresh_view_enable` tinyint(1) NULL DEFAULT 0 COMMENT '是否开启刷新' AFTER `view_fields`,
ADD COLUMN `refresh_unit` varchar(255) NULL DEFAULT 'minute' COMMENT '刷新时间单位' AFTER `refresh_view_enable`,
ADD COLUMN `refresh_time` int(13) NULL DEFAULT 5 COMMENT '刷新时间' AFTER `refresh_unit`;

View File

@ -137,7 +137,7 @@
:target="curComponent.hyperlinks.openMode "
:href="curComponent.hyperlinks.content "
>
<i class="icon iconfont icon-com-jump" />
<i class="icon iconfont icon-com-jump"/>
</a>
</span>
@ -496,19 +496,7 @@ export default {
},
// sourceViewId
clearLinkage() {
this.componentData.forEach(item => {
if (item.linkageFilters && item.linkageFilters.length > 0) {
const newList = item.linkageFilters.filter(linkage => linkage.sourceViewId !== this.element.propValue.viewId)
item.linkageFilters.splice(0, item.linkageFilters.length)
// push watch
if (newList.length > 0) {
newList.forEach(newLinkage => {
item.linkageFilters.push(newLinkage)
})
}
}
})
bus.$emit('clear_panel_linkage', { viewId: this.element.propValue.viewId })
this.$store.commit('clearViewLinkage', this.element.propValue.viewId)
},
goFile() {
this.$refs.files.click()

View File

@ -305,6 +305,7 @@ export default {
},
data() {
return {
innerRefreshTimer: null,
mobileChartDetailsVisible: false,
chartDetailsVisible: false,
showChartInfo: {},
@ -393,7 +394,7 @@ export default {
return this.httpRequest.status && this.chart.type && this.chart.type === 'label'
},
loadingFlag() {
return (this.canvasStyleData.refreshViewLoading || this.searchCount === 0) && this.requestStatus === 'waiting'
return (this.canvasStyleData.refreshViewLoading || (!this.innerRefreshTimer && this.searchCount === 0)) && this.requestStatus === 'waiting'
},
panelInfo() {
return this.$store.state.panel.panelInfo
@ -520,7 +521,8 @@ export default {
},
//
searchCount: function(val1) {
if (val1 > 0 && this.requestStatus !== 'waiting') {
//
if (val1 > 0 && this.requestStatus !== 'waiting' && !this.innerRefreshTimer) {
this.getData(this.element.propValue.viewId)
}
},
@ -547,6 +549,7 @@ export default {
},
beforeDestroy() {
this.innerRefreshTimer && clearInterval(this.innerRefreshTimer)
bus.$off('plugin-chart-click', this.pluginChartClick)
bus.$off('plugin-jump-click', this.pluginJumpClick)
bus.$off('plugin-add-view-track-filter', this.pluginAddViewTrackFilter)
@ -566,6 +569,20 @@ export default {
}
},
methods: {
//
buildInnerRefreshTimer(refreshViewEnable = false, refreshUnit = 'minute', refreshTime = 5) {
if (this.editMode === 'preview' && !this.innerRefreshTimer && refreshViewEnable) {
this.innerRefreshTimer && clearInterval(this.innerRefreshTimer)
const timerRefreshTime = refreshUnit === 'second' ? refreshTime * 1000 : refreshTime * 60000
this.innerRefreshTimer = setInterval(() => {
this.clearViewLinkage()
this.getData(this.element.propValue.viewId)
}, timerRefreshTime)
}
},
clearViewLinkage() {
this.$store.commit('clearViewLinkage', this.element.propValue.viewId)
},
responseResetButton() {
if (!this.cfilters?.length) {
this.getData(this.element.propValue.viewId, false)
@ -741,6 +758,7 @@ export default {
if (response.success) {
this.chart = response.data
this.view = response.data
this.buildInnerRefreshTimer(this.chart.refreshViewEnable, this.chart.refreshUnit, this.chart.refreshTime)
this.$emit('fill-chart-2-parent', this.chart)
this.getDataOnly(response.data, dataBroadcast)
this.chart['position'] = this.inTab ? 'tab' : 'panel'

View File

@ -931,6 +931,7 @@ export default {
password_input_error: 'Original password input error'
},
chart: {
chart_refresh_tips: 'View refresh setting takes precedence over panel refresh setting',
'1-trend': 'trend',
'2-state': 'State',
'3-rank': 'Rank',

View File

@ -930,6 +930,7 @@ export default {
password_input_error: '原始密碼輸入錯誤'
},
chart: {
chart_refresh_tips: '視圖刷新設置優先於儀表板刷新設置',
'1-trend': '趨勢',
'2-state': '狀態',
'3-rank': '排名',

View File

@ -929,6 +929,7 @@ export default {
password_input_error: '原始密码输入错误'
},
chart: {
chart_refresh_tips: '视图刷新设置优先于仪表板刷新设置',
'1-trend': '趋势',
'2-state': '状态',
'3-rank': '排名',

View File

@ -824,6 +824,23 @@ const data = {
}
}
}
},
// 清除相同sourceViewId 的 联动条件
clearViewLinkage(state, viewId) {
state.componentData.forEach(item => {
if (item.linkageFilters && item.linkageFilters.length > 0) {
const newList = item.linkageFilters.filter(linkage => linkage.sourceViewId !== viewId)
item.linkageFilters.splice(0, item.linkageFilters.length)
// 重新push 可保证数组指针不变 可以watch到
if (newList.length > 0) {
newList.forEach(newLinkage => {
item.linkageFilters.push(newLinkage)
})
}
}
})
bus.$emit('clear_panel_linkage', { viewId: viewId })
}
},
modules: {

View File

@ -13,7 +13,7 @@
@click="add('group')"
/>
</el-row>
<el-divider />
<el-divider/>
<el-row style="margin-bottom: 10px">
<el-col :span="16">
<el-input
@ -31,7 +31,7 @@
size="mini"
type="primary"
>
{{ searchMap[searchType] }}<i class="el-icon-arrow-down el-icon--right" />
{{ searchMap[searchType] }}<i class="el-icon-arrow-down el-icon--right"/>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="searchTypeClick('all')">{{ $t('commons.all') }}</el-dropdown-item>
@ -63,7 +63,7 @@
>
<span style="display: flex;flex: 1;width: 0;">
<span>
<i class="el-icon-folder" />
<i class="el-icon-folder"/>
</span>
<span
style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
@ -152,7 +152,7 @@
class="custom-tree-node-list father"
>
<span style="display: flex;flex: 1;width: 0;">
<span><svg-icon :icon-class="data.modelInnerType" /></span>
<span><svg-icon :icon-class="data.modelInnerType"/></span>
<span
style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
:title="data.name"
@ -225,7 +225,7 @@
:label="$t('commons.name')"
prop="name"
>
<el-input v-model="groupForm.name" />
<el-input v-model="groupForm.name"/>
</el-form-item>
</el-form>
<div
@ -235,12 +235,14 @@
<el-button
size="mini"
@click="close()"
>{{ $t('chart.cancel') }}</el-button>
>{{ $t('chart.cancel') }}
</el-button>
<el-button
type="primary"
size="mini"
@click="saveGroup(groupForm)"
>{{ $t('chart.confirm') }}</el-button>
>{{ $t('chart.confirm') }}
</el-button>
</div>
</el-dialog>
</el-col>
@ -264,7 +266,7 @@
:label="$t('commons.name')"
prop="name"
>
<el-input v-model="tableForm.name" />
<el-input v-model="tableForm.name"/>
</el-form-item>
</el-form>
<div
@ -274,12 +276,14 @@
<el-button
size="mini"
@click="closeTable()"
>{{ $t('chart.cancel') }}</el-button>
>{{ $t('chart.cancel') }}
</el-button>
<el-button
type="primary"
size="mini"
@click="saveTable(tableForm)"
>{{ $t('chart.confirm') }}</el-button>
>{{ $t('chart.confirm') }}
</el-button>
</div>
</el-dialog>
@ -318,8 +322,8 @@
:active="createActive"
align-center
>
<el-step :title="$t('chart.select_dataset')" />
<el-step :title="$t('chart.select_chart_type')" />
<el-step :title="$t('chart.select_dataset')"/>
<el-step :title="$t('chart.select_chart_type')"/>
</el-steps>
<table-selector
@ -385,14 +389,16 @@
<el-button
size="mini"
@click="closeCreateChart"
>{{ $t('chart.cancel') }}</el-button>
>{{ $t('chart.cancel') }}
</el-button>
<el-button
v-if="createActive === 2"
type="primary"
size="mini"
@click="createPreview"
>{{ $t('chart.preview')
}}
>{{
$t('chart.preview')
}}
</el-button>
<el-button
v-if="createActive === 1"
@ -433,14 +439,16 @@
<el-button
size="mini"
@click="closeMoveGroup()"
>{{ $t('dataset.cancel') }}</el-button>
>{{ $t('dataset.cancel') }}
</el-button>
<el-button
:disabled="groupMoveConfirmDisabled"
type="primary"
size="mini"
@click="saveMoveGroup(tGroup)"
>{{
$t('dataset.confirm') }}
$t('dataset.confirm')
}}
</el-button>
</div>
</el-dialog>
@ -465,14 +473,16 @@
<el-button
size="mini"
@click="closeMoveDs()"
>{{ $t('dataset.cancel') }}</el-button>
>{{ $t('dataset.cancel') }}
</el-button>
<el-button
:disabled="dsMoveConfirmDisabled"
type="primary"
size="mini"
@click="saveMoveDs(tDs)"
>{{
$t('dataset.confirm') }}
$t('dataset.confirm')
}}
</el-button>
</div>
</el-dialog>
@ -480,27 +490,26 @@
</template>
<script>
import { post, chartGroupTree } from '@/api/chart/chart'
import { chartGroupTree, pluginTypes, post } from '@/api/chart/chart'
import { queryAuthModel } from '@/api/authModel/authModel'
import TableSelector from '../view/TableSelector'
import GroupMoveSelector from '../components/treeSelector/GroupMoveSelector'
import ChartMoveSelector from '../components/treeSelector/ChartMoveSelector'
import ChartType from '@/views/chart/view/ChartType'
import { pluginTypes } from '@/api/chart/chart'
import {
DEFAULT_COLOR_CASE,
DEFAULT_FUNCTION_CFG,
DEFAULT_LABEL,
DEFAULT_LEGEND_STYLE,
DEFAULT_SIZE,
DEFAULT_SPLIT,
DEFAULT_THRESHOLD,
DEFAULT_TITLE_STYLE,
DEFAULT_TOOLTIP,
DEFAULT_TOTAL,
DEFAULT_XAXIS_STYLE,
DEFAULT_YAXIS_STYLE,
DEFAULT_YAXIS_EXT_STYLE,
DEFAULT_SPLIT,
DEFAULT_FUNCTION_CFG,
DEFAULT_THRESHOLD,
DEFAULT_TOTAL
DEFAULT_YAXIS_STYLE
} from '../chart/chart'
import { checkViewTitle } from '@/components/canvas/utils/utils'
import { adaptCurTheme } from '@/components/canvas/utils/style'
@ -977,6 +986,9 @@ export default {
view.render = this.view.render
view.resultMode = 'custom'
view.resultCount = 1000
view.refreshViewEnable = false
view.refreshUnit = 'minute'
view.refreshTime = 5
const customAttr = {
color: DEFAULT_COLOR_CASE,
tableColor: DEFAULT_COLOR_CASE,
@ -1226,135 +1238,135 @@ export default {
</script>
<style scoped>
.el-divider--horizontal {
margin: 12px 0
}
.el-divider--horizontal {
margin: 12px 0
}
.search-input {
padding: 12px 0;
}
.search-input {
padding: 12px 0;
}
.custom-tree-container {
margin-top: 10px;
}
.custom-tree-container {
margin-top: 10px;
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
.custom-tree-node-list {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding: 0 8px;
}
.custom-tree-node-list {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding: 0 8px;
}
.tree-list ::v-deep .el-tree-node__expand-icon.is-leaf {
display: none;
}
.tree-list ::v-deep .el-tree-node__expand-icon.is-leaf {
display: none;
}
.custom-position {
flex: 1;
display: flex;
align-items: center;
font-size: 14px;
flex-flow: row nowrap;
}
.custom-position {
flex: 1;
display: flex;
align-items: center;
font-size: 14px;
flex-flow: row nowrap;
}
.form-item {
margin-bottom: 0;
}
.form-item {
margin-bottom: 0;
}
.title-css {
height: 26px;
}
.title-css {
height: 26px;
}
.title-text {
line-height: 26px;
}
.title-text {
line-height: 26px;
}
.dialog-css ::v-deep .el-dialog__header {
padding: 20px 20px 0;
}
.dialog-css ::v-deep .el-dialog__header {
padding: 20px 20px 0;
}
.dialog-css ::v-deep .el-dialog__body {
padding: 10px 20px 20px;
}
.dialog-css ::v-deep .el-dialog__body {
padding: 10px 20px 20px;
}
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.scene-title {
width: 100%;
display: flex;
}
.scene-title {
width: 100%;
display: flex;
}
.scene-title-name {
width: 100%;
overflow: hidden;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
}
.scene-title-name {
width: 100%;
overflow: hidden;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
}
.father .child {
/*display: none;*/
visibility: hidden;
}
.father .child {
/*display: none;*/
visibility: hidden;
}
.father:hover .child {
/*display: inline;*/
visibility: visible;
}
.father:hover .child {
/*display: inline;*/
visibility: visible;
}
.tree-style {
padding: 10px 15px;
height: 100%;
overflow-y: auto;
}
.tree-style {
padding: 10px 15px;
height: 100%;
overflow-y: auto;
}
/deep/ .vue-treeselect__control {
height: 28px;
}
/deep/ .vue-treeselect__control {
height: 28px;
}
/deep/ .vue-treeselect__single-value {
color: #606266;
line-height: 28px !important;
}
/deep/ .vue-treeselect__single-value {
color: #606266;
line-height: 28px !important;
}
.render-select ::v-deep .el-input__suffix {
width: 20px;
}
.render-select ::v-deep .el-input__suffix {
width: 20px;
}
.render-select ::v-deep .el-input__inner {
padding-right: 10px;
padding-left: 6px;
}
.render-select ::v-deep .el-input__inner {
padding-right: 10px;
padding-left: 6px;
}
.dialog-css ::v-deep .el-step__title {
font-weight: 400;
font-size: 12px;
}
.dialog-css ::v-deep .el-step__title {
font-weight: 400;
font-size: 12px;
}
.chart-icon {
width: 200px;
height: 200px;
}
.chart-icon {
width: 200px;
height: 200px;
}
.chart-box {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
width: 50%;
float: left;
height: 380px;
}
.chart-box {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
width: 50%;
float: left;
height: 380px;
}
</style>

View File

@ -192,7 +192,7 @@
@command="chartFieldEdit"
>
<span class="el-dropdown-link">
<i class="el-icon-s-tools" />
<i class="el-icon-s-tools"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
@ -267,7 +267,7 @@
@command="chartFieldEdit"
>
<span class="el-dropdown-link">
<i class="el-icon-s-tools" />
<i class="el-icon-s-tools"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
@ -362,7 +362,7 @@
style="padding: 6px;"
>
{{ $t('chart.change_chart_type') }}
<i class="el-icon-caret-bottom" />
<i class="el-icon-caret-bottom"/>
</el-button>
</el-popover>
</span>
@ -406,6 +406,68 @@
</el-radio-group>
</el-row>
</el-row>
<el-row class="padding-lr">
<!-- <span-->
<!-- style="color: #909399; font-size: 8px;width: 80px;text-align: right;"-->
<!-- >-->
<!-- Tips:{{ $t('chart.rich_text_view_result_tips') }}-->
<!-- </span>-->
<span
style="width: 80px;text-align: right;"
>
{{ $t('panel.refresh_frequency') }}
</span>
<el-tooltip
class="item"
effect="dark"
placement="bottom"
>
<div slot="content">
{{ $t('chart.chart_refresh_tips') }}
</div>
<i
class="el-icon-info"
style="cursor: pointer;color: #606266;font-size: 12px"
/>
</el-tooltip>
<span class="padding-lr">
<el-checkbox
v-model="view.refreshViewEnable"
class="el-input-refresh-loading"
@change="refreshAttrChange"
></el-checkbox>
{{ $t('panel.enable_refresh_view') }}
</span>
<el-row>
<el-input
v-model="view.refreshTime"
class="el-input-refresh-time"
type="number"
size="mini"
controls-position="right"
:min="1"
:max="3600"
:disabled="!view.refreshViewEnable"
@change="refreshAttrChange"
/>
<el-select
v-model="view.refreshUnit"
class="el-input-refresh-unit margin-left8"
size="mini"
:disabled="!view.refreshViewEnable"
@change="refreshAttrChange"
>
<el-option
:label="$t('panel.minute')"
:value="'minute'"
/>
<el-option
:label="$t('panel.second')"
:value="'second'"
/>
</el-select>
</el-row>
</el-row>
<plugin-com
v-if="view.isPlugin"
@ -490,8 +552,8 @@
>
<span class="data-area-label">
<span v-if="view.type && view.type.includes('table')">{{
$t('chart.drag_block_table_data_column')
}}</span>
$t('chart.drag_block_table_data_column')
}}</span>
<span
v-else-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('scatter') || view.type === 'chart-mix' || view.type === 'waterfall' || view.type === 'area')"
>{{ $t('chart.drag_block_type_axis') }}</span>
@ -499,18 +561,18 @@
v-else-if="view.type && view.type.includes('pie')"
>{{ $t('chart.drag_block_pie_label') }}</span>
<span v-else-if="view.type && view.type.includes('funnel')">{{
$t('chart.drag_block_funnel_split')
}}</span>
$t('chart.drag_block_funnel_split')
}}</span>
<span v-else-if="view.type && view.type.includes('radar')">{{
$t('chart.drag_block_radar_label')
}}</span>
$t('chart.drag_block_radar_label')
}}</span>
<span v-else-if="view.type && view.type === 'map'">{{ $t('chart.area') }}</span>
<span v-else-if="view.type && view.type.includes('treemap')">{{
$t('chart.drag_block_treemap_label')
}}</span>
$t('chart.drag_block_treemap_label')
}}</span>
<span v-else-if="view.type && view.type === 'word-cloud'">{{
$t('chart.drag_block_word_cloud_label')
}}</span>
$t('chart.drag_block_word_cloud_label')
}}</span>
<span v-else-if="view.type && view.type === 'label'">{{ $t('chart.drag_block_label') }}</span>
<span v-show="view.type !== 'richTextView'"> / </span>
<span v-if="view.type && view.type !== 'table-info'">{{ $t('chart.dimension') }}</span>
@ -633,8 +695,8 @@
>
<span class="data-area-label">
<span v-if="view.type && view.type.includes('table')">{{
$t('chart.drag_block_table_data_column')
}}</span>
$t('chart.drag_block_table_data_column')
}}</span>
<span
v-else-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('scatter') || view.type === 'waterfall' || view.type === 'area')"
>{{ $t('chart.drag_block_value_axis') }}</span>
@ -642,30 +704,30 @@
v-else-if="view.type && view.type.includes('pie')"
>{{ $t('chart.drag_block_pie_angel') }}</span>
<span v-else-if="view.type && view.type.includes('funnel')">{{
$t('chart.drag_block_funnel_width')
}}</span>
$t('chart.drag_block_funnel_width')
}}</span>
<span v-else-if="view.type && view.type.includes('radar')">{{
$t('chart.drag_block_radar_length')
}}</span>
$t('chart.drag_block_radar_length')
}}</span>
<span v-else-if="view.type && view.type.includes('gauge')">{{
$t('chart.drag_block_gauge_angel')
}}</span>
$t('chart.drag_block_gauge_angel')
}}</span>
<span
v-else-if="view.type && view.type.includes('text')"
>{{ $t('chart.drag_block_label_value') }}</span>
<span v-else-if="view.type && view.type === 'map'">{{ $t('chart.chart_data') }}</span>
<span v-else-if="view.type && view.type.includes('tree')">{{
$t('chart.drag_block_treemap_size')
}}</span>
$t('chart.drag_block_treemap_size')
}}</span>
<span v-else-if="view.type && view.type === 'chart-mix'">{{
$t('chart.drag_block_value_axis_main')
}}</span>
$t('chart.drag_block_value_axis_main')
}}</span>
<span
v-else-if="view.type && view.type === 'liquid'"
>{{ $t('chart.drag_block_progress') }}</span>
<span v-else-if="view.type && view.type === 'word-cloud'">{{
$t('chart.drag_block_word_cloud_size')
}}</span>
$t('chart.drag_block_word_cloud_size')
}}</span>
<span v-show="view.type !== 'richTextView'"> / </span>
<span>{{ $t('chart.quota') }}</span>
<i
@ -1137,7 +1199,7 @@
:title="$t('panel.position_adjust_component')"
:name="'positionAdjust'"
>
<position-adjust />
<position-adjust/>
</el-collapse-item>
</el-collapse>
</div>
@ -1293,7 +1355,7 @@
width="800px"
class="dialog-css"
>
<quota-filter-editor :item="quotaItem" />
<quota-filter-editor :item="quotaItem"/>
<div
slot="footer"
class="dialog-footer"
@ -1320,7 +1382,7 @@
width="800px"
class="dialog-css"
>
<dimension-filter-editor :item="dimensionItem" />
<dimension-filter-editor :item="dimensionItem"/>
<div
slot="footer"
class="dialog-footer"
@ -1622,8 +1684,8 @@ import {
pluginTypes,
post,
resetViewCacheCallBack,
viewEditSave,
tableField
tableField,
viewEditSave
} from '@/api/chart/chart'
import DimensionItem from '../components/dragItem/DimensionItem'
import QuotaItem from '../components/dragItem/QuotaItem'
@ -1683,6 +1745,7 @@ import CalcChartFieldEdit from '@/views/chart/view/CalcChartFieldEdit'
import { equalsAny } from '@/utils/StringUtils'
import PositionAdjust from '@/views/chart/view/PositionAdjust'
import MarkMapDataEditor from '@/views/chart/components/map/MarkMapDataEditor'
export default {
name: 'ChartEdit',
components: {
@ -1759,6 +1822,9 @@ export default {
show: true,
type: 'bar',
title: '',
refreshViewEnable: false,
refreshUnit: 'minute',
refreshTime: 5,
customAttr: {
color: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
@ -2291,6 +2357,12 @@ export default {
delete view.data
return view
},
refreshAttrChange(switchType = false, switchRender = false) {
this.changeEditStatus(true)
const view = this.buildParam(true, 'chart', false, switchType, switchRender)
if (!view) return
viewEditSave(this.panelInfo.id, view)
},
calcData(getData, trigger, needRefreshGroup = false, switchType = false, switchRender = false) {
this.changeEditStatus(true)
const view = this.buildParam(true, 'chart', false, switchType, switchRender)
@ -3834,4 +3906,19 @@ span {
cursor: pointer;
z-index: 1;
}
.el-input-refresh-time {
width: calc(50% - 4px) !important;
}
.el-input-refresh-unit {
margin-left: 8px;
width: calc(50% - 4px) !important;
}
.el-input-refresh-loading {
margin-left: 4px;
font-size: 12px !important;
}
</style>

View File

@ -49,7 +49,6 @@
<el-checkbox
v-model="overallSettingForm.refreshViewLoading"
class="el-input-refresh-loading"
:disabled="!overallSettingForm.refreshViewEnable"
@change="themeChange"
>{{ $t('panel.enable_view_loading') }}</el-checkbox>
</span>