refactor(仪表板): 优化修复富文本显示文案,tab页中的显示优化 (#2936)

* fix(仪表板): 修复富文本在tab页无效的问题

* refactor(富文本): 富文本编辑区结果展示文案修改,去掉下钻

* refactor(富文本): 富文本字段选择按钮再进入编辑状态再显示

* fix(仪表板): 富文本初始化进入仪表板编辑状态保存按钮会显示可以用问题

Co-authored-by: wangjiahao <1522128093@qq.com>
This commit is contained in:
fit2cloudrd 2022-08-25 11:55:22 +08:00 committed by GitHub
parent 95dbfd14a2
commit 75c21bf04d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 62 additions and 10 deletions

View File

@ -185,4 +185,10 @@ public class PanelGroupController {
public void viewLog(@RequestBody PanelViewLogRequest request) {
panelGroupService.viewLog(request);
}
@ApiOperation("获取仪表板中视图Element信息")
@GetMapping("/findPanelElementInfo/{viewId}")
@I18n
public Object findPanelElementInfo(@PathVariable String viewId){
return panelGroupService.findPanelElementInfo(viewId);
}
}

View File

@ -1,5 +1,7 @@
package io.dataease.service.panel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.commons.constants.*;
@ -698,4 +700,21 @@ public class PanelGroupService {
}
DeLogUtils.save(operateType, sourceType, panelId, panel.getPid(), null, null);
}
public Object findPanelElementInfo(String viewId){
PanelView panelView = panelViewService.findByViewId(viewId);
if(panelView!=null){
PanelGroupWithBLOBs panelGroupWithBLOBs = panelGroupMapper.selectByPrimaryKey(panelView.getPanelId());
if(panelGroupWithBLOBs != null){
JSONArray panelData = JSONObject.parseArray(panelGroupWithBLOBs.getPanelData());
for(int i = 0;i<panelData.size();i++){
JSONObject element = panelData.getJSONObject(i);
if("user-view".equals(element.getString("component"))){
return element;
}
}
}
}
return null;
}
}

View File

@ -291,3 +291,11 @@ export function removePanelCache(panelId) {
})
}
export function findPanelElementInfo(viewId) {
return request({
url: 'panel/group/findPanelElementInfo/'+viewId,
method: 'get',
loading: false
})
}

View File

@ -45,7 +45,7 @@
@mousedown="fieldsAreaDown"
>
<fields-list :fields="curFields" :element="element" />
<i slot="reference" :title="$t('panel.select_field')" class="icon iconfont icon-datasource-select" style="margin-left: 4px;cursor: pointer;font-size: 14px;" />
<i slot="reference" :disabled="element.editing" :title="$t('panel.select_field')" class="icon iconfont icon-datasource-select" style="margin-left: 4px;cursor: pointer;font-size: 14px;" />
</el-popover>
<span :title="$t('panel.jump')">
<a v-if="showJumpFlag" :title="curComponent.hyperlinks.content " :target="curComponent.hyperlinks.openMode " :href="curComponent.hyperlinks.content ">
@ -131,7 +131,7 @@ export default {
return this.curComponent.type === 'view' && this.curComponent.propValue.innerType !== 'richTextView'
},
selectFieldShow() {
return this.activeModel === 'edit' && this.curComponent.type === 'view' && this.curComponent.propValue.innerType === 'richTextView'
return this.activeModel === 'edit' && this.curComponent.type === 'view' && this.curComponent.propValue.innerType === 'richTextView' && this.curComponent.editing
},
curComponentTypes() {
const types = []

View File

@ -131,9 +131,9 @@ export default {
viewInit(){
bus.$on('fieldSelect-' + this.element.propValue.viewId, this.fieldSelect)
tinymce.init({})
this.myValue = this.assignment(this.element.propValue.textValue)
bus.$on('initCurFields-' + this.element.id, this.initCurFieldsChange)
this.$nextTick(()=>{
this.myValue = this.assignment(this.element.propValue.textValue)
bus.$on('initCurFields-' + this.element.id, this.initCurFieldsChange)
this.initReady=true
})
},

View File

@ -159,6 +159,7 @@ import { mapState } from 'vuex'
import { chartCopy } from '@/api/chart/chart'
import { buildFilterMap } from '@/utils/conditionUtil'
import TabUseList from '@/views/panel/AssistComponent/tabUseList'
import {findPanelElementInfo} from "@/api/panel/panel";
export default {
name: 'DeTabls',
@ -366,7 +367,8 @@ export default {
component = JSON.parse(JSON.stringify(componentTemp))
const propValue = {
id: newComponentId,
viewId: componentInfo.id
viewId: componentInfo.id,
textValue: ''
}
component.propValue = propValue
component.filters = []
@ -382,9 +384,20 @@ export default {
this.curItem.name = newComponentId
this.viewDialogVisible = false
this.activeTabName = newComponentId
this.$store.dispatch('chart/setViewId', component.propValue.viewId)
this.styleChange()
if(node.modelInnerType==='richTextView'){
findPanelElementInfo(node.innerId).then(viewElement =>{
if(viewElement.data){
this.curItem.content.propValue.textValue = viewElement.data.propValue.textValue
}
this.$store.dispatch('chart/setViewId', component.propValue.viewId)
this.styleChange()
})
}else{
this.$store.dispatch('chart/setViewId', component.propValue.viewId)
this.styleChange()
}
})
},
setComponentInfo() {

View File

@ -794,6 +794,7 @@ export default {
classification_name: 'Classification Name:'
},
chart: {
rich_text_view_result_tips: 'The rich text view selects only the first result',
rich_text_view: 'Rich Text View',
view_reset: 'View Reset',
view_reset_tips: 'Discard Changes To View?',

View File

@ -795,6 +795,7 @@ export default {
classification_name: '分類名稱'
},
chart: {
rich_text_view_result_tips: '富文本只选取第一条结果',
rich_text_view: '富文本视图',
view_reset: '視圖重置',
view_reset_tips: '放棄對視圖的修改?',

View File

@ -796,6 +796,7 @@ export default {
classification_name: '分类名称'
},
chart: {
rich_text_view_result_tips: '富文本只选取第一条结果',
rich_text_view: '富文本视图',
view_reset: '视图重置',
view_reset_tips: '放弃对视图的修改?',

View File

@ -254,10 +254,13 @@
<div style="overflow:auto;border-top: 1px solid #e6e6e6" class="attr-style theme-border-class">
<el-row style="height: 100%;">
<el-row class="padding-lr">
<span style="width: 80px;text-align: right;">
<span v-show="view.type==='richTextView'" style="color: #909399; font-size: 8px;width: 80px;text-align: right;">
Tips:{{ $t('chart.rich_text_view_result_tips') }}
</span>
<span v-show="view.type!=='richTextView'" style="width: 80px;text-align: right;">
{{ $t('chart.result_count') }}
</span>
<el-row>
<el-row v-show="view.type!=='richTextView'">
<el-radio-group
v-model="view.resultMode"
class="radio-span"
@ -683,7 +686,7 @@
</div>
</el-row>
<el-row
v-if="view.type && !(view.type.includes('table') && view.render === 'echarts') && !view.type.includes('text') && !view.type.includes('gauge') && view.type !== 'liquid' && view.type !== 'word-cloud' && view.type !== 'table-pivot' && view.type !=='label'"
v-if="view.type && !(view.type.includes('table') && view.render === 'echarts') && !view.type.includes('text') && !view.type.includes('gauge') && view.type !== 'liquid' && view.type !== 'word-cloud' && view.type !== 'table-pivot' && view.type !=='label'&&view.type !=='richTextView'"
class="padding-lr"
style="margin-top: 6px;"
>