Browse Source

表格多选 bug修复

chenrui 3 years ago
parent
commit
eb2bacf25f

+ 3 - 3
src/components/MultiTab/MultiTab.vue

@@ -152,7 +152,7 @@ export default {
   watch: {
     '$route': function (newVal, oldVal) {
       if (newVal.name == oldVal.name) { return }
-      console.log(newVal, oldVal, this.pages)
+      // console.log(newVal, oldVal, this.pages)
       // 解决页面地址相同参数不同时打开多个页签问题(例 详情页id或sn不同时)
       const index = this.tabsList.indexOf(newVal.name)
 
@@ -181,7 +181,7 @@ export default {
       const oxt = oldMenu.meta.replaceTab
 
       if (index < 0) { // 不存在
-        console.log(1, hasChildren, '不存在')
+        // console.log(1, hasChildren, '不存在')
         if ((na || nb || nc || nxt || oa || ob || oc || oxt) && hasChildren) {
           // 替换当前页签
           this.replaceTab(newVal, oldMenu)
@@ -211,7 +211,7 @@ export default {
           }
         }
       } else { // 已存在
-        console.log(1, nxt, '已存在')
+        // console.log(1, nxt, '已存在')
         this.pages.splice(index, 1, newVal)
         this.tabsList.splice(index, 1, newVal.name)
         this.$store.state.app.isNewTab = !!nxt

+ 78 - 18
src/components/Table/index.js

@@ -9,7 +9,8 @@ export default {
       selectedRowKeys: [],
       localLoading: false,
       localDataSource: [],
-      localPagination: Object.assign({}, this.pagination)
+      localPagination: Object.assign({}, this.pagination),
+      isSucceed: true //  是否请求成功
     }
   },
   props: Object.assign({}, T.props, {
@@ -17,6 +18,10 @@ export default {
       type: [String, Function],
       default: 'key'
     },
+    rowKeyName: { // 多选时,唯一标识键名
+      type: String,
+      default: 'id'
+    },
     rowClassName: {
       type: [String, Function],
       default: ''
@@ -55,11 +60,6 @@ export default {
       type: Object,
       default: null
     },
-    /** @Deprecated */
-    showAlertInfo: {
-      type: Boolean,
-      default: false
-    },
     showPagination: {
       type: String | Boolean,
       default: 'auto'
@@ -147,6 +147,7 @@ export default {
     },
     // 重置表格为空
     clearTable () {
+      this.localLoading = false
       this.localDataSource = []
       this.localPagination = Object.assign({}, {
         current: 1, pageSize: this.pageSize, total: 0
@@ -183,8 +184,13 @@ export default {
       // eslint-disable-next-line
       if ((typeof result === 'object' || typeof result === 'function') && typeof result.then === 'function') {
         result.then(r => {
-          const list = r.list || r.data || r
+          // const list = r.list || r.data || r
+          let list = []
+          if (r) {
+            list = r.list || r.data || r
+          }
           // console.log(r,'rrrrrrrrrr')
+          this.isSucceed = !!r
           this.localPagination = this.showPagination && Object.assign({}, this.localPagination, {
             current: r.pageNo, // 返回结果中的当前分页数
             total: Number(r.count), // 返回结果中的总记录数
@@ -210,6 +216,8 @@ export default {
           }
           this.localDataSource = list // 返回结果中的数组数据
           this.localLoading = false
+        }).catch(err => {
+          this.clearTable()
         })
       }
     },
@@ -231,26 +239,72 @@ export default {
      * @param selectedRows
      */
     updateSelect (selectedRowKeys, selectedRows) {
-      this.selectedRows = selectedRows
-      this.selectedRowKeys = selectedRowKeys
       const list = this.needTotalList
       this.needTotalList = list.map(item => {
         return {
           ...item,
-          total: selectedRows.reduce((sum, val) => {
+          total: this.selectedRows.reduce((sum, val) => {
             const total = sum + parseInt(get(val, item.dataIndex))
             return isNaN(total) ? 0 : total
           }, 0)
         }
       })
+      const obj = {
+        selectedRowKeys: this.selectedRowKeys,
+        selectedRows: this.selectedRows
+      }
+      this.$emit('rowSelection', obj)
+    },
+    onSelectChange (record, selected, selectedRows, nativeEvent) {
+      if (selected) { //  选择
+        this.selectedRows.push(record)
+      } else { //  取消
+        const selectedRowsArr = []
+        this.selectedRows.map(item => {
+          if (this.selectedRowKeys.indexOf(item[this.rowKeyName]) != -1) {
+            selectedRowsArr.push(item)
+          }
+        })
+        this.selectedRows = selectedRowsArr
+      }
+      this.updateSelect()
+    },
+    // 本页全选/取消全选
+    onSelectAllChange (selected, selectedRows, changeRows) {
+      const _this = this
+      if (selected) { //  选择
+        this.selectedRows = [...this.selectedRows, ...changeRows]
+      } else { //  取消
+        const arrId = []
+        this.selectedRows.map((item, index) => {
+          this.selectedRows.map((subItem, ind) => {
+            if (item[this.rowKeyName] == subItem[this.rowKeyName]) {
+              arrId.push(index)
+            }
+          })
+        })
+        arrId.map((item, index) => {
+          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
+        })
+      }
+      this.updateSelect()
+    },
+    // 设置 table 已选中项
+    setTableSelected (selectedRowKeys, selectedRows) {
+      this.selectedRows = selectedRows
+      this.selectedRowKeys = selectedRowKeys
+      this.updateSelect()
     },
     /**
      * 清空 table 已选中项
      */
     clearSelected () {
       if (this.rowSelection) {
-        this.rowSelection.onChange([], [])
-        this.updateSelect([], [])
+        // this.rowSelection.onChange([], [])
+        // this.updateSelect([], [])
+        this.selectedRows = []
+        this.selectedRowKeys = []
+        this.updateSelect()
       }
     },
     /**
@@ -299,7 +353,6 @@ export default {
     const props = {}
     const localKeys = Object.keys(this.$data)
     const showAlert = (typeof this.alert === 'object' && this.alert !== null && this.alert.show) && typeof this.rowSelection.selectedRowKeys !== 'undefined' || this.alert
-
     Object.keys(T.props).forEach(k => {
       const localKey = `local${k.substring(0, 1).toUpperCase()}${k.substring(1)}`
       if (localKeys.includes(localKey)) {
@@ -307,16 +360,19 @@ export default {
         return props[k]
       }
       if (k === 'rowSelection') {
-        if (showAlert && this.rowSelection) {
+        if (this.rowSelection) {
           // 如果需要使用alert,则重新绑定 rowSelection 事件
-          // console.log('this.rowSelection', this.rowSelection)
           props[k] = {
             ...this.rowSelection,
-            selectedRows: this.selectedRows,
             selectedRowKeys: this.selectedRowKeys,
             onChange: (selectedRowKeys, selectedRows) => {
-              this.updateSelect(selectedRowKeys, selectedRows)
-              typeof this[k].onChange !== 'undefined' && this[k].onChange(selectedRowKeys, selectedRows)
+              this.selectedRowKeys = selectedRowKeys
+            },
+            onSelect: (record, selected, selectedRows, nativeEvent) => {
+              this.onSelectChange(record, selected, selectedRows, nativeEvent)
+            },
+            onSelectAll: (selected, selectedRows, changeRows) => {
+              this.onSelectAllChange(selected, selectedRows, changeRows)
             }
           }
           return props[k]
@@ -329,6 +385,10 @@ export default {
       this[k] && (props[k] = this[k])
       return props[k]
     })
+    if (!this.isSucceed) { // 请求失败
+      props['locale'] = { emptyText: '网络异常,请点击按钮刷新' }
+    }
+    // isSucceed
     const table = (
       <a-table {...{ props, scopedSlots: { ...this.$scopedSlots } }} onChange={this.loadData}>
         { Object.keys(this.$slots).map(name => (<template slot={name}>{this.$slots[name]}</template>)) }

+ 90 - 83
src/views/common/chooseCustomerModal.vue

@@ -8,80 +8,84 @@
     v-model="isShow"
     @cancle="isShow=false"
     :width="900">
-    <div class="chooseCustomer-con">
-      <!-- 搜索条件 -->
-      <div class="table-page-search-wrapper">
-        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-          <a-row :gutter="15">
-            <a-col :md="6" :sm="24">
-              <a-form-item label="客户名称">
-                <a-input id="chooseCustomer-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入客户名称"/>
-              </a-form-item>
-            </a-col>
-            <a-col :md="12" :sm="24">
-              <a-row>
-                <a-form-item label="地区">
-                  <a-col span="7">
-                    <a-form-item prop="provinceSn" style="margin: 0;">
-                      <a-select v-model="queryParam.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
-                        <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <a-col span="7" offset="1">
-                    <a-form-item prop="citySn" style="margin: 0;">
-                      <a-select v-model="queryParam.citySn" allowClear @change="getAreaList" placeholder="请选择市">
-                        <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <a-col span="7" offset="1">
-                    <a-form-item prop="districtSn" style="margin: 0;">
-                      <a-select v-model="queryParam.districtSn" allowClear placeholder="请选择区/县">
-                        <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="chooseCustomer-con">
+        <!-- 搜索条件 -->
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="客户名称">
+                  <a-input id="chooseCustomer-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入客户名称"/>
                 </a-form-item>
-              </a-row>
-            </a-col>
-            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionRulesList-refresh">查询</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="promotionRulesList-reset">重置</a-button>
-            </a-col>
-          </a-row>
-        </a-form>
+              </a-col>
+              <a-col :md="12" :sm="24">
+                <a-row>
+                  <a-form-item label="地区">
+                    <a-col span="7">
+                      <a-form-item prop="provinceSn" style="margin: 0;">
+                        <a-select v-model="queryParam.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
+                          <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-item>
+                    </a-col>
+                    <a-col span="7" offset="1">
+                      <a-form-item prop="citySn" style="margin: 0;">
+                        <a-select v-model="queryParam.citySn" allowClear @change="getAreaList" placeholder="请选择市">
+                          <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-item>
+                    </a-col>
+                    <a-col span="7" offset="1">
+                      <a-form-item prop="districtSn" style="margin: 0;">
+                        <a-select v-model="queryParam.districtSn" allowClear placeholder="请选择区/县">
+                          <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-item>
+                    </a-col>
+                  </a-form-item>
+                </a-row>
+              </a-col>
+              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionRulesList-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="promotionRulesList-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <p style="font-weight: bold;">当前已选:{{ rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length }}个</p>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.dealerSn"
+          rowKeyName="dealerSn"
+          :row-selection="{ columnWidth: 40 }"
+          @rowSelection="rowSelectionFun"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          bordered>
+        </s-table>
+        <!-- 按钮 -->
+        <div class="btn-con">
+          <a-button
+            type="primary"
+            id="chooseCustomer-submit"
+            size="large"
+            class="button-primary"
+            style="padding: 0 60px;"
+            @click="handleSubmit">确定</a-button>
+          <a-button
+            id="chooseCustomer-cancel"
+            size="large"
+            class="button-cancel"
+            @click="isShow=false"
+            style="padding: 0 60px;margin-left: 15px;">取消</a-button>
+        </div>
       </div>
-      <p style="font-weight: bold;">当前已选:{{ selectedRowKeys.length }}个</p>
-      <!-- 列表 -->
-      <s-table
-        class="sTable"
-        ref="table"
-        size="small"
-        :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
-        :rowKey="(record) => record.dealerSn"
-        :columns="columns"
-        :data="loadData"
-        :defaultLoadData="false"
-        bordered>
-      </s-table>
-      <!-- 按钮 -->
-      <div class="btn-con">
-        <a-button
-          type="primary"
-          id="chooseCustomer-submit"
-          size="large"
-          class="button-primary"
-          style="padding: 0 60px;"
-          @click="handleSubmit">确定</a-button>
-        <a-button
-          id="chooseCustomer-cancel"
-          size="large"
-          class="button-cancel"
-          @click="isShow=false"
-          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
-      </div>
-    </div>
+    </a-spin>
   </a-modal>
 </template>
 
@@ -106,6 +110,7 @@ export default {
   },
   data () {
     return {
+      spinning: false,
       isShow: this.openModal, //  是否打开弹框
       disabled: false, //  查询、重置按钮是否可操作
       queryParam: {
@@ -121,6 +126,7 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
+        this.spinning = true
         return dealerQueryList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
@@ -131,16 +137,21 @@ export default {
             }
             this.disabled = false
           }
+          this.spinning = false
           return data
         })
       },
-      selectedRowKeys: [],
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
-      addrDistrictList: [] //  区下拉
+      addrDistrictList: [], //  区下拉
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     //  重置
     resetSearchForm () {
       this.resetData()
@@ -156,17 +167,13 @@ export default {
     },
     //  确定
     handleSubmit () {
-      if (this.selectedRowKeys.length < 1) {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         this.$message.warning('请在列表勾选后再进行操作!')
         return
       }
-      this.$emit('ok', this.selectedRowKeys)
+      this.$emit('ok', this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys)
       this.isShow = false
     },
-    onSelectChange (selectedRowKeys, selectedRows) {
-      console.log('selectedRowKeys changed: ', selectedRowKeys, selectedRows)
-      this.selectedRowKeys = selectedRowKeys
-    },
     // 获取城市列表
     getCityList (val) {
       this.addrCityList = []
@@ -225,14 +232,14 @@ export default {
         this.$emit('close')
         this.resetData()
       } else {
-        this.selectedRowKeys = this.chooseCust
         if (this.addrProvinceList.length == 0) {
           this.getArea('province')
         }
         const _this = this
-        setTimeout(() => {
+        this.$nextTick(() => { // 页面渲染完成后的回调
           _this.$refs.table.refresh(true)
-        }, 200)
+          _this.$refs.table.setTableSelected(_this.chooseCust, []) // 设置表格选中项
+        })
       }
     }
   }

+ 136 - 205
src/views/common/chooseProductsModal.vue

@@ -8,109 +8,95 @@
     v-model="isShow"
     @cancle="isShow=false"
     :width="900">
-    <div class="products-con">
-      <div>
-        <!-- 搜索条件 -->
-        <div class="table-page-search-wrapper">
-          <a-form-model
-            ref="ruleForm"
-            class="form-model-con"
-            layout="inline"
-            :model="queryParam"
-            :rules="rules"
-            @keyup.enter.native="getProductList(1)"
-            :label-col="formItemLayout.labelCol"
-            :wrapper-col="formItemLayout.wrapperCol">
-            <a-row :gutter="15">
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="产品编码" prop="code">
-                  <a-input id="chooseProducts-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="产品品牌" :prop="type=='dealership'?'productBrandSn':''">
-                  <a-select
-                    placeholder="请选择产品品牌"
-                    id="chooseProducts-productBrandSn"
-                    allowClear
-                    v-model="queryParam.productBrandSn"
-                    :showSearch="true"
-                    option-filter-prop="children"
-                    :filter-option="filterOption">
-                    <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
-                  </a-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="产品分类" :prop="type=='dealership'?'productType':''">
-                  <a-cascader
-                    @change="changeProductType"
-                    change-on-select
-                    v-model="queryParam.productType"
-                    expand-trigger="hover"
-                    :options="productTypeList"
-                    :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
-                    id="chooseProducts-productType"
-                    placeholder="请选择产品分类"
-                    allowClear />
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chooseProducts-refresh">查询</a-button>
-                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
-              </a-col>
-            </a-row>
-          </a-form-model></a-form>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="products-con">
+        <div>
+          <!-- 搜索条件 -->
+          <div class="table-page-search-wrapper">
+            <a-form-model
+              ref="ruleForm"
+              class="form-model-con"
+              layout="inline"
+              :model="queryParam"
+              :rules="rules"
+              @keyup.enter.native="handleSearch"
+              :label-col="formItemLayout.labelCol"
+              :wrapper-col="formItemLayout.wrapperCol">
+              <a-row :gutter="15">
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="产品编码" prop="code">
+                    <a-input id="chooseProducts-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="产品品牌" :prop="type=='dealership'?'productBrandSn':''">
+                    <a-select
+                      placeholder="请选择产品品牌"
+                      id="chooseProducts-productBrandSn"
+                      allowClear
+                      v-model="queryParam.productBrandSn"
+                      :showSearch="true"
+                      option-filter-prop="children"
+                      :filter-option="filterOption">
+                      <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+                    </a-select>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="产品分类" :prop="type=='dealership'?'productType':''">
+                    <a-cascader
+                      @change="changeProductType"
+                      change-on-select
+                      v-model="queryParam.productType"
+                      expand-trigger="hover"
+                      :options="productTypeList"
+                      :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+                      id="chooseProducts-productType"
+                      placeholder="请选择产品分类"
+                      allowClear />
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                  <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chooseProducts-refresh">查询</a-button>
+                  <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
+                </a-col>
+              </a-row>
+            </a-form-model></a-form>
+          </div>
+          <p style="font-weight: bold;">当前已选:{{ rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length }}个</p>
+          <!-- 列表 -->
+          <s-table
+            class="sTable"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.productSn"
+            rowKeyName="productSn"
+            :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: (this.type == 'supplier') && (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.indexOf(record.productSn) > -1) }}) }"
+            @rowSelection="rowSelectionFun"
+            :columns="columns"
+            :data="loadData"
+            :defaultLoadData="false"
+            bordered>
+          </s-table>
+        </div>
+        <!-- 按钮 -->
+        <div class="btn-con">
+          <a-button
+            type="primary"
+            id="chooseProducts-save"
+            size="large"
+            class="button-primary"
+            @click="handleSave"
+            style="padding: 0 60px;">保存</a-button>
+          <a-button
+            id="chooseProducts-cancel"
+            size="large"
+            class="button-cancel"
+            @click="isShow=false"
+            style="padding: 0 60px;margin-left: 15px;">取消</a-button>
         </div>
-        <p style="font-weight: bold;">当前已选:{{ selectedRowKeys.length }}个</p>
-        <!-- 列表 -->
-        <a-table
-          class="sTable"
-          ref="table"
-          size="small"
-          :rowKey="(record) => record.productSn"
-          :row-selection="{
-            selectedRowKeys: selectedRowKeys,
-            onChange: onChange,
-            onSelect: onSelectChange,
-            onSelectAll: onSelectAllChange,
-            getCheckboxProps:record =>({props: {
-              disabled: (this.type == 'supplier') && (this.selectedRowKeys.indexOf(record.productSn) > -1)
-            }})
-          }"
-          :data-source="loadData"
-          :columns="columns"
-          :pagination="false"
-          :loading="loading"
-          :scroll="{ y: 450 }"
-          bordered>
-        </a-table>
-        <!-- 分页 -->
-        <tablePagination
-          ref="tablePagination"
-          :total="paginationProps.total"
-          :current="paginationProps.current"
-          :pageSize="paginationProps.pageSize"
-          @changePageSize="changePageSize"
-          @changePage="changePage" />
-      </div>
-      <!-- 按钮 -->
-      <div class="btn-con">
-        <a-button
-          type="primary"
-          id="chooseProducts-save"
-          size="large"
-          class="button-primary"
-          @click="handleSave"
-          style="padding: 0 60px;">保存</a-button>
-        <a-button
-          id="chooseProducts-cancel"
-          size="large"
-          class="button-cancel"
-          @click="isShow=false"
-          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
       </div>
-    </div>
+    </a-spin>
   </a-modal>
 </template>
 
@@ -146,6 +132,7 @@ export default {
   },
   data () {
     return {
+      spinning: false,
       isShow: this.openModal, //  是否打开弹框
       formItemLayout: {
         labelCol: { span: 4 },
@@ -170,19 +157,42 @@ export default {
         { title: '产品编码', dataIndex: 'code', align: 'center' },
         { title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } }
       ],
-      loadData: [],
-      paginationProps: {
-        total: 0, //  分页总条数
-        current: 1,
-        pageSize: 20
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        let url = productPricedList //  获取定过价的产品
+        if (this.type == 'supplier') { //  供应商增加产品
+          url = productPricingList //  获取定价产品
+        }
+        const params = Object.assign(parameter, this.queryParam)
+        if (this.type != 'supplier' && this.type != 'dealership') { //  促销
+          params.onlineFalg = 1
+        }
+        return url(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
       },
       productBrandList: [], //  品牌下拉数据
       productTypeList: [], //  分类下拉数据
-      selectedRowKeys: [],
-      selectedRows: []
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     // 查询
     handleSearch () {
       const _this = this
@@ -221,11 +231,11 @@ export default {
             }
             dealerScopeValidProduct(params).then(res => {
               if (res.status == 200) {
-                _this.getProductList(1)
+                _this.$refs.table.refresh(true)
               }
             })
           } else {
-            _this.getProductList(1)
+            _this.$refs.table.refresh(true)
           }
         } else {
           return false
@@ -240,116 +250,32 @@ export default {
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
       this.queryParam.productType = []
-      this.paginationProps.total = 0
-      this.paginationProps.current = 1
-      this.paginationProps.pageSize = 20
     },
     //  重置
     resetSearchForm () {
       this.resetData()
-      this.loadData = []
-      this.disabled = false
+      this.$refs.table.clearTable()
     },
     // 保存
     handleSave () {
       const _this = this
-      if (this.selectedRowKeys.length < 1) {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         this.$message.warning('请在列表勾选后再进行操作!')
         return
       }
       if (this.type == 'supplier') { //  供应商增加产品
         const arr = []
-        this.selectedRowKeys.map(item => {
+        this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.map(item => {
           if (_this.chooseData.indexOf(item) == -1) {
             arr.push(item)
           }
         })
         this.$emit('ok', arr)
       } else {
-        this.$emit('ok', this.selectedRows)
+        this.$emit('ok', this.rowSelectionInfo && this.rowSelectionInfo.selectedRows)
       }
       this.isShow = false
     },
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (this.type != 'supplier') { //  供应商增加产品
-        if (selected) { //  选择
-          this.selectedRows.push(record)
-        } else { //  取消
-          this.selectedRows = selectedRows
-        }
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (this.type != 'supplier') { //  供应商增加产品
-        if (selected) { //  选择
-          this.selectedRows = [...this.selectedRows, ...changeRows]
-        } else { //  取消
-          const arrId = []
-          this.selectedRows.map((item, index) => {
-            this.selectedRows.map((subItem, ind) => {
-              if (item.productSn == subItem.productSn) {
-                arrId.push(index)
-              }
-            })
-          })
-          arrId.map((item, index) => {
-            _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-          })
-        }
-      }
-    },
-    // 产品列表
-    getProductList (pageNo) {
-      this.paginationProps.current = pageNo || this.paginationProps.current
-      this.disabled = true
-      const params = {
-        pageNo: this.paginationProps.current,
-        pageSize: this.paginationProps.pageSize
-      }
-      this.loading = true
-      let url = productPricedList //  获取定过价的产品
-      if (this.type == 'supplier') { //  供应商增加产品
-        url = productPricingList //  获取定价产品
-      }
-      if (this.type != 'supplier' && this.type != 'dealership') { //  促销
-        params.onlineFalg = 1
-      }
-      url(Object.assign(params, this.queryParam)).then(res => {
-        this.loading = false
-        if (res.status == 200) {
-          const data = res.data
-          this.paginationProps.total = Number(res.data.count) || 0
-          this.paginationProps.current = data.pageNo
-          const no = (data.pageNo - 1) * data.pageSize
-          for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = no + i + 1
-          }
-          this.loadData = data.list
-          this.disabled = false
-        } else {
-          this.paginationProps.total = 0
-          this.paginationProps.current = 1
-          this.paginationProps.pageSize = 20
-          this.loadData = []
-        }
-      })
-    },
-    //  已选产品 分页  一页多少条change
-    changePageSize (current, pageSize) {
-      this.paginationProps.current = current
-      this.paginationProps.pageSize = pageSize
-      this.getProductList()
-    },
-    //  已选产品 分页 页码change
-    changePage (current) {
-      this.paginationProps.current = current
-      this.getProductList()
-    },
     //  产品分类  change
     changeProductType (val, opt) {
       this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
@@ -401,20 +327,25 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.loadData = []
-        this.disabled = false
+        this.$refs.table.clearTable()
         this.resetData()
       } else {
+        const _this = this
+        let selectedRows = []
+        let selectedRowKeys = []
         if (this.type == 'supplier') { //  供应商增加产品
-          this.selectedRows = []
-          this.selectedRowKeys = this.chooseData
+          selectedRows = []
+          selectedRowKeys = this.chooseData
         } else {
-          this.selectedRows = this.chooseData
-          this.selectedRowKeys = []
+          selectedRows = this.chooseData
+          selectedRowKeys = []
           this.chooseData.map(item => {
-            this.selectedRowKeys.push(item.goodsSn)
+            selectedRowKeys.push(item.goodsSn)
           })
         }
+        this.$nextTick(() => { // 页面渲染完成后的回调
+          _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
+        })
         if (this.productBrandList.length == 0) {
           this.getProductBrand()
         }

+ 101 - 185
src/views/common/chooseSupplierModal.vue

@@ -8,93 +8,82 @@
     v-model="isShow"
     @cancle="isShow=false"
     :width="900">
-    <div class="products-con">
-      <div>
-        <!-- 搜索条件 -->
-        <div class="table-page-search-wrapper">
-          <a-form-model
-            ref="ruleForm"
-            class="form-model-con"
-            layout="inline"
-            :model="queryParam"
-            :rules="rules"
-            @keyup.enter.native="getSupplierList(1)"
-            :label-col="formItemLayout.labelCol"
-            :wrapper-col="formItemLayout.wrapperCol">
-            <a-row :gutter="15">
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="供应商名称">
-                  <a-input id="chooseSupplier-supplierName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="状态">
-                  <v-select code="ENABLE_FLAG" id="chooseSupplier-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chooseSupplier-refresh">查询</a-button>
-                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseSupplier-reset">重置</a-button>
-              </a-col>
-            </a-row>
-          </a-form-model></a-form>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="products-con">
+        <div>
+          <!-- 搜索条件 -->
+          <div class="table-page-search-wrapper">
+            <a-form-model
+              ref="ruleForm"
+              class="form-model-con"
+              layout="inline"
+              :model="queryParam"
+              :rules="rules"
+              @keyup.enter.native="$refs.table.refresh(true)"
+              :label-col="formItemLayout.labelCol"
+              :wrapper-col="formItemLayout.wrapperCol">
+              <a-row :gutter="15">
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="供应商名称">
+                    <a-input id="chooseSupplier-supplierName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="状态">
+                    <v-select code="ENABLE_FLAG" id="chooseSupplier-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                  <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chooseSupplier-refresh">查询</a-button>
+                  <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseSupplier-reset">重置</a-button>
+                </a-col>
+              </a-row>
+            </a-form-model>
+          </div>
+          <p style="font-weight: bold;">当前已选:{{ rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length }}个</p>
+          <!-- 列表 -->
+          <s-table
+            class="sTable"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.supplierSn"
+            rowKeyName="supplierSn"
+            :row-selection="{ columnWidth: 40 }"
+            @rowSelection="rowSelectionFun"
+            :columns="columns"
+            :data="loadData"
+            :scroll="{ y: 450 }"
+            :defaultLoadData="false"
+            bordered>
+          </s-table>
+        </div>
+        <!-- 按钮 -->
+        <div class="btn-con">
+          <a-button
+            type="primary"
+            id="chooseSupplier-save"
+            size="large"
+            class="button-primary"
+            @click="handleSave"
+            style="padding: 0 60px;">保存</a-button>
+          <a-button
+            id="chooseSupplier-cancel"
+            size="large"
+            class="button-cancel"
+            @click="isShow=false"
+            style="padding: 0 60px;margin-left: 15px;">取消</a-button>
         </div>
-        <p style="font-weight: bold;">当前已选:{{ selectedRowKeys.length }}个</p>
-        <!-- 列表 -->
-        <a-table
-          class="sTable"
-          ref="table"
-          size="small"
-          :rowKey="(record) => record.supplierSn"
-          :row-selection="{
-            selectedRowKeys: selectedRowKeys,
-            onChange: onChange,
-            onSelect: onSelectChange,
-            onSelectAll: onSelectAllChange
-          }"
-          :data-source="loadData"
-          :columns="columns"
-          :pagination="false"
-          :loading="loading"
-          :scroll="{ y: 450 }"
-          bordered>
-        </a-table>
-        <!-- 分页 -->
-        <tablePagination
-          ref="tablePagination"
-          :total="paginationProps.total"
-          :current="paginationProps.current"
-          :pageSize="paginationProps.pageSize"
-          @changePageSize="changePageSize"
-          @changePage="changePage" />
-      </div>
-      <!-- 按钮 -->
-      <div class="btn-con">
-        <a-button
-          type="primary"
-          id="chooseSupplier-save"
-          size="large"
-          class="button-primary"
-          @click="handleSave"
-          style="padding: 0 60px;">保存</a-button>
-        <a-button
-          id="chooseSupplier-cancel"
-          size="large"
-          class="button-cancel"
-          @click="isShow=false"
-          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
       </div>
-    </div>
+    </a-spin>
   </a-modal>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import tablePagination from '@/views/common/tablePagination.vue'
 import { supplierList } from '@/api/supplier'
 export default {
   name: 'ChooseSupplierModal',
-  components: { STable, VSelect, tablePagination },
+  components: { STable, VSelect },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -113,6 +102,7 @@ export default {
   },
   data () {
     return {
+      spinning: false,
       isShow: this.openModal, //  是否打开弹框
       formItemLayout: {
         labelCol: { span: 4 },
@@ -124,126 +114,51 @@ export default {
       },
       rules: {},
       disabled: false, //  查询、重置按钮是否可操作
-      loading: false, //  表格加载中
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '供应商名称', dataIndex: 'supplierName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
         { title: '状态', dataIndex: 'enableFlagDictValue', align: 'center', customRender: function (text) { return text || '--' } }
       ],
-      loadData: [],
-      paginationProps: {
-        total: 0, //  分页总条数
-        current: 1,
-        pageSize: 20
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return supplierList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
       },
-      selectedRowKeys: [],
-      selectedRows: []
+      rowSelectionInfo: null
     }
   },
   methods: {
-    // 查询
-    handleSearch () {
-      const _this = this
-      _this.$refs.ruleForm.validate(valid => {
-        if (valid) {
-          _this.getSupplierList(1)
-        } else {
-          return false
-        }
-      })
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
     },
-    // 重置数据
-    resetData () {
+    // 重置
+    resetSearchForm () {
       this.queryParam.supplierName = ''
       this.queryParam.enabledFlag = undefined
-      this.paginationProps.total = 0
-      this.paginationProps.total = 0
-      this.paginationProps.current = 1
-      this.paginationProps.pageSize = 20
-    },
-    //  重置
-    resetSearchForm () {
-      this.resetData()
-      this.loadData = []
-      this.disabled = false
+      this.$refs.table.refresh(true)
     },
     // 保存
     handleSave () {
-      if (this.selectedRowKeys.length < 1) {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         this.$message.warning('请在列表勾选后再进行操作!')
         return
       }
-      this.$emit('ok', this.selectedRows)
+      this.$emit('ok', this.rowSelectionInfo && this.rowSelectionInfo.selectedRows)
       this.isShow = false
-    },
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.supplierSn == subItem.supplierSn) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
-    },
-    // 供应商列表
-    getSupplierList (pageNo) {
-      this.paginationProps.current = pageNo || this.paginationProps.current
-      this.disabled = true
-      const params = {
-        pageNo: this.paginationProps.current,
-        pageSize: this.paginationProps.pageSize
-      }
-      this.loading = true
-      supplierList(Object.assign(params, this.queryParam)).then(res => {
-        this.loading = false
-        if (res.status == 200) {
-          const data = res.data
-          this.paginationProps.total = Number(res.data.count) || 0
-          this.paginationProps.current = data.pageNo
-          const no = (data.pageNo - 1) * data.pageSize
-          for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = no + i + 1
-          }
-          this.loadData = data.list
-          this.disabled = false
-        } else {
-          this.paginationProps.total = 0
-          this.paginationProps.current = 1
-          this.paginationProps.pageSize = 20
-          this.loadData = []
-        }
-      })
-    },
-    //  已选产品 分页  一页多少条change
-    changePageSize (current, pageSize) {
-      this.paginationProps.current = current
-      this.paginationProps.pageSize = pageSize
-      this.getSupplierList()
-    },
-    //  已选产品 分页 页码change
-    changePage (current) {
-      this.paginationProps.current = current
-      this.getSupplierList()
     }
   },
   watch: {
@@ -255,15 +170,16 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.loadData = []
-        this.disabled = false
-        this.resetData()
+        this.resetSearchForm()
       } else {
-        this.getSupplierList(1)
-        this.selectedRows = this.chooseData
-        this.selectedRowKeys = []
+        const _this = this
+        const selectedRowKeys = []
         this.chooseData.map(item => {
-          this.selectedRowKeys.push(item.rangeDataSn)
+          selectedRowKeys.push(item.rangeDataSn)
+        })
+        this.$nextTick(() => { // 页面渲染完成后的回调
+          _this.$refs.table.refresh(true)
+          _this.$refs.table.setTableSelected(selectedRowKeys, _this.chooseData) // 设置表格选中项
         })
       }
     }

+ 16 - 35
src/views/financialManagement/warehousingConfirmation/list.vue

@@ -32,7 +32,7 @@
       <div v-if="$hasPermissions('B_warehousingConfirmationpl')" style="margin-bottom: 10px">
         <a-button type="primary" class="button-error" id="warehousingConfirmationList-export" :loading="loading" @click="handleBatchAudit">批量确认</a-button>
         <span style="margin-left: 5px">
-          <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
+          <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0"> {{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }} </template>
         </span>
       </div>
       <s-table
@@ -40,8 +40,10 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="rowSelection"
         :rowKey="(record) => record.stockPutSn"
+        rowKeyName="stockPutSn"
+        :row-selection="$hasPermissions('B_warehousingConfirmationpl') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.auditState != 'WAIT' } }) } : null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -105,7 +107,6 @@ export default {
       },
       tableHeight: 0,
       disabled: false, //  查询、重置按钮是否可操作
-      selectedRowKeys: [], // Check here to configure the default column
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -126,7 +127,8 @@ export default {
       nowData: null,
       confirmationModal: false,
       confirmationInfo: null,
-      isBatch: false
+      isBatch: false,
+      rowSelectionInfo: null
     }
   },
   computed: {
@@ -135,43 +137,26 @@ export default {
       const arr = [
         { title: '入库时间', dataIndex: 'putTime', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '入库单号', scopedSlots: { customRender: 'stockPutNo' }, width: '16%', align: 'center' },
-        { title: '商户名称', dataIndex: 'providerName', align: 'center', width: '22%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户名称', dataIndex: 'providerName', align: 'left', width: '22%', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '入库数量', dataIndex: 'productTotalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '入库成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单据状态', dataIndex: 'auditStateDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '财务审核时间', dataIndex: 'auditTime', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '备注', dataIndex: 'remark', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '备注', dataIndex: 'remark', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
       ]
       if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
         arr.splice(4, 0, { title: '入库成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       }
       return arr
-    },
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
-    rowSelection () {
-      if (this.$hasPermissions('B_warehousingConfirmationpl')) {
-        return {
-          selectedRowKeys: this.selectedRowKeys,
-          onChange: (selectedRowKeys, selectedRows) => {
-            console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
-            this.onSelectChange(selectedRowKeys)
-          },
-          getCheckboxProps: record => ({
-            props: {
-              disabled: record.auditState != 'WAIT'
-            }
-          })
-        }
-      } else {
-        return null
-      }
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.stockPutNo = ''
@@ -194,7 +179,7 @@ export default {
     // 通过
     handleConfirmationOk () {
       if (this.isBatch) { //  批量
-        this.auditOrder(this.selectedRowKeys, true)
+        this.auditOrder(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, true)
       } else {
         this.auditOrder([this.confirmationInfo.stockPutSn], true)
       }
@@ -202,7 +187,7 @@ export default {
     // 不通过
     handleConfirmationFail () {
       if (this.isBatch) { //  批量
-        this.auditOrder(this.selectedRowKeys, false)
+        this.auditOrder(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, false)
       } else {
         this.auditOrder([this.confirmationInfo.stockPutSn], false)
       }
@@ -225,7 +210,7 @@ export default {
         }
         if (res.status == 200) {
           if (this.isBatch) {
-            _this.selectedRowKeys = []
+            _this.$refs.table.clearSelected() // 清空表格选中项
           }
           _this.$message.success(res.message)
           _this.$refs.table.refresh()
@@ -240,17 +225,13 @@ export default {
     // 批量审核
     handleBatchAudit () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
       this.isBatch = true
       this.confirmationModal = true
     },
-    onSelectChange (selectedRowKeys) {
-      console.log('selectedRowKeys changed: ', selectedRowKeys)
-      this.selectedRowKeys = selectedRowKeys
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 33 - 49
src/views/inventoryManagement/inventoryWarning/list.vue

@@ -68,7 +68,7 @@
       <div v-if="$hasPermissions('B_inventoryWarning_refresh')" class="table-operator">
         <a-button class="button-error" type="primary" id="inventoryWarningList-update" :loading="loading" @click="handleupdate">批量更新</a-button>
         <span style="margin-left: 8px">
-          <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
+          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <!-- 列表 -->
@@ -77,8 +77,9 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="$hasPermissions('B_inventoryWarning_refresh')?{ selectedRowKeys: selectedRowKeys, onChange: onChange, onSelect: onSelectChange, onSelectAll: onSelectAllChange }:null"
+        :row-selection="$hasPermissions('B_inventoryWarning_refresh')?{ columnWidth: 40 }:null"
         :rowKey="(record) => record.id"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -109,6 +110,8 @@
               :precision="0"
               :min="0"
               :max="999999"
+              style="width: 100%;"
+              @change="numChange(record)"
               placeholder="请输入在途数" />
           </div>
         </template>
@@ -122,6 +125,8 @@
               :precision="0"
               :min="0"
               :max="999999"
+              style="width: 100%;"
+              @change="numChange(record)"
               placeholder="请输入最大库存数" />
           </div>
         </template>
@@ -135,6 +140,8 @@
               :precision="0"
               :min="0"
               :max="record.upperLimit"
+              style="width: 100%;"
+              @change="numChange(record)"
               placeholder="请输入最小库存数" />
           </div>
         </template>
@@ -155,7 +162,6 @@
 </template>
 
 <script>
-import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import { productBrandQuery } from '@/api/productBrand'
 import { productTypeQuery } from '@/api/productType'
@@ -210,12 +216,12 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
-              if (this.selectedRowKeys) { //  处理切换页码后 上页已选已输数据保留
-                const ind = this.selectedRowKeys.indexOf(data.list[i].id)
+              if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys) { //  处理切换页码后 上页已选已输数据保留
+                const ind = this.rowSelectionInfo.selectedRowKeys.indexOf(data.list[i].id)
                 if (ind >= 0) {
-                  data.list[i].inTransit = this.selectedRows[ind].inTransit
-                  data.list[i].upperLimit = this.selectedRows[ind].upperLimit
-                  data.list[i].lowerLimit = this.selectedRows[ind].lowerLimit
+                  data.list[i].inTransit = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows[ind].inTransit
+                  data.list[i].upperLimit = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows[ind].upperLimit
+                  data.list[i].lowerLimit = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows[ind].lowerLimit
                 }
               }
             }
@@ -225,23 +231,31 @@ export default {
           return data
         })
       },
-      selectedRowKeys: [],
-      selectedRows: [],
-      loading: false
-    }
-  },
-  computed: {
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
+      loading: false,
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    numChange (row) {
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys) { //  处理切换页码后 上页已选已输数据保留
+        const ind = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.indexOf(row.id)
+        if (ind >= 0) {
+          this.rowSelectionInfo.selectedRows[ind].inTransit = row.inTransit
+          this.rowSelectionInfo.selectedRows[ind].upperLimit = row.upperLimit
+          this.rowSelectionInfo.selectedRows[ind].lowerLimit = row.lowerLimit
+        }
+      }
+    },
     //  保存
     handleSave (row, isBatch) {
       const params = []
       if (isBatch) { //  批量更新
         const dataInd = []
-        this.selectedRows.map((item, index) => {
+        this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map((item, index) => {
           if ((!item.inTransit && item.inTransit != 0) || (!item.upperLimit && item.upperLimit != 0) || (!item.lowerLimit && item.lowerLimit != 0)) {
             dataInd.push(item.no)
           }
@@ -286,43 +300,13 @@ export default {
         if (res.status == 200) {
           this.$message.success(res.message)
           this.$refs.table.refresh()
-          this.selectedRowKeys = []
-          this.selectedRows = []
+          this.$refs.table.clearSelected() // 清空表格选中项
           this.spinning = false
         } else {
           this.spinning = false
         }
       })
     },
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.id == subItem.id) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
-    },
     //  重置
     resetSearchForm () {
       this.queryParam.productCode = ''
@@ -338,7 +322,7 @@ export default {
     },
     //  批量更新
     handleupdate () {
-      if (this.selectedRowKeys.length < 1) {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }

+ 17 - 48
src/views/productManagement/productInfo/list.vue

@@ -94,7 +94,7 @@
           @click="handleBatchDownline"
           style="margin: 0 15px;">批量下线</a-button>
         <span style="margin-left: 8px" v-if="$hasPermissions('B_productInfo_batchAudit') || $hasPermissions('B_productInfo_batchLaunch') || $hasPermissions('B_productInfo_batchDownline')">
-          <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
+          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <s-table
@@ -102,8 +102,9 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection=" showSelect ?{ selectedRowKeys: selectedRowKeys, onChange: onChange, onSelect: onSelectChange, onSelectAll: onSelectAllChange }:null"
+        :row-selection=" showSelect?{ columnWidth: 40 }:null"
         :rowKey="(record) => record.id"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -225,8 +226,6 @@ export default {
         { title: '定价状态', dataIndex: 'pricingStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
       ],
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       loadingAudit: false,
       loadingLaunch: false,
       loadingDownline: false,
@@ -254,47 +253,20 @@ export default {
       offlineProductList: [], //  下线 当前所选数据
       productBrandList: [], //  品牌下拉数据
       productTypeList: [], //  分类下拉数据
-      pageFromInfo: null
+      pageFromInfo: null,
+      rowSelectionInfo: null
     }
   },
   computed: {
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
     // 是否显示table选择框
     showSelect () {
       return this.$hasPermissions('B_productInfo_batchAudit') || this.$hasPermissions('B_productInfo_batchLaunch') || this.$hasPermissions('B_productInfo_batchDownline')
     }
   },
   methods: {
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.id == subItem.id) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
     },
     // 审核
     handleAudit (row) {
@@ -320,13 +292,13 @@ export default {
     // 批量审核
     handleBatchAudit () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
       let num = 0
       const obj = []
-      _this.selectedRows.map(item => {
+      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
         if (item.state == 'WAIT') {
           num++
           obj.push(item.productSn)
@@ -346,8 +318,7 @@ export default {
           productBatchAudit(obj).then(res => {
             _this.loadingAudit = false
             if (res.status == 200) {
-              _this.selectedRowKeys = []
-              _this.selectedRows = []
+              _this.$refs.table.clearSelected() // 清空表格选中项
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
               _this.spinning = false
@@ -361,13 +332,13 @@ export default {
     // 批量上线
     handleBatchLaunch () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
       let num = 0
       const obj = []
-      _this.selectedRows.map(item => {
+      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
         if (item.state == 'WAIT_ONLINE' || item.state == 'OFFLINE') {
           num++
           obj.push(item.productSn)
@@ -387,8 +358,7 @@ export default {
           productBatchOnline(obj).then(res => {
             _this.loadingLaunch = false
             if (res.status == 200) {
-              _this.selectedRowKeys = []
-              _this.selectedRows = []
+              _this.$refs.table.clearSelected() // 清空表格选中项
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
               _this.spinning = false
@@ -402,13 +372,13 @@ export default {
     // 批量下线
     handleBatchDownline () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
       let num = 0
       _this.offlineProductList = []
-      _this.selectedRows.map(item => {
+      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
         if (item.state == 'ONLINE') {
           num++
           _this.offlineProductList.push({ productSn: item.productSn, code: item.code, commonProductList: [] })
@@ -500,8 +470,7 @@ export default {
     },
     //  关闭下线弹框
     closeOfflineModal () {
-      this.selectedRowKeys = []
-      this.selectedRows = []
+      this.$refs.table.clearSelected() // 清空表格选中项
       this.offlineProductList = []
       this.openOfflineModal = false
     },

+ 13 - 31
src/views/productManagement/productLaunchAudit/list.vue

@@ -37,7 +37,7 @@
       <div style="margin-bottom: 10px">
         <a-button type="primary" v-if="$hasPermissions('B_productLaunchAudit_batchAudit')" id="productLaunchAudit-export" :loading="loading" @click="handleBatchAudit">批量审核</a-button>
         <span style="margin-left: 5px" v-if="$hasPermissions('B_productLaunchAudit_batchAudit')">
-          <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
+          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <s-table
@@ -45,8 +45,10 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="rowSelection"
         :rowKey="(record) => record.productSn"
+        rowKeyName="productSn"
+        :row-selection="$hasPermissions('B_productLaunchAudit_batchAudit')?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state != 'WAIT_ONLINE_AUDIT' } }) }:null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -99,7 +101,6 @@ export default {
         { title: '审核人', dataIndex: 'onlineAuditPerson', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
       ],
-      selectedRowKeys: [], // Check here to configure the default column
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -114,29 +115,15 @@ export default {
           this.spinning = false
           return data
         })
-      }
-    }
-  },
-  computed: {
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
-    rowSelection () {
-      return this.$hasPermissions('B_productLaunchAudit_batchAudit') ? {
-        selectedRowKeys: this.selectedRowKeys,
-        onChange: (selectedRowKeys, selectedRows) => {
-          console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
-          this.onSelectChange(selectedRowKeys)
-        },
-        getCheckboxProps: record => ({
-          props: {
-            disabled: record.state != 'WAIT_ONLINE_AUDIT'
-          }
-        })
-      } : null
+      },
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.name = ''
@@ -168,7 +155,7 @@ export default {
     // 批量审核
     handleBatchAudit () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
@@ -179,11 +166,10 @@ export default {
         onOk () {
           _this.loading = true
           _this.spinning = true
-          productBatchOnlineAudit(_this.selectedRowKeys).then(res => {
+          productBatchOnlineAudit(_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys).then(res => {
             _this.loading = false
             if (res.status == 200) {
-              _this.selectedRowKeys = []
-              _this.selectedRows = []
+              _this.$refs.table.clearSelected() // 清空表格选中项
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
               _this.spinning = false
@@ -197,10 +183,6 @@ export default {
         }
       })
     },
-    onSelectChange (selectedRowKeys) {
-      console.log('selectedRowKeys changed: ', selectedRowKeys)
-      this.selectedRowKeys = selectedRowKeys
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 13 - 30
src/views/productManagement/productOfflineAudit/list.vue

@@ -73,7 +73,7 @@
       <div style="margin-bottom: 10px">
         <a-button type="primary" v-if="$hasPermissions('B_productOfflineAudit_batchAudit')" id="productOfflineAudit-export" :loading="loading" @click="handleBatchAudit">批量审核</a-button>
         <span style="margin-left: 5px" v-if="$hasPermissions('B_productOfflineAudit_batchAudit')">
-          <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
+          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <s-table
@@ -81,8 +81,10 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="rowSelection"
         :rowKey="(record) => record.productSn"
+        rowKeyName="productSn"
+        :row-selection="$hasPermissions('B_productOfflineAudit_batchAudit')?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state != 'WAIT_OFFLINE_AUDIT' } }) }:null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -148,7 +150,6 @@ export default {
         { title: '审核人', dataIndex: 'offlineAuditPerson', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
       ],
-      selectedRowKeys: [], // Check here to configure the default column
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -165,29 +166,15 @@ export default {
         })
       },
       productBrandList: [], //  品牌下拉数据
-      productTypeList: [] //  分类下拉数据
-    }
-  },
-  computed: {
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
-    rowSelection () {
-      return this.$hasPermissions('B_productOfflineAudit_batchAudit') ? {
-        selectedRowKeys: this.selectedRowKeys,
-        onChange: (selectedRowKeys, selectedRows) => {
-          console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
-          this.onSelectChange(selectedRowKeys)
-        },
-        getCheckboxProps: record => ({
-          props: {
-            disabled: record.state != 'WAIT_OFFLINE_AUDIT'
-          }
-        })
-      } : null
+      productTypeList: [], //  分类下拉数据
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.name = ''
@@ -225,7 +212,7 @@ export default {
     // 批量审核
     handleBatchAudit () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
@@ -236,10 +223,10 @@ export default {
         onOk () {
           _this.loading = true
           _this.spinning = true
-          productBatchOfflineAudit(_this.selectedRowKeys).then(res => {
+          productBatchOfflineAudit(_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys).then(res => {
             _this.loading = false
             if (res.status == 200) {
-              _this.selectedRowKeys = []
+              _this.$refs.table.clearSelected() // 清空表格选中项
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
               _this.spinning = false
@@ -250,10 +237,6 @@ export default {
         }
       })
     },
-    onSelectChange (selectedRowKeys) {
-      console.log('selectedRowKeys changed: ', selectedRowKeys)
-      this.selectedRowKeys = selectedRowKeys
-    },
     //  产品分类  change
     changeProductType (val, opt) {
       this.queryParam.productTypeSn1 = val[0] ? val[0] : ''

+ 13 - 64
src/views/purchasingManagement/bulkWarehousingOrder/list.vue

@@ -48,7 +48,7 @@
           @click="handleBatchAudit"
           style="margin: 0 15px;">批量审核</a-button>
         <span style="margin-left: 8px">
-          <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
+          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <!-- 列表 -->
@@ -57,8 +57,10 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="rowSelection"
         :rowKey="(record) => record.sparePartsSn"
+        rowKeyName="sparePartsSn"
+        :row-selection="$hasPermissions('B_sparePartsBatchAudit')?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state != 'WAIT_AUDIT' } }) }:null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -120,8 +122,6 @@ export default {
         relationNo: '',
         state: undefined
       },
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -142,7 +142,8 @@ export default {
         })
       },
       openDetailModal: false,
-      itemSn: null
+      itemSn: null,
+      rowSelectionInfo: null
     }
   },
   computed: {
@@ -164,63 +165,12 @@ export default {
 	      arr.splice(4, 0, { title: '入库成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
 	    }
 	    return arr
-	  },
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
-    rowSelection () {
-      if (this.$hasPermissions('B_sparePartsBatchAudit')) {
-        return {
-          selectedRowKeys: this.selectedRowKeys,
-          onChange: (selectedRowKeys, selectedRows) => {
-            this.onChange(selectedRowKeys, selectedRows)
-          },
-          onSelect: (record, selected, selectedRows, nativeEvent) => {
-            this.onSelectChange(record, selected, selectedRows, nativeEvent)
-          },
-          onSelectAll: (selected, selectedRows, changeRows) => {
-            this.onSelectAllChange(selected, selectedRows, changeRows)
-          },
-          getCheckboxProps: record => ({
-            props: {
-              disabled: record.state != 'WAIT_AUDIT'
-            }
-          })
-        }
-      } else {
-        return null
-      }
-    }
+	  }
   },
   methods: {
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.sparePartsSn == subItem.sparePartsSn) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
     },
     //  新增
     handleAdd () {
@@ -293,8 +243,7 @@ export default {
           _this.spinning = true
           sparePartsAudit(params).then(res => {
             if (res.status == 200) {
-              _this.selectedRowKeys = []
-              _this.selectedRows = []
+              _this.$refs.table.clearSelected() // 清空表格选中项
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
               _this.spinning = false
@@ -307,11 +256,11 @@ export default {
     },
     // 批量审核
     handleBatchAudit () {
-      if (this.selectedRowKeys.length < 1) {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
-      this.handleAudit(this.selectedRowKeys, 'batch')
+      this.handleAudit(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, 'batch')
     },
     pageInit () {
       const _this = this

+ 13 - 62
src/views/salesManagement/outboundOrder/list.vue

@@ -78,7 +78,7 @@
       <div style="margin-bottom: 10px" v-if="$hasPermissions('B_stockOut')">
         <a-button type="primary" class="button-error" id="outboundOrder-export" :loading="loading" @click="handleOutbound()">批量出库</a-button>
         <span style="margin-left: 5px">
-          <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
+          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <s-table
@@ -86,8 +86,10 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="$hasPermissions('B_stockOut')?rowSelection:null"
         :rowKey="(record) => record.stockOutSn"
+        rowKeyName="stockOutSn"
+        :row-selection="$hasPermissions('B_stockOut')?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state == 'FINISH' } }) }:null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -163,8 +165,6 @@ export default {
         shippingAddrProvinceSn: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -187,7 +187,8 @@ export default {
       addrProvinceList: [], //  省下拉
       openModal: false,
       orderSn: undefined,
-      outBizType: null //  当前单子类型   SALES销售出库        ALLOCATE调拨出库
+      outBizType: null, //  当前单子类型   SALES销售出库        ALLOCATE调拨出库
+      rowSelectionInfo: null
     }
   },
   computed: {
@@ -209,31 +210,13 @@ export default {
         arr.splice(7, 0, { title: '售价', dataIndex: 'productTotalPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       }
       return arr
-    },
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
-    rowSelection () {
-      return {
-        selectedRowKeys: this.selectedRowKeys,
-        onChange: (selectedRowKeys, selectedRows) => {
-          this.onChange(selectedRowKeys, selectedRows)
-        },
-        onSelect: (record, selected, selectedRows, nativeEvent) => {
-          this.onSelectChange(record, selected, selectedRows, nativeEvent)
-        },
-        onSelectAll: (selected, selectedRows, changeRows) => {
-          this.onSelectAllChange(selected, selectedRows, changeRows)
-        },
-        getCheckboxProps: record => ({
-          props: {
-            disabled: record.state == 'FINISH' // Column configuration not to be checked
-          }
-        })
-      }
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     detailPermissions (row) {
       let state = false
       //  根据出库类型和对应功能权限 判断是否有查看详情的权限
@@ -268,11 +251,9 @@ export default {
       this.outBizType = row.outBizType
       //  根据出库类型跳转对应页面
       if (row.outBizType == 'SALES' && this.$hasPermissions('B_dispatchDetail')) { //  销售出库
-        // this.$router.push({ path: `/salesManagement/pushOrderManagement/detail/${row.outBizSubSn}/stockOut` })
         this.orderSn = row.outBizSubSn
         this.openModal = true
       } else if (row.outBizType == 'ALLOCATE' && this.$hasPermissions('M_transferOut_detail')) { //  调拨出库
-        // this.$router.push({ path: `/allocationManagement/transferOut/detail/${row.outBizSn}` })
         this.orderSn = row.outBizSn
         this.openModal = true
       } else if (row.outBizType == 'CHECK_ORDER_OUT') { //  库存盘点盘亏
@@ -300,12 +281,12 @@ export default {
         }]
       } else { //  批量出库
         content = '确认要批量出库吗?'
-        if (this.selectedRowKeys.length < 1) {
+        if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
           this.$message.warning('请在列表勾选后再进行批量操作!')
           return
         }
         params = []
-        this.selectedRows.map(item => {
+        this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map(item => {
           params.push({
             stockOutSn: item.stockOutSn,
             outBizSn: item.outBizSn,
@@ -327,8 +308,7 @@ export default {
             _this.loading = false
             if (res.status == 200) {
               if (!row) { //  批量出库
-                _this.selectedRowKeys = []
-                _this.selectedRows = []
+                _this.$refs.table.clearSelected() // 清空表格选中项
               }
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -340,35 +320,6 @@ export default {
         }
       })
     },
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.stockOutSn == subItem.stockOutSn) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
-    },
     //  省/市/区
     getArea (leve, sn) {
       let params

+ 12 - 47
src/views/salesManagement/salesQuery/chooseActive.vue

@@ -6,25 +6,16 @@
     title="促销品列表"
     v-model="isShow"
     @cancle="cansel"
-    width="80%">
+    :width="960">
     <a-card size="small" :bordered="false" class="productInfoList-wrap">
       <!-- 列表 -->
       <s-table
         class="sTable"
         ref="table"
         size="small"
-        :row-selection="{
-          selectedRowKeys: selectedRowKeys,
-          onChange: onChange,
-          onSelect: onSelectChange,
-          onSelectAll: onSelectAllChange,
-          getCheckboxProps: record => ({
-            props: {
-              disabled: record.cost == undefined||record.cost==0||record.productPrice==0||record.productPrice==undefined, // Column configuration not to be checked
-            }
-          })
-        }"
         :rowKey="(record) => record.id"
+        :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.cost == undefined||record.cost==0||record.productPrice==0||record.productPrice==undefined } }) }"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :defaultLoadData="false"
@@ -39,6 +30,7 @@
             v-model="record.qty"
             :precision="0"
             :step="1"
+            style="width: 100%;"
           />
         </template>
       </s-table>
@@ -76,8 +68,6 @@ export default {
   data () {
     return {
       isShow: this.openModal,
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       spinning: false,
       list: [],
       salesBillDetailSn: null,
@@ -100,7 +90,8 @@ export default {
           this.spinning = false
           return data
         })
-      }
+      },
+      rowSelectionInfo: null
     }
   },
   computed: {
@@ -126,44 +117,19 @@ export default {
     }
   },
   methods: {
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.id == subItem.id) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
     },
     // 选择产品
     handleSubmit () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请选择促销品!')
         return
       }
       const obj = []
-      _this.selectedRows.map(item => {
+      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
         obj.push({
           showCost: item.cost,
           price: item.promoRuleGoods.goodsPrice,
@@ -202,8 +168,7 @@ export default {
     //  重定义的弹框状态
     isShow (newValue, oldValue) {
       if (!newValue) {
-        this.selectedRows = []
-        this.selectedRowKeys = []
+        this.$refs.table.clearSelected() // 清空表格选中项
         this.$emit('close')
       }
     }

+ 10 - 35
src/views/salesManagement/salesReturn/salesReturnCheck.vue

@@ -18,8 +18,9 @@
           ref="table"
           :style="{ height: tableHeight+84.5+'px' }"
           size="small"
-          :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onChange, onSelect: onSelectChange, onSelectAll: onSelectAllChange }"
           :rowKey="(record) => record.id"
+          :row-selection="{ columnWidth: 40 }"
+          @rowSelection="rowSelectionFun"
           :columns="columns"
           :data="loadData"
           :scroll="{ y: tableHeight }"
@@ -80,8 +81,6 @@ export default {
       isInster: false, // 是否正在添加产品
       ordeDetail: { discountAmount: 0 },
       loading: false,
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       // 已选产品
       dataSource: [],
       productForm: {
@@ -107,7 +106,8 @@ export default {
           }
           return data
         })
-      }
+      },
+      rowSelectionInfo: null
     }
   },
   computed: {
@@ -129,34 +129,9 @@ export default {
     }
   },
   methods: {
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.id == subItem.id) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
     },
     //  返回
     handleBack () {
@@ -165,8 +140,8 @@ export default {
     // 批量返库
     backStock () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
-        _this.$message.warning('请选择产品!')
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        _this.$message.warning('请选择产品!')
         return
       }
       this.$confirm({
@@ -175,7 +150,7 @@ export default {
         centered: true,
         onOk () {
           const obj = []
-          _this.selectedRows.map(item => {
+          _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
             obj.push({
               salesReturnDetailSn: item.salesReturnDetailSn,
               backStockQty: item.qty

+ 13 - 40
src/views/salesManagement/waitDispatch/edit.vue

@@ -47,8 +47,9 @@
           class="sTable"
           ref="table"
           size="small"
-          :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onChange, onSelect: onSelectChange, onSelectAll: onSelectAllChange }"
           :rowKey="(record) => record.id"
+          :row-selection="{ columnWidth: 40 }"
+          @rowSelection="rowSelectionFun"
           :columns="columns"
           :data="loadData"
           :showPagination="false"
@@ -125,8 +126,6 @@ export default {
       productForm: {
         dispatchBillSn: ''
       },
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
@@ -158,38 +157,14 @@ export default {
           return data
         })
       },
-      totalData: null
+      totalData: null,
+      rowSelectionInfo: null
     }
   },
   methods: {
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.id == subItem.id) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
     },
     // 统计查询
     getTotalData () {
@@ -237,13 +212,13 @@ export default {
     // 批量删除
     delSalerDetailAll () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请在选择待下推产品!')
         return
       }
       const obj = []
-      _this.selectedRows.map(item => {
-        if (_this.selectedRowKeys.indexOf(item.id) != -1) {
+      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
+        if (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.indexOf(item.id) != -1) {
           obj.push(item.dispatchBillDetailSn)
         }
       })
@@ -280,11 +255,10 @@ export default {
           _this.resetSearchForm(true)
           _this.$refs.partQuery.resetCurForm()
           if (type == 1) { //  批量操作
-            _this.selectedRowKeys = []
-            _this.selectedRows = []
+            _this.$refs.table.clearSelected() // 清空表格选中项
           } else if (type == 0) { //  单条
-            const ind = _this.selectedRowKeys.findIndex(item => item == row.id)
-            _this.selectedRowKeys.splice(ind, 1)
+            const ind = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.findIndex(item => item == row.id)
+            _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.splice(ind, 1)
           }
           _this.$message.success(res.message)
           _this.spinning = false
@@ -296,7 +270,6 @@ export default {
     },
     // 添加产品
     insterProduct (list) {
-      console.log(list)
       // 防止多次添加产品
       if (this.isInster) { return }
       this.saveNewProduct(list)

+ 15 - 52
src/views/salesManagement/waitDispatch/queryPart.vue

@@ -77,16 +77,9 @@
       class="sTable"
       ref="table"
       size="small"
-      :row-selection="{
-        selectedRowKeys: selectedRowKeys,
-        onChange: onChange,
-        onSelect: onSelectChange,
-        onSelectAll: onSelectAllChange,
-        getCheckboxProps:record =>({props: {
-          disabled: record.surplusQty<=0,
-        }})
-      }"
       :rowKey="(record) => record.id"
+      :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: record.surplusQty<=0 }})}"
+      @rowSelection="rowSelectionFun"
       :columns="columns"
       :showPagination="false"
       :data="loadData"
@@ -141,7 +134,6 @@ export default {
   },
   watch: {
     data (newValue, oldValue) {
-      console.log(newValue)
       this.resetSearchForm()
     }
   },
@@ -164,8 +156,6 @@ export default {
         salesBillSn: ''
       },
       disabled: false, //  查询、重置按钮是否可操作
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -201,7 +191,8 @@ export default {
           }
           return data
         })
-      }
+      },
+      rowSelectionInfo: null
     }
   },
   computed: {
@@ -233,39 +224,12 @@ export default {
     }
   },
   methods: {
-    onChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-    },
-    onSelectChange (record, selected, selectedRows, nativeEvent) {
-      if (selected) { //  选择
-        this.selectedRows.push(record)
-      } else { //  取消
-        this.selectedRows = selectedRows
-      }
-    },
-    // 本页全选/取消全选
-    onSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.selectedRows = [...this.selectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item.id == subItem.id) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
     },
     // 类型变化,过滤列表
-    handlePtypeChange () {
-
-    },
+    handlePtypeChange () {},
     //  重置
     resetSearchForm () {
       this.queryParam.ptype = '0'
@@ -286,8 +250,7 @@ export default {
     },
     // 刷新当前页面
     resetCurForm () {
-      this.selectedRowKeys = []
-      this.selectedRows = []
+      this.$refs.table.clearSelected() // 清空表格选中项
       this.$refs.table.refresh()
     },
     // 添加
@@ -301,12 +264,12 @@ export default {
     // 批量添加
     handlePlAdd () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
-        _this.$message.warning('请选择产品!')
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        _this.$message.warning('请选择产品!')
         return
       }
       const obj = []
-      _this.selectedRows.map(item => {
+      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
         if (item.stockQty > 0) {
           obj.push(item.salesBillDetailSn)
         }
@@ -328,12 +291,12 @@ export default {
     // 批量取消
     handlePlCancel () {
       const _this = this
-      if (_this.selectedRowKeys.length < 1) {
-        _this.$message.warning('请选择产品!')
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        _this.$message.warning('请选择产品!')
         return
       }
       const obj = []
-      _this.selectedRows.map(item => {
+      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
         obj.push({
           'cancelQty': item.cancelNums,
           'salesBillDetailSn': item.salesBillDetailSn