@fmdeui/fmui 1.0.1 → 1.0.3
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/es/api/base/index.d.ts +1 -1
- package/es/api/index.d.ts +0 -1
- package/es/{version.css → component.css} +0 -9
- package/es/components/button/index.d.ts +3 -3
- package/es/components/button/src/index.vue.d.ts +1 -1
- package/es/components/button/style/css.d.ts +0 -1
- package/es/components/button/style/index.d.ts +0 -1
- package/es/components/chart/style/css.d.ts +0 -1
- package/es/components/chart/style/index.d.ts +0 -1
- package/es/components/form/style/css.d.ts +0 -1
- package/es/components/form/style/index.d.ts +0 -1
- package/es/components/input/style/css.d.ts +0 -1
- package/es/components/input/style/index.d.ts +0 -1
- package/es/components/layout-page/style/css.d.ts +0 -1
- package/es/components/layout-page/style/index.d.ts +0 -1
- package/es/components/layout-page-item/style/css.d.ts +0 -1
- package/es/components/layout-page-item/style/index.d.ts +0 -1
- package/es/components/query-condition/index.d.ts +12 -12
- package/es/components/query-condition/src/index.vue.d.ts +4 -4
- package/es/components/query-condition/style/css.d.ts +0 -1
- package/es/components/query-condition/style/index.d.ts +0 -1
- package/es/components/select/index.d.ts +5 -5
- package/es/components/select/src/index.vue.d.ts +2 -2
- package/es/components/select/style/css.d.ts +0 -1
- package/es/components/select/style/index.d.ts +0 -1
- package/es/components/select-table/index.d.ts +6 -6
- package/es/components/select-table/src/index.vue.d.ts +2 -2
- package/es/components/select-table/style/css.d.ts +0 -1
- package/es/components/select-table/style/index.d.ts +0 -1
- package/es/hooks/other.d.ts +1 -1
- package/es/hooks/useLocale.d.ts +1 -1
- package/es/hooks/useVxeTableOptionsHook.d.ts +2 -2
- package/es/index.d.ts +7 -8
- package/es/index.mjs +0 -10
- package/es/packages/api/index.mjs +0 -1
- package/es/packages/utils/index.mjs +1 -0
- package/es/stores/keepAliveNames.d.ts +1 -1
- package/es/stores/requestOldRoutes.d.ts +1 -1
- package/es/stores/routesList.d.ts +1 -1
- package/es/stores/tagsViewRoutes.d.ts +1 -1
- package/es/stores/themeConfig.d.ts +1 -1
- package/es/stores/userInfo.d.ts +1 -1
- package/index.js +259 -268
- package/index.min.js +4 -4
- package/index.min.mjs +4 -4
- package/index.mjs +257 -257
- package/lib/api/base/index.d.ts +1 -1
- package/lib/api/index.d.ts +0 -1
- package/lib/components/button/index.d.ts +3 -3
- package/lib/components/button/src/index.vue.d.ts +1 -1
- package/lib/components/button/style/css.d.ts +0 -1
- package/lib/components/button/style/index.d.ts +0 -1
- package/lib/components/chart/style/css.d.ts +0 -1
- package/lib/components/chart/style/index.d.ts +0 -1
- package/lib/components/form/style/css.d.ts +0 -1
- package/lib/components/form/style/index.d.ts +0 -1
- package/lib/components/input/style/css.d.ts +0 -1
- package/lib/components/input/style/index.d.ts +0 -1
- package/lib/components/layout-page/style/css.d.ts +0 -1
- package/lib/components/layout-page/style/index.d.ts +0 -1
- package/lib/components/layout-page-item/style/css.d.ts +0 -1
- package/lib/components/layout-page-item/style/index.d.ts +0 -1
- package/lib/components/query-condition/index.d.ts +12 -12
- package/lib/components/query-condition/src/index.vue.d.ts +4 -4
- package/lib/components/query-condition/style/css.d.ts +0 -1
- package/lib/components/query-condition/style/index.d.ts +0 -1
- package/lib/components/select/index.d.ts +5 -5
- package/lib/components/select/src/index.vue.d.ts +2 -2
- package/lib/components/select/style/css.d.ts +0 -1
- package/lib/components/select/style/index.d.ts +0 -1
- package/lib/components/select-table/index.d.ts +6 -6
- package/lib/components/select-table/src/index.vue.d.ts +2 -2
- package/lib/components/select-table/style/css.d.ts +0 -1
- package/lib/components/select-table/style/index.d.ts +0 -1
- package/lib/hooks/other.d.ts +1 -1
- package/lib/hooks/useLocale.d.ts +1 -1
- package/lib/hooks/useVxeTableOptionsHook.d.ts +2 -2
- package/lib/{other.css → index.css} +0 -9
- package/lib/index.d.ts +7 -8
- package/lib/index.js +15 -34
- package/lib/packages/api/index.js +0 -17
- package/lib/packages/utils/index.js +17 -0
- package/lib/stores/keepAliveNames.d.ts +1 -1
- package/lib/stores/requestOldRoutes.d.ts +1 -1
- package/lib/stores/routesList.d.ts +1 -1
- package/lib/stores/tagsViewRoutes.d.ts +1 -1
- package/lib/stores/themeConfig.d.ts +1 -1
- package/lib/stores/userInfo.d.ts +1 -1
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/package.json +1 -1
- package/es/packages/components/button/style/css.mjs +0 -1
- package/es/packages/components/button/style/index.mjs +0 -1
- package/es/packages/components/chart/style/css.mjs +0 -1
- package/es/packages/components/chart/style/index.mjs +0 -1
- package/es/packages/components/form/style/css.mjs +0 -1
- package/es/packages/components/form/style/index.mjs +0 -1
- package/es/packages/components/index.mjs +0 -9
- package/es/packages/components/input/style/css.mjs +0 -1
- package/es/packages/components/input/style/index.mjs +0 -1
- package/es/packages/components/layout-page/style/css.mjs +0 -1
- package/es/packages/components/layout-page/style/index.mjs +0 -1
- package/es/packages/components/layout-page-item/style/css.mjs +0 -1
- package/es/packages/components/layout-page-item/style/index.mjs +0 -1
- package/es/packages/components/query-condition/style/css.mjs +0 -1
- package/es/packages/components/query-condition/style/index.mjs +0 -1
- package/es/packages/components/select/style/css.mjs +0 -1
- package/es/packages/components/select/style/index.mjs +0 -1
- package/es/packages/components/select-table/style/css.mjs +0 -1
- package/es/packages/components/select-table/style/index.mjs +0 -1
- package/es/packages/components/svgIcon/index.vue.mjs +0 -5
- package/es/packages/components/svgIcon/index.vue2.mjs +0 -91
- package/es/packages/components/utils/install.mjs +0 -17
- package/es/packages/hooks/dateTimeShortCust.mjs +0 -23
- package/es/packages/hooks/idleTimeout.mjs +0 -127
- package/es/packages/hooks/other.mjs +0 -146
- package/es/packages/hooks/sysInfo.mjs +0 -59
- package/es/packages/hooks/useInfo.mjs +0 -44
- package/es/packages/theme-chalk/assets/logo.png.mjs +0 -3
- package/es/packages/theme-chalk/src/button.scss.mjs +0 -3
- package/es/packages/theme-chalk/src/chart.scss.mjs +0 -3
- package/es/packages/theme-chalk/src/form.scss.mjs +0 -3
- package/es/packages/theme-chalk/src/input.scss.mjs +0 -3
- package/es/packages/theme-chalk/src/layout-page-item.scss.mjs +0 -3
- package/es/packages/theme-chalk/src/layout-page.scss.mjs +0 -3
- package/es/packages/theme-chalk/src/query-condition.scss.mjs +0 -3
- package/es/packages/theme-chalk/src/select-table.scss.mjs +0 -3
- package/es/packages/theme-chalk/src/select.scss.mjs +0 -3
- package/es/packages/utils/signalR.mjs +0 -47
- package/lib/packages/components/button/style/css.js +0 -4
- package/lib/packages/components/button/style/index.js +0 -4
- package/lib/packages/components/chart/style/css.js +0 -4
- package/lib/packages/components/chart/style/index.js +0 -4
- package/lib/packages/components/form/style/css.js +0 -4
- package/lib/packages/components/form/style/index.js +0 -4
- package/lib/packages/components/index.js +0 -23
- package/lib/packages/components/input/style/css.js +0 -4
- package/lib/packages/components/input/style/index.js +0 -4
- package/lib/packages/components/layout-page/style/css.js +0 -4
- package/lib/packages/components/layout-page/style/index.js +0 -4
- package/lib/packages/components/layout-page-item/style/css.js +0 -4
- package/lib/packages/components/layout-page-item/style/index.js +0 -4
- package/lib/packages/components/query-condition/style/css.js +0 -4
- package/lib/packages/components/query-condition/style/index.js +0 -4
- package/lib/packages/components/select/style/css.js +0 -4
- package/lib/packages/components/select/style/index.js +0 -4
- package/lib/packages/components/select-table/style/css.js +0 -4
- package/lib/packages/components/select-table/style/index.js +0 -4
- package/lib/packages/components/svgIcon/index.vue.js +0 -9
- package/lib/packages/components/svgIcon/index.vue2.js +0 -95
- package/lib/packages/components/utils/install.js +0 -19
- package/lib/packages/hooks/dateTimeShortCust.js +0 -25
- package/lib/packages/hooks/idleTimeout.js +0 -131
- package/lib/packages/hooks/other.js +0 -178
- package/lib/packages/hooks/sysInfo.js +0 -62
- package/lib/packages/hooks/useInfo.js +0 -64
- package/lib/packages/theme-chalk/assets/logo.png.js +0 -7
- package/lib/packages/theme-chalk/src/button.scss.js +0 -7
- package/lib/packages/theme-chalk/src/chart.scss.js +0 -7
- package/lib/packages/theme-chalk/src/form.scss.js +0 -7
- package/lib/packages/theme-chalk/src/input.scss.js +0 -7
- package/lib/packages/theme-chalk/src/layout-page-item.scss.js +0 -7
- package/lib/packages/theme-chalk/src/layout-page.scss.js +0 -7
- package/lib/packages/theme-chalk/src/query-condition.scss.js +0 -7
- package/lib/packages/theme-chalk/src/select-table.scss.js +0 -7
- package/lib/packages/theme-chalk/src/select.scss.js +0 -7
- package/lib/packages/utils/signalR.js +0 -68
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! fmdeui-fmui v1.0.
|
|
1
|
+
/*! fmdeui-fmui v1.0.3 */
|
|
2
2
|
(function (global, factory) {
|
|
3
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pinia'), require('crypto-js'), require('xlsx-js-style'), require('element-plus'), require('vue'), require('@element-plus/icons-vue'), require('mitt'), require('
|
|
4
|
-
typeof define === 'function' && define.amd ? define(['exports', 'pinia', 'crypto-js', 'xlsx-js-style', 'element-plus', 'vue', '@element-plus/icons-vue', 'mitt', '
|
|
5
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fmdeuifmui = {}, global.Pinia, global.CryptoJS, global.XLSX, global.ElementPlus, global.Vue, global.ElementPlusIconsVue, global.mitt, global.
|
|
6
|
-
})(this, (function (exports, pinia$1, CryptoJS, XLSXS, elementPlus, vue, svg, mitt,
|
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pinia'), require('crypto-js'), require('xlsx-js-style'), require('element-plus'), require('vue'), require('@element-plus/icons-vue'), require('mitt'), require('axios'), require('js-cookie'), require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('vue-i18n'), require('exceljs'), require('lodash-es'), require('@vueuse/core'), require('vue-router'), require('nprogress')) :
|
|
4
|
+
typeof define === 'function' && define.amd ? define(['exports', 'pinia', 'crypto-js', 'xlsx-js-style', 'element-plus', 'vue', '@element-plus/icons-vue', 'mitt', 'axios', 'js-cookie', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'vue-i18n', 'exceljs', 'lodash-es', '@vueuse/core', 'vue-router', 'nprogress'], factory) :
|
|
5
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fmdeuifmui = {}, global.Pinia, global.CryptoJS, global.XLSX, global.ElementPlus, global.Vue, global.ElementPlusIconsVue, global.mitt, global.axios, global.Cookies, global.VxeUITable, global.VxeUIPluginRenderElement, global.VxeUIPluginExportXLSX, global.VxeUIExport, global.vueI18n, global.ExcelJS, global._, global.VueUse, global.vueRouter, global.NProgress));
|
|
6
|
+
})(this, (function (exports, pinia$1, CryptoJS, XLSXS, elementPlus, vue, svg, mitt, axios, Cookies, VxeUITable, VxeUIPluginRenderElement, VxeUIPluginExportXLSX, VxeUI, vueI18n, ExcelJS, lodashEs, core, vueRouter, NProgress) { 'use strict';
|
|
7
7
|
|
|
8
8
|
const pinia = pinia$1.createPinia();
|
|
9
9
|
|
|
@@ -1165,50 +1165,6 @@
|
|
|
1165
1165
|
|
|
1166
1166
|
mitt();
|
|
1167
1167
|
|
|
1168
|
-
const saulVModel = (props, propName, emit) => {
|
|
1169
|
-
return vue.computed({
|
|
1170
|
-
get() {
|
|
1171
|
-
if (typeof props[propName] === "object") {
|
|
1172
|
-
return new Proxy(props[propName], {
|
|
1173
|
-
set(obj, name, val) {
|
|
1174
|
-
emit(`update:${String(propName)}`, { ...obj, [name]: val });
|
|
1175
|
-
return true;
|
|
1176
|
-
}
|
|
1177
|
-
});
|
|
1178
|
-
}
|
|
1179
|
-
return props[propName];
|
|
1180
|
-
},
|
|
1181
|
-
set(val) {
|
|
1182
|
-
emit(`update:${String(propName)}`, val);
|
|
1183
|
-
}
|
|
1184
|
-
});
|
|
1185
|
-
};
|
|
1186
|
-
|
|
1187
|
-
const cssCdnUrlList = [
|
|
1188
|
-
// 调整为从本地引入,注释下面的 url
|
|
1189
|
-
// '//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css',
|
|
1190
|
-
// '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
|
|
1191
|
-
];
|
|
1192
|
-
const jsCdnUrlList = [];
|
|
1193
|
-
function setCssCdn() {
|
|
1194
|
-
if (cssCdnUrlList.length <= 0) return false;
|
|
1195
|
-
cssCdnUrlList.map((v) => {
|
|
1196
|
-
let link = document.createElement("link");
|
|
1197
|
-
link.rel = "stylesheet";
|
|
1198
|
-
link.href = v;
|
|
1199
|
-
link.crossOrigin = "anonymous";
|
|
1200
|
-
document.getElementsByTagName("head")[0].appendChild(link);
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
function setJsCdn() {
|
|
1204
|
-
if (jsCdnUrlList.length <= 0) return false;
|
|
1205
|
-
jsCdnUrlList.map((v) => {
|
|
1206
|
-
let link = document.createElement("script");
|
|
1207
|
-
link.src = v;
|
|
1208
|
-
document.body.appendChild(link);
|
|
1209
|
-
});
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
1168
|
const Local = {
|
|
1213
1169
|
// 查看 v2.4.3版本更新日志
|
|
1214
1170
|
setKey(key) {
|
|
@@ -1260,6 +1216,260 @@
|
|
|
1260
1216
|
}
|
|
1261
1217
|
};
|
|
1262
1218
|
|
|
1219
|
+
const abortControllerMap = /* @__PURE__ */ new Map();
|
|
1220
|
+
const service = axios.create({
|
|
1221
|
+
baseURL: window.__env__.VITE_API_URL,
|
|
1222
|
+
timeout: 1e3 * 60 * 10
|
|
1223
|
+
// 设置超时,默认 10 分钟
|
|
1224
|
+
// headers: { 'Content-Type': 'application/json' },
|
|
1225
|
+
});
|
|
1226
|
+
const accessTokenKey = "access-token";
|
|
1227
|
+
const refreshAccessTokenKey = `x-${accessTokenKey}`;
|
|
1228
|
+
const getToken = () => {
|
|
1229
|
+
return Local.get(accessTokenKey);
|
|
1230
|
+
};
|
|
1231
|
+
const getHeader = () => {
|
|
1232
|
+
return { authorization: "Bearer " + getToken() };
|
|
1233
|
+
};
|
|
1234
|
+
const clearAccessTokens = () => {
|
|
1235
|
+
clearTokens();
|
|
1236
|
+
if (window.location.hash.startsWith("#/login")) {
|
|
1237
|
+
window.location.hash = window.location.hash.replace(/([?&])token=[^&]*&?/, "$1").replace(/&$/, "");
|
|
1238
|
+
} else {
|
|
1239
|
+
window.location.reload();
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
const clearTokens = () => {
|
|
1243
|
+
Local.remove(accessTokenKey);
|
|
1244
|
+
Local.remove(refreshAccessTokenKey);
|
|
1245
|
+
Session.clear();
|
|
1246
|
+
};
|
|
1247
|
+
const axiosInstance = axios;
|
|
1248
|
+
service.interceptors.request.use(
|
|
1249
|
+
(config) => {
|
|
1250
|
+
var _a;
|
|
1251
|
+
const controller = new AbortController();
|
|
1252
|
+
config.signal = controller.signal;
|
|
1253
|
+
const url = config.url || "";
|
|
1254
|
+
abortControllerMap.set(url, controller);
|
|
1255
|
+
const accessToken = Local.get(accessTokenKey);
|
|
1256
|
+
if (accessToken) {
|
|
1257
|
+
config.headers["Authorization"] = `Bearer ${accessToken}`;
|
|
1258
|
+
const jwt = decryptJWT(accessToken);
|
|
1259
|
+
const exp = getJWTDate(jwt.exp);
|
|
1260
|
+
if (/* @__PURE__ */ new Date() >= exp) {
|
|
1261
|
+
const refreshAccessToken = Local.get(refreshAccessTokenKey);
|
|
1262
|
+
if (refreshAccessToken) {
|
|
1263
|
+
config.headers["X-Authorization"] = `Bearer ${refreshAccessToken}`;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
if (((_a = config.method) == null ? void 0 : _a.toLowerCase()) === "get" && config.data) {
|
|
1267
|
+
let url2 = config.url + "?" + tansParams(config.data);
|
|
1268
|
+
url2 = url2.slice(0, -1);
|
|
1269
|
+
config.data = {};
|
|
1270
|
+
config.url = url2;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
return config;
|
|
1274
|
+
},
|
|
1275
|
+
(error) => {
|
|
1276
|
+
return Promise.reject(error);
|
|
1277
|
+
}
|
|
1278
|
+
);
|
|
1279
|
+
service.interceptors.response.use(
|
|
1280
|
+
(res) => {
|
|
1281
|
+
const url = res.config.url || "";
|
|
1282
|
+
abortControllerMap.delete(url);
|
|
1283
|
+
var status = res.status;
|
|
1284
|
+
var serve = res.data;
|
|
1285
|
+
if (status === 401) {
|
|
1286
|
+
clearAccessTokens();
|
|
1287
|
+
}
|
|
1288
|
+
if (status >= 400) {
|
|
1289
|
+
throw new Error(res.statusText || "Request Error.");
|
|
1290
|
+
}
|
|
1291
|
+
if (serve && serve.hasOwnProperty("errors") && serve.errors) {
|
|
1292
|
+
throw new Error(JSON.stringify(serve.errors || "Request Error."));
|
|
1293
|
+
}
|
|
1294
|
+
var accessToken = res.headers[accessTokenKey];
|
|
1295
|
+
var refreshAccessToken = res.headers[refreshAccessTokenKey];
|
|
1296
|
+
if (accessToken === "invalid_token") {
|
|
1297
|
+
clearAccessTokens();
|
|
1298
|
+
} else if (refreshAccessToken && accessToken && accessToken !== "invalid_token") {
|
|
1299
|
+
Local.set(accessTokenKey, accessToken);
|
|
1300
|
+
Local.set(refreshAccessTokenKey, refreshAccessToken);
|
|
1301
|
+
}
|
|
1302
|
+
if (serve.code === 401) {
|
|
1303
|
+
clearAccessTokens();
|
|
1304
|
+
} else if (serve.code === void 0) {
|
|
1305
|
+
return Promise.resolve(res);
|
|
1306
|
+
} else if (serve.code !== 200) {
|
|
1307
|
+
let message = handleResponse(serve.message, 5);
|
|
1308
|
+
elementPlus.ElMessage.error({ dangerouslyUseHTMLString: true, message });
|
|
1309
|
+
throw new Error(serve.message);
|
|
1310
|
+
}
|
|
1311
|
+
return res;
|
|
1312
|
+
},
|
|
1313
|
+
(error) => {
|
|
1314
|
+
if (error.response) {
|
|
1315
|
+
if (error.response.status === 401) {
|
|
1316
|
+
clearAccessTokens();
|
|
1317
|
+
} else if (error.response.statusCode === 404) {
|
|
1318
|
+
elementPlus.ElMessage.error("\u63A5\u53E3\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458");
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
if (error.message.indexOf("timeout") != -1) {
|
|
1322
|
+
elementPlus.ElMessage.error("\u7F51\u7EDC\u8D85\u65F6");
|
|
1323
|
+
} else if (error.message == "Network Error") {
|
|
1324
|
+
elementPlus.ElMessage.error("\u7F51\u7EDC\u8FDE\u63A5\u9519\u8BEF");
|
|
1325
|
+
} else {
|
|
1326
|
+
if (error.response.data) elementPlus.ElMessage.error(error.response.statusText);
|
|
1327
|
+
else elementPlus.ElMessage.error("\u63A5\u53E3\u8DEF\u5F84\u627E\u4E0D\u5230");
|
|
1328
|
+
}
|
|
1329
|
+
return Promise.reject(error);
|
|
1330
|
+
}
|
|
1331
|
+
);
|
|
1332
|
+
const handleResponse = (input, col = 5) => {
|
|
1333
|
+
const messageList = [];
|
|
1334
|
+
const errorCodeRegex = /^\[[A-Za-z0-9_]+\]\s*/;
|
|
1335
|
+
function process(value) {
|
|
1336
|
+
if (value == null) return;
|
|
1337
|
+
if (typeof value === "string") {
|
|
1338
|
+
const clean = value.replace(errorCodeRegex, "");
|
|
1339
|
+
if (clean.trim()) messageList.push(clean.trim());
|
|
1340
|
+
} else if (Array.isArray(value)) {
|
|
1341
|
+
value.forEach((item) => process(item));
|
|
1342
|
+
} else if (typeof value === "object") {
|
|
1343
|
+
Object.values(value).forEach((val) => process(val));
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
try {
|
|
1347
|
+
const parsed = typeof input === "string" ? JSON.parse(input) : input;
|
|
1348
|
+
process(parsed);
|
|
1349
|
+
} catch (e) {
|
|
1350
|
+
process(input);
|
|
1351
|
+
}
|
|
1352
|
+
col = col < 4 ? 4 : col;
|
|
1353
|
+
return messageList.reduce((rows, msg, i) => {
|
|
1354
|
+
if (i % col === 0) rows.push([]);
|
|
1355
|
+
rows[rows.length - 1].push(msg);
|
|
1356
|
+
return rows;
|
|
1357
|
+
}, []).map((row) => row.join("; ")).join("<br/>");
|
|
1358
|
+
};
|
|
1359
|
+
const cancelRequest = (url) => {
|
|
1360
|
+
var _a;
|
|
1361
|
+
const urlList = Array.isArray(url) ? url : [url];
|
|
1362
|
+
for (const _url of urlList) {
|
|
1363
|
+
(_a = abortControllerMap.get(_url)) == null ? void 0 : _a.abort();
|
|
1364
|
+
abortControllerMap.delete(_url);
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
const cancelAllRequest = () => {
|
|
1368
|
+
for (const [_, controller] of abortControllerMap) {
|
|
1369
|
+
controller.abort();
|
|
1370
|
+
}
|
|
1371
|
+
abortControllerMap.clear();
|
|
1372
|
+
};
|
|
1373
|
+
function tansParams(params) {
|
|
1374
|
+
let result = "";
|
|
1375
|
+
for (const propName of Object.keys(params)) {
|
|
1376
|
+
const value = params[propName];
|
|
1377
|
+
var part = encodeURIComponent(propName) + "=";
|
|
1378
|
+
if (value !== null && value !== "" && typeof value !== "undefined") {
|
|
1379
|
+
if (typeof value === "object") {
|
|
1380
|
+
for (const key of Object.keys(value)) {
|
|
1381
|
+
if (value[key] !== null && value[key] !== "" && typeof value[key] !== "undefined") {
|
|
1382
|
+
let params2 = propName + "[" + key + "]";
|
|
1383
|
+
var subPart = encodeURIComponent(params2) + "=";
|
|
1384
|
+
result += subPart + encodeURIComponent(value[key]) + "&";
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
} else {
|
|
1388
|
+
result += part + encodeURIComponent(value) + "&";
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return result;
|
|
1393
|
+
}
|
|
1394
|
+
function decryptJWT(token) {
|
|
1395
|
+
token = token.replace(/_/g, "/").replace(/-/g, "+");
|
|
1396
|
+
var json = decodeURIComponent(escape(window.atob(token.split(".")[1])));
|
|
1397
|
+
return JSON.parse(json);
|
|
1398
|
+
}
|
|
1399
|
+
function getJWTDate(timestamp) {
|
|
1400
|
+
return new Date(timestamp * 1e3);
|
|
1401
|
+
}
|
|
1402
|
+
function request2(config) {
|
|
1403
|
+
return new Promise((resolve, reject) => {
|
|
1404
|
+
service(config).then((res) => {
|
|
1405
|
+
if (res.data.type == "success") {
|
|
1406
|
+
resolve(res.data.result);
|
|
1407
|
+
} else {
|
|
1408
|
+
elementPlus.ElMessage.success(res.data.message);
|
|
1409
|
+
}
|
|
1410
|
+
}).catch((res) => {
|
|
1411
|
+
elementPlus.ElMessage.error(res);
|
|
1412
|
+
reject(res);
|
|
1413
|
+
});
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
function reLoadLoginAccessToken(accessInfo) {
|
|
1417
|
+
if ((accessInfo == null ? void 0 : accessInfo.accessToken) && (accessInfo == null ? void 0 : accessInfo.refreshToken)) {
|
|
1418
|
+
Local.remove("tagsViewList");
|
|
1419
|
+
Session.set("token", accessInfo.accessToken);
|
|
1420
|
+
Local.set(accessTokenKey, accessInfo.accessToken);
|
|
1421
|
+
Local.set(refreshAccessTokenKey, accessInfo.refreshToken);
|
|
1422
|
+
setTimeout(() => location.href = "/", 500);
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
function sleep(delay) {
|
|
1426
|
+
return new Promise((resolve) => setTimeout(resolve, delay));
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
const saulVModel = (props, propName, emit) => {
|
|
1430
|
+
return vue.computed({
|
|
1431
|
+
get() {
|
|
1432
|
+
if (typeof props[propName] === "object") {
|
|
1433
|
+
return new Proxy(props[propName], {
|
|
1434
|
+
set(obj, name, val) {
|
|
1435
|
+
emit(`update:${String(propName)}`, { ...obj, [name]: val });
|
|
1436
|
+
return true;
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
return props[propName];
|
|
1441
|
+
},
|
|
1442
|
+
set(val) {
|
|
1443
|
+
emit(`update:${String(propName)}`, val);
|
|
1444
|
+
}
|
|
1445
|
+
});
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
const cssCdnUrlList = [
|
|
1449
|
+
// 调整为从本地引入,注释下面的 url
|
|
1450
|
+
// '//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css',
|
|
1451
|
+
// '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
|
|
1452
|
+
];
|
|
1453
|
+
const jsCdnUrlList = [];
|
|
1454
|
+
function setCssCdn() {
|
|
1455
|
+
if (cssCdnUrlList.length <= 0) return false;
|
|
1456
|
+
cssCdnUrlList.map((v) => {
|
|
1457
|
+
let link = document.createElement("link");
|
|
1458
|
+
link.rel = "stylesheet";
|
|
1459
|
+
link.href = v;
|
|
1460
|
+
link.crossOrigin = "anonymous";
|
|
1461
|
+
document.getElementsByTagName("head")[0].appendChild(link);
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
function setJsCdn() {
|
|
1465
|
+
if (jsCdnUrlList.length <= 0) return false;
|
|
1466
|
+
jsCdnUrlList.map((v) => {
|
|
1467
|
+
let link = document.createElement("script");
|
|
1468
|
+
link.src = v;
|
|
1469
|
+
document.body.appendChild(link);
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1263
1473
|
function useChangeColor() {
|
|
1264
1474
|
const hexToRgb = (str) => {
|
|
1265
1475
|
let hexs = "";
|
|
@@ -1651,216 +1861,6 @@
|
|
|
1651
1861
|
}
|
|
1652
1862
|
});
|
|
1653
1863
|
|
|
1654
|
-
const abortControllerMap = /* @__PURE__ */ new Map();
|
|
1655
|
-
const service = axios.create({
|
|
1656
|
-
baseURL: window.__env__.VITE_API_URL,
|
|
1657
|
-
timeout: 1e3 * 60 * 10
|
|
1658
|
-
// 设置超时,默认 10 分钟
|
|
1659
|
-
// headers: { 'Content-Type': 'application/json' },
|
|
1660
|
-
});
|
|
1661
|
-
const accessTokenKey = "access-token";
|
|
1662
|
-
const refreshAccessTokenKey = `x-${accessTokenKey}`;
|
|
1663
|
-
const getToken = () => {
|
|
1664
|
-
return Local.get(accessTokenKey);
|
|
1665
|
-
};
|
|
1666
|
-
const getHeader = () => {
|
|
1667
|
-
return { authorization: "Bearer " + getToken() };
|
|
1668
|
-
};
|
|
1669
|
-
const clearAccessTokens = () => {
|
|
1670
|
-
clearTokens();
|
|
1671
|
-
if (window.location.hash.startsWith("#/login")) {
|
|
1672
|
-
window.location.hash = window.location.hash.replace(/([?&])token=[^&]*&?/, "$1").replace(/&$/, "");
|
|
1673
|
-
} else {
|
|
1674
|
-
window.location.reload();
|
|
1675
|
-
}
|
|
1676
|
-
};
|
|
1677
|
-
const clearTokens = () => {
|
|
1678
|
-
Local.remove(accessTokenKey);
|
|
1679
|
-
Local.remove(refreshAccessTokenKey);
|
|
1680
|
-
Session.clear();
|
|
1681
|
-
};
|
|
1682
|
-
const axiosInstance = axios;
|
|
1683
|
-
service.interceptors.request.use(
|
|
1684
|
-
(config) => {
|
|
1685
|
-
var _a;
|
|
1686
|
-
const controller = new AbortController();
|
|
1687
|
-
config.signal = controller.signal;
|
|
1688
|
-
const url = config.url || "";
|
|
1689
|
-
abortControllerMap.set(url, controller);
|
|
1690
|
-
const accessToken = Local.get(accessTokenKey);
|
|
1691
|
-
if (accessToken) {
|
|
1692
|
-
config.headers["Authorization"] = `Bearer ${accessToken}`;
|
|
1693
|
-
const jwt = decryptJWT(accessToken);
|
|
1694
|
-
const exp = getJWTDate(jwt.exp);
|
|
1695
|
-
if (/* @__PURE__ */ new Date() >= exp) {
|
|
1696
|
-
const refreshAccessToken = Local.get(refreshAccessTokenKey);
|
|
1697
|
-
if (refreshAccessToken) {
|
|
1698
|
-
config.headers["X-Authorization"] = `Bearer ${refreshAccessToken}`;
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
if (((_a = config.method) == null ? void 0 : _a.toLowerCase()) === "get" && config.data) {
|
|
1702
|
-
let url2 = config.url + "?" + tansParams(config.data);
|
|
1703
|
-
url2 = url2.slice(0, -1);
|
|
1704
|
-
config.data = {};
|
|
1705
|
-
config.url = url2;
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
return config;
|
|
1709
|
-
},
|
|
1710
|
-
(error) => {
|
|
1711
|
-
return Promise.reject(error);
|
|
1712
|
-
}
|
|
1713
|
-
);
|
|
1714
|
-
service.interceptors.response.use(
|
|
1715
|
-
(res) => {
|
|
1716
|
-
const url = res.config.url || "";
|
|
1717
|
-
abortControllerMap.delete(url);
|
|
1718
|
-
var status = res.status;
|
|
1719
|
-
var serve = res.data;
|
|
1720
|
-
if (status === 401) {
|
|
1721
|
-
clearAccessTokens();
|
|
1722
|
-
}
|
|
1723
|
-
if (status >= 400) {
|
|
1724
|
-
throw new Error(res.statusText || "Request Error.");
|
|
1725
|
-
}
|
|
1726
|
-
if (serve && serve.hasOwnProperty("errors") && serve.errors) {
|
|
1727
|
-
throw new Error(JSON.stringify(serve.errors || "Request Error."));
|
|
1728
|
-
}
|
|
1729
|
-
var accessToken = res.headers[accessTokenKey];
|
|
1730
|
-
var refreshAccessToken = res.headers[refreshAccessTokenKey];
|
|
1731
|
-
if (accessToken === "invalid_token") {
|
|
1732
|
-
clearAccessTokens();
|
|
1733
|
-
} else if (refreshAccessToken && accessToken && accessToken !== "invalid_token") {
|
|
1734
|
-
Local.set(accessTokenKey, accessToken);
|
|
1735
|
-
Local.set(refreshAccessTokenKey, refreshAccessToken);
|
|
1736
|
-
}
|
|
1737
|
-
if (serve.code === 401) {
|
|
1738
|
-
clearAccessTokens();
|
|
1739
|
-
} else if (serve.code === void 0) {
|
|
1740
|
-
return Promise.resolve(res);
|
|
1741
|
-
} else if (serve.code !== 200) {
|
|
1742
|
-
let message = handleResponse(serve.message, 5);
|
|
1743
|
-
elementPlus.ElMessage.error({ dangerouslyUseHTMLString: true, message });
|
|
1744
|
-
throw new Error(serve.message);
|
|
1745
|
-
}
|
|
1746
|
-
return res;
|
|
1747
|
-
},
|
|
1748
|
-
(error) => {
|
|
1749
|
-
if (error.response) {
|
|
1750
|
-
if (error.response.status === 401) {
|
|
1751
|
-
clearAccessTokens();
|
|
1752
|
-
} else if (error.response.statusCode === 404) {
|
|
1753
|
-
elementPlus.ElMessage.error("\u63A5\u53E3\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458");
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
if (error.message.indexOf("timeout") != -1) {
|
|
1757
|
-
elementPlus.ElMessage.error("\u7F51\u7EDC\u8D85\u65F6");
|
|
1758
|
-
} else if (error.message == "Network Error") {
|
|
1759
|
-
elementPlus.ElMessage.error("\u7F51\u7EDC\u8FDE\u63A5\u9519\u8BEF");
|
|
1760
|
-
} else {
|
|
1761
|
-
if (error.response.data) elementPlus.ElMessage.error(error.response.statusText);
|
|
1762
|
-
else elementPlus.ElMessage.error("\u63A5\u53E3\u8DEF\u5F84\u627E\u4E0D\u5230");
|
|
1763
|
-
}
|
|
1764
|
-
return Promise.reject(error);
|
|
1765
|
-
}
|
|
1766
|
-
);
|
|
1767
|
-
const handleResponse = (input, col = 5) => {
|
|
1768
|
-
const messageList = [];
|
|
1769
|
-
const errorCodeRegex = /^\[[A-Za-z0-9_]+\]\s*/;
|
|
1770
|
-
function process(value) {
|
|
1771
|
-
if (value == null) return;
|
|
1772
|
-
if (typeof value === "string") {
|
|
1773
|
-
const clean = value.replace(errorCodeRegex, "");
|
|
1774
|
-
if (clean.trim()) messageList.push(clean.trim());
|
|
1775
|
-
} else if (Array.isArray(value)) {
|
|
1776
|
-
value.forEach((item) => process(item));
|
|
1777
|
-
} else if (typeof value === "object") {
|
|
1778
|
-
Object.values(value).forEach((val) => process(val));
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
try {
|
|
1782
|
-
const parsed = typeof input === "string" ? JSON.parse(input) : input;
|
|
1783
|
-
process(parsed);
|
|
1784
|
-
} catch (e) {
|
|
1785
|
-
process(input);
|
|
1786
|
-
}
|
|
1787
|
-
col = col < 4 ? 4 : col;
|
|
1788
|
-
return messageList.reduce((rows, msg, i) => {
|
|
1789
|
-
if (i % col === 0) rows.push([]);
|
|
1790
|
-
rows[rows.length - 1].push(msg);
|
|
1791
|
-
return rows;
|
|
1792
|
-
}, []).map((row) => row.join("; ")).join("<br/>");
|
|
1793
|
-
};
|
|
1794
|
-
const cancelRequest = (url) => {
|
|
1795
|
-
var _a;
|
|
1796
|
-
const urlList = Array.isArray(url) ? url : [url];
|
|
1797
|
-
for (const _url of urlList) {
|
|
1798
|
-
(_a = abortControllerMap.get(_url)) == null ? void 0 : _a.abort();
|
|
1799
|
-
abortControllerMap.delete(_url);
|
|
1800
|
-
}
|
|
1801
|
-
};
|
|
1802
|
-
const cancelAllRequest = () => {
|
|
1803
|
-
for (const [_, controller] of abortControllerMap) {
|
|
1804
|
-
controller.abort();
|
|
1805
|
-
}
|
|
1806
|
-
abortControllerMap.clear();
|
|
1807
|
-
};
|
|
1808
|
-
function tansParams(params) {
|
|
1809
|
-
let result = "";
|
|
1810
|
-
for (const propName of Object.keys(params)) {
|
|
1811
|
-
const value = params[propName];
|
|
1812
|
-
var part = encodeURIComponent(propName) + "=";
|
|
1813
|
-
if (value !== null && value !== "" && typeof value !== "undefined") {
|
|
1814
|
-
if (typeof value === "object") {
|
|
1815
|
-
for (const key of Object.keys(value)) {
|
|
1816
|
-
if (value[key] !== null && value[key] !== "" && typeof value[key] !== "undefined") {
|
|
1817
|
-
let params2 = propName + "[" + key + "]";
|
|
1818
|
-
var subPart = encodeURIComponent(params2) + "=";
|
|
1819
|
-
result += subPart + encodeURIComponent(value[key]) + "&";
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
} else {
|
|
1823
|
-
result += part + encodeURIComponent(value) + "&";
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
return result;
|
|
1828
|
-
}
|
|
1829
|
-
function decryptJWT(token) {
|
|
1830
|
-
token = token.replace(/_/g, "/").replace(/-/g, "+");
|
|
1831
|
-
var json = decodeURIComponent(escape(window.atob(token.split(".")[1])));
|
|
1832
|
-
return JSON.parse(json);
|
|
1833
|
-
}
|
|
1834
|
-
function getJWTDate(timestamp) {
|
|
1835
|
-
return new Date(timestamp * 1e3);
|
|
1836
|
-
}
|
|
1837
|
-
function request2(config) {
|
|
1838
|
-
return new Promise((resolve, reject) => {
|
|
1839
|
-
service(config).then((res) => {
|
|
1840
|
-
if (res.data.type == "success") {
|
|
1841
|
-
resolve(res.data.result);
|
|
1842
|
-
} else {
|
|
1843
|
-
elementPlus.ElMessage.success(res.data.message);
|
|
1844
|
-
}
|
|
1845
|
-
}).catch((res) => {
|
|
1846
|
-
elementPlus.ElMessage.error(res);
|
|
1847
|
-
reject(res);
|
|
1848
|
-
});
|
|
1849
|
-
});
|
|
1850
|
-
}
|
|
1851
|
-
function reLoadLoginAccessToken(accessInfo) {
|
|
1852
|
-
if ((accessInfo == null ? void 0 : accessInfo.accessToken) && (accessInfo == null ? void 0 : accessInfo.refreshToken)) {
|
|
1853
|
-
Local.remove("tagsViewList");
|
|
1854
|
-
Session.set("token", accessInfo.accessToken);
|
|
1855
|
-
Local.set(accessTokenKey, accessInfo.accessToken);
|
|
1856
|
-
Local.set(refreshAccessTokenKey, accessInfo.refreshToken);
|
|
1857
|
-
setTimeout(() => location.href = "/", 500);
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
function sleep(delay) {
|
|
1861
|
-
return new Promise((resolve) => setTimeout(resolve, delay));
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
1864
|
const useBaseApi = (module, options = {}) => {
|
|
1865
1865
|
const baseUrl = `/api/${module}/`;
|
|
1866
1866
|
const request = (config, cancel = false) => {
|
|
@@ -22265,15 +22265,6 @@
|
|
|
22265
22265
|
const install = installer.install;
|
|
22266
22266
|
|
|
22267
22267
|
exports.AccountTypeEnum = AccountTypeEnum;
|
|
22268
|
-
exports.FButton = FButton;
|
|
22269
|
-
exports.FChart = FChart;
|
|
22270
|
-
exports.FForm = FForm;
|
|
22271
|
-
exports.FInput = FInput;
|
|
22272
|
-
exports.FLayoutPage = FLayoutPage;
|
|
22273
|
-
exports.FLayoutPageItem = FLayoutPageItem;
|
|
22274
|
-
exports.FQueryCondition = FQueryCondition;
|
|
22275
|
-
exports.FSelect = FSelect;
|
|
22276
|
-
exports.FSelectTable = FSelectTable;
|
|
22277
22268
|
exports.HttpMethodEnum = HttpMethodEnum;
|
|
22278
22269
|
exports.JobCreateTypeEnum = JobCreateTypeEnum;
|
|
22279
22270
|
exports.Local = Local;
|