imatrix-ui 2.9.8-pv2 → 2.9.8-pv3

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-pv3",
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
  }
@@ -1346,51 +1346,86 @@ export default {
1346
1346
  gridParams.options.subTableData &&
1347
1347
  gridParams.options.subTableData.length > 0
1348
1348
  ) {
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
- }
1349
+ this.packageSubTableData(gridParams, gridParams.options.subTableData)
1350
+ } else {
1351
+ const isCanRefreshTableData = this.canRefreshTableData(gridParams)
1352
+ if (isCanRefreshTableData) {
1353
+ // 可以刷新表格记录
1354
+ return this.fetchListData(searchParam, isSearch, parentRowIds, resove)
1365
1355
  } else {
1366
- subTableData = gridParams.options.subTableData
1356
+ // 子表无记录时不需要刷新子表记录。表示是新建或修改时子表无记录,且不需要刷新子表。
1357
+ if (
1358
+ this.isSubTableEmpty(gridParams)
1359
+ ){
1360
+ // 表示是新建表单时,子表记录集合是空数组
1361
+ console.log('子表无记录----code=', this.code, gridParams)
1362
+ const subTableData = []
1363
+ this.packageSubTableData(gridParams,subTableData)
1364
+ }
1367
1365
  this.hasLoadData = true
1366
+ gridParams.loaded = true
1368
1367
  }
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
- )
1368
+ }
1369
+ }
1370
+ },
1371
+ isSubTableEmpty (gridParams) {
1372
+ return gridParams.options && gridParams.options.isFormSubTable &&
1373
+ ((gridParams.options.subTableData === undefined || gridParams.options.subTableData === null) ||
1374
+ gridParams.options.subTableData.length === 0)
1375
+ },
1376
+ packageSubTableData(gridParams, initSubTableData) {
1377
+ this.hasLoadData = false
1378
+ gridParams.loaded = true
1379
+ let subTableData = []
1380
+ // 如果有子表数据,则展示传递的子表数据
1381
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1382
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
1383
+ gridData: initSubTableData,
1384
+ columns: gridParams.columns
1385
+ })
1386
+ if (gridData) {
1387
+ subTableData = gridData
1388
+ this.hasLoadData = true
1390
1389
  } else {
1391
- return this.fetchListData(searchParam, isSearch, parentRowIds, resove)
1390
+ subTableData = initSubTableData
1391
+ this.hasLoadData = true
1392
1392
  }
1393
+ } else {
1394
+ subTableData = initSubTableData
1395
+ this.hasLoadData = true
1396
+ }
1397
+ if (subTableData) {
1398
+ // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1399
+ subTableData.forEach(item => {
1400
+ this.setColumnsDefaultValue(gridParams.allColumns, item)
1401
+ })
1402
+ }
1403
+ if (this.pagination && this.isSubTableShowPage === true) {
1404
+ // 表示子表需要显示分页
1405
+ this.subTableData = subTableData
1406
+ // 更新记录总条数
1407
+ this.pagination.total = this.subTableData.length
1408
+ gridParams.subTableData = this.subTableData
1409
+ this.gridData = this.getSubTableGridData(this.subTableData)
1410
+ } else {
1411
+ this.gridData = subTableData
1412
+ }
1413
+ gridParams.gridData = this.gridData
1414
+ // 完成深拷贝,复制一份对象,行编辑时使用
1415
+ gridParams.orgGridData = [].concat(
1416
+ JSON.parse(JSON.stringify(this.gridData))
1417
+ )
1418
+ },
1419
+ canRefreshTableData (gridParams) {
1420
+ let isCanRefreshTableData = false
1421
+ if (gridParams.options && !gridParams.options.isFormSubTable) {
1422
+ // 如果不是子表时
1423
+ isCanRefreshTableData = true
1424
+ } else if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.canRrefreshSubtableData !== undefined && gridParams.options.canRrefreshSubtableData === true) {
1425
+ // 是子表,且配置了子表无记录时更新子表记录集合
1426
+ isCanRefreshTableData = true
1393
1427
  }
1428
+ return isCanRefreshTableData
1394
1429
  },
1395
1430
  getSubTableGridData(subTableData) {
1396
1431
  let gridData = subTableData
@@ -2017,6 +2052,7 @@ export default {
2017
2052
  handleSizeChange(val) {
2018
2053
  if (!this.options || !this.options.isPageShow) {
2019
2054
  // console.log(`每页 ${val} 条`)
2055
+ this.currentPage = 1
2020
2056
  this.pageSize = val
2021
2057
  this.changePage()
2022
2058
  }
@@ -321,7 +321,7 @@ export default {
321
321
  this.$watch('hasLoadData', function(newVal, oldVal) {
322
322
  if (newVal === true) {
323
323
  this.$nextTick(() => {
324
- this.rowDrop()
324
+ // this.rowDrop()
325
325
  const gridParams = store.get(this.storeId)
326
326
  if (isHasOptionFunction('gridComplete', this.storeId)) {
327
327
  gridParams.options.gridComplete.call(this, { gridData: this.gridData, columns: gridParams.columns, superGrid: this.$refs.superGrid })
@@ -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;
@@ -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>