| | |
| | | <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> |
| | |
| | | status: { |
| | | type: Number, |
| | | default: 1 |
| | | }, |
| | | selectedEquipmentIds:{ |
| | | type:String |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | 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() |
| | |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | |
| | | initGroupOptions() { |
| | | getAction(this.url.loadProductionOptions).then(res => { |
| | | if (res.success) { |
| | |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | /** |
| | | * 每次加载列表时判断已选中设备编号数组是否包含表格数据中的设备编号,如果包含则选中 |
| | | * @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 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | } |