agilebuilder-ui 1.1.37 → 1.1.38-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.
@@ -210,7 +210,8 @@ import {
210
210
  isEditOptionFunction,
211
211
  isHasEditOption,
212
212
  isHasOptionFunction,
213
- isObjectValueEqual
213
+ isObjectValueEqual,
214
+ rowBeforeValidate
214
215
  } from './utils'
215
216
  import Sortable from 'sortablejs'
216
217
  import store from './store'
@@ -2775,10 +2776,28 @@ export default {
2775
2776
  gridData = this.subTableData
2776
2777
  }
2777
2778
  if (gridData && gridData.length > 0) {
2779
+ const gridParams = store.get(this.code)
2780
+ const customRules = gridParams.options.customRules
2778
2781
  const pageSize = this.pagination && this.pagination.pageSize
2779
2782
  const validateRules = formValidatorService.getValidator(this.code)
2780
2783
  for (let i = 0; i < gridData.length; i++) {
2781
2784
  const row = gridData[i]
2785
+ let rules = validateRules
2786
+ if (customRules) {
2787
+ const propNames = Object.keys(customRules)
2788
+ if (propNames.length > 0) {
2789
+ // 遍历customRules,判断customRules的规则是否有beforeValidate
2790
+ for (const propName of propNames) {
2791
+ if (customRules[propName].beforeValidate) {
2792
+ const result = rowBeforeValidate(customRules[propName], gridParams, row)
2793
+ if (result === false && rules[propName]) {
2794
+ rules = JSON.parse(JSON.stringify(validateRules))
2795
+ rules[propName] = []
2796
+ }
2797
+ }
2798
+ }
2799
+ }
2800
+ }
2782
2801
  // 取消最后一个编辑行的状态
2783
2802
  if (row.$editing !== undefined && row.$editing === true) {
2784
2803
  setEntityFieldValue(row, '$editing', false)
@@ -2788,7 +2807,7 @@ export default {
2788
2807
  let needValidate = true
2789
2808
  if (isHasEditOption('isEnableValidate', this.code)) {
2790
2809
  // 表示配置了是否启用必填验证
2791
- needValidate = this.gridParams.options.lineEditOptions['isEnableValidate']
2810
+ needValidate = gridParams.options.lineEditOptions['isEnableValidate']
2792
2811
  }
2793
2812
  let validateResult = true
2794
2813
  if (needValidate === true) {
@@ -2803,7 +2822,7 @@ export default {
2803
2822
  row,
2804
2823
  this.code,
2805
2824
  i,
2806
- validateRules,
2825
+ rules,
2807
2826
  this.isSubTableShowPage,
2808
2827
  pageNum,
2809
2828
  pageRowIndex
@@ -205,7 +205,7 @@ function getEntityId(row) {
205
205
  }
206
206
 
207
207
  // 行编辑时,是否有权限编辑某字段
208
- export function isDisableEdit(prop, listCode, row) {
208
+ export function isDisableEdit(prop, listCode, row, rowIndex) {
209
209
  if (!listCode) {
210
210
  listCode = store.get('_list_code')
211
211
  }
@@ -271,7 +271,11 @@ export function isDisableEdit(prop, listCode, row) {
271
271
  const columnRules = gridParams.options.customRules[prop]
272
272
  ? gridParams.options.customRules[prop]
273
273
  : gridParams.options.customRules['_all_fields']
274
- if (columnRules && columnRules.disabled) {
274
+ let beforeValidateResult = true
275
+ // if (columnRules.beforeValidate) {
276
+ // beforeValidateResult = rowBeforeValidate(columnRules, gridParams, row, rowIndex)
277
+ // }
278
+ if (columnRules && columnRules.disabled && beforeValidateResult !== false) {
275
279
  isDiabled = true
276
280
  }
277
281
  }
@@ -280,6 +284,16 @@ export function isDisableEdit(prop, listCode, row) {
280
284
  return isDiabled
281
285
  }
282
286
 
287
+ export function rowBeforeValidate(columnRules, gridParams, row) {
288
+ const params = {
289
+ parent: gridParams.options.extraParam.entityMap,
290
+ row: row,
291
+ pageContext: gridParams.options.pageContext,
292
+ configure: gridParams.options.configureObj
293
+ }
294
+ return columnRules.beforeValidate(params)
295
+ }
296
+
283
297
  // 行编辑时,是否必填某字段, 如果是流程表单子表, 需要将列表管理里配置的必填字段去掉,使用流程内的子表编辑权限控制
284
298
  export function isRequiredEdit(column, listCode) {
285
299
  const prop = column.prop
@@ -17,7 +17,7 @@ function packageEnumAndBeanColumnValueSetsWhenPlate(columns, listCode) {
17
17
  return new Promise((resolve, reject) => {
18
18
  const valueSetColumnsInfo = {
19
19
  listCode: listCode,
20
- valueSetMetas: [],
20
+ valueSetMetas: []
21
21
  }
22
22
  const valueSetColumnIndexs = []
23
23
  for (let i = 0; i < columns.length; i++) {
@@ -27,13 +27,11 @@ function packageEnumAndBeanColumnValueSetsWhenPlate(columns, listCode) {
27
27
  let titleValueSet = null
28
28
  const titleValueSetJson = column.titleValueSet
29
29
  if (titleValueSetJson) {
30
- titleValueSet = packageEnumAndBeanColumnValueSet(
31
- JSON.parse(titleValueSetJson)
32
- )
30
+ titleValueSet = packageEnumAndBeanColumnValueSet(JSON.parse(titleValueSetJson))
33
31
  }
34
32
  if (columnValueSet || titleValueSet) {
35
33
  const valueSetMeta = {
36
- prop: prop,
34
+ prop: prop
37
35
  }
38
36
  if (columnValueSet) {
39
37
  // 字段的值设置
@@ -48,17 +46,11 @@ function packageEnumAndBeanColumnValueSetsWhenPlate(columns, listCode) {
48
46
  }
49
47
  if (valueSetColumnsInfo.valueSetMetas.length > 0) {
50
48
  window.$vueApp.config.globalProperties.$http
51
- .post(
52
- window.$vueApp.config.globalProperties.baseURL +
53
- '/common/super-grids/value-sets',
54
- valueSetColumnsInfo
55
- )
49
+ .post(window.$vueApp.config.globalProperties.baseURL + '/common/super-grids/value-sets', valueSetColumnsInfo)
56
50
  .then((columnValueSets) => {
57
51
  valueSetColumnIndexs.forEach((columnIndex) => {
58
52
  let valueSetMap
59
- const prop = columns[columnIndex].prop
60
- ? columns[columnIndex].prop
61
- : columns[columnIndex].label
53
+ const prop = columns[columnIndex].prop ? columns[columnIndex].prop : columns[columnIndex].label
62
54
  for (const prop1 in columnValueSets) {
63
55
  if (prop === prop1) {
64
56
  valueSetMap = columnValueSets[prop]
@@ -70,8 +62,7 @@ function packageEnumAndBeanColumnValueSetsWhenPlate(columns, listCode) {
70
62
  columns[columnIndex].valueSet = valueSetMap.valueSet
71
63
  }
72
64
  if (valueSetMap.titleValueSet) {
73
- columns[columnIndex].titleValueSetValue =
74
- valueSetMap.titleValueSet
65
+ columns[columnIndex].titleValueSetValue = valueSetMap.titleValueSet
75
66
  }
76
67
  }
77
68
  })
@@ -111,7 +102,7 @@ function packageEnumAndBeanColumnValueSet(valueSetInfo) {
111
102
  * 封装值设置为枚举 或 bean方式时的值为'key-value'键值对信息
112
103
  */
113
104
  function packageEnumAndBeanColumnValueSetsWhenOtherSys(columns, listCode, additionalParamMap, entity, systemCode) {
114
- return new Promise((resolve, reject) => {
105
+ return new Promise((resolve, reject) => {
115
106
  const dataSourceList = getDataSourceConfigList(columns)
116
107
  const valueSetColumnIndexs = dataSourceList.valueSetColumnIndexs
117
108
  const param = {
@@ -129,7 +120,7 @@ function packageEnumAndBeanColumnValueSetsWhenOtherSys(columns, listCode, additi
129
120
  .then((result) => {
130
121
  const columnValueSet = result.columnValueSet
131
122
  const columnTitleValueSet = result.columnTitleValueSet
132
- for(let prop in valueSetColumnIndexs){
123
+ for (let prop in valueSetColumnIndexs) {
133
124
  const columnIndex = valueSetColumnIndexs[prop]
134
125
  const valueSet = columnValueSet[prop]
135
126
  if (valueSet) {
@@ -175,7 +166,7 @@ function getDataSourceConfigList(columns) {
175
166
  valueSetColumnIndexs[prop] = i
176
167
  }
177
168
  }
178
- return {dataSourceConfigList, dataSourceConfigListTitle, valueSetColumnIndexs}
169
+ return { dataSourceConfigList, dataSourceConfigListTitle, valueSetColumnIndexs }
179
170
  }
180
171
 
181
172
  function getConfigWithValueSet(valueSetInfo, prop, column) {
@@ -203,41 +194,42 @@ function getConfigWithValueSet(valueSetInfo, prop, column) {
203
194
  }
204
195
  }
205
196
  } else if (beanName && beanName !== '') {
206
- infoObj.type = 'beanName'
207
- infoObj.props = {
208
- prop: prop,
209
- valueSet: BEAN_NAME_PREFIX + beanName
210
- }
211
- }else if(column && column.valueSetOptions) {
212
- // 动态数据源、数据表/视图、服务
197
+ infoObj.type = 'beanName'
198
+ infoObj.props = {
199
+ prop: prop,
200
+ valueSet: BEAN_NAME_PREFIX + beanName
201
+ }
202
+ } else if (column && column.valueSetOptions) {
203
+ // 动态数据源(select开启value-label自动转换或者)、数据表/视图、服务
213
204
  const valueSetOptionsObj = JSON.parse(column.valueSetOptions)
214
- if((valueSetOptionsObj.type || valueSetOptionsObj.dynamicDataSourceCode) && valueSetOptionsObj.valueLabelSwitch){
205
+ if (
206
+ (valueSetOptionsObj.type || valueSetOptionsObj.dynamicDataSourceCode) &&
207
+ (column.componentType === 'radio' || column.componentType === 'checkbox' || valueSetOptionsObj.valueLabelSwitch)
208
+ ) {
215
209
  // 表示是动态数据源等值设置信息
216
210
  // const isShouldInitSearch = (valueSetOptionsObj.filterType === undefined || valueSetOptionsObj.filterType != 'remote')
217
- if(!valueSetOptionsObj.type || valueSetOptionsObj.type !== 'optionGroup'){
211
+ if (!valueSetOptionsObj.type || valueSetOptionsObj.type !== 'optionGroup') {
218
212
  // 选项组时不需要在此处获得
219
213
  Object.assign(infoObj, valueSetOptionsObj)
220
214
  // 更新uuid为字段名
221
215
  infoObj.uuid = prop
222
- if(!infoObj.props){
216
+ if (!infoObj.props) {
223
217
  infoObj.props = {}
224
218
  }
225
219
  infoObj.props.prop = prop
226
220
  }
227
- if(valueSetOptionsObj.dynamicDataSourceCode){
221
+ if (valueSetOptionsObj.dynamicDataSourceCode) {
228
222
  infoObj.type = 'dynamicData'
229
- if(!infoObj.props){
223
+ if (!infoObj.props) {
230
224
  infoObj.props = {}
231
225
  }
232
226
  infoObj.props.code = valueSetOptionsObj.dynamicDataSourceCode
233
227
  }
234
228
  }
235
229
  }
236
- if(infoObj.type){
230
+ if (infoObj.type) {
237
231
  // 表示是有效的值设置
238
232
  return infoObj
239
233
  }
240
234
  return null
241
235
  }
242
-
243
-
@@ -61,7 +61,7 @@ function logout() {
61
61
  }
62
62
 
63
63
  function getCurrentUserPermissionsBySystem(loginName, systemCode) {
64
- console.log('getCurrentUserPermissionsBySystem----loginName=', loginName, isMobileBrowser())
64
+ console.log('getCurrentUserPermissionsBySystem----loginName=', loginName, 'isMobile=',isMobileBrowser(),'systemCode=',systemCode)
65
65
  if(isMobileBrowser()){
66
66
  return getCurrentUserMobilePermissions(loginName)
67
67
  } else {
@@ -72,6 +72,7 @@ function getCurrentUserPermissionsBySystem(loginName, systemCode) {
72
72
  systemCode = window.$vueApp.config.globalProperties.systemCode
73
73
  }
74
74
  }
75
+ console.log('getCurrentUserPermissionsBySystem----loginName=', loginName, 'systemCode222=',systemCode)
75
76
  return request.get(
76
77
  window.$vueApp.config.globalProperties.baseAPI +
77
78
  '/sso/current-users/permissions/with-system?loginName=' +
package/src/permission.js CHANGED
@@ -157,10 +157,11 @@ router.beforeEach((to, from, next) => {
157
157
  // 开发平台本身的功能或直接平台功能时
158
158
  // console.log('开发平台本身的功能或直接平台功能时')
159
159
  let systemCode = to.query ? to.query.customSystem: null
160
+ console.log('getCurrentUserPermissions---systemCode111=', systemCode)
160
161
  if (!systemCode) {
161
162
  systemCode = window.$vueApp.config.globalProperties.currentSystem
162
163
  }
163
- console.log('3333systemCode=', systemCode)
164
+ console.log('getCurrentUserPermissions---systemCode222=', systemCode)
164
165
  return store.dispatch('getCurrentUserPermissions', {loginName:user.loginName, systemCode})
165
166
  }
166
167
  })
@@ -238,7 +238,7 @@ const user = {
238
238
  const loginName = param.loginName
239
239
  const systemCode = param.systemCode
240
240
  let storePermissions = getPermissions(systemCode)
241
- console.log('getCurrentUserPermissions-----systemCode=', systemCode, 'storePermissions=', storePermissions)
241
+ console.log('getCurrentUserPermissions-----systemCode=', systemCode)
242
242
  // 这个判断会导致资源不会重新加载??
243
243
  if (
244
244
  typeof storePermissions === 'undefined' ||
@@ -248,6 +248,7 @@ const user = {
248
248
  ssoService
249
249
  .getCurrentUserPermissionsBySystem(loginName, systemCode)
250
250
  .then((permissions) => {
251
+ console.log('getCurrentUserPermissions-----systemCode=', systemCode, 'permissions[0]=', permissions && permissions.length>0?permissions[0]: null )
251
252
  let currentPermissions = ['index']
252
253
  currentPermissions = currentPermissions.concat(permissions)
253
254
  storePermissions = setPermissions(currentPermissions, systemCode)
@@ -257,6 +258,8 @@ const user = {
257
258
  reject(error)
258
259
  })
259
260
  } else {
261
+ let keys = Object.keys(storePermissions)
262
+ console.log('getCurrentUserPermissions-----systemCode=', systemCode, 'storePermissions[1]=', keys && keys.length>1?keys[1]: null )
260
263
  resolve(storePermissions)
261
264
  }
262
265
  })
@@ -243,6 +243,7 @@ export function getServerConfigUtil(http) {
243
243
  window.$vueApp.config.globalProperties.baseAPI
244
244
  )
245
245
  localStorage.setItem('_baseAPI_', window.$vueApp.config.globalProperties.baseAPI)
246
+ localStorage.setItem('_amb_projectModel_', window.$vueApp.config.globalProperties.projectModel)
246
247
  if (config.fontIconAddress && window.insertCssFile) {
247
248
  window.insertCssFile(`${config.fontIconAddress}/iconfont.css`)
248
249
  }
@@ -26,7 +26,7 @@ export function getSystemCode() {
26
26
 
27
27
  export function getPermissions(systemCode) {
28
28
  let totalPermissions = null
29
- if(!systemCode){
29
+ if(!systemCode || systemCode+''==='null'){
30
30
  systemCode = getSystemCode()
31
31
  }
32
32
  let permissions = localStorage.getItem(permissionKey + systemCode)
@@ -91,17 +91,19 @@ export function getTotalPermissions() {
91
91
  }
92
92
 
93
93
  export function setPermissions(permissions, systemCode) {
94
+ console.log('setPermissions==========systemCode=', systemCode,'isHasPlatPermission----permissions[0]=',permissions && permissions.length > 0 ?permissions[0]: null)
94
95
  const isMobile = isMobileBrowser()
95
96
  let key
96
97
  const permissionObjs = getPermissionObjs(permissions)
97
98
  if(isMobile){
98
99
  key = mobilePermissionKey
99
100
  } else {
100
- if (!systemCode) {
101
+ if (!systemCode || systemCode+''==='null') {
101
102
  systemCode = getSystemCode()
102
103
  }
103
104
  key = permissionKey + systemCode
104
105
  }
106
+ console.log('setPermissions==========systemCode=', systemCode,'key=',key)
105
107
  localStorage.setItem(key, JSON.stringify(permissionObjs))
106
108
  setPermissionAllSystemKey(key)
107
109
  return permissionObjs
@@ -121,7 +123,7 @@ function getPermissionObjs(permissions){
121
123
 
122
124
 
123
125
  export function getMenus(systemCode) {
124
- if (!systemCode) {
126
+ if (!systemCode || systemCode+''==='null') {
125
127
  systemCode = getSystemCode()
126
128
  }
127
129
  const myPermissionMenuKey = getRunInfoKey(permissionMenuKey)
@@ -136,7 +138,7 @@ export function getMenus(systemCode) {
136
138
 
137
139
  export function setMenus(menus, systemCode) {
138
140
  if (menus) {
139
- if (!systemCode) {
141
+ if (!systemCode || systemCode+''==='null') {
140
142
  systemCode = getSystemCode()
141
143
  }
142
144
  const myPermissionMenuKey = getRunInfoKey(permissionMenuKey)
@@ -148,7 +150,7 @@ export function setMenus(menus, systemCode) {
148
150
  }
149
151
 
150
152
  export function removeMenus(systemCode) {
151
- if (!systemCode) {
153
+ if (!systemCode || systemCode+''==='null') {
152
154
  systemCode = getSystemCode()
153
155
  }
154
156
  const myPermissionMenuKey = getRunInfoKey(permissionMenuKey)
package/vite.config.js CHANGED
@@ -12,8 +12,7 @@ export default defineConfig(({ mode }) => ({
12
12
  terser({
13
13
  compress: {
14
14
  drop_debugger: ['production'].includes(mode),
15
- // drop_console: ['production'].includes(mode),
16
- pure_funcs: ['production'].includes(mode) ? ['console.log', 'console.info', 'console.warn', 'console.debug'] : [],
15
+ // pure_funcs: ['production'].includes(mode) ? ['console.log', 'console.info', 'console.warn', 'console.debug'] : [],
17
16
  },
18
17
  output: {
19
18
  // 对于console.error,不做任何处理