| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869 |
- <!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(#fieldModal),
- 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;
- }
- .form-grid {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 20px;
- }
- .form-group {
- margin-bottom: 0;
- }
- .form-label {
- display: block;
- margin-bottom: 8px;
- font-size: 14px;
- color: #333;
- }
- .form-input {
- width: 100%;
- padding: 8px 12px;
- border: 1px solid #ddd;
- border-radius: 4px;
- font-size: 14px;
- transition: all 0.3s;
- }
- .form-input:focus {
- border-color: var(--primary);
- box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
- outline: none;
- }
- .required {
- color: #f44336;
- margin-left: 4px;
- }
- /* 确保所有按钮可点击 */
- .action-btn,
- .btn,
- button {
- cursor: pointer !important;
- pointer-events: auto !important;
- position: relative;
- z-index: 1;
- }
- /* 移除可能影响按钮的样式 */
- body > div:not(.page-container):not(.modal):not(#fieldModal) {
- display: none !important;
- }
-
- /* 确保所有操作按钮可见和可交互 */
- .action-btn,
- #addFieldBtn,
- .btn-primary,
- .btn-outline,
- .modal button {
- visibility: visible !important;
- opacity: 1 !important;
- display: inline-flex !important;
- pointer-events: auto !important;
- }
-
- /* 页面容器 */
- .page-container {
- max-width: 100%;
- padding: 24px;
- padding-top: 42px;
- margin: 0;
- box-sizing: border-box;
- position: relative;
- z-index: 1;
- }
-
- /* 页面标题和操作按钮容器 */
- .page-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
- padding-bottom: 16px;
- border-bottom: 1px solid var(--border);
- padding-top: 10px;
- position: relative;
- }
-
- /* 添加新增按钮的特定样式 */
- .add-button-container {
- position: relative;
- z-index: 9999;
- }
-
- #addFieldBtn {
- position: relative;
- z-index: 9999 !important;
- visibility: visible !important;
- opacity: 1 !important;
- display: inline-flex !important;
- cursor: pointer;
- pointer-events: auto !important;
- }
-
- .page-title {
- font-size: 22px;
- font-weight: 600;
- position: relative;
- color: var(--text-primary);
- display: flex;
- align-items: center;
- margin: 0;
- }
-
- .page-title::before {
- content: "";
- width: 4px;
- height: 22px;
- background-color: var(--primary);
- margin-right: 8px;
- border-radius: 2px;
- }
-
- .search-card {
- background-color: #fff;
- border-radius: var(--radius);
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
- padding: 16px;
- margin-bottom: 20px;
- }
-
- .search-input {
- width: 100%;
- border: 1px solid var(--border);
- border-radius: 4px;
- padding: 6px 12px;
- font-size: 13px;
- transition: all 0.3s;
- height: 32px;
- }
-
- .search-input:focus {
- border-color: var(--primary);
- box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
- outline: none;
- }
-
- .form-select {
- width: 100%;
- padding: 6px 24px 6px 10px;
- border: 1px solid var(--border);
- border-radius: 4px;
- 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");
- background-repeat: no-repeat;
- background-position: right 8px center;
- background-size: 14px;
- -webkit-appearance: none;
- -moz-appearance: none;
- appearance: none;
- font-size: 13px;
- color: #333;
- height: 32px;
- line-height: 1.2;
- }
-
- .form-select:focus {
- border-color: var(--primary);
- box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
- outline: none;
- }
- /* 调整搜索区按钮样式 */
- .search-card .btn {
- height: 32px;
- padding: 0 16px;
- font-size: 13px;
- }
- .search-card .btn-icon {
- font-size: 14px;
- }
- /* 调整间距 */
- .search-card .grid.gap-4 {
- gap: 12px;
- }
- /* 调整搜索图标大小和位置 */
- .search-input + button .iconfont {
- font-size: 14px;
- }
- /* 调整日期输入框样式 */
- .search-card input[type="date"] {
- height: 32px;
- font-size: 13px;
- padding: 6px 10px;
- }
- /* 添加placeholder样式 */
- .search-input::placeholder {
- color: #999;
- font-size: 13px;
- }
- /* 调整select的placeholder颜色 */
- .form-select option:first-child {
- color: #999;
- }
-
- .table-card {
- background-color: #fff;
- border-radius: var(--radius);
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
- overflow: hidden;
- position: relative;
- }
-
- .table-container {
- position: relative;
- overflow-x: auto;
- scrollbar-width: thin;
- scrollbar-color: #cbd5e1 #f1f5f9;
- -ms-overflow-style: none;
- scroll-behavior: smooth;
- }
-
- .table-container::-webkit-scrollbar {
- height: 6px;
- }
-
- .table-container::-webkit-scrollbar-track {
- background: #f1f5f9;
- border-radius: 3px;
- }
-
- .table-container::-webkit-scrollbar-thumb {
- background: #cbd5e1;
- border-radius: 3px;
- }
-
- .table-container::-webkit-scrollbar-thumb:hover {
- background: #94a3b8;
- }
-
- .badge {
- display: inline-flex;
- align-items: center;
- padding: 2px 8px;
- border-radius: 12px;
- font-size: 12px;
- font-weight: 500;
- line-height: 1.5;
- }
-
- .badge-success {
- background-color: #dcfce7;
- color: #15803d;
- }
-
- .badge-warning {
- background-color: #fef9c3;
- color: #854d0e;
- }
-
- .badge-danger {
- background-color: #fee2e2;
- color: #b91c1c;
- }
-
- .badge-icon {
- margin-right: 4px;
- font-size: 12px;
- }
-
- .action-group {
- display: flex;
- gap: 8px;
- flex-wrap: wrap;
- padding: 4px 0;
- }
-
- .action-group + .action-group {
- margin-top: 4px;
- padding-top: 4px;
- border-top: 1px solid #f0f0f0;
- }
-
- .action-btn {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- padding: 4px 8px;
- font-size: 13px;
- line-height: 1;
- color: #666;
- background: transparent;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- transition: all 0.2s;
- white-space: nowrap;
- text-decoration: none;
- -webkit-appearance: none;
- -moz-appearance: none;
- appearance: none;
- }
-
- .action-btn:hover {
- color: var(--primary);
- background-color: rgba(76, 175, 80, 0.1);
- }
-
- .action-btn:focus {
- outline: none;
- }
-
- .action-btn i {
- margin-right: 4px;
- font-size: 14px;
- }
-
- .action-btn.view:hover {
- color: var(--primary);
- background-color: rgba(76, 175, 80, 0.1);
- }
-
- .action-btn.edit:hover {
- color: var(--info);
- background-color: rgba(33, 150, 243, 0.1);
- }
-
- .action-btn.delete:hover {
- color: var(--danger);
- background-color: rgba(244, 67, 54, 0.1);
- }
- /* 确保最后一列的操作按钮容器没有背景 */
- tr td:last-child {
- background: none !important;
- }
- .pagination {
- display: flex;
- align-items: center;
- gap: 8px;
- margin-top: 20px;
- }
-
- .pagination .page-item {
- width: 32px;
- height: 32px;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- cursor: pointer;
- font-size: 14px;
- transition: all 0.2s;
- }
-
- .pagination .page-item:hover {
- background-color: #f5f5f5;
- }
-
- .pagination .page-item.active {
- background-color: var(--primary);
- color: white;
- }
-
- .pagination .page-item.disabled {
- color: #ccc;
- cursor: not-allowed;
- }
-
- .count-badge {
- display: inline-flex;
- align-items: center;
- gap: 4px;
- font-size: 13px;
- color: #475569;
- padding: 2px 4px;
- }
-
- .count-badge i {
- color: #64748b;
- font-size: 13px;
- }
-
- /* 新增按钮容器样式 */
- .add-button-container {
- position: relative;
- z-index: 9999;
- }
-
- /* 新增按钮的特定样式 */
- #addFieldBtn {
- position: relative;
- z-index: 9999 !important;
- visibility: visible !important;
- opacity: 1 !important;
- display: inline-flex !important;
- cursor: pointer;
- pointer-events: auto !important;
- }
-
- /* 防止页面滚动 */
- body.modal-open {
- overflow: hidden;
- }
- @media (max-width: 768px) {
- .form-grid {
- grid-template-columns: 1fr;
- }
-
- .modal-dialog {
- margin: 10px;
- width: auto;
- }
- }
- /* 表格样式优化 */
- table {
- width: 100%;
- border-collapse: separate;
- border-spacing: 0;
- font-size: 13px;
- table-layout: fixed;
- background: transparent !important;
- }
-
- /* 表格行样式 */
- tr {
- background: none !important;
- }
- tr::before,
- tr::after {
- display: none !important;
- content: none !important;
- background: none !important;
- }
-
- /* 表格单元格基础样式 */
- th, td {
- white-space: nowrap;
- max-width: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- position: relative;
- background: none !important;
- border-radius: 0 !important;
- -webkit-border-radius: 0 !important;
- -moz-border-radius: 0 !important;
- }
-
- /* 表头样式 - 确保内容完整显示 */
- th {
- white-space: nowrap;
- position: relative;
- overflow: visible;
- max-width: none;
- text-overflow: clip;
- white-space: nowrap;
- background-color: #f9fafb !important;
- padding: 12px 16px;
- text-align: left;
- font-weight: 500;
- color: #6b7280;
- border-bottom: 1px solid #e5e7eb;
- position: relative;
- overflow: visible;
- max-width: none;
- text-overflow: clip;
- }
- /* 普通单元格应用省略号截断 */
- td {
- white-space: nowrap;
- max-width: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- max-width: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- padding: 12px 16px;
- border-bottom: 1px solid #e2e8f0;
- color: #1e293b;
- line-height: 1.4;
- vertical-align: middle;
- }
- /* 确保操作列没有任何装饰 */
- td:last-child {
- background: none !important;
- border-radius: 0 !important;
- -webkit-border-radius: 0 !important;
- -moz-border-radius: 0 !important;
- }
- td:last-child::before,
- td:last-child::after {
- display: none !important;
- content: none !important;
- background: none !important;
- }
- /* 操作按钮组容器样式 */
- .action-group {
- display: flex;
- gap: 6px;
- flex-wrap: wrap;
- justify-content: flex-start;
- background: none !important;
- position: relative;
- border-radius: 0 !important;
- -webkit-border-radius: 0 !important;
- -moz-border-radius: 0 !important;
- }
- .action-group::before,
- .action-group::after {
- display: none !important;
- content: none !important;
- background: none !important;
- }
- /* 操作按钮样式 */
- .action-btn {
- padding: 4px 8px;
- background: none !important;
- color: #64748b;
- cursor: pointer !important;
- transition: all 0.2s;
- display: inline-flex;
- align-items: center;
- border: none !important;
- font-size: 12px;
- line-height: 1;
- position: relative;
- outline: none !important;
- box-shadow: none !important;
- -webkit-appearance: none !important;
- -moz-appearance: none !important;
- appearance: none !important;
- border-radius: 4px !important;
- -webkit-border-radius: 4px !important;
- -moz-border-radius: 4px !important;
- text-decoration: none !important;
- }
- .action-btn::before,
- .action-btn::after {
- display: none !important;
- content: none !important;
- background: none !important;
- }
- /* 鼠标悬停效果 */
- .action-btn:hover {
- color: var(--primary);
- background-color: rgba(241, 245, 249, 0.9) !important;
- }
- .action-btn.edit:hover {
- color: #0284c7;
- background-color: rgba(240, 249, 255, 0.9) !important;
- }
- .action-btn.delete:hover {
- color: #dc2626;
- background-color: rgba(254, 242, 242, 0.9) !important;
- }
- /* 按钮图标样式 */
- .action-btn i {
- margin-right: 4px;
- font-size: 14px;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- background: none !important;
- }
- /* 移除所有可能的装饰性样式 */
- .action-btn,
- .action-btn:focus,
- .action-btn:hover,
- .action-btn:active,
- .action-group,
- td,
- tr,
- th {
- white-space: nowrap;
- position: relative;
- overflow: visible;
- max-width: none;
- text-overflow: clip;
- white-space: nowrap;
- position: relative;
- text-decoration: none !important;
- -webkit-appearance: none !important;
- -moz-appearance: none !important;
- appearance: none !important;
- }
- /* 确保表格行交替背景色正确 */
- tbody tr:hover {
-
- tr:hover td:last-child {
- background-color: #f9fafb;
- }
-
- /* 固定最后一列(操作列)样式 */
- .table-fixed-right {
- position: relative;
- }
-
- .table-fixed-right th:last-child,
- .table-fixed-right td:last-child {
- position: sticky;
- right: 0;
- z-index: 2;
- background-color: white;
- box-shadow: -5px 0 5px -5px rgba(0, 0, 0, 0.1);
- }
-
- .table-fixed-right th:last-child {
- background-color: #f9fafb;
- }
-
- /* 表格滚动控件 */
- .table-scroll-controls {
- display: none;
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- width: 100%;
- pointer-events: none;
- z-index: 3;
- }
-
- .table-scroll-btn {
- position: absolute;
- width: 32px;
- height: 32px;
- border-radius: 50%;
- background-color: rgba(255, 255, 255, 0.9);
- color: #4CAF50;
- border: 1px solid #e0e0e0;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- pointer-events: auto;
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
- z-index: 4;
- }
-
- .table-scroll-left {
- left: 10px;
- }
-
- .table-scroll-right {
- right: 10px;
- }
-
- .has-overflow .table-scroll-controls {
- display: block;
- }
- tbody tr:hover {
- background-color: #f8fafc !important;
- }
- tbody tr:hover td {
- white-space: nowrap;
- max-width: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- background: none !important;
- }
- /* 移除所有可能的轮廓和装饰 */
- *:focus {
- outline: none !important;
- }
- /* 确保按钮组之间的间距正确 */
- .action-group + .action-group {
- margin-top: 4px;
- border-top: none !important;
- background: none !important;
- }
- /* 移除滚动按钮相关样式 */
- #scrollLeftBtn,
- #scrollRightBtn {
- display: none !important;
- }
- .w-8,
- .h-8,
- .shadow-md {
- display: none !important;
- }
- /* 表格容器相关样式 */
- .table-container-wrapper {
- position: relative;
- padding: 0 40px;
- }
- .scroll-button {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- width: 32px;
- height: 32px;
- background: #fff;
- border: 1px solid #e5e7eb;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
- z-index: 10;
- transition: all 0.2s;
- }
- .scroll-button:hover {
- background: #f9fafb;
- border-color: #d1d5db;
- }
- .scroll-button:disabled {
- opacity: 0.5;
- cursor: not-allowed;
- }
- .scroll-button.left {
- left: 4px;
- }
- .scroll-button.right {
- right: 4px;
- }
- .scroll-button i {
- font-size: 16px;
- color: #6b7280;
- }
- /* 确保操作按钮在一行 */
- .action-group {
- display: flex;
- gap: 8px;
- flex-wrap: nowrap;
- white-space: nowrap;
- }
- /* 调整表格滚动容器 */
- .table-container {
- position: relative;
- overflow-x: auto;
- scrollbar-width: thin;
- scrollbar-color: #cbd5e1 #f1f5f9;
- -ms-overflow-style: none;
- scroll-behavior: smooth;
- }
- .table-container::-webkit-scrollbar {
- height: 6px;
- }
- .table-container::-webkit-scrollbar-track {
- background: #f1f5f9;
- border-radius: 3px;
- }
- .table-container::-webkit-scrollbar-thumb {
- background: #cbd5e1;
- border-radius: 3px;
- }
- .table-container::-webkit-scrollbar-thumb:hover {
- background: #94a3b8;
- }
- /* 调整表格最后一列宽度 */
- table th:last-child,
- table td:last-child {
- min-width: 200px;
- width: 200px;
- }
- </style>
- </head>
- <body>
- <div class="page-container">
- <!-- 页面标题和操作按钮 -->
- <div class="page-header">
- <div class="flex items-center">
- <h1 class="page-title">地块管理</h1>
- </div>
- <div class="add-button-container">
- <button type="button"
- class="btn btn-primary"
- id="addFieldBtn">
- <i class="iconfont icon-plus btn-icon"></i>新增地块
- </button>
- </div>
- </div>
-
- <!-- 搜索和筛选区域 -->
- <div class="search-card">
- <div class="grid grid-cols-1 gap-4">
- <div class="grid grid-cols-1 md:grid-cols-4 lg:grid-cols-6 gap-4">
- <!-- 搜索框 -->
- <div class="md:col-span-2 lg:col-span-2">
- <div class="relative">
- <input type="text" class="search-input" placeholder="请输入地块编号、名称、位置关键词">
- <button class="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 focus:outline-none">
- <i class="iconfont icon-search"></i>
- </button>
- </div>
- </div>
-
- <!-- 筛选项第一行 -->
- <div class="md:col-span-1 lg:col-span-1">
- <select class="form-select">
- <option value="">所属农场</option>
- <option value="1">智慧农场一号</option>
- <option value="2">智慧农场二号</option>
- <option value="3">智慧农场三号</option>
- <option value="4">有机蔬菜基地</option>
- <option value="5">生态果园基地</option>
- </select>
- </div>
- <div class="md:col-span-1 lg:col-span-1">
- <select class="form-select">
- <option value="">所属区域</option>
- <option value="1">东区</option>
- <option value="2">西区</option>
- <option value="3">南区</option>
- <option value="4">北区</option>
- </select>
- </div>
- <div class="md:col-span-1 lg:col-span-1">
- <select class="form-select">
- <option value="">使用状态</option>
- <option value="1">使用中</option>
- <option value="2">维护中</option>
- <option value="0">未使用</option>
- </select>
- </div>
- <div class="md:col-span-1 lg:col-span-1">
- <select class="form-select">
- <option value="">土壤类型</option>
- <option value="1">黏土</option>
- <option value="2">沙质土</option>
- <option value="3">壤土</option>
- <option value="4">沙壤土</option>
- <option value="5">其他</option>
- </select>
- </div>
- </div>
-
- <!-- 筛选项第二行 -->
- <div class="grid grid-cols-1 md:grid-cols-4 lg:grid-cols-6 gap-4">
- <div class="md:col-span-1 lg:col-span-1">
- <select class="form-select">
- <option value="">灌溉方式</option>
- <option value="1">喷灌</option>
- <option value="2">滴灌</option>
- <option value="3">微喷灌</option>
- <option value="4">漫灌</option>
- <option value="5">其他</option>
- </select>
- </div>
- <div class="md:col-span-1 lg:col-span-1">
- <select class="form-select">
- <option value="">种植作物</option>
- <optgroup label="粮食作物">
- <option value="101">水稻</option>
- <option value="102">小麦</option>
- <option value="103">玉米</option>
- <option value="104">大豆</option>
- <option value="105">高粱</option>
- <option value="106">谷子</option>
- </optgroup>
- <optgroup label="经济作物">
- <option value="201">棉花</option>
- <option value="202">油菜</option>
- <option value="203">花生</option>
- <option value="204">芝麻</option>
- <option value="205">甘蔗</option>
- <option value="206">烟草</option>
- <option value="207">茶叶</option>
- <option value="208">药材</option>
- </optgroup>
- <optgroup label="果树作物">
- <option value="301">葡萄</option>
- <option value="302">苹果</option>
- <option value="303">梨</option>
- <option value="304">桃</option>
- <option value="305">柑橘</option>
- <option value="306">枣</option>
- <option value="307">猕猴桃</option>
- <option value="308">石榴</option>
- <option value="309">杏</option>
- </optgroup>
- <optgroup label="蔬菜作物">
- <option value="401">叶菜类</option>
- <option value="402">根茎类</option>
- <option value="403">瓜果类</option>
- <option value="404">豆类</option>
- <option value="405">茄果类</option>
- <option value="406">葱蒜类</option>
- </optgroup>
- <optgroup label="其他作物">
- <option value="901">饲料作物</option>
- <option value="902">观赏作物</option>
- <option value="903">食用菌</option>
- <option value="999">其他</option>
- </optgroup>
- </select>
- </div>
- <div class="md:col-span-1 lg:col-span-1">
- <div class="relative">
- <input type="text" class="search-input" placeholder="负责人">
- </div>
- </div>
- <div class="md:col-span-1 lg:col-span-1">
- <div class="relative">
- <input type="date" class="search-input" placeholder="创建日期">
- </div>
- </div>
- <div class="md:col-span-2 lg:col-span-2 flex justify-end items-center gap-2">
- <button class="btn btn-primary">
- <i class="iconfont icon-search btn-icon"></i>查询
- </button>
- <button class="btn btn-outline">
- <i class="iconfont icon-refresh btn-icon"></i>重置
- </button>
- </div>
- </div>
- </div>
- </div>
-
- <!-- 表格列表 -->
- <div class="table-card">
- <div class="relative table-container-wrapper">
- <!-- 左滑动按钮 -->
- <button type="button" class="scroll-button left" id="scrollLeftBtn" disabled>
- <i class="iconfont icon-left"></i>
- </button>
-
- <!-- 右滑动按钮 -->
- <button type="button" class="scroll-button right" id="scrollRightBtn">
- <i class="iconfont icon-right"></i>
- </button>
-
- <!-- 表格容器 -->
- <div class="table-container" id="tableContainer">
- <table>
- <thead>
- <tr>
- <th class="min-w-[120px]">地块编号</th>
- <th class="min-w-[120px]">地块名称</th>
- <th class="min-w-[120px]">所属农场</th>
- <th class="min-w-[100px]">所属区域</th>
- <th class="min-w-[100px]">地块类型</th>
- <th class="min-w-[90px]">面积(亩)</th>
- <th class="min-w-[120px]">种植作物</th>
- <th class="min-w-[100px]">土壤类型</th>
- <th class="min-w-[100px]">灌溉方式</th>
- <th class="min-w-[100px]">使用状态</th>
- <th class="min-w-[100px]">绑定设备</th>
- <th class="min-w-[100px]">绑定人员</th>
- <th class="min-w-[100px]">负责人</th>
- <th class="min-w-[120px]">创建时间</th>
- <th class="min-w-[120px]">上次更新</th>
- <th class="min-w-[180px]">操作</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>FK20230001</td>
- <td>东区水稻田A</td>
- <td>智慧农场一号</td>
- <td>东区</td>
- <td>水田</td>
- <td>120</td>
- <td>水稻</td>
- <td>黏土</td>
- <td>喷灌</td>
- <td>
- <span class="badge badge-success">
- <i class="iconfont icon-check-circle badge-icon"></i>使用中
- </span>
- </td>
- <td>
- <span class="count-badge">
- <i class="iconfont icon-device"></i>3
- </span>
- </td>
- <td>
- <span class="count-badge">
- <i class="iconfont icon-user"></i>2
- </span>
- </td>
- <td>张三</td>
- <td>2023-05-15</td>
- <td>2023-06-20</td>
- <td>
- <div class="action-group">
- <button type="button" class="action-btn view" title="地块管理" data-id="FK20230001">
- <i class="iconfont icon-eye"></i>管理
- </button>
- <button type="button" class="action-btn edit" title="编辑地块" data-id="FK20230001">
- <i class="iconfont icon-edit"></i>编辑
- </button>
- <button type="button" class="action-btn delete" title="删除地块" data-id="FK20230001">
- <i class="iconfont icon-delete"></i>删除
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>FK20230002</td>
- <td>西区蔬菜园B</td>
- <td>有机蔬菜基地</td>
- <td>西区</td>
- <td>菜地</td>
- <td>85</td>
- <td>青菜、萝卜</td>
- <td>沙质土</td>
- <td>滴灌</td>
- <td>
- <span class="badge badge-success">
- <i class="iconfont icon-check-circle badge-icon"></i>使用中
- </span>
- </td>
- <td>
- <span class="count-badge">
- <i class="iconfont icon-device"></i>2
- </span>
- </td>
- <td>
- <span class="count-badge">
- <i class="iconfont icon-user"></i>1
- </span>
- </td>
- <td>李四</td>
- <td>2023-05-18</td>
- <td>2023-06-25</td>
- <td>
- <div class="action-group">
- <button type="button" class="action-btn view" title="地块管理" data-id="FK20230002">
- <i class="iconfont icon-eye"></i>管理
- </button>
- <button type="button" class="action-btn edit" title="编辑地块" data-id="FK20230002">
- <i class="iconfont icon-edit"></i>编辑
- </button>
- <button type="button" class="action-btn delete" title="删除地块" data-id="FK20230002">
- <i class="iconfont icon-delete"></i>删除
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>FK20230003</td>
- <td>南区果园C</td>
- <td>生态果园基地</td>
- <td>南区</td>
- <td>果园</td>
- <td>200</td>
- <td>苹果</td>
- <td>壤土</td>
- <td>微喷灌</td>
- <td>
- <span class="badge badge-warning">
- <i class="iconfont icon-warning badge-icon"></i>维护中
- </span>
- </td>
- <td>
- <span class="count-badge">
- <i class="iconfont icon-device"></i>5
- </span>
- </td>
- <td>
- <span class="count-badge">
- <i class="iconfont icon-user"></i>3
- </span>
- </td>
- <td>王五</td>
- <td>2023-05-20</td>
- <td>2023-07-05</td>
- <td>
- <div class="action-group">
- <button type="button" class="action-btn view" title="地块管理" data-id="FK20230003">
- <i class="iconfont icon-eye"></i>管理
- </button>
- <button type="button" class="action-btn edit" title="编辑地块" data-id="FK20230003">
- <i class="iconfont icon-edit"></i>编辑
- </button>
- <button type="button" class="action-btn delete" title="删除地块" data-id="FK20230003">
- <i class="iconfont icon-delete"></i>删除
- </button>
- </div>
- </td>
- </tr>
- <tr>
- <td>FK20230004</td>
- <td>北区小麦田D</td>
- <td>智慧农场二号</td>
- <td>北区</td>
- <td>旱地</td>
- <td>160</td>
- <td>小麦</td>
- <td>沙壤土</td>
- <td>漫灌</td>
- <td>
- <span class="badge badge-danger">
- <i class="iconfont icon-close-circle badge-icon"></i>未使用
- </span>
- </td>
- <td>
- <span class="count-badge">
- <i class="iconfont icon-device"></i>0
- </span>
- </td>
- <td>
- <span class="count-badge">
- <i class="iconfont icon-user"></i>0
- </span>
- </td>
- <td>赵六</td>
- <td>2023-06-10</td>
- <td>2023-07-15</td>
- <td>
- <div class="action-group">
- <button type="button" class="action-btn view" title="地块管理" data-id="FK20230004">
- <i class="iconfont icon-eye"></i>管理
- </button>
- <button type="button" class="action-btn edit" title="编辑地块" data-id="FK20230004">
- <i class="iconfont icon-edit"></i>编辑
- </button>
- <button type="button" class="action-btn delete" title="删除地块" data-id="FK20230004">
- <i class="iconfont icon-delete"></i>删除
- </button>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
-
- <!-- 分页 -->
- <div class="flex justify-between items-center px-6 py-4">
- <div class="text-sm text-gray-600">
- 共 <span class="text-primary font-medium">24</span> 条记录
- </div>
-
- <div class="pagination">
- <div class="page-item disabled">
- <i class="iconfont icon-left"></i>
- </div>
- <div class="page-item active">1</div>
- <div class="page-item">2</div>
- <div class="page-item">3</div>
- <div class="page-item">
- <i class="iconfont icon-right"></i>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- 新增/编辑地块模态框 -->
- <div id="fieldModal" class="modal hidden">
- <div class="modal-backdrop"></div>
- <div class="modal-dialog">
- <div class="modal-content">
- <!-- 模态框头部 -->
- <div class="modal-header">
- <h3 class="modal-title">新增地块</h3>
- <button type="button" class="modal-close" id="closeModal">
- <i class="iconfont icon-close"></i>
- </button>
- </div>
-
- <!-- 模态框内容 -->
- <div class="modal-body">
- <form id="fieldForm">
- <div class="form-grid">
- <div class="form-group">
- <label class="form-label">地块名称<span class="required">*</span></label>
- <input type="text" name="fieldName" class="form-input" required>
- </div>
-
- <div class="form-group">
- <label class="form-label">地块编号</label>
- <input type="text" name="fieldCode" class="form-input" placeholder="自动生成" disabled>
- </div>
-
- <div class="form-group">
- <label class="form-label">所属农场<span class="required">*</span></label>
- <select name="farmId" class="form-input" required>
- <option value="">请选择农场</option>
- <option value="1">智慧农场一号</option>
- <option value="2">智慧农场二号</option>
- <option value="3">智慧农场三号</option>
- <option value="4">有机蔬菜基地</option>
- <option value="5">生态果园基地</option>
- </select>
- </div>
-
- <div class="form-group">
- <label class="form-label">所属区域<span class="required">*</span></label>
- <select name="fieldArea" class="form-input" required>
- <option value="">请选择区域</option>
- <option value="1">东区</option>
- <option value="2">西区</option>
- <option value="3">南区</option>
- <option value="4">北区</option>
- </select>
- </div>
-
- <div class="form-group">
- <label class="form-label">地块类型<span class="required">*</span></label>
- <select name="fieldType" class="form-input" required>
- <option value="">请选择类型</option>
- <option value="1">水田</option>
- <option value="2">旱地</option>
- <option value="3">果园</option>
- <option value="4">菜地</option>
- <option value="5">其他</option>
- </select>
- </div>
-
- <div class="form-group">
- <label class="form-label">面积(亩)<span class="required">*</span></label>
- <input type="number" name="fieldSize" class="form-input" required>
- </div>
-
- <div class="form-group">
- <label class="form-label">负责人</label>
- <select name="manager" class="form-input">
- <option value="">请选择负责人</option>
- <option value="1">张三</option>
- <option value="2">李四</option>
- <option value="3">王五</option>
- <option value="4">赵六</option>
- </select>
- </div>
-
- <div class="form-group">
- <label class="form-label">种植作物</label>
- <select name="crops" class="form-input">
- <option value="">请选择作物</option>
- <optgroup label="粮食作物">
- <option value="101">水稻</option>
- <option value="102">小麦</option>
- <option value="103">玉米</option>
- <option value="104">大豆</option>
- <option value="105">高粱</option>
- <option value="106">谷子</option>
- </optgroup>
- <optgroup label="经济作物">
- <option value="201">棉花</option>
- <option value="202">油菜</option>
- <option value="203">花生</option>
- <option value="204">芝麻</option>
- <option value="205">甘蔗</option>
- <option value="206">烟草</option>
- <option value="207">茶叶</option>
- <option value="208">药材</option>
- </optgroup>
- <optgroup label="果树作物">
- <option value="301">葡萄</option>
- <option value="302">苹果</option>
- <option value="303">梨</option>
- <option value="304">桃</option>
- <option value="305">柑橘</option>
- <option value="306">枣</option>
- <option value="307">猕猴桃</option>
- <option value="308">石榴</option>
- <option value="309">杏</option>
- </optgroup>
- <optgroup label="蔬菜作物">
- <option value="401">叶菜类</option>
- <option value="402">根茎类</option>
- <option value="403">瓜果类</option>
- <option value="404">豆类</option>
- <option value="405">茄果类</option>
- <option value="406">葱蒜类</option>
- </optgroup>
- <optgroup label="其他作物">
- <option value="901">饲料作物</option>
- <option value="902">观赏作物</option>
- <option value="903">食用菌</option>
- <option value="999">其他</option>
- </optgroup>
- </select>
- </div>
-
- <div class="form-group">
- <label class="form-label">土壤类型</label>
- <select name="soilType" class="form-input">
- <option value="">请选择</option>
- <option value="1">黏土</option>
- <option value="2">沙质土</option>
- <option value="3">壤土</option>
- <option value="4">沙壤土</option>
- <option value="5">其他</option>
- </select>
- </div>
-
- <div class="form-group">
- <label class="form-label">灌溉方式</label>
- <select name="irrigationType" class="form-input">
- <option value="">请选择</option>
- <option value="1">喷灌</option>
- <option value="2">滴灌</option>
- <option value="3">微喷灌</option>
- <option value="4">漫灌</option>
- <option value="5">其他</option>
- </select>
- </div>
-
- <div class="form-group">
- <label class="form-label">使用状态</label>
- <select name="status" class="form-input">
- <option value="1">使用中</option>
- <option value="2">维护中</option>
- <option value="0">未使用</option>
- <option value="3">闲置中</option>
- <option value="4">待开发</option>
- </select>
- </div>
- </div>
-
- <div class="form-group mt-4">
- <label class="form-label">地块描述</label>
- <textarea name="description" class="form-input" rows="4"></textarea>
- </div>
- </form>
- </div>
-
- <!-- 模态框底部 -->
- <div class="modal-footer">
- <button type="button" class="btn btn-outline" id="cancelBtn">取消</button>
- <button type="button" class="btn btn-primary" id="saveBtn">保存</button>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- document.addEventListener("DOMContentLoaded", function() {
- // 初始化表格滚动功能
- function initTableScroll() {
- const tableContainer = document.querySelector(".table-container");
- if (!tableContainer) return;
-
- const scrollLeftBtn = document.querySelector(".table-scroll-left");
- const scrollRightBtn = document.querySelector(".table-scroll-right");
-
- if (!scrollLeftBtn || !scrollRightBtn) return;
-
- // 检查表格是否需要水平滚动
- function checkTableOverflow() {
- if (tableContainer.scrollWidth > tableContainer.clientWidth) {
- tableContainer.classList.add("has-overflow");
- } else {
- tableContainer.classList.remove("has-overflow");
- }
- }
-
- // 左右滚动按钮点击事件
- scrollLeftBtn.addEventListener("click", function() {
- tableContainer.scrollLeft -= 150;
- });
-
- scrollRightBtn.addEventListener("click", function() {
- tableContainer.scrollLeft += 150;
- });
-
- // 初始检查和窗口大小变化时检查
- checkTableOverflow();
- window.addEventListener("resize", checkTableOverflow);
-
- // 滚动事件处理
- tableContainer.addEventListener("scroll", function() {
- // 根据滚动位置显示/隐藏滚动按钮
- if (tableContainer.scrollLeft <= 10) {
- scrollLeftBtn.style.opacity = "0.5";
- } else {
- scrollLeftBtn.style.opacity = "1";
- }
-
- if (tableContainer.scrollLeft >= tableContainer.scrollWidth - tableContainer.clientWidth - 10) {
- scrollRightBtn.style.opacity = "0.5";
- } else {
- scrollRightBtn.style.opacity = "1";
- }
- });
-
- // 初始触发滚动事件,设置初始按钮状态
- tableContainer.dispatchEvent(new Event("scroll"));
- }
-
- // 初始化表格滚动
- initTableScroll(); // 页面跳转函数
- function navigateTo(type, id) {
- switch(type) {
- case 'view':
- window.location.href = `../pages/field-detail.html?id=${id}`;
- break;
- case 'edit':
- window.location.href = `../pages/field-edit.html?id=${id}`;
- break;
- }
- }
- // 全局函数,用于显示模态框
- function showModalDialog(event, type = 'add', rowData = null) {
- console.log('showModalDialog called', {type, rowData});
- try {
- if (event) {
- event.preventDefault();
- event.stopPropagation();
- }
- const modal = document.getElementById('fieldModal');
- if (!modal) {
- console.error('Modal not found');
- return;
- }
- // 设置模态框标题
- const modalTitle = modal.querySelector('.modal-title');
- if (modalTitle) {
- modalTitle.textContent = type === 'edit' ? '编辑地块' : '新增地块';
- }
- // 如果是编辑模式,预填充表单数据
- if (type === 'edit') {
- // 这里使用模拟数据,实际项目中应该从后端获取
- const mockFieldData = {
- fieldName: '西区蔬菜园B',
- fieldCode: 'FK20230002',
- farmId: '4', // 有机蔬菜基地
- fieldArea: '2', // 西区
- fieldType: '4', // 菜地
- fieldSize: '85',
- manager: '2', // 李四
- crops: '401', // 叶菜类
- soilType: '2', // 沙质土
- irrigationType: '2', // 滴灌
- status: '1', // 使用中
- description: '这是一个示例地块描述。'
- };
- const form = document.getElementById('fieldForm');
- if (form) {
- Object.keys(mockFieldData).forEach(key => {
- const input = form.elements[key];
- if (input) {
- input.value = mockFieldData[key];
- }
- });
- }
- }
-
- // 显示模态框
- modal.style.cssText = 'display: block !important; opacity: 1 !important; visibility: visible !important;';
- modal.classList.remove('hidden');
- modal.classList.add('show');
- document.body.classList.add('modal-open');
- } catch (error) {
- console.error('Error in showModalDialog:', error);
- }
- }
- document.addEventListener('DOMContentLoaded', function() {
- console.log('DOM Content Loaded');
-
- // 添加按钮点击事件
- const addButton = document.getElementById('addFieldBtn');
- if (addButton) {
- addButton.addEventListener('click', e => showModalDialog(e, 'add'));
- }
-
- // 为所有操作按钮添加事件监听
- document.querySelectorAll('.action-btn').forEach(btn => {
- btn.addEventListener('click', function(e) {
- e.preventDefault();
- e.stopPropagation();
-
- let type = 'add';
- if (this.classList.contains('view')) {
- type = 'view';
- navigateTo(type, this.getAttribute('data-id'));
- } else if (this.classList.contains('edit')) {
- type = 'edit';
- showModalDialog(e, type, {id: this.getAttribute('data-id')});
- } else if (this.classList.contains('delete')) {
- if (confirm('确认要删除该地块吗?')) {
- console.log('删除地块:', this.getAttribute('data-id'));
- // 这里添加删除逻辑
- }
- }
- });
- });
-
- // 模态框关闭逻辑
- const modal = document.getElementById('fieldModal');
- const closeBtn = document.getElementById('closeModal');
- const cancelBtn = document.getElementById('cancelBtn');
- const form = document.getElementById('fieldForm');
- function hideModal(e) {
- if (e) {
- e.preventDefault();
- e.stopPropagation();
- }
-
- if (!modal) return;
-
- // 强制隐藏模态框
- modal.style.cssText = 'display: none !important; opacity: 0 !important; visibility: hidden !important;';
- modal.classList.remove('show');
- modal.classList.add('hidden');
- document.body.classList.remove('modal-open');
-
- // 重置表单
- if (form) {
- form.reset();
- const inputs = form.querySelectorAll('input, select, textarea');
- inputs.forEach(input => {
- input.disabled = false;
- input.style.borderColor = '#ddd';
- });
- }
- }
- // 关闭按钮事件
- if (closeBtn) {
- closeBtn.onclick = hideModal;
- }
- // 取消按钮事件
- if (cancelBtn) {
- cancelBtn.onclick = hideModal;
- }
- // 点击背景关闭
- if (modal) {
- modal.onclick = function(e) {
- if (e.target === modal || e.target.classList.contains('modal-backdrop')) {
- hideModal(e);
- }
- };
- }
- // 保存按钮点击事件
- const saveBtn = document.getElementById('saveBtn');
- if (saveBtn) {
- saveBtn.onclick = function(e) {
- e.preventDefault();
- e.stopPropagation();
-
- if (!form) return;
-
- const requiredFields = form.querySelectorAll('[required]');
- let isValid = true;
-
- requiredFields.forEach(field => {
- if (!field.value.trim()) {
- field.style.borderColor = '#f44336';
- isValid = false;
- } else {
- field.style.borderColor = '#ddd';
- }
- });
-
- if (!isValid) {
- alert('请填写必填项');
- return;
- }
-
- alert('地块信息保存成功');
- hideModal(e);
- };
- }
- // 防止表单提交
- if (form) {
- form.onsubmit = function(e) {
- e.preventDefault();
- return false;
- };
- }
- // 获取滚动相关元素
- const tableContainer = document.getElementById('tableContainer');
- const scrollLeftBtn = document.getElementById('scrollLeftBtn');
- const scrollRightBtn = document.getElementById('scrollRightBtn');
-
- // 更新滚动按钮状态
- function updateScrollButtons() {
- if (tableContainer) {
- const { scrollLeft, scrollWidth, clientWidth } = tableContainer;
-
- // 更新左滚动按钮状态
- if (scrollLeftBtn) {
- scrollLeftBtn.disabled = scrollLeft <= 0;
- }
-
- // 更新右滚动按钮状态
- if (scrollRightBtn) {
- scrollRightBtn.disabled = scrollLeft + clientWidth >= scrollWidth;
- }
- }
- }
-
- // 初始化滚动按钮状态
- updateScrollButtons();
-
- // 监听滚动事件
- if (tableContainer) {
- tableContainer.addEventListener('scroll', updateScrollButtons);
- }
-
- // 左滚动按钮点击事件
- if (scrollLeftBtn) {
- scrollLeftBtn.addEventListener('click', () => {
- if (tableContainer) {
- tableContainer.scrollLeft -= 200; // 每次滚动200px
- }
- });
- }
-
- // 右滚动按钮点击事件
- if (scrollRightBtn) {
- scrollRightBtn.addEventListener('click', () => {
- if (tableContainer) {
- tableContainer.scrollLeft += 200; // 每次滚动200px
- }
- });
- }
-
- // 监听窗口大小变化
- window.addEventListener('resize', updateScrollButtons);
- });
- // 添加全局错误处理
- window.onerror = function(msg, url, line, col, error) {
- console.error('Global error:', {msg, url, line, col, error});
- return false;
- };
- </script>
- </body>
- </html>
|