浏览代码

bug7682-移动端的冻结没有保留时间日期单位

chenlei 1 月之前
父节点
当前提交
b192146e19

+ 4 - 0
src/views/sheetList/balanceDetail.vue

@@ -421,6 +421,10 @@ function goChart () {
         color: rgba(102, 102, 102, 1);
         .top-item {
             line-height: 60px;
+            width: 50%;
+            white-space: nowrap; /* 文字不换行 */
+            overflow: hidden; /* 隐藏超出容器的内容 */
+            text-overflow: ellipsis; /* 显示省略号 */
         }
     }
     .sheet-box{

+ 72 - 14
src/views/sheetList/components/BalanceSheet.vue

@@ -12,6 +12,7 @@
   const disabled = ref(true)
   const cellRef = ref([])
   const rowTable = ref(null);
+  const cornerRef = ref(null);
   const tableData = reactive(props.TableInfo.TableData.Data);
   const freezeData = reactive(props.TableInfo.ExtraConfig.TableFreeze);
 
@@ -26,32 +27,48 @@
   });
   // 提取公共路径到局部变量
   const tableFreeze = computed(() => props.TableInfo.ExtraConfig.TableFreeze);
-
   // 使用对象解构获取所需属性
   const minRow = computed(() => {
     const { FreezeStartRow, FreezeEndRow } = tableFreeze.value;
     return Math.min(FreezeStartRow, FreezeEndRow) === 0 ? 1 : Math.min(FreezeStartRow, FreezeEndRow)
   });
-
   const maxRow = computed(() => {
     const { FreezeStartRow, FreezeEndRow } = tableFreeze.value;
     return Math.max(FreezeStartRow, FreezeEndRow);
   });
-
   const minCol = computed(() => {
     const { FreezeStartCol, FreezeEndCol } = tableFreeze.value;
     return Math.min(FreezeStartCol, FreezeEndCol) === 0 ? 1 : Math.min(FreezeStartCol, FreezeEndCol);
   });
-
   const maxCol = computed(() => {
     const { FreezeStartCol, FreezeEndCol } = tableFreeze.value;
     return Math.max(FreezeStartCol, FreezeEndCol);
   });
+  const isFreezeColumns = computed(() => {
+    return tableFreeze.value && maxCol.value > 0;
+  });
+  const isFreezeRows = computed(() => {
+    return tableFreeze.value && maxRow.value > 0;
+  });
+  const isFreezeAll = computed(() => {
+    return tableFreeze.value && isFreezeColumns.value && isFreezeRows.value;
+  });
+  const isFreezeRowsOrColumns = computed(() => {
 
+    return tableFreeze.value && isFreezeColumns.value || isFreezeRows.value;
+  });
+  const cornerWidth = computed(() => {
+    return cornerRef.value ? cornerRef.value.offsetWidth : 23;
+  });
+  const cornerHeight = computed(() => {
+    return cornerRef.value ? cornerRef.value.offsetHeight : 24;
+  });
   //手机端pc端不同样式
   const dynamicSty = computed(()=>{
     return isMobile() ? 'mobile-sty' : 'pc-sty';
   })
+
+
   //判断是否是手机设备
  function isMobile() {
 		// 判断是否是移动设备的正则表达式
@@ -101,7 +118,7 @@
   }
 
   onMounted(() => {
-    tableHeight.value = rowTable.value ? rowTable.value[0].offsetHeight : 35;
+    tableHeight.value = rowTable.value ? rowTable.value[0].offsetHeight : cornerHeight.value;
   })
 
   // 设置背景色及字体颜色
@@ -249,9 +266,27 @@ function isNumberVal(value) {
   function isWithinColRange (index) {
     return rowHeader.value[index] >= minCol.value &&  rowHeader.value[index] <= maxCol.value
   }
-   // 获取某一列的宽度
+  // 是否固定行
+  function isBetweenTargetRows (index) {
+    return rowHeader.value[index] >= minRow.value &&  rowHeader.value[index] <= maxRow.value
+  }
+  // 获取某一列的宽度
   function getColumnHeaderWidth (index) {
-    return cellRef.value && cellRef.value[index] ? cellRef.value[index].offsetWidth : 104
+    if (!cellRef.value || cellRef.value.length === 0 || index <= 0) return cornerWidth.value;
+    let ColumnHeaderWidth = cornerWidth.value;
+    let minWidth = 0
+
+    // 计算冻结列的宽度总和
+    for (let i = 0; i < index; i++) {
+      ColumnHeaderWidth += cellRef.value[i] ? cellRef.value[i].offsetWidth : 104
+    }
+
+    // 计算冻结最小列之外的宽度总和
+    for (let i = 0; i < this.minCol - 1; i++) {
+      minWidth += cellRef.value[i] ? cellRef.value[i].offsetWidth : 104;
+    }
+    
+    return ColumnHeaderWidth - minWidth;
   }
 </script>
 
@@ -269,12 +304,18 @@ function isNumberVal(value) {
         <thead>
           <tr ref="rowTable">
              <!-- 行头 -->
-             <th class="th-tg sm"  style="width:36px"></th>
+             <th class="th-tg sm index-overlap"
+              style="width:36px"
+              ref="cornerRef"
+              :class="[isFreezeRowsOrColumns ? 'fix-col ' : '']"
+              :style="isFreezeAll ? {left: '0', top: '0'} : (isFreezeColumns ? {left: '0'} : (isFreezeRows ? {top: '0'} : ''))"
+             ></th>
 
             <!-- 列头 -->
             <th 
               ref="cellRef"
-              :style="TableInfo.TableData.Data[0][index].ShowStyle?getShowCss(TableInfo.TableData.Data[0][index].ShowStyle,'header'):{}"
+              :style="[TableInfo.TableData.Data[0][index].ShowStyle?getShowCss(TableInfo.TableData.Data[0][index].ShowStyle,'header'):{}, isFreezeRows ? {top: 0} : {}, isFreezeColumns && isWithinColRange(index) ? {left: getColumnHeaderWidth(index) + 'px'} : {},]"
+              :class="[isFreezeRows || isFreezeColumns ? 'fix-col' : {}, isFreezeColumns && maxCol <= index ? 'index' : {}, freezeData && isWithinColRange(index) ? 'index-overlap' : {}]"
               v-for="(item, index) in columnHeader"
               :key="index"
               class="th-tg th-col"
@@ -287,13 +328,15 @@ function isNumberVal(value) {
         </thead>
 
         <tbody>
-          <tr ref="rowTable" v-for="(row, index) in TableInfo.TableData.Data" :key="index" :style="freezeData ? `top: ${(index- minRow+1)*tableHeight}px;` : ''" :class="freezeData && rowHeader[index] >= minRow &&  rowHeader[index] <= maxRow ? 'fix' : ''">
+          <tr ref="rowTable" v-for="(row, index) in TableInfo.TableData.Data" :key="index" :style="isFreezeRows && maxRow > index ? `top: ${(index- minRow+1)*tableHeight + cornerHeight}px;` : ''" :class="freezeData && isBetweenTargetRows(index) ? 'fix' : ''">
              <!-- 行头 -->
              <th
                 class="th-tg th-row sm"
                 @contextmenu.prevent="rightClickHandle"
                 :data-rindex="rowHeader[index]"
                 :data-cindex="-1"
+                :style="[isFreezeColumns ? {left: 0} : {}, isFreezeRows && isBetweenTargetRows(index) ? {top:(index- minRow+1)*tableHeight + cornerHeight + 'px'} : {} ]"
+                :class="[isFreezeRowsOrColumns  ? 'fix-col' : {}, !isBetweenTargetRows(index) ? 'index' : 'index-overlap']"
               >
                 {{ rowHeader[index] }}
               </th>
@@ -305,8 +348,12 @@ function isNumberVal(value) {
               :data-cindex="columnHeader[cell_index]"
               :data-datarindex="index"
               :data-datacindex="cell_index"
-              :style="[cell.ShowStyle?getShowCss(cell.ShowStyle):{}, freezeData && isWithinColRange(cell_index) ? {left: (cell_index- minCol+1)*getColumnHeaderWidth(cell_index) + 'px'} : '']"
-              :class="[freezeData && isWithinColRange(cell_index) ? 'fix-col' : '']"
+              :style="[cell.ShowStyle?getShowCss(cell.ShowStyle):{}, freezeData && isWithinColRange(cell_index) ? {left: getColumnHeaderWidth(cell_index) + 'px'} : {},  isFreezeRows && isBetweenTargetRows(index) ? {top: (index- minRow+1)*tableHeight + cornerHeight + 'px'} : {}]"
+              :class="[
+                freezeData ? 'fix-col' : '',
+                (index >= maxRow || index < minRow - 1) && (cell_index >= maxCol || cell_index < minCol - 1) ? 'index-outside' : '',
+                isBetweenTargetRows(index) && isWithinColRange(cell_index) ? 'index-overlap' : ''
+              ]"
               :initIndex="initIndex(index,cell_index,rowHeader[index],columnHeader[cell_index])"
               :data-key="cell.Uid"
               v-show="!cell.merData || cell.merData.type!=='merged'"
@@ -428,8 +475,19 @@ function isNumberVal(value) {
 
     &.fix-col {
       position: sticky;
-      left: 0;
-      z-index: 98; // 表格右键操作弹窗为99
+      z-index: 97; // 表格右键操作弹窗为99
+    }
+    &.index {
+      z-index: 96; // 冻结的行列z-index为97,此处为96确保表格行不遮挡表格行内容
+    }
+    &.index-outside {
+      z-index: 95; // 同上
+    }
+    &.index-overlap {
+      z-index: 98; // 冻结的行列z-index为97,此处为行列交叉的地方层级要比冻结的行列高一层
+    }
+    &.index-highest {
+      z-index: 99;
     }
   }
 

+ 70 - 18
src/views/sheetList/components/MixedSheet.vue

@@ -11,6 +11,7 @@
   const tableHeight = ref(0)
   const disabled = ref(true)
   const cellRef = ref(null)
+  const cornerRef = ref(null);
   const rowTable = ref(null);
   const tableData = reactive(props.TableInfo.TableData.Data);
   const freezeData = reactive(props.TableInfo.ExtraConfig.TableFreeze);
@@ -26,32 +27,47 @@
   });
   // 提取公共路径到局部变量
   const tableFreeze = computed(() => props.TableInfo.ExtraConfig.TableFreeze);
-
   // 使用对象解构获取所需属性
   const minRow = computed(() => {
     const { FreezeStartRow, FreezeEndRow } = tableFreeze.value;
     return Math.min(FreezeStartRow, FreezeEndRow) === 0 ? 1 : Math.min(FreezeStartRow, FreezeEndRow)
   });
-
   const maxRow = computed(() => {
     const { FreezeStartRow, FreezeEndRow } = tableFreeze.value;
     return Math.max(FreezeStartRow, FreezeEndRow);
   });
-
   const minCol = computed(() => {
     const { FreezeStartCol, FreezeEndCol } = tableFreeze.value;
     return Math.min(FreezeStartCol, FreezeEndCol) === 0 ? 1 : Math.min(FreezeStartCol, FreezeEndCol);
   });
-
   const maxCol = computed(() => {
     const { FreezeStartCol, FreezeEndCol } = tableFreeze.value;
     return Math.max(FreezeStartCol, FreezeEndCol);
   });
-
+  const isFreezeColumns = computed(() => {
+    return tableFreeze.value && maxCol.value > 0;
+  });
+  const isFreezeRows = computed(() => {
+    return tableFreeze.value && maxRow.value > 0;
+  });
+  const isFreezeAll = computed(() => {
+    return tableFreeze.value && isFreezeColumns.value && isFreezeRows.value;
+  });
+  const isFreezeRowsOrColumns = computed(() => {
+    return tableFreeze.value && isFreezeColumns.value || isFreezeRows.value;
+  });
+  const cornerWidth = computed(() => {
+    return cornerRef.value ? cornerRef.value.offsetWidth : 23;
+  });
+  const cornerHeight = computed(() => {
+    return cornerRef.value ? cornerRef.value.offsetHeight : 24;
+  });
   //手机端pc端不同样式
   const dynamicSty = computed(()=>{
     return isMobile() ? 'mobile-sty' : 'pc-sty';
   })
+
+
   //判断是否是手机设备
  function isMobile() {
 		// 判断是否是移动设备的正则表达式
@@ -101,7 +117,7 @@
   }
 
   onMounted(() => {
-    tableHeight.value = rowTable.value ? rowTable.value[0].offsetHeight : 35;
+    tableHeight.value = rowTable.value ? rowTable.value[0].offsetHeight : cornerHeight.value;
   })
 
   // 设置背景色及字体颜色
@@ -248,15 +264,28 @@ function isNumberVal(value) {
   // 是否固定列
   function isWithinColRange (index) {
     return rowHeader.value[index] >= minCol.value &&  rowHeader.value[index] <= maxCol.value
+  }
+  // 是否固定行
+  function isBetweenTargetRows (index) {
+    return rowHeader.value[index] >= minRow.value &&  rowHeader.value[index] <= maxRow.value
   }
    // 获取某一列的宽度
   function getColumnHeaderWidth (index) {
-    if (!cellRef.value) return
-    // console.log(index);
-    // console.log(cellRef.value);
-    // console.log(cellRef.value[index].offsetWidth);
+    if (!cellRef.value || cellRef.value.length === 0 || index <= 0) return cornerWidth.value;
+    let ColumnHeaderWidth = cornerWidth.value;
+    let minWidth = 0
+
+    // 计算冻结列的宽度总和
+    for (let i = 0; i < index; i++) {
+      ColumnHeaderWidth += cellRef.value[i] ? cellRef.value[i].offsetWidth : 104
+    }
+
+    // 计算冻结最小列之外的宽度总和
+    for (let i = 0; i < this.minCol - 1; i++) {
+      minWidth += cellRef.value[i] ? cellRef.value[i].offsetWidth : 104;
+    }
     
-    return cellRef.value && cellRef.value[index] ? cellRef.value[index].offsetWidth : 104
+    return ColumnHeaderWidth - minWidth;
   }
 </script>
 
@@ -274,12 +303,18 @@ function isNumberVal(value) {
         <thead>
           <tr ref="rowTable">
             <!-- 行头 -->
-            <th class="th-tg sm"  style="width:36px"></th>
+            <th class="th-tg sm index-overlap"
+              style="width:36px"
+              ref="cornerRef"
+              :class="[isFreezeRowsOrColumns ? 'fix-col ' : '']"
+              :style="isFreezeAll ? {left: '0', top: '0'} : (isFreezeColumns ? {left: '0'} : (isFreezeRows ? {top: '0'} : ''))"
+            ></th>
 
             <!-- 列头 -->
             <th 
               ref="cellRef"
-              :style="TableInfo.TableData.Data[0][index].ShowStyle?getShowCss(TableInfo.TableData.Data[0][index].ShowStyle,'header'):{}"
+              :style="[TableInfo.TableData.Data[0][index].ShowStyle?getShowCss(TableInfo.TableData.Data[0][index].ShowStyle,'header'):{}, isFreezeRows ? {top: 0} : {}, isFreezeColumns && isWithinColRange(index) ? {left: getColumnHeaderWidth(index) + 'px'} : {},]"
+              :class="[isFreezeRows || isFreezeColumns ? 'fix-col' : {}, isFreezeColumns && maxCol <= index ? 'index' : {}, freezeData && isWithinColRange(index) ? 'index-overlap' : {}]"
               v-for="(item, index) in columnHeader"
               :key="index"
               class="th-tg th-col"
@@ -292,13 +327,15 @@ function isNumberVal(value) {
         </thead>
 
         <tbody>
-          <tr ref="rowTable" v-for="(row, index) in TableInfo.TableData.Data" :key="index" :style="freezeData ? `top: ${(index- minRow+1)*tableHeight}px;` : ''" :class="freezeData && rowHeader[index] >= minRow &&  rowHeader[index] <= maxRow ? 'fix' : ''">
+          <tr ref="rowTable" v-for="(row, index) in TableInfo.TableData.Data" :key="index" :style="isFreezeRows && maxRow > index ? `top: ${(index- minRow+1)*tableHeight + cornerHeight}px;` : ''" :class="freezeData && isBetweenTargetRows(index) ? 'fix' : ''">
               <!-- 行头 -->
               <th
                 class="th-tg th-row sm"
                 @contextmenu.prevent="rightClickHandle"
                 :data-rindex="rowHeader[index]"
                 :data-cindex="-1"
+                :style="[isFreezeColumns ? {left: 0} : {}, isFreezeRows && isBetweenTargetRows(index) ? {top:(index- minRow+1)*tableHeight + cornerHeight + 'px'} : {} ]"
+                :class="[isFreezeRowsOrColumns  ? 'fix-col' : {}, !isBetweenTargetRows(index) ? 'index' : 'index-overlap']"
               >
                 {{ rowHeader[index] }}
               </th>
@@ -310,8 +347,12 @@ function isNumberVal(value) {
               :data-cindex="columnHeader[cell_index]"
               :data-datarindex="index"
               :data-datacindex="cell_index"
-              :style="[cell.ShowStyle?getShowCss(cell.ShowStyle):{}, freezeData && isWithinColRange(cell_index) ? {left: (cell_index- minCol+1)*getColumnHeaderWidth(cell_index) + 'px'} : '']"
-              :class="[freezeData && isWithinColRange(cell_index) ? 'fix-col' : '']"
+              :style="[cell.ShowStyle?getShowCss(cell.ShowStyle):{}, freezeData && isWithinColRange(cell_index) ? {left: getColumnHeaderWidth(cell_index) + 'px'} : {},  isFreezeRows && isBetweenTargetRows(index) ? {top: (index- minRow+1)*tableHeight + cornerHeight + 'px'} : {}]"
+              :class="[
+                freezeData ? 'fix-col' : '',
+                (index >= maxRow || index < minRow - 1) && (cell_index >= maxCol || cell_index < minCol - 1) ? 'index-outside' : '',
+                isBetweenTargetRows(index) && isWithinColRange(cell_index) ? 'index-overlap' : ''
+              ]"
               :initIndex="initIndex(index,cell_index,rowHeader[index],columnHeader[cell_index])"
               :data-key="cell.Uid"
               v-show="!cell.merData || cell.merData.type!=='merged'"
@@ -439,8 +480,19 @@ function isNumberVal(value) {
 
     &.fix-col {
       position: sticky;
-      left: 0;
-      z-index: 98; // 表格右键操作弹窗为99
+      z-index: 97; // 表格右键操作弹窗为99
+    }
+    &.index {
+      z-index: 96; // 冻结的行列z-index为97,此处为96确保表格行不遮挡表格行内容
+    }
+    &.index-outside {
+      z-index: 95; // 同上
+    }
+    &.index-overlap {
+      z-index: 98; // 冻结的行列z-index为97,此处为行列交叉的地方层级要比冻结的行列高一层
+    }
+    &.index-highest {
+      z-index: 99;
     }
   }
 

+ 210 - 40
src/views/sheetList/components/TimelineSheet.vue

@@ -13,6 +13,11 @@
   const disabled = ref(true)
   const EdbKeys = ref(["EdbName", "Unit"])
   const cellRef = ref(null)
+  const indexCellRef = ref(null);
+  const dateCellRef = ref(null);
+  const nameTh = ref(null)
+  const unitTh = ref(null)
+
 
   const dateArr = computed (() => {
     return props.TableInfo.TableData.Data.length ? props.TableInfo.TableData.Data[0].Data.map(_ => _.DataTime) : []
@@ -28,31 +33,55 @@
   });
   // 提取公共路径到局部变量
   const tableFreeze = computed(() => props.TableInfo.ExtraConfig.TableFreeze);
-
   const minRow = computed(() => {
     const { FreezeStartRow, FreezeEndRow } = tableFreeze.value;
     return Math.min(FreezeStartRow, FreezeEndRow) === 0 ? 1 : Math.min(FreezeStartRow, FreezeEndRow)
   });
-
   const maxRow = computed(() => {
     const { FreezeStartRow, FreezeEndRow } = tableFreeze.value;
     return Math.max(FreezeStartRow, FreezeEndRow);
   });
-
   const minCol = computed(() => {
     const { FreezeStartCol, FreezeEndCol } = tableFreeze.value;
     return Math.min(FreezeStartCol, FreezeEndCol) === 0 ? 1 : Math.min(FreezeStartCol, FreezeEndCol);
   });
-
   const maxCol = computed(() => {
     const { FreezeStartCol, FreezeEndCol } = tableFreeze.value;
     return Math.max(FreezeStartCol, FreezeEndCol);
   });
-
+  const isFreezeColumns = computed(() => {
+    return tableFreeze.value && maxCol.value > 0;
+  });
+  const isFreezeRows = computed(() => {
+    return tableFreeze.value && maxRow.value > 0;
+  });
+  const isFreezeAll = computed(() => {
+    return tableFreeze.value && isFreezeColumns.value && isFreezeRows.value;
+  });
+  const isFreezeRowsOrColumns = computed(() => {
+    return tableFreeze.value && isFreezeColumns.value || isFreezeRows.value;
+  });
+  const cornerWidth = computed(() => {
+    return indexCellRef.value ? indexCellRef.value.offsetWidth : 23;
+  });
+  const cornerHeight = computed(() => {
+    return indexCellRef.value ? indexCellRef.value.offsetHeight : 24;
+  });
+  const dateCellRefHeight = computed(() => {
+    return dateCellRef.value ? dateCellRef.value.offsetWidth : 68;
+  });
+  const nameThWidth = computed(() => {
+    return nameTh.value ? nameTh.value.offsetWidth : 191;
+  });
+  const unitThWidth = computed(() => {
+    return unitTh.value ? unitTh.value.offsetWidth : 62;
+  });
   //手机端pc端不同样式
   const dynamicSty = computed(()=>{
     return isMobile() ? 'mobile-sty' : 'pc-sty';
   })
+
+
   //判断是否是手机设备
  function isMobile() {
 		// 判断是否是移动设备的正则表达式
@@ -94,18 +123,53 @@
   }
 
   onMounted(() => {
-    console.log('rowTable', rowTable.value.offsetHeight);
-    
-    tableHeight.value = rowTable.value ? rowTable.value.offsetHeight : 35;
+    tableHeight.value = rowTable.value ? rowTable.value.offsetHeight : cornerHeight.value;
   })
 
   // 是否固定列
   function isWithinColRange (index) {
     return rowHeader.value[index] >= minCol.value &&  rowHeader.value[index] <= maxCol.value
+  }
+  // 是否固定行
+  function isBetweenTargetRows (index) {
+    return rowHeader.value[index] >= minRow.value &&  rowHeader.value[index] <= maxRow.value
   }
    // 获取某一列的宽度
   function getColumnHeaderWidth (index) {
-    return cellRef.value && cellRef.value ? cellRef.value[index].offsetWidth : 104
+    if (!cellRef.value || cellRef.value.length === 0 || index <= 0) return cornerWidth.value;
+    let ColumnHeaderWidth = cornerWidth.value;
+    let minWidth = 0
+
+    // 计算冻结列的宽度总和
+    for (let i = 0; i < index; i++) {
+      ColumnHeaderWidth += cellRef.value[i] ? cellRef.value[i].offsetWidth : 68
+    }
+
+    // 计算冻结最小列之外的宽度总和
+    for (let i = 0; i < minCol.value - 1; i++) {
+      minWidth += cellRef.value[i] ? cellRef.value[i].offsetWidth : 68;
+    }
+    
+    return ColumnHeaderWidth - minWidth;
+  }
+  // 文本行冻结效果动态计算
+  function getInsertClass(cell) {
+    return [2, 3, 5].includes(cell.DataType) && cell.ShowValue ? 'insert' : '';
+  }
+  function getFixColClass(cell_index, index, freezeData, isFreezeColumns, dateArr) {
+    return (freezeData && (isWithinColRange(cell_index - 1) || isBetweenTargetRows(index + dateArr.length))) || (isFreezeColumns && cell_index === 0) ? 'fix-col' : '';
+  }
+  function getIndexOutsideClass(cell_index, index, maxRow, minRow, maxCol, minCol, dateArr) {
+    return (index + dateArr.length >= maxRow || index + dateArr.length < minRow - 1) && (cell_index > maxCol || cell_index < minCol - 1) && cell_index !== 0 ? 'index-outside' : '';
+  }
+  function getIndexOverlapClass(cell_index, index, dateArr) {
+    return isBetweenTargetRows(index + dateArr.length) && isWithinColRange(cell_index - 1) ? 'index-overlap' : '';
+  }
+  function getIndexClass(cell_index, index, dateArr) {
+    return cell_index === 0 && !isBetweenTargetRows(index + dateArr.length) ? 'index' : '';
+  }
+  function getDateOverlapClass(cell_index, index, dateArr) {
+    return cell_index === 0 && isBetweenTargetRows(index + dateArr.length) ? 'index-overlap' : '';
   }
 </script>
 
@@ -116,8 +180,20 @@
         <thead>
           <tr ref="rowTable">
             <!-- 行头 -->
-            <th class="th-tg sm"></th>
-            <th class="th-tg"></th>
+            <th
+              ref="indexCellRef"
+              class="th-tg sm index-overlap"
+              :class="[isFreezeRowsOrColumns ? 'fix-col ' : '']"
+              :style="isFreezeAll ? {left: '0', top: '0'} : (isFreezeColumns ? {left: '0'} : (isFreezeRows ? {top: '0'} : ''))"
+            ></th>
+
+            <th
+              ref="dateCellRef"
+              class="th-tg index-overlap"
+              :class="[isFreezeRowsOrColumns ? 'fix-col' : '']"
+              :style="[isFreezeAll ? {left: getColumnHeaderWidth(-1) + 'px', top: 0} : '', isFreezeColumns ? {left: getColumnHeaderWidth(-1) + 'px'} : '', isFreezeRows ? {top: 0} : '']"
+              >
+            </th>
 
             <!-- 列头 -->
             <th 
@@ -125,6 +201,8 @@
               v-for="(item, index) in columnHeader" 
               :key="index" 
               class="th-tg th-col"
+              :style="[isFreezeRows ? {top: 0} : '', isFreezeColumns && isWithinColRange(index) ? {left: getColumnHeaderWidth(index) + 68 + 'px'} : '',]"
+              :class="[isFreezeRows || isFreezeColumns ? 'fix-col' : '', isFreezeColumns && maxCol <= index ? 'index' : '', tableFreeze && isWithinColRange(index) ? 'index-overlap' : '']"
               :data-cindex="item"
               :data-rindex="-1">
               {{item}}
@@ -133,11 +211,27 @@
         </thead>
 
         <tbody>
-          <tr v-for="(item, index) in EdbKeys" :key="item">
+          <tr
+            v-for="(item, index) in EdbKeys"
+            :key="item"
+            :style="isFreezeRows ? `top: ${(index + 1) * tableHeight}px;` : ''"
+            :class="isFreezeRows && index !== 1 ? 'fix' : ''"
+          >
             <!-- 行头 -->
-            <th class="th-tg sm"></th>
+            <th 
+              class="th-tg sm index-highest"
+              :style="[isFreezeAll ? {left: 0,top: (index)*tableHeight + 24 + 'px'} : '', isFreezeColumns ? {left: 0} : '', isFreezeRows ? {top: (index)*tableHeight + 24 + 'px'} : '']"
+              :class="[isFreezeRowsOrColumns ? 'fix-col' : '']"
+            >
+            </th>
 
-            <td rowspan="2" v-if="index === 0" class="head-column">
+            <td
+              rowspan="2"
+              v-if="index === 0"
+              class="head-column"
+              :class="[isFreezeRowsOrColumns ? 'fix-col index-highest' : 'index-highest']"
+              :style="[isFreezeAll ? {left: 23 + 'px', top: 24 + 'px'} : '', isFreezeColumns ? {left: 23 + 'px'} : '', isFreezeRows ? {top: 24 + 'px'} : '']"
+            >
               日期
             </td>
             <td 
@@ -145,10 +239,13 @@
               :key="sub_index"
               :data-rindex="-1"
               :data-cindex="columnHeader[sub_index]"
+              :style="[tableFreeze && isWithinColRange(sub_index) ? {left: getColumnHeaderWidth(sub_index) + dateCellRefHeight + 'px'} : '', isFreezeRows ? {top: (index)*tableHeight + 24 + 'px'} : '']"
               :class="['data-cell',{
                 'one-bg':(index+1)%2&&index>0,
                 'tow-bg': (index+1)%2!==0&&index>0,
                 'head-column': index === 0,
+                'fix-col':isFreezeRows,
+                'index-overlap': tableFreeze && isWithinColRange(sub_index)
               }]"
             >
               <template v-if="item === 'EdbName'">
@@ -159,27 +256,34 @@
           </tr>
 
           <!-- 数据行  第一列日期-->
-          <tr v-for="(date, dateIndex) in dateArr" :key="date" :style="TableInfo.ExtraConfig.TableFreeze ? `top: ${(dateIndex- minRow+1)*tableHeight}px;` : ''" :class="TableInfo.ExtraConfig.TableFreeze && rowHeader[dateIndex] >= minRow &&  rowHeader[dateIndex] <= maxRow ? 'fix' : ''">
+          <tr
+            v-for="(date, dateIndex) in dateArr"
+            :key="date"
+            :style="isFreezeRows && maxRow > dateIndex ? `top: ${(dateIndex- minRow+1)*tableHeight}px;` : ''"
+            :class="tableFreeze && isBetweenTargetRows(dateIndex) ? 'fix' : ''"
+          >
             <!-- 行头 -->
             <th 
               class="th-tg th-row sm"
               :data-cindex="-1"
               :data-rindex="rowHeader[dateIndex]"
               @contextmenu.prevent="rightClickHandle"
+              :style="[isFreezeColumns ? {left: 0} : '', isFreezeRows && isBetweenTargetRows(dateIndex) ? {top: (dateIndex- minRow+1)*tableHeight + cornerHeight * 3 + 'px'} : '' ]"
+              :class="[isFreezeRowsOrColumns  ? 'fix-col' : '', !isBetweenTargetRows(dateIndex) ? 'index' : 'index-overlap']"
             >{{rowHeader[dateIndex]}}</th>
             <td 
               :data-rindex="rowHeader[dateIndex]"
               :data-cindex="-1"
-              :style="TableInfo.ExtraConfig.TableFreeze && isWithinColRange(dateIndex) ? `left: 0px;` : ''"
-              :class="[TableInfo.ExtraConfig.TableFreeze && isWithinColRange(dateIndex) ? 'fix-col' : '']"
+              :style="[isFreezeColumns ? {left: getColumnHeaderWidth(-1) + 'px'} : '', isFreezeRows && isBetweenTargetRows(dateIndex) ? {top: (dateIndex- minRow+1)*tableHeight + cornerHeight * 3 + 'px'} : '']"
+              :class="[isFreezeRowsOrColumns ? 'fix-col' : '', !isBetweenTargetRows(dateIndex) ? 'index' : 'index-overlap', ]"
             >{{date}}</td>
             <td 
               v-for="(edb, edb_index) in TableInfo.TableData.Data" 
               :key="edb_index"
               :data-rindex="rowHeader[dateIndex]"
               :data-cindex="columnHeader[edb_index]"
-              :style="TableInfo.ExtraConfig.TableFreeze && isWithinColRange(edb_index+dateArr.length) ? `left: ${(edb_index+dateArr.length- minCol+1)*getColumnHeaderWidth(edb_index+dateArr.length)}px;` : ''"
-              :class="[([2,3,5].includes(edb.Data.find(_ =>_.DataTime === date)?.DataType)&&edb.Data.find(_ =>_.DataTime === date)?.ShowValue)?'insert': '', TableInfo.ExtraConfig.TableFreeze && isWithinColRange(edb_index+dateArr.length) ? 'fix-col' : '']"
+              :style="[tableFreeze && isWithinColRange(edb_index) ? {left: getColumnHeaderWidth(edb_index) + dateCellRefHeight + 'px'} : '', isFreezeRows && isBetweenTargetRows(dateIndex) ? {top: (dateIndex- minRow+1)*tableHeight + cornerHeight * 3 + 'px'} : '']"
+              :class="[([2,3,5].includes(edb.Data.find(_ =>_.DataTime === date).DataType)&&edb.Data.find(_ =>_.DataTime === date).ShowValue)?'insert': '', tableFreeze ? 'fix-col' : '' , (dateIndex >= maxRow || dateIndex < minRow - 1) && (edb_index >= maxCol || edb_index < minCol - 1) ?  'index-outside' : '', isBetweenTargetRows(dateIndex) && isWithinColRange(edb_index) ? 'index-overlap' : '']"
             >
               <!-- 实际值/插值 -->
               <span 
@@ -192,21 +296,35 @@
             </td>
           </tr>
           <!-- 文本行 -->
-          <tr v-for="(row,index) in TableInfo.TableData.TextRowData" :key="index" :style="TableInfo.ExtraConfig.TableFreeze ? `top: ${(index+dateArr.length-minRow+1)*tableHeight}px;` : ''" :class="TableInfo.ExtraConfig.TableFreeze && rowHeader[index+dateArr.length] >= minRow &&  rowHeader[index+dateArr.length] <= maxRow ? 'fix' : ''">
+          <tr
+            v-for="(row,index) in TableInfo.TableData.TextRowData"
+            :key="index"
+            :style="isFreezeRows && maxRow > index+dateArr.length ? `top: ${(index+dateArr.length-minRow+1)*tableHeight + cornerHeight * 3}px;` : ''"
+            :class="tableFreeze && isBetweenTargetRows(index+dateArr.length) ? 'fix' : ''"
+          >
             <!-- 行头 -->
             <th 
               class="th-tg th-row sm" 
               @contextmenu.prevent="rightClickHandle"
               :data-rindex="rowHeader[index+dateArr.length]"
               :data-cindex="-1"
+              :style="[isFreezeColumns ? {left: 0} : '', isFreezeRows && isBetweenTargetRows(index+dateArr.length) ? {top: (index+dateArr.length- minRow+1)*tableHeight + cornerHeight * 3 + 'px'} : '']"
+              :class="[isFreezeRowsOrColumns  ? 'fix-col' : '', !isBetweenTargetRows(index+dateArr.length) ? 'index' : 'index-overlap']"
             >{{rowHeader[index+dateArr.length]}}</th>
             <td 
               v-for="(cell, cell_index) in row" 
               :key="`${index}_${cell_index}`"
               :data-rindex="rowHeader[index+dateArr.length]"
               :data-cindex="cell_index===0?-1:columnHeader[cell_index-1]"
-              :style="TableInfo.ExtraConfig.TableFreeze && isWithinColRange(cell_index+dateArr.length) ? `left: ${(cell_index+dateArr.length- minCol+1)*getColumnHeaderWidth(cell_index+dateArr.length)}px;` : ''"
-              :class="[([2,3,5].includes(cell.DataType)&&cell.ShowValue)?'insert': '',  TableInfo.ExtraConfig.TableFreeze && isWithinColRange(cell_index+dateArr.length) ? 'fix-col' : '']"
+              :style="[tableFreeze && isWithinColRange(cell_index-1) ? {left: getColumnHeaderWidth(cell_index-1) + (cell_index !== 0 ?  dateCellRefHeight : 0) + 'px'} : '', isFreezeRows && isBetweenTargetRows(index+dateArr.length) ? {top: (index+dateArr.length- minRow+1)*tableHeight + cornerHeight * 3 + 'px'} : '', isFreezeColumns && cell_index == 0 ? {left: getColumnHeaderWidth(-1) + 'px'} : '']"
+              :class="[
+                getInsertClass(cell),
+                getFixColClass(cell_index, index, tableFreeze, isFreezeColumns, dateArr),
+                getIndexOutsideClass(cell_index, index, maxRow, minRow, maxCol, minCol, dateArr),
+                getIndexOverlapClass(cell_index, index, dateArr),
+                getIndexClass(cell_index, index, dateArr),
+                getDateOverlapClass(cell_index, index, dateArr)
+              ]"
             >
               <span 
                 :data-rindex="rowHeader[index+dateArr.length]"
@@ -224,10 +342,27 @@
         <thead>
           <tr ref="rowTable">
             <!-- 行头 -->
-            <th class="th-tg sm"></th>
+            <th
+              class="th-tg sm index-overlap"
+              :style="isFreezeAll ? {left: '0', top: '0'} : (isFreezeColumns ? {left: '0'} : (isFreezeRows ? {top: '0'} : ''))"
+              :class="[isFreezeRowsOrColumns ? 'fix-col' : '']"
+            >
+            </th>
 
-            <th class="th-tg"></th>
-            <th class="th-tg"></th>
+            <th
+              class="th-tg index-overlap"
+              ref="nameTh"
+              :style="[isFreezeAll ? {left: 21 + 'px',top: 0} : '', isFreezeColumns ? {left: 21 + 'px'} : '', isFreezeRows ? {top: 0} : '']"
+              :class="[isFreezeRowsOrColumns ? 'fix-col' : '']"
+            >
+            </th>
+            <th
+              class="th-tg index-overlap"
+              ref="unitTh"
+              :style="[isFreezeAll ? {left: nameThWidth + 21 + 'px', top: 0} : '', isFreezeColumns ? {left:nameThWidth + 21 + 'px'} : '', isFreezeRows ? {top: 0} : '']"
+              :class="[isFreezeRowsOrColumns ? 'fix-col' : '']"
+            >
+            </th>
 
             <!-- 列头 -->
             <th 
@@ -235,6 +370,8 @@
               :key="index" 
               ref="cellRef"
               class="th-tg th-col"
+              :style="[isFreezeRows ? {top: 0} : '', isFreezeColumns && (maxCol > index &&  index >= minCol - 1) ? {left: getColumnHeaderWidth(index) + nameThWidth + unitThWidth + 'px'} : '']"
+              :class="[isFreezeRows || (maxCol > index &&  index >= minCol - 1) ? 'fix-col' : '', isFreezeColumns && maxCol <= index ? 'index' : '', tableFreeze && isWithinColRange(index) ? 'index-overlap' : '']"
               :data-cindex="-1"
               :data-rindex="rowHeader[index]">
               {{item}}
@@ -242,11 +379,24 @@
           </tr>
         </thead>
         <tbody>
-          <tr>
+          <tr
+            :style="tableFreeze ? `top: ${1 * tableHeight}px;` : ''"
+            :class="tableFreeze &&  maxRow > 0 ? 'fix' : ''"
+          >
             <!-- 行头 -->
-            <th class="th-tg sm"></th>
+            <th
+              class="th-tg sm"
+              :style="isFreezeAll ? {left: 0,top:1*tableHeight + 'px'} : (isFreezeColumns ? {left: 0} : (isFreezeRows ? {top: 1*tableHeight + 'px'} : ''))"
+              :class="[isFreezeRowsOrColumns  ? 'fix-col' : '']"
+            >
+            </th>
 
-            <td colspan="2" class="head-column">
+            <td
+              colspan="2"
+              class="head-column"
+              :class="[isFreezeRowsOrColumns ? 'fix-col' : '']"
+              :style="[isFreezeAll ? {left: 21 + 'px', top: 22 + 'px'} : (isFreezeColumns ? {left: 21 + 'px'} : (isFreezeRows ? {top: 22 + 'px'} : ''))]"
+            >
               日期
             </td>
 
@@ -257,9 +407,12 @@
               :data-rindex="rowHeader[sub_index]"
               :data-cindex="-1"
  
-              :style="TableInfo.ExtraConfig.TableFreeze && isWithinColRange(sub_index) ? `left: ${(sub_index- minCol+1)*getColumnHeaderWidth(sub_index)}px;` : ''"
-              :class="['data-cell','head-column',
-              TableInfo.ExtraConfig.TableFreeze && isWithinColRange(sub_index) ? 'fix-col' : '']"
+              :style="[tableFreeze && isWithinColRange(sub_index) ? {left: getColumnHeaderWidth(sub_index)  + nameThWidth + unitThWidth + 'px'} : '']"
+              :class="[
+                'data-cell',
+                'head-column',
+                tableFreeze && isWithinColRange(sub_index) ? 'fix-col' : ''
+              ]"
             >{{ date }}</td>
 
             <!-- 文本列 -->
@@ -268,8 +421,8 @@
               :key="index"
               :data-cindex="-1"
               :data-rindex="rowHeader[index+dateArr.length]"
-              :style="TableInfo.ExtraConfig.TableFreeze && isWithinColRange(index+dateArr.length) ? `left: ${(index+dateArr.length- minCol+1)*getColumnHeaderWidth(index+dateArr.length)}px;` : ''"
-              :class="'head-column', [([2,3,5].includes(column[0].DataType)&&column[0].ShowValue)?'insert': '', TableInfo.ExtraConfig.TableFreeze && isWithinColRange(index+dateArr.length) ? 'fix-col' : '']"
+              :style="tableFreeze && isWithinColRange(index+dateArr.length) ? `left: ${getColumnHeaderWidth(index+dateArr.length) + nameThWidth + unitThWidth}px;` : ''"
+                :class="[([2,3,5].includes(column[0].DataType)&&column[0].ShowValue)?'insert': '', tableFreeze && isWithinColRange(index+dateArr.length) ? 'fix-col' : '']"
               @click="clickCell($event,column[0])"
               @dblclick="dblClickCell($event,column[0])"
               @copy="copyCellHandle($event,column[0])"
@@ -284,13 +437,15 @@
 
 
           <!-- 指标行 -->
-          <tr v-for="(edb, edb_index) in TableInfo.TableData.Data" :key="edb.EdbInfoId" :style="TableInfo.ExtraConfig.TableFreeze ? `top: ${(edb_index- minRow+1)*tableHeight}px;` : ''" :class="TableInfo.ExtraConfig.TableFreeze && rowHeader[edb_index] >= minRow &&  rowHeader[edb_index] <= maxRow ? 'fix' : ''">
+          <tr v-for="(edb, edb_index) in TableInfo.TableData.Data" :key="edb.EdbInfoId" :style="tableFreeze ? `top: ${(edb_index- minRow+1)*tableHeight + 44}px;` : ''" :class="tableFreeze && rowHeader[edb_index] >= minRow &&  rowHeader[edb_index] <= maxRow ? 'fix' : ''">
             <!-- 行头 -->
             <th 
               class="th-tg th-row sm"
               :data-cindex="columnHeader[edb_index]"
               :data-rindex="-1"
               @contextmenu.prevent="rightClickHandle"
+              :style="[isFreezeColumns  ? {left: 0} : '']"
+              :class="[isFreezeColumns  ? 'fix-col' : '']"
             >
               {{columnHeader[edb_index]}}
             </th>
@@ -302,6 +457,10 @@
               :data-rindex="-1"
               :data-cindex="columnHeader[edb_index]"
               @click="() => { !disabled && item==='EdbName' && clickEdbName(edb)}"
+              :style="[isFreezeColumns ? {left:  index === 1 ? nameThWidth + 21 + 'px' : getColumnHeaderWidth(index) + 'px' } : '', tableFreeze && isWithinColRange(index) ? {top: (index- minRow+1)*tableHeight + 22 + 'px'} : '']"
+              :class="{
+                'fix-col': isFreezeColumns
+              }"
             >
               <template v-if="item === 'EdbName'">
                 <span :class="{'edbname-td':disabled}" @click="edbJumpToBase(edb)">{{ edb.EdbAliasName||(edb[item]) }}</span>
@@ -315,8 +474,8 @@
               :key="`${edb.EdbInfoId}_${rowHeader[data_index]}_${columnHeader[edb_index]}`"
               :data-rindex="rowHeader[data_index]"
               :data-cindex="columnHeader[edb_index]"
-              :style="TableInfo.ExtraConfig.TableFreeze && isWithinColRange(data_index) ? `left: ${(data_index- minCol+1)*getColumnHeaderWidth(data_index)}px;` : ''"
-              :class="[([2,3,5].includes(data.DataType)&&data.ShowValue)?'insert': '', TableInfo.ExtraConfig.TableFreeze && isWithinColRange(data_index) ? 'fix-col' : '']"
+              :style="tableFreeze && isWithinColRange(data_index) ? `left: ${getColumnHeaderWidth(data_index) + unitThWidth + nameThWidth}px;` : ''"
+              :class="[([2,3,5].includes(data.DataType)&&data.ShowValue)?'insert': '', tableFreeze && isWithinColRange(data_index) ? 'fix-col' : '']"
               @click="clickCell($event,data)"
               @dblclick="dblClickCell($event,data)"
               @copy="copyCellHandle($event,data)"
@@ -337,8 +496,8 @@
               :key="`${rowHeader[column_index+dateArr.length]}_${columnHeader[edb_index]}`"
               :data-rindex="rowHeader[column_index+dateArr.length]"
               :data-cindex="columnHeader[edb_index]"
-              :style="TableInfo.ExtraConfig.TableFreeze && isWithinColRange(column_index+dateArr.length) ? `left: ${(column_index+dateArr.length- minCol+1)*getColumnHeaderWidth(column_index+dateArr.length)}px;` : ''"
-              :class="[([2,3,5].includes(column[edb_index+1].DataType)&&column[edb_index+1].ShowValue)?'insert': '', TableInfo.ExtraConfig.TableFreeze && isWithinColRange(column_index+dateArr.length) ? 'fix-col' : '']"
+              :style="tableFreeze && isWithinColRange(column_index+dateArr.length) ? `left: ${getColumnHeaderWidth(column_index+dateArr.length) + nameThWidth + unitThWidth}px;` : ''"
+                :class="[([2,3,5].includes(column[edb_index+1].DataType)&&column[edb_index+1].ShowValue)?'insert': '', tableFreeze && isWithinColRange(column_index+dateArr.length) ? 'fix-col' : '']"
               @click="clickCell($event,column[edb_index+1])"
               @dblclick="dblClickCell($event,column[edb_index+1])"
               @copy="copyCellHandle($event,column[edb_index+1])"
@@ -461,8 +620,19 @@
 
     &.fix-col {
       position: sticky;
-      left: 0;
-      z-index: 98; // 表格右键操作弹窗为99
+      z-index: 97; // 表格右键操作弹窗为99
+    }
+    &.index {
+      z-index: 96; // 冻结的行列z-index为97,此处为96确保表格行不遮挡表格行内容
+    }
+    &.index-outside {
+      z-index: 95; // 同上
+    }
+    &.index-overlap {
+      z-index: 98; // 冻结的行列z-index为97,此处为行列交叉的地方层级要比冻结的行列高一层
+    }
+    &.index-highest {
+      z-index: 99;
     }
   }
 

+ 4 - 4
src/views/sheetList/sharedDetail.vue

@@ -301,12 +301,12 @@ function Base64() {
         color: rgba(102, 102, 102, 1);
         .top-item {
             line-height: 60px;
+            width: 50%;
+            white-space: nowrap; /* 文字不换行 */
+            overflow: hidden; /* 隐藏超出容器的内容 */
+            text-overflow: ellipsis; /* 显示省略号 */
         }
     }
-    .sheet-box{
-        width: 100%;
-        // height: calc(100vh - 400px);
-    }
     .sheet-more-action-wrap{
         .head-box{
             .title{