agilebuilder-ui 1.1.40 → 1.1.41

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.
@@ -1,133 +1,35 @@
1
1
  <template>
2
- <span>
2
+ <span style="width: 100%">
3
3
  <template v-if="!disabled">
4
4
  <template v-if="!isMobile">
5
- <el-input
6
- ref="item"
5
+ <fs-preview
6
+ :enable-delete="true"
7
+ :entity="row"
7
8
  :disabled="disabled"
8
- :model-value="value"
9
- :placeholder="$t('imatrixUIMessage.fileUpload')"
10
- :readonly="true"
9
+ :fileInfo="fileInfo"
10
+ :file-set-obj="fileSetObj"
11
+ :is-sql="isSql"
12
+ :label="value"
13
+ @delete-file="deleteRow"
11
14
  >
12
- <template v-slot:append>
13
- <div class="group-link-btn-main">
14
- <el-link v-if="!disabled" type="info" :underline="false" @click="openAnnexUpload">
15
- <template v-slot:icon>
16
- <el-icon :size="14"><Upload /></el-icon>
17
- </template>
18
- </el-link>
19
- <el-link size="default" type="info" :underline="false" @click="preview">
20
- <template v-slot:icon>
21
- <el-icon :size="14"><ZoomIn /></el-icon>
22
- </template>
23
- </el-link>
24
- </div>
15
+ <template #prefix>
16
+ <el-upload
17
+ :accept="fileSetObj.accept ? fileSetObj.accept : null"
18
+ :action="defaultAction"
19
+ :multiple="fileSetObj.multiple"
20
+ :before-upload="handleBeforeUpload"
21
+ :show-file-list="false"
22
+ :headers="headers"
23
+ :on-success="uploadOnSuccess"
24
+ :with-credentials="true"
25
+ name="file"
26
+ >
27
+ <el-button size="small" style="margin-right: 5px" bg>
28
+ <el-icon><UploadFilled /></el-icon>
29
+ </el-button>
30
+ </el-upload>
25
31
  </template>
26
- </el-input>
27
-
28
- <el-dialog
29
- v-model="annexUploadFlag"
30
- :append-to-body="true"
31
- :show-close="true"
32
- :title="$t('imatrixUIMessage.upload')"
33
- width="30%"
34
- >
35
- <el-upload
36
- v-if="annexUploadFlag"
37
- :accept="fileSetObj.accept ? fileSetObj.accept : null"
38
- :action="defaultAction"
39
- :multiple="fileSetObj.multiple"
40
- :before-upload="handleBeforeUpload"
41
- :headers="headers"
42
- :on-success="uploadOnSuccess"
43
- :with-credentials="true"
44
- name="file"
45
- >
46
- <el-button>{{ $t('imatrixUIMessage.upload') }}</el-button>
47
- </el-upload>
48
- </el-dialog>
49
- <el-dialog
50
- v-model="showPreviewSingleImage"
51
- :append-to-body="true"
52
- :show-close="true"
53
- :title="$t('imatrixUIPublicModel.previewImage')"
54
- @close="$emit('close')"
55
- >
56
- <template v-slot:title>
57
- <span
58
- >{{ $t('imatrixUIPublicModel.previewImage') }}
59
- <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
60
- <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
61
- </span>
62
- </template>
63
- <el-image
64
- v-if="previewImageInfo && previewImageInfo.isImg"
65
- :preview-src-list="[previewImageInfo.src]"
66
- :src="previewImageInfo.src"
67
- />
68
- </el-dialog>
69
- <el-dialog
70
- v-model="showPreviewMulti"
71
- :append-to-body="true"
72
- :show-close="true"
73
- :title="$t('imatrixUIPublicModel.preview')"
74
- width="30%"
75
- @close="$emit('close')"
76
- >
77
- <template v-slot:title>
78
- <span
79
- >{{ $t('imatrixUIPublicModel.preview') }}
80
- <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
81
- <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
82
- </span>
83
- </template>
84
- <el-table :show-header="false" :data="showFileList" max-height="60vh">
85
- <el-table-column prop="showName" show-overflow-tooltip>
86
- <template v-slot="scope">
87
- <div style="display: flex; align-items: center">
88
- <span>
89
- <super-icon :iconValue="getFileIconByName(scope.row.showName)" />
90
- </span>
91
- <span class="amb-list-preivew-name" @click="previewSingle(scope.row)">
92
- {{ scope.row.showName }}
93
- </span>
94
- </div>
95
- </template>
96
- </el-table-column>
97
- <el-table-column width="80" align="center">
98
- <template v-slot="scope">
99
- <div style="margin: -10px 0">
100
- <el-tooltip
101
- v-if="!fileSetObj.disabledNoPreview"
102
- :content="$t('imatrixUIPublicModel.preview')"
103
- class="item"
104
- effect="dark"
105
- placement="top"
106
- >
107
- <el-button type="text" @click="previewSingle(scope.row)">
108
- <el-icon style="cursor: pointer">
109
- <el-icon-view />
110
- </el-icon>
111
- </el-button>
112
- </el-tooltip>
113
- <el-tooltip
114
- v-if="!disabled"
115
- :content="$t('imatrixUIPublicModel.delete')"
116
- class="item"
117
- effect="dark"
118
- placement="top"
119
- >
120
- <el-button type="text" @click="deleteRow(scope.$index)">
121
- <el-icon style="cursor: pointer">
122
- <el-icon-delete />
123
- </el-icon>
124
- </el-button>
125
- </el-tooltip>
126
- </div>
127
- </template>
128
- </el-table-column>
129
- </el-table>
130
- </el-dialog>
32
+ </fs-preview>
131
33
  </template>
132
34
  <FileUploadInputMobile
133
35
  v-else
@@ -177,6 +79,7 @@ import { packageFile } from '../../super-grid/src/utils'
177
79
  import FileUploadInputMobile from '../../fs-upload-new/src/file-upload-mobile/file-upload-input.vue'
178
80
  import { Base64 } from 'js-base64'
179
81
  import { getFileIconByName } from '../../../src/utils/file-util'
82
+ import { ElMessage } from 'element-plus'
180
83
  export default {
181
84
  name: 'FsUploadList',
182
85
  props: {
@@ -278,9 +181,28 @@ export default {
278
181
  ElIconDelete,
279
182
  FileUploadInputMobile
280
183
  },
281
- created() {},
184
+ created() {
185
+ this.fileList.length = 0
186
+ this.fileList.push(...this.getFileList())
187
+ },
282
188
  mounted() {},
283
189
  methods: {
190
+ getFileList() {
191
+ const fileList = []
192
+ if (this.fileInfo?.serverPath) {
193
+ const uuids = this.fileInfo.serverPath.split(',')
194
+ const names = this.fileInfo.showName.split(',')
195
+ for (let i = 0; i < uuids.length; i++) {
196
+ if (uuids[i]) {
197
+ fileList.push({
198
+ serverPath: uuids[i],
199
+ showName: names[i]
200
+ })
201
+ }
202
+ }
203
+ }
204
+ return fileList
205
+ },
284
206
  openAnnexUpload() {
285
207
  if (this.openFsUpload) {
286
208
  this.annexUploadFlag = true
@@ -320,6 +242,7 @@ export default {
320
242
  // 上传成功
321
243
  uploadOnSuccess(response, file) {
322
244
  if (response) {
245
+ ElMessage.success(this.$t('fsUpload.uploadSucceeded'))
323
246
  $emit(this, 'upload-success', {
324
247
  showName: response.name,
325
248
  serverPath: response.serverPath
@@ -339,100 +262,33 @@ export default {
339
262
  }
340
263
  this.annexUploadFlag = false
341
264
  },
342
- preview() {
343
- this.fileList.length = 0
344
- const uuids = this.fileInfo.serverPath.split(',')
345
- const baseURL = window.$vueApp.config.globalProperties.baseURL
346
- const baseAPI = window.$vueApp.config.globalProperties.baseAPI
347
- let tempAction = baseURL + '/common/fs-upload/search-file-names'
348
- if (isPlateSys(window.$vueApp.config.globalProperties.systemCode)) {
349
- tempAction = baseAPI + '/api/search-file-names'
350
- }
351
- this.$http.post(tempAction, uuids).then((result) => {
352
- uuids.forEach((uuid) => {
353
- this.fileList.push({ showName: result[uuid], serverPath: uuid })
354
- })
355
- this.showFileList = this.fileList
356
- this.showPreviewMulti = true
357
- })
358
- },
359
- previewSingle(fileInfo) {
360
- fileInfo = packageFile(fileInfo.showName, fileInfo.serverPath)
361
- if (isImage(fileInfo.showName)) {
362
- this.previewImageInfo = fileInfo
363
- this.showPreviewSingleImage = true
364
- } else {
365
- this.previewDoc(fileInfo)
366
- }
367
- },
368
- previewDoc(file) {
369
- const showName = file.showName.replace('#', '~~').replace('?', '~$').replace('&', '$')
370
- const token = getToken()
371
- if (window.$vueApp.config.globalProperties.customPreviewUrl) {
372
- window.open(
373
- getSystemFrontendUrl(window.$vueApp.config.globalProperties.portalUrl) +
374
- '/#/file-service/preview?serverPath=' +
375
- file.serverPath +
376
- '&showName=' +
377
- encodeURI(showName),
378
- file.showName
379
- )
380
- } else {
381
- let previewUrl
382
- const myShowName = showName
383
- const uuid = file.serverPath
384
- let baseUrl = window.$vueApp.config.globalProperties.baseURL
385
- if (isPlateSys(window.$vueApp.config.globalProperties.systemCode)) {
386
- baseUrl = window.$vueApp.config.globalProperties.baseAPI
387
- }
388
- if (window.$vueApp.config.globalProperties.kkFileViewUrl) {
389
- const originUrl =
390
- baseUrl +
391
- '/common/super-form/downloads?jwt=' +
392
- token +
393
- '&showName=' +
394
- encodeURI(myShowName) +
395
- '&serverPath=' +
396
- uuid
397
- //要预览文件的访问地址
398
- const myPreviewUrl = originUrl + '&fullfilename=' + myShowName
399
- // http://127.0.0.1:8012/onlinePreview
400
- previewUrl =
401
- window.$vueApp.config.globalProperties.kkFileViewUrl +
402
- '?url=' +
403
- encodeURIComponent(Base64.encode(myPreviewUrl))
404
- } else {
405
- previewUrl = baseUrl + '/common/fs-upload/preview?jwt=' + token
406
- previewUrl = previewUrl + '&showName=' + encodeURI(myShowName) + '&serverPath=' + uuid
407
- }
408
- window.open(previewUrl, myShowName)
409
- }
410
- },
411
- deleteRow(index) {
412
- const deleteFile = this.showFileList[index]
265
+ deleteRow(deleteFile) {
413
266
  // this.fileList.splice(index, 1)
414
267
  const nameArr = []
415
268
  const pathArr = []
416
- for (let i = 0; i < this.showFileList.length; i++) {
417
- if (i !== index) {
418
- nameArr.push(this.showFileList[i].showName)
419
- pathArr.push(this.showFileList[i].serverPath)
269
+ let deleteFileIndex = -1
270
+ for (let i = 0; i < this.fileList.length; i++) {
271
+ if (this.fileList[i].serverPath !== deleteFile.serverPath) {
272
+ nameArr.push(this.fileList[i].showName)
273
+ pathArr.push(this.fileList[i].serverPath)
274
+ } else {
275
+ deleteFileIndex = i
420
276
  }
421
277
  }
422
278
  if (nameArr.length === 0) {
423
279
  this.fileInfo.showName = null
424
280
  this.fileInfo.serverPath = null
425
- this.showFileList = []
281
+ this.fileList.length = 0
426
282
  $emit(this, 'delete-success', { deleteFile: deleteFile, all: [] })
427
- $emit(this, 'delete', [], index)
283
+ $emit(this, 'delete', [], deleteFileIndex)
428
284
  } else {
429
285
  this.fileInfo.showName = nameArr.join(',')
430
286
  this.fileInfo.serverPath = pathArr.join(',')
431
287
  $emit(this, 'delete-success', {
432
288
  deleteFile: deleteFile,
433
- all: this.showFileList
289
+ all: this.fileList
434
290
  })
435
- $emit(this, 'delete', this.showFileList, index)
291
+ $emit(this, 'delete', this.fileList, deleteFileIndex)
436
292
  }
437
293
  },
438
294
  // 移动端上传成功
@@ -132,9 +132,9 @@ import FsDragUpload from './fs-drag-upload.vue'
132
132
  import FsButtonUpload from './fs-button-upload.vue'
133
133
  import FileUploadMobile from './file-upload-mobile/file-upload.vue'
134
134
  import FileUploadInputMobile from './file-upload-mobile/file-upload-input.vue'
135
+ import FsUploadList from '../../fs-upload-list/src/fs-upload-list.vue'
135
136
  import { ref, defineProps } from 'vue'
136
137
  import { getReplaceUrlDomain, isMobileBrowser, isPlateSys } from '../../../src/utils/common-util'
137
- import { Download } from '@element-plus/icons-vue'
138
138
  const props = defineProps({
139
139
  openFsUpload: {
140
140
  type: Object,
@@ -713,7 +713,6 @@ export default {
713
713
  annexUploadFlag: false,
714
714
  defaultAction,
715
715
  fileMultiple: false, // 文件是否多选
716
- lastFileName: '',
717
716
  fileList: [],
718
717
  lastServerName: '',
719
718
  fileSetObj: null,
@@ -838,7 +837,6 @@ export default {
838
837
  this.fileMultiple = true
839
838
  }
840
839
  this.fileList = getFileList(this.row, this.column, this.isSql)
841
- this.packageFileNameWithFileList()
842
840
  }
843
841
 
844
842
  if (this.column.componentType === 'inputNumber') {
@@ -1323,6 +1321,7 @@ export default {
1323
1321
  this.radioStorageFile(fileSetObj, responseFile)
1324
1322
  }
1325
1323
  this.fileList = getFileList(this.row, this.column, this.isSql)
1324
+ console.log('superGrid---uploadOnSuccess----fileList=', this.fileList)
1326
1325
  }
1327
1326
  }
1328
1327
  }
@@ -1368,7 +1367,6 @@ export default {
1368
1367
  }
1369
1368
  }
1370
1369
  }
1371
- this.packageFileNameWithFileList([{ showName: responseFile.name, serverPath: responseFile.serverPath }])
1372
1370
  },
1373
1371
  // 多选上传完成后存储
1374
1372
  multiStorage(fileSetObj, responseFile) {
@@ -1453,7 +1451,6 @@ export default {
1453
1451
  serverPath: pathNameStr
1454
1452
  })
1455
1453
  }
1456
- this.packageFileNameWithFileList()
1457
1454
  },
1458
1455
  // 多选上传完成后存储 移动端时
1459
1456
  multiStorageMobile(fileSetObj, responseFiles) {
@@ -1545,7 +1542,6 @@ export default {
1545
1542
  serverPath: pathNameStr
1546
1543
  })
1547
1544
  }
1548
- this.packageFileNameWithFileList()
1549
1545
  },
1550
1546
  responseFileToFileObj(fileSetObj, responseFile) {
1551
1547
  const fileObj = {}
@@ -1601,11 +1597,12 @@ export default {
1601
1597
  }
1602
1598
  },
1603
1599
  deleteFile(fileList, index) {
1600
+ console.log(JSON.stringify(fileList))
1604
1601
  this.fileList = fileList
1605
1602
  if (index !== undefined && index !== -1) {
1606
1603
  this.fileList.splice(index, 1)
1607
1604
  }
1608
- this.packageFileNameWithFileList()
1605
+ console.log(JSON.stringify(this.fileList))
1609
1606
  if (this.column.fileSet && this.column.fileSet !== '') {
1610
1607
  const fileSetObj = JSON.parse(this.column.fileSet)
1611
1608
  if (fileSetObj) {
@@ -1620,26 +1617,6 @@ export default {
1620
1617
  }
1621
1618
  }
1622
1619
  },
1623
- packageFileNameWithFileList(fileList) {
1624
- if (!fileList) {
1625
- fileList = this.fileList
1626
- }
1627
- if (fileList && fileList.length > 0) {
1628
- let fileNames = ''
1629
- let fileServerName = ''
1630
- fileList.forEach((item) => {
1631
- fileNames += item.showName + ','
1632
- fileServerName += item.serverPath + ','
1633
- })
1634
- if (fileNames && fileNames.indexOf(',') > 0) {
1635
- this.lastFileName = fileNames.substring(0, fileNames.lastIndexOf(','))
1636
- this.lastServerName = fileServerName.substring(0, fileServerName.lastIndexOf(','))
1637
- }
1638
- } else {
1639
- this.lastFileName = null
1640
- this.lastServerName = null
1641
- }
1642
- },
1643
1620
  // fileList 赋值Row
1644
1621
  standardToOtherFiles(fileSetObj, keyValueParam) {
1645
1622
  if (fileSetObj.childAnnexDataTableCode) {
@@ -199,7 +199,6 @@
199
199
  <span v-if="column.formatter && column.formatter.type === 'files'" type="primary">
200
200
  <span
201
201
  :id="column.prop + 'DomData' + rowIndex"
202
- :style="textOverflow === 'newline' ? {} : { width: cellWidth + 'px' }"
203
202
  :title="isShowOverflowTooltip ? $escapeHtml(getLabel(row)) : ''"
204
203
  :class="textOverflow === 'newline' ? 'wrap-text' : 'ellipsis cell--span'"
205
204
  >
@@ -264,15 +263,19 @@
264
263
  }}</span>
265
264
  </template>
266
265
  <template v-else>
267
- <span v-if="column.componentType === 'annex' || column.componentType === 'multipartUpload'" type="primary">
266
+ <span
267
+ v-if="column.componentType === 'annex' || column.componentType === 'multipartUpload'"
268
+ type="primary"
269
+ style="width: 100%"
270
+ >
268
271
  <span
269
272
  v-if="isShowOverflowTooltip"
270
273
  :id="column.prop + 'DomData' + rowIndex"
271
- :style="textOverflow === 'newline' ? {} : { width: cellWidth + 'px' }"
272
274
  :title="$escapeHtml(getLabel(row))"
273
275
  :class="textOverflow === 'newline' ? 'wrap-text' : 'ellipsis cell--span'"
274
276
  >
275
277
  <FsPreview
278
+ :width="cellWidth"
276
279
  :entity="row"
277
280
  :file-set-obj="getFileObj(column.fileSet)"
278
281
  :is-sql="isSql"
@@ -291,7 +294,6 @@
291
294
  <span v-else-if="column.formatter && column.formatter.type === 'files'">
292
295
  <span
293
296
  :id="column.prop + 'DomData' + rowIndex"
294
- :style="textOverflow === 'newline' ? {} : { width: cellWidth + 'px' }"
295
297
  :title="isShowOverflowTooltip ? $escapeHtml(getLabel(row)) : ''"
296
298
  :class="textOverflow === 'newline' ? 'wrap-text' : 'ellipsis cell--span'"
297
299
  >
@@ -704,7 +706,7 @@ export default {
704
706
  }
705
707
  }
706
708
  this.setScanRuleSets()
707
- this.requiredClass = this.isRequired(this.row.$editing) ? 'm-requried' : ''
709
+ this.requiredClass = this.isRequired(this.row.$editing) ? 'm-requried column-text-main' : ''
708
710
  },
709
711
  mounted() {
710
712
  if (this.controlConfig) {
@@ -1219,7 +1221,7 @@ export default {
1219
1221
  }
1220
1222
  },
1221
1223
  changeRequired(required) {
1222
- this.requiredClass = required ? 'm-requried' : ''
1224
+ this.requiredClass = required ? 'm-requried column-text-main' : ''
1223
1225
  },
1224
1226
  openPageEvent(openPageParams) {
1225
1227
  console.log('normalColumnContent----openPageEvent----', openPageParams)