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 'lodash'
import $ from 'jquery' import $ from 'jquery'
import Background from '@/views/background/index' 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 positionBox = []
let coordinates = [] // let coordinates = [] //
@ -943,7 +949,11 @@ export default {
}, },
computed: { computed: {
showGrid() { showGrid() {
return this.canvasStyleData.aidedDesign.showGrid if (this.canvasStyleData && this.canvasStyleData.aidedDesign) {
return this.canvasStyleData.aidedDesign.showGrid
} else {
return false
}
}, },
editStyle() { editStyle() {
return { return {
@ -1002,6 +1012,12 @@ export default {
} }
}, },
watch: { watch: {
matrixCount: {
handler(newVal, oldVal) {
const pointScale = newVal.x / oldVal.x
this.changeScale(pointScale)
}
},
customStyle: { customStyle: {
handler(newVal) { handler(newVal) {
// //
@ -1223,10 +1239,19 @@ export default {
// //
return value * scale / 100 return value * scale / 100
}, },
changeScale() { //
if (this.canvasStyleData.matrixCount) { changeComponentSizePoint(pointScale) {
this.matrixCount = this.canvasStyleData.matrixCount 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 // 1.3 1600*900 scaleWidth
// scaleHeight = scaleWidth 128*72 12.5*12.5 // scaleHeight = scaleWidth 128*72 12.5*12.5

View File

@ -67,7 +67,7 @@ export function mobile2MainCanvas(mainSource, mobileSource) {
} }
export function panelInit(componentData, componentStyle) { export function panelInit(componentData, componentStyle) {
componentData.forEach(item => { componentData.forEach((item, index) => {
if (item.component && item.component === 'de-date') { if (item.component && item.component === 'de-date') {
if (item.options.attrs && 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'))) { (!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.hyperlinks = (item.hyperlinks || HYPERLINKS)
} }
item.commonBackground = item.commonBackground || deepCopy(COMMON_BACKGROUND_NONE) item.commonBackground = item.commonBackground || deepCopy(COMMON_BACKGROUND_NONE)
componentData[index] = item
}) })
// style初始化 // style初始化
componentStyle.refreshTime = (componentStyle.refreshTime || 5) componentStyle.refreshTime = (componentStyle.refreshTime || 5)

View File

@ -8,9 +8,16 @@
> >
<el-col> <el-col>
<el-form ref="aidedForm" label-width="110px" size="mini"> <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-checkbox v-model="aidedDesign.showGrid" size="mini" @change="onChangePanelStyle" />
</el-form-item> </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-form>
</el-col> </el-col>
<el-button slot="reference" size="mini" class="shape-item">辅助设计 <i <el-button slot="reference" size="mini" class="shape-item">辅助设计 <i

View File

@ -168,7 +168,7 @@
@mouseup="deselectCurComponent" @mouseup="deselectCurComponent"
@scroll="canvasScroll" @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> </div>
<!--移动端画布区域 保持宽高比2.5--> <!--移动端画布区域 保持宽高比2.5-->
<el-row v-if="mobileLayoutStatus" class="mobile_canvas_main"> <el-row v-if="mobileLayoutStatus" class="mobile_canvas_main">
@ -547,6 +547,16 @@ export default {
panelInfo() { panelInfo() {
return this.$store.state.panel.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([ ...mapState([
'curComponent', 'curComponent',
'curCanvasScale', 'curCanvasScale',

View File

@ -1,5 +1,5 @@
// eslint-disable-next-line no-unused-vars // 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' import { deepCopy } from '@/components/canvas/utils/utils'
export const DEFAULT_PANEL_STYLE = { export const DEFAULT_PANEL_STYLE = {