mp_fjyrjc_inp.html 12 KB

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