mp_fjyrjc_inp.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <!DOCTYPE html>
  2. <!-- 平台移动端录入壳按 /page/mp_<对象>_inp.html 查找本页。 -->
  3. <html lang="zh-CN">
  4. <head>
  5. <meta charset="UTF-8"/>
  6. <meta name="viewport"
  7. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  8. <title>登记风纪仪容检查</title>
  9. <script src="/js/mp_base/base.js?v=20261127-auth-refresh-v1"></script>
  10. <style>
  11. [v-cloak] { display: none !important; }
  12. :root {
  13. --line: #e5e7eb;
  14. --text: #222;
  15. --muted: #8b95a5;
  16. --green: #222222;
  17. --danger: #e5484d;
  18. --danger-soft: #fff0f0;
  19. }
  20. * { box-sizing: border-box; }
  21. body {
  22. margin: 0;
  23. color: var(--text);
  24. background: #f3f4f6;
  25. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
  26. "Microsoft YaHei", sans-serif;
  27. }
  28. #app { min-height: 100vh; }
  29. .loading-container {
  30. display: flex;
  31. min-height: 65vh;
  32. align-items: center;
  33. justify-content: center;
  34. color: var(--muted);
  35. font-size: 14px;
  36. }
  37. .loading-spinner {
  38. width: 38px;
  39. height: 38px;
  40. margin-right: 10px;
  41. border: 4px solid #e6e8ec;
  42. border-top-color: var(--green);
  43. border-radius: 50%;
  44. animation: spin .9s linear infinite;
  45. }
  46. @keyframes spin { to { transform: rotate(360deg); } }
  47. .error-box,
  48. .submit-hint {
  49. margin: 12px 14px 0;
  50. padding: 12px;
  51. border-radius: 6px;
  52. line-height: 1.55;
  53. font-size: 14px;
  54. }
  55. .error-box,
  56. .submit-hint {
  57. color: var(--danger);
  58. background: var(--danger-soft);
  59. border: 1px solid #ffd0d0;
  60. }
  61. .page-content { padding: 12px 14px 16px; }
  62. .form-table {
  63. overflow: hidden;
  64. background: #fff;
  65. border: 1px solid var(--line);
  66. border-radius: 6px;
  67. }
  68. .form-row {
  69. position: relative;
  70. display: grid;
  71. grid-template-columns: 92px minmax(0, 1fr);
  72. min-height: 58px;
  73. border-bottom: 1px solid var(--line);
  74. }
  75. .form-row.required::before {
  76. content: "";
  77. position: absolute;
  78. left: 92px;
  79. top: 0;
  80. bottom: 0;
  81. width: 2px;
  82. background: #ff3b30;
  83. z-index: 1;
  84. }
  85. .form-row:last-child { border-bottom: 0; }
  86. .form-label {
  87. display: flex;
  88. align-items: center;
  89. justify-content: flex-end;
  90. padding: 12px;
  91. color: var(--muted);
  92. background: #fbfbfc;
  93. border-right: 1px solid var(--line);
  94. font-size: 15px;
  95. }
  96. .form-value {
  97. display: flex;
  98. align-items: center;
  99. min-width: 0;
  100. padding: 10px 12px;
  101. font-size: 15px;
  102. }
  103. .select-cell,
  104. .select-cell > .ss-select-container { width: 100%; min-width: 0; }
  105. .native-textarea {
  106. width: 100%;
  107. min-height: 100px;
  108. padding: 10px 0;
  109. color: var(--text);
  110. background: #fff;
  111. border: 0;
  112. outline: none;
  113. resize: vertical;
  114. font: inherit;
  115. font-size: 15px;
  116. }
  117. .native-textarea::placeholder { color: #b4bbc6; }
  118. .description-row .form-value { padding: 0; align-items: stretch; }
  119. .description-cell {
  120. position: relative;
  121. width: 100%;
  122. min-height: 110px;
  123. }
  124. .description-cell .native-textarea {
  125. min-height: 110px;
  126. padding: 12px 76px 12px 12px;
  127. }
  128. .pms-attachment-button {
  129. position: absolute;
  130. top: 0;
  131. right: 0;
  132. bottom: 0;
  133. width: 64px;
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. flex-direction: column;
  138. gap: 5px;
  139. padding: 0;
  140. color: #666;
  141. background: #f0f0f0;
  142. border: 0;
  143. border-left: 1px solid #ddd;
  144. border-radius: 0;
  145. font: inherit;
  146. font-size: 13px;
  147. cursor: pointer;
  148. z-index: 1;
  149. }
  150. .pms-attachment-button:disabled { color: #aaa; background: #f5f5f5; }
  151. .pms-attachment-button .common-icon { font-size: 18px; }
  152. .attachment-modal {
  153. position: fixed;
  154. z-index: 9999;
  155. inset: 0;
  156. display: flex;
  157. flex-direction: column;
  158. background: #fff;
  159. }
  160. .attachment-modal-head {
  161. display: flex;
  162. height: 48px;
  163. align-items: center;
  164. justify-content: space-between;
  165. padding: 0 14px;
  166. border-bottom: 1px solid var(--line);
  167. font-size: 16px;
  168. font-weight: 700;
  169. }
  170. .attachment-close {
  171. padding: 8px 4px 8px 14px;
  172. color: var(--green);
  173. background: transparent;
  174. border: 0;
  175. font: inherit;
  176. font-size: 15px;
  177. }
  178. .attachment-frame { flex: 1; width: 100%; border: 0; }
  179. </style>
  180. </head>
  181. <body>
  182. <div id="app" v-cloak>
  183. <div v-if="loading" class="loading-container">
  184. <div class="loading-spinner"></div><span>加载中...</span>
  185. </div>
  186. <template v-else>
  187. <div v-if="errorMsg" class="error-box">{{ errorMsg }}</div>
  188. <div v-if="submitHint" class="submit-hint">{{ submitHint }}</div>
  189. <div class="page-content">
  190. <div class="form-table">
  191. <div class="form-row required">
  192. <div class="form-label">班级</div>
  193. <div class="form-value">
  194. <div class="select-cell">
  195. <ss-select
  196. v-model="form.bjid"
  197. cb="bj"
  198. placeholder=""
  199. empty-option
  200. searchable
  201. clearable
  202. @change="onClassChange"
  203. />
  204. </div>
  205. </div>
  206. </div>
  207. <div class="form-row required">
  208. <div class="form-label">学员</div>
  209. <div class="form-value">
  210. <div class="select-cell">
  211. <ss-select
  212. :key="'student-' + form.bjid"
  213. v-model="form.fzryid"
  214. :cb="form.bjid ? 'xyByBj' : ''"
  215. :filter="{bjid: form.bjid}"
  216. :disabled="!form.bjid"
  217. placeholder=""
  218. empty-option
  219. searchable
  220. clearable
  221. />
  222. </div>
  223. </div>
  224. </div>
  225. <div class="form-row required">
  226. <div class="form-label">违纪类别</div>
  227. <div class="form-value">
  228. <div class="select-cell">
  229. <ss-select
  230. v-model="form.wjlbm"
  231. cb="fjyrwjlb"
  232. placeholder=""
  233. empty-option
  234. searchable
  235. clearable
  236. />
  237. </div>
  238. </div>
  239. </div>
  240. <div class="form-row">
  241. <div class="form-label">违纪时间</div>
  242. <div class="form-value">
  243. <div class="select-cell">
  244. <ss-datetime-picker
  245. v-model="form.wjsj"
  246. mode="datetime"
  247. min-date="2020-01-01"
  248. max-date="2035-12-31"
  249. placeholder="请选择违纪时间"
  250. />
  251. </div>
  252. </div>
  253. </div>
  254. <div class="form-row description-row">
  255. <div class="form-label">描述</div>
  256. <div class="form-value">
  257. <div class="description-cell">
  258. <textarea
  259. v-model="form.ms"
  260. class="native-textarea"
  261. maxlength="500"
  262. placeholder=""
  263. ></textarea>
  264. <button class="pms-attachment-button" type="button"
  265. :disabled="attachmentLoading"
  266. :aria-label="form.fjid ? '管理附件' : '添加附件'"
  267. @click="openAttachment">
  268. <ss-common-icon class="common-icon-paper-clip"></ss-common-icon>
  269. <span>{{ attachmentLoading ? '处理中' : '附件' }}</span>
  270. </button>
  271. </div>
  272. </div>
  273. </div>
  274. </div>
  275. </div>
  276. <div v-if="attachmentVisible" class="attachment-modal">
  277. <div class="attachment-modal-head">
  278. <span>附件管理</span>
  279. <button class="attachment-close" type="button" @click="closeAttachment">关闭</button>
  280. </div>
  281. <iframe class="attachment-frame" :src="attachmentUrl"></iframe>
  282. </div>
  283. </template>
  284. </div>
  285. <script>
  286. window.SS.ready(function () {
  287. window.SS.dom.initializeFormApp({
  288. el: "#app",
  289. data() {
  290. const params = new URLSearchParams(window.location.search);
  291. return {
  292. loading: false,
  293. errorMsg: "",
  294. submitHint: "",
  295. attachmentVisible: false,
  296. attachmentLoading: false,
  297. attachmentUrl: "",
  298. form: {
  299. wjxzm: 1,
  300. wjsj: params.get("wjsj") || "",
  301. bjid: params.get("bjid") || "",
  302. fzryid: params.get("fzryid") || "",
  303. wjlbm: params.get("wjlbm") || "",
  304. ms: params.get("ms") || "",
  305. fjid: params.get("fjid") || ""
  306. }
  307. };
  308. },
  309. async mounted() {
  310. if (!this.form.wjsj)
  311. this.form.wjsj = this.formatNow();
  312. window.__mpObjInpGetFormData = () => {
  313. const form = this.form;
  314. let message = "";
  315. if (!form.wjsj) message = "请选择违纪时间";
  316. else if (!form.bjid) message = "请选择班级";
  317. else if (!form.fzryid) message = "请选择学员";
  318. else if (!form.wjlbm) message = "请选择违纪类别";
  319. return {
  320. valid: !message,
  321. message,
  322. data: {
  323. wjxzm: 1,
  324. wjsj: form.wjsj,
  325. bjid: form.bjid,
  326. fzryid: form.fzryid,
  327. wjlbm: form.wjlbm,
  328. ms: String(form.ms || "").trim(),
  329. fjid: form.fjid
  330. }
  331. };
  332. };
  333. this.loading = true;
  334. try {
  335. if (typeof window.ensureMiniProgramSessionFresh === "function") {
  336. await window.ensureMiniProgramSessionFresh({
  337. page: "mp_fjyrjc_inp",
  338. service: "fjyrjc_lr_zj",
  339. force: true
  340. });
  341. }
  342. } catch (error) {
  343. this.errorMsg = error && error.message
  344. ? error.message
  345. : "登录状态刷新失败";
  346. } finally {
  347. this.loading = false;
  348. }
  349. },
  350. beforeUnmount() {
  351. try {
  352. delete window.__mpObjInpGetFormData;
  353. } catch (_) {}
  354. },
  355. methods: {
  356. getRequest() {
  357. return window.request || (typeof request !== "undefined" ? request : null);
  358. },
  359. onClassChange() {
  360. this.form.fzryid = "";
  361. },
  362. async openAttachment() {
  363. if (this.attachmentLoading) return;
  364. this.attachmentLoading = true;
  365. try {
  366. if (!this.form.fjid) {
  367. const req = this.getRequest();
  368. if (!req || typeof req.post !== "function") throw new Error("请求组件未加载");
  369. const response = await req.post(
  370. "/service?ssServ=makeAttCms&wdConfirmationCaptchaService=0",
  371. {name: "fjid", ssNrObjName: "fjyrjc", ssNrObjId: ""},
  372. {loading: false, formData: true}
  373. );
  374. const raw = response && response.data !== undefined ? response.data : response;
  375. const candidate = raw && typeof raw === "object"
  376. ? (raw.data ?? raw.ssData ?? raw.result)
  377. : raw;
  378. const fjid = String(candidate == null ? "" : candidate).trim();
  379. if (!/^\d+$/.test(fjid)) throw new Error("附件初始化失败");
  380. this.form.fjid = fjid;
  381. }
  382. const query = "&nrid=T-" + encodeURIComponent(this.form.fjid)
  383. + "&objectId=" + encodeURIComponent(this.form.fjid)
  384. + "&objectName=fjid&mode=edit&callback=";
  385. this.attachmentUrl =
  386. "/service?ssServ=regCms&ssDest=cmsEdit&wdConfirmationCaptchaService=0" + query;
  387. this.attachmentVisible = true;
  388. } catch (error) {
  389. this.showToast(error.message || "附件初始化失败", "fail");
  390. } finally {
  391. this.attachmentLoading = false;
  392. }
  393. },
  394. closeAttachment() {
  395. this.attachmentVisible = false;
  396. },
  397. formatNow() {
  398. const d = new Date();
  399. const pad = v => String(v).padStart(2, "0");
  400. return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-"
  401. + pad(d.getDate()) + " " + pad(d.getHours()) + ":"
  402. + pad(d.getMinutes()) + ":" + pad(d.getSeconds());
  403. },
  404. showToast(message, type) {
  405. const toastType = type === "success" ? "success" : "error";
  406. if (window.wx && window.wx.miniProgram && window.wx.miniProgram.showToast) {
  407. window.wx.miniProgram.showToast({title: message, icon: toastType});
  408. } else if (window.SS && window.SS.dom && window.SS.dom.showToast) {
  409. window.SS.dom.showToast({message, type: toastType});
  410. }
  411. }
  412. }
  413. });
  414. });
  415. </script>
  416. </body>
  417. </html>