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. 【ZJOI2017 Round1练习&BZOJ4774】D3T2 road(斯坦纳树,状压DP)

    题意: 对于边带权的无向图 G = (V, E),请选择一些边, 使得1<=i<=d,i号节点和 n − i + 1 号节点可以通过选中的边连通, 最小化选中的所有边的权值和. d< ...

  2. Operating system management of address-translation-related data structures and hardware lookasides

    An approach is provided in a hypervised computer system where a page table request is at an operatin ...

  3. iOS点击cell时,控件背景色消失的解决方法

    同时调用一下两个方法: - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected ...

  4. 动态链接 - dll和so文件区别与构成

    动态链接,在可执行文件装载时或运行时,由操作系统的装载程序加载库.大多数操作系统将解析外部引用(比如库)作为加载过程的一部分.在这些系统上,可执行文件包含一个叫做import   directory的 ...

  5. MongoDB学习day02--数据库增删改查

    (window系统,在cmd命令提示符中使用) 一.数据库使用 管理mongodb数据库:mongo,连接本地数据库,或mongo 127.0.0.1:27017,连接其他服务器:mongo  ip: ...

  6. Linux下启用IP转发功能(主要针对Ubuntu的使用)

    说明:以下的操作只要在Linux下都是通用的. Linux发行版默认情况下是不开启IP转发功能的.如果架设一个Linux路由或者VPN服务就需要开启该服务. 1.通过访问sysctl的内核ipv4.i ...

  7. 建立DHCPserver

    一.实验的目的:     实现以下的要求的DHCPserver,了解子网内的IP分配的情况. 二.实验目标 虚拟机 vm1:192.168.6.3/24属于子网VMnet8. 在其上建立DHCPser ...

  8. 华为OJ2011-最长公共子串

    一.题目描述 描述: 计算两个字符串的最大公共子串(Longest Common Substring)的长度,字符区分大小写. 输入: 输入两个字符串 输出: 输出一个整数 样例输入: asdfas ...

  9. [Unity-21] Prefab具体解释

    1.什么是Prefab? Prefab又被称为预设,以下部分来自官网:预置是一种资源类型--存储在项目视图中的一种可反复使用的游戏对象.预置能够多次放入到多个场景中. 当你加入一个预置到场景中,就创建 ...

  10. python-----重命名文件(在原文件名前加0)

    问题描述: 如果用循环给文件命名,则文件名就会是1,2,3...,10,11,12,13...,100,101...,但是遍历这些文件时,顺序就会变成1,10,100,101,...109,11,.. ...