From 375a77e967e83aa342f42e2bacd5be1b20044383 Mon Sep 17 00:00:00 2001 From: "liu.shiyi" Date: Tue, 31 Oct 2023 10:53:30 +0800 Subject: [PATCH 01/18] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E7=A3=81=E5=90=B8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BigScreenDesign/OverallSetting/index.vue | 25 ++++++++++++++++++- data-room-ui/packages/Render/index.vue | 5 ++-- data-room-ui/packages/js/store/mutations.js | 4 +++ data-room-ui/packages/js/store/state.js | 4 ++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/data-room-ui/packages/BigScreenDesign/OverallSetting/index.vue b/data-room-ui/packages/BigScreenDesign/OverallSetting/index.vue index 8d2a37cd..05af9963 100644 --- a/data-room-ui/packages/BigScreenDesign/OverallSetting/index.vue +++ b/data-room-ui/packages/BigScreenDesign/OverallSetting/index.vue @@ -59,6 +59,16 @@ /> + + + state.bigScreen.pageInfo, config: state => state.bigScreen.activeItemConfig }), + currentSnap: { + get () { + // return this.snap + return this.$store.state.bigScreen.snapTolerance + }, + set (val) { + } + }, isPreview () { return (this.$route.path === window?.BS_CONFIG?.routers?.previewUrl) || (this.$route.path === '/big-screen/preview') }, @@ -361,7 +379,8 @@ export default { 'changeLayout', 'changeChartKey', 'changeRefreshConfig', - 'changePageInfo' + 'changePageInfo', + 'snapChange' ]), // 切换主题时更新主题配置 changeTheme (theme) { @@ -465,6 +484,10 @@ export default { }, timerEmptyState () { return this.pageInfo.chartList.every(chart => chart.dataSource?.businessKey === '' && chart.type !== 'marquee') + }, + snapHandler (val) { + // this.$emit('changeSnap', val) + this.snapChange(val) } } } diff --git a/data-room-ui/packages/Render/index.vue b/data-room-ui/packages/Render/index.vue index 997360bc..b3f72f7f 100644 --- a/data-room-ui/packages/Render/index.vue +++ b/data-room-ui/packages/Render/index.vue @@ -34,7 +34,7 @@ :debug="false" :is-conflict-check="false" :snap="true" - :snap-tolerance="2" + :snap-tolerance="snapTolerance" :style="{ zIndex: chart.z || 0, }" @@ -128,7 +128,8 @@ export default { hoverCode: (state) => state.bigScreen.hoverCode, themeJson: (state) => state.bigScreen.pageInfo.pageConfig.themeJson, isInit: (state) => !state.bigScreen.pageLoading, - scale: (state) => state.bigScreen.zoom / 100 + scale: (state) => state.bigScreen.zoom / 100, + snapTolerance: (state) => state.bigScreen.snapTolerance }) }, watch: { diff --git a/data-room-ui/packages/js/store/mutations.js b/data-room-ui/packages/js/store/mutations.js index b8070e49..a6ed1aa1 100644 --- a/data-room-ui/packages/js/store/mutations.js +++ b/data-room-ui/packages/js/store/mutations.js @@ -385,6 +385,10 @@ export default { // 清空数据集库 emptyComputedDatas (state) { state.computedDatas = {} + }, + // 修改磁吸状态 + snapChange (state, snap) { + state.snapTolerance = snap } } function deldataset (state, type, codes) { diff --git a/data-room-ui/packages/js/store/state.js b/data-room-ui/packages/js/store/state.js index 28b4a200..59c0f2e8 100644 --- a/data-room-ui/packages/js/store/state.js +++ b/data-room-ui/packages/js/store/state.js @@ -68,7 +68,9 @@ export const defaultData = { // 页面上所有组件的数据集的数据信息 dataset: {}, // 页面上所有组件的数据集的数据信息 - computedDatas: {} + computedDatas: {}, + // 是否开启磁吸 + snapTolerance: 3 } export default () => ({ From 4996957059da788583ae90ada641cae8a1f055a6 Mon Sep 17 00:00:00 2001 From: "hong.yang" Date: Tue, 31 Oct 2023 15:33:27 +0800 Subject: [PATCH 02/18] =?UTF-8?q?fix:=20=E9=A5=BC=E5=9B=BE=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=85=8D=E7=BD=AE=E6=A0=87=E7=AD=BE=E7=9A=84=E5=80=BC?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E4=B8=BA=E7=BB=B4=E5=BA=A6=E6=88=96=E6=8C=87?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/G2Plots/饼图/基础环图.js | 18 ++++++++++++++++++ .../packages/G2Plots/饼图/基础饼图.js | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/data-room-ui/packages/G2Plots/饼图/基础环图.js b/data-room-ui/packages/G2Plots/饼图/基础环图.js index 8db1cbab..6de6ee3e 100644 --- a/data-room-ui/packages/G2Plots/饼图/基础环图.js +++ b/data-room-ui/packages/G2Plots/饼图/基础环图.js @@ -41,6 +41,24 @@ const setting = [ }, /** 样式配置 **/ // 图表 graph + { + label: '标签文本来源', + // 设置组件类型 + type: 'select', + // 字段 + field: 'label_content', + // 对应options中的字段 + optionField: 'label.content', + value: '{value}', + tabName: 'custom', + options: [ + { label: '维度', value: '{name}' }, + { label: '指标', value: '{value}' } + ], + step: 0.1, + max: 1, + groupName: 'graph' + }, { label: '标签位置', // 设置组件类型 diff --git a/data-room-ui/packages/G2Plots/饼图/基础饼图.js b/data-room-ui/packages/G2Plots/饼图/基础饼图.js index 5102eff7..e7f565f7 100644 --- a/data-room-ui/packages/G2Plots/饼图/基础饼图.js +++ b/data-room-ui/packages/G2Plots/饼图/基础饼图.js @@ -41,6 +41,24 @@ const setting = [ }, /** 样式配置 **/ // 图表 graph + { + label: '标签文本来源', + // 设置组件类型 + type: 'select', + // 字段 + field: 'label_content', + // 对应options中的字段 + optionField: 'label.content', + value: '{value}', + tabName: 'custom', + options: [ + { label: '维度', value: '{name}' }, + { label: '指标', value: '{value}' } + ], + step: 0.1, + max: 1, + groupName: 'graph' + }, { label: '标签位置', // 设置组件类型 From b59a3c476da1d6dc81fed7c67d158290a9f0f175 Mon Sep 17 00:00:00 2001 From: "zhu.yawen" Date: Tue, 31 Oct 2023 15:41:49 +0800 Subject: [PATCH 03/18] =?UTF-8?q?fix:=E7=82=B9=E4=B9=9D=E5=9B=BEbug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RightSetting/MoveDialog/index.vue | 360 +++++++++--------- .../BorderComponents/GcBorder16/index.vue | 20 +- .../BorderComponents/GcBorder16/setting.js | 4 +- 3 files changed, 192 insertions(+), 192 deletions(-) diff --git a/data-room-ui/packages/BigScreenDesign/RightSetting/MoveDialog/index.vue b/data-room-ui/packages/BigScreenDesign/RightSetting/MoveDialog/index.vue index d8832872..623a5c72 100644 --- a/data-room-ui/packages/BigScreenDesign/RightSetting/MoveDialog/index.vue +++ b/data-room-ui/packages/BigScreenDesign/RightSetting/MoveDialog/index.vue @@ -10,55 +10,57 @@ @closed="close" @opened="getDom" > -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
方向描述
左上角不能拉伸
右上角不能拉伸
左下角不能拉伸
右下角不能拉伸
左侧宽度不变,高度自动拉伸
右侧宽度不变,高度自动拉伸
顶部高度不变,宽度自动拉伸
底部高度不变,宽度自动拉伸
中部宽度,高度自动拉伸
-
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
方向描述
左上角不能拉伸
右上角不能拉伸
左下角不能拉伸
右下角不能拉伸
左侧宽度不变,高度自动拉伸
右侧宽度不变,高度自动拉伸
顶部高度不变,宽度自动拉伸
底部高度不变,宽度自动拉伸
中部宽度,高度自动拉伸
+
+
+
@@ -76,7 +78,7 @@ class="bs-el-input-number" :step=" 1" :min="0" - :max="100000" + :max="49" @change="changeRight" /> @@ -86,7 +88,7 @@ class="bs-el-input-number" :step=" 1" :min="0" - :max="100000" + :max="49" @change="changeBottom" /> @@ -96,14 +98,14 @@ class="bs-el-input-number" :step=" 1" :min="0" - :max="100000" + :max="49" @change="changeLeft" />
+ diff --git a/data-room-ui/packages/BorderComponents/GcBorder16/index.vue b/data-room-ui/packages/BorderComponents/GcBorder16/index.vue index 867835fa..81cdb2ae 100644 --- a/data-room-ui/packages/BorderComponents/GcBorder16/index.vue +++ b/data-room-ui/packages/BorderComponents/GcBorder16/index.vue @@ -1,12 +1,12 @@ @@ -75,6 +92,23 @@ export default { .el-icon-right{ width: 40px; 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; } } diff --git a/data-room-ui/packages/BigScreenRun/index.vue b/data-room-ui/packages/BigScreenRun/index.vue index 34afd522..4c601fd1 100644 --- a/data-room-ui/packages/BigScreenRun/index.vue +++ b/data-room-ui/packages/BigScreenRun/index.vue @@ -42,6 +42,7 @@ import { compile } from 'tiny-sass-compiler/dist/tiny-sass-compiler.esm-browser. import NotPermission from 'data-room-ui/NotPermission' import Configuration from 'data-room-ui/Render/Configuration.vue' import DataViewDialog from 'data-room-ui/BigScreenDesign/DataViewDialog/index.vue' +import { getFileUrl } from 'data-room-ui/js/utils/file' export default { name: 'BigScreenRun', components: { @@ -99,7 +100,7 @@ export default { const bg = this.fitMode !== 'none' ? { 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' } : {} @@ -121,7 +122,7 @@ export default { const bg = this.fitMode === 'none' ? { 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' } : {} @@ -378,6 +379,14 @@ export default { } return newPageConfig + }, + /** + * 获取图片访问地址,如果是相对路径则拼接上文件访问前缀地址 + * @param url + * @returns {*} + */ + getCoverPicture (url) { + return getFileUrl(url) } } } diff --git a/data-room-ui/packages/Render/index.vue b/data-room-ui/packages/Render/index.vue index b3f72f7f..00a78250 100644 --- a/data-room-ui/packages/Render/index.vue +++ b/data-room-ui/packages/Render/index.vue @@ -7,7 +7,7 @@ width: pageInfo.pageConfig.w + 'px', height: pageInfo.pageConfig.h + 'px', 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)" @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 plotList, { getCustomPlots } from '../G2Plots/plotList' import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting' +import { getFileUrl } from 'data-room-ui/js/utils/file' export default { name: 'BigScreenRender', @@ -455,6 +456,14 @@ export default { }) }) } + }, + /** + * 获取图片访问地址,如果是相对路径则拼接上文件访问前缀地址 + * @param url + * @returns {*} + */ + getCoverPicture (url) { + return getFileUrl(url) } } } From 3930a8c13ef6c6558a4d18eb469c46daac3a25c3 Mon Sep 17 00:00:00 2001 From: "hong.yang" Date: Thu, 2 Nov 2023 16:53:11 +0800 Subject: [PATCH 09/18] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8A=A0=E8=BD=BD=E6=97=B6=EF=BC=8C=E5=AF=B9=E4=BA=8E?= =?UTF-8?q?G2=E7=BB=84=E4=BB=B6=E7=9A=84=E9=85=8D=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-room-ui/packages/js/store/actions.js | 49 ++++++++++++++--------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/data-room-ui/packages/js/store/actions.js b/data-room-ui/packages/js/store/actions.js index f2df60f8..b3b5e70e 100644 --- a/data-room-ui/packages/js/store/actions.js +++ b/data-room-ui/packages/js/store/actions.js @@ -17,32 +17,41 @@ export default { // 配置兼容 const pageInfo = handleResData(data) // 兼容边框配置 - pageInfo.chartList.forEach((item) => { - if (item.dataSource) { - item.dataSource.source = item.dataSource?.source || 'dataset' + pageInfo.chartList.forEach((chart) => { + if (chart.dataSource) { + chart.dataSource.source = chart.dataSource?.source || 'dataset' } - if (!item.border) { - item.border = { type: '', titleHeight: 60, fontSize: 16, isTitle: true, padding: [0, 0, 0, 0] } + if (!chart.border) { + chart.border = { type: '', titleHeight: 60, fontSize: 16, isTitle: true, padding: [0, 0, 0, 0] } } - if (!item.border.padding) { - item.border.padding = [0, 0, 0, 0] + if (!chart.border.padding) { + chart.border.padding = [0, 0, 0, 0] } - if (item.type == 'customComponent') { - plotSettings[Symbol.iterator] = function * () { - const keys = Object.keys(plotSettings) - for (const k of keys) { - yield [k, plotSettings[k]] + let plotSettingsIterator = false + if (chart.type == 'customComponent') { + // 为本地G2组件配置添加迭代器 + if (!plotSettingsIterator) { + plotSettings[Symbol.iterator] = function * () { + const keys = Object.keys(plotSettings) + for (const k of keys) { + yield [k, plotSettings[k]] + } } } - for (const [key, value] of plotSettings) { - if (item.name == value.name) { - const settings = JSON.parse(JSON.stringify(value.setting)) - item.setting = settings.map((x) => { - const index = item.setting.findIndex(y => y.field == x.field) - x.field = item.setting[index].field - x.value = item.setting[index].value - return x + for (const [key, localPlotSetting] of plotSettings) { + if (chart.name == localPlotSetting.name) { + // 本地配置项 + const localSettings = JSON.parse(JSON.stringify(localPlotSetting.setting)) + chart.setting = localSettings.map((localSet) => { + // 在远程组件配置中找到 与 本地组件的配置项 相同的项索引 + const index = chart.setting.findIndex(remoteSet => remoteSet.field == localSet.field) + if (index !== -1) { + // 使用远程的值替换本地值 + localSet.field = chart.setting[index].field + localSet.value = chart.setting[index].value + } + return localSet }) } } From 71f3eb8ebc12aa7453e1e41ce7fff407ac72cd8c Mon Sep 17 00:00:00 2001 From: "liu.shiyi" Date: Thu, 2 Nov 2023 16:54:28 +0800 Subject: [PATCH 10/18] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F=E7=9A=84=E5=AD=97=E6=AE=B5=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=8F=8A=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BasicComponents/Numbers/index.vue | 11 ++----- .../BasicComponents/Numbers/setting.vue | 24 +++++++++++--- .../packages/BasicComponents/Texts/index.vue | 16 ++++------ .../BasicComponents/Texts/setting.vue | 24 +++++++++++--- .../RightSetting/ExpressionDialog.vue | 26 ++++++++------- .../packages/js/mixins/commonMixins.js | 32 ++++++++++++------- data-room-ui/packages/js/store/mutations.js | 21 ++++++++++-- 7 files changed, 101 insertions(+), 53 deletions(-) diff --git a/data-room-ui/packages/BasicComponents/Numbers/index.vue b/data-room-ui/packages/BasicComponents/Numbers/index.vue index f28e5bdb..6c6d1b50 100644 --- a/data-room-ui/packages/BasicComponents/Numbers/index.vue +++ b/data-room-ui/packages/BasicComponents/Numbers/index.vue @@ -39,18 +39,11 @@ export default { methods: { // 通过表达式计算得来的值 getDataByExpression (config) { - // 如果表达式是由其他组件的值构成的 - // const len = this.config.expressionCodes ? this.config.expressionCodes.length : 0 - // const len1 = this.currentComputedDatas ? Object.keys(this.currentComputedDatas).length : 0 - // const len2 = this.currentDataset ? Object.keys(this.currentDataset).length : 0 - // if (len && len === len1 + len2) { - // eslint-disable-next-line no-new-func + console.log('getDataByExpression', this.dataset) const result = new Function('dataset', 'computedDatas', this.config.expression) config.customize.title = result(this.dataset, this.computedDatas) // 同时将计算得来的值保存到公共的数据存储的地方 - this.updateComputedDatas({ code: config.code, name: config.name, data: config.customize.title }) - // this.changeChartConfig(config) - // } + this.updateComputedDatas({ code: config.code, title: config.title, data: config.customize.title, isExpression: true }) }, dataFormatting (config, data) { // 文本数据配置原则:选择数据集则以后端返回的数据为主,否则以设置面板中标题设置为准 diff --git a/data-room-ui/packages/BasicComponents/Numbers/setting.vue b/data-room-ui/packages/BasicComponents/Numbers/setting.vue index 60f5f1f2..35777728 100644 --- a/data-room-ui/packages/BasicComponents/Numbers/setting.vue +++ b/data-room-ui/packages/BasicComponents/Numbers/setting.vue @@ -43,11 +43,11 @@ />
旋转 -
- -
+
+ +
基础
diff --git a/data-room-ui/packages/BasicComponents/Texts/index.vue b/data-room-ui/packages/BasicComponents/Texts/index.vue index 1cc6c5ec..430f184b 100644 --- a/data-room-ui/packages/BasicComponents/Texts/index.vue +++ b/data-room-ui/packages/BasicComponents/Texts/index.vue @@ -40,17 +40,15 @@ export default { // 通过表达式计算得来的值 getDataByExpression (config) { // 如果表达式是由其他组件的值构成的 - // const len = this.config.expressionCodes ? this.config.expressionCodes.length : 0 - // const len1 = this.currentComputedDatas ? Object.keys(this.currentComputedDatas).length : 0 - // const len2 = this.currentDataset ? Object.keys(this.currentDataset).length : 0 - // console.log('len', len, len1, len2) - // if (len && len === len1 + len2) { // eslint-disable-next-line no-new-func - const result = new Function('dataset', 'computedDatas', this.config.expression) - config.customize.title = result(this.dataset, this.computedDatas) - console.log(result(this.dataset, this.computedDatas)) + try { + const result = new Function('dataset', 'computedDatas', this.config.expression) + config.customize.title = result(this.dataset, this.computedDatas) + } catch (e) { + + } // 同时将计算得来的值保存到公共的数据存储的地方 - this.updateComputedDatas({ code: config.code, name: config.name, data: config.customize.title }) + this.updateComputedDatas({ code: config.code, title: config.title, data: config.customize.title }) // this.changeChartConfig(config) // } }, diff --git a/data-room-ui/packages/BasicComponents/Texts/setting.vue b/data-room-ui/packages/BasicComponents/Texts/setting.vue index b7b62147..00acf058 100644 --- a/data-room-ui/packages/BasicComponents/Texts/setting.vue +++ b/data-room-ui/packages/BasicComponents/Texts/setting.vue @@ -43,11 +43,11 @@ />
旋转 -
- -
+
+ +
基础
diff --git a/data-room-ui/packages/BigScreenDesign/RightSetting/ExpressionDialog.vue b/data-room-ui/packages/BigScreenDesign/RightSetting/ExpressionDialog.vue index 7a3b203f..1f4efcc5 100644 --- a/data-room-ui/packages/BigScreenDesign/RightSetting/ExpressionDialog.vue +++ b/data-room-ui/packages/BigScreenDesign/RightSetting/ExpressionDialog.vue @@ -129,17 +129,21 @@ export default { treeData () { const list = [] for (const item in this.dataset) { - const fields = Object.keys(this.dataset[item][0]) - const children = fields.map((field) => { - return { - label: field, - code: item, - value: `dataset.${item}[0].${field}`, - disabled: item.includes(this.config.code) - } - }) + let children = [] + if (this.dataset[item][0]) { + const fields = Object.keys(this.dataset[item][0]) + children = fields.map((field) => { + return { + label: field, + code: item, + value: `dataset.${item}[0].${field}`, + disabled: item.includes(this.config.code) + } + }) + } + list.push({ - label: item, + label: item.split('_')[0], code: item, value: `dataset.${item}`, disabled: item.includes(this.config.code), @@ -148,7 +152,7 @@ export default { } for (const item in this.computedDatas) { list.push({ - label: item, + label: item.split('_')[0], code: item, value: `computedDatas.${item}`, disabled: item.includes(this.config.code) diff --git a/data-room-ui/packages/js/mixins/commonMixins.js b/data-room-ui/packages/js/mixins/commonMixins.js index 3aa2b62c..0fe0f85e 100644 --- a/data-room-ui/packages/js/mixins/commonMixins.js +++ b/data-room-ui/packages/js/mixins/commonMixins.js @@ -26,8 +26,8 @@ export default { } }, currentDataset: { // 关联的数据发生变化 - handler (val) { - if (val && Object.keys(val).length) { + handler (val, old) { + if (val && Object.keys(val).length && JSON.stringify(val) !== JSON.stringify(old)) { this.getDataByExpression(this.config) } }, @@ -35,8 +35,8 @@ export default { immediate: true }, currentComputedDatas: { // 关联的数据发生变化 - handler (val) { - if (val && Object.keys(val).length) { + handler (val, old) { + if (val && Object.keys(val).length && JSON.stringify(val) !== JSON.stringify(old)) { this.getDataByExpression(this.config) } }, @@ -62,9 +62,13 @@ export default { // 跟当前组件计算表达式关联的组件的数据集合 currentDataset () { const newDataset = {} - this.config.expressionCodes?.forEach(code => { - if (this.dataset[code]) { - newDataset[code] = this.dataset[code] + this.config.expressionCodes?.forEach(item => { + const code = item.split('_')[1] + for (const key in this.dataset) { + const objCode = key.split('_')[1] + if (objCode === code) { + newDataset[code] = this.dataset[key] + } } }) return newDataset @@ -72,9 +76,13 @@ export default { // 跟当前组件计算表达式关联的组件的数据集合 currentComputedDatas () { const newDataset = {} - this.config.expressionCodes?.forEach(code => { - if (this.computedDatas[code]) { - newDataset[code] = this.computedDatas[code] + this.config.expressionCodes?.forEach(item => { + const code = item.split('_')[1] + for (const key in this.computedDatas) { + const objCode = key.split('_')[1] + if (objCode === code) { + newDataset[code] = this.computedDatas[key] + } } }) return newDataset @@ -170,7 +178,7 @@ export default { } // 将后端返回的数据保存 if (_res.success) { - this.updateDataset({ code: config.code, name: config.name, data: _res?.data }) + this.updateDataset({ code: config.code, title: config.title, data: _res?.data }) } config = this.dataFormatting(config, _res) this.changeChartConfig(config) @@ -242,7 +250,7 @@ export default { } // 将后端返回的数据保存 if (_res.success) { - this.updateDataset({ code: config.code, name: config.name, data: _res?.data }) + this.updateDataset({ code: config.code, title: config.title, data: _res?.data }) } config = this.dataFormatting(config, _res) if (this.chart) { diff --git a/data-room-ui/packages/js/store/mutations.js b/data-room-ui/packages/js/store/mutations.js index a6ed1aa1..17f8fa02 100644 --- a/data-room-ui/packages/js/store/mutations.js +++ b/data-room-ui/packages/js/store/mutations.js @@ -14,6 +14,7 @@ import { defaultData } from './state' import moment from 'moment' import { randomString } from 'data-room-ui/js/utils' import { EventBus } from 'data-room-ui/js/utils/eventBus' +import CloneDeep from 'lodash-es/cloneDeep' export default { // 改变页面基本信息,后端请求的页面信息存储到此处 changePageInfo (state, pageInfo) { @@ -372,11 +373,27 @@ export default { }, // 更新数据集库中的内容 updateDataset (state, res) { - Vue.set(state.dataset, res.name + res.code, res.data) + // 如果只是更新了组件的标题 + if (res.oldTitle && state.dataset.hasOwnProperty(res.oldTitle + '_' + res.code)) { + const _dataset = CloneDeep(state.dataset) + _dataset[res.title + '_' + res.code] = _dataset[res.oldTitle + '_' + res.code] + delete _dataset[res.oldTitle + '_' + res.code] + state.dataset = CloneDeep(_dataset) + } else { + Vue.set(state.dataset, res.title + '_' + res.code, res.data) + } }, // 更新数据集库中的内容 updateComputedDatas (state, res) { - Vue.set(state.computedDatas, res.name + res.code, res.data) + // 如果只是更新了组件的标题 + if (res.oldTitle && state.computedDatas.hasOwnProperty(res.oldTitle + '_' + res.code)) { + const _computedDatas = CloneDeep(state.computedDatas) + _computedDatas[res.title + '_' + res.code] = _computedDatas[res.oldTitle + '_' + res.code] + delete _computedDatas[res.oldTitle + '_' + res.code] + state.computedDatas = CloneDeep(_computedDatas) + } else if (res.isExpression) { + Vue.set(state.computedDatas, res.title + '_' + res.code, res.data) + } }, // 清空数据集库 emptyDataset (state) { From 5f611a26c3353c92890ad80ea4719b8070f1e138 Mon Sep 17 00:00:00 2001 From: "hong.yang" Date: Thu, 2 Nov 2023 17:58:17 +0800 Subject: [PATCH 11/18] =?UTF-8?q?feat:=20=E9=A5=BC=E5=9B=BE=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=86=85=E9=83=A8=E6=A0=87=E7=AD=BE=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=97=8B=E8=BD=AC=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-room-ui/packages/G2Plots/饼图/基础饼图.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data-room-ui/packages/G2Plots/饼图/基础饼图.js b/data-room-ui/packages/G2Plots/饼图/基础饼图.js index e7f565f7..7acf3189 100644 --- a/data-room-ui/packages/G2Plots/饼图/基础饼图.js +++ b/data-room-ui/packages/G2Plots/饼图/基础饼图.js @@ -76,6 +76,17 @@ const setting = [ ], groupName: 'graph' }, + { + label: '旋转内部标签', + type: 'switch', // 设置组件类型 + field: 'labelAutoRotate', // 字段 + optionField: 'label.autoRotate', // 对应options中的字段 + value: true, + active: true, + inactive: false, + tabName: 'custom', + groupName: 'graph' + }, { label: '标签颜色', // 设置组件类型 @@ -257,6 +268,7 @@ const option = { }, color: ['#6b74e4', '#4391f4', '#38bbe5', '#69d6fd', '#36c6a0'], label: { + autoRotate: true, type: 'inner', labelHeight: 50, labelLine: { From e6cf38ba670da44193cce96f7f8081b55919a7cb Mon Sep 17 00:00:00 2001 From: "hong.yang" Date: Fri, 3 Nov 2023 13:51:41 +0800 Subject: [PATCH 12/18] =?UTF-8?q?fix=EF=BC=9A=20=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E5=B0=8F=E6=95=B0=E4=BD=8D=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/G2Plots/进度图/仪表盘.js | 19 ++++++++++++++++++- .../G2Plots/进度图/进度仪表盘.js | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/data-room-ui/packages/G2Plots/进度图/仪表盘.js b/data-room-ui/packages/G2Plots/进度图/仪表盘.js index de84471b..eeae9572 100644 --- a/data-room-ui/packages/G2Plots/进度图/仪表盘.js +++ b/data-room-ui/packages/G2Plots/进度图/仪表盘.js @@ -99,6 +99,18 @@ const setting = [ tabName: 'custom', groupName: 'graph' }, + { + label: '指标小数位', + // 设置组件类型 + type: 'inputNumber', + // 字段 + field: 'statistic_fixed', + // 对应options中的字段 + optionField: 'statisticFixed', + value: 0, + tabName: 'custom', + groupName: 'graph' + }, { label: '指标字体类型', // 设置组件类型 @@ -185,7 +197,11 @@ const data = [ } ] // 配置处理脚本 -const optionHandler ='option.range.color = [option.color1, option.color2]' +const optionHandler ='option.range.color = [option.color1, option.color2]\n' + + ' let fix = option.statisticFixed\n' + + ' option.statistic.title.formatter = ({ percent }) => `${(percent * 100).toFixed(fix)}%`' + + // 数据处理脚本 const dataHandler = '// 取返回数据列表的第一项指标值\noption.percent = data[0][setting.filter(settingItem=>settingItem.field === \'percent\')[0].value]' @@ -226,6 +242,7 @@ const option = { // shapeStyle: { // fill: 'rgba(208,208,208,0)' // }, + statisticFixed: 0, statistic: { title: { offsetY: 0, diff --git a/data-room-ui/packages/G2Plots/进度图/进度仪表盘.js b/data-room-ui/packages/G2Plots/进度图/进度仪表盘.js index 15ad569b..0fb9c1b5 100644 --- a/data-room-ui/packages/G2Plots/进度图/进度仪表盘.js +++ b/data-room-ui/packages/G2Plots/进度图/进度仪表盘.js @@ -75,6 +75,18 @@ const setting = [ tabName: 'custom', groupName: 'graph' }, + { + label: '指标小数位', + // 设置组件类型 + type: 'inputNumber', + // 字段 + field: 'statistic_fixed', + // 对应options中的字段 + optionField: 'statisticFixed', + value: 0, + tabName: 'custom', + groupName: 'graph' + }, { label: '指标字体类型', // 设置组件类型 @@ -160,7 +172,9 @@ const data = [ } ] // 配置处理脚本 -const optionHandler ='option.range.color = [option.color1, option.color2]' +const optionHandler ='option.range.color = [option.color1, option.color2]\n' + + ' let fix = option.statisticFixed\n' + + ' option.statistic.title.formatter = ({ percent }) => `${(percent * 100).toFixed(fix)}%`' // 数据处理脚本 const dataHandler = '// 取返回数据列表的第一项指标值\noption.percent = data[0][setting.filter(settingItem=>settingItem.field === \'percent\')[0].value]' @@ -175,6 +189,7 @@ const option = { range: { color: ['l(0) 0:#6b74e4 1:#4391f4','#d0d0d0'] }, + statisticFixed: 0, startAngle: Math.PI, endAngle: 2 * Math.PI, indicator: null, From 7dfb749f2c2c2fdd8b68694b97b04b26d8ec83e7 Mon Sep 17 00:00:00 2001 From: "hong.yang" Date: Fri, 3 Nov 2023 16:32:07 +0800 Subject: [PATCH 13/18] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96G2=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=8A=A8=E6=80=81=E9=85=8D=E7=BD=AE=E8=B5=8B?= =?UTF-8?q?=E5=80=BC=EF=BC=8C=E5=AF=B9=E4=BA=8E=E5=B1=9E=E6=80=A7=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=EF=BC=8C=E5=B0=86=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=B5=8B=E5=80=BC=E7=A9=BA=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-room-ui/packages/PlotRender/index.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data-room-ui/packages/PlotRender/index.vue b/data-room-ui/packages/PlotRender/index.vue index b67a2f38..be6cd8ed 100644 --- a/data-room-ui/packages/PlotRender/index.vue +++ b/data-room-ui/packages/PlotRender/index.vue @@ -147,7 +147,9 @@ export default { let option = null config.setting.forEach(set => { if (set.optionField) { + // 例 point.style.fill const optionField = set.optionField.split('.') + // 例 [point,style,fill] option = config.option optionField.forEach((field, index) => { if (index === optionField.length - 1) { @@ -156,6 +158,10 @@ export default { option[field] = set.value } } else { + // 如果没有这个属性,则创建该属性,并赋值为空对值 + if (!option[field]) { + option[field] = {} + } option = option[field] } }) From c3149423d1a93fd0aa4729c60bda2f917beef6c3 Mon Sep 17 00:00:00 2001 From: "zhu.yawen" Date: Mon, 6 Nov 2023 09:12:15 +0800 Subject: [PATCH 14/18] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B0=8F=E5=9C=B0?= =?UTF-8?q?=E5=9B=BEbug;=E4=BF=AE=E5=A4=8D=E9=BC=A0=E6=A0=87=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E4=BD=8D=E7=BD=AE=E5=81=8F=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BigScreenDesign/MouseSelect/index.vue | 37 +++++++++++---- .../BigScreenDesign/RulerTool/SketchRuler.vue | 47 ++----------------- .../packages/BigScreenDesign/index.vue | 1 - 3 files changed, 33 insertions(+), 52 deletions(-) diff --git a/data-room-ui/packages/BigScreenDesign/MouseSelect/index.vue b/data-room-ui/packages/BigScreenDesign/MouseSelect/index.vue index 02267a22..935bdabd 100644 --- a/data-room-ui/packages/BigScreenDesign/MouseSelect/index.vue +++ b/data-room-ui/packages/BigScreenDesign/MouseSelect/index.vue @@ -51,8 +51,10 @@ export default { }), getSelectionBoxStyle () { // 计算虚线框的样式 - const left = Math.min(this.startX, this.endX) + 'px' - const top = Math.min(this.startY, this.endY) + 'px' + let left = Math.min(this.startX, this.endX) + 'px' + let top = Math.min(this.startY, this.endY) + 'px' + const left1 = Math.min(this.startX, this.endX) + 50 * this.scale + 'px' + const top1 = Math.min(this.startY, this.endY) + 50 * this.scale + 'px' const width = Math.abs(this.endX - this.startX) + 'px' const height = Math.abs(this.endY - this.startY) + 'px' if (!this.isSelecting) { @@ -79,6 +81,7 @@ export default { ] ), handleMouseDown (event) { + // 点击在底部背景上 if (event.button === 0) { time = new Date() // 避免和shift + 点击多选组件冲突 @@ -86,11 +89,22 @@ export default { return } this.isSelectDown = true - - this.startX = (event.x - this.offsetX) / this.scale + 50 - this.startY = (event.y - this.offsetY) / this.scale + 50 - this.endX = (event.x - this.offsetX) / this.scale + 50 - this.endY = (event.y - this.offsetY) / this.scale + 50 + // 点击在底部背景上 + if (event.target.className.indexOf('mouse-select-wrap') !== -1) { + this.startX = event.offsetX + this.endX = event.offsetX + this.startY = event.offsetY + this.endY = event.offsetY + } else if (event.target.className.indexOf('design-drag-wrap') !== -1) { + this.startX = event.offsetX + 50 + this.endX = event.offsetX + 50 + this.startY = event.offsetY + 50 + this.endY = event.offsetY + 50 + } + // this.startX = (event.x - this.offsetX + 50) / this.scale + // this.startY = (event.y - this.offsetY + 50) / this.scale + // this.endX = (event.x - this.offsetX + 50) / this.scale + // this.endY = (event.y - this.offsetY + 50) / this.scale } }, handleMouseMove (event) { @@ -102,8 +116,13 @@ export default { this.isSelecting = true } if (this.isSelecting) { - this.endX = (event.x - this.offsetX) / this.scale + 50 - this.endY = (event.y - this.offsetY) / this.scale + 50 + if (event.target.className.indexOf('mouse-select-wrap') !== -1) { + this.endX = event.offsetX + this.endY = event.offsetY + } else if (event.target.className.indexOf('design-drag-wrap') !== -1) { + this.startX = event.offsetX + 50 + this.endY = event.offsetY + 50 + } } }, handleMouseUp (event) { diff --git a/data-room-ui/packages/BigScreenDesign/RulerTool/SketchRuler.vue b/data-room-ui/packages/BigScreenDesign/RulerTool/SketchRuler.vue index d5856302..6544fee0 100644 --- a/data-room-ui/packages/BigScreenDesign/RulerTool/SketchRuler.vue +++ b/data-room-ui/packages/BigScreenDesign/RulerTool/SketchRuler.vue @@ -214,6 +214,10 @@ export default { scrollLeft = screenElement.scrollLeft scrollTop = screenElement.scrollTop maxContainer.addEventListener('mousemove', function (event) { + // 在鼠标移动过程中判断出鼠标左键未点击,则停止拖拽 + if (event.buttons !== 1) { + that.isDrag = false + } if (that.isDrag) { event.preventDefault() // 鼠标移动距离 @@ -427,52 +431,11 @@ export default { .screen-container { position: absolute; + overflow:hidden; width: 6000px; height: 6000px; } -.minimap{ - position: fixed; - bottom: 15px; - right: 15px; - border: 1px solid #f6f7fb; - z-index:10000; - /*cursor: move;*/ -} -.minimap .mapHeader{ - background-color:#303640; - padding: 0 10px; - display: flex; - justify-content: space-between; - height: 20px; - width: 150px; - font-size: 12px; - border-bottom: 1px solid #fff; - color: #ffffff; - cursor: pointer; - span { - user-select: none; - } -} - -.minimap .selectWin{ - background-color: #232832; - height: 150px; - width: 150px; - position: relative; -} - -.minimap .selectionWin{ - position: absolute; - left: 0px; - top: 0px; - width: 30px; - height: 30px; - background-color: white; - opacity: 0.5; - cursor: move; -} - .scale-value { position: absolute; left: 0; diff --git a/data-room-ui/packages/BigScreenDesign/index.vue b/data-room-ui/packages/BigScreenDesign/index.vue index 1533beef..2b46c39d 100644 --- a/data-room-ui/packages/BigScreenDesign/index.vue +++ b/data-room-ui/packages/BigScreenDesign/index.vue @@ -55,7 +55,6 @@ class="selectionWin" />
-
Date: Mon, 6 Nov 2023 14:17:05 +0800 Subject: [PATCH 15/18] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=9D=A1=E5=BD=A2?= =?UTF-8?q?=E5=9B=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BasicComponents/Numbers/index.vue | 1 - data-room-ui/packages/PlotRender/index.vue | 22 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/data-room-ui/packages/BasicComponents/Numbers/index.vue b/data-room-ui/packages/BasicComponents/Numbers/index.vue index 6c6d1b50..454e9c73 100644 --- a/data-room-ui/packages/BasicComponents/Numbers/index.vue +++ b/data-room-ui/packages/BasicComponents/Numbers/index.vue @@ -39,7 +39,6 @@ export default { methods: { // 通过表达式计算得来的值 getDataByExpression (config) { - console.log('getDataByExpression', this.dataset) const result = new Function('dataset', 'computedDatas', this.config.expression) config.customize.title = result(this.dataset, this.computedDatas) // 同时将计算得来的值保存到公共的数据存储的地方 diff --git a/data-room-ui/packages/PlotRender/index.vue b/data-room-ui/packages/PlotRender/index.vue index be6cd8ed..dc798981 100644 --- a/data-room-ui/packages/PlotRender/index.vue +++ b/data-room-ui/packages/PlotRender/index.vue @@ -186,7 +186,7 @@ export default { console.error(e) } } - if(config.chartType=='Treemap'){ + if (config.chartType == 'Treemap') { const xAxis = config.setting.find(item => item.field === 'xField')?.value const listData = data.children.map(item => { if (xAxis && typeof item[xAxis] === 'number') { @@ -194,14 +194,26 @@ export default { } return item }) - config.option.data={name:'root',children:[...listData]} + config.option.data = { name: 'root', children: [...listData] } // console.log(config.option.data) - }else{ - // 如果维度为数字类型则转化为字符串,否则在不增加其他配置的情况下会导致图标最后一项不显示(g2plot官网已说明) + } else { + // 如果维度为数字类型则转化为字符串,否则在不增加其他配置的情况下会导致图标最后一项不显示(g2plot官网已说明) const xAxis = config.setting.find(item => item.field === 'xField')?.value + const yAxis = config.setting.find(item => item.field === 'yField')?.value config.option.data = data?.map(item => { - if (xAxis && typeof item[xAxis] === 'number') { + // 此处函数处理data + if (config.dataHandler) { + try { + // 此处函数处理data + eval(config.dataHandler) + } catch (e) { + console.error(e) + } + } + if (config.chartType !== 'Bar' && xAxis && typeof item[xAxis] === 'number') { item[xAxis] = (item[xAxis]).toString() + } else if (config.chartType === 'Bar' && yAxis && typeof item[yAxis] === 'number') { + item[yAxis] = (item[yAxis]).toString() } return item }) From 6cff0a7518e90ab63ff1b73e78a74170343a5b94 Mon Sep 17 00:00:00 2001 From: "liu.shiyi" Date: Mon, 6 Nov 2023 16:21:02 +0800 Subject: [PATCH 16/18] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BB=84=E4=BB=B6=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=B8=B2=E6=9F=93=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-room-ui/packages/Render/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-room-ui/packages/Render/index.vue b/data-room-ui/packages/Render/index.vue index 00a78250..9eced1aa 100644 --- a/data-room-ui/packages/Render/index.vue +++ b/data-room-ui/packages/Render/index.vue @@ -372,7 +372,7 @@ export default { code: !chart.code ? randomString(8) : chart.code, option } - config.key = config.code + config.key = isComponent ? randomString(8) : config.code // isComponent = false 从左侧新增时需要初始化theme的内容 // isComponent = true从组件库添加自定义组件时不用初始化 if (!isComponent) { From 21258fc1d47772cab2c3e1830ea6e01f3e8bd10d Mon Sep 17 00:00:00 2001 From: "hong.yang" Date: Mon, 6 Nov 2023 17:59:59 +0800 Subject: [PATCH 17/18] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E9=A5=BC?= =?UTF-8?q?=E5=9B=BE=E5=92=8C=E7=8E=AF=E5=9B=BE=E7=9A=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=99=BE=E5=88=86=E6=AF=94=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/G2Plots/饼图/基础环图.js | 43 ++++++++++++++++--- .../packages/G2Plots/饼图/基础饼图.js | 3 +- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/data-room-ui/packages/G2Plots/饼图/基础环图.js b/data-room-ui/packages/G2Plots/饼图/基础环图.js index 6de6ee3e..8a6993e2 100644 --- a/data-room-ui/packages/G2Plots/饼图/基础环图.js +++ b/data-room-ui/packages/G2Plots/饼图/基础环图.js @@ -46,19 +46,32 @@ const setting = [ // 设置组件类型 type: 'select', // 字段 - field: 'label_content', + field: 'label_contentList', // 对应options中的字段 - optionField: 'label.content', - value: '{value}', + optionField: 'label.contentList', + value: ['{value}'], tabName: 'custom', + multiple: true, options: [ { label: '维度', value: '{name}' }, - { label: '指标', value: '{value}' } + { label: '指标', value: '{value}' }, + { label: '百分比', value: '{percentage}' }, ], step: 0.1, max: 1, groupName: 'graph' }, + { + label: '旋转内部标签', + type: 'switch', // 设置组件类型 + field: 'labelAutoRotate', // 字段 + optionField: 'label.autoRotate', // 对应options中的字段 + value: false, + active: true, + inactive: false, + tabName: 'custom', + groupName: 'graph' + }, { label: '标签位置', // 设置组件类型 @@ -365,7 +378,25 @@ const data = [ const optionHandler = 'option.legend = option.legendEnable ? {position: setting.find(settingItem=>settingItem.field === \'legendPosition\').value} : false;' + '\n if (option.legendEnable) {\n' + ' option.legend.itemName = option.legendItemName\n' + - ' }' + ' }' + + `if (option.label.contentList && option.label.contentList.length > 0) { + let content = '' + if (option.label.contentList.length === 1) { + content = option.label.contentList[0] + } else { + // 多行文本,加换行符,但是最后一行不加 + option.label.contentList.forEach((item, index) => { + if (index === option.label.contentList.length - 1) { + content += item + } else { + content += item + '\\n' + } + }) + } + option.label.content = content +}` + + // 数据处理脚本 const dataHandler = '' @@ -394,6 +425,7 @@ const option = { color: ['#6b74e4', '#4391f4', '#38bbe5', '#69d6fd', '#36c6a0'], label: { type: 'inner', + autoRotate: false, labelLine: { style: { stroke: '#5B8FF9', @@ -401,6 +433,7 @@ const option = { lineWidth: 1 } }, + contentList: [], content: '{value}', style: { fill: '#ffffff', diff --git a/data-room-ui/packages/G2Plots/饼图/基础饼图.js b/data-room-ui/packages/G2Plots/饼图/基础饼图.js index 7acf3189..6c995819 100644 --- a/data-room-ui/packages/G2Plots/饼图/基础饼图.js +++ b/data-room-ui/packages/G2Plots/饼图/基础饼图.js @@ -53,7 +53,8 @@ const setting = [ tabName: 'custom', options: [ { label: '维度', value: '{name}' }, - { label: '指标', value: '{value}' } + { label: '指标', value: '{value}' }, + { label: '百分比', value: '{percentage}' } ], step: 0.1, max: 1, From 7038513e495b01204ca8fff6181ff6e11f7d5c85 Mon Sep 17 00:00:00 2001 From: "liu.shiyi" Date: Tue, 7 Nov 2023 09:58:08 +0800 Subject: [PATCH 18/18] =?UTF-8?q?fix:=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-room-ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-room-ui/package.json b/data-room-ui/package.json index 15c4a87f..dd708752 100644 --- a/data-room-ui/package.json +++ b/data-room-ui/package.json @@ -1,6 +1,6 @@ { "name": "@gcpaas/data-room-ui", - "version": "2.0.1-2023102702-Alpha", + "version": "2.0.1-2023110701-Alpha", "description": "自定义大屏", "author": "gcpaas", "license": "MIT",