@lambo-design/shared 1.0.0-beta.2 → 1.0.0-beta.200

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 (175) hide show
  1. package/config/config.js +26 -2
  2. package/config/index.js +7 -2
  3. package/config/themes/atrovirens/atrovirens.css +564 -0
  4. package/config/themes/atrovirens/atrovirens.css.map +1 -0
  5. package/config/themes/atrovirens/atrovirens.less +656 -0
  6. package/config/themes/atrovirens/var.less +662 -0
  7. package/config/themes/blue/blue.css +564 -0
  8. package/config/themes/blue/blue.css.map +1 -0
  9. package/config/themes/blue/blue.less +657 -0
  10. package/config/themes/blue/var.less +663 -0
  11. package/config/themes/blue-white/blue-white.css +564 -0
  12. package/config/themes/blue-white/blue-white.css.map +1 -0
  13. package/config/themes/blue-white/blue-white.less +656 -0
  14. package/config/themes/blue-white/var.less +663 -0
  15. package/config/themes/blue-white-tight/blue-white-tight.css +565 -0
  16. package/config/themes/blue-white-tight/blue-white-tight.css.map +1 -0
  17. package/config/themes/blue-white-tight/blue-white-tight.less +657 -0
  18. package/config/themes/blue-white-tight/var.less +663 -0
  19. package/config/themes/deep/deep.css +564 -0
  20. package/config/themes/deep/deep.css.map +1 -0
  21. package/config/themes/deep/deep.less +655 -0
  22. package/config/themes/deep/var.less +663 -0
  23. package/config/themes/default/default.css +380 -57
  24. package/config/themes/default/default.css.map +1 -0
  25. package/config/themes/default/default.less +425 -88
  26. package/config/themes/default/var.less +361 -12
  27. package/config/themes/eap/eap.css +564 -0
  28. package/config/themes/eap/eap.css.map +1 -0
  29. package/config/themes/eap/eap.less +656 -0
  30. package/config/themes/eap/var.less +663 -0
  31. package/config/themes/gold/gold.css +564 -0
  32. package/config/themes/gold/gold.css.map +1 -0
  33. package/config/themes/gold/gold.less +656 -0
  34. package/config/themes/gold/var.less +357 -7
  35. package/config/themes/index.js +17 -3
  36. package/config/themes/lime/lime.css +564 -0
  37. package/config/themes/lime/lime.css.map +1 -0
  38. package/config/themes/lime/lime.less +656 -0
  39. package/config/themes/lime/var.less +357 -7
  40. package/config/themes/orange/orange.css +564 -0
  41. package/config/themes/orange/orange.css.map +1 -0
  42. package/config/themes/orange/orange.less +656 -0
  43. package/config/themes/orange/var.less +664 -0
  44. package/config/themes/red/red.css +564 -0
  45. package/config/themes/red/red.css.map +1 -0
  46. package/config/themes/red/red.less +656 -0
  47. package/config/themes/red/var.less +663 -0
  48. package/config/themes/theme-atrovirens.js +546 -0
  49. package/config/themes/theme-blue.js +546 -0
  50. package/config/themes/theme-bw.js +546 -0
  51. package/config/themes/theme-bwt.js +547 -0
  52. package/config/themes/theme-deep.js +546 -0
  53. package/config/themes/theme-default.js +353 -59
  54. package/config/themes/theme-eap.js +546 -0
  55. package/config/themes/theme-gold.js +305 -11
  56. package/config/themes/theme-lime.js +305 -11
  57. package/config/themes/theme-orange.js +547 -0
  58. package/config/themes/theme-red.js +546 -0
  59. package/directives/index.js +23 -0
  60. package/directives/module/draggable.js +56 -0
  61. package/directives/module/permission.js +49 -0
  62. package/directives/module/print.js +1 -0
  63. package/directives/module/vue-print-nb/README.md +63 -0
  64. package/directives/module/vue-print-nb/print.js +94 -0
  65. package/directives/module/vue-print-nb/printarea.js +532 -0
  66. package/index.js +8 -1
  67. package/nstyles/common.less +197 -0
  68. package/nstyles/components/404.less +46 -0
  69. package/nstyles/components/button.less +34 -0
  70. package/nstyles/components/date-picker.less +37 -0
  71. package/nstyles/components/drawer.less +20 -0
  72. package/nstyles/components/dropdown.less +18 -0
  73. package/nstyles/components/excel-flow.less +72 -0
  74. package/nstyles/components/form.less +303 -0
  75. package/nstyles/components/index.less +15 -0
  76. package/nstyles/components/layout/collect.less +10 -0
  77. package/nstyles/components/layout/detail-view.less +107 -0
  78. package/nstyles/components/layout/full-screen.less +7 -0
  79. package/nstyles/components/layout/index.less +7 -0
  80. package/nstyles/components/layout/other-menu.less +142 -0
  81. package/nstyles/components/layout/page-view.less +101 -0
  82. package/nstyles/components/layout/sider-trigger.less +41 -0
  83. package/nstyles/components/layout/tags-nav.less +113 -0
  84. package/nstyles/components/modal.less +85 -0
  85. package/nstyles/components/panel.less +31 -0
  86. package/nstyles/components/select.less +3 -0
  87. package/nstyles/components/sign.less +27 -0
  88. package/nstyles/components/table.less +315 -0
  89. package/nstyles/components/tree.less +159 -0
  90. package/nstyles/components/upload.less +131 -0
  91. package/nstyles/index.less +5 -0
  92. package/nstyles/reset.less +65 -0
  93. package/nstyles/third/ag.less +173 -0
  94. package/nstyles/third/icons/sort-desc.svg +1 -0
  95. package/nstyles/third/icons/sort-up.svg +1 -0
  96. package/nstyles/third/icons/sorting.svg +1 -0
  97. package/nstyles/third/index.less +11 -0
  98. package/nstyles/third/view-design.less +356 -0
  99. package/nstyles/variables/base.less +143 -0
  100. package/nstyles/variables/index.less +4 -0
  101. package/nstyles/variables/theme/default/button.less +7 -0
  102. package/nstyles/variables/theme/default/common.less +57 -0
  103. package/nstyles/variables/theme/default/index.less +7 -0
  104. package/nstyles/variables/theme/default/layout.less +40 -0
  105. package/nstyles/variables/theme/default/table.less +37 -0
  106. package/nstyles/variables/theme/default/tag.less +3 -0
  107. package/nstyles/variables/theme/default/upload.less +3 -0
  108. package/nstyles/variables/theme/index.less +13 -0
  109. package/nstyles/variables/theme/small/button.less +7 -0
  110. package/nstyles/variables/theme/small/common.less +39 -0
  111. package/nstyles/variables/theme/small/index.less +5 -0
  112. package/nstyles/variables/theme/small/layout.less +21 -0
  113. package/nstyles/variables/theme/small/table.less +17 -0
  114. package/nstyles/variables/theme/small/tag.less +3 -0
  115. package/package.json +39 -20
  116. package/plugin/index.js +12 -0
  117. package/plugin/module/date-format.js +30 -0
  118. package/plugin/module/loading.js +26 -0
  119. package/plugin/module/warn-handler.js +11 -0
  120. package/styles/image/lan_navigator.png +0 -0
  121. package/styles/image/lv_navigator.png +0 -0
  122. package/utils/ajax/content-type.js +30 -0
  123. package/utils/ajax/interceptors.js +97 -90
  124. package/utils/assist.js +78 -10
  125. package/utils/base64.js +126 -0
  126. package/utils/blob.js +47 -0
  127. package/utils/crypto/index.js +10 -0
  128. package/utils/date.js +334 -305
  129. package/utils/dict/built-in-dict.js +20 -0
  130. package/utils/dict/index.js +75 -0
  131. package/utils/event.js +72 -0
  132. package/utils/excel.js +369 -237
  133. package/utils/file.js +19 -0
  134. package/utils/form/validate.js +29 -0
  135. package/utils/half-year.js +68 -0
  136. package/utils/index.js +37 -0
  137. package/utils/json.js +29 -0
  138. package/utils/lodop.js +5 -0
  139. package/utils/menu/before-close.js +17 -0
  140. package/utils/menu/index.js +381 -0
  141. package/utils/mime_type.js +67 -0
  142. package/utils/modelerUtil.js +4 -1
  143. package/utils/n/date.js +57 -0
  144. package/utils/n/index.js +10 -0
  145. package/utils/n/is-type.js +176 -0
  146. package/utils/n/number.js +144 -0
  147. package/utils/n/permission-cache.js +11 -0
  148. package/utils/n/reuqest/axiosN.js +15 -0
  149. package/utils/n/reuqest/content-type.js +19 -0
  150. package/utils/n/reuqest/interceptors.js +95 -0
  151. package/utils/n/reuqest/url-params.js +12 -0
  152. package/utils/n/storage.js +51 -0
  153. package/utils/n/token.js +51 -0
  154. package/utils/n/user-cache.js +11 -0
  155. package/utils/n/user.js +34 -0
  156. package/utils/n/uuid.js +16 -0
  157. package/utils/n-generator-routers.js +208 -0
  158. package/utils/n-router.js +205 -0
  159. package/utils/n-theme.js +30 -0
  160. package/utils/number.js +72 -15
  161. package/utils/oss.js +58 -0
  162. package/utils/platform.js +582 -26
  163. package/utils/quarter.js +58 -0
  164. package/utils/storage.js +198 -0
  165. package/utils/style.js +24 -0
  166. package/utils/theme.js +97 -4
  167. package/utils/transfer-queue.js +7 -0
  168. package/utils/type.js +102 -0
  169. package/utils/util.js +795 -0
  170. package/utils/validator.js +181 -0
  171. package/utils/vxetable/index.js +25 -0
  172. package/config/themes/gold/default.css +0 -241
  173. package/config/themes/gold/default.less +0 -319
  174. package/config/themes/lime/default.css +0 -241
  175. package/config/themes/lime/default.less +0 -319
@@ -0,0 +1,39 @@
1
+ .ind-small-theme {
2
+ --ind-menu-desc-margin-top: 0px;
3
+ --ind-sc-padding-top: 10px; // 值来自四川
4
+
5
+ // 压缩padding
6
+ // --ind-padding-xs: 4px;
7
+ --ind-padding-sm: 8px;
8
+
9
+ // card的样式
10
+ --ivu-card-head-padding: 6px 12px;
11
+ --ivu-card-head-line-height: 36px;
12
+ --ivu-card-head-height: 36px;
13
+ --ivu-card-body-padding: 6px;
14
+
15
+ // 表单的样式
16
+ --input-height: 26px; //30px; // 24px; // small 24px // 值来自四川 // 又改一版
17
+ --ivu-form-item-label-padding: 6px 8px 6px 0; // 6px 8px 6px 0; 值来自四川 // 又改一版
18
+ --ivu-form-v6stle-item-label-paddingleft: 12px;
19
+ --ivu-form-item-content-padding: 4px 6px;
20
+ --ivu-form-item-label-before-left: 4px;
21
+ --ivu-form-item-content-line-height: 26px; //30px; //24px; // 值来自四川 // 又改一版
22
+
23
+ // tree样式
24
+ --ind-tree-wrapper-width: 100%;
25
+ --tree-content-padding: var(--ind-padding-xs);
26
+ --ivu-tree-margin: var(--ind-padding-xs) 0;
27
+
28
+ // drawer样式
29
+ --ind-drawer-content-padding: 6px;
30
+ --ind-drawer-footer-padding: 10px 16px;
31
+
32
+ // 报表指标样式
33
+ --report-index-model-panel-padding: var(--tree-content-padding);
34
+ --report-index-options-padding-right: var(--tree-content-padding);
35
+
36
+ // 表格
37
+ --ind-table-button-padding: 6px; // var(--ind-padding-xs);
38
+ --input-height-table: 24px; // 表格输入框的高度
39
+ }
@@ -0,0 +1,5 @@
1
+ @import './button.less';
2
+ @import './common.less';
3
+ @import './layout.less';
4
+ @import './table.less';
5
+ @import './tag.less';
@@ -0,0 +1,21 @@
1
+ .ind-small-theme {
2
+ // basic layout 系统布局变量 -begin
3
+ --ivu-menu-item-font-size: var(--ind-font-size-md);
4
+
5
+ --menu-icon-margin-right: var(--ind-padding-xs);
6
+ // basic layout 系统布局变量 -end
7
+
8
+ // page-view layout 系统布局变量 -begin
9
+ --ind-panel-vertical-margin: var(--ind-padding-xs); // 12px;
10
+ --ind-panel-horizon-margin: var(--ind-padding-xs); // var(--ind-padding-sm);
11
+ // page-view layout 系统布局变量 -end
12
+
13
+ // --input-height: 30px; // 24px; // small 24px 挪common.less去了
14
+ --search-margin-bottom: var(--ind-padding-xs); // var(--ind-padding-sm); // 24px; // 6px;
15
+ --search-button-margin: var(--ind-padding-xs); // var(--ind-padding-sm);
16
+
17
+ --menu-name-padding: 0 14px 0 10px; // var(--ind-padding-xs) 14px var(--ind-padding-xs) 10px; // 标题行padding
18
+ --menu-title-font-size: 16px;
19
+ --menu-title-color: #17233d;
20
+ --page-content-padding: var(--ind-padding-xs); // 12px;
21
+ }
@@ -0,0 +1,17 @@
1
+ .ind-small-theme {
2
+ --ind-table-padding: var(--ind-padding-sm);
3
+ --ind-ag-cell-widget-spacing: 12px;
4
+
5
+ --ind-ag-grid-size: 4px;
6
+ --ind-ag-font-size: var(--ind-font-size-md); // var(--ind-font-size-sm);
7
+ --ind-ag-list-item-height: calc(var(--ag-grid-size) * 6);
8
+ --ind-ag-cell-horizontal-padding: 3px; // 0px
9
+
10
+ // 以下是 ag 没有的
11
+ --ind-ag-cell-icon-margin-left: 3px;
12
+ --ind-ag-cell-header-horizontal-padding: 0px;
13
+ --ind-ag-cell-line-height: 14px;
14
+
15
+ --ind-unit-switch-bottom: 10px;
16
+ --ind-other-button-top: 2px;
17
+ }
@@ -0,0 +1,3 @@
1
+ .ind-small-theme {
2
+ --ind-tag-height: 18px; //22px // 16px;; // 值来自四川 // 又改一版
3
+ }
package/package.json CHANGED
@@ -1,20 +1,39 @@
1
- {
2
- "name": "@lambo-design/shared",
3
- "version": "1.0.0-beta.2",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {},
7
- "author": "lambo",
8
- "license": "ISC",
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "dependencies": {
13
- "axios": "^0.24.0",
14
- "axios-cache-plugin": "^0.1.0",
15
- "qs": "^6.11.0",
16
- "xlsx": "^0.13.3",
17
- "classnames": "^2.3.1",
18
- "xlsx-style": "^0.8.13"
19
- }
20
- }
1
+ {
2
+ "name": "@lambo-design/shared",
3
+ "version": "1.0.0-beta.200",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "author": "lambo",
7
+ "license": "ISC",
8
+ "publishConfig": {
9
+ "access": "public",
10
+ "registry": "https://registry.npmjs.org/",
11
+ "files": [
12
+ "!**/.*",
13
+ "!**/CHANGELOG.md",
14
+ "**/*"
15
+ ]
16
+ },
17
+ "dependencies": {
18
+ "axios": "^0.24.0",
19
+ "axios-cache-plugin": "^0.1.0",
20
+ "classnames": "^2.3.1",
21
+ "css-vars-ponyfill": "^2.4.8",
22
+ "dayjs": "^1.11.9",
23
+ "lodash": "^4.17.21",
24
+ "moment": "2.29.4",
25
+ "nanoid": "^3.3.7",
26
+ "node-rsa": "^1.1.1",
27
+ "qs": "^6.11.0",
28
+ "xlsx": "http://cicd.lambo.top/package/cdn/xlsx-0.19.1.tgz",
29
+ "xlsx-style": "^0.8.13"
30
+ },
31
+ "scripts": {
32
+ "release-shared": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
33
+ "release-major": "standard-version --release-as major",
34
+ "release-minor": "standard-version --release-as minor",
35
+ "release-patch": "standard-version --release-as patch",
36
+ "release-beta": "standard-version --prerelease beta",
37
+ "re-publish": "pnpm publish --access public --no-git-checks"
38
+ }
39
+ }
@@ -0,0 +1,12 @@
1
+ import DateFormat from "./module/date-format";
2
+ import Loading from "./module/loading";
3
+ import WarnHandler from "./module/warn-handler";
4
+ export default {
5
+ install : function (Vue, options) {
6
+ DateFormat.install(Vue,options);
7
+ Loading.install(Vue.options);
8
+ WarnHandler.install(Vue.options);
9
+ }
10
+
11
+ }
12
+ export { DateFormat , Loading , WarnHandler}
@@ -0,0 +1,30 @@
1
+ export default {
2
+ /**
3
+ * 对Date的扩展,将 Date 转化为指定格式的String
4
+ * 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
5
+ * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
6
+ * 例:
7
+ * (new Date()).Format("yyyy-MM-dd HH:mm:ss.S") ==> 2006-07-02 08:09:04.423
8
+ * (new Date()).Format("yyyy-M-d H:m:s.S") ==> 2006-7-2 8:9:4.18
9
+ */
10
+ install: function (Vue, options) {
11
+ Date.prototype.Format = function (fmt) {
12
+ let o = {
13
+ "M+": this.getMonth() + 1, //月份
14
+ "d+": this.getDate(), //日
15
+ "H+": this.getHours(), //小时
16
+ "m+": this.getMinutes(), //分
17
+ "s+": this.getSeconds(), //秒
18
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
19
+ "S": this.getMilliseconds() //毫秒
20
+ };
21
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
22
+ for (let k in o)
23
+ if (new RegExp("(" + k + ")").test(fmt)) {
24
+ fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
25
+ }
26
+ return fmt;
27
+ }
28
+
29
+ }
30
+ }
@@ -0,0 +1,26 @@
1
+ export default {
2
+ install : function (Vue, options) {
3
+ //通用Loading
4
+ Vue.prototype.$ShowLoading = function(text){
5
+ this.$Spin.show({
6
+ render: (h) => {
7
+ return h('div', [
8
+ h('Icon', {
9
+ 'class': 'demo-spin-icon-load',
10
+ props: {
11
+ type: 'ios-loading',
12
+ size: 24
13
+ }
14
+ }),
15
+ h('div', text||'Loading')
16
+ ])
17
+ }
18
+ });
19
+ }
20
+
21
+ Vue.prototype.$CloseLoading = function(){
22
+ this.$Spin.hide();
23
+ }
24
+ }
25
+
26
+ }
@@ -0,0 +1,11 @@
1
+ export default {
2
+ install : function (Vue, options) {
3
+ Vue.config.warnHandler = function (err, vm, info) {
4
+ if (err.toString().indexOf("Component names should conform to valid custom element name in html5 specification")>0){
5
+ console.warn("[Lambo warn]: " + err + info);
6
+ }else{
7
+ console.error("[Vue warn]: " + err + info);
8
+ }
9
+ }
10
+ }
11
+ }
Binary file
Binary file
@@ -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,90 +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
-
9
- function requestInterceptors(config) {
10
- const params = getUrlParams();
11
-
12
- let token = getToken();
13
- if (token) {
14
- config.headers.token = token;
15
- }
16
-
17
- //sso_token认证
18
- if (params.hasOwnProperty('sso_token')||sessionStorage.getItem('sso_token')) {
19
- config.params = Object.assign({
20
- sso_token: params.sso_token||sessionStorage.getItem('sso_token') ,
21
- sso_id: params.sso_id
22
- }, config.params)
23
- }
24
-
25
- //oauth认证
26
- if (params.hasOwnProperty('token')) {
27
- if (config.url.indexOf('?') === -1) {
28
- config.url = config.url + "?token=" + params.token + "&ssoid=" + params.ssoid;
29
- } else {
30
- config.url = config.url + "&token=" + params.token + "&ssoid=" + params.ssoid;
31
- }
32
- }
33
-
34
- if (config.method === 'post') {
35
- // payload为自定义不使用qs.stringify序列化的标记,默认config.payload == undefined;
36
- // 为true时用于匹配@requestBody定义参数的接口
37
- // 使用方式:post(config.AAAServerContext + '/AAA/BBB/CCC', { ...paramRequestBody }, { payload: true })
38
- if (!config.payload) {
39
- config.data = qs.stringify(config.data)
40
- }
41
- } else if (config.method === 'get') {
42
- for (let rule of cacheRules) {
43
- if (rule.test(config.url)) {
44
- return config;
45
- }
46
- }
47
- if (config.url.indexOf('?') === -1) {
48
- config.url = config.url + "?t=" + new Date().getTime();
49
- } else {
50
- config.url = config.url + "&t=" + new Date().getTime();
51
- }
52
- }
53
- return config;
54
- }
55
-
56
- function requestError(error) {
57
- console.error("服务器内部异常,请稍候再试",error);
58
- return Promise.reject(error);
59
- }
60
-
61
- function responseInterceptors(response) {
62
- const data = response.data;
63
- if (data instanceof Object) {
64
- const code = data["code"];
65
- if (code === 10106) {
66
- clearTimeout(timer1);
67
- timer1 = setTimeout(function () {
68
- if (confirm("会话已失效,是否重新登录")) {
69
- Bus.$emit("needLogin");
70
- }
71
- }, 500)
72
- }
73
- }
74
- return response;
75
- }
76
-
77
- function responseError(error) {
78
- clearTimeout(timer2);
79
- timer2 = setTimeout(function () {
80
- console.error("服务器内部异常,请稍候再试");
81
- }, 500)
82
- return Promise.reject(error);
83
- }
84
-
85
- export default {
86
- requestInterceptors,
87
- responseInterceptors,
88
- requestError,
89
- responseError
90
- }
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,5 +1,6 @@
1
1
  // deepCopy
2
2
 
3
+
3
4
  export function deepCopy(data) {
4
5
  let i;
5
6
  const t = typeOf(data);
@@ -24,6 +25,23 @@ export function deepCopy(data) {
24
25
  }
25
26
  return o;
26
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
+ }
27
45
 
28
46
  export function typeOf(obj) {
29
47
  const toString = Object.prototype.toString;
@@ -42,17 +60,14 @@ export function typeOf(obj) {
42
60
  return map[toString.call(obj)];
43
61
  }
44
62
 
45
- export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
46
- return h('Button', {
63
+ export function operateBtn(vm, h, currentRow, operationName, operation, type, permission, disabled = false) {
64
+ let renderOption = {
47
65
  props: {
48
66
  type: type,
49
67
  size: "small",
50
68
  ghost: true,
69
+ disabled: disabled
51
70
  },
52
- directives: [{
53
- name: "permission",
54
- value: permission
55
- }],
56
71
  style: {
57
72
  margin: '0 2px'
58
73
  },
@@ -61,19 +76,72 @@ export function operateBtn(vm, h, currentRow, operationName, operation, type, pe
61
76
  operation(vm, currentRow);
62
77
  }
63
78
  }
64
- }, operationName);
79
+ }
80
+ if(permission){
81
+ renderOption['directives'] = [{
82
+ name: "permission",
83
+ value: permission
84
+ }]
85
+ }
86
+
87
+ return h('Button', renderOption, operationName);
88
+
65
89
  }
66
90
 
67
- export function operateHref(vm, h, currentRow, operationName, operation) {
68
- return h('a', {
91
+ export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
92
+ let renderOption = {
93
+ style: {
94
+ margin: '0 4px'
95
+ },
69
96
  on: {
70
97
  'click': () => {
71
98
  operation(vm, currentRow);
72
99
  }
73
100
  }
74
- }, operationName);
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
+ ]);
75
138
  }
76
139
 
77
140
  export function isJson(arg) {
78
141
  return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
79
142
  };
143
+
144
+
145
+ export function isObject(item) {
146
+ return (item && typeof item === 'object' && !Array.isArray(item));
147
+ }