Forráskód Böngészése

表格多选 bug修复

chenrui 3 éve
szülő
commit
ffa519faa3

+ 11 - 2
src/components/Table/index.js

@@ -289,13 +289,22 @@ export default {
       }
       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()
       }
     },
     /**

+ 21 - 51
src/views/financialManagement/companyReceivablePayable/chooseBillModal.vue

@@ -46,12 +46,13 @@
         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"
-        :scroll="{ x: '100%', y: 400 }"
+        :scroll="{ y: 400 }"
         :defaultLoadData="false"
         bordered>
       </s-table>
@@ -101,12 +102,12 @@ export default {
       },
       // 表头
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '单据号', dataIndex: 'bizNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '单据类型', dataIndex: 'bizTypeDictValue', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '金额', dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '余额', dataIndex: 'unsettleAmount', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
+        { title: '单据号', dataIndex: 'bizNo', width: '28%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单据类型', dataIndex: 'bizTypeDictValue', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '审核时间', dataIndex: 'auditTime', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '金额', dataIndex: 'totalAmount', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '余额', dataIndex: 'unsettleAmount', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -116,33 +117,32 @@ export default {
           let data
           if (res.status == 200) {
             data = res.data
-            this.selectedRowKeys = []
-            this.selectedRows = []
+            const selectedRowKeys = []
+            const selectedRows = []
             for (var i = 0; i < data.length; i++) {
               data[i].no = i + 1
               data[i].settleAmount = data[i].unsettleAmount
               const ind = this.nowChoose.findIndex(item => item.id == data[i].id)
               if (ind != -1) {
-                this.selectedRowKeys.push(data[i].id)
-                this.selectedRows.push(data[i])
+                selectedRowKeys.push(data[i].id)
+                selectedRows.push(data[i])
               }
             }
+            this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
             this.disabled = false
           }
           this.spinning = false
           return data
         })
       },
-      selectedRowKeys: [],
-      selectedRows: []
-    }
-  },
-  computed: {
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     //  时间  change
     dateChange (date) {
       this.queryParam.auditBeginDate = date[0]
@@ -150,7 +150,7 @@ export default {
     },
     // 确定
     handleSave () {
-      this.$emit('ok', this.selectedRows)
+      this.$emit('ok', this.rowSelectionInfo && this.rowSelectionInfo.selectedRows)
       this.isShow = false
     },
     // 重置
@@ -161,35 +161,6 @@ export default {
       this.queryParam.bizNo = ''
       this.queryParam.bizType = undefined
       this.$refs.table.refresh(true)
-    },
-    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)
-        })
-      }
     }
   },
   watch: {
@@ -202,8 +173,7 @@ export default {
       const _this = this
       if (!newValue) {
         _this.$emit('close')
-        _this.selectedRowKeys = []
-        _this.selectedRows = []
+        _this.$refs.table.clearSelected() // 清空表格选中项
         _this.resetSearchForm()
       } else {
         setTimeout(() => {

+ 15 - 67
src/views/financialManagement/financialCollection/list.vue

@@ -44,8 +44,8 @@
             <a-col :md="6" :sm="24">
               <span class="table-page-search-submitButtons">
                 <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="financialCollectionList-refresh">查询</a-button>
-                <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="financialCollectionList-reset">重置</a-button>
-                <a @click="advanced = !advanced" style="margin-left: 8px">
+                <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="financialCollectionList-reset">重置</a-button>
+                <a @click="advanced = !advanced" style="margin-left: 5px">
                   {{ advanced ? '收起' : '展开' }}
                   <a-icon :type="advanced ? 'up' : 'down'" />
                 </a>
@@ -70,9 +70,7 @@
       <div v-if="$hasPermissions('B_financialCollectionPl')" style="margin-bottom: 10px">
         <a-button type="primary" id="financialCollectionList-export" :loading="loading" @click="handleCollection">批量收款</a-button>
         <span style="margin-left: 8px" v-if="$hasPermissions('B_financialCollectionPl')">
-          <template v-if="hasSelected">
-            {{ `已选 ${selectedRowKeys.length} 项` }}
-          </template>
+          <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <!-- 列表 -->
@@ -81,8 +79,9 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="$hasPermissions('B_financialCollectionPl') ? rowSelection : null"
         :rowKey="record => record.id"
+        :row-selection="$hasPermissions('B_financialCollectionPl') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.settleState == 'SETTLED' } }) } : null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -166,8 +165,6 @@ export default {
         { title: '收款时间', dataIndex: 'settleTime', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
       ],
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -190,38 +187,15 @@ export default {
           return data
         })
       },
-      tabPaneData: []
-    }
-  },
-  computed: {
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
-    rowSelection () {
-      if (this.$hasPermissions('B_financialCollectionPl')) {
-        return {
-          selectedRowKeys: this.selectedRowKeys,
-          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)
-          },
-          getCheckboxProps: record => ({
-            props: {
-              disabled: record.settleState == 'SETTLED'
-            }
-          })
-        }
-      } else {
-        return null
-      }
+      tabPaneData: [],
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     //  时间  change
     dateChange (date) {
       this.queryParam.auditBeginDate = date[0]
@@ -262,8 +236,8 @@ export default {
         this.loading = false
         if (res.status == 200) {
           this.$message.success(res.message)
-          this.selectedRowKeys = []
           this.$refs.table.refresh()
+          this.$refs.table.clearSelected() // 清空表格选中项
           this.spinning = false
         } else {
           this.spinning = false
@@ -278,18 +252,18 @@ export default {
     },
     // 批量收款
     handleCollection () {
-      if (this.selectedRowKeys.length < 1) {
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1) {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
       this.loading = true
       this.spinning = true
-      settleReceiptMoney(this.selectedRowKeys).then(res => {
+      settleReceiptMoney(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys).then(res => {
         this.loading = false
         if (res.status == 200) {
           this.$message.success(res.message)
-          this.selectedRowKeys = []
           this.$refs.table.refresh()
+          this.$refs.table.clearSelected() // 清空表格选中项
           this.spinning = false
         } else {
           this.spinning = false
@@ -316,32 +290,6 @@ export default {
         auditEndDate: ''
       }
     },
-    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)
-        })
-      }
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 15 - 67
src/views/financialManagement/financialPayment/list.vue

@@ -43,8 +43,8 @@
             <a-col :md="6" :sm="24">
               <span class="table-page-search-submitButtons">
                 <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="finacialPay-refresh">查询</a-button>
-                <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="finacialPay-reset">重置</a-button>
-                <a @click="advanced = !advanced" style="margin-left: 8px">
+                <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="finacialPay-reset">重置</a-button>
+                <a @click="advanced = !advanced" style="margin-left: 5px">
                   {{ advanced ? '收起' : '展开' }}
                   <a-icon :type="advanced ? 'up' : 'down'" />
                 </a>
@@ -69,9 +69,7 @@
       <div v-if="$hasPermissions('B_financialPaymentPl')" style="margin-bottom: 10px">
         <a-button type="primary" id="finacialPay-export" :loading="loading" @click="handlePayment">批量付款</a-button>
         <span style="margin-left: 8px" v-if="$hasPermissions('B_financialPaymentPl')">
-          <template v-if="hasSelected">
-            {{ `已选 ${selectedRowKeys.length} 项` }}
-          </template>
+          <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <!-- 列表 -->
@@ -80,8 +78,9 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="$hasPermissions('B_financialPaymentPl') ? rowSelection : null"
         :rowKey="record => record.id"
+        :row-selection="$hasPermissions('B_financialPaymentPl') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.settleState == 'SETTLED' } }) } : null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -164,8 +163,6 @@ export default {
         { title: '付款时间', dataIndex: 'settleTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
       ],
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -188,38 +185,15 @@ export default {
           return data
         })
       },
-      tabPaneData: []
-    }
-  },
-  computed: {
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
-    rowSelection () {
-      if (this.$hasPermissions('B_financialPaymentPl')) {
-        return {
-          selectedRowKeys: this.selectedRowKeys,
-          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)
-          },
-          getCheckboxProps: record => ({
-            props: {
-              disabled: record.settleState == 'SETTLED'
-            }
-          })
-        }
-      } else {
-        return null
-      }
+      tabPaneData: [],
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     //  时间  change
     dateChange (date) {
       this.queryParam.auditBeginDate = date[0]
@@ -260,8 +234,8 @@ export default {
         this.loading = false
         if (res.status == 200) {
           this.$message.success(res.message)
-          this.selectedRowKeys = []
           this.$refs.table.refresh()
+          this.$refs.table.clearSelected() // 清空表格选中项
           this.spinning = false
         } else {
           this.spinning = false
@@ -276,17 +250,17 @@ export default {
     },
     // 批量付款
     handlePayment () {
-      if (this.selectedRowKeys.length < 1) {
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1) {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
       this.loading = true
       this.spinning = true
-      settlePayMoney(this.selectedRowKeys).then(res => {
+      settlePayMoney(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys).then(res => {
         this.loading = false
         if (res.status == 200) {
           this.$message.success(res.message)
-          this.selectedRowKeys = []
+          this.$refs.table.clearSelected() // 清空表格选中项
           this.$refs.table.refresh()
           this.spinning = false
         } else {
@@ -314,32 +288,6 @@ export default {
         auditEndDate: ''
       }
     },
-    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)
-        })
-      }
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 22 - 93
src/views/inventoryManagement/inventoryChecking/selfDisk.vue

@@ -88,13 +88,10 @@
           class="sTable"
           ref="table"
           size="small"
-          :row-selection="{
-            selectedRowKeys: selectedRowKeys,
-            onChange: onChange,
-            onSelect: onSelectChange,
-            onSelectAll: onSelectAllChange
-          }"
-          :rowKey="(record) => record.id"
+          :rowKey="(record) => record.productSn"
+          rowKeyName="productSn"
+          :row-selection="{ columnWidth: 40 }"
+          @rowSelection="rowSelectionFun"
           :columns="columns"
           :customRow="handleClickRow"
           :data="loadData"
@@ -184,13 +181,9 @@
           class="sTable"
           ref="chooseTable"
           size="small"
-          :row-selection="{
-            selectedRowKeys: chooseSelectedRowKeys,
-            onChange: onChooseChange,
-            onSelect: onChooseSelectChange,
-            onSelectAll: onChooseSelectAllChange
-          }"
           :rowKey="(record) => record.id"
+          :row-selection="{ columnWidth: 40 }"
+          @rowSelection="rowChooseSelectionFun"
           :columns="chooseColumns"
           :data="chooseLoadData"
           :scroll="{ y: 300 }"
@@ -292,11 +285,9 @@ export default {
       productType: [],
       chooseProductType: [],
       warehouseList: [], //  仓库  下拉数据
-      selectedRowKeys: [],
-      selectedRows: [],
-      chooseSelectedRowKeys: [],
-      chooseSelectedRows: [],
-      listData: []
+      listData: [],
+      rowSelectionInfo: null,
+      rowChooseSelectionInfo: null
     }
   },
   computed: {
@@ -336,6 +327,13 @@ export default {
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    rowChooseSelectionFun (obj) {
+      this.rowChooseSelectionInfo = obj || null
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.productCode = ''
@@ -386,13 +384,13 @@ export default {
       const _this = this
       let params = {}
       if (type == 'batch') { //  批量添加
-        if (this.selectedRows.length == 0) {
+        if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.length == 0) {
           this.$message.warning('请选择需要批量添加的选项值后再操作!')
           return
         }
         params.checkWarehouseSn = _this.$route.params.sn
         params.checkWarehouseDetailEntityList = []
-        this.selectedRows.map(item => {
+        this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map(item => {
           params.checkWarehouseDetailEntityList.push({
             checkWarehouseSn: _this.$route.params.sn,
             checkCost: item.putCost,
@@ -427,8 +425,7 @@ export default {
       this.spinning = true
       checkWarehouseDetailSaveBatch(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.$refs.chooseTable.refresh()
@@ -443,7 +440,7 @@ export default {
       const _this = this
       let content
       if (isAll == 'batch') { // 批量
-        if (this.chooseSelectedRowKeys.length == 0) {
+        if (this.rowChooseSelectionInfo && this.rowChooseSelectionInfo.selectedRowKeys.length == 0) {
           this.$message.warning('请选择需要批量删除的选项值后再操作!')
           return
         }
@@ -461,7 +458,7 @@ export default {
           _this.spinning = true
           const params = { checkWarehouseSn: _this.$route.params.sn }
           if (isAll == 'batch') { // 批量
-            params.idList = _this.chooseSelectedRowKeys
+            params.idList = _this.rowChooseSelectionInfo && _this.rowChooseSelectionInfo.selectedRowKeys
           } else if (isAll == 'all') { // 全部
             params.allFlag = true
           } else { // 单个
@@ -473,8 +470,7 @@ export default {
               _this.$refs.table.refresh()
               _this.$refs.chooseTable.refresh()
               if (isAll == 'batch') { // 批量
-                _this.chooseSelectedRowKeys = []
-                _this.chooseSelectedRows = []
+                _this.$refs.chooseTable.clearSelected() // 清空表格选中项
               }
               _this.spinning = false
             } else {
@@ -558,73 +554,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.id == subItem.id) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
-    },
-    onChooseChange (selectedRowKeys, selectedRows) {
-      this.chooseSelectedRowKeys = selectedRowKeys
-    },
-    onChooseSelectChange (record, selected, selectedRows, nativeEvent) {
-      const _this = this
-      if (selected) { //  选择
-        this.chooseSelectedRows.push(record)
-      } else { //  取消
-        const arrId = []
-        this.chooseSelectedRows.map((item, index) => {
-          if (item.id == record.id) {
-            arrId.push(index)
-          }
-        })
-        arrId.map((item, index) => {
-          _this.chooseSelectedRows = _this.chooseSelectedRows.slice(item, item + 1)
-        })
-      }
-    },
-    // 本页全选/取消全选
-    onChooseSelectAllChange (selected, selectedRows, changeRows) {
-      const _this = this
-      if (selected) { //  选择
-        this.chooseSelectedRows = [...this.chooseSelectedRows, ...changeRows]
-      } else { //  取消
-        const arrId = []
-        this.chooseSelectedRows.map((item, index) => {
-          this.chooseSelectedRows.map((subItem, ind) => {
-            if (item.id == subItem.id) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.chooseSelectedRows = _this.chooseSelectedRows.slice(item, item + 1)
-        })
-      }
     }
   },
   mounted () {

+ 44 - 83
src/views/inventoryManagement/inventoryWarning/list.vue

@@ -65,14 +65,6 @@
             <a-col :md="6" :sm="24">
               <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryWarningList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryWarningList-reset">重置</a-button>
-              <!-- <a-button
-                style="margin-left: 8px"
-                type="primary"
-                class="button-warning"
-                @click="handleExport"
-                :disabled="disabled"
-                :loading="exportLoading"
-                id="inventoryWarningList-export">导出</a-button> -->
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -84,8 +76,8 @@
       <!-- 操作按钮 -->
       <div class="table-operator">
         <a-button type="primary" v-if="$hasPermissions('B_inventoryWarningBatchSave')" id="inventoryWarningList-update" @click="handleupdate">批量更新</a-button>
-        <span style="margin-left: 8px" v-if="$hasPermissions('B_inventoryWarningBatchSave')">
-          <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
+        <span style="margin-left: 5px" v-if="$hasPermissions('B_inventoryWarningBatchSave')">
+          <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
         </span>
       </div>
       <!-- 列表 -->
@@ -94,16 +86,12 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="$hasPermissions('B_inventoryWarningBatchSave') ? {
-          selectedRowKeys: selectedRowKeys,
-          onChange: onChange,
-          onSelect: onSelectChange,
-          onSelectAll: onSelectAllChange
-        } : null"
         :rowKey="(record) => record.id"
+        :row-selection="$hasPermissions('B_inventoryWarningBatchSave') ? { columnWidth: 40 } : null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
-        :scroll="{ x: 1490, y: tableHeight }"
+        :scroll="{ x: 1330, y: tableHeight }"
         :defaultLoadData="false"
         bordered>
         <!-- 产品分类 -->
@@ -131,6 +119,8 @@
               :precision="0"
               :min="0"
               :max="999999"
+              style="width: 100%;"
+              @change="numChange(record)"
               placeholder="请输入在途数" />
           </div>
         </template>
@@ -144,6 +134,8 @@
               :precision="0"
               :min="0"
               :max="999999"
+              style="width: 100%;"
+              @change="numChange(record)"
               placeholder="请输入最大库存数" />
           </div>
         </template>
@@ -157,6 +149,8 @@
               :precision="0"
               :min="0"
               :max="record.upperLimit"
+              style="width: 100%;"
+              @change="numChange(record)"
               placeholder="请输入最小库存数" />
           </div>
         </template>
@@ -182,7 +176,6 @@ import { STable, VSelect } from '@/components'
 import { stockWarnList, stockWarnSaveBatch } from '@/api/stockWarn'
 import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeList } from '@/api/dealerProductType'
-// import { downloadExcel } from '@/libs/JGPrint.js'
 export default {
   name: 'InventoryWarning',
   components: { STable, VSelect },
@@ -208,20 +201,19 @@ export default {
       productTypeList: [], //  产品类别下拉数据
       productType: [],
       columns: [
-        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '序号', dataIndex: 'no', width: 50, align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'productOrigCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品品牌', dataIndex: 'brandName', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: 150, align: 'center' },
-        // { title: '实时库存数(个)', scopedSlots: { customRender: 'stockQty' }, width: 110, align: 'center' },
-        { title: '在途数(个)', scopedSlots: { customRender: 'inTransit' }, width: 100, align: 'center' },
-        { title: '总库存数(个)', dataIndex: 'currentStockQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '最大库存数(个)', scopedSlots: { customRender: 'upperLimit' }, width: 110, align: 'center' },
-        { title: '最小库存数(个)', scopedSlots: { customRender: 'lowerLimit' }, width: 110, align: 'center' },
+        { title: '产品品牌', dataIndex: 'brandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: 120, align: 'center' },
+        { title: '在途数(个)', scopedSlots: { customRender: 'inTransit' }, width: 80, align: 'center' },
+        { title: '总库存数(个)', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '最大库存数(个)', scopedSlots: { customRender: 'upperLimit' }, width: 100, align: 'center' },
+        { title: '最小库存数(个)', scopedSlots: { customRender: 'lowerLimit' }, width: 100, align: 'center' },
         { title: '差异数量', dataIndex: 'differenceNum', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '预警提示', scopedSlots: { customRender: 'stockState' }, width: 100, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -234,12 +226,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 && 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
                 }
               }
             }
@@ -249,23 +241,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)
           }
@@ -310,43 +310,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 = ''
@@ -362,7 +332,7 @@ export default {
     },
     //  批量更新
     handleupdate () {
-      if (this.selectedRowKeys.length < 1) {
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1) {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
@@ -408,15 +378,6 @@ export default {
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       )
     },
-    //  导出
-    handleExport () {
-      const params = this.queryParam
-      this.exportLoading = true
-      // customerBundleExportDelay(params).then(res => {
-      //   this.exportLoading = false
-	  // downloadExcel(res, '库存预警')
-      // })
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 1 - 1
src/views/numsGoodsShelves/shelfMonitoring/list.vue

@@ -98,7 +98,7 @@
           :columns="columns"
           :data="loadData"
           rowKeyName="storeCallOutSn"
-          :rowSelection="{ columnWidth: 40 }"
+          :row-selection="{ columnWidth: 40 }"
           @rowSelection="rowSelectionFun"
           :scroll="{ y: tableHeight }"
           :defaultLoadData="false"

+ 21 - 78
src/views/outboundOrderManagement/outboundOrder/list.vue

@@ -48,8 +48,8 @@
       <div v-if="$hasPermissions('B_outboundBatchOut')" style="margin-bottom: 10px">
         <a-button type="primary" id="outboundOrderList-export" :loading="loading" @click="handleOutbounds">批量出库</a-button>
         <span style="margin-left: 5px" v-if="$hasPermissions('B_outboundBatchOut')">
-          <template v-if="hasSelected">
-            {{ `已选 ${selectedRowKeys.length} 项` }}
+          <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">
+            {{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}
           </template>
         </span>
       </div>
@@ -59,8 +59,10 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :row-selection="$hasPermissions('B_outboundBatchOut') ? rowSelection : null"
         :rowKey="(record) => record.outBizSn"
+        rowKeyName="outBizSn"
+        :row-selection="$hasPermissions('B_outboundBatchOut') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state == 'FINISH' } }) } : null"
+        @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -145,20 +147,18 @@ export default {
       },
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
-        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '关联单号', dataIndex: 'outBizNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '出库类型', dataIndex: 'outBizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位名称', dataIndex: 'demanderName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '总售价', dataIndex: 'productTotalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '审核时间', dataIndex: 'auditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
-        { title: '出库时间', dataIndex: 'outTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '总款数', dataIndex: 'productTotalCategory', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '总数量', dataIndex: 'productTotalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '总售价', dataIndex: 'productTotalPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
+        { title: '出库时间', dataIndex: 'outTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '出库状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
-      selectedRowKeys: [], // Check here to configure the default column
-      selectedRows: [],
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -184,38 +184,15 @@ export default {
       },
       openModal: false,
       orderSn: undefined,
-      outBizType: null //  当前单子类型   SALES销售出库        ALLOCATE调拨出库
-    }
-  },
-  computed: {
-    hasSelected () {
-      return this.selectedRowKeys.length > 0
-    },
-    rowSelection () {
-      if (this.$hasPermissions('B_outboundBatchOut')) {
-        return {
-          selectedRowKeys: this.selectedRowKeys,
-          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)
-          },
-          getCheckboxProps: record => ({
-            props: {
-              disabled: record.state == 'FINISH'
-            }
-          })
-        }
-      } else {
-        return null
-      }
+      outBizType: null, //  当前单子类型   SALES销售出库        ALLOCATE调拨出库
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     detailPermissions (row) {
       let state = false
       //  根据出库类型和对应功能权限 判断是否有查看详情的权限
@@ -263,31 +240,25 @@ export default {
       this.outBizType = row.outBizType
       //  根据出库类型跳转对应页面
       if (row.outBizType == 'PURCHASE_RETURN') { // 采购退货
-        // this.$router.push({ path: `/purchasingManagement/purchaseReturn/detail/${row.outBizSn}` })
         this.orderSn = row.outBizSn
         this.openModal = true
       } else if (row.outBizType == 'SPARE_PARTS_RETURN') { // 散件退货
         this.$message.warning('该出库类型对应页面未开发')
       } else if (row.outBizType == 'SALES') { // 销售
-        // this.$router.push({ path: `/salesManagement/salesQuery/detail/${row.outBizSn}` })
         this.orderSn = row.outBizSn
         this.openModal = true
       } else if (row.outBizType == 'DISPATCH_DEDUCT') { // 急件冲减
-        // this.$router.push({ path: `/salesManagement/urgentItemsOffset/detail/${row.outBizSn}` })
         this.orderSn = row.outBizSn
         this.openModal = true
       } else if (row.outBizType == 'SHOP_CALL_OUT') { // 店内调出
-        // this.$router.push({ path: `/allocationManagement/storeTransferOut/detail/${row.outBizSn}` })
         this.orderSn = row.outBizSn
         this.openModal = true
       } else if (row.outBizType == 'CHECK_ORDER_OUT') { // 库存盘点盘亏
         this.$message.warning('该出库类型对应页面未开发')
       } else if (row.outBizType == 'LINKAGE_CALL_OUT') { // 连锁调出
-        // this.$router.push({ path: `/allocationManagement/chainTransferOut/detail/${row.outBizSn}` })
         this.orderSn = row.outBizSn
         this.openModal = true
       } else if (row.outBizType == 'WAREHOUSE_CALL_OUT') { // 仓库调出
-        // this.$router.push({ path: `/allocationManagement/warehouseAllocation/detail/${row.outBizSn}` })
         this.orderSn = row.outBizSn
         this.openModal = true
       } else {
@@ -323,22 +294,21 @@ export default {
     },
     // 批量出库
     handleOutbounds () {
-      if (this.selectedRowKeys.length < 1) {
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1) {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
       this.loading = true
       this.spinning = true
       const params = []
-      this.selectedRows.map(item => {
+      this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map(item => {
         params.push({ outBizSn: item.outBizSn, outStockEnum: item.outBizType })
       })
       stockOutBatchOut(params).then(res => {
         this.loading = false
         if (res.status == 200) {
           this.$message.success(res.message)
-          this.selectedRowKeys = []
-          this.selectedRows = []
+          this.$refs.table.clearSelected() // 清空表格选中项
           this.$refs.table.refresh()
           this.spinning = false
         } else {
@@ -346,39 +316,12 @@ export default {
         }
       })
     },
-    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.outBizSn == subItem.outBizSn) {
-              arrId.push(index)
-            }
-          })
-        })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
-        })
-      }
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
-      this.selectedRowKeys = []
-      this.selectedRows = []
+      this.$refs.table.clearSelected() // 清空表格选中项
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight

+ 21 - 50
src/views/purchasingManagement/purchaseOrder/outStockModal.vue

@@ -11,14 +11,16 @@
     <a-spin :spinning="spinning" tip="Loading...">
       <div class="outStock-con">
         <div>
-          <p style="font-weight: bold;">当前已选:{{ selectedRowKeys.length }}个</p>
+          <p style="font-weight: bold;">当前已选:{{ rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length }}个</p>
           <!-- 列表 -->
           <s-table
             class="sTable"
             ref="table"
             size="small"
             :rowKey="(record) => record.productSn"
-            :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onChange, onSelect: onSelectChange, onSelectAll: onSelectAllChange }"
+            rowKeyName="productSn"
+            :row-selection="{ columnWidth: 40 }"
+            @rowSelection="rowSelectionFun"
             :data="loadData"
             :columns="columns"
             :scroll="{ y: 450 }"
@@ -81,11 +83,11 @@ export default {
       },
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
-        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '上次采购数量', dataIndex: 'qty', width: '20%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '上次缺货数量', dataIndex: 'cancelQty', width: '20%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '32%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '上次采购数量', dataIndex: 'qty', width: '18%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '上次缺货数量', dataIndex: 'cancelQty', width: '18%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -101,16 +103,19 @@ export default {
           return data
         })
       },
-      selectedRowKeys: [],
-      selectedRows: [],
-      spinning: false
+      spinning: false,
+      rowSelectionInfo: null
     }
   },
   methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     // 保存
     handleSave () {
       const _this = this
-      if (this.selectedRowKeys.length < 1) {
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1) {
         this.$message.warning('请在列表勾选后再进行操作!')
         return
       }
@@ -118,7 +123,7 @@ export default {
         confirm: false,
         purchaseBillSn: this.paramsData.purchaseBillSn,
         purchaseBillNo: this.paramsData.purchaseBillNo,
-        purchaseBillDetailEntityList: this.selectedRows
+        purchaseBillDetailEntityList: this.rowSelectionInfo && this.rowSelectionInfo.selectedRows
       }
       purchaseDetailCancelSave(params).then(res => {
         if (res.status == 200 && res.data) {
@@ -134,8 +139,7 @@ export default {
               okText: '好的',
               centered: true,
               onOk () {
-                _this.selectedRowKeys = []
-                _this.selectedRows = []
+                _this.$refs.table.clearSelected() // 清空表格选中项
               }
             })
           } else {
@@ -160,7 +164,7 @@ export default {
             confirm: true,
             purchaseBillSn: _this.paramsData.purchaseBillSn,
             purchaseBillNo: _this.paramsData.purchaseBillNo,
-            purchaseBillDetailEntityList: _this.selectedRows
+            purchaseBillDetailEntityList: _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows
           }
           purchaseDetailCancelSave(params).then(res => {
             if (res.status == 200) {
@@ -173,41 +177,9 @@ export default {
           })
         },
         onCancel () {
-          _this.selectedRowKeys = []
-          _this.selectedRows = []
+          _this.$refs.table.clearSelected() // 清空表格选中项
         }
       })
-    },
-    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 (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)
-          })
-        }
-      }
     }
   },
   watch: {
@@ -219,8 +191,7 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.selectedRowKeys = []
-        this.selectedRows = []
+        this.$refs.table.clearSelected() // 清空表格选中项
       }
     }
   }