@fmdeui/fmui 1.0.8 → 1.0.9

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.
@@ -1,8 +1,32 @@
1
1
  import { default as commonFunction } from './commonFunction';
2
+ import { EmptyArrayType } from 'fmdeui-fmui';
3
+ import { MessageHandler } from 'element-plus';
4
+ declare const commonFun: {
5
+ percentFormat: (row: EmptyArrayType, column: number, cellValue: string) => string;
6
+ dateFormatYMD: (row: EmptyArrayType, column: number, cellValue: string) => string;
7
+ dateFormatYMDHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
8
+ dateFormatHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
9
+ scaleFormat: (value?: string, scale?: number) => string;
10
+ scale2Format: (value?: string) => string;
11
+ groupSeparator: (value: number, minimumFractionDigits?: number) => string;
12
+ copyText: (text: string) => Promise<unknown>;
13
+ removeHtmlSub: (value: string) => string;
14
+ removeHtml: (value: string) => string;
15
+ getEnumDesc: (key: any, lstEnum: any) => any;
16
+ appendQueryParams: (url: string, params: {
17
+ [key: string]: any;
18
+ }) => string;
19
+ getNameAbbr: (text: string, callback?: (abbr: any) => void) => Promise<any> | MessageHandler | undefined;
20
+ handleConditionalClear: (condition: boolean, fieldValue: any, clearValue?: any) => any;
21
+ getTimeRangePickerShortcuts: () => {
22
+ text: string;
23
+ value: () => Date[];
24
+ }[];
25
+ };
26
+ export { commonFunction, commonFun, };
2
27
  export * from './useLocale';
3
28
  export * from './authFunction';
4
29
  export * from './useVxeTableOptionsHook';
5
30
  export * from './sysInfo';
6
31
  export * from './useInfo';
7
32
  export * from './dateTimeShortCust';
8
- export { commonFunction };
package/es/index.d.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  import { default as installer } from './defaults';
2
- import { default as mittBus } from './utils/mitt';
3
- import { default as setIntroduction } from './utils/setIconfont';
4
2
  import { App } from 'vue';
5
- export { mittBus, setIntroduction };
6
3
  export * from './types';
7
4
  export * from './api';
8
5
  export * from './utils';
package/es/index.mjs CHANGED
@@ -1,11 +1,9 @@
1
1
  import installer from './defaults.mjs';
2
- export { default as mittBus } from './packages/utils/mitt.mjs';
3
- export { setCssCdn, default as setIntroduction, setJsCdn } from './packages/utils/setIconfont.mjs';
4
2
  import './packages/types/index.mjs';
5
3
  export { AccountTypeEnum, HttpMethodEnum, JobCreateTypeEnum } from './packages/api/index.mjs';
6
4
  import './packages/utils/index.mjs';
7
5
  import './packages/stores/index.mjs';
8
- import './packages/hooks/index.mjs';
6
+ export { commonFun } from './packages/hooks/index.mjs';
9
7
  export { initRouter } from './packages/router/index.mjs';
10
8
  export { getCountryCode, i18n, iso_3166_1_CountryList, languageList, mergMessage, setupI18n } from './packages/locale/index.mjs';
11
9
  export { version } from './version.mjs';
@@ -31,7 +29,9 @@ export { initBackEndControlRoutes, setDynamicViewsModules } from './packages/rou
31
29
  export { initFrontEndControlRoutes } from './packages/router/frontEnd.mjs';
32
30
  export { judgementIdCard, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl } from './packages/utils/toolsValidate.mjs';
33
31
  export { loadSysInfo, updateFavicon } from './packages/hooks/sysInfo.mjs';
32
+ export { default as mittBus } from './packages/utils/mitt.mjs';
34
33
  export { saulVModel } from './packages/utils/saulVModel.mjs';
34
+ export { default as setIntroduction } from './packages/utils/setIconfont.mjs';
35
35
  export { signatureByKSort } from './packages/utils/data-signature.mjs';
36
36
  export { useApi, useBaseApi } from './packages/api/base/index.mjs';
37
37
  export { useChangeColor } from './packages/utils/theme.mjs';
@@ -1,7 +1,11 @@
1
+ import commonFunction from './commonFunction.mjs';
1
2
  export { buildLocaleContext, buildTranslator, translate, useLocale } from './useLocale.mjs';
2
3
  export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './authFunction.mjs';
3
4
  export { useVxeTable } from './useVxeTableOptionsHook.mjs';
4
5
  export { loadSysInfo, updateFavicon } from './sysInfo.mjs';
5
6
  export { hasPrivilege, hasRoleCode, isAdmin, isMember, isNormalUser, isSupperAdmin, isTenantAdmin, orgId, orgName, posId, posName, roles, tenantId, userAccount, userEmail, userFriendName, userId, userName, userPhone } from './useInfo.mjs';
6
7
  export { useDateTimeShortCust } from './dateTimeShortCust.mjs';
7
- export { default as commonFunction } from './commonFunction.mjs';
8
+
9
+ const commonFun = commonFunction();
10
+
11
+ export { commonFun, commonFunction };
@@ -1,3 +1,5 @@
1
+ export { default as mittBus } from './mitt.mjs';
2
+ export { default as setIntroduction } from './setIconfont.mjs';
1
3
  export { clone, isObjectValueEqual, judgementSameArr, removeDuplicate } from './arrayOperation.mjs';
2
4
  import './auto-update.mjs';
3
5
  export { base64ToFile, blobToFile, dataURLtoBlob, fileToBase64, urlToBase64 } from './base64Conver.mjs';
@@ -13,10 +15,8 @@ export { gcj02ToBd09, wgs84ToBd09, wgs84ToGcj02 } from './gpsConvertor.mjs';
13
15
  export { StringToObj } from './json-utils.mjs';
14
16
  export { NextLoading } from './loading.mjs';
15
17
  import './md5Signature.mjs';
16
- import './mitt.mjs';
17
18
  export { accessTokenKey, axiosInstance, cancelAllRequest, cancelRequest, clearAccessTokens, clearTokens, decryptJWT, getHeader, getJWTDate, getToken, reLoadLoginAccessToken, refreshAccessTokenKey, request2, default as service, sleep, tansParams } from './request.mjs';
18
19
  export { saulVModel } from './saulVModel.mjs';
19
- export { setCssCdn, setJsCdn } from './setIconfont.mjs';
20
20
  export { Local, Session } from './storage.mjs';
21
21
  export { useChangeColor } from './theme.mjs';
22
22
  export { judgementIdCard, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl } from './toolsValidate.mjs';
@@ -1,3 +1,6 @@
1
+ import { default as mittBus } from './mitt';
2
+ import { default as setIntroduction } from './setIconfont';
3
+ export { mittBus, setIntroduction };
1
4
  export * from './arrayOperation';
2
5
  export * from './auto-update';
3
6
  export * from './base64Conver';
@@ -13,10 +16,8 @@ export * from './gpsConvertor';
13
16
  export * from './json-utils';
14
17
  export * from './loading';
15
18
  export * from './md5Signature';
16
- export * from './mitt';
17
19
  export * from './request';
18
20
  export * from './saulVModel';
19
- export * from './setIconfont';
20
21
  export * from './storage';
21
22
  export * from './theme';
22
23
  export * from './toolsValidate';
package/index.js CHANGED
@@ -1,12 +1,49 @@
1
- /*! fmdeui-fmui v1.0.8 */
1
+ /*! fmdeui-fmui v1.0.9 */
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('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';
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pinia'), require('mitt'), require('crypto-js'), require('xlsx-js-style'), require('element-plus'), require('vue'), require('@element-plus/icons-vue'), 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('@vueuse/core'), require('lodash-es'), require('vue-router'), require('nprogress')) :
4
+ typeof define === 'function' && define.amd ? define(['exports', 'pinia', 'mitt', 'crypto-js', 'xlsx-js-style', 'element-plus', 'vue', '@element-plus/icons-vue', 'axios', 'js-cookie', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'vue-i18n', 'exceljs', '@vueuse/core', 'lodash-es', 'vue-router', 'nprogress'], factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fmdeuifmui = {}, global.Pinia, global.mitt, global.CryptoJS, global.XLSX, global.ElementPlus, global.Vue, global.ElementPlusIconsVue, global.axios, global.Cookies, global.VxeUITable, global.VxeUIPluginRenderElement, global.VxeUIPluginExportXLSX, global.VxeUIExport, global.vueI18n, global.ExcelJS, global.VueUse, global._, global.vueRouter, global.NProgress));
6
+ })(this, (function (exports, pinia$1, mitt, CryptoJS, XLSXS, elementPlus, vue, svg, axios, Cookies, VxeUITable, VxeUIPluginRenderElement, VxeUIPluginExportXLSX, VxeUI, vueI18n, ExcelJS, core, lodashEs, vueRouter, NProgress) { 'use strict';
7
7
 
8
8
  const pinia = pinia$1.createPinia();
9
9
 
10
+ const emitter = mitt();
11
+
12
+ const cssCdnUrlList = [
13
+ // 调整为从本地引入,注释下面的 url
14
+ // '//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css',
15
+ // '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
16
+ ];
17
+ const jsCdnUrlList = [];
18
+ function setCssCdn() {
19
+ if (cssCdnUrlList.length <= 0) return false;
20
+ cssCdnUrlList.map((v) => {
21
+ let link = document.createElement("link");
22
+ link.rel = "stylesheet";
23
+ link.href = v;
24
+ link.crossOrigin = "anonymous";
25
+ document.getElementsByTagName("head")[0].appendChild(link);
26
+ });
27
+ }
28
+ function setJsCdn() {
29
+ if (jsCdnUrlList.length <= 0) return false;
30
+ jsCdnUrlList.map((v) => {
31
+ let link = document.createElement("script");
32
+ link.src = v;
33
+ document.body.appendChild(link);
34
+ });
35
+ }
36
+ const setIntroduction = {
37
+ // 设置css
38
+ cssCdn: () => {
39
+ setCssCdn();
40
+ },
41
+ // 设置js
42
+ jsCdn: () => {
43
+ setJsCdn();
44
+ }
45
+ };
46
+
10
47
  function judgementSameArr(newArr, oldArr) {
11
48
  const news = removeDuplicate(newArr);
12
49
  const olds = removeDuplicate(oldArr);
@@ -1163,8 +1200,6 @@
1163
1200
  }
1164
1201
  };
1165
1202
 
1166
- const emitter = mitt();
1167
-
1168
1203
  const Local = {
1169
1204
  // 查看 v2.4.3版本更新日志
1170
1205
  setKey(key) {
@@ -1445,41 +1480,6 @@
1445
1480
  });
1446
1481
  };
1447
1482
 
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
- const setIntroduction = {
1473
- // 设置css
1474
- cssCdn: () => {
1475
- setCssCdn();
1476
- },
1477
- // 设置js
1478
- jsCdn: () => {
1479
- setJsCdn();
1480
- }
1481
- };
1482
-
1483
1483
  function useChangeColor() {
1484
1484
  const hexToRgb = (str) => {
1485
1485
  let hexs = "";
@@ -18455,31 +18455,6 @@
18455
18455
 
18456
18456
  const FButton = _sfc_main$d;
18457
18457
 
18458
- const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
18459
- const translate = (path, option, locale) => lodashEs.get(locale, path, path).replace(
18460
- /\{(\w+)\}/g,
18461
- (_, key) => {
18462
- var _a;
18463
- return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
18464
- }
18465
- );
18466
- const buildLocaleContext = (locale) => {
18467
- const lang = vue.computed(() => vue.unref(locale).name);
18468
- const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
18469
- return {
18470
- lang,
18471
- locale: localeRef,
18472
- t: buildTranslator(locale)
18473
- };
18474
- };
18475
- const useLocale = (localeOverrides) => {
18476
- const locale = localeOverrides || vue.inject(elementPlus.localeContextKey, vue.ref());
18477
- return buildLocaleContext(vue.computed(() => {
18478
- var _a;
18479
- return ((_a = locale == null ? void 0 : locale.value) == null ? void 0 : _a.plus) ? locale.value : plusZhCn;
18480
- }));
18481
- };
18482
-
18483
18458
  const useKeepALiveNames = pinia$1.defineStore("keepALiveNames", {
18484
18459
  state: () => ({
18485
18460
  keepAliveNames: [],
@@ -18557,6 +18532,202 @@
18557
18532
  }
18558
18533
  });
18559
18534
 
18535
+ const themeStore = useThemeConfig();
18536
+ function commonFunction() {
18537
+ const { t } = vueI18n.useI18n();
18538
+ const { copy, isSupported } = core.useClipboard();
18539
+ const percentFormat = (row, column, cellValue) => {
18540
+ return cellValue ? `${cellValue}%` : "-";
18541
+ };
18542
+ const dateFormatYMD = (row, column, cellValue) => {
18543
+ if (!cellValue) return "-";
18544
+ return formatDate(new Date(cellValue), "YYYY-mm-dd");
18545
+ };
18546
+ const dateFormatYMDHMS = (row, column, cellValue) => {
18547
+ if (!cellValue) return "-";
18548
+ return formatDate(new Date(cellValue), "YYYY-mm-dd HH:MM:SS");
18549
+ };
18550
+ const dateFormatHMS = (row, column, cellValue) => {
18551
+ if (!cellValue) return "-";
18552
+ let time = 0;
18553
+ if (typeof row === "number") time = row;
18554
+ if (typeof cellValue === "number") time = cellValue;
18555
+ return formatDate(new Date(time * 1e3), "HH:MM:SS");
18556
+ };
18557
+ const scaleFormat = (value = "0", scale = 4) => {
18558
+ return Number.parseFloat(value).toFixed(scale);
18559
+ };
18560
+ const scale2Format = (value = "0") => {
18561
+ return Number.parseFloat(value).toFixed(2);
18562
+ };
18563
+ const groupSeparator = (value, minimumFractionDigits = 2) => {
18564
+ return value.toLocaleString("en-US", {
18565
+ minimumFractionDigits,
18566
+ maximumFractionDigits: 2
18567
+ });
18568
+ };
18569
+ const copyText = (text) => {
18570
+ return new Promise((resolve, reject) => {
18571
+ try {
18572
+ if (!isSupported.value) {
18573
+ console.error("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
18574
+ reject("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
18575
+ } else {
18576
+ copy(text);
18577
+ elementPlus.ElMessage.success(t("message.layout.copyTextSuccess"));
18578
+ resolve(text);
18579
+ }
18580
+ } catch (e) {
18581
+ elementPlus.ElMessage.error(t("message.layout.copyTextError"));
18582
+ reject(e);
18583
+ }
18584
+ });
18585
+ };
18586
+ const removeHtmlSub = (value) => {
18587
+ var str = value.replace(/<[^>]+>/g, "");
18588
+ if (str.length > 50) return str.substring(0, 50) + "......";
18589
+ else return str;
18590
+ };
18591
+ const removeHtml = (value) => {
18592
+ return value.replace(/<[^>]+>/g, "");
18593
+ };
18594
+ const getEnumDesc = (key, lstEnum) => {
18595
+ var _a;
18596
+ return (_a = lstEnum.find((x) => x.value == key)) == null ? void 0 : _a.describe;
18597
+ };
18598
+ const appendQueryParams = (url, params) => {
18599
+ if (!params || Object.keys(params).length == 0) return url;
18600
+ const queryString = Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
18601
+ return `${url}${url.includes("?") ? "&" : "?"}${queryString}`;
18602
+ };
18603
+ const getNameAbbr = (text, callback) => {
18604
+ if (!text) return elementPlus.ElMessage.error("\u83B7\u53D6\u7B80\u79F0\u6587\u672C\u4E0D\u80FD\u4E3A\u7A7A");
18605
+ try {
18606
+ return useBaseApi("sysCommon").post({ text }, "nameAbbr").then((res) => {
18607
+ if (callback) callback(res.data.result);
18608
+ return res.data.result;
18609
+ });
18610
+ } catch (e) {
18611
+ elementPlus.ElMessage.error("\u83B7\u53D6\u5931\u8D25");
18612
+ }
18613
+ };
18614
+ const handleConditionalClear = (condition, fieldValue, clearValue = void 0) => {
18615
+ if (condition) {
18616
+ return clearValue;
18617
+ }
18618
+ return fieldValue;
18619
+ };
18620
+ const getTimeRangePickerShortcuts = () => {
18621
+ return [
18622
+ {
18623
+ text: "\u8FD1\u4E00\u5468",
18624
+ value: () => {
18625
+ const now = new Date(themeStore.themeConfig.serverTime);
18626
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18627
+ const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7);
18628
+ return [start, end];
18629
+ }
18630
+ },
18631
+ {
18632
+ text: "\u8FD1\u4E00\u6708",
18633
+ value: () => {
18634
+ const now = new Date(themeStore.themeConfig.serverTime);
18635
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18636
+ const start = new Date(now.getFullYear(), now.getMonth() - 1, now.getDate());
18637
+ return [start, end];
18638
+ }
18639
+ },
18640
+ {
18641
+ text: "\u8FD1\u4E09\u6708",
18642
+ value: () => {
18643
+ const now = new Date(themeStore.themeConfig.serverTime);
18644
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18645
+ const start = new Date(now.getFullYear(), now.getMonth() - 3, now.getDate());
18646
+ return [start, end];
18647
+ }
18648
+ },
18649
+ {
18650
+ text: "\u8FD1\u534A\u5E74",
18651
+ value: () => {
18652
+ const now = new Date(themeStore.themeConfig.serverTime);
18653
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18654
+ const start = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate());
18655
+ return [start, end];
18656
+ }
18657
+ },
18658
+ {
18659
+ text: "\u672C\u5E74",
18660
+ value: () => {
18661
+ const now = new Date(themeStore.themeConfig.serverTime);
18662
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
18663
+ const start = new Date(now.getFullYear(), 0, 1);
18664
+ return [start, end];
18665
+ }
18666
+ },
18667
+ {
18668
+ text: "\u8FD1\u4E24\u5E74",
18669
+ value: () => {
18670
+ const now = new Date(themeStore.themeConfig.serverTime);
18671
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
18672
+ const start = new Date(now.getFullYear() - 1, 0, 1);
18673
+ return [start, end];
18674
+ }
18675
+ },
18676
+ {
18677
+ text: "\u8FD1\u4E09\u5E74",
18678
+ value: () => {
18679
+ const now = new Date(themeStore.themeConfig.serverTime);
18680
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
18681
+ const start = new Date(now.getFullYear() - 2, 0, 1);
18682
+ return [start, end];
18683
+ }
18684
+ }
18685
+ ];
18686
+ };
18687
+ return {
18688
+ percentFormat,
18689
+ dateFormatYMD,
18690
+ dateFormatYMDHMS,
18691
+ dateFormatHMS,
18692
+ scaleFormat,
18693
+ scale2Format,
18694
+ groupSeparator,
18695
+ copyText,
18696
+ removeHtmlSub,
18697
+ removeHtml,
18698
+ getEnumDesc,
18699
+ appendQueryParams,
18700
+ getNameAbbr,
18701
+ handleConditionalClear,
18702
+ getTimeRangePickerShortcuts
18703
+ };
18704
+ }
18705
+
18706
+ const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
18707
+ const translate = (path, option, locale) => lodashEs.get(locale, path, path).replace(
18708
+ /\{(\w+)\}/g,
18709
+ (_, key) => {
18710
+ var _a;
18711
+ return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
18712
+ }
18713
+ );
18714
+ const buildLocaleContext = (locale) => {
18715
+ const lang = vue.computed(() => vue.unref(locale).name);
18716
+ const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
18717
+ return {
18718
+ lang,
18719
+ locale: localeRef,
18720
+ t: buildTranslator(locale)
18721
+ };
18722
+ };
18723
+ const useLocale = (localeOverrides) => {
18724
+ const locale = localeOverrides || vue.inject(elementPlus.localeContextKey, vue.ref());
18725
+ return buildLocaleContext(vue.computed(() => {
18726
+ var _a;
18727
+ return ((_a = locale == null ? void 0 : locale.value) == null ? void 0 : _a.plus) ? locale.value : plusZhCn;
18728
+ }));
18729
+ };
18730
+
18560
18731
  function auth(value) {
18561
18732
  const stores = useUserInfo();
18562
18733
  return stores.userInfos.authApiList.some((v) => v === value);
@@ -18860,176 +19031,7 @@
18860
19031
  ];
18861
19032
  };
18862
19033
 
18863
- const themeStore = useThemeConfig();
18864
- function commonFunction() {
18865
- const { t } = vueI18n.useI18n();
18866
- const { copy, isSupported } = core.useClipboard();
18867
- const percentFormat = (row, column, cellValue) => {
18868
- return cellValue ? `${cellValue}%` : "-";
18869
- };
18870
- const dateFormatYMD = (row, column, cellValue) => {
18871
- if (!cellValue) return "-";
18872
- return formatDate(new Date(cellValue), "YYYY-mm-dd");
18873
- };
18874
- const dateFormatYMDHMS = (row, column, cellValue) => {
18875
- if (!cellValue) return "-";
18876
- return formatDate(new Date(cellValue), "YYYY-mm-dd HH:MM:SS");
18877
- };
18878
- const dateFormatHMS = (row, column, cellValue) => {
18879
- if (!cellValue) return "-";
18880
- let time = 0;
18881
- if (typeof row === "number") time = row;
18882
- if (typeof cellValue === "number") time = cellValue;
18883
- return formatDate(new Date(time * 1e3), "HH:MM:SS");
18884
- };
18885
- const scaleFormat = (value = "0", scale = 4) => {
18886
- return Number.parseFloat(value).toFixed(scale);
18887
- };
18888
- const scale2Format = (value = "0") => {
18889
- return Number.parseFloat(value).toFixed(2);
18890
- };
18891
- const groupSeparator = (value, minimumFractionDigits = 2) => {
18892
- return value.toLocaleString("en-US", {
18893
- minimumFractionDigits,
18894
- maximumFractionDigits: 2
18895
- });
18896
- };
18897
- const copyText = (text) => {
18898
- return new Promise((resolve, reject) => {
18899
- try {
18900
- if (!isSupported.value) {
18901
- console.error("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
18902
- reject("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
18903
- } else {
18904
- copy(text);
18905
- elementPlus.ElMessage.success(t("message.layout.copyTextSuccess"));
18906
- resolve(text);
18907
- }
18908
- } catch (e) {
18909
- elementPlus.ElMessage.error(t("message.layout.copyTextError"));
18910
- reject(e);
18911
- }
18912
- });
18913
- };
18914
- const removeHtmlSub = (value) => {
18915
- var str = value.replace(/<[^>]+>/g, "");
18916
- if (str.length > 50) return str.substring(0, 50) + "......";
18917
- else return str;
18918
- };
18919
- const removeHtml = (value) => {
18920
- return value.replace(/<[^>]+>/g, "");
18921
- };
18922
- const getEnumDesc = (key, lstEnum) => {
18923
- var _a;
18924
- return (_a = lstEnum.find((x) => x.value == key)) == null ? void 0 : _a.describe;
18925
- };
18926
- const appendQueryParams = (url, params) => {
18927
- if (!params || Object.keys(params).length == 0) return url;
18928
- const queryString = Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
18929
- return `${url}${url.includes("?") ? "&" : "?"}${queryString}`;
18930
- };
18931
- const getNameAbbr = (text, callback) => {
18932
- if (!text) return elementPlus.ElMessage.error("\u83B7\u53D6\u7B80\u79F0\u6587\u672C\u4E0D\u80FD\u4E3A\u7A7A");
18933
- try {
18934
- return useBaseApi("sysCommon").post({ text }, "nameAbbr").then((res) => {
18935
- if (callback) callback(res.data.result);
18936
- return res.data.result;
18937
- });
18938
- } catch (e) {
18939
- elementPlus.ElMessage.error("\u83B7\u53D6\u5931\u8D25");
18940
- }
18941
- };
18942
- const handleConditionalClear = (condition, fieldValue, clearValue = void 0) => {
18943
- if (condition) {
18944
- return clearValue;
18945
- }
18946
- return fieldValue;
18947
- };
18948
- const getTimeRangePickerShortcuts = () => {
18949
- return [
18950
- {
18951
- text: "\u8FD1\u4E00\u5468",
18952
- value: () => {
18953
- const now = new Date(themeStore.themeConfig.serverTime);
18954
- const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18955
- const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7);
18956
- return [start, end];
18957
- }
18958
- },
18959
- {
18960
- text: "\u8FD1\u4E00\u6708",
18961
- value: () => {
18962
- const now = new Date(themeStore.themeConfig.serverTime);
18963
- const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18964
- const start = new Date(now.getFullYear(), now.getMonth() - 1, now.getDate());
18965
- return [start, end];
18966
- }
18967
- },
18968
- {
18969
- text: "\u8FD1\u4E09\u6708",
18970
- value: () => {
18971
- const now = new Date(themeStore.themeConfig.serverTime);
18972
- const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18973
- const start = new Date(now.getFullYear(), now.getMonth() - 3, now.getDate());
18974
- return [start, end];
18975
- }
18976
- },
18977
- {
18978
- text: "\u8FD1\u534A\u5E74",
18979
- value: () => {
18980
- const now = new Date(themeStore.themeConfig.serverTime);
18981
- const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18982
- const start = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate());
18983
- return [start, end];
18984
- }
18985
- },
18986
- {
18987
- text: "\u672C\u5E74",
18988
- value: () => {
18989
- const now = new Date(themeStore.themeConfig.serverTime);
18990
- const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
18991
- const start = new Date(now.getFullYear(), 0, 1);
18992
- return [start, end];
18993
- }
18994
- },
18995
- {
18996
- text: "\u8FD1\u4E24\u5E74",
18997
- value: () => {
18998
- const now = new Date(themeStore.themeConfig.serverTime);
18999
- const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
19000
- const start = new Date(now.getFullYear() - 1, 0, 1);
19001
- return [start, end];
19002
- }
19003
- },
19004
- {
19005
- text: "\u8FD1\u4E09\u5E74",
19006
- value: () => {
19007
- const now = new Date(themeStore.themeConfig.serverTime);
19008
- const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
19009
- const start = new Date(now.getFullYear() - 2, 0, 1);
19010
- return [start, end];
19011
- }
19012
- }
19013
- ];
19014
- };
19015
- return {
19016
- percentFormat,
19017
- dateFormatYMD,
19018
- dateFormatYMDHMS,
19019
- dateFormatHMS,
19020
- scaleFormat,
19021
- scale2Format,
19022
- groupSeparator,
19023
- copyText,
19024
- removeHtmlSub,
19025
- removeHtml,
19026
- getEnumDesc,
19027
- appendQueryParams,
19028
- getNameAbbr,
19029
- handleConditionalClear,
19030
- getTimeRangePickerShortcuts
19031
- };
19032
- }
19034
+ const commonFun = commonFunction();
19033
19035
 
19034
19036
  const _hoisted_1$6 = { key: 0 };
19035
19037
  const _hoisted_2$3 = { key: 0 };
@@ -22587,6 +22589,7 @@
22587
22589
  exports.clearAccessTokens = clearAccessTokens;
22588
22590
  exports.clearTokens = clearTokens;
22589
22591
  exports.clone = clone;
22592
+ exports.commonFun = commonFun;
22590
22593
  exports.commonFunction = commonFunction;
22591
22594
  exports.configureRoutes = configureRoutes;
22592
22595
  exports.dataURLtoBlob = dataURLtoBlob;
@@ -22647,10 +22650,8 @@
22647
22650
  exports.roles = roles;
22648
22651
  exports.saulVModel = saulVModel;
22649
22652
  exports.service = service;
22650
- exports.setCssCdn = setCssCdn;
22651
22653
  exports.setDynamicViewsModules = setDynamicViewsModules;
22652
22654
  exports.setIntroduction = setIntroduction;
22653
- exports.setJsCdn = setJsCdn;
22654
22655
  exports.setPathPrefix = setPathPrefix;
22655
22656
  exports.setupI18n = setupI18n;
22656
22657
  exports.signatureByKSort = signatureByKSort;