zxl
2025-05-23 5d5b0f7ab0f34019e11901ddcd59cd8b51ea9ff9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export default {
  data() {
    return {
      prefixCls: 'zk-table',
    };
  },
  methods: {
    validateType(type, validTypes, funcName, isReturn = true) {
      if (validTypes.indexOf(type) < 0) throw new Error(`${funcName}'s type must is ${validTypes.join(' or ')}.`);
      if (isReturn) {
        const certainType = {};
        validTypes.forEach((item) => {
          certainType[item] = item === type;
        });
        return certainType;
      }
      return true;
    },
    isExpandCell(table, columnIndex) {
      return table.expandType && (
        (table.showIndex && columnIndex === 1) ||
        (!table.showIndex && columnIndex === 0)
      );
    },
    isSelectionCell(table, columnIndex) {
      return table.selectable && (
        (table.showIndex && table.expandType && columnIndex === 2) ||
        (!table.showIndex && table.expandType && columnIndex === 1) ||
        (table.showIndex && !table.expandType && columnIndex === 1) ||
        (!table.showIndex && !table.expandType && columnIndex === 0)
      );
    },
  },
};