处理element-ui穿梭框-加载慢 性能优化 方案

用el-table 添加 移除 方式处理 穿梭框 从左与右的双向选择

  1. 通过条件 筛选 效果图如下
    在这里插入图片描述

  2. 主业务逻辑层代码

<div>
	<el-input v-model="teachName" placeholder="输入姓名搜索" style="width:200px;" size="mini" clearable />
	<el-button type="primary" size="mini" icon="el-icon-search" style="margin-left: 10px;" @click="getData">查询</el-button>
  </div>
  <el-col :span="12">
	<el-table :data="tabDataLeft" border style="100%" size="mini" fit highlight-current-row>
	  <el-table-column label="可选">
		<!-- <el-table-column label="序号" type="index" :index="courseIndex" /> -->
		<el-table-column prop="fullName" label="姓名"></el-table-column>
		<el-table-column prop="workPlace" label="单位"></el-table-column>
		<el-table-column prop="position" label="职务"></el-table-column>
		<el-table-column label="添加" width="50">
		  <template slot-scope="scope">
			<el-button type="text" icon="el-icon-circle-plus-outline" class="underline btn24" size="mini" @click="handleAddData(scope.$index)"></el-button>
		  </template>
		</el-table-column>
	  </el-table-column>
	</el-table>
	<!-- <pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="getData" /> -->
  </el-col>
 <el-col :span="12">
	<el-table :data="tabDataRight" border style="100%" size="mini" fit highlight-current-row>
	  <el-table-column label="已选">
		<el-table-column prop="fullName" label="姓名"></el-table-column>
		<el-table-column prop="workPlace" label="单位"></el-table-column>
		<el-table-column prop="position" label="职务"></el-table-column>
		<el-table-column label="移除">
		  <template slot-scope="scope">
			<el-button type="text" icon="el-icon-remove-outline" class="underline btn24" size="mini" @click="handleRemoveData(scope.$index)">移除</el-button>
		  </template>
		</el-table-column>
	  </el-table-column>
	</el-table>
  </el-col>
  1. 调用方法
handleAddData(index) {        // 添加
  this.tabDataRight.push(this.tabDataLeft[index])        //右边添加
  this.tabDataLeft.splice(index, 1)                      //左边移除
},
handleRemoveData(index){        // 移除
  this.tabDataRight.splice(index, 1)
},
getData(){         // 获取信息列表
  var teachDto = ....     // 构建查询dto this.page 分页对象
  resTeachersList(teachDto, this.page).then((res) => {            
    this.tabDataLeft = res.data.records
    this.total = res.data.total
  })
},
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值