This commit is contained in:
linfso 2025-07-07 17:40:51 +08:00
parent b8bec7639c
commit ca84bda82b
4 changed files with 35 additions and 201 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="xd-table full-block flex-layout" :id="tableId" >
<div class="xd-table full-block flex-layout" >
<div class="table-operate-btn-content" v-show="showOperateButton">
<slot name="operateBtnContent">
@ -96,7 +96,7 @@
</div>
<div @mouseenter="initKeyDownEvent" @mouseleave="removeKeyDownEvent">
<!-- <div class="flex-auto"> -->
<orig-table ref="table" :key="refreshKeyId" tabindex="-1" :config="config" v-dragSelect class="xd-tb-wrapper" />
<orig-table :id="tableId" ref="table" :key="refreshKeyId" tabindex="-1" :config="config" v-dragSelect class="xd-tb-wrapper" />
<!-- </div> -->
<!-- 统计数据 v-dragColumn v-dragSelect-->
<!-- <div class="flex-none"> -->
@ -266,11 +266,6 @@ export default {
var oDiv = el;
var tbBodyDiv=oDiv.getElementsByClassName("el-table__body-wrapper")[0];
var startCell=null;
var endCell=null;
var selectedCells=[];
var selDiv=null;
// 鼠标按下事件
tbBodyDiv.onmousedown = function (ev) {
var evt = window.event || arguments[0];
@ -305,23 +300,15 @@ export default {
// 清除粘贴板
vnode.context.clearBatchSelect();
// 获取鼠标按下的单元格
const cell = evt.target.closest('td');
if (!cell || cell.classList.contains('el-table__expanded-cell')) return;
// 获取单元格位置信息
const cellInfo = getCellInfo(cell);
if (!cellInfo) return;
startCell = cellInfo;
// console.log("===>startCell===>",startCell);
vnode.context.contextVisible=false;
// 增加图层
var xdTableObj = document.getElementById(vnode.context.tableId);
var tbBody1=xdTableObj.getElementsByClassName("el-table__body-wrapper")[0];
var selDiv = document.createElement("div");
selDiv.style.cssText = "position:absolute;width:0px;height:0px;font-size:0px;margin:0px;padding:0px;border:2px solid #409eff;background-color:#d9ecff;z-index:1000;filter:alpha(opacity:60);opacity:0.6;display:none;";
selDiv.id = "selectDiv-"+vnode.context.tableId;
tbBodyDiv.appendChild(selDiv);
tbBody1.appendChild(selDiv);
// 表格对象
const refTableObj=vnode.context.getInstance();
@ -371,23 +358,10 @@ export default {
return;
}
// 获取鼠标当前所在的单元格
const cell = evt.target.closest('td');
if (!cell || cell.classList.contains('el-table__expanded-cell')) return;
// 获取单元格位置信息
const cellInfo = getCellInfo(cell);
if (!cellInfo) return;
// 记录结束单元格
endCell = cellInfo;
// console.log("===>startCell==endCell=>",startCell,endCell);
// updateSelectionRange();
if(flag&&vnode.context.mouseflag){
vnode.context.multipleSelection=[];
// console.log("===fileNodes.length==>",fileNodes.length);
// 只选取范围内的数据
for (var i = 0; i < fileNodes.length; i++) {
@ -486,150 +460,6 @@ export default {
return tableRect;
}
function getCellXY(cell) {
try{
while(cell.tagName !== 'TD'){
cell = cell.parentElement;
}
// // console.log("xdtable==>",cell);
const cellRect = cell.getBoundingClientRect();
return { x:cellRect.x,y:cellRect.y,width:cellRect.width,height:cellRect.height};
}catch(e){
return { left:-1,top:-1,width:-1,height:-1};
}
}
// 获取单元格信息 ------------------
function getCellInfo(cell) {
if (!cell) return null;
// 获取行索引(排除表头)
const row = Array.from(cell.closest('tbody').children).indexOf(cell.parentElement);
if (row === -1) return null;
// 获取列索引
const column = Array.from(cell.parentElement.children).indexOf(cell);
if (column === -1) return null;
// 获取单元格内容
const content = cell.textContent.trim();
// 获取对应的属性名
// const table = vnode.context.$refs.table;
// const columnProperty = table.columns[column].property;
return { row:row, col:column, text:content,element: cell };
}
// 根据行列位置获取单元格元素
function getCellByPosition(rowIndex, columnIndex) {
// const table = vnode.context.$refs.table.elTable;
// const table=vnode.context.$refs.table.$refs.elTable;
// const rows = table.$el.querySelectorAll('tbody tr');
// console.log("===>tbBodyDiv===>",tbBodyDiv);
const rows = tbBodyDiv.querySelectorAll('tr');
if (rowIndex >= 0 && rowIndex < rows.length) {
const row = rows[rowIndex];
const cells = row.querySelectorAll('td');
if (columnIndex >= 0 && columnIndex < cells.length) {
return cells[columnIndex];
}
}
return null;
}
// 更新选择范围
function updateSelectionRange(finalize = false) {
if (!startCell || !endCell) return;
// 计算选择范围
const startRow = Math.min(startCell.row, endCell.row);
const endRow = Math.max(startCell.row, endCell.row);
const startColumn = Math.min(startCell.column, endCell.column);
const endColumn = Math.max(startCell.column, endCell.column);
if (finalize) {
// 最终确定选择范围
clearSelection();
// 选择范围内的所有单元格
for (let row = startRow; row <= endRow; row++) {
for (let col = startColumn; col <= endColumn; col++) {
const cell = getCellByPosition(row, col);
if (cell) {
const cellInfo = getCellInfo(cell);
selectCell(cellInfo);
}
}
}
} else {
// 实时显示选择范围指示器
const startCell = getCellByPosition(startRow, startColumn);
const endCell = getCellByPosition(endRow, endColumn);
if (startCell && endCell) {
const startRect = startCell.getBoundingClientRect();
const endRect = endCell.getBoundingClientRect();
const tableDom=vnode.context.$refs.table.$refs.elTable.$el;
const tableRect = tableDom.getBoundingClientRect();
// console.log("====>updateSelectionRange===>",tableRect,tableDom)
selDiv.style.left = `${startRect.left - tableRect.left}px`;
selDiv.style.top = `${startRect.top - tableRect.top}px`;
selDiv.style.width = `${endRect.right - startRect.left}px`;
selDiv.style.height = `${endRect.bottom - startRect.top}px`;
selDiv.style.display = 'block';
}
}
}
// 检查单元格是否已选中
function isCellSelected(cellInfo) {
if (!cellInfo) return false;
return selectedCells.some(cell =>
cell.row === cellInfo.row && cell.column === cellInfo.column
);
}
// 清除所有选择
function clearSelection() {
// 移除所有选中样式
selectedCells.forEach(cell => {
if (cell.element) {
cell.element.classList.remove('seled');
}
});
// 清空选中列表
selectedCells = [];
// 重置起始和结束单元格
startCell = null;
endCell = null;
}
// 选择单元格
function selectCell(cellInfo) {
if (!cellInfo || isCellSelected(cellInfo)) return;
// 添加到选中列表
selectedCells.push(cellInfo);
// console.log("===>selectedCells===>",selectedCells);
// 添加选中样式
if (cellInfo.element) {
cellInfo.element.classList.add('seled');
}
}
function setMouseCellSelect(cell,selRowList) {
try{
while(cell.tagName !== 'TD'){
@ -653,8 +483,6 @@ export default {
vnode.context.multipleSelection=[];
vnode.context.multipleSelection.push(cellInfo);
// 行样式设置
// const refTableObj=vnode.context.getInstance();
// let rowIndex = cell.rowIndex;
@ -683,12 +511,6 @@ export default {
}
//在鼠标抬起后做的重置
document.onmouseup = function () {
// 如果有结束单元格,更新选择范围
// if (endCell) {
// updateSelectionRange(true);
// }
//把鼠标移动事初始化
// document.onmousemove=null;
var xdTableObj = document.getElementById(vnode.context.tableId);
@ -700,9 +522,9 @@ export default {
vnode.context.mouseflag = false;
vnode.context.handleBatchSelect();
// cancelContextMenu();
};
};
};
};
}
@ -728,7 +550,6 @@ export default {
// 是否显示弹出层
open: false,
showTable: false,
popVisible:false,
isMouseDown: true, // 是否需要(允许)处理鼠标的移动事件

View File

@ -307,7 +307,6 @@ export default {
vnode.context.contextVisible=false;
// 增加图层
var xdTableObj = document.getElementById(vnode.context.tableId);
var tbBody1=xdTableObj.getElementsByClassName("el-table__body-wrapper")[0];
var selDiv = document.createElement("div");
selDiv.style.cssText = "position:absolute;width:0px;height:0px;font-size:0px;margin:0px;padding:0px;border:2px solid #409eff;background-color:#d9ecff;z-index:1000;filter:alpha(opacity:60);opacity:0.6;display:none;";

View File

@ -43,6 +43,18 @@
<el-form-item label="供应商" prop="supplierCode">
<EmisSupplierPicker :placeholder="$t('请选择')" v-model="queryParams.supplierCode" ></EmisSupplierPicker>
</el-form-item>
<el-form-item :label="$t('是否启用')" prop="blOpen">
<el-select v-model="queryParams.blOpen" clearable :placeholder="$t('启用状态')" >
<el-option key="1" label="启用" :value="1" />
<el-option key="0" label="停用" :value="0" />
</el-select>
</el-form-item>
<el-form-item :label="$t('剔除自提')" prop="blIgnoreZt">
<el-select v-model="queryParams.blIgnoreZt" clearable :placeholder="$t('剔除自提')" >
<el-option key="1" label="是" :value="1" />
<el-option key="0" label="否" :value="0" />
</el-select>
</el-form-item>
<!-- <el-form-item label="" prop="startDate">
<el-date-picker clearable
v-model="queryParams.startDate"
@ -71,7 +83,7 @@
v-loading="loading"
ref="refTable"
storageName="BigBatchPanel_main_241121"
storageName="BigBatchPanel_main_2411212"
border stripe
size="small"
@ -161,6 +173,20 @@
</el-table-column> -->
<el-table-column :label="$t('开始日期')" align="center" prop="startDate" min-width="100" />
<el-table-column :label="$t('结束日期')" align="center" prop="endDate" min-width="100" />
<el-table-column :label="$t('是否启用')" align="center" prop="blOpen" min-width="100" >
<template slot-scope="scope">
<el-tag v-if="scope.row.blOpen==1" type="success">启用</el-tag>
<el-tag v-if="scope.row.blOpen==0" type="danger">停用</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('剔除自提')" align="center" prop="blIgnoreZt" min-width="100" >
<template slot-scope="scope">
<el-tag v-if="scope.row.blIgnoreZt==1" type="success">是</el-tag>
<el-tag v-if="scope.row.blIgnoreZt==0" type="danger">否</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('备注')" align="center" prop="remark" min-width="150" :show-overflow-tooltip="true"/>
</XdTable>

View File

@ -191,7 +191,7 @@
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<el-row :gutter="10" class="mb8">
<!-- icon="el-icon-plus" -->
<!-- v-hasPermi="['emis:emisWaybill:add']" -->
<el-col :span="1.5" v-if="activeTab=='waitConfirm'">
@ -307,7 +307,6 @@
<span v-text="getIndex(scope.$index)"> </span>
</template>
</el-table-column>
-->
<el-table-column :label="$t('下单日期')" align="center" prop="orderDate" min-width="170" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('运单号')" align="center" prop="billCode" min-width="150" :show-overflow-tooltip="true"/>
@ -1114,17 +1113,6 @@ export default {
<style lang="scss" scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
.query-label {
.el-radio{
display: block;