field-management-content-backup.html 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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. :root {
  12. --primary: #4CAF50;
  13. --primary-dark: #388E3C;
  14. --primary-light: #A5D6A7;
  15. --primary-bg: #F1F8E9;
  16. --success: #4CAF50;
  17. --warning: #FFC107;
  18. --danger: #F44336;
  19. --info: #2196F3;
  20. --disabled: #9E9E9E;
  21. --border: #E0E0E0;
  22. --text-primary: #212121;
  23. --text-secondary: #757575;
  24. --radius: 8px;
  25. }
  26. /* 全局样式重置 */
  27. * {
  28. margin: 0;
  29. padding: 0;
  30. box-sizing: border-box;
  31. }
  32. /* 移除所有固定定位和绝对定位元素 */
  33. .fixed,
  34. .absolute,
  35. [style*="position: fixed"],
  36. [style*="position: absolute"] {
  37. display: none !important;
  38. }
  39. /* 移除所有圆形按钮和浮动元素 */
  40. .circle,
  41. .rounded-full,
  42. .floating,
  43. [class*="circle"],
  44. [class*="round"],
  45. [class*="float"] {
  46. display: none !important;
  47. }
  48. /* 确保内容不会溢出 */
  49. html, body {
  50. overflow-x: hidden;
  51. position: relative;
  52. }
  53. /* 移除所有可能的遮罩层 */
  54. [class*="overlay"],
  55. [class*="mask"],
  56. [style*="z-index: 9999"] {
  57. display: none !important;
  58. }
  59. /* 重置默认样式 */
  60. html, body {
  61. margin: 0;
  62. padding: 0;
  63. font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  64. height: 100%;
  65. position: relative;
  66. }
  67. body {
  68. background-color: #f5f7f9;
  69. color: var(--text-primary);
  70. overflow-x: hidden;
  71. padding-top: 15px;
  72. }
  73. /* 防止重复菜单 - 修改选择器避免影响按钮和模态框 */
  74. body > div:not(.page-container):not(.modal):not(#fieldModal),
  75. iframe#sidebar,
  76. div.system-menu,
  77. [id^="system-menu"],
  78. [class^="system-menu"],
  79. #admin-sidebar,
  80. .menu-popup,
  81. .user-avatar-circle {
  82. display: none !important;
  83. }
  84. /* 移除可能影响按钮和模态框的全局样式 */
  85. .circle-btn,
  86. .floating-circle,
  87. .round-button,
  88. .scroll-top-btn,
  89. .help-btn,
  90. .chat-btn {
  91. display: none !important;
  92. }
  93. /* 模态框样式 */
  94. .modal {
  95. display: none;
  96. position: fixed;
  97. top: 0;
  98. left: 0;
  99. right: 0;
  100. bottom: 0;
  101. width: 100%;
  102. height: 100%;
  103. background-color: rgba(0, 0, 0, 0.5);
  104. z-index: 99999;
  105. opacity: 0;
  106. visibility: hidden;
  107. transition: opacity 0.3s ease, visibility 0.3s ease;
  108. }
  109. .modal.show {
  110. display: block !important;
  111. opacity: 1 !important;
  112. visibility: visible !important;
  113. }
  114. .modal-dialog {
  115. position: fixed;
  116. top: 50%;
  117. left: 50%;
  118. transform: translate(-50%, -50%);
  119. width: 90%;
  120. max-width: 800px;
  121. margin-top: 20px;
  122. background: #fff;
  123. border-radius: 8px;
  124. z-index: 100000;
  125. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  126. }
  127. .modal-content {
  128. background: #fff;
  129. border-radius: 8px;
  130. overflow: hidden;
  131. position: relative;
  132. }
  133. .modal-header {
  134. padding: 16px 24px;
  135. border-bottom: 1px solid #e0e0e0;
  136. display: flex;
  137. align-items: center;
  138. justify-content: space-between;
  139. background: #fff;
  140. position: sticky;
  141. top: 0;
  142. z-index: 1;
  143. }
  144. .modal-close {
  145. padding: 8px;
  146. background: none;
  147. border: none;
  148. cursor: pointer;
  149. font-size: 20px;
  150. color: #666;
  151. display: flex;
  152. align-items: center;
  153. justify-content: center;
  154. border-radius: 4px;
  155. transition: all 0.3s;
  156. }
  157. .modal-close:hover {
  158. background-color: rgba(0, 0, 0, 0.05);
  159. color: #333;
  160. }
  161. .modal-title {
  162. font-size: 18px;
  163. font-weight: 500;
  164. color: #333;
  165. margin: 0;
  166. }
  167. .modal-body {
  168. padding: 24px;
  169. max-height: calc(100vh - 200px);
  170. overflow-y: auto;
  171. background: #fff;
  172. }
  173. .modal-footer {
  174. padding: 16px 24px;
  175. border-top: 1px solid #e0e0e0;
  176. display: flex;
  177. justify-content: flex-end;
  178. gap: 12px;
  179. background: #fff;
  180. }
  181. .form-grid {
  182. display: grid;
  183. grid-template-columns: repeat(2, 1fr);
  184. gap: 20px;
  185. }
  186. .form-group {
  187. margin-bottom: 0;
  188. }
  189. .form-label {
  190. display: block;
  191. margin-bottom: 8px;
  192. font-size: 14px;
  193. color: #333;
  194. }
  195. .form-input {
  196. width: 100%;
  197. padding: 8px 12px;
  198. border: 1px solid #ddd;
  199. border-radius: 4px;
  200. font-size: 14px;
  201. transition: all 0.3s;
  202. }
  203. .form-input:focus {
  204. border-color: var(--primary);
  205. box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
  206. outline: none;
  207. }
  208. .required {
  209. color: #f44336;
  210. margin-left: 4px;
  211. }
  212. /* 确保所有按钮可点击 */
  213. .action-btn,
  214. .btn,
  215. button {
  216. cursor: pointer !important;
  217. pointer-events: auto !important;
  218. position: relative;
  219. z-index: 1;
  220. }
  221. /* 移除可能影响按钮的样式 */
  222. body > div:not(.page-container):not(.modal):not(#fieldModal) {
  223. display: none !important;
  224. }
  225. /* 确保所有操作按钮可见和可交互 */
  226. .action-btn,
  227. #addFieldBtn,
  228. .btn-primary,
  229. .btn-outline,
  230. .modal button {
  231. visibility: visible !important;
  232. opacity: 1 !important;
  233. display: inline-flex !important;
  234. pointer-events: auto !important;
  235. }
  236. /* 页面容器 */
  237. .page-container {
  238. max-width: 100%;
  239. padding: 24px;
  240. padding-top: 42px;
  241. margin: 0;
  242. box-sizing: border-box;
  243. position: relative;
  244. z-index: 1;
  245. }
  246. /* 页面标题和操作按钮容器 */
  247. .page-header {
  248. display: flex;
  249. justify-content: space-between;
  250. align-items: center;
  251. margin-bottom: 20px;
  252. padding-bottom: 16px;
  253. border-bottom: 1px solid var(--border);
  254. padding-top: 10px;
  255. position: relative;
  256. }
  257. /* 添加新增按钮的特定样式 */
  258. .add-button-container {
  259. position: relative;
  260. z-index: 9999;
  261. }
  262. #addFieldBtn {
  263. position: relative;
  264. z-index: 9999 !important;
  265. visibility: visible !important;
  266. opacity: 1 !important;
  267. display: inline-flex !important;
  268. cursor: pointer;
  269. pointer-events: auto !important;
  270. }
  271. .page-title {
  272. font-size: 22px;
  273. font-weight: 600;
  274. position: relative;
  275. color: var(--text-primary);
  276. display: flex;
  277. align-items: center;
  278. margin: 0;
  279. }
  280. .page-title::before {
  281. content: "";
  282. width: 4px;
  283. height: 22px;
  284. background-color: var(--primary);
  285. margin-right: 8px;
  286. border-radius: 2px;
  287. }
  288. .search-card {
  289. background-color: #fff;
  290. border-radius: var(--radius);
  291. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  292. padding: 16px;
  293. margin-bottom: 20px;
  294. }
  295. .search-input {
  296. width: 100%;
  297. border: 1px solid var(--border);
  298. border-radius: 4px;
  299. padding: 6px 12px;
  300. font-size: 13px;
  301. transition: all 0.3s;
  302. height: 32px;
  303. }
  304. .search-input:focus {
  305. border-color: var(--primary);
  306. box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
  307. outline: none;
  308. }
  309. .form-select {
  310. width: 100%;
  311. padding: 6px 24px 6px 10px;
  312. border: 1px solid var(--border);
  313. border-radius: 4px;
  314. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23757575' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  315. background-repeat: no-repeat;
  316. background-position: right 8px center;
  317. background-size: 14px;
  318. -webkit-appearance: none;
  319. -moz-appearance: none;
  320. appearance: none;
  321. font-size: 13px;
  322. color: #333;
  323. height: 32px;
  324. line-height: 1.2;
  325. }
  326. .form-select:focus {
  327. border-color: var(--primary);
  328. box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
  329. outline: none;
  330. }
  331. /* 调整搜索区按钮样式 */
  332. .search-card .btn {
  333. height: 32px;
  334. padding: 0 16px;
  335. font-size: 13px;
  336. }
  337. .search-card .btn-icon {
  338. font-size: 14px;
  339. }
  340. /* 调整间距 */
  341. .search-card .grid.gap-4 {
  342. gap: 12px;
  343. }
  344. /* 调整搜索图标大小和位置 */
  345. .search-input + button .iconfont {
  346. font-size: 14px;
  347. }
  348. /* 调整日期输入框样式 */
  349. .search-card input[type="date"] {
  350. height: 32px;
  351. font-size: 13px;
  352. padding: 6px 10px;
  353. }
  354. /* 添加placeholder样式 */
  355. .search-input::placeholder {
  356. color: #999;
  357. font-size: 13px;
  358. }
  359. /* 调整select的placeholder颜色 */
  360. .form-select option:first-child {
  361. color: #999;
  362. }
  363. .table-card {
  364. background-color: #fff;
  365. border-radius: var(--radius);
  366. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  367. overflow: hidden;
  368. position: relative;
  369. }
  370. .table-container {
  371. position: relative;
  372. overflow-x: auto;
  373. scrollbar-width: thin;
  374. scrollbar-color: #cbd5e1 #f1f5f9;
  375. -ms-overflow-style: none;
  376. scroll-behavior: smooth;
  377. }
  378. .table-container::-webkit-scrollbar {
  379. height: 6px;
  380. }
  381. .table-container::-webkit-scrollbar-track {
  382. background: #f1f5f9;
  383. border-radius: 3px;
  384. }
  385. .table-container::-webkit-scrollbar-thumb {
  386. background: #cbd5e1;
  387. border-radius: 3px;
  388. }
  389. .table-container::-webkit-scrollbar-thumb:hover {
  390. background: #94a3b8;
  391. }
  392. .badge {
  393. display: inline-flex;
  394. align-items: center;
  395. padding: 2px 8px;
  396. border-radius: 12px;
  397. font-size: 12px;
  398. font-weight: 500;
  399. line-height: 1.5;
  400. }
  401. .badge-success {
  402. background-color: #dcfce7;
  403. color: #15803d;
  404. }
  405. .badge-warning {
  406. background-color: #fef9c3;
  407. color: #854d0e;
  408. }
  409. .badge-danger {
  410. background-color: #fee2e2;
  411. color: #b91c1c;
  412. }
  413. .badge-icon {
  414. margin-right: 4px;
  415. font-size: 12px;
  416. }
  417. .action-group {
  418. display: flex;
  419. gap: 8px;
  420. flex-wrap: wrap;
  421. padding: 4px 0;
  422. }
  423. .action-group + .action-group {
  424. margin-top: 4px;
  425. padding-top: 4px;
  426. border-top: 1px solid #f0f0f0;
  427. }
  428. .action-btn {
  429. display: inline-flex;
  430. align-items: center;
  431. justify-content: center;
  432. padding: 4px 8px;
  433. font-size: 13px;
  434. line-height: 1;
  435. color: #666;
  436. background: transparent;
  437. border: none;
  438. border-radius: 4px;
  439. cursor: pointer;
  440. transition: all 0.2s;
  441. white-space: nowrap;
  442. text-decoration: none;
  443. -webkit-appearance: none;
  444. -moz-appearance: none;
  445. appearance: none;
  446. }
  447. .action-btn:hover {
  448. color: var(--primary);
  449. background-color: rgba(76, 175, 80, 0.1);
  450. }
  451. .action-btn:focus {
  452. outline: none;
  453. }
  454. .action-btn i {
  455. margin-right: 4px;
  456. font-size: 14px;
  457. }
  458. .action-btn.view:hover {
  459. color: var(--primary);
  460. background-color: rgba(76, 175, 80, 0.1);
  461. }
  462. .action-btn.edit:hover {
  463. color: var(--info);
  464. background-color: rgba(33, 150, 243, 0.1);
  465. }
  466. .action-btn.delete:hover {
  467. color: var(--danger);
  468. background-color: rgba(244, 67, 54, 0.1);
  469. }
  470. /* 确保最后一列的操作按钮容器没有背景 */
  471. tr td:last-child {
  472. background: none !important;
  473. }
  474. .pagination {
  475. display: flex;
  476. align-items: center;
  477. gap: 8px;
  478. margin-top: 20px;
  479. }
  480. .pagination .page-item {
  481. width: 32px;
  482. height: 32px;
  483. display: inline-flex;
  484. align-items: center;
  485. justify-content: center;
  486. border-radius: 4px;
  487. cursor: pointer;
  488. font-size: 14px;
  489. transition: all 0.2s;
  490. }
  491. .pagination .page-item:hover {
  492. background-color: #f5f5f5;
  493. }
  494. .pagination .page-item.active {
  495. background-color: var(--primary);
  496. color: white;
  497. }
  498. .pagination .page-item.disabled {
  499. color: #ccc;
  500. cursor: not-allowed;
  501. }
  502. .count-badge {
  503. display: inline-flex;
  504. align-items: center;
  505. gap: 4px;
  506. font-size: 13px;
  507. color: #475569;
  508. padding: 2px 4px;
  509. }
  510. .count-badge i {
  511. color: #64748b;
  512. font-size: 13px;
  513. }
  514. /* 新增按钮容器样式 */
  515. .add-button-container {
  516. position: relative;
  517. z-index: 9999;
  518. }
  519. /* 新增按钮的特定样式 */
  520. #addFieldBtn {
  521. position: relative;
  522. z-index: 9999 !important;
  523. visibility: visible !important;
  524. opacity: 1 !important;
  525. display: inline-flex !important;
  526. cursor: pointer;
  527. pointer-events: auto !important;
  528. }
  529. /* 防止页面滚动 */
  530. body.modal-open {
  531. overflow: hidden;
  532. }
  533. @media (max-width: 768px) {
  534. .form-grid {
  535. grid-template-columns: 1fr;
  536. }
  537. .modal-dialog {
  538. margin: 10px;
  539. width: auto;
  540. }
  541. }
  542. /* 表格样式优化 */
  543. table {
  544. width: 100%;
  545. border-collapse: separate;
  546. border-spacing: 0;
  547. font-size: 13px;
  548. table-layout: fixed;
  549. background: transparent !important;
  550. }
  551. /* 表格行样式 */
  552. tr {
  553. background: none !important;
  554. }
  555. tr::before,
  556. tr::after {
  557. display: none !important;
  558. content: none !important;
  559. background: none !important;
  560. }
  561. /* 表格单元格基础样式 */
  562. th, td {
  563. white-space: nowrap;
  564. max-width: 200px;
  565. overflow: hidden;
  566. text-overflow: ellipsis;
  567. position: relative;
  568. background: none !important;
  569. border-radius: 0 !important;
  570. -webkit-border-radius: 0 !important;
  571. -moz-border-radius: 0 !important;
  572. }
  573. /* 表头样式 - 确保内容完整显示 */
  574. th {
  575. white-space: nowrap;
  576. position: relative;
  577. overflow: visible;
  578. max-width: none;
  579. text-overflow: clip;
  580. white-space: nowrap;
  581. background-color: #f9fafb !important;
  582. padding: 12px 16px;
  583. text-align: left;
  584. font-weight: 500;
  585. color: #6b7280;
  586. border-bottom: 1px solid #e5e7eb;
  587. position: relative;
  588. overflow: visible;
  589. max-width: none;
  590. text-overflow: clip;
  591. }
  592. /* 普通单元格应用省略号截断 */
  593. td {
  594. white-space: nowrap;
  595. max-width: 200px;
  596. overflow: hidden;
  597. text-overflow: ellipsis;
  598. white-space: nowrap;
  599. max-width: 200px;
  600. overflow: hidden;
  601. text-overflow: ellipsis;
  602. padding: 12px 16px;
  603. border-bottom: 1px solid #e2e8f0;
  604. color: #1e293b;
  605. line-height: 1.4;
  606. vertical-align: middle;
  607. }
  608. /* 确保操作列没有任何装饰 */
  609. td:last-child {
  610. background: none !important;
  611. border-radius: 0 !important;
  612. -webkit-border-radius: 0 !important;
  613. -moz-border-radius: 0 !important;
  614. }
  615. td:last-child::before,
  616. td:last-child::after {
  617. display: none !important;
  618. content: none !important;
  619. background: none !important;
  620. }
  621. /* 操作按钮组容器样式 */
  622. .action-group {
  623. display: flex;
  624. gap: 6px;
  625. flex-wrap: wrap;
  626. justify-content: flex-start;
  627. background: none !important;
  628. position: relative;
  629. border-radius: 0 !important;
  630. -webkit-border-radius: 0 !important;
  631. -moz-border-radius: 0 !important;
  632. }
  633. .action-group::before,
  634. .action-group::after {
  635. display: none !important;
  636. content: none !important;
  637. background: none !important;
  638. }
  639. /* 操作按钮样式 */
  640. .action-btn {
  641. padding: 4px 8px;
  642. background: none !important;
  643. color: #64748b;
  644. cursor: pointer !important;
  645. transition: all 0.2s;
  646. display: inline-flex;
  647. align-items: center;
  648. border: none !important;
  649. font-size: 12px;
  650. line-height: 1;
  651. position: relative;
  652. outline: none !important;
  653. box-shadow: none !important;
  654. -webkit-appearance: none !important;
  655. -moz-appearance: none !important;
  656. appearance: none !important;
  657. border-radius: 4px !important;
  658. -webkit-border-radius: 4px !important;
  659. -moz-border-radius: 4px !important;
  660. text-decoration: none !important;
  661. }
  662. .action-btn::before,
  663. .action-btn::after {
  664. display: none !important;
  665. content: none !important;
  666. background: none !important;
  667. }
  668. /* 鼠标悬停效果 */
  669. .action-btn:hover {
  670. color: var(--primary);
  671. background-color: rgba(241, 245, 249, 0.9) !important;
  672. }
  673. .action-btn.edit:hover {
  674. color: #0284c7;
  675. background-color: rgba(240, 249, 255, 0.9) !important;
  676. }
  677. .action-btn.delete:hover {
  678. color: #dc2626;
  679. background-color: rgba(254, 242, 242, 0.9) !important;
  680. }
  681. /* 按钮图标样式 */
  682. .action-btn i {
  683. margin-right: 4px;
  684. font-size: 14px;
  685. display: inline-flex;
  686. align-items: center;
  687. justify-content: center;
  688. background: none !important;
  689. }
  690. /* 移除所有可能的装饰性样式 */
  691. .action-btn,
  692. .action-btn:focus,
  693. .action-btn:hover,
  694. .action-btn:active,
  695. .action-group,
  696. td,
  697. tr,
  698. th {
  699. white-space: nowrap;
  700. position: relative;
  701. overflow: visible;
  702. max-width: none;
  703. text-overflow: clip;
  704. white-space: nowrap;
  705. position: relative;
  706. text-decoration: none !important;
  707. -webkit-appearance: none !important;
  708. -moz-appearance: none !important;
  709. appearance: none !important;
  710. }
  711. /* 确保表格行交替背景色正确 */
  712. tbody tr:hover {
  713. tr:hover td:last-child {
  714. background-color: #f9fafb;
  715. }
  716. /* 固定最后一列(操作列)样式 */
  717. .table-fixed-right {
  718. position: relative;
  719. }
  720. .table-fixed-right th:last-child,
  721. .table-fixed-right td:last-child {
  722. position: sticky;
  723. right: 0;
  724. z-index: 2;
  725. background-color: white;
  726. box-shadow: -5px 0 5px -5px rgba(0, 0, 0, 0.1);
  727. }
  728. .table-fixed-right th:last-child {
  729. background-color: #f9fafb;
  730. }
  731. /* 表格滚动控件 */
  732. .table-scroll-controls {
  733. display: none;
  734. position: absolute;
  735. top: 50%;
  736. transform: translateY(-50%);
  737. width: 100%;
  738. pointer-events: none;
  739. z-index: 3;
  740. }
  741. .table-scroll-btn {
  742. position: absolute;
  743. width: 32px;
  744. height: 32px;
  745. border-radius: 50%;
  746. background-color: rgba(255, 255, 255, 0.9);
  747. color: #4CAF50;
  748. border: 1px solid #e0e0e0;
  749. display: flex;
  750. align-items: center;
  751. justify-content: center;
  752. cursor: pointer;
  753. pointer-events: auto;
  754. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  755. z-index: 4;
  756. }
  757. .table-scroll-left {
  758. left: 10px;
  759. }
  760. .table-scroll-right {
  761. right: 10px;
  762. }
  763. .has-overflow .table-scroll-controls {
  764. display: block;
  765. }
  766. tbody tr:hover {
  767. background-color: #f8fafc !important;
  768. }
  769. tbody tr:hover td {
  770. white-space: nowrap;
  771. max-width: 200px;
  772. overflow: hidden;
  773. text-overflow: ellipsis;
  774. background: none !important;
  775. }
  776. /* 移除所有可能的轮廓和装饰 */
  777. *:focus {
  778. outline: none !important;
  779. }
  780. /* 确保按钮组之间的间距正确 */
  781. .action-group + .action-group {
  782. margin-top: 4px;
  783. border-top: none !important;
  784. background: none !important;
  785. }
  786. /* 移除滚动按钮相关样式 */
  787. #scrollLeftBtn,
  788. #scrollRightBtn {
  789. display: none !important;
  790. }
  791. .w-8,
  792. .h-8,
  793. .shadow-md {
  794. display: none !important;
  795. }
  796. /* 表格容器相关样式 */
  797. .table-container-wrapper {
  798. position: relative;
  799. padding: 0 40px;
  800. }
  801. .scroll-button {
  802. position: absolute;
  803. top: 50%;
  804. transform: translateY(-50%);
  805. width: 32px;
  806. height: 32px;
  807. background: #fff;
  808. border: 1px solid #e5e7eb;
  809. border-radius: 50%;
  810. display: flex;
  811. align-items: center;
  812. justify-content: center;
  813. cursor: pointer;
  814. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  815. z-index: 10;
  816. transition: all 0.2s;
  817. }
  818. .scroll-button:hover {
  819. background: #f9fafb;
  820. border-color: #d1d5db;
  821. }
  822. .scroll-button:disabled {
  823. opacity: 0.5;
  824. cursor: not-allowed;
  825. }
  826. .scroll-button.left {
  827. left: 4px;
  828. }
  829. .scroll-button.right {
  830. right: 4px;
  831. }
  832. .scroll-button i {
  833. font-size: 16px;
  834. color: #6b7280;
  835. }
  836. /* 确保操作按钮在一行 */
  837. .action-group {
  838. display: flex;
  839. gap: 8px;
  840. flex-wrap: nowrap;
  841. white-space: nowrap;
  842. }
  843. /* 调整表格滚动容器 */
  844. .table-container {
  845. position: relative;
  846. overflow-x: auto;
  847. scrollbar-width: thin;
  848. scrollbar-color: #cbd5e1 #f1f5f9;
  849. -ms-overflow-style: none;
  850. scroll-behavior: smooth;
  851. }
  852. .table-container::-webkit-scrollbar {
  853. height: 6px;
  854. }
  855. .table-container::-webkit-scrollbar-track {
  856. background: #f1f5f9;
  857. border-radius: 3px;
  858. }
  859. .table-container::-webkit-scrollbar-thumb {
  860. background: #cbd5e1;
  861. border-radius: 3px;
  862. }
  863. .table-container::-webkit-scrollbar-thumb:hover {
  864. background: #94a3b8;
  865. }
  866. /* 调整表格最后一列宽度 */
  867. table th:last-child,
  868. table td:last-child {
  869. min-width: 200px;
  870. width: 200px;
  871. }
  872. </style>
  873. </head>
  874. <body>
  875. <div class="page-container">
  876. <!-- 页面标题和操作按钮 -->
  877. <div class="page-header">
  878. <div class="flex items-center">
  879. <h1 class="page-title">地块管理</h1>
  880. </div>
  881. <div class="add-button-container">
  882. <button type="button"
  883. class="btn btn-primary"
  884. id="addFieldBtn">
  885. <i class="iconfont icon-plus btn-icon"></i>新增地块
  886. </button>
  887. </div>
  888. </div>
  889. <!-- 搜索和筛选区域 -->
  890. <div class="search-card">
  891. <div class="grid grid-cols-1 gap-4">
  892. <div class="grid grid-cols-1 md:grid-cols-4 lg:grid-cols-6 gap-4">
  893. <!-- 搜索框 -->
  894. <div class="md:col-span-2 lg:col-span-2">
  895. <div class="relative">
  896. <input type="text" class="search-input" placeholder="请输入地块编号、名称、位置关键词">
  897. <button class="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 focus:outline-none">
  898. <i class="iconfont icon-search"></i>
  899. </button>
  900. </div>
  901. </div>
  902. <!-- 筛选项第一行 -->
  903. <div class="md:col-span-1 lg:col-span-1">
  904. <select class="form-select">
  905. <option value="">所属农场</option>
  906. <option value="1">智慧农场一号</option>
  907. <option value="2">智慧农场二号</option>
  908. <option value="3">智慧农场三号</option>
  909. <option value="4">有机蔬菜基地</option>
  910. <option value="5">生态果园基地</option>
  911. </select>
  912. </div>
  913. <div class="md:col-span-1 lg:col-span-1">
  914. <select class="form-select">
  915. <option value="">所属区域</option>
  916. <option value="1">东区</option>
  917. <option value="2">西区</option>
  918. <option value="3">南区</option>
  919. <option value="4">北区</option>
  920. </select>
  921. </div>
  922. <div class="md:col-span-1 lg:col-span-1">
  923. <select class="form-select">
  924. <option value="">使用状态</option>
  925. <option value="1">使用中</option>
  926. <option value="2">维护中</option>
  927. <option value="0">未使用</option>
  928. </select>
  929. </div>
  930. <div class="md:col-span-1 lg:col-span-1">
  931. <select class="form-select">
  932. <option value="">土壤类型</option>
  933. <option value="1">黏土</option>
  934. <option value="2">沙质土</option>
  935. <option value="3">壤土</option>
  936. <option value="4">沙壤土</option>
  937. <option value="5">其他</option>
  938. </select>
  939. </div>
  940. </div>
  941. <!-- 筛选项第二行 -->
  942. <div class="grid grid-cols-1 md:grid-cols-4 lg:grid-cols-6 gap-4">
  943. <div class="md:col-span-1 lg:col-span-1">
  944. <select class="form-select">
  945. <option value="">灌溉方式</option>
  946. <option value="1">喷灌</option>
  947. <option value="2">滴灌</option>
  948. <option value="3">微喷灌</option>
  949. <option value="4">漫灌</option>
  950. <option value="5">其他</option>
  951. </select>
  952. </div>
  953. <div class="md:col-span-1 lg:col-span-1">
  954. <select class="form-select">
  955. <option value="">种植作物</option>
  956. <optgroup label="粮食作物">
  957. <option value="101">水稻</option>
  958. <option value="102">小麦</option>
  959. <option value="103">玉米</option>
  960. <option value="104">大豆</option>
  961. <option value="105">高粱</option>
  962. <option value="106">谷子</option>
  963. </optgroup>
  964. <optgroup label="经济作物">
  965. <option value="201">棉花</option>
  966. <option value="202">油菜</option>
  967. <option value="203">花生</option>
  968. <option value="204">芝麻</option>
  969. <option value="205">甘蔗</option>
  970. <option value="206">烟草</option>
  971. <option value="207">茶叶</option>
  972. <option value="208">药材</option>
  973. </optgroup>
  974. <optgroup label="果树作物">
  975. <option value="301">葡萄</option>
  976. <option value="302">苹果</option>
  977. <option value="303">梨</option>
  978. <option value="304">桃</option>
  979. <option value="305">柑橘</option>
  980. <option value="306">枣</option>
  981. <option value="307">猕猴桃</option>
  982. <option value="308">石榴</option>
  983. <option value="309">杏</option>
  984. </optgroup>
  985. <optgroup label="蔬菜作物">
  986. <option value="401">叶菜类</option>
  987. <option value="402">根茎类</option>
  988. <option value="403">瓜果类</option>
  989. <option value="404">豆类</option>
  990. <option value="405">茄果类</option>
  991. <option value="406">葱蒜类</option>
  992. </optgroup>
  993. <optgroup label="其他作物">
  994. <option value="901">饲料作物</option>
  995. <option value="902">观赏作物</option>
  996. <option value="903">食用菌</option>
  997. <option value="999">其他</option>
  998. </optgroup>
  999. </select>
  1000. </div>
  1001. <div class="md:col-span-1 lg:col-span-1">
  1002. <div class="relative">
  1003. <input type="text" class="search-input" placeholder="负责人">
  1004. </div>
  1005. </div>
  1006. <div class="md:col-span-1 lg:col-span-1">
  1007. <div class="relative">
  1008. <input type="date" class="search-input" placeholder="创建日期">
  1009. </div>
  1010. </div>
  1011. <div class="md:col-span-2 lg:col-span-2 flex justify-end items-center gap-2">
  1012. <button class="btn btn-primary">
  1013. <i class="iconfont icon-search btn-icon"></i>查询
  1014. </button>
  1015. <button class="btn btn-outline">
  1016. <i class="iconfont icon-refresh btn-icon"></i>重置
  1017. </button>
  1018. </div>
  1019. </div>
  1020. </div>
  1021. </div>
  1022. <!-- 表格列表 -->
  1023. <div class="table-card">
  1024. <div class="relative table-container-wrapper">
  1025. <!-- 左滑动按钮 -->
  1026. <button type="button" class="scroll-button left" id="scrollLeftBtn" disabled>
  1027. <i class="iconfont icon-left"></i>
  1028. </button>
  1029. <!-- 右滑动按钮 -->
  1030. <button type="button" class="scroll-button right" id="scrollRightBtn">
  1031. <i class="iconfont icon-right"></i>
  1032. </button>
  1033. <!-- 表格容器 -->
  1034. <div class="table-container" id="tableContainer">
  1035. <table>
  1036. <thead>
  1037. <tr>
  1038. <th class="min-w-[120px]">地块编号</th>
  1039. <th class="min-w-[120px]">地块名称</th>
  1040. <th class="min-w-[120px]">所属农场</th>
  1041. <th class="min-w-[100px]">所属区域</th>
  1042. <th class="min-w-[100px]">地块类型</th>
  1043. <th class="min-w-[90px]">面积(亩)</th>
  1044. <th class="min-w-[120px]">种植作物</th>
  1045. <th class="min-w-[100px]">土壤类型</th>
  1046. <th class="min-w-[100px]">灌溉方式</th>
  1047. <th class="min-w-[100px]">使用状态</th>
  1048. <th class="min-w-[100px]">绑定设备</th>
  1049. <th class="min-w-[100px]">绑定人员</th>
  1050. <th class="min-w-[100px]">负责人</th>
  1051. <th class="min-w-[120px]">创建时间</th>
  1052. <th class="min-w-[120px]">上次更新</th>
  1053. <th class="min-w-[180px]">操作</th>
  1054. </tr>
  1055. </thead>
  1056. <tbody>
  1057. <tr>
  1058. <td>FK20230001</td>
  1059. <td>东区水稻田A</td>
  1060. <td>智慧农场一号</td>
  1061. <td>东区</td>
  1062. <td>水田</td>
  1063. <td>120</td>
  1064. <td>水稻</td>
  1065. <td>黏土</td>
  1066. <td>喷灌</td>
  1067. <td>
  1068. <span class="badge badge-success">
  1069. <i class="iconfont icon-check-circle badge-icon"></i>使用中
  1070. </span>
  1071. </td>
  1072. <td>
  1073. <span class="count-badge">
  1074. <i class="iconfont icon-device"></i>3
  1075. </span>
  1076. </td>
  1077. <td>
  1078. <span class="count-badge">
  1079. <i class="iconfont icon-user"></i>2
  1080. </span>
  1081. </td>
  1082. <td>张三</td>
  1083. <td>2023-05-15</td>
  1084. <td>2023-06-20</td>
  1085. <td>
  1086. <div class="action-group">
  1087. <button type="button" class="action-btn view" title="地块管理" data-id="FK20230001">
  1088. <i class="iconfont icon-eye"></i>管理
  1089. </button>
  1090. <button type="button" class="action-btn edit" title="编辑地块" data-id="FK20230001">
  1091. <i class="iconfont icon-edit"></i>编辑
  1092. </button>
  1093. <button type="button" class="action-btn delete" title="删除地块" data-id="FK20230001">
  1094. <i class="iconfont icon-delete"></i>删除
  1095. </button>
  1096. </div>
  1097. </td>
  1098. </tr>
  1099. <tr>
  1100. <td>FK20230002</td>
  1101. <td>西区蔬菜园B</td>
  1102. <td>有机蔬菜基地</td>
  1103. <td>西区</td>
  1104. <td>菜地</td>
  1105. <td>85</td>
  1106. <td>青菜、萝卜</td>
  1107. <td>沙质土</td>
  1108. <td>滴灌</td>
  1109. <td>
  1110. <span class="badge badge-success">
  1111. <i class="iconfont icon-check-circle badge-icon"></i>使用中
  1112. </span>
  1113. </td>
  1114. <td>
  1115. <span class="count-badge">
  1116. <i class="iconfont icon-device"></i>2
  1117. </span>
  1118. </td>
  1119. <td>
  1120. <span class="count-badge">
  1121. <i class="iconfont icon-user"></i>1
  1122. </span>
  1123. </td>
  1124. <td>李四</td>
  1125. <td>2023-05-18</td>
  1126. <td>2023-06-25</td>
  1127. <td>
  1128. <div class="action-group">
  1129. <button type="button" class="action-btn view" title="地块管理" data-id="FK20230002">
  1130. <i class="iconfont icon-eye"></i>管理
  1131. </button>
  1132. <button type="button" class="action-btn edit" title="编辑地块" data-id="FK20230002">
  1133. <i class="iconfont icon-edit"></i>编辑
  1134. </button>
  1135. <button type="button" class="action-btn delete" title="删除地块" data-id="FK20230002">
  1136. <i class="iconfont icon-delete"></i>删除
  1137. </button>
  1138. </div>
  1139. </td>
  1140. </tr>
  1141. <tr>
  1142. <td>FK20230003</td>
  1143. <td>南区果园C</td>
  1144. <td>生态果园基地</td>
  1145. <td>南区</td>
  1146. <td>果园</td>
  1147. <td>200</td>
  1148. <td>苹果</td>
  1149. <td>壤土</td>
  1150. <td>微喷灌</td>
  1151. <td>
  1152. <span class="badge badge-warning">
  1153. <i class="iconfont icon-warning badge-icon"></i>维护中
  1154. </span>
  1155. </td>
  1156. <td>
  1157. <span class="count-badge">
  1158. <i class="iconfont icon-device"></i>5
  1159. </span>
  1160. </td>
  1161. <td>
  1162. <span class="count-badge">
  1163. <i class="iconfont icon-user"></i>3
  1164. </span>
  1165. </td>
  1166. <td>王五</td>
  1167. <td>2023-05-20</td>
  1168. <td>2023-07-05</td>
  1169. <td>
  1170. <div class="action-group">
  1171. <button type="button" class="action-btn view" title="地块管理" data-id="FK20230003">
  1172. <i class="iconfont icon-eye"></i>管理
  1173. </button>
  1174. <button type="button" class="action-btn edit" title="编辑地块" data-id="FK20230003">
  1175. <i class="iconfont icon-edit"></i>编辑
  1176. </button>
  1177. <button type="button" class="action-btn delete" title="删除地块" data-id="FK20230003">
  1178. <i class="iconfont icon-delete"></i>删除
  1179. </button>
  1180. </div>
  1181. </td>
  1182. </tr>
  1183. <tr>
  1184. <td>FK20230004</td>
  1185. <td>北区小麦田D</td>
  1186. <td>智慧农场二号</td>
  1187. <td>北区</td>
  1188. <td>旱地</td>
  1189. <td>160</td>
  1190. <td>小麦</td>
  1191. <td>沙壤土</td>
  1192. <td>漫灌</td>
  1193. <td>
  1194. <span class="badge badge-danger">
  1195. <i class="iconfont icon-close-circle badge-icon"></i>未使用
  1196. </span>
  1197. </td>
  1198. <td>
  1199. <span class="count-badge">
  1200. <i class="iconfont icon-device"></i>0
  1201. </span>
  1202. </td>
  1203. <td>
  1204. <span class="count-badge">
  1205. <i class="iconfont icon-user"></i>0
  1206. </span>
  1207. </td>
  1208. <td>赵六</td>
  1209. <td>2023-06-10</td>
  1210. <td>2023-07-15</td>
  1211. <td>
  1212. <div class="action-group">
  1213. <button type="button" class="action-btn view" title="地块管理" data-id="FK20230004">
  1214. <i class="iconfont icon-eye"></i>管理
  1215. </button>
  1216. <button type="button" class="action-btn edit" title="编辑地块" data-id="FK20230004">
  1217. <i class="iconfont icon-edit"></i>编辑
  1218. </button>
  1219. <button type="button" class="action-btn delete" title="删除地块" data-id="FK20230004">
  1220. <i class="iconfont icon-delete"></i>删除
  1221. </button>
  1222. </div>
  1223. </td>
  1224. </tr>
  1225. </tbody>
  1226. </table>
  1227. </div>
  1228. </div>
  1229. <!-- 分页 -->
  1230. <div class="flex justify-between items-center px-6 py-4">
  1231. <div class="text-sm text-gray-600">
  1232. 共 <span class="text-primary font-medium">24</span> 条记录
  1233. </div>
  1234. <div class="pagination">
  1235. <div class="page-item disabled">
  1236. <i class="iconfont icon-left"></i>
  1237. </div>
  1238. <div class="page-item active">1</div>
  1239. <div class="page-item">2</div>
  1240. <div class="page-item">3</div>
  1241. <div class="page-item">
  1242. <i class="iconfont icon-right"></i>
  1243. </div>
  1244. </div>
  1245. </div>
  1246. </div>
  1247. </div>
  1248. <!-- 新增/编辑地块模态框 -->
  1249. <div id="fieldModal" class="modal hidden">
  1250. <div class="modal-backdrop"></div>
  1251. <div class="modal-dialog">
  1252. <div class="modal-content">
  1253. <!-- 模态框头部 -->
  1254. <div class="modal-header">
  1255. <h3 class="modal-title">新增地块</h3>
  1256. <button type="button" class="modal-close" id="closeModal">
  1257. <i class="iconfont icon-close"></i>
  1258. </button>
  1259. </div>
  1260. <!-- 模态框内容 -->
  1261. <div class="modal-body">
  1262. <form id="fieldForm">
  1263. <div class="form-grid">
  1264. <div class="form-group">
  1265. <label class="form-label">地块名称<span class="required">*</span></label>
  1266. <input type="text" name="fieldName" class="form-input" required>
  1267. </div>
  1268. <div class="form-group">
  1269. <label class="form-label">地块编号</label>
  1270. <input type="text" name="fieldCode" class="form-input" placeholder="自动生成" disabled>
  1271. </div>
  1272. <div class="form-group">
  1273. <label class="form-label">所属农场<span class="required">*</span></label>
  1274. <select name="farmId" class="form-input" required>
  1275. <option value="">请选择农场</option>
  1276. <option value="1">智慧农场一号</option>
  1277. <option value="2">智慧农场二号</option>
  1278. <option value="3">智慧农场三号</option>
  1279. <option value="4">有机蔬菜基地</option>
  1280. <option value="5">生态果园基地</option>
  1281. </select>
  1282. </div>
  1283. <div class="form-group">
  1284. <label class="form-label">所属区域<span class="required">*</span></label>
  1285. <select name="fieldArea" class="form-input" required>
  1286. <option value="">请选择区域</option>
  1287. <option value="1">东区</option>
  1288. <option value="2">西区</option>
  1289. <option value="3">南区</option>
  1290. <option value="4">北区</option>
  1291. </select>
  1292. </div>
  1293. <div class="form-group">
  1294. <label class="form-label">地块类型<span class="required">*</span></label>
  1295. <select name="fieldType" class="form-input" required>
  1296. <option value="">请选择类型</option>
  1297. <option value="1">水田</option>
  1298. <option value="2">旱地</option>
  1299. <option value="3">果园</option>
  1300. <option value="4">菜地</option>
  1301. <option value="5">其他</option>
  1302. </select>
  1303. </div>
  1304. <div class="form-group">
  1305. <label class="form-label">面积(亩)<span class="required">*</span></label>
  1306. <input type="number" name="fieldSize" class="form-input" required>
  1307. </div>
  1308. <div class="form-group">
  1309. <label class="form-label">负责人</label>
  1310. <select name="manager" class="form-input">
  1311. <option value="">请选择负责人</option>
  1312. <option value="1">张三</option>
  1313. <option value="2">李四</option>
  1314. <option value="3">王五</option>
  1315. <option value="4">赵六</option>
  1316. </select>
  1317. </div>
  1318. <div class="form-group">
  1319. <label class="form-label">种植作物</label>
  1320. <select name="crops" class="form-input">
  1321. <option value="">请选择作物</option>
  1322. <optgroup label="粮食作物">
  1323. <option value="101">水稻</option>
  1324. <option value="102">小麦</option>
  1325. <option value="103">玉米</option>
  1326. <option value="104">大豆</option>
  1327. <option value="105">高粱</option>
  1328. <option value="106">谷子</option>
  1329. </optgroup>
  1330. <optgroup label="经济作物">
  1331. <option value="201">棉花</option>
  1332. <option value="202">油菜</option>
  1333. <option value="203">花生</option>
  1334. <option value="204">芝麻</option>
  1335. <option value="205">甘蔗</option>
  1336. <option value="206">烟草</option>
  1337. <option value="207">茶叶</option>
  1338. <option value="208">药材</option>
  1339. </optgroup>
  1340. <optgroup label="果树作物">
  1341. <option value="301">葡萄</option>
  1342. <option value="302">苹果</option>
  1343. <option value="303">梨</option>
  1344. <option value="304">桃</option>
  1345. <option value="305">柑橘</option>
  1346. <option value="306">枣</option>
  1347. <option value="307">猕猴桃</option>
  1348. <option value="308">石榴</option>
  1349. <option value="309">杏</option>
  1350. </optgroup>
  1351. <optgroup label="蔬菜作物">
  1352. <option value="401">叶菜类</option>
  1353. <option value="402">根茎类</option>
  1354. <option value="403">瓜果类</option>
  1355. <option value="404">豆类</option>
  1356. <option value="405">茄果类</option>
  1357. <option value="406">葱蒜类</option>
  1358. </optgroup>
  1359. <optgroup label="其他作物">
  1360. <option value="901">饲料作物</option>
  1361. <option value="902">观赏作物</option>
  1362. <option value="903">食用菌</option>
  1363. <option value="999">其他</option>
  1364. </optgroup>
  1365. </select>
  1366. </div>
  1367. <div class="form-group">
  1368. <label class="form-label">土壤类型</label>
  1369. <select name="soilType" class="form-input">
  1370. <option value="">请选择</option>
  1371. <option value="1">黏土</option>
  1372. <option value="2">沙质土</option>
  1373. <option value="3">壤土</option>
  1374. <option value="4">沙壤土</option>
  1375. <option value="5">其他</option>
  1376. </select>
  1377. </div>
  1378. <div class="form-group">
  1379. <label class="form-label">灌溉方式</label>
  1380. <select name="irrigationType" class="form-input">
  1381. <option value="">请选择</option>
  1382. <option value="1">喷灌</option>
  1383. <option value="2">滴灌</option>
  1384. <option value="3">微喷灌</option>
  1385. <option value="4">漫灌</option>
  1386. <option value="5">其他</option>
  1387. </select>
  1388. </div>
  1389. <div class="form-group">
  1390. <label class="form-label">使用状态</label>
  1391. <select name="status" class="form-input">
  1392. <option value="1">使用中</option>
  1393. <option value="2">维护中</option>
  1394. <option value="0">未使用</option>
  1395. <option value="3">闲置中</option>
  1396. <option value="4">待开发</option>
  1397. </select>
  1398. </div>
  1399. </div>
  1400. <div class="form-group mt-4">
  1401. <label class="form-label">地块描述</label>
  1402. <textarea name="description" class="form-input" rows="4"></textarea>
  1403. </div>
  1404. </form>
  1405. </div>
  1406. <!-- 模态框底部 -->
  1407. <div class="modal-footer">
  1408. <button type="button" class="btn btn-outline" id="cancelBtn">取消</button>
  1409. <button type="button" class="btn btn-primary" id="saveBtn">保存</button>
  1410. </div>
  1411. </div>
  1412. </div>
  1413. </div>
  1414. <script>
  1415. document.addEventListener("DOMContentLoaded", function() {
  1416. // 初始化表格滚动功能
  1417. function initTableScroll() {
  1418. const tableContainer = document.querySelector(".table-container");
  1419. if (!tableContainer) return;
  1420. const scrollLeftBtn = document.querySelector(".table-scroll-left");
  1421. const scrollRightBtn = document.querySelector(".table-scroll-right");
  1422. if (!scrollLeftBtn || !scrollRightBtn) return;
  1423. // 检查表格是否需要水平滚动
  1424. function checkTableOverflow() {
  1425. if (tableContainer.scrollWidth > tableContainer.clientWidth) {
  1426. tableContainer.classList.add("has-overflow");
  1427. } else {
  1428. tableContainer.classList.remove("has-overflow");
  1429. }
  1430. }
  1431. // 左右滚动按钮点击事件
  1432. scrollLeftBtn.addEventListener("click", function() {
  1433. tableContainer.scrollLeft -= 150;
  1434. });
  1435. scrollRightBtn.addEventListener("click", function() {
  1436. tableContainer.scrollLeft += 150;
  1437. });
  1438. // 初始检查和窗口大小变化时检查
  1439. checkTableOverflow();
  1440. window.addEventListener("resize", checkTableOverflow);
  1441. // 滚动事件处理
  1442. tableContainer.addEventListener("scroll", function() {
  1443. // 根据滚动位置显示/隐藏滚动按钮
  1444. if (tableContainer.scrollLeft <= 10) {
  1445. scrollLeftBtn.style.opacity = "0.5";
  1446. } else {
  1447. scrollLeftBtn.style.opacity = "1";
  1448. }
  1449. if (tableContainer.scrollLeft >= tableContainer.scrollWidth - tableContainer.clientWidth - 10) {
  1450. scrollRightBtn.style.opacity = "0.5";
  1451. } else {
  1452. scrollRightBtn.style.opacity = "1";
  1453. }
  1454. });
  1455. // 初始触发滚动事件,设置初始按钮状态
  1456. tableContainer.dispatchEvent(new Event("scroll"));
  1457. }
  1458. // 初始化表格滚动
  1459. initTableScroll(); // 页面跳转函数
  1460. function navigateTo(type, id) {
  1461. switch(type) {
  1462. case 'view':
  1463. window.location.href = `../pages/field-detail.html?id=${id}`;
  1464. break;
  1465. case 'edit':
  1466. window.location.href = `../pages/field-edit.html?id=${id}`;
  1467. break;
  1468. }
  1469. }
  1470. // 全局函数,用于显示模态框
  1471. function showModalDialog(event, type = 'add', rowData = null) {
  1472. console.log('showModalDialog called', {type, rowData});
  1473. try {
  1474. if (event) {
  1475. event.preventDefault();
  1476. event.stopPropagation();
  1477. }
  1478. const modal = document.getElementById('fieldModal');
  1479. if (!modal) {
  1480. console.error('Modal not found');
  1481. return;
  1482. }
  1483. // 设置模态框标题
  1484. const modalTitle = modal.querySelector('.modal-title');
  1485. if (modalTitle) {
  1486. modalTitle.textContent = type === 'edit' ? '编辑地块' : '新增地块';
  1487. }
  1488. // 如果是编辑模式,预填充表单数据
  1489. if (type === 'edit') {
  1490. // 这里使用模拟数据,实际项目中应该从后端获取
  1491. const mockFieldData = {
  1492. fieldName: '西区蔬菜园B',
  1493. fieldCode: 'FK20230002',
  1494. farmId: '4', // 有机蔬菜基地
  1495. fieldArea: '2', // 西区
  1496. fieldType: '4', // 菜地
  1497. fieldSize: '85',
  1498. manager: '2', // 李四
  1499. crops: '401', // 叶菜类
  1500. soilType: '2', // 沙质土
  1501. irrigationType: '2', // 滴灌
  1502. status: '1', // 使用中
  1503. description: '这是一个示例地块描述。'
  1504. };
  1505. const form = document.getElementById('fieldForm');
  1506. if (form) {
  1507. Object.keys(mockFieldData).forEach(key => {
  1508. const input = form.elements[key];
  1509. if (input) {
  1510. input.value = mockFieldData[key];
  1511. }
  1512. });
  1513. }
  1514. }
  1515. // 显示模态框
  1516. modal.style.cssText = 'display: block !important; opacity: 1 !important; visibility: visible !important;';
  1517. modal.classList.remove('hidden');
  1518. modal.classList.add('show');
  1519. document.body.classList.add('modal-open');
  1520. } catch (error) {
  1521. console.error('Error in showModalDialog:', error);
  1522. }
  1523. }
  1524. document.addEventListener('DOMContentLoaded', function() {
  1525. console.log('DOM Content Loaded');
  1526. // 添加按钮点击事件
  1527. const addButton = document.getElementById('addFieldBtn');
  1528. if (addButton) {
  1529. addButton.addEventListener('click', e => showModalDialog(e, 'add'));
  1530. }
  1531. // 为所有操作按钮添加事件监听
  1532. document.querySelectorAll('.action-btn').forEach(btn => {
  1533. btn.addEventListener('click', function(e) {
  1534. e.preventDefault();
  1535. e.stopPropagation();
  1536. let type = 'add';
  1537. if (this.classList.contains('view')) {
  1538. type = 'view';
  1539. navigateTo(type, this.getAttribute('data-id'));
  1540. } else if (this.classList.contains('edit')) {
  1541. type = 'edit';
  1542. showModalDialog(e, type, {id: this.getAttribute('data-id')});
  1543. } else if (this.classList.contains('delete')) {
  1544. if (confirm('确认要删除该地块吗?')) {
  1545. console.log('删除地块:', this.getAttribute('data-id'));
  1546. // 这里添加删除逻辑
  1547. }
  1548. }
  1549. });
  1550. });
  1551. // 模态框关闭逻辑
  1552. const modal = document.getElementById('fieldModal');
  1553. const closeBtn = document.getElementById('closeModal');
  1554. const cancelBtn = document.getElementById('cancelBtn');
  1555. const form = document.getElementById('fieldForm');
  1556. function hideModal(e) {
  1557. if (e) {
  1558. e.preventDefault();
  1559. e.stopPropagation();
  1560. }
  1561. if (!modal) return;
  1562. // 强制隐藏模态框
  1563. modal.style.cssText = 'display: none !important; opacity: 0 !important; visibility: hidden !important;';
  1564. modal.classList.remove('show');
  1565. modal.classList.add('hidden');
  1566. document.body.classList.remove('modal-open');
  1567. // 重置表单
  1568. if (form) {
  1569. form.reset();
  1570. const inputs = form.querySelectorAll('input, select, textarea');
  1571. inputs.forEach(input => {
  1572. input.disabled = false;
  1573. input.style.borderColor = '#ddd';
  1574. });
  1575. }
  1576. }
  1577. // 关闭按钮事件
  1578. if (closeBtn) {
  1579. closeBtn.onclick = hideModal;
  1580. }
  1581. // 取消按钮事件
  1582. if (cancelBtn) {
  1583. cancelBtn.onclick = hideModal;
  1584. }
  1585. // 点击背景关闭
  1586. if (modal) {
  1587. modal.onclick = function(e) {
  1588. if (e.target === modal || e.target.classList.contains('modal-backdrop')) {
  1589. hideModal(e);
  1590. }
  1591. };
  1592. }
  1593. // 保存按钮点击事件
  1594. const saveBtn = document.getElementById('saveBtn');
  1595. if (saveBtn) {
  1596. saveBtn.onclick = function(e) {
  1597. e.preventDefault();
  1598. e.stopPropagation();
  1599. if (!form) return;
  1600. const requiredFields = form.querySelectorAll('[required]');
  1601. let isValid = true;
  1602. requiredFields.forEach(field => {
  1603. if (!field.value.trim()) {
  1604. field.style.borderColor = '#f44336';
  1605. isValid = false;
  1606. } else {
  1607. field.style.borderColor = '#ddd';
  1608. }
  1609. });
  1610. if (!isValid) {
  1611. alert('请填写必填项');
  1612. return;
  1613. }
  1614. alert('地块信息保存成功');
  1615. hideModal(e);
  1616. };
  1617. }
  1618. // 防止表单提交
  1619. if (form) {
  1620. form.onsubmit = function(e) {
  1621. e.preventDefault();
  1622. return false;
  1623. };
  1624. }
  1625. // 获取滚动相关元素
  1626. const tableContainer = document.getElementById('tableContainer');
  1627. const scrollLeftBtn = document.getElementById('scrollLeftBtn');
  1628. const scrollRightBtn = document.getElementById('scrollRightBtn');
  1629. // 更新滚动按钮状态
  1630. function updateScrollButtons() {
  1631. if (tableContainer) {
  1632. const { scrollLeft, scrollWidth, clientWidth } = tableContainer;
  1633. // 更新左滚动按钮状态
  1634. if (scrollLeftBtn) {
  1635. scrollLeftBtn.disabled = scrollLeft <= 0;
  1636. }
  1637. // 更新右滚动按钮状态
  1638. if (scrollRightBtn) {
  1639. scrollRightBtn.disabled = scrollLeft + clientWidth >= scrollWidth;
  1640. }
  1641. }
  1642. }
  1643. // 初始化滚动按钮状态
  1644. updateScrollButtons();
  1645. // 监听滚动事件
  1646. if (tableContainer) {
  1647. tableContainer.addEventListener('scroll', updateScrollButtons);
  1648. }
  1649. // 左滚动按钮点击事件
  1650. if (scrollLeftBtn) {
  1651. scrollLeftBtn.addEventListener('click', () => {
  1652. if (tableContainer) {
  1653. tableContainer.scrollLeft -= 200; // 每次滚动200px
  1654. }
  1655. });
  1656. }
  1657. // 右滚动按钮点击事件
  1658. if (scrollRightBtn) {
  1659. scrollRightBtn.addEventListener('click', () => {
  1660. if (tableContainer) {
  1661. tableContainer.scrollLeft += 200; // 每次滚动200px
  1662. }
  1663. });
  1664. }
  1665. // 监听窗口大小变化
  1666. window.addEventListener('resize', updateScrollButtons);
  1667. });
  1668. // 添加全局错误处理
  1669. window.onerror = function(msg, url, line, col, error) {
  1670. console.error('Global error:', {msg, url, line, col, error});
  1671. return false;
  1672. };
  1673. </script>
  1674. </body>
  1675. </html>