mp_objInfo.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. </style>
  19. </head>
  20. <body>
  21. <div id="app" v-cloak>
  22. <!-- 使用 ss-sub-tab 组件 -->
  23. <ss-sub-tab
  24. v-if="tabList.length > 0"
  25. :tab-list="tabList"
  26. :active-index="0"
  27. :base-params="baseParams"
  28. @tab-change="handleTabChange"
  29. />
  30. </div>
  31. <script>
  32. // 等待SS框架加载完成
  33. window.SS.ready(function () {
  34. // 使用SS框架的方式创建Vue实例
  35. window.SS.dom.initializeFormApp({
  36. el: "#app",
  37. data() {
  38. return {
  39. pageParams: {},
  40. loading: false,
  41. tabList: [], // tabTag接口返回的Tab列表
  42. baseParams: {}, // 基础参数(传递给子页面)
  43. };
  44. },
  45. mounted() {
  46. // 获取URL参数
  47. this.pageParams = this.getUrlParams();
  48. console.log("🔗 mp_objInfo页面接收到参数:", this.pageParams);
  49. const infoService =
  50. this.pageParams.service || this.pageParams.ssServ || "";
  51. const infoDest =
  52. this.pageParams.dest || this.pageParams.ssDest || "";
  53. const infoParam = this.pageParams.param || "";
  54. // 设置基础参数(会传递给所有子页面)
  55. this.baseParams = {
  56. ssObjName:
  57. this.pageParams.ssObjName || this.pageParams.ssobjname || "",
  58. ssObjId: this.pageParams.ssObjId || this.pageParams.ssobjid || "",
  59. sqid: this.pageParams.sqid || "",
  60. shid: this.pageParams.shid || "",
  61. shyjm: this.pageParams.shyjm || "",
  62. bdlbm: this.pageParams.bdlbm || "",
  63. dataType:
  64. this.pageParams.dataType ||
  65. this.pageParams.datatype ||
  66. "bdplay",
  67. encode_shid: this.pageParams.encode_shid || "",
  68. jdmc: this.pageParams.jdmc || "",
  69. ssToken: this.pageParams.ssToken || "",
  70. service: infoService,
  71. dest: infoDest,
  72. param: infoParam,
  73. parm: infoParam,
  74. ssServ: infoService,
  75. ssDest: infoDest,
  76. };
  77. console.log("📦 mp_objInfo透传基础参数:", this.baseParams);
  78. // 联调模式:不校验入参,始终尝试调用tabTag
  79. this.loadTag();
  80. },
  81. methods: {
  82. // 获取URL参数
  83. getUrlParams() {
  84. const params = {};
  85. const urlSearchParams = new URLSearchParams(
  86. window.location.search
  87. );
  88. for (const [key, value] of urlSearchParams) {
  89. params[key] = decodeURIComponent(value);
  90. }
  91. return params;
  92. },
  93. // 加载Tab列表
  94. async loadTag() {
  95. this.loading = true;
  96. try {
  97. console.log("📋 调用tabTag服务获取Tab列表...");
  98. const { ssObjName, ssObjId, sqid, shid, service, dest, param } =
  99. this.baseParams;
  100. const tagQuery = new URLSearchParams({
  101. ssServ: "tabTag",
  102. ssDest: "data",
  103. name: "baseInfo,child",
  104. ssObjName: ssObjName || "",
  105. ssObjId: ssObjId || "",
  106. sqid: sqid || "",
  107. shid: shid || "",
  108. service: service || "",
  109. dest: dest || "",
  110. param: param || "",
  111. });
  112. const tagUrl = `/service?${tagQuery.toString()}`;
  113. console.log("📋 tabTag请求URL:", tagUrl);
  114. const tagResponse = await request.post(
  115. tagUrl,
  116. {},
  117. { loading: false, formData: true }
  118. );
  119. console.log("📋 tabTag响应:", tagResponse);
  120. // 保存Tab列表
  121. if (
  122. tagResponse &&
  123. tagResponse.data &&
  124. tagResponse.data.tabList
  125. ) {
  126. this.tabList = tagResponse.data.tabList;
  127. console.log("✅ 获取到Tab列表:", this.tabList);
  128. } else {
  129. console.warn("⚠️ tabTag响应中没有tabList字段", {
  130. service,
  131. dest,
  132. param,
  133. tagResponse,
  134. });
  135. }
  136. } catch (error) {
  137. console.error("❌ 加载Tab数据失败:", error);
  138. } finally {
  139. this.loading = false;
  140. }
  141. },
  142. // Tab切换事件处理
  143. handleTabChange({ index, tab }) {
  144. console.log("📑 切换到Tab:", index, tab.desc || tab.title);
  145. },
  146. },
  147. });
  148. });
  149. </script>
  150. </body>
  151. </html>