cuijian
13 小时以前 55abd3e2adf7585fb4597a6227336f0a0550f1ba
src/views/tms/modules/inboundOrder/JSelectToolingModal.vue
@@ -20,13 +20,13 @@
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="中文名称">
                <a-input placeholder="请输入中文名称,支持模糊查询" v-model="queryParam.chineseName"></a-input>
              <a-form-item label="标记">
                <a-input placeholder="请输入标记,支持模糊查询" v-model="queryParam.groupCompanySign"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="型号/图号">
                <a-input placeholder="请输入规格型号,支持模糊查询" v-model="queryParam.toolModel"></a-input>
              <a-form-item label="工具简称">
                <a-input placeholder="请输入工具简称" v-model="queryParam.shortCalled"></a-input>
              </a-form-item>
            </a-col>
@@ -83,25 +83,36 @@
          title: '工具编码',
          align: 'center',
          dataIndex: 'toolCode',
          sorter: true,
        },
        {
          title: '工具名称',
          align: 'center',
          dataIndex: 'chineseName',
          sorter: true,
        },
        {
          title: '工具类型',
          title: '工具简称',
          align: 'center',
          dataIndex: 'applicationTypeName',
          sorter: true,
          dataIndex: 'shortCalled',
        },
        {
          title: '标记',
          align: 'center',
          dataIndex: 'groupCompanySign',
        },
        {
          title: '库位号',
          align: 'center',
          dataIndex: 'positionCode',
        },
        {
          title: '型号/图号',
          align: 'center',
          dataIndex: 'toolModel',
          sorter: true,
        },
        {
          title: '工具类型',
          align: 'center',
          dataIndex: 'applicationTypeName',
        },
      ],
      selectedRowKeys: [],
@@ -109,6 +120,7 @@
      scrollTrigger: {},
      dataSource: [],
      selectionRows: [],
      allSelectionRows: [],
      title: '根据查询结果选择工具',
      ipagination: {
        current: 1,
@@ -130,7 +142,7 @@
      loading: false,
      url: {
        // list: '/base/tooling/list',
         list: '/tms/baseTools/paraCommonToolList',
         list: '/tms/baseTools/selectToolList',
      },
    }
  },
@@ -138,7 +150,10 @@
    rowSelection() {
      return {
        type: 'checkbox',
        selectedRowKeys: this.selectedRowKeys,
        onChange: (selectedRowKeys, selectedRows) => {
          //更新跨页选中状态
          this.updateSelection(selectedRows);
          this.selectedRowKeys = selectedRowKeys
          this.onSelectChange(selectedRows)
        },
@@ -154,6 +169,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 +213,9 @@
    },
    showModal(oldSlelectRows) {
      this.oldSlelectRows = oldSlelectRows
       //重置跨页选择状态
      this.allSelectionRows = [];
      this.selectedRowKeys = [];
      this.visible = true
      this.loadData(1)
    },
@@ -222,7 +256,7 @@
      this.loadData()
    },
    handleSubmit() {
      this.$bus.$emit('selectionRows', this.selectionRows)
      this.$bus.$emit('selectionRows', this.allSelectionRows);
      this.searchReset(0)
      this.close()
    },