Merge pull request #2123 from dataease/pr@dev@feat_panel-aided-design

feat: 可选择调节矩阵密度
This commit is contained in:
王嘉豪 2022-04-15 19:45:58 +08:00 committed by GitHub
commit b731e5998b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 9 deletions

View File

@ -219,6 +219,12 @@ import { buildFilterMap } from '@/utils/conditionUtil'
import _ from 'lodash'
import $ from 'jquery'
import Background from '@/views/background/index'
import { ApplicationContext } from '@/utils/ApplicationContext'
import {
BASE_MOBILE_STYLE,
COMMON_BACKGROUND_NONE,
HYPERLINKS
} from '@/components/canvas/custom-component/component-list'
let positionBox = []
let coordinates = [] //
@ -943,7 +949,11 @@ export default {
},
computed: {
showGrid() {
return this.canvasStyleData.aidedDesign.showGrid
if (this.canvasStyleData && this.canvasStyleData.aidedDesign) {
return this.canvasStyleData.aidedDesign.showGrid
} else {
return false
}
},
editStyle() {
return {
@ -1002,6 +1012,12 @@ export default {
}
},
watch: {
matrixCount: {
handler(newVal, oldVal) {
const pointScale = newVal.x / oldVal.x
this.changeScale(pointScale)
}
},
customStyle: {
handler(newVal) {
//
@ -1223,10 +1239,19 @@ export default {
//
return value * scale / 100
},
changeScale() {
if (this.canvasStyleData.matrixCount) {
this.matrixCount = this.canvasStyleData.matrixCount
}
//
changeComponentSizePoint(pointScale) {
this.componentData.forEach((item, index) => {
item.x = (item.x - 1) * pointScale + 1
item.y = (item.y - 1) * pointScale + 1
item.sizex = item.sizex * pointScale
item.sizey = item.sizey * pointScale
// this.componentData[index] = item
})
},
changeScale(pointScale) {
this.changeComponentSizePoint(pointScale)
// 1.3 1600*900 scaleWidth
// scaleHeight = scaleWidth 128*72 12.5*12.5

View File

@ -67,7 +67,7 @@ export function mobile2MainCanvas(mainSource, mobileSource) {
}
export function panelInit(componentData, componentStyle) {
componentData.forEach(item => {
componentData.forEach((item, index) => {
if (item.component && item.component === 'de-date') {
if (item.options.attrs &&
(!item.options.attrs.default || (item.serviceName === 'timeYearWidget' && item.options.attrs.default.dynamicInfill !== 'year') || (item.serviceName === 'timeMonthWidget' && item.options.attrs.default.dynamicInfill !== 'month'))) {
@ -95,6 +95,7 @@ export function panelInit(componentData, componentStyle) {
item.hyperlinks = (item.hyperlinks || HYPERLINKS)
}
item.commonBackground = item.commonBackground || deepCopy(COMMON_BACKGROUND_NONE)
componentData[index] = item
})
// style初始化
componentStyle.refreshTime = (componentStyle.refreshTime || 5)

View File

@ -8,9 +8,16 @@
>
<el-col>
<el-form ref="aidedForm" label-width="110px" size="mini">
<el-form-item :label="'显示辅助网格'" class="form-item form-item-slider">
<el-form-item :label="'辅助网格'" class="form-item form-item-slider">
<el-checkbox v-model="aidedDesign.showGrid" size="mini" @change="onChangePanelStyle" />
</el-form-item>
<el-form-item :label="'矩阵密度'" class="form-item form-item-slider">
<el-radio-group v-model="aidedDesign.matrixBase" size="mini">
<el-radio-button :label="1">普通</el-radio-button>
<el-radio-button :label="2">适中</el-radio-button>
<el-radio-button :label="3">密集</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item">辅助设计 <i

View File

@ -168,7 +168,7 @@
@mouseup="deselectCurComponent"
@scroll="canvasScroll"
>
<Editor ref="canvasEditor" :matrix-count="pcMatrixCount" :out-style="outStyle" :scroll-top="scrollTop" />
<Editor ref="canvasEditor" :matrix-count="pcMatrixCountBase" :out-style="outStyle" :scroll-top="scrollTop" />
</div>
<!--移动端画布区域 保持宽高比2.5-->
<el-row v-if="mobileLayoutStatus" class="mobile_canvas_main">
@ -547,6 +547,16 @@ export default {
panelInfo() {
return this.$store.state.panel.panelInfo
},
pcMatrixCountBase() {
if (this.canvasStyleData.aidedDesign) {
return {
x: this.pcMatrixCount.x * this.canvasStyleData.aidedDesign.matrixBase,
y: this.pcMatrixCount.y * this.canvasStyleData.aidedDesign.matrixBase
}
} else {
return this.pcMatrixCount
}
},
...mapState([
'curComponent',
'curCanvasScale',

View File

@ -1,5 +1,5 @@
// eslint-disable-next-line no-unused-vars
import { BASE_CHART, BASE_CHART_STRING } from '@/views/chart/chart/chart'
import { BASE_CHART_STRING } from '@/views/chart/chart/chart'
import { deepCopy } from '@/components/canvas/utils/utils'
export const DEFAULT_PANEL_STYLE = {