imatrix-ui 2.9.8-pv2 → 2.9.8-pv4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imatrix-ui",
3
- "version": "2.9.8-pv2",
3
+ "version": "2.9.8-pv4",
4
4
  "description": "前端组件库:表格、表单、组织结构树等",
5
5
  "main": "lib/super-ui.umd.min.js",
6
6
  "private": false,
@@ -50,20 +50,25 @@ const dynamicSourceSelectService = {
50
50
  }
51
51
 
52
52
  return new Promise((resolve, reject) => {
53
- this.$http.post(backendUrl + '/common/dynamic-data-source/' + dynamicSourceCode, params).then(result => {
54
- if (result.backendUrl) {
55
- // result.backendUrl表示需要使用动态数据源所属的系统路径重新获得一次数据
56
- this.$http.post(result.backendUrl + '/common/dynamic-data-source/' + dynamicSourceCode, params).then(finallyResult => {
57
- resolve(finallyResult)
58
- }).catch(error => {
59
- reject(error)
60
- })
61
- } else {
62
- resolve(result)
63
- }
64
- }).catch(error => {
65
- reject(error)
66
- })
53
+ // 页面设计不请求动态数据源
54
+ if (Vue.prototype.systemCode !== undefined && Vue.prototype.systemCode === 'iMatrix') {
55
+ resolve()
56
+ } else {
57
+ this.$http.post(backendUrl + '/common/dynamic-data-source/' + dynamicSourceCode, params).then(result => {
58
+ if (result.backendUrl) {
59
+ // result.backendUrl表示需要使用动态数据源所属的系统路径重新获得一次数据
60
+ this.$http.post(result.backendUrl + '/common/dynamic-data-source/' + dynamicSourceCode, params).then(finallyResult => {
61
+ resolve(finallyResult)
62
+ }).catch(error => {
63
+ reject(error)
64
+ })
65
+ } else {
66
+ resolve(result)
67
+ }
68
+ }).catch(error => {
69
+ reject(error)
70
+ })
71
+ }
67
72
  })
68
73
  }
69
74
  }
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable no-undef */
2
- import Vue from 'vue'
3
2
  import Sortable from 'sortablejs'
4
- import store from './store'
3
+ import Vue from 'vue'
5
4
  import {
6
5
  packageEnumAndBeanColumnValueSets
7
6
  } from '../../utils/value-set'
7
+ import store from './store'
8
8
  import {
9
9
  isHasOptionFunction
10
10
  } from './utils'
@@ -27,7 +27,7 @@ const superGridService = {
27
27
  this.fetchData(null, null, null, null)
28
28
  resolve()
29
29
  } else {
30
- const url = Vue.prototype.baseAPI + '/component/super-grids/' + this.code
30
+ const url = Vue.prototype.baseAPI + '/component/super-grids/' + this.code + '/' + this.publishVersion
31
31
  const param = {}
32
32
  const isSqlSetting = this.options.isSql
33
33
  if (this.options && typeof (isSqlSetting) !== 'undefined') {
@@ -268,13 +268,13 @@ const superGridService = {
268
268
  const watchParentAttrs = dynamicColumnInfo.watchParentAttr.split(',')
269
269
  watchParentAttrs.forEach(watchParentAttr => {
270
270
  if (watchParentAttr) {
271
- // 存储属性对应的值
271
+ // 存储属性对应的值
272
272
  if (!param.watchParentAttrValues) {
273
273
  param.watchParentAttrValues = {}
274
274
  }
275
275
  param.watchParentAttrValues[watchParentAttr] = this.parentFormData[watchParentAttr]
276
- const unWatch = this.$watch('parentFormData.' + watchParentAttr, function(newValue, oldValue) {
277
- // 重新加载表格及表格数据
276
+ const unWatch = this.$watch('parentFormData.' + watchParentAttr, function (newValue, oldValue) {
277
+ // 重新加载表格及表格数据
278
278
  if (!gridParams.dynamicTemp) {
279
279
  gridParams.dynamicTemp = {}
280
280
  }
@@ -284,7 +284,7 @@ const superGridService = {
284
284
  }
285
285
  gridParams.dynamicTemp.watchParentAttrValues[watchParentAttr] = newValue
286
286
  if (this.$refs && this.$refs.superGrid) {
287
- // 手动注销watch,否则会调用多次watch
287
+ // 手动注销watch,否则会调用多次watch
288
288
  unWatch()
289
289
  // 重新加载表格及表格数据
290
290
  this.$emit('reload-grid')
@@ -279,6 +279,10 @@ export default {
279
279
  return {}
280
280
  }
281
281
  },
282
+ publishVersion: {
283
+ type: Number,
284
+ default: 0
285
+ },
282
286
  // 为了兼容平台的旧写法,暂不删除以下属性
283
287
  // 操作列、占位符列内容显示的函数,格式为:{'属性名':方法},例如:{'name':viewUser,'operation':showOperation}
284
288
  customFormatter: {
@@ -1346,51 +1350,86 @@ export default {
1346
1350
  gridParams.options.subTableData &&
1347
1351
  gridParams.options.subTableData.length > 0
1348
1352
  ) {
1349
- this.hasLoadData = false
1350
- gridParams.loaded = true
1351
- let subTableData = []
1352
- // 如果有子表数据,则展示传递的子表数据
1353
- if (isHasOptionFunction('gridDataLoaded', this.code)) {
1354
- const gridData = gridParams.options.gridDataLoaded.call(this, {
1355
- gridData: gridParams.options.subTableData,
1356
- columns: gridParams.columns
1357
- })
1358
- if (gridData) {
1359
- subTableData = gridData
1360
- this.hasLoadData = true
1361
- } else {
1362
- subTableData = gridParams.options.subTableData
1363
- this.hasLoadData = true
1364
- }
1353
+ this.packageSubTableData(gridParams, gridParams.options.subTableData)
1354
+ } else {
1355
+ const isCanRefreshTableData = this.canRefreshTableData(gridParams)
1356
+ if (isCanRefreshTableData) {
1357
+ // 可以刷新表格记录
1358
+ return this.fetchListData(searchParam, isSearch, parentRowIds, resove)
1365
1359
  } else {
1366
- subTableData = gridParams.options.subTableData
1360
+ // 子表无记录时不需要刷新子表记录。表示是新建或修改时子表无记录,且不需要刷新子表。
1361
+ if (
1362
+ this.isSubTableEmpty(gridParams)
1363
+ ) {
1364
+ // 表示是新建表单时,子表记录集合是空数组
1365
+ console.log('子表无记录----code=', this.code, gridParams)
1366
+ const subTableData = []
1367
+ this.packageSubTableData(gridParams, subTableData)
1368
+ }
1367
1369
  this.hasLoadData = true
1370
+ gridParams.loaded = true
1368
1371
  }
1369
- if (subTableData) {
1370
- // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1371
- subTableData.forEach(item => {
1372
- this.setColumnsDefaultValue(gridParams.allColumns, item)
1373
- })
1374
- }
1375
- if (this.pagination && this.isSubTableShowPage === true) {
1376
- // 表示子表需要显示分页
1377
- this.subTableData = subTableData
1378
- // 更新记录总条数
1379
- this.pagination.total = this.subTableData.length
1380
- gridParams.subTableData = this.subTableData
1381
- this.gridData = this.getSubTableGridData(this.subTableData)
1382
- } else {
1383
- this.gridData = subTableData
1384
- }
1385
- gridParams.gridData = this.gridData
1386
- // 完成深拷贝,复制一份对象,行编辑时使用
1387
- gridParams.orgGridData = [].concat(
1388
- JSON.parse(JSON.stringify(this.gridData))
1389
- )
1372
+ }
1373
+ }
1374
+ },
1375
+ isSubTableEmpty(gridParams) {
1376
+ return gridParams.options && gridParams.options.isFormSubTable &&
1377
+ ((gridParams.options.subTableData === undefined || gridParams.options.subTableData === null) ||
1378
+ gridParams.options.subTableData.length === 0)
1379
+ },
1380
+ packageSubTableData(gridParams, initSubTableData) {
1381
+ this.hasLoadData = false
1382
+ gridParams.loaded = true
1383
+ let subTableData = []
1384
+ // 如果有子表数据,则展示传递的子表数据
1385
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1386
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
1387
+ gridData: initSubTableData,
1388
+ columns: gridParams.columns
1389
+ })
1390
+ if (gridData) {
1391
+ subTableData = gridData
1392
+ this.hasLoadData = true
1390
1393
  } else {
1391
- return this.fetchListData(searchParam, isSearch, parentRowIds, resove)
1394
+ subTableData = initSubTableData
1395
+ this.hasLoadData = true
1392
1396
  }
1397
+ } else {
1398
+ subTableData = initSubTableData
1399
+ this.hasLoadData = true
1400
+ }
1401
+ if (subTableData) {
1402
+ // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1403
+ subTableData.forEach(item => {
1404
+ this.setColumnsDefaultValue(gridParams.allColumns, item)
1405
+ })
1406
+ }
1407
+ if (this.pagination && this.isSubTableShowPage === true) {
1408
+ // 表示子表需要显示分页
1409
+ this.subTableData = subTableData
1410
+ // 更新记录总条数
1411
+ this.pagination.total = this.subTableData.length
1412
+ gridParams.subTableData = this.subTableData
1413
+ this.gridData = this.getSubTableGridData(this.subTableData)
1414
+ } else {
1415
+ this.gridData = subTableData
1416
+ }
1417
+ gridParams.gridData = this.gridData
1418
+ // 完成深拷贝,复制一份对象,行编辑时使用
1419
+ gridParams.orgGridData = [].concat(
1420
+ JSON.parse(JSON.stringify(this.gridData))
1421
+ )
1422
+ },
1423
+ canRefreshTableData(gridParams) {
1424
+ let isCanRefreshTableData = false
1425
+ if (gridParams.options && !gridParams.options.isFormSubTable) {
1426
+ // 如果不是子表时
1427
+ isCanRefreshTableData = true
1428
+ } else if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.canRrefreshSubtableData !== undefined && gridParams.options.canRrefreshSubtableData === true) {
1429
+ // 是子表,且配置了子表无记录时更新子表记录集合
1430
+ isCanRefreshTableData = true
1393
1431
  }
1432
+ return isCanRefreshTableData
1394
1433
  },
1395
1434
  getSubTableGridData(subTableData) {
1396
1435
  let gridData = subTableData
@@ -2017,6 +2056,7 @@ export default {
2017
2056
  handleSizeChange(val) {
2018
2057
  if (!this.options || !this.options.isPageShow) {
2019
2058
  // console.log(`每页 ${val} 条`)
2059
+ this.currentPage = 1
2020
2060
  this.pageSize = val
2021
2061
  this.changePage()
2022
2062
  }
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable no-undef */
2
2
  import Vue from 'vue'
3
- import store from './store'
4
3
  import { packageEnumAndBeanColumnValueSets } from '../../utils/value-set'
4
+ import store from './store'
5
5
  import { isHasOptionFunction } from './utils'
6
6
  const superGridService = {
7
7
  initialize() {
8
- const url = Vue.prototype.baseAPI + '/component/super-grids/' + this.code
8
+ const url = Vue.prototype.baseAPI + '/component/super-grids/' + this.code + '/' + this.publishVersion
9
9
  const param = {}
10
10
  const isSqlSetting = this.options.isSql
11
11
  if (this.options && typeof (isSqlSetting) !== 'undefined') {
@@ -235,6 +235,10 @@ export default {
235
235
  default: function() {
236
236
  return {}
237
237
  }
238
+ },
239
+ publishVersion: {
240
+ type: Number,
241
+ default: 0
238
242
  }
239
243
  },
240
244
  data() {
@@ -321,7 +325,7 @@ export default {
321
325
  this.$watch('hasLoadData', function(newVal, oldVal) {
322
326
  if (newVal === true) {
323
327
  this.$nextTick(() => {
324
- this.rowDrop()
328
+ // this.rowDrop()
325
329
  const gridParams = store.get(this.storeId)
326
330
  if (isHasOptionFunction('gridComplete', this.storeId)) {
327
331
  gridParams.options.gridComplete.call(this, { gridData: this.gridData, columns: gridParams.columns, superGrid: this.$refs.superGrid })
@@ -1,5 +1,5 @@
1
1
  import ssoService from '../../api/sso-service'
2
- import { setToken, removeToken, setUsername, getUsername, removeUsername, setCurrentUser, removeCurrentUser } from '../../utils/auth'
2
+ import { setToken, removeToken, setUsername, getUsername, removeUsername, setCurrentUser, removeCurrentUser, removePublishControl } from '../../utils/auth'
3
3
 
4
4
  import { removePermissions, getPermissions, setPermissions, getMenus, setMenus, removeMenus } from '../../utils/permissionAuth'
5
5
 
@@ -102,6 +102,8 @@ const user = {
102
102
 
103
103
  removeMenus()
104
104
 
105
+ removePublishControl()
106
+
105
107
  resolve(data)
106
108
  }).catch(error => {
107
109
  reject(error)
@@ -79,8 +79,11 @@
79
79
  }
80
80
 
81
81
  .el-menu {
82
+ position: static;
82
83
  border: none;
83
- height: 100%;
84
+ // height: 100%;
85
+ height: auto;
86
+ max-height: 100vh;
84
87
  width: 100% !important;
85
88
  background-color: #FFF;
86
89
  color: #000D1F
@@ -188,13 +191,22 @@
188
191
  }
189
192
  }
190
193
 
194
+ .sidebar-container-popper .el-menu{
195
+ // height: 100vh;
196
+ height: auto;
197
+ max-height: 100vh;
198
+ overflow-y: auto;
199
+ overflow-x: hidden;
200
+ scroll-behavior: smooth;
201
+ }
202
+
191
203
  .sidebar-container-popper .el-submenu__title:not(.is-disabled):hover {
192
204
  background: #F7F7F8;
193
205
  color: rgba(0, 13, 31, 0.85);
194
206
  font-weight: 500;
195
207
  }
196
208
 
197
- .sidebar-container-popper .el-menu .el-submenu.is-active>.el-submenu__title {
209
+ .sidebar-container-popper .el-menu-item.is-active,.sidebar-container-popper .el-menu .el-submenu.is-active>.el-submenu__title {
198
210
  background-color: #EBECFF !important;
199
211
  color: #3D4CF2;
200
212
  font-weight: 500;
@@ -4,6 +4,8 @@ import Vue from 'vue'
4
4
  const jwtKey = 'JWT'
5
5
  const currentUserNameKey = 'USERNAME'
6
6
  const currentUserInfoKey = 'CURRENT_USER'
7
+ const versionEnv = 'VERSION_ENVIRONMENT'
8
+ const userVersion = 'CURRENT_USER_SYSTEM_VERSION'
7
9
 
8
10
  function getToken() {
9
11
  let token = getCookieCache(jwtKey)
@@ -96,6 +98,11 @@ function setSessionCache(key, value) {
96
98
  function removeSessionCache(key) {
97
99
  sessionStorage.removeItem(key)
98
100
  }
101
+
102
+ function removePublishControl() {
103
+ removeCookieCache(versionEnv)
104
+ removeCookieCache(userVersion)
105
+ }
99
106
  export default {
100
107
  getToken,
101
108
  setToken,
@@ -111,5 +118,6 @@ export default {
111
118
  removeCookieCache,
112
119
  getSessionCache,
113
120
  setSessionCache,
114
- removeSessionCache
121
+ removeSessionCache,
122
+ removePublishControl
115
123
  }
package/src/utils/auth.js CHANGED
@@ -59,3 +59,7 @@ export function setSessionCache(key, value) {
59
59
  export function removeSessionCache(key) {
60
60
  authApi.removeSessionCache(key)
61
61
  }
62
+
63
+ export function removePublishControl() {
64
+ authApi.removePublishControl()
65
+ }
@@ -1,5 +1,7 @@
1
1
  import sessionStorage from 'sessionstorage'
2
2
  import Vue from 'vue'
3
+ import authApi from './auth-api'
4
+ import { getToken } from './auth'
3
5
  /**
4
6
  * 获得相对地址
5
7
  */
@@ -169,7 +171,7 @@ export function isPlateSys(systemCode) {
169
171
  systemCode === 'mms' || systemCode === 'task' ||
170
172
  systemCode === 'wf' || systemCode === 'dc' ||
171
173
  systemCode === 'mc' || systemCode === 'mobile' ||
172
- systemCode === 'acs' || systemCode === 'bs')) {
174
+ systemCode === 'acs' || systemCode === 'bs' || systemCode === 'pcm')) {
173
175
  return true
174
176
  } else {
175
177
  return false
@@ -223,3 +225,90 @@ export function getTimeZone() {
223
225
  }
224
226
  return timeZone
225
227
  }
228
+
229
+ export function isMobileBrowser() {
230
+ if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Opera Mobi|Windows CE|Symbian|Windows Phone|POLARIS|lgtelecom|nokia|SonyEricsson|LG|SAMSUNG|Samsung/i
231
+ .test(navigator.userAgent)) {
232
+ //移动端浏览器
233
+ return true
234
+ } else {
235
+ //PC浏览器
236
+ return false
237
+ }
238
+ }
239
+
240
+ export function getLocaleByLang(lang) {
241
+ let locale = 'cn'
242
+ if (lang && lang.indexOf('_') > 0) {
243
+ const language = lang.substring(0, lang.indexOf('_'))
244
+ locale = language
245
+ }
246
+ if (locale === 'zh') {
247
+ locale = 'cn'
248
+ }
249
+ return locale
250
+ }
251
+
252
+ const langKey = 'AMB_LANG_INFO'
253
+
254
+ export function cacheLangs(langs) {
255
+ let langResult
256
+ if(langs) {
257
+ langResult = JSON.stringify(langs)
258
+ }
259
+ return authApi.setCookieCache(langKey,langResult)
260
+ }
261
+
262
+ export function getLangs() {
263
+ return authApi.getCookieCache(langKey)
264
+ }
265
+ /**
266
+ *
267
+ * @param {*} langShort 例如:cn或en
268
+ * @returns 例如:zh_CN或en_US
269
+ */
270
+ export function getLangByShort(langShort) {
271
+ let lang
272
+ const langResultJson = getLangs()
273
+ if(langResultJson){
274
+ const langObj = JSON.parse(langResultJson)
275
+ lang = langObj[langShort]
276
+ }
277
+ if(!lang){
278
+ lang = 'zh_CN'
279
+ }
280
+ return lang
281
+ }
282
+
283
+ // 首次加载业务系统时,缓存所有语言
284
+ export function cacheAllLanguagesUtil(http) {
285
+ return new Promise((resolve, reject) => {
286
+ const token = getToken()
287
+ if (token) {
288
+ http.get(Vue.prototype.baseAPI + '/component/all-languages').then((langList) => {
289
+ const langResult = {}
290
+ if (langList) {
291
+ langList.forEach(item => {
292
+ // 例如:zh_CN、en_US
293
+ const lang = item.value
294
+ let langShort
295
+ if (lang.indexOf('_') > 0) {
296
+ langShort = lang.substring(0, lang.indexOf('_'))
297
+ }
298
+ if (langShort && langShort === 'zh') {
299
+ // 中文处理,为了兼容历史逻辑
300
+ langShort = 'cn'
301
+ }
302
+ if (langShort) {
303
+ langResult[langShort] = lang
304
+ }
305
+ })
306
+ }
307
+ cacheLangs(langResult)
308
+ resolve()
309
+ })
310
+ } else {
311
+ resolve()
312
+ }
313
+ })
314
+ }
package/src/utils/util.js CHANGED
@@ -3,6 +3,7 @@ import Vue from 'vue'
3
3
  import {
4
4
  executeExpression
5
5
  } from './calculator/calculator-util'
6
+ import { getLangByShort } from './common-util'
6
7
  export function getI18n() {
7
8
  if (!window.$locale) {
8
9
  i18n.locale = 'cn'
@@ -13,12 +14,11 @@ export function getI18n() {
13
14
  }
14
15
 
15
16
  export function getLanguageWithLocale() {
16
- const currentLocale = window.$locale
17
- if (currentLocale && currentLocale === 'en') {
18
- return 'en_US'
19
- } else {
20
- return 'zh_CN'
17
+ let currentLocale = window.$locale
18
+ if (!currentLocale || currentLocale === 'zh') {
19
+ currentLocale = 'cn'
21
20
  }
21
+ return getLangByShort(currentLocale)
22
22
  }
23
23
  /**
24
24
  * 根据动态数据源获得下拉选的选项集合
@@ -8,7 +8,7 @@
8
8
  </app-link>
9
9
  </template>
10
10
 
11
- <el-submenu v-else :index="resolvePath(item.code,item.path,item.pageType)" :show-timeout="0" :hide-timeout="50" popper-class="sidebar-container-popper">
11
+ <el-submenu v-else :index="resolvePath(item.code,item.path,item.pageType)" :show-timeout="0" :hide-timeout="50" :popper-append-to-body="false" popper-class="sidebar-container-popper">
12
12
  <template v-slot:title>
13
13
  <item :icon="item.iconName" :title="getI18nName(item)" :has-children="item.children.length > 0?true:false" />
14
14
  </template>