ElementUI对表格某一行执行操作和批量操作限制

<div slot="header" >
    <el-row type="flex" justify="space-between">
        <el-col :span="12">
            <el-button size="mini" @click="down(1)">批量下载</el-button>
            <el-button size="mini" @click="deletes(1)">批量删除</el-button>
        </el-col>
    </el-row>
</div>
<el-table :data="tableData" border style="width: 100%" ref="multipleTable">
    <el-table-column type="selection" width="40" align="center"></el-table-column>                        
    <el-table-column type="index" label="序号" width="50" :index="indexMethod" align="center"></el-table-column>
    <el-table-column prop="username" label="用户名称" align="center"></el-table-column>          
    <el-table-column prop="authorFirm" label="作者单位" align="center"></el-table-column>        
    <el-table-column fixed="right" label="操作" align="center" width="80px">
        <template slot-scope="scope">
            <i class="el-icon-edit blue" @click="editForm(scope.row)"></i>&nbsp;
            <i class="el-icon-download blue" @click="down(scope.row)"></i>&nbsp;
            <i class="el-icon-delete blue" @click="deletes(scope.row)"></i>
        </template>
    </el-table-column>
</el-table>
deletes(scope) {
    var vm=this;
    var arr="";
    // 批量删除
    if(scope==1){
        var data = this.$refs.multipleTable.selection;
        data.forEach(function(item){
            arr += item.guid+','
        });
    }else{
        // 删除
        arr=scope.guid+','
    }
        this.$alert('此操作将永久删除该模型文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
    type: 'warning'
    }).then(() => {
        request.delete(apis.manageModel+'/'+arr)
        .then(function(response) {
        if (response.data.code== 200) {
            vm.findForm(1)
        }
        })
        .catch(function(error) {
            console.log(error);
        });
    })
},
//下载文件
down(scope) {
    var vm=this;
    var arr="";
    // 批量下载
    if(scope==1){
        var data = this.$refs.multipleTable.selection;
        data.forEach(function(item){
            arr += item.guid+','
        });
    }else{
        // 下载当前行 
        arr=scope.guid+','
    }
    window.location.href = apis.modelFile+'/'+arr;
},

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值