agilebuilder-ui 1.0.79-temp2 → 1.0.80-tmp1

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.
@@ -87,7 +87,7 @@ const ArrowKeyAction = {
87
87
  return null
88
88
  }
89
89
  }
90
- }
90
+ },
91
91
  }
92
92
  export { ArrowKeyAction }
93
93
 
@@ -101,7 +101,10 @@ export function setCurrentRow(rowIndex, listCode) {
101
101
  // 新建时会传过来比记录条数大的行号
102
102
  if (gridParams.isMulitiSelect) {
103
103
  gridParams.superGrid.clearSelection()
104
- gridParams.superGrid.toggleRowSelection(gridParams.gridData[rowIndex], true)
104
+ gridParams.superGrid.toggleRowSelection(
105
+ gridParams.gridData[rowIndex],
106
+ true
107
+ )
105
108
  } else {
106
109
  gridParams.superGrid.setCurrentRow(gridParams.gridData[rowIndex])
107
110
  }
@@ -157,11 +160,17 @@ export function isLastEditRowSave(listCode) {
157
160
  // 表示有正在编辑的行,不能编辑其他行
158
161
  return false
159
162
  }
160
- if (typeof gridParams.$rowIndex === 'undefined' || gridParams.$rowIndex === null) {
163
+ if (
164
+ typeof gridParams.$rowIndex === 'undefined' ||
165
+ gridParams.$rowIndex === null
166
+ ) {
161
167
  // 表示没有在该列表编辑任何行,可以编辑行
162
168
  return true
163
169
  }
164
- if (typeof gridParams.$lastSaveRowIndex === 'undefined' || gridParams.$lastSaveRowIndex === null) {
170
+ if (
171
+ typeof gridParams.$lastSaveRowIndex === 'undefined' ||
172
+ gridParams.$lastSaveRowIndex === null
173
+ ) {
165
174
  // 表示没有在该列表保存任何行,可以编辑行
166
175
  return true
167
176
  }
@@ -188,7 +197,10 @@ export function isCanRefreshGrid(listCode) {
188
197
  return false
189
198
  }
190
199
 
191
- if (typeof gridParams.isCreateRow !== 'undefined' && gridParams.isCreateRow === true) {
200
+ if (
201
+ typeof gridParams.isCreateRow !== 'undefined' &&
202
+ gridParams.isCreateRow === true
203
+ ) {
192
204
  // 说明刚刚新建的行还没有保存 或 撤销编辑,表示当前列表中有编辑行,不能刷新列表数据
193
205
  return false
194
206
  }
@@ -225,12 +237,16 @@ export function isDisableEdit(prop, listCode, row) {
225
237
  const fieldPermissions = gridParams.options.validateRules
226
238
  if (fieldPermissions) {
227
239
  const fieldRule = fieldPermissions.filter(
228
- (item) => item.name && (item.name === prop || item.name === 'all_fields')
240
+ (item) =>
241
+ item.name && (item.name === prop || item.name === 'all_fields')
229
242
  )
230
243
  let canEdit = true
231
244
  if (fieldRule && fieldRule.length > 0) {
232
245
  for (let i = 0; i < fieldRule.length; i++) {
233
- if (fieldRule[i].rowIndexes === undefined || fieldRule[i].rowIndexes === null) {
246
+ if (
247
+ fieldRule[i].rowIndexes === undefined ||
248
+ fieldRule[i].rowIndexes === null
249
+ ) {
234
250
  canEdit = fieldRule[i].canEdit
235
251
  } else if (fieldRule[i].rowIndexes.indexOf(rowId) >= 0) {
236
252
  canEdit = fieldRule[i].canEdit
@@ -326,7 +342,10 @@ export function isHasEditOption(event, listCode) {
326
342
  listCode = store.get('_list_code')
327
343
  }
328
344
  const gridParams = store.get(listCode)
329
- if (gridParams.options.lineEditOptions && gridParams.options.lineEditOptions[event]) {
345
+ if (
346
+ gridParams.options.lineEditOptions &&
347
+ gridParams.options.lineEditOptions[event]
348
+ ) {
330
349
  return true
331
350
  }
332
351
  return false
@@ -337,7 +356,10 @@ export function isEditOptionFunction(event, listCode) {
337
356
  listCode = store.get('_list_code')
338
357
  }
339
358
  const gridParams = store.get(listCode)
340
- if (gridParams.options.lineEditOptions && typeof gridParams.options.lineEditOptions[event] === 'function') {
359
+ if (
360
+ gridParams.options.lineEditOptions &&
361
+ typeof gridParams.options.lineEditOptions[event] === 'function'
362
+ ) {
341
363
  return true
342
364
  }
343
365
  return false
@@ -402,7 +424,7 @@ export function getGridParams() {
402
424
  isRestoreByEsc: true, // 点击ESC时,是否撤销编辑,
403
425
  aftersaveIsCancelEditState: true, // 保存后,是否取消编辑状态
404
426
  afterRestoreIsCancelEditState: true, // 撤销编辑后,是否取消编辑状态
405
- input: function () {} // 数据改变时触发
427
+ input: function () {}, // 数据改变时触发
406
428
  // 'beforeSave': function() { return true }, // 保存行数据前的回调
407
429
  // 'saveSuccess': function() {}, // 保存行数据成功的回调
408
430
  // 'saveError': function() {}, // 保存行数据发生异常的回调
@@ -429,7 +451,7 @@ export function getGridParams() {
429
451
  // urlToSaveRow:'', // 保存行记录的url,如果设置了以该设置的为准
430
452
  // isEnableValidate: true, // 保存行记录时,是否启用必填验证
431
453
  // saveRow: function(){return new Promise((resolve, reject) => {...resolve(data)})} // 需要返回的是保存后的行记录的值
432
- }
454
+ },
433
455
  // 自定义行编辑
434
456
  // customFormatter: {
435
457
  // },
@@ -494,7 +516,7 @@ export function getGridParams() {
494
516
  // actionPermission: { 'canAdd': true, 'canUpdate': true, 'canDelete': true }, // 列表行编辑时控制按钮的权限
495
517
  // formData: {}, // 主表单的实体信息
496
518
  // hiddenColumns:['operation','xx]
497
- }
519
+ },
498
520
  }
499
521
  return Vue.reactive(gridParams)
500
522
  }
@@ -577,7 +599,7 @@ export function getTableHeight(superGrid, listCode, pageHeight) {
577
599
  topDivHeight = 0
578
600
  }
579
601
  let totalHeight = pageHeight - topDivHeight
580
- if (superGrid) {
602
+ if(superGrid){
581
603
  totalHeight = pageHeight - superGrid.$el.offsetTop - topDivHeight
582
604
  }
583
605
  // const cur = document.querySelectorAll("div[class='grid-area']")
@@ -612,7 +634,7 @@ export function getTableHeight(superGrid, listCode, pageHeight) {
612
634
 
613
635
  export function getExtraParam(searchParam, gridParams) {
614
636
  const param = {
615
- searchParam: searchParam
637
+ searchParam: searchParam,
616
638
  }
617
639
  param.withDataPermission = gridParams.options.isWithDataPermission
618
640
  param.isWorkflowEntity = gridParams.options.isWorkflowEntity
@@ -653,17 +675,25 @@ export function analysisFileSetObj(fileSetObj, isSql) {
653
675
  }
654
676
  return {
655
677
  showName: showName,
656
- serverPath: serverPath
678
+ serverPath: serverPath,
657
679
  }
658
680
  }
659
681
 
660
- export function otherFilesToStandard(fileSetObj, keyValueParam, files, filesStringData) {
682
+ export function otherFilesToStandard(
683
+ fileSetObj,
684
+ keyValueParam,
685
+ files,
686
+ filesStringData
687
+ ) {
661
688
  const standardFiles = []
662
689
  if (files) {
663
690
  if (files && files.length > 0) {
664
691
  for (var i = 0; i < files.length; i++) {
665
692
  const file = files[i]
666
- const standardFile = packageFile(file[keyValueParam.showName], file[keyValueParam.serverPath])
693
+ const standardFile = packageFile(
694
+ file[keyValueParam.showName],
695
+ file[keyValueParam.serverPath]
696
+ )
667
697
  standardFiles.push(standardFile)
668
698
  }
669
699
  }
@@ -690,15 +720,31 @@ export function packageFile(showName, serverPath) {
690
720
  standardFile.showName = showName
691
721
  standardFile.serverPath = serverPath
692
722
 
693
- if (standardFile.showName && /\.(jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|bmp|BMP|psd|PSD|tif|TIF)$/.test(showName)) {
723
+ if (
724
+ standardFile.showName &&
725
+ /\.(jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|bmp|BMP|psd|PSD|tif|TIF)$/.test(
726
+ showName
727
+ )
728
+ ) {
694
729
  standardFile.isImg = true
695
730
  }
696
731
  const token = getToken()
697
- let url = window.$vueApp.config.globalProperties.baseURL + '/common/super-form/downloads?jwt=' + token
732
+ let url =
733
+ window.$vueApp.config.globalProperties.baseURL +
734
+ '/common/super-form/downloads?jwt=' +
735
+ token
698
736
  if (isPlateSys(window.$vueApp.config.globalProperties.systemCode)) {
699
- url = window.$vueApp.config.globalProperties.baseAPI + '/component/super-form/downloads?jwt=' + token
700
- }
701
- const src = url + '&showName=' + encodeURI(standardFile.showName) + '&serverPath=' + standardFile.serverPath
737
+ url =
738
+ window.$vueApp.config.globalProperties.baseAPI +
739
+ '/component/super-form/downloads?jwt=' +
740
+ token
741
+ }
742
+ const src =
743
+ url +
744
+ '&showName=' +
745
+ encodeURI(standardFile.showName) +
746
+ '&serverPath=' +
747
+ standardFile.serverPath
702
748
  standardFile.src = src
703
749
  return standardFile
704
750
  }
@@ -708,7 +754,8 @@ export function getFileList(row, column, isSql) {
708
754
  if (
709
755
  column.fileSet &&
710
756
  column.fileSet !== '' &&
711
- (column.componentType === 'annex' || column.componentType === 'multipartUpload')
757
+ (column.componentType === 'annex' ||
758
+ column.componentType === 'multipartUpload')
712
759
  ) {
713
760
  const fileSetObj = JSON.parse(column.fileSet)
714
761
  const keyValueParam = analysisFileSetObj(fileSetObj, isSql)
@@ -717,13 +764,23 @@ export function getFileList(row, column, isSql) {
717
764
  // const lowerStr = fileSetObj.childAnnexDataTableCode.toLowerCase()
718
765
  const fileArr = row[column.prop]
719
766
  // 子表
720
- fileList = otherFilesToStandard(fileSetObj, keyValueParam, fileArr, null)
767
+ fileList = otherFilesToStandard(
768
+ fileSetObj,
769
+ keyValueParam,
770
+ fileArr,
771
+ null
772
+ )
721
773
  } else {
722
774
  const filesStringData = {
723
775
  showName: getEntityFieldValue(row, keyValueParam.showName),
724
- serverPath: getEntityFieldValue(row, keyValueParam.serverPath)
776
+ serverPath: getEntityFieldValue(row, keyValueParam.serverPath),
725
777
  }
726
- fileList = otherFilesToStandard(fileSetObj, keyValueParam, null, filesStringData)
778
+ fileList = otherFilesToStandard(
779
+ fileSetObj,
780
+ keyValueParam,
781
+ null,
782
+ filesStringData
783
+ )
727
784
  }
728
785
  } else {
729
786
  const showName = getEntityFieldValue(row, keyValueParam.showName)
@@ -737,7 +794,10 @@ export function getFileList(row, column, isSql) {
737
794
  export function getDynamicDataSourceOptions(column, isSql, additionalParamMap) {
738
795
  let additionalParameter
739
796
  if (additionalParamMap) {
740
- console.log('getDynamicDataSourceOptions--additionalParamMap=', additionalParamMap)
797
+ console.log(
798
+ 'getDynamicDataSourceOptions--additionalParamMap=',
799
+ additionalParamMap
800
+ )
741
801
  if (additionalParamMap && typeof additionalParamMap === 'object') {
742
802
  additionalParameter = JSON.stringify(additionalParamMap)
743
803
  } else if (additionalParamMap && additionalParamMap !== '') {
@@ -746,7 +806,7 @@ export function getDynamicDataSourceOptions(column, isSql, additionalParamMap) {
746
806
  }
747
807
  const options = {
748
808
  isSql: isSql,
749
- additionalParameter: additionalParameter
809
+ additionalParameter: additionalParameter,
750
810
  }
751
811
  // 如果是多选文件类型,需要解析(需要设置临时字段,判断文件还是图片,图片需要预览)
752
812
  if (column.valueSetOptions) {
@@ -754,7 +814,10 @@ export function getDynamicDataSourceOptions(column, isSql, additionalParamMap) {
754
814
  if (valueSetOptionsObj && valueSetOptionsObj.valueSetOptions) {
755
815
  options.valueSetOptions = valueSetOptionsObj.valueSetOptions
756
816
  }
757
- if (valueSetOptionsObj.dynamicDataSourceCode && valueSetOptionsObj.dynamicDataSourceCode !== '') {
817
+ if (
818
+ valueSetOptionsObj.dynamicDataSourceCode &&
819
+ valueSetOptionsObj.dynamicDataSourceCode !== ''
820
+ ) {
758
821
  options.dynamicDataSourceCode = valueSetOptionsObj.dynamicDataSourceCode
759
822
  }
760
823
  }
@@ -763,7 +826,11 @@ export function getDynamicDataSourceOptions(column, isSql, additionalParamMap) {
763
826
 
764
827
  // 值设置是否是动态数据源类型的数据源
765
828
  export function isDynamicDataSourceSource(column) {
766
- if (column.valueSet && column.valueSet.length > 0 && column.valueSet[0].value === 'dynamicDataSource') {
829
+ if (
830
+ column.valueSet &&
831
+ column.valueSet.length > 0 &&
832
+ column.valueSet[0].value === 'dynamicDataSource'
833
+ ) {
767
834
  return true
768
835
  } else {
769
836
  return false
@@ -773,7 +840,11 @@ export function isDynamicDataSourceSource(column) {
773
840
  export function getLastPageNum(total, rowsPerPage) {
774
841
  if (total === undefined || total === null || total === 0) {
775
842
  return 1
776
- } else if (rowsPerPage === undefined || rowsPerPage === null || rowsPerPage === 0) {
843
+ } else if (
844
+ rowsPerPage === undefined ||
845
+ rowsPerPage === null ||
846
+ rowsPerPage === 0
847
+ ) {
777
848
  return 1
778
849
  } else {
779
850
  return Math.ceil(total / rowsPerPage)
@@ -781,20 +852,31 @@ export function getLastPageNum(total, rowsPerPage) {
781
852
  }
782
853
  // 纵向滚动条滚动最底部功能
783
854
  export function scrollYToBottom(listCode) {
784
- const scrollDivElement = document.querySelector('.' + listCode + ' .el-table--scrollable-y .el-table__body-wrapper')
855
+ const scrollDivElement = document.querySelector(
856
+ '.' + listCode + ' .el-table--scrollable-y .el-table__body-wrapper'
857
+ )
785
858
  console.log('scrollDivElement==', scrollDivElement)
786
859
  if (scrollDivElement && scrollDivElement !== null) {
787
860
  // 表示有滚动条,需要将滚动条滚动最底部
788
- console.log('scrollDivElement==scrollDivElement.scrollHeight=', scrollDivElement.scrollHeight)
861
+ console.log(
862
+ 'scrollDivElement==scrollDivElement.scrollHeight=',
863
+ scrollDivElement.scrollHeight
864
+ )
789
865
  scrollDivElement.scrollTop = scrollDivElement.scrollHeight
790
866
  }
791
867
  }
792
868
 
793
869
  export function getAdditionalParamMap(gridParams) {
794
870
  let additionalParamMap = null
795
- if (gridParams.additionalParamMap && typeof gridParams.additionalParamMap === 'object') {
871
+ if (
872
+ gridParams.additionalParamMap &&
873
+ typeof gridParams.additionalParamMap === 'object'
874
+ ) {
796
875
  additionalParamMap = gridParams.additionalParamMap
797
- } else if (gridParams.additionalParamMap && gridParams.additionalParamMap !== '') {
876
+ } else if (
877
+ gridParams.additionalParamMap &&
878
+ gridParams.additionalParamMap !== ''
879
+ ) {
798
880
  additionalParamMap = JSON.parse(gridParams.additionalParamMap)
799
881
  }
800
882
  return additionalParamMap
@@ -802,7 +884,7 @@ export function getAdditionalParamMap(gridParams) {
802
884
 
803
885
  // 获得控件的配置信息,例如:自定义控件的附加配置等
804
886
  export function getControlConfig(column) {
805
- let controlConfig = {}
887
+ let controlConfig
806
888
  if (column && column.controlConfig) {
807
889
  controlConfig = JSON.parse(column.controlConfig)
808
890
  }
@@ -577,6 +577,8 @@ export default {
577
577
  },
578
578
  fetchData(searchParam, isSearch) {
579
579
  return new Promise((resolve, reject) => {
580
+ // 刷新页面数据时,把选中集合清空
581
+ this.clearSelections()
580
582
  // 获得各属性对应的字段配置
581
583
  this.getPropColumns()
582
584
  this.isLoading = true
@@ -18,7 +18,7 @@
18
18
  :key="buttonIndex"
19
19
  v-permission="button.permission"
20
20
  :class="button.code ? button.code : ''"
21
- :disabled="preventReclick"
21
+ :disabled="disabled?disabled:preventReclick"
22
22
  :type="button.type"
23
23
 
24
24
  @click="button.clickFun"
@@ -60,6 +60,11 @@ export default {
60
60
  type: String,
61
61
  default: null,
62
62
  },
63
+ // 是否禁用按钮组所有按钮
64
+ disabled: {
65
+ type: Boolean,
66
+ default: false
67
+ },
63
68
  },
64
69
  data() {
65
70
  const buttonsPermission = this.getButtonsPermission()
package/src/permission.js CHANGED
@@ -8,7 +8,8 @@ import { ElMessage as Message } from 'element-plus'
8
8
  import * as Vue from 'vue'
9
9
  import authApi from './utils/auth-api'
10
10
 
11
- import { cacheAllLanguagesUtil, getLocaleByLang, cacheCurrentLanguageUtil } from './utils/common-util'
11
+ import { cacheAllLanguagesUtil, getLocaleByLang, cacheCurrentLanguageUtil, isPlateSys } from './utils/common-util'
12
+ import { getSystemCode } from './utils/permissionAuth'
12
13
 
13
14
  // 首次加载业务系统时,获得用户的语言
14
15
  function initUserLanguage() {
@@ -148,7 +149,9 @@ router.beforeEach((to, from, next) => {
148
149
  .then((user) => {
149
150
  console.log('router.beforeEach-getCurrentUser')
150
151
  const devpRoleCodes = authApi.getSessionCache(runCurrentRoleKey)
151
- if (!isDevp && devpRoleCodes) {
152
+ const systemCode = getSystemCode()
153
+ // console.log('router.beforeEach-getCurrentUser----systemCode=', systemCode, 'isPlateSys(systemCode)=', isPlateSys(systemCode))
154
+ if (!isDevp && devpRoleCodes && systemCode && isPlateSys(systemCode)) {
152
155
  // 表示是开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码,对应运行平台的岗位编码
153
156
  // console.log('开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码时,!isDevp && devpRoleCodes')
154
157
  return store.dispatch('getDevPlatformPermissions', devpRoleCodes)
@@ -3,6 +3,20 @@ import { getAbstractUserFactoryWf } from './calculator-factory-wf'
3
3
  import { getPropValue, getEntityFieldValue } from '../util'
4
4
  export function executeExpression(leftValue, operator, rightValue, dataType) {
5
5
  const Calculator = getAbstractUserFactory(dataType)
6
+ if (dataType === 'DATE' || dataType === 'TIME') {
7
+ return executeDateExpression(leftValue, operator, rightValue, Calculator)
8
+ }
9
+ const calculatorObj = new Calculator(leftValue, operator, rightValue)
10
+ return calculatorObj.result
11
+ }
12
+
13
+ function executeDateExpression(leftValue, operator, rightValue, Calculator) {
14
+ if (rightValue && typeof (rightValue) === 'string') {
15
+ rightValue = new Date(rightValue).getTime()
16
+ }
17
+ if (leftValue && typeof (leftValue) === 'string') {
18
+ leftValue = new Date(leftValue).getTime()
19
+ }
6
20
  const calculatorObj = new Calculator(leftValue, operator, rightValue)
7
21
  return calculatorObj.result
8
22
  }
@@ -1,5 +1,5 @@
1
1
  import 'nprogress/nprogress.css' // Progress 进度条样式
2
- import { getTotalPermissions } from './permissionAuth'
2
+ import { getTotalPermissions, isDevpAccess } from './permissionAuth'
3
3
 
4
4
  /**
5
5
  * @param {String} permission 多个资源编码以逗号隔开
@@ -7,6 +7,12 @@ import { getTotalPermissions } from './permissionAuth'
7
7
  */
8
8
  export default function checkPermission(permission) {
9
9
  if (permission) {
10
+ // 是否是预览项目时开发平台用户
11
+ const isDevpPermission= isDevpAccess()
12
+ // console.log('checkPermission---------permission=', permission, 'isDevpPermission=', isDevpPermission)
13
+ if(isDevpPermission){
14
+ return true
15
+ }
10
16
  let hasPermission = false
11
17
  const storeCurrentUserPermissions = getTotalPermissions()
12
18
  if (
@@ -1,5 +1,5 @@
1
1
  import * as Vue from 'vue'
2
- import {getSessionCache, getRunInfoKey} from './auth'
2
+ import {getSessionCache, getRunInfoKey, getUsername, getRunCurrentRole} from './auth'
3
3
  import { isMobileBrowser } from './common-util'
4
4
 
5
5
  const permissionKey = 'PERMISSION-'
@@ -196,4 +196,50 @@ export function removeAllSystemPermissions() {
196
196
  localStorage.removeItem(key)
197
197
  })
198
198
  removePermissionSystemKey()
199
+ }
200
+ // 开发平台项目负责人角色编码
201
+ const DEV_ROLE_PROJECT_ADMIN_CODE = "PROJECT_ADMIN"
202
+ // 开发平台项目开发者角色编码
203
+ const DEV_ROLE_PROJECT_DEVELOPER_CODE = "PROJECT_DEVELOPER"
204
+ // 开发平台项目观察者角色编码
205
+ const DEV_ROLE_PROJECT_VIEWER_CODE = "PROJECT_VIEWER"
206
+
207
+ /**
208
+ * 预览项目时查询应用权限使用。
209
+ * 负责人岗位和观察者岗位
210
+ * @return
211
+ */
212
+ export function isDevpAccess() {
213
+ const username = getUsername()
214
+ // console.log("isDevpAccess-----username=",username);
215
+ const DEVP_APP_ID = "0bba9791-d4f1-47ca-b5e6-1fc840b54f3a"
216
+ if(username && username === DEVP_APP_ID){
217
+ // 开发环境的角色编码,运行环境中是岗位
218
+ const postManagementCodes = getPostManagementCodes()
219
+ // console.log("isDevAccess----postManagementCodes=",postManagementCodes);
220
+ if(postManagementCodes && postManagementCodes.indexOf(DEV_ROLE_PROJECT_ADMIN_CODE) >= 0 ||
221
+ postManagementCodes.contains(DEV_ROLE_PROJECT_VIEWER_CODE) >= 0){
222
+ // 表示是项目负责人岗位或观察者岗位或平台管理员,且当前登录用户是 devp的应用id
223
+ return true
224
+ }
225
+ }
226
+ return false
227
+ }
228
+
229
+ function getPostManagementCodes() {
230
+ const devpPostManagements = getRunCurrentRole()
231
+ if(devpPostManagements){
232
+ let postCodes = [];
233
+ const devpCodes = devpPostManagements.split(",");
234
+ devpCodes.forEach(code=>{
235
+ let roleCode = code
236
+ if(code === DEV_ROLE_PROJECT_ADMIN_CODE || code === DEV_ROLE_PROJECT_DEVELOPER_CODE ){
237
+ roleCode = DEV_ROLE_PROJECT_ADMIN_CODE
238
+ }
239
+ if(postCodes.indexOf(roleCode) < 0) {
240
+ postCodes.push(roleCode)
241
+ }
242
+ })
243
+ return postCodes
244
+ }
199
245
  }