1.table内容展示

<el-table stripe :key='tableKey' header-cell-class-name="bindonce" :data="tableList" v-loading="listLoading" element-loading-text="列表正在加载中" border fit highlight-current-row
style="width: 100%;" @selection-change="selectionChange">
<el-table-column align="center" type="selection" width="55px"></el-table-column> <el-table-column align="center" :label="'会员卡名称'" width="150" sortable prop="scope.row.name">
<template slot-scope="scope">
<span v-text="scope.row.name"></span>
</template>
</el-table-column> <el-table-column align="center" :label="'会员卡类型'" width="120" prop="scope.row.type"
:filters="[{text: '全部', value: 0},{text: '时效卡', value: 1}, {text: '次卡', value: 2}]"
:filter-method="filterType" filter-placement="bottom-end" :filter-multiple="false">
<template slot-scope="scope">
<span>{{scope.row.type === 1 ? '时效卡' : '次卡'}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'总时间/次数'" width="150" sortable prop="scope.row.times">
<template slot-scope="scope">
<span>{{ scope.row.type===1 ? scope.row.times + '天' : scope.row.times + '次'}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'价格(元)'" width="150" sortable prop="scope.row.price">
<template slot-scope="scope">
<span>{{scope.row.price}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'底价(元)'" width="150" sortable prop="scope.row.floor_price">
<template slot-scope="scope">
<span>{{scope.row.floor_price}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'APP状态'" width="150" sortable prop="scope.row.app_status">
<template slot-scope="scope">
<span>{{scope.row.app_status === 1? '下架':'上架'}}</span>
</template>
</el-table-column> <el-table-column align="center" :label="'SAAS状态'" width="150" sortable prop="scope.row.saas_status">
<template slot-scope="scope">
<span>{{scope.row.saas_status === 1? '下架' : '上架'}}</span>
</template>
</el-table-column> <el-table-column width="150px" align="center" :label="'会员卡图标'">
<template slot-scope="scope">
<span><img :src="scope.row.photo" @click="common.bigImg($event)" alt="icon" width="30" height="30" style="margin-left:50px;display: list-item;border-radius:50%;"></span>
</template>
</el-table-column> <el-table-column width="200px" align="center" label="创建时间<i class='el-icon-date'></i>" sortable prop="scope.row.created_at">
<template slot-scope="scope">
<span>{{scope.row.created_at}}</span>
</template>
</el-table-column> <el-table-column align="center" fixed="right" :label="$t('table.actions')" min-width="230" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="primary" plain
@click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-dropdown trigger="click">
<el-button size="mini" type="danger" plain>删除</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleDelete(scope.$index, tableList)">确定</el-dropdown-item>
<el-dropdown-item>取消</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>

2.编辑

handleEdit(index, row) {
this.subStatus = 'edit_' + index
this.formData = Object.assign({}, row)
this.DialogVisible = true
this.add_edit = true
this.$nextTick(() => {
this.$refs.imgbox.setImg(row.photo)
})
},
editsubmit() {
let self = this
this.$refs.formbox.validate(valid => {
if (valid) {
self.loading = true
editVipCard(self.formData).then(response => {
self.loading = false
self.DialogVisible = false
let index = self.subStatus.split('_')[1]
self.$set(self.tableList, index, response.data)
// this.getList()
})
} else {
console.log('error submit!!')
return false
}
})
},

3.删除

handleDelete(index, rows) {
deleteVipCard(rows[index].id).then(res => {
rows.splice(index, 1)
}).catch(() => {
this.common.Message('error', '删除失败!')
})
}

4.table中使用checkbox,判断选中状态

在table中加入@selection-change="selectionChange"

// 点击checkbox获得对应id
selectionChange(selection) {
this.groupOprate.ids = []
for (let i = 0; i < selection.length; i++) {
this.groupOprate.ids.push(selection[i].id)
}
console.log(this.groupOprate.ids)
},

vue+elementUI table篇的更多相关文章

  1. 关于【vue + element-ui Table的数据多选,多页选择数据回显,分页记录保存选中的数据】的优化

    之前写的[vue + element-ui Table的数据多选,多页选择数据回显,分页记录保存选中的数据]这篇博客.功能虽然实现了相对应的功能.但是用起来很不爽.所以进行了优化. 备注:最近可能没时 ...

  2. Vue Element-ui table只展开一行

    直接上代码了哈~ <template> <div class="app-content"> <div class="table_expand ...

  3. vue + element-ui Table的数据多选,多页选择数据回显,分页记录保存选中的数据。

    业务的需要:我要对与会人员勾选,记录所选的与会人员,并且点击到别的页面上时也要记录所勾选的.第一次尝试,每次点击下一页数据都会清空.然后我就去element ui官网查看了api.实现如下: 在tab ...

  4. vue element-ui Table数据解除自动响应方法

    在对列表Table进行数据编辑时,会存在table的增删改操作后,列表view也自动响应发生了变化,原因是赋值的数据是一个引用类型共享一个内存区域的.所以我们就不能直接连等复制,需要重新克隆一份新的数 ...

  5. vue elementui table 双击单元格实现编辑,聚焦,失去焦点,显示隐藏input和span

    <el-table :data="tableData" class="tb-edit" style="width: 100%" ref ...

  6. vue elementui table 内按钮跳转页面

    vue : <el-table-column label="操作" v-if="isColumOperate"> <template slot ...

  7. vue elementui table组件内容换行

    解决方案 tableData = [ { "name": "domain111", "metric": [ "平均耗时" ...

  8. Vue + Element-ui实现后台管理系统(5)---封装一个Form表单组件和Table表格组件

    封装一个Form表单组件和Table组件 有关后台管理系统之前写过四遍博客,看这篇之前最好先看下这四篇博客.另外这里只展示关键部分代码,项目代码放在github上: mall-manage-syste ...

  9. SpringBoot + Vue + ElementUI 实现后台管理系统模板 -- 后端篇(五): 数据表设计、使用 jwt、redis、sms 工具类完善注册登录逻辑

    (1) 相关博文地址: SpringBoot + Vue + ElementUI 实现后台管理系统模板 -- 前端篇(一):搭建基本环境:https://www.cnblogs.com/l-y-h/p ...

随机推荐

  1. Codeforces704B. Ant Man

    n<=5000个数轴上的点,有属性x,a,b,c,d,从i跳到j的代价如下: 问从s跳到t的最小代价. 方法?:先构造s->t链,然后依次插入其他点,每次选个最佳的位置.过了这题,正确性不 ...

  2. Linux下汇编语言学习笔记17 ---

    这是17年暑假学习Linux汇编语言的笔记记录,参考书目为清华大学出版社 Jeff Duntemann著 梁晓辉译<汇编语言基于Linux环境>的书,喜欢看原版书的同学可以看<Ass ...

  3. Spring在Java Filter注入Bean为Null的问题解决

    在Spring的自动注入中普通的POJO类都可以使用@Autowired进行自动注入,但是除了两类:Filter和Servlet无法使用自动注入属性.(因为这两个归Web容器管理)可以用init(集承 ...

  4. 如何利用神经网络和Python生成指定模式的密码

    今天给大家介绍的是Github上一个名叫PyMLProjects的项目,这个项目的目的是为了训练AI来学习人类构造密码的模式,然后我们就可以用AI来生成大量同一模式或种类的密码了.这种方法也许可以用来 ...

  5. Android多媒体-MediaPlayer唤醒锁及音频焦点

    MediaPlayer的唤醒锁 一般使用MediaPlayer播放音频流,推荐使用一个Service来承载MediaPlayer,而不是直接在Activity里使用.可是Android系统的功耗设计里 ...

  6. MySQL中文參考手冊

    非常好的中文手冊: 链接:http://www.sdau.edu.cn/support/mysq_doc/manual_toc.html

  7. 【bzoj2748】[HAOI2012]音量调节

    设F[i][j]表示在第i首歌曲结束后,音量能否刚好为j 转移:F[i][j]=F[i][j-C[i]] or F[i][j+C[i]] 初始化:F[0][beginlevel]=true 最后在所有 ...

  8. HTTP要点概述:十,内容协商

    一,内容协商(Content Negotiation) 同一个Web网站可能存在很多份相同内容的页面,比如英文版和中文版的Web页面,它们内容上相同,但是使用语言不同.比如大家进入英文版的google ...

  9. ios29--多线程

    进程是指在系统中正在运行的一个应用程序(一个程序可以对应多个进程).每个进程之间是独立的,每个进程均运行在其专用且受保护的内存空间内.比如同时打开迅雷.Xcode,系统就会分别启动2个进程.1个进程要 ...

  10. XML解析方式汇总

    XML解析方式汇总 分类: XML2011-08-23 19:19 167人阅读 评论(0) 收藏 举报 xmlstringexceptionattributesclassiterator DOM解析 ...