Explorar o código

Merge branch 'master' of github.com:gcpaas/DataRoom

zhu.yawen hai 1 ano
pai
achega
0ac94c72fb

+ 24 - 1
data-room-ui/packages/BigScreenDesign/OverallSetting/index.vue

@@ -59,6 +59,16 @@
               />
             </el-select>
           </el-form-item>
+          <el-form-item label="开启磁吸">
+            <el-switch
+              v-model="currentSnap"
+              class="bs-el-switch"
+              active-color="#007aff"
+              :active-value="30"
+              :inactive-value="3"
+              @change="snapHandler"
+            />
+          </el-form-item>
           <el-form-item label="主题">
             <el-select
               v-model="form.customTheme"
@@ -304,6 +314,14 @@ export default {
       pageInfo: state => 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)
     }
   }
 }

+ 18 - 0
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: '标签位置',
     // 设置组件类型

+ 18 - 0
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: '标签位置',
     // 设置组件类型

+ 3 - 2
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: {

+ 4 - 0
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) {

+ 3 - 1
data-room-ui/packages/js/store/state.js

@@ -68,7 +68,9 @@ export const defaultData = {
   // 页面上所有组件的数据集的数据信息
   dataset: {},
   // 页面上所有组件的数据集的数据信息
-  computedDatas: {}
+  computedDatas: {},
+  // 是否开启磁吸
+  snapTolerance: 3
 }
 
 export default () => ({