|
|
@@ -10,6 +10,7 @@
|
|
|
:page.sync="page"
|
|
|
@size-change="sizeChange"
|
|
|
@current-change="currentChange"
|
|
|
+ @select="select"
|
|
|
@selection-change="selectionChange"
|
|
|
@row-click="handleRowClick"
|
|
|
@resetColumn="resetColumn('crud', 'option', 'optionBack', 487)"
|
|
|
@@ -391,14 +392,12 @@ export default {
|
|
|
},
|
|
|
pageData: [],
|
|
|
queryData: [],
|
|
|
- // 键盘状态
|
|
|
- isShiftPressed: false,
|
|
|
- // 操作锁
|
|
|
- isSelecting: false,
|
|
|
// 选择相关
|
|
|
lastSelectedRow: null,
|
|
|
lastSelectionRange: null, // {startIndex, endIndex}
|
|
|
selectionList: [],
|
|
|
+ isShiftPressed: false, // 键盘状态
|
|
|
+ lastSelectedRowIndex: null,
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
|
@@ -423,9 +422,60 @@ export default {
|
|
|
this.roleName = localStorage.getItem("roleName").split(",");
|
|
|
this.option = await this.getColumnData(this.getColumnName(487), this.optionBack);
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ document.addEventListener("keydown", this.handleKeyDown);
|
|
|
+ document.addEventListener("keyup", this.handleKeyUp);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ document.removeEventListener("keydown", this.handleKeyDown);
|
|
|
+ document.removeEventListener("keyup", this.handleKeyUp);
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ handleKeyDown(e) {
|
|
|
+ if (e.key === "Shift" || e.keyCode === 16) {
|
|
|
+ this.isShiftPressed = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleKeyUp(e) {
|
|
|
+ if (e.key === "Shift" || e.keyCode === 16) {
|
|
|
+ this.isShiftPressed = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
handleRowClick(row, event, column) {
|
|
|
- this.$refs.crud.toggleRowSelection(row, true);
|
|
|
+ const currentIndex = this.pageData.indexOf(row); // 获取当前行索引
|
|
|
+ if (this.isShiftPressed && this.lastSelectedRowIndex != null) {
|
|
|
+ const start = Math.min(this.lastSelectedRowIndex, currentIndex);
|
|
|
+ const end = Math.max(this.lastSelectedRowIndex, currentIndex);
|
|
|
+ this.$refs.crud.selectClear(); // 清空历史选中
|
|
|
+ setTimeout(() => {
|
|
|
+ for (let i = start; i <= end; i++) {
|
|
|
+ this.$refs.crud.toggleRowSelection(this.pageData[i], true);
|
|
|
+ }
|
|
|
+ }, 10);
|
|
|
+
|
|
|
+ this.lastSelectedRowIndex = currentIndex; // 更新起始行索引
|
|
|
+ } else {
|
|
|
+ // 普通点击:清空选中并设置起始行
|
|
|
+ // this.$refs.crud.selectClear(); // 清空历史选中
|
|
|
+ this.$refs.crud.toggleRowSelection(row, true); // 选中当前行
|
|
|
+ this.lastSelectedRowIndex = currentIndex; // 更新起始行索引
|
|
|
+ }
|
|
|
+ },
|
|
|
+ select(list, row) {
|
|
|
+ const currentIndex = this.pageData.indexOf(row); // 获取当前行索引
|
|
|
+ if (this.isShiftPressed && this.lastSelectedRowIndex != null) {
|
|
|
+ const start = Math.min(this.lastSelectedRowIndex, currentIndex);
|
|
|
+ const end = Math.max(this.lastSelectedRowIndex, currentIndex);
|
|
|
+ this.$refs.crud.selectClear(); // 清空历史选中
|
|
|
+ setTimeout(() => {
|
|
|
+ for (let i = start; i <= end; i++) {
|
|
|
+ this.$refs.crud.toggleRowSelection(this.pageData[i], true);
|
|
|
+ }
|
|
|
+ }, 10);
|
|
|
+ this.lastSelectedRowIndex = currentIndex; // 更新起始行索引
|
|
|
+ } else {
|
|
|
+ this.lastSelectedRowIndex = currentIndex; // 更新起始行索引
|
|
|
+ }
|
|
|
},
|
|
|
viewRLA(row, type) {
|
|
|
this.rlaData = [];
|
|
|
@@ -565,6 +615,12 @@ export default {
|
|
|
res.data.data.forEach((item, index) => {
|
|
|
item.accBillId = item.id;
|
|
|
delete item.id;
|
|
|
+ delete item.createUser;
|
|
|
+ delete item.createUserName;
|
|
|
+ delete item.createTime;
|
|
|
+ delete item.updateUser;
|
|
|
+ delete item.updateUserName;
|
|
|
+ delete item.updateTime;
|
|
|
item.lineNo = Number(index) + 1;
|
|
|
this.$set(item, "currentStlCurCode", item.curCode);
|
|
|
this.$set(item, "currentStlExrate", item.exrate);
|