mp_objInfo.html 5.2 KB

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