vue-antdesign子表格的全选与取消

废话不多说,直接上代码

 

          :columns="outColumns"

          :data-source="data"

          :expandedRowKeys="expandedRowKeys"

          :rowKey="data => data.tradeId"

          class="tdNowrap"

          :scroll="{ x: 'max-content' }"

          :row-selection="{ selectedRowKeys: selectedRowKeysFather, onChange: onChangeFather, onSelect: onSelectFather, onSelectAll: onSelectAllFather }"

          :pagination="false"

          @expand="handleExpand"

          bordered

        >

          

            slot="yieldType"

            slot-scope="text"

          >

            {{text?(text==2 ? '行权' : '到期'):''}}

          

          

            v-if='roleshow("split")'

            slot="operation"

            slot-scope="text, record"

          >

            

              v-if="record.splitResultVos.length>0"

              class="operatSty"

              @click='split(record)'

            >修改

            

              v-else

              class="operatSty"

              @click='split(record)'

            >分户

          

          

            slot="expandedRowRender"

            slot-scope="record"

            class="innerTable"

            v-if="record.splitResultVos.length&&record.splitResultVos.length"

            :columns="innerColumns"

            :data-source="record.splitResultVos"

            :rowKey="record => record.splitId"

            :pagination="false"

            :rowClassName="tableRowClass"

            :row-selection="{ selectedRowKeys: selectedRowKeysSon, onChange: onChangeSon, onSelect: onSelectSon, onSelectAll: onSelectAllSon }"

            bordered

          >

          

        
















    // 复选框 子

    onChangeSon(selectedRowKeys, selectedRows) {

      this.selectedRowKeysSon = selectedRowKeys;

      const data = this.selectedSonData.concat(selectedRows);

      const newArr = [];

      const obj = {};

      selectedRowKeys.map(key => {

        data.map(item => {

          if (!obj[item.splitId] && key === item.splitId) {

            item.checked = true;

            newArr.push(item);

            obj[item.splitId] = 1

          }

        })

      })

      this.selectedSonData = newArr

      console.log("selectedRowKeys========", selectedRowKeys, 'newArr', newArr, 'selectedSonData', this.selectedSonData)

    },

你可能感兴趣的:(vue-antdesign子表格的全选与取消)