imatrix-ui 2.8.2-tmp1 → 2.8.2-tmp2

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.
@@ -202,3 +202,24 @@ export function getOrignUrl() {
202
202
  }
203
203
  return orignUrl
204
204
  }
205
+
206
+ export function isPromise(p) {
207
+ return p && Object.prototype.toString.call(p) === '[object Promise]'
208
+ }
209
+ /**
210
+ * 获得UTC时区
211
+ * @returns 时区
212
+ */
213
+ export function getTimeZone() {
214
+ const dateStr = new Date() + ''
215
+ let timeZone = ''
216
+ if (dateStr.indexOf('GMT') > 0) {
217
+ const timeZoneSuffix = dateStr.substring(dateStr.indexOf('GMT') + 3, dateStr.indexOf('(')).trim()
218
+ const partPrefix = timeZoneSuffix.substring(0, timeZoneSuffix.length - 2)
219
+ const partSuffix = timeZoneSuffix.substring(timeZoneSuffix.length - 2)
220
+ timeZone = 'UTC' + partPrefix + ':' + partSuffix
221
+ } else if (dateStr.indexOf('UTC') > 0) {
222
+ timeZone = 'UTC' + dateStr.substring(dateStr.indexOf('UTC') + 3, dateStr.indexOf('(')).trim()
223
+ }
224
+ return timeZone
225
+ }
@@ -243,7 +243,8 @@ function jumpToPageTwo(jumpPageSetting, system, dataId, ids, buttonCode, isHasId
243
243
  const frontendUrl = getSystemFrontendUrl(system.frontendUrl)
244
244
  path = frontendUrl + '/#' + path
245
245
  }
246
- jumpToPageWithFullPath(dataId, path, additionalParameterStr, jumpPageSetting, ids, buttonCode, isHasIdParam)
246
+ const systemName = getSystemNameWithLanguage(system)
247
+ jumpToPageWithFullPath(dataId, path, additionalParameterStr, jumpPageSetting, ids, buttonCode, isHasIdParam, systemName)
247
248
  resolve()
248
249
  }
249
250
  })
@@ -255,16 +256,20 @@ function jumpToPageTwo(jumpPageSetting, system, dataId, ids, buttonCode, isHasId
255
256
  * @param {*} additionalParameterStr
256
257
  * @param {*} jumpPage
257
258
  */
258
- function jumpToPageWithFullPath(dataId, path, additionalParameterStr, jumpPage, ids, buttonCode, isHasIdParam) {
259
+ function jumpToPageWithFullPath(dataId, path, additionalParameterStr, jumpPage, ids, buttonCode, isHasIdParam, systemName) {
259
260
  path = packagePathParams(dataId, path, jumpPage, ids, buttonCode, isHasIdParam)
260
261
  // 保持这种情况参数传递,是为了解决不同域时获得不到sessionStorage中存的附加参数问题
261
262
  if (additionalParameterStr && additionalParameterStr !== '') {
263
+ let systemNameParam = ''
264
+ if (systemName) {
265
+ systemNameParam = '&_systemName_=' + encodeURI(systemName)
266
+ }
262
267
  if (path.indexOf('?') !== -1) {
263
268
  path += '&'
264
- path += additionalParameterStr
269
+ path += additionalParameterStr + systemNameParam
265
270
  } else {
266
271
  path += '?'
267
- path += additionalParameterStr
272
+ path += additionalParameterStr + systemNameParam
268
273
  }
269
274
  }
270
275
  let jumpMode = 'refresh'
@@ -448,10 +453,28 @@ function openDialogWhenPopup(jumpPageSetting, system, pageCode, dataId, jumpMode
448
453
 
449
454
  function packageOpenUrl(system, pageCode, dataId, jumpPageSetting, jumpMode, ids, buttonCode, isHasIdParam) {
450
455
  const frontendUrl = getSystemFrontendUrl(system.frontendUrl)
451
- const path = frontendUrl + '/#/dsc-full-screen/page?customSystem=' + system.code + '&pageCode=' + pageCode + '&jumpMode=' + jumpMode
456
+ let path = frontendUrl + '/#/dsc-full-screen/page?customSystem=' + system.code + '&pageCode=' + pageCode + '&jumpMode=' + jumpMode
457
+ const systemName = getSystemNameWithLanguage(system)
458
+ if (systemName) {
459
+ path += '&_systemName_=' + encodeURI(systemName)
460
+ }
452
461
  return packagePathParams(dataId, path, jumpPageSetting, ids, buttonCode, isHasIdParam)
453
462
  }
454
463
 
464
+ function getSystemNameWithLanguage(system) {
465
+ if (system) {
466
+ let locale = 'cn'
467
+ if (window.$locale) {
468
+ locale = window.$locale
469
+ }
470
+ if (locale === 'cn') {
471
+ return system.name
472
+ } else {
473
+ return system.enName
474
+ }
475
+ }
476
+ }
477
+
455
478
  // 解析跳转页面附带参数
456
479
  function analysisAdditionalParameter(paramStoreId) {
457
480
  const additionalParamMap = sessionStorage.getItem(paramStoreId)
@@ -18,15 +18,19 @@ export function getSystemCode() {
18
18
  }
19
19
 
20
20
  export function getPermissions() {
21
+ const a = new Date().getTime()
21
22
  const systemCode = getSystemCode()
22
23
  const permissions = sessionStorage.getItem(permissionKey + systemCode)
23
24
  if (permissions) {
24
25
  return JSON.parse(permissions)
25
26
  }
27
+ const b = new Date().getTime()
28
+ sessionStorage.setItem('====getPermissions===>'+new Date().getTime()+'-执行时间=',(b-a)+'')
26
29
  return null
27
30
  }
28
31
 
29
32
  export function setPermissions(permissions) {
33
+ const a = new Date().getTime()
30
34
  const systemCode = getSystemCode()
31
35
  const permissionObjs = {}
32
36
  for (let i = 0; i < permissions.length; i++) {
@@ -34,6 +38,8 @@ export function setPermissions(permissions) {
34
38
  permissionObjs[permission] = true
35
39
  }
36
40
  sessionStorage.setItem(permissionKey + systemCode, JSON.stringify(permissionObjs))
41
+ const b = new Date().getTime()
42
+ sessionStorage.setItem('====setPermissions===>'+new Date().getTime()+'-执行时间=',(b-a)+'')
37
43
  return permissionObjs
38
44
  }
39
45
 
@@ -13,7 +13,8 @@ import {
13
13
  getI18n
14
14
  } from './util'
15
15
  import {
16
- getRelativeBaseUrl
16
+ getRelativeBaseUrl,
17
+ getTimeZone
17
18
  } from './common-util'
18
19
  // 创建axios实例
19
20
  const service = axios.create({
@@ -27,6 +28,8 @@ service.interceptors.request.use(
27
28
  config => {
28
29
  // 防止重复发送ajax请求
29
30
  store.commit('togglePreventReclick', true)
31
+ const timeZone = getTimeZone()
32
+ config.headers['timeZone'] = timeZone
30
33
  const token = getToken()
31
34
  if (token) {
32
35
  config.headers['Authorization'] = token // 让每个请求携带自定义token 请根据实际情况自行修改
@@ -128,6 +131,15 @@ service.interceptors.response.use(
128
131
  })
129
132
  return Promise.reject(error)
130
133
  }
134
+ } else {
135
+ const errorMsg = getI18n().t('imatrixUIMessage.internalServerError')
136
+ Message({
137
+ showClose: true,
138
+ message: errorMsg,
139
+ type: 'error',
140
+ duration: 5 * 1000
141
+ })
142
+ return Promise.reject(error)
131
143
  }
132
144
  }
133
145
  )