|
@@ -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;
|
|
|
}
|
|
|
}
|
|
|
|