agilebuilder-ui 1.0.621 → 1.0.962

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 (120) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.js +115880 -110424
  3. package/lib/super-ui.umd.cjs +103 -95
  4. package/package.json +6 -3
  5. package/packages/department-tree/src/department-tree.vue +27 -10
  6. package/packages/department-tree-inline/src/department-tree-service.js +20 -41
  7. package/packages/department-tree-mobile/src/department-tree-app.vue +6 -6
  8. package/packages/department-tree-mobile/src/department-tree-inline-app.vue +15 -15
  9. package/packages/department-user-tree/src/department-user-tree.vue +17 -2
  10. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +61 -26
  11. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +64 -22
  12. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -6
  13. package/packages/department-user-tree-inline/src/group-user/group-input.vue +162 -0
  14. package/packages/department-user-tree-inline/src/group-user/group-list.vue +99 -0
  15. package/packages/department-user-tree-inline/src/group-user/group-user.vue +42 -0
  16. package/packages/department-user-tree-inline/src/group-user-multiple-tree.vue +304 -0
  17. package/packages/department-user-tree-inline/src/group-user-single-tree.vue +155 -0
  18. package/packages/department-user-tree-inline/src/group-user-tree-service.js +74 -0
  19. package/packages/department-user-tree-inline/src/search-result.vue +34 -36
  20. package/packages/department-user-tree-mobile/src/department-user-tree-app.vue +6 -6
  21. package/packages/department-user-tree-mobile/src/department-user-tree-inline-app.vue +17 -19
  22. package/packages/department-user-tree-mobile/src/department-user-tree-service.ts +0 -11
  23. package/packages/dynamic-source-select/src/dynamic-source-select.vue +795 -799
  24. package/packages/dynamic-source-select/src/events.js +11 -16
  25. package/packages/fs-upload-list/src/fs-upload-list.vue +183 -122
  26. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +246 -0
  27. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +480 -0
  28. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-component.vue +127 -0
  29. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-input.vue +246 -0
  30. package/packages/fs-upload-new/src/file-upload-mobile/file-upload.vue +255 -0
  31. package/packages/fs-upload-new/src/fs-button-upload.vue +10 -13
  32. package/packages/fs-upload-new/src/fs-drag-upload.vue +4 -8
  33. package/packages/fs-upload-new/src/fs-preview-new.vue +103 -36
  34. package/packages/fs-upload-new/src/fs-upload-new.vue +160 -13
  35. package/packages/index.js +11 -2
  36. package/packages/organization-input/src/organization-input.vue +493 -539
  37. package/packages/plugins/export-data-new.js +34 -1
  38. package/packages/rich-editor/index.vue +29 -0
  39. package/packages/row-form/index.js +7 -0
  40. package/packages/row-form/index.vue +211 -0
  41. package/packages/scan-code-input/src/scan-code-input.vue +136 -104
  42. package/packages/scan-code-input-browser/index.js +6 -0
  43. package/packages/{scan-code-input/src/scan-code-input-colse.vue → scan-code-input-browser/src/scan-code-input.vue} +1 -28
  44. package/packages/secret-info/index.vue +2 -2
  45. package/packages/super-grid/src/apis.js +158 -10
  46. package/packages/super-grid/src/components/grid-icon.vue +7 -14
  47. package/packages/super-grid/src/components/hyperlinks.vue +24 -8
  48. package/packages/super-grid/src/custom-formatter.js +312 -380
  49. package/packages/super-grid/src/dynamic-input.vue +346 -43
  50. package/packages/super-grid/src/formValidatorUtil.js +79 -15
  51. package/packages/super-grid/src/group-column.vue +5 -0
  52. package/packages/super-grid/src/normal-column-content.vue +1056 -0
  53. package/packages/super-grid/src/normal-column.vue +57 -740
  54. package/packages/super-grid/src/row-detail.vue +50 -0
  55. package/packages/super-grid/src/row-operation.vue +19 -10
  56. package/packages/super-grid/src/scan-util.ts +243 -0
  57. package/packages/super-grid/src/search-button.vue +18 -14
  58. package/packages/super-grid/src/search-form-advancedQuery.vue +9 -2
  59. package/packages/super-grid/src/search-form-item.vue +10 -3
  60. package/packages/super-grid/src/search-form-mobile.vue +250 -0
  61. package/packages/super-grid/src/search-form.vue +159 -82
  62. package/packages/super-grid/src/super-grid-service.js +51 -6
  63. package/packages/super-grid/src/super-grid.vue +657 -761
  64. package/packages/super-grid/src/utils.js +126 -170
  65. package/packages/super-nine-grid/src/super-nine-grid.vue +1032 -1141
  66. package/packages/workflow-button/src/workflow-button.vue +6 -1
  67. package/packages/workgroup-tree/src/workgroup-tree.vue +31 -0
  68. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +28 -0
  69. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +26 -0
  70. package/packages/workgroup-tree-mobile/index.js +6 -0
  71. package/packages/workgroup-tree-mobile/src/dept-result.vue +51 -0
  72. package/packages/workgroup-tree-mobile/src/workgroup-tree-app.vue +120 -0
  73. package/packages/workgroup-tree-mobile/src/workgroup-tree-inline-app.vue +375 -0
  74. package/packages/workgroup-tree-mobile/src/workgroup-tree-service.ts +62 -0
  75. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +15 -0
  76. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +27 -0
  77. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +11 -0
  78. package/packages/workgroup-user-tree-mobile/index.js +6 -0
  79. package/packages/workgroup-user-tree-mobile/src/dept-path.vue +36 -0
  80. package/packages/workgroup-user-tree-mobile/src/dept-result.vue +58 -0
  81. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-app.vue +119 -0
  82. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-inline-app.vue +394 -0
  83. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-service.ts +41 -0
  84. package/src/api/sso-service.js +44 -15
  85. package/src/directives/permission/permission.js +4 -3
  86. package/src/i18n/langs/cn.js +19 -3
  87. package/src/i18n/langs/en.js +18 -2
  88. package/src/permission.js +114 -122
  89. package/src/store/modules/user.js +32 -33
  90. package/src/styles/index.scss +1 -0
  91. package/src/styles/table.scss +12 -0
  92. package/src/styles/theme/dark-blue/button.scss +2 -2
  93. package/src/styles/theme/dark-blue/index.scss +1 -1
  94. package/src/styles/theme/dark-blue/sidebar.scss +10 -0
  95. package/src/styles/theme/dark-blue/table.scss +8 -52
  96. package/src/styles/theme/green/button.scss +2 -2
  97. package/src/styles/theme/green/green.scss +1 -1
  98. package/src/styles/theme/green/index.scss +1 -1
  99. package/src/styles/theme/green/sidebar.scss +20 -0
  100. package/src/styles/theme/green/table.scss +7 -51
  101. package/src/styles/theme/ocean-blue/button.scss +2 -2
  102. package/src/styles/theme/ocean-blue/index.scss +1 -1
  103. package/src/styles/theme/ocean-blue/ocean-blue.scss +1 -1
  104. package/src/styles/theme/ocean-blue/sidebar.scss +10 -0
  105. package/src/styles/theme/ocean-blue/table.scss +7 -52
  106. package/src/utils/auth.js +23 -3
  107. package/src/utils/calculator/calculator-factory.js +4 -4
  108. package/src/utils/calculator/calculator-util.js +14 -0
  109. package/src/utils/common-util.js +270 -124
  110. package/src/utils/i18n-util.js +145 -0
  111. package/src/utils/jump-page-utils.js +245 -314
  112. package/src/utils/permission.js +7 -1
  113. package/src/utils/permissionAuth.js +155 -37
  114. package/src/utils/request.js +10 -11
  115. package/src/utils/util.js +154 -205
  116. package/src/views/layout/EmptyLayout.vue +1 -1
  117. package/src/views/layout/components/Menubar/Item.vue +27 -4
  118. package/src/views/layout/components/Menubar/SidebarItem.vue +7 -3
  119. package/src/views/layout/components/Menubar/index.vue +14 -2
  120. package/src/views/layout/tab-content-index.vue +1 -1
@@ -20,7 +20,7 @@ const events = {
20
20
  * @param {*} tag 移除的tag值
21
21
  */
22
22
  removeTag: function (remote, tag) {
23
- this.$emit( 'remove-tag', tag)
23
+ this.$emit('remove-tag', tag)
24
24
  if (Array.isArray(this.value)) {
25
25
  if (this.value.length === 1 && remote) {
26
26
  this.clearMarkValue()
@@ -33,38 +33,33 @@ const events = {
33
33
  */
34
34
  clear: function () {
35
35
  this.clearMarkValue()
36
- this.$emit( 'clear')
36
+ this.$emit('clear')
37
37
  },
38
38
  /**
39
39
  * 当 input 失去焦点时触发
40
40
  * @param {*} event
41
41
  */
42
42
  blur: function (event) {
43
- this.$emit( 'blur', event)
43
+ this.$emit('blur', event)
44
44
  },
45
45
  /**
46
46
  * 当 input 获得焦点时触发
47
47
  * @param {*} event
48
48
  */
49
49
  focus: function (event) {
50
- this.$emit( 'focus', event)
50
+ this.$emit('focus', event)
51
51
  },
52
52
  input(newValue) {
53
- this.$emit( 'update:value', newValue)
53
+ this.$emit('update:value', newValue)
54
54
  },
55
55
  getSelectedOptionItem(selectValue) {
56
- if (
57
- this.baseProps.multiple !== undefined &&
58
- this.baseProps.multiple === true &&
59
- Array.isArray(selectValue)
60
- ) {
56
+ if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true && Array.isArray(selectValue)) {
61
57
  const selected = []
62
58
  for (var i = 0; i < selectValue.length; i++) {
63
- selected.push(
64
- this.optionItems.find((item) => {
65
- return item[this.valueAttribute] === selectValue[i]
66
- })
67
- )
59
+ const value = this.optionItems.find((item) => {
60
+ return item[this.valueAttribute] === selectValue[i]
61
+ })
62
+ selected.push(value)
68
63
  }
69
64
  return selected
70
65
  } else {
@@ -72,6 +67,6 @@ const events = {
72
67
  return item[this.valueAttribute] === selectValue
73
68
  })
74
69
  }
75
- },
70
+ }
76
71
  }
77
72
  export default events
@@ -1,102 +1,126 @@
1
1
  <template>
2
- <div>
2
+ <span>
3
3
  <template v-if="!disabled">
4
- <el-input
5
- ref="item"
6
- :disabled="disabled"
7
- :model-value="value"
8
- :placeholder="$t('imatrixUIMessage.fileUpload')"
9
- :readonly="true"
10
- >
11
- <template v-slot:append>
12
- <el-button v-if="!disabled" :icon="ElIconUpload2" size="default" @click="openAnnexUpload" />
13
- <el-button :icon="ElIconZoomIn" size="default" @click="preview" />
14
- </template>
15
- </el-input>
4
+ <template v-if="!isMobile">
5
+ <el-input
6
+ ref="item"
7
+ :disabled="disabled"
8
+ :model-value="value"
9
+ :placeholder="$t('imatrixUIMessage.fileUpload')"
10
+ :readonly="true"
11
+ >
12
+ <template v-slot:append>
13
+ <el-button v-if="!disabled" :icon="ElIconUpload2" size="default" @click="openAnnexUpload" />
14
+ <el-button :icon="ElIconZoomIn" size="default" @click="preview" />
15
+ </template>
16
+ </el-input>
16
17
 
17
- <el-dialog
18
- v-model="annexUploadFlag"
19
- :append-to-body="true"
20
- :show-close="true"
21
- :title="$t('imatrixUIMessage.upload')"
22
- width="30%"
23
- >
24
- <el-upload
25
- v-if="annexUploadFlag"
26
- :accept="fileSetObj.accept ? fileSetObj.accept : null"
27
- :action="defaultAction"
28
- :multiple="fileSetObj.multiple"
29
- :before-upload="handleBeforeUpload"
30
- :headers="headers"
31
- :on-success="uploadOnSuccess"
32
- :with-credentials="true"
33
- name="file"
18
+ <el-dialog
19
+ v-model="annexUploadFlag"
20
+ :append-to-body="true"
21
+ :show-close="true"
22
+ :title="$t('imatrixUIMessage.upload')"
23
+ width="30%"
24
+ >
25
+ <el-upload
26
+ v-if="annexUploadFlag"
27
+ :accept="fileSetObj.accept ? fileSetObj.accept : null"
28
+ :action="defaultAction"
29
+ :multiple="fileSetObj.multiple"
30
+ :before-upload="handleBeforeUpload"
31
+ :headers="headers"
32
+ :on-success="uploadOnSuccess"
33
+ :with-credentials="true"
34
+ name="file"
35
+ >
36
+ <el-button>{{ $t('imatrixUIMessage.upload') }}</el-button>
37
+ </el-upload>
38
+ </el-dialog>
39
+ <el-dialog
40
+ v-model="showPreviewSingleImage"
41
+ :append-to-body="true"
42
+ :show-close="true"
43
+ :title="$t('imatrixUIPublicModel.previewImage')"
44
+ @close="$emit('close')"
45
+ >
46
+ <template v-slot:title>
47
+ <span
48
+ >{{ $t('imatrixUIPublicModel.previewImage') }}
49
+ <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
50
+ <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
51
+ </span>
52
+ </template>
53
+ <el-image
54
+ v-if="previewImageInfo && previewImageInfo.isImg"
55
+ :preview-src-list="[previewImageInfo.src]"
56
+ :src="previewImageInfo.src"
57
+ />
58
+ </el-dialog>
59
+ <el-dialog
60
+ v-model="showPreviewMulti"
61
+ :append-to-body="true"
62
+ :show-close="true"
63
+ :title="$t('imatrixUIPublicModel.preview')"
64
+ width="30%"
65
+ @close="$emit('close')"
34
66
  >
35
- <el-button>{{ $t('imatrixUIMessage.upload') }}</el-button>
36
- </el-upload>
37
- </el-dialog>
38
- <el-dialog
39
- v-model="showPreviewSingleImage"
40
- :append-to-body="true"
41
- :show-close="true"
42
- :title="$t('imatrixUIPublicModel.previewImage')"
43
- @close="$emit('close')"
44
- >
45
- <template v-slot:title>
46
- <span
47
- >{{ $t('imatrixUIPublicModel.previewImage') }}
48
- <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
49
- <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
50
- </span>
51
- </template>
52
- <el-image
53
- v-if="previewImageInfo && previewImageInfo.isImg"
54
- :preview-src-list="[previewImageInfo.src]"
55
- :src="previewImageInfo.src"
56
- />
57
- </el-dialog>
58
- <el-dialog
59
- v-model="showPreviewMulti"
60
- :append-to-body="true"
61
- :show-close="true"
62
- :title="$t('imatrixUIPublicModel.preview')"
63
- width="30%"
64
- @close="$emit('close')"
65
- >
66
- <template v-slot:title>
67
- <span
68
- >{{ $t('imatrixUIPublicModel.preview') }}
69
- <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
70
- <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
71
- </span>
72
- </template>
73
- <el-table :data="showFileList" :show-header="false">
74
- <el-table-column prop="showName" width="300" />
75
- <el-table-column align="right">
76
- <template v-slot="scope">
77
- <el-tooltip :content="$t('imatrixUIPublicModel.preview')" class="item" effect="dark" placement="top">
78
- <el-icon style="cursor: pointer" @click="previewSingle(scope.row)">
79
- <el-icon-view />
80
- </el-icon>
81
- </el-tooltip>
82
- </template>
83
- </el-table-column>
84
- <el-table-column v-if="!disabled">
85
- <template v-slot="scope">
86
- <el-tooltip :content="$t('imatrixUIPublicModel.delete')" class="item" effect="dark" placement="top">
87
- <el-icon style="cursor: pointer" @click="deleteRow(scope.$index)">
88
- <el-icon-delete />
89
- </el-icon>
90
- </el-tooltip>
91
- </template>
92
- </el-table-column>
93
- </el-table>
94
- </el-dialog>
67
+ <template v-slot:title>
68
+ <span
69
+ >{{ $t('imatrixUIPublicModel.preview') }}
70
+ <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
71
+ <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
72
+ </span>
73
+ </template>
74
+ <el-table :data="showFileList" :show-header="false">
75
+ <el-table-column prop="showName" width="300" />
76
+ <el-table-column align="right">
77
+ <template v-slot="scope">
78
+ <el-tooltip :content="$t('imatrixUIPublicModel.preview')" class="item" effect="dark" placement="top">
79
+ <el-icon style="cursor: pointer" @click="previewSingle(scope.row)">
80
+ <el-icon-view />
81
+ </el-icon>
82
+ </el-tooltip>
83
+ </template>
84
+ </el-table-column>
85
+ <el-table-column v-if="!disabled">
86
+ <template v-slot="scope">
87
+ <el-tooltip :content="$t('imatrixUIPublicModel.delete')" class="item" effect="dark" placement="top">
88
+ <el-icon style="cursor: pointer" @click="deleteRow(scope.$index)">
89
+ <el-icon-delete />
90
+ </el-icon>
91
+ </el-tooltip>
92
+ </template>
93
+ </el-table-column>
94
+ </el-table>
95
+ </el-dialog>
96
+ </template>
97
+ <FileUploadInputMobile
98
+ v-else
99
+ ref="fileUploadRef"
100
+ :disabled="disabled"
101
+ :fileInfo="fileInfo"
102
+ :systemCode="systemCode"
103
+ :accept="fileSetObj.accept ? fileSetObj.accept : null"
104
+ :multiple="fileSetObj.multiple"
105
+ :limitFileSize="fileSetObj.limitFileSize"
106
+ :placeholder="$t('imatrixUIMessage.fileUpload')"
107
+ :file-list="fileList"
108
+ :beforeUpload="fileSetObj.beforeUpload"
109
+ :onSuccess="uploadOnSuccessMobile"
110
+ :beforeRemove="fileSetObj.beforeRemove"
111
+ :onRemove="onRemoveMobile"
112
+ :beforeDownload="fileSetObj.beforeDownload"
113
+ :pageContext="pageContext"
114
+ :openFsUpload="openFsUpload"
115
+ :componentId="componentId"
116
+ :listCode="listCode"
117
+ :openCameraOrChoosePhoto="fileSetObj.openCameraOrChoosePhoto"
118
+ />
95
119
  </template>
96
120
  <template v-else>
97
121
  <fs-preview :entity="row" :file-set-obj="fileSetObj" :is-sql="isSql" :label="value" />
98
122
  </template>
99
- </div>
123
+ </span>
100
124
  </template>
101
125
 
102
126
  <script>
@@ -110,36 +134,13 @@ import { $emit } from '../../utils/gogocodeTransfer'
110
134
 
111
135
  import { getToken } from '../../../src/utils/auth'
112
136
  import { isImage } from '../../../src/utils/util'
113
- import { getSystemFrontendUrl, isPlateSys } from '../../../src/utils/common-util'
137
+ import { getSystemFrontendUrl, isPlateSys, isMobileBrowser } from '../../../src/utils/common-util'
114
138
  import FsPreview from '../../fs-preview/src/fs-preview.vue'
115
139
  import { packageFile } from '../../super-grid/src/utils'
140
+ import FileUploadInputMobile from '../../fs-upload-new/src/file-upload-mobile/file-upload-input.vue'
141
+
116
142
 
117
143
  export default {
118
- data() {
119
- const headers = { Authorization: getToken() }
120
- let defaultAction = window.$vueApp.config.globalProperties.baseURL + '/common/fs-upload'
121
- if (isPlateSys(window.$vueApp.config.globalProperties.systemCode)) {
122
- defaultAction = window.$vueApp.config.globalProperties.baseAPI + '/component/super-form/uploads'
123
- }
124
- return {
125
- deleteUuids: [],
126
- headers,
127
- defaultAction,
128
- annexUploadFlag: false,
129
- showPreviewSingleImage: false,
130
- showPreviewMulti: false,
131
- lastFileName: null,
132
- previewImageInfo: {},
133
- showFileList: this.fileList,
134
- ElIconUpload2,
135
- ElIconZoomIn
136
- }
137
- },
138
- components: {
139
- FsPreview,
140
- ElIconView,
141
- ElIconDelete
142
- },
143
144
  name: 'FsUploadList',
144
145
  props: {
145
146
  value: {
@@ -195,10 +196,52 @@ export default {
195
196
  type: Boolean,
196
197
  default: false
197
198
  },
198
- openFsUpload:{
199
- type: Boolean,
200
- default: true
201
- }
199
+ openFsUpload:{
200
+ type: Boolean,
201
+ default: true
202
+ },
203
+ pageContext: {
204
+ type: Object,
205
+ default: () => ({})
206
+ },
207
+ listCode: {
208
+ type: String,
209
+ default: null
210
+ },
211
+ componentId: {
212
+ type: String,
213
+ default: null
214
+ }
215
+ },
216
+ data() {
217
+ const headers = { Authorization: getToken() }
218
+ let defaultAction = window.$vueApp.config.globalProperties.baseURL + '/common/fs-upload'
219
+ if (isPlateSys(window.$vueApp.config.globalProperties.systemCode)) {
220
+ defaultAction = window.$vueApp.config.globalProperties.baseAPI + '/component/super-form/uploads'
221
+ }
222
+ const isMobile = isMobileBrowser()
223
+ const systemCode = this.pageContext && this.pageContext.systemCode? this.pageContext.systemCode: null
224
+ return {
225
+ deleteUuids: [],
226
+ headers,
227
+ defaultAction,
228
+ annexUploadFlag: false,
229
+ showPreviewSingleImage: false,
230
+ showPreviewMulti: false,
231
+ lastFileName: null,
232
+ previewImageInfo: {},
233
+ showFileList: this.fileList,
234
+ ElIconUpload2,
235
+ ElIconZoomIn,
236
+ isMobile,
237
+ systemCode
238
+ }
239
+ },
240
+ components: {
241
+ FsPreview,
242
+ ElIconView,
243
+ ElIconDelete,
244
+ FileUploadInputMobile
202
245
  },
203
246
  created() {},
204
247
  mounted() {},
@@ -210,7 +253,8 @@ export default {
210
253
  },
211
254
  handleBeforeUpload(file) {
212
255
  let limitFileSize = this.fileSetObj.limitFileSize
213
- if (limitFileSize === undefined) {
256
+ console.log('handleBeforeUpload-----limitFileSize=', limitFileSize)
257
+ if (!limitFileSize) {
214
258
  // 默认是30M
215
259
  limitFileSize = 30
216
260
  }
@@ -351,6 +395,23 @@ export default {
351
395
  })
352
396
  $emit(this, 'delete', this.showFileList, index)
353
397
  }
398
+ },
399
+ // 移动端上传成功
400
+ uploadOnSuccessMobile() {
401
+ console.log('uploadOnSuccessMobile-------this.fileList=', this.fileList)
402
+ $emit(this, 'upload-success', this.fileList)
403
+ },
404
+ // 移动端删除附件
405
+ onRemoveMobile(){
406
+ console.log('onRemoveMobile-------this.fileList=', this.fileList)
407
+ $emit(this, 'delete', this.fileList)
408
+ },
409
+ pickFileDone(data){
410
+ console.log('fs-upload-list------pickFileDone-------data=', data)
411
+ this.$refs.fileUploadRef.pickFileDone(data)
412
+ },
413
+ uploadFileDone(data){
414
+ this.$refs.fileUploadRef.uploadFileDone(data)
354
415
  }
355
416
  },
356
417
  emits: ['close', 'upload-success', 'delete-success', 'delete', 'update:value', 'close', 'update:value']
@@ -0,0 +1,246 @@
1
+ <template>
2
+ <div>
3
+ <FileUploadComponent
4
+ ref="fileUploadRef"
5
+ :disabled="disabled"
6
+ :systemCode="systemCode"
7
+ :accept="accept"
8
+ :multiple="multiple"
9
+ :limitFileSize="limitFileSize"
10
+ :fileList="fileListResult"
11
+ :beforeRemove="beforeRemove"
12
+ :onRemove="onRemove"
13
+ :beforeDownload="beforeDownload"
14
+ :baseURL="baseURLVal"
15
+ @chooseFile="pickBrowserFiles"
16
+ @remove="removeFile"
17
+ />
18
+ </div>
19
+ </template>
20
+ <script lang="ts" setup>
21
+ import { ref, defineEmits } from 'vue'
22
+ import { getToken, getCookieCache } from '../../../../src/utils/auth.js' // 获得token
23
+ import Compressor from 'compressorjs'
24
+ import { ElMessage } from 'element-plus'
25
+ import { useI18n } from 'vue-i18n'
26
+ import FileUploadComponent from './file-upload-component.vue'
27
+ const props = defineProps({
28
+ openFsUpload: {
29
+ type: Object,
30
+ default: true
31
+ },
32
+ entity: {
33
+ type: Object,
34
+ default: () => {
35
+ return null
36
+ }
37
+ },
38
+ fileInfo: {
39
+ type: Object,
40
+ default: () => ({})
41
+ },
42
+ systemCode: {
43
+ type: String,
44
+ default: ''
45
+ },
46
+ displayType: {
47
+ type: String,
48
+ default: 'input'
49
+ },
50
+ // 是否禁止编辑,为true只能下载,不能删除和上传
51
+ disabled: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ accept: {
56
+ type: String,
57
+ default: ''
58
+ },
59
+ multiple: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ limit: {
64
+ type: Number,
65
+ default: 1
66
+ },
67
+ // 文件大小限制,单位是M,默认是30M
68
+ limitFileSize: {
69
+ type: Number,
70
+ default: 30
71
+ },
72
+ placeholder: {
73
+ type: String,
74
+ default: '拖拽文件 或 点击上传'
75
+ },
76
+ action: {
77
+ type: String,
78
+ default: ''
79
+ },
80
+ headers: {
81
+ type: Object,
82
+ default: () => ({ Authorization: null })
83
+ },
84
+ // 已上传文件列表
85
+ fileList: {
86
+ type: Array,
87
+ default: () => []
88
+ },
89
+ onSuccess: {
90
+ type: Function,
91
+ default: () => {}
92
+ },
93
+ beforeRemove: {
94
+ type: Function,
95
+ default: () => {}
96
+ },
97
+ onRemove: {
98
+ type: Function,
99
+ default: () => {}
100
+ },
101
+ beforeDownload: {
102
+ type: Function,
103
+ default: () => {}
104
+ },
105
+ pageContext: {
106
+ type: Object,
107
+ default: () => ({})
108
+ },
109
+ configure: {
110
+ type: Object,
111
+ default: () => ({})
112
+ },
113
+ // 组件id,在表单或列表中应该唯一,一般传字段名即可
114
+ componentId: {
115
+ type: String,
116
+ default: function () {
117
+ return 'file-upload'
118
+ }
119
+ },
120
+ // 组件名称,一般是字段label
121
+ componentName: {
122
+ type: String,
123
+ default: function () {
124
+ return 'file-upload'
125
+ }
126
+ },
127
+ // 列表编码
128
+ listCode: {
129
+ type: String,
130
+ default: null
131
+ },
132
+ // 打开相机和相册选项,默认是都可以打开
133
+ openCameraOrChoosePhoto: {
134
+ type: String,
135
+ default: 'openCameraAndChoosePhoto'
136
+ },
137
+ beforeUpload: {
138
+ type: Function,
139
+ default: () => {}
140
+ }
141
+ })
142
+
143
+ const fileListResult = ref(props.fileList)
144
+ let baseURL = window.$vueApp.config.globalProperties.baseURL
145
+ if (props.pageContext && props.pageContext.backendUrl) {
146
+ baseURL = props.pageContext.backendUrl
147
+ }
148
+ if (!baseURL) {
149
+ baseURL = window.$vueApp.config.globalProperties.baseURL
150
+ }
151
+ const baseURLVal = ref(baseURL)
152
+
153
+ const baseAPI = window.$vueApp.config.globalProperties.baseAPI
154
+ const fileUploadRef = ref(null)
155
+ const emits = defineEmits(['remove', 'uploadend'])
156
+
157
+ // 表示点击了选择文件按钮
158
+ function pickBrowserFiles() {
159
+ // console.log('---点击了选择文件按钮---')
160
+ const message = {
161
+ type: 'pickFiles',
162
+ multiple: props.multiple,
163
+ componentId: props.componentId,
164
+ componentName: props.componentName,
165
+ systemCode: props.systemCode,
166
+ token: getToken(),
167
+ listCode: props.listCode
168
+ }
169
+ window.parent.postMessage(JSON.stringify(message), '*')
170
+ }
171
+
172
+ function pickFileDone(data) {
173
+ appFileDone(data)
174
+ }
175
+ function uploadFileDone(data) {
176
+ // 表示文件上传到服务器成功
177
+ appFileDone(data)
178
+ }
179
+ function appFileDone(data) {
180
+ const files = data.files
181
+ let myFiles = files
182
+ if (files && typeof files === 'string') {
183
+ myFiles = JSON.parse(files)
184
+ }
185
+ if (myFiles && !Array.isArray(myFiles)) {
186
+ myFiles = [myFiles]
187
+ }
188
+ uploadFileSuccess(myFiles)
189
+ }
190
+ function uploadFileSuccess(files) {
191
+ // this.isUploading = true
192
+ let isCanUpload = true
193
+ if (props.beforeUpload && typeof props.beforeUpload === 'function') {
194
+ for (let i = 0; i < files.length; i++) {
195
+ const file = files[i]
196
+ const isMobile = true
197
+ // eslint-disable-next-line no-useless-call
198
+ isCanUpload = props.beforeUpload({
199
+ fileObj: file,
200
+ files: files,
201
+ isMobile,
202
+ pageContext: props.pageContext,
203
+ configureObj: props.configure
204
+ })
205
+ if (isCanUpload !== undefined && isCanUpload === false) {
206
+ break
207
+ }
208
+ }
209
+ }
210
+ if (isCanUpload !== undefined && !isCanUpload) {
211
+ // 不能提交文件
212
+ return
213
+ }
214
+ // this.isUploading = false
215
+ // 表示文件上传到服务器成功
216
+ if (files) {
217
+ // files:[{name:'',serverPath:''},{name:'',serverPath:''}]
218
+ if (props.multiple) {
219
+ files.forEach((file) => {
220
+ fileListResult.value.push(file)
221
+ })
222
+ } else {
223
+ // 单选时将已选文件移除,然后再替换为新上传的文件
224
+ const rmFiles = JSON.parse(JSON.stringify(fileListResult.value))
225
+ fileListResult.value = files
226
+ emits('remove', { rmFiles, serverFiles: fileListResult.value })
227
+ }
228
+ }
229
+ console.log('uploadFileSuccess111111----fileListResult.value=', JSON.stringify(fileListResult.value))
230
+
231
+ fileUploadRef.value.changeFileList(fileListResult.value)
232
+ // this.isUploading = false
233
+ emits('uploadend', fileListResult.value)
234
+ }
235
+
236
+ function removeFile(param) {
237
+ console.log('removeFile----param=', param)
238
+ const file = param.file
239
+ if (file) {
240
+ emits('remove', { rmFiles: [file], serverFiles: fileListResult.value, index: param.index })
241
+ }
242
+ }
243
+ defineExpose({pickFileDone,uploadFileDone})
244
+ </script>
245
+
246
+ <style lang="scss" scoped></style>