ksap_home.jsp 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873
  1. <%@ page language="java" pageEncoding="UTF-8" isELIgnored="false" %>
  2. <%@ taglib uri="/ssTag" prefix="ss"%>
  3. <% pageContext.setAttribute(ss.page.PageC.PAGE_objName,"ksap");%>
  4. <%pageContext.setAttribute("wdpageinformation","{'hastab':'0'}");%>
  5. <!DOCTYPE html>
  6. <html lang="zh-CN">
  7. <head>
  8. <meta charset="UTF-8">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10. <title>考试编排</title>
  11. <script src="/js/Sortable/Sortable.min.js"></script> <%-- ="/newUI/ss/js/Sortable.min.js"。Lin(新UI) --%>
  12. <script src="/js/load.js"></script> <%-- ="/newUI/ss/js/base.js"。Lin(新UI) --%>
  13. <style>
  14. :root {
  15. --primary-text: #333;
  16. --regular-text: #606266;
  17. --secondary-text: #909399;
  18. --border-color: #dcdfe6;
  19. --bg-color: #f5f7fa;
  20. --card-active-border: #dcdee5;
  21. --header-default-bg: #dddfe6;
  22. --header-active-bg: #b1b4bb;
  23. --delete-btn-bg: #5f6c7b;
  24. --section-bg-gray: #f8f9fb;
  25. --line-color: #ebeef5;
  26. }
  27. input[type="number"]::-webkit-inner-spin-button,
  28. input[type="number"]::-webkit-outer-spin-button {
  29. -webkit-appearance: none;
  30. margin: 0;
  31. }
  32. * {
  33. margin: 0;
  34. padding: 0;
  35. box-sizing: border-box;
  36. outline: none;
  37. }
  38. body {
  39. font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  40. background-color: #ffffff;
  41. font-size: 16px;
  42. /* 全局字体 16px */
  43. color: var(--primary-text);
  44. height: 100vh;
  45. display: flex;
  46. overflow: hidden;
  47. }
  48. /* SVG 图标通用样式 */
  49. .icon {
  50. width: 22px;
  51. height: 22px;
  52. fill: currentColor;
  53. vertical-align: middle;
  54. }
  55. #app {
  56. width: 100%;
  57. height: 100%;
  58. }
  59. .content {
  60. display: flex;
  61. width: 100%;
  62. height: calc(100% - 60px);
  63. }
  64. /* --- 左侧区域 --- */
  65. .left-container {
  66. flex: 1;
  67. display: flex;
  68. flex-direction: column;
  69. padding: 0 20px;
  70. overflow: hidden;
  71. background-color: #fff;
  72. }
  73. .header-info {
  74. padding: 16px 0;
  75. flex-shrink: 0;
  76. display: flex;
  77. align-items: center;
  78. gap: 20px;
  79. border-bottom: 1px solid #e2e4ec;
  80. }
  81. .info-items {
  82. display: flex;
  83. gap: 24px;
  84. font-size: 16px;
  85. color: var(--primary-text);
  86. }
  87. .info-label {
  88. /* color: var(--secondary-text); */
  89. margin-right: 4px;
  90. }
  91. .btn {
  92. padding: 6px 16px;
  93. border: 1px solid #dcdfe6;
  94. background: white;
  95. border-radius: 4px;
  96. cursor: pointer;
  97. font-size: 13px;
  98. color: #606266;
  99. transition: all 0.3s;
  100. white-space: nowrap;
  101. }
  102. .btn:hover {
  103. color: #409eff;
  104. border-color: #c6e2ff;
  105. background-color: #ecf5ff;
  106. }
  107. .card-container {
  108. flex: 1;
  109. display: flex;
  110. gap: 20px;
  111. overflow-x: auto;
  112. overflow-y: hidden;
  113. padding: 20px;
  114. align-items: flex-start;
  115. border: 2px dashed transparent;
  116. border-radius: 10px;
  117. transition: border-color 0.2s, background 0.2s;
  118. }
  119. .card-container.drop-active {
  120. border-color: #d3d6dc;
  121. background: rgba(211, 214, 220, 0.35);
  122. }
  123. /* --- 考室卡片 --- */
  124. .room-card {
  125. width: 270px;
  126. height: 100%;
  127. max-height: calc(100vh - 100px);
  128. background: #fff;
  129. border: 1px solid #e2e4ec;
  130. display: flex;
  131. flex-direction: column;
  132. flex-shrink: 0;
  133. transition: box-shadow 0.2s;
  134. position: relative;
  135. box-sizing: border-box;
  136. }
  137. .room-card:hover {
  138. box-shadow: 0 0 0 8px var(--card-active-border);
  139. z-index: 1;
  140. }
  141. .room-card.active {
  142. box-shadow: 0 0 0 8px var(--card-active-border);
  143. border-color: var(--card-active-border);
  144. z-index: 2;
  145. }
  146. /* 卡片头部 */
  147. .room-header {
  148. height: 55px;
  149. padding: 0 22px;
  150. font-size: 22px;
  151. /* font-weight: 500; */
  152. color: #4d4d4d;
  153. flex-shrink: 0;
  154. display: flex;
  155. align-items: center;
  156. border-bottom: 1px solid var(--line-color);
  157. /* 修复:确保有下边框 */
  158. background: #fff;
  159. position: relative;
  160. }
  161. /* 删除按钮 */
  162. .btn-close {
  163. position: absolute;
  164. top: 0;
  165. right: 0;
  166. width: 55px;
  167. height: 55px;
  168. background: transparent;
  169. border: none;
  170. cursor: pointer;
  171. display: none;
  172. align-items: center;
  173. justify-content: center;
  174. z-index: 10;
  175. color: #909399;
  176. transition: background-color 0.2s;
  177. }
  178. .room-card:hover .btn-close {
  179. display: flex;
  180. }
  181. .btn-close:hover {
  182. background-color: #565d6d;
  183. color: #fff;
  184. }
  185. /* 容纳人数行 (灰色背景) */
  186. .capacity-row {
  187. display: flex;
  188. align-items: stretch;
  189. height: 48px;
  190. background-color: var(--section-bg-gray);
  191. border-bottom: 1px solid var(--line-color);
  192. /* 修复:确保有下边框 */
  193. flex-shrink: 0;
  194. }
  195. .capacity-label {
  196. padding: 0 12px 0 22px;
  197. font-size: 20px;
  198. color: #333333;
  199. border-right: 1px solid var(--line-color);
  200. display: flex;
  201. align-items: center;
  202. }
  203. .capacity-input-wrapper {
  204. flex: 1;
  205. display: flex;
  206. align-items: center;
  207. position: relative;
  208. }
  209. .capacity-alert {
  210. position: absolute;
  211. left: 0;
  212. bottom: 0;
  213. padding: 0 14px;
  214. color: #f56c6c;
  215. font-size: 12px;
  216. border-bottom: 1px solid #f56c6c;
  217. pointer-events: none;
  218. width: 100%;
  219. }
  220. .capacity-input:placeholder-shown {
  221. border-left: 2px solid #f56c6c;
  222. }
  223. .capacity-input {
  224. width: 100%;
  225. height: 100%;
  226. border: none;
  227. padding: 0 12px;
  228. font-size: 20px;
  229. background: transparent;
  230. color: #333333;
  231. }
  232. .card-scroll-area {
  233. flex: 1;
  234. overflow-y: auto;
  235. display: flex;
  236. flex-direction: column;
  237. }
  238. /* 监考员区域 (灰色背景) */
  239. .supervisor-section {
  240. display: flex;
  241. flex-direction: column;
  242. border-bottom: 1px solid var(--line-color);
  243. /* 修复:确保有下边框 */
  244. background-color: var(--section-bg-gray);
  245. }
  246. .supervisor-section .section-header,
  247. .supervisor-section .section-list {
  248. background-color: var(--section-bg-gray);
  249. }
  250. /* 考生区域 (白色背景) */
  251. .student-section {
  252. display: flex;
  253. flex-direction: column;
  254. background-color: #fff;
  255. flex: 1;
  256. /* 占满剩余空间 */
  257. }
  258. .section-header {
  259. padding: 0 22px;
  260. height: 48px;
  261. display: flex;
  262. align-items: center;
  263. justify-content: space-between;
  264. color: var(--primary-text);
  265. font-weight: 500;
  266. font-size: 20px;
  267. }
  268. .section-header-left {
  269. display: flex;
  270. align-items: center;
  271. gap: 20px;
  272. }
  273. .section-icon {
  274. display: inline-flex;
  275. font-size: 20px;
  276. color: #5e6470;
  277. }
  278. .section-count {
  279. font-size: 18px;
  280. color: #999999;
  281. font-weight: normal;
  282. }
  283. .section-list {
  284. min-height: 40px;
  285. display: flex;
  286. flex-direction: column;
  287. align-items: flex-end;
  288. margin-bottom: 10px;
  289. border: 2px dashed transparent;
  290. border-radius: 6px;
  291. transition: border-color 0.2s, background 0.2s;
  292. }
  293. .section-list.drop-active {
  294. border-color: #d3d6dc;
  295. background: rgba(211, 214, 220, 0.35);
  296. }
  297. .empty-tip {
  298. display: none;
  299. }
  300. /* 列表项 */
  301. .list-item {
  302. width: 75%;
  303. height: 36px;
  304. margin-right: 10px;
  305. padding-left: 10px;
  306. display: flex;
  307. align-items: center;
  308. justify-content: space-between;
  309. font-size: 18px;
  310. /* 确保列表项也是 16px */
  311. color: var(--primary-text);
  312. cursor: grab;
  313. position: relative;
  314. /* 为 absolute button 提供定位上下文 */
  315. border-radius: 0;
  316. box-sizing: border-box;
  317. }
  318. .list-item:hover {
  319. background-color: #edf2f5;
  320. }
  321. .list-item-name {
  322. text-align: left;
  323. flex: 1;
  324. overflow: hidden;
  325. text-overflow: ellipsis;
  326. white-space: nowrap;
  327. }
  328. .list-item-code {
  329. color: #909399;
  330. font-size: 16px;
  331. /* 工号稍微小一点点,或者也 16px */
  332. margin-right: 8px;
  333. /* 稍微离右边远一点,避免贴着删除按钮区域 */
  334. text-align: right;
  335. }
  336. /* 列表项删除按钮 */
  337. .item-delete-btn {
  338. display: none;
  339. position: absolute;
  340. /* 绝对定位 */
  341. top: 0;
  342. right: 0;
  343. bottom: 0;
  344. /* 撑满高度 */
  345. width: 36px;
  346. /* 固定宽度 */
  347. /* height: 100%; 由 top/bottom 决定 */
  348. color: #909399;
  349. cursor: pointer;
  350. align-items: center;
  351. justify-content: center;
  352. font-size: 18px;
  353. line-height: 1;
  354. border-radius: 0;
  355. /* 贴边无圆角 */
  356. z-index: 5;
  357. }
  358. .list-item:hover .item-delete-btn {
  359. display: flex;
  360. }
  361. .item-delete-btn:hover {
  362. background-color: #565d6d;
  363. color: #fff;
  364. }
  365. /* --- 右侧资源面板 --- */
  366. .right-panel {
  367. width: 350px;
  368. background: #f2f3f5;
  369. display: flex;
  370. flex-direction: column;
  371. border-left: 1px solid #dcdfe6;
  372. flex-shrink: 0;
  373. height: 100%;
  374. overflow: hidden;
  375. }
  376. .panel {
  377. background: #fff;
  378. display: flex;
  379. flex-direction: column;
  380. flex: none;
  381. border: none;
  382. border-bottom: 1px solid transparent;
  383. }
  384. .panel-header {
  385. width: calc(100% - 6px);
  386. margin: 0 auto;
  387. height: 48px;
  388. box-sizing: border-box;
  389. padding: 10px 18px;
  390. display: flex;
  391. align-items: center;
  392. cursor: default;
  393. user-select: none;
  394. background: var(--header-default-bg);
  395. color: #303133;
  396. transition: background 0.2s;
  397. flex-shrink: 0;
  398. }
  399. .panel-header.can-resize {
  400. cursor: ns-resize;
  401. }
  402. .panel-header.resizing {
  403. background: var(--header-active-bg);
  404. cursor: ns-resize;
  405. }
  406. .panel-header-left {
  407. display: flex;
  408. align-items: center;
  409. gap: 12px;
  410. flex: 1;
  411. }
  412. .panel-header.dark {
  413. background: var(--header-dark-bg);
  414. /* 深色背景暂未定义,假设不需要或沿用 dark 逻辑 */
  415. color: #fff;
  416. }
  417. /* 左侧组:图标+标题+箭头 */
  418. .panel-header-group {
  419. display: flex;
  420. align-items: center;
  421. gap: 12px;
  422. }
  423. .panel-icon {
  424. display: inline-flex;
  425. color: #5e6470;
  426. font-size: 22px;
  427. }
  428. .panel-title {
  429. font-size: 20px;
  430. /* font-weight: 500; */
  431. }
  432. .panel-arrow {
  433. transition: color 0.2s ease;
  434. color: #606266;
  435. width: 22px;
  436. height: 22px;
  437. pointer-events: none;
  438. display: inline-flex;
  439. align-items: center;
  440. justify-content: center;
  441. }
  442. .panel-toggle {
  443. background: transparent;
  444. border: none;
  445. cursor: pointer;
  446. width: 28px;
  447. height: 28px;
  448. display: flex;
  449. align-items: center;
  450. justify-content: center;
  451. font-size: 22px;
  452. margin-left: 12px;
  453. }
  454. .panel-actions {
  455. display: flex;
  456. align-items: center;
  457. gap: 6px;
  458. margin-left: auto;
  459. }
  460. .panel-resize-indicator {
  461. background: transparent;
  462. border: none;
  463. cursor: ns-resize;
  464. width: 28px;
  465. height: 28px;
  466. display: flex;
  467. align-items: center;
  468. justify-content: center;
  469. color: #5e6470;
  470. }
  471. .panel-resize-icon {
  472. font-size: 18px;
  473. color: #5e6470;
  474. }
  475. .panel-body {
  476. display: flex;
  477. flex-direction: column;
  478. flex: none;
  479. overflow: hidden;
  480. min-height: 0;
  481. background: #f7f7f7;
  482. }
  483. .panel-search {
  484. padding: 12px !important;
  485. display: flex;
  486. justify-content: flex-end;
  487. gap: 8px;
  488. /* background: #fff; */
  489. flex-shrink: 0;
  490. height: auto !important;
  491. gap: 8px !important;
  492. /* border-bottom: 1px solid #ebeef5; */
  493. }
  494. .search-select {
  495. width: 138px;
  496. height: 34px;
  497. padding: 4px;
  498. border: 1px solid #dcdfe6;
  499. border-radius: 2px;
  500. font-size: 16px;
  501. color: #606266;
  502. }
  503. .search-input {
  504. width: 106px;
  505. height: 34px;
  506. padding: 4px 15px;
  507. border: 1px solid #dcdfe6;
  508. border-radius: 2px;
  509. font-size: 16px;
  510. color: #999999;
  511. }
  512. .panel-list {
  513. flex: 1;
  514. overflow-y: auto;
  515. /* background: #fff; */
  516. padding: 0 12px 8px 0;
  517. min-height: 0;
  518. box-sizing: border-box;
  519. display: flex;
  520. flex-direction: column;
  521. align-items: flex-end;
  522. }
  523. .panel-list::-webkit-scrollbar {
  524. width: 6px;
  525. }
  526. .panel-list-item {
  527. width: 280px;
  528. /* margin-left: auto; */
  529. /* margin-right: 12px; */
  530. flex-shrink: 0;
  531. display: flex;
  532. justify-content: space-between;
  533. align-items: center;
  534. padding: 0 6px;
  535. height: 34px;
  536. font-size: 18px;
  537. color: var(--primary-text);
  538. cursor: move;
  539. border-bottom: 1px solid #e2e4ec;
  540. box-sizing: border-box;
  541. }
  542. .panel-list-item:hover {
  543. background-color: #ecf5ff;
  544. }
  545. .panel-item-name {
  546. text-align: left;
  547. }
  548. .panel-item-code {
  549. text-align: right;
  550. /* color: #909399; */
  551. }
  552. .panel-room-building {
  553. /* color: #909399; */
  554. /* font-size: 18; */
  555. margin-left: 12px;
  556. text-align: right;
  557. }
  558. ::-webkit-scrollbar {
  559. width: 6px;
  560. height: 6px;
  561. }
  562. ::-webkit-scrollbar-thumb {
  563. background: #c0c4cc;
  564. border-radius: 3px;
  565. }
  566. ::-webkit-scrollbar-track {
  567. background: transparent;
  568. }
  569. </style>
  570. </head>
  571. <body>
  572. <div id="app">
  573. <div class="content">
  574. <!-- 左侧区域容器 -->
  575. <div class="left-container">
  576. <!-- 头部信息栏 -->
  577. <div class="header-info">
  578. <div class="info-items">
  579. <div><span class="info-label">课程:</span>{{ ksjh.kcmc }}</div>
  580. <div><span class="info-label">年级:</span>{{ ksjh.njmc }}</div>
  581. <div><span class="info-label">学期:</span>{{ ksjh.xqmc }}</div>
  582. <div><span class="info-label">试室数:</span>{{ ksjh.ssCount }} 间</div>
  583. <div><span class="info-label">总容纳人数:</span>{{ ksjh.totalCapacity }} 人</div>
  584. <div><span class="info-label">已编排考生数:</span>{{ ksjh.arrangedCount }} 人</div>
  585. </div>
  586. <!-- <button class="btn" @click="autoArrange">自动编排</button> -->
  587. <ss-search-button
  588. text="自动编排"
  589. @click.stop="autoArrange"
  590. ></ss-search-button>
  591. </div>
  592. <!-- 考室卡片区域 (X轴滚动) -->
  593. <div class="card-container" ref="leftContent"
  594. :class="{ 'drop-active': dropIndicators.room }"
  595. @dragover.prevent="handleRoomDragOver"
  596. @dragleave="handleRoomDragLeave"
  597. @drop.prevent="handleRoomDrop">
  598. <div v-for="room in ksapList" :key="room.ksapid" class="room-card"
  599. :class="{ active: selectedKsapid === room.ksapid }" :data-ksapid="room.ksapid"
  600. @click.stop="selectRoom(room.ksapid)">
  601. <button class="btn-close" @click.stop="deleteRoom(room)" title="删除">
  602. <ss-bottom-div-icon class="bottom-div-close"></ss-bottom-div-icon>
  603. </button>
  604. <div class="room-header">{{ room.ssmc || '未选择' }}</div>
  605. <div class="capacity-row" style="margin-bottom: 12px;">
  606. <div class="capacity-label">容纳人数</div>
  607. <div class="capacity-input-wrapper">
  608. <input type="number" class="capacity-input" v-model="room.zdrs" min="0"
  609. @input="handleCapacityInput(room)"
  610. placeholder="请输入">
  611. <div class="capacity-alert" v-if="room.showCapacityAlert">请先输入容纳人数</div>
  612. </div>
  613. </div>
  614. <!-- 内部滚动区域 -->
  615. <div class="card-scroll-area">
  616. <!-- 监考员区域 -->
  617. <div class="card-section supervisor-section">
  618. <div class="section-header">
  619. <div class="section-header-left">
  620. <ss-common-icon class="section-icon common-icon-renyuan2"></ss-common-icon>
  621. <span>监考员</span>
  622. </div>
  623. </div>
  624. <div class="section-divider"></div>
  625. <div class="section-list"
  626. :class="{ 'drop-active': dropIndicators.supervisor === room.ksapid }"
  627. @dragover.prevent="handleSupervisorDragOver(room, $event)"
  628. @dragleave="handleSupervisorDragLeave(room)"
  629. @drop.prevent.stop="handleSupervisorDrop(room)">
  630. <div v-if="room.zjkry" class="list-item">
  631. <span class="list-item-name">{{ room.zjkry.xm }}</span>
  632. <span class="item-delete-btn"
  633. @click.stop="removeSupervisor(room, room.zjkry)">
  634. <ss-bottom-div-icon class="bottom-div-close"></ss-bottom-div-icon>
  635. </span>
  636. </div>
  637. <div v-for="person in room.jkcyList" :key="person.ryid" class="list-item">
  638. <span class="list-item-name">{{ person.xm }}</span>
  639. <span class="item-delete-btn"
  640. @click.stop="removeSupervisor(room, person)">
  641. <ss-bottom-div-icon class="bottom-div-close"></ss-bottom-div-icon>
  642. </span>
  643. </div>
  644. <div v-if="!room.zjkry && room.jkcyList.length === 0" class="empty-tip">
  645. 暂无监考员
  646. </div>
  647. </div>
  648. </div>
  649. <!-- 考生区域 -->
  650. <div class="card-section student-section">
  651. <div class="section-header">
  652. <div class="section-header-left">
  653. <ss-common-icon class="section-icon common-icon-xueyuan"></ss-common-icon>
  654. <span>考生</span>
  655. </div>
  656. <span class="section-count">{{ room.dqrs }}/{{ room.zdrs || 0 }}</span>
  657. </div>
  658. <div class="section-divider"></div>
  659. <div class="section-list"
  660. :class="{ 'drop-active': dropIndicators.student === room.ksapid }"
  661. @dragover.prevent="handleStudentDragOver(room, $event)"
  662. @dragleave="handleStudentDragLeave(room)"
  663. @drop.prevent.stop="handleStudentDrop(room)">
  664. <div v-for="student in room.kscyList" :key="student.ryid" class="list-item">
  665. <span>{{ student.xm }}</span>
  666. <span class="item-delete-btn"
  667. @click.stop="removeStudent(room, student)">
  668. <ss-bottom-div-icon class="bottom-div-close"></ss-bottom-div-icon>
  669. </span>
  670. </div>
  671. <div v-if="room.kscyList.length === 0" class="empty-tip">
  672. 暂无考生
  673. </div>
  674. </div>
  675. </div>
  676. </div>
  677. </div>
  678. </div>
  679. </div>
  680. <!-- 右侧资源面板 -->
  681. <div class="right-panel" ref="rightPanel">
  682. <!-- 可安排的课室 -->
  683. <div class="panel">
  684. <div class="panel-header" :class="{ 'can-resize': canResize('room'), resizing: isResizing('room') }"
  685. @mousedown="handlePanelPress('room', $event)" @mouseup="handlePanelRelease"
  686. @mouseleave="handlePanelRelease" ref="roomHeader">
  687. <div class="panel-header-group">
  688. <ss-common-icon class="panel-icon common-icon-jiaoshi"></ss-common-icon>
  689. <span class="panel-title">可安排的课室</span>
  690. </div>
  691. <button type="button" class="panel-toggle" @click.stop="togglePanel('room')" @mousedown.stop
  692. @mouseup.stop>
  693. <ss-common-icon :class="['panel-arrow', getPanelToggleIcon('room')]"></ss-common-icon>
  694. </button>
  695. <button v-if="isResizing('room')" class="panel-resize-indicator" title="拖动调整高度"
  696. style="margin-left: auto;">
  697. <ss-common-icon class="panel-resize-icon common-icon-paixu"></ss-common-icon>
  698. </button>
  699. </div>
  700. <div class="panel-body" v-show="!panels.room.collapsed" :style="getPanelBodyStyle('room')"
  701. ref="roomBody">
  702. <div class="search-bar-contaienr panel-search " ref="roomSearch">
  703. <ss-objp v-model="searchFilters.room.building" name="jzwid" :opt="bmidOption"
  704. placeholder="建筑物" width="150px" inp="true"
  705. url="/service?ssServ=loadObjpOpt&objectpickerdropdown1=1" cb="jzw"></ss-objp>
  706. <ss-search-input name="roomnmae" placeholder="名称" v-model="searchFilters.room.name"
  707. width="100px" @search="search">
  708. </ss-search-input>
  709. </div>
  710. <div class="panel-list" ref="roomList">
  711. <div v-for="room in filteredRooms" :key="room.ssid" class="panel-list-item"
  712. draggable="true"
  713. @dragstart="handleDragStart('room', room, $event)"
  714. @dragend="handleDragEnd">
  715. <span class="panel-item-name">{{ room.ssmc }}</span>
  716. <span class="panel-item-code">{{ room.jzwid || room.ssid }}</span>
  717. </div>
  718. </div>
  719. </div>
  720. </div>
  721. <!-- 未编排的考生 -->
  722. <div class="panel">
  723. <div class="panel-header"
  724. :class="{ 'can-resize': canResize('student'), resizing: isResizing('student') }"
  725. @mousedown="handlePanelPress('student', $event)" @mouseup="handlePanelRelease"
  726. @mouseleave="handlePanelRelease" ref="studentHeader">
  727. <div class="panel-header-group">
  728. <ss-common-icon class="panel-icon common-icon-xueyuan"></ss-common-icon>
  729. <span class="panel-title">未编排的考生</span>
  730. </div>
  731. <button type="button" class="panel-toggle" @click.stop="togglePanel('student')" @mousedown.stop
  732. @mouseup.stop>
  733. <ss-common-icon :class="['panel-arrow', getPanelToggleIcon('student')]"></ss-common-icon>
  734. </button>
  735. <button v-if="isResizing('student')" class="panel-resize-indicator" title="拖动调整高度"
  736. style="margin-left: auto;">
  737. <ss-common-icon class="panel-resize-icon common-icon-paixu"></ss-common-icon>
  738. </button>
  739. </div>
  740. <div class="panel-body" v-show="!panels.student.collapsed" :style="getPanelBodyStyle('student')"
  741. ref="studentBody">
  742. <div class="search-bar-contaienr panel-search " ref="studentSearch">
  743. <ss-objp v-model="searchFilters.student.class" name="bjid" :opt="bjidOption"
  744. placeholder="班级" width="150px" inp="true"
  745. url="/service?ssServ=loadObjpOpt&objectpickerdropdown1=1" cb="bj"></ss-objp>
  746. <ss-search-input name="roomnmae" placeholder="姓名" v-model="searchFilters.student.name"
  747. width="100px" @search="search">
  748. </ss-search-input>
  749. </div>
  750. <div class="panel-list" ref="studentList">
  751. <div v-for="student in filteredStudents" :key="student.ryid" class="panel-list-item"
  752. draggable="true"
  753. @dragstart="handleDragStart('student', student, $event)"
  754. @dragend="handleDragEnd">
  755. <span>{{ student.xm }}</span>
  756. <span class="panel-item-code">{{ student.displayId }}</span>
  757. </div>
  758. </div>
  759. </div>
  760. </div>
  761. <!-- 可安排的监考人员 -->
  762. <div class="panel">
  763. <div class="panel-header"
  764. :class="{ 'can-resize': canResize('supervisor'), resizing: isResizing('supervisor') }"
  765. @mousedown="handlePanelPress('supervisor', $event)" @mouseup="handlePanelRelease"
  766. @mouseleave="handlePanelRelease" ref="supervisorHeader">
  767. <div class="panel-header-group">
  768. <ss-common-icon class="panel-icon common-icon-renyuan2"></ss-common-icon>
  769. <span class="panel-title">可安排的监考人员</span>
  770. </div>
  771. <button type="button" class="panel-toggle" @click.stop="togglePanel('supervisor')"
  772. @mousedown.stop @mouseup.stop>
  773. <ss-common-icon :class="['panel-arrow', getPanelToggleIcon('supervisor')]"></ss-common-icon>
  774. </button>
  775. <button v-if="isResizing('supervisor')" class="panel-resize-indicator" title="拖动调整高度"
  776. style="margin-left: auto;">
  777. <ss-common-icon class="panel-resize-icon common-icon-paixu"></ss-common-icon>
  778. </button>
  779. </div>
  780. <div class="panel-body" v-show="!panels.supervisor.collapsed"
  781. :style="getPanelBodyStyle('supervisor')" ref="supervisorBody">
  782. <div class="search-bar-contaienr panel-search " ref="supervisorSearch">
  783. <ss-objp v-model="searchFilters.supervisor.dept" name="bmid" :opt="bjidOption"
  784. placeholder="部门" width="150px" inp="true"
  785. url="/service?ssServ=loadObjpOpt&objectpickerdropdown1=1" cb="bm"></ss-objp>
  786. <ss-search-input name="roomnmae" placeholder="姓名" v-model="searchFilters.supervisor.name"
  787. width="100px" @search="search">
  788. </ss-search-input>
  789. </div>
  790. <div class="panel-list" ref="supervisorList">
  791. <div v-for="person in filteredSupervisors" :key="person.ryid" class="panel-list-item"
  792. draggable="true"
  793. @dragstart="handleDragStart('supervisor', person, $event)"
  794. @dragend="handleDragEnd">
  795. <span>{{ person.xm }}</span>
  796. <span class="panel-item-code">{{ person.displayId }}</span>
  797. </div>
  798. </div>
  799. </div>
  800. </div>
  801. </div>
  802. </div>
  803. <div class='bottom-div'>
  804. <ss-bottom-button text="取消" @click="handleCancel" icon-class="bottom-div-close"></ss-bottom-button>
  805. <ss-bottom-button text="保存" @click="submitForm" icon-class="bottom-div-save"></ss-bottom-button>
  806. </div>
  807. </div>
  808. <script>
  809. /*
  810. * 以下脚本负责考室编排页的所有动态行为:
  811. * - 通过后端接口加载实际数据
  812. * - 通过 Vue 的 data/computed/methods 管理状态、拖拽、校验与保存
  813. */
  814. SS.ready(function () {
  815. window.SS.dom.initializeFormApp({
  816. el: "#app",
  817. data() {
  818. const normalizeStr = (val) => {
  819. if (val === undefined || val === null) return '';
  820. const text = String(val);
  821. return text === 'null' ? '' : text;
  822. };
  823. const initialKsjh = {
  824. ksjhid: normalizeStr("${ksjh.ksjhid}"),
  825. kcid: normalizeStr("${ksjh.kcid}"),
  826. kcmc: normalizeStr("<ss:cbTrans cb='kc' val='${ksjh.kcid}'/>"),
  827. njm: normalizeStr("${ksjh.njm}"),
  828. njmc: normalizeStr("<ss:cbTrans cb='nj' val='${ksjh.njm}'/>"),
  829. xqm: normalizeStr("${ksjh.xqm}"),
  830. xqmc: normalizeStr("<ss:cbTrans cb='xq' val='${ksjh.xqm}'/>"),
  831. rxnd: normalizeStr("${ksjh.rxnd}"),
  832. ssCount: 0,
  833. totalCapacity: 0,
  834. arrangedCount: 0
  835. };
  836. return {
  837. ksjh: initialKsjh,
  838. ksapList: [],
  839. kbpSsList: [],
  840. kbpJkcyList: [],
  841. wbpKscyList: [],
  842. selectedKsapid: '',
  843. panels: {
  844. room: { collapsed: false },
  845. student: { collapsed: false },
  846. supervisor: { collapsed: false }
  847. },
  848. panelHeights: {
  849. room: 260,
  850. student: 280,
  851. supervisor: 240
  852. },
  853. panelOrder: ['room', 'student', 'supervisor'],
  854. resizeState: {
  855. timer: null,
  856. active: false,
  857. pair: null,
  858. startY: 0,
  859. startUpper: 0,
  860. totalHeight: 0
  861. },
  862. searchFilters: {
  863. supervisor: { dept: '', name: '' },
  864. room: { building: '', name: '' },
  865. student: { class: '', name: '' }
  866. },
  867. dragState: { type: '', item: null },
  868. dropIndicators: {
  869. room: false,
  870. supervisor: '',
  871. student: ''
  872. },
  873. newRoomSerial: 1,
  874. loading: false
  875. };
  876. },
  877. // 计算属性用于生成面板列表展示与筛选选项
  878. computed: {
  879. filteredSupervisors() {
  880. const keyword = (this.searchFilters.supervisor.name || '').trim();
  881. const deptFilter = this.normalizeId(this.searchFilters.supervisor.dept);
  882. return this.kbpJkcyList.filter(person => {
  883. if (deptFilter) {
  884. const personDept = this.normalizeId(person.bmid || person.deptId || person.dept);
  885. if (personDept !== deptFilter) {
  886. return false;
  887. }
  888. }
  889. if (!keyword) return true;
  890. const matchName = person.xm && person.xm.includes(keyword);
  891. const matchId = person.displayId && String(person.displayId).includes(keyword);
  892. return matchName || matchId;
  893. });
  894. },
  895. filteredRooms() {
  896. const keyword = (this.searchFilters.room.name || '').trim();
  897. const buildingFilter = this.normalizeId(this.searchFilters.room.building);
  898. return this.kbpSsList.filter(room => {
  899. if (buildingFilter) {
  900. const roomBuilding = this.normalizeId(room.jzwid || room.building);
  901. if (roomBuilding !== buildingFilter) {
  902. return false;
  903. }
  904. }
  905. if (!keyword) return true;
  906. const matchName = room.ssmc && room.ssmc.includes(keyword);
  907. const matchCode = room.jzwid && String(room.jzwid).includes(keyword);
  908. return matchName || matchCode;
  909. });
  910. },
  911. filteredStudents() {
  912. const keyword = (this.searchFilters.student.name || '').trim();
  913. const classFilter = this.normalizeId(this.searchFilters.student.class);
  914. return this.wbpKscyList.filter(student => {
  915. if (classFilter) {
  916. const studentClass = this.normalizeId(student.bjid || student.classId);
  917. if (studentClass !== classFilter) {
  918. return false;
  919. }
  920. }
  921. if (!keyword) return true;
  922. const matchName = student.xm && student.xm.includes(keyword);
  923. const matchId = student.displayId && String(student.displayId).includes(keyword);
  924. return matchName || matchId;
  925. });
  926. },
  927. roomBuildingOptions() {
  928. const set = new Set();
  929. this.kbpSsList.forEach(room => {
  930. if (room.building) set.add(room.building);
  931. });
  932. return Array.from(set);
  933. }
  934. },
  935. // methods 里按功能拆分:交互控制、面板高度、拖拽编排、删除/回流、校验与保存
  936. methods: {
  937. search() {},
  938. fetchInitialData() {
  939. if (!this.ksjh.ksjhid) {
  940. this.updateSummaryStats();
  941. return;
  942. }
  943. const _this = this;
  944. const ksapUrl = "<ss:serv name='ksap_loadArr' parm='{\"wdConfirmationCaptchaService\":\"0\"}'/>";
  945. $.ajax({
  946. url: ksapUrl,
  947. data: { ksjhid: this.ksjh.ksjhid },
  948. async: true,
  949. type: "POST",
  950. dataType: "json",
  951. success(result) {
  952. if (result && result.ssCode === 0 && result.ssData) {
  953. _this.applyServerData(result.ssData);
  954. } else {
  955. alert((result && result.ssMsg) || '数据加载失败');
  956. }
  957. },
  958. error() {
  959. alert('数据加载失败,请稍后重试');
  960. }
  961. });
  962. },
  963. applyServerData(ssData) {
  964. const rooms = Array.isArray(ssData.ksapList) ? ssData.ksapList.map(item => this.normalizeServerRoom(item)) : [];
  965. this.ksapList = rooms;
  966. this.selectedKsapid = rooms.length ? rooms[0].ksapid : '';
  967. this.kbpSsList = Array.isArray(ssData.kbpSsList)
  968. ? ssData.kbpSsList.map(ss => ({
  969. ssid: ss.ssid || ss.cdid || '',
  970. ssmc: ss.ssmc || ss.mc || '',
  971. building: ss.building || '',
  972. capacity: ss.zdrs || ss.rnrs || 0,
  973. jzwid: ss.jzwid || ''
  974. }))
  975. : [];
  976. this.kbpJkcyList = Array.isArray(ssData.kbpJkcyList)
  977. ? ssData.kbpJkcyList.map(person => ({
  978. ...person,
  979. ryid: person.ryid || person.jkryid || person.rybh || '',
  980. xm: person.xm || person.name || '',
  981. displayId: person.ryid || person.rybh || ''
  982. }))
  983. : [];
  984. this.wbpKscyList = Array.isArray(ssData.wbpKscyList)
  985. ? ssData.wbpKscyList.map(student => ({
  986. ...student,
  987. displayId: student.ryh || ''
  988. }))
  989. : [];
  990. this.newRoomSerial = this.ksapList.length + 1;
  991. if (ssData.ksjh) {
  992. this.ksjh = Object.assign({}, this.ksjh, ssData.ksjh);
  993. }
  994. this.updateSummaryStats();
  995. },
  996. normalizeServerRoom(item) {
  997. const monitors = Array.isArray(item.jkcyList) ? item.jkcyList : [];
  998. const students = Array.isArray(item.kscyList) ? item.kscyList : [];
  999. const baseCapacity = item.zdrs || item.capacity || item.rnrs || '';
  1000. return {
  1001. ksapid: item.ksapid || ('xz-' + (this.newRoomSerial++)),
  1002. xh: item.xh || 0,
  1003. dqrs: item.dqrs || students.length,
  1004. zdrs: item.zdrs || baseCapacity || '',
  1005. ssid: item.ssid || item.cdid || '',
  1006. ssmc: item.ssmc || '',
  1007. building: item.building || '',
  1008. defaultCapacity: baseCapacity ? String(baseCapacity) : '',
  1009. zjkry: item.zjkryid ? { ryid: item.zjkryid, xm: item.zjkryxm || '' } : null,
  1010. jkcyList: monitors.map(p => ({
  1011. ryid: p.ryid,
  1012. xm: p.xm,
  1013. displayId: p.ryid || p.rybh || ''
  1014. })),
  1015. kscyList: students.map(s => ({
  1016. ryid: s.ryid,
  1017. xm: s.xm,
  1018. displayId: s.ryh || ''
  1019. })),
  1020. showCapacityAlert: false
  1021. };
  1022. },
  1023. updateSummaryStats() {
  1024. const leftCapacity = this.ksapList.reduce((sum, room) => {
  1025. const cap = Number(room.zdrs || room.defaultCapacity || 0);
  1026. if (Number.isNaN(cap) || cap <= 0) return sum;
  1027. return sum + cap;
  1028. }, 0);
  1029. const rightCapacity = this.kbpSsList.reduce((sum, room) => {
  1030. const cap = Number(room.capacity || room.rnrs || 0);
  1031. if (Number.isNaN(cap) || cap <= 0) return sum;
  1032. return sum + cap;
  1033. }, 0);
  1034. const totalCapacity = leftCapacity + rightCapacity;
  1035. const totalRoomCount = this.ksapList.length + this.kbpSsList.length;
  1036. const arranged = this.ksapList.reduce((sum, room) => sum + (room.kscyList ? room.kscyList.length : 0), 0);
  1037. this.ksjh.ssCount = totalRoomCount;
  1038. this.ksjh.totalCapacity = totalCapacity;
  1039. this.ksjh.arrangedCount = arranged;
  1040. },
  1041. collectAssignedMonitorIds() {
  1042. const ids = [];
  1043. const normalizeId = this.normalizeId;
  1044. this.ksapList.forEach(room => {
  1045. if (room.zjkry && room.zjkry.ryid) {
  1046. ids.push(normalizeId(room.zjkry.ryid));
  1047. }
  1048. room.jkcyList.forEach(p => {
  1049. if (p.ryid) {
  1050. ids.push(normalizeId(p.ryid));
  1051. }
  1052. });
  1053. });
  1054. return ids;
  1055. },
  1056. collectAssignedStudentIds() {
  1057. const ids = [];
  1058. const normalizeId = this.normalizeId;
  1059. this.ksapList.forEach(room => {
  1060. room.kscyList.forEach(s => {
  1061. if (s.ryid) {
  1062. ids.push(normalizeId(s.ryid));
  1063. }
  1064. });
  1065. });
  1066. return ids;
  1067. },
  1068. distributeStudents(studentList) {
  1069. if (!studentList || !studentList.length) return;
  1070. const pending = studentList.slice();
  1071. this.ksapList.forEach(room => {
  1072. const capacity = this.resolveRoomCapacity(room);
  1073. if (!capacity) return;
  1074. while (pending.length && room.kscyList.length < capacity) {
  1075. const student = pending.shift();
  1076. if (!student) break;
  1077. if (student.ryid && this.isStudentAssigned(student.ryid)) {
  1078. continue;
  1079. }
  1080. const normalized = this.normalizeStudentEntry(student);
  1081. room.kscyList.push(normalized);
  1082. }
  1083. room.dqrs = room.kscyList.length;
  1084. });
  1085. this.wbpKscyList = pending;
  1086. this.updateSummaryStats();
  1087. },
  1088. normalizeStudentEntry(student) {
  1089. if (!student) return null;
  1090. return {
  1091. ...student,
  1092. displayId: student.displayId || student.ryh || ''
  1093. };
  1094. },
  1095. resolveRoomCapacity(room) {
  1096. if (!room) return 0;
  1097. let value = Number(room.zdrs);
  1098. if (!value || Number.isNaN(value) || value <= 0) {
  1099. if (room.defaultCapacity) {
  1100. room.zdrs = room.defaultCapacity;
  1101. value = Number(room.zdrs);
  1102. }
  1103. }
  1104. if (!value || Number.isNaN(value) || value <= 0) {
  1105. room.showCapacityAlert = true;
  1106. return 0;
  1107. }
  1108. room.showCapacityAlert = false;
  1109. return value;
  1110. },
  1111. shuffleStudents(list) {
  1112. if (!Array.isArray(list)) return [];
  1113. const arr = list.slice();
  1114. for (let i = arr.length - 1; i > 0; i -= 1) {
  1115. const j = Math.floor(Math.random() * (i + 1));
  1116. const temp = arr[i];
  1117. arr[i] = arr[j];
  1118. arr[j] = temp;
  1119. }
  1120. return arr;
  1121. },
  1122. normalizeId(value) {
  1123. if (value === undefined || value === null) return '';
  1124. return String(value);
  1125. },
  1126. prepareSavePayload() {
  1127. const normalizeId = this.normalizeId;
  1128. return this.ksapList.map((room, index) => {
  1129. const monitorIds = [];
  1130. if (room.zjkry && room.zjkry.ryid) {
  1131. monitorIds.push(normalizeId(room.zjkry.ryid));
  1132. }
  1133. room.jkcyList.forEach(person => {
  1134. if (person.ryid) {
  1135. monitorIds.push(normalizeId(person.ryid));
  1136. }
  1137. });
  1138. const studentIds = room.kscyList
  1139. .map(student => student.ryid)
  1140. .filter(id => !!id)
  1141. .map(id => normalizeId(id));
  1142. return {
  1143. xh: String(index + 1),
  1144. zdrs: String(room.zdrs || ''),
  1145. ssid: normalizeId(room.ssid),
  1146. jkryidList: monitorIds,
  1147. kscyidList: studentIds
  1148. };
  1149. });
  1150. },
  1151. buildConflictMessage(conflictData) {
  1152. if (!conflictData) return '';
  1153. const wrapDetail = (text) => (text ? '(' + text + ')' : '');
  1154. const parts = [];
  1155. (conflictData.jxry || []).forEach(item => {
  1156. parts.push('教师冲突:' + (item.xm || '') + wrapDetail(item.ms));
  1157. });
  1158. (conflictData.jxrc || []).forEach(item => {
  1159. parts.push('教师日程冲突:' + (item.xm || '') + wrapDetail(item.ms));
  1160. });
  1161. (conflictData.jxcd || []).forEach(item => {
  1162. parts.push('场地冲突:' + (item.cdmc || '') + wrapDetail(item.ms));
  1163. });
  1164. return parts.join('\n');
  1165. },
  1166. // 选中左侧卡片,更新高亮状态便于用户确认当前操作对象
  1167. selectRoom(id) {
  1168. this.selectedKsapid = id;
  1169. },
  1170. /* ---------- 拖拽相关逻辑(右侧 → 左侧) ---------- */
  1171. // 统一记录拖拽起点及数据,便于 drop 阶段判断拖拽来源
  1172. handleDragStart(type, item, event) {
  1173. this.dragState = { type, item };
  1174. if (event?.dataTransfer) {
  1175. event.dataTransfer.effectAllowed = 'copyMove';
  1176. event.dataTransfer.setData('text/plain', type);
  1177. }
  1178. },
  1179. // 拖拽结束或取消时统一清理拖拽状态和高亮
  1180. handleDragEnd() {
  1181. this.dragState = { type: '', item: null };
  1182. this.resetDropIndicators();
  1183. },
  1184. // 关闭所有 drop 高亮提示,防止状态残留
  1185. resetDropIndicators() {
  1186. this.dropIndicators.room = false;
  1187. this.dropIndicators.supervisor = '';
  1188. this.dropIndicators.student = '';
  1189. },
  1190. // 课室容器允许投放课室时显示灰色虚线提示
  1191. handleRoomDragOver(event) {
  1192. if (this.dragState?.type === 'room') {
  1193. event.preventDefault();
  1194. if (event?.dataTransfer) {
  1195. event.dataTransfer.dropEffect = 'copy';
  1196. }
  1197. this.dropIndicators.room = true;
  1198. }
  1199. },
  1200. // 鼠标离开容器时即时取消高亮
  1201. handleRoomDragLeave() {
  1202. this.dropIndicators.room = false;
  1203. },
  1204. // 课室拖拽到左侧容器,自动创建考室卡片并滚动到最右侧
  1205. handleRoomDrop() {
  1206. if (!this.dragState || this.dragState.type !== 'room') return;
  1207. this.dropIndicators.room = false;
  1208. const roomData = this.dragState.item || {};
  1209. if (roomData.ssid && this.ksapList.some(room => room.ssid === roomData.ssid)) {
  1210. alert('该课室已在左侧。');
  1211. this.handleDragEnd();
  1212. return;
  1213. }
  1214. const initialCapacity = roomData.capacity || roomData.rnrs || '';
  1215. const newRoom = {
  1216. ksapid: roomData.ksapid || ('xz-' + (this.newRoomSerial++)),
  1217. xh: this.ksapList.length + 1,
  1218. dqrs: 0,
  1219. zdrs: '',
  1220. ssid: roomData.ssid || '',
  1221. ssmc: roomData.ssmc || '新增考室',
  1222. building: roomData.building || '',
  1223. defaultCapacity: initialCapacity === '' ? '' : String(initialCapacity),
  1224. zjkry: null,
  1225. jkcyList: [],
  1226. kscyList: [],
  1227. showCapacityAlert: false
  1228. };
  1229. this.ksapList.push(newRoom);
  1230. if (roomData.ssid) {
  1231. this.kbpSsList = this.kbpSsList.filter(r => r.ssid !== roomData.ssid);
  1232. }
  1233. this.ksjh.ssCount = this.ksapList.length;
  1234. this.updateSummaryStats();
  1235. this.$nextTick(() => this.scrollToLatestRoom());
  1236. this.handleDragEnd();
  1237. },
  1238. // 新增考室后将卡片容器滚动至最右,保证最新卡片可见
  1239. scrollToLatestRoom() {
  1240. const container = this.$refs.leftContent;
  1241. if (container) {
  1242. const maxLeft = Math.max(container.scrollWidth - container.clientWidth, 0);
  1243. container.scrollTo({
  1244. left: maxLeft,
  1245. behavior: 'smooth'
  1246. });
  1247. }
  1248. },
  1249. // 监考区在可投放状态下提示高亮
  1250. handleSupervisorDragOver(room, event) {
  1251. if (this.dragState?.type === 'supervisor') {
  1252. if (event?.dataTransfer) {
  1253. event.dataTransfer.dropEffect = 'copy';
  1254. }
  1255. this.dropIndicators.supervisor = room.ksapid;
  1256. }
  1257. },
  1258. // 拖拽离开监考区时重置高亮
  1259. handleSupervisorDragLeave(room) {
  1260. if (this.dropIndicators.supervisor === room.ksapid) {
  1261. this.dropIndicators.supervisor = '';
  1262. }
  1263. },
  1264. // 监考员拖拽到考室后,若未重复,优先填充主监考,再追加到监考列表
  1265. handleSupervisorDrop(room) {
  1266. if (!this.dragState || this.dragState.type !== 'supervisor') return;
  1267. const person = this.dragState.item;
  1268. if (!person) return;
  1269. if (this.isSupervisorAssigned(person.ryid)) {
  1270. this.handleDragEnd();
  1271. return;
  1272. }
  1273. if (!room.zjkry) {
  1274. room.zjkry = { ...person };
  1275. } else if (!room.jkcyList.some(p => p.ryid === person.ryid)) {
  1276. room.jkcyList.push({ ...person });
  1277. }
  1278. this.kbpJkcyList = this.kbpJkcyList.filter(p => p.ryid !== person.ryid);
  1279. this.dropIndicators.supervisor = '';
  1280. this.handleDragEnd();
  1281. },
  1282. // 考生区在可投放状态下提示高亮
  1283. handleStudentDragOver(room, event) {
  1284. if (this.dragState?.type === 'student') {
  1285. if (event?.dataTransfer) {
  1286. event.dataTransfer.dropEffect = 'copy';
  1287. }
  1288. this.dropIndicators.student = room.ksapid;
  1289. }
  1290. },
  1291. // 拖拽离开考生区时重置高亮
  1292. handleStudentDragLeave(room) {
  1293. if (this.dropIndicators.student === room.ksapid) {
  1294. this.dropIndicators.student = '';
  1295. }
  1296. },
  1297. // 考生拖拽到考室时,验证容量与重复后才允许落入
  1298. handleStudentDrop(room) {
  1299. if (!this.dragState || this.dragState.type !== 'student') return;
  1300. const student = this.dragState.item;
  1301. if (!student) return;
  1302. // Ⅰ. 同一个考生只能存在于一个考室中
  1303. if (this.isStudentAssigned(student.ryid)) {
  1304. this.handleDragEnd();
  1305. return;
  1306. }
  1307. // Ⅱ. 未设置容纳人数时直接拒绝
  1308. if (room.zdrs === '' || room.zdrs === null || room.zdrs === undefined) {
  1309. room.showCapacityAlert = true;
  1310. this.handleDragEnd();
  1311. return;
  1312. }
  1313. const capacity = Number(room.zdrs);
  1314. // Ⅲ. 容纳人数需为正且未超员
  1315. if (Number.isNaN(capacity) || capacity <= 0 || room.kscyList.length >= capacity) {
  1316. if (!capacity || Number.isNaN(capacity) || capacity <= 0) {
  1317. room.showCapacityAlert = true;
  1318. }
  1319. this.handleDragEnd();
  1320. return;
  1321. }
  1322. // Ⅳ. 将考生写入考室列表,并同步右侧未编排列表
  1323. room.kscyList.push({ ...student });
  1324. room.dqrs = room.kscyList.length;
  1325. this.wbpKscyList = this.wbpKscyList.filter(s => s.ryid !== student.ryid);
  1326. this.dropIndicators.student = '';
  1327. this.updateSummaryStats();
  1328. this.handleDragEnd();
  1329. },
  1330. handleCapacityInput(room) {
  1331. const value = Number(room.zdrs);
  1332. if (value && !Number.isNaN(value) && value > 0) {
  1333. room.showCapacityAlert = false;
  1334. }
  1335. },
  1336. /* ---------- 底部按钮:取消 / 保存 ---------- */
  1337. // 点击“取消”按钮时默认回退,若无历史则尝试关闭窗口
  1338. handleCancel() {
  1339. if (window.history?.back) {
  1340. window.history.back();
  1341. } else {
  1342. window.close?.();
  1343. }
  1344. },
  1345. // 点击“保存”按钮:先校验,后输出格式化数据
  1346. submitForm() {
  1347. if (!this.validateBeforeSubmit()) return;
  1348. if (!this.ksjh.ksjhid) {
  1349. alert('缺少考试计划信息,无法保存');
  1350. return;
  1351. }
  1352. const payload = this.prepareSavePayload();
  1353. const monitorIds = this.collectAssignedMonitorIds();
  1354. const ssIds = payload.map(item => item.ssid).filter(id => !!id);
  1355. const checkUrl = "<ss:serv name='ksap_chkArr' parm='{\"wdConfirmationCaptchaService\":\"0\"}'/>";
  1356. const _this = this;
  1357. $.ajax({
  1358. url: checkUrl,
  1359. data: {
  1360. ksjhid: this.ksjh.ksjhid,
  1361. allJxry: monitorIds.join(','),
  1362. allSs: ssIds.join(',')
  1363. },
  1364. type: "POST",
  1365. dataType: "json",
  1366. success(result) {
  1367. const message = _this.buildConflictMessage(result);
  1368. if (message) {
  1369. if (confirm('发现冲突:\n' + message + '\n是否继续保存?')) {
  1370. _this.savePayload(payload);
  1371. }
  1372. } else {
  1373. _this.savePayload(payload);
  1374. }
  1375. },
  1376. error() {
  1377. alert('保存前校验失败,请稍后重试');
  1378. }
  1379. });
  1380. },
  1381. // 保存前统一校验:课室、主监考、容量、人员重复等
  1382. validateBeforeSubmit() {
  1383. const errors = [];
  1384. const monitorIds = new Set();
  1385. const studentIds = new Set();
  1386. this.ksapList.forEach((room, idx) => {
  1387. const label = room.ssmc || ('第' + (idx + 1) + '间考室');
  1388. const capacity = Number(room.zdrs);
  1389. if (!room.ssid) {
  1390. errors.push(label + ' 未选择课室。');
  1391. }
  1392. if (!room.zjkry) {
  1393. errors.push(label + ' 需要至少一名主监考。');
  1394. }
  1395. if (!room.zdrs || Number.isNaN(capacity) || capacity <= 0) {
  1396. errors.push(label + ' 的容纳人数必须为大于 0 的数字。');
  1397. } else {
  1398. if (room.kscyList.length === 0) {
  1399. errors.push(label + ' 至少需要分配 1 名考生。');
  1400. }
  1401. if (room.kscyList.length > capacity) {
  1402. errors.push(label + ' 的考生数量超过容纳人数。');
  1403. }
  1404. }
  1405. if (room.zjkry) {
  1406. if (monitorIds.has(room.zjkry.ryid)) {
  1407. errors.push(room.zjkry.xm + ' 被重复分配。');
  1408. } else {
  1409. monitorIds.add(room.zjkry.ryid);
  1410. }
  1411. }
  1412. room.jkcyList.forEach(person => {
  1413. if (monitorIds.has(person.ryid)) {
  1414. errors.push(person.xm + ' 被重复分配。');
  1415. } else {
  1416. monitorIds.add(person.ryid);
  1417. }
  1418. });
  1419. room.kscyList.forEach(student => {
  1420. if (studentIds.has(student.ryid)) {
  1421. errors.push(student.xm + ' 被重复分配。');
  1422. } else {
  1423. studentIds.add(student.ryid);
  1424. }
  1425. });
  1426. });
  1427. if (errors.length) {
  1428. alert(errors.join('\n'));
  1429. return false;
  1430. }
  1431. return true;
  1432. },
  1433. savePayload(payload) {
  1434. const saveUrl = "<ss:serv name='ksap_saveArr' parm='{\"wdConfirmationCaptchaService\":\"0\"}'/>";
  1435. const _this = this;
  1436. $.ajax({
  1437. url: saveUrl,
  1438. data: {
  1439. "requestParentViewObject":"ksjh",
  1440. ksjhid: this.ksjh.ksjhid,
  1441. ksapList: JSON.stringify(payload)
  1442. },
  1443. type: "POST",
  1444. dataType: "json",
  1445. success(result) {
  1446. if (result && (result.flag === true || result.flag === "true")) {
  1447. alert(result.msg || '保存成功');
  1448. _this.fetchInitialData();
  1449. } else {
  1450. alert((result && result.msg) || '保存失败');
  1451. }
  1452. },
  1453. error() {
  1454. alert('保存失败,请稍后重试');
  1455. }
  1456. });
  1457. },
  1458. // 判断监考员是否已在任一考室中,避免重复
  1459. isSupervisorAssigned(ryid) {
  1460. return this.ksapList.some(room => {
  1461. if (room.zjkry && room.zjkry.ryid === ryid) return true;
  1462. return room.jkcyList.some(p => p.ryid === ryid);
  1463. });
  1464. },
  1465. // 判断考生是否已在任一考室中,避免重复
  1466. isStudentAssigned(ryid) {
  1467. return this.ksapList.some(room =>
  1468. room.kscyList.some(s => s.ryid === ryid)
  1469. );
  1470. },
  1471. // 删除整张考室卡片时,课室/监考/考生三类资源全部退回右侧
  1472. deleteRoom(room) {
  1473. if (confirm('确定要删除该考室吗?')) {
  1474. if (room.zjkry) {
  1475. if (!this.kbpJkcyList.some(p => p.ryid === room.zjkry.ryid)) {
  1476. this.kbpJkcyList.push({ ...room.zjkry });
  1477. }
  1478. }
  1479. room.jkcyList.forEach(p => {
  1480. if (!this.kbpJkcyList.some(item => item.ryid === p.ryid)) {
  1481. this.kbpJkcyList.push({ ...p });
  1482. }
  1483. });
  1484. room.kscyList.forEach(s => {
  1485. if (!this.wbpKscyList.some(item => item.ryid === s.ryid)) {
  1486. this.wbpKscyList.push({ ...s });
  1487. }
  1488. });
  1489. if (room.ssid) {
  1490. const exists = this.kbpSsList.find(r => r.ssid === room.ssid);
  1491. if (!exists) {
  1492. this.kbpSsList.push({
  1493. ssid: room.ssid,
  1494. ssmc: room.ssmc,
  1495. building: room.building || '',
  1496. capacity: room.zdrs
  1497. });
  1498. }
  1499. }
  1500. const index = this.ksapList.findIndex(r => r.ksapid === room.ksapid);
  1501. if (index > -1) this.ksapList.splice(index, 1);
  1502. this.ksjh.ssCount = this.ksapList.length;
  1503. this.updateSummaryStats();
  1504. }
  1505. },
  1506. // 从考室中移除监考,顺便放回右侧待选列
  1507. removeSupervisor(room, person) {
  1508. if (room.zjkry && room.zjkry.ryid === person.ryid) {
  1509. room.zjkry = null;
  1510. } else {
  1511. const index = room.jkcyList.findIndex(p => p.ryid === person.ryid);
  1512. if (index > -1) room.jkcyList.splice(index, 1);
  1513. }
  1514. if (!this.kbpJkcyList.some(p => p.ryid === person.ryid)) {
  1515. this.kbpJkcyList.push({ ...person });
  1516. }
  1517. },
  1518. // 从考室中移除考生,顺便放回右侧待编排列表
  1519. removeStudent(room, student) {
  1520. const index = room.kscyList.findIndex(s => s.ryid === student.ryid);
  1521. if (index > -1) {
  1522. room.kscyList.splice(index, 1);
  1523. room.dqrs = room.kscyList.length;
  1524. }
  1525. if (!this.wbpKscyList.some(s => s.ryid === student.ryid)) {
  1526. this.wbpKscyList.push({ ...student });
  1527. }
  1528. this.updateSummaryStats();
  1529. },
  1530. // 折叠/展开右侧面板,同时保持高度分布
  1531. togglePanel(type) {
  1532. this.panels[type].collapsed = !this.panels[type].collapsed;
  1533. if (!this.panels[type].collapsed) {
  1534. const minHeight = this.getPanelMinHeight(type);
  1535. this.panelHeights[type] = Math.max(this.panelHeights[type] || minHeight, minHeight);
  1536. }
  1537. this.normalizePanelHeights();
  1538. },
  1539. // 根据折叠状态返回对应的箭头图标类名
  1540. getPanelToggleIcon(type) {
  1541. return this.panels[type].collapsed ? 'common-icon-arrow-bottom' : 'common-icon-arrow-top';
  1542. },
  1543. getPanelBodyStyle(type) {
  1544. const height = this.panels[type].collapsed ? 0 : this.panelHeights[type];
  1545. return {
  1546. height: String(height) + 'px'
  1547. };
  1548. },
  1549. // 长按面板标题后开启高度拖拽功能,配合延迟防止误触
  1550. handlePanelPress(type, event) {
  1551. if ((event.button !== 0 && event.button !== undefined) || this.resizeState.active) return;
  1552. const pair = this.getResizePair(type);
  1553. if (!pair) return;
  1554. event.preventDefault();
  1555. this.cancelResizeTimer();
  1556. const startY = event.clientY;
  1557. this.resizeState.timer = setTimeout(() => {
  1558. this.startPanelResize(pair, startY);
  1559. }, 250);
  1560. },
  1561. // 鼠标提前抬起时取消进入拖拽状态
  1562. handlePanelRelease() {
  1563. if (!this.resizeState.active) {
  1564. this.cancelResizeTimer();
  1565. }
  1566. },
  1567. // 真正进入拖拽时记录初始高度,以便后续计算
  1568. startPanelResize(pair, startY) {
  1569. const { upper, lower } = pair;
  1570. if (this.panels[upper].collapsed || this.panels[lower].collapsed) return;
  1571. this.resizeState.active = true;
  1572. this.resizeState.pair = pair;
  1573. this.resizeState.startY = startY;
  1574. this.resizeState.startUpper = this.panelHeights[upper];
  1575. this.resizeState.totalHeight = this.panelHeights[upper] + this.panelHeights[lower];
  1576. document.addEventListener('mousemove', this.onPanelMouseMove);
  1577. document.addEventListener('mouseup', this.onDocumentMouseUp);
  1578. },
  1579. // 拖拽过程中动态更新上下两个面板高度,保持总高度不变
  1580. onPanelMouseMove(event) {
  1581. if (!this.resizeState.active || !this.resizeState.pair) return;
  1582. const delta = event.clientY - this.resizeState.startY;
  1583. const { upper, lower } = this.resizeState.pair;
  1584. const minUpper = this.getPanelMinHeight(upper);
  1585. const minLower = this.getPanelMinHeight(lower);
  1586. const total = this.resizeState.totalHeight;
  1587. let nextUpper = this.resizeState.startUpper + delta;
  1588. const maxUpper = total - minLower;
  1589. nextUpper = Math.min(Math.max(nextUpper, minUpper), maxUpper);
  1590. const nextLower = total - nextUpper;
  1591. this.panelHeights[upper] = nextUpper;
  1592. this.panelHeights[lower] = nextLower;
  1593. },
  1594. // 鼠标抬起后收尾:停止监听并重置拖拽状态
  1595. onDocumentMouseUp() {
  1596. if (this.resizeState.active) {
  1597. this.stopPanelResize();
  1598. } else {
  1599. this.cancelResizeTimer();
  1600. }
  1601. },
  1602. stopPanelResize() {
  1603. document.removeEventListener('mousemove', this.onPanelMouseMove);
  1604. document.removeEventListener('mouseup', this.onDocumentMouseUp);
  1605. this.resizeState.active = false;
  1606. this.resizeState.pair = null;
  1607. this.resizeState.startY = 0;
  1608. this.resizeState.startUpper = 0;
  1609. this.resizeState.totalHeight = 0;
  1610. this.cancelResizeTimer();
  1611. },
  1612. // 清理长按定时器,防止普通点击也触发拖拽
  1613. cancelResizeTimer() {
  1614. if (this.resizeState.timer) {
  1615. clearTimeout(this.resizeState.timer);
  1616. this.resizeState.timer = null;
  1617. }
  1618. },
  1619. // 判断某个面板当前是否处于“被拖拽”的状态,用于控制提示图标
  1620. isResizing(type) {
  1621. return this.resizeState.active && this.resizeState.pair && this.resizeState.pair.lower === type;
  1622. },
  1623. // 计算面板最小高度:至少展示搜索区域+一行列表
  1624. getPanelMinHeight(type) {
  1625. const search = this.getRefEl(type + 'Search');
  1626. const list = this.getRefEl(type + 'List');
  1627. const searchHeight = search ? search.offsetHeight : 0;
  1628. let listHeight = 0;
  1629. if (list) {
  1630. const firstItem = list.querySelector('.panel-list-item');
  1631. if (firstItem && this.getPanelDataLength(type) > 0) {
  1632. listHeight = firstItem.offsetHeight;
  1633. }
  1634. }
  1635. const base = searchHeight + listHeight + 24;
  1636. return Math.max(base, 120);
  1637. },
  1638. // 提供给高度约束逻辑,用来判断某面板当前列表数据条数
  1639. getPanelDataLength(type) {
  1640. if (type === 'room') return this.filteredRooms.length;
  1641. if (type === 'student') return this.filteredStudents.length;
  1642. if (type === 'supervisor') return this.filteredSupervisors.length;
  1643. return 0;
  1644. },
  1645. // 折叠/展开后重新按比例分配高度,保持用户调整后的整体比例
  1646. normalizePanelHeights() {
  1647. if (this.resizeState.active) return;
  1648. this.$nextTick(() => {
  1649. this.updatePanelHeightsToContainer();
  1650. });
  1651. },
  1652. // 根据容器总高度、面板最小高度,重新计算可用空间分配
  1653. updatePanelHeightsToContainer() {
  1654. const container = this.$refs.rightPanel;
  1655. if (!container) return;
  1656. const visiblePanels = this.panelOrder.filter(type => !this.panels[type].collapsed);
  1657. if (!visiblePanels.length) return;
  1658. const headersHeight = this.getHeadersHeight();
  1659. const available = container.clientHeight - headersHeight;
  1660. if (available <= 0) return;
  1661. const ratioBase = visiblePanels.reduce((sum, type) => sum + (this.panelHeights[type] || 1), 0) || visiblePanels.length;
  1662. let remaining = available;
  1663. const newHeights = {};
  1664. visiblePanels.forEach(type => {
  1665. const min = this.getPanelMinHeight(type);
  1666. newHeights[type] = min;
  1667. remaining -= min;
  1668. });
  1669. if (remaining < 0) {
  1670. remaining = 0;
  1671. }
  1672. visiblePanels.forEach(type => {
  1673. const ratio = ratioBase ? (this.panelHeights[type] || 1) / ratioBase : 1 / visiblePanels.length;
  1674. const extra = remaining * ratio;
  1675. newHeights[type] += extra;
  1676. });
  1677. visiblePanels.forEach(type => {
  1678. this.panelHeights[type] = newHeights[type];
  1679. });
  1680. },
  1681. // 统计所有面板标题栏高度,用于扣除后计算剩余内容高度
  1682. getHeadersHeight() {
  1683. return this.panelOrder.reduce((sum, type) => {
  1684. const header = this.getRefEl(type + 'Header');
  1685. return sum + (header ? header.offsetHeight : 0);
  1686. }, 0);
  1687. },
  1688. // 自动填充考生:调用后端自动编排接口或使用本地候选列表
  1689. autoArrange() {
  1690. if (!this.ksapList.length) {
  1691. alert('请先添加考室');
  1692. return;
  1693. }
  1694. if (!this.ksjh.ksjhid) {
  1695. alert('缺少考试计划信息,无法自动编排');
  1696. return;
  1697. }
  1698. if (!this.wbpKscyList.length) {
  1699. return;
  1700. }
  1701. const randomized = this.shuffleStudents(this.wbpKscyList);
  1702. this.distributeStudents(randomized);
  1703. },
  1704. // 离开页面前统一卸载事件并重置状态,避免内存泄漏
  1705. cleanupResizeListeners() {
  1706. document.removeEventListener('mousemove', this.onPanelMouseMove);
  1707. document.removeEventListener('mouseup', this.onDocumentMouseUp);
  1708. this.cancelResizeTimer();
  1709. this.resizeState.active = false;
  1710. this.resizeState.pair = null;
  1711. this.resizeState.startY = 0;
  1712. this.resizeState.startUpper = 0;
  1713. this.resizeState.totalHeight = 0;
  1714. if (this.$_panelResizeHandler) {
  1715. window.removeEventListener('resize', this.$_panelResizeHandler);
  1716. this.$_panelResizeHandler = null;
  1717. }
  1718. },
  1719. // 兼容模板中 ref 可能成数组的情况,统一获取原生 DOM
  1720. getRefEl(name) {
  1721. const el = this.$refs[name];
  1722. if (Array.isArray(el)) {
  1723. return el[0] || null;
  1724. }
  1725. return el || null;
  1726. },
  1727. // 根据面板类型找到其上一个未折叠的面板,组成拖拽调整的上下组合
  1728. getResizePair(type) {
  1729. if (this.panels[type].collapsed) return null;
  1730. const idx = this.panelOrder.indexOf(type);
  1731. if (idx === -1) return null;
  1732. const upper = this.getPrevExpandedPanel(idx - 1);
  1733. if (!upper) return null;
  1734. return { upper, lower: type };
  1735. },
  1736. getPrevExpandedPanel(fromIndex) {
  1737. for (let i = fromIndex; i >= 0; i -= 1) {
  1738. const candidate = this.panelOrder[i];
  1739. if (!this.panels[candidate].collapsed) {
  1740. return candidate;
  1741. }
  1742. }
  1743. return null;
  1744. },
  1745. // 判断某面板是否允许被上下拖拽(上方需有展开的面板)
  1746. canResize(type) {
  1747. if (this.panels[type].collapsed) return false;
  1748. const idx = this.panelOrder.indexOf(type);
  1749. if (idx <= 0) return false;
  1750. return !!this.getPrevExpandedPanel(idx - 1);
  1751. }
  1752. },
  1753. beforeUnmount() {
  1754. this.cleanupResizeListeners();
  1755. },
  1756. beforeDestroy() {
  1757. this.cleanupResizeListeners();
  1758. },
  1759. mounted() {
  1760. console.log('UI Refreshed', this.$data);
  1761. // 进入页面后立即根据容器高度分配三块面板的初始高度
  1762. this.normalizePanelHeights();
  1763. // 监听窗口尺寸变化,保持右侧面板高度自适应
  1764. this.$_panelResizeHandler = () => this.normalizePanelHeights();
  1765. window.addEventListener('resize', this.$_panelResizeHandler);
  1766. this.fetchInitialData();
  1767. }
  1768. });
  1769. });
  1770. </script>
  1771. </body>
  1772. </html>