imatrix-ui 0.0.15 → 0.1.1-up

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 (171) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +7 -0
  3. package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
  4. package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
  5. package/components/dynamic-source-select/events.js +77 -0
  6. package/components/fs-preview/fs-preview.vue +287 -0
  7. package/components/index.js +26 -0
  8. package/components/plugins/export-data-new.js +623 -0
  9. package/components/plugins/export-data.js +431 -0
  10. package/components/plugins/index.js +15 -0
  11. package/components/plugins/public-method.js +47 -0
  12. package/components/rich-editor/index-bak.vue +306 -0
  13. package/components/rich-editor/index.vue +236 -0
  14. package/components/rich-editor/langs/zh-Hans.js +438 -0
  15. package/components/rich-editor/viewer.vue +105 -0
  16. package/components/super-grid/apis.js +1065 -0
  17. package/components/super-grid/columns-config.vue +430 -0
  18. package/components/super-grid/custom-formatter.js +330 -0
  19. package/components/super-grid/dynamic-input.vue +1706 -0
  20. package/components/super-grid/eventBus.js +2 -0
  21. package/components/super-grid/events.js +56 -0
  22. package/components/super-grid/formValidatorUtil.js +300 -0
  23. package/components/super-grid/formatter.js +190 -0
  24. package/components/super-grid/group-column.vue +100 -0
  25. package/components/super-grid/header-context-menu.vue +82 -0
  26. package/components/super-grid/index-column.vue +69 -0
  27. package/components/super-grid/normal-column.vue +1148 -0
  28. package/components/super-grid/public-methods.js +30 -0
  29. package/components/super-grid/row-operation.vue +193 -0
  30. package/components/super-grid/search-button.vue +74 -0
  31. package/components/super-grid/search-condition-input.vue +73 -0
  32. package/components/super-grid/search-condition-list.vue +68 -0
  33. package/components/super-grid/search-form-advancedQuery.vue +820 -0
  34. package/components/super-grid/search-form-dialog.vue +77 -0
  35. package/components/super-grid/search-form-item.vue +470 -0
  36. package/components/super-grid/search-form-number.vue +111 -0
  37. package/components/super-grid/search-form-open.vue +178 -0
  38. package/components/super-grid/search-form-ordinarySearch.vue +218 -0
  39. package/components/super-grid/search-form.vue +756 -0
  40. package/components/super-grid/search-methods.js +484 -0
  41. package/components/super-grid/selection-column.vue +46 -0
  42. package/components/super-grid/store.js +3 -0
  43. package/components/super-grid/super-grid-service.js +682 -0
  44. package/components/super-grid/super-grid.vue +2893 -0
  45. package/components/super-grid/utils.js +851 -0
  46. package/components/super-grid/view-image-dialog.vue +173 -0
  47. package/components/utils/gogocodeTransfer.js +59 -0
  48. package/components/utils/utils.js +180 -0
  49. package/components/utils/value-set.js +98 -0
  50. package/components/z-test-utton/index.vue +82 -0
  51. package/package.json +29 -40
  52. package/public/index.html +13 -0
  53. package/public/vite.svg +1 -0
  54. package/src/api/sso-service.js +172 -19
  55. package/src/api/tab.js +36 -0
  56. package/src/api/user-service.js +11 -11
  57. package/src/assets/401/401.gif +0 -0
  58. package/src/assets/404/404-cloud.png +0 -0
  59. package/src/assets/404/404.png +0 -0
  60. package/src/assets/cloud.png +0 -0
  61. package/src/directives/permission/index.js +13 -13
  62. package/src/directives/permission/permission.js +20 -15
  63. package/src/i18n/i18n.js +16 -0
  64. package/src/i18n/langs/cn.js +254 -0
  65. package/src/i18n/langs/en.js +264 -0
  66. package/src/permission.js +157 -71
  67. package/src/plugins.js +18 -18
  68. package/src/router/index.js +96 -69
  69. package/src/store/getters.js +15 -10
  70. package/src/store/index.js +19 -19
  71. package/src/store/modules/app.js +54 -42
  72. package/src/store/modules/permission.js +137 -73
  73. package/src/store/modules/tab-content.js +36 -0
  74. package/src/store/modules/user.js +293 -80
  75. package/src/styles/display-layout.scss +34 -0
  76. package/src/styles/element-ui.scss +29 -29
  77. package/src/styles/index.scss +157 -78
  78. package/src/styles/mixin.scss +27 -27
  79. package/src/styles/theme/black/font-style.scss +70 -0
  80. package/src/styles/theme/black/index.scss +306 -0
  81. package/src/styles/theme/black/sidebar.scss +189 -0
  82. package/src/styles/theme/blue/font-style.scss +46 -0
  83. package/src/styles/theme/blue/index.scss +172 -0
  84. package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
  85. package/src/styles/theme/blue2/font-style.scss +70 -0
  86. package/src/styles/theme/blue2/index.scss +188 -0
  87. package/src/styles/theme/blue2/sidebar.scss +201 -0
  88. package/src/styles/theme/dark-blue/button.scss +9 -0
  89. package/src/styles/theme/dark-blue/card.scss +62 -0
  90. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  91. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  92. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  93. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  94. package/src/styles/theme/dark-blue/font.scss +71 -0
  95. package/src/styles/theme/dark-blue/form.scss +51 -0
  96. package/src/styles/theme/dark-blue/index.scss +269 -0
  97. package/src/styles/theme/dark-blue/input.scss +15 -0
  98. package/src/styles/theme/dark-blue/message.scss +8 -0
  99. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  100. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  101. package/src/styles/theme/dark-blue/sidebar.scss +266 -0
  102. package/src/styles/theme/dark-blue/tab.scss +83 -0
  103. package/src/styles/theme/dark-blue/table.scss +60 -0
  104. package/src/styles/theme/dark-blue/tree.scss +31 -0
  105. package/src/styles/theme/dark-blue/var.scss +1028 -0
  106. package/src/styles/theme/gray/card-style.scss +54 -0
  107. package/src/styles/theme/gray/font-style.scss +70 -0
  108. package/src/styles/theme/gray/index.scss +172 -0
  109. package/src/styles/theme/gray/input-style.scss +19 -0
  110. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  111. package/src/styles/theme/gray/sidebar.scss +231 -0
  112. package/src/styles/theme/gray/tab-style.scss +81 -0
  113. package/src/styles/transition.scss +47 -46
  114. package/src/utils/auth-api.js +159 -0
  115. package/src/utils/auth.js +61 -15
  116. package/src/utils/calculator/calculator-factory-wf.js +558 -0
  117. package/src/utils/calculator/calculator-factory.js +145 -0
  118. package/src/utils/calculator/calculator-util.js +166 -0
  119. package/src/utils/common-util.js +305 -0
  120. package/src/utils/eventBus.js +2 -0
  121. package/src/utils/iconUtils.js +28 -0
  122. package/src/utils/index.js +102 -86
  123. package/src/utils/jump-page-utils.js +814 -0
  124. package/src/utils/local-storage.js +33 -31
  125. package/src/utils/menu.js +19 -0
  126. package/src/utils/permission.js +31 -26
  127. package/src/utils/permissionAuth.js +90 -0
  128. package/src/utils/range-selector.js +188 -0
  129. package/src/utils/request.js +270 -116
  130. package/src/utils/restful-interface-utils.js +57 -0
  131. package/src/utils/util.js +698 -0
  132. package/src/utils/validate.js +34 -33
  133. package/src/utils/watermark.js +108 -0
  134. package/src/utils/workflow-util.js +93 -0
  135. package/src/views/404.vue +248 -228
  136. package/src/views/dsc-component/Sidebar/Item.vue +84 -0
  137. package/src/views/dsc-component/Sidebar/Link.vue +38 -0
  138. package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
  139. package/src/views/dsc-component/Sidebar/index.vue +220 -0
  140. package/src/views/dsc-component/tabs/tab-content.vue +199 -0
  141. package/src/views/error-page/401.vue +106 -91
  142. package/src/views/error-page/404.vue +248 -228
  143. package/src/views/layout/EmptyLayout.vue +3 -0
  144. package/src/views/layout/Layout.vue +81 -68
  145. package/src/views/layout/NewLayout.vue +18 -0
  146. package/src/views/layout/components/AppMain.vue +39 -29
  147. package/src/views/layout/components/Breadcrumb/index.vue +156 -0
  148. package/src/views/layout/components/Menubar/Item.vue +57 -0
  149. package/src/views/layout/components/Menubar/Link.vue +38 -0
  150. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
  151. package/src/views/layout/components/Menubar/index.vue +210 -0
  152. package/src/views/layout/components/Sidebar/Item.vue +53 -29
  153. package/src/views/layout/components/Sidebar/Link.vue +38 -39
  154. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
  155. package/src/views/layout/components/Sidebar/index.vue +141 -48
  156. package/src/views/layout/components/iframe-page.vue +38 -0
  157. package/src/views/layout/components/index.js +4 -3
  158. package/src/views/layout/components/tabs/tab-content.vue +207 -0
  159. package/src/views/layout/mixin/ResizeHandler.js +41 -41
  160. package/src/views/layout/tab-content-iframe-index.vue +38 -0
  161. package/src/views/layout/tab-content-index.vue +93 -0
  162. package/src/views/login/authredirect.vue +10 -10
  163. package/src/views/login/index.vue +296 -203
  164. package/src/views/login/update-password.vue +243 -0
  165. package/src/views/redirect/index.vue +14 -12
  166. package/src/views/wf-history/tache-subprocess-history.vue +45 -0
  167. package/vite.config.js +31 -0
  168. package/lib/super-ui.css +0 -1
  169. package/lib/super-ui.umd.min.js +0 -2
  170. package/src/styles/variables.scss +0 -4
  171. package/src/views/layout/components/Navbar.vue +0 -92
@@ -0,0 +1,166 @@
1
+ import { getAbstractUserFactory } from './calculator-factory'
2
+ import { getAbstractUserFactoryWf } from './calculator-factory-wf'
3
+ import { getPropValue, getEntityFieldValue } from '../util'
4
+ export function executeExpression(leftValue, operator, rightValue, dataType) {
5
+ const Calculator = getAbstractUserFactory(dataType)
6
+ const calculatorObj = new Calculator(leftValue, operator, rightValue)
7
+ return calculatorObj.result
8
+ }
9
+
10
+ /**
11
+ * 保存时,验证子表字段必填时,解析子表字段权限中的“子表条件”
12
+ * @param express
13
+ * @param upc
14
+ * @return
15
+ */
16
+ export function parseSubTablePermissionCondition(
17
+ express,
18
+ dataTypeMap,
19
+ parentEntity,
20
+ subEntity,
21
+ additionalParamMap,
22
+ task,
23
+ contextParameterMap
24
+ ) {
25
+ const expressTrueVal = 'true'
26
+ // ${user} operator.text.eq '吴荣[wurong]' condition.operator.and ${department} operator.text.eq 'EIT业务部' condition.operator.and ${role} operator.text.eq '普通员工'
27
+ if (!express) {
28
+ // 表示没有配置条件,则字段必填
29
+ return true
30
+ }
31
+ if (expressTrueVal.toLowerCase() === express.trim()) {
32
+ return true
33
+ }
34
+ const SQUARE_BRACKETS_LEFT = '['
35
+ const SQUARE_BRACKETS_RIGHT = ']'
36
+ const AND = '&&'
37
+ const OR = '||'
38
+ let temp = express
39
+ const strs = splitExpression(express)
40
+ console.log('分割后的原子表达式为:', strs)
41
+ let result = false
42
+ for (let i = 0; i < strs.length; i++) {
43
+ console.log('开始分析原子表达式:', strs[i])
44
+ const atomicExpress = strs[i]
45
+ if (atomicExpress && atomicExpress.trim()) {
46
+ const name = atomicExpress.substring(
47
+ atomicExpress.indexOf(SQUARE_BRACKETS_LEFT) +
48
+ SQUARE_BRACKETS_LEFT.length,
49
+ atomicExpress.indexOf(SQUARE_BRACKETS_RIGHT)
50
+ )
51
+ let dataType = 'TEXT'
52
+
53
+ if (dataTypeMap != null && dataTypeMap[name] != null) {
54
+ dataType = dataTypeMap[name]
55
+ }
56
+ result = parseFieldCondition(
57
+ atomicExpress,
58
+ dataType,
59
+ parentEntity,
60
+ subEntity,
61
+ additionalParamMap,
62
+ task,
63
+ contextParameterMap
64
+ )
65
+ console.log('原子表达式:', atomicExpress, '的分析结果为 ', result)
66
+ temp = temp.replace(atomicExpress.trim(), result + '')
67
+ console.log('将原子表达式替换为它的结果后:', temp)
68
+ }
69
+ }
70
+ temp = temp.replace(/condition.operator.and/g, AND)
71
+ temp = temp.replace(/condition.operator.or/g, OR)
72
+ if (temp.trim().endsWith(OR)) {
73
+ temp = temp.substring(0, temp.lastIndexOf(OR))
74
+ }
75
+ if (temp.trim().endsWith(AND)) {
76
+ temp = temp.substring(0, temp.lastIndexOf(AND))
77
+ }
78
+ console.log('最终该流向的表达式为:', temp)
79
+ // eslint-disable-next-line no-eval
80
+ return eval('(' + temp + ')')
81
+ }
82
+
83
+ /**
84
+ * 解析字段条件
85
+ * @param {*} atomicExpress
86
+ * @param {*} workflowCalculatorInfo
87
+ * @param {*} dataType
88
+ * @param {*} task
89
+ * @param {*} contextParameterMap
90
+ * @param {*} parentEntity 主表实体信息
91
+ * @param {*} entityData 子表实体信息
92
+ * @returns
93
+ */
94
+ function parseFieldCondition(
95
+ atomicExpress,
96
+ dataType,
97
+ parentEntity,
98
+ subEntity,
99
+ additionalParamMap,
100
+ task,
101
+ contextParameterMap
102
+ ) {
103
+ if (!atomicExpress) {
104
+ return false
105
+ }
106
+ const SQUARE_BRACKETS_LEFT = '['
107
+ const SQUARE_BRACKETS_RIGHT = ']'
108
+ // 去掉前后空格
109
+ atomicExpress = atomicExpress.trim()
110
+ const name = atomicExpress.substring(
111
+ atomicExpress.indexOf(SQUARE_BRACKETS_LEFT) + SQUARE_BRACKETS_LEFT.length,
112
+ atomicExpress.indexOf(SQUARE_BRACKETS_RIGHT)
113
+ )
114
+ // 获得 ${field[fieldName]}
115
+ const fieldInfo = atomicExpress.substring(0, atomicExpress.indexOf(' '))
116
+ const suffixInfo = atomicExpress.substring(atomicExpress.indexOf(' ') + 1)
117
+ const valueInfo = suffixInfo.substring(suffixInfo.indexOf(' ') + 1).trim()
118
+ // 解析动态参数、上下文参数、手动输入、obj.(此处表示的是主表记录)
119
+ const leftValue = getPropValue(
120
+ valueInfo,
121
+ parentEntity,
122
+ additionalParamMap,
123
+ contextParameterMap,
124
+ null,
125
+ subEntity,
126
+ task
127
+ )
128
+ if (leftValue != null) {
129
+ atomicExpress = atomicExpress.replace(valueInfo, leftValue.toString())
130
+ }
131
+ const value = getValue(subEntity, name)
132
+ if (value === undefined || value === null || value === '') {
133
+ if (dataType === 'DATE' || dataType === 'TIME') {
134
+ return false
135
+ }
136
+ }
137
+ console.log('对应值为:', value)
138
+ const CalculatorWf = getAbstractUserFactoryWf(dataType)
139
+ const subExpression = atomicExpress.replace(fieldInfo, value)
140
+ const calculatorObj = new CalculatorWf(subExpression)
141
+ const result = calculatorObj.result
142
+ console.log('判断结果为:', result)
143
+ return result
144
+ }
145
+
146
+ function splitExpression(express) {
147
+ // const workflowAnd = /condition.operator.and/g
148
+ // const workflowOr = /condition.operator.or/g
149
+ const ASTERISK_REGEX = '\\*'
150
+ // const PARENTHESES_LEFT = /\(/g
151
+ // const PARENTHESES_RIGHT = /\)/g
152
+ const EMPTY_STRING = ''
153
+ express = express.replace(/condition.operator.and/g, ASTERISK_REGEX)
154
+ express = express.replace(/condition.operator.or/g, ASTERISK_REGEX)
155
+ express = express.replace(/\(/g, EMPTY_STRING)
156
+ express = express.replace(/\)/g, EMPTY_STRING)
157
+ return express.split(ASTERISK_REGEX)
158
+ }
159
+
160
+ function getValue(entity, feildName) {
161
+ const value = getEntityFieldValue(entity, feildName)
162
+ if (value === undefined || value == null) {
163
+ return ''
164
+ }
165
+ return value + ''
166
+ }
@@ -0,0 +1,305 @@
1
+ import * as Vue from 'vue'
2
+ /**
3
+ * 获得相对地址
4
+ */
5
+ export function getRelativeBaseUrl(originalBaseUrl) {
6
+ if (
7
+ window.$vueApp.config.globalProperties.projectModel === undefined ||
8
+ window.$vueApp.config.globalProperties.projectModel !== 'developing.model'
9
+ ) {
10
+ // 表示是产品模式,使用相对地址访问后台
11
+ let relativeUrl = getUrlPrefix(location.href)
12
+ window.sessionStorage.setItem('relativeUrl', relativeUrl)
13
+ // console.log('getRelativeBaseUrl--relativeUrl---originalBaseUrl=',relativeUrl,originalBaseUrl)
14
+ if (relativeUrl && originalBaseUrl) {
15
+ // console.log('getRelativeBaseUrl---originalBaseUrl=',originalBaseUrl)
16
+ let baseUrlSuffix = ''
17
+ const baseUrls = originalBaseUrl.split('/')
18
+ // console.log('getRelativeBaseUrl---baseUrls=',baseUrls)
19
+ if (baseUrls.length >= 3) {
20
+ const baseUrlPrefix = baseUrls[0] + '//' + baseUrls[2]
21
+ // console.log('getRelativeBaseUrl---baseUrlPrefix=',baseUrlPrefix)
22
+ baseUrlSuffix = originalBaseUrl.substring(
23
+ originalBaseUrl.indexOf(baseUrlPrefix) + baseUrlPrefix.length
24
+ )
25
+ // console.log('getRelativeBaseUrl---baseUrlSuffix=',baseUrlSuffix)
26
+ }
27
+ if (relativeUrl.lastIndexOf('/') === relativeUrl.length - 1) {
28
+ // 表示以“/”结尾,去掉最后一个“/”
29
+ relativeUrl = relativeUrl.substring(0, relativeUrl.lastIndexOf('/'))
30
+ }
31
+ // console.log('getRelativeBaseUrl---relativeUrl=',relativeUrl)
32
+ if (baseUrlSuffix) {
33
+ return relativeUrl + baseUrlSuffix
34
+ } else {
35
+ return relativeUrl
36
+ }
37
+ }
38
+ }
39
+ return originalBaseUrl
40
+ }
41
+
42
+ /**
43
+ * 获得url前缀,
44
+ * 例如地址栏地址为:http://localhost:8080/demo/#/
45
+ * 返回的应该是http://localhost:8080
46
+ */
47
+ function getUrlPrefix(url) {
48
+ // console.log('getUrlPrefix---url=',url)
49
+ const hrefs = url.split('#')
50
+ if (hrefs.length > 0) {
51
+ // 前端url,例如:http://localhost:8080/demo/
52
+ const frontUrl = hrefs[0]
53
+ let rootUrl = frontUrl
54
+ const frontUrls = frontUrl.split('/')
55
+ if (frontUrls.length >= 3) {
56
+ // 获得http://localhost:8080
57
+ rootUrl = frontUrls[0] + '//' + frontUrls[2] + '/'
58
+ }
59
+ // console.log('getUrlPrefix---rootUrl1=',rootUrl)
60
+ return rootUrl
61
+ }
62
+ }
63
+
64
+ /**
65
+ * 替换路径前缀,例如:http://localhost/demo/#/notice/task需要替换为http://127.0.0.1/demo/#/notice/task
66
+ * @param {*} originalUrl 原地址
67
+ * @param {*} locationUrl 地址栏的地址
68
+ */
69
+ export function replacePrefix(originalUrl) {
70
+ if (
71
+ window.$vueApp.config.globalProperties.projectModel === undefined ||
72
+ window.$vueApp.config.globalProperties.projectModel !== 'developing.model'
73
+ ) {
74
+ const locationUrl = location.href
75
+ let newUrl = originalUrl
76
+ // console.log('replacePrefix---originalUrl=',originalUrl)
77
+ const orginalPrefixUrl = getUrlPrefix(originalUrl)
78
+ // console.log('replacePrefix---orginalPrefixUrl=',orginalPrefixUrl)
79
+ let locationPrefixUrl = getUrlPrefix(locationUrl)
80
+ // console.log('replacePrefix---locationPrefixUrl=',locationPrefixUrl)
81
+ if (orginalPrefixUrl !== locationPrefixUrl) {
82
+ // 获得/demo/#/notice/task需要替换为http://127.0.0.1/demo/#/notice/task
83
+ let suffixUrl = originalUrl.substring(
84
+ originalUrl.indexOf(orginalPrefixUrl) + orginalPrefixUrl.length
85
+ )
86
+ if (suffixUrl.indexOf('/') !== 0) {
87
+ suffixUrl = '/' + suffixUrl
88
+ }
89
+ // console.log('replacePrefix---suffixUrl=',suffixUrl)
90
+ if (locationPrefixUrl.lastIndexOf('/') === locationPrefixUrl.length - 1) {
91
+ // 表示以“/”结尾,去掉最后一个“/”
92
+ locationPrefixUrl = locationPrefixUrl.substring(
93
+ 0,
94
+ locationPrefixUrl.lastIndexOf('/')
95
+ )
96
+ }
97
+ // console.log('replacePrefix---locationPrefixUrl2=',locationPrefixUrl)
98
+ newUrl = locationPrefixUrl + suffixUrl
99
+ }
100
+ // console.log('replacePrefix---newUrl=',newUrl)
101
+ return newUrl
102
+ }
103
+ return originalUrl
104
+ }
105
+
106
+ // 获得门户前端访问路径
107
+ function getPortalFrontendUrl() {
108
+ return window.$vueApp.config.globalProperties.$http.get(
109
+ window.$vueApp.config.globalProperties.baseAPI + '/api/portal-frontend-url'
110
+ )
111
+ }
112
+
113
+ // 获得登录页面地址
114
+ export function getLoginUrl() {
115
+ return new Promise((resolve, reject) => {
116
+ const href = window.location.href
117
+ let systemPath = href
118
+ let routerPath = ''
119
+ let param = ''
120
+ if (href.indexOf('#/') > 0 && href.indexOf('#/login') < 0) {
121
+ systemPath = href.substring(0, href.indexOf('#'))
122
+ const suffix = href.substring(href.indexOf('#') + 1)
123
+ routerPath = suffix
124
+ if (suffix.indexOf('?') > 0) {
125
+ // 如果包含参数,则需要截取参数
126
+ routerPath = suffix.substring(0, suffix.indexOf('?'))
127
+ param = suffix.substring(suffix.indexOf('?') + 1)
128
+ }
129
+ }
130
+ getPortalFrontendUrl()
131
+ .then((portalUrl) => {
132
+ let loginUrl =
133
+ portalUrl +
134
+ '#/login?systemPath=' +
135
+ systemPath +
136
+ '&routerPath=' +
137
+ routerPath
138
+ if (param) {
139
+ loginUrl += '&' + param
140
+ }
141
+ loginUrl = replacePrefix(loginUrl)
142
+ resolve(loginUrl)
143
+ })
144
+ .catch((error) => {
145
+ reject(error)
146
+ })
147
+ })
148
+ }
149
+
150
+ export function isShowMenuRoute() {
151
+ // 是否显示菜单路径,默认是不显示
152
+ let showMenuRoute = window.$vueApp.config.globalProperties.showMenuRoute
153
+ if (showMenuRoute === undefined) {
154
+ showMenuRoute = 'false'
155
+ }
156
+ return showMenuRoute === 'true'
157
+ }
158
+
159
+ export function isShowSystemMenu() {
160
+ // 左侧菜单最上方是否显示系统菜单,默认是不显示
161
+ let showSystemMenu = window.$vueApp.config.globalProperties.showSystemMenu
162
+ if (showSystemMenu === undefined) {
163
+ showSystemMenu = 'false'
164
+ }
165
+ return showSystemMenu === 'true'
166
+ }
167
+
168
+ export function getSystemFrontendUrl(frontendUrl) {
169
+ if (
170
+ window.$vueApp.config.globalProperties.projectModel &&
171
+ window.$vueApp.config.globalProperties.projectModel ===
172
+ 'developing.model' &&
173
+ window.$vueApp.config.globalProperties.frontUrl
174
+ ) {
175
+ return window.$vueApp.config.globalProperties.frontUrl
176
+ } else {
177
+ return getRelativeBaseUrl(frontendUrl)
178
+ }
179
+ }
180
+
181
+ export function getSystemBackendUrl(backendUrl) {
182
+ if (
183
+ window.$vueApp.config.globalProperties.projectModel &&
184
+ window.$vueApp.config.globalProperties.projectModel ===
185
+ 'developing.model' &&
186
+ window.$vueApp.config.globalProperties.baseURL
187
+ ) {
188
+ return window.$vueApp.config.globalProperties.baseURL
189
+ } else {
190
+ return getRelativeBaseUrl(backendUrl)
191
+ }
192
+ }
193
+ /**
194
+ * 是否是平台系统
195
+ * @param {*} systemCode
196
+ * @returns
197
+ */
198
+ export function isPlateSys(systemCode) {
199
+ if (
200
+ systemCode &&
201
+ (systemCode === 'iMatrix' ||
202
+ systemCode === 'portal' ||
203
+ systemCode === 'mms' ||
204
+ systemCode === 'task' ||
205
+ systemCode === 'wf' ||
206
+ systemCode === 'dc' ||
207
+ systemCode === 'mc' ||
208
+ systemCode === 'mobile' ||
209
+ systemCode === 'acs' ||
210
+ systemCode === 'bs')
211
+ ) {
212
+ return true
213
+ } else {
214
+ return false
215
+ }
216
+ }
217
+
218
+ export function getServerConfigUtil(http) {
219
+ return new Promise((resolve, reject) => {
220
+ http.get('./server-config.json').then((result) => {
221
+ const config = result
222
+ for (const key in config) {
223
+ window.$vueApp.config.globalProperties[key] = config[key]
224
+ }
225
+ window.$vueApp.config.globalProperties.baseURL = getRelativeBaseUrl(
226
+ window.$vueApp.config.globalProperties.baseURL
227
+ )
228
+ window.$vueApp.config.globalProperties.baseAPI = getRelativeBaseUrl(
229
+ window.$vueApp.config.globalProperties.baseAPI
230
+ )
231
+ resolve()
232
+ })
233
+ })
234
+ }
235
+ /**
236
+ * postmessage跨域传message时获得orign路径使用
237
+ * @returns orign路径
238
+ */
239
+ export function getOrignUrl() {
240
+ const url = window.location.href
241
+ let orignUrl
242
+ if (url && url.indexOf('/') > 0) {
243
+ const urls = url.split('/')
244
+ orignUrl = urls[0] + '//' + urls[2]
245
+ }
246
+ return orignUrl
247
+ }
248
+
249
+ export function isPromise(p) {
250
+ return p && Object.prototype.toString.call(p) === '[object Promise]'
251
+ }
252
+ /**
253
+ * 获得UTC时区
254
+ * @returns 时区
255
+ */
256
+ export function getTimeZone() {
257
+ const dateStr = new Date() + ''
258
+ let timeZone = ''
259
+ if (dateStr.indexOf('GMT') > 0) {
260
+ const timeZoneSuffix = dateStr
261
+ .substring(dateStr.indexOf('GMT') + 3, dateStr.indexOf('('))
262
+ .trim()
263
+ const partPrefix = timeZoneSuffix.substring(0, timeZoneSuffix.length - 2)
264
+ const partSuffix = timeZoneSuffix.substring(timeZoneSuffix.length - 2)
265
+ timeZone = 'UTC' + partPrefix + ':' + partSuffix
266
+ } else if (dateStr.indexOf('UTC') > 0) {
267
+ timeZone =
268
+ 'UTC' +
269
+ dateStr.substring(dateStr.indexOf('UTC') + 3, dateStr.indexOf('(')).trim()
270
+ }
271
+ return timeZone
272
+ }
273
+
274
+ export function setCustomSystemBackendUrl(customSystem) {
275
+ // 重新缓存系统后台路径
276
+ if (
277
+ !window.$vueApp.config.globalProperties.projectModel ||
278
+ window.$vueApp.config.globalProperties.projectModel !== 'developing.model'
279
+ ) {
280
+ // 表示是生产环境时,需要根据数据库配置获得对应的后端地址
281
+ const backendUrl = window.$authApi.getSystemCacheUrlByCode(customSystem)
282
+ if (backendUrl) {
283
+ window.$vueApp.config.globalProperties.baseURL =
284
+ getRelativeBaseUrl(backendUrl)
285
+ }
286
+ }
287
+ }
288
+
289
+ export function pushCustomControlValidatorRef(pageCode, refName, ref) {
290
+ console.log('pushCustomControlValidatorRef----', pageCode, refName, ref)
291
+ if (!window.customValidatorRef) {
292
+ window.customValidatorRef = new Map()
293
+ }
294
+ let pageCustomControlRef = window.customValidatorRef.get(pageCode)
295
+ if (!pageCustomControlRef) {
296
+ pageCustomControlRef = new Map()
297
+ window.customValidatorRef.set(pageCode, pageCustomControlRef)
298
+ }
299
+ pageCustomControlRef.set(refName, ref)
300
+ }
301
+
302
+ export function removeCustomControlValidatorRef(pageCode, refName) {
303
+ const pageCustomControlRef = window.customValidatorRef.get(pageCode)
304
+ pageCustomControlRef.delete(refName)
305
+ }
@@ -0,0 +1,2 @@
1
+ import * as Vue from 'vue'
2
+ export default {}
@@ -0,0 +1,28 @@
1
+ import * as Vue from 'vue'
2
+
3
+ export function getRedisButtonGeneralIcon(buttonCode) {
4
+ let buttonIcon = ''
5
+ const buttonIcons = window.sessionStorage.getItem('button-icon')
6
+ if (buttonIcons && buttonIcons !== undefined && buttonIcons !== 'undefined') {
7
+ const buttonIconMap = JSON.parse(buttonIcons)
8
+ buttonIcon = buttonIconMap[buttonCode]
9
+ }
10
+ return buttonIcon
11
+ }
12
+
13
+ export function findRedisButtonGeneralIcon() {
14
+ return new Promise((resolve, reject) => {
15
+ window.$vueApp.config.globalProperties.$http
16
+ .get(
17
+ window.$vueApp.config.globalProperties.baseAPI +
18
+ '/component/general-icon/find-redis-button-icon'
19
+ )
20
+ .then((data) => {
21
+ window.sessionStorage.setItem('button-icon', JSON.stringify(data))
22
+ resolve(data)
23
+ })
24
+ .catch((error) => {
25
+ reject(error)
26
+ })
27
+ })
28
+ }
@@ -1,86 +1,102 @@
1
- /**
2
- * Created by jiachenpan on 16/11/18.
3
- */
4
-
5
- export function parseTime(time, cFormat) {
6
- if (arguments.length === 0) {
7
- return null
8
- }
9
- const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
10
- let date
11
- if (typeof time === 'object') {
12
- date = time
13
- } else {
14
- if (('' + time).length === 10) time = parseInt(time) * 1000
15
- date = new Date(time)
16
- }
17
- const formatObj = {
18
- y: date.getFullYear(),
19
- m: date.getMonth() + 1,
20
- d: date.getDate(),
21
- h: date.getHours(),
22
- i: date.getMinutes(),
23
- s: date.getSeconds(),
24
- a: date.getDay()
25
- }
26
- const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
27
- let value = formatObj[key]
28
- // Note: getDay() returns 0 on Sunday
29
- if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
30
- if (result.length > 0 && value < 10) {
31
- value = '0' + value
32
- }
33
- return value || 0
34
- })
35
- return time_str
36
- }
37
-
38
- export function formatTime(time, option) {
39
- if (('' + time).length === 10) {
40
- time = parseInt(time) * 1000
41
- } else {
42
- time = +time
43
- }
44
- const d = new Date(time)
45
- const now = Date.now()
46
-
47
- const diff = (now - d) / 1000
48
-
49
- if (diff < 30) {
50
- return '刚刚'
51
- } else if (diff < 3600) {
52
- // less 1 hour
53
- return Math.ceil(diff / 60) + '分钟前'
54
- } else if (diff < 3600 * 24) {
55
- return Math.ceil(diff / 3600) + '小时前'
56
- } else if (diff < 3600 * 24 * 2) {
57
- return '1天前'
58
- }
59
- if (option) {
60
- return parseTime(time, option)
61
- } else {
62
- return (
63
- d.getMonth() +
64
- 1 +
65
- '月' +
66
- d.getDate() +
67
- '' +
68
- d.getHours() +
69
- '' +
70
- d.getMinutes() +
71
- ''
72
- )
73
- }
74
- }
75
-
76
- export function isExternal(path) {
77
- return /^(https?:|mailto:|tel:)/.test(path)
78
- }
79
-
80
- export function getStore() {
81
- return window.Vue.$store
82
- }
83
-
84
- export function getRouter() {
85
- return window.Vue.$router
86
- }
1
+ /**
2
+ * Created by jiachenpan on 16/11/18.
3
+ */
4
+
5
+ export function parseTime(time, cFormat) {
6
+ if (arguments.length === 0) {
7
+ return null
8
+ }
9
+ const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
10
+ let date
11
+ if (typeof time === 'object') {
12
+ date = time
13
+ } else {
14
+ if (('' + time).length === 10) time = parseInt(time) * 1000
15
+ date = new Date(time)
16
+ }
17
+ const formatObj = {
18
+ y: date.getFullYear(),
19
+ m: date.getMonth() + 1,
20
+ d: date.getDate(),
21
+ h: date.getHours(),
22
+ i: date.getMinutes(),
23
+ s: date.getSeconds(),
24
+ a: date.getDay(),
25
+ }
26
+ const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
27
+ let value = formatObj[key]
28
+ // Note: getDay() returns 0 on Sunday
29
+ if (key === 'a') {
30
+ return ['日', '一', '二', '三', '四', '五', '六'][value]
31
+ }
32
+ if (result.length > 0 && value < 10) {
33
+ value = '0' + value
34
+ }
35
+ return value || 0
36
+ })
37
+ return time_str
38
+ }
39
+
40
+ export function formatTime(time, option) {
41
+ if (('' + time).length === 10) {
42
+ time = parseInt(time) * 1000
43
+ } else {
44
+ time = +time
45
+ }
46
+ const d = new Date(time)
47
+ const now = Date.now()
48
+
49
+ const diff = (now - d) / 1000
50
+
51
+ if (diff < 30) {
52
+ return '刚刚'
53
+ } else if (diff < 3600) {
54
+ // less 1 hour
55
+ return Math.ceil(diff / 60) + '分钟前'
56
+ } else if (diff < 3600 * 24) {
57
+ return Math.ceil(diff / 3600) + '小时前'
58
+ } else if (diff < 3600 * 24 * 2) {
59
+ return '1天前'
60
+ }
61
+ if (option) {
62
+ return parseTime(time, option)
63
+ } else {
64
+ return (
65
+ d.getMonth() +
66
+ 1 +
67
+ '' +
68
+ d.getDate() +
69
+ '' +
70
+ d.getHours() +
71
+ '' +
72
+ d.getMinutes() +
73
+ '分'
74
+ )
75
+ }
76
+ }
77
+
78
+ export function isExternal(path) {
79
+ return /^(https?:|mailto:|tel:)/.test(path)
80
+ }
81
+
82
+ export function getStore() {
83
+ return window.Vue.$store
84
+ }
85
+
86
+ export function getRouter() {
87
+ return window.Vue.$router
88
+ }
89
+
90
+ export function utf8ToB64(str) {
91
+ return window.btoa(unescape(encodeURIComponent(str)))
92
+ }
93
+
94
+ export function b64ToUtf8(str) {
95
+ return decodeURIComponent(escape(window.atob(str)))
96
+ }
97
+
98
+ export function getLoginName(jwt) {
99
+ const payload = jwt.split('.')[1]
100
+ const result = b64ToUtf8(payload)
101
+ return JSON.parse(result).sub
102
+ }