hrp-ui-base 1.3.6 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.cjs +5 -5
- package/dist/components.es.js +3364 -3319
- package/dist/index.cjs +1 -1
- package/dist/index.es.js +2 -2
- package/dist/string-utils-BH3jGZDF.cjs +1 -0
- package/dist/{string-utils-DPWu4Qfh.js → string-utils-DjRg4NCR.js} +86 -95
- package/dist/style.css +1 -1
- package/dist/{transform-data-DDmK9TEL.cjs → transform-data-CkMSs3ZE.cjs} +1 -1
- package/dist/{transform-data-jyYW8phC.js → transform-data-_KBQqEax.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.es.js +2 -2
- package/package.json +1 -1
- package/packages/approval-process/package.json +1 -1
- package/src/components/layout/ApprovalCenterDrawer.vue +2 -7
- package/src/components/layout/LayoutContainer.vue +18 -20
- package/src/components/layout/utils/redirect.ts +120 -0
- package/src/utils/crypto.ts +12 -12
- package/dist/string-utils-DKz4mfHd.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var P=(t,e,r)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>P(t,typeof e!="symbol"?e+"":e,r);const y=require("element-plus"),m=require("./string-utils-
|
|
1
|
+
"use strict";var g=Object.defineProperty;var P=(t,e,r)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>P(t,typeof e!="symbol"?e+"":e,r);const y=require("element-plus"),m=require("./string-utils-BH3jGZDF.cjs"),b=t=>{try{let e=[];sessionStorage.getItem("readyAppList")?(e=JSON.parse(sessionStorage.getItem("readyAppList")),e.push(t)):e=[t],sessionStorage.setItem("readyAppList",JSON.stringify(e))}catch{sessionStorage.setItem("readyAppList",JSON.stringify([t]))}};function x({row:t,column:e,rowIndex:r,columnIndex:o}){return{color:"var(--mh-table-text-color)",fontWeight:"bold",background:"var(--mh-table-bg-color)",fontSize:"var(--font-size-description)"}}function w({row:t,column:e,rowIndex:r,columnIndex:o}){return{color:"var(--custom-theme-text-3)",fontWeight:"bold",background:"var(--custom-theme-fill-4)",fontSize:"var(--font-size-description)"}}const F=()=>{const t=document.querySelector(".is-error");t&&t.scrollIntoView({behavior:"smooth",block:"start"})};function C({row:t,column:e,rowIndex:r,columnIndex:o}){return{"font-size":"var(--font-size-description)"}}class A{constructor(){d(this,"use",(e,r,o=!1)=>{let n;return(...l)=>{o&&(e.apply(this,l),o=!1),n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,l)},r)}})}}class v{constructor(){d(this,"use",(e,r)=>{let o=null,n=!0,l=0;return(...s)=>{n?(e.apply(this,s),l=Date.now(),n=!1):(o&&clearTimeout(o),Date.now()-l<r?y.ElMessage({message:"请不要频繁点击哦..",type:"warning",grouping:!0}):(l=Date.now(),e.apply(this,s))),o=setTimeout(()=>{o=null,n=!0},r)}})}}const i=(t,e,r)=>{const o=new Blob([t],{type:r});window.URL=window.URL||window.webkitURL;const n=URL.createObjectURL(o),l=document.createElement("a");l.href=n,l.download=e,l.click(),window.URL.revokeObjectURL(n)},D={excel:(t,e)=>{i(t,e,"application/vnd.ms-excel")},word:(t,e)=>{i(t,e,"application/msword")},zip:(t,e)=>{i(t,e,"application/zip")},html:(t,e)=>{i(t,e,"text/html")},markdown:(t,e)=>{i(t,e,"text/markdown")}};function S(t){return t.indexOf("/")===0&&(t=t.substring(1,t.length)),t.indexOf("/")>-1&&(t=t.substring(0,t.indexOf("/"))),t.indexOf("?")>-1&&(t=t.substring(0,t.indexOf("?"))),t.indexOf("#")>-1&&(t=t.substring(0,t.indexOf("#"))),t="/"+t,t}function k(t){const e=window.location.search;return new URLSearchParams(e).get(t)}const T="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='320'%20height='320'%20viewBox='0%200%20320%20320'%3e%3cg%20id='组_1341'%20data-name='组%201341'%20transform='translate(-678%20-170)'%20opacity='0.5'%3e%3cg%20id='组_1126'%20data-name='组%201126'%20transform='translate(449.087%2034.086)'%3e%3crect%20id='BG'%20width='320'%20height='320'%20transform='translate(228.913%20135.914)'%20fill='none'/%3e%3c/g%3e%3cg%20id='ic_无权限'%20transform='translate(576.361%20-1.649)'%3e%3cpath%20id='路径_324'%20data-name='路径%20324'%20d='M0,654.326c0,25.553,71.632,46.268,160,46.268s160-20.712,160-46.267-71.638-46.263-160-46.263S0,628.78,0,654.326Z'%20transform='translate(101.639%20-221.483)'%20fill='%23f4f4f5'/%3e%3cpath%20id='路径_325'%20data-name='路径%20325'%20d='M243.984,656.332c0,16.787,47.114,30.388,105.234,30.388s105.235-13.6,105.235-30.39-47.114-30.39-105.233-30.39-105.237,13.6-105.237,30.39v0Z'%20transform='translate(-87.58%20-235.347)'%20fill='%23e6e8eb'/%3e%3cpath%20id='路径_393'%20data-name='路径%20393'%20d='M229.517,573.793H394.705v98.074a10.324,10.324,0,0,1-10.324,10.324H239.841a10.324,10.324,0,0,1-10.324-10.324V573.793Z'%20transform='translate(-50.187%20-261.211)'%20fill='%23d2d4d6'/%3e%3cpath%20id='路径_394'%20data-name='路径%20394'%20d='M460.526,687.644a18.066,18.066,0,1,1,15.485,0v17.225a5.162,5.162,0,0,1-5.162,5.162h-5.162a5.162,5.162,0,0,1-5.162-5.162V687.644Z'%20transform='translate(-206.629%20-317.288)'%20fill='%23f4f4f5'/%3e%3cpath%20id='路径_395'%20data-name='路径%20395'%20d='M244.841,520.828H379.382a5.162,5.162,0,0,1,3.967,1.859l11.356,13.627H229.517l11.357-13.627a5.162,5.162,0,0,1,3.967-1.858Z'%20transform='translate(-50.187%20-223.387)'%20fill='%23acaeb2'/%3e%3cpath%20id='路径_396'%20data-name='路径%20396'%20d='M410.706,251.136V225.327a36.133,36.133,0,0,0-72.265,0v25.809c0,2.852-4.62,5.162-10.324,5.162s-10.324-2.31-10.324-5.162V225.327a56.78,56.78,0,0,1,113.56,0v25.809c0,2.852-4.62,5.162-10.324,5.162s-10.324-2.31-10.324-5.162Zm77.427-61.942c19.956,0,36.133-12.711,36.133-28.39s-16.177-28.39-36.133-28.39S452,145.125,452,160.8a23.879,23.879,0,0,0,5.053,14.489q-1.412,7.566-2.473,15.191a112.438,112.438,0,0,0,13.841-5.884A43.267,43.267,0,0,0,488.133,189.194Z'%20transform='translate(-113.321%2051.773)'%20fill='%23c2c3c7'/%3e%3cpath%20id='路径_397'%20data-name='路径%20397'%20d='M834.955,222.185a5.162,5.162,0,1,1,5.162-5.162A5.162,5.162,0,0,1,834.955,222.185Zm15.485,0a5.162,5.162,0,1,1,5.162-5.162A5.162,5.162,0,0,1,850.44,222.185Zm15.486,0a5.162,5.162,0,1,1,5.162-5.162,5.162,5.162,0,0,1-5.162,5.162Z'%20transform='translate(-475.628%20-4.448)'%20fill='%23f4f4f5'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";class z{static selectPermissionGroupPage(e){return m.HttpUtil.get("/bms/safety/permission/group/selectPermissionGroupPage",e)}static getPermissionGroupList(){return m.HttpUtil.postJson("/bms/safety/permission/group/getPermissionGroupList")}static getTheFirstStep(e){return m.HttpUtil.get("/bms/safety/permission/group/getTheFirstStep",{permissionGroupId:e})}static saveTheFirstStepWhenAll(e){return m.HttpUtil.postJson("/bms/safety/permission/group/saveTheFirstStepWhenAll",e)}static saveTheFirstStepWhenNotAll(e){return m.HttpUtil.postJson("/bms/safety/permission/group/saveTheFirstStepWhenNotAll",e)}static getTheSecondStepData(e){return m.HttpUtil.get("/bms/safety/permission/group/getTheSecondStepData",{secondStepId:e})}static saveTheSecondStepWhenNotAll(e){return m.HttpUtil.postJson("/bms/safety/permission/group/saveTheSecondStepWhenNotAll",e)}static savePermissionGroup(e){return m.HttpUtil.postJson("/bms/safety/permission/group/savePermissionGroup",e)}static deletePermissionGroup(e){return m.HttpUtil.deleted("/bms/safety/permission/group/deletePermissionGroup",{safetyPermissionGroupId:e})}static updatePermissionGroup(e){return m.HttpUtil.putJson("/bms/safety/permission/group/updatePermissionGroup",e)}static getPermissionGroupMemberById(e){return m.HttpUtil.get("/bms/safety/permission/group/getPermissionGroupMemberById",{permissionGroupId:e})}static savePermissionGroupMember(e){return m.HttpUtil.postJson("/bms/safety/permission/group/savePermissionGroupMember",e)}static getFunPointVoByPageId(e){return m.HttpUtil.get("/bms/safety/permission/group/getFunPointVoByPageId",{pageId:e})}}const H=(t,e)=>{t?(y.ElMessage({type:"warning",message:"当前无权限!"}),console.dir(t),console.dir(e),t.innerHTML=`
|
|
2
2
|
<div style="width:100%;height:100%;display: flex;flex-direction: column;justify-content: center;align-items: center;background:var(--custom-theme-fill-7);">
|
|
3
3
|
<img src="${T}" alt="" style="width: 25vw;">
|
|
4
4
|
<div style="font-weight: 400;
|
|
@@ -2,7 +2,7 @@ var E = Object.defineProperty;
|
|
|
2
2
|
var g = (t, e, r) => e in t ? E(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var d = (t, e, r) => g(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import { ElMessage as y } from "element-plus";
|
|
5
|
-
import { H as m, F as P } from "./string-utils-
|
|
5
|
+
import { H as m, F as P } from "./string-utils-DjRg4NCR.js";
|
|
6
6
|
const k = (t) => {
|
|
7
7
|
try {
|
|
8
8
|
let e = [];
|
package/dist/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./transform-data-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./transform-data-CkMSs3ZE.cjs"),t=require("./string-utils-BH3jGZDF.cjs");exports.Debounce=e.debounce;exports.SocketClass=e.Socket;exports.Throttle=e.throttle;exports.addWujieListener=e.addWujieListener;exports.debounceleading=e.debounceleading;exports.download=e.download;exports.filterKey=e.filterKey;exports.forSureMounted=e.forSureMounted;exports.formatterHandler=e.formatterHandler;exports.getDictConfigs=e.getDictConfigs;exports.getFirstLevelPath=e.getFirstLevelPath;exports.getFirstMenuInList=e.getFirstMenuInList;exports.getModuleFirstMenuPath=e.getModuleFirstMenuPath;exports.getModuleNameByPathName=e.getModuleNameByPathName;exports.getPagePermit=e.getPagePermit;exports.getRouteExistIf=e.getRouteExistIf;exports.getUrlParam=e.getUrlParam;exports.isArray=e.isArray;exports.isExternal=e.isExternal;exports.isHavePermit=e.isHavePermit;exports.isHttp=e.isHttp;exports.isString=e.isString;exports.makeAccessPath=e.makeAccessPath;exports.phoneTableHeaderCellStyle=e.phoneTableHeaderCellStyle;exports.routerPush=e.routerPush;exports.scrollToErrorElement=e.scrollToErrorElement;exports.setDarkStyle=e.setDarkStyle;exports.setFontSizeMode=e.setFontSizeMode;exports.setRouterUtilsContext=e.setRouterUtilsContext;exports.setWhiteStyle=e.setWhiteStyle;exports.tableFontCellStyle=e.tableFontCellStyle;exports.tableHeaderCellStyle=e.tableHeaderCellStyle;exports.toMainRouter=e.toMainRouter;exports.toNoPermitPage=e.toNoPermitPage;exports.transformData=e.transformData;exports.validAlphabets=e.validAlphabets;exports.validEmail=e.validEmail;exports.validLowerCase=e.validLowerCase;exports.validURL=e.validURL;exports.validUpperCase=e.validUpperCase;exports.validUsername=e.validUsername;exports.HttpUtil=t.HttpUtil;exports.IsPc=t.IsPc;exports.IsPhone=t.IsPhone;exports.ddWindowOpen=t.ddWindowOpen;exports.digitUppercase=t.digitUppercase;exports.downloadFile=t.downloadFile;exports.exitLogin=t.exitLogin;exports.formatDecimal=t.formatDecimal;exports.formatTwoDecimal=t.formatTwoDecimal;exports.getEllipsis=t.getEllipsis;exports.getFileType=t.getFileType;exports.getProcessAppIdUrl=t.getProcessAppIdUrl;exports.highlightText=t.highlightText;exports.openEncodeUrl=t.openEncodeUrl;exports.setDingDingTitle=t.setDingDingTitle;exports.setExitLoginRouter=t.setExitLoginRouter;
|
package/dist/utils.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as s, S as t, t as i, a as l, b as o, c as r, f as n, e as d, g, h as m, i as p, j as u, k as c, l as h, m as P, n as f, o as y, p as S, q as v, r as x, s as C, u as D, v as E, w as U, x as b, y as F, z as H, A as L, B as M, C as I, D as T, E as w, F as k, G as A, H as R, I as N, J as j, K as W, L as z, M as B, N as K } from "./transform-data-
|
|
2
|
-
import { H as G, I as J, a as O, d as Q, b as V, c as X, e as Y, f as Z, g as _, h as $, i as aa, j as ea, k as sa, o as ta, s as ia, l as la } from "./string-utils-
|
|
1
|
+
import { d as s, S as t, t as i, a as l, b as o, c as r, f as n, e as d, g, h as m, i as p, j as u, k as c, l as h, m as P, n as f, o as y, p as S, q as v, r as x, s as C, u as D, v as E, w as U, x as b, y as F, z as H, A as L, B as M, C as I, D as T, E as w, F as k, G as A, H as R, I as N, J as j, K as W, L as z, M as B, N as K } from "./transform-data-_KBQqEax.js";
|
|
2
|
+
import { H as G, I as J, a as O, d as Q, b as V, c as X, e as Y, f as Z, g as _, h as $, i as aa, j as ea, k as sa, o as ta, s as ia, l as la } from "./string-utils-DjRg4NCR.js";
|
|
3
3
|
export {
|
|
4
4
|
s as Debounce,
|
|
5
5
|
G as HttpUtil,
|
package/package.json
CHANGED
|
@@ -79,8 +79,8 @@ import { ref, watch, inject } from "vue";
|
|
|
79
79
|
import FlowInstanceController from "../../api/bms/flow/FlowInstanceController";
|
|
80
80
|
import type AssociatedApprovalVO from "../../api/bms/flow/bo/AssociatedApprovalVO";
|
|
81
81
|
import TableQueryCriteriaVO from "../../api/common/TableQueryCriteriaVO";
|
|
82
|
-
import { useLayoutMenuStore } from "./stores/useLayoutMenuStore";
|
|
83
82
|
import { LAYOUT_ROUTER_KEY } from "./plugin";
|
|
83
|
+
import { navigateByDomainRoute } from "./utils/redirect";
|
|
84
84
|
|
|
85
85
|
// 默认头像 - 使用一个简单的 SVG data URI
|
|
86
86
|
const defaultAvatar = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='16' fill='%23e0e0e0'/%3E%3Ccircle cx='16' cy='12' r='5' fill='%23fff'/%3E%3Cpath d='M6 28c0-5.5 4.5-10 10-10s10 4.5 10 10' fill='%23fff'/%3E%3C/svg%3E";
|
|
@@ -94,7 +94,6 @@ const emit = defineEmits<{
|
|
|
94
94
|
}>();
|
|
95
95
|
|
|
96
96
|
const router = inject<any>(LAYOUT_ROUTER_KEY);
|
|
97
|
-
const menuStore = useLayoutMenuStore();
|
|
98
97
|
|
|
99
98
|
const drawerVisible = ref(false);
|
|
100
99
|
const loading = ref(false);
|
|
@@ -152,11 +151,7 @@ const handlePageChange = () => {
|
|
|
152
151
|
/** 跳转到审批详情页 */
|
|
153
152
|
const gotoRelatedPage = async (item: AssociatedApprovalVO) => {
|
|
154
153
|
if (!item.approveUrl) return;
|
|
155
|
-
|
|
156
|
-
if (item.funSystem && item.funSystem !== localStorage.getItem("current-application-id")) {
|
|
157
|
-
await menuStore.getDomainAndHomeMenu(item.approveUrl, router);
|
|
158
|
-
}
|
|
159
|
-
router?.push(item.approveUrl);
|
|
154
|
+
await navigateByDomainRoute(item.approveUrl, router);
|
|
160
155
|
emit("update:visible", false);
|
|
161
156
|
};
|
|
162
157
|
</script>
|
|
@@ -110,6 +110,7 @@ import type { TabsOptions } from "./stores/useLayoutTabsStore";
|
|
|
110
110
|
import type HomeMenu from "../../api/bms/home/bo/HomeMenu";
|
|
111
111
|
import type NoticeVO from "../../api/notice/bo/NoticeVO";
|
|
112
112
|
import { ElNotification, ElMessage } from "element-plus";
|
|
113
|
+
import { navigateByDomainRoute } from "./utils/redirect";
|
|
113
114
|
|
|
114
115
|
defineOptions({ name: "LayoutContainer" });
|
|
115
116
|
|
|
@@ -287,10 +288,11 @@ const handleMessageNavigate = async (notice: NoticeVO) => {
|
|
|
287
288
|
await noticeStore.readNoticeInfo(notice.noticeId);
|
|
288
289
|
await noticeStore.getNoReadNoticeCount();
|
|
289
290
|
updateNum.value += 1;
|
|
290
|
-
if (notice.urlRoute
|
|
291
|
-
|
|
291
|
+
if (!notice.urlRoute) return;
|
|
292
|
+
if (notice.urlRoute.startsWith("/project/") && options?.onCrossAppNavigate) {
|
|
293
|
+
options.onCrossAppNavigate(notice.urlRoute);
|
|
292
294
|
} else {
|
|
293
|
-
await
|
|
295
|
+
await navigateByDomainRoute(notice.urlRoute, router);
|
|
294
296
|
}
|
|
295
297
|
};
|
|
296
298
|
|
|
@@ -298,7 +300,11 @@ const handleMessageDownload = async (notice: NoticeVO) => {
|
|
|
298
300
|
await noticeStore.readNoticeInfo(notice.noticeId);
|
|
299
301
|
await noticeStore.getNoReadNoticeCount();
|
|
300
302
|
updateNum.value += 1;
|
|
301
|
-
options?.onFileDownload
|
|
303
|
+
if (options?.onFileDownload) {
|
|
304
|
+
options.onFileDownload(notice);
|
|
305
|
+
} else {
|
|
306
|
+
await navigateByDomainRoute("/bms/base-manage/base-information/export-center", router);
|
|
307
|
+
}
|
|
302
308
|
};
|
|
303
309
|
|
|
304
310
|
const handleMessageUpdateCount = async () => {
|
|
@@ -410,11 +416,15 @@ const showNoticeNotification = async (notice: NoticeVO) => {
|
|
|
410
416
|
await noticeStore.getNoReadNoticeCount();
|
|
411
417
|
updateNum.value += 1;
|
|
412
418
|
if (notice.noticeType === "file-notice") {
|
|
413
|
-
options?.onFileDownload
|
|
414
|
-
|
|
415
|
-
|
|
419
|
+
if (options?.onFileDownload) {
|
|
420
|
+
options.onFileDownload(notice);
|
|
421
|
+
} else {
|
|
422
|
+
await navigateByDomainRoute("/bms/base-manage/base-information/export-center", router);
|
|
423
|
+
}
|
|
424
|
+
} else if (notice.urlRoute?.startsWith("/project/") && options?.onCrossAppNavigate) {
|
|
425
|
+
options.onCrossAppNavigate(notice.urlRoute);
|
|
416
426
|
} else {
|
|
417
|
-
await
|
|
427
|
+
await navigateByDomainRoute(notice.urlRoute, router);
|
|
418
428
|
}
|
|
419
429
|
closeNotification();
|
|
420
430
|
};
|
|
@@ -455,18 +465,6 @@ const showNoticeNotification = async (notice: NoticeVO) => {
|
|
|
455
465
|
updateNum.value += 1;
|
|
456
466
|
};
|
|
457
467
|
|
|
458
|
-
// ====== 辅助函数 ======
|
|
459
|
-
const buildRouteLocation = (urlRoute: string) => {
|
|
460
|
-
const [path, search] = urlRoute.split("?");
|
|
461
|
-
const query: Record<string, string> = {};
|
|
462
|
-
if (search) {
|
|
463
|
-
new URLSearchParams(search).forEach((value, key) => {
|
|
464
|
-
query[key] = value;
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
return { path: path || "/", query };
|
|
468
|
-
};
|
|
469
|
-
|
|
470
468
|
// ====== 生命周期 ======
|
|
471
469
|
onMounted(async () => {
|
|
472
470
|
// 初始化用户配置
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout cross-system route redirect helpers.
|
|
3
|
+
* Mirrors ui-hrp-entry/public/utils/redirect.js for runtime layout components.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const menuStateRelation: Record<string, string> = {
|
|
7
|
+
imd: "imd",
|
|
8
|
+
agoal: "agoal",
|
|
9
|
+
scm: "scm",
|
|
10
|
+
bms: "bms",
|
|
11
|
+
coc: "coc",
|
|
12
|
+
hws: "hws",
|
|
13
|
+
fms: "fms",
|
|
14
|
+
hrm: "hrm",
|
|
15
|
+
hrms: "hrms",
|
|
16
|
+
itr: "itrms",
|
|
17
|
+
personalization: "imd",
|
|
18
|
+
projectManagement: "projectManagement",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const loginPaths = ["/auth-login", "/oa-login", "/login"];
|
|
22
|
+
|
|
23
|
+
const normalizeBasePath = (path: string) => {
|
|
24
|
+
if (!path || path === "/") return "";
|
|
25
|
+
return path.endsWith("/") ? path.slice(0, -1) : path;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const getKnownDomainIds = () => {
|
|
29
|
+
return Array.from(new Set(Object.values(menuStateRelation)));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Get deploy base path before app segment.
|
|
34
|
+
*
|
|
35
|
+
* Examples:
|
|
36
|
+
* - /login -> ""
|
|
37
|
+
* - /hrp/login -> /hrp
|
|
38
|
+
* - /hws/ -> ""
|
|
39
|
+
* - /hrp/hws/ -> /hrp
|
|
40
|
+
*/
|
|
41
|
+
export const getLayoutBasePath = () => {
|
|
42
|
+
const pathname = window.location.pathname || "/";
|
|
43
|
+
|
|
44
|
+
for (const loginPath of loginPaths) {
|
|
45
|
+
const idx = pathname.indexOf(loginPath);
|
|
46
|
+
if (idx !== -1) {
|
|
47
|
+
return normalizeBasePath(pathname.substring(0, idx));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
52
|
+
const knownDomainIds = getKnownDomainIds();
|
|
53
|
+
const lastPart = parts[parts.length - 1];
|
|
54
|
+
if (lastPart && knownDomainIds.includes(lastPart)) {
|
|
55
|
+
return normalizeBasePath(`/${parts.slice(0, -1).join("/")}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return normalizeBasePath(pathname.replace(/\/$/, ""));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const normalizeRoutePath = (urlRoute: string) => {
|
|
62
|
+
if (!urlRoute) return "";
|
|
63
|
+
if (/^https?:\/\//i.test(urlRoute)) return urlRoute;
|
|
64
|
+
|
|
65
|
+
const [path = "", search = ""] = urlRoute.split("?");
|
|
66
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
67
|
+
return search ? `${normalizedPath}?${search}` : normalizedPath;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const buildRouteLocation = (urlRoute: string) => {
|
|
71
|
+
const routePath = normalizeRoutePath(urlRoute);
|
|
72
|
+
const [path, search] = routePath.split("?");
|
|
73
|
+
const query: Record<string, string> = {};
|
|
74
|
+
if (search) {
|
|
75
|
+
new URLSearchParams(search).forEach((value, key) => {
|
|
76
|
+
query[key] = value;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return { path: path || "/", query };
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const getDomainRedirectUrl = (urlRoute: string) => {
|
|
83
|
+
const routePath = normalizeRoutePath(urlRoute);
|
|
84
|
+
if (!routePath) return "";
|
|
85
|
+
if (/^https?:\/\//i.test(routePath)) return routePath;
|
|
86
|
+
|
|
87
|
+
const cleaned = routePath.replace(/^\/+/, "");
|
|
88
|
+
const firstValue = cleaned.split("/")[0] || "";
|
|
89
|
+
const basePath = getLayoutBasePath();
|
|
90
|
+
const domainId = menuStateRelation[firstValue];
|
|
91
|
+
const originBase = `${window.location.origin}${basePath}`;
|
|
92
|
+
|
|
93
|
+
if (domainId === "bms" || !domainId) {
|
|
94
|
+
return `${originBase}/#${routePath}`;
|
|
95
|
+
}
|
|
96
|
+
return `${originBase}/${domainId}/#${routePath}`;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const isSameAppUrl = (targetUrl: string) => {
|
|
100
|
+
const target = new URL(targetUrl, window.location.origin);
|
|
101
|
+
const currentPath = window.location.pathname.replace(/\/$/, "");
|
|
102
|
+
const targetPath = target.pathname.replace(/\/$/, "");
|
|
103
|
+
return target.origin === window.location.origin && targetPath === currentPath;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const navigateByDomainRoute = async (urlRoute: string, router?: any) => {
|
|
107
|
+
const routePath = normalizeRoutePath(urlRoute);
|
|
108
|
+
if (!routePath) return;
|
|
109
|
+
|
|
110
|
+
const targetUrl = getDomainRedirectUrl(routePath);
|
|
111
|
+
if (!targetUrl) return;
|
|
112
|
+
|
|
113
|
+
if (router && isSameAppUrl(targetUrl)) {
|
|
114
|
+
await router.push(buildRouteLocation(routePath));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
window.location.href = targetUrl;
|
|
119
|
+
};
|
|
120
|
+
|
package/src/utils/crypto.ts
CHANGED
|
@@ -79,19 +79,19 @@ export const getPMSFinalToken = function (token: string) {
|
|
|
79
79
|
|
|
80
80
|
// 获取最终的token
|
|
81
81
|
export const getFinalToken = function () {
|
|
82
|
-
// 从 URL中获取 projectId
|
|
83
|
-
const hash = window.location.hash;
|
|
84
|
-
const pathname = window.location.pathname;
|
|
85
|
-
const projectIdMatch = hash.match(/\/project\/([^\/\?]+)/);
|
|
86
|
-
const projectId = projectIdMatch ? projectIdMatch[1] : null;
|
|
82
|
+
// // 从 URL中获取 projectId
|
|
83
|
+
// const hash = window.location.hash;
|
|
84
|
+
// const pathname = window.location.pathname;
|
|
85
|
+
// const projectIdMatch = hash.match(/\/project\/([^\/\?]+)/);
|
|
86
|
+
// const projectId = projectIdMatch ? projectIdMatch[1] : null;
|
|
87
87
|
|
|
88
|
-
// 如果有 projectId,优先使用项目专属 token
|
|
89
|
-
if (projectId && pathname.includes("/pms/")) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
88
|
+
// // 如果有 projectId,优先使用项目专属 token
|
|
89
|
+
// if (projectId && pathname.includes("/pms/")) {
|
|
90
|
+
// const projectToken = localStorage.getItem(`TOKEN-${projectId}`);
|
|
91
|
+
// if (projectToken) {
|
|
92
|
+
// return getPMSFinalToken(projectToken);
|
|
93
|
+
// }
|
|
94
|
+
// }
|
|
95
95
|
|
|
96
96
|
// 否则使用通用 TOKEN
|
|
97
97
|
return getFinalHrpToken();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var D=Object.defineProperty;var R=(t,o,e)=>o in t?D(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e;var g=(t,o,e)=>R(t,typeof o!="symbol"?o+"":o,e);const y=require("dingtalk-jsapi"),u=require("element-plus"),v=require("axios"),A=require("qs"),j=require("lodash"),w=require("vant"),J=require("sm-crypto"),L=t=>{if(y.env.platform!=="notInDingTalk")window.open(t+"/?ddtab=true","_blank");else if(window.oaTool&&window.oaTool.isOA){window.oaTool.openNewWindow(t);return}else window.open(t,"_blank")},M=t=>encodeURIComponent(t),K=t=>(t.indexOf("?")>-1&&(t.indexOf("/?")>-1?t=t.split("/?")[0]:t=t.split("?")[0]),t[t.length-1]==="/"&&(t=t.substring(0,t.length-1)),t),W=t=>{if(!(!t||typeof t!="string"))if(y.env.platform!=="notInDingTalk")y.biz.navigation.setTitle({title:t}),document.title=t;else if(window.oaTool&&window.oaTool.isOA){window.oaTool.setTitle(t);return}else document.title=t};function F(t){try{return new URL(t),t}catch{}const o=window.location.origin,e=window.location.pathname;t.startsWith("./")?t=t.substring(2):t.startsWith("/")&&(t=t.substring(1));const n=e.endsWith("/")?e:e.substring(0,e.lastIndexOf("/")+1);return o+n+t}const q=async t=>{let o="";try{o=(sessionStorage.getItem("userConfig")?JSON.parse(sessionStorage.getItem("userConfig")):null).fileUploadType}catch(n){console.log(n)}try{await navigator.clipboard.writeText(F(t.url)),console.log("URL 已复制到剪贴板:",F(t.url)),u.ElMessage.success("文件下载链接已写入剪切板,如遇系统无法下载,自行复制到浏览器打开链接即可下载!")}catch(n){console.error("无法写入剪贴板:",n)}let e=document.createElement("a");e.style="display: none",e.download=t.fileName,e.href=t.url,e.target="_blank",document.body.appendChild(e),e.click(),document.body.removeChild(e)},b=()=>{const t=navigator.userAgent.toLowerCase();return["android","iphone","ipad","ipod","harmonyos","openharmony","huawei","honor","symbianos","windows phone","mobile","webos","blackberry","opera mini","opera mobi","iemobile","wpdesktop"].some(n=>t.includes(n))},$=()=>!b();let m=null;const B=t=>{m=t},x=()=>{var t,o,e;return((o=(t=m==null?void 0:m.currentRoute)==null?void 0:t.value)==null?void 0:o.fullPath)||((e=window.location.hash)==null?void 0:e.replace(/^#/,""))||window.location.pathname+window.location.search},H=j.debounce(()=>{alert("登录失效,请重新登录")},1e3,{leading:!0,trailing:!1});function T(t){const o=localStorage.getItem("TenantHost");localStorage.setItem("preRoute",x()),localStorage.setItem("toRouter",window.location.search),localStorage.getItem("toRouter");let e=localStorage.getItem("currentRouterInfo");if(localStorage.setItem("toRouterObject",e),y.env.platform!=="notInDingTalk")window.location.href=window.location.origin+window.location.pathname+"login/index.html?host="+o;else if(window.oaTool&&window.oaTool.isOA){const n=window.location.origin+(window.location.pathname.endsWith("/")?window.location.pathname:window.location.pathname+"/");let i=x();sessionStorage.setItem("preRoute",i),window.localStorage.removeItem("TOKEN"),window.location.href=`${n}oa-login/index.html?url=${i}`}else if(t&&t===1)window.sessionStorage.clear(),window.localStorage.clear(),window.location.href=window.location.origin+window.location.pathname+"login/index.html";else{localStorage.setItem("toRouter",window.location.search);let n=x();sessionStorage.setItem("preRoute",n),window.localStorage.removeItem("TOKEN"),window.localStorage.removeItem("clientId"),H();const i=window.location.origin+(window.location.pathname.endsWith("/")?window.location.pathname:window.location.pathname+"/");setTimeout(()=>{window.location.href=`${i}login/index.html?host=${o}`},100)}}const P=(t,o)=>J.sm4.encrypt(t,V(o));function V(t){const o=[];for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?o.push(n):n<2048?o.push(192|n>>6,128|n&63):n<55296||n>=57344?o.push(224|n>>12,128|n>>6&63,128|n&63):(e++,n=65536+((n&1023)<<10|t.charCodeAt(e)&1023),o.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63))}for(let e=0;e<o.length;e++){let n=o[e];n>127&&(o[e]=n-256)}return o}const Z=function(){let t=localStorage.getItem("TOKEN")+"IhfN5d11Zk1ZC%Po"+Date.now();return P(t,"*XeL#J@znVJ#sdSv")},_=function(){return localStorage.getItem("TOKEN")},X=function(t){let o=t+"IhfN5d11Zk1ZC%Po"+Date.now();return P(o,"*XeL#J@znVJ#sdSv")},a=function(){const t=window.location.hash,o=window.location.pathname,e=t.match(/\/project\/([^\/\?]+)/),n=e?e[1]:null;if(n&&o.includes("/pms/")){const i=localStorage.getItem(`TOKEN-${n}`);if(i)return X(i)}return Z()},U=window.location.origin+window.location.pathname+"api",r=v.create({timeout:18e5,baseURL:U});r.interceptors.request.use(t=>t);r.interceptors.response.use(t=>(b()?t.data.code==501||t.data.code==510?t.data.msg?w.showNotify({type:"danger",message:t.data.msg}):w.showNotify({type:"danger",message:"发生未知错误!"}):t.data.code==500?w.showNotify({type:"danger",message:"服务发生错误!"}):t.data.code==201?w.showNotify({type:"success",message:t.data.msg}):t.data.code===401&&T():t.data.code==501||t.data.code==510?t.data.msg?u.ElMessage({type:"error",dangerouslyUseHTMLString:!0,message:`<span style="word-break: break-all">${t.data.msg}</span>`,duration:5e3}):u.ElMessage.error("发生未知错误!"):t.data.code==500?u.ElMessageBox.alert(t.data.msg?t.data.msg:"服务发生错误","错误提示",{confirmButtonText:"确定",callback:()=>{}}):t.data.code==201?u.ElMessage({type:"success",dangerouslyUseHTMLString:!0,message:`<span style="word-break: break-all">${t.data.msg}</span>`,duration:5e3}):t.data.code===401&&T(),t.data),async t=>(t.response.status===401?T():b()?w.showNotify({type:"danger",message:"网络请求失败"}):u.ElMessage.error("网络请求失败"),Promise.reject(t.response)));class z{static get(o,e){return e&&(e=e||""),r({method:"get",url:o,params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static post(o,e){return e&&(e=e||""),r({method:"post",url:o,data:A.stringify(e),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a(),"Authorization-origin-Token":localStorage.getItem("TOKEN")}})}static postJson(o,e,n){return e&&(e=e||""),r({method:"post",url:o,data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a(),"Authorization-origin-Token":localStorage.getItem("TOKEN"),...n}})}static uploadOSS(o,e,n){return e&&(e=e||""),r({method:"post",url:o,data:e,headers:{"Content-Type":"multipart/form-data","Authorization-Token":a(),...n}})}static uploadOSSResident(o,e,n){return e&&(e=e||""),r({method:"post",url:o,data:e,headers:{"Content-Type":"multipart/form-data","Authorization-Token":_(),...n}})}static exportFile(o,e){return e&&(e=e||""),r({method:"post",responseType:"arraybuffer",url:o,data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static put(o,e){return e&&(e=e||""),r({method:"put",url:o,data:A.stringify(e),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static putJson(o,e){return e&&(e=e||""),r({method:"put",url:o,data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static putFile(o,e,n){return e&&(e=e||""),r({method:"put",url:o,data:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a(),...n}})}static deleted(o,e){return e&&(e=e||""),r({method:"delete",url:o,data:A.stringify(e),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static deletedjson(o,e){return e&&(e=e||""),r({method:"delete",url:o,data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static downloadGet(o,e){return e&&(e=e||""),r({method:"get",url:o,responseType:"blob",params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static downloadPost(o,e){return e&&(e=e||""),r({method:"post",url:o,responseType:"blob",params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static download(o,e){return e&&(e=e||""),r({method:"post",url:o,responseType:"blob",data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static downloadPostJson(o,e){return e&&(e=e||""),r({method:"post",url:o,responseType:"blob",data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static downloadPut(o,e){return e&&(e=e||""),r({method:"put",url:o,responseType:"blob",params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static downloadPutJson(o,e){return e&&(e=e||""),r({method:"put",url:o,responseType:"blob",data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static downloadFile(o,e){return e&&(e=e||{}),r({method:"post",url:o,responseType:"blob",params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static uploadBase64(o,e,n){let i=new FormData;return i.append("file",e.file),i.append("modulesId",e.modulesId),r({method:"post",url:o,data:i,headers:{"Content-Type":"multipart/form-data","Authorization-Token":a(),...n}})}static postFormData(o,e,n){let i=new FormData;return e.files&&Array.isArray(e.files)&&e.files.forEach(c=>{i.append("files",c)}),e.submitWorkOrderParam&&i.append("submitWorkOrderParam",new Blob([JSON.stringify(e.submitWorkOrderParam)],{type:"application/json;charset=utf-8"})),r({method:"post",url:o,data:i,headers:{"Authorization-Token":a(),"Content-Type":"multipart/form-data",...n}})}}g(z,"baseUrl",U);class G{constructor(){g(this,"havePermission",!1);g(this,"funPointIdList",[])}}const Q=(t,o)=>{const e=o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),n=new RegExp(e,"gi");return t.replace(n,c=>`<span style="color:var(--theme-normal-normal)">${c}</span>`)},Y=t=>t.split("?")[0].substring(t.lastIndexOf(".")+1).toLowerCase(),ee=(t,o,e=0)=>{let n="";if(e>0)for(let i=0;i<e;i++)n+=".";return t.length>o?t.slice(0,o-e)+n:t};function te(t){let o=new Array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖"),e=new Array("","拾","佰","仟"),n=new Array("","万","亿","兆"),i=new Array("角","分","毫","厘"),c="元",E=1e15,p="",h="",s="",S=["",""],f,I,d,k,N,C,O;if(t==null)return"";if(t>=E)return"超出最大处理数字";if(t==0)return s=o[0]+c,s;if(t.toString().indexOf(".")==-1?(p=t.toString(),h="",c="元整"):(S=t.toString().split("."),p=S[0],h=S[1].substr(0,2)),parseInt(p,10)>0){f=0,I=p.length;for(let l=0;l<I;l++)d=p.substr(l,1),k=I-l-1,N=k/4,C=k%4,d=="0"?f++:(f>0&&(s+=o[0]),f=0,s+=o[parseInt(d)]+e[C]),C==0&&f<4&&(s+=n[N]);s+=c}if(h!=""){O=h.length;for(let l=0;l<O;l++)d=h.substr(l,1),d!="0"&&(s+=o[Number(d)]+i[l])}return s==""&&(s+=o[0]+c),s}function oe(t){const o=parseFloat(t.toString());if(isNaN(o))return t;const e=o.toString();return(e.split(".")[1]||"").length>11?o.toFixed(11):e}function ne(t){const o=parseFloat(t.toString());return isNaN(o)?0:Number(Math.round(o*100)/100)}exports.FunPointVo=G;exports.HttpUtil=z;exports.IsPc=$;exports.IsPhone=b;exports.ddWindowOpen=L;exports.digitUppercase=te;exports.downloadFile=q;exports.exitLogin=T;exports.formatDecimal=oe;exports.formatTwoDecimal=ne;exports.getEllipsis=ee;exports.getFileType=Y;exports.getProcessAppIdUrl=K;exports.highlightText=Q;exports.openEncodeUrl=M;exports.setDingDingTitle=W;exports.setExitLoginRouter=B;
|