【element-ui】表格

news/2024/11/26 13:29:33/

效果展示

组件代码

    <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.ppmy.cn/news/1192400.html

相关文章

通过C++ 给PDF文档添加文字水印

因PDF文档具有较好的稳定性和兼容性&#xff0c;现在越来越多的合同、研究论文、报告等都采用PDF格式。为了进一步保护这些重要文档内容免受未经授权的复制或使用&#xff0c;我们可以添加水印以表明其状态、所有权或用途。针对工作中可能出现的在 C 应用程序中给 PDF 文档添加…

Redsync 多 Redis 实例使用 demo

完整代码传送门 package mainimport ("context""fmt""net/http""redis-distributed-lock/redis_client""strconv""github.com/go-redsync/redsync/v4""github.com/go-redsync/redsync/v4/redis/goredis/v9&…

java8利用Stream方法求两个List对象的交集、差集与并集(即:anyMatch和allMatch和noneMatch的区别详解)

1、anyMatch 判断数据列表中是否存在任意一个元素符合设置的predicate条件&#xff0c;如果是就返回true&#xff0c;否则返回false。 接口定义&#xff1a; boolean anyMatch(Predicate<? super T> predicate); 方法描述&#xff1a; 在anyMatch 接口定义中是接收 P…

Java算法:二分查找

一、 二分查找注意 前提是数组必须是有序的&#xff0c;否则无法正常工作。如果数组不是有序的&#xff0c;需要先对数组进行排序&#xff0c;然后才能使用二分查找算法。 二、二分查找高效算法 二分查找也称为折半查找&#xff0c;是一种在有序数组中查找目标元素的算法。它的…

关于yarn安装一些东西报错时的处理方法

The engine "node" is incompatible with this module. Expected version "^14.18.0 || ^16.14.0 || >18.0.0". Got "17.9.0"出现遮掩刮得错误时直接使用这个命令 yarn config set ignore-engines true 忽略错误就可以了 直接安装自己想安装…

Linux 安装 Redis7.x

Linux 安装 Redis7.x 下载redis7检查linux版本检查是否有 gcc什么是 gcc查看 gcc 是否有安装 安装 redis7查看默认安装目录启动服务连接服务服务关闭Redis的删除卸载Redis数据类型 下载redis7 下载地址&#xff1a;https://download.redis.io/releases/ 检查linux版本 [root…

WiFi 6下的大规模部署策略

随着数字化时代的快速发展&#xff0c;我们正处于一个多设备、高密度连接的时代。在这个背景下&#xff0c;WiFi 6&#xff08;802.11ax&#xff09;作为一项新的无线通信标准&#xff0c;被广泛认为是满足未来大规模连接需求的关键技术。本文将深入研究WiFi 6在大规模部署中的…

HashMap源码分析——Java全栈知识(8)

jdk1.7和jdk1.8的HashMap的原理有一点出入我们就分开讲解&#xff1a; 1、JDK1.7中的HashMap JDK1.7中的HashMap是通过数组加链表的方式存储数据。他的底层维护了一个Entry数组&#xff0c;通过哈希函数的计算出来哈希值&#xff0c;将待填数据根据计算出来的哈希值填入到对应…