This commit is contained in:
linfso 2024-07-19 08:23:11 +08:00
parent 238f900011
commit cc31812ca0
5 changed files with 65 additions and 83 deletions

View File

@ -27,12 +27,11 @@ html, body {
} }
.el-table th.el-table__cell { .el-table th.el-table__cell {
user-select: initial; user-select: text;
// user-select: initial;
} }
label { label {
font-weight: 700; font-weight: 700;
} }

View File

@ -37,7 +37,7 @@ export default {
values() { values() {
if (this.value !== null && typeof this.value !== 'undefined') { if (this.value !== null && typeof this.value !== 'undefined') {
// return Array.isArray(this.value) ? this.value : [String(this.value)]; // return Array.isArray(this.value) ? this.value : [String(this.value)];
return Array.isArray(this.value) ? this.value : this.value.split(','); return Array.isArray(this.value) ? this.value : this.value?this.value.split(','):[];
} else { } else {
return []; return [];
} }

View File

@ -70,6 +70,9 @@
</div> </div>
</div> </div>
<div style=""> <div style="">
<div style="width:50%">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
</div>
<el-scrollbar style="height: calc(100vh - 200px);box-sizing: border-box;" > <el-scrollbar style="height: calc(100vh - 200px);box-sizing: border-box;" >
<draggable v-model="storageList" <draggable v-model="storageList"
ghostClass="drag-ghost" ghostClass="drag-ghost"
@ -78,9 +81,7 @@
handle=".el-icon-s-operation" handle=".el-icon-s-operation"
@end="updateTable" @end="updateTable"
> >
<div style="width:50%">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
</div>
<div v-for="col in storageList" :key="col.label" class="setting-row"> <div v-for="col in storageList" :key="col.label" class="setting-row">
<!-- <i class="el-icon-s-operation" /> --> <!-- <i class="el-icon-s-operation" /> -->
<i class="el-icon-s-operation icon iconfont icon-ui_drag_horizontally" /> <i class="el-icon-s-operation icon iconfont icon-ui_drag_horizontally" />
@ -270,14 +271,13 @@ export default {
var evt = window.event || arguments[0]; var evt = window.event || arguments[0];
var flag = true; var flag = true;
// 鼠标右键菜单 // 鼠标右键菜单
// console.log("evt",evt);
if(evt.button == 2){ if(evt.button == 2){
flag=false; flag=false;
showContextMenu(evt); if(vnode.context.multipleSelection&&vnode.context.multipleSelection.length>0){
// vnode.context.clearEventBubble(evt); showContextMenu(evt);
const currentCellInfo=getCellPosition(evt.target); const currentCellInfo=getCellPosition(evt.target);
vnode.context.currentCellInfo=currentCellInfo; vnode.context.currentCellInfo=currentCellInfo;
// console.log("currentCellInfo",currentCellInfo); }
return; return;
} }
// 只有鼠标左键按下时有效 // 只有鼠标左键按下时有效
@ -310,6 +310,17 @@ export default {
var startX = (evt.x || evt.clientX); var startX = (evt.x || evt.clientX);
var startY = (evt.y || evt.clientY); var startY = (evt.y || evt.clientY);
//重置选中css
for (var i = 0; i < fileNodes.length; i++) {
if (fileNodes[i].className.indexOf("el-table__cell") != -1) {
// fileNodes[i].className = "el-table__cell";
fileNodes[i].classList.remove("seled");
selList.push(fileNodes[i]);
}
}
setMouseCellSelect(evt.target);
var _x = null; var _x = null;
var _y = null; var _y = null;
@ -327,16 +338,7 @@ export default {
// } // }
//为了确保只有一次的渲染每次框选都把默认选中为空 //为了确保只有一次的渲染每次框选都把默认选中为空
if(flag){ if(flag){
//重置选中css flag = false;
for (var i = 0; i < fileNodes.length; i++) {
if (fileNodes[i].className.indexOf("el-table__cell") != -1) {
// fileNodes[i].className = "el-table__cell";
fileNodes[i].classList.remove("seled");
selList.push(fileNodes[i]);
}
}
flag = false;
} }
if (vnode.context.mouseflag) { if (vnode.context.mouseflag) {
@ -442,12 +444,18 @@ export default {
while(cell.tagName !== 'TD'){ while(cell.tagName !== 'TD'){
cell = cell.parentElement; cell = cell.parentElement;
} }
cell.className = cell.className + " seled";
const cellInfo=getCellPosition(cell);
vnode.context.multipleSelection=[];
vnode.context.multipleSelection.push(cellInfo);
// 选中和取消选中
if(cell.className.indexOf("seled") != -1 ){
cell.classList.remove("seled");
vnode.context.multipleSelection=[];
}
else{
cell.className = cell.className + " seled";
const cellInfo=getCellPosition(cell);
vnode.context.multipleSelection=[];
vnode.context.multipleSelection.push(cellInfo);
}
}catch(e){ }catch(e){
} }
@ -579,12 +587,6 @@ export default {
immediate: true immediate: true
}, },
}, },
beforeMount() {
window.addEventListener('keydown', this.keyDown)
},
beforeDestroy() {
window.removeEventListener('keydown', this.keyDown)
},
mounted() { mounted() {
if(this.saveStorageName&&this.saveStorageName!=undefined&&this.saveStorageName!=''){ if(this.saveStorageName&&this.saveStorageName!=undefined&&this.saveStorageName!=''){
this.isNeedDbSaveTpl=true; this.isNeedDbSaveTpl=true;
@ -608,49 +610,16 @@ export default {
return Math.random().toString(36).substring(3,10); return Math.random().toString(36).substring(3,10);
}, },
// initKeyDown(){ initKeyDown(){
// let that=this;
// document.addEventListener('keydown', function(e) {
// e = e||window.event;
// if(e.ctrlKey&&e.code=="KeyC"){
// that.handleCopySelect(e);
// return false;
// }
// });
// },
keyDown(e) {
let that=this; let that=this;
if (e || window.e) { document.addEventListener('keydown', function(e) {
const { key, target } = e e = e||window.event;
const deleteKeyArr = ['Backspace', 'Delete'] if(e.ctrlKey&&e.code=="KeyC"){
// 使用this.$el.querySelector('#efContainer')而不使用document.getElementById,是因为我们获取元素,尽量用this.$el去一级级获取,用document,单页面应用总会出些意外 that.handleCopySelect(e);
// js的contains方法用来查看dom元素的包含关系-用来限定键盘事件只局限于当前dom范围内 return false;
const efContainerId = this.$el.querySelector('#'+this.tableId)
console.log("====>efContainerId==>",efContainerId);
if (e.ctrlKey&&e.code=="KeyC" && target.contains(efContainerId)) {
this.handleCopySelect(e)
} }
});
// const efContainerId = this.$el.querySelector('#'+this.tableId)
// console.log("====>efContainerId==>",efContainerId);
// console.log("====>efContainerId==>",efContainerId);
// if(e.ctrlKey&&e.code=="KeyC"){
// that.handleCopySelect(e);
// return false;
// }
// if (deleteKeyArr.includes(key) && !this.delBtnDisabled && this.clickedBackSpace && target.contains(efContainerId)) {
// this.deleteElement()
// }
}
}, },
keyDownOld(e) {
if(e.ctrlKey && e.keyCode==13) { //用户点击了ctrl+enter触发
}
// this.textarea += '\n';
// }else { //用户点击了enter触发
// this.sendMessage();
},
onTplSelectInputBlur(e) { onTplSelectInputBlur(e) {
if (e.target.value.trim()!== '') { if (e.target.value.trim()!== '') {
//e.target.value就是录入的内容 //e.target.value就是录入的内容
@ -1070,7 +1039,14 @@ export default {
})) }))
this.storageList = list this.storageList = list
}, },
keyDown(e) {
if(e.ctrlKey && e.keyCode==13) { //用户点击了ctrl+enter触发
}
// this.textarea += '\n';
// }else { //用户点击了enter触发
// this.sendMessage();
},
// 根据缓存的数组进行渲染表格 // 根据缓存的数组进行渲染表格
updateTable() { updateTable() {
// 特殊类型 // 特殊类型

View File

@ -265,6 +265,8 @@
slot-scope="slotProps" slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'" :height="(slotProps.contentHeight)+'px'"
highlight-current-row
ref="refTable" ref="refTable"
row-key="id" row-key="id"
@ -279,6 +281,7 @@
@queryTable="getList" @queryTable="getList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@sort-change="handleSortChange" @sort-change="handleSortChange"
@row-dblclick="handleShowTraceInfo"
> >
<div slot="toolbar"> <div slot="toolbar">
@ -321,15 +324,16 @@
<el-table-column :label="$t('快件跟踪')" align="left" prop="lastTraceInfo" min-width="350" :show-overflow-tooltip="true" > <el-table-column :label="$t('快件跟踪')" align="left" prop="lastTraceInfo" min-width="350" :show-overflow-tooltip="true" >
<template slot-scope="scope"> <template slot-scope="scope">
<div class="link-type" @click="handleShowTraceInfo(scope.row)">{{scope.row.lastTraceInfo}}</div> <div >{{scope.row.lastTraceInfo}}</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- class="link-type" @click="handleShowTraceInfo(scope.row)" class="link-type" @click="handleShowTraceInfo(scope.row)" class="link-type" @click="handleShowTraceInfo(scope.row)" -->
<el-table-column :label="$t('跟踪预警')" align="center" prop="traceWaring" min-width="100" :show-overflow-tooltip="true" > <el-table-column :label="$t('跟踪预警')" align="center" prop="traceWaring" min-width="100" :show-overflow-tooltip="true" >
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.blSign=='1'" class="link-type" @click="handleShowTraceInfo(scope.row)"> <div v-if="scope.row.blSign=='1'" >
{{calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)}}天 {{calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)}}天
</div> </div>
<div v-else class="link-type" @click="handleShowTraceInfo(scope.row)"> <div v-else >
<span v-if="calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)>2" style="color: red" > <span v-if="calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)>2" style="color: red" >
轨迹异常:停留超时{{calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)}}天 轨迹异常:停留超时{{calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)}}天
</span> </span>
@ -400,7 +404,7 @@
<el-table-column :label="$t('客户名称')" align="center" prop="customerName" min-width="80" :show-overflow-tooltip="true"> <el-table-column :label="$t('客户名称')" align="center" prop="customerName" min-width="80" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.paymentType==2 || scope.row.paymentType==4 || scope.row.paymentType==5">{{scope.row.customerName}}</span> <span v-if="scope.row.paymentType==2 || scope.row.paymentType==4 || scope.row.paymentType==5">{{scope.row.custName}}</span>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>

View File

@ -283,6 +283,7 @@
@queryTable="getList" @queryTable="getList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@sort-change="handleSortChange" @sort-change="handleSortChange"
@row-dblclick="handleShowTraceInfo"
> >
<div slot="toolbar"> <div slot="toolbar">
@ -322,18 +323,20 @@
</template> </template>
</el-table-column> </el-table-column>
<!-- class="link-type" @click="handleShowTraceInfo(scope.row)" -->
<!-- class="link-type" @click="handleShowTraceInfo(scope.row)"
class="link-type" @click="handleShowTraceInfo(scope.row)"-->
<el-table-column :label="$t('快件跟踪')" align="left" prop="lastTraceInfo" min-width="350" :show-overflow-tooltip="true" > <el-table-column :label="$t('快件跟踪')" align="left" prop="lastTraceInfo" min-width="350" :show-overflow-tooltip="true" >
<template slot-scope="scope"> <template slot-scope="scope">
<div class="link-type" @click="handleShowTraceInfo(scope.row)">{{scope.row.lastTraceInfo}}</div> <div >{{scope.row.lastTraceInfo}}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('跟踪预警')" align="center" prop="traceWaring" min-width="100" :show-overflow-tooltip="true" > <el-table-column :label="$t('跟踪预警')" align="center" prop="traceWaring" min-width="100" :show-overflow-tooltip="true" >
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.blSign=='1'" class="link-type" @click="handleShowTraceInfo(scope.row)"> <div v-if="scope.row.blSign=='1'">
{{calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)}}天 {{calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)}}天
</div> </div>
<div v-else class="link-type" @click="handleShowTraceInfo(scope.row)"> <div v-else >
<span v-if="calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)>2" style="color: red" > <span v-if="calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)>2" style="color: red" >
轨迹异常:停留超时{{calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)}}天 轨迹异常:停留超时{{calcDeliveryTime(scope.row.sendDate,scope.row.scanDate)}}天
</span> </span>
@ -407,7 +410,7 @@
<el-table-column :label="$t('客户名称')" align="center" prop="customerName" min-width="80" :show-overflow-tooltip="true"> <el-table-column :label="$t('客户名称')" align="center" prop="customerName" min-width="80" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.paymentType==2 || scope.row.paymentType==4 || scope.row.paymentType==5">{{scope.row.customerName}}</span> <span v-if="scope.row.paymentType==2 || scope.row.paymentType==4 || scope.row.paymentType==5">{{scope.row.custName}}</span>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>