mp_objInfo.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta
  6. name="viewport"
  7. content="width=device-width, initial-scale=1.0, user-scalable=no"
  8. />
  9. <title></title>
  10. <script src="/js/mp_base/base.js?v=20261127-auth-refresh-v1"></script>
  11. <style>
  12. #app {
  13. background: #f5f5f5;
  14. min-height: 100vh;
  15. display: flex;
  16. flex-direction: column;
  17. }
  18. /* 单 Tab 的查看页(如学校违纪、风纪仪容)隐藏顶部“基本情况”标签栏 */
  19. #app.hide-sub-tab-bar .ss-sub-tab__bar {
  20. display: none !important;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <div id="app" v-cloak>
  26. <!-- 使用 ss-sub-tab 组件 -->
  27. <ss-sub-tab
  28. v-if="tabList.length > 0"
  29. :tab-list="tabList"
  30. :active-index="0"
  31. :base-params="baseParams"
  32. @tab-change="handleTabChange"
  33. />
  34. </div>
  35. <script>
  36. // 等待SS框架加载完成
  37. window.SS.ready(function () {
  38. // 使用SS框架的方式创建Vue实例
  39. window.SS.dom.initializeFormApp({
  40. el: "#app",
  41. data() {
  42. return {
  43. pageParams: {},
  44. loading: false,
  45. tabList: [], // tabTag接口返回的Tab列表
  46. baseParams: {}, // 基础参数(传递给子页面)
  47. };
  48. },
  49. computed: {
  50. // 学校违纪、风纪仪容的查看页只有一个“基本情况”页签,隐藏标签栏只保留内容
  51. hideSubTabBar() {
  52. const objName = String(
  53. this.baseParams.ssObjName ||
  54. this.pageParams.ssObjName ||
  55. ""
  56. ).trim();
  57. const singleTabObjects = ["xxwjjl", "fjyrjc"];
  58. return (
  59. singleTabObjects.includes(objName) &&
  60. this.tabList.length <= 1
  61. );
  62. },
  63. },
  64. watch: {
  65. // 挂载元素自身的 :class 不会被 Vue 编译,这里直接切换 #app 上的 class
  66. hideSubTabBar: {
  67. immediate: true,
  68. handler(val) {
  69. const el = document.getElementById("app");
  70. if (el) {
  71. el.classList.toggle("hide-sub-tab-bar", !!val);
  72. }
  73. },
  74. },
  75. },
  76. mounted() {
  77. // 获取URL参数
  78. this.pageParams = this.getUrlParams();
  79. console.log("🔗 mp_objInfo页面接收到参数:", this.pageParams);
  80. const infoService =
  81. this.pageParams.service || this.pageParams.ssServ || "";
  82. const infoDest =
  83. this.pageParams.dest || this.pageParams.ssDest || "";
  84. const infoParam = this.pageParams.param || "";
  85. // 设置基础参数(会传递给所有子页面)
  86. this.baseParams = {
  87. ssObjName:
  88. this.pageParams.ssObjName || this.pageParams.ssobjname || "",
  89. ssObjId: this.pageParams.ssObjId || this.pageParams.ssobjid || "",
  90. sqid: this.pageParams.sqid || "",
  91. shid: this.pageParams.shid || "",
  92. shyjm: this.pageParams.shyjm || "",
  93. bdlbm: this.pageParams.bdlbm || "",
  94. dataType:
  95. this.pageParams.dataType ||
  96. this.pageParams.datatype ||
  97. "bdplay",
  98. encode_shid: this.pageParams.encode_shid || "",
  99. jdmc: this.pageParams.jdmc || "",
  100. ssToken: this.pageParams.ssToken || "",
  101. service: infoService,
  102. dest: infoDest,
  103. param: infoParam,
  104. parm: infoParam,
  105. ssServ: infoService,
  106. ssDest: infoDest,
  107. };
  108. console.log("📦 mp_objInfo透传基础参数:", this.baseParams);
  109. // 联调模式:不校验入参,始终尝试调用tabTag
  110. this.loadTag();
  111. },
  112. methods: {
  113. // 获取URL参数
  114. getUrlParams() {
  115. const params = {};
  116. const urlSearchParams = new URLSearchParams(
  117. window.location.search
  118. );
  119. for (const [key, value] of urlSearchParams) {
  120. params[key] = decodeURIComponent(value);
  121. }
  122. return params;
  123. },
  124. // 加载Tab列表
  125. async loadTag() {
  126. this.loading = true;
  127. try {
  128. console.log("📋 调用tabTag服务获取Tab列表...");
  129. const { ssObjName, ssObjId, sqid, shid, service, dest, param } =
  130. this.baseParams;
  131. const tagQuery = new URLSearchParams({
  132. ssServ: "tabTag",
  133. ssDest: "data",
  134. name: "baseInfo,child",
  135. ssObjName: ssObjName || "",
  136. ssObjId: ssObjId || "",
  137. sqid: sqid || "",
  138. shid: shid || "",
  139. service: service || "",
  140. dest: dest || "",
  141. param: param || "",
  142. });
  143. const tagUrl = `/service?${tagQuery.toString()}`;
  144. console.log("📋 tabTag请求URL:", tagUrl);
  145. const tagResponse = await request.post(
  146. tagUrl,
  147. {},
  148. { loading: false, formData: true }
  149. );
  150. console.log("📋 tabTag响应:", tagResponse);
  151. // 保存Tab列表
  152. if (
  153. tagResponse &&
  154. tagResponse.data &&
  155. tagResponse.data.tabList
  156. ) {
  157. this.tabList = tagResponse.data.tabList;
  158. console.log("✅ 获取到Tab列表:", this.tabList);
  159. } else {
  160. console.warn("⚠️ tabTag响应中没有tabList字段", {
  161. service,
  162. dest,
  163. param,
  164. tagResponse,
  165. });
  166. }
  167. } catch (error) {
  168. console.error("❌ 加载Tab数据失败:", error);
  169. } finally {
  170. this.loading = false;
  171. }
  172. },
  173. // Tab切换事件处理
  174. handleTabChange({ index, tab }) {
  175. console.log("📑 切换到Tab:", index, tab.desc || tab.title);
  176. },
  177. },
  178. });
  179. });
  180. </script>
  181. </body>
  182. </html>