hrp-ui-base 1.4.0 → 1.4.2
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 +2 -2
- package/dist/components.es.js +519 -515
- package/dist/index.cjs +1 -1
- package/dist/index.es.js +2 -2
- package/dist/{string-utils-DjRg4NCR.js → string-utils-B1iXup7H.js} +137 -125
- package/dist/string-utils-BdintfxS.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/{transform-data-CkMSs3ZE.cjs → transform-data--ruli7aE.cjs} +1 -1
- package/dist/{transform-data-_KBQqEax.js → transform-data-APk1LVKg.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/LayoutContainer.vue +2 -5
- package/src/components/layout/message/message-notification-drawer.vue +4 -0
- package/src/utils/exitLogin.ts +19 -47
- package/src/utils/login-path.ts +35 -0
- package/dist/string-utils-BH3jGZDF.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-BdintfxS.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-B1iXup7H.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--ruli7aE.cjs"),t=require("./string-utils-BdintfxS.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-APk1LVKg.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-B1iXup7H.js";
|
|
3
3
|
export {
|
|
4
4
|
s as Debounce,
|
|
5
5
|
G as HttpUtil,
|
package/package.json
CHANGED
|
@@ -210,7 +210,7 @@ const handleMenuItemClick = (item: HomeMenu) => {
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
const handleParentClick = (_item: HomeMenu, index: number) => {
|
|
213
|
-
menuStore.changeCurrentSecondIndex(index,
|
|
213
|
+
menuStore.changeCurrentSecondIndex(index, menuPosition.value === "left", router);
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
const goHomePage = () => {
|
|
@@ -288,6 +288,7 @@ const handleMessageNavigate = async (notice: NoticeVO) => {
|
|
|
288
288
|
await noticeStore.readNoticeInfo(notice.noticeId);
|
|
289
289
|
await noticeStore.getNoReadNoticeCount();
|
|
290
290
|
updateNum.value += 1;
|
|
291
|
+
if (notice.noticeType === "file-notice") return;
|
|
291
292
|
if (!notice.urlRoute) return;
|
|
292
293
|
if (notice.urlRoute.startsWith("/project/") && options?.onCrossAppNavigate) {
|
|
293
294
|
options.onCrossAppNavigate(notice.urlRoute);
|
|
@@ -302,8 +303,6 @@ const handleMessageDownload = async (notice: NoticeVO) => {
|
|
|
302
303
|
updateNum.value += 1;
|
|
303
304
|
if (options?.onFileDownload) {
|
|
304
305
|
options.onFileDownload(notice);
|
|
305
|
-
} else {
|
|
306
|
-
await navigateByDomainRoute("/bms/base-manage/base-information/export-center", router);
|
|
307
306
|
}
|
|
308
307
|
};
|
|
309
308
|
|
|
@@ -418,8 +417,6 @@ const showNoticeNotification = async (notice: NoticeVO) => {
|
|
|
418
417
|
if (notice.noticeType === "file-notice") {
|
|
419
418
|
if (options?.onFileDownload) {
|
|
420
419
|
options.onFileDownload(notice);
|
|
421
|
-
} else {
|
|
422
|
-
await navigateByDomainRoute("/bms/base-manage/base-information/export-center", router);
|
|
423
420
|
}
|
|
424
421
|
} else if (notice.urlRoute?.startsWith("/project/") && options?.onCrossAppNavigate) {
|
|
425
422
|
options.onCrossAppNavigate(notice.urlRoute);
|
|
@@ -311,6 +311,10 @@ const deleteReadNoticeHandler = async () => {
|
|
|
311
311
|
const messageItemHandler = async (e: NoticeVO) => {
|
|
312
312
|
await NoticeController.readNoticeInfo(e.noticeId)
|
|
313
313
|
e.ifRead = true
|
|
314
|
+
if (e.noticeType === 'file-notice') {
|
|
315
|
+
emit('update-count')
|
|
316
|
+
return
|
|
317
|
+
}
|
|
314
318
|
emit('navigate', e)
|
|
315
319
|
emit('update-count')
|
|
316
320
|
close()
|
package/src/utils/exitLogin.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import qs from "qs";
|
|
2
|
-
import dd from "dingtalk-jsapi";
|
|
3
2
|
|
|
4
3
|
import { ElMessageBox } from "element-plus";
|
|
5
4
|
import { debounce } from "lodash";
|
|
5
|
+
import { getLoginUrl } from "./login-path";
|
|
6
6
|
|
|
7
7
|
type RouterLike = {
|
|
8
8
|
currentRoute?: {
|
|
@@ -30,57 +30,29 @@ const remind = debounce(() => {
|
|
|
30
30
|
alert("登录失效,请重新登录");
|
|
31
31
|
}, 1000, { leading: true, trailing: false })
|
|
32
32
|
export default function exitLogin(clear?: number) {
|
|
33
|
-
const tenantHost = localStorage.getItem("TenantHost");
|
|
34
33
|
localStorage.setItem("preRoute", getCurrentFullPath());
|
|
35
34
|
localStorage.setItem("toRouter", window.location.search);
|
|
36
35
|
let toRouter = localStorage.getItem("toRouter")
|
|
37
36
|
let currentRouterInfo: any = localStorage.getItem("currentRouterInfo");
|
|
38
37
|
localStorage.setItem("toRouterObject", currentRouterInfo)
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
window.location.href =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} else {
|
|
48
|
-
if (window.oaTool && window.oaTool.isOA) {
|
|
49
|
-
|
|
50
|
-
const basePath = window.location.origin +
|
|
51
|
-
(window.location.pathname.endsWith('/')
|
|
52
|
-
? window.location.pathname
|
|
53
|
-
: window.location.pathname + '/');
|
|
54
|
-
let path = getCurrentFullPath();
|
|
55
|
-
sessionStorage.setItem("preRoute", path);
|
|
56
|
-
window.localStorage.removeItem('TOKEN')
|
|
57
|
-
// 去首页
|
|
58
|
-
window.location.href = `${basePath}oa-login/index.html?url=${path}`;
|
|
59
|
-
|
|
60
|
-
} else {
|
|
61
|
-
/**传递参数clear == 1表示退出登录 未传代表401 */
|
|
62
|
-
if (clear && clear === 1) {
|
|
63
|
-
window.sessionStorage.clear()
|
|
64
|
-
window.localStorage.clear()
|
|
65
|
-
window.location.href = window.location.origin + window.location.pathname + "login/index.html"; // 去登录页
|
|
66
|
-
} else {
|
|
67
|
-
localStorage.setItem("toRouter", window.location.search);
|
|
68
|
-
let path = getCurrentFullPath();
|
|
69
|
-
sessionStorage.setItem("preRoute", path);
|
|
70
|
-
|
|
71
|
-
window.localStorage.removeItem('TOKEN')
|
|
72
|
-
window.localStorage.removeItem('clientId')
|
|
73
|
-
remind()
|
|
74
|
-
// 确保路径拼接正确
|
|
75
|
-
const basePath = window.location.origin +
|
|
76
|
-
(window.location.pathname.endsWith('/')
|
|
77
|
-
? window.location.pathname
|
|
78
|
-
: window.location.pathname + '/');
|
|
79
|
-
// 使用setTimeout确保alert完全显示后再跳转
|
|
80
|
-
setTimeout(() => {
|
|
81
|
-
window.location.href = `${basePath}login/index.html?host=${tenantHost}`;
|
|
82
|
-
}, 100); // 100ms延迟足够确保alert显示
|
|
83
|
-
}
|
|
84
|
-
}
|
|
39
|
+
/**传递参数clear == 1表示退出登录 未传代表401 */
|
|
40
|
+
if (clear && clear === 1) {
|
|
41
|
+
window.sessionStorage.clear()
|
|
42
|
+
window.localStorage.clear()
|
|
43
|
+
window.location.href = getLoginUrl(); // 去登录页
|
|
44
|
+
return;
|
|
85
45
|
}
|
|
46
|
+
|
|
47
|
+
localStorage.setItem("toRouter", window.location.search);
|
|
48
|
+
let path = getCurrentFullPath();
|
|
49
|
+
sessionStorage.setItem("preRoute", path);
|
|
50
|
+
|
|
51
|
+
window.localStorage.removeItem('TOKEN')
|
|
52
|
+
window.localStorage.removeItem('clientId')
|
|
53
|
+
remind()
|
|
54
|
+
// 使用setTimeout确保alert完全显示后再跳转
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
window.location.href = getLoginUrl();
|
|
57
|
+
}, 100); // 100ms延迟足够确保alert显示
|
|
86
58
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const subApps = [
|
|
2
|
+
"imd",
|
|
3
|
+
"agoal",
|
|
4
|
+
"scm",
|
|
5
|
+
"bms",
|
|
6
|
+
"coc",
|
|
7
|
+
"hws",
|
|
8
|
+
"fms",
|
|
9
|
+
"hrm",
|
|
10
|
+
"hrms",
|
|
11
|
+
"itrms",
|
|
12
|
+
"personalization",
|
|
13
|
+
"projectManagement",
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const getEntryBasePath = () => {
|
|
17
|
+
const segments = window.location.pathname.replace(/\/$/, "").split("/");
|
|
18
|
+
const lastSegment = segments[segments.length - 1];
|
|
19
|
+
|
|
20
|
+
if (subApps.includes(lastSegment)) {
|
|
21
|
+
segments.pop();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const basePath = segments.join("/") || "/";
|
|
25
|
+
return window.location.origin + (basePath.endsWith("/") ? basePath : `${basePath}/`);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const getLoginUrl = (tenantHost?: string | null) => {
|
|
29
|
+
const loginUrl = `${getEntryBasePath()}login/index.html`;
|
|
30
|
+
return tenantHost ? `${loginUrl}?host=${encodeURIComponent(tenantHost)}` : loginUrl;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const getOaLoginUrl = (url: string) => {
|
|
34
|
+
return `${getEntryBasePath()}oa-login/index.html?url=${encodeURIComponent(url)}`;
|
|
35
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var E=Object.defineProperty;var R=(t,o,e)=>o in t?E(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e;var w=(t,o,e)=>R(t,typeof o!="symbol"?o+"":o,e);const y=require("dingtalk-jsapi"),u=require("element-plus"),D=require("axios"),A=require("qs"),v=require("lodash"),g=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")},j=t=>encodeURIComponent(t),M=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),K=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 W=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))},q=()=>!b();let m=null;const $=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},B=v.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 r=x();sessionStorage.setItem("preRoute",r),window.localStorage.removeItem("TOKEN"),window.location.href=`${n}oa-login/index.html?url=${r}`}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"),B();const r=window.location.origin+(window.location.pathname.endsWith("/")?window.location.pathname:window.location.pathname+"/");setTimeout(()=>{window.location.href=`${r}login/index.html?host=${o}`},100)}}const H=(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 _=function(){let t=localStorage.getItem("TOKEN")+"IhfN5d11Zk1ZC%Po"+Date.now();return H(t,"*XeL#J@znVJ#sdSv")},Z=function(){return localStorage.getItem("TOKEN")},a=function(){return _()},U=window.location.origin+window.location.pathname+"api",i=D.create({timeout:18e5,baseURL:U});i.interceptors.request.use(t=>t);i.interceptors.response.use(t=>(b()?t.data.code==501||t.data.code==510?t.data.msg?g.showNotify({type:"danger",message:t.data.msg}):g.showNotify({type:"danger",message:"发生未知错误!"}):t.data.code==500?g.showNotify({type:"danger",message:"服务发生错误!"}):t.data.code==201?g.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()?g.showNotify({type:"danger",message:"网络请求失败"}):u.ElMessage.error("网络请求失败"),Promise.reject(t.response)));class P{static get(o,e){return e&&(e=e||""),i({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||""),i({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||""),i({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||""),i({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||""),i({method:"post",url:o,data:e,headers:{"Content-Type":"multipart/form-data","Authorization-Token":Z(),...n}})}static exportFile(o,e){return e&&(e=e||""),i({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||""),i({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||""),i({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||""),i({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||""),i({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||""),i({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||""),i({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||""),i({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||""),i({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||""),i({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||""),i({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||""),i({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||{}),i({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 r=new FormData;return r.append("file",e.file),r.append("modulesId",e.modulesId),i({method:"post",url:o,data:r,headers:{"Content-Type":"multipart/form-data","Authorization-Token":a(),...n}})}static postFormData(o,e,n){let r=new FormData;return e.files&&Array.isArray(e.files)&&e.files.forEach(c=>{r.append("files",c)}),e.submitWorkOrderParam&&r.append("submitWorkOrderParam",new Blob([JSON.stringify(e.submitWorkOrderParam)],{type:"application/json;charset=utf-8"})),i({method:"post",url:o,data:r,headers:{"Authorization-Token":a(),"Content-Type":"multipart/form-data",...n}})}}w(P,"baseUrl",U);class G{constructor(){w(this,"havePermission",!1);w(this,"funPointIdList",[])}}const X=(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>`)},Q=t=>t.split("?")[0].substring(t.lastIndexOf(".")+1).toLowerCase(),Y=(t,o,e=0)=>{let n="";if(e>0)for(let r=0;r<e;r++)n+=".";return t.length>o?t.slice(0,o-e)+n:t};function ee(t){let o=new Array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖"),e=new Array("","拾","佰","仟"),n=new Array("","万","亿","兆"),r=new Array("角","分","毫","厘"),c="元",z=1e15,p="",h="",s="",S=["",""],f,I,d,k,N,C,O;if(t==null)return"";if(t>=z)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)]+r[l])}return s==""&&(s+=o[0]+c),s}function te(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 oe(t){const o=parseFloat(t.toString());return isNaN(o)?0:Number(Math.round(o*100)/100)}exports.FunPointVo=G;exports.HttpUtil=P;exports.IsPc=q;exports.IsPhone=b;exports.ddWindowOpen=L;exports.digitUppercase=ee;exports.downloadFile=W;exports.exitLogin=T;exports.formatDecimal=te;exports.formatTwoDecimal=oe;exports.getEllipsis=Y;exports.getFileType=Q;exports.getProcessAppIdUrl=M;exports.highlightText=X;exports.openEncodeUrl=j;exports.setDingDingTitle=K;exports.setExitLoginRouter=$;
|