提交 fec7a677 authored 作者: wangjiahao's avatar wangjiahao

refactor: 批量修改样式优化

上级 7db5e731
...@@ -124,7 +124,7 @@ public class PanelGroupService { ...@@ -124,7 +124,7 @@ public class PanelGroupService {
if (StringUtils.isEmpty(panelId)) { // 新建 if (StringUtils.isEmpty(panelId)) { // 新建
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType()); checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType());
panelId = newPanel(request); panelId = newPanel(request);
panelGroupMapper.insert(request); panelGroupMapper.insertSelective(request);
// 清理权限缓存 // 清理权限缓存
clearPermissionCache(); clearPermissionCache();
sysAuthService.copyAuth(panelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL); sysAuthService.copyAuth(panelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL);
......
...@@ -1851,7 +1851,7 @@ export default { ...@@ -1851,7 +1851,7 @@ export default {
} }
.batchSetting{ .batchSetting{
opacity: 0.7; opacity: 0.9;
} }
.positionChange{ .positionChange{
......
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
}, },
// batch operation area // batch operation area
batchOptAreaShow() { batchOptAreaShow() {
return this.batchOptStatus && this.element.type === 'view' return this.batchOptStatus && this.element.type === 'view' && !this.element.isPlugin
}, },
// 联动区域按钮显示 // 联动区域按钮显示
linkageAreaShow() { linkageAreaShow() {
......
...@@ -256,6 +256,7 @@ export default { ...@@ -256,6 +256,7 @@ export default {
}) })
// 监听画布div变动事件 // 监听画布div变动事件
const tempCanvas = document.getElementById('canvasInfoTemp') const tempCanvas = document.getElementById('canvasInfoTemp')
if (tempCanvas) {
erd.listenTo(document.getElementById('canvasInfoTemp'), element => { erd.listenTo(document.getElementById('canvasInfoTemp'), element => {
_this.$nextTick(() => { _this.$nextTick(() => {
// 将mainHeight 修改为px 临时解决html2canvas 截图不全的问题 // 将mainHeight 修改为px 临时解决html2canvas 截图不全的问题
...@@ -263,6 +264,7 @@ export default { ...@@ -263,6 +264,7 @@ export default {
this.$emit('mainHeightChange', _this.mainHeight) this.$emit('mainHeightChange', _this.mainHeight)
}) })
}) })
}
eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog) eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog)
_this.$store.commit('clearLinkageSettingInfo', false) _this.$store.commit('clearLinkageSettingInfo', false)
_this.canvasStyleDataInit() _this.canvasStyleDataInit()
......
...@@ -412,8 +412,11 @@ export default { ...@@ -412,8 +412,11 @@ export default {
this.chart.customAttr = this.sourceCustomAttrStr this.chart.customAttr = this.sourceCustomAttrStr
updateParams['customAttr'] = this.sourceCustomAttrStr updateParams['customAttr'] = this.sourceCustomAttrStr
} else if (param.custom === 'customStyle') { } else if (param.custom === 'customStyle') {
this.sourceCustomStyleStr = this.chart.customStyle
const sourceCustomStyle = JSON.parse(this.sourceCustomStyleStr) const sourceCustomStyle = JSON.parse(this.sourceCustomStyleStr)
// view's title use history
if (param.property === 'text') {
param.value.title = sourceCustomStyle.text.title
}
sourceCustomStyle[param.property] = param.value sourceCustomStyle[param.property] = param.value
this.sourceCustomStyleStr = JSON.stringify(sourceCustomStyle) this.sourceCustomStyleStr = JSON.stringify(sourceCustomStyle)
this.chart.customStyle = this.sourceCustomStyleStr this.chart.customStyle = this.sourceCustomStyleStr
......
...@@ -125,7 +125,8 @@ const data = { ...@@ -125,7 +125,8 @@ const data = {
changeProperties: { changeProperties: {
customStyle: {}, customStyle: {},
customAttr: {} customAttr: {}
} },
allViewRender: []
}, },
mutations: { mutations: {
...animation.mutations, ...animation.mutations,
...@@ -550,7 +551,7 @@ const data = { ...@@ -550,7 +551,7 @@ const data = {
// get view base info // get view base info
const viewBaseInfo = state.componentViewsData[id] const viewBaseInfo = state.componentViewsData[id]
// get properties // get properties
const viewConfig = TYPE_CONFIGS.filter(item => item.render === viewBaseInfo.render && item.value === viewBaseInfo.type) const viewConfig = state.allViewRender.filter(item => item.render === viewBaseInfo.render && item.value === viewBaseInfo.type)
const viewProperties = viewConfig ? viewConfig[0].properties : [] const viewProperties = viewConfig ? viewConfig[0].properties : []
if (state.mixProperties.length > 0) { if (state.mixProperties.length > 0) {
// If it exists , taking the intersection // If it exists , taking the intersection
...@@ -641,6 +642,12 @@ const data = { ...@@ -641,6 +642,12 @@ const data = {
customStyle: {}, customStyle: {},
customAttr: {} customAttr: {}
} }
},
initViewRender(state, pluginViews) {
pluginViews.forEach(plugin => {
plugin.isPlugin = true
})
state.allViewRender = [...TYPE_CONFIGS, ...pluginViews]
} }
}, },
modules: { modules: {
......
...@@ -8,7 +8,8 @@ export const DEFAULT_COLOR_CASE = { ...@@ -8,7 +8,8 @@ export const DEFAULT_COLOR_CASE = {
tableStripe: true, tableStripe: true,
dimensionColor: '#000000', dimensionColor: '#000000',
quotaColor: '#000000', quotaColor: '#000000',
tableBorderColor: '#cfdaf4' tableBorderColor: '#cfdaf4',
seriesColors: [] // 格式:{"name":"s1","color":"","isCustom":false}
} }
export const DEFAULT_SIZE = { export const DEFAULT_SIZE = {
barDefault: true, barDefault: true,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<el-checkbox v-model="titleForm.show" @change="changeTitleStyle">{{ $t('chart.show') }}</el-checkbox> <el-checkbox v-model="titleForm.show" @change="changeTitleStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item> </el-form-item>
<div v-show="titleForm.show"> <div v-show="titleForm.show">
<el-form-item :label="$t('chart.title')" class="form-item"> <el-form-item v-if="!batchOptStatus" :label="$t('chart.title')" class="form-item">
<el-input <el-input
v-model="titleForm.title" v-model="titleForm.title"
size="mini" size="mini"
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_TITLE_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_TITLE_STYLE } from '../../chart/chart'
import { checkViewTitle } from '@/components/canvas/utils/utils' import { checkViewTitle } from '@/components/canvas/utils/utils'
import { mapState } from 'vuex'
export default { export default {
name: 'TitleSelector', name: 'TitleSelector',
...@@ -79,6 +80,11 @@ export default { ...@@ -79,6 +80,11 @@ export default {
} }
} }
}, },
computed: {
...mapState([
'batchOptStatus'
])
},
mounted() { mounted() {
this.init() this.init()
this.initData() this.initData()
...@@ -96,8 +102,10 @@ export default { ...@@ -96,8 +102,10 @@ export default {
if (customStyle.text) { if (customStyle.text) {
this.titleForm = customStyle.text this.titleForm = customStyle.text
} }
if (!this.batchOptStatus) {
this.titleForm.title = this.chart.title this.titleForm.title = this.chart.title
} }
}
}, },
init() { init() {
const arr = [] const arr = []
...@@ -110,6 +118,7 @@ export default { ...@@ -110,6 +118,7 @@ export default {
this.fontSize = arr this.fontSize = arr
}, },
changeTitleStyle() { changeTitleStyle() {
if (!this.batchOptStatus) {
if (this.titleForm.title.length < 1) { if (this.titleForm.title.length < 1) {
this.$error(this.$t('chart.title_cannot_empty')) this.$error(this.$t('chart.title_cannot_empty'))
this.titleForm.title = this.chart.title this.titleForm.title = this.chart.title
...@@ -120,6 +129,7 @@ export default { ...@@ -120,6 +129,7 @@ export default {
this.titleForm.title = this.chart.title this.titleForm.title = this.chart.title
return return
} }
}
if (!this.titleForm.show) { if (!this.titleForm.show) {
this.isSetting = false this.isSetting = false
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<el-checkbox v-model="titleForm.show" @change="changeTitleStyle">{{ $t('chart.show') }}</el-checkbox> <el-checkbox v-model="titleForm.show" @change="changeTitleStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item> </el-form-item>
<div v-show="titleForm.show"> <div v-show="titleForm.show">
<el-form-item :label="$t('chart.title')" class="form-item"> <el-form-item v-if="!this.batchOptStatus" :label="$t('chart.title')" class="form-item">
<el-input <el-input
v-model="titleForm.title" v-model="titleForm.title"
size="mini" size="mini"
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_TITLE_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_TITLE_STYLE } from '../../chart/chart'
import { checkTitle } from '@/api/chart/chart'
import { checkViewTitle } from '@/components/canvas/utils/utils' import { checkViewTitle } from '@/components/canvas/utils/utils'
import { mapState } from 'vuex'
export default { export default {
name: 'TitleSelectorAntV', name: 'TitleSelectorAntV',
...@@ -66,6 +66,11 @@ export default { ...@@ -66,6 +66,11 @@ export default {
predefineColors: COLOR_PANEL predefineColors: COLOR_PANEL
} }
}, },
computed: {
...mapState([
'batchOptStatus'
])
},
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
...@@ -90,8 +95,10 @@ export default { ...@@ -90,8 +95,10 @@ export default {
if (customStyle.text) { if (customStyle.text) {
this.titleForm = customStyle.text this.titleForm = customStyle.text
} }
if (!this.batchOptStatus) {
this.titleForm.title = this.chart.title this.titleForm.title = this.chart.title
} }
}
}, },
init() { init() {
const arr = [] const arr = []
...@@ -104,6 +111,7 @@ export default { ...@@ -104,6 +111,7 @@ export default {
this.fontSize = arr this.fontSize = arr
}, },
changeTitleStyle() { changeTitleStyle() {
if (!this.batchOptStatus) {
if (this.titleForm.title.length < 1) { if (this.titleForm.title.length < 1) {
this.$error(this.$t('chart.title_cannot_empty')) this.$error(this.$t('chart.title_cannot_empty'))
this.titleForm.title = this.chart.title this.titleForm.title = this.chart.title
...@@ -114,6 +122,7 @@ export default { ...@@ -114,6 +122,7 @@ export default {
this.titleForm.title = this.chart.title this.titleForm.title = this.chart.title
return return
} }
}
this.$emit('onTextChange', this.titleForm) this.$emit('onTextChange', this.titleForm)
}, },
inputOnInput: function(e) { inputOnInput: function(e) {
......
...@@ -1170,7 +1170,7 @@ export default { ...@@ -1170,7 +1170,7 @@ export default {
chartProperties() { chartProperties() {
const _this = this const _this = this
if (_this.chart && _this.chart.render) { if (_this.chart && _this.chart.render) {
const viewConfig = TYPE_CONFIGS.filter(item => item.render === _this.chart.render && item.value === _this.chart.type) const viewConfig = this.allViewRender.filter(item => item.render === _this.chart.render && item.value === _this.chart.type)
if (viewConfig && viewConfig.length) { if (viewConfig && viewConfig.length) {
return viewConfig[0].properties return viewConfig[0].properties
} else { } else {
...@@ -1188,7 +1188,8 @@ export default { ...@@ -1188,7 +1188,8 @@ export default {
}, },
...mapState([ ...mapState([
'curComponent', 'curComponent',
'panelViewEditInfo' 'panelViewEditInfo',
'allViewRender'
]) ])
/* pluginRenderOptions() { /* pluginRenderOptions() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || [] const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;padding-right: 6px" style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;padding-right: 6px"
class="attr-style theme-border-class" class="attr-style theme-border-class"
> >
<el-row v-if="chart.mode!=='batchOpt'" class="padding-lr"> <el-row v-if="!batchOptStatus" class="padding-lr">
<span class="title-text">{{ $t('chart.style_priority') }}</span> <span class="title-text">{{ $t('chart.style_priority') }}</span>
<el-row> <el-row>
<el-radio-group <el-radio-group
...@@ -274,6 +274,7 @@ import LegendSelectorAntV from '@/views/chart/components/component-style/LegendS ...@@ -274,6 +274,7 @@ import LegendSelectorAntV from '@/views/chart/components/component-style/LegendS
import BackgroundColorSelector from '@/views/chart/components/component-style/BackgroundColorSelector' import BackgroundColorSelector from '@/views/chart/components/component-style/BackgroundColorSelector'
import SplitSelector from '@/views/chart/components/component-style/SplitSelector' import SplitSelector from '@/views/chart/components/component-style/SplitSelector'
import SplitSelectorAntV from '@/views/chart/components/component-style/SplitSelectorAntV' import SplitSelectorAntV from '@/views/chart/components/component-style/SplitSelectorAntV'
import { mapState } from 'vuex'
export default { export default {
name: 'ChartStyle', name: 'ChartStyle',
...@@ -321,7 +322,9 @@ export default { ...@@ -321,7 +322,9 @@ export default {
} }
}, },
computed: { computed: {
...mapState([
'batchOptStatus'
])
}, },
created() { created() {
......
...@@ -30,6 +30,7 @@ import PanelList from '../list/PanelList' ...@@ -30,6 +30,7 @@ import PanelList from '../list/PanelList'
import PanelViewShow from '../list/PanelViewShow' import PanelViewShow from '../list/PanelViewShow'
import ShareTree from '../GrantAuth/shareTree' import ShareTree from '../GrantAuth/shareTree'
import Enshrine from '../enshrine/index' import Enshrine from '../enshrine/index'
import { pluginTypes } from '@/api/chart/chart'
export default { export default {
name: 'PanelMain', name: 'PanelMain',
...@@ -59,6 +60,16 @@ export default { ...@@ -59,6 +60,16 @@ export default {
} }
}, },
mounted() { mounted() {
// init all views (include plugins) base info
localStorage.removeItem('plugin-views')
pluginTypes().then(res => {
const plugins = res.data
localStorage.setItem('plugin-views', JSON.stringify(plugins))
this.$store.commit('initViewRender', plugins)
}).catch(e => {
localStorage.setItem('plugin-views', null)
this.$store.commit('initViewRender', plugins)
})
this.clear() this.clear()
}, },
methods: { methods: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论