| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <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;
- }
-
- /* 全局样式重置 */
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- /* 移除所有固定定位和绝对定位元素 */
- .fixed,
- .absolute,
- [style*="position: fixed"],
- [style*="position: absolute"] {
- display: none !important;
- }
- /* 移除所有圆形按钮和浮动元素 */
- .circle,
- .rounded-full,
- .floating,
- [class*="circle"],
- [class*="round"],
- [class*="float"] {
- display: none !important;
- }
- /* 确保内容不会溢出 */
- html, body {
- overflow-x: hidden;
- position: relative;
- }
- /* 移除所有可能的遮罩层 */
- [class*="overlay"],
- [class*="mask"],
- [style*="z-index: 9999"] {
- display: none !important;
- }
-
- /* 重置默认样式 */
- html, body {
- margin: 0;
- padding: 0;
- font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
- height: 100%;
- position: relative;
- }
-
- body {
- background-color: #f5f7f9;
- color: var(--text-primary);
- overflow-x: hidden;
- padding-top: 15px;
- }
-
- /* 防止重复菜单 - 修改选择器避免影响按钮和模态框 */
- body > div:not(.page-container):not(.modal):not(#machineModal),
- 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,
- .help-btn,
- .chat-btn {
- display: none !important;
- }
- /* 模态框样式 */
- .modal {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.5);
- z-index: 99999;
- opacity: 0;
- visibility: hidden;
- transition: opacity 0.3s ease, visibility 0.3s ease;
- }
- .modal.show {
- display: block !important;
- opacity: 1 !important;
- visibility: visible !important;
- }
- .modal-dialog {
- position: fixed;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 90%;
- max-width: 800px;
- margin-top: 20px;
- background: #fff;
- border-radius: 8px;
- z-index: 100000;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
- }
- .modal-content {
- background: #fff;
- border-radius: 8px;
- overflow: hidden;
- position: relative;
- }
- .modal-header {
- padding: 16px 24px;
- border-bottom: 1px solid #e0e0e0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: #fff;
- position: sticky;
- top: 0;
- z-index: 1;
- }
- .modal-close {
- padding: 8px;
- background: none;
- border: none;
- cursor: pointer;
- font-size: 20px;
- color: #666;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- transition: all 0.3s;
- }
- .modal-close:hover {
- background-color: rgba(0, 0, 0, 0.05);
- color: #333;
- }
- .modal-title {
- font-size: 18px;
- font-weight: 500;
- color: #333;
- margin: 0;
- }
- .modal-body {
- padding: 24px;
- max-height: calc(100vh - 200px);
- overflow-y: auto;
- background: #fff;
- }
- .modal-footer {
- padding: 16px 24px;
- border-top: 1px solid #e0e0e0;
- display: flex;
- justify-content: flex-end;
- gap: 12px;
- background: #fff;
- }
- /* 页面容器 */
- .page-container {
- padding: 20px;
- max-width: 1600px;
- margin: 0 auto;
- }
- /* 页面标题和操作按钮容器 */
- .page-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
- }
- /* 卡片样式 */
- .card {
- background-color: white;
- border-radius: 8px;
- box-shadow: 0 2px 8px rgba(0,0,0,0.05);
- overflow: hidden;
- }
- /* 表格样式 */
- .table-container {
- overflow-x: auto;
- }
- table {
- width: 100%;
- border-collapse: collapse;
- }
- th {
- background-color: #f9fafb;
- padding: 12px 16px;
- text-align: left;
- font-weight: 500;
- color: #6b7280;
- border-bottom: 1px solid #e5e7eb;
- }
- td {
- padding: 12px 16px;
- border-bottom: 1px solid #e5e7eb;
- }
- tr:hover {
- 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-icon {
- margin-right: 4px;
- }
- .btn-sm {
- padding: 4px 8px;
- font-size: 12px;
- }
- /* 表单控件样式 */
- .form-control {
- display: block;
- width: 100%;
- padding: 8px 12px;
- font-size: 14px;
- line-height: 1.5;
- color: #374151;
- background-color: #fff;
- border: 1px solid #d1d5db;
- border-radius: 4px;
- transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
- }
- .form-control:focus {
- border-color: #4CAF50;
- outline: 0;
- box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
- }
- /* 搜索框样式 */
- .search-input {
- min-width: 280px;
- padding: 8px 12px;
- padding-right: 36px;
- border: 2px solid #e5e7eb;
- border-radius: 6px;
- transition: all 0.2s;
- }
- .search-input:focus {
- outline: none;
- border-color: #4CAF50;
- box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
- }
- .search-input::placeholder {
- color: #9ca3af;
- }
- /* 状态标签样式 */
- .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;
- }
- .badge-info {
- background-color: #e0f2fe;
- color: #0369a1;
- }
- /* 表单组样式 */
- .form-group {
- margin-bottom: 16px;
- }
- .form-label {
- display: block;
- margin-bottom: 4px;
- font-size: 14px;
- color: #4b5563;
- }
- /* 分页样式 */
- .pagination {
- display: flex;
- align-items: center;
- gap: 8px;
- }
- .page-item {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- min-width: 32px;
- height: 32px;
- padding: 0 8px;
- border-radius: 4px;
- background-color: #fff;
- border: 1px solid #d1d5db;
- color: #374151;
- font-size: 14px;
- cursor: pointer;
- transition: all 0.2s;
- }
- .page-item:hover {
- background-color: #f9fafb;
- }
- .page-item.active {
- background-color: #4CAF50;
- border-color: #4CAF50;
- color: #fff;
- }
- .page-item.disabled {
- opacity: 0.5;
- cursor: not-allowed;
- }
- </style>
- </head>
- <body>
- <div class="page-container">
- <!-- 页面标题和操作按钮 -->
- <div class="page-header">
- <h1 class="text-2xl font-bold">农机管理</h1>
- <div class="flex gap-2">
- <button class="btn btn-primary" id="addMachineBtn">
- <i class="iconfont icon-plus btn-icon"></i>
- 添加农机
- </button>
- <button class="btn btn-default" id="refreshBtn">
- <i class="iconfont icon-reload btn-icon"></i>
- 刷新
- </button>
- </div>
- </div>
- <!-- 搜索和筛选区域 -->
- <div class="card mb-6 p-4">
- <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
- <div class="relative">
- <input type="text" class="search-input w-full" id="searchInput" placeholder="搜索农机编号/名称">
- <i class="iconfont icon-search absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
- </div>
- <div>
- <select class="form-control" id="machineTypeFilter">
- <option value="">全部类型</option>
- <option value="tractor">拖拉机</option>
- <option value="harvester">收割机</option>
- <option value="seeder">播种机</option>
- <option value="sprayer">喷雾机</option>
- <option value="other">其他</option>
- </select>
- </div>
- <div>
- <select class="form-control" id="statusFilter">
- <option value="">全部状态</option>
- <option value="online">在线</option>
- <option value="offline">离线</option>
- <option value="maintenance">维护中</option>
- <option value="fault">故障</option>
- </select>
- </div>
- <div>
- <select class="form-control" id="farmFilter">
- <option value="">全部农场</option>
- <option value="farm1">智慧农场一号</option>
- <option value="farm2">智慧农场二号</option>
- <option value="farm3">智慧农场三号</option>
- </select>
- </div>
- </div>
- </div>
- <!-- 农机列表 -->
- <div class="card">
- <div class="table-container">
- <table>
- <thead>
- <tr>
- <th>农机编号</th>
- <th>农机名称</th>
- <th>类型</th>
- <th>所属农场</th>
- <th>负责人</th>
- <th>状态</th>
- <th>最后活动时间</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>M20230001</td>
- <td>
- <div class="flex items-center">
- <img src="../assets/images/tractor.png" alt="拖拉机" class="w-10 h-10 mr-3 rounded-md object-cover">
- <div>
- <div class="font-medium">东方红-LX1000</div>
- <div class="text-xs text-gray-500">拖拉机</div>
- </div>
- </div>
- </td>
- <td>拖拉机</td>
- <td>智慧农场一号</td>
- <td>张三</td>
- <td><span class="badge badge-success">在线</span></td>
- <td>2023-08-15 10:30</td>
- <td>
- <div class="flex gap-2">
- <button class="btn btn-sm btn-default view-btn" data-id="M20230001">
- <i class="iconfont icon-eye"></i>
- 管理
- </button>
- <button class="btn btn-sm btn-default edit-btn" data-id="M20230001">
- <i class="iconfont icon-edit"></i>
- 编辑
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>M20230002</td>
- <td>
- <div class="flex items-center">
- <img src="../assets/images/harvester.png" alt="收割机" class="w-10 h-10 mr-3 rounded-md object-cover">
- <div>
- <div class="font-medium">雷沃-GE70</div>
- <div class="text-xs text-gray-500">收割机</div>
- </div>
- </div>
- </td>
- <td>收割机</td>
- <td>智慧农场二号</td>
- <td>李四</td>
- <td><span class="badge badge-warning">维护中</span></td>
- <td>2023-08-14 16:45</td>
- <td>
- <div class="flex gap-2">
- <button class="btn btn-sm btn-default view-btn" data-id="M20230002">
- <i class="iconfont icon-eye"></i>
- 管理
- </button>
- <button class="btn btn-sm btn-default edit-btn" data-id="M20230002">
- <i class="iconfont icon-edit"></i>
- 编辑
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>M20230003</td>
- <td>
- <div class="flex items-center">
- <img src="../assets/images/sprayer.png" alt="喷雾机" class="w-10 h-10 mr-3 rounded-md object-cover">
- <div>
- <div class="font-medium">科乐收-KS2000</div>
- <div class="text-xs text-gray-500">喷雾机</div>
- </div>
- </div>
- </td>
- <td>喷雾机</td>
- <td>智慧农场一号</td>
- <td>王五</td>
- <td><span class="badge badge-danger">离线</span></td>
- <td>2023-08-10 09:15</td>
- <td>
- <div class="flex gap-2">
- <button class="btn btn-sm btn-default view-btn" data-id="M20230003">
- <i class="iconfont icon-eye"></i>
- 管理
- </button>
- <button class="btn btn-sm btn-default edit-btn" data-id="M20230003">
- <i class="iconfont icon-edit"></i>
- 编辑
- </button>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- 分页 -->
- <div class="flex justify-between items-center p-4 border-t border-gray-200">
- <div class="text-sm text-gray-600">
- 共 <span class="text-primary font-medium">24</span> 条记录
- </div>
- <div class="pagination">
- <button class="page-item disabled">上一页</button>
- <button class="page-item active">1</button>
- <button class="page-item">2</button>
- <button class="page-item">3</button>
- <button class="page-item">下一页</button>
- </div>
- </div>
- </div>
- </div>
- <!-- 添加/编辑农机模态框 -->
- <div class="modal" id="machineModal">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="modalTitle">添加农机</h5>
- <button type="button" class="modal-close" id="closeModal">
- <i class="iconfont icon-close"></i>
- </button>
- </div>
- <div class="modal-body">
- <form id="machineForm">
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
- <div class="form-group">
- <label class="form-label" for="machineCode">农机编号</label>
- <input type="text" class="form-control" id="machineCode" placeholder="请输入农机编号">
- </div>
- <div class="form-group">
- <label class="form-label" for="machineName">农机名称</label>
- <input type="text" class="form-control" id="machineName" placeholder="请输入农机名称">
- </div>
- <div class="form-group">
- <label class="form-label" for="machineType">农机类型</label>
- <select class="form-control" id="machineType">
- <option value="">请选择农机类型</option>
- <option value="tractor">拖拉机</option>
- <option value="harvester">收割机</option>
- <option value="seeder">播种机</option>
- <option value="sprayer">喷雾机</option>
- <option value="other">其他</option>
- </select>
- </div>
- <div class="form-group">
- <label class="form-label" for="machineModel">农机型号</label>
- <input type="text" class="form-control" id="machineModel" placeholder="请输入农机型号">
- </div>
- <div class="form-group">
- <label class="form-label" for="machineFarm">所属农场</label>
- <select class="form-control" id="machineFarm">
- <option value="">请选择所属农场</option>
- <option value="farm1">智慧农场一号</option>
- <option value="farm2">智慧农场二号</option>
- <option value="farm3">智慧农场三号</option>
- </select>
- </div>
- <div class="form-group">
- <label class="form-label" for="machineManager">负责人</label>
- <select class="form-control" id="machineManager">
- <option value="">请选择负责人</option>
- <option value="user1">张三</option>
- <option value="user2">李四</option>
- <option value="user3">王五</option>
- </select>
- </div>
- <div class="form-group">
- <label class="form-label" for="machineStatus">使用状态</label>
- <select class="form-control" id="machineStatus">
- <option value="online">在线</option>
- <option value="offline">离线</option>
- <option value="maintenance">维护中</option>
- <option value="fault">故障</option>
- </select>
- </div>
- <div class="form-group">
- <label class="form-label" for="purchaseDate">购买日期</label>
- <input type="date" class="form-control" id="purchaseDate">
- </div>
- </div>
- <div class="form-group">
- <label class="form-label" for="machineDesc">农机描述</label>
- <textarea class="form-control" id="machineDesc" rows="4" placeholder="请输入农机描述信息"></textarea>
- </div>
- </form>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" id="cancelBtn">取消</button>
- <button type="button" class="btn btn-primary" id="saveBtn">保存</button>
- </div>
- </div>
- </div>
- </div>
- <script>
- document.addEventListener('DOMContentLoaded', function() {
- // 获取元素
- const addMachineBtn = document.getElementById('addMachineBtn');
- const refreshBtn = document.getElementById('refreshBtn');
- const machineModal = document.getElementById('machineModal');
- const closeModal = document.getElementById('closeModal');
- const cancelBtn = document.getElementById('cancelBtn');
- const saveBtn = document.getElementById('saveBtn');
- const modalTitle = document.getElementById('modalTitle');
- const machineForm = document.getElementById('machineForm');
- const editBtns = document.querySelectorAll('.edit-btn');
- const viewBtns = document.querySelectorAll('.view-btn');
- // 打开添加农机模态框
- addMachineBtn.addEventListener('click', function() {
- modalTitle.textContent = '添加农机';
- machineForm.reset();
- machineModal.classList.add('show');
- });
- // 关闭模态框
- function closeModalFunc() {
- machineModal.classList.remove('show');
- }
- closeModal.addEventListener('click', closeModalFunc);
- cancelBtn.addEventListener('click', closeModalFunc);
- // 编辑按钮点击事件
- editBtns.forEach(btn => {
- btn.addEventListener('click', function() {
- const machineId = this.getAttribute('data-id');
- modalTitle.textContent = '编辑农机';
- // 这里应该根据ID获取农机信息并填充表单
- // 模拟填充表单
- document.getElementById('machineCode').value = machineId;
- document.getElementById('machineName').value = this.closest('tr').querySelector('.font-medium').textContent;
- document.getElementById('machineType').value = this.closest('tr').cells[2].textContent.toLowerCase();
- document.getElementById('machineFarm').value = 'farm1';
- document.getElementById('machineManager').value = 'user1';
- document.getElementById('machineStatus').value = 'online';
-
- machineModal.classList.add('show');
- });
- });
- // 查看按钮点击事件
- viewBtns.forEach(btn => {
- btn.addEventListener('click', function() {
- const machineId = this.getAttribute('data-id');
- // 跳转到农机详情页
- window.location.href = `machine-detail.html?id=${machineId}`;
- });
- });
- // 保存按钮点击事件
- saveBtn.addEventListener('click', function() {
- // 模拟保存操作
- alert('保存成功!');
- closeModalFunc();
- });
- // 刷新按钮点击事件
- refreshBtn.addEventListener('click', function() {
- // 模拟刷新操作
- alert('数据已刷新!');
- });
- });
- </script>
- </body>
- </html>
|