field-detail.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  1. <!DOCTYPE html>
  2. <html lang="zh-CN" class="iframe-content">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>地块详情 - 爱智农</title>
  7. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
  8. <link rel="stylesheet" href="https://at.alicdn.com/t/font_3114978_qe0b39no76.css">
  9. <link rel="stylesheet" href="../assets/css/global.css">
  10. <style>
  11. body {
  12. font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  13. background-color: #f5f7f9;
  14. color: #333;
  15. }
  16. .page-container {
  17. padding: 20px;
  18. }
  19. .card {
  20. background-color: white;
  21. border-radius: 8px;
  22. box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  23. }
  24. .btn {
  25. display: inline-flex;
  26. align-items: center;
  27. justify-content: center;
  28. padding: 8px 16px;
  29. border-radius: 4px;
  30. font-weight: 500;
  31. cursor: pointer;
  32. transition: all 0.2s;
  33. }
  34. .btn-primary {
  35. background-color: #4CAF50;
  36. color: white;
  37. }
  38. .btn-primary:hover {
  39. background-color: #388E3C;
  40. }
  41. .btn-default {
  42. background-color: white;
  43. border: 1px solid #d1d5db;
  44. color: #374151;
  45. }
  46. .btn-default:hover {
  47. background-color: #f9fafb;
  48. }
  49. .btn-danger {
  50. background-color: #ef4444;
  51. color: white;
  52. }
  53. .btn-danger:hover {
  54. background-color: #dc2626;
  55. }
  56. .btn-icon {
  57. margin-right: 4px;
  58. }
  59. .tabs {
  60. display: flex;
  61. border-bottom: 1px solid #e5e7eb;
  62. }
  63. .tab {
  64. padding: 12px 20px;
  65. cursor: pointer;
  66. border-bottom: 2px solid transparent;
  67. font-weight: 500;
  68. transition: all 0.2s;
  69. }
  70. .tab:hover {
  71. color: #4CAF50;
  72. }
  73. .tab.active {
  74. color: #4CAF50;
  75. border-bottom: 2px solid #4CAF50;
  76. }
  77. .tab-content {
  78. display: none;
  79. padding: 20px;
  80. }
  81. .tab-content.active {
  82. display: block;
  83. }
  84. .info-group {
  85. margin-bottom: 20px;
  86. }
  87. .info-label {
  88. color: #6b7280;
  89. margin-bottom: 4px;
  90. }
  91. .info-value {
  92. font-weight: 500;
  93. }
  94. .badge {
  95. display: inline-block;
  96. padding: 2px 8px;
  97. border-radius: 9999px;
  98. font-size: 12px;
  99. font-weight: 500;
  100. }
  101. .badge-success {
  102. background-color: #d1fae5;
  103. color: #065f46;
  104. }
  105. .badge-warning {
  106. background-color: #fef3c7;
  107. color: #92400e;
  108. }
  109. .badge-danger {
  110. background-color: #fee2e2;
  111. color: #b91c1c;
  112. }
  113. .table-container {
  114. overflow-x: auto;
  115. }
  116. table {
  117. width: 100%;
  118. border-collapse: collapse;
  119. }
  120. th {
  121. background-color: #f9fafb;
  122. padding: 12px 16px;
  123. text-align: left;
  124. font-weight: 500;
  125. color: #6b7280;
  126. border-bottom: 1px solid #e5e7eb;
  127. }
  128. td {
  129. padding: 12px 16px;
  130. border-bottom: 1px solid #e5e7eb;
  131. }
  132. tr:hover {
  133. background-color: #f9fafb;
  134. }
  135. .device-item, .person-item {
  136. border: 1px solid #e5e7eb;
  137. border-radius: 8px;
  138. padding: 12px;
  139. margin-bottom: 12px;
  140. display: flex;
  141. justify-content: space-between;
  142. align-items: center;
  143. }
  144. .device-item-bound, .person-item-bound {
  145. background-color: #f0fdf4;
  146. border-color: #4CAF50;
  147. }
  148. .map-container {
  149. height: 500px;
  150. width: 100%;
  151. position: relative;
  152. background-color: #eee;
  153. overflow: hidden;
  154. border-radius: 8px;
  155. }
  156. .map-toolbar {
  157. position: absolute;
  158. top: 20px;
  159. left: 20px;
  160. background-color: white;
  161. border-radius: 8px;
  162. box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  163. padding: 10px;
  164. z-index: 10;
  165. }
  166. .map-tool {
  167. display: flex;
  168. align-items: center;
  169. padding: 8px 12px;
  170. cursor: pointer;
  171. border-radius: 4px;
  172. margin-bottom: 8px;
  173. transition: all 0.2s;
  174. }
  175. .map-tool:hover {
  176. background-color: #f3f4f6;
  177. }
  178. .map-tool.active {
  179. background-color: #e8f5e9;
  180. color: #4CAF50;
  181. }
  182. .map-tool i {
  183. margin-right: 8px;
  184. font-size: 18px;
  185. }
  186. .detail-card {
  187. background: #fff;
  188. border-radius: 8px;
  189. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  190. margin-bottom: 20px;
  191. padding: 24px;
  192. }
  193. .detail-grid {
  194. display: grid;
  195. grid-template-columns: repeat(4, 1fr);
  196. gap: 24px;
  197. }
  198. .detail-item {
  199. display: flex;
  200. flex-direction: column;
  201. gap: 8px;
  202. }
  203. .detail-label {
  204. font-size: 13px;
  205. color: #64748b;
  206. }
  207. .detail-value {
  208. font-size: 14px;
  209. color: #1e293b;
  210. font-weight: 500;
  211. }
  212. .count-badge {
  213. display: inline-flex;
  214. align-items: center;
  215. gap: 4px;
  216. font-size: 13px;
  217. color: #475569;
  218. padding: 2px 4px;
  219. }
  220. .count-badge i {
  221. color: #64748b;
  222. font-size: 13px;
  223. }
  224. .btn-sm {
  225. padding: 4px 12px;
  226. font-size: 13px;
  227. }
  228. .btn-default.active {
  229. background-color: #f0fdf4;
  230. border-color: #4ade80;
  231. color: #16a34a;
  232. }
  233. .search-input {
  234. min-width: 280px;
  235. padding: 8px 12px;
  236. padding-right: 36px;
  237. border: 2px solid #e5e7eb;
  238. border-radius: 6px;
  239. transition: all 0.2s;
  240. }
  241. .search-input:focus {
  242. outline: none;
  243. border-color: #4CAF50;
  244. box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
  245. }
  246. .search-input::placeholder {
  247. color: #9ca3af;
  248. }
  249. table {
  250. border-collapse: separate;
  251. border-spacing: 0;
  252. }
  253. th {
  254. font-weight: 500;
  255. white-space: nowrap;
  256. }
  257. td {
  258. white-space: nowrap;
  259. }
  260. tbody tr:hover {
  261. background-color: #f8fafc;
  262. }
  263. .btn-danger {
  264. background-color: #fee2e2;
  265. color: #dc2626;
  266. border: 1px solid #fecaca;
  267. }
  268. .btn-danger:hover {
  269. background-color: #fecaca;
  270. }
  271. .filter-tabs {
  272. display: flex;
  273. gap: 1px;
  274. padding: 2px;
  275. background: #f3f4f6;
  276. border-radius: 8px;
  277. }
  278. .filter-tab {
  279. padding: 6px 16px;
  280. font-size: 14px;
  281. border-radius: 6px;
  282. cursor: pointer;
  283. transition: all 0.2s;
  284. background: transparent;
  285. border: none;
  286. color: #6b7280;
  287. position: relative;
  288. display: flex;
  289. align-items: center;
  290. gap: 6px;
  291. }
  292. .filter-tab:hover {
  293. color: #4b5563;
  294. }
  295. .filter-tab.active {
  296. background: white;
  297. color: #4CAF50;
  298. box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  299. }
  300. .filter-badge {
  301. padding: 2px 8px;
  302. font-size: 12px;
  303. border-radius: 10px;
  304. font-weight: 500;
  305. background: #f3f4f6;
  306. }
  307. .filter-tab.active .filter-badge {
  308. background: #ecfdf5;
  309. color: #059669;
  310. }
  311. .filter-tab:not(.active) .filter-badge {
  312. background: #f3f4f6;
  313. color: #6b7280;
  314. }
  315. </style>
  316. </head>
  317. <body>
  318. <div class="page-container">
  319. <div class="flex justify-between items-center mb-6">
  320. <div class="flex items-center">
  321. <a href="field-management.html" class="mr-2">
  322. <i class="iconfont icon-left"></i>
  323. </a>
  324. <h1 class="text-2xl font-bold">地块详情</h1>
  325. </div>
  326. <div class="flex gap-2">
  327. <button class="btn btn-default" id="editBtn">
  328. <i class="iconfont icon-edit btn-icon"></i>
  329. 编辑
  330. </button>
  331. <button class="btn btn-default" id="refreshBtn">
  332. <i class="iconfont icon-reload btn-icon"></i>
  333. 刷新
  334. </button>
  335. </div>
  336. </div>
  337. <div class="card">
  338. <div class="tabs">
  339. <div class="tab active" data-tab="info">基本信息</div>
  340. <div class="tab" data-tab="device">设备绑定</div>
  341. <div class="tab" data-tab="person">人员绑定</div>
  342. <div class="tab" data-tab="map">区域绘制</div>
  343. </div>
  344. <!-- 基本信息 -->
  345. <div class="tab-content active" id="tab-info">
  346. <div class="grid grid-cols-1 gap-4">
  347. <!-- 基础信息展示 -->
  348. <div class="detail-card">
  349. <div class="detail-grid">
  350. <div class="detail-item">
  351. <div class="detail-label">地块编号</div>
  352. <div class="detail-value" id="fieldId">FK20230001</div>
  353. </div>
  354. <div class="detail-item">
  355. <div class="detail-label">地块名称</div>
  356. <div class="detail-value" id="fieldName">东区水稻田A</div>
  357. </div>
  358. <div class="detail-item">
  359. <div class="detail-label">所属农场</div>
  360. <div class="detail-value">智慧农场一号</div>
  361. </div>
  362. <div class="detail-item">
  363. <div class="detail-label">所属区域</div>
  364. <div class="detail-value" id="fieldArea">东区</div>
  365. </div>
  366. <div class="detail-item">
  367. <div class="detail-label">地块类型</div>
  368. <div class="detail-value" id="fieldType">水田</div>
  369. </div>
  370. <div class="detail-item">
  371. <div class="detail-label">面积(亩)</div>
  372. <div class="detail-value" id="fieldSize">120</div>
  373. </div>
  374. <div class="detail-item">
  375. <div class="detail-label">种植作物</div>
  376. <div class="detail-value">水稻</div>
  377. </div>
  378. <div class="detail-item">
  379. <div class="detail-label">土壤类型</div>
  380. <div class="detail-value">黏土</div>
  381. </div>
  382. <div class="detail-item">
  383. <div class="detail-label">灌溉方式</div>
  384. <div class="detail-value">喷灌</div>
  385. </div>
  386. <div class="detail-item">
  387. <div class="detail-label">使用状态</div>
  388. <div class="detail-value">
  389. <span class="badge badge-success">
  390. <i class="iconfont icon-check-circle badge-icon"></i>使用中
  391. </span>
  392. </div>
  393. </div>
  394. <div class="detail-item">
  395. <div class="detail-label">绑定设备</div>
  396. <div class="detail-value">
  397. <span class="count-badge">
  398. <i class="iconfont icon-device"></i>3
  399. </span>
  400. </div>
  401. </div>
  402. <div class="detail-item">
  403. <div class="detail-label">绑定人员</div>
  404. <div class="detail-value">
  405. <span class="count-badge">
  406. <i class="iconfont icon-user"></i>2
  407. </span>
  408. </div>
  409. </div>
  410. <div class="detail-item">
  411. <div class="detail-label">负责人</div>
  412. <div class="detail-value">张三</div>
  413. </div>
  414. <div class="detail-item">
  415. <div class="detail-label">创建时间</div>
  416. <div class="detail-value" id="createTime">2023-05-15</div>
  417. </div>
  418. <div class="detail-item">
  419. <div class="detail-label">上次更新</div>
  420. <div class="detail-value">2023-06-20</div>
  421. </div>
  422. <div class="detail-item col-span-4">
  423. <div class="detail-label">地块描述</div>
  424. <div class="detail-value" id="fieldDesc" style="white-space: pre-line; line-height: 1.5;">
  425. 这是一块位于东区的水稻田,土壤肥沃,水源充足,适合种植水稻。年产量约为10000公斤,是农场的主要粮食生产区域。
  426. </div>
  427. </div>
  428. </div>
  429. </div>
  430. <div class="info-group">
  431. <div class="info-label">作物信息</div>
  432. <div class="table-container mt-2">
  433. <table>
  434. <thead>
  435. <tr>
  436. <th>作物名称</th>
  437. <th>种植面积(亩)</th>
  438. <th>种植时间</th>
  439. <th>预计收获时间</th>
  440. <th>状态</th>
  441. </tr>
  442. </thead>
  443. <tbody>
  444. <tr>
  445. <td>水稻(早稻)</td>
  446. <td>120</td>
  447. <td>2023-02-15</td>
  448. <td>2023-06-20</td>
  449. <td><span class="badge badge-success">生长中</span></td>
  450. </tr>
  451. </tbody>
  452. </table>
  453. </div>
  454. </div>
  455. </div>
  456. </div>
  457. <!-- 设备绑定 -->
  458. <div class="tab-content" id="tab-device">
  459. <div class="flex justify-between items-center mb-4">
  460. <div class="flex items-center gap-4">
  461. <h3 class="text-lg font-medium">设备列表</h3>
  462. <div class="filter-tabs">
  463. <button class="filter-tab active" data-filter="bound" data-target="device-bound-list">
  464. 已绑定
  465. <span class="filter-badge">3</span>
  466. </button>
  467. <button class="filter-tab" data-filter="unbound" data-target="device-unbound-list">
  468. 未绑定
  469. <span class="filter-badge">8</span>
  470. </button>
  471. </div>
  472. </div>
  473. <div class="relative">
  474. <input type="text" class="search-input" placeholder="搜索设备编号/名称">
  475. <i class="iconfont icon-search absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
  476. </div>
  477. </div>
  478. <div id="device-bound-list" class="bg-white rounded-lg overflow-hidden">
  479. <table class="min-w-full">
  480. <!-- 已绑定设备表格内容 -->
  481. <thead>
  482. <tr class="bg-gray-50">
  483. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备编号</th>
  484. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备名称</th>
  485. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备类型</th>
  486. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">状态</th>
  487. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">绑定时间</th>
  488. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">操作</th>
  489. </tr>
  490. </thead>
  491. <tbody>
  492. <tr class="border-t border-gray-100">
  493. <td class="px-4 py-3 text-sm">DEV001</td>
  494. <td class="px-4 py-3 text-sm">土壤湿度传感器</td>
  495. <td class="px-4 py-3 text-sm">传感器</td>
  496. <td class="px-4 py-3 text-sm">
  497. <span class="badge badge-success">在线</span>
  498. </td>
  499. <td class="px-4 py-3 text-sm">2023-05-15 10:30</td>
  500. <td class="px-4 py-3 text-sm">
  501. <button class="btn btn-sm btn-danger">解绑</button>
  502. </td>
  503. </tr>
  504. </tbody>
  505. </table>
  506. </div>
  507. <div id="device-unbound-list" class="bg-white rounded-lg overflow-hidden" style="display: none;">
  508. <table class="min-w-full">
  509. <!-- 未绑定设备表格内容 -->
  510. <thead>
  511. <tr class="bg-gray-50">
  512. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备编号</th>
  513. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备名称</th>
  514. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备类型</th>
  515. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">状态</th>
  516. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">操作</th>
  517. </tr>
  518. </thead>
  519. <tbody>
  520. <tr class="border-t border-gray-100">
  521. <td class="px-4 py-3 text-sm">DEV004</td>
  522. <td class="px-4 py-3 text-sm">气象站</td>
  523. <td class="px-4 py-3 text-sm">监测设备</td>
  524. <td class="px-4 py-3 text-sm">
  525. <span class="badge badge-success">在线</span>
  526. </td>
  527. <td class="px-4 py-3 text-sm">
  528. <button class="btn btn-sm btn-primary">绑定</button>
  529. </td>
  530. </tr>
  531. </tbody>
  532. </table>
  533. </div>
  534. <!-- 分页 -->
  535. <div class="flex justify-between items-center mt-4">
  536. <div class="text-sm text-gray-600">
  537. 共 <span class="text-primary font-medium">11</span> 条记录
  538. </div>
  539. <div class="flex items-center gap-2">
  540. <button class="btn btn-default btn-sm" disabled>上一页</button>
  541. <button class="btn btn-default btn-sm bg-primary text-white">1</button>
  542. <button class="btn btn-default btn-sm">2</button>
  543. <button class="btn btn-default btn-sm">下一页</button>
  544. </div>
  545. </div>
  546. </div>
  547. <!-- 人员绑定 -->
  548. <div class="tab-content" id="tab-person">
  549. <div class="flex justify-between items-center mb-4">
  550. <div class="flex items-center gap-4">
  551. <h3 class="text-lg font-medium">人员列表</h3>
  552. <div class="filter-tabs">
  553. <button class="filter-tab active" data-filter="bound" data-target="person-bound-list">
  554. 已绑定
  555. <span class="filter-badge">2</span>
  556. </button>
  557. <button class="filter-tab" data-filter="unbound" data-target="person-unbound-list">
  558. 未绑定
  559. <span class="filter-badge">6</span>
  560. </button>
  561. </div>
  562. </div>
  563. <div class="relative">
  564. <input type="text" class="search-input" placeholder="搜索姓名/职位">
  565. <i class="iconfont icon-search absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
  566. </div>
  567. </div>
  568. <div id="person-bound-list" class="bg-white rounded-lg overflow-hidden">
  569. <table class="min-w-full">
  570. <!-- 已绑定人员表格内容 -->
  571. <thead>
  572. <tr class="bg-gray-50">
  573. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">工号</th>
  574. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">姓名</th>
  575. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">职位</th>
  576. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">联系方式</th>
  577. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">绑定时间</th>
  578. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">操作</th>
  579. </tr>
  580. </thead>
  581. <tbody>
  582. <tr class="border-t border-gray-100">
  583. <td class="px-4 py-3 text-sm">EMP001</td>
  584. <td class="px-4 py-3 text-sm">
  585. <div class="flex items-center gap-2">
  586. <div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center">
  587. <i class="iconfont icon-user text-green-600"></i>
  588. </div>
  589. <span>张三</span>
  590. </div>
  591. </td>
  592. <td class="px-4 py-3 text-sm">农场技术员</td>
  593. <td class="px-4 py-3 text-sm">13800138000</td>
  594. <td class="px-4 py-3 text-sm">2023-05-15 10:30</td>
  595. <td class="px-4 py-3 text-sm">
  596. <button class="btn btn-sm btn-danger">解绑</button>
  597. </td>
  598. </tr>
  599. </tbody>
  600. </table>
  601. </div>
  602. <div id="person-unbound-list" class="bg-white rounded-lg overflow-hidden" style="display: none;">
  603. <table class="min-w-full">
  604. <!-- 未绑定人员表格内容 -->
  605. <thead>
  606. <tr class="bg-gray-50">
  607. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">工号</th>
  608. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">姓名</th>
  609. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">职位</th>
  610. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">联系方式</th>
  611. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">操作</th>
  612. </tr>
  613. </thead>
  614. <tbody>
  615. <tr class="border-t border-gray-100">
  616. <td class="px-4 py-3 text-sm">EMP004</td>
  617. <td class="px-4 py-3 text-sm">
  618. <div class="flex items-center gap-2">
  619. <div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center">
  620. <i class="iconfont icon-user text-gray-600"></i>
  621. </div>
  622. <span>李四</span>
  623. </div>
  624. </td>
  625. <td class="px-4 py-3 text-sm">农场工人</td>
  626. <td class="px-4 py-3 text-sm">13900139000</td>
  627. <td class="px-4 py-3 text-sm">
  628. <button class="btn btn-sm btn-primary">绑定</button>
  629. </td>
  630. </tr>
  631. </tbody>
  632. </table>
  633. </div>
  634. <!-- 分页 -->
  635. <div class="flex justify-between items-center mt-4">
  636. <div class="text-sm text-gray-600">
  637. 共 <span class="text-primary font-medium">8</span> 条记录
  638. </div>
  639. <div class="flex items-center gap-2">
  640. <button class="btn btn-default btn-sm" disabled>上一页</button>
  641. <button class="btn btn-default btn-sm bg-primary text-white">1</button>
  642. <button class="btn btn-default btn-sm">2</button>
  643. <button class="btn btn-default btn-sm">下一页</button>
  644. </div>
  645. </div>
  646. </div>
  647. <!-- 区域绘制 -->
  648. <div class="tab-content" id="tab-map">
  649. <div class="flex justify-between items-center mb-4">
  650. <h3 class="text-lg font-medium">地块区域绘制</h3>
  651. <button class="btn btn-primary" id="saveMapBtn">
  652. <i class="iconfont icon-save btn-icon"></i>
  653. 保存绘制区域
  654. </button>
  655. </div>
  656. <div class="map-container">
  657. <!-- 地图工具栏 -->
  658. <div class="map-toolbar">
  659. <div class="map-tool active">
  660. <i class="iconfont icon-select"></i>
  661. <span>选择</span>
  662. </div>
  663. <div class="map-tool">
  664. <i class="iconfont icon-edit"></i>
  665. <span>绘制区域</span>
  666. </div>
  667. <div class="map-tool">
  668. <i class="iconfont icon-edit-square"></i>
  669. <span>编辑节点</span>
  670. </div>
  671. <div class="map-tool">
  672. <i class="iconfont icon-delete"></i>
  673. <span>删除</span>
  674. </div>
  675. <div class="map-tool">
  676. <i class="iconfont icon-undo"></i>
  677. <span>撤销</span>
  678. </div>
  679. <div class="map-tool">
  680. <i class="iconfont icon-redo"></i>
  681. <span>重做</span>
  682. </div>
  683. </div>
  684. <!-- 地图区域 (实际项目中这里会使用高德地图、百度地图等API) -->
  685. <div class="w-full h-full flex items-center justify-center text-gray-400">
  686. <div class="text-center">
  687. <i class="iconfont icon-map text-6xl"></i>
  688. <div class="mt-2">地图加载中...</div>
  689. <div class="mt-2 text-sm">实际项目中这里将集成高德地图、百度地图等API</div>
  690. </div>
  691. </div>
  692. </div>
  693. <div class="mt-4">
  694. <div class="font-medium mb-2">地块坐标信息</div>
  695. <div class="p-3 bg-gray-50 rounded-md text-sm font-mono">
  696. {"type":"Polygon","coordinates":[[[120.12345,30.12345],[120.23456,30.12345],[120.23456,30.23456],[120.12345,30.23456],[120.12345,30.12345]]]}
  697. </div>
  698. </div>
  699. </div>
  700. </div>
  701. </div>
  702. <script>
  703. document.addEventListener('DOMContentLoaded', function() {
  704. // 获取URL参数
  705. const urlParams = new URLSearchParams(window.location.search);
  706. const fieldId = urlParams.get('id');
  707. const activeTab = urlParams.get('tab');
  708. // 切换Tab
  709. const tabs = document.querySelectorAll('.tab');
  710. const tabContents = document.querySelectorAll('.tab-content');
  711. // 如果URL中有指定的tab,则激活它
  712. if (activeTab) {
  713. tabs.forEach(tab => {
  714. tab.classList.remove('active');
  715. if (tab.getAttribute('data-tab') === activeTab) {
  716. tab.classList.add('active');
  717. }
  718. });
  719. tabContents.forEach(content => {
  720. content.classList.remove('active');
  721. if (content.id === 'tab-' + activeTab) {
  722. content.classList.add('active');
  723. }
  724. });
  725. }
  726. // Tab点击事件
  727. tabs.forEach(tab => {
  728. tab.addEventListener('click', function() {
  729. const tabId = this.getAttribute('data-tab');
  730. // 更新URL参数但不刷新页面
  731. const url = new URL(window.location);
  732. url.searchParams.set('tab', tabId);
  733. window.history.pushState({}, '', url);
  734. // 切换激活状态
  735. tabs.forEach(t => t.classList.remove('active'));
  736. this.classList.add('active');
  737. // 显示对应内容
  738. tabContents.forEach(content => {
  739. content.classList.remove('active');
  740. if (content.id === 'tab-' + tabId) {
  741. content.classList.add('active');
  742. }
  743. });
  744. });
  745. });
  746. // 编辑按钮事件
  747. document.getElementById('editBtn').addEventListener('click', function() {
  748. // 跳转到地块管理页的编辑模态框
  749. window.location.href = `field-management-content.html?edit=${fieldId}`;
  750. });
  751. // 设备绑定保存按钮
  752. document.getElementById('saveDeviceBtn')?.addEventListener('click', function() {
  753. alert('设备绑定关系保存成功');
  754. });
  755. // 人员绑定保存按钮
  756. document.getElementById('savePersonBtn')?.addEventListener('click', function() {
  757. alert('人员绑定关系保存成功');
  758. });
  759. // 地图区域保存按钮
  760. document.getElementById('saveMapBtn').addEventListener('click', function() {
  761. alert('地块区域保存成功');
  762. });
  763. // 设备绑定/解绑按钮
  764. const deviceBindBtns = document.querySelectorAll('#tab-device .btn-primary');
  765. deviceBindBtns.forEach(btn => {
  766. btn.addEventListener('click', function() {
  767. const deviceItem = this.closest('.device-item');
  768. deviceItem.classList.add('device-item-bound');
  769. this.className = 'btn btn-sm btn-danger';
  770. this.textContent = '解绑';
  771. });
  772. });
  773. const deviceUnbindBtns = document.querySelectorAll('#tab-device .btn-danger');
  774. deviceUnbindBtns.forEach(btn => {
  775. btn.addEventListener('click', function() {
  776. const deviceItem = this.closest('.device-item');
  777. deviceItem.classList.remove('device-item-bound');
  778. this.className = 'btn btn-sm btn-primary';
  779. this.textContent = '绑定';
  780. });
  781. });
  782. // 人员绑定/解绑按钮
  783. const personBindBtns = document.querySelectorAll('#tab-person .btn-primary');
  784. personBindBtns.forEach(btn => {
  785. btn.addEventListener('click', function() {
  786. const personItem = this.closest('.person-item');
  787. personItem.classList.add('person-item-bound');
  788. this.className = 'btn btn-sm btn-danger';
  789. this.textContent = '解绑';
  790. });
  791. });
  792. const personUnbindBtns = document.querySelectorAll('#tab-person .btn-danger');
  793. personUnbindBtns.forEach(btn => {
  794. btn.addEventListener('click', function() {
  795. const personItem = this.closest('.person-item');
  796. personItem.classList.remove('person-item-bound');
  797. this.className = 'btn btn-sm btn-primary';
  798. this.textContent = '绑定';
  799. });
  800. });
  801. // 地图工具点击事件
  802. const mapTools = document.querySelectorAll('.map-tool');
  803. mapTools.forEach(tool => {
  804. tool.addEventListener('click', function() {
  805. mapTools.forEach(t => t.classList.remove('active'));
  806. this.classList.add('active');
  807. });
  808. });
  809. // 绑定/未绑定切换功能
  810. function initFilterTabs(container) {
  811. const tabs = container.querySelectorAll('.filter-tab');
  812. tabs.forEach(tab => {
  813. tab.addEventListener('click', function() {
  814. // 移除所有tab的active状态
  815. tabs.forEach(t => t.classList.remove('active'));
  816. // 添加当前tab的active状态
  817. this.classList.add('active');
  818. // 获取目标列表
  819. const targetId = this.getAttribute('data-target');
  820. const lists = container.closest('.tab-content').querySelectorAll('[id$="-list"]');
  821. // 隐藏所有列表
  822. lists.forEach(list => list.style.display = 'none');
  823. // 显示目标列表
  824. document.getElementById(targetId).style.display = 'block';
  825. });
  826. });
  827. }
  828. // 初始化设备和人员的过滤标签
  829. const deviceContent = document.getElementById('tab-device');
  830. const personContent = document.getElementById('tab-person');
  831. initFilterTabs(deviceContent);
  832. initFilterTabs(personContent);
  833. });
  834. </script>
  835. </body>
  836. </html>