This commit is contained in:
linfso 2024-06-20 07:57:25 +08:00
parent df8201a06b
commit 83e6992385
4 changed files with 85 additions and 95 deletions

View File

@ -21,6 +21,17 @@
}
}
@mixin wh($width, $height) {
width: $width;
height: $height;
}
@mixin flexCenter($flexStart, $center) {
// width: $width;
// height: $height;
}
@mixin relative {
position: relative;
width: 100%;

View File

@ -342,7 +342,6 @@ export default {
</script>
<style lang="scss">
// @import "../../../public/style/mixin.scss";
@import '@/assets/styles/mixin.scss';
.air-table-wrapper {

View File

@ -78,7 +78,7 @@
</slot>
</div>
<div>
<orig-table ref="table" :config="config" />
<orig-table ref="table" :config="config" />
<!-- <orig-table ref="table" :config="config" v-drag /> -->
@ -144,8 +144,8 @@ export default {
default: true,
},
},
// 框选的指令
directives: {
drag: {
// 指令的定义
@ -199,92 +199,17 @@ export default {
selList.push(fileNodes[i]);
}
}
// const tableBody = document.querySelector(".el-table__body");
// tableBody.children[1].childNodes.forEach(element => {
// for (let index = 0; index < element.childNodes.length; index++) {
// // 获取当前单元格
// const cell = element.childNodes[index];
// if (
// // 判断选中的单元格是否在鼠标拉框的范围内
// rectLeft <
// cell.offsetLeft - this.tableRectLeft + cell.offsetWidth &&
// rectLeft + this.rect.offsetWidth >
// cell.offsetLeft - this.tableRectLeft &&
// rectTop <
// cell.offsetTop - this.tableRectTop + cell.offsetHeight &&
// rectTop + this.rect.offsetHeight >
// cell.offsetTop - this.tableRectTop &&
// index >= 3 // 选中的单元格所在列的索引大于等于3
// ) {
// if (cell.className.indexOf("add") == -1) {
// // cell.style.border = "1px solid red";
// const cellText = cell.innerText;
// const rowData = this.historyDataTables[element.rowIndex]; // 获取当前单元格所在的行数据
// // 获取表格的列名的属性名property
// let columnProperty = undefined;
// // 遍历第一行数据
// // console.log(index, '--index--'); // 框选数据所在列的索引
// for (const item of columns) {
// if (item.index === index) {
// columnProperty = item.property;
// break;
// }
// }
// // const rowIndex = element.rowIndex; // 将当前单元格所在的行数据加入到该列数据中
// const columnIndex = index;
// const time = rowData.sampleTime;
// // 选择要添加到选中行数组中的属性
// const selected = {
// rowId: rowData.id,
// // row: rowIndex,
// column: columnIndex,
// sampleTime: time,
// factor: columnProperty,
// tag: rowData[columnProperty + "_tag"] || "",
// tagStatus: rowData[columnProperty + "_tag_status"] || "",
// mark: rowData[columnProperty + "_mark"] || ""
// };
// // 将选中数据加入到状态中已有的数据中,如果已有相同的数据,则不加入
// if (
// !this.selectedData.some(data => this.isEqual(data, selected))
// ) {
// this.selectedData.push(selected);
// }
// // 将选中数据加入到 xqArr 中
// this.selectedData.forEach(item => {
// // 如果 xqArr 中已有相同数据,则不加入
// if (!this.xqArr.some(data => this.isEqual(data, item))) {
// this.xqArr.push(item);
// }
// });
// this.selectedData = [];
// }
// }
// }
// });
vnode.context.multipleSelection=[]
// console.log(vnode.context);
// vnode.context.tableData.forEach((ele)=>{
// vnode.context.$refs.table.toggleRowSelection(ele,false)
// })
vnode.context.tableData.forEach((ele)=>{
vnode.context.$refs.table.toggleRowSelection(ele,false)
})
flag = false;
}
if (vnode.context.mouseflag) {
if (selDiv.style.display == "none") {
selDiv.style.display = "";
}
// var scrolling=oDiv.getElementsByClassName("is-scrolling-none");
var scrolling=oDiv.getElementsByClassName("is-scrolling-left");
// console.log("========>");
// console.log(scrolling);
var scrolling=oDiv.getElementsByClassName("is-scrolling-none");
selDiv.style.left = Math.min(_x, startX)-left+scrolling[0].scrollLeft + "px";
//48是表头的高度
selDiv.style.top = Math.min(_y, startY)-top - 48+scrolling[0].scrollTop+ "px";
@ -300,21 +225,21 @@ export default {
if (sl > _l && st > _t && selList[i].offsetLeft < _l + _w && selList[i].offsetTop < _t + _h) {
if (selList[i].className.indexOf("seled") == -1) {
selList[i].className = selList[i].className + " seled";
// vnode.context.$refs.table.toggleRowSelection(vnode.context.tableData[i],true)
vnode.context.$refs.table.toggleRowSelection(vnode.context.tableData[i],true)
//把选中的都存入到table标签中的已选中
// if(vnode.context.tableData[i])
// vnode.context.multipleSelection.push(vnode.context.tableData[i]);
if(vnode.context.tableData[i])
vnode.context.multipleSelection.push(vnode.context.tableData[i]);
}
} else {
if (selList[i].className.indexOf("seled") != -1 ) {
selList[i].className = "el-table__row";
// vnode.context.$refs.table.toggleRowSelection(vnode.context.tableData[i],false);
// vnode.context.multipleSelection.forEach((ele,i)=>{
// //这里没用对象是否相等用的是传入table中的唯一的myKey字段
// if(ele[vnode.context.myKey]==vnode.context.tableData[i][vnode.context.myKey] ){
// vnode.context.multipleSelection.splice(i,1);
// }
// })
vnode.context.$refs.table.toggleRowSelection(vnode.context.tableData[i],false);
vnode.context.multipleSelection.forEach((ele,i)=>{
//这里没用对象是否相等用的是传入table中的唯一的myKey字段
if(ele[vnode.context.myKey]==vnode.context.tableData[i][vnode.context.myKey] ){
vnode.context.multipleSelection.splice(i,1);
}
})
}
}
}
@ -349,7 +274,7 @@ export default {
}
selList = null, _x = null, _y = null, selDiv = null, startX = null, startY = null, evt = null;
vnode.context.mouseflag = false;
// vnode.context.$handleSelect();
vnode.context.$handleSelect();
};
};
}
@ -417,6 +342,17 @@ export default {
},
methods: {
//当批量选中结束调用
$handleSelect(){
this.$emit('handleSelect',this.multipleSelection)
},
//监听表格的滚动
handleScroll(e){
this.targetScroll = e.target.scrollTop;
},
// ---------------
//清除默认事件
clearEventBubble(evt) {
if (evt.stopPropagation)
@ -436,7 +372,9 @@ export default {
this.tableRectLeft = Math.ceil(tableRect.left);
},
handleSelect(rows) {
console.log(rows)
},
handleSelectionChange(rows) {
// console.log(rows)
},

View File

@ -294,6 +294,29 @@
</SearchForm>
<!-- :columData="columData"
:menuList ="menuList" -->
<!-- @rowContextmenu="rowContextmenu" -->
<!-- @currentPageChange="currentPageChange" -->
<!-- @handleSelect="handleSelect" -->
<!-- <XdTableAdv
:tableData="emisWaybillList"
:total="total"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('运单号')" align="center" prop="billCode" min-width="120" :show-overflow-tooltip="true" >
<template slot-scope="scope">
<span> {{scope.row.billCode}} </span>
<i v-if="scope.row.billCode"
style="margin-left: 4px; cursor: pointer"
class="el-icon-document-copy"
@click="handleCopy(scope.row,$event)"></i>
</template>
</el-table-column>
</XdTableAdv> -->
<XdTable
slot="pageContent"
slot-scope="slotProps"
@ -312,6 +335,10 @@
@sort-change="handleSortChange"
@row-dblclick="handleShowTraceInfo"
:cell-selection="true"
:selection-type="'multiple'"
>
<div slot="toolbar">
@ -342,7 +369,12 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('运单号')" align="center" prop="billCode" min-width="120" :show-overflow-tooltip="true" >
<template slot-scope="scope">
{{scope.row.billCode}}
<span> {{scope.row.billCode}} </span>
<i v-if="scope.row.billCode"
style="margin-left: 4px; cursor: pointer"
class="el-icon-document-copy"
@click="handleCopy(scope.row,$event)"></i>
</template>
</el-table-column>
@ -625,8 +657,13 @@ import WaybillDetailReadOnly from '@/views/emis/emisWaybill/waybillDetailReadOnl
import TraceWaybillDetailView from '@/views/emis/customerService/traceWaybillDetailView.vue';
import XdTableAdv from "@/components/XdTable/index_adv.vue";
import {timeDiffTime,timeFormat} from '@/utils/dateUtils'
import { formatSearchStr,deepClone } from '@/utils/index'
import clip from '@/utils/clipboard'
export default {
name: "SendWaybillList",
@ -653,6 +690,8 @@ export default {
WaybillDetailReadOnly,
XdTableAdv
},
dicts: ['emis_qujian_fangshi','emis_declare_mode','emis_customs_clear',
'emis_tab_packing_type','emis_tab_dispatch_mode','emis_payment_type',
@ -876,6 +915,9 @@ export default {
},
methods: {
handleCopy(row, event) {
clip(row.billCode, event)
},
calcDeliveryTime(startData,endDate){
return timeDiffTime(startData,endDate)
},