【element-ui】表格

news2024/10/5 20:25:15

效果展示

组件代码

    <el-table class="compTableClass" ref="tableOOOOO"
      :class="('className' in tableConfig)?tableConfig.className:''"
      :data="tableConfig.data" 
      :height="tableConfig.height" 
      style="width: 100%"
      highlight-current-row
      @row-click="tableTRclickFun"
      @selection-change="handleSelectionChange"
    >
        <el-table-column type="selection" width="60" v-if="tableConfig.checkbox"></el-table-column>
        <el-table-column align="center" label="选择" width="100" v-if="('radius' in tableConfig)">
          <template slot-scope="scope">
            <el-radio class="radioOOOClass" :label="scope.row['id']" v-model="tableRadio" @change.native="getCurrentRow(scope.row)"></el-radio>
          </template>
        </el-table-column>
        <el-table-column type="index" align="center" width="60" label="序号" v-if="tableConfig.index"></el-table-column>
        <el-table-column align="center"
          v-for="(item2,index2) in tableConfig.head" :key="index2"
          :label="item2.label"
          :width="('width' in item2)?item2.width:'auto'"
          :min-width="('width' in item2)?item2.width:'auto'"
        >
          <template slot-scope="scope">
            <span v-if="item2.type==61" class="spanIMG">
              <img 
                :src="(scope.row[item2.prop]&&scope.row[item2.prop].length>0)?scope.row[item2.prop]:require('@/assets/images/srchResult/zOtherpp999.png')"
                @error="$commonOpt.errorImageShow($event)"
              />
              <span v-if="('bkKey' in item2)&&(scope.row[item2.bkKey]==1)">已布控</span>
            </span>
            <span v-if="item2.type==6266" class="spanText1_66" :title="scope.row[item2.prop]" :style="('maxWidth' in item2)?{'max-width':item2.maxWidth}:{}">{{ scope.row[item2.prop] }}</span>
            <span v-if="item2.type==62" class="spanText1" :title="scope.row[item2.prop]" :style="('maxWidth' in item2)?{'max-width':item2.maxWidth}:{}">{{ scope.row[item2.prop] }}</span>
            <span v-if="item2.type==63" class="spanText2">{{ scope.row[item2.prop] }}</span>
            <span v-if="item2.type==64" class="spanText3">{{ scope.row[item2.prop] }}</span>
            <span v-if="item2.type==65" class="spanIMG2">
              <img :src="item2.list[scope.row[item2.prop]]['img']"/>
            </span>
            <span v-if="(item2.type==66)&&(item2.list[scope.row[item2.prop]])" class="spanText4">
              <span :style="{'background':item2.list[scope.row[item2.prop]]['bgColor']}">{{ item2.list[scope.row[item2.prop]]['label'] }}</span>
              <span v-if="'prop2' in item2" style="margin-left:5px;">({{scope.row[item2.prop2]}}次)</span>
            </span>
            <span v-if="item2.type==67" class="spanText1">
              {{ scope.row[item2.prop].split(" ")[0] }}
              <br/>
              {{ scope.row[item2.prop].split(" ")[1] }}
            </span>
            <span v-if="(item2.type==68)&&(scope.row[item2.prop].length>0)" class="spanText4">
              <span style="background:#E60012">{{ scope.row[item2.prop] }}</span>
              <span v-if="'prop2' in item2" style="margin-left:5px;">({{scope.row[item2.prop2]}}次)</span>
            </span>
            <span v-if="(item2.type==680)&&(scope.row[item2.prop].length>0)" class="spanText4Root">
              <span class="spanText4" v-for="(tt,ii) in scope.row[item2.prop]" :key="ii">
                <span style="background:#E60012">{{ tt }}</span>
              </span>
            </span>
            <span v-if="(item2.type==88)&&(item2.list[scope.row[item2.prop]])" class="spanText4">
              <span :style="{'background':item2.list[scope.row[item2.prop]]['bgColor']}">{{ item2.list[scope.row[item2.prop]]['label'] }}</span>
            </span>
            <span v-if="item2.type==98" class="spanIMG9">
              <img v-for="(item98,index98) in item2.btns" :key="index98" 
                :title="('tt' in item98)?(item98.list[scope.row[item98.val]]['title']):item98.title"
                :src="('tt' in item98)?(item98.list[scope.row[item98.val]]['img']):item98.img" 
                :style="{'width':item98.wh[0]+'px','height':item98.wh[1]+'px'}"
                v-show="('ss' in item98)?(scope.row[item98['ss']]):true"
                @click.stop="tableEventFun(item2,scope.row,item98)"
              />
            </span>
            <span v-if="item2.type==99" class="spanBtn">
              <span v-for="(item99,index99) in item2.btns" :key="index99"
                v-show="('ss' in item99)?(scope.row[item99['ss']]):true"
                @click.stop="tableEventFun(item2,scope.row,item99)"
              >{{ ('tt' in item99)?(item99.list[scope.row[item99.val]]['text']):item99.text }}</span>
            </span>
          </template>
        </el-table-column>
      </el-table>

模拟数据

    initTable() {
        let list = [];
        for (let i = 0; i < 20; i++) {
            list.push({
                    id: i,
                    img: "",
                    xm: "***",
                    dz: "河北省石家庄市桥西区红旗大街123号",
                    bfb: "99.9%",
                    hm: "130999999999999999",
                    lx: Math.floor(Math.random() * 2 + 1),
                    lx2: Math.floor(Math.random() * 2 + 1),
                    lx2NN: Math.floor(Math.random() * 99),
                    lal:["类型1","类型2","类型3"],
                    time: "2023-09-06 17:08:30",
                    zt:Math.floor(Math.random() * 2 + 1),
                    noInfo: Math.floor(Math.random() * 2 + 1), //1-有数据;2-无数据
            });
        }
        this.tableConfig.data = this.tableCardList;
    }

配置参数

    【data】
     tableConfig: {
                height: 690,
                index: true,
                checkbox: true,
                head: [
                    { type: 61, prop: "img", label: "照片",width:"200px" },
                    { type: 62, prop: "xm", label: "姓名",width:"200px" },
                    { type: 6266, prop: "dz", label: "地址",maxWidth:"100px" ,width:"200px"},
                    { type: 63, prop: "bfb", label: "相似度",width:"200px" },
                    { type: 64, prop: "hm", label: "证件号码" ,width:"200px"},
                    {
                        type: 65,
                        prop: "lx",
                        label: "类型",
                        width:"200px",
                        list: {
                            1: {
                                img: require("@/assets/images/srchResult/table_td_1_1.png"),
                            },
                            2: {
                                img: require("@/assets/images/srchResult/table_td_1_2.png"),
                            },
                        },
                    },
                    {
                        type: 66,
                        prop: "lx2",
                        prop2: "lx2NN",
                        label: "类型",
                        width:"200px",
                        list: {
                            1: { label: "类型1", bgColor: "#E60012" },
                            2: { label: "类型2", bgColor: "#FA913D" },
                        },
                    },
                    { type: 680, prop: "lal", label: "类型",width:"200px" },
                    { type: 67, prop: "time", label: "结算时间",width:"200px" },
                    {
                        type: 88,
                        prop: "zt",
                        label: "任务状态",
                        width:"200px",
                        list: {
                            1: { label: "进行中", bgColor: "#6aa84f" },
                            2: { label: "已停止", bgColor: "#cccccc" },
                        },
                    },
                    {
                        type: 98,
                        btns: [
                            {
                                mm: 1,
                                title: "画像",
                                img: require("@/assets/images/srchResult/table_1.png"),
                                wh: [20, 20],
                            },
                            {
                                mm: 2,
                                title: "详情",
                                img: require("@/assets/images/srchResult/table_2.png"),
                                wh: [24, 18],
                            },
                            {
                                mm: 3,
                                title: "删除",
                                img: require("@/assets/images/srchResult/table_3.png"),
                                wh: [18, 20],
                            },
                        ],
                        label: "操作",
                        width:"200px",
                    },
                    {
                        type: 99,
                        btns: [{ mm: 1, text: "查看" }],
                        label: "操作",
                        width:"200px",
                    },
                ],
                data: [],
    }

    【回调方法】
    //表格-按钮回调
    tableEventCallback(item, data, item2) {
            if (item2) {
                debugger;
            }
    },

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1156244.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【ES专题】ElasticSearch 高级查询语法Query DSL实战

目录 前言阅读对象阅读导航前置知识数据准备笔记正文一、ES高级查询Query DSL1.1 基本介绍1.2 简单查询之——match-all&#xff08;匹配所有&#xff09;1.2.1 返回源数据_source1.2.2 返回指定条数size1.2.3 分页查询from&size1.2.4 指定字段排序sort 1.3 简单查询之——…

CUMT-----Java课后第三章编程作业

文章目录 一、题11.1 题目描述1.2 代码块1.3 运行截图 二、题22.1 题目描述2.2 代码块2.3 运行截图 一、题1 1.1 题目描述 1.2 代码块 public class Book {private String name;private int pages;public String getname(){return name;}public void setname(String name){th…

HarmonyOS(二)—— 初识ArkTS开发语言(上)之TypeScript入门

前言 Mozilla创造了JS&#xff0c;Microsoft创建了TS&#xff0c;而Huawei进一步推出了ArkTS。因此在学习使用ArkTS前&#xff0c;需要掌握基本的TS开发技能。 ArkTS介绍 ArkTS是HarmonyOS优选的主力应用开发语言。它在TypeScript&#xff08;简称TS&#xff09;的基础上&am…

网络安全安全领域最容易搞混的四个名词:Network网络安全、Cyber网络安全、数据安全、信息安全

在安全领域我们经常会遇到Network网络安全、Cyber网络安全、数据安全、信息安全&#xff0c;它们看起来都差不多&#xff0c;那么它们之间有什么区别呢&#xff1f; 如果你对网络安全入门感兴趣&#xff0c;那么你需要的话可以点击这里&#x1f449;【入门&进阶全套282G学…

基于PyTorch的共享单车使用数量预测研究

收藏和点赞&#xff0c;您的关注是我创作的动力 文章目录 概要 一、预测模型的实现3.1数据的获取和预处理3.2划分数据集3.3构建神经网络 二、PyTorch框架三 原理2.1前馈神经网络2.1.1 BP神经网络 四 预测效果验证4.1小批量梯度下降4.2批量梯度下降4.3随机梯度下降 五 结 论目录…

javascript的webstorage数据存储问题,不能直接存undefined

这篇文章分享一下自己使用sessionStorage遇到的一个小问题&#xff0c;以后遇到要避坑。 需求是easyui表格的单元格编辑&#xff0c;点击保存的时候会结束当前行的编辑&#xff0c;然后修改editingId&#xff08;当前编辑行记录的ID&#xff09;。 目录 一、待解决问题 二、完…

CN考研真题知识点二轮归纳(3)

持续更新&#xff0c;上期目录&#xff1a; CN考研真题知识点二轮归纳&#xff08;2&#xff09;https://blog.csdn.net/jsl123x/article/details/134111760?spm1001.2014.3001.5501 1.TCP/IP 名称&#xff1a;传输控制协议/网络协议&#xff0c;是一个协议族&#xff0c;主…

机器人仿真——gazebo学习笔记(0)

Gazebo是一个功能强大的三维物理仿真平台&#xff0c;具有强大的物理引擎、高质量的图形渲染能力、重点是他是开源的、免费的。 1.Gazebo具备以下几个特点: 1.动力学仿真:支持多种高性能物理引擎,像ODE、Bullet等. 2.三维可视化环境:x、y、z三维环境。 3.传感器仿真:支持传…

【MATLAB】全网唯一的13种信号分解+FFT傅里叶频谱变换联合算法全家桶

有意向获取代码&#xff0c;请转文末观看代码获取方式~ 大家吃一顿火锅的价格便可以拥有13种信号分解FFT傅里叶频谱变换联合算法&#xff0c;绝对不亏&#xff0c;知识付费是现今时代的趋势&#xff0c;而且都是我精心制作的教程&#xff0c;有问题可随时反馈~也可单独获取某一…

数据仓库-拉链表

在数据仓库中制作拉链表&#xff0c;可以按照以下步骤进行&#xff1a; 确定需求&#xff1a;首先明确需要使用拉链表的场景和需求。例如&#xff0c;可能需要记录历史数据的变化&#xff0c;以便进行时间序列分析等。设计表结构&#xff1a;在数据仓库中&#xff0c;拉链表通…

uniapp 使用 UDP

一、搭建UDP服务端&#xff0c;nodejs const dgram require("dgram");const message Buffer.from("你好&#xff0c;这是一个UDP广播消息"); const port 3000; // 用你想要的端口替换这里// 创建一个UDP套接字 const socket dgram.createSocket("…

《TCP/IP详解 卷一:协议》第5章的IPv4数据报的IHL字段解释

首先说明一下&#xff0c;这里并不解释整个IPv4数据报各个字段的含义&#xff0c;仅仅针对IHL字段作解释。 我们先看下IPv4数据报格式 对于IHL字段&#xff0c; 《TCP/IP详解 卷一&#xff1a;协议》这么解释&#xff1a; IPv4数据报。头部大小可变&#xff0c;4位的IHL字段…

队列的链式存储结构与实现

前言 在前面我们学习了队列的概念与循环队列&#xff0c;我们知道了循环链表的队列长度事先就得确定好&#xff0c;但是实际中队列长度我们事先大多不知道&#xff0c;所以还是得研究一下动态的队列长度的队列储存与实现。 虽然顺序存储也可以通过realloc来实现扩容&#xff0c…

使用Postman快速复现浏览器的请求(包括生成调用代码)

前言 大家好&#xff01;我是sum墨&#xff0c;一个一线的底层码农&#xff0c;平时喜欢研究和思考一些技术相关的问题并整理成文&#xff0c;限于本人水平&#xff0c;如果文章和代码有表述不当之处&#xff0c;还请不吝赐教。 好久没有写开发类的工具使用文了&#xff0c;这…

Tigger绕过激活锁/屏幕锁隐藏工具,支持登入iCloud有消息通知,支持iOS12.0-14.8.1。

绕过激活锁工具Tigger可以用来帮助因为忘记自己的ID或者密码而导致iPhone/iPad无法激活的工具来绕过自己的iPhone/iPad。工具支持Windows和Mac。 工具支持的功能&#xff1a; 1.Hello界面两网/三网/无基带/乱码绕过&#xff0c;可以完美重启&#xff0c;支持iCloud登录、有消…

Leetcode—2.两数相加【中等】

2023每日刷题&#xff08;十五&#xff09; Leetcode—2.两数相加 迭代法实现代码 /*** Definition for singly-linked list.* struct ListNode {* int val;* struct ListNode *next;* };*/ struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l…

损坏的视频不能观看,还能修复吗?

3-1 在日常的生活或者工作中&#xff0c;特别是做摄像工作的人&#xff0c;有一定的概率会遇到损坏的视频文件&#xff0c;比如相机突然断电、无人机炸机等&#xff0c;都有可能导致保存的视频文件损坏。 如果遇到这种情况&#xff0c;该如何修复这种损坏的视频文件&#xff…

[架构之路-248/创业之路-79]:目标系统 - 纵向分层 - 企业信息化的呈现形态:常见企业信息化软件系统 - 供应链管理

目录 前言&#xff1a; 一、企业信息化的结果&#xff1a;常见企业信息化软件 1.1 供应链管理 1.1 什么是供应链与供应链管理What 1.2 为什么需要供应链管理系统Why&#xff1f; 1.3 谁需要供应链管理系统who&#xff1f; 1.4 供应链管理在企业管理中的位置where 1.5 什…

CS224W4.1——PageRank

在这篇中&#xff0c;我们将关注如何将图表示为矩阵&#xff0c;并讨论我们可以探索的后续属性。我们定义了PageRank的概念&#xff0c;进一步探索随机游走&#xff0c;并引入矩阵分解作为生成节点嵌入的视角。在第一部分&#xff0c;我们将介绍PageRank作为在图中对节点重要性…