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.
- package/.vscode/extensions.json +3 -0
- package/README.md +7 -0
- package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
- package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
- package/components/dynamic-source-select/events.js +77 -0
- package/components/fs-preview/fs-preview.vue +287 -0
- package/components/index.js +26 -0
- package/components/plugins/export-data-new.js +623 -0
- package/components/plugins/export-data.js +431 -0
- package/components/plugins/index.js +15 -0
- package/components/plugins/public-method.js +47 -0
- package/components/rich-editor/index-bak.vue +306 -0
- package/components/rich-editor/index.vue +236 -0
- package/components/rich-editor/langs/zh-Hans.js +438 -0
- package/components/rich-editor/viewer.vue +105 -0
- package/components/super-grid/apis.js +1065 -0
- package/components/super-grid/columns-config.vue +430 -0
- package/components/super-grid/custom-formatter.js +330 -0
- package/components/super-grid/dynamic-input.vue +1706 -0
- package/components/super-grid/eventBus.js +2 -0
- package/components/super-grid/events.js +56 -0
- package/components/super-grid/formValidatorUtil.js +300 -0
- package/components/super-grid/formatter.js +190 -0
- package/components/super-grid/group-column.vue +100 -0
- package/components/super-grid/header-context-menu.vue +82 -0
- package/components/super-grid/index-column.vue +69 -0
- package/components/super-grid/normal-column.vue +1148 -0
- package/components/super-grid/public-methods.js +30 -0
- package/components/super-grid/row-operation.vue +193 -0
- package/components/super-grid/search-button.vue +74 -0
- package/components/super-grid/search-condition-input.vue +73 -0
- package/components/super-grid/search-condition-list.vue +68 -0
- package/components/super-grid/search-form-advancedQuery.vue +820 -0
- package/components/super-grid/search-form-dialog.vue +77 -0
- package/components/super-grid/search-form-item.vue +470 -0
- package/components/super-grid/search-form-number.vue +111 -0
- package/components/super-grid/search-form-open.vue +178 -0
- package/components/super-grid/search-form-ordinarySearch.vue +218 -0
- package/components/super-grid/search-form.vue +756 -0
- package/components/super-grid/search-methods.js +484 -0
- package/components/super-grid/selection-column.vue +46 -0
- package/components/super-grid/store.js +3 -0
- package/components/super-grid/super-grid-service.js +682 -0
- package/components/super-grid/super-grid.vue +2893 -0
- package/components/super-grid/utils.js +851 -0
- package/components/super-grid/view-image-dialog.vue +173 -0
- package/components/utils/gogocodeTransfer.js +59 -0
- package/components/utils/utils.js +180 -0
- package/components/utils/value-set.js +98 -0
- package/components/z-test-utton/index.vue +82 -0
- package/package.json +29 -40
- package/public/index.html +13 -0
- package/public/vite.svg +1 -0
- package/src/api/sso-service.js +172 -19
- package/src/api/tab.js +36 -0
- package/src/api/user-service.js +11 -11
- package/src/assets/401/401.gif +0 -0
- package/src/assets/404/404-cloud.png +0 -0
- package/src/assets/404/404.png +0 -0
- package/src/assets/cloud.png +0 -0
- package/src/directives/permission/index.js +13 -13
- package/src/directives/permission/permission.js +20 -15
- package/src/i18n/i18n.js +16 -0
- package/src/i18n/langs/cn.js +254 -0
- package/src/i18n/langs/en.js +264 -0
- package/src/permission.js +157 -71
- package/src/plugins.js +18 -18
- package/src/router/index.js +96 -69
- package/src/store/getters.js +15 -10
- package/src/store/index.js +19 -19
- package/src/store/modules/app.js +54 -42
- package/src/store/modules/permission.js +137 -73
- package/src/store/modules/tab-content.js +36 -0
- package/src/store/modules/user.js +293 -80
- package/src/styles/display-layout.scss +34 -0
- package/src/styles/element-ui.scss +29 -29
- package/src/styles/index.scss +157 -78
- package/src/styles/mixin.scss +27 -27
- package/src/styles/theme/black/font-style.scss +70 -0
- package/src/styles/theme/black/index.scss +306 -0
- package/src/styles/theme/black/sidebar.scss +189 -0
- package/src/styles/theme/blue/font-style.scss +46 -0
- package/src/styles/theme/blue/index.scss +172 -0
- package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
- package/src/styles/theme/blue2/font-style.scss +70 -0
- package/src/styles/theme/blue2/index.scss +188 -0
- package/src/styles/theme/blue2/sidebar.scss +201 -0
- package/src/styles/theme/dark-blue/button.scss +9 -0
- package/src/styles/theme/dark-blue/card.scss +62 -0
- package/src/styles/theme/dark-blue/checkbox.scss +10 -0
- package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
- package/src/styles/theme/dark-blue/dialog.scss +21 -0
- package/src/styles/theme/dark-blue/element-variables.scss +7 -0
- package/src/styles/theme/dark-blue/font.scss +71 -0
- package/src/styles/theme/dark-blue/form.scss +51 -0
- package/src/styles/theme/dark-blue/index.scss +269 -0
- package/src/styles/theme/dark-blue/input.scss +15 -0
- package/src/styles/theme/dark-blue/message.scss +8 -0
- package/src/styles/theme/dark-blue/pagination.scss +14 -0
- package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
- package/src/styles/theme/dark-blue/sidebar.scss +266 -0
- package/src/styles/theme/dark-blue/tab.scss +83 -0
- package/src/styles/theme/dark-blue/table.scss +60 -0
- package/src/styles/theme/dark-blue/tree.scss +31 -0
- package/src/styles/theme/dark-blue/var.scss +1028 -0
- package/src/styles/theme/gray/card-style.scss +54 -0
- package/src/styles/theme/gray/font-style.scss +70 -0
- package/src/styles/theme/gray/index.scss +172 -0
- package/src/styles/theme/gray/input-style.scss +19 -0
- package/src/styles/theme/gray/scrollbar-style.scss +32 -0
- package/src/styles/theme/gray/sidebar.scss +231 -0
- package/src/styles/theme/gray/tab-style.scss +81 -0
- package/src/styles/transition.scss +47 -46
- package/src/utils/auth-api.js +159 -0
- package/src/utils/auth.js +61 -15
- package/src/utils/calculator/calculator-factory-wf.js +558 -0
- package/src/utils/calculator/calculator-factory.js +145 -0
- package/src/utils/calculator/calculator-util.js +166 -0
- package/src/utils/common-util.js +305 -0
- package/src/utils/eventBus.js +2 -0
- package/src/utils/iconUtils.js +28 -0
- package/src/utils/index.js +102 -86
- package/src/utils/jump-page-utils.js +814 -0
- package/src/utils/local-storage.js +33 -31
- package/src/utils/menu.js +19 -0
- package/src/utils/permission.js +31 -26
- package/src/utils/permissionAuth.js +90 -0
- package/src/utils/range-selector.js +188 -0
- package/src/utils/request.js +270 -116
- package/src/utils/restful-interface-utils.js +57 -0
- package/src/utils/util.js +698 -0
- package/src/utils/validate.js +34 -33
- package/src/utils/watermark.js +108 -0
- package/src/utils/workflow-util.js +93 -0
- package/src/views/404.vue +248 -228
- package/src/views/dsc-component/Sidebar/Item.vue +84 -0
- package/src/views/dsc-component/Sidebar/Link.vue +38 -0
- package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
- package/src/views/dsc-component/Sidebar/index.vue +220 -0
- package/src/views/dsc-component/tabs/tab-content.vue +199 -0
- package/src/views/error-page/401.vue +106 -91
- package/src/views/error-page/404.vue +248 -228
- package/src/views/layout/EmptyLayout.vue +3 -0
- package/src/views/layout/Layout.vue +81 -68
- package/src/views/layout/NewLayout.vue +18 -0
- package/src/views/layout/components/AppMain.vue +39 -29
- package/src/views/layout/components/Breadcrumb/index.vue +156 -0
- package/src/views/layout/components/Menubar/Item.vue +57 -0
- package/src/views/layout/components/Menubar/Link.vue +38 -0
- package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
- package/src/views/layout/components/Menubar/index.vue +210 -0
- package/src/views/layout/components/Sidebar/Item.vue +53 -29
- package/src/views/layout/components/Sidebar/Link.vue +38 -39
- package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
- package/src/views/layout/components/Sidebar/index.vue +141 -48
- package/src/views/layout/components/iframe-page.vue +38 -0
- package/src/views/layout/components/index.js +4 -3
- package/src/views/layout/components/tabs/tab-content.vue +207 -0
- package/src/views/layout/mixin/ResizeHandler.js +41 -41
- package/src/views/layout/tab-content-iframe-index.vue +38 -0
- package/src/views/layout/tab-content-index.vue +93 -0
- package/src/views/login/authredirect.vue +10 -10
- package/src/views/login/index.vue +296 -203
- package/src/views/login/update-password.vue +243 -0
- package/src/views/redirect/index.vue +14 -12
- package/src/views/wf-history/tache-subprocess-history.vue +45 -0
- package/vite.config.js +31 -0
- package/lib/super-ui.css +0 -1
- package/lib/super-ui.umd.min.js +0 -2
- package/src/styles/variables.scss +0 -4
- 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,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
|
+
}
|
package/src/utils/index.js
CHANGED
|
@@ -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') {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
time =
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return Math.ceil(diff /
|
|
56
|
-
} else if (diff < 3600 * 24
|
|
57
|
-
return '
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
'
|
|
68
|
-
d.
|
|
69
|
-
'
|
|
70
|
-
d.
|
|
71
|
-
'
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
+
}
|