cuijian
2023-11-16 e0cd695c11734348e1e01304bdff0696768c1fda
src/views/mdc/base/modules/deviceRepair/DeviceRepairListModel.vue
@@ -44,8 +44,8 @@
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="设备编码">
                <a-input placeholder="请输入设备编码检索" v-model="queryParam.equipmentId"></a-input>
              <a-form-item label="统一编码">
                <a-input placeholder="请输入统一编码检索" v-model="queryParam.equipmentId"></a-input>
              </a-form-item>
            </a-col>
@@ -66,7 +66,7 @@
      <div>
        <a-table ref="table" size="middle" bordered rowKey="id" :scroll="{  y: 400 }" :columns="columns"
                 :dataSource="dataSource" :pagination="ipagination" :loading="loading"
                 :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
                 :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,getCheckboxProps:getCheckboxProps,selections: true,}"
                 @change="handleTableChange">
        </a-table>
      </div>
@@ -110,6 +110,9 @@
      status: {
        type: Number,
        default: 1
      },
      selectedEquipmentIds:{
        type:String
      }
    },
    data() {
@@ -134,7 +137,7 @@
            }
          },{
            title: '设备编码',
            title: '统一编码',
            align: 'center',
            dataIndex: 'equipmentId',
          },
@@ -199,6 +202,9 @@
        this.selectionRows = selectionRows
        // this.SelectedList =[...this.SelectedList,...selectionRows];
        // console.log(this.SelectedList);
        console.log('selectedRowKeys',selectedRowKeys)
        console.log('selectionRows',selectionRows)
      },
      handleTableChange(pagination, filters, sorter) {
        // this.onClearSelected()
@@ -305,8 +311,6 @@
          }
        })
      },
      initGroupOptions() {
        getAction(this.url.loadProductionOptions).then(res => {
          if (res.success) {
@@ -319,6 +323,27 @@
            });
          }
        })
      },
      /**
       * 每次加载列表时判断已选中设备编号数组是否包含表格数据中的设备编号,如果包含则选中
       * @param record
       * @returns {{props: {defaultChecked: boolean}}}
       */
      getCheckboxProps(record){
        if(this.selectedEquipmentIds){
          let selectedEquipmentIdsArr=this.selectedEquipmentIds.split(',')
          return {
            props:{
              defaultChecked: selectedEquipmentIdsArr.includes(record.equipmentId)
            }
          }
        }else{
          return {
            props:{
              defaultChecked:false
            }
          }
        }
      }
    },
  }