src/views/tms/modules/inboundOrder/JSelectToolingModal.vue
@@ -83,25 +83,26 @@
          title: '工具编码',
          align: 'center',
          dataIndex: 'toolCode',
          sorter: true,
        },
        {
          title: '工具名称',
          align: 'center',
          dataIndex: 'chineseName',
          sorter: true,
        },
        {
          title: '工具类型',
          title: '库位号',
          align: 'center',
          dataIndex: 'applicationTypeName',
          sorter: true,
          dataIndex: 'positionCode',
        },
        {
          title: '型号/图号',
          align: 'center',
          dataIndex: 'toolModel',
          sorter: true,
        },
        {
          title: '工具类型',
          align: 'center',
          dataIndex: 'applicationTypeName',
        },
      ],
      selectedRowKeys: [],
@@ -109,6 +110,7 @@
      scrollTrigger: {},
      dataSource: [],
      selectionRows: [],
      allSelectionRows: [],
      title: '根据查询结果选择工具',
      ipagination: {
        current: 1,
@@ -138,7 +140,10 @@
    rowSelection() {
      return {
        type: 'checkbox',
        selectedRowKeys: this.selectedRowKeys,
        onChange: (selectedRowKeys, selectedRows) => {
          //更新跨页选中状态
          this.updateSelection(selectedRows);
          this.selectedRowKeys = selectedRowKeys
          this.onSelectChange(selectedRows)
        },
@@ -154,6 +159,22 @@
  watch: {},
  created() {},
  methods: {
    // 更新跨页选中状态
    updateSelection(selectedRows) {
      // 获取当前页所有行的ID
      const currentPageIds = this.dataSource.map(item => item.id);
      // 1. 移除当前页之前的选择
      this.allSelectionRows = this.allSelectionRows.filter(
        row => !currentPageIds.includes(row.id)
      );
      // 2. 添加当前页新选择的行
      this.allSelectionRows = [...this.allSelectionRows, ...selectedRows];
      // 3. 更新选中keys
      this.selectedRowKeys = this.allSelectionRows.map(row => row.id);
    },
    async loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1
@@ -182,6 +203,9 @@
    },
    showModal(oldSlelectRows) {
      this.oldSlelectRows = oldSlelectRows
       //重置跨页选择状态
      this.allSelectionRows = [];
      this.selectedRowKeys = [];
      this.visible = true
      this.loadData(1)
    },
@@ -222,7 +246,7 @@
      this.loadData()
    },
    handleSubmit() {
      this.$bus.$emit('selectionRows', this.selectionRows)
      this.$bus.$emit('selectionRows', this.allSelectionRows);
      this.searchReset(0)
      this.close()
    },