leiqunqing
2026-01-19 ba8aa925e7901381ceb394adb53eca8723d1c4c5
´úÂë¹ÜÀí/WIDESEAWCS_Client/src/components/basic/VolTable.vue
@@ -642,6 +642,7 @@
      default: 500,
    },
    selectable: {
      type: Function,
      default: (row, index) => {
        return true;
@@ -884,18 +885,45 @@
    rowDbClick(row, column, event) {
      //2021.05.23增加双击行事件
      this.$emit("rowDbClick", { row, column, event });
    },
    rowClick(row, column, event) {
    },rowClick(row, column, event) {
      //2022.02.20增加点击时表格参数判断
      if (!column) {
        return;
      }
      //正在编辑时,禁止出发rowClick事件
  // ===== ä¼˜åŒ–:隔离复选框点击事件,避免冒泡干扰 å¼€å§‹ =====
  // åˆ¤æ–­ç‚¹å‡»ç›®æ ‡æ˜¯å¦æ˜¯å¤é€‰æ¡†ï¼ˆæˆ–复选框所在的单元格/图标)
  const targetEl = event.target;
  const isCheckbox = targetEl.classList.contains('el-checkbox__input') ||
                      targetEl.closest('.el-checkbox__input') ||
                      targetEl.closest('.el-table-column--selection');
  // å¦‚果点击的是复选框区域,直接返回,不执行行选中逻辑
  if (isCheckbox) {
    return;
  }
  // ===== ä¼˜åŒ–:隔离复选框点击事件 ç»“束 =====
  // ===== ä¼˜åŒ–:点击行选中/切换复选框 å¼€å§‹ =====
  // 1. åˆ¤æ–­æ˜¯å¦æ˜¾ç¤ºå¤é€‰æ¡†ï¼ˆck为true),不显示则无需处理
  // 2. ç¼–辑状态下不触发(避免干扰编辑功能)
  if (this.ck && this.edit.rowIndex === -1) {
    // 3. å•选场景(single为true):先清空所有选中项,再强制选中当前行(保持单选逻辑)
    if (this.single) {
      this.$refs.table.clearSelection(); // æ¸…空所有选中
      this.$refs.table.toggleRowSelection(row, true); // å•选场景强制选中当前行
    }
    // 4. å¤šé€‰åœºæ™¯ï¼ˆsingle为false):不传第二个参数,实现切换选中/取消状态
    else {
      this.$refs.table.toggleRowSelection(row); // åˆ‡æ¢çŠ¶æ€ï¼Œæ”¯æŒå–æ¶ˆé€‰ä¸­
    }
  }
  // ===== ä¼˜åŒ–:点击行选中/切换复选框 ç»“束 =====
  // æ­£åœ¨ç¼–辑时,禁止触发rowClick事件
      if (this.edit.rowIndex == -1) {
        this.$emit("rowClick", { row, column, event });
      }
      // ç‚¹å‡»è¡Œäº‹ä»¶(2020.11.07)
      if (!this.doubleEdit) {
        return;
      }
@@ -918,13 +946,49 @@
          this.edit.rowIndex = -1;
        }
        //当正在编辑,且点击到其他行时,在原编辑的行结束编辑后,触发新行的rowClick事件
        //正在编辑时,禁止出发rowClick事件
    //正在编辑时,禁止触发rowClick事件
        if (this.edit.rowIndex == -1) {
          this.$emit("rowClick", { row, column, event });
        }
      }
      this.rowBeginEdit(row, column);
    },
    //   //正在编辑时,禁止出发rowClick事件
    //   if (this.edit.rowIndex == -1) {
    //     this.$emit("rowClick", { row, column, event });
    //   }
    //   // ç‚¹å‡»è¡Œäº‹ä»¶(2020.11.07)
    //   if (!this.doubleEdit) {
    //     return;
    //   }
    //   // ç‚¹å‡»å…¶ä»–行时,如果点击的行与正在编辑的行相同,保持编辑状态
    //   if (this.clickEdit && this.edit.rowIndex != -1) {
    //     if (row.elementIndex == this.edit.rowIndex) {
    //       // ç‚¹å‡»çš„单元格如果不可以编辑,直接结束编辑
    //       // 2020.10.12修复结束编辑时,element table高版本属性获取不到的问题
    //       let _col = this.columns.find((x) => {
    //         return x.field == ((event && event.property) || column.property);
    //       });
    //       if (_col && (!_col.edit || _col.readonly)) {
    //         if (this.rowEndEdit(row, event)) {
    //           this.edit.rowIndex = -1;
    //         }
    //       }
    //       return;
    //     }
    //     if (this.rowEndEdit(row, event && event.property ? event : column)) {
    //       this.edit.rowIndex = -1;
    //     }
    //     //当正在编辑,且点击到其他行时,在原编辑的行结束编辑后,触发新行的rowClick事件
    //     //正在编辑时,禁止出发rowClick事件
    //     if (this.edit.rowIndex == -1) {
    //       this.$emit("rowClick", { row, column, event });
    //     }
    //   }
    //   this.rowBeginEdit(row, column);
    // },
    dowloadFile(file) {
      this.base.dowloadFile(
        file.path,
@@ -1654,6 +1718,7 @@
      return column.edit.type == "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss";
    },
    userSelect(selection, row) {
      console.log("userSelect", selection, row);
      this.selectRows = selection;
      if (!this.single) {
        this.$emit("rowChange", { row, selection });