Răsfoiți Sursa

[Feat 0000]皮带巷首页表格组件优化

bobo04052021@163.com 20 ore în urmă
părinte
comite
3aacd397d5

+ 2 - 9
src/views/vent/home/configurable/components/belt/CustomTableBelt.vue

@@ -5,11 +5,11 @@
     </div>
     <div ref="scrollRef" class="table__content_list" :class="`table__content_list_${type}`">
       <!-- 🔥 修复:空数据时依然渲染一行 -->
-      <div class="table__content_list_row" v-if="tableList.length === 0">
+      <div class="table__content_list_row" v-if="data.length === 0">
         <div class="empty-text" :style="{ flexBasis: '100%' }"> 暂无数据 </div>
       </div>
 
-      <div class="table__content_list_row" v-else v-for="(item, index) in tableList" :key="`svvhbct-${index}`">
+      <div class="table__content_list_row" v-else v-for="(item, index) in data" :key="`svvhbct-${index}`">
         <div v-for="(t, i) in columns" :key="`svvhbctr-${i}`" :style="{ flexBasis }" :class="`table__content__list_item_${type}`">
           <slot :name="t.prop" :scope="item">
             <span>
@@ -53,13 +53,6 @@ if (props.autoScroll) {
   useAutoScroll(scrollRef);
 }
 
-// 🔥 核心修复:安全获取 gateArray,永远不会报错/空白
-const tableList = computed(() => {
-  const gateControl = _.get(props, 'data.data.gate_control', []);
-  const firstItem = gateControl[0] || {};
-  return firstItem.gateArray || []; // 不存在就返回空数组
-});
-
 const getStatusClass = (status) => {
   switch (status) {
     case 1:

+ 1 - 1
src/views/vent/home/configurable/components/content.vue

@@ -126,7 +126,7 @@
               :type="config.type"
               :columns="config.columns"
               :auto-scroll="config.autoScroll"
-              :data="config"
+              :data="config.data"
             />
           </template>
           <template v-else>