el table 列表头变成按钮 弹窗

在这里插入图片描述
在这里插入图片描述

  <el-table-column prop="aid_name" label="跟单人员" >
      <template slot="header" slot-scope="scope">
        <el-button type="primary" icon="el-icon-search" @click="filter_aid()">跟单人员</el-button>
      </template>
      
      <template slot-scope="scope">
        <span>${ scope.row.aid_name }</span>
      </template>
    </el-table-column>

<el-dialog
  	title="选择跟单"
  	:visible.sync="choose_aid_dialog"
  	width="30%"
  	>
  	<span>
  		<el-form ref="form" :model="form" label-width="80px">
  			<el-form-item label="操作">
			    <el-button type="primary" size="mini" @click="chooseAll(1)">全选</el-button>
			    <el-button type="primary" size="mini" @click="chooseAll(2)">反选</el-button>
			</el-form-item>
       <el-form-item label="跟单人员">
          <el-checkbox-group v-model="choose_aid_data">
              <template>
                  <el-checkbox :label="item.value" v-for="item of aid_list"> ${ item.label } </el-checkbox>
              </template>
          </el-checkbox-group>
			</el-form-item>
		</el-form>
  	</span>
  	<span slot="footer" class="dialog-footer">
    	<el-button @click="choose_aid_dialog = false">取 消</el-button>
    	<el-button type="primary" @click="confirmAid">确 定</el-button>
  	</span>
</el-dialog>

     not_finish_data: [],  //table 内容
     not_finish_data_all: [],  //table 原内容
     choose_aid_dialog  : false, //选择跟单弹框
     choose_aid_data    : [],  //选中跟单
     aid_list   : [],  //跟单列表
 
 filter_aid(){
        var that = this
        if(that.aid_list.length == 0){
          return;
        }
        that.choose_aid_data = []
        for(var i in that.aid_list){
          that.choose_aid_data.push(that.aid_list[i]['value']);
        }
        that.choose_aid_dialog = true;
      },
      /**
       * 全选与否
       * */
      chooseAll(type){
        var that = this
        if (type == 1) {
          that.choose_aid_data = []
          for(var i in that.aid_list){
            that.choose_aid_data.push(that.aid_list[i]['value']);
          }
        }else{
          that.choose_aid_data = []
        }

      },

      /**
       * 确认选择跟单
       * */
      confirmAid(){
        var that = this
        if (that.choose_aid_data.length == 0) {
          that.$message({
            message: '请选择跟单人员!',
            type: 'warning'
          })
          return
        }
        if(that.choose_aid_data.length == that.aid_list.length){
          that.not_finish_data = that.not_finish_data_all;
        }
        else{
          that.not_finish_data = [];
          var data_all = that.not_finish_data_all;
          var choose_aid_all = that.choose_aid_data;
          for (let i = 0; i < data_all.length; i++) {
            var aid = data_all[i]['aid'];
            var aid_index = choose_aid_all.indexOf(aid);
            if(aid_index > -1){
              that.not_finish_data.push(data_all[i]);
            }
            else{
              console.log("秃几把,没被选中")
            }
          }

        }
        that.choose_aid_dialog = false;
      },

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值