mp_fjjc_detail.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8"/>
  5. <meta name="viewport"
  6. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  7. <title>风纪检查详情</title>
  8. <script src="/js/mp_base/base.js?v=20261127-auth-refresh-v1"></script>
  9. <style>
  10. [v-cloak] { display: none !important; }
  11. :root {
  12. --line: #e5e7eb;
  13. --text: #222;
  14. --muted: #8b95a5;
  15. --green: #222222;
  16. --danger: #e5484d;
  17. }
  18. * { box-sizing: border-box; }
  19. body {
  20. margin: 0;
  21. color: var(--text);
  22. background: #f3f4f6;
  23. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
  24. "Microsoft YaHei", sans-serif;
  25. }
  26. #app { min-height: 100vh; }
  27. .loading-container {
  28. display: flex;
  29. min-height: 65vh;
  30. align-items: center;
  31. justify-content: center;
  32. color: var(--muted);
  33. font-size: 14px;
  34. }
  35. .loading-spinner {
  36. width: 34px;
  37. height: 34px;
  38. margin-right: 10px;
  39. border: 4px solid #e6e8ec;
  40. border-top-color: var(--green);
  41. border-radius: 50%;
  42. animation: spin .9s linear infinite;
  43. }
  44. @keyframes spin { to { transform: rotate(360deg); } }
  45. .page-content { padding: 12px 14px 18px; }
  46. .error-box {
  47. margin: 12px 14px;
  48. padding: 11px 12px;
  49. color: var(--danger);
  50. background: #fff0f0;
  51. border: 1px solid #ffd0d0;
  52. border-radius: 6px;
  53. font-size: 14px;
  54. }
  55. .form-table, .section-card {
  56. overflow: hidden;
  57. margin-bottom: 12px;
  58. background: #fff;
  59. border: 1px solid var(--line);
  60. border-radius: 6px;
  61. }
  62. .form-row {
  63. display: grid;
  64. grid-template-columns: 96px minmax(0, 1fr);
  65. min-height: 52px;
  66. border-bottom: 1px solid var(--line);
  67. }
  68. .form-row:last-child { border-bottom: 0; }
  69. .form-label {
  70. display: flex;
  71. align-items: center;
  72. justify-content: flex-end;
  73. padding: 10px 12px;
  74. color: var(--muted);
  75. background: #fbfbfc;
  76. border-right: 1px solid var(--line);
  77. font-size: 14px;
  78. }
  79. .form-value {
  80. display: flex;
  81. min-width: 0;
  82. align-items: center;
  83. padding: 10px 12px;
  84. font-size: 14px;
  85. line-height: 1.45;
  86. word-break: break-all;
  87. }
  88. .section-head {
  89. display: flex;
  90. min-height: 46px;
  91. align-items: center;
  92. justify-content: space-between;
  93. padding: 0 13px;
  94. color: #3c4a61;
  95. background: #fbfbfc;
  96. border-bottom: 1px solid var(--line);
  97. font-size: 15px;
  98. font-weight: 600;
  99. }
  100. .section-count { color: var(--muted); font-size: 13px; font-weight: 400; }
  101. .class-row { border-bottom: 1px solid var(--line); }
  102. .class-row:last-child { border-bottom: 0; }
  103. .class-title {
  104. display: flex;
  105. min-height: 48px;
  106. align-items: center;
  107. justify-content: space-between;
  108. gap: 10px;
  109. padding: 10px 13px;
  110. font-size: 15px;
  111. font-weight: 600;
  112. }
  113. .result-no { color: var(--green); font-size: 13px; font-weight: 400; }
  114. .result-yes { color: var(--danger); font-size: 13px; font-weight: 400; }
  115. .violation-list { padding: 0 13px 10px; }
  116. .violation-item {
  117. padding: 10px 12px;
  118. background: #f8f9fa;
  119. border: 1px solid #eceef1;
  120. border-radius: 5px;
  121. }
  122. .violation-item + .violation-item { margin-top: 8px; }
  123. .violation-name { font-size: 14px; line-height: 1.45; }
  124. .violation-meta {
  125. margin-top: 5px;
  126. color: var(--muted);
  127. font-size: 13px;
  128. line-height: 1.5;
  129. }
  130. .violation-score { color: var(--danger); }
  131. .empty-violation { padding: 0 13px 12px; color: var(--muted); font-size: 13px; }
  132. .empty-state { padding: 50px 20px; color: #999; text-align: center; }
  133. </style>
  134. </head>
  135. <body>
  136. <div id="app" v-cloak>
  137. <div v-if="loading" class="loading-container">
  138. <div class="loading-spinner"></div><span>加载中...</span>
  139. </div>
  140. <div v-else-if="errorMsg" class="error-box">{{ errorMsg }}</div>
  141. <template v-else-if="record">
  142. <div class="page-content">
  143. <div class="form-table">
  144. <div class="form-row"><div class="form-label">检查时间</div><div class="form-value">{{ record.jcsj }}</div></div>
  145. <div class="form-row"><div class="form-label">检查类型</div><div class="form-value">{{ record.fjlxmc }}</div></div>
  146. <div class="form-row"><div class="form-label">责任部门</div><div class="form-value">{{ record.bmmc }}</div></div>
  147. <div class="form-row"><div class="form-label">检查人员</div><div class="form-value">{{ record.jcryxm }}</div></div>
  148. <div class="form-row"><div class="form-label">状态</div><div class="form-value">{{ record.statusName }}</div></div>
  149. <div class="form-row"><div class="form-label">检查班级</div><div class="form-value">{{ record.classCount }} 个</div></div>
  150. <div class="form-row"><div class="form-label">违纪人数</div><div class="form-value">{{ record.violationCount }} 人</div></div>
  151. <div class="form-row"><div class="form-label">扣分合计</div><div class="form-value">{{ formatScore(record.jfkf) }}</div></div>
  152. <div class="form-row"><div class="form-label">检查说明</div><div class="form-value">{{ record.ms || '' }}</div></div>
  153. </div>
  154. <div class="section-card">
  155. <div class="section-head">
  156. <span>班级检查结果</span>
  157. <span class="section-count">{{ classList.length }} 个班级</span>
  158. </div>
  159. <div v-if="!classList.length" class="empty-state">暂无班级检查结果</div>
  160. <div v-for="item in classList" :key="item.xjb_fjjcmxid" class="class-row">
  161. <div class="class-title">
  162. <span>{{ item.bjmc }}</span>
  163. <span :class="item.wjrs > 0 ? 'result-yes' : 'result-no'">{{ item.jcjgmc }}</span>
  164. </div>
  165. <div v-if="item.violations && item.violations.length" class="violation-list">
  166. <div v-for="row in item.violations" :key="row.wjjlid" class="violation-item">
  167. <div class="violation-name">
  168. {{ row.wjlbmc }}<span v-if="row.xm"> · {{ row.xm }}</span>
  169. </div>
  170. <div class="violation-meta">
  171. <span>{{ row.wjsj }}</span>
  172. <span v-if="Number(row.bjfk) > 0" class="violation-score"> 扣 {{ formatScore(row.bjfk) }} 分</span>
  173. </div>
  174. <div v-if="row.ms" class="violation-meta">{{ row.ms }}</div>
  175. </div>
  176. </div>
  177. <div v-else class="empty-violation">已检查,无违纪</div>
  178. </div>
  179. </div>
  180. </div>
  181. </template>
  182. </div>
  183. <script>
  184. const PLAY_SERV = "fjjc_mpPlay";
  185. window.SS.ready(function () {
  186. window.SS.dom.initializeFormApp({
  187. el: "#app",
  188. data() {
  189. return {
  190. loading: true,
  191. errorMsg: "",
  192. record: null,
  193. classList: []
  194. };
  195. },
  196. async mounted() {
  197. if (!(await this.ensureSession()))
  198. return;
  199. await this.loadDetail();
  200. },
  201. methods: {
  202. getRequest() {
  203. return window.request || (typeof request !== "undefined" ? request : null);
  204. },
  205. getRecordId() {
  206. try {
  207. return new URLSearchParams(window.location.search).get("xjb_fjjcid") || "";
  208. } catch (_) {
  209. return "";
  210. }
  211. },
  212. async ensureSession() {
  213. if (typeof window.ensureMiniProgramSessionFresh !== "function")
  214. return true;
  215. try {
  216. await window.ensureMiniProgramSessionFresh({
  217. page: "mp_fjjc_detail",
  218. service: PLAY_SERV,
  219. force: true
  220. });
  221. return true;
  222. } catch (error) {
  223. this.errorMsg = error && error.message
  224. ? error.message
  225. : "登录状态刷新失败,请返回小程序重新进入";
  226. this.loading = false;
  227. return false;
  228. }
  229. },
  230. async postService(url, data) {
  231. const req = this.getRequest();
  232. if (!req || typeof req.post !== "function")
  233. throw new Error("请求组件未加载");
  234. const response = await req.post(url, data, {loading: false, formData: true});
  235. const raw = response && response.data !== undefined ? response.data : response;
  236. if (raw && raw.ssCode !== undefined && Number(raw.ssCode) !== 0)
  237. throw new Error(raw.ssMsg || "请求失败");
  238. return raw && raw.ssData !== undefined ? raw.ssData : raw;
  239. },
  240. async loadDetail() {
  241. const id = this.getRecordId();
  242. if (!id) {
  243. this.errorMsg = "风纪检查记录编号为空";
  244. this.loading = false;
  245. return;
  246. }
  247. try {
  248. const data = await this.postService(
  249. `/service?ssServ=${PLAY_SERV}&ssDest=data`,
  250. {xjb_fjjcid: id}
  251. ) || {};
  252. this.record = data.record || null;
  253. this.classList = Array.isArray(data.classList) ? data.classList : [];
  254. if (!this.record)
  255. this.errorMsg = "风纪检查记录不存在或已不可查看";
  256. } catch (error) {
  257. this.errorMsg = error && error.message
  258. ? error.message
  259. : "风纪检查详情加载失败";
  260. } finally {
  261. this.loading = false;
  262. }
  263. },
  264. formatScore(value) {
  265. const number = Number(value);
  266. if (!Number.isFinite(number))
  267. return "0";
  268. return String(Math.round(number * 100) / 100);
  269. }
  270. }
  271. });
  272. });
  273. </script>
  274. </body>
  275. </html>