Merge remote-tracking branch 'origin/master'

main
liu.shiyi 1 year ago
commit 25bb0f0010

@ -82,6 +82,8 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getFileUrl } from 'data-room-ui/js/utils/file'
export default { export default {
name: 'BgImgDialog', name: 'BgImgDialog',
props: { props: {
@ -114,10 +116,10 @@ export default {
init () { init () {
this.dialogVisible = true this.dialogVisible = true
this.imgUrl = this.form.customTheme === 'light' ? this.form.bg : this.form.lightBg this.imgUrl = this.form.customTheme === 'light' ? this.form.bg : this.form.lightBg
this.fileList = this.imgUrl this.fileList = this.getCoverPicture(this.imgUrl)
? [{ ? [{
name: '背景图', name: '背景图',
url: this.imgUrl url: this.getCoverPicture(this.imgUrl)
}] }]
: [] : []
this.hideUploadImgBtn = this.fileList.length !== 0 this.hideUploadImgBtn = this.fileList.length !== 0
@ -155,6 +157,14 @@ export default {
}, },
confirm () { confirm () {
this.dialogVisible = false this.dialogVisible = false
},
/**
* 获取图片访问地址,如果是相对路径则拼接上文件访问前缀地址
* @param url
* @returns {*}
*/
getCoverPicture (url) {
return getFileUrl(url)
} }
} }
} }

@ -97,7 +97,7 @@
<el-image <el-image
v-if="form[currentBg]" v-if="form[currentBg]"
class="bg-img bs-el-img" class="bg-img bs-el-img"
:src="form[currentBg]" :src="getCoverPicture(form[currentBg])"
fit="cover" fit="cover"
@click="$refs.bgImg.init()" @click="$refs.bgImg.init()"
/> />
@ -200,6 +200,7 @@ import BgImg from './BgImgDialog.vue'
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import { themeToSetting } from 'data-room-ui/js/utils/themeFormatting' import { themeToSetting } from 'data-room-ui/js/utils/themeFormatting'
import {predefineColors} from 'data-room-ui/js/utils/colorList' import {predefineColors} from 'data-room-ui/js/utils/colorList'
import { getFileUrl } from 'data-room-ui/js/utils/file'
export default { export default {
name: 'OverallSetting', name: 'OverallSetting',
components: { components: {
@ -488,6 +489,14 @@ export default {
snapHandler (val) { snapHandler (val) {
// this.$emit('changeSnap', val) // this.$emit('changeSnap', val)
this.snapChange(val) this.snapChange(val)
},
/**
* 获取图片访问地址,如果是相对路径则拼接上文件访问前缀地址
* @param url
* @returns {*}
*/
getCoverPicture (url) {
return getFileUrl(url)
} }
} }
} }

@ -6,7 +6,7 @@
class="bs-el-color-picker" class="bs-el-color-picker"
popper-class="bs-el-color-picker" popper-class="bs-el-color-picker"
/> />
<div class="el-icon-right" /> <div :class="positionIcon" @click="positionChange" />
<el-color-picker <el-color-picker
v-model="endColor" v-model="endColor"
class="bs-el-color-picker" class="bs-el-color-picker"
@ -33,7 +33,15 @@ export default {
startColor: '', // startColor: '', //
endColor: '', // endColor: '', //
position: '', // position: '', //
colorsValue: ''// g2 colorsValue: '',// g2
positionList: ['l(0)', 'l(90)', 'l(180)', 'l(270)'],
positionIconList: {
'l(0)': 'el-icon-right',
'l(90)': 'el-icon-bottom',
'l(180)': 'el-icon-back',
'l(270)': 'el-icon-top'
},
positionIcon: 'el-icon-right'
} }
}, },
computed: { computed: {
@ -51,8 +59,10 @@ export default {
}, },
methods: { methods: {
init () { init () {
// color 'l(0) 0:#ffffff 1:#000000'
const arr = this.colors?.split(' ') || [] const arr = this.colors?.split(' ') || []
this.position = arr[0] this.position = arr[0] || 'l(0)'
this.positionIcon = this.positionIconList[this.position] || 'el-icon-right'
const s = arr[1].split(':')[1] && arr[1].split(':')[1] !== 'null' ? arr[1].split(':')[1] : '' const s = arr[1].split(':')[1] && arr[1].split(':')[1] !== 'null' ? arr[1].split(':')[1] : ''
const e = arr[2].split(':')[1] && arr[2].split(':')[1] !== 'null' ? arr[2].split(':')[1] : '' const e = arr[2].split(':')[1] && arr[2].split(':')[1] !== 'null' ? arr[2].split(':')[1] : ''
this.startColor = s this.startColor = s
@ -61,7 +71,14 @@ export default {
colorChange (val) { colorChange (val) {
this.colorsValue = `${this.position} 0:${this.startColor} 1:${this.endColor}` this.colorsValue = `${this.position} 0:${this.startColor} 1:${this.endColor}`
this.$emit('change', this.colorsValue) this.$emit('change', this.colorsValue)
} },
positionChange(){
// position
const index = this.positionList.indexOf(this.position)
this.position = this.positionList[(index + 1) % 4]
this.positionIcon = this.positionIconList[this.position]
this.colorChange()
},
} }
} }
</script> </script>
@ -75,6 +92,23 @@ export default {
.el-icon-right{ .el-icon-right{
width: 40px; width: 40px;
text-align: center; text-align: center;
cursor: pointer;
}
.el-icon-bottom{
width: 40px;
text-align: center;
cursor: pointer;
}
.el-icon-back{
width: 40px;
text-align: center;
cursor: pointer;
}
.el-icon-top {
width: 40px;
text-align: center;
cursor: pointer;
} }
} }

@ -42,6 +42,7 @@ import { compile } from 'tiny-sass-compiler/dist/tiny-sass-compiler.esm-browser.
import NotPermission from 'data-room-ui/NotPermission' import NotPermission from 'data-room-ui/NotPermission'
import Configuration from 'data-room-ui/Render/Configuration.vue' import Configuration from 'data-room-ui/Render/Configuration.vue'
import DataViewDialog from 'data-room-ui/BigScreenDesign/DataViewDialog/index.vue' import DataViewDialog from 'data-room-ui/BigScreenDesign/DataViewDialog/index.vue'
import { getFileUrl } from 'data-room-ui/js/utils/file'
export default { export default {
name: 'BigScreenRun', name: 'BigScreenRun',
components: { components: {
@ -99,7 +100,7 @@ export default {
const bg = this.fitMode !== 'none' const bg = this.fitMode !== 'none'
? { ? {
backgroundColor: this.fitPageConfig.customTheme === 'light' ? this.fitPageConfig.lightBgColor : this.fitPageConfig.bgColor, backgroundColor: this.fitPageConfig.customTheme === 'light' ? this.fitPageConfig.lightBgColor : this.fitPageConfig.bgColor,
backgroundImage: this.fitPageConfig.customTheme === 'light' ? `url(${this.fitPageConfig.lightBg})` : `url(${this.fitPageConfig.bg})`, backgroundImage: this.fitPageConfig.customTheme === 'light' ? `url(${this.getCoverPicture(this.fitPageConfig.lightBg)})` : `url(${this.getCoverPicture(this.fitPageConfig.bg)})`,
backgroundSize: 'cover' backgroundSize: 'cover'
} }
: {} : {}
@ -121,7 +122,7 @@ export default {
const bg = this.fitMode === 'none' const bg = this.fitMode === 'none'
? { ? {
backgroundColor: this.fitPageConfig.customTheme === 'light' ? this.fitPageConfig.lightBgColor : this.fitPageConfig.bgColor, backgroundColor: this.fitPageConfig.customTheme === 'light' ? this.fitPageConfig.lightBgColor : this.fitPageConfig.bgColor,
backgroundImage: this.fitPageConfig.customTheme === 'light' ? `url(${this.fitPageConfig.lightBg})` : `url(${this.fitPageConfig.bg})`, backgroundImage: this.fitPageConfig.customTheme === 'light' ? `url(${this.getCoverPicture(this.fitPageConfig.lightBg)})` : `url(${this.getCoverPicture(this.fitPageConfig.bg)})`,
backgroundSize: 'cover' backgroundSize: 'cover'
} }
: {} : {}
@ -378,6 +379,14 @@ export default {
} }
return newPageConfig return newPageConfig
},
/**
* 获取图片访问地址,如果是相对路径则拼接上文件访问前缀地址
* @param url
* @returns {*}
*/
getCoverPicture (url) {
return getFileUrl(url)
} }
} }
} }

@ -7,7 +7,7 @@
width: pageInfo.pageConfig.w + 'px', width: pageInfo.pageConfig.w + 'px',
height: pageInfo.pageConfig.h + 'px', height: pageInfo.pageConfig.h + 'px',
backgroundColor:pageInfo.pageConfig.customTheme ==='light' ? pageInfo.pageConfig.lightBgColor:pageInfo.pageConfig.bgColor , backgroundColor:pageInfo.pageConfig.customTheme ==='light' ? pageInfo.pageConfig.lightBgColor:pageInfo.pageConfig.bgColor ,
backgroundImage:pageInfo.pageConfig.customTheme ==='light' ? `url(${pageInfo.pageConfig.lightBg})`:`url(${pageInfo.pageConfig.bg})` backgroundImage:pageInfo.pageConfig.customTheme ==='light' ? `url(${this.getCoverPicture(pageInfo.pageConfig.lightBg)})`:`url(${this.getCoverPicture(pageInfo.pageConfig.bg)})`
}" }"
@drop="drop($event)" @drop="drop($event)"
@dragover.prevent @dragover.prevent
@ -92,6 +92,7 @@ import { randomString } from '../js/utils'
import { compile } from 'tiny-sass-compiler/dist/tiny-sass-compiler.esm-browser.prod.js' import { compile } from 'tiny-sass-compiler/dist/tiny-sass-compiler.esm-browser.prod.js'
import plotList, { getCustomPlots } from '../G2Plots/plotList' import plotList, { getCustomPlots } from '../G2Plots/plotList'
import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting' import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting'
import { getFileUrl } from 'data-room-ui/js/utils/file'
export default { export default {
name: 'BigScreenRender', name: 'BigScreenRender',
@ -455,6 +456,14 @@ export default {
}) })
}) })
} }
},
/**
* 获取图片访问地址,如果是相对路径则拼接上文件访问前缀地址
* @param url
* @returns {*}
*/
getCoverPicture (url) {
return getFileUrl(url)
} }
} }
} }

@ -17,32 +17,41 @@ export default {
// 配置兼容 // 配置兼容
const pageInfo = handleResData(data) const pageInfo = handleResData(data)
// 兼容边框配置 // 兼容边框配置
pageInfo.chartList.forEach((item) => { pageInfo.chartList.forEach((chart) => {
if (item.dataSource) { if (chart.dataSource) {
item.dataSource.source = item.dataSource?.source || 'dataset' chart.dataSource.source = chart.dataSource?.source || 'dataset'
} }
if (!item.border) { if (!chart.border) {
item.border = { type: '', titleHeight: 60, fontSize: 16, isTitle: true, padding: [0, 0, 0, 0] } chart.border = { type: '', titleHeight: 60, fontSize: 16, isTitle: true, padding: [0, 0, 0, 0] }
} }
if (!item.border.padding) { if (!chart.border.padding) {
item.border.padding = [0, 0, 0, 0] chart.border.padding = [0, 0, 0, 0]
} }
if (item.type == 'customComponent') { let plotSettingsIterator = false
plotSettings[Symbol.iterator] = function * () { if (chart.type == 'customComponent') {
const keys = Object.keys(plotSettings) // 为本地G2组件配置添加迭代器
for (const k of keys) { if (!plotSettingsIterator) {
yield [k, plotSettings[k]] plotSettings[Symbol.iterator] = function * () {
const keys = Object.keys(plotSettings)
for (const k of keys) {
yield [k, plotSettings[k]]
}
} }
} }
for (const [key, value] of plotSettings) { for (const [key, localPlotSetting] of plotSettings) {
if (item.name == value.name) { if (chart.name == localPlotSetting.name) {
const settings = JSON.parse(JSON.stringify(value.setting)) // 本地配置项
item.setting = settings.map((x) => { const localSettings = JSON.parse(JSON.stringify(localPlotSetting.setting))
const index = item.setting.findIndex(y => y.field == x.field) chart.setting = localSettings.map((localSet) => {
x.field = item.setting[index].field // 在远程组件配置中找到 与 本地组件的配置项 相同的项索引
x.value = item.setting[index].value const index = chart.setting.findIndex(remoteSet => remoteSet.field == localSet.field)
return x if (index !== -1) {
// 使用远程的值替换本地值
localSet.field = chart.setting[index].field
localSet.value = chart.setting[index].value
}
return localSet
}) })
} }
} }

Loading…
Cancel
Save