| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785 |
- <!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>审核</title>
- <script src="/js/mp_base/base.js"></script>
- <style>
- [v-cloak] {
- display: none !important;
- }
- #app {
- background: #f5f5f5;
- height: 100vh;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- box-sizing: border-box;
- }
- .content-wrap {
- flex: 1;
- display: flex;
- flex-direction: column;
- gap: 8px;
- padding: 8px;
- box-sizing: border-box;
- overflow: hidden;
- }
- .frame-card {
- background: #fff;
- border-radius: 8px;
- overflow: hidden;
- box-sizing: border-box;
- }
- .info-frame-wrap {
- flex: 0 0 176px;
- }
- .chg-frame-wrap,
- .sh-frame-wrap {
- flex: 1;
- min-height: 0;
- }
- .info-iframe,
- .chg-iframe,
- .sh-iframe {
- width: 100%;
- height: 100%;
- border: none;
- display: block;
- background: #fff;
- }
- .status-wrap {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 16px;
- box-sizing: border-box;
- }
- .status-card {
- width: 100%;
- max-width: 520px;
- background: #fff;
- border-radius: 8px;
- padding: 16px;
- box-sizing: border-box;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
- }
- .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;
- }
- .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__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>
- <div class="content-wrap" v-if="initStatus === 'ready'">
- <div class="frame-card info-frame-wrap">
- <iframe
- ref="infoIframe"
- class="info-iframe"
- :src="topIframeSrc || 'about:blank'"
- frameborder="0"
- ></iframe>
- </div>
- <div class="frame-card chg-frame-wrap">
- <iframe
- ref="chgIframe"
- class="chg-iframe"
- :src="chgIframeSrc || 'about:blank'"
- frameborder="0"
- ></iframe>
- </div>
- <div class="frame-card sh-frame-wrap">
- <iframe
- ref="shIframe"
- class="sh-iframe"
- :src="shIframeSrc || 'about:blank'"
- frameborder="0"
- ></iframe>
- </div>
- </div>
- <div class="status-wrap" v-else>
- <div class="status-card">
- <div class="status-title">{{ initStatusTitle }}</div>
- <div class="status-text">{{ initStatusMessage }}</div>
- <div class="status-text" v-if="missingParams.length > 0">
- 缺少参数:{{ missingParams.join('、') }}
- </div>
- <button class="status-retry" type="button" @click="callApi">
- 重新加载
- </button>
- </div>
- </div>
- <ss-bottom
- :buttons="bottomButtons"
- :show-shyj="true"
- @button-click="handleBottomAction"
- :disabled="submitting"
- v-if="initStatus === 'ready' && bottomButtons.length > 0"
- ></ss-bottom>
- <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>
- <button
- class="url-log-panel__close"
- type="button"
- @click="urlLogVisible = false"
- >
- ×
- </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,
- submitting: false,
- jdmc: "",
- sqid: "",
- shid: "",
- shyjm: "",
- bdlbm: "",
- dataType: "bdplay",
- encode_shid: "",
- ssObjName: "",
- ssObjId: "",
- initStatus: "loading",
- initStatusTitle: "页面初始化中",
- initStatusMessage: "正在加载审核数据,请稍候...",
- missingParams: [],
- infoData: null,
- actionAgreeData: null,
- actionRejectData: null,
- bottomButtons: [],
- topIframeSrc: "",
- chgIframeSrc: "",
- shIframeSrc: "",
- urlLogVisible: false,
- urlLogText: "",
- };
- },
- mounted() {
- this.pageParams = this.getUrlParams();
- this.callApi();
- },
- methods: {
- // 新增变动审核页初始化状态控制 by xu 2026-03-06
- setInitStatus(status, title, message) {
- this.initStatus = status;
- this.initStatusTitle = title || "";
- this.initStatusMessage = message || "";
- },
- normalizeError(error) {
- return {
- message: (error && error.message) || String(error),
- };
- },
- getUrlParams() {
- const params = {};
- const aliasMap = {
- ssobjname: "ssObjName",
- ssobjid: "ssObjId",
- sqid: "sqid",
- shid: "shid",
- shyjm: "shyjm",
- bdlbm: "bdlbm",
- datatype: "dataType",
- encode_shid: "encode_shid",
- jdmc: "jdmc",
- };
- 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);
- }
- },
- pickFirstValue(sources, keys) {
- const srcArr = Array.isArray(sources) ? sources : [];
- const keyArr = Array.isArray(keys) ? keys : [];
- for (let i = 0; i < srcArr.length; i += 1) {
- const src = srcArr[i];
- if (!src || typeof src !== "object") continue;
- for (let j = 0; j < keyArr.length; j += 1) {
- const key = keyArr[j];
- const value = src[key];
- if (value !== undefined && value !== null && value !== "") {
- return value;
- }
- }
- }
- return "";
- },
- extractTokenData(apiResponse) {
- const wantedKeys = [
- "sqid",
- "shid",
- "ssObjName",
- "ssObjId",
- "jdmc",
- "bdlbm",
- "dataType",
- "encode_shid",
- ];
- const candidates = [
- apiResponse && apiResponse.data && apiResponse.data.ssData,
- apiResponse && apiResponse.ssData,
- apiResponse && apiResponse.data,
- apiResponse,
- ];
- let best = {};
- let bestScore = -1;
- candidates.forEach((item) => {
- if (!item || typeof item !== "object") return;
- let score = 0;
- wantedKeys.forEach((key) => {
- if (
- item[key] !== undefined &&
- item[key] !== null &&
- item[key] !== ""
- ) {
- score += 1;
- }
- });
- if (score > bestScore) {
- best = item;
- bestScore = score;
- }
- });
- return best;
- },
- resolveBusinessContext(apiResponse) {
- const tokenData = this.extractTokenData(apiResponse);
- const sources = [tokenData, this.pageParams];
- return {
- sqid: String(this.pickFirstValue(sources, ["sqid"]) || ""),
- shid: String(this.pickFirstValue(sources, ["shid"]) || ""),
- shyjm: String(this.pickFirstValue(sources, ["shyjm"]) || ""),
- ssObjName: String(
- this.pickFirstValue(sources, ["ssObjName", "ssobjname"]) ||
- ""
- ),
- ssObjId: String(
- this.pickFirstValue(sources, ["ssObjId", "ssobjid"]) || ""
- ),
- bdlbm: String(this.pickFirstValue(sources, ["bdlbm"]) || ""),
- dataType:
- String(
- this.pickFirstValue(sources, ["dataType", "datatype"]) ||
- this.dataType ||
- "bdplay"
- ) || "bdplay",
- encode_shid: String(
- this.pickFirstValue(sources, ["encode_shid"]) || ""
- ),
- jdmc: this.safeDecode(
- this.pickFirstValue(sources, ["jdmc"]) || ""
- ),
- };
- },
- parseInfoParm(rawParm) {
- if (!rawParm) return {};
- if (typeof rawParm === "object") return rawParm;
- const text = String(rawParm).trim();
- if (!text) return {};
- try {
- return JSON.parse(text);
- } catch (_) {}
- try {
- const normalized = text
- .replace(/([{,]\s*)([A-Za-z0-9_]+)\s*:/g, '$1"$2":')
- .replace(/'/g, '"');
- return JSON.parse(normalized);
- } catch (_) {
- return {};
- }
- },
- resolveInfoDestPath(destName) {
- const raw = String(destName || "").trim();
- if (!raw) return "";
- if (/^https?:\/\//i.test(raw)) return raw;
- if (raw.startsWith("/")) return raw;
- if (raw.endsWith(".html")) return `/page/${raw}`;
- if (raw.startsWith("mp_")) return `/page/${raw}.html`;
- return `/page/mp_${raw}.html`;
- },
- buildIframeSrc(path, queryObj) {
- const search = new URLSearchParams();
- Object.keys(queryObj || {}).forEach((key) => {
- const value = queryObj[key];
- if (value === undefined || value === null) return;
- search.set(key, String(value));
- });
- return `${path}?${search.toString()}`;
- },
- buildInfoIframeSrc(infoData, fallbackQuery) {
- const conf =
- infoData && typeof infoData === "object" ? infoData : {};
- const serviceName = conf.service || conf.servName || "";
- const destName = conf.dest || "";
- const parmObj = this.parseInfoParm(conf.parm);
- const mergedQuery = {
- ...(fallbackQuery || {}),
- ...(parmObj || {}),
- };
- if (!serviceName || !destName) {
- return this.buildIframeSrc("/page/mp_objInfo.html", mergedQuery);
- }
- const pagePath = this.resolveInfoDestPath(destName);
- if (!pagePath) {
- return this.buildIframeSrc("/page/mp_objInfo.html", mergedQuery);
- }
- const paramText =
- typeof conf.parm === "string"
- ? conf.parm
- : JSON.stringify(parmObj || {});
- const iframeQuery = {
- ...mergedQuery,
- ssServ: serviceName,
- ssDest: destName,
- service: serviceName,
- dest: destName,
- param: paramText,
- };
- return this.buildIframeSrc(pagePath, iframeQuery);
- },
- buildCommonQuery() {
- return {
- sqid: this.sqid,
- shid: this.shid,
- shyjm: this.shyjm,
- bdlbm: this.bdlbm,
- dataType: this.dataType,
- encode_shid: this.encode_shid,
- ssObjName: this.ssObjName,
- ssObjId: this.ssObjId,
- jdmc: this.jdmc,
- };
- },
- normalizeActionConfig(config) {
- if (!config || typeof config !== "object") return null;
- const normalized = { ...config };
- if (!normalized.service && normalized.servName) {
- normalized.service = normalized.servName;
- }
- return normalized;
- },
- async fetchActionConfigs() {
- // 按 bdlbm 拉取变动审核同意退回动作配置 by xu 2026-03-06
- const query = `ssObjName=${encodeURIComponent(
- this.ssObjName
- )}&ssObjId=${encodeURIComponent(
- this.ssObjId
- )}&sqid=${encodeURIComponent(
- this.sqid
- )}&shid=${encodeURIComponent(
- this.shid
- )}&bdlbm=${encodeURIComponent(
- this.bdlbm
- )}&dataType=${encodeURIComponent(
- this.dataType
- )}&encode_shid=${encodeURIComponent(this.encode_shid)}`;
- let agreeTag = "";
- let rejectTag = "";
- if (String(this.bdlbm) === "55") {
- agreeTag = "agrRes";
- rejectTag = "rejRes";
- } else if (String(this.bdlbm) === "51") {
- agreeTag = "agrSus";
- rejectTag = "rejSus";
- } else if (!["1", "51", "55"].includes(String(this.bdlbm))) {
- agreeTag = "agrChg";
- rejectTag = "rejChg";
- }
- this.actionAgreeData = null;
- this.actionRejectData = null;
- const buttons = [];
- if (rejectTag) {
- const rejectRes = await request.post(
- `/service?ssServ=dataTag&ssDest=data&name=${rejectTag}&${query}`,
- {},
- { loading: false, formData: true }
- );
- this.actionRejectData = this.normalizeActionConfig(
- rejectRes && rejectRes.data ? rejectRes.data[rejectTag] : null
- );
- if (
- this.actionRejectData &&
- this.actionRejectData.service &&
- this.actionRejectData.dest
- ) {
- buttons.push({ text: "退回", action: "reject" });
- }
- }
- if (agreeTag) {
- const agreeRes = await request.post(
- `/service?ssServ=dataTag&ssDest=data&name=${agreeTag}&${query}`,
- {},
- { loading: false, formData: true }
- );
- this.actionAgreeData = this.normalizeActionConfig(
- agreeRes && agreeRes.data ? agreeRes.data[agreeTag] : null
- );
- if (
- this.actionAgreeData &&
- this.actionAgreeData.service &&
- this.actionAgreeData.dest
- ) {
- buttons.push({ text: "同意", action: "agree" });
- }
- }
- this.bottomButtons = buttons;
- },
- async callApi() {
- this.loading = true;
- this.infoData = null;
- this.actionAgreeData = null;
- this.actionRejectData = null;
- this.bottomButtons = [];
- this.topIframeSrc = "";
- this.chgIframeSrc = "";
- this.shIframeSrc = "";
- this.missingParams = [];
- this.setInitStatus(
- "loading",
- "页面初始化中",
- "正在加载审核数据,请稍候..."
- );
- let apiResponse = null;
- try {
- if (this.pageParams.ssToken) {
- apiResponse = await request.post(
- `/service?ssToken=${this.pageParams.ssToken}`,
- {},
- { loading: false }
- );
- }
- const context = this.resolveBusinessContext(apiResponse);
- this.sqid = context.sqid;
- this.shid = context.shid;
- this.shyjm = context.shyjm;
- this.ssObjName = context.ssObjName;
- this.ssObjId = context.ssObjId;
- this.bdlbm = context.bdlbm;
- this.dataType = context.dataType;
- this.encode_shid = context.encode_shid;
- this.jdmc = context.jdmc || "";
- const requiredKeys = ["sqid", "shid", "ssObjId"];
- this.missingParams = requiredKeys.filter((key) => !this[key]);
- const query = this.buildCommonQuery();
- const infoRes = await request.post(
- `/service?ssServ=dataTag&ssDest=data&name=info&ssObjName=${encodeURIComponent(
- this.ssObjName
- )}&ssObjId=${encodeURIComponent(
- this.ssObjId
- )}&sqid=${encodeURIComponent(
- this.sqid
- )}&shid=${encodeURIComponent(this.shid)}`,
- {},
- { loading: false, formData: true }
- );
- this.infoData = infoRes && infoRes.data ? infoRes.data.info : null;
- this.topIframeSrc = this.buildInfoIframeSrc(this.infoData, query);
- // 新增变动情况子页承接 by xu 2026-03-06
- this.chgIframeSrc = this.buildIframeSrc(
- // 功能说明:变动页签入口改为精确命中 mp_chgChkTab.html,对齐 chgChkTab.ss.jsp by xu 2026-03-08
- "/page/mp_chgChkTab.html",
- {
- ...query,
- service: "selChgInfo",
- dest: "chgList",
- ssServ: "selChgInfo",
- ssDest: "chgList",
- param: JSON.stringify({ sqid: this.sqid }),
- }
- );
- this.shIframeSrc = this.buildIframeSrc(
- "/page/mp_shList.html",
- query
- );
- await this.fetchActionConfigs();
- this.setInitStatus("ready", "页面已就绪", "审核数据加载完成");
- } catch (error) {
- const normalized = this.normalizeError(error);
- this.setInitStatus(
- "error",
- "页面初始化失败",
- normalized.message || "页面初始化失败,请稍后重试"
- );
- console.error("[mp_chgchk] 初始化失败", error);
- if (typeof showToastEffect === "function") {
- showToastEffect("页面初始化失败,请稍后重试", 2200, "error");
- }
- } finally {
- this.loading = false;
- }
- },
- buildSubmitPayload(actionPayload) {
- const submitPayload = {};
- if (this.shid) submitPayload.shid = this.shid;
- if (this.sqid) submitPayload.sqid = this.sqid;
- if (this.ssObjName) submitPayload.ssObjName = this.ssObjName;
- if (this.ssObjId) submitPayload.ssObjId = this.ssObjId;
- const payloadObj =
- actionPayload && typeof actionPayload === "object"
- ? actionPayload
- : {};
- const reviewValue = this.pickFirstValue(
- [payloadObj],
- [
- "shsm",
- "shyjValue",
- "shyj",
- "spyj",
- "opinion",
- "comment",
- "remark",
- "reason",
- "yj",
- ]
- );
- if (
- reviewValue !== undefined &&
- reviewValue !== null &&
- reviewValue !== ""
- ) {
- submitPayload.shsm = String(reviewValue);
- }
- return submitPayload;
- },
- goBackWithRefresh() {
- if (
- window.NavigationManager &&
- typeof window.NavigationManager.goBack === "function"
- ) {
- window.NavigationManager.goBack({ refreshParent: true });
- return;
- }
- window.history.back();
- },
- async submitByConfig(conf, actionPayload) {
- const serviceName = conf && (conf.service || conf.servName);
- const destName = conf && conf.dest;
- if (!conf || !serviceName || !destName) {
- if (typeof showToastEffect === "function") {
- showToastEffect("缺少提交配置", 2200, "error");
- }
- return;
- }
- if (this.submitting) return;
- try {
- this.submitting = true;
- await request.post(
- `/service?ssServ=${encodeURIComponent(
- serviceName
- )}&ssDest=${encodeURIComponent(destName)}`,
- this.buildSubmitPayload(actionPayload),
- {
- loading: true,
- formData: true,
- }
- );
- if (typeof showToastEffect === "function") {
- showToastEffect("提交成功", 1200, "success");
- }
- setTimeout(() => {
- this.goBackWithRefresh();
- }, 300);
- } catch (error) {
- console.error("[mp_chgchk] 提交失败", error);
- if (typeof showToastEffect === "function") {
- showToastEffect("提交失败,请稍后重试", 2200, "error");
- }
- } finally {
- this.submitting = false;
- }
- },
- handleBottomAction(payload) {
- if (!payload || !payload.action) return;
- if (payload.action === "agree") {
- this.submitByConfig(this.actionAgreeData, payload);
- return;
- }
- if (payload.action === "reject") {
- this.submitByConfig(this.actionRejectData, payload);
- }
- },
- showCurrentUrls() {
- const lines = [
- `page: ${window.location.href}`,
- `info: ${
- (this.$refs.infoIframe && this.$refs.infoIframe.src) ||
- this.topIframeSrc ||
- "(empty)"
- }`,
- `chg: ${
- (this.$refs.chgIframe && this.$refs.chgIframe.src) ||
- this.chgIframeSrc ||
- "(empty)"
- }`,
- `sh: ${
- (this.$refs.shIframe && this.$refs.shIframe.src) ||
- this.shIframeSrc ||
- "(empty)"
- }`,
- ];
- this.urlLogText = lines.join("\n");
- this.urlLogVisible = true;
- },
- },
- });
- });
- </script>
- </body>
- </html>
|