lilei 5 days ago
parent
commit
fdef92263b
2 changed files with 18 additions and 10 deletions
  1. 7 5
      src/components/VTable/index.vue
  2. 11 5
      src/views/salesManagement/salesCollection/list.vue

+ 7 - 5
src/components/VTable/index.vue

@@ -206,7 +206,7 @@ export default {
   methods: {
     // 选择单元格
     selectedRowChange ({ row, isSelected, selectedRowKeys }) {
-      // console.log(isSelected, selectedRowKeys)
+      console.log(isSelected, selectedRowKeys)
       // 选中
       if (isSelected) {
         this.selectedRows.push(row)
@@ -220,7 +220,7 @@ export default {
     },
     // 全选或取消本页行
     selectedAllChange ({ isSelected, selectedRowKeys }) {
-      // console.log(isSelected, selectedRowKeys)
+      console.log(isSelected, selectedRowKeys)
       // 全选
       if (isSelected) {
         // 合并数组,并去重
@@ -242,12 +242,13 @@ export default {
     // 触发已选项事件
     onRowSelection () {
       // console.log(this.selectedRows)
-      const selectedRowKeys = this.selectedRows.map(item => item[this.rowKeyName])
-      this.$emit('rowSelection', { selectedRows: this.selectedRows, selectedRowKeys: selectedRowKeys })
+      const result = this.selectedRows.filter(item => !this.disableSelectedRowKeys.includes(item[this.rowKeyName]))
+      const selectedRowKeys = result.map(item => item[this.rowKeyName])
+      this.$emit('rowSelection', { selectedRows: result, selectedRowKeys: selectedRowKeys })
     },
     // 页码改变的时候设置新页的已选项
     setCheckedRows () {
-      const list = this.selectedRows.map(item => item[this.rowKeyName])
+      const list = this.selectedRows.filter(item => !this.disableSelectedRowKeys.includes(item[this.rowKeyName])).map(item => item[this.rowKeyName])
       this.selectedRowKeys = this.localDataSource.filter(item => list.includes(item[this.rowKeyName])).map(item => item[this.rowKeyName])
     },
     /**
@@ -256,6 +257,7 @@ export default {
     clearSelected () {
       this.selectedRowKeys = []
       this.selectedRows = []
+      this.onRowSelection()
     },
     // 设置 table 已选中项
     setTableSelected (selectedRowKeys) {

+ 11 - 5
src/views/salesManagement/salesCollection/list.vue

@@ -141,13 +141,14 @@
           </span>
         </div>
         <!-- 列表 -->
-        <s-table
+        <v-table
           class="sTable fixPagination"
           ref="table"
           :style="{ height: tableHeight+68+'px' }"
           size="small"
-          :row-selection="showSelect?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.settleState=='FINISH' } })}:null"
+          :row-selection="showSelect?{ columnWidth: 40 }:null"
           @rowSelection="rowSelectionFun"
+          :disableSelectedRowKeys="disableSelectedRowKeys"
           :rowKey="(record) => record.id"
           :columns="columns"
           :data="loadData"
@@ -182,7 +183,7 @@
               id="financialCollectionList-voucher-btn">凭证</a-button>
             <span v-if="record.settleState=='WAIT' && record.voidFlag==1">--</span>
           </template>
-        </s-table>
+        </v-table>
 
         <!-- 销售收款凭证 -->
         <voucherModal v-drag ref="voucherModal" modalTit="销售收款凭证" :openModal="showVoucher" @cancel="closeVoucherModal"></voucherModal>
@@ -218,7 +219,7 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { STable, VSelect } from '@/components'
+import { VTable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import subarea from '@/views/common/subarea.js'
 import Area from '@/views/common/area.js'
@@ -232,7 +233,7 @@ import customerService from '@/views/common/customerService'
 export default {
   name: 'SalesCollectionList',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, rangeDate, commonModal, Area, voucherModal, dealerSubareaScopeList, salesDetail, dispatchDetail, customerService },
+  components: { VTable, VSelect, subarea, rangeDate, commonModal, Area, voucherModal, dealerSubareaScopeList, salesDetail, dispatchDetail, customerService },
   data () {
     return {
       spinning: false,
@@ -283,6 +284,9 @@ 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 (data.list[i].settleState == 'FINISH') {
+                this.disableSelectedRowKeys.push(data.list[i].id)
+              }
             }
             this.total = data.count || 0
             this.disabled = false
@@ -291,6 +295,7 @@ export default {
           return data
         })
       },
+      disableSelectedRowKeys: [],
       total: 0, // 合计
       rowSelectionInfo: null, // 批量选择的数据
       handlePlData: [], // 收款临时数据
@@ -348,6 +353,7 @@ export default {
     },
     // 表格选中项
     rowSelectionFun (obj) {
+      console.log(obj)
       this.rowSelectionInfo = obj || null
     },
     //  选择审核时间  change