vue3 el-table无表头

news2025/2/7 11:18:27

需要实现的样式

在这里插入图片描述

父组件

<template>
    <div>
        <!-- 表格组件 无表头  -->
        <Table :label="tableData.label" :data="tableData.data" :querydata="tableData.querydata" :queryTitle="tableData.title">
            <template #operate="{ item }">
                <div class="operate-button" style="display: flex; cursor: pointer">
                    <el-button type="primary" plain @click="opendetail(item.row, $refs)" :class="item.$index%2 ?'blue':'green'">{{item.$index%2 ? '立即填报':'继续填报'}}</el-button>
                </div>
            </template>
        </Table>
    </div>
</template>
<script lang="ts" setup>
import { defineAsyncComponent, ref } from 'vue';
//列表组件
const Table = defineAsyncComponent(() => import('./components/TableTitle.vue'));
//底部table数据
const tableData = ref({
	title: '待填报任务列表',
	label: [
		{ label: '水厂', props: 'title', width: '300' },
		{ label: '任务类型', props: 'one', width: '200' },
		{ label: '任务周期', props: 'one' },
		{ label: '期检次数(已检/需检)', props: 'one', width: '200' },
		{ label: '需检指标', props: 'onee' },
		{ label: '备注 ', props: 'one' },
		{ label: '任务时间 ', props: 'one' },
		{ label: '操作', props: 'operate', width: '100' },
	],
	data: [
		{ title: '一日一检 —— 水源水质', one: '供水', onee: '10项', date: 'day' },
		{ title: '一日一检 —— 出厂水质', one: '供水', onee: '10项', date: 'day' },
		{ title: '一日一检 —— 管网(末梢)水质', one: '供水', onee: '10项', date: 'day' },
		{ title: '一月一检 (理化分析) —— 出厂水质', one: '供水', onee: '10项', date: 'month', number: 2 },
		{ title: '一月一检 (理化分析) —— 抽检', one: '供水', onee: '10项', date: 'month', number: 1 },
		{ title: '一日一检 —— 水源水质', one: '供水', onee: '10项', date: 'day' },
	],
	querydata: [
		{
			label: '任务名称',
			props: 'two',
			type: 'option',
			option: [
				{ label: '转派中', value: '0' },
				{ label: '待接单', value: '1' },
				{ label: '待处理', value: '2' },
				{ label: '已处理', value: '3' },
			],
		},
		{
			label: '任务周期',
			props: 'two',
			type: 'option',
			option: [
				{ label: '转派中', value: '0' },
				{ label: '待接单', value: '1' },
				{ label: '待处理', value: '2' },
				{ label: '已处理', value: '3' },
			],
		},
		{
			label: '期内需检次数 ',
			props: 'two',
			type: 'option',
			option: [
				{ label: '转派中', value: '0' },
				{ label: '待接单', value: '1' },
				{ label: '待处理', value: '2' },
				{ label: '已处理', value: '3' },
			],
		},
		{
			label: '任务状态 ',
			props: 'two',
			type: 'option',
			option: [
				{ label: '转派中', value: '0' },
				{ label: '待接单', value: '1' },
				{ label: '待处理', value: '2' },
				{ label: '已处理', value: '3' },
			],
		},

		{ label: '采样时间', props: 'one', type: 'date', format: 'YYYY-MM-dd' },
	],
});

const transferValue = ref([]);
const AddMaterialsRef = ref(null);

//立即填报

//打开详情
const opendetail = (row: any, $refs: any) => {
	if (row.date == 'day') {
		$refs.AddMaterialsRef.Init('《一日一检 —— 水源水质》检测点选择');
	} else {
		$refs.AddMaterialsRef.Init('《一月一检(理化分析) 》检测点选择', row);
	}
};
</script>
<style lang="scss" scoped>
.blue {
	color: #458bf5;
	background: rgba(69, 139, 245, 0.05);
	box-sizing: border-box;
	border: 1px solid #458bf5;
}
.green {
	color: #1fc26b;
	background: rgba(31, 194, 107, 0.05);
	box-sizing: border-box;
	border: 1px solid #1fc26b;
}
</style>

子组件

<template>
    <div>
        <div class="table">
            <div class="top-header">
                <div class="title">
                    <h4><span></span>{{props.queryTitle}}</h4>
                </div>
                <div class="top-header-button" style="margin-left: 20px">
                    <el-button class="info" type="info" @click="onExport" :icon="Bottom" size="default">导出</el-button>
                </div>
            </div>
            <div class="searchform" ref="searchformRef">
                <el-form :inline="true" :model="queryform">
                    <template v-for="it in props.querydata" :key="it.label">
                        <el-form-item :label="it.label" v-if="it.type == 'input'" label-width="100px">
                            <el-input v-model="queryform[it.props]" placeholder="请输入" clearable style="width: 200px" />
                        </el-form-item>
                        <el-form-item :label="it.label" v-else-if="it.type == 'treeselect'" label-width="100px">
                            <el-tree-select v-model="queryform[it.props]" :data="it.option" :render-after-expand="false" style="width: 240px" />
                        </el-form-item>

                        <el-form-item :label="it.label" v-else-if="it.type == 'option'" label-width="100px">
                            <el-select v-model="queryform[it.props]" placeholder="请选择" clearable style="width: 200px">
                                <el-option :label="childit.label" :value="childit.value" v-for="childit in it.option" :key="childit.label" />
                            </el-select>
                        </el-form-item>
                        <el-form-item :label="it.label" v-else-if="it.type == 'date' || it.type == 'year' || it.type == 'month'" label-width="100px">
                            <el-date-picker v-model="queryform[it.props]" :value-format="it.format" :type="it.type" style="width: 200px" placeholder="请选择" clearable />
                        </el-form-item>
                        <el-form-item :label="it.label" v-else-if="it.type == 'monthrange'" label-width="100px">
                            <el-date-picker v-model="queryform[it.props]" :type="it.type" :value-format="it.format" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 200px" />
                        </el-form-item>
                    </template>
                    <el-form-item>
                        <el-button class="color-button-icon primary-button" :icon="Search" type="primary" @click="onQuery" style="margin-left:16px;">查询</el-button>
                        <el-button class="color-button-icon primary-button-plain" :icon="Refresh" type="primary" @click="resetting">重置</el-button>
                    </el-form-item>
                </el-form>
            </div>
            <div class="user_skills">
                <el-table :data="props.data" :show-header="false" class="container-table" style="width: 100%">
                    <el-table-column :label="it.label" v-for="it in props.label" :key="it.label" :width="it.width">
                        <template #default="scope" v-if="it.props != 'operate'">
                            <div class="table-headline" v-if="it.props == 'title'">
                                <span>{{ scope.row[it.props] }}</span>
                            </div>
                            <div v-else class="table-content">
                                <span class="title">{{it.label}}</span>
                                <div class="text" :class="it.props == 'onee'? 'inspectionShow':''">{{ scope.row[it.props] }}</div>
                            </div>
                        </template>
                        <template #default="scope" v-else>
                            <slot name="operate" :item="scope"></slot>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <div style="position: absolute; right: 20px; bottom: 24px">
                <el-pagination @size-change="emit('query', queryform)" @current-change="emit('query', queryform)" class="pagination" small :page-sizes="[10, 20, 30]" v-model:current-page="queryform.current" background v-model:page-size="queryform.size" layout="total, sizes, prev, pager, next, jumper" :total="queryform.total">
                </el-pagination>
            </div>
        </div>
    </div>
</template>
<script lang="ts" setup>
import { defineProps, ref, defineEmits } from 'vue';
import { Iqueryform } from '/@/components/table/types';
import { Bottom, Search, Refresh } from '@element-plus/icons-vue';

const props = defineProps(['label', 'data', 'querydata', 'queryTitle']);
const emit = defineEmits(['query', 'openAdd']);

const queryform = ref<Iqueryform>({
	current: 1,
	size: 10,
	total: 0,
});

//搜索
const onQuery = () => {
	emit('query', queryform.value);
};

//重置
const resetting = () => {
	queryform.value = {
		current: 1,
		size: 10,
		total: 0,
	};
	emit('query', queryform.value);
};
//导出
const onExport = () => {};
//删除
const onDel = () => {};
//新增
const onAdd = () => {
	emit('openAdd', queryform.value);
};
const initTotal = (totalNumber: number) => {
	queryform.value.total = totalNumber;
};

defineExpose({
	initTotal,
});
</script>

<style lang="scss" scoped>
.table {
	margin: 12px auto;
	width: 98%;
	height: 86vh;
	border-radius: 8px;
	background: rgba(246, 248, 251, 0.6);
	box-sizing: border-box;
	border: 2px solid #ffffff;
	backdrop-filter: blur(12px);
	box-shadow: 0px 0px 4px 0px rgba(0, 34, 102, 0.2);
	padding: 8px;
	box-sizing: border-box;
	.top-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		height: 56px;
		padding: 0 8px;
		border-bottom: 1px solid #d1d9e5;

		.title {
			h4 {
				font-family: MiSans;
				font-size: 16px;
				font-weight: bold;
				line-height: 16px;
				letter-spacing: 0em;
				font-variation-settings: 'opsz' auto;
				color: #01193d;
				span {
					display: inline-block;
					width: 4px;
					height: 16px;
					border-radius: 1px;
					background: #2681ff;
					vertical-align: middle;
					margin-right: 5px;
				}
			}
		}
		.top-header-button {
			display: flex;
			:deep .el-button {
				width: 58px;
				height: 28px;
				border-radius: 4px;
				display: flex;
				flex-direction: row;
				justify-content: flex-end;
				align-items: center;
				padding: 6px 8px;
				gap: 2px;
				box-sizing: border-box;
				z-index: 3;
				i.el-icon {
					margin-right: 0;
				}
				span {
					font-size: 12px;
					margin-left: 0;
				}
			}

			.info {
				color: #4e5766;
				background: rgba(191, 200, 217, 0.2);
				border: 1px solid #bfc8d9;
			}
			.primary {
				background: #458bf5;
				z-index: 5;
			}
		}
	}
	.searchform {
		background: #ffffff;
		padding: 10px 0;
		padding-left: 15px;
		margin-top: 8px;
		.el-form.el-form--inline {
			.el-form-item {
				margin-bottom: 0 !important;
				width: 260px;
				margin: 6px 0;
			}

			.el-button.blueBtn {
				background: #2681ff;
			}

			.el-button.orangeBtn {
				background: #ff884d;
			}

			.el-button.greenBtn {
				background: #1fc26b;
			}

			.el-button.deleteBtn {
				background: rgba(255, 77, 77, 0.1);
				border: 1px solid #ff4d4d;
				color: #ff4d4d;
			}
		}
	}
}

:deep.el-form-item--large .el-form-item__label {
	height: 32px !important;
	line-height: 32px !important;
	width: 80px;
}

:deep.el-select--large .el-select__wrapper {
	min-height: 32px;
}

:deep.el-input__wrapper {
	height: 32px;
	background: rgba(148, 161, 179, 0.16);
}

:deep.el-date-editor {
	height: 32px;
}

.el-button {
	height: 32px;
	border: none;
	padding: 0 20px;
}

//设置表头的背景色(可以设置和页面背景色一致):
:deep.el-table th {
	background-color: #00083e;
}
//设置表每一行的背景色,字体颜色及字体粗细;
:deep.el-table tr {
	background-color: #fff;
	color: #000;
	font-weight: 500;
}
//去除表格每一行的下标线;
:deep.el-table td {
	border-bottom: none;
}
//去除表头的下标线;
:deep.el-table th.is-leaf {
	border-bottom: none;
}
//去除表格的最下边框线;
.el-table::before {
	height: 0;
}
//设置表格的背景色问题(否则一般默认的背景色是白色);
.el-table,
.el-table__expanded-cell {
	background-color: #f4f6f9;
}
//设置表格的行间距;
::v-deep .el-table__body {
	-webkit-border-vertical-spacing: 13px;
}
//设置标题行(th)的字体属性;
::v-deep .el-table th > .cell {
	line-height: 11px;
	font-size: 5px;
	padding-left: 20px;
}
//设置 table 中的每个 cell 的属性值;
::v-deep .el-table .cell {
	height: 84px;
	padding-left: 20px;
	// line-height: 58px;
	display: flex;
	align-items: center;
}
//设置 table 中的 th td 的 padding 值;
::v-deep .el-table td,
::v-deep .el-table th {
	padding: 0;
}
//将表格的每一行悬停的背景色都设置为:transparent;
:deep.el-table--enable-row-hover .el-table__body tr:hover > td {
	background-color: transparent;
}

.table-headline {
	width: 280px;
	min-width: 280px;
	height: 40px;
	line-height: 40px;
	border-right: 1px solid #d1d9e5;
	span {
		font-family: MiSans;
		font-size: 16px;
		font-weight: 600;
		line-height: 16px;
		letter-spacing: 0em;
		font-variation-settings: 'opsz' auto;
		color: #01193d;
	}
}

.table-content {
	.title {
		font-family: MiSans;
		font-size: 14px;
		font-weight: normal;
		line-height: 14px;
		letter-spacing: 0px;
		font-feature-settings: 'kern' on;
		color: #878e99;
	}
	.text {
		font-family: MiSans;
		font-size: 14px;
		font-weight: normal;
		line-height: 14px;
		letter-spacing: 0px;
		font-feature-settings: 'kern' on;
		color: #01193d;
		margin-top: 8px;
	}
}
.text.inspectionShow {
	font-family: MiSans;
	font-size: 14px;
	font-weight: normal;
	line-height: 14px;
	letter-spacing: 0px;
	text-decoration: underline;
	font-variation-settings: 'opsz' auto;
	font-feature-settings: 'kern' on;
	color: #458bf5;
	cursor: pointer;
}
</style>

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

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

相关文章

矩阵起源招聘进行时,寻找发光的你~

推荐有礼&#xff01;添加MO小助理 MO定制书包轻松GET~

Linux查看进程

Linux查看进程 引言查看进程1.快速查看运行中的进程列表2. 查看所有用户的所有进程3.显示所有进程的完整格式。4.动态显示进程的信息5.根据进程名查找进程ID6.以树状图的方式显示进程间的父子关系7.查找指定名字的进程id 引言 Linux查看进程在日常的使用中比较常见&#xff0c…

Sony Camera Remote SDK在Windows上的使用

Sony官方提供了相机遥控软件开发包&#xff0c;允许用户自行开发应用软件&#xff0c;实现对相机的远程控制&#xff0c;包括拍摄、监看和文件传输等。截至目前最新的版本是2024.4.12发布的1.12.00版本&#xff0c;下载链接如下&#xff1a;Camera Remote SDK | LICENSE AGREEM…

直流充电桩与交流充电桩有哪些区别,如何选最靠谱?

在当今快速发展的电动汽车市场&#xff0c;正确选择充电桩成为了车主们面临的重要问题之一。直流充电桩与交流充电桩区到底有什么区别&#xff1f;哪些方面不同&#xff1f;分别适用场景是什么&#xff1f;不同场景应该怎么选&#xff1f;本文一文为您详解。 一、直流充电桩与交…

wps使用Latex编辑公式没有Latex formula

wps使用Latex编辑公式没有Latex formula 1. 下载CTEX2. 下载LaTeXEE3. 配置Miktex4. 配置latexee5. 用管理员权限运行latexeqedit.exe6. wps插入latex公式 1. 下载CTEX 下载CTEX网址&#xff0c;我下载的下图这个&#xff0c;下载完了之后运行exe文件安装ctex。 2. 下载LaTe…

雷达智能名片小程序源码系统 带完整的安装代码包以及搭建教程

在数字化高速发展的今天&#xff0c;名片作为商务交流中的一张“金名片”&#xff0c;其形式与功能也在不断地迭代升级。雷达智能名片小程序源码系统应运而生&#xff0c;为企业和个人提供了一个全新的、智能化的名片展示与互动平台。本文将对雷达智能名片小程序源码系统的开发…

初级软件测试常见问题

1.JMeter &#xff08;1&#xff09;在http请求的时候&#xff0c;消息体数据中的数据需要用{}和“”标记起来&#xff0c;变量要用${}括起来。 &#xff08;2&#xff09;在响应断言的时候&#xff0c;要根据测试模式输出的内容来改变测试字段&#xff0c;假如输出错误可以把…

谷歌浏览器的开发者插件vue-devtools

在这里我留下一个git地址用来下载插件包&#xff0c;首先在自己喜欢的位置创建一个新的文件夹&#xff0c;起一个自己喜欢的文件夹名字&#xff0c;下载到包后&#xff0c;然后点进文件夹里下载依赖&#xff0c;npm install,下载后如下面这个样子 git clone https://gitee.com…

【Leetcode每日一题】 动态规划 - 最小路径和(难度⭐⭐)(58)

1. 题目解析 题目链接&#xff1a;64. 最小路径和 这个问题的理解其实相当简单&#xff0c;只需看一下示例&#xff0c;基本就能明白其含义了。 2.算法原理 算法思路梳理&#xff1a; 一、状态表示 在路径类问题中&#xff0c;状态表示通常有两种形式&#xff1a; 从 [i,…

算法题解记录13+++杨辉三角(百日筑基)

本题是动态规划的问题&#xff0c;我也在此阐述我对动态规划的理解&#xff0c;如有不准确、缺失、错误&#xff0c;敬请斧正。 题目描述&#xff1a; 给定一个非负整数 numRows&#xff0c;生成「杨辉三角」的前 numRows 行。 在「杨辉三角」中&#xff0c;每个数是它左上方和…

激光雷达初识

一、实车激光雷达 一般在车顶位置: 二、激光雷达组成 激光收发器模块:发射激光器VCSEL+接收模块采用了SiPM(硅基光电倍增管)或者APD,一个激光器发生失效的情况,其他仍可正常工作 扫描模块:水平视场和的垂直视场的扫描,128个阵列的VCSEL激光器负责 信号处理模块:信号处…

3_2Linux中内核级加强型火墙的管理

### 一.Selinux的功能 ### 观察现象 ①当Selinux未开启时 在/mnt中建立文件被移动到/var/ftp下可以被vsftpd服务访问 匿名用户可以通过设置后上传文件 当使用ls -Z /var/ftp查看文件时显示"?" ps auxZ | grep vsftpd 时显示&#xff1a; - root 8546 0.0 0.0 26952 …

从iPhone恢复已删除照片的最佳软件

本文分享了从iPhone恢复已删除照片的最佳软件。如果您正在寻找如何从iPhone恢复已删除的照片&#xff0c;请查看这篇文章。 为什么您需要软件从iPhone恢复已删除的照片&#xff1f; 没有什么比丢失iPhone上的重要数据更痛苦的了&#xff0c;尤其是一些具有珍贵回忆的照片。有时…

Java面试必问题38:SpringMVC执行流程(工作原理)(一般必问) SpringMVC的常用注解

MVC 是 Model — View — Controler 的简称&#xff0c;它是一种架构模式&#xff0c;它分离了表现与交互。它被分为三个核心部件&#xff1a;模型、视图、控制器。 Model&#xff08;模型&#xff09;&#xff1a;是程序的主体部分&#xff0c;主要包含业务数据和业务逻辑。在…

Python 版分布式消息队列 Kafka 实现图片数据传输

1、Kafka 介绍 在使用 Kafka 之前&#xff0c;通常需要先安装和配置 ZooKeeper。ZooKeeper 是 Kafka 的依赖项之一&#xff0c;它用于协调和管理 Kafka 集群的状态。 ZooKeeper 是一个开源的分布式协调服务&#xff0c;它提供了可靠的数据存储和协调机制&#xff0c;用于协调…

libcurl 简单使用

LibCurl是一个开源的免费的多协议数据传输开源库&#xff0c;该框架具备跨平台性&#xff0c;开源免费&#xff0c;并提供了包括HTTP、FTP、SMTP、POP3等协议的功能&#xff0c;使用libcurl可以方便地进行网络数据传输操作&#xff0c;如发送HTTP请求、下载文件、发送电子邮件等…

【计算机毕业设计】物流管理系统设计与实现——后附源码

&#x1f389;**欢迎来到琛哥的技术世界&#xff01;**&#x1f389; &#x1f4d8; 博主小档案&#xff1a; 琛哥&#xff0c;一名来自世界500强的资深程序猿&#xff0c;毕业于国内知名985高校。 &#x1f527; 技术专长&#xff1a; 琛哥在深度学习任务中展现出卓越的能力&a…

Python(11):网络编程

文章目录 一、一些基本概念二、软件的开发架构&#xff08;c/s架构和b/s架构&#xff09;三、OSI模型四、socket套接字编程1.socket编程过程2.python中的socket编程 一、一些基本概念 来了解一些网络的基本概念 名词解释IP&#xff08;互联网协议地址&#xff09;IP用来标识网…

归并排序详解(附代码)

归并排序 数据科学家每天都在处理算法。 然而&#xff0c;数据科学学科作为一个整体已经发展成为一个不涉及复杂算法实现的角色。 尽管如此&#xff0c;从业者仍然可以从建立对算法的理解和知识库中受益。 在本文中&#xff0c;对排序算法归并排序进行了介绍、解释、评估和实…

hds更换电源操作

HDS更换电源 1、 查看损坏的电源 2.选中电源 3、 如下图所示&#xff0c;选择Execute 4、选择ok&#xff0c;表示为防止静电引起的严重故障&#xff0c;请务必在手腕上佩戴腕带&#xff0c;并将腕带的另一侧的接地夹连接到机柜架上。 5、 选择YES&#xff0c;提示你的手…