Преглед изворни кода

fix: 修复表格组件在绑定数据集后,后端返回的数据columnData中remark字段无数据,表格列展示使用originalColumn替代

wu.jian2 пре 1 година
родитељ
комит
2c791d3f70

+ 17 - 15
data-room-ui/packages/BasicComponents/Tables/index.vue

@@ -3,9 +3,9 @@
     style="width: 100%;height: 100%"
     class="bs-design-wrap "
   >
-    <!-- <span style="color: aliceblue;font-size: 40px;">
-      {{ Object.keys(columnData) }}
-    </span> -->
+    <span style="color: aliceblue;font-size: 40px;">
+      {{ columnData }}
+    </span>
     <!-- :border="this.config.customize.border" -->
     <el-table
       :id="config.code"
@@ -25,7 +25,7 @@
         :key="index"
         show-overflow-tooltip
         :prop="col.alias"
-        :label="col.remark"
+        :label="getLabel(col)"
         align="center"
       />
     </el-table>
@@ -106,13 +106,15 @@ export default {
     this.chartInit()
     // this.config.option?.columnData 对象的key 根据 list 对应的key 来排序
     EventBus.$on('dragSelectChange', (val) => {
-      const sortedColumnData = {}
-      const columnData = cloneDeep(this.config.option?.columnData)
-      val.forEach((item, index) => {
-        sortedColumnData[item] = columnData[item]
-      })
-      this.columnData = sortedColumnData
-      this.updateKey = new Date().getTime()
+      if (val.length > 0) {
+        const sortedColumnData = {}
+        const columnData = cloneDeep(this.config.option?.columnData)
+        val.forEach((item, index) => {
+          sortedColumnData[item] = columnData[item]
+        })
+        this.columnData = sortedColumnData
+        this.updateKey = new Date().getTime()
+      }
     })
   },
   beforeDestroy () {
@@ -240,10 +242,7 @@ export default {
       } else {
         config.option.columnData = columnData
       }
-      if (this.isInit) {
-        this.columnData = cloneDeep(config.option.columnData)
-        this.isInit = false
-      }
+      this.columnData = cloneDeep(config.option.columnData)
       this.updateKey = new Date().getTime()
       return config
     },
@@ -290,6 +289,9 @@ export default {
       } else {
         this.cellStyleObj = {}
       }
+    },
+    getLabel (data) {
+      return data.remark || data.originalColumn
     }
   }
 }

+ 0 - 2
data-room-ui/packages/Render/index.vue

@@ -36,8 +36,6 @@
       :snap-tolerance="2"
       :style="{
         zIndex: chart.z || 0,
-        // 样式过度
-        transition: 'all 0.3s',
       }"
       :grid="[1,1]"
       @activated="activated(...arguments, chart)"