eoss-mobiles 0.1.13

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.
Files changed (285) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +28 -0
  3. package/lib/action-sheet.js +313 -0
  4. package/lib/button-group.js +421 -0
  5. package/lib/button.js +278 -0
  6. package/lib/calendar.js +301 -0
  7. package/lib/cascader.js +336 -0
  8. package/lib/cell.js +366 -0
  9. package/lib/checkbox.js +2170 -0
  10. package/lib/circle.js +299 -0
  11. package/lib/config/api.js +31 -0
  12. package/lib/count-down.js +299 -0
  13. package/lib/date.js +956 -0
  14. package/lib/empty.js +274 -0
  15. package/lib/eoss-mobile.common.js +15072 -0
  16. package/lib/field.js +440 -0
  17. package/lib/flow.js +5664 -0
  18. package/lib/form.js +714 -0
  19. package/lib/grid-item.js +274 -0
  20. package/lib/grid.js +317 -0
  21. package/lib/image-preview.js +325 -0
  22. package/lib/index.js +1 -0
  23. package/lib/list.js +315 -0
  24. package/lib/loading.js +279 -0
  25. package/lib/nav-bar.js +283 -0
  26. package/lib/pagination.js +323 -0
  27. package/lib/picker.js +2714 -0
  28. package/lib/popover.js +306 -0
  29. package/lib/popup.js +297 -0
  30. package/lib/radio.js +2137 -0
  31. package/lib/rate.js +300 -0
  32. package/lib/search.js +316 -0
  33. package/lib/selector.js +3496 -0
  34. package/lib/skeleton.js +277 -0
  35. package/lib/stepper.js +300 -0
  36. package/lib/switch.js +304 -0
  37. package/lib/tab.js +274 -0
  38. package/lib/table-column.js +2991 -0
  39. package/lib/table.js +2652 -0
  40. package/lib/tabs.js +315 -0
  41. package/lib/tag.js +281 -0
  42. package/lib/theme-chalk/action-sheet.css +0 -0
  43. package/lib/theme-chalk/base.css +1 -0
  44. package/lib/theme-chalk/button-group.css +1 -0
  45. package/lib/theme-chalk/button.css +1 -0
  46. package/lib/theme-chalk/calendar.css +1 -0
  47. package/lib/theme-chalk/cascader.css +1 -0
  48. package/lib/theme-chalk/cell.css +1 -0
  49. package/lib/theme-chalk/checkbox.css +1 -0
  50. package/lib/theme-chalk/circle.css +1 -0
  51. package/lib/theme-chalk/count-down.css +0 -0
  52. package/lib/theme-chalk/date.css +0 -0
  53. package/lib/theme-chalk/empty.css +0 -0
  54. package/lib/theme-chalk/field.css +1 -0
  55. package/lib/theme-chalk/flow.css +1 -0
  56. package/lib/theme-chalk/fonts/iconfont.scss +530 -0
  57. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  58. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  59. package/lib/theme-chalk/form.css +0 -0
  60. package/lib/theme-chalk/grid-item.css +1 -0
  61. package/lib/theme-chalk/grid.css +0 -0
  62. package/lib/theme-chalk/icon.css +1 -0
  63. package/lib/theme-chalk/image-preview.css +0 -0
  64. package/lib/theme-chalk/index.css +1 -0
  65. package/lib/theme-chalk/list.css +0 -0
  66. package/lib/theme-chalk/loading.css +0 -0
  67. package/lib/theme-chalk/nav-bar.css +0 -0
  68. package/lib/theme-chalk/navbar.css +1 -0
  69. package/lib/theme-chalk/pagination.css +1 -0
  70. package/lib/theme-chalk/picker.css +1 -0
  71. package/lib/theme-chalk/popover.css +0 -0
  72. package/lib/theme-chalk/popup.css +0 -0
  73. package/lib/theme-chalk/radio.css +1 -0
  74. package/lib/theme-chalk/rate.css +0 -0
  75. package/lib/theme-chalk/search.css +0 -0
  76. package/lib/theme-chalk/selector.css +1 -0
  77. package/lib/theme-chalk/skeleton.css +0 -0
  78. package/lib/theme-chalk/stepper.css +1 -0
  79. package/lib/theme-chalk/switch.css +1 -0
  80. package/lib/theme-chalk/tab.css +0 -0
  81. package/lib/theme-chalk/table-column.css +0 -0
  82. package/lib/theme-chalk/table.css +1 -0
  83. package/lib/theme-chalk/tabs.css +1 -0
  84. package/lib/theme-chalk/tag.css +1 -0
  85. package/lib/theme-chalk/theme.css +0 -0
  86. package/lib/theme-chalk/tree.css +1 -0
  87. package/lib/theme-chalk/uploader.css +0 -0
  88. package/lib/uploader.js +307 -0
  89. package/lib/utils/axios.js +199 -0
  90. package/lib/utils/date-util.js +320 -0
  91. package/lib/utils/http.js +74 -0
  92. package/lib/utils/rules.js +21 -0
  93. package/lib/utils/store.js +24 -0
  94. package/lib/utils/util.js +1315 -0
  95. package/package.json +153 -0
  96. package/packages/action-sheet/index.js +5 -0
  97. package/packages/action-sheet/src/main.vue +32 -0
  98. package/packages/button/index.js +5 -0
  99. package/packages/button/src/main.vue +15 -0
  100. package/packages/button-group/index.js +5 -0
  101. package/packages/button-group/src/main.vue +80 -0
  102. package/packages/calendar/index.js +5 -0
  103. package/packages/calendar/src/main.vue +34 -0
  104. package/packages/cascader/index.js +5 -0
  105. package/packages/cascader/src/main.vue +40 -0
  106. package/packages/cell/index.js +5 -0
  107. package/packages/cell/src/main.vue +72 -0
  108. package/packages/checkbox/index.js +5 -0
  109. package/packages/checkbox/src/main.vue +149 -0
  110. package/packages/circle/index.js +5 -0
  111. package/packages/circle/src/main.vue +27 -0
  112. package/packages/count-down/index.js +5 -0
  113. package/packages/count-down/src/main.vue +27 -0
  114. package/packages/date/index.js +5 -0
  115. package/packages/date/src/date-time.vue +290 -0
  116. package/packages/date/src/main.vue +319 -0
  117. package/packages/empty/index.js +5 -0
  118. package/packages/empty/src/main.vue +16 -0
  119. package/packages/field/index.js +5 -0
  120. package/packages/field/src/main.vue +130 -0
  121. package/packages/flow/index.js +5 -0
  122. package/packages/flow/src/components/Handle.vue +1031 -0
  123. package/packages/flow/src/components/Message.vue +96 -0
  124. package/packages/flow/src/components/Opinion.vue +112 -0
  125. package/packages/flow/src/components/Reject.vue +202 -0
  126. package/packages/flow/src/components/StartFlow.vue +440 -0
  127. package/packages/flow/src/components/TaskRead.vue +237 -0
  128. package/packages/flow/src/main.vue +43 -0
  129. package/packages/form/index.js +5 -0
  130. package/packages/form/src/main.vue +158 -0
  131. package/packages/grid/index.js +5 -0
  132. package/packages/grid/src/main.vue +28 -0
  133. package/packages/grid-item/index.js +5 -0
  134. package/packages/grid-item/src/main.vue +16 -0
  135. package/packages/image-preview/index.js +5 -0
  136. package/packages/image-preview/src/main.vue +34 -0
  137. package/packages/list/index.js +5 -0
  138. package/packages/list/src/main.vue +32 -0
  139. package/packages/loading/index.js +5 -0
  140. package/packages/loading/src/main.vue +20 -0
  141. package/packages/nav-bar/index.js +5 -0
  142. package/packages/nav-bar/src/main.vue +16 -0
  143. package/packages/pagination/index.js +5 -0
  144. package/packages/pagination/src/main.vue +29 -0
  145. package/packages/picker/index.js +5 -0
  146. package/packages/picker/src/main.vue +500 -0
  147. package/packages/popover/index.js +5 -0
  148. package/packages/popover/src/main.vue +32 -0
  149. package/packages/popup/index.js +5 -0
  150. package/packages/popup/src/main.vue +27 -0
  151. package/packages/radio/index.js +5 -0
  152. package/packages/radio/src/main.vue +147 -0
  153. package/packages/rate/index.js +5 -0
  154. package/packages/rate/src/main.vue +27 -0
  155. package/packages/search/index.js +5 -0
  156. package/packages/search/src/main.vue +39 -0
  157. package/packages/selector/index.js +5 -0
  158. package/packages/selector/src/main.vue +77 -0
  159. package/packages/selector/src/selector-field.vue +225 -0
  160. package/packages/selector/src/selector-tree.vue +472 -0
  161. package/packages/selector/src/tree.vue +179 -0
  162. package/packages/skeleton/index.js +5 -0
  163. package/packages/skeleton/src/main.vue +17 -0
  164. package/packages/stepper/index.js +5 -0
  165. package/packages/stepper/src/main.vue +25 -0
  166. package/packages/switch/index.js +5 -0
  167. package/packages/switch/src/main.vue +29 -0
  168. package/packages/tab/index.js +5 -0
  169. package/packages/tab/src/main.vue +16 -0
  170. package/packages/table/index.js +5 -0
  171. package/packages/table/src/main.vue +830 -0
  172. package/packages/table-column/index.js +5 -0
  173. package/packages/table-column/src/main.vue +742 -0
  174. package/packages/table-column/src/mixins/table.js +12 -0
  175. package/packages/tabs/index.js +5 -0
  176. package/packages/tabs/src/main.vue +34 -0
  177. package/packages/tag/index.js +5 -0
  178. package/packages/tag/src/main.vue +16 -0
  179. package/packages/theme-chalk/README.md +33 -0
  180. package/packages/theme-chalk/lib/action-sheet.css +0 -0
  181. package/packages/theme-chalk/lib/base.css +1 -0
  182. package/packages/theme-chalk/lib/button-group.css +1 -0
  183. package/packages/theme-chalk/lib/button.css +1 -0
  184. package/packages/theme-chalk/lib/calendar.css +1 -0
  185. package/packages/theme-chalk/lib/cascader.css +1 -0
  186. package/packages/theme-chalk/lib/cell.css +1 -0
  187. package/packages/theme-chalk/lib/checkbox.css +1 -0
  188. package/packages/theme-chalk/lib/circle.css +1 -0
  189. package/packages/theme-chalk/lib/count-down.css +0 -0
  190. package/packages/theme-chalk/lib/date.css +0 -0
  191. package/packages/theme-chalk/lib/empty.css +0 -0
  192. package/packages/theme-chalk/lib/field.css +1 -0
  193. package/packages/theme-chalk/lib/flow.css +1 -0
  194. package/packages/theme-chalk/lib/fonts/iconfont.scss +530 -0
  195. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  196. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  197. package/packages/theme-chalk/lib/form.css +0 -0
  198. package/packages/theme-chalk/lib/grid-item.css +1 -0
  199. package/packages/theme-chalk/lib/grid.css +0 -0
  200. package/packages/theme-chalk/lib/icon.css +1 -0
  201. package/packages/theme-chalk/lib/image-preview.css +0 -0
  202. package/packages/theme-chalk/lib/index.css +1 -0
  203. package/packages/theme-chalk/lib/list.css +0 -0
  204. package/packages/theme-chalk/lib/loading.css +0 -0
  205. package/packages/theme-chalk/lib/nav-bar.css +0 -0
  206. package/packages/theme-chalk/lib/navbar.css +1 -0
  207. package/packages/theme-chalk/lib/pagination.css +1 -0
  208. package/packages/theme-chalk/lib/picker.css +1 -0
  209. package/packages/theme-chalk/lib/popover.css +0 -0
  210. package/packages/theme-chalk/lib/popup.css +0 -0
  211. package/packages/theme-chalk/lib/radio.css +1 -0
  212. package/packages/theme-chalk/lib/rate.css +0 -0
  213. package/packages/theme-chalk/lib/search.css +0 -0
  214. package/packages/theme-chalk/lib/selector.css +1 -0
  215. package/packages/theme-chalk/lib/skeleton.css +0 -0
  216. package/packages/theme-chalk/lib/stepper.css +1 -0
  217. package/packages/theme-chalk/lib/switch.css +1 -0
  218. package/packages/theme-chalk/lib/tab.css +0 -0
  219. package/packages/theme-chalk/lib/table-column.css +0 -0
  220. package/packages/theme-chalk/lib/table.css +1 -0
  221. package/packages/theme-chalk/lib/tabs.css +1 -0
  222. package/packages/theme-chalk/lib/tag.css +1 -0
  223. package/packages/theme-chalk/lib/theme.css +0 -0
  224. package/packages/theme-chalk/lib/tree.css +1 -0
  225. package/packages/theme-chalk/lib/uploader.css +0 -0
  226. package/packages/theme-chalk/package.json +35 -0
  227. package/packages/theme-chalk/src/action-sheet.scss +0 -0
  228. package/packages/theme-chalk/src/base.scss +182 -0
  229. package/packages/theme-chalk/src/button-group.scss +26 -0
  230. package/packages/theme-chalk/src/button.scss +3 -0
  231. package/packages/theme-chalk/src/calendar.scss +12 -0
  232. package/packages/theme-chalk/src/cascader.scss +12 -0
  233. package/packages/theme-chalk/src/cell.scss +14 -0
  234. package/packages/theme-chalk/src/checkbox.scss +10 -0
  235. package/packages/theme-chalk/src/circle.scss +7 -0
  236. package/packages/theme-chalk/src/common/var.scss +1525 -0
  237. package/packages/theme-chalk/src/count-down.scss +0 -0
  238. package/packages/theme-chalk/src/date.scss +0 -0
  239. package/packages/theme-chalk/src/empty.scss +0 -0
  240. package/packages/theme-chalk/src/field.scss +28 -0
  241. package/packages/theme-chalk/src/flow.scss +542 -0
  242. package/packages/theme-chalk/src/fonts/iconfont.scss +530 -0
  243. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  244. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  245. package/packages/theme-chalk/src/form.scss +15 -0
  246. package/packages/theme-chalk/src/grid-item.scss +8 -0
  247. package/packages/theme-chalk/src/grid.scss +0 -0
  248. package/packages/theme-chalk/src/icon.scss +1661 -0
  249. package/packages/theme-chalk/src/image-preview.scss +0 -0
  250. package/packages/theme-chalk/src/index.scss +38 -0
  251. package/packages/theme-chalk/src/list.scss +0 -0
  252. package/packages/theme-chalk/src/loading.scss +0 -0
  253. package/packages/theme-chalk/src/mixins/color.scss +117 -0
  254. package/packages/theme-chalk/src/mixins/mixins.scss +25 -0
  255. package/packages/theme-chalk/src/nav-bar.scss +0 -0
  256. package/packages/theme-chalk/src/navbar.scss +6 -0
  257. package/packages/theme-chalk/src/pagination.scss +10 -0
  258. package/packages/theme-chalk/src/picker.scss +27 -0
  259. package/packages/theme-chalk/src/popover.scss +0 -0
  260. package/packages/theme-chalk/src/popup.scss +0 -0
  261. package/packages/theme-chalk/src/radio.scss +7 -0
  262. package/packages/theme-chalk/src/rate.scss +0 -0
  263. package/packages/theme-chalk/src/search.scss +0 -0
  264. package/packages/theme-chalk/src/selector.scss +218 -0
  265. package/packages/theme-chalk/src/skeleton.scss +0 -0
  266. package/packages/theme-chalk/src/stepper.scss +10 -0
  267. package/packages/theme-chalk/src/switch.scss +6 -0
  268. package/packages/theme-chalk/src/tab.scss +0 -0
  269. package/packages/theme-chalk/src/table-column.scss +0 -0
  270. package/packages/theme-chalk/src/table.scss +42 -0
  271. package/packages/theme-chalk/src/tabs.scss +21 -0
  272. package/packages/theme-chalk/src/tag.scss +13 -0
  273. package/packages/theme-chalk/src/theme.scss +2 -0
  274. package/packages/theme-chalk/src/tree.scss +115 -0
  275. package/packages/theme-chalk/src/uploader.scss +0 -0
  276. package/packages/uploader/index.js +5 -0
  277. package/packages/uploader/src/main.vue +31 -0
  278. package/src/config/api.js +29 -0
  279. package/src/index.js +130 -0
  280. package/src/utils/axios.js +198 -0
  281. package/src/utils/date-util.js +312 -0
  282. package/src/utils/http.js +66 -0
  283. package/src/utils/rules.js +18 -0
  284. package/src/utils/store.js +21 -0
  285. package/src/utils/util.js +1346 -0
@@ -0,0 +1,1315 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* eslint-disable indent */
6
+ // import { authCenter } from '../config/api';
7
+
8
+
9
+ var _color = require('@eoss-design/color');
10
+
11
+ var sm2 = require('sm-crypto').sm2;
12
+
13
+ /**
14
+ * esEncrypt
15
+ * @desc:sm2加密
16
+ * @author huangbo
17
+ * @date 2022年5月7日
18
+ * @param {string} [data] - 被加密的字符串
19
+ * @param {string} [key] - 公钥
20
+ **/
21
+ var esEncrypt = function esEncrypt(data, key, mode) {
22
+ var cipherMode = mode ? mode : 1;
23
+ if (!new RegExp('^04').test(key)) {
24
+ key = '04' + key;
25
+ }
26
+ var result = sm2.doEncrypt(data, key, cipherMode);
27
+ return result;
28
+ };
29
+
30
+ /**
31
+ * esDecode
32
+ * @desc:sm2解密
33
+ * @author huangbo
34
+ * @date 2022年5月7日
35
+ * @param {string} [data] - 被解密的加密字符串
36
+ * @param {string} [key] - 私钥
37
+ **/
38
+ var esDecode = function esDecode(data, key, mode) {
39
+ var cipherMode = mode ? mode : 1;
40
+ var result = sm2.doDecrypt(data, key, cipherMode);
41
+ return result;
42
+ };
43
+ /**
44
+ * startWith
45
+ * @desc:判断是否以指定字符开头
46
+ * @author huangbo
47
+ * @date 2022年5月7日
48
+ * @param {string} [str] - 被查找的字符串
49
+ * @param {string} [reg] - 指定字符串
50
+ **/
51
+ var startWith = function startWith(str, reg) {
52
+ if (new RegExp('^' + reg).test(str)) {
53
+ return true;
54
+ }
55
+ return false;
56
+ };
57
+ /**
58
+ * jointUrl
59
+ * @desc:判断url地址是否以字符开头,没有则添加
60
+ * @author huangbo
61
+ * @date 2022年5月7日
62
+ * @param {string} [str] - 域名或者路径
63
+ * @param {string} [url] - 地址
64
+ **/
65
+ var jointUrl = function jointUrl(url, str) {
66
+ if (startWith(url, 'http') || startWith(url, 'blob:') || !str) {
67
+ return url;
68
+ }
69
+ return startWith(url, str) ? url : str + url;
70
+ };
71
+ /**
72
+ * queryParams
73
+ * @desc:对象转url拼接参数
74
+ * @author huangbo
75
+ * @date 2022年5月7日
76
+ * @param {Object} [obj] - 被转换的对象
77
+ **/
78
+ var queryParams = function queryParams(obj) {
79
+ var arry = [];
80
+ for (var i in obj) {
81
+ arry.push(i + '=' + obj[i]);
82
+ }
83
+ if (arry.length) {
84
+ return arry.join('&');
85
+ }
86
+ return false;
87
+ };
88
+ /**
89
+ * queryParams
90
+ * @desc:对象转url拼接参数
91
+ * @author huangbo
92
+ * @date 2022年5月7日
93
+ * @param {Object} [url] - url地址
94
+ * @param {Object} [obj] - 被转换的对象
95
+ **/
96
+ var urlJoinParams = function urlJoinParams(url, obj) {
97
+ var arry = decodeURI(url).split('?');
98
+ var params = {};
99
+ if (arry.length > 1) {
100
+ var search = arry[1].split('&');
101
+ search.forEach(function (item) {
102
+ var items = item.split('=');
103
+ params[items[0]] = items[1];
104
+ });
105
+ }
106
+ params = extend(true, params, obj);
107
+ var str = queryParams(params);
108
+ if (str) {
109
+ return arry[0] + '?' + str;
110
+ }
111
+ return arry[0];
112
+ };
113
+ /**
114
+ * arrUnique
115
+ * @desc:数组元素对象去重
116
+ * @author huangbo
117
+ * @date 2022年5月7日
118
+ * @param {Object} [arr] - 原始数组
119
+ * @param {String} [key] - 对象子元素的属性名
120
+ **/
121
+ var arrUnique = function arrUnique(arr, key) {
122
+ var newArr = [];
123
+ if (key === undefined) {
124
+ arr.sort();
125
+ newArr = [arr[0]];
126
+ for (var i = 1; i < arr.length; i++) {
127
+ if (arr[i] !== newArr[newArr.length - 1]) {
128
+ newArr.push(arr[i]);
129
+ }
130
+ }
131
+ } else {
132
+ var obj = {};
133
+ for (var _i = 0; _i < arr.length; _i++) {
134
+ if (!obj[arr[_i][key]]) {
135
+ newArr.push(arr[_i]);
136
+ obj[arr[_i][key]] = true;
137
+ }
138
+ }
139
+ }
140
+ return newArr;
141
+ };
142
+ /**
143
+ * isObject
144
+ * @desc:判断是否是对象
145
+ * @author huangbo
146
+ * @date 2022年5月7日
147
+ * @param {Object} [obj] - 对象
148
+ **/
149
+ var isObject = function isObject(obj) {
150
+ var proto = void 0;
151
+ var Ctor = void 0;
152
+ var hasOwn = {}.hasOwnProperty;
153
+ if (!obj || toString.call(obj) !== '[object Object]') {
154
+ return false;
155
+ }
156
+
157
+ proto = Object.getPrototypeOf(obj);
158
+ if (!proto) {
159
+ return true;
160
+ }
161
+ var fnToString = hasOwn.toString;
162
+ var ObjectFunctionString = fnToString.call(Object);
163
+ Ctor = hasOwn.call(proto, 'constructor') && proto.constructor;
164
+ return typeof Ctor === 'function' && fnToString.call(Ctor) === ObjectFunctionString;
165
+ };
166
+ /**
167
+ * isFunction
168
+ * @desc:判断是否是函数
169
+ * @author huangbo
170
+ * @date 2022年5月7日
171
+ * @param {Object} [obj] - 对象
172
+ **/
173
+ var isFunction = function isFunction(obj) {
174
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number' && typeof obj.item !== 'function';
175
+ };
176
+ /**
177
+ * extend
178
+ * @desc:对象拷贝
179
+ * @author huangbo
180
+ * @date 2022年5月7日
181
+ * @param {Object} [target] - 被扩展的对象
182
+ * @param {Boolean}} [deep] - 是否深度操作
183
+ **/
184
+ var extend = function extend() {
185
+ var options = void 0;
186
+ var name = void 0;
187
+ var src = void 0;
188
+ var copy = void 0;
189
+ var copyIsArray = void 0;
190
+ var clone = void 0;
191
+ var target = arguments[0] || {};
192
+ var i = 1;
193
+ var length = arguments.length;
194
+ var deep = false;
195
+ if (typeof target === 'boolean') {
196
+ deep = target;
197
+ target = arguments[i] || {};
198
+ i++;
199
+ }
200
+ if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) !== 'object' && !isFunction(target)) {
201
+ target = {};
202
+ }
203
+ if (i === length) {
204
+ target = this;
205
+ i--;
206
+ }
207
+ for (; i < length; i++) {
208
+ if ((options = arguments[i]) != null) {
209
+ for (name in options) {
210
+ copy = options[name];
211
+ if (name === '__proto__' || target === copy) {
212
+ continue;
213
+ }
214
+ if (deep && copy && (isObject(copy) || (copyIsArray = Array.isArray(copy)))) {
215
+ src = target[name];
216
+ if (copyIsArray && !Array.isArray(src)) {
217
+ clone = [];
218
+ } else if (!copyIsArray && !isObject(src)) {
219
+ clone = {};
220
+ } else {
221
+ clone = src;
222
+ }
223
+ copyIsArray = false;
224
+ target[name] = extend(deep, clone, copy);
225
+ } else if (copy !== undefined) {
226
+ target[name] = copy;
227
+ }
228
+ }
229
+ }
230
+ }
231
+ return target;
232
+ };
233
+ /**
234
+ * getObjectType
235
+ * @desc:获取数据类型
236
+ * @author tangdaibing
237
+ * @date 2022年5月7日
238
+ **/
239
+ var getObjectType = function getObjectType(data) {
240
+ var type = Object.prototype.toString.call(data).toLowerCase();
241
+ var typeFormat = {
242
+ '[object string]': 'string',
243
+ '[object number]': 'number',
244
+ '[object null]': 'null',
245
+ '[object boolean]': 'boolean',
246
+ '[object undefined]': 'undefined',
247
+ '[object object]': 'object',
248
+ '[object array]': 'array',
249
+ '[object function]': 'function',
250
+ '[object date]': 'date'
251
+ };
252
+ return typeFormat[type];
253
+ };
254
+ /**
255
+ * getParams
256
+ * @desc:获取url地址指定参数
257
+ * @author huangbo
258
+ * @date 2022年5月7日
259
+ * @param {String} [name] - 参数名称
260
+ **/
261
+ var getParams = function getParams(name) {
262
+ var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
263
+ var r = window.location.search ? decodeURI(window.location.search).substr(1).match(reg) : decodeURI(window.location.hash).slice(decodeURI(window.location.hash).indexOf('?') + 1).match(reg);
264
+ if (r != null) {
265
+ return unescape(r[2]);
266
+ } else {
267
+ return null;
268
+ }
269
+ };
270
+ /**
271
+ * getScript
272
+ * @desc:获取js文件并执行
273
+ * @author huangbo
274
+ * @date 2022年5月7日
275
+ * @param {String} [url] - js文件地址
276
+ **/
277
+ var getScript = function getScript(url) {
278
+ // eslint-disable-next-line no-undef
279
+ return new Promise(function (resolve, reject) {
280
+ var xmlHttp = null;
281
+ if (window.XMLHttpRequest) {
282
+ xmlHttp = new XMLHttpRequest();
283
+ } else if (window.ActiveXObject) {
284
+ xmlHttp = new window.ActiveXObject('Microsoft.XMLHTTP');
285
+ }
286
+ if (xmlHttp == null) {
287
+ alert('浏览器不支持xmlHttp');
288
+ return;
289
+ }
290
+ xmlHttp.open('GET', url, false);
291
+ xmlHttp.onreadystatechange = function () {
292
+ if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
293
+ var res = xmlHttp.responseText;
294
+ domEval(res);
295
+ resolve(true);
296
+ } else {
297
+ reject(false);
298
+ }
299
+ };
300
+ xmlHttp.send();
301
+ }).catch(function onRejected() {});
302
+ };
303
+ /**
304
+ * domEval
305
+ * @desc:添加js内容
306
+ * @author huangbo
307
+ * @date 2022年5月7日
308
+ * @param {String} [code] - js内容
309
+ **/
310
+ function domEval(code) {
311
+ var script = document.createElement('script');
312
+ script.text = code;
313
+ document.head.appendChild(script).parentNode.removeChild(script);
314
+ }
315
+
316
+ /**
317
+ * indexOfObj
318
+ * @desc:查找数组对象下标
319
+ * @author huangbo
320
+ * @date 2022年5月7日
321
+ * @param {Array} [arry] - 被查找的数组
322
+ * @param {Object} [item] - 目标对象
323
+ * @param {String} [key] - 目标对象的属性名
324
+ **/
325
+ var indexOfObj = function indexOfObj(arry, item, key) {
326
+ for (var i = 0; i < arry.length; i++) {
327
+ if (key) {
328
+ if (typeof item === 'string' && arry[i][key] === item) {
329
+ return i;
330
+ }
331
+ if (item[key] === arry[i][key]) {
332
+ return i;
333
+ }
334
+ } else {
335
+ if (JSON.stringify(item) === JSON.stringify(arry[i])) {
336
+ return i;
337
+ }
338
+ }
339
+ }
340
+ return -1;
341
+ };
342
+
343
+ /**
344
+ * overbrim
345
+ * @desc:判断是否文字溢出
346
+ * @author huangbo
347
+ * @date 2022年5月7日
348
+ * @param {String} [el] - 文字所在的dom
349
+ **/
350
+ var overbrim = function overbrim(el) {
351
+ var w = el.offsetWidth;
352
+ var s = el.scrollWidth;
353
+ if (s > w) {
354
+ return true;
355
+ } else {
356
+ return false;
357
+ }
358
+ };
359
+
360
+ /**
361
+ * setStorage
362
+ * @desc:设置本地储存数据
363
+ * @author huangbo
364
+ * @date 2022年5月7日
365
+ * @param {String} [type] - 储存类型
366
+ * @param {String, Array, Object} [key] - 数据的名称,array类型表示多个key保存同一个value,object类型时对象的属性名称作为key属性值作为value
367
+ * @param {String} [value] - 数据的值
368
+ **/
369
+ var setStorage = function setStorage(type, key, value) {
370
+ if (type === undefined || type === 'sessionStorage') {
371
+ if (typeof key === 'string') {
372
+ sessionStorage.setItem(key, value);
373
+ } else if (Array.isArray(key)) {
374
+ for (var i in key) {
375
+ sessionStorage.setItem(key[i], value);
376
+ }
377
+ } else {
378
+ for (var _i2 in key) {
379
+ sessionStorage.setItem(_i2, key[_i2]);
380
+ }
381
+ }
382
+ } else {
383
+ if (typeof key === 'string') {
384
+ localStorage.setItem(key, value);
385
+ } else if (Array.isArray(key)) {
386
+ for (var _i3 in key) {
387
+ localStorage.setItem(key[_i3], value);
388
+ }
389
+ } else {
390
+ for (var _i4 in key) {
391
+ localStorage.setItem(_i4, key[_i4]);
392
+ }
393
+ }
394
+ }
395
+ };
396
+ /**
397
+ * removeStorage
398
+ * @desc:删除本地储存数据
399
+ * @author huangbo
400
+ * @date 2022年5月7日
401
+ * @param {String, Array} [key] - 获取的名称
402
+ **/
403
+ var removeStorage = function removeStorage(key) {
404
+ if (Array.isArray(key)) {
405
+ for (var i = 0; i < key.length; i++) {
406
+ sessionStorage.removeItem(key[i]);
407
+ localStorage.removeItem(key[i]);
408
+ }
409
+ } else if (key) {
410
+ sessionStorage.removeItem(key);
411
+ localStorage.removeItem(key);
412
+ } else {
413
+ sessionStorage.clear();
414
+ localStorage.clear();
415
+ }
416
+ };
417
+ /**
418
+ * getStorage
419
+ * @desc:获取本地储存数据
420
+ * @author huangbo
421
+ * @date 2022年5月7日
422
+ * @param {String} [key] - 获取的名称
423
+ **/
424
+ var getStorage = function getStorage(key) {
425
+ if (key) {
426
+ var res = sessionStorage.getItem(key) || localStorage.getItem(key) || window[key];
427
+ if (key === 'host' && !res) {
428
+ return window.origin;
429
+ }
430
+ return res;
431
+ }
432
+ var defaults = {};
433
+ var token = sessionStorage.getItem('token') || localStorage.getItem('token') || window.token;
434
+ var ssId = sessionStorage.getItem('ssId') || localStorage.getItem('ssId') || window.ssId;
435
+ var deviceUnique = sessionStorage.getItem('deviceUnique') || localStorage.getItem('deviceUnique') || window.deviceUnique;
436
+ if (token) {
437
+ defaults.Authorization = token;
438
+ }
439
+ if (ssId) {
440
+ defaults.ssId = ssId;
441
+ }
442
+ if (deviceUnique) {
443
+ defaults.deviceUnique = deviceUnique;
444
+ }
445
+ return defaults;
446
+ };
447
+ var getValues = function getValues(obj, flag) {
448
+ var val = {};
449
+ obj.forEach(function (items) {
450
+ if (items.contents) {
451
+ items.contents.forEach(function (item) {
452
+ if (item.name && item.type !== 'button' && item.type !== 'submit') {
453
+ if (item.type === 'table' && item.form) {
454
+ val[item.name] = item.data;
455
+ } else if (item.name && !flag && !item.hide) {
456
+ if (item.value !== undefined && item.value !== '') {
457
+ if (Array.isArray(val)) {
458
+ if (val.length) {
459
+ val[item.name] = item.value;
460
+ }
461
+ } else {
462
+ val[item.name] = item.value;
463
+ }
464
+ }
465
+ }
466
+ }
467
+ });
468
+ } else if (items.name && items.type !== 'button' && items.type !== 'submit') {
469
+ if (items.value !== undefined && items.value !== '') {
470
+ if (Array.isArray(val)) {
471
+ if (val.length) {
472
+ val[items.name] = items.value;
473
+ }
474
+ } else {
475
+ val[items.name] = items.value;
476
+ }
477
+ }
478
+ } else if (items.type === 'table' && items.form) {
479
+ val[items.type] = items.data;
480
+ }
481
+ });
482
+ return val;
483
+ };
484
+
485
+ /**
486
+ * loading 需全局引入element-ui
487
+ * @desc:loading
488
+ * @author huangbo
489
+ * @date 2022年5月7日
490
+ * @param {String} [text] - 显示的文本内容
491
+ **/
492
+ var loading = function loading($loading, res) {
493
+ if (isObject(res)) {
494
+ var config = extend({}, {
495
+ fullscreen: true,
496
+ background: 'rgba(0, 0, 0, 0.65)',
497
+ spinner: 'el-icon-loading',
498
+ text: '加载中...'
499
+ }, res);
500
+ return $loading(config);
501
+ } else {
502
+ window.loading = $loading({
503
+ fullscreen: true,
504
+ background: 'rgba(0, 0, 0, 0.65)',
505
+ spinner: 'el-icon-loading',
506
+ text: res ? res : '加载中...'
507
+ });
508
+ return window.loading;
509
+ }
510
+ };
511
+
512
+ /**
513
+ * formatDate
514
+ * @desc:格式化时间
515
+ * @author huangbo
516
+ * @date 2022年5月7日
517
+ * @param {String, Number} [date] - 时间字符串或时间戳
518
+ * @param {String} [fmt] - 格式
519
+ **/
520
+ var formatDate = function formatDate(date, fmt) {
521
+ var obj = void 0;
522
+ if (date) {
523
+ obj = new Date(date);
524
+ } else {
525
+ obj = new Date();
526
+ }
527
+ var quarter = ['一', '二', '三', '四'];
528
+ var o = {
529
+ 'b+': Math.ceil((obj.getMonth() + 1) / 6), // 半年
530
+ 'M+': obj.getMonth() + 1, // 月份
531
+ 'd+': obj.getDate(), // 日
532
+ 'H+': obj.getHours(), // 小时
533
+ 'm+': obj.getMinutes(), // 分
534
+ 's+': obj.getSeconds(), // 秒
535
+ 'q+': quarter[Math.ceil((obj.getMonth() + 1) / 3) - 1], // 季度
536
+ S: obj.getMilliseconds() // 毫秒
537
+ };
538
+ if (/(y+)/.test(fmt)) {
539
+ fmt = fmt.replace(RegExp.$1, (obj.getFullYear() + '').substr(4 - RegExp.$1.length));
540
+ }
541
+ for (var k in o) {
542
+ if (new RegExp('(' + k + ')').test(fmt)) {
543
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
544
+ }
545
+ }
546
+ return fmt;
547
+ };
548
+ /**
549
+ * timeFrame
550
+ * @desc:格式化时间
551
+ * @author huangbo
552
+ * @date 2022年5月7日
553
+ * @param {String, Number} [date] - 时间字符串或时间戳
554
+ **/
555
+ var timeFrame = function timeFrame(date) {
556
+ var obj = void 0;
557
+ if (date) {
558
+ obj = new Date(date);
559
+ } else {
560
+ obj = new Date();
561
+ }
562
+ var h = obj.getHours(); // 获取小时
563
+ var period = '';
564
+ h < 12 ? period = '上午好!' : h < 18 ? period = '下午好!' : period = '晚上好!';
565
+ return period;
566
+ };
567
+ /**
568
+ * getStyle
569
+ * @desc:获取元素样式(含非行内样式)
570
+ * @author huangbo
571
+ * @date 2022年5月7日
572
+ * @param {String} [dom] - dom元素
573
+ * @param {String} [attr] - 样式属性名
574
+ **/
575
+
576
+ var getStyle = function getStyle(dom, attr) {
577
+ if (dom.style[attr]) {
578
+ return dom.style[attr];
579
+ }
580
+ if (window.getComputedStyle) {
581
+ return getComputedStyle(dom, null)[attr];
582
+ }
583
+ return dom.currentStyle[attr];
584
+ };
585
+
586
+ /**
587
+ * handlerUrl
588
+ * @desc:更新url参数中的时间戳
589
+ * @author huangbo
590
+ * @date 2022年5月7日
591
+ * @param {String} [url] - url地址
592
+ **/
593
+
594
+ var handlerUrl = function handlerUrl(url, host) {
595
+ var arry = url.split('?');
596
+ if (arry.length > 1) {
597
+ if (arry[1].indexOf('_tt') > -1) {
598
+ var search = arry[1].split('&');
599
+ for (var i in search) {
600
+ if (search[i].indexOf('_tt') > -1) {
601
+ search[i] = '_tt=' + new Date().getTime();
602
+ }
603
+ }
604
+ arry[1] = search.join('&');
605
+ } else {
606
+ arry[1] += '&_tt=' + new Date().getTime();
607
+ }
608
+ url = arry.join('?');
609
+ } else {
610
+ url += '?_tt=' + new Date().getTime();
611
+ }
612
+ url = jointUrl(url, host);
613
+ return encodeURI(url);
614
+ };
615
+
616
+ /**
617
+ * getRgb
618
+ * @desc:获取颜色值的rgb值
619
+ * @author huangbo
620
+ * @date 2022年5月7日
621
+ * @param {string} [$color] - 颜色值
622
+ **/
623
+ var getRgb = function getRgb($color) {
624
+ var rgb = [];
625
+ // 16进制颜色值的正则
626
+ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
627
+ // 把颜色值变成小写
628
+ $color = $color.toLowerCase();
629
+ if (reg.test($color)) {
630
+ // 如果只有三位的值,需变成六位,如:#fff => #ffffff
631
+ if ($color.length === 4) {
632
+ var colorNew = '#';
633
+ for (var i = 1; i < 4; i++) {
634
+ colorNew += $color.slice(i, i + 1).concat($color.slice(i, i + 1));
635
+ }
636
+ $color = colorNew;
637
+ }
638
+ // 处理六位的颜色值,转为RGB
639
+ for (var _i5 = 1; _i5 < 7; _i5 += 2) {
640
+ rgb.push(parseInt('0x' + $color.slice(_i5, _i5 + 2), 16));
641
+ }
642
+ } else {
643
+ rgb = $color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
644
+ }
645
+ return rgb;
646
+ };
647
+
648
+ /**
649
+ * rgbToHsv
650
+ * @desc:rgb转化成hsv
651
+ * @author huangbo
652
+ * @date 2022年5月7日
653
+ * @param {string} [$color] - 颜色值
654
+ **/
655
+ var rgbToHsv = function rgbToHsv($color) {
656
+ var rgb = getRgb($color);
657
+ var $red = rgb[0];
658
+ var $green = rgb[1];
659
+ var $blue = rgb[2];
660
+ var $max = Math.max($red, $green, $blue);
661
+ var $min = Math.min($red, $green, $blue);
662
+ var $diff = $max - $min;
663
+ var $h = 0;
664
+ if ($max === $min) {
665
+ $h = 0;
666
+ } else if ($max === $red) {
667
+ $h = 60 * ($green - $blue) / $diff + ($green > $blue - 1 ? 0 : 360);
668
+ } else if ($max === $green) {
669
+ $h = 60 * ($blue - $red) / $diff + 120;
670
+ } else if ($max === $blue) {
671
+ $h = 60 * ($red - $green) / $diff + 240;
672
+ }
673
+ var $s = $max === 0 ? 0 : $diff / $max;
674
+ var $v = $max / 255;
675
+ return [$h, $s, $v];
676
+ };
677
+ /**
678
+ * hsvTorgb
679
+ * @desc:hsv转化成rgb
680
+ * @author huangbo
681
+ * @date 2022年5月7日
682
+ * @param {string} [$color] - 颜色值
683
+ **/
684
+ function hsvTorgb($h, $s, $v) {
685
+ var $th = Math.floor($h / 60);
686
+ var $t1 = $h / 60 - $th;
687
+ var $t2 = $v * (1 - $s);
688
+ var $t3 = $v * (1 - $t1 * $s);
689
+ var $t4 = $v * (1 - (1 - $t1) * $s);
690
+ var $r = [$v, $t3, $t2, $t2, $t4, $v][$th % 6];
691
+ var $g = [$t4, $v, $v, $t3, $t2, $t2][$th % 6];
692
+ var $b = [$t2, $t2, $t4, $v, $v, $t3][$th % 6];
693
+ // return `rgb(${Math.round($r * 255)}, ${Math.round($g * 255)}, ${Math.round($b * 255)})`;
694
+ var red = Math.round($r * 255);
695
+ var green = Math.round($g * 255);
696
+ var blue = Math.round($b * 255);
697
+ red = red.toString(16);
698
+ green = green.toString(16);
699
+ blue = blue.toString(16);
700
+ red = red.length === 1 ? '0' + red : red;
701
+ green = green.length === 1 ? '0' + green : green;
702
+ blue = blue.length === 1 ? '0' + blue : blue;
703
+ return '#' + red + green + blue;
704
+ }
705
+ /**
706
+ * toFixed
707
+ * @desc:浮点数保留小数位
708
+ * @author huangbo
709
+ * @date 2022年5月7日
710
+ * @param {number} [$float] - 要转换的数值
711
+ * @param {number} [$digits] - 小数位数
712
+ **/
713
+ function toFixed($float, $digits) {
714
+ var $pow = Math.pow(10, $digits);
715
+ return Math.round($float * $pow) / $pow;
716
+ }
717
+
718
+ /**
719
+ * getHue
720
+ * @desc:转换色相
721
+ * @author huangbo
722
+ * @date 2022年5月7日
723
+ **/
724
+ function getHue($h, $i, $isLight) {
725
+ var $hue = void 0;
726
+ if ($h >= 60 && $h <= 240) {
727
+ $hue = $isLight ? $h - $hueStep * $i : $h + $hueStep * $i;
728
+ } else {
729
+ $hue = $isLight ? $h + $hueStep * $i : $h - $hueStep * $i;
730
+ }
731
+ $hue = ($hue + 360) % 360;
732
+ return Math.round($hue);
733
+ }
734
+
735
+ /**
736
+ * getSaturation
737
+ * @desc:转换饱和度
738
+ * @author huangbo
739
+ * @date 2022年5月7日
740
+ **/
741
+ function getSaturation($s, $i, $isLight) {
742
+ var $saturation = void 0;
743
+ if ($isLight) {
744
+ $saturation = $s - $saturationStep1 * $i;
745
+ } else if ($i === $darkColorCount) {
746
+ $saturation = $s + $saturationStep1;
747
+ } else {
748
+ $saturation = $s + $saturationStep2 * $i;
749
+ }
750
+ $saturation = $saturation < 1 ? $saturation : 1;
751
+
752
+ if ($isLight && $i === $lightColorCount && $saturation > 0.1) {
753
+ $saturation = 0.1;
754
+ }
755
+ $saturation = $saturation > 0.06 ? $saturation : 0.06;
756
+ return toFixed($saturation, 2);
757
+ }
758
+
759
+ /**
760
+ * getValue
761
+ * @desc:转换明度
762
+ * @author huangbo
763
+ * @date 2022年5月7日
764
+ **/
765
+ function getValue($v, $i, $isLight) {
766
+ var $value = $isLight ? $v + $brightnessStep1 * $i : $v - $brightnessStep2 * $i;
767
+ $value = $value < 1 ? $value : 1;
768
+ return toFixed($value, 2);
769
+ }
770
+ var $hueStep = 2;
771
+ var $saturationStep1 = 0.16;
772
+ var $saturationStep2 = 0.05;
773
+ var $brightnessStep1 = 0.05;
774
+ var $brightnessStep2 = 0.15;
775
+ var $lightColorCount = 5;
776
+ var $darkColorCount = 4;
777
+
778
+ /**
779
+ * getColor
780
+ * @desc:根据颜色和对应的色板位置,计算出对应的色板颜色
781
+ * @author huangbo
782
+ * @date 2022年5月7日
783
+ **/
784
+ function getColor($color, $n) {
785
+ var $isLight = $n < 7;
786
+ var $hsv = rgbToHsv($color);
787
+ // 这里将i转换成以主色为中心,两侧的i值逐渐增大
788
+ var $i = $isLight ? $lightColorCount + 1 - $n : $n - $lightColorCount - 1;
789
+ var color = hsvTorgb(getHue($hsv[0], $i, $isLight), getSaturation($hsv[1], $i, $isLight), getValue($hsv[2], $i, $isLight));
790
+ return color;
791
+ }
792
+ /**
793
+ * mixColor
794
+ * @desc:生成混合色
795
+ * @author huangbo
796
+ * @date 2022年5月7日
797
+ * @param {string} [$color1] - 颜色值
798
+ * @param {string} [$color2] - 颜色值
799
+ * @param {string} [$n] - 百分比 0~1
800
+ **/
801
+ var mixColor = function mixColor($color1, $color2, $n) {
802
+ var rgb1 = getRgb($color1);
803
+ var rgb2 = getRgb($color2);
804
+ var r = rgb1[0] * $n + rgb2[0] * (1 - $n);
805
+ var g = rgb1[1] * $n + rgb2[1] * (1 - $n);
806
+ var b = rgb1[2] * $n + rgb2[2] * (1 - $n);
807
+ return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
808
+ };
809
+ /**
810
+ * updateTheme
811
+ * @desc:更新主题色
812
+ * @author huangbo
813
+ * @date 2022年5月7日
814
+ * @param {string} [$color] - 颜色值
815
+ **/
816
+ var updateTheme = function updateTheme($color, send) {
817
+ $color = $color ? $color : '#409eff';
818
+ if (send === undefined) {
819
+ send = true;
820
+ }
821
+ document.documentElement.style.setProperty('--theme-primary', $color);
822
+ for (var i = 1; i < 11; i++) {
823
+ if (i === 6) {
824
+ document.documentElement.style.setProperty('--theme-primary-light-' + i, $color);
825
+ } else {
826
+ var light = getColor($color, i);
827
+ document.documentElement.style.setProperty('--theme-primary-light-' + i, light);
828
+ }
829
+ }
830
+ if (send) {
831
+ sendMessage({ data: { type: 'setTheme' } });
832
+ }
833
+ };
834
+ /**
835
+ * sendMessage
836
+ * @desc:向iframe发送信息
837
+ * @author huangbo
838
+ * @date 2022年5月7日
839
+ * @param {object} [data] - 数据---其中type必须表示操作类型
840
+ * @param {string} [url] - 指定的消息发送URI地址
841
+ **/
842
+ var sendMessage = function sendMessage(_ref) {
843
+ var _ref$data = _ref.data,
844
+ data = _ref$data === undefined ? {} : _ref$data,
845
+ url = _ref.url;
846
+
847
+ var iframes = document.getElementsByTagName('iframe');
848
+ for (var i = 0; i < iframes.length; i++) {
849
+ if (url !== undefined) {
850
+ if (iframes[i].contentWindow.location.href === url) {
851
+ iframes[i].contentWindow.postMessage(data, url);
852
+ return;
853
+ }
854
+ } else {
855
+ iframes[i].contentWindow.postMessage(data);
856
+ }
857
+ }
858
+ };
859
+
860
+ /**
861
+ * receiveMessage
862
+ * @desc:接收发送信息
863
+ * @author huangbo
864
+ * @date 2022年5月7日
865
+ * @param {object} [data] - 数据---其中type必须表示操作类型
866
+ * @param {string} [url] - 消息源的 URI
867
+ * @param {function} [callback] - 回调函数
868
+ **/
869
+ var receiveMessage = function receiveMessage(_ref2) {
870
+ var _ref2$data = _ref2.data,
871
+ data = _ref2$data === undefined ? {} : _ref2$data,
872
+ url = _ref2.url,
873
+ callback = _ref2.callback;
874
+
875
+ window.addEventListener('message', function (e) {
876
+ if (url !== undefined) {
877
+ if (e.origin !== url) {
878
+ // 验证消息来源地址
879
+ return;
880
+ }
881
+ }
882
+ callback(e.data);
883
+ });
884
+ };
885
+
886
+ /**
887
+ * getTypeName
888
+ * @desc:转换类型文本
889
+ * @author huangbo
890
+ * @date 2022年5月7日
891
+ * @param {string} [type] - 类型
892
+ **/
893
+ var getTypeName = function getTypeName(type) {
894
+ var typeName = '';
895
+ var sysorgname = getStorage('sysorgname');
896
+ var sysdepname = getStorage('sysdepname');
897
+ if (type === 'enterprise') {
898
+ if (sysorgname) {
899
+ typeName = '[' + sysorgname + ']';
900
+ } else {
901
+ typeName = '[公司]';
902
+ }
903
+ } else if (type === 'department') {
904
+ if (sysdepname) {
905
+ typeName = '[' + sysdepname + ']';
906
+ } else {
907
+ typeName = '[部门]';
908
+ }
909
+ } else if (type === 'role') {
910
+ typeName = '[角色]';
911
+ } else if (type === 'post') {
912
+ typeName = '[岗位]';
913
+ } else if (type === 'otheremployee' || type === 'employee') {
914
+ if (sysdepname) {
915
+ typeName = '[' + sysdepname + '员工]';
916
+ } else {
917
+ typeName = '[部门员工]';
918
+ }
919
+ } else if (type === 'postemployee') {
920
+ typeName = '[岗位员工]';
921
+ } else if (type === 'persongroup') {
922
+ typeName = '[人员群组成员]';
923
+ } else if (type === 'filgroup') {
924
+ if (sysorgname) {
925
+ typeName = '[' + sysorgname + '群组成员]';
926
+ } else {
927
+ typeName = '[公司群组成员]';
928
+ }
929
+ } else if (type === 'depgroup') {
930
+ if (sysdepname) {
931
+ typeName = '[' + sysdepname + '群组成员]';
932
+ } else {
933
+ typeName = '[部门群组成员]';
934
+ }
935
+ } else if (type === 'persongroupobj') {
936
+ typeName = '[人员群组]';
937
+ } else if (type === 'filgroupobj') {
938
+ if (sysorgname) {
939
+ typeName = '[' + sysorgname + '群组]';
940
+ } else {
941
+ typeName = '[公司群组]';
942
+ }
943
+ } else if (type === 'depgroupobj') {
944
+ if (sysdepname) {
945
+ typeName = '[' + sysdepname + '群组]';
946
+ } else {
947
+ typeName = '[部门群组]';
948
+ }
949
+ } else if (type === 'otherperson' || type === 'topcontacts' || type === 'person') {
950
+ typeName = '[人员]';
951
+ } else if (type === 'codetable') {
952
+ typeName = '[代码表]';
953
+ } else if (type === 'organizecentreobj') {
954
+ typeName = '[组织中心]';
955
+ }
956
+ return typeName;
957
+ };
958
+
959
+ /**
960
+ * replenish
961
+ * @desc:补全小数位数
962
+ * @author huangbo
963
+ * @date 2022年5月7日
964
+ * @param {string、number} [num] - 数字或字符串型数字
965
+ * @param {number} [precision] - 需要的小数位数
966
+ **/
967
+ var replenish = function replenish(num, precision) {
968
+ if (num && precision && precision > 0) {
969
+ var power = Math.pow(10, precision);
970
+ var res = num === 'string' ? Number(num) : num;
971
+ res = String(Math.round(res * power) / power);
972
+ var len = res.indexOf('.');
973
+ if (len < 0) {
974
+ len = res.length;
975
+ res += '.';
976
+ }
977
+ while (res.length <= len + precision) {
978
+ res += '0';
979
+ }
980
+ return parseFloat(res);
981
+ }
982
+ return num;
983
+ };
984
+ /**
985
+ * identical
986
+ * @desc:form验证两个值是否相同(确认密码)
987
+ * @author huangbo
988
+ * @date 2022年5月7日
989
+ * @param {val} [string] - 当前值
990
+ * @param {callback} [function] - 回调函数
991
+ * @param {val} [string] - 被验证的原值
992
+ **/
993
+ var identical = function identical(value, callback, val) {
994
+ if (value === '' || value === null || value === undefined) {
995
+ if (val === '' || val === null || val === undefined) {
996
+ callback();
997
+ } else {
998
+ callback(new Error('请再次输入'));
999
+ }
1000
+ } else if (value !== val) {
1001
+ callback(new Error('两次输入不一致!'));
1002
+ } else {
1003
+ callback();
1004
+ }
1005
+ };
1006
+
1007
+ /**
1008
+ * exportXls
1009
+ * @desc:导出表格数据
1010
+ * @author huangbo
1011
+ * @date 2022年5月7日
1012
+ * @param {thead} [array] - 表单头部
1013
+ * @param {data} [array] - 导出的数据
1014
+ * @param {name} [string] - 导出文件名
1015
+ * @param {numbers} [boolean] - 序号
1016
+ **/
1017
+ var exportXls = function exportXls(_ref3) {
1018
+ var _ref3$thead = _ref3.thead,
1019
+ thead = _ref3$thead === undefined ? [] : _ref3$thead,
1020
+ _ref3$data = _ref3.data,
1021
+ data = _ref3$data === undefined ? [] : _ref3$data,
1022
+ name = _ref3.name,
1023
+ numbers = _ref3.numbers;
1024
+
1025
+ var tbody = '';
1026
+ var aligns = [];
1027
+ var fields = [];
1028
+ var alink = document.createElement('a');
1029
+ for (var i = 0; i < thead.length; i++) {
1030
+ tbody += '<tr style="text-align: center;">';
1031
+ if (numbers) {
1032
+ tbody += '<th rowspan="' + thead.length + '"></th>';
1033
+ }
1034
+ var tr = thead[i];
1035
+ for (var _x = 0; _x < tr.length; _x++) {
1036
+ var td = tr[_x];
1037
+ tbody += '<th rowspan="' + td.rowspan + '" colspan="' + td.colspan + '" align="' + td.align + '">' + td.label + '</th>';
1038
+ if (td.property) {
1039
+ fields.push(td.property);
1040
+ aligns.push(td.align);
1041
+ }
1042
+ }
1043
+ tbody += '</tr>';
1044
+ }
1045
+ for (var _i6 = 0; _i6 < data.length; _i6++) {
1046
+ tbody += '<tr>';
1047
+ for (var x in fields) {
1048
+ tbody += '<td align="' + aligns[x] + '">' + data[_i6][fields[x]] + '</td>';
1049
+ }
1050
+ tbody += '</tr>';
1051
+ }
1052
+ if (!name) {
1053
+ name = 'table_' + new Date().getTime();
1054
+ }
1055
+ var uri = 'data:application/vnd.ms-excel;base64,';
1056
+ var template = '<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:@">' + tbody + '</table></body></html>';
1057
+ alink.href = uri + window.btoa(unescape(encodeURIComponent(template)));
1058
+ alink.download = name + '.xls';
1059
+ document.body.appendChild(alink);
1060
+ alink.click();
1061
+ document.body.removeChild(alink);
1062
+ };
1063
+ /**
1064
+ * 获取色彩列表的方法
1065
+ * @function themeTools#handlerGetThemeCluster
1066
+ * @param {String} color - 主题色
1067
+ * @param {String} mode - 风格模式light | dark
1068
+ * @param {String} backgroundColor - mode = dark时的页面背景颜色
1069
+ *
1070
+ * @example
1071
+ * ```js
1072
+ * handlerGetThemeCluster('#0e91ef','dark','#000000');
1073
+ * ```
1074
+ * @return {Array} ['#e6f9ff','#0e91ef',...]
1075
+ */
1076
+ var handlerGetThemeCluster = function handlerGetThemeCluster(color) {
1077
+ var mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'light';
1078
+ var backgroundColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '#000000';
1079
+
1080
+ return (0, _color.generate)(color, mode === 'dark' ? { theme: 'dark', backgroundColor: backgroundColor } : {});
1081
+ };
1082
+
1083
+ /**
1084
+ * H5TokenInvalid
1085
+ * @desc 原生app重新登录
1086
+ * @date 2023年3月2日
1087
+ * @author liufan
1088
+ */
1089
+ var H5TokenInvalid = function H5TokenInvalid() {
1090
+ var u = navigator.userAgent;
1091
+ var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
1092
+ var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
1093
+ if (isAndroid) {
1094
+ window.AndroidWebView.H5TokenInvalid();
1095
+ } else if (isiOS) {
1096
+ var info = {};
1097
+ window.webkit.messageHandlers.H5TokenInvalid.postMessage(info);
1098
+ }
1099
+ };
1100
+ /**
1101
+ * JSCallNativeShowTabbar
1102
+ * @desc:原生app隐藏或显示底部tabbar
1103
+ * @date 2023年3月2日
1104
+ * @author liufan
1105
+ * @param {Boolean} res -是否展示底部导航
1106
+ */
1107
+ var JSCallNativeShowTabbar = function JSCallNativeShowTabbar(res) {
1108
+ var u = navigator.userAgent;
1109
+ var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
1110
+ var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
1111
+ var data = {
1112
+ showState: res
1113
+ };
1114
+ if (isAndroid) {
1115
+ window.AndroidWebView.JSCallNativeShowTabbar(JSON.stringify(data));
1116
+ } else if (isiOS) {
1117
+ window.webkit.messageHandlers.JSCallNativeShowTabbar.postMessage(data);
1118
+ }
1119
+ };
1120
+ /**
1121
+ * JSCallNativeShowNaviBar
1122
+ * @desc:原生app隐藏或者显示头部导航栏
1123
+ * @date 2023年3月2日
1124
+ * @author liufan
1125
+ * @param {Boolean} res -是否展示头部导航栏
1126
+ */
1127
+ var JSCallNativeShowNaviBar = function JSCallNativeShowNaviBar(res) {
1128
+ var u = navigator.userAgent;
1129
+ var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
1130
+ var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
1131
+ if (isAndroid) {
1132
+ var data = {
1133
+ showState: res
1134
+ };
1135
+ window.AndroidWebView.JSCallNativeShowNaviBar(JSON.stringify(data));
1136
+ } else if (isiOS) {
1137
+ window.webkit.messageHandlers.JSCallNativeShowNaviBar({
1138
+ showState: JSON.stringify(res)
1139
+ });
1140
+ }
1141
+ };
1142
+ /**
1143
+ * JSCallNativeOpenUrl
1144
+ * @desc:原生app打开外部链接
1145
+ * @date 2023年3月2日
1146
+ * @author liufan
1147
+ * @param {Object} data -链接参数
1148
+ */
1149
+ var JSCallNativeOpenUrl = function JSCallNativeOpenUrl(data) {
1150
+ var u = navigator.userAgent;
1151
+ var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
1152
+ var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
1153
+ if (isAndroid) {
1154
+ window.AndroidWebView.JSCallNativeOpenUrl(JSON.stringify(data));
1155
+ } else if (isiOS) {
1156
+ window.webkit.messageHandlers.JSCallNativeOpenUrl.postMessage(data);
1157
+ }
1158
+ };
1159
+ /**
1160
+ * openMainBodyFile
1161
+ * @desc:原生app打开正文
1162
+ * @date 2023年3月2日
1163
+ * @author liufan
1164
+ * @param {Object} data 正文参数
1165
+ */
1166
+ var openMainBodyFile = function openMainBodyFile(data) {
1167
+ var u = navigator.userAgent;
1168
+ var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
1169
+ var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
1170
+ if (isAndroid) {
1171
+ window.AndroidWebView.JSCallOpenMainBodyFile(JSON.stringify(data));
1172
+ } else if (isiOS) {
1173
+ window.webkit.messageHandlers.JSCallOpenMainBodyFile.postMessage(data);
1174
+ }
1175
+ };
1176
+ /**
1177
+ * openUrl
1178
+ * @desc 打开外网地址
1179
+ * @date 2023年3月2日
1180
+ * @author liufan
1181
+ * @param {String} url 调整地址
1182
+ */
1183
+ var openUrl = function openUrl(url) {
1184
+ var u = navigator.userAgent;
1185
+ var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
1186
+ var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
1187
+ if (isAndroid) {
1188
+ window.open(url);
1189
+ } else if (isiOS) {
1190
+ window.location.href = url;
1191
+ }
1192
+ };
1193
+ /**
1194
+ * openAttachment
1195
+ * @desc:原生app通用打开附件
1196
+ * @date 2023年3月2日
1197
+ * @author liufan
1198
+ * @param {Object} data -附件信息
1199
+ */
1200
+ var openAttachment = function openAttachment(data) {
1201
+ if (window.isCh) {
1202
+ window.uexPDF.openOther(data);
1203
+ } else {
1204
+ var u = navigator.userAgent;
1205
+ var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
1206
+ var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
1207
+ if (isAndroid) {
1208
+ window.AndroidWebView.jsOpenAccessory(JSON.stringify(data));
1209
+ } else if (isiOS) {
1210
+ window.webkit.messageHandlers.jsOpenAccessory.postMessage(data);
1211
+ }
1212
+ }
1213
+ };
1214
+ /**
1215
+ * deepClone
1216
+ * @desc:深拷贝
1217
+ * @date 2023年3月2日
1218
+ * @author liufan
1219
+ * @param {Object、Array} target
1220
+ */
1221
+ var deepClone = function deepClone(target) {
1222
+ var result = void 0;
1223
+ // 如果当前需要深拷贝的是一个对象的话
1224
+ if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object') {
1225
+ // 如果是一个数组的话
1226
+ if (Array.isArray(target)) {
1227
+ result = [];
1228
+ for (var i in target) {
1229
+ result.push(deepClone(target[i]));
1230
+ }
1231
+ } else if (target === null) {
1232
+ result = null;
1233
+ } else if (target.constructor === RegExp) {
1234
+ result = target;
1235
+ } else {
1236
+ result = {};
1237
+ for (var _i7 in target) {
1238
+ result[_i7] = deepClone(target[_i7]);
1239
+ }
1240
+ }
1241
+ } else {
1242
+ result = target;
1243
+ }
1244
+ return result;
1245
+ };
1246
+
1247
+ /**
1248
+ * 排除属性
1249
+ * @desc:exclAttribute
1250
+ * @author huangbo
1251
+ * @date 2022年5月7日
1252
+ * @param {String/Array} [attrs] - 要排除的属性
1253
+ **/
1254
+ var exclAttribute = function exclAttribute(_ref4) {
1255
+ var _ref4$attrs = _ref4.attrs,
1256
+ attrs = _ref4$attrs === undefined ? 'value' : _ref4$attrs,
1257
+ data = _ref4.data;
1258
+
1259
+ var obj = extend(true, {}, data);
1260
+ if (Array.isArray(attrs)) {
1261
+ attrs.forEach(function (item) {
1262
+ if (obj[item] !== undefined) {
1263
+ delete obj[item];
1264
+ }
1265
+ });
1266
+ } else {
1267
+ delete obj[attrs];
1268
+ }
1269
+ return obj;
1270
+ };
1271
+ exports.default = {
1272
+ esEncrypt: esEncrypt,
1273
+ esDecode: esDecode,
1274
+ startWith: startWith,
1275
+ jointUrl: jointUrl,
1276
+ queryParams: queryParams,
1277
+ exclAttribute: exclAttribute,
1278
+ urlJoinParams: urlJoinParams,
1279
+ arrUnique: arrUnique,
1280
+ isObject: isObject,
1281
+ isFunction: isFunction,
1282
+ extend: extend,
1283
+ getObjectType: getObjectType,
1284
+ getParams: getParams,
1285
+ getScript: getScript,
1286
+ indexOfObj: indexOfObj,
1287
+ overbrim: overbrim,
1288
+ deepClone: deepClone,
1289
+ setStorage: setStorage,
1290
+ handlerGetThemeCluster: handlerGetThemeCluster,
1291
+ JSCallNativeShowNaviBar: JSCallNativeShowNaviBar,
1292
+ removeStorage: removeStorage,
1293
+ openAttachment: openAttachment,
1294
+ openUrl: openUrl,
1295
+ JSCallNativeOpenUrl: JSCallNativeOpenUrl,
1296
+ openMainBodyFile: openMainBodyFile,
1297
+ JSCallNativeShowTabbar: JSCallNativeShowTabbar,
1298
+ H5TokenInvalid: H5TokenInvalid,
1299
+ getStorage: getStorage,
1300
+ getValues: getValues,
1301
+ loading: loading,
1302
+ formatDate: formatDate,
1303
+ timeFrame: timeFrame,
1304
+ getStyle: getStyle,
1305
+ handlerUrl: handlerUrl,
1306
+ mixColor: mixColor,
1307
+ getRgb: getRgb,
1308
+ updateTheme: updateTheme,
1309
+ sendMessage: sendMessage,
1310
+ receiveMessage: receiveMessage,
1311
+ getTypeName: getTypeName,
1312
+ replenish: replenish,
1313
+ identical: identical,
1314
+ exportXls: exportXls
1315
+ };