vue3 el-table无表头

需要实现的样式

在这里插入图片描述

父组件

<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.mfbz.cn/a/548676.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

企业网站建设需要了解什么

在现代商业环境中&#xff0c;企业网站已经成为企业宣传、推广和销售的重要工具。企业网站的建设需要考虑多个因素&#xff0c;包括以下几个方面&#xff1a; 首先&#xff0c;了解企业的目标和定位。企业网站的建设应该围绕企业的目标和定位展开&#xff0c;以达到企业在市场中…

低代码开发平台权威推荐:创新开发、领跑市场!

Gartner是低代码领域的一家权威机构&#xff0c;该机构常常通过"魔力象限"的研究方法&#xff0c;评选全球范围内IT细分领域的产品&#xff0c;来帮助决策者提供重要的咨询建议。本文盘点了Gartner机构推荐的6款低代码平台&#xff1a;Zoho Creator、Mendix、Oracle、…

新零售门店、商品、会员管理指标体系总览

新零售&#xff0c;旨在打破传统零售业的边界&#xff0c;引入先进科技和数字化手段&#xff0c;通过整合线上线下渠道&#xff0c;全面提升用户体验&#xff0c;并实现更智能、高效、个性化的零售运营模式。这一模式不仅仅关注销售产品&#xff0c;更注重构建全方位的购物生态…

(BERT蒸馏)TinyBERT: Distilling BERT for Natural Language Understanding

文章链接&#xff1a;https://arxiv.org/abs/1909.10351 背景 在自然语言处理&#xff08;NLP&#xff09;领域&#xff0c;预训练语言模型&#xff08;如BERT&#xff09;通过大规模的数据训练&#xff0c;已在多种NLP任务中取得了卓越的性能。尽管BERT模型在语言理解和生成…

【刷题笔记】第一天

两道贪心题 文章目录 [3106. 满足距离约束且字典序最小的字符串](https://leetcode.cn/problems/lexicographically-smallest-string-after-operations-with-constraint/)[3107. 使数组中位数等于 K 的最少操作数](https://leetcode.cn/problems/minimum-operations-to-make-me…

ubuntu安装python3.10

1. 官网下载源程序 2. 解压进入文件夹&#xff1a; ./configure --prefix/usr/local/python3/ 3. 编译安装&#xff1a; make && make install 4. 添加环境变量&#xff1a; vim ~/.bashrc PATH/usr/local/python3/bin:$PATH #保存后&#xff0c;刷新配置文件 sour…

HCIP的学习(8)

OSPF数据报文 OSPF头部信息&#xff08;公共固定&#xff09; 版本&#xff1a;OSPF版本&#xff0c;在IPv4网络中版本字段恒定为数值2&#xff08;v1属于实验室版本&#xff0c;v3属于IPv6&#xff09;类型&#xff1a;代表具体是哪一种报文&#xff0c;按照1~5排序&#xff…

C++从入门到精通——类的6个默认成员函数之赋值运算符重载

赋值运算符重载 前言一、运算符重载定义实例注意要点 二、赋值运算符重载赋值运算符重载格式赋值运算符重载要点重载要点传值返回和传址返回要点 三、前置和后置重载 前言 类的6个默认成员函数&#xff1a;如果一个类中什么成员都没有&#xff0c;简称为空类。 空类中真的什么…

xcode c++项目设置运行时参数

在 Xcode 项目中&#xff0c;你可以通过配置 scheme 来指定在运行时传递的参数。以下是在 Xcode 中设置运行时参数的步骤&#xff1a; 打开 Xcode&#xff0c;并打开你的项目。在 Xcode 菜单栏中&#xff0c;选择 "Product" -> "Scheme" -> "E…

利驰软件亮相第二届全国先进技术成果转化大会

4月8日&#xff0c;第二届全国先进技术成果转化大会在苏开幕。省长许昆林出席大会开幕式并致辞。国家国防科工局局长张克俭&#xff0c;省委常委、苏州市委书记刘小涛分别致辞。 本次转化大会由江苏省国防科学技术工业办公室、苏州市人民政府、先进技术成果长三角转化中心主办…

无人棋牌室软硬件方案

先决思考 软件这一套确实是做一套下来&#xff0c;可以无限复制卖出&#xff0c;这个雀氏是一本万利的买卖。 现在肯定是有成套的方案&#xff0c;值不值得重做&#xff1f;为什么要重做&#xff1f; 你想达到什么效果&#xff1f;还是需要细聊的。 做这个东西难度不高&…

自动发版工具以及本地debug

# 定义变量 $jarFile "xxx.jar" $server "ip" $username "user" $password "password" $remoteHost "${username}${server}" $remoteFolderPath "path" $gitDir "$PSScriptRoot\..\.git" # 设置…

每日OJ题_BFS解决最短路①_力扣1926. 迷宫中离入口最近的出口

目录 力扣1926. 迷宫中离入口最近的出口 解析代码 力扣1926. 迷宫中离入口最近的出口 1926. 迷宫中离入口最近的出口 难度 中等 给你一个 m x n 的迷宫矩阵 maze &#xff08;下标从 0 开始&#xff09;&#xff0c;矩阵中有空格子&#xff08;用 . 表示&#xff09;和墙&…

汽车抗疲劳驾驶测试铸铁试验底座技术要求有哪些

铸铁平台试验台底座的主要技术参数要求 1、 试验台底座设计制造符合JB/T794-1999《铸铁平板》标准。 2、 试验铁底板及所有附件的计量单位全部采用 单位&#xff08;SI&#xff09;标准。 3、铸铁平台平板材质&#xff1a;用细密的灰口铸铁HT250或HT200&#xff0c;强度符…

默认图表太丑!?快来看看这个好看的绘图主题吧~~

有很多小伙伴经常私信给小编&#xff0c;问自己绘制的图表为啥没小编绘制的精美&#xff1f; 听到这句话&#xff0c;小编老脸一红&#xff0c;还是比较惭愧的&#xff0c;因为并不是像小伙伴说的那样对每一个图表元素都进行定制化涉及操作&#xff0c;是借助优秀的“第三方工具…

Python 正则表达式模块使用

目录 1、匹配单个字符 2、匹配多个字符 3、匹配开头结尾 4、匹配分组 说明&#xff1a;在Python中需要通过正则表达式对字符串进行匹配的时候&#xff0c;可以使用re模块 表达式&#xff1a;re.match(正则表达式&#xff0c; 要匹配的字符串) 有返回值说明匹配成功&#x…

vue3项目 使用 element-plus 中 el-collapse 折叠面板

最近接触拉了一个项目&#xff0c;使用到 element-plus 中 el-collapse 折叠面板&#xff0c;发现在使用中利用高官网多多少少的会出现问题。 &#xff08;1.直接默认一个展开值&#xff0c;发现时显时不显 2 . 数据渲染问题&#xff0c;接口请求了&#xff0c;页面数据不更新 …

通过Omnet++官网tictoc教程学习在Omnet++中构建和运行仿真 Part3

TicToc Part3 增强2节点 TicToc增加图标增加 日志添加状态变量增加参数使用NED 继承模拟处理延时随机数字和参数超时、取消计时器重传同样的消息 官方文档 在官方文档中&#xff0c;你可以看见所有的代码 增强2节点 TicToc 增加图标 为了使模型在GUI中看起来更好看&#xff…

计算机网络—TCP协议详解:协议构成、深度解析(1)

&#x1f3ac;慕斯主页&#xff1a;修仙—别有洞天 ♈️今日夜电波&#xff1a;マリンブルーの庭園—ずっと真夜中でいいのに。 0:34━━━━━━️&#x1f49f;──────── 3:34 &#x1f504; ◀️…

vs2008使用 openmp

目录 1 在项目中找到property pages>>c/c>>language>>openmp支持 2 在环境变量中增加“OMP_NUM_THREADS”变量&#xff0c;数值自己根据你的CPU的性能来设置&#xff0c;一般2、4、8等 3 在项目中输入如下代码&#xff0c;并编译运行 4 结果与不使用omp的…
最新文章