| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846 |
- <!DOCTYPE html>
- <html lang="zh-CN" class="iframe-content">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>设备管理列表 - 爱智农</title>
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
- <link rel="stylesheet" href="https://at.alicdn.com/t/font_3114978_qe0b39no76.css">
- <link rel="stylesheet" href="../assets/css/global.css">
- <style>
- :root {
- --primary: #4CAF50;
- --primary-dark: #388E3C;
- --primary-light: #A5D6A7;
- --primary-bg: #F1F8E9;
- --success: #4CAF50;
- --warning: #FFC107;
- --danger: #F44336;
- --info: #2196F3;
- --disabled: #9E9E9E;
- --border: #E0E0E0;
- --text-primary: #212121;
- --text-secondary: #757575;
- --radius: 8px;
- }
-
- body {
- font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
- background-color: #f5f7f9;
- color: var(--text-primary);
- margin: 0;
- padding: 0;
- height: auto; overflow-y: auto; overflow-x: hidden;
- min-height: 100%;
- overflow-y: auto;
- overflow-x: hidden;
- padding-top: 70px; /* 增加顶部填充,确保内容不被系统导航栏遮挡 */
- }
-
- /* 内容页面框架 */
- #content-frame {
- width: 100%;
- height: 100%;
- border: none;
- overflow: hidden;
- margin-top: 0; /* 移除顶部外边距 */
- padding-top: 0; /* 移除顶部内边距 */
- }
-
- /* 移除白色圆形按钮 */
- .circle-btn,
- .floating-button,
- .round-button,
- button[class*='circle'],
- div[class*='circle'],
- [class*='float-btn'],
- body > div:not(#app),
- body > button {
- display: none !important;
- visibility: hidden !important;
- opacity: 0 !important;
- position: absolute !important;
- top: -9999px !important;
- left: -9999px !important;
- z-index: -9999 !important;
- pointer-events: none !important;
- }
-
- .page-container {
- padding: 20px;
- position: relative;
- min-height: 100vh;
- width: 100%;
- max-width: 100%;
- box-sizing: border-box;
- padding-top: 20px; /* 减少顶部内边距,因为body已经有较大的padding-top */
- display: block !important; /* 确保容器可见 */
- visibility: visible !important; /* 确保容器可见 */
- z-index: 5; /* 确保层级足够高 */
- }
-
- /* 防止重复菜单,但允许页面容器显示 */
- body > div:not(.page-container):not(.modal-overlay),
- iframe#sidebar,
- div.system-menu,
- [id^="system-menu"],
- [class^="system-menu"],
- #admin-sidebar,
- .menu-popup,
- .user-avatar-circle {
- display: none !important;
- }
-
- /* 防止右侧白圈和浮动元素,但允许页面内容显示 */
- .circle-btn,
- .floating-circle,
- .round-button,
- .scroll-top-btn,
- [class*="circle-button"],
- [class*="float-circle"],
- .help-btn,
- .chat-btn {
- display: none !important;
- }
-
- /* 页面标题和操作按钮容器 */
- .page-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
- padding-bottom: 16px;
- border-bottom: 1px solid #e0e0e0;
- padding-top: 10px;
- position: relative;
- z-index: 10;
- }
-
- /* 添加新增按钮的特定样式 */
- .button-container {
- position: relative;
- z-index: 20;
- }
-
- #addDeviceBtn,
- #importBtn,
- #exportBtn {
- position: relative;
- z-index: 5;
- height: 38px;
- visibility: visible !important;
- opacity: 1 !important;
- display: inline-flex !important;
- }
-
- .card {
- background-color: white;
- border-radius: 8px;
- box-shadow: 0 2px 8px rgba(0,0,0,0.05);
- }
-
- .table-container {
- position: relative;
- position: relative;
- overflow-x: auto;
- }
-
- table {
- width: 100%;
- border-collapse: separate;
- border-spacing: 0;
- }
-
- th {
- white-space: nowrap;
- position: relative;
- overflow: visible;
- max-width: none;
- text-overflow: clip;
- white-space: nowrap;
- position: relative;
- background-color: #f9fafb;
- padding: 12px 16px;
- text-align: left;
- font-weight: 500;
- color: #6b7280;
- border-bottom: 1px solid #e5e7eb;
- }
-
- td {
- white-space: nowrap;
- max-width: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- max-width: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- padding: 12px 16px;
- border-bottom: 1px solid #e5e7eb;
- }
-
- tr:hover {
-
- tr:hover td:last-child {
- background-color: #f9fafb;
- }
-
- /* 固定最后一列(操作列)样式 */
- .table-fixed-right {
- position: relative;
- }
-
- .table-fixed-right th:last-child,
- .table-fixed-right td:last-child {
- position: sticky;
- right: 0;
- z-index: 2;
- background-color: white;
- box-shadow: -5px 0 5px -5px rgba(0, 0, 0, 0.1);
- }
-
- .table-fixed-right th:last-child {
- background-color: #f9fafb;
- }
-
- /* 表格滚动控件 */
- .table-scroll-controls {
- display: none;
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- width: 100%;
- pointer-events: none;
- z-index: 3;
- }
-
- .table-scroll-btn {
- position: absolute;
- width: 32px;
- height: 32px;
- border-radius: 50%;
- background-color: rgba(255, 255, 255, 0.9);
- color: #4CAF50;
- border: 1px solid #e0e0e0;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- pointer-events: auto;
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
- z-index: 4;
- }
-
- .table-scroll-left {
- left: 10px;
- }
-
- .table-scroll-right {
- right: 10px;
- }
-
- .has-overflow .table-scroll-controls {
- display: block;
- } background-color: #f9fafb;
- }
-
- .btn {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- padding: 8px 16px;
- border-radius: 4px;
- font-weight: 500;
- cursor: pointer;
- transition: all 0.2s;
- }
-
- .btn-primary {
- background-color: #4CAF50;
- color: white;
- }
-
- .btn-primary:hover {
- background-color: #388E3C;
- }
-
- .btn-default {
- background-color: white;
- border: 1px solid #d1d5db;
- color: #374151;
- }
-
- .btn-default:hover {
- background-color: #f9fafb;
- }
-
- .btn-danger {
- background-color: #ef4444;
- color: white;
- }
-
- .btn-danger:hover {
- background-color: #dc2626;
- }
-
- .btn-sm {
- padding: 4px 8px;
- font-size: 12px;
- }
-
- .btn-icon {
- margin-right: 4px;
- }
-
- .search-box {
- display: flex;
- gap: 8px;
- }
-
- .input {
- padding: 8px 12px;
- border: 1px solid #d1d5db;
- border-radius: 4px;
- flex-grow: 1;
- }
-
- .input:focus {
- outline: none;
- border-color: #4CAF50;
- box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
- }
-
- .select {
- padding: 8px 12px;
- border: 1px solid #d1d5db;
- border-radius: 4px;
- background-color: white;
- }
-
- .modal-overlay {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.5);
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 50;
- display: none;
- }
-
- .modal {
- background-color: white;
- border-radius: 8px;
- width: 100%;
- max-width: 600px;
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
- }
-
- .modal-header {
- padding: 16px 24px;
- border-bottom: 1px solid #e5e7eb;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
-
- .modal-title {
- font-size: 18px;
- font-weight: 500;
- }
-
- .modal-close {
- cursor: pointer;
- font-size: 20px;
- }
-
- .modal-body {
- padding: 24px;
- }
-
- .modal-footer {
- padding: 16px 24px;
- border-top: 1px solid #e5e7eb;
- display: flex;
- justify-content: flex-end;
- gap: 8px;
- }
-
- .form-group {
- margin-bottom: 16px;
- }
-
- .form-label {
- display: block;
- margin-bottom: 4px;
- font-weight: 500;
- }
-
- .form-input {
- width: 100%;
- padding: 8px 12px;
- border: 1px solid #d1d5db;
- border-radius: 4px;
- }
-
- .form-input:focus {
- outline: none;
- border-color: #4CAF50;
- box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
- }
-
- .badge {
- display: inline-block;
- padding: 2px 8px;
- border-radius: 9999px;
- font-size: 12px;
- font-weight: 500;
- }
-
- .badge-success {
- background-color: #d1fae5;
- color: #065f46;
- }
-
- .badge-warning {
- background-color: #fef3c7;
- color: #92400e;
- }
-
- .badge-danger {
- background-color: #fee2e2;
- color: #b91c1c;
- }
-
- .pagination {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- gap: 4px;
- }
-
- .pagination-item {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 32px;
- height: 32px;
- border-radius: 4px;
- cursor: pointer;
- transition: all 0.2s;
- }
-
- .pagination-item:hover {
- background-color: #f3f4f6;
- }
-
- .pagination-item.active {
- background-color: #4CAF50;
- color: white;
- }
-
- .pagination-item.disabled {
- color: #9ca3af;
- cursor: not-allowed;
- }
-
- .grid-2 {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 16px;
- }
- </style>
- </head>
- <body>
- <div class="page-container responsive-container">
- <div class="flex justify-between items-center mb-6 page-header">
- <h1 class="text-2xl font-bold">设备管理列表</h1>
-
- <div class="flex gap-2 button-container">
- <button class="btn btn-primary" id="addDeviceBtn">
- <i class="iconfont icon-plus btn-icon"></i>
- 新增设备
- </button>
- <button class="btn btn-default" id="importBtn">
- <i class="iconfont icon-import btn-icon"></i>
- 导入
- </button>
- <button class="btn btn-default" id="exportBtn">
- <i class="iconfont icon-export btn-icon"></i>
- 导出
- </button>
- </div>
- </div>
-
- <div class="card p-6 mb-6">
- <div class="flex flex-wrap gap-4">
- <div class="search-box flex-grow">
- <input type="text" class="input" placeholder="请输入设备名称/编号/位置">
- <button class="btn btn-primary">
- <i class="iconfont icon-search btn-icon"></i>
- 搜索
- </button>
- <button class="btn btn-default">
- <i class="iconfont icon-reload btn-icon"></i>
- 重置
- </button>
- </div>
-
- <div class="flex gap-2">
- <select class="select">
- <option value="">所有设备类型</option>
- <option value="sensor">传感器</option>
- <option value="camera">摄像头</option>
- <option value="controller">控制器</option>
- <option value="weather">气象设备</option>
- </select>
-
- <select class="select">
- <option value="">所有状态</option>
- <option value="1">在线</option>
- <option value="0">离线</option>
- <option value="2">维护中</option>
- </select>
- </div>
- </div>
- </div>
-
- <!-- 添加设备列表表格 -->
- <div class="card">
- <div class="table-container">
- <table>
- <thead>
- <tr>
- <th>设备ID</th>
- <th class="min-w-[120px]">设备名称</th>
- <th class="min-w-[100px]">设备类型</th>
- <th>所在位置</th>
- <th class="min-w-[100px]">安装日期</th>
- <th class="min-w-[80px]">状态</th>
- <th>最后活动</th>
- <th class="min-w-[150px]">操作</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>DEV20230001</td>
- <td>温湿度传感器-A1</td>
- <td>传感器</td>
- <td>东区大棚A区</td>
- <td>2023-01-15</td>
- <td><span class="badge badge-success">在线</span></td>
- <td>2023-10-15 14:30</td>
- <td>
- <div class="flex gap-2">
- <button class="btn btn-sm btn-default view-btn" data-id="DEV20230001">
- <i class="iconfont icon-eye"></i>
- 查看
- </button>
- <button class="btn btn-sm btn-default edit-btn" data-id="DEV20230001">
- <i class="iconfont icon-edit"></i>
- 编辑
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>DEV20230002</td>
- <td>土壤湿度检测仪-B1</td>
- <td>传感器</td>
- <td>西区稻田B区</td>
- <td>2023-02-20</td>
- <td><span class="badge badge-warning">离线</span></td>
- <td>2023-10-10 09:15</td>
- <td>
- <div class="flex gap-2">
- <button class="btn btn-sm btn-default view-btn" data-id="DEV20230002">
- <i class="iconfont icon-eye"></i>
- 查看
- </button>
- <button class="btn btn-sm btn-default edit-btn" data-id="DEV20230002">
- <i class="iconfont icon-edit"></i>
- 编辑
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>DEV20230003</td>
- <td>气象站-C1</td>
- <td>气象设备</td>
- <td>中心监测站</td>
- <td>2023-03-10</td>
- <td><span class="badge badge-success">在线</span></td>
- <td>2023-10-16 10:25</td>
- <td>
- <div class="flex gap-2">
- <button class="btn btn-sm btn-default view-btn" data-id="DEV20230003">
- <i class="iconfont icon-eye"></i>
- 查看
- </button>
- <button class="btn btn-sm btn-default edit-btn" data-id="DEV20230003">
- <i class="iconfont icon-edit"></i>
- 编辑
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>DEV20230004</td>
- <td>智能灌溉控制器-D1</td>
- <td>控制器</td>
- <td>南区果园</td>
- <td>2023-04-05</td>
- <td><span class="badge badge-danger">故障</span></td>
- <td>2023-10-12 18:40</td>
- <td>
- <div class="flex gap-2">
- <button class="btn btn-sm btn-default view-btn" data-id="DEV20230004">
- <i class="iconfont icon-eye"></i>
- 查看
- </button>
- <button class="btn btn-sm btn-default edit-btn" data-id="DEV20230004">
- <i class="iconfont icon-edit"></i>
- 编辑
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>DEV20230005</td>
- <td>作物监控摄像头-E1</td>
- <td>摄像头</td>
- <td>东区大棚B区</td>
- <td>2023-05-20</td>
- <td><span class="badge badge-success">在线</span></td>
- <td>2023-10-16 11:05</td>
- <td>
- <div class="flex gap-2">
- <button class="btn btn-sm btn-default view-btn" data-id="DEV20230005">
- <i class="iconfont icon-eye"></i>
- 查看
- </button>
- <button class="btn btn-sm btn-default edit-btn" data-id="DEV20230005">
- <i class="iconfont icon-edit"></i>
- 编辑
- </button>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-
- <!-- 分页 -->
- <div class="p-4 border-t border-gray-200 flex justify-between items-center">
- <div class="text-sm text-gray-500">显示 1 至 5,共 24 条记录</div>
- <div class="pagination">
- <div class="pagination-item disabled"><</div>
- <div class="pagination-item active">1</div>
- <div class="pagination-item">2</div>
- <div class="pagination-item">3</div>
- <div class="pagination-item">4</div>
- <div class="pagination-item">5</div>
- <div class="pagination-item">></div>
- </div>
- </div>
- </div>
-
- <!-- 设备表单弹窗 -->
- <div class="modal-overlay" id="deviceModal">
- <div class="modal">
- <div class="modal-header">
- <div class="modal-title">添加设备</div>
- <div class="modal-close" id="closeModal">×</div>
- </div>
- <div class="modal-body">
- <form id="deviceForm">
- <div class="grid-2">
- <div class="form-group">
- <label class="form-label">设备ID</label>
- <input type="text" class="form-input" id="deviceId" placeholder="输入设备ID">
- </div>
- <div class="form-group">
- <label class="form-label">设备名称</label>
- <input type="text" class="form-input" id="deviceName" placeholder="输入设备名称">
- </div>
- </div>
- <div class="grid-2">
- <div class="form-group">
- <label class="form-label">设备类型</label>
- <select class="form-input" id="deviceType">
- <option value="">请选择设备类型</option>
- <option value="sensor">传感器</option>
- <option value="camera">摄像头</option>
- <option value="controller">控制器</option>
- <option value="weather">气象设备</option>
- </select>
- </div>
- <div class="form-group">
- <label class="form-label">所在位置</label>
- <input type="text" class="form-input" id="deviceLocation" placeholder="输入设备位置">
- </div>
- </div>
- <div class="grid-2">
- <div class="form-group">
- <label class="form-label">安装日期</label>
- <input type="date" class="form-input" id="installDate">
- </div>
- <div class="form-group">
- <label class="form-label">状态</label>
- <select class="form-input" id="deviceStatus">
- <option value="1">在线</option>
- <option value="0">离线</option>
- <option value="2">维护中</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="form-label">设备描述</label>
- <textarea class="form-input" id="deviceDesc" rows="3" placeholder="输入设备描述"></textarea>
- </div>
- </form>
- </div>
- <div class="modal-footer">
- <button class="btn btn-default" id="cancelBtn">取消</button>
- <button class="btn btn-primary" id="saveBtn">保存</button>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- document.addEventListener("DOMContentLoaded", function() {
- // 初始化表格滚动功能
- function initTableScroll() {
- const tableContainer = document.querySelector(".table-container");
- if (!tableContainer) return;
-
- const scrollLeftBtn = document.querySelector(".table-scroll-left");
- const scrollRightBtn = document.querySelector(".table-scroll-right");
-
- if (!scrollLeftBtn || !scrollRightBtn) return;
-
- // 检查表格是否需要水平滚动
- function checkTableOverflow() {
- if (tableContainer.scrollWidth > tableContainer.clientWidth) {
- tableContainer.classList.add("has-overflow");
- } else {
- tableContainer.classList.remove("has-overflow");
- }
- }
-
- // 左右滚动按钮点击事件
- scrollLeftBtn.addEventListener("click", function() {
- tableContainer.scrollLeft -= 150;
- });
-
- scrollRightBtn.addEventListener("click", function() {
- tableContainer.scrollLeft += 150;
- });
-
- // 初始检查和窗口大小变化时检查
- checkTableOverflow();
- window.addEventListener("resize", checkTableOverflow);
-
- // 滚动事件处理
- tableContainer.addEventListener("scroll", function() {
- // 根据滚动位置显示/隐藏滚动按钮
- if (tableContainer.scrollLeft <= 10) {
- scrollLeftBtn.style.opacity = "0.5";
- } else {
- scrollLeftBtn.style.opacity = "1";
- }
-
- if (tableContainer.scrollLeft >= tableContainer.scrollWidth - tableContainer.clientWidth - 10) {
- scrollRightBtn.style.opacity = "0.5";
- } else {
- scrollRightBtn.style.opacity = "1";
- }
- });
-
- // 初始触发滚动事件,设置初始按钮状态
- tableContainer.dispatchEvent(new Event("scroll"));
- }
-
- // 初始化表格滚动
- initTableScroll(); // 添加设备按钮点击事件
- document.getElementById('addDeviceBtn').addEventListener('click', function() {
- document.getElementById('deviceModal').style.display = 'flex';
- });
-
- // 关闭模态框
- document.getElementById('closeModal').addEventListener('click', function() {
- document.getElementById('deviceModal').style.display = 'none';
- });
-
- // 取消按钮点击事件
- document.getElementById('cancelBtn').addEventListener('click', function() {
- document.getElementById('deviceModal').style.display = 'none';
- });
-
- // 保存按钮点击事件
- document.getElementById('saveBtn').addEventListener('click', function() {
- alert('设备信息已保存');
- document.getElementById('deviceModal').style.display = 'none';
- });
-
- // 编辑按钮点击事件
- const editBtns = document.querySelectorAll('.edit-btn');
- editBtns.forEach(function(btn) {
- btn.addEventListener('click', function() {
- const deviceId = this.getAttribute('data-id');
- document.getElementById('deviceModal').style.display = 'flex';
- document.querySelector('.modal-title').textContent = '编辑设备';
- // 这里可以根据deviceId加载设备信息
- });
- });
-
- // 查看按钮点击事件
- const viewBtns = document.querySelectorAll('.view-btn');
- viewBtns.forEach(function(btn) {
- btn.addEventListener('click', function() {
- const deviceId = this.getAttribute('data-id');
- alert('查看设备详情:' + deviceId);
- // 这里可以跳转到设备详情页面
- });
- });
-
- // 监听来自父页面的消息
- window.addEventListener('message', function(event) {
- if (event.data === 'parentReady') {
- console.log('父页面已就绪,内容页面显示完成');
- // 可以在这里添加需要在父页面加载完成后执行的代码
- }
- });
-
- // 确保页面在iframe中正确显示
- document.addEventListener('DOMContentLoaded', function() {
- // 显示页面内容,以防被CSS规则隐藏
- document.querySelector('.page-container').style.display = 'block';
- document.querySelector('.page-container').style.visibility = 'visible';
- document.querySelector('.page-container').style.opacity = '1';
-
- // 强制刷新布局
- setTimeout(function() {
- const tables = document.querySelectorAll('table');
- tables.forEach(table => {
- table.style.display = 'none';
- setTimeout(() => {
- table.style.display = 'table';
- }, 10);
- });
-
- // 再次确保内容可见
- document.body.style.display = 'block';
- document.body.style.visibility = 'visible';
- document.body.style.opacity = '1';
- }, 100);
- });
- </script>
- </body>
- </html>
|