/* 顶部固定区域 */ .top-container { position: sticky; top: 0; background-color: white; z-index: 100; /* 保证顶部元素位于表格之上 */ } .topsearch { width: 90%; margin-left: 5%; display: flex; align-items: center; justify-content: space-between; /* 确保搜索框和按钮分开 */ } .frame { background-color: white; width: 75%; border-radius: 1px; padding: 0 3%; } .frame > input { font-size: 24rpx; margin: 6rpx 0; } .topsearch > text { width: 10%; margin-left: 5%; color: #a8a7a7fa; } /* 新增按钮容器 */ .add-btn-container { position: sticky; top: 0; background-color: #fff; /* 背景色为白色 */ z-index: 101; /* 确保新增按钮高于表格 */ padding: 1rpx; /* 增加按钮的上内边距 */ display: flex; justify-content: center; margin-top: 1rpx; /* 新增按钮的上边距 */ } /* 新增按钮 */ .add-btn { padding: 1px 12px; background-color: #3EC01E; color: #fff; border-radius: 4px; font-size: 14px; } /* 表格容器 */ .table-container { width: 100%; overflow-x: auto; /* 启用横向滚动 */ white-space: nowrap; /* 禁止换行 */ background-color: #fff; border: 1rpx solid #ddd; margin-top: 10rpx; /* 添加上边距,确保不会和顶部元素重叠 */ white-space: nowrap; /* 禁止换行 */ } /* 表头样式 */ .table-header { display: flex; background-color: #61E054; /* 表头背景色 */ font-weight: bold; text-align: center; } /* 表格单元格样式 */ .table-cell { flex: none; width: 250rpx; /* 固定宽度 */ padding: 10rpx; text-align: center; font-size: 28rpx; color: #030803; /* 表头文字颜色 */ border-right: 1rpx solid #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 表格行样式 */ .table-row:nth-child(odd) { background-color: #E4FBE5; /* 奇数行背景色 */ } .table-row:nth-child(even) { background-color: #fff; /* 偶数行背景色 */ } /* 表格内容样式 */ .table-body { display: flex; flex-direction: column; width: max-content; } .table-row { display: flex; flex-direction: row; border-bottom: 1rpx solid #ddd; } /* 模态框背景 */ .modal { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); /* 半透明背景 */ z-index: 1000; /* 确保弹窗在最上层 */ } /* 模态框内容 */ .modal-content { background-color: #fff; /* 白色背景 */ padding: 20px; border-radius: 8px; width: 90%; max-width: 400px; /* 最大宽度 */ max-height: 80vh; /* 最大高度,留出一些空间以便滚动条显示 */ overflow-y: auto; /* 垂直方向溢出时显示滚动条 */ overflow-x: hidden; /* 隐藏水平滚动条 */ display: flex; flex-direction: column; /* 默认垂直方向布局 */ align-items: flex-start; /* 左对齐 */ } /* 每个输入项 */ .modal-item { display: flex; /* 使用 flex 布局 */ align-items: center; /* 垂直居中 */ width: 100%; margin-bottom: 15rpx; /* 每个输入项之间的间隔 */ } /* 输入框标签 */ .item-label { width: 30%; /* 标签宽度 */ font-size: 16px; margin-right: 15rpx; /* 标签与输入框之间的间隔 */ text-align: right; /* 标签文本右对齐 */ } /* 输入框样式 */ .input-field { flex: 1; /* 输入框占据剩余空间 */ padding: 8px; font-size: 16px; border: 1px solid #ccc; border-radius: 4px; } /* 按钮容器 */ .button-container { display: flex; /* 使用 flexbox 布局 */ justify-content: space-between; /* 按钮之间均匀分布 */ width: 100%; margin-top: 20rpx; /* 上边距 */ } /* 每个按钮样式 */ .submit-btn, .cancel-btn { flex: 1; /* 使按钮宽度相等 */ margin: 0 10rpx; /* 按钮间隔 */ padding: 10px; border-radius: 5px; font-size: 16px; cursor: pointer; } /* 提交按钮样式 */ .submit-btn { background-color: #4CAF50; /* 绿色背景 */ color: white; } /* 取消按钮样式 */ .cancel-btn { background-color: #e74c3c; /* 红色背景 */ color: white; } /* 提交按钮悬停效果 */ .submit-btn:hover { background-color: #45a049; } /* 取消按钮悬停效果 */ .cancel-btn:hover { background-color: #c0392b; }