@lambo-design/shared 1.0.0-beta.24 → 1.0.0-beta.240

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 (206) hide show
  1. package/config/config.js +51 -37
  2. package/config/env.js +4 -4
  3. package/config/index.js +7 -2
  4. package/config/themes/atrovirens/atrovirens.css +576 -0
  5. package/config/themes/atrovirens/atrovirens.css.map +1 -0
  6. package/config/themes/atrovirens/atrovirens.less +667 -0
  7. package/config/themes/atrovirens/var.less +674 -0
  8. package/config/themes/blue/blue.css +576 -0
  9. package/config/themes/blue/blue.css.map +1 -0
  10. package/config/themes/blue/blue.less +669 -0
  11. package/config/themes/blue/var.less +677 -0
  12. package/config/themes/blue-white/blue-white.css +576 -0
  13. package/config/themes/blue-white/blue-white.css.map +1 -0
  14. package/config/themes/blue-white/blue-white.less +669 -0
  15. package/config/themes/blue-white/var.less +676 -0
  16. package/config/themes/blue-white-tight/blue-white-tight.css +577 -0
  17. package/config/themes/blue-white-tight/blue-white-tight.css.map +1 -0
  18. package/config/themes/blue-white-tight/blue-white-tight.less +672 -0
  19. package/config/themes/blue-white-tight/var.less +677 -0
  20. package/config/themes/danqing/danqing.css +576 -0
  21. package/config/themes/danqing/danqing.css.map +1 -0
  22. package/config/themes/danqing/danqing.less +668 -0
  23. package/config/themes/danqing/danqing.wxss +572 -0
  24. package/config/themes/danqing/var.less +679 -0
  25. package/config/themes/deep/deep.css +576 -0
  26. package/config/themes/deep/deep.css.map +1 -0
  27. package/config/themes/deep/deep.less +669 -0
  28. package/config/themes/deep/var.less +677 -0
  29. package/config/themes/default/default.css +576 -241
  30. package/config/themes/default/default.css.map +1 -0
  31. package/config/themes/default/default.less +671 -319
  32. package/config/themes/default/var.less +677 -314
  33. package/config/themes/eap/eap.css +576 -0
  34. package/config/themes/eap/eap.css.map +1 -0
  35. package/config/themes/eap/eap.less +671 -0
  36. package/config/themes/eap/var.less +677 -0
  37. package/config/themes/gold/gold.css +576 -0
  38. package/config/themes/gold/gold.css.map +1 -0
  39. package/config/themes/gold/gold.less +671 -0
  40. package/config/themes/gold/var.less +677 -314
  41. package/config/themes/index.js +28 -14
  42. package/config/themes/lime/lime.css +576 -0
  43. package/config/themes/lime/lime.css.map +1 -0
  44. package/config/themes/lime/lime.less +671 -0
  45. package/config/themes/lime/var.less +678 -314
  46. package/config/themes/orange/orange.css +576 -0
  47. package/config/themes/orange/orange.css.map +1 -0
  48. package/config/themes/orange/orange.less +671 -0
  49. package/config/themes/orange/var.less +678 -0
  50. package/config/themes/red/red.css +576 -0
  51. package/config/themes/red/red.css.map +1 -0
  52. package/config/themes/red/red.less +671 -0
  53. package/config/themes/red/var.less +677 -0
  54. package/config/themes/theme-atrovirens.js +558 -0
  55. package/config/themes/theme-blue.js +558 -0
  56. package/config/themes/theme-bw.js +558 -0
  57. package/config/themes/theme-bwt.js +559 -0
  58. package/config/themes/theme-danqing.js +558 -0
  59. package/config/themes/theme-deep.js +558 -0
  60. package/config/themes/theme-default.js +558 -252
  61. package/config/themes/theme-eap.js +558 -0
  62. package/config/themes/theme-gold.js +558 -252
  63. package/config/themes/theme-lime.js +558 -252
  64. package/config/themes/theme-orange.js +559 -40
  65. package/config/themes/theme-red.js +558 -40
  66. package/config/themes/theme-white.js +558 -0
  67. package/config/themes/white/var.less +676 -0
  68. package/config/themes/white/white.css +576 -0
  69. package/config/themes/white/white.css.map +1 -0
  70. package/config/themes/white/white.less +669 -0
  71. package/directives/index.js +23 -23
  72. package/directives/module/draggable.js +56 -56
  73. package/directives/module/permission.js +49 -49
  74. package/directives/module/print.js +1 -0
  75. package/directives/module/vue-print-nb/README.md +63 -0
  76. package/directives/module/vue-print-nb/print.js +94 -0
  77. package/directives/module/vue-print-nb/printarea.js +532 -0
  78. package/index.js +10 -4
  79. package/nstyles/common.less +197 -0
  80. package/nstyles/components/404.less +46 -0
  81. package/nstyles/components/button.less +34 -0
  82. package/nstyles/components/date-picker.less +37 -0
  83. package/nstyles/components/drawer.less +20 -0
  84. package/nstyles/components/dropdown.less +18 -0
  85. package/nstyles/components/excel-flow.less +72 -0
  86. package/nstyles/components/form.less +313 -0
  87. package/nstyles/components/index.less +23 -0
  88. package/nstyles/components/layout/collect.less +10 -0
  89. package/nstyles/components/layout/detail-view.less +107 -0
  90. package/nstyles/components/layout/full-screen.less +7 -0
  91. package/nstyles/components/layout/index.less +7 -0
  92. package/nstyles/components/layout/other-menu.less +142 -0
  93. package/nstyles/components/layout/page-view.less +101 -0
  94. package/nstyles/components/layout/sider-trigger.less +41 -0
  95. package/nstyles/components/layout/tags-nav.less +113 -0
  96. package/nstyles/components/modal.less +85 -0
  97. package/nstyles/components/n-button.less +131 -0
  98. package/nstyles/components/n-image-preview.less +131 -0
  99. package/nstyles/components/n-model/index.less +19 -0
  100. package/nstyles/components/n-model/report-index.less +43 -0
  101. package/nstyles/components/n-panel.less +41 -0
  102. package/nstyles/components/n-picker.less +37 -0
  103. package/nstyles/components/n-sign.less +17 -0
  104. package/nstyles/components/n-tooltip.less +10 -0
  105. package/nstyles/components/panel.less +31 -0
  106. package/nstyles/components/select.less +3 -0
  107. package/nstyles/components/sign.less +27 -0
  108. package/nstyles/components/table.less +315 -0
  109. package/nstyles/components/tree.less +159 -0
  110. package/nstyles/components/upload.less +164 -0
  111. package/nstyles/index.less +5 -0
  112. package/nstyles/reset.less +65 -0
  113. package/nstyles/third/ag.less +174 -0
  114. package/nstyles/third/icons/sort-desc.svg +1 -0
  115. package/nstyles/third/icons/sort-up.svg +1 -0
  116. package/nstyles/third/icons/sorting.svg +1 -0
  117. package/nstyles/third/index.less +11 -0
  118. package/nstyles/third/view-design.less +367 -0
  119. package/nstyles/variables/base.less +143 -0
  120. package/nstyles/variables/index.less +4 -0
  121. package/nstyles/variables/theme/default/button.less +7 -0
  122. package/nstyles/variables/theme/default/common.less +57 -0
  123. package/nstyles/variables/theme/default/index.less +7 -0
  124. package/nstyles/variables/theme/default/layout.less +40 -0
  125. package/nstyles/variables/theme/default/table.less +37 -0
  126. package/nstyles/variables/theme/default/tag.less +3 -0
  127. package/nstyles/variables/theme/default/upload.less +3 -0
  128. package/nstyles/variables/theme/index.less +13 -0
  129. package/nstyles/variables/theme/small/button.less +7 -0
  130. package/nstyles/variables/theme/small/common.less +39 -0
  131. package/nstyles/variables/theme/small/index.less +5 -0
  132. package/nstyles/variables/theme/small/layout.less +21 -0
  133. package/nstyles/variables/theme/small/table.less +17 -0
  134. package/nstyles/variables/theme/small/tag.less +3 -0
  135. package/package.json +27 -7
  136. package/plugin/index.js +12 -0
  137. package/plugin/module/date-format.js +30 -0
  138. package/plugin/module/loading.js +26 -0
  139. package/plugin/module/warn-handler.js +11 -0
  140. package/styles/image/inspur.png +0 -0
  141. package/styles/image/lan_navigator.png +0 -0
  142. package/styles/image/lv_navigator.png +0 -0
  143. package/styles/variables.less +21 -21
  144. package/utils/ajax/cacheconf.js +19 -19
  145. package/utils/ajax/content-type.js +30 -0
  146. package/utils/ajax/index.js +12 -12
  147. package/utils/ajax/interceptors.js +97 -97
  148. package/utils/assist.js +147 -84
  149. package/utils/base64.js +126 -0
  150. package/utils/blob.js +47 -0
  151. package/utils/bus.js +3 -3
  152. package/utils/crypto/index.js +48 -38
  153. package/utils/crypto/md5.js +152 -152
  154. package/utils/crypto/sm3.js +235 -235
  155. package/utils/date.js +381 -352
  156. package/utils/dict/built-in-dict.js +20 -0
  157. package/utils/dict/index.js +168 -0
  158. package/utils/dom.js +38 -38
  159. package/utils/event.js +72 -0
  160. package/utils/excel.js +655 -523
  161. package/utils/file.js +19 -0
  162. package/utils/form/validate.js +29 -0
  163. package/utils/half-year.js +68 -0
  164. package/utils/index.js +42 -5
  165. package/utils/json.js +29 -0
  166. package/utils/lodop.js +165 -160
  167. package/utils/menu/before-close.js +17 -17
  168. package/utils/menu/index.js +395 -135
  169. package/utils/mime_type.js +67 -0
  170. package/utils/modelerUtil.js +227 -224
  171. package/utils/n/api.js +22 -0
  172. package/utils/n/date.js +57 -0
  173. package/utils/n/index.js +10 -0
  174. package/utils/n/is-type.js +176 -0
  175. package/utils/n/number.js +144 -0
  176. package/utils/n/permission-cache.js +11 -0
  177. package/utils/n/reuqest/axiosN.js +17 -0
  178. package/utils/n/reuqest/content-type.js +19 -0
  179. package/utils/n/reuqest/interceptors.js +95 -0
  180. package/utils/n/reuqest/url-params.js +12 -0
  181. package/utils/n/storage.js +51 -0
  182. package/utils/n/token.js +51 -0
  183. package/utils/n/user-cache.js +11 -0
  184. package/utils/n/user.js +34 -0
  185. package/utils/n/uuid.js +16 -0
  186. package/utils/n-generator-routers.js +208 -0
  187. package/utils/n-router.js +205 -0
  188. package/utils/n-theme.js +30 -0
  189. package/utils/number.js +180 -123
  190. package/utils/oss.js +57 -0
  191. package/utils/platform.js +1334 -583
  192. package/utils/quarter.js +58 -0
  193. package/utils/storage.js +198 -0
  194. package/utils/style.js +24 -0
  195. package/utils/theme.js +138 -43
  196. package/utils/transfer-queue.js +7 -0
  197. package/utils/transform.js +206 -0
  198. package/utils/type.js +102 -0
  199. package/utils/util.js +795 -0
  200. package/utils/validator.js +181 -0
  201. package/utils/vxetable/index.js +25 -25
  202. package/utils/zoomScroll.js +9 -9
  203. package/config/themes/gold/default.css +0 -241
  204. package/config/themes/gold/default.less +0 -319
  205. package/config/themes/lime/default.css +0 -241
  206. package/config/themes/lime/default.less +0 -319
@@ -0,0 +1,30 @@
1
+ const contentTypeKey = 'Content-Type'
2
+
3
+ export function getContentType(config) {
4
+ // let type = config?.[contentTypeKey] || config?.['content-type'] || ''
5
+ let type = '';
6
+
7
+ if (config && config[contentTypeKey]) {
8
+ type = config[contentTypeKey];
9
+ } else if (config && config['content-type']) {
10
+ type = config['content-type'];
11
+ }
12
+ const suffixIdx = type.indexOf(';')
13
+ if (suffixIdx !== -1) {
14
+ type = type.substring(0, suffixIdx)
15
+ }
16
+
17
+ return type
18
+ }
19
+
20
+ export function setContentType(headers, type) {
21
+ headers[contentTypeKey] = type
22
+ }
23
+
24
+ export const CONTENT_TYPE = {
25
+ form: 'application/x-www-form-urlencoded',
26
+ multiForm: 'multipart/form-data',
27
+ body: 'application/json',
28
+ os: 'application/octet-stream',
29
+ json: 'application/json',
30
+ }
@@ -1,12 +1,12 @@
1
- import axios from 'axios'
2
- import config from '../../config/config'
3
- import interceptors from './interceptors'
4
-
5
-
6
- let ajax = axios.create();
7
- ajax.defaults.baseURL = config.serverContext
8
- ajax.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8'
9
- ajax.interceptors.request.use(interceptors.requestInterceptors, interceptors.requestError);
10
- ajax.interceptors.response.use(interceptors.responseInterceptors, interceptors.responseError);
11
-
12
- export default ajax;
1
+ import axios from 'axios'
2
+ import config from '../../config/config'
3
+ import interceptors from './interceptors'
4
+
5
+
6
+ let ajax = axios.create();
7
+ ajax.defaults.baseURL = config.serverContext
8
+ ajax.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8'
9
+ ajax.interceptors.request.use(interceptors.requestInterceptors, interceptors.requestError);
10
+ ajax.interceptors.response.use(interceptors.responseInterceptors, interceptors.responseError);
11
+
12
+ export default ajax;
@@ -1,97 +1,97 @@
1
- import qs from 'qs'
2
- import cacheRules from "./cacheconf";
3
- import {getToken,getUrlParams} from '../platform'
4
- import Bus from '../bus';
5
-
6
-
7
- let timer1, timer2;
8
- let hasDialog = false;
9
-
10
- function requestInterceptors(config) {
11
- const params = getUrlParams();
12
-
13
- let token = getToken();
14
- if (token) {
15
- config.headers.token = token;
16
- }
17
-
18
- //sso_token认证
19
- if (params.hasOwnProperty('sso_token')||sessionStorage.getItem('sso_token')) {
20
- config.params = Object.assign({
21
- sso_token: params.sso_token||sessionStorage.getItem('sso_token') ,
22
- sso_id: params.sso_id
23
- }, config.params)
24
- }
25
-
26
- //oauth认证
27
- if (params.hasOwnProperty('token')) {
28
- if (config.url.indexOf('?') === -1) {
29
- config.url = config.url + "?token=" + params.token + "&ssoid=" + params.ssoid;
30
- } else {
31
- config.url = config.url + "&token=" + params.token + "&ssoid=" + params.ssoid;
32
- }
33
- }
34
-
35
- if (config.method === 'post') {
36
- // payload为自定义不使用qs.stringify序列化的标记,默认config.payload == undefined;
37
- // 为true时用于匹配@requestBody定义参数的接口
38
- // 使用方式:post(config.AAAServerContext + '/AAA/BBB/CCC', { ...paramRequestBody }, { payload: true })
39
- if (!config.payload) {
40
- config.data = qs.stringify(config.data)
41
- }
42
- } else if (config.method === 'get') {
43
- for (let rule of cacheRules) {
44
- if (rule.test(config.url)) {
45
- return config;
46
- }
47
- }
48
- if (config.url.indexOf('?') === -1) {
49
- config.url = config.url + "?t=" + new Date().getTime();
50
- } else {
51
- config.url = config.url + "&t=" + new Date().getTime();
52
- }
53
- }
54
- return config;
55
- }
56
-
57
- function requestError(error) {
58
- console.error("服务器内部异常,请稍候再试",error);
59
- return Promise.reject(error);
60
- }
61
-
62
- function responseInterceptors(response) {
63
- const data = response.data;
64
- if (data instanceof Object) {
65
- const code = data["code"];
66
- if (code === 10106) {
67
- if (!hasDialog) {
68
- clearTimeout(timer1);
69
- timer1 = setTimeout(function () {
70
- hasDialog = true;
71
- if (confirm("会话已失效,是否重新登录")) {
72
- hasDialog = false;
73
- Bus.$emit("needLogin");
74
- } else {
75
- hasDialog = false;
76
- }
77
- }, 500)
78
- }
79
- }
80
- }
81
- return response;
82
- }
83
-
84
- function responseError(error) {
85
- clearTimeout(timer2);
86
- timer2 = setTimeout(function () {
87
- console.error("服务器内部异常,请稍候再试");
88
- }, 500)
89
- return Promise.reject(error);
90
- }
91
-
92
- export default {
93
- requestInterceptors,
94
- responseInterceptors,
95
- requestError,
96
- responseError
97
- }
1
+ import qs from 'qs'
2
+ import cacheRules from "./cacheconf";
3
+ import {getToken,getUrlParams} from '../platform'
4
+ import Bus from '../bus';
5
+
6
+
7
+ let timer1, timer2;
8
+ let hasDialog = false;
9
+
10
+ function requestInterceptors(config) {
11
+ const params = getUrlParams();
12
+
13
+ let token = getToken();
14
+ if (token) {
15
+ config.headers.token = token;
16
+ }
17
+
18
+ //sso_token认证
19
+ if (params.hasOwnProperty('sso_token')||sessionStorage.getItem('sso_token')) {
20
+ config.params = Object.assign({
21
+ sso_token: params.sso_token||sessionStorage.getItem('sso_token') ,
22
+ sso_id: params.sso_id
23
+ }, config.params)
24
+ }
25
+
26
+ //oauth认证
27
+ if (params.hasOwnProperty('token')) {
28
+ if (config.url.indexOf('?') === -1) {
29
+ config.url = config.url + "?token=" + params.token + "&ssoid=" + params.ssoid;
30
+ } else {
31
+ config.url = config.url + "&token=" + params.token + "&ssoid=" + params.ssoid;
32
+ }
33
+ }
34
+
35
+ if (config.method === 'post') {
36
+ // payload为自定义不使用qs.stringify序列化的标记,默认config.payload == undefined;
37
+ // 为true时用于匹配@requestBody定义参数的接口
38
+ // 使用方式:post(config.AAAServerContext + '/AAA/BBB/CCC', { ...paramRequestBody }, { payload: true })
39
+ if (!config.payload) {
40
+ config.data = qs.stringify(config.data)
41
+ }
42
+ } else if (config.method === 'get') {
43
+ for (let rule of cacheRules) {
44
+ if (rule.test(config.url)) {
45
+ return config;
46
+ }
47
+ }
48
+ if (config.url.indexOf('?') === -1) {
49
+ config.url = config.url + "?t=" + new Date().getTime();
50
+ } else {
51
+ config.url = config.url + "&t=" + new Date().getTime();
52
+ }
53
+ }
54
+ return config;
55
+ }
56
+
57
+ function requestError(error) {
58
+ console.error("服务器内部异常,请稍候再试",error);
59
+ return Promise.reject(error);
60
+ }
61
+
62
+ function responseInterceptors(response) {
63
+ const data = response.data;
64
+ if (data instanceof Object) {
65
+ const code = data["code"];
66
+ if (code === 10106) {
67
+ if (!hasDialog) {
68
+ clearTimeout(timer1);
69
+ timer1 = setTimeout(function () {
70
+ hasDialog = true;
71
+ if (confirm("会话已失效,是否重新登录")) {
72
+ hasDialog = false;
73
+ Bus.$emit("needLogin");
74
+ } else {
75
+ hasDialog = false;
76
+ }
77
+ }, 500)
78
+ }
79
+ }
80
+ }
81
+ return response;
82
+ }
83
+
84
+ function responseError(error) {
85
+ clearTimeout(timer2);
86
+ timer2 = setTimeout(function () {
87
+ console.error("服务器内部异常,请稍候再试");
88
+ }, 500)
89
+ return Promise.reject(error);
90
+ }
91
+
92
+ export default {
93
+ requestInterceptors,
94
+ responseInterceptors,
95
+ requestError,
96
+ responseError
97
+ }
package/utils/assist.js CHANGED
@@ -1,84 +1,147 @@
1
- // deepCopy
2
-
3
-
4
- export function deepCopy(data) {
5
- let i;
6
- const t = typeOf(data);
7
- let o;
8
-
9
- if (t === 'array') {
10
- o = [];
11
- } else if (t === 'object') {
12
- o = {};
13
- } else {
14
- return data;
15
- }
16
-
17
- if (t === 'array') {
18
- for (i = 0; i < data.length; i++) {
19
- o.push(deepCopy(data[i]));
20
- }
21
- } else if (t === 'object') {
22
- for (i in data) {
23
- o[i] = deepCopy(data[i]);
24
- }
25
- }
26
- return o;
27
- }
28
-
29
- export function typeOf(obj) {
30
- const toString = Object.prototype.toString;
31
- const map = {
32
- '[object Boolean]': 'boolean',
33
- '[object Number]': 'number',
34
- '[object String]': 'string',
35
- '[object Function]': 'function',
36
- '[object Array]': 'array',
37
- '[object Date]': 'date',
38
- '[object RegExp]': 'regExp',
39
- '[object Undefined]': 'undefined',
40
- '[object Null]': 'null',
41
- '[object Object]': 'object'
42
- };
43
- return map[toString.call(obj)];
44
- }
45
-
46
- export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
47
- return h('Button', {
48
- props: {
49
- type: type,
50
- size: "small",
51
- ghost: true,
52
- },
53
- directives: [(permission === '' || permission === null) ? '' : {
54
- name: "permission",
55
- value: permission
56
- }],
57
- style: {
58
- margin: '0 2px'
59
- },
60
- on: {
61
- 'click': () => {
62
- operation(vm, currentRow);
63
- }
64
- }
65
- }, operationName);
66
-
67
- }
68
-
69
- export function operateHref(vm, h, currentRow, operationName, operation) {
70
- return h('a', {
71
- style: {
72
- margin: '0 4px'
73
- },
74
- on: {
75
- 'click': () => {
76
- operation(vm, currentRow);
77
- }
78
- }
79
- }, operationName);
80
- }
81
-
82
- export function isJson(arg) {
83
- return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
84
- };
1
+ // deepCopy
2
+
3
+
4
+ export function deepCopy(data) {
5
+ let i;
6
+ const t = typeOf(data);
7
+ let o;
8
+
9
+ if (t === 'array') {
10
+ o = [];
11
+ } else if (t === 'object') {
12
+ o = {};
13
+ } else {
14
+ return data;
15
+ }
16
+
17
+ if (t === 'array') {
18
+ for (i = 0; i < data.length; i++) {
19
+ o.push(deepCopy(data[i]));
20
+ }
21
+ } else if (t === 'object') {
22
+ for (i in data) {
23
+ o[i] = deepCopy(data[i]);
24
+ }
25
+ }
26
+ return o;
27
+ }
28
+ export function deepMerge(target, ...sources) {
29
+ if (!sources.length) return target;
30
+ const source = sources.shift();
31
+
32
+ if (isObject(target) && isObject(source)) {
33
+ for (const key in source) {
34
+ if (isObject(source[key])) {
35
+ if (!target[key]) Object.assign(target, { [key]: {} });
36
+ deepMerge(target[key], source[key]);
37
+ } else {
38
+ Object.assign(target, { [key]: source[key] });
39
+ }
40
+ }
41
+ }
42
+
43
+ return deepMerge(target, ...sources);
44
+ }
45
+
46
+ export function typeOf(obj) {
47
+ const toString = Object.prototype.toString;
48
+ const map = {
49
+ '[object Boolean]': 'boolean',
50
+ '[object Number]': 'number',
51
+ '[object String]': 'string',
52
+ '[object Function]': 'function',
53
+ '[object Array]': 'array',
54
+ '[object Date]': 'date',
55
+ '[object RegExp]': 'regExp',
56
+ '[object Undefined]': 'undefined',
57
+ '[object Null]': 'null',
58
+ '[object Object]': 'object'
59
+ };
60
+ return map[toString.call(obj)];
61
+ }
62
+
63
+ export function operateBtn(vm, h, currentRow, operationName, operation, type, permission, disabled = false) {
64
+ let renderOption = {
65
+ props: {
66
+ type: type,
67
+ size: "small",
68
+ ghost: true,
69
+ disabled: disabled
70
+ },
71
+ style: {
72
+ margin: '0 2px'
73
+ },
74
+ on: {
75
+ 'click': () => {
76
+ operation(vm, currentRow);
77
+ }
78
+ }
79
+ }
80
+ if(permission){
81
+ renderOption['directives'] = [{
82
+ name: "permission",
83
+ value: permission
84
+ }]
85
+ }
86
+
87
+ return h('Button', renderOption, operationName);
88
+
89
+ }
90
+
91
+ export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
92
+ let renderOption = {
93
+ style: {
94
+ margin: '0 4px'
95
+ },
96
+ on: {
97
+ 'click': () => {
98
+ operation(vm, currentRow);
99
+ }
100
+ }
101
+ }
102
+ if(permission){
103
+ renderOption['directives'] = [{
104
+ name: "permission",
105
+ value: permission
106
+ }]
107
+ }
108
+
109
+ return h('a', renderOption, operationName);
110
+ }
111
+
112
+ export function operateMore(vm, h, operation) {
113
+ return h("Dropdown", {
114
+ style: {
115
+ marginLeft: "4px",
116
+ },
117
+ props: {
118
+ transfer: true,
119
+ }
120
+ }, [
121
+ h("a", {
122
+ style: {
123
+ margin: '0 4px',
124
+ borderBottom: '0px solid #CC9900',
125
+ }
126
+ }, [
127
+ h("span", "更多"),
128
+ h("Icon", {
129
+ props: {
130
+ type: "ios-arrow-down"
131
+ },
132
+ })
133
+ ]),
134
+ h('DropdownMenu', {
135
+ slot: "list",
136
+ }, operation)
137
+ ]);
138
+ }
139
+
140
+ export function isJson(arg) {
141
+ return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
142
+ };
143
+
144
+
145
+ export function isObject(item) {
146
+ return (item && typeof item === 'object' && !Array.isArray(item));
147
+ }
@@ -0,0 +1,126 @@
1
+ let Base64 = {
2
+ Base64Chars:
3
+ "abcdefghijklmnopqrstuv" +
4
+ "wxyzABCDEFGHIJKLMNOP" +
5
+ "QRSTUVWXYZ0123456789@*-",
6
+ /**
7
+ * Encode a string to a Base64 string follow Bse64 regular.
8
+ * @param s, a normal string
9
+ * @return a Base64 string
10
+ */
11
+ encode: function (s) {
12
+ if (!s || s.length == 0) return s;
13
+
14
+ var d = "";
15
+ var b = this.ucs2_utf8(s);
16
+ var b0, b1, b2, b3;
17
+ var len = b.length;
18
+ var i = 0;
19
+ while (i < len) {
20
+ var tmp = b[i++];
21
+ b0 = (tmp & 0xfc) >> 2;
22
+ b1 = (tmp & 0x03) << 4;
23
+ if (i < len) {
24
+ tmp = b[i++];
25
+ b1 |= (tmp & 0xf0) >> 4;
26
+ b2 = (tmp & 0x0f) << 2;
27
+ if (i < len) {
28
+ tmp = b[i++];
29
+ b2 |= (tmp & 0xc0) >> 6;
30
+ b3 = tmp & 0x3f;
31
+ } else {
32
+ b3 = 64; // 1 byte "-" is supplement
33
+
34
+ }
35
+ } else {
36
+ b2 = b3 = 64; // 2 bytes "-" are supplement
37
+
38
+ }
39
+
40
+ d += this.Base64Chars.charAt(b0);
41
+ d += this.Base64Chars.charAt(b1);
42
+ d += this.Base64Chars.charAt(b2);
43
+ d += this.Base64Chars.charAt(b3);
44
+ }
45
+
46
+ return d;
47
+
48
+ },
49
+
50
+ /**
51
+ * Encodes a ucs2 string to a utf8 integer array.
52
+ * @param s, a string
53
+ * @return an integer array
54
+ */
55
+ ucs2_utf8: function (s) {
56
+ if (!s) return null;
57
+ var d = new Array();
58
+ if (s == "") return d;
59
+
60
+ var c = 0, i = 0, j = 0;
61
+ var len = s.length;
62
+ while (i < len) {
63
+ c = s.charCodeAt(i++);
64
+ if (c <= 0x7f) {
65
+ // 1 byte
66
+
67
+ d[j++] = c;
68
+ } else if ((c >= 0x80) && (c <= 0x7ff)) {
69
+ // 2 bytes
70
+
71
+ d[j++] = ((c >> 6) & 0x1f) | 0xc0;
72
+ d[j++] = (c & 0x3f) | 0x80;
73
+ } else {
74
+ // 3 bytes
75
+
76
+ d[j++] = (c >> 12) | 0xe0;
77
+ d[j++] = ((c >> 6) & 0x3f) | 0x80;
78
+ d[j++] = (c & 0x3f) | 0x80;
79
+ }
80
+ }
81
+
82
+ return d;
83
+ },
84
+ /**
85
+ * Encodes a utf8 integer array to a ucs2 string.
86
+ * @param s, an integer array
87
+ * @return a string
88
+ */
89
+ utf8_ucs2: function (s) {
90
+ if (!s) return null;
91
+ var len = s.length;
92
+ if (len == 0) return "";
93
+
94
+ var d = "";
95
+ var c = 0, i = 0, tmp = 0;
96
+ while (i < len) {
97
+ c = s[i++];
98
+ if ((c & 0xe0) == 0xe0) {
99
+ // 3 bytes
100
+
101
+ tmp = (c & 0x0f) << 12;
102
+ c = s[i++];
103
+ tmp |= ((c & 0x3f) << 6);
104
+ c = s[i++];
105
+ tmp |= (c & 0x3f);
106
+ } else if ((c & 0xc0) == 0xc0) {
107
+ // 2 bytes
108
+
109
+ tmp = (c & 0x1f) << 6;
110
+ c = s[i++];
111
+ tmp |= (c & 0x3f);
112
+ } else {
113
+ // 1 byte
114
+
115
+ tmp = c;
116
+ }
117
+
118
+ d += String.fromCharCode(tmp);
119
+ }
120
+
121
+ return d;
122
+ }
123
+ };
124
+ export {
125
+ Base64
126
+ }
package/utils/blob.js ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * 将base64转换为Blob
3
+ *
4
+ * @param base64Data base64数据
5
+ * @param contentType 数据的MIME Type,如 png 为 image/png
6
+ * @returns Blob数据
7
+ */
8
+ export function base64ToBlob(base64Data, contentType) {
9
+ contentType = contentType || ''
10
+ const sliceSize = 1024
11
+ const byteCharacters = atob(base64Data)
12
+ const bytesLength = byteCharacters.length
13
+ const slicesCount = Math.ceil(bytesLength / sliceSize)
14
+ const byteArrays = new Array(slicesCount)
15
+
16
+ for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
17
+ const begin = sliceIndex * sliceSize
18
+ const end = Math.min(begin + sliceSize, bytesLength)
19
+
20
+ const bytes = new Array(end - begin)
21
+ for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
22
+ bytes[i] = byteCharacters[offset].charCodeAt(0)
23
+ }
24
+ byteArrays[sliceIndex] = new Uint8Array(bytes)
25
+ }
26
+ return new Blob(byteArrays, { type: contentType })
27
+ }
28
+
29
+ export function blobToBase64(blob, hasPrefix = true) {
30
+ return new Promise((resolve) => {
31
+ const reader = new FileReader()
32
+ reader.onload = function () {
33
+ // const base64Data = (reader?.result || '')
34
+ let base64Data = '';
35
+ if (reader !== null && reader !== undefined) {
36
+ base64Data = reader.result || '';
37
+ }
38
+ if (hasPrefix) {
39
+ resolve(base64Data)
40
+ return
41
+ }
42
+ const base64WithoutPrefix = base64Data.split(',')[1]
43
+ resolve(base64WithoutPrefix)
44
+ }
45
+ reader.readAsDataURL(blob)
46
+ })
47
+ }
package/utils/bus.js CHANGED
@@ -1,3 +1,3 @@
1
- import Vue from 'vue'
2
- const Bus = new Vue();
3
- export default Bus;
1
+ import Vue from 'vue'
2
+ const Bus = new Vue();
3
+ export default Bus;