eoss-ui 0.3.97
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/CHANGELOG.md +929 -0
- package/README.md +30 -0
- package/lib/button-group.js +2857 -0
- package/lib/button.js +2884 -0
- package/lib/card.js +603 -0
- package/lib/cascader.js +373 -0
- package/lib/checkbox-group.js +3099 -0
- package/lib/clients.js +375 -0
- package/lib/config/api.js +205 -0
- package/lib/data-table-form.js +3848 -0
- package/lib/data-table.js +6315 -0
- package/lib/date-picker.js +2821 -0
- package/lib/dialog.js +3730 -0
- package/lib/enterprise.js +372 -0
- package/lib/eoss-ui.common.js +65365 -0
- package/lib/error-page.js +293 -0
- package/lib/flow-group.js +4200 -0
- package/lib/flow-list.js +4350 -0
- package/lib/flow.js +12893 -0
- package/lib/form.js +15635 -0
- package/lib/handle-user.js +2900 -0
- package/lib/handler.js +3118 -0
- package/lib/index.js +1 -0
- package/lib/input-number.js +2743 -0
- package/lib/input.js +2935 -0
- package/lib/label.js +411 -0
- package/lib/login.js +5048 -0
- package/lib/main.js +5816 -0
- package/lib/mainComp.js +6530 -0
- package/lib/menu.js +529 -0
- package/lib/nav.js +3048 -0
- package/lib/notify.js +1079 -0
- package/lib/page.js +3036 -0
- package/lib/pagination.js +354 -0
- package/lib/player.js +2904 -0
- package/lib/qr-code.js +2860 -0
- package/lib/radio-group.js +3091 -0
- package/lib/select-ganged.js +3242 -0
- package/lib/select.js +3295 -0
- package/lib/selector-panel.js +4425 -0
- package/lib/selector.js +3722 -0
- package/lib/sizer.js +3067 -0
- package/lib/steps.js +2943 -0
- package/lib/switch.js +2784 -0
- package/lib/table-form.js +6211 -0
- package/lib/tabs-panel.js +274 -0
- package/lib/tabs.js +4988 -0
- package/lib/theme-chalk/base.css +1 -0
- package/lib/theme-chalk/button-group.css +1 -0
- package/lib/theme-chalk/button.css +0 -0
- package/lib/theme-chalk/card.css +1 -0
- package/lib/theme-chalk/cascader.css +0 -0
- package/lib/theme-chalk/checkbox-group.css +1 -0
- package/lib/theme-chalk/clients.css +1 -0
- package/lib/theme-chalk/data-table-form.css +1 -0
- package/lib/theme-chalk/data-table.css +1 -0
- package/lib/theme-chalk/date-picker.css +1 -0
- package/lib/theme-chalk/dialog.css +1 -0
- package/lib/theme-chalk/enterprise.css +1 -0
- package/lib/theme-chalk/error-page.css +1 -0
- package/lib/theme-chalk/flow-chart.css +0 -0
- package/lib/theme-chalk/flow-group.css +1 -0
- package/lib/theme-chalk/flow-list.css +1 -0
- package/lib/theme-chalk/flow.css +1 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/form.css +1 -0
- package/lib/theme-chalk/handle-user.css +1 -0
- package/lib/theme-chalk/handler.css +1 -0
- package/lib/theme-chalk/icon.css +1 -0
- package/lib/theme-chalk/index.css +1 -0
- package/lib/theme-chalk/input-number.css +0 -0
- package/lib/theme-chalk/input.css +1 -0
- package/lib/theme-chalk/label.css +1 -0
- package/lib/theme-chalk/login.css +1 -0
- package/lib/theme-chalk/main.css +1 -0
- package/lib/theme-chalk/mainComp.css +0 -0
- package/lib/theme-chalk/menu.css +1 -0
- package/lib/theme-chalk/nav.css +1 -0
- package/lib/theme-chalk/notify.css +0 -0
- package/lib/theme-chalk/page.css +1 -0
- package/lib/theme-chalk/pagination.css +1 -0
- package/lib/theme-chalk/player.css +1 -0
- package/lib/theme-chalk/qr-code.css +1 -0
- package/lib/theme-chalk/radio-group.css +1 -0
- package/lib/theme-chalk/radio.css +1 -0
- package/lib/theme-chalk/select-ganged.css +1 -0
- package/lib/theme-chalk/select.css +0 -0
- package/lib/theme-chalk/selector-panel.css +1 -0
- package/lib/theme-chalk/selector.css +1 -0
- package/lib/theme-chalk/sizer.css +1 -0
- package/lib/theme-chalk/steps.css +1 -0
- package/lib/theme-chalk/switch.css +1 -0
- package/lib/theme-chalk/table-form.css +0 -0
- package/lib/theme-chalk/tabs-panel.css +0 -0
- package/lib/theme-chalk/tabs.css +1 -0
- package/lib/theme-chalk/tips.css +1 -0
- package/lib/theme-chalk/toolbar.css +1 -0
- package/lib/theme-chalk/tree-group.css +1 -0
- package/lib/theme-chalk/tree.css +1 -0
- package/lib/theme-chalk/upload.css +1 -0
- package/lib/theme-chalk/wujie.css +0 -0
- package/lib/theme-chalk/wxlogin.css +1 -0
- package/lib/tips.js +2830 -0
- package/lib/toolbar.js +531 -0
- package/lib/tree-group.js +3373 -0
- package/lib/tree.js +3482 -0
- package/lib/upload.js +3913 -0
- package/lib/utils/bus.js +9 -0
- package/lib/utils/date-util.js +318 -0
- package/lib/utils/http.js +58 -0
- package/lib/utils/rules.js +19 -0
- package/lib/utils/store.js +22 -0
- package/lib/utils/util.js +2056 -0
- package/lib/wujie.js +2845 -0
- package/lib/wxlogin.js +2799 -0
- package/package.json +151 -0
- package/packages/button/index.js +5 -0
- package/packages/button/src/main.vue +264 -0
- package/packages/button-group/index.js +5 -0
- package/packages/button-group/src/main.vue +130 -0
- package/packages/card/index.js +5 -0
- package/packages/card/src/main.vue +144 -0
- package/packages/cascader/index.js +5 -0
- package/packages/cascader/src/main.vue +144 -0
- package/packages/checkbox-group/index.js +5 -0
- package/packages/checkbox-group/src/main.vue +285 -0
- package/packages/clients/index.js +5 -0
- package/packages/clients/src/main.vue +50 -0
- package/packages/data-table/index.js +5 -0
- package/packages/data-table/src/children.vue +40 -0
- package/packages/data-table/src/column.vue +796 -0
- package/packages/data-table/src/main copy.vue +1383 -0
- package/packages/data-table/src/main.vue +1229 -0
- package/packages/data-table/src/mixins/table.js +12 -0
- package/packages/data-table/src/sizer.vue +160 -0
- package/packages/data-table-form/index.js +5 -0
- package/packages/data-table-form/src/colgroup.vue +17 -0
- package/packages/data-table-form/src/main.vue +167 -0
- package/packages/data-table-form/src/table.vue +192 -0
- package/packages/data-table-form/src/tbody.vue +219 -0
- package/packages/data-table-form/src/thead.vue +68 -0
- package/packages/date-picker/index.js +5 -0
- package/packages/date-picker/src/main.vue +185 -0
- package/packages/dialog/index.js +5 -0
- package/packages/dialog/src/main.vue +442 -0
- package/packages/enterprise/index.js +5 -0
- package/packages/enterprise/src/main.vue +66 -0
- package/packages/error-page/index.js +5 -0
- package/packages/error-page/src/main.vue +44 -0
- package/packages/flow/index.js +5 -0
- package/packages/flow/src/component/CommonOpinions.vue +290 -0
- package/packages/flow/src/component/CustomPreset.vue +311 -0
- package/packages/flow/src/component/FileList.vue +97 -0
- package/packages/flow/src/component/Preset.vue +253 -0
- package/packages/flow/src/component/SendMsg.vue +221 -0
- package/packages/flow/src/component/TimeLimit.vue +190 -0
- package/packages/flow/src/component/taskUnionExamine.vue +507 -0
- package/packages/flow/src/form.vue +120 -0
- package/packages/flow/src/main.vue +2107 -0
- package/packages/flow/src/processForm.vue +866 -0
- package/packages/flow/src/processReject.vue +262 -0
- package/packages/flow/src/selectUser.vue +425 -0
- package/packages/flow/src/startTaskRead.vue +556 -0
- package/packages/flow/src/table.vue +51 -0
- package/packages/flow-group/index.js +5 -0
- package/packages/flow-group/src/main.vue +540 -0
- package/packages/flow-list/index.js +5 -0
- package/packages/flow-list/src/flow-table.vue +445 -0
- package/packages/flow-list/src/main.vue +456 -0
- package/packages/form/index.js +5 -0
- package/packages/form/src/main.vue +4429 -0
- package/packages/form/src/table.vue +1196 -0
- package/packages/handle-user/index.js +5 -0
- package/packages/handle-user/src/main.vue +122 -0
- package/packages/handler/index.js +5 -0
- package/packages/handler/src/main.vue +306 -0
- package/packages/input/index.js +5 -0
- package/packages/input/src/main.vue +307 -0
- package/packages/input-number/index.js +5 -0
- package/packages/input-number/src/main.vue +106 -0
- package/packages/label/index.js +5 -0
- package/packages/label/src/main.vue +208 -0
- package/packages/login/index.js +5 -0
- package/packages/login/src/main.vue +1193 -0
- package/packages/login/src/resetPassword.vue +332 -0
- package/packages/main/index.js +5 -0
- package/packages/main/src/main.vue +1496 -0
- package/packages/main/src/message.vue +239 -0
- package/packages/main/src/notice.vue +145 -0
- package/packages/main/src/settings.vue +105 -0
- package/packages/main/src/userinfo.vue +430 -0
- package/packages/mainComp/index.js +5 -0
- package/packages/mainComp/src/async-component/index.vue +85 -0
- package/packages/mainComp/src/main.vue +1934 -0
- package/packages/mainComp/src/message.vue +239 -0
- package/packages/mainComp/src/notice.vue +152 -0
- package/packages/mainComp/src/settings.vue +105 -0
- package/packages/mainComp/src/userinfo.vue +423 -0
- package/packages/menu/index.js +5 -0
- package/packages/menu/src/main.vue +401 -0
- package/packages/nav/index.js +5 -0
- package/packages/nav/src/main.vue +250 -0
- package/packages/notify/index.js +5 -0
- package/packages/notify/src/main.vue +538 -0
- package/packages/page/index.js +5 -0
- package/packages/page/src/main.vue +167 -0
- package/packages/pagination/index.js +5 -0
- package/packages/pagination/src/main.vue +77 -0
- package/packages/player/index.js +5 -0
- package/packages/player/src/main.vue +194 -0
- package/packages/qr-code/index.js +5 -0
- package/packages/qr-code/src/main.vue +154 -0
- package/packages/radio/index.js +5 -0
- package/packages/radio/src/main.vue +259 -0
- package/packages/radio-group/index.js +6 -0
- package/packages/radio-group/src/main.vue +267 -0
- package/packages/select/index.js +5 -0
- package/packages/select/src/main.vue +683 -0
- package/packages/select-ganged/index.js +5 -0
- package/packages/select-ganged/src/main.vue +686 -0
- package/packages/selector/index.js +5 -0
- package/packages/selector/src/main.vue +588 -0
- package/packages/selector-panel/index.js +5 -0
- package/packages/selector-panel/src/main.vue +968 -0
- package/packages/selector-panel/src/selection.vue +142 -0
- package/packages/selector-panel/src/tree.vue +129 -0
- package/packages/sizer/index.js +5 -0
- package/packages/sizer/src/main.vue +254 -0
- package/packages/steps/index.js +5 -0
- package/packages/steps/src/main.vue +175 -0
- package/packages/switch/index.js +5 -0
- package/packages/switch/src/main.vue +154 -0
- package/packages/table-form/index.js +5 -0
- package/packages/tabs/index.js +5 -0
- package/packages/tabs/src/main.vue +749 -0
- package/packages/tabs-panel/index.js +5 -0
- package/packages/tabs-panel/src/main.vue +18 -0
- package/packages/theme-chalk/README.md +33 -0
- package/packages/theme-chalk/lib/base.css +1 -0
- package/packages/theme-chalk/lib/button-group.css +1 -0
- package/packages/theme-chalk/lib/button.css +0 -0
- package/packages/theme-chalk/lib/card.css +1 -0
- package/packages/theme-chalk/lib/cascader.css +0 -0
- package/packages/theme-chalk/lib/checkbox-group.css +1 -0
- package/packages/theme-chalk/lib/clients.css +1 -0
- package/packages/theme-chalk/lib/data-table-form.css +1 -0
- package/packages/theme-chalk/lib/data-table.css +1 -0
- package/packages/theme-chalk/lib/date-picker.css +1 -0
- package/packages/theme-chalk/lib/dialog.css +1 -0
- package/packages/theme-chalk/lib/enterprise.css +1 -0
- package/packages/theme-chalk/lib/error-page.css +1 -0
- package/packages/theme-chalk/lib/flow-chart.css +0 -0
- package/packages/theme-chalk/lib/flow-group.css +1 -0
- package/packages/theme-chalk/lib/flow-list.css +1 -0
- package/packages/theme-chalk/lib/flow.css +1 -0
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/form.css +1 -0
- package/packages/theme-chalk/lib/handle-user.css +1 -0
- package/packages/theme-chalk/lib/handler.css +1 -0
- package/packages/theme-chalk/lib/icon.css +1 -0
- package/packages/theme-chalk/lib/index.css +1 -0
- package/packages/theme-chalk/lib/input-number.css +0 -0
- package/packages/theme-chalk/lib/input.css +1 -0
- package/packages/theme-chalk/lib/label.css +1 -0
- package/packages/theme-chalk/lib/login.css +1 -0
- package/packages/theme-chalk/lib/main.css +1 -0
- package/packages/theme-chalk/lib/mainComp.css +0 -0
- package/packages/theme-chalk/lib/menu.css +1 -0
- package/packages/theme-chalk/lib/nav.css +1 -0
- package/packages/theme-chalk/lib/notify.css +0 -0
- package/packages/theme-chalk/lib/page.css +1 -0
- package/packages/theme-chalk/lib/pagination.css +1 -0
- package/packages/theme-chalk/lib/player.css +1 -0
- package/packages/theme-chalk/lib/qr-code.css +1 -0
- package/packages/theme-chalk/lib/radio-group.css +1 -0
- package/packages/theme-chalk/lib/radio.css +1 -0
- package/packages/theme-chalk/lib/select-ganged.css +1 -0
- package/packages/theme-chalk/lib/select.css +0 -0
- package/packages/theme-chalk/lib/selector-panel.css +1 -0
- package/packages/theme-chalk/lib/selector.css +1 -0
- package/packages/theme-chalk/lib/sizer.css +1 -0
- package/packages/theme-chalk/lib/steps.css +1 -0
- package/packages/theme-chalk/lib/switch.css +1 -0
- package/packages/theme-chalk/lib/table-form.css +0 -0
- package/packages/theme-chalk/lib/tabs-panel.css +0 -0
- package/packages/theme-chalk/lib/tabs.css +1 -0
- package/packages/theme-chalk/lib/tips.css +1 -0
- package/packages/theme-chalk/lib/toolbar.css +1 -0
- package/packages/theme-chalk/lib/tree-group.css +1 -0
- package/packages/theme-chalk/lib/tree.css +1 -0
- package/packages/theme-chalk/lib/upload.css +1 -0
- package/packages/theme-chalk/lib/wujie.css +0 -0
- package/packages/theme-chalk/lib/wxlogin.css +1 -0
- package/packages/theme-chalk/package.json +35 -0
- package/packages/theme-chalk/src/base.scss +165 -0
- package/packages/theme-chalk/src/button-group.scss +9 -0
- package/packages/theme-chalk/src/button.scss +0 -0
- package/packages/theme-chalk/src/card.scss +55 -0
- package/packages/theme-chalk/src/cascader.scss +0 -0
- package/packages/theme-chalk/src/checkbox-group.scss +8 -0
- package/packages/theme-chalk/src/clients.scss +72 -0
- package/packages/theme-chalk/src/common/var.scss +1516 -0
- package/packages/theme-chalk/src/data-table-form.scss +55 -0
- package/packages/theme-chalk/src/data-table.scss +202 -0
- package/packages/theme-chalk/src/date-picker.scss +8 -0
- package/packages/theme-chalk/src/dialog.scss +52 -0
- package/packages/theme-chalk/src/enterprise.scss +5 -0
- package/packages/theme-chalk/src/error-page.scss +18 -0
- package/packages/theme-chalk/src/flow-chart.scss +0 -0
- package/packages/theme-chalk/src/flow-group.scss +101 -0
- package/packages/theme-chalk/src/flow-list.scss +41 -0
- package/packages/theme-chalk/src/flow.scss +285 -0
- package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/src/form.scss +451 -0
- package/packages/theme-chalk/src/handle-user.scss +40 -0
- package/packages/theme-chalk/src/handler.scss +131 -0
- package/packages/theme-chalk/src/icon.scss +1714 -0
- package/packages/theme-chalk/src/index.scss +50 -0
- package/packages/theme-chalk/src/input-number.scss +0 -0
- package/packages/theme-chalk/src/input.scss +3 -0
- package/packages/theme-chalk/src/label.scss +24 -0
- package/packages/theme-chalk/src/login.scss +490 -0
- package/packages/theme-chalk/src/main.scss +483 -0
- package/packages/theme-chalk/src/mainComp.scss +0 -0
- package/packages/theme-chalk/src/menu.scss +201 -0
- package/packages/theme-chalk/src/mixins/color.scss +117 -0
- package/packages/theme-chalk/src/mixins/mixins.scss +25 -0
- package/packages/theme-chalk/src/nav.scss +73 -0
- package/packages/theme-chalk/src/notify.scss +0 -0
- package/packages/theme-chalk/src/page.scss +3 -0
- package/packages/theme-chalk/src/pagination.scss +14 -0
- package/packages/theme-chalk/src/player.scss +9 -0
- package/packages/theme-chalk/src/qr-code.scss +17 -0
- package/packages/theme-chalk/src/radio-group.scss +9 -0
- package/packages/theme-chalk/src/radio.scss +3 -0
- package/packages/theme-chalk/src/select-ganged.scss +9 -0
- package/packages/theme-chalk/src/select.scss +0 -0
- package/packages/theme-chalk/src/selector-panel.scss +203 -0
- package/packages/theme-chalk/src/selector.scss +85 -0
- package/packages/theme-chalk/src/sizer.scss +36 -0
- package/packages/theme-chalk/src/steps.scss +88 -0
- package/packages/theme-chalk/src/switch.scss +3 -0
- package/packages/theme-chalk/src/table-form.scss +1 -0
- package/packages/theme-chalk/src/tabs-panel.scss +0 -0
- package/packages/theme-chalk/src/tabs.scss +91 -0
- package/packages/theme-chalk/src/tips.scss +7 -0
- package/packages/theme-chalk/src/toolbar.scss +121 -0
- package/packages/theme-chalk/src/tree-group.scss +64 -0
- package/packages/theme-chalk/src/tree.scss +140 -0
- package/packages/theme-chalk/src/upload.scss +131 -0
- package/packages/theme-chalk/src/wujie.scss +0 -0
- package/packages/theme-chalk/src/wxlogin.scss +3 -0
- package/packages/tips/index.js +5 -0
- package/packages/tips/src/main.vue +126 -0
- package/packages/toolbar/index.js +5 -0
- package/packages/toolbar/src/main.vue +377 -0
- package/packages/tree/index.js +5 -0
- package/packages/tree/src/main.vue +636 -0
- package/packages/tree-group/index.js +5 -0
- package/packages/tree-group/src/main.vue +435 -0
- package/packages/upload/index.js +5 -0
- package/packages/upload/src/main.vue +1033 -0
- package/packages/upload/src/picture.js +15 -0
- package/packages/wujie/index.js +5 -0
- package/packages/wujie/src/main.vue +137 -0
- package/packages/wxlogin/index.js +5 -0
- package/packages/wxlogin/src/main.vue +110 -0
- package/src/config/api.js +211 -0
- package/src/index.js +167 -0
- package/src/utils/bus.js +3 -0
- package/src/utils/date-util.js +312 -0
- package/src/utils/http.js +50 -0
- package/src/utils/rules.js +18 -0
- package/src/utils/store.js +21 -0
- package/src/utils/util.js +2105 -0
|
@@ -0,0 +1,2105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 新封装公告方法规范:
|
|
3
|
+
* 1.方法顺序按字母顺序排列
|
|
4
|
+
* 2.参数超过2个且有的参数是非必传的最好用对象形式传参
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
|
|
8
|
+
/* eslint-disable indent */
|
|
9
|
+
const sm2 = require('sm-crypto').sm2;
|
|
10
|
+
import { authCenter } from '../config/api';
|
|
11
|
+
import axios from 'axios';
|
|
12
|
+
import qs from 'qs';
|
|
13
|
+
import JSONbig from 'json-bigint';
|
|
14
|
+
|
|
15
|
+
const win = window.__WUJIE_RAW_WINDOW__ ? window.__WUJIE_RAW_WINDOW__ : window;
|
|
16
|
+
|
|
17
|
+
const $hueStep = 2;
|
|
18
|
+
const $saturationStep1 = 0.16;
|
|
19
|
+
const $saturationStep2 = 0.05;
|
|
20
|
+
const $brightnessStep1 = 0.05;
|
|
21
|
+
const $brightnessStep2 = 0.15;
|
|
22
|
+
const $lightColorCount = 5;
|
|
23
|
+
const $darkColorCount = 4;
|
|
24
|
+
const publicKey = 'abcdefghijklmnopqrstuvwxyz12345678';
|
|
25
|
+
|
|
26
|
+
const JSONbigToString = JSONbig({ storeAsString: true });
|
|
27
|
+
import { MessageBox, Loading } from 'eoss-element';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ajax
|
|
31
|
+
* @desc:ajax请求
|
|
32
|
+
* @author huangbo
|
|
33
|
+
* @date 2022年5月7日
|
|
34
|
+
* @param {Object} [headers] - headers
|
|
35
|
+
* @param {String} [method] - 请求类型
|
|
36
|
+
* @param {String} [url] - 请求地址
|
|
37
|
+
* @param {String} [host] - host
|
|
38
|
+
* @param {Object} [data] - 请求参数
|
|
39
|
+
* @param {Object} [params] - 请求参数
|
|
40
|
+
* @param {Boolean} [format] - post请求是否使用表单类型
|
|
41
|
+
* @param {Boolean} [mix] - 是否混合传参
|
|
42
|
+
* @param {Boolean} [defaults] - 是否传入默认参数userId
|
|
43
|
+
* @param {Object} [loading] - loading加载对象
|
|
44
|
+
**/
|
|
45
|
+
// 请求
|
|
46
|
+
let _timer = null;
|
|
47
|
+
const pendingRequest = new Map();
|
|
48
|
+
function getRequestKey(config) {
|
|
49
|
+
const { method, url, params, data } = config;
|
|
50
|
+
return [method, url, qs.stringify(params), qs.stringify(data)].join('&');
|
|
51
|
+
};
|
|
52
|
+
function delPendingRequest(config) {
|
|
53
|
+
let requestKey = getRequestKey(config);
|
|
54
|
+
if (pendingRequest.has(requestKey)) {
|
|
55
|
+
pendingRequest.delete(requestKey);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const ajax = function ({
|
|
59
|
+
headers = {},
|
|
60
|
+
method,
|
|
61
|
+
url,
|
|
62
|
+
host = true,
|
|
63
|
+
data = {},
|
|
64
|
+
params = {},
|
|
65
|
+
format = true,
|
|
66
|
+
mix = false,
|
|
67
|
+
defaults = false,
|
|
68
|
+
loading
|
|
69
|
+
}) {
|
|
70
|
+
if (!method) {
|
|
71
|
+
if (format) {
|
|
72
|
+
method = 'get';
|
|
73
|
+
} else {
|
|
74
|
+
method = 'post';
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
method = method.toLowerCase();
|
|
78
|
+
}
|
|
79
|
+
let baseURL = host === true ? getStorage('host') : host === false ? '' : host;
|
|
80
|
+
let http = axios.create({
|
|
81
|
+
baseURL: baseURL,
|
|
82
|
+
timeout: 99000,
|
|
83
|
+
transformResponse: [
|
|
84
|
+
function (data) {
|
|
85
|
+
try {
|
|
86
|
+
return JSONbigToString.parse(data);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
return data;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
// 请求拦截
|
|
94
|
+
http.interceptors.request.use(
|
|
95
|
+
config => {
|
|
96
|
+
config.headers.common = getStorage();
|
|
97
|
+
// 根据请求的信息(请求方式,url,请求get/post数据),产生map的key
|
|
98
|
+
let requestKey = getRequestKey(config);
|
|
99
|
+
// 判断请求是否重复
|
|
100
|
+
if (pendingRequest.has(requestKey)) {
|
|
101
|
+
// 取消上次请求
|
|
102
|
+
let cancel = pendingRequest.get(requestKey);
|
|
103
|
+
cancel();
|
|
104
|
+
// 删除请求信息
|
|
105
|
+
pendingRequest.delete(requestKey);
|
|
106
|
+
}
|
|
107
|
+
// 把请求信息,添加请求到map当中
|
|
108
|
+
// 生成取消方法
|
|
109
|
+
config.cancelToken =
|
|
110
|
+
config.cancelToken ||
|
|
111
|
+
new axios.CancelToken(cancel => {
|
|
112
|
+
// 把取消方法添加到map
|
|
113
|
+
if (!pendingRequest.has(requestKey)) {
|
|
114
|
+
pendingRequest.set(requestKey, cancel);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return config;
|
|
118
|
+
},
|
|
119
|
+
err => {
|
|
120
|
+
return err;
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
// 响应拦截
|
|
124
|
+
http.interceptors.response.use(
|
|
125
|
+
response => {
|
|
126
|
+
delPendingRequest(response.config);
|
|
127
|
+
loading && loading.close();
|
|
128
|
+
if (
|
|
129
|
+
response.headers.authorization &&
|
|
130
|
+
response.headers.authorization !== getStorage('token')
|
|
131
|
+
) {
|
|
132
|
+
if (
|
|
133
|
+
localStorage.getItem('storage') === 'localStorage' ||
|
|
134
|
+
localStorage.getItem('ssId') ||
|
|
135
|
+
localStorage.getItem('token') ||
|
|
136
|
+
localStorage.getItem('Authorization')
|
|
137
|
+
) {
|
|
138
|
+
localStorage.setItem('ssId', response.headers.ssid);
|
|
139
|
+
localStorage.setItem('token', response.headers.authorization);
|
|
140
|
+
localStorage.setItem(
|
|
141
|
+
'Authorization',
|
|
142
|
+
response.headers.authorization
|
|
143
|
+
);
|
|
144
|
+
} else {
|
|
145
|
+
sessionStorage.setItem('ssId', response.headers.ssid);
|
|
146
|
+
sessionStorage.setItem('token', response.headers.authorization);
|
|
147
|
+
sessionStorage.setItem(
|
|
148
|
+
'Authorization',
|
|
149
|
+
response.headers.authorization
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (response.status === 200) {
|
|
154
|
+
if (
|
|
155
|
+
response.data.rCode === 64 ||
|
|
156
|
+
response.data.rCode === 65 ||
|
|
157
|
+
response.data.rCode === 67 ||
|
|
158
|
+
response.data.rCode === 69
|
|
159
|
+
) {
|
|
160
|
+
removeStorage([
|
|
161
|
+
'Authorization',
|
|
162
|
+
'token',
|
|
163
|
+
'ssId',
|
|
164
|
+
'userId',
|
|
165
|
+
'userName',
|
|
166
|
+
'deviceUnique',
|
|
167
|
+
'menus',
|
|
168
|
+
'menus',
|
|
169
|
+
'useCaseCodes',
|
|
170
|
+
'mainConfig'
|
|
171
|
+
]);
|
|
172
|
+
|
|
173
|
+
let timer = getStorage('timer') || 0;
|
|
174
|
+
timer = parseInt(timer, 10);
|
|
175
|
+
if (
|
|
176
|
+
win.top.location.href.indexOf('#/login') === -1 &&
|
|
177
|
+
win.top.location.href.indexOf('/login.html') === -1 &&
|
|
178
|
+
!timer
|
|
179
|
+
) {
|
|
180
|
+
sessionStorage.setItem('timer', 1);
|
|
181
|
+
MessageBox.confirm(
|
|
182
|
+
response.data.rCode === 69
|
|
183
|
+
? '该账号在其他地方已登陆!'
|
|
184
|
+
: '登录已过期,请重新登录!',
|
|
185
|
+
'提示',
|
|
186
|
+
response.data.rCode === 69
|
|
187
|
+
? {
|
|
188
|
+
confirmButtonText: '确定',
|
|
189
|
+
closeOnClickModal: false,
|
|
190
|
+
type: 'warning'
|
|
191
|
+
}
|
|
192
|
+
: {
|
|
193
|
+
confirmButtonText: '确定',
|
|
194
|
+
cancelButtonText: '取消',
|
|
195
|
+
closeOnClickModal: false,
|
|
196
|
+
type: 'warning'
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
.then(() => {
|
|
200
|
+
const loginPage = getStorage('login') || getStorage('loginPage');
|
|
201
|
+
if (loginPage) {
|
|
202
|
+
win.top.location.href = loginPage;
|
|
203
|
+
} else if (win.top.location.href.indexOf('main.html') > -1) {
|
|
204
|
+
win.top.location.href = './login.html';
|
|
205
|
+
} else {
|
|
206
|
+
const hash = win.top.location.hash;
|
|
207
|
+
if (
|
|
208
|
+
hash ||
|
|
209
|
+
(win.top.location.indexOf('model=') &&
|
|
210
|
+
win.top.location.indexOf('view=') &&
|
|
211
|
+
win.top.location.indexOf('render.html'))
|
|
212
|
+
) {
|
|
213
|
+
const len = win.top.location.href.indexOf(hash);
|
|
214
|
+
let href = win.top.location.href.slice(0, len) + '#/login';
|
|
215
|
+
win.top.location.href = href;
|
|
216
|
+
} else {
|
|
217
|
+
win.top.location.href = '/login.html';
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
.catch(e => {
|
|
222
|
+
_timer && clearTimeout(_timer);
|
|
223
|
+
_timer = setTimeout(() => {
|
|
224
|
+
removeStorage('timer');
|
|
225
|
+
clearTimeout(_timer);
|
|
226
|
+
_timer = null;
|
|
227
|
+
}, 1000);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return Promise.reject(response.data);
|
|
231
|
+
} else {
|
|
232
|
+
// eslint-disable-next-line no-undef
|
|
233
|
+
return Promise.resolve(response.data);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
error => {
|
|
238
|
+
loading && loading.close();
|
|
239
|
+
if (!axios.isCancel(error)) {
|
|
240
|
+
delPendingRequest(error.config || {});
|
|
241
|
+
}
|
|
242
|
+
if (error && error.response) {
|
|
243
|
+
if (error.response.status) {
|
|
244
|
+
switch (error.response.status) {
|
|
245
|
+
case 400:
|
|
246
|
+
error.message = '错误请求';
|
|
247
|
+
break;
|
|
248
|
+
case 401:
|
|
249
|
+
error.message = '未授权,请重新登录';
|
|
250
|
+
break;
|
|
251
|
+
case 403:
|
|
252
|
+
error.message = '登录过期,请重新登录';
|
|
253
|
+
break;
|
|
254
|
+
case 404:
|
|
255
|
+
error.message = '网络请求不存在';
|
|
256
|
+
break;
|
|
257
|
+
case 405:
|
|
258
|
+
error.message = '请求方法错误';
|
|
259
|
+
break;
|
|
260
|
+
case 408:
|
|
261
|
+
error.message = '请求超时';
|
|
262
|
+
break;
|
|
263
|
+
case 500:
|
|
264
|
+
error.message = '服务器端出错';
|
|
265
|
+
break;
|
|
266
|
+
case 501:
|
|
267
|
+
error.message = '网络未实现';
|
|
268
|
+
break;
|
|
269
|
+
case 502:
|
|
270
|
+
error.message = '网络错误';
|
|
271
|
+
break;
|
|
272
|
+
case 503:
|
|
273
|
+
error.message = '服务不可用';
|
|
274
|
+
break;
|
|
275
|
+
case 504:
|
|
276
|
+
error.message = '网络超时';
|
|
277
|
+
break;
|
|
278
|
+
case 505:
|
|
279
|
+
error.message = 'http版本不支持该请求';
|
|
280
|
+
break;
|
|
281
|
+
default:
|
|
282
|
+
error.message = `连接错误${error.response.status}`;
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
error.message = '无法请求,请联系管理员';
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// eslint-disable-next-line no-undef
|
|
289
|
+
return Promise.reject(error);
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
let userId = getStorage('userId');
|
|
293
|
+
if (!Object.prototype.hasOwnProperty.call(data, 'userId') && userId && defaults) {
|
|
294
|
+
data.userId = userId;
|
|
295
|
+
}
|
|
296
|
+
if (!Object.prototype.hasOwnProperty.call(params, 'userId') && userId && defaults) {
|
|
297
|
+
params.userId = getStorage('userId');
|
|
298
|
+
}
|
|
299
|
+
if (!mix && method === 'get') {
|
|
300
|
+
data = {};
|
|
301
|
+
}
|
|
302
|
+
if (method === 'post') {
|
|
303
|
+
if (!mix) {
|
|
304
|
+
params = {};
|
|
305
|
+
}
|
|
306
|
+
if (format) {
|
|
307
|
+
data = qs.stringify(data);
|
|
308
|
+
headers['content-type'] = 'application/x-www-form-urlencoded';
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return http({
|
|
312
|
+
method,
|
|
313
|
+
url,
|
|
314
|
+
data,
|
|
315
|
+
params,
|
|
316
|
+
headers
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* arrUnique
|
|
322
|
+
* @desc:数组元素对象去重
|
|
323
|
+
* @author huangbo
|
|
324
|
+
* @date 2022年5月7日
|
|
325
|
+
* @param {Object} [data] - 原始数组
|
|
326
|
+
* @param {String} [key] - 对象子元素的属性名
|
|
327
|
+
**/
|
|
328
|
+
const arrUnique = function (data, key) {
|
|
329
|
+
var newArr = [];
|
|
330
|
+
if (key === undefined) {
|
|
331
|
+
data.sort();
|
|
332
|
+
newArr = [data[0]];
|
|
333
|
+
for (let i = 1; i < data.length; i++) {
|
|
334
|
+
if (data[i] !== newArr[newArr.length - 1]) {
|
|
335
|
+
newArr.push(data[i]);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
} else {
|
|
339
|
+
var obj = {};
|
|
340
|
+
for (let i = 0; i < data.length; i++) {
|
|
341
|
+
if (!obj[data[i][key]]) {
|
|
342
|
+
newArr.push(data[i]);
|
|
343
|
+
obj[data[i][key]] = true;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return newArr;
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* browser
|
|
351
|
+
* @desc:浏览器类型
|
|
352
|
+
* @author huangbo
|
|
353
|
+
* @date 2022年5月7日
|
|
354
|
+
**/
|
|
355
|
+
const browser = function () {
|
|
356
|
+
const reg = { ie: /msie/, moz: /gecko/, opera: /opera/, safari: /safari/ };
|
|
357
|
+
for (let i in reg) {
|
|
358
|
+
if (reg[i].test(win.navigator.userAgent.toLowerCase())) {
|
|
359
|
+
return i;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* debounce
|
|
366
|
+
* @desc:添加js内容
|
|
367
|
+
* @author huangbo
|
|
368
|
+
* @date 2022年5月7日
|
|
369
|
+
* @param {Function} [fn] - 函数
|
|
370
|
+
* @param {Number} [wait] - 延迟毫秒数
|
|
371
|
+
* @param {Boolean} [immediate] - 是否首次触发执行
|
|
372
|
+
**/
|
|
373
|
+
|
|
374
|
+
const debounce = function (fn, wait, immediate) {
|
|
375
|
+
let timeout;
|
|
376
|
+
return function () {
|
|
377
|
+
let self = this;
|
|
378
|
+
let args = arguments;
|
|
379
|
+
|
|
380
|
+
if (timeout) clearTimeout(timeout);
|
|
381
|
+
// 是否在某一批事件中首次执行
|
|
382
|
+
if (immediate) {
|
|
383
|
+
let callNow = !timeout;
|
|
384
|
+
timeout = setTimeout(function () {
|
|
385
|
+
timeout = null;
|
|
386
|
+
fn.apply(self, args);
|
|
387
|
+
immediate = true;
|
|
388
|
+
}, wait);
|
|
389
|
+
if (callNow) {
|
|
390
|
+
fn.apply(self, args);
|
|
391
|
+
}
|
|
392
|
+
immediate = false;
|
|
393
|
+
} else {
|
|
394
|
+
timeout = setTimeout(function () {
|
|
395
|
+
fn.apply(self, args);
|
|
396
|
+
immediate = true;
|
|
397
|
+
}, wait);
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* delUrlParam
|
|
403
|
+
* @desc:删除url指定参数
|
|
404
|
+
* @author huangbo
|
|
405
|
+
* @date 2022年5月7日
|
|
406
|
+
* @param {String} [url] - url地址
|
|
407
|
+
* @param {String} [key] - 参数名
|
|
408
|
+
**/
|
|
409
|
+
const delUrlParam = function ({ url, key }) {
|
|
410
|
+
let src = url ? decodeURI(url) : decodeURI(win.top.location.href);
|
|
411
|
+
let param = getParams({ url: src });
|
|
412
|
+
if (param && param.hasOwnProperty(key)) {
|
|
413
|
+
let reg = `${key}=${param[key]}`;
|
|
414
|
+
if (Object.keys(param).length > 1) {
|
|
415
|
+
if (src.indexOf(reg + '&') > -1) {
|
|
416
|
+
src = src.replace(reg + '&', '');
|
|
417
|
+
}
|
|
418
|
+
if (src.indexOf('&' + reg) > -1) {
|
|
419
|
+
src = src.replace('&' + reg, '');
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
src = src.replace('?' + reg, '');
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return src;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* domEval
|
|
430
|
+
* @desc:添加js内容
|
|
431
|
+
* @author huangbo
|
|
432
|
+
* @date 2022年5月7日
|
|
433
|
+
* @param {String} [code] - js内容
|
|
434
|
+
**/
|
|
435
|
+
const domEval = function (code) {
|
|
436
|
+
let script = document.createElement('script');
|
|
437
|
+
script.text = code;
|
|
438
|
+
document.head.appendChild(script);
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* esEncode
|
|
443
|
+
* @desc:加密
|
|
444
|
+
* @author huangbo
|
|
445
|
+
* @date 2022年5月7日
|
|
446
|
+
* @param {string} [data] - 被加密的字符串
|
|
447
|
+
**/
|
|
448
|
+
const esEncode = function (value) {
|
|
449
|
+
let kleng = publicKey.length;
|
|
450
|
+
let kstr = publicKey.split('');
|
|
451
|
+
let result = '';
|
|
452
|
+
let cat;
|
|
453
|
+
let cat1;
|
|
454
|
+
let cat2;
|
|
455
|
+
let cat3;
|
|
456
|
+
for (let i = 0; i < value.length; i++) {
|
|
457
|
+
cat = value.charCodeAt(i);
|
|
458
|
+
cat1 = cat % kleng;
|
|
459
|
+
cat = (cat - cat1) / kleng;
|
|
460
|
+
cat2 = cat % kleng;
|
|
461
|
+
cat = (cat - cat2) / kleng;
|
|
462
|
+
cat3 = cat % kleng;
|
|
463
|
+
result += kstr[cat3] + kstr[cat2] + kstr[cat1];
|
|
464
|
+
}
|
|
465
|
+
return result;
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* esDecode
|
|
470
|
+
* @desc:解密
|
|
471
|
+
* @author huangbo
|
|
472
|
+
* @date 2022年5月7日
|
|
473
|
+
* @param {string} [value] - 被解密的加密字符串
|
|
474
|
+
* @param {string} [key] - 私钥
|
|
475
|
+
**/
|
|
476
|
+
const esDecode = function (value) {
|
|
477
|
+
var kleng = publicKey.length;
|
|
478
|
+
var result;
|
|
479
|
+
let cat1;
|
|
480
|
+
let cat2;
|
|
481
|
+
let cat3;
|
|
482
|
+
let num = 0;
|
|
483
|
+
let arr;
|
|
484
|
+
arr = new Array(Math.floor(value.length / 3));
|
|
485
|
+
result = arr.length;
|
|
486
|
+
for (var i = 0; i < result; i++) {
|
|
487
|
+
cat1 = publicKey.indexOf(value.charAt(num));
|
|
488
|
+
num++;
|
|
489
|
+
cat2 = publicKey.indexOf(value.charAt(num));
|
|
490
|
+
num++;
|
|
491
|
+
cat3 = publicKey.indexOf(value.charAt(num));
|
|
492
|
+
num++;
|
|
493
|
+
arr[i] = cat1 * kleng * kleng + cat2 * kleng + cat3;
|
|
494
|
+
}
|
|
495
|
+
// eslint-disable-next-line no-eval
|
|
496
|
+
result = eval('String.fromCharCode(' + arr.join(',') + ')');
|
|
497
|
+
return result;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* esmEncrypt
|
|
502
|
+
* @desc:sm2加密
|
|
503
|
+
* @author huangbo
|
|
504
|
+
* @date 2022年5月7日
|
|
505
|
+
* @param {string} [data] - 被加密的字符串
|
|
506
|
+
* @param {string} [key] - 公钥
|
|
507
|
+
**/
|
|
508
|
+
const esmEncrypt = function ({ data, key, mode }) {
|
|
509
|
+
const cipherMode = mode ? mode : 1;
|
|
510
|
+
if (!new RegExp('^04').test(key)) {
|
|
511
|
+
key = '04' + key;
|
|
512
|
+
}
|
|
513
|
+
const result = sm2.doEncrypt(data, key, cipherMode);
|
|
514
|
+
return result;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* esmDecode
|
|
519
|
+
* @desc:sm2解密
|
|
520
|
+
* @author huangbo
|
|
521
|
+
* @date 2022年5月7日
|
|
522
|
+
* @param {string} [data] - 被解密的加密字符串
|
|
523
|
+
* @param {string} [key] - 私钥
|
|
524
|
+
**/
|
|
525
|
+
const esmDecode = function ({ data, key, mode }) {
|
|
526
|
+
const cipherMode = mode ? mode : 1;
|
|
527
|
+
if (new RegExp('^04').test(key)) {
|
|
528
|
+
key = key.slice(2);
|
|
529
|
+
}
|
|
530
|
+
const result = sm2.doDecrypt(data, key, cipherMode);
|
|
531
|
+
return result;
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* 排除属性
|
|
536
|
+
* @desc:exclAttribute
|
|
537
|
+
* @author huangbo
|
|
538
|
+
* @date 2022年5月7日
|
|
539
|
+
* @param {String/Array} [attrs] - 要排除的属性
|
|
540
|
+
**/
|
|
541
|
+
const exclAttribute = ({ attrs = 'value', data }) => {
|
|
542
|
+
let obj = extend(true, {}, data);
|
|
543
|
+
if (Array.isArray(attrs)) {
|
|
544
|
+
attrs.forEach(item => {
|
|
545
|
+
if (obj[item] !== undefined) {
|
|
546
|
+
delete obj[item];
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
} else {
|
|
550
|
+
delete obj[attrs];
|
|
551
|
+
}
|
|
552
|
+
return obj;
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* exportXls
|
|
557
|
+
* @desc:导出表格数据
|
|
558
|
+
* @author huangbo
|
|
559
|
+
* @date 2022年5月7日
|
|
560
|
+
* @param {thead} [array] - 表单头部
|
|
561
|
+
* @param {data} [array] - 导出的数据
|
|
562
|
+
* @param {name} [string] - 导出文件名
|
|
563
|
+
* @param {numbers} [boolean] - 序号
|
|
564
|
+
**/
|
|
565
|
+
const exportXls = function ({ thead = [], data = [], name, numbers }) {
|
|
566
|
+
let tbody = '';
|
|
567
|
+
let aligns = [];
|
|
568
|
+
let fields = [];
|
|
569
|
+
let others = {};
|
|
570
|
+
let alink = document.createElement('a');
|
|
571
|
+
for (let i = 0; i < thead.length; i++) {
|
|
572
|
+
tbody += '<tr style="text-align: center;">';
|
|
573
|
+
if (numbers) {
|
|
574
|
+
tbody += '<th rowspan="' + thead.length + '"></th>';
|
|
575
|
+
}
|
|
576
|
+
const tr = thead[i];
|
|
577
|
+
let col = 0;
|
|
578
|
+
for (let x = 0; x < tr.length; x++) {
|
|
579
|
+
const td = tr[x];
|
|
580
|
+
if (td.property) {
|
|
581
|
+
if (col === x) {
|
|
582
|
+
fields.push(td.property);
|
|
583
|
+
aligns.push(td.align);
|
|
584
|
+
} else {
|
|
585
|
+
others[String(col)] = [td.property, td.align];
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
tbody += `<th rowspan="${td.rowspan}" colspan="${td.colspan}" align="${td.align
|
|
589
|
+
}">${td.label}</th>`;
|
|
590
|
+
if (td.colspan) {
|
|
591
|
+
col += parseInt(td.colspan, 10);
|
|
592
|
+
} else {
|
|
593
|
+
col++;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
tbody += '</tr>';
|
|
597
|
+
}
|
|
598
|
+
for (let i in others) {
|
|
599
|
+
fields.splice(i, 0, others[i][0]);
|
|
600
|
+
aligns.splice(i, 0, others[i][1]);
|
|
601
|
+
}
|
|
602
|
+
for (let i = 0; i < data.length; i++) {
|
|
603
|
+
tbody += '<tr>';
|
|
604
|
+
for (var x in fields) {
|
|
605
|
+
tbody += '<td align="' + aligns[x] + '">' + data[i][fields[x]] + '</td>';
|
|
606
|
+
}
|
|
607
|
+
tbody += '</tr>';
|
|
608
|
+
}
|
|
609
|
+
if (!name) {
|
|
610
|
+
name = 'table_' + new Date().getTime();
|
|
611
|
+
}
|
|
612
|
+
var uri = 'data:application/vnd.ms-excel;base64,';
|
|
613
|
+
var template =
|
|
614
|
+
'<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><meta charset="UTF-8"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table style="vnd.ms-excel.numberformat:@">' +
|
|
615
|
+
tbody +
|
|
616
|
+
'</table></body></html>';
|
|
617
|
+
alink.href = uri + win.btoa(unescape(encodeURIComponent(template)));
|
|
618
|
+
alink.download = name + '.xls';
|
|
619
|
+
document.body.appendChild(alink);
|
|
620
|
+
alink.click();
|
|
621
|
+
document.body.removeChild(alink);
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* extend
|
|
626
|
+
* @desc:对象拷贝
|
|
627
|
+
* @author huangbo
|
|
628
|
+
* @date 2022年5月7日
|
|
629
|
+
* @param {Object} [target] - 被扩展的对象
|
|
630
|
+
* @param {Boolean}} [deep] - 是否深度操作
|
|
631
|
+
**/
|
|
632
|
+
const extend = function () {
|
|
633
|
+
let options;
|
|
634
|
+
let name;
|
|
635
|
+
let src;
|
|
636
|
+
let copy;
|
|
637
|
+
let copyIsArray;
|
|
638
|
+
let clone;
|
|
639
|
+
let target = arguments[0] || {};
|
|
640
|
+
let i = 1;
|
|
641
|
+
let length = arguments.length;
|
|
642
|
+
let deep = false;
|
|
643
|
+
if (typeof target === 'boolean') {
|
|
644
|
+
deep = target;
|
|
645
|
+
target = arguments[i] || {};
|
|
646
|
+
i++;
|
|
647
|
+
}
|
|
648
|
+
if (typeof target !== 'object' && !isFunction(target)) {
|
|
649
|
+
target = {};
|
|
650
|
+
}
|
|
651
|
+
if (i === length) {
|
|
652
|
+
target = this;
|
|
653
|
+
i--;
|
|
654
|
+
}
|
|
655
|
+
for (; i < length; i++) {
|
|
656
|
+
if ((options = arguments[i]) != null) {
|
|
657
|
+
for (name in options) {
|
|
658
|
+
copy = options[name];
|
|
659
|
+
if (name === '__proto__' || target === copy) {
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
if (
|
|
663
|
+
deep &&
|
|
664
|
+
copy &&
|
|
665
|
+
(isObject(copy) || (copyIsArray = Array.isArray(copy)))
|
|
666
|
+
) {
|
|
667
|
+
src = target[name];
|
|
668
|
+
if (copyIsArray && !Array.isArray(src)) {
|
|
669
|
+
clone = [];
|
|
670
|
+
} else if (!copyIsArray && !isObject(src)) {
|
|
671
|
+
clone = {};
|
|
672
|
+
} else {
|
|
673
|
+
clone = src;
|
|
674
|
+
}
|
|
675
|
+
copyIsArray = false;
|
|
676
|
+
target[name] = extend(deep, clone, copy);
|
|
677
|
+
} else if (copy !== undefined) {
|
|
678
|
+
target[name] = copy;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return target;
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* formatDate
|
|
688
|
+
* @desc:格式化时间
|
|
689
|
+
* @author huangbo
|
|
690
|
+
* @date 2022年5月7日
|
|
691
|
+
* @param {String, Number} [date] - 时间字符串或时间戳
|
|
692
|
+
* @param {String} [fmt] - 格式
|
|
693
|
+
**/
|
|
694
|
+
const formatDate = function (date, fmt) {
|
|
695
|
+
let obj;
|
|
696
|
+
if (date) {
|
|
697
|
+
obj = new Date(date);
|
|
698
|
+
} else {
|
|
699
|
+
obj = new Date();
|
|
700
|
+
}
|
|
701
|
+
let quarter = ['一', '二', '三', '四'];
|
|
702
|
+
let o = {
|
|
703
|
+
'b+': Math.ceil((obj.getMonth() + 1) / 6), // 半年
|
|
704
|
+
'M+': obj.getMonth() + 1, // 月份
|
|
705
|
+
'd+': obj.getDate(), // 日
|
|
706
|
+
'H+': obj.getHours(), // 小时
|
|
707
|
+
'm+': obj.getMinutes(), // 分
|
|
708
|
+
's+': obj.getSeconds(), // 秒
|
|
709
|
+
'q+': quarter[Math.ceil((obj.getMonth() + 1) / 3) - 1], // 季度
|
|
710
|
+
S: obj.getMilliseconds() // 毫秒
|
|
711
|
+
};
|
|
712
|
+
if (/(y+)/.test(fmt)) {
|
|
713
|
+
fmt = fmt.replace(
|
|
714
|
+
RegExp.$1,
|
|
715
|
+
(obj.getFullYear() + '').substr(4 - RegExp.$1.length)
|
|
716
|
+
);
|
|
717
|
+
}
|
|
718
|
+
for (let k in o) {
|
|
719
|
+
if (new RegExp('(' + k + ')').test(fmt)) {
|
|
720
|
+
fmt = fmt.replace(
|
|
721
|
+
RegExp.$1,
|
|
722
|
+
RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return fmt;
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* getColor
|
|
731
|
+
* @desc:根据颜色和对应的色板位置,计算出对应的色板颜色
|
|
732
|
+
* @author huangbo
|
|
733
|
+
* @date 2022年5月7日
|
|
734
|
+
**/
|
|
735
|
+
const getColor = function ($color, $n) {
|
|
736
|
+
let $isLight = $n < 7;
|
|
737
|
+
let $hsv = rgbToHsv($color);
|
|
738
|
+
// 这里将i转换成以主色为中心,两侧的i值逐渐增大
|
|
739
|
+
let $i = $isLight ? $lightColorCount + 1 - $n : $n - $lightColorCount - 1;
|
|
740
|
+
let color = hsvTorgb(
|
|
741
|
+
getHue($hsv[0], $i, $isLight),
|
|
742
|
+
getSaturation($hsv[1], $i, $isLight),
|
|
743
|
+
getLightness($hsv[2], $i, $isLight)
|
|
744
|
+
);
|
|
745
|
+
return color;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* getHue
|
|
750
|
+
* @desc:转换色相
|
|
751
|
+
* @author huangbo
|
|
752
|
+
* @date 2022年5月7日
|
|
753
|
+
**/
|
|
754
|
+
const getHue = function ($h, $i, $isLight) {
|
|
755
|
+
let $hue;
|
|
756
|
+
if ($h >= 60 && $h <= 240) {
|
|
757
|
+
$hue = $isLight ? $h - $hueStep * $i : $h + $hueStep * $i;
|
|
758
|
+
} else {
|
|
759
|
+
$hue = $isLight ? $h + $hueStep * $i : $h - $hueStep * $i;
|
|
760
|
+
}
|
|
761
|
+
$hue = ($hue + 360) % 360;
|
|
762
|
+
return Math.round($hue);
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* getLightness
|
|
767
|
+
* @desc:转换明度
|
|
768
|
+
* @author huangbo
|
|
769
|
+
* @date 2022年5月7日
|
|
770
|
+
**/
|
|
771
|
+
const getLightness = function ($v, $i, $isLight) {
|
|
772
|
+
let $value = $isLight
|
|
773
|
+
? $v + $brightnessStep1 * $i
|
|
774
|
+
: $v - $brightnessStep2 * $i;
|
|
775
|
+
$value = $value < 1 ? $value : 1;
|
|
776
|
+
return toFixed($value, 2);
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* getObjectType
|
|
781
|
+
* @desc:获取数据类型
|
|
782
|
+
* @author tangdaibing
|
|
783
|
+
* @date 2022年5月7日
|
|
784
|
+
**/
|
|
785
|
+
const getObjectType = function (data) {
|
|
786
|
+
let type = Object.prototype.toString.call(data).toLowerCase();
|
|
787
|
+
const typeFormat = {
|
|
788
|
+
'[object string]': 'string',
|
|
789
|
+
'[object number]': 'number',
|
|
790
|
+
'[object null]': 'null',
|
|
791
|
+
'[object boolean]': 'boolean',
|
|
792
|
+
'[object undefined]': 'undefined',
|
|
793
|
+
'[object object]': 'object',
|
|
794
|
+
'[object array]': 'array',
|
|
795
|
+
'[object function]': 'function',
|
|
796
|
+
'[object date]': 'date'
|
|
797
|
+
};
|
|
798
|
+
return typeFormat[type];
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* getParams
|
|
803
|
+
* @desc:获取url地址指定参数
|
|
804
|
+
* @author huangbo
|
|
805
|
+
* @date 2022年5月7日
|
|
806
|
+
* @param {String/Object} [res] - String:参数名称;Object:name参数名称,url:需要查询的地址
|
|
807
|
+
* @param {String/Boolean} [url] - Boolean:是否返回不带参数的url地址,String:返回不带参数的url地址的属性名
|
|
808
|
+
**/
|
|
809
|
+
const getParams = function (res, baseUrl) {
|
|
810
|
+
let name;
|
|
811
|
+
let url;
|
|
812
|
+
if (typeof res === 'string') {
|
|
813
|
+
name = res;
|
|
814
|
+
} else if (typeof res === 'object') {
|
|
815
|
+
name = res.name;
|
|
816
|
+
url = res.url ? decodeURI(res.url) : '';
|
|
817
|
+
}
|
|
818
|
+
let search;
|
|
819
|
+
let _url;
|
|
820
|
+
if (url) {
|
|
821
|
+
if (
|
|
822
|
+
startWith(url, ['/', './'], true) ||
|
|
823
|
+
url.indexOf('html') > -1 ||
|
|
824
|
+
url.indexOf('dhtml') > -1 ||
|
|
825
|
+
url.indexOf('/#/') > -1
|
|
826
|
+
) {
|
|
827
|
+
if (url.indexOf('?') === -1) {
|
|
828
|
+
_url = url.slice(0);
|
|
829
|
+
} else {
|
|
830
|
+
_url = url.slice(0, url.indexOf('?'));
|
|
831
|
+
search = url.slice(url.indexOf('?') + 1);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
} else if (win.location.search) {
|
|
835
|
+
search = decodeURI(win.location.search).slice(1);
|
|
836
|
+
} else {
|
|
837
|
+
search = decodeURI(win.location.hash);
|
|
838
|
+
if (search.indexOf('?') > -1) {
|
|
839
|
+
search = search.slice(search.indexOf('?') + 1);
|
|
840
|
+
} else {
|
|
841
|
+
search = null;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
if (search) {
|
|
845
|
+
if (name) {
|
|
846
|
+
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
|
|
847
|
+
let r = search.match(reg);
|
|
848
|
+
if (r != null) {
|
|
849
|
+
return unescape(r[2]).replace(
|
|
850
|
+
new RegExp('/+', 'gm'), '&');
|
|
851
|
+
} else {
|
|
852
|
+
return null;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
let obj = {};
|
|
856
|
+
if (baseUrl) {
|
|
857
|
+
if (typeof baseUrl === 'string') {
|
|
858
|
+
obj[baseUrl] = _url;
|
|
859
|
+
} else {
|
|
860
|
+
obj['_baseUrl'] = _url;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
if (search.indexOf('&') > -1) {
|
|
864
|
+
search.split('&').forEach(item => {
|
|
865
|
+
let val = item;
|
|
866
|
+
let param;
|
|
867
|
+
if (val.indexOf('?') > -1) {
|
|
868
|
+
let ary = val.split('?');
|
|
869
|
+
val = ary[0];
|
|
870
|
+
param = ary[1].replace(
|
|
871
|
+
new RegExp('/+', 'gm'), '&');
|
|
872
|
+
}
|
|
873
|
+
let items = val.split('=');
|
|
874
|
+
obj[items[0]] = items[1] + (param ? `?${param}` : '');
|
|
875
|
+
});
|
|
876
|
+
} else {
|
|
877
|
+
let items = search.split('=');
|
|
878
|
+
obj[items[0]] = items[1];
|
|
879
|
+
}
|
|
880
|
+
return obj;
|
|
881
|
+
}
|
|
882
|
+
return null;
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* getRgb
|
|
887
|
+
* @desc:获取颜色值的rgb值
|
|
888
|
+
* @author huangbo
|
|
889
|
+
* @date 2022年5月7日
|
|
890
|
+
* @param {string} [$color] - 颜色值
|
|
891
|
+
**/
|
|
892
|
+
const getRgb = function ($color) {
|
|
893
|
+
let rgb = [];
|
|
894
|
+
// 16进制颜色值的正则
|
|
895
|
+
let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
896
|
+
// 把颜色值变成小写
|
|
897
|
+
$color = $color.toLowerCase();
|
|
898
|
+
if (reg.test($color)) {
|
|
899
|
+
// 如果只有三位的值,需变成六位,如:#fff => #ffffff
|
|
900
|
+
if ($color.length === 4) {
|
|
901
|
+
let colorNew = '#';
|
|
902
|
+
for (let i = 1; i < 4; i++) {
|
|
903
|
+
colorNew += $color.slice(i, i + 1).concat($color.slice(i, i + 1));
|
|
904
|
+
}
|
|
905
|
+
$color = colorNew;
|
|
906
|
+
}
|
|
907
|
+
// 处理六位的颜色值,转为RGB
|
|
908
|
+
for (let i = 1; i < 7; i += 2) {
|
|
909
|
+
rgb.push(parseInt('0x' + $color.slice(i, i + 2), 16));
|
|
910
|
+
}
|
|
911
|
+
} else {
|
|
912
|
+
rgb = $color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
|
|
913
|
+
}
|
|
914
|
+
return rgb;
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* getSaturation
|
|
919
|
+
* @desc:转换饱和度
|
|
920
|
+
* @author huangbo
|
|
921
|
+
* @date 2022年5月7日
|
|
922
|
+
**/
|
|
923
|
+
const getSaturation = function ($s, $i, $isLight) {
|
|
924
|
+
let $saturation;
|
|
925
|
+
if ($isLight) {
|
|
926
|
+
$saturation = $s - $saturationStep1 * $i;
|
|
927
|
+
} else if ($i === $darkColorCount) {
|
|
928
|
+
$saturation = $s + $saturationStep1;
|
|
929
|
+
} else {
|
|
930
|
+
$saturation = $s + $saturationStep2 * $i;
|
|
931
|
+
}
|
|
932
|
+
$saturation = $saturation < 1 ? $saturation : 1;
|
|
933
|
+
|
|
934
|
+
if ($isLight && $i === $lightColorCount && $saturation > 0.1) {
|
|
935
|
+
$saturation = 0.1;
|
|
936
|
+
}
|
|
937
|
+
$saturation = $saturation > 0.06 ? $saturation : 0.06;
|
|
938
|
+
return toFixed($saturation, 2);
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* getScript
|
|
943
|
+
* @desc:获取js文件并执行
|
|
944
|
+
* @author huangbo
|
|
945
|
+
* @date 2022年5月7日
|
|
946
|
+
* @param {String} [url] - js文件地址
|
|
947
|
+
**/
|
|
948
|
+
const getScript = function (url, callback) {
|
|
949
|
+
// eslint-disable-next-line no-undef
|
|
950
|
+
return new Promise((resolve, reject) => {
|
|
951
|
+
var xmlHttp = null;
|
|
952
|
+
if (win.XMLHttpRequest) {
|
|
953
|
+
xmlHttp = new XMLHttpRequest();
|
|
954
|
+
} else if (win.ActiveXObject) {
|
|
955
|
+
xmlHttp = new win.ActiveXObject('Microsoft.XMLHTTP');
|
|
956
|
+
}
|
|
957
|
+
if (xmlHttp == null) {
|
|
958
|
+
alert('浏览器不支持xmlHttp');
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
xmlHttp.open('GET', url, false);
|
|
962
|
+
xmlHttp.onreadystatechange = () => {
|
|
963
|
+
if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
|
|
964
|
+
let res = xmlHttp.responseText;
|
|
965
|
+
if (callback) {
|
|
966
|
+
typeof callback === 'function' && callback(res);
|
|
967
|
+
} else {
|
|
968
|
+
domEval(res);
|
|
969
|
+
}
|
|
970
|
+
resolve(res);
|
|
971
|
+
} else {
|
|
972
|
+
reject(false);
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
xmlHttp.send();
|
|
976
|
+
});
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* getStorage
|
|
981
|
+
* @desc:获取本地储存数据
|
|
982
|
+
* @author huangbo
|
|
983
|
+
* @date 2022年5月7日
|
|
984
|
+
* @param {String} [key] - 获取的名称
|
|
985
|
+
**/
|
|
986
|
+
const getStorage = function (key) {
|
|
987
|
+
if (key) {
|
|
988
|
+
let res =
|
|
989
|
+
sessionStorage.getItem(key) || localStorage.getItem(key) || win[key];
|
|
990
|
+
if (key === 'host' && !res) {
|
|
991
|
+
return win.location.origin;
|
|
992
|
+
}
|
|
993
|
+
return res;
|
|
994
|
+
}
|
|
995
|
+
let defaults = {};
|
|
996
|
+
const token =
|
|
997
|
+
sessionStorage.getItem('token') ||
|
|
998
|
+
localStorage.getItem('token') ||
|
|
999
|
+
win.token;
|
|
1000
|
+
const ssId =
|
|
1001
|
+
sessionStorage.getItem('ssId') || localStorage.getItem('ssId') || win.ssId;
|
|
1002
|
+
const deviceUnique =
|
|
1003
|
+
sessionStorage.getItem('deviceUnique') ||
|
|
1004
|
+
localStorage.getItem('deviceUnique') ||
|
|
1005
|
+
win.deviceUnique;
|
|
1006
|
+
if (token) {
|
|
1007
|
+
defaults.Authorization = token;
|
|
1008
|
+
}
|
|
1009
|
+
if (ssId) {
|
|
1010
|
+
defaults.ssId = ssId;
|
|
1011
|
+
}
|
|
1012
|
+
if (deviceUnique) {
|
|
1013
|
+
defaults.deviceUnique = deviceUnique;
|
|
1014
|
+
}
|
|
1015
|
+
return defaults;
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* getStyle
|
|
1020
|
+
* @desc:获取元素样式(含非行内样式)
|
|
1021
|
+
* @author huangbo
|
|
1022
|
+
* @date 2022年5月7日
|
|
1023
|
+
* @param {String} [dom] - dom元素
|
|
1024
|
+
* @param {String} [attr] - 样式属性名
|
|
1025
|
+
**/
|
|
1026
|
+
|
|
1027
|
+
const getStyle = function (dom, attr) {
|
|
1028
|
+
if (dom.style[attr]) {
|
|
1029
|
+
return dom.style[attr];
|
|
1030
|
+
}
|
|
1031
|
+
if (win.getComputedStyle) {
|
|
1032
|
+
return getComputedStyle(dom, null)[attr];
|
|
1033
|
+
}
|
|
1034
|
+
return dom.currentStyle[attr];
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* getTypeName
|
|
1039
|
+
* @desc:转换类型文本
|
|
1040
|
+
* @author huangbo
|
|
1041
|
+
* @date 2022年5月7日
|
|
1042
|
+
* @param {string} [type] - 类型
|
|
1043
|
+
**/
|
|
1044
|
+
const getTypeName = function (type) {
|
|
1045
|
+
let typeName = '';
|
|
1046
|
+
const sysorgname = getStorage('sysorgname');
|
|
1047
|
+
const sysdepname = getStorage('sysdepname');
|
|
1048
|
+
if (type === 'enterprise') {
|
|
1049
|
+
if (sysorgname) {
|
|
1050
|
+
typeName = '[' + sysorgname + ']';
|
|
1051
|
+
} else {
|
|
1052
|
+
typeName = '[公司]';
|
|
1053
|
+
}
|
|
1054
|
+
} else if (type === 'department') {
|
|
1055
|
+
if (sysdepname) {
|
|
1056
|
+
typeName = '[' + sysdepname + ']';
|
|
1057
|
+
} else {
|
|
1058
|
+
typeName = '[部门]';
|
|
1059
|
+
}
|
|
1060
|
+
} else if (type === 'role') {
|
|
1061
|
+
typeName = '[角色]';
|
|
1062
|
+
} else if (type === 'post') {
|
|
1063
|
+
typeName = '[岗位]';
|
|
1064
|
+
} else if (type === 'otheremployee' || type === 'employee') {
|
|
1065
|
+
if (sysdepname) {
|
|
1066
|
+
typeName = '[' + sysdepname + '员工]';
|
|
1067
|
+
} else {
|
|
1068
|
+
typeName = '[部门员工]';
|
|
1069
|
+
}
|
|
1070
|
+
} else if (type === 'postemployee') {
|
|
1071
|
+
typeName = '[岗位员工]';
|
|
1072
|
+
} else if (type === 'persongroup') {
|
|
1073
|
+
typeName = '[人员群组成员]';
|
|
1074
|
+
} else if (type === 'filgroup') {
|
|
1075
|
+
if (sysorgname) {
|
|
1076
|
+
typeName = '[' + sysorgname + '群组成员]';
|
|
1077
|
+
} else {
|
|
1078
|
+
typeName = '[公司群组成员]';
|
|
1079
|
+
}
|
|
1080
|
+
} else if (type === 'depgroup') {
|
|
1081
|
+
if (sysdepname) {
|
|
1082
|
+
typeName = '[' + sysdepname + '群组成员]';
|
|
1083
|
+
} else {
|
|
1084
|
+
typeName = '[部门群组成员]';
|
|
1085
|
+
}
|
|
1086
|
+
} else if (type === 'persongroupobj') {
|
|
1087
|
+
typeName = '[人员群组]';
|
|
1088
|
+
} else if (type === 'filgroupobj') {
|
|
1089
|
+
if (sysorgname) {
|
|
1090
|
+
typeName = '[' + sysorgname + '群组]';
|
|
1091
|
+
} else {
|
|
1092
|
+
typeName = '[公司群组]';
|
|
1093
|
+
}
|
|
1094
|
+
} else if (type === 'depgroupobj') {
|
|
1095
|
+
if (sysdepname) {
|
|
1096
|
+
typeName = '[' + sysdepname + '群组]';
|
|
1097
|
+
} else {
|
|
1098
|
+
typeName = '[部门群组]';
|
|
1099
|
+
}
|
|
1100
|
+
} else if (
|
|
1101
|
+
type === 'otherperson' ||
|
|
1102
|
+
type === 'topcontacts' ||
|
|
1103
|
+
type === 'person'
|
|
1104
|
+
) {
|
|
1105
|
+
typeName = '[人员]';
|
|
1106
|
+
} else if (type === 'codetable') {
|
|
1107
|
+
typeName = '[代码表]';
|
|
1108
|
+
} else if (type === 'organizecentreobj') {
|
|
1109
|
+
typeName = '[组织中心]';
|
|
1110
|
+
}
|
|
1111
|
+
return typeName;
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
/**
|
|
1115
|
+
* getValues
|
|
1116
|
+
* @desc:获取value值
|
|
1117
|
+
* @author huangbo
|
|
1118
|
+
* @date 2022年5月7日
|
|
1119
|
+
* @param {object} [obj] - json对象
|
|
1120
|
+
* @param {boolean} [flag] - 是否不重复获取
|
|
1121
|
+
**/
|
|
1122
|
+
const getValues = function (obj, flag) {
|
|
1123
|
+
let val = {};
|
|
1124
|
+
obj.forEach(items => {
|
|
1125
|
+
if (items.contents) {
|
|
1126
|
+
items.contents.forEach(item => {
|
|
1127
|
+
if (item.name && item.type !== 'button' && item.type !== 'submit') {
|
|
1128
|
+
if (item.type === 'table' && item.form) {
|
|
1129
|
+
val[item.name] = item.data;
|
|
1130
|
+
} else if (item.name && (!flag && !item.hide)) {
|
|
1131
|
+
if (item.value !== undefined && item.value !== '') {
|
|
1132
|
+
if (Array.isArray(val)) {
|
|
1133
|
+
if (val.length) {
|
|
1134
|
+
val[item.name] = item.value;
|
|
1135
|
+
}
|
|
1136
|
+
} else {
|
|
1137
|
+
val[item.name] = item.value;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
} else if (
|
|
1144
|
+
items.name &&
|
|
1145
|
+
items.type !== 'button' &&
|
|
1146
|
+
items.type !== 'submit'
|
|
1147
|
+
) {
|
|
1148
|
+
if (items.value !== undefined && items.value !== '') {
|
|
1149
|
+
if (Array.isArray(val)) {
|
|
1150
|
+
if (val.length) {
|
|
1151
|
+
val[items.name] = items.value;
|
|
1152
|
+
}
|
|
1153
|
+
} else {
|
|
1154
|
+
val[items.name] = items.value;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
} else if (items.type === 'table' && items.form) {
|
|
1158
|
+
val[items.type] = items.data;
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
return val;
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* handlerUrl
|
|
1166
|
+
* @desc:更新url参数中的时间戳
|
|
1167
|
+
* @author huangbo
|
|
1168
|
+
* @date 2022年5月7日
|
|
1169
|
+
* @param {String} [url] - url地址
|
|
1170
|
+
**/
|
|
1171
|
+
|
|
1172
|
+
const handlerUrl = function (url, before) {
|
|
1173
|
+
var arry = url.split('?');
|
|
1174
|
+
if (arry.length > 2) {
|
|
1175
|
+
let ary = arry.splice(1, arry.length);
|
|
1176
|
+
arry.push(ary.join('?'));
|
|
1177
|
+
}
|
|
1178
|
+
if (arry.length > 1) {
|
|
1179
|
+
if (arry[1].indexOf('_tt') > -1) {
|
|
1180
|
+
var search = arry[1].split('&');
|
|
1181
|
+
for (var i in search) {
|
|
1182
|
+
if (search[i].indexOf('_tt') > -1) {
|
|
1183
|
+
search[i] = '_tt=' + new Date().getTime();
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
arry[1] = search.join('&');
|
|
1187
|
+
} else {
|
|
1188
|
+
arry[1] += '&_tt=' + new Date().getTime();
|
|
1189
|
+
}
|
|
1190
|
+
url = arry.join('?');
|
|
1191
|
+
} else {
|
|
1192
|
+
url += '?_tt=' + new Date().getTime();
|
|
1193
|
+
}
|
|
1194
|
+
if (before && before === arry[0]) {
|
|
1195
|
+
let pathname = win.location.pathname;
|
|
1196
|
+
if (pathname === '/') {
|
|
1197
|
+
url = pathname + url;
|
|
1198
|
+
} else {
|
|
1199
|
+
url = pathname.replace('index.html', url);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
return encodeURI(url);
|
|
1203
|
+
};
|
|
1204
|
+
/**
|
|
1205
|
+
* hasChars
|
|
1206
|
+
* @desc: 检测指定字符串是否含有目标字符
|
|
1207
|
+
* @author huangbo
|
|
1208
|
+
* @date 2022年5月7日
|
|
1209
|
+
* @param {String} [str] - 指定字符
|
|
1210
|
+
* @param {String,Array} [res] - 检测目标
|
|
1211
|
+
**/
|
|
1212
|
+
const hasChars = function (res, str) {
|
|
1213
|
+
if (typeof res === 'string') {
|
|
1214
|
+
return str.indexOf(res) > -1;
|
|
1215
|
+
}
|
|
1216
|
+
if (Array.isArray(res)) {
|
|
1217
|
+
let flag = true;
|
|
1218
|
+
for (let i = 0; i < res.length; i++) {
|
|
1219
|
+
if (str.indexOf(res[i]) === -1) {
|
|
1220
|
+
flag = false;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
return flag;
|
|
1224
|
+
}
|
|
1225
|
+
return false;
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
const hasClass = function (element, name) {
|
|
1229
|
+
return (
|
|
1230
|
+
element && (' ' + element.className + ' ').indexOf(' ' + name + ' ') > -1
|
|
1231
|
+
);
|
|
1232
|
+
};
|
|
1233
|
+
/**
|
|
1234
|
+
* hsvTorgb
|
|
1235
|
+
* @desc:hsv转化成rgb
|
|
1236
|
+
* @author huangbo
|
|
1237
|
+
* @date 2022年5月7日
|
|
1238
|
+
* @param {string} [$color] - 颜色值
|
|
1239
|
+
**/
|
|
1240
|
+
const hsvTorgb = function ($h, $s, $v) {
|
|
1241
|
+
let $th = Math.floor($h / 60);
|
|
1242
|
+
let $t1 = $h / 60 - $th;
|
|
1243
|
+
let $t2 = $v * (1 - $s);
|
|
1244
|
+
let $t3 = $v * (1 - $t1 * $s);
|
|
1245
|
+
let $t4 = $v * (1 - (1 - $t1) * $s);
|
|
1246
|
+
let $r = [$v, $t3, $t2, $t2, $t4, $v][$th % 6];
|
|
1247
|
+
let $g = [$t4, $v, $v, $t3, $t2, $t2][$th % 6];
|
|
1248
|
+
let $b = [$t2, $t2, $t4, $v, $v, $t3][$th % 6];
|
|
1249
|
+
// return `rgb(${Math.round($r * 255)}, ${Math.round($g * 255)}, ${Math.round($b * 255)})`;
|
|
1250
|
+
let red = Math.round($r * 255);
|
|
1251
|
+
let green = Math.round($g * 255);
|
|
1252
|
+
let blue = Math.round($b * 255);
|
|
1253
|
+
red = red.toString(16);
|
|
1254
|
+
green = green.toString(16);
|
|
1255
|
+
blue = blue.toString(16);
|
|
1256
|
+
red = red.length === 1 ? '0' + red : red;
|
|
1257
|
+
green = green.length === 1 ? '0' + green : green;
|
|
1258
|
+
blue = blue.length === 1 ? '0' + blue : blue;
|
|
1259
|
+
return `#${red}${green}${blue}`;
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
/**
|
|
1263
|
+
* identical
|
|
1264
|
+
* @desc:验证值是否相同
|
|
1265
|
+
* @author huangbo
|
|
1266
|
+
* @date 2022年5月7日
|
|
1267
|
+
* @param {value} [array] - 需要对比的值的数组集合
|
|
1268
|
+
* @param {callback} [function] - 回调函数
|
|
1269
|
+
**/
|
|
1270
|
+
const identical = function ({
|
|
1271
|
+
value,
|
|
1272
|
+
callback,
|
|
1273
|
+
msg = ['请输入值', '请再次输入', '输入不一致!']
|
|
1274
|
+
}) {
|
|
1275
|
+
if (value && value.length > 1) {
|
|
1276
|
+
let val = value[0];
|
|
1277
|
+
if (val === '' || val === undefined || val === null) {
|
|
1278
|
+
callback(new Error(msg[0]));
|
|
1279
|
+
return false;
|
|
1280
|
+
}
|
|
1281
|
+
for (let i = 1; i < value.length; i++) {
|
|
1282
|
+
if (val === '' || val === undefined || val === null) {
|
|
1283
|
+
callback(new Error(msg[1]));
|
|
1284
|
+
return false;
|
|
1285
|
+
} else if (value[i] !== val) {
|
|
1286
|
+
callback(new Error(msg[2]));
|
|
1287
|
+
return false;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
callback();
|
|
1291
|
+
return true;
|
|
1292
|
+
}
|
|
1293
|
+
return false;
|
|
1294
|
+
};
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* indexOfObj
|
|
1298
|
+
* @desc:查找数组对象下标
|
|
1299
|
+
* @author huangbo
|
|
1300
|
+
* @date 2022年5月7日
|
|
1301
|
+
* @param {Array} [arry] - 被查找的数组
|
|
1302
|
+
* @param {Object} [target] - 目标对象
|
|
1303
|
+
* @param {String} [key] - 目标对象的属性名
|
|
1304
|
+
**/
|
|
1305
|
+
const indexOfObj = function (arry, target, key) {
|
|
1306
|
+
for (var i = 0; i < arry.length; i++) {
|
|
1307
|
+
if (key) {
|
|
1308
|
+
if (typeof target === 'string' && arry[i][key] === target) {
|
|
1309
|
+
return i;
|
|
1310
|
+
}
|
|
1311
|
+
if (target[key] === arry[i][key]) {
|
|
1312
|
+
return i;
|
|
1313
|
+
}
|
|
1314
|
+
} else {
|
|
1315
|
+
if (JSON.stringify(target) === JSON.stringify(arry[i])) {
|
|
1316
|
+
return i;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
return -1;
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* isFunction
|
|
1325
|
+
* @desc:判断是否是函数
|
|
1326
|
+
* @author huangbo
|
|
1327
|
+
* @date 2022年5月7日
|
|
1328
|
+
* @param {Object} [obj] - 对象
|
|
1329
|
+
**/
|
|
1330
|
+
const isFunction = function (obj) {
|
|
1331
|
+
return (
|
|
1332
|
+
typeof obj === 'function' &&
|
|
1333
|
+
typeof obj.nodeType !== 'number' &&
|
|
1334
|
+
typeof obj.item !== 'function'
|
|
1335
|
+
);
|
|
1336
|
+
};
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* isLogged
|
|
1340
|
+
* @desc:是否登录(用于路由守卫中)
|
|
1341
|
+
* @author huangbo
|
|
1342
|
+
* @date 2022年5月7日
|
|
1343
|
+
* @param {object} [to] - 路由跳转信息
|
|
1344
|
+
* @param {object} [from] - 路由来源信息
|
|
1345
|
+
* @param {function} [next] - 跳转函数
|
|
1346
|
+
* @param {function} [exclude] - 不拦截的路由
|
|
1347
|
+
* @param {boolean} [open] - 是否新窗口打开
|
|
1348
|
+
* @param {boolean} [cookie] - 是否尝试采用
|
|
1349
|
+
* @param {sting} [loginPage] - 第三方登录页面地址
|
|
1350
|
+
* @param {boolean} [redirect] - 是否重定向(用于新脚手架)
|
|
1351
|
+
**/
|
|
1352
|
+
const isLogged = function ({
|
|
1353
|
+
to,
|
|
1354
|
+
from,
|
|
1355
|
+
next,
|
|
1356
|
+
exclude,
|
|
1357
|
+
open,
|
|
1358
|
+
cookie,
|
|
1359
|
+
loginPage,
|
|
1360
|
+
redirect
|
|
1361
|
+
}) {
|
|
1362
|
+
const logined = getStorage('logined');
|
|
1363
|
+
if (cookie === undefined) {
|
|
1364
|
+
cookie = getParams({ name: 'cookie' });
|
|
1365
|
+
}
|
|
1366
|
+
// eslint-disable-next-line eqeqeq
|
|
1367
|
+
if (logined || cookie == true || cookie == 1) {
|
|
1368
|
+
if (loginPage) {
|
|
1369
|
+
sessionStorage.setItem('loginPage', loginPage);
|
|
1370
|
+
}
|
|
1371
|
+
next();
|
|
1372
|
+
} else {
|
|
1373
|
+
const token = getStorage('token') || getStorage('Authorization');
|
|
1374
|
+
if (
|
|
1375
|
+
Object.prototype.hasOwnProperty.call(to.query, 'serverId') &&
|
|
1376
|
+
Object.prototype.hasOwnProperty.call(to.query, 'authType')
|
|
1377
|
+
) {
|
|
1378
|
+
const url = win.top.location.href;
|
|
1379
|
+
ajax({
|
|
1380
|
+
method: 'post',
|
|
1381
|
+
url: authCenter,
|
|
1382
|
+
data: to.query
|
|
1383
|
+
}).then(res => {
|
|
1384
|
+
if (res.rCode === 0) {
|
|
1385
|
+
switch (res.results.statusCode) {
|
|
1386
|
+
case 0:
|
|
1387
|
+
const storage = getStorage('storage');
|
|
1388
|
+
setStorage({
|
|
1389
|
+
type: storage,
|
|
1390
|
+
key: {
|
|
1391
|
+
ssId: res.results.ssId,
|
|
1392
|
+
token: res.results.token,
|
|
1393
|
+
Authorization: res.results.token,
|
|
1394
|
+
deviceUnique: res.results.deviceUnique
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
next();
|
|
1398
|
+
break;
|
|
1399
|
+
case 1:
|
|
1400
|
+
break;
|
|
1401
|
+
case 2:
|
|
1402
|
+
break;
|
|
1403
|
+
case 3:
|
|
1404
|
+
const href = res.results.authorizeUrl.replace(
|
|
1405
|
+
'{redirectUri}',
|
|
1406
|
+
encodeURIComponent(url)
|
|
1407
|
+
);
|
|
1408
|
+
if (open) {
|
|
1409
|
+
win.open(href);
|
|
1410
|
+
} else {
|
|
1411
|
+
win.top.location.href = href;
|
|
1412
|
+
}
|
|
1413
|
+
break;
|
|
1414
|
+
}
|
|
1415
|
+
} else {
|
|
1416
|
+
if (token) {
|
|
1417
|
+
next();
|
|
1418
|
+
} else {
|
|
1419
|
+
alert(res.msg);
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
}).catch(e => { });
|
|
1423
|
+
} else if (
|
|
1424
|
+
token ||
|
|
1425
|
+
to.path === '/' ||
|
|
1426
|
+
to.path === '/login' ||
|
|
1427
|
+
to.path === '/404' ||
|
|
1428
|
+
exclude.indexOf(to.path) > -1 || exclude.indexOf(to.name) > -1
|
|
1429
|
+
) {
|
|
1430
|
+
if (redirect && to.name && (to.name === 'login' || to.name === 'main')) {
|
|
1431
|
+
window.location.replace(urlJoinParams({ url: `./${to.name}.html`, param: to.query }));
|
|
1432
|
+
} else {
|
|
1433
|
+
next();
|
|
1434
|
+
}
|
|
1435
|
+
} else {
|
|
1436
|
+
if (loginPage) {
|
|
1437
|
+
win.top.location.replace(loginPage);
|
|
1438
|
+
} else if (document.referrer) {
|
|
1439
|
+
win.top.location.replace(document.referrer);
|
|
1440
|
+
} else if (win.top.location.href.indexOf('main.html') > -1) {
|
|
1441
|
+
win.top.location.href = './login.html';
|
|
1442
|
+
} else {
|
|
1443
|
+
next('/login');
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* isObject
|
|
1451
|
+
* @desc:判断是否是对象
|
|
1452
|
+
* @author huangbo
|
|
1453
|
+
* @date 2022年5月7日
|
|
1454
|
+
* @param {Object} [obj] - 对象
|
|
1455
|
+
**/
|
|
1456
|
+
const isObject = function (obj) {
|
|
1457
|
+
let proto;
|
|
1458
|
+
let Ctor;
|
|
1459
|
+
|
|
1460
|
+
if (!obj || {}.toString.call(obj) !== '[object Object]') {
|
|
1461
|
+
return false;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
proto = Object.getPrototypeOf(obj);
|
|
1465
|
+
if (!proto) {
|
|
1466
|
+
return true;
|
|
1467
|
+
}
|
|
1468
|
+
let ObjectFunctionString = Object.prototype.hasOwnProperty.toString.call(
|
|
1469
|
+
Object
|
|
1470
|
+
);
|
|
1471
|
+
Ctor =
|
|
1472
|
+
Object.prototype.hasOwnProperty.call(proto, 'constructor') &&
|
|
1473
|
+
proto.constructor;
|
|
1474
|
+
return (
|
|
1475
|
+
typeof Ctor === 'function' &&
|
|
1476
|
+
Object.prototype.hasOwnProperty.toString.call(Ctor) === ObjectFunctionString
|
|
1477
|
+
);
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1480
|
+
/**
|
|
1481
|
+
* jointUrl
|
|
1482
|
+
* @desc:判断url地址是否以字符开头,没有则添加
|
|
1483
|
+
* @author huangbo
|
|
1484
|
+
* @date 2022年5月7日
|
|
1485
|
+
* @param {string} [reg] - 域名或者路径
|
|
1486
|
+
* @param {string/array} [url] - 地址
|
|
1487
|
+
* @param {boolean} [single] - 是否做js沙箱隔离
|
|
1488
|
+
**/
|
|
1489
|
+
const jointUrl = function ({ url, reg }) {
|
|
1490
|
+
if (
|
|
1491
|
+
startWith(url, ['https', 'http', 'blob:'], true) ||
|
|
1492
|
+
!reg ||
|
|
1493
|
+
!reg.length
|
|
1494
|
+
) {
|
|
1495
|
+
return url;
|
|
1496
|
+
}
|
|
1497
|
+
if (Array.isArray(reg)) {
|
|
1498
|
+
let newUrl = '';
|
|
1499
|
+
reg.forEach(item => {
|
|
1500
|
+
newUrl = startWith(url, item) ? url : item + url;
|
|
1501
|
+
});
|
|
1502
|
+
return newUrl;
|
|
1503
|
+
}
|
|
1504
|
+
return startWith(url, reg) ? url : reg + url;
|
|
1505
|
+
};
|
|
1506
|
+
|
|
1507
|
+
const loadJs = function ({ url, type = 'text/javascript', id, single = true }) {
|
|
1508
|
+
return new Promise((resolve, reject) => {
|
|
1509
|
+
let script =
|
|
1510
|
+
document.getElementById(id) || document.createElement('script');
|
|
1511
|
+
const src = script.getAttribute('src');
|
|
1512
|
+
if (src && src === url) {
|
|
1513
|
+
console.warn(id + '已存在');
|
|
1514
|
+
resolve();
|
|
1515
|
+
} else {
|
|
1516
|
+
id && script.setAttribute('id', id);
|
|
1517
|
+
script.setAttribute('type', type);
|
|
1518
|
+
script.setAttribute('src', url);
|
|
1519
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
|
1520
|
+
script.onreadystatechange = () => {
|
|
1521
|
+
resolve();
|
|
1522
|
+
};
|
|
1523
|
+
script.onload = () => {
|
|
1524
|
+
resolve();
|
|
1525
|
+
};
|
|
1526
|
+
script.onerror = () => {
|
|
1527
|
+
reject();
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
};
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* loading
|
|
1535
|
+
* @desc:loading
|
|
1536
|
+
* @author huangbo
|
|
1537
|
+
* @date 2022年5月7日
|
|
1538
|
+
* @param {String} [text] - 显示的文本内容
|
|
1539
|
+
**/
|
|
1540
|
+
const loading = function ($loading, res) {
|
|
1541
|
+
if (!$loading) {
|
|
1542
|
+
$loading = Loading.service;
|
|
1543
|
+
}
|
|
1544
|
+
if (isObject(res)) {
|
|
1545
|
+
const config = extend(
|
|
1546
|
+
{},
|
|
1547
|
+
{
|
|
1548
|
+
target: win.top.document.body,
|
|
1549
|
+
fullscreen: true,
|
|
1550
|
+
background: 'rgba(0, 0, 0, 0.65)',
|
|
1551
|
+
spinner: 'el-icon-loading',
|
|
1552
|
+
text: '加载中...'
|
|
1553
|
+
},
|
|
1554
|
+
res
|
|
1555
|
+
);
|
|
1556
|
+
return $loading(config);
|
|
1557
|
+
} else {
|
|
1558
|
+
let loading = $loading({
|
|
1559
|
+
target: win.top.document.body,
|
|
1560
|
+
fullscreen: true,
|
|
1561
|
+
background: 'rgba(0, 0, 0, 0.65)',
|
|
1562
|
+
spinner: 'el-icon-loading',
|
|
1563
|
+
text: res ? res : '加载中...'
|
|
1564
|
+
});
|
|
1565
|
+
return loading;
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* mixColor
|
|
1571
|
+
* @desc:生成混合色
|
|
1572
|
+
* @author huangbo
|
|
1573
|
+
* @date 2022年5月7日
|
|
1574
|
+
* @param {string} [$color1] - 颜色值
|
|
1575
|
+
* @param {string} [$color2] - 颜色值
|
|
1576
|
+
* @param {string} [$n] - 百分比 0~1
|
|
1577
|
+
**/
|
|
1578
|
+
const mixColor = function ($color1, $color2, $n) {
|
|
1579
|
+
const rgb1 = getRgb($color1);
|
|
1580
|
+
const rgb2 = getRgb($color2);
|
|
1581
|
+
const r = rgb1[0] * $n + rgb2[0] * (1 - $n);
|
|
1582
|
+
const g = rgb1[1] * $n + rgb2[1] * (1 - $n);
|
|
1583
|
+
const b = rgb1[2] * $n + rgb2[2] * (1 - $n);
|
|
1584
|
+
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
/**
|
|
1588
|
+
* overbrim
|
|
1589
|
+
* @desc:判断是否文字溢出
|
|
1590
|
+
* @author huangbo
|
|
1591
|
+
* @date 2022年5月7日
|
|
1592
|
+
* @param {String} [el] - 文字所在的dom
|
|
1593
|
+
**/
|
|
1594
|
+
const overbrim = function (el) {
|
|
1595
|
+
let w = el.offsetWidth;
|
|
1596
|
+
var s = el.scrollWidth;
|
|
1597
|
+
if (s > w) {
|
|
1598
|
+
return true;
|
|
1599
|
+
} else {
|
|
1600
|
+
return false;
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* queryParams
|
|
1606
|
+
* @desc:对象转url地址的拼接参数
|
|
1607
|
+
* @author huangbo
|
|
1608
|
+
* @date 2022年5月7日
|
|
1609
|
+
* @param {Object} [obj] - 被转换的对象
|
|
1610
|
+
**/
|
|
1611
|
+
const queryParams = function (obj) {
|
|
1612
|
+
let arry = [];
|
|
1613
|
+
for (let i in obj) {
|
|
1614
|
+
arry.push(i + '=' + obj[i]);
|
|
1615
|
+
}
|
|
1616
|
+
if (arry.length) {
|
|
1617
|
+
return arry.join('&');
|
|
1618
|
+
}
|
|
1619
|
+
return false;
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
/**
|
|
1623
|
+
* receiveMessage
|
|
1624
|
+
* @desc:接收发送信息
|
|
1625
|
+
* @author huangbo
|
|
1626
|
+
* @date 2022年5月7日
|
|
1627
|
+
* @param {object} [data] - 数据---其中type必须表示操作类型
|
|
1628
|
+
* @param {string} [url] - 消息源的 URI
|
|
1629
|
+
* @param {function} [callback] - 回调函数
|
|
1630
|
+
**/
|
|
1631
|
+
const receiveMessage = function ({ data = {}, url, callback }) {
|
|
1632
|
+
win.addEventListener('message', function (e) {
|
|
1633
|
+
if (url !== undefined) {
|
|
1634
|
+
let origin = e.origin || e.location.origin;
|
|
1635
|
+
if (origin !== url) {
|
|
1636
|
+
// 验证消息来源地址
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
callback(e.data);
|
|
1641
|
+
});
|
|
1642
|
+
};
|
|
1643
|
+
|
|
1644
|
+
/**
|
|
1645
|
+
* removeStorage
|
|
1646
|
+
* @desc:删除本地储存数据
|
|
1647
|
+
* @author huangbo
|
|
1648
|
+
* @date 2022年5月7日
|
|
1649
|
+
* @param {String, Array} [key] - 获取的名称
|
|
1650
|
+
**/
|
|
1651
|
+
const removeStorage = function (key) {
|
|
1652
|
+
if (Array.isArray(key)) {
|
|
1653
|
+
for (let i = 0; i < key.length; i++) {
|
|
1654
|
+
sessionStorage.removeItem(key[i]);
|
|
1655
|
+
localStorage.removeItem(key[i]);
|
|
1656
|
+
}
|
|
1657
|
+
} else if (key) {
|
|
1658
|
+
sessionStorage.removeItem(key);
|
|
1659
|
+
localStorage.removeItem(key);
|
|
1660
|
+
} else {
|
|
1661
|
+
sessionStorage.clear();
|
|
1662
|
+
localStorage.clear();
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* replenish
|
|
1668
|
+
* @desc:补全小数位数
|
|
1669
|
+
* @author huangbo
|
|
1670
|
+
* @date 2022年5月7日
|
|
1671
|
+
* @param {string、number} [data] - 数字或字符串型数字
|
|
1672
|
+
* @param {number} [precision] - 需要的小数位数
|
|
1673
|
+
**/
|
|
1674
|
+
const replenish = function ({ data, precision }) {
|
|
1675
|
+
if (data && precision && precision > 0) {
|
|
1676
|
+
let power = Math.pow(10, precision);
|
|
1677
|
+
let res = data === 'string' ? Number(data) : data;
|
|
1678
|
+
res = String(Math.round(res * power) / power);
|
|
1679
|
+
let len = res.indexOf('.');
|
|
1680
|
+
if (len < 0) {
|
|
1681
|
+
len = res.length;
|
|
1682
|
+
res += '.';
|
|
1683
|
+
}
|
|
1684
|
+
while (res.length <= len + precision) {
|
|
1685
|
+
res += '0';
|
|
1686
|
+
}
|
|
1687
|
+
return parseFloat(res);
|
|
1688
|
+
}
|
|
1689
|
+
return data;
|
|
1690
|
+
};
|
|
1691
|
+
|
|
1692
|
+
/**
|
|
1693
|
+
* rgbToHsv
|
|
1694
|
+
* @desc:rgb转化成hsv
|
|
1695
|
+
* @author huangbo
|
|
1696
|
+
* @date 2022年5月7日
|
|
1697
|
+
* @param {string} [$color] - 颜色值
|
|
1698
|
+
**/
|
|
1699
|
+
const rgbToHsv = function ($color) {
|
|
1700
|
+
let rgb = getRgb($color);
|
|
1701
|
+
let $red = rgb[0];
|
|
1702
|
+
let $green = rgb[1];
|
|
1703
|
+
let $blue = rgb[2];
|
|
1704
|
+
let $max = Math.max($red, $green, $blue);
|
|
1705
|
+
let $min = Math.min($red, $green, $blue);
|
|
1706
|
+
let $diff = $max - $min;
|
|
1707
|
+
let $h = 0;
|
|
1708
|
+
if ($max === $min) {
|
|
1709
|
+
$h = 0;
|
|
1710
|
+
} else if ($max === $red) {
|
|
1711
|
+
$h = (60 * ($green - $blue)) / $diff + ($green > $blue - 1 ? 0 : 360);
|
|
1712
|
+
} else if ($max === $green) {
|
|
1713
|
+
$h = (60 * ($blue - $red)) / $diff + 120;
|
|
1714
|
+
} else if ($max === $blue) {
|
|
1715
|
+
$h = (60 * ($red - $green)) / $diff + 240;
|
|
1716
|
+
}
|
|
1717
|
+
let $s = $max === 0 ? 0 : $diff / $max;
|
|
1718
|
+
let $v = $max / 255;
|
|
1719
|
+
return [$h, $s, $v];
|
|
1720
|
+
};
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* sendMessage
|
|
1724
|
+
* @desc:向iframe发送信息
|
|
1725
|
+
* @author huangbo
|
|
1726
|
+
* @date 2022年5月7日
|
|
1727
|
+
* @param {object} [data] - 数据---其中type必须表示操作类型
|
|
1728
|
+
* @param {string} [url] - 指定的消息发送URI地址
|
|
1729
|
+
**/
|
|
1730
|
+
const sendMessage = function ({ data = {}, url }) {
|
|
1731
|
+
const iframes = document.getElementsByTagName('iframe');
|
|
1732
|
+
for (let i = 0; i < iframes.length; i++) {
|
|
1733
|
+
if (url !== undefined) {
|
|
1734
|
+
if (iframes[i].contentWindow.location.href === url) {
|
|
1735
|
+
iframes[i].contentWindow.postMessage(data, url);
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
} else {
|
|
1739
|
+
iframes[i].contentWindow.postMessage(data);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* setFavicon
|
|
1746
|
+
* @desc:设置浏览器页签窗口图标
|
|
1747
|
+
* @author huangbo
|
|
1748
|
+
* @date 2022年5月7日
|
|
1749
|
+
* @param {String} [url] - 图标地址
|
|
1750
|
+
**/
|
|
1751
|
+
const setFavicon = function (url) {
|
|
1752
|
+
var link = document.querySelector("link[rel*='icon']");
|
|
1753
|
+
if (link) {
|
|
1754
|
+
link.href = url;
|
|
1755
|
+
} else {
|
|
1756
|
+
link = document.createElement('link');
|
|
1757
|
+
link.type = 'image/x-icon';
|
|
1758
|
+
link.rel = 'shortcut icon';
|
|
1759
|
+
link.href = url;
|
|
1760
|
+
document.getElementsByTagName('head')[0].appendChild(link);
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1764
|
+
/**
|
|
1765
|
+
* setStorage
|
|
1766
|
+
* @desc:设置本地储存数据
|
|
1767
|
+
* @author huangbo
|
|
1768
|
+
* @date 2022年5月7日
|
|
1769
|
+
* @param {String} [type] - 储存类型
|
|
1770
|
+
* @param {String, Array, Object} [key] - 数据的名称,array类型表示多个key保存同一个value,object类型时对象的属性名称作为key属性值作为value
|
|
1771
|
+
* @param {String} [value] - 数据的值
|
|
1772
|
+
**/
|
|
1773
|
+
const setStorage = function ({ type, key, value }) {
|
|
1774
|
+
if (value && typeof value === 'object') {
|
|
1775
|
+
value = JSON.stringify(value);
|
|
1776
|
+
}
|
|
1777
|
+
if (type === undefined || type === 'sessionStorage') {
|
|
1778
|
+
if (typeof key === 'string') {
|
|
1779
|
+
sessionStorage.setItem(key, value);
|
|
1780
|
+
} else if (Array.isArray(key)) {
|
|
1781
|
+
for (let i in key) {
|
|
1782
|
+
sessionStorage.setItem(key[i], value);
|
|
1783
|
+
}
|
|
1784
|
+
} else {
|
|
1785
|
+
for (let i in key) {
|
|
1786
|
+
let val = typeof key[i] === 'object' ? JSON.stringify(key[i]) : key[i];
|
|
1787
|
+
sessionStorage.setItem(i, val);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
} else {
|
|
1791
|
+
if (typeof key === 'string') {
|
|
1792
|
+
localStorage.setItem(key, value);
|
|
1793
|
+
} else if (Array.isArray(key)) {
|
|
1794
|
+
for (let i in key) {
|
|
1795
|
+
localStorage.setItem(key[i], value);
|
|
1796
|
+
}
|
|
1797
|
+
} else {
|
|
1798
|
+
for (let i in key) {
|
|
1799
|
+
let val = typeof key[i] === 'object' ? JSON.stringify(key[i]) : key[i];
|
|
1800
|
+
localStorage.setItem(i, val);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
/**
|
|
1806
|
+
* startWith
|
|
1807
|
+
* @desc:判断值是否以指定字符开头
|
|
1808
|
+
* @author huangbo
|
|
1809
|
+
* @date 2022年5月7日
|
|
1810
|
+
* @param {string} [value] - 被查找的字符串
|
|
1811
|
+
* @param {string,array} [reg] - 指定字符串
|
|
1812
|
+
* @param {boolean} [or] - 或者(等同于||)
|
|
1813
|
+
**/
|
|
1814
|
+
const startWith = function (value, reg, or = false) {
|
|
1815
|
+
if (Array.isArray(reg)) {
|
|
1816
|
+
let flag = true;
|
|
1817
|
+
for (let i = 0; i < reg.length; i++) {
|
|
1818
|
+
let item = reg[i];
|
|
1819
|
+
if (new RegExp('^' + item).test(value)) {
|
|
1820
|
+
if (or) {
|
|
1821
|
+
flag = true;
|
|
1822
|
+
return true;
|
|
1823
|
+
}
|
|
1824
|
+
} else {
|
|
1825
|
+
flag = false;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
return flag;
|
|
1829
|
+
}
|
|
1830
|
+
if (new RegExp('^' + reg).test(value)) {
|
|
1831
|
+
return true;
|
|
1832
|
+
}
|
|
1833
|
+
return false;
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
/**
|
|
1837
|
+
* throttle
|
|
1838
|
+
* @desc:添加js内容
|
|
1839
|
+
* @author huangbo
|
|
1840
|
+
* @date 2022年5月7日
|
|
1841
|
+
* @param {Function} [fn] - 函数
|
|
1842
|
+
* @param {Number} [wait] - 延迟毫秒数
|
|
1843
|
+
**/
|
|
1844
|
+
const throttle = function (fn, wait) {
|
|
1845
|
+
var timer = null;
|
|
1846
|
+
var startTime = Date.now();
|
|
1847
|
+
return function () {
|
|
1848
|
+
var curTime = Date.now();
|
|
1849
|
+
var remaining = wait - (curTime - startTime);
|
|
1850
|
+
var context = this;
|
|
1851
|
+
var args = arguments;
|
|
1852
|
+
clearTimeout(timer);
|
|
1853
|
+
if (remaining <= 0) {
|
|
1854
|
+
fn.apply(context, args);
|
|
1855
|
+
startTime = Date.now();
|
|
1856
|
+
} else {
|
|
1857
|
+
timer = setTimeout(fn, remaining); // 如果小于wait 保证在差值时间后执行
|
|
1858
|
+
}
|
|
1859
|
+
};
|
|
1860
|
+
};
|
|
1861
|
+
|
|
1862
|
+
/**
|
|
1863
|
+
* timeCycle
|
|
1864
|
+
* @desc:时间转换成上午下午晚上
|
|
1865
|
+
* @author huangbo
|
|
1866
|
+
* @date 2022年5月7日
|
|
1867
|
+
* @param {String, Number} [date] - 时间字符串或时间戳
|
|
1868
|
+
**/
|
|
1869
|
+
const timeCycle = function (date) {
|
|
1870
|
+
let obj;
|
|
1871
|
+
if (date) {
|
|
1872
|
+
obj = new Date(date);
|
|
1873
|
+
} else {
|
|
1874
|
+
obj = new Date();
|
|
1875
|
+
}
|
|
1876
|
+
let h = obj.getHours(); // 获取小时
|
|
1877
|
+
let period = '';
|
|
1878
|
+
h < 12 ? (period = '上午') : h < 18 ? (period = '下午') : (period = '晚上');
|
|
1879
|
+
return period;
|
|
1880
|
+
};
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* toFixed
|
|
1884
|
+
* @desc:浮点数保留小数位
|
|
1885
|
+
* @author huangbo
|
|
1886
|
+
* @date 2022年5月7日
|
|
1887
|
+
* @param {number} [$float] - 要转换的数值
|
|
1888
|
+
* @param {number} [$digits] - 小数位数
|
|
1889
|
+
**/
|
|
1890
|
+
const toFixed = function ($float, $digits) {
|
|
1891
|
+
let $pow = Math.pow(10, $digits);
|
|
1892
|
+
return Math.round($float * $pow) / $pow;
|
|
1893
|
+
};
|
|
1894
|
+
/**
|
|
1895
|
+
* toFunction
|
|
1896
|
+
* 兼容ie
|
|
1897
|
+
* @desc:函数字符串转函数
|
|
1898
|
+
* @author huangbo
|
|
1899
|
+
* @date 2022年5月7日
|
|
1900
|
+
* @param {string} [str] - 函数字符串
|
|
1901
|
+
**/
|
|
1902
|
+
const toFunction = function (str) {
|
|
1903
|
+
if (str.indexOf('=>') > -1) {
|
|
1904
|
+
let renders = str.split('=>');
|
|
1905
|
+
let args = renders[0].replace('(', '').replace(')', '').split(',');
|
|
1906
|
+
// eslint-disable-next-line no-control-regex
|
|
1907
|
+
let fnStr = renders[1].trim().replace(new RegExp('\n', 'gm'), '').replace(new RegExp('\t', 'gm'), '').replace(new RegExp('^\\{+|\\}+$', 'g'), '');
|
|
1908
|
+
let fn;
|
|
1909
|
+
if (args.length) {
|
|
1910
|
+
fn = new Function(
|
|
1911
|
+
...args,
|
|
1912
|
+
fnStr
|
|
1913
|
+
);
|
|
1914
|
+
} else {
|
|
1915
|
+
fn = new Function(
|
|
1916
|
+
fnStr
|
|
1917
|
+
);
|
|
1918
|
+
}
|
|
1919
|
+
return fn;
|
|
1920
|
+
} else {
|
|
1921
|
+
// eslint-disable-next-line no-eval
|
|
1922
|
+
return eval(str);
|
|
1923
|
+
}
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* updateTheme
|
|
1928
|
+
* @desc:更新主题色
|
|
1929
|
+
* @author huangbo
|
|
1930
|
+
* @date 2022年5月7日
|
|
1931
|
+
* @param {string} [$color] - 颜色值
|
|
1932
|
+
**/
|
|
1933
|
+
const updateTheme = function ($color, send) {
|
|
1934
|
+
$color = $color ? $color : '#409eff';
|
|
1935
|
+
if (send === undefined) {
|
|
1936
|
+
send = true;
|
|
1937
|
+
}
|
|
1938
|
+
document.documentElement.style.setProperty('--theme-primary', $color);
|
|
1939
|
+
for (let i = 1; i < 11; i++) {
|
|
1940
|
+
if (i === 6) {
|
|
1941
|
+
document.documentElement.style.setProperty(
|
|
1942
|
+
'--theme-primary-light-' + i,
|
|
1943
|
+
$color
|
|
1944
|
+
);
|
|
1945
|
+
} else {
|
|
1946
|
+
const light = getColor($color, i);
|
|
1947
|
+
document.documentElement.style.setProperty(
|
|
1948
|
+
'--theme-primary-light-' + i,
|
|
1949
|
+
light
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
if (send) {
|
|
1954
|
+
sendMessage({ data: { type: 'setTheme' } });
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* urlJoinParams
|
|
1960
|
+
* @desc:对象转url拼接参数
|
|
1961
|
+
* @author huangbo
|
|
1962
|
+
* @date 2022年5月7日
|
|
1963
|
+
* @param {Object} [url] - url地址
|
|
1964
|
+
* @param {Object} [param] - 被转换的对象
|
|
1965
|
+
**/
|
|
1966
|
+
const urlJoinParams = function ({ url, param, timestamp }) {
|
|
1967
|
+
let arry = decodeURI(url).split('?');
|
|
1968
|
+
let times = new Date().getTime();
|
|
1969
|
+
let params = timestamp ? { _tt: times } : {};
|
|
1970
|
+
if (arry.length > 1) {
|
|
1971
|
+
let search = arry[1].split('&');
|
|
1972
|
+
search.forEach(item => {
|
|
1973
|
+
let items = item.split('=');
|
|
1974
|
+
params[items[0]] = items[1];
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
'&_tt=' + new Date().getTime();
|
|
1978
|
+
params = extend(true, params, param);
|
|
1979
|
+
let str = queryParams(params);
|
|
1980
|
+
if (str) {
|
|
1981
|
+
return arry[0] + '?' + str;
|
|
1982
|
+
}
|
|
1983
|
+
return arry[0];
|
|
1984
|
+
};
|
|
1985
|
+
/**
|
|
1986
|
+
* uuid
|
|
1987
|
+
* @desc:唯一id
|
|
1988
|
+
* @author huangbo
|
|
1989
|
+
* @date 2022年5月7日
|
|
1990
|
+
* @param {number} [len] - 长度
|
|
1991
|
+
**/
|
|
1992
|
+
const uuid = function (len) {
|
|
1993
|
+
len = len || 32;
|
|
1994
|
+
let s = 4;
|
|
1995
|
+
let str = '';
|
|
1996
|
+
function S4() {
|
|
1997
|
+
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
1998
|
+
}
|
|
1999
|
+
for (let i = 0; i < Math.ceil(len / s); i++) {
|
|
2000
|
+
str += S4();
|
|
2001
|
+
}
|
|
2002
|
+
return str.substring(0, len);
|
|
2003
|
+
};
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* watermark
|
|
2007
|
+
* @desc:水印
|
|
2008
|
+
* @author huangbo
|
|
2009
|
+
* @date 2022年5月7日
|
|
2010
|
+
* @param {object} [option] - 配置参数
|
|
2011
|
+
**/
|
|
2012
|
+
const watermark = function (option) {
|
|
2013
|
+
// 默认设置
|
|
2014
|
+
let config = {
|
|
2015
|
+
rows: 5, // 水印行数
|
|
2016
|
+
cols: 5,
|
|
2017
|
+
html: '水印示例', // 水印文本内容
|
|
2018
|
+
angle: -15, // 旋转角度
|
|
2019
|
+
color: '#000', // 水印文字颜色
|
|
2020
|
+
width: 100, // 水印宽度
|
|
2021
|
+
height: 20, // 水印高度
|
|
2022
|
+
lineHeight: 20, // 水印行高
|
|
2023
|
+
opacity: 0.1, // 水印透明度
|
|
2024
|
+
fontSize: 14, // 水印文字字体大小
|
|
2025
|
+
fontWeight: 400, // 水印字体粗细
|
|
2026
|
+
fontFamily: '微软雅黑', // 水印文字字体类型
|
|
2027
|
+
textAlign: 'center', // 水印文字居中类型
|
|
2028
|
+
zIndex: 999999 // 水印文字的层级
|
|
2029
|
+
};
|
|
2030
|
+
let options = option ? extend(true, config, typeof option === 'string' ? { html: option } : option) : config;
|
|
2031
|
+
let wrap = document.createElement('div');
|
|
2032
|
+
// 禁止选择和复制
|
|
2033
|
+
wrap.onselectstart = wrap.oncontextmenu = function () {
|
|
2034
|
+
return false;
|
|
2035
|
+
};
|
|
2036
|
+
let docFrag = document.createDocumentFragment();
|
|
2037
|
+
let { rows, cols, html, angle, color, height, lineHeight, opacity, fontSize, fontWeight, fontFamily, textAlign, zIndex } = options;
|
|
2038
|
+
|
|
2039
|
+
wrap.style.cssText = 'display: flex;align-items: center;justify-content: flex-start;flex-wrap: wrap;align-content: space-between;position: fixed;left: 50%;top: 50%;transform: translate(-50%, -50%);height: 100vh;width: 100vw;pointer-events: none;overflow: hidden;background: transparent;z-index: ' + zIndex + ';';
|
|
2040
|
+
var num = rows * cols;
|
|
2041
|
+
for (var i = 0; i < num; i++) {
|
|
2042
|
+
var item = document.createElement('div');
|
|
2043
|
+
item.innerHTML = html;
|
|
2044
|
+
item.style.cssText = 'flex-grow: 1;flex-shrink: 0;color: ' + color + ';text-align: ' + textAlign + ';width: ' + (100 / cols) + '%;height: ' + height + 'px;line-height: ' + lineHeight + 'px;font-size:' + fontSize + 'px;font-weight: ' + fontWeight + ';font-family: ' + fontFamily + ';text-align: ' + textAlign + ';transform: rotate(' + angle + 'deg);opacity: ' + opacity + ';';
|
|
2045
|
+
docFrag.appendChild(item);
|
|
2046
|
+
}
|
|
2047
|
+
wrap.appendChild(docFrag);
|
|
2048
|
+
document.body.appendChild(wrap);
|
|
2049
|
+
};
|
|
2050
|
+
export default {
|
|
2051
|
+
ajax,
|
|
2052
|
+
arrUnique,
|
|
2053
|
+
browser,
|
|
2054
|
+
debounce,
|
|
2055
|
+
delUrlParam,
|
|
2056
|
+
domEval,
|
|
2057
|
+
esDecode,
|
|
2058
|
+
esEncode,
|
|
2059
|
+
esmEncrypt,
|
|
2060
|
+
esmDecode,
|
|
2061
|
+
exclAttribute,
|
|
2062
|
+
exportXls,
|
|
2063
|
+
extend,
|
|
2064
|
+
formatDate,
|
|
2065
|
+
getObjectType,
|
|
2066
|
+
getParams,
|
|
2067
|
+
getRgb,
|
|
2068
|
+
getScript,
|
|
2069
|
+
getStorage,
|
|
2070
|
+
getStyle,
|
|
2071
|
+
getTypeName,
|
|
2072
|
+
getValues,
|
|
2073
|
+
handlerUrl,
|
|
2074
|
+
hasChars,
|
|
2075
|
+
hasClass,
|
|
2076
|
+
hsvTorgb,
|
|
2077
|
+
identical,
|
|
2078
|
+
indexOfObj,
|
|
2079
|
+
isFunction,
|
|
2080
|
+
isLogged,
|
|
2081
|
+
isObject,
|
|
2082
|
+
jointUrl,
|
|
2083
|
+
loadJs,
|
|
2084
|
+
loading,
|
|
2085
|
+
mixColor,
|
|
2086
|
+
overbrim,
|
|
2087
|
+
queryParams,
|
|
2088
|
+
receiveMessage,
|
|
2089
|
+
removeStorage,
|
|
2090
|
+
replenish,
|
|
2091
|
+
rgbToHsv,
|
|
2092
|
+
sendMessage,
|
|
2093
|
+
setFavicon,
|
|
2094
|
+
setStorage,
|
|
2095
|
+
startWith,
|
|
2096
|
+
throttle,
|
|
2097
|
+
timeCycle,
|
|
2098
|
+
toFixed,
|
|
2099
|
+
toFunction,
|
|
2100
|
+
updateTheme,
|
|
2101
|
+
urlJoinParams,
|
|
2102
|
+
uuid,
|
|
2103
|
+
watermark,
|
|
2104
|
+
win
|
|
2105
|
+
};
|