agilebuilder-ui 1.1.34 → 1.1.35-sit2

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.
Files changed (34) hide show
  1. package/lib/{401-7193e896.js → 401-10787110.js} +1 -1
  2. package/lib/{404-2852bd20.js → 404-81306f89.js} +1 -1
  3. package/lib/{iframe-page-bcc25b1c.js → iframe-page-bd0c7ac7.js} +1 -1
  4. package/lib/index-5d1deed4.js +73264 -0
  5. package/lib/super-ui.css +1 -1
  6. package/lib/super-ui.js +1 -1
  7. package/lib/super-ui.umd.cjs +89 -89
  8. package/lib/{tab-content-iframe-index-48b3b846.js → tab-content-iframe-index-84fee73c.js} +1 -1
  9. package/lib/{tab-content-index-d25e4873.js → tab-content-index-ddd15021.js} +1 -1
  10. package/lib/{tache-subprocess-history-a72dd967.js → tache-subprocess-history-00e89e0a.js} +1 -1
  11. package/package.json +1 -1
  12. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +5 -1
  13. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +343 -368
  14. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +113 -42
  15. package/packages/organization-input/src/organization-input.vue +11 -0
  16. package/packages/super-grid/src/apis.js +13 -13
  17. package/packages/super-grid/src/dynamic-input.vue +11 -1
  18. package/packages/super-grid/src/formatter.js +58 -57
  19. package/packages/super-grid/src/normal-column-content.vue +149 -56
  20. package/packages/super-grid/src/row-operation.vue +35 -18
  21. package/packages/super-grid/src/search-form-open.vue +0 -1
  22. package/packages/super-grid/src/super-grid-service.js +1 -1
  23. package/packages/super-grid/src/super-grid.vue +135 -97
  24. package/packages/super-icon/src/index.vue +35 -18
  25. package/packages/utils/value-set.js +147 -1
  26. package/src/styles/display-layout.scss +1 -1
  27. package/src/styles/index.scss +7 -1
  28. package/src/utils/auth-api.js +4 -0
  29. package/src/utils/common-util.js +3 -0
  30. package/src/utils/dingtalk-util.ts +23 -17
  31. package/src/utils/util.js +721 -715
  32. package/src/views/dsc-component/Sidebar/Item.vue +76 -60
  33. package/src/views/layout/components/Menubar/Item.vue +94 -74
  34. package/lib/index-d502d8fe.js +0 -72779
@@ -65,6 +65,7 @@ import Compressor from 'compressorjs'
65
65
  import { ElMessage } from 'element-plus'
66
66
  import { useI18n } from 'vue-i18n'
67
67
  import FileUploadComponent from './file-upload-component.vue'
68
+ import { isRef } from 'vue'
68
69
 
69
70
  const props = defineProps({
70
71
  openFsUpload: {
@@ -181,13 +182,17 @@ const props = defineProps({
181
182
  default: () => {}
182
183
  }
183
184
  })
185
+
184
186
  const multipleUpload = ref<string | null>(null)
185
187
  if (props.multiple) {
186
188
  multipleUpload.value = 'multiple'
187
189
  }
188
190
  const isDingTalk = ref(false)
189
191
  const authSource = window.localStorage.getItem('auth_source')
190
- if (authSource && authSource === 'dingtalk') {
192
+
193
+ if (authSource && authSource === 'dingtalk' && window.top && window.top.$dd) {
194
+ console.log('当前是钉钉环境')
195
+ // 如果是钉钉环境 并且已经加载了钉钉jsapi
191
196
  isDingTalk.value = true
192
197
  }
193
198
 
@@ -251,13 +256,13 @@ function pickBrowserFiles() {
251
256
  // if (props.openCameraOrChoosePhoto && props.openCameraOrChoosePhoto === 'openCamera') {
252
257
  // 只打开相机
253
258
  myAccept.value = 'image/*'
254
- // if (isDingTalk.value) {
255
- // dingtalkChooseImage()
256
- // } else {
257
- setTimeout(() => {
258
- fileRef.value.click()
259
- })
260
- // }
259
+ if (isDingTalk.value) {
260
+ dingtalkChooseImage()
261
+ } else {
262
+ setTimeout(() => {
263
+ fileRef.value.click()
264
+ })
265
+ }
261
266
  // } else {
262
267
  // // 相机和文件都可以选
263
268
  // myAccept.value = '*'
@@ -329,7 +334,7 @@ async function uploadBrowserFile() {
329
334
  console.error('未选择任何文件')
330
335
  return
331
336
  }
332
- let uploadFiles = []
337
+ let uploadFiles: File[] = []
333
338
  try {
334
339
  uploadFiles = await compressionImg(selectFiles)
335
340
  } catch (error) {
@@ -348,32 +353,7 @@ async function uploadBrowserFile() {
348
353
  } else {
349
354
  param.append('file', uploadFiles[0])
350
355
  }
351
- param.append('systemCode', props.systemCode)
352
-
353
- window.$vueApp.config.globalProperties.$http
354
- .post(defaultAction.value, param, { headers: { 'Content-Type': 'multipart/form-data', Authorization: getToken() } })
355
- .then((result) => {
356
- // result:批量上传时返回的是集合,单选上传时返回的是对象
357
- console.log('上传后返回值==result=', result)
358
- if (result) {
359
- if (props.multiple) {
360
- if (result.length > 0) {
361
- // this.tempFileList.push(...result)
362
- uploadComplete(result)
363
- } else {
364
- console.error('多选时上传后返回值异常')
365
- }
366
- } else {
367
- // this.tempFileList.push(result)
368
- uploadComplete(result)
369
- }
370
- } else {
371
- console.error('上传后返回值异常')
372
- }
373
- })
374
- .catch(() => {
375
- isUploading.value = false
376
- })
356
+ uploadFileToServer(param)
377
357
  }
378
358
  function validateCanUploadFile(file, limitFileSize) {
379
359
  let isCanUpload = true
@@ -399,6 +379,7 @@ function uploadComplete(result) {
399
379
  } else {
400
380
  // 单选时将已选文件移除,然后再替换为新上传的文件
401
381
  const rmFiles = JSON.parse(JSON.stringify(fileListResult.value))
382
+ fileListResult.value = []
402
383
  fileListResult.value.push(result)
403
384
  emits('remove', { rmFiles, serverFiles: fileListResult.value, index: 0 })
404
385
  }
@@ -421,7 +402,7 @@ function uploadBrowserFiles() {
421
402
  ElMessage({
422
403
  showClose: true,
423
404
  type: 'warning',
424
- message: '文件最大上传数量: 1'
405
+ message: t('fsUpload.theNumberOfUploadsExceedsTheLimitTheLimitIs') + ': 1'
425
406
  })
426
407
  fileRef.value.value = null
427
408
  return
@@ -442,11 +423,11 @@ function uploadNoNewFiles() {
442
423
  emits('uploadend', fileListResult.value)
443
424
  }
444
425
 
445
- function compressionImg(selectFiles) {
446
- const uploadFilesPromises = []
426
+ function compressionImg(selectFiles: File[]): Promise<File[]> {
427
+ const uploadFilesPromises: Promise<File>[] = []
447
428
  for (let i = 0; i < selectFiles.length; i++) {
448
429
  uploadFilesPromises.push(
449
- new Promise((resolve, reject) => {
430
+ new Promise<File>((resolve, reject) => {
450
431
  console.log(`压缩前 size ${selectFiles[i].size / 1024 / 1024} MB`)
451
432
  // eslint-disable-next-line no-new
452
433
  new Compressor(selectFiles[i], {
@@ -483,7 +464,20 @@ function dingtalkChooseImage() {
483
464
  if (props.multiple) {
484
465
  count = 20
485
466
  if (props.limit) {
486
- count = props.limit
467
+ // 限制上传数量
468
+ if (fileListResult.value && fileListResult.value.length > 0) {
469
+ if (props.limit === fileListResult.value.length) {
470
+ ElMessage({
471
+ showClose: true,
472
+ type: 'warning',
473
+ message: t('fsUpload.theNumberOfUploadsExceedsTheLimitTheLimitIs') + ': ' + props.limit
474
+ })
475
+ return
476
+ }
477
+ count = props.limit - fileListResult.value.length
478
+ } else {
479
+ count = props.limit
480
+ }
487
481
  }
488
482
  }
489
483
  window.top.$dd.biz.util
@@ -491,11 +485,88 @@ function dingtalkChooseImage() {
491
485
  sourceType: sourceType,
492
486
  count: count
493
487
  })
494
- .then((res) => {
495
- //
488
+ .then(async (res) => {
489
+ console.log('dingtalkChooseImage res=', res)
490
+ // fileUploadRef.value.changeFileList(fileListResult.value)
496
491
  if (res && res.filePaths && res.filePaths.length > 0) {
492
+ fetchDingTalkFile(res.files).then(async (sourceFiles) => {
493
+ let uploadFiles: File[] = []
494
+ try {
495
+ uploadFiles = await compressionImg(sourceFiles)
496
+ } catch (error) {
497
+ console.error('压缩图片失败', error)
498
+ uploadFiles = sourceFiles
499
+ }
500
+ if (uploadFiles && uploadFiles.length > 0) {
501
+ const param = new FormData()
502
+ let limitFileSize = props.limitFileSize
503
+ if (limitFileSize === undefined) {
504
+ // 默认是30M
505
+ limitFileSize = 30
506
+ }
507
+ if (props.multiple) {
508
+ if (fileListResult.value && fileListResult.value.length > 0) {
509
+ if (fileListResult.value.length + uploadFiles.length > props.limit) {
510
+ ElMessage({
511
+ showClose: true,
512
+ type: 'warning',
513
+ message: t('fsUpload.theNumberOfUploadsExceedsTheLimitTheLimitIs') + ': ' + props.limit
514
+ })
515
+ return
516
+ }
517
+ }
518
+ for (let i = 0; i < uploadFiles.length; i++) {
519
+ param.append('files', uploadFiles[i])
520
+ }
521
+ } else {
522
+ param.append('file', uploadFiles[0])
523
+ }
524
+ uploadFileToServer(param)
525
+ }
526
+ })
527
+ }
528
+ })
529
+ }
530
+ async function fetchDingTalkFile(files: any) {
531
+ const uploadFiles: any = []
532
+ for (let index = 0; index < files.length; index++) {
533
+ const file = files[index]
534
+ const response = await fetch(file.path)
535
+ const blob = await response.blob()
536
+ // https://resource/216576ea16afcbee18c392d15814827.image
537
+ const fileName = file.path.replace('https://resource/', '').replace('.image', '')
538
+ // 构造 File 对象
539
+ uploadFiles.push(new File([blob], fileName + '.' + file.fileType, { type: blob.type }))
540
+ }
541
+ return uploadFiles
542
+ }
543
+
544
+ function uploadFileToServer(param: FormData) {
545
+ param.append('systemCode', props.systemCode)
546
+ window.$vueApp.config.globalProperties.$http
547
+ .post(defaultAction.value, param, { headers: { 'Content-Type': 'multipart/form-data', Authorization: getToken() } })
548
+ .then((result) => {
549
+ // result:批量上传时返回的是集合,单选上传时返回的是对象
550
+ console.log('上传后返回值==result=', result)
551
+ if (result) {
552
+ if (props.multiple) {
553
+ if (result.length > 0) {
554
+ // this.tempFileList.push(...result)
555
+ uploadComplete(result)
556
+ } else {
557
+ console.error('多选时上传后返回值异常')
558
+ }
559
+ } else {
560
+ // this.tempFileList.push(result)
561
+ uploadComplete(result)
562
+ }
563
+ } else {
564
+ console.error('上传后返回值异常')
497
565
  }
498
566
  })
567
+ .catch(() => {
568
+ isUploading.value = false
569
+ })
499
570
  }
500
571
  </script>
501
572
 
@@ -411,6 +411,17 @@ export default {
411
411
  }
412
412
  }
413
413
  return branchDeptIds.join(this.separator)
414
+ } else if (orgDataType === 'divisionManager') {
415
+ let divisionManagerArr = []
416
+ if (isUserTree) {
417
+ if (selectNodeInfo.divisionManager && selectNodeInfo.divisionManager.length > 0) {
418
+ divisionManagerArr = selectNodeInfo.divisionManager
419
+ }
420
+ }
421
+ if (divisionManagerArr && divisionManagerArr.length > 0) {
422
+ return divisionManagerArr.join(this.separator)
423
+ }
424
+ return null
414
425
  }
415
426
  } else {
416
427
  // 单选树时
@@ -21,8 +21,8 @@ import {
21
21
  import eventBus from './eventBus'
22
22
  import { isPromise } from '../../../src/utils/common-util'
23
23
  import { updateWithPageValue } from '../../../src/utils/jump-page-utils'
24
- import { getGuId } from '../../../src/utils/guid.js';
25
- import { ElMessageBox } from 'element-plus';
24
+ import { getGuId } from '../../../src/utils/guid.js'
25
+ import { ElMessageBox } from 'element-plus'
26
26
 
27
27
  const apis = {
28
28
  // 列表工具栏控件刷新列表数据。添加该方法解决工具栏值清空后,列表内容没有还原问题
@@ -369,7 +369,7 @@ const apis = {
369
369
  }
370
370
  return {
371
371
  $rowDataGuId: getGuId(),
372
- ...row,
372
+ ...row
373
373
  }
374
374
  },
375
375
  // 设置默认值null
@@ -459,23 +459,23 @@ const apis = {
459
459
  if (action === 'confirm') {
460
460
  this.saveRow(rowIndex, listCode).then((res) => {
461
461
  // this.editRow(rowIndex, listCode, true)
462
- callback?.('confirm');
463
- done();
462
+ callback?.('confirm')
463
+ done()
464
464
  })
465
465
  } else if (action === 'cancel') {
466
466
  this.restoreCurrentRow(rowIndex, listCode)
467
- callback?.('cancel');
468
- done();
467
+ callback?.('cancel')
468
+ done()
469
469
  } else if (action === 'close') {
470
- done();
470
+ done()
471
471
  }
472
- },
472
+ }
473
473
  }
474
474
  )
475
475
  }
476
476
  },
477
- // 编辑行
478
- editRow(rowIndex, listCode, isSaveCallback) {
477
+ // 编辑行 SkipBeforeEdit 是否跳过编辑前校验
478
+ editRow(rowIndex, listCode, isSaveCallback, SkipBeforeEdit) {
479
479
  if (!listCode) {
480
480
  listCode = store.get('_list_code')
481
481
  }
@@ -516,7 +516,7 @@ const apis = {
516
516
  }
517
517
 
518
518
  let canEdit = true
519
- if (isEditOptionFunction('beforeEdit', listCode)) {
519
+ if (!SkipBeforeEdit && isEditOptionFunction('beforeEdit', listCode)) {
520
520
  const isSubTableShowPage = gridParams.isSubTableShowPage
521
521
  // 每页显示多少条
522
522
  const pageSize = gridParams.pagination && gridParams.pagination.pageSize
@@ -1473,7 +1473,7 @@ export const apisMixin = {
1473
1473
  isMulitiSelect: false,
1474
1474
  sql: false,
1475
1475
  restoreCurrentRowTimer: null
1476
- };
1476
+ }
1477
1477
  },
1478
1478
  methods: {
1479
1479
  ...apis
@@ -28,7 +28,7 @@
28
28
  <div v-else :style="row.validateErrorField && row.validateErrorField === column.prop ? 'border:1px solid red' : ''">
29
29
  <!--必须有@input ,否则无法输入值-->
30
30
  <el-date-picker
31
- v-if="type === 'year' || type === 'month'"
31
+ v-if="type === 'year' || type === 'month' || type === 'week'"
32
32
  ref="item"
33
33
  v-model="innerValue"
34
34
  :disabled="disabled"
@@ -1844,6 +1844,11 @@ export default {
1844
1844
  if (this.column.dataType === 'TEXT' || this.column.dataType === 'text') {
1845
1845
  return this.isFormat()
1846
1846
  }
1847
+ if (this.type === 'week') {
1848
+ if (this.controlConfig && this.controlConfig.valueFormat) {
1849
+ return this.controlConfig.valueFormat
1850
+ }
1851
+ }
1847
1852
  // timestamp毫秒值为x
1848
1853
  return 'x'
1849
1854
  },
@@ -1862,6 +1867,11 @@ export default {
1862
1867
  return 'MM'
1863
1868
  } else if (this.type === 'date') {
1864
1869
  return 'YYYY-MM-DD'
1870
+ } else if (this.type === 'week') {
1871
+ if (this.controlConfig && this.controlConfig.format) {
1872
+ return this.controlConfig.format
1873
+ }
1874
+ return 'ww'
1865
1875
  } else if (this.type === 'time' || this.column.dataType === 'TIME') {
1866
1876
  return 'HH:mm:ss'
1867
1877
  } else if (this.column.dataType === 'DATE') {
@@ -1,4 +1,7 @@
1
1
  import { isDynamicDataSourceSource } from './utils'
2
+ import dayjs from 'dayjs'
3
+ import weekOfYear from 'dayjs/plugin/weekOfYear'
4
+ dayjs.extend(weekOfYear)
2
5
  const formatter = {
3
6
  number: function (inputValue, options) {
4
7
  // 小数位数
@@ -19,10 +22,7 @@ const formatter = {
19
22
  }
20
23
  if (isDelimiter) {
21
24
  const inputValueStr = inputValue + ''
22
- const value = inputValueStr.replace(
23
- /\d{1,3}(?=(\d{3})+(\.\d*)?$)/g,
24
- '$&,'
25
- )
25
+ const value = inputValueStr.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
26
26
  if (sign) {
27
27
  return value + sign
28
28
  } else {
@@ -65,47 +65,52 @@ const formatter = {
65
65
  date: function (value, options) {
66
66
  // format格式,例如:yyyy-m-d,yyyy-m-d hh:mm:ss等等
67
67
  const format = options.format
68
+
68
69
  if (value != null) {
69
- const date = new Date(value)
70
- var y = date.getFullYear()
71
- var m = date.getMonth() + 1
72
- var d = date.getDate()
73
- var h = date.getHours()
74
- var min = date.getMinutes()
75
- var s = date.getSeconds()
76
- if (m < 10) {
77
- m = '0' + m
78
- }
79
- if (d < 10) {
80
- d = '0' + d
81
- }
82
- // if (format.indexOf('hh') >= 0) {
83
- // h = h > 12 ? h - 12 : h
84
- // } else {
85
- if (h < 10) {
86
- h = '0' + h
87
- }
88
- // }
89
- if (min < 10) {
90
- min = '0' + min
91
- }
92
- if (s < 10) {
93
- s = '0' + s
94
- }
95
- const newValue = format
96
- .replace('yyyy', y)
97
- .replace('mm', min)
98
- .replace('M', m)
99
- .replace('m', m)
100
- .replace('d', d)
101
- .replace('hh', h)
102
- .replace('HH', h)
103
- .replace('ss', s)
104
- // 判断格式化的值是否包含NaN,如果包含NaN取数据库的值
105
- if (newValue.indexOf('NaN') === -1) {
106
- return newValue
70
+ if (format === 'ww') {
71
+ return dayjs(value).week()
72
+ } else {
73
+ const date = new Date(value)
74
+ var y = date.getFullYear()
75
+ var m = date.getMonth() + 1
76
+ var d = date.getDate()
77
+ var h = date.getHours()
78
+ var min = date.getMinutes()
79
+ var s = date.getSeconds()
80
+ if (m < 10) {
81
+ m = '0' + m
82
+ }
83
+ if (d < 10) {
84
+ d = '0' + d
85
+ }
86
+ // if (format.indexOf('hh') >= 0) {
87
+ // h = h > 12 ? h - 12 : h
88
+ // } else {
89
+ if (h < 10) {
90
+ h = '0' + h
91
+ }
92
+ // }
93
+ if (min < 10) {
94
+ min = '0' + min
95
+ }
96
+ if (s < 10) {
97
+ s = '0' + s
98
+ }
99
+ const newValue = format
100
+ .replace('yyyy', y)
101
+ .replace('mm', min)
102
+ .replace('M', m)
103
+ .replace('m', m)
104
+ .replace('d', d)
105
+ .replace('hh', h)
106
+ .replace('HH', h)
107
+ .replace('ss', s)
108
+ // 判断格式化的值是否包含NaN,如果包含NaN取数据库的值
109
+ if (newValue.indexOf('NaN') === -1) {
110
+ return newValue
111
+ }
112
+ return value
107
113
  }
108
- return value
109
114
  }
110
115
  return value
111
116
  },
@@ -117,7 +122,7 @@ const formatter = {
117
122
  return this.number(value, options) + '%'
118
123
  }
119
124
  return value
120
- },
125
+ }
121
126
  }
122
127
 
123
128
  export function doFormat(column, value) {
@@ -132,24 +137,21 @@ export function doFormat(column, value) {
132
137
  column.formatter = {
133
138
  type: 'date',
134
139
  options: {
135
- format: 'yyyy-m-d',
136
- },
140
+ format: 'yyyy-m-d'
141
+ }
137
142
  }
138
143
  } else if (column.dataType === 'TIME') {
139
144
  // 默认的“TIME”类型的格式设置
140
145
  column.formatter = {
141
146
  type: 'time',
142
147
  options: {
143
- format: 'yyyy-m-d hh:mm:ss',
144
- },
148
+ format: 'yyyy-m-d hh:mm:ss'
149
+ }
145
150
  }
146
151
  }
147
152
  }
148
153
  const columnFormatter = column.formatter
149
- if (
150
- columnFormatter !== undefined &&
151
- formatter[columnFormatter.type] !== undefined
152
- ) {
154
+ if (columnFormatter !== undefined && formatter[columnFormatter.type] !== undefined) {
153
155
  return formatter[columnFormatter.type](value, columnFormatter.options)
154
156
  } else {
155
157
  return value
@@ -163,10 +165,7 @@ export function doFormatWithValueSet(column, value) {
163
165
  const valueSet = column.valueSet
164
166
  // 先处理值设置再处理格式化设置:即会对值设置的结果进行格式化设置
165
167
  if (valueSet !== undefined) {
166
- if (
167
- column.componentType === 'multiselect' &&
168
- !isDynamicDataSourceSource(column)
169
- ) {
168
+ if (column.componentType === 'multiselect') {
170
169
  if (typeof value === 'number') {
171
170
  // 当value是0时, value instanceof Number 为false
172
171
  value += ''
@@ -181,7 +180,9 @@ export function doFormatWithValueSet(column, value) {
181
180
  label.push(item[0].label)
182
181
  }
183
182
  })
184
- value = label.join(',')
183
+ if(label.length > 0){
184
+ value = label.join(',')
185
+ }
185
186
  } else {
186
187
  const item = valueSet.filter((item) => {
187
188
  return item.value === value + ''