| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8" />
- <meta
- name="viewport"
- content="width=device-width, initial-scale=1.0, user-scalable=no"
- />
- <title>变动情况 1</title>
- <script src="/js/mp_base/base.js"></script>
- <style>
- [v-cloak] {
- display: none !important;
- }
- #app {
- background: #f5f5f5;
- min-height: 100vh;
- }
- /* 新增变动情况页纯转圈加载态 by xu 2026-03-06 */
- .loading {
- min-height: 40vh;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 32px 16px;
- }
- .loading-spinner {
- width: 30px;
- height: 30px;
- border: 3px solid #e8f3ed;
- border-top-color: #40ac6d;
- border-radius: 50%;
- animation: page-spin 0.9s linear infinite;
- }
- @keyframes page-spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
- }
- .status-wrap {
- padding: 16px;
- }
- .status-card {
- background: #fff;
- border-radius: 8px;
- padding: 16px;
- box-sizing: border-box;
- }
- .status-title {
- font-size: 15px;
- font-weight: 600;
- color: #2d3748;
- }
- .status-text {
- margin-top: 8px;
- line-height: 1.6;
- color: #4a5568;
- font-size: 13px;
- word-break: break-all;
- }
- .status-retry {
- margin-top: 12px;
- height: 34px;
- padding: 0 14px;
- border: none;
- border-radius: 4px;
- background: #4a5568;
- color: #fff;
- font-size: 13px;
- }
- .ss-sub-tab {
- min-height: 100vh;
- }
- .ss-sub-tab__content {
- background: #fff;
- }
- .ss-sub-tab__content iframe {
- width: 100%;
- min-height: calc(100vh - 56px);
- }
- /* 变动页签页补充 URL 调试浮层,便于打开和复制当前地址 by xu 2026-03-08 */
- .url-log-fab {
- position: fixed;
- right: 12px;
- bottom: 72px;
- z-index: 1200;
- border: none;
- border-radius: 16px;
- background: rgba(36, 40, 53, 0.88);
- color: #fff;
- font-size: 12px;
- line-height: 1;
- padding: 8px 10px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
- }
- .url-log-panel {
- position: fixed;
- left: 12px;
- right: 12px;
- bottom: 116px;
- z-index: 1200;
- background: rgba(36, 40, 53, 0.96);
- color: #fff;
- border-radius: 8px;
- padding: 10px;
- max-height: 42vh;
- overflow: auto;
- box-sizing: border-box;
- }
- .url-log-panel__head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 8px;
- font-size: 12px;
- }
- .url-log-panel__close {
- border: none;
- background: transparent;
- color: #fff;
- font-size: 14px;
- line-height: 1;
- }
- .url-log-panel__actions {
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
- margin-bottom: 8px;
- }
- .url-log-action {
- border: none;
- border-radius: 4px;
- padding: 5px 10px;
- font-size: 12px;
- color: #fff;
- background: rgba(255, 255, 255, 0.16);
- }
- .url-log-panel__body {
- margin: 0;
- white-space: pre-wrap;
- word-break: break-all;
- font-size: 12px;
- line-height: 1.5;
- }
- </style>
- </head>
- <body>
- <div id="app" v-cloak>
- <!-- 新增变动情况页纯转圈加载态 by xu 2026-03-06 -->
- <div v-if="loading" class="loading">
- <div class="loading-spinner"></div>
- </div>
- <div v-else-if="error" class="status-wrap">
- <div class="status-card">
- <div class="status-title">页面加载失败</div>
- <div class="status-text">{{ error }}</div>
- <button class="status-retry" type="button" @click="loadTabList">
- 重新加载
- </button>
- </div>
- </div>
- <div v-else-if="!tabList.length" class="status-wrap">
- <div class="status-card">
- <div class="status-title">暂无变动页签</div>
- <div class="status-text">当前接口未返回可展示的页签数据。</div>
- </div>
- </div>
- <!-- 新增变动情况子页 Tab 承接 by xu 2026-03-06 -->
- <ss-sub-tab
- v-else
- :tab-list="tabList"
- :base-params="baseParams"
- @tab-change="handleTabChange"
- />
- <!-- 变动页签页补充 URL 调试入口,便于打开和复制当前地址 by xu 2026-03-08 -->
- <button class="url-log-fab" type="button" @click="showCurrentUrls">
- URL
- </button>
- <div class="url-log-panel" v-if="urlLogVisible">
- <div class="url-log-panel__head">
- <span>当前 URL</span>
- <div>
- <button class="url-log-action" type="button" @click="showCurrentUrls">显示当前 URL</button>
- <button class="url-log-panel__close" type="button" @click="urlLogVisible = false">
- ×
- </button>
- </div>
- </div>
- <div class="url-log-panel__actions">
- <button class="url-log-action" type="button" @click="openCurrentUrl('page')">打开页面</button>
- <button class="url-log-action" type="button" @click="copyCurrentUrl('page')">复制页面</button>
- <button class="url-log-action" type="button" @click="openCurrentUrl('tab')">打开Tab</button>
- <button class="url-log-action" type="button" @click="copyCurrentUrl('tab')">复制Tab</button>
- </div>
- <pre class="url-log-panel__body">{{ urlLogText }}</pre>
- </div>
- </div>
- <script>
- window.SS.ready(function () {
- window.SS.dom.initializeFormApp({
- el: "#app",
- data() {
- return {
- pageParams: {},
- loading: false,
- error: "",
- tabList: [],
- baseParams: {},
- urlLogVisible: false,
- urlLogText: '',
- currentPageUrl: '',
- currentTabUrl: '',
- };
- },
- mounted() {
- this.pageParams = this.getUrlParams();
- this.loadTabList();
- },
- methods: {
- getUrlParams() {
- const params = {};
- const aliasMap = {
- ssobjname: "ssObjName",
- ssobjid: "ssObjId",
- datatype: "dataType",
- };
- const urlSearchParams = new URLSearchParams(
- window.location.search
- );
- for (const [rawKey, rawValue] of urlSearchParams) {
- const decodedValue = this.safeDecode(rawValue);
- params[rawKey] = decodedValue;
- const normalizedKey = aliasMap[String(rawKey).toLowerCase()];
- if (normalizedKey) {
- params[normalizedKey] = decodedValue;
- }
- }
- return params;
- },
- safeDecode(text) {
- if (text === undefined || text === null || text === "") return "";
- try {
- return decodeURIComponent(String(text));
- } catch (_) {
- return String(text);
- }
- },
- parseParamObject(paramStr) {
- if (!paramStr) return {};
- if (typeof paramStr === "object") return paramStr;
- try {
- return JSON.parse(paramStr);
- } catch (_) {
- try {
- const fixed = String(paramStr)
- .replace(/([{,]\s*)([A-Za-z0-9_]+)\s*:/g, '$1"$2":')
- .replace(/'/g, '"');
- return JSON.parse(fixed);
- } catch (error) {
- console.error("解析param失败:", error);
- return {};
- }
- }
- },
- buildBaseParams(serviceName, destName, paramText) {
- return {
- sqid: this.pageParams.sqid || "",
- shid: this.pageParams.shid || "",
- shyjm: this.pageParams.shyjm || "",
- bdlbm: this.pageParams.bdlbm || "",
- dataType: this.pageParams.dataType || this.pageParams.datatype || "bdplay",
- encode_shid: this.pageParams.encode_shid || "",
- ssObjName: this.pageParams.ssObjName || this.pageParams.ssobjname || "",
- ssObjId: this.pageParams.ssObjId || this.pageParams.ssobjid || "",
- jdmc: this.pageParams.jdmc || "",
- service: serviceName,
- dest: destName,
- ssServ: serviceName,
- ssDest: destName,
- param: paramText,
- };
- },
- pickTabList(data) {
- if (!data) return [];
- if (Array.isArray(data.tabList)) return data.tabList;
- if (data.data && Array.isArray(data.data.tabList)) return data.data.tabList;
- if (data.chgList && Array.isArray(data.chgList.tabList)) return data.chgList.tabList;
- if (Array.isArray(data.tabs)) return data.tabs;
- return [];
- },
- async loadTabList() {
- // 按 chgChkTab 规则加载变动子页签数据 by xu 2026-03-06
- this.loading = true;
- this.error = "";
- this.tabList = [];
- try {
- const serviceName = String(
- this.pageParams.service || this.pageParams.ssServ || "selChgInfo"
- ).trim();
- const destName = String(
- this.pageParams.dest || this.pageParams.ssDest || "chgList"
- ).trim();
- const paramObj = this.parseParamObject(this.pageParams.param);
- const requestData = {
- ...paramObj,
- };
- const appendIfMissing = (targetKey, sourceKeys) => {
- if (
- requestData[targetKey] !== undefined &&
- requestData[targetKey] !== null &&
- requestData[targetKey] !== ""
- ) {
- return;
- }
- for (let i = 0; i < sourceKeys.length; i += 1) {
- const value = this.pageParams[sourceKeys[i]];
- if (value !== undefined && value !== null && value !== "") {
- requestData[targetKey] = value;
- return;
- }
- }
- };
- appendIfMissing("sqid", ["sqid"]);
- appendIfMissing("shid", ["shid"]);
- appendIfMissing("ssObjName", ["ssObjName", "ssobjname"]);
- appendIfMissing("ssObjId", ["ssObjId", "ssobjid"]);
- appendIfMissing("bdlbm", ["bdlbm"]);
- appendIfMissing("dataType", ["dataType", "datatype"]);
- appendIfMissing("encode_shid", ["encode_shid"]);
- appendIfMissing("jdmc", ["jdmc"]);
- appendIfMissing("ssToken", ["ssToken"]);
- const response = await request.post(
- `/service?ssServ=${encodeURIComponent(
- serviceName
- )}&ssDest=${encodeURIComponent(destName)}`,
- requestData,
- { loading: false, formData: true }
- );
- const responseData = response && response.data ? response.data : response;
- this.tabList = this.pickTabList(responseData);
- this.baseParams = this.buildBaseParams(
- serviceName,
- destName,
- typeof this.pageParams.param === "string"
- ? this.pageParams.param
- : JSON.stringify(requestData || {})
- );
- // 新增变动页签单页兜底 by xu 2026-03-06
- if (!this.tabList.length && destName) {
- this.tabList = [
- {
- desc: '变动详情',
- title: '变动详情',
- service: serviceName,
- dest: destName,
- param: typeof this.pageParams.param === "string"
- ? this.pageParams.param
- : JSON.stringify(requestData || {}),
- },
- ];
- }
- if (!this.tabList.length) {
- console.warn("[mp_chgChgchk] 未获取到tabList:", responseData);
- }
- } catch (error) {
- console.error("加载变动情况页签失败:", error);
- this.error = (error && error.message) || "加载失败,请稍后重试";
- } finally {
- this.loading = false;
- }
- },
- getCurrentTabIframeSrc() {
- const frame = document.querySelector('.ss-sub-tab__content iframe');
- return (frame && frame.src) || '';
- },
- getCurrentUrlMap() {
- return {
- page: window.location.href,
- tab: this.getCurrentTabIframeSrc(),
- };
- },
- // 功能说明:变动页签页补充“显示当前 URL”按钮,并直接展示 page/tab 文本 by xu 2026-03-08
- showCurrentUrls() {
- const currentUrls = this.getCurrentUrlMap();
- this.currentPageUrl = currentUrls.page || '';
- this.currentTabUrl = currentUrls.tab || '';
- this.urlLogText = [
- `page: ${this.currentPageUrl || '(empty)'}`,
- `tab: ${this.currentTabUrl || '(empty)'}`,
- ].join('\n');
- this.urlLogVisible = true;
- },
- getUrlByType(type) {
- const currentUrls = this.getCurrentUrlMap();
- return String(currentUrls[type] || '').trim();
- },
- async copyText(text) {
- const value = String(text || '').trim();
- if (!value) throw new Error('empty');
- if (navigator.clipboard && navigator.clipboard.writeText) {
- await navigator.clipboard.writeText(value);
- return;
- }
- const textarea = document.createElement('textarea');
- textarea.value = value;
- textarea.style.position = 'fixed';
- textarea.style.opacity = '0';
- document.body.appendChild(textarea);
- textarea.focus();
- textarea.select();
- document.execCommand('copy');
- document.body.removeChild(textarea);
- },
- async copyCurrentUrl(type) {
- try {
- await this.copyText(this.getUrlByType(type));
- if (typeof showToastEffect === 'function') showToastEffect('URL 已复制', 1400, 'success');
- } catch (_) {
- if (typeof showToastEffect === 'function') showToastEffect('复制失败', 1800, 'error');
- }
- },
- openCurrentUrl(type) {
- const url = this.getUrlByType(type);
- if (!url) {
- if (typeof showToastEffect === 'function') showToastEffect('当前没有可打开的 URL', 1800, 'warning');
- return;
- }
- const newWindow = window.open(url, '_blank');
- if (!newWindow) {
- window.location.href = url;
- }
- },
- handleTabChange({ index, tab }) {
- console.log("[mp_chgChgchk] 切换页签:", index, tab);
- if (this.urlLogVisible) {
- setTimeout(() => this.showCurrentUrls(), 80);
- }
- },
- },
- });
- });
- </script>
- </body>
- </html>
|