mp_xsh_baseInfo.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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"></script>
  9. <style>
  10. [v-cloak] { display: none !important; }
  11. :root { --line: #e5e7eb; --text: #222; --muted: #8b95a5; }
  12. * { box-sizing: border-box; }
  13. body { margin: 0; color: var(--text); background: #f5f5f5;
  14. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
  15. "Microsoft YaHei", sans-serif; }
  16. #app { min-height: 100vh; padding: 8px; }
  17. .loading, .error { padding: 48px 16px; text-align: center;
  18. color: var(--muted); font-size: 14px; }
  19. .error { color: #e5484d; }
  20. .form-table { overflow: hidden; background: #fff; border-radius: 6px;
  21. border: 1px solid var(--line); }
  22. .form-row { display: grid; grid-template-columns: 112px minmax(0, 1fr);
  23. border-bottom: 1px solid var(--line); }
  24. .form-row:last-child { border-bottom: 0; }
  25. .form-label { padding: 12px; color: var(--muted); background: #fbfbfc;
  26. border-right: 1px solid var(--line); text-align: center; font-size: 15px; }
  27. .form-value { min-width: 0; padding: 12px; white-space: pre-wrap;
  28. word-break: break-all; line-height: 1.55; font-size: 15px; }
  29. .description-cell { position: relative; min-height: 110px; }
  30. .description-text { min-height: 110px; padding: 0 76px 0 0; }
  31. .pms-attachment-button { position: absolute; top: 0; right: 0; bottom: 0;
  32. width: 64px; display: flex; align-items: center; justify-content: center;
  33. flex-direction: column; gap: 5px; color: #666; background: #f0f0f0;
  34. border: 0; border-left: 1px solid #ddd; border-radius: 0;
  35. font: inherit; font-size: 13px; }
  36. .pms-attachment-button:disabled { color: #aaa; background: #f5f5f5; }
  37. .pms-attachment-button .common-icon { font-size: 18px; }
  38. .attachment-modal { position: fixed; z-index: 9999; inset: 0;
  39. display: flex; flex-direction: column; background: #fff; }
  40. .attachment-modal-head { display: flex; height: 48px; align-items: center;
  41. justify-content: space-between; padding: 0 14px;
  42. border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 700; }
  43. .attachment-close { padding: 8px 4px 8px 14px; color: #19a463;
  44. background: transparent; border: 0; font: inherit; font-size: 15px; }
  45. .attachment-frame { flex: 1; width: 100%; border: 0; }
  46. </style>
  47. </head>
  48. <body>
  49. <div id="app" v-cloak>
  50. <div v-if="loading" class="loading">加载中...</div>
  51. <div v-else-if="error" class="error">{{ error }}</div>
  52. <template v-else>
  53. <div class="form-table">
  54. <div class="form-row"><div class="form-label">名称</div><div class="form-value">{{ data.mc || '-' }}</div></div>
  55. <div class="form-row"><div class="form-label">类别</div><div class="form-value">{{ data.ttlbmc || data.ttlbm || '-' }}</div></div>
  56. <div class="form-row"><div class="form-label">负责人员</div><div class="form-value">{{ data.fzrymc || data.fzryid || '-' }}</div></div>
  57. <div class="form-row"><div class="form-label">负责部门</div><div class="form-value">{{ data.fzbmmc || data.fzbmid || '-' }}</div></div>
  58. <div class="form-row"><div class="form-label">生效日期</div><div class="form-value">{{ data.ksrq || '-' }}</div></div>
  59. <div class="form-row"><div class="form-label">结束日期</div><div class="form-value">{{ data.jsrq || '-' }}</div></div>
  60. <div class="form-row"><div class="form-label">学年</div><div class="form-value">{{ data.xndm || '-' }}</div></div>
  61. <div class="form-row"><div class="form-label">描述</div><div class="form-value">
  62. <div class="description-cell">
  63. <div class="description-text">{{ data.ms || '-' }}</div>
  64. <button class="pms-attachment-button" type="button"
  65. :disabled="!data.fjid || attachmentLoading"
  66. :aria-label="'附件'"
  67. @click="openAttachment">
  68. <ss-common-icon class="common-icon-paper-clip"></ss-common-icon>
  69. <span>{{ attachmentLoading ? '处理中' : '附件' }}</span>
  70. </button>
  71. </div>
  72. </div></div>
  73. </div>
  74. </template>
  75. <div v-if="attachmentVisible" class="attachment-modal">
  76. <div class="attachment-modal-head">
  77. <span>附件管理</span>
  78. <button class="attachment-close" type="button" @click="attachmentVisible=false">关闭</button>
  79. </div>
  80. <iframe class="attachment-frame" :src="attachmentUrl"></iframe>
  81. </div>
  82. </div>
  83. <script>
  84. window.SS.ready(function () {
  85. window.SS.dom.initializeFormApp({
  86. el: "#app",
  87. data() {
  88. return {
  89. loading: true,
  90. error: "",
  91. data: {},
  92. attachmentVisible: false,
  93. attachmentLoading: false,
  94. attachmentUrl: "",
  95. pageParams: {}
  96. };
  97. },
  98. async mounted() {
  99. this.pageParams = this.getUrlParams();
  100. await this.loadData();
  101. },
  102. methods: {
  103. getUrlParams() {
  104. const params = {};
  105. new URLSearchParams(window.location.search).forEach((value, key) => {
  106. try { params[key] = decodeURIComponent(value); }
  107. catch (_) { params[key] = value; }
  108. });
  109. return params;
  110. },
  111. parseParamObject(raw) {
  112. if (!raw) return {};
  113. if (typeof raw === "object") return raw;
  114. try { return JSON.parse(raw); } catch (_) {
  115. try {
  116. return JSON.parse(String(raw)
  117. .replace(/([{,]\s*)([A-Za-z0-9_]+)\s*:/g, '$1"$2":')
  118. .replace(/'/g, '"'));
  119. } catch (__) { return {}; }
  120. }
  121. },
  122. async loadData() {
  123. const param = this.parseParamObject(this.pageParams.param);
  124. const ttid = String(param.ttid || param.ssObjId ||
  125. this.pageParams.ttid || this.pageParams.ssObjId || "").trim();
  126. if (!ttid) {
  127. this.error = "缺少团体ID";
  128. this.loading = false;
  129. return;
  130. }
  131. try {
  132. const req = window.request;
  133. const response = await req.post(
  134. "/service?ssServ=xsh_mpDetail&ssDest=data",
  135. {ttid, ssObjName: "xsh", ssObjId: ttid},
  136. {loading: false, formData: true});
  137. const raw = response && response.data !== undefined
  138. ? response.data : response;
  139. if (raw && raw.ssCode !== undefined && Number(raw.ssCode) !== 0)
  140. throw new Error(raw.ssMsg || "加载失败");
  141. this.data = raw && raw.ssData !== undefined ? raw.ssData : (raw || {});
  142. } catch (error) {
  143. this.error = "加载失败:" + (error.message || "未知错误");
  144. } finally {
  145. this.loading = false;
  146. }
  147. },
  148. async openAttachment() {
  149. if (!this.data.fjid || this.attachmentLoading) return;
  150. this.attachmentLoading = true;
  151. try {
  152. const fjid = encodeURIComponent(this.data.fjid);
  153. this.attachmentUrl =
  154. "/service?ssServ=regCms&ssDest=cmsPlay&wdConfirmationCaptchaService=0"
  155. + "&nrid=T-" + fjid + "&objectId=" + fjid
  156. + "&objectName=fjid&jlztm=null";
  157. this.attachmentVisible = true;
  158. } finally {
  159. this.attachmentLoading = false;
  160. }
  161. }
  162. }
  163. });
  164. });
  165. </script>
  166. </body>
  167. </html>