imatrix-ui 2.8.21-dw → 2.8.21

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 (181) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +4 -2
  4. package/packages/breadcrumb/index.js +6 -0
  5. package/packages/breadcrumb/src/breadcrumb.vue +71 -0
  6. package/packages/department-tree/index.js +6 -0
  7. package/packages/department-tree/src/department-tree.vue +108 -0
  8. package/packages/department-tree-inline/index.js +6 -0
  9. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +402 -0
  10. package/packages/department-tree-inline/src/department-single-tree-inline.vue +284 -0
  11. package/packages/department-tree-inline/src/department-tree-inline.vue +86 -0
  12. package/packages/department-tree-inline/src/department-tree-service.js +245 -0
  13. package/packages/department-tree-inline/src/search-result.vue +176 -0
  14. package/packages/department-user-tree/index.js +6 -0
  15. package/packages/department-user-tree/src/department-user-multiple-tree.vue +116 -0
  16. package/packages/department-user-tree/src/department-user-single-tree.vue +76 -0
  17. package/packages/department-user-tree/src/department-user-tree.vue +101 -0
  18. package/packages/department-user-tree-inline/index.js +6 -0
  19. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +626 -0
  20. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +269 -0
  21. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +79 -0
  22. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +230 -0
  23. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +122 -0
  24. package/packages/department-user-tree-inline/src/search-result.vue +197 -0
  25. package/packages/directives/prevent-reclick.js +19 -0
  26. package/packages/dynamic-source-select/index.js +6 -0
  27. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +70 -0
  28. package/packages/dynamic-source-select/src/dynamic-source-select.vue +440 -0
  29. package/packages/dynamic-source-select/src/events.js +55 -0
  30. package/packages/fs-preview/index.js +6 -0
  31. package/packages/fs-preview/src/fs-preview.vue +226 -0
  32. package/packages/fs-upload/index.js +6 -0
  33. package/packages/fs-upload/src/fs-upload-multi.vue +420 -0
  34. package/packages/fs-upload/src/fs-upload-single.vue +312 -0
  35. package/packages/fs-upload/src/fs-upload.vue +189 -0
  36. package/packages/fs-upload/src/see-big-picture.vue +55 -0
  37. package/packages/fs-upload-list/index.js +6 -0
  38. package/packages/fs-upload-list/src/fs-upload-list.vue +287 -0
  39. package/packages/hamburger/index.js +6 -0
  40. package/packages/hamburger/src/hamburger.vue +38 -0
  41. package/packages/index.js +121 -0
  42. package/packages/multipart-upload/index.js +6 -0
  43. package/packages/multipart-upload/src/index.vue +73 -0
  44. package/packages/multipart-upload/src/multipart-upload-form.vue +297 -0
  45. package/packages/multipart-upload/src/multipart-upload-list.vue +378 -0
  46. package/packages/organization-input/index.js +6 -0
  47. package/packages/organization-input/src/organization-input.vue +542 -0
  48. package/packages/plugins/export-data-new.js +453 -0
  49. package/packages/plugins/export-data.js +361 -0
  50. package/packages/plugins/index.js +15 -0
  51. package/packages/plugins/public-method.js +43 -0
  52. package/packages/remove-department/index.js +6 -0
  53. package/packages/remove-department/src/remove-department.vue +172 -0
  54. package/packages/remove-department/src/remove-dept-service.js +20 -0
  55. package/packages/remove-user/index.js +6 -0
  56. package/packages/remove-user/src/remove-user-service.js +20 -0
  57. package/packages/remove-user/src/remove-user.vue +195 -0
  58. package/packages/remove-workgroup/index.js +6 -0
  59. package/packages/remove-workgroup/src/remove-workgroup-service.js +20 -0
  60. package/packages/remove-workgroup/src/remove-workgroup.vue +159 -0
  61. package/packages/rich-editor/index.js +7 -0
  62. package/packages/rich-editor/index.vue +278 -0
  63. package/packages/rich-editor/langs/zh-Hans.js +1 -0
  64. package/packages/rich-editor/viewer.vue +103 -0
  65. package/packages/scan-code-input/index.js +6 -0
  66. package/packages/scan-code-input/src/events.js +33 -0
  67. package/packages/scan-code-input/src/scan-code-input-colse.vue +131 -0
  68. package/packages/scan-code-input/src/scan-code-input.vue +116 -0
  69. package/packages/secret-info/index.js +7 -0
  70. package/packages/secret-info/index.vue +90 -0
  71. package/packages/super-grid/index.js +7 -0
  72. package/packages/super-grid/src/apis.js +763 -0
  73. package/packages/super-grid/src/columns-config.vue +335 -0
  74. package/packages/super-grid/src/custom-formatter.js +250 -0
  75. package/packages/super-grid/src/dynamic-input.vue +1279 -0
  76. package/packages/super-grid/src/eventBus.js +2 -0
  77. package/packages/super-grid/src/events.js +55 -0
  78. package/packages/super-grid/src/formValidatorUtil.js +226 -0
  79. package/packages/super-grid/src/formatter.js +181 -0
  80. package/packages/super-grid/src/group-column.vue +100 -0
  81. package/packages/super-grid/src/header-context-menu.vue +87 -0
  82. package/packages/super-grid/src/index-column.vue +51 -0
  83. package/packages/super-grid/src/normal-column.vue +769 -0
  84. package/packages/super-grid/src/public-methods.js +31 -0
  85. package/packages/super-grid/src/row-operation.vue +161 -0
  86. package/packages/super-grid/src/search-button.vue +66 -0
  87. package/packages/super-grid/src/search-condition-input.vue +61 -0
  88. package/packages/super-grid/src/search-condition-list.vue +59 -0
  89. package/packages/super-grid/src/search-form-advancedQuery.vue +653 -0
  90. package/packages/super-grid/src/search-form-dialog.vue +79 -0
  91. package/packages/super-grid/src/search-form-item.vue +386 -0
  92. package/packages/super-grid/src/search-form-number.vue +38 -0
  93. package/packages/super-grid/src/search-form-open.vue +162 -0
  94. package/packages/super-grid/src/search-form-ordinarySearch.vue +188 -0
  95. package/packages/super-grid/src/search-form.vue +634 -0
  96. package/packages/super-grid/src/search-methods.js +387 -0
  97. package/packages/super-grid/src/selection-column.vue +43 -0
  98. package/packages/super-grid/src/store.js +3 -0
  99. package/packages/super-grid/src/super-grid-service.js +561 -0
  100. package/packages/super-grid/src/super-grid.vue +2793 -0
  101. package/packages/super-grid/src/utils.js +763 -0
  102. package/packages/super-grid/src/view-image-dialog.vue +130 -0
  103. package/packages/super-nine-grid/index.js +7 -0
  104. package/packages/super-nine-grid/src/apis.js +103 -0
  105. package/packages/super-nine-grid/src/custom-formatter.js +66 -0
  106. package/packages/super-nine-grid/src/formatter.js +132 -0
  107. package/packages/super-nine-grid/src/search-form-number.vue +38 -0
  108. package/packages/super-nine-grid/src/search-form.vue +430 -0
  109. package/packages/super-nine-grid/src/search-methods.js +134 -0
  110. package/packages/super-nine-grid/src/store.js +3 -0
  111. package/packages/super-nine-grid/src/super-grid-service.js +91 -0
  112. package/packages/super-nine-grid/src/super-nine-grid.vue +872 -0
  113. package/packages/super-nine-grid/src/utils.js +261 -0
  114. package/packages/svg-icon/index.js +6 -0
  115. package/packages/svg-icon/src/svg-icon.vue +43 -0
  116. package/packages/utils/utils.js +152 -0
  117. package/packages/utils/value-set.js +86 -0
  118. package/packages/valid-code/index.js +7 -0
  119. package/packages/valid-code/src/valid-code.vue +95 -0
  120. package/packages/workflow-button/index.js +6 -0
  121. package/packages/workflow-button/src/workflow-button.vue +325 -0
  122. package/packages/workflow-history-list/index.js +6 -0
  123. package/packages/workflow-history-list/src/api.js +7 -0
  124. package/packages/workflow-history-list/src/workflow-history-list.vue +185 -0
  125. package/packages/workgroup-tree/index.js +6 -0
  126. package/packages/workgroup-tree/src/workgroup-tree.vue +76 -0
  127. package/packages/workgroup-tree-inline/index.js +6 -0
  128. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +317 -0
  129. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +43 -0
  130. package/packages/workgroup-user-tree/index.js +6 -0
  131. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +100 -0
  132. package/packages/workgroup-user-tree-inline/index.js +6 -0
  133. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +163 -0
  134. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +436 -0
  135. package/packages/year-range-picker/index.js +6 -0
  136. package/packages/year-range-picker/src/year-range-picker.vue +51 -0
  137. package/src/i18n/i18n.js +1 -1
  138. package/src/i18n/langs/cn.js +4 -2
  139. package/src/i18n/langs/en.js +4 -2
  140. package/src/index.js +93 -0
  141. package/src/permission.js +7 -3
  142. package/src/plugins.js +3 -3
  143. package/src/router/index.js +24 -0
  144. package/src/store/getters.js +2 -1
  145. package/src/store/modules/app.js +10 -1
  146. package/src/styles/display-layout.scss +34 -0
  147. package/src/styles/index.scss +32 -4
  148. package/src/styles/theme/dark-blue/button.scss +9 -0
  149. package/src/styles/theme/dark-blue/card.scss +64 -0
  150. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  151. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  152. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  153. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  154. package/src/styles/theme/dark-blue/font.scss +71 -0
  155. package/src/styles/theme/dark-blue/form.scss +51 -0
  156. package/src/styles/theme/dark-blue/index.scss +247 -0
  157. package/src/styles/theme/dark-blue/input.scss +15 -0
  158. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  159. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  160. package/src/styles/theme/dark-blue/sidebar.scss +296 -0
  161. package/src/styles/theme/dark-blue/tab.scss +83 -0
  162. package/src/styles/theme/dark-blue/table.scss +60 -0
  163. package/src/styles/theme/dark-blue/tree.scss +31 -0
  164. package/src/styles/theme/dark-blue/var.scss +1028 -0
  165. package/src/styles/theme/gray/form-style.scss +2 -2
  166. package/src/styles/theme/gray/input-style.scss +8 -0
  167. package/src/utils/auth-api.js +115 -0
  168. package/src/utils/auth.js +34 -42
  169. package/src/utils/calculator/calculator-factory.js +2 -2
  170. package/src/utils/common-util.js +34 -0
  171. package/src/utils/jump-page-utils.js +29 -5
  172. package/src/utils/menu.js +19 -0
  173. package/src/utils/permission.js +4 -0
  174. package/src/utils/request.js +18 -2
  175. package/src/utils/util.js +7 -3
  176. package/src/views/dsc-component/Sidebar/Item.vue +4 -4
  177. package/src/views/dsc-component/Sidebar/Link.vue +11 -2
  178. package/src/views/dsc-component/Sidebar/SidebarItem.vue +36 -20
  179. package/src/views/dsc-component/Sidebar/index.vue +24 -12
  180. package/src/views/dsc-component/tabs/tab-content.vue +16 -1
  181. package/src/views/login/index.vue +1 -1
@@ -0,0 +1,297 @@
1
+ <!-- 文件上传 -->
2
+ <template>
3
+ <div>
4
+ <template v-if="!disabled">
5
+ <el-input
6
+ ref="item"
7
+ :readonly="true"
8
+ :disabled="disabled"
9
+ :value="value"
10
+ :placeholder="$t('imatrixUIMessage.fileUpload')"
11
+ >
12
+ <el-button v-if="!disabled" slot="append" size="mini" icon="el-icon-upload2" @click="openAnnexUpload" />
13
+ <el-button slot="append" size="mini" icon="el-icon-zoom-in" @click="preview" />
14
+ </el-input>
15
+
16
+ <el-dialog
17
+ :title="$t('imatrixUIMessage.tips')"
18
+ :visible.sync="annexUploadFlag"
19
+ :append-to-body="true"
20
+ :show-close="true"
21
+ width="30%"
22
+ >
23
+ <el-upload
24
+ v-if="annexUploadFlag"
25
+ :action="defaultAction"
26
+ :accept="fileSetObj.accept?fileSetObj.accept:null"
27
+ :on-success="uploadOnSuccess"
28
+ :headers="headers"
29
+ :before-upload="handleBeforeUpload"
30
+ :with-credentials="true"
31
+ name="file"
32
+ >
33
+ <el-button>{{ $t('imatrixUIMessage.upload') }}</el-button>
34
+ </el-upload>
35
+ </el-dialog>
36
+ <el-dialog
37
+ :append-to-body="true"
38
+ :show-close="true"
39
+ :title="$t('imatrixUIPublicModel.previewImage')"
40
+ :visible.sync="showPreviewSingleImage"
41
+ @close="$emit('close')"
42
+ >
43
+ <span slot="title">{{ $t('imatrixUIPublicModel.previewImage') }}
44
+ <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
45
+ <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
46
+ </span>
47
+ <el-image v-if="previewImageInfo&&previewImageInfo.isImg" :preview-src-list="[previewImageInfo.src]" :src="previewImageInfo.src" />
48
+ </el-dialog>
49
+ <el-dialog
50
+ :append-to-body="true"
51
+ :show-close="true"
52
+ :title="$t('imatrixUIPublicModel.preview')"
53
+ :visible.sync="showPreviewMulti"
54
+ width="30%"
55
+ @close="$emit('close')"
56
+ >
57
+ <span slot="title">{{ $t('imatrixUIPublicModel.preview') }}
58
+ <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
59
+ <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
60
+ </span>
61
+ <el-table
62
+ :show-header="false"
63
+ :data="showFileList"
64
+ >
65
+ <el-table-column
66
+ width="300"
67
+ prop="showName"
68
+ />
69
+ <el-table-column align="right">
70
+ <template slot-scope="scope">
71
+ <el-tooltip :content="$t('imatrixUIPublicModel.preview')" class="item" effect="dark" placement="top">
72
+ <i class="el-icon-view" style="cursor:pointer;" @click="previewSingle(scope.row)" />
73
+ </el-tooltip>
74
+ </template>
75
+ </el-table-column>
76
+ <el-table-column v-if="!disabled">
77
+ <template slot-scope="scope">
78
+ <el-tooltip :content="$t('imatrixUIPublicModel.delete')" class="item" effect="dark" placement="top">
79
+ <i class="el-icon-delete" style="cursor:pointer;" @click="deleteRow(scope.$index)" />
80
+ </el-tooltip>
81
+ </template>
82
+ </el-table-column>
83
+ </el-table>
84
+ </el-dialog>
85
+ </template>
86
+ <template v-else>
87
+ <fs-preview :label="value" :file-list="showFileList" />
88
+ </template>
89
+ </div>
90
+ </template>
91
+
92
+ <script>
93
+
94
+ import { getToken } from '../../../src/utils/auth'
95
+ import { isImage } from '../../../src/utils/util'
96
+ import { isPlateSys, getSystemFrontendUrl } from '../../../src/utils/common-util'
97
+ import Vue from 'vue'
98
+ import FsPreview from '../../fs-preview/src/fs-preview.vue'
99
+ export default {
100
+ name: 'MultipartUploadForm',
101
+ components: {
102
+ FsPreview
103
+
104
+ },
105
+ props: {
106
+ value: {
107
+ type: String,
108
+ default: null
109
+ },
110
+ // name ','分隔的名称 和serverPath
111
+ fileInfo: {
112
+ type: Object,
113
+ default: () => {
114
+ return {
115
+ name: null,
116
+ serverPath: null
117
+ }
118
+ }
119
+ },
120
+ fileSetObj: {
121
+ type: Object,
122
+ default: () => {
123
+ return { limitFileSize: 30, multiple: false, accept: null }
124
+ }
125
+ },
126
+ customViewUrl: {
127
+ type: Boolean,
128
+ default: false
129
+ },
130
+ disabled: {
131
+ type: Boolean,
132
+ default: false
133
+ },
134
+ uploadAble: {
135
+ type: Boolean,
136
+ default: true
137
+ },
138
+ deletaAble: {
139
+ type: Boolean,
140
+ default: true
141
+ },
142
+ // 文件详细消息
143
+ fileList: {
144
+ type: Array,
145
+ default: () => {
146
+ return []
147
+ }
148
+ }
149
+
150
+ },
151
+ data() {
152
+ const headers = { Authorization: getToken() }
153
+ let defaultAction = Vue.prototype.baseURL + '/common/fs-upload'
154
+ if (isPlateSys(Vue.prototype.systemCode)) {
155
+ defaultAction = Vue.prototype.baseAPI + '/component/super-form/uploads'
156
+ }
157
+ return {
158
+ deleteUuids: [],
159
+ headers,
160
+ defaultAction,
161
+ annexUploadFlag: false,
162
+ showPreviewSingleImage: false,
163
+ showPreviewMulti: false,
164
+ lastFileName: null,
165
+ previewImageInfo: {},
166
+ showFileList: this.fileList
167
+ }
168
+ },
169
+ created() {
170
+
171
+ },
172
+ mounted() {
173
+ this.getFileList()
174
+ },
175
+ methods: {
176
+ openAnnexUpload() {
177
+ this.annexUploadFlag = true
178
+ },
179
+ handleBeforeUpload(file) {
180
+ let limitFileSize = this.fileSetObj.limitFileSize
181
+ if (limitFileSize === undefined) {
182
+ // 默认是30M
183
+ limitFileSize = 30
184
+ }
185
+ if (file.size > limitFileSize * 1024 * 1024) {
186
+ // 超过最大限制
187
+ this.$message({
188
+ type: 'warning',
189
+ message: this.$t('imatrixUIMessage.exceedFileSize', { fileSize: limitFileSize }),
190
+ showClose: true
191
+ })
192
+ // 返回false停止上传
193
+ return false
194
+ }
195
+ },
196
+ // 上传成功
197
+ uploadOnSuccess(response, file) {
198
+ if (response) {
199
+ this.$emit('upload-success', { showName: response.name, serverPath: response.serverPath })
200
+ if (this.fileSetObj.multiple) {
201
+ if (this.fileInfo.showName) {
202
+ const nameArr = this.fileInfo.showName.split(',')
203
+ const serverPathArr = this.fileInfo.serverPath.split(',')
204
+ nameArr.push(response.name)
205
+ serverPathArr.push(response.serverPath)
206
+ this.fileInfo.showName = nameArr.join(',')
207
+ this.fileInfo.serverPath = serverPathArr.join(',')
208
+ } else {
209
+ this.fileInfo.showName = response.name
210
+ this.fileInfo.serverPath = response.serverPath
211
+ }
212
+ } else {
213
+ this.fileInfo.showName = response.name
214
+ this.fileInfo.serverPath = response.serverPath
215
+ }
216
+ }
217
+ this.annexUploadFlag = false
218
+ },
219
+ preview() {
220
+ this.getFileList()
221
+ this.showPreviewMulti = true
222
+ },
223
+ previewSingle(file) {
224
+ if (isImage(file.showName)) {
225
+ this.previewImageInfo = file
226
+ this.showPreviewSingleImage = true
227
+ } else {
228
+ this.previewDoc(file)
229
+ }
230
+ },
231
+ getFileList() {
232
+ if (!this.customViewUrl) {
233
+ const nameArr = this.fileInfo.showName.split(',')
234
+ const serverPath = this.fileInfo.serverPath.split(',')
235
+ if (nameArr.length === 0 || serverPath.length === 0 || nameArr.length !== serverPath.length) {
236
+ return
237
+ }
238
+ const fileList = []
239
+ const url = Vue.prototype.baseURL + '/common/super-form/downloads?jwt=' + getToken()
240
+ for (let index = 0; index < nameArr.length; index++) {
241
+ const tempName = nameArr[index]
242
+ if (tempName && serverPath[index]) {
243
+ const standardFile = {
244
+ showName: tempName,
245
+ serverPath: serverPath[index],
246
+ src: url + '&showName=' + tempName + '&serverPath=' + serverPath[index]
247
+ }
248
+ if (isImage(tempName)) {
249
+ standardFile.isImg = true
250
+ } else {
251
+ standardFile.isImg = false
252
+ }
253
+ fileList.push(standardFile)
254
+ }
255
+ }
256
+ this.showFileList = fileList
257
+ } else {
258
+ this.showFileList = this.fileList
259
+ }
260
+ },
261
+ previewDoc(file) {
262
+ const token = getToken()
263
+ let previewUrl = Vue.prototype.baseURL + '/common/fs-upload/preview?jwt=' + token
264
+ if (isPlateSys(Vue.prototype.systemCode)) {
265
+ previewUrl = Vue.prototype.baseAPI + '/component/fs-upload/preview?jwt=' + token
266
+ }
267
+ if (Vue.prototype.customPreviewUrl) {
268
+ window.open(getSystemFrontendUrl(Vue.prototype.portalUrl) + '/#/file-service/preview?serverPath=' + file.serverPath +
269
+ '&showName=' + encodeURI(file.showName),
270
+ file.showName
271
+ )
272
+ } else {
273
+ window.open(previewUrl + '&showName=' + encodeURI(file.showName) + '&serverPath=' + file.serverPath)
274
+ }
275
+ },
276
+ deleteRow(index) {
277
+ const deleteFile = this.showFileList[index]
278
+ // this.fileList.splice(index, 1)
279
+ const nameArr = []
280
+ const pathArr = []
281
+ for (let i = 0; i < this.showFileList.length; i++) {
282
+ if (i !== index) {
283
+ nameArr.push(this.showFileList[i].showName)
284
+ pathArr.push(this.showFileList[i].serverPath)
285
+ }
286
+ }
287
+ this.fileInfo.showName = nameArr.join(',')
288
+ this.fileInfo.serverPath = pathArr.join(',')
289
+ this.getFileList()
290
+ this.$emit('delete-success', { deleteFile: deleteFile, all: this.showFileList })
291
+ this.$emit('delete', this.showFileList, index)
292
+ }
293
+ }
294
+ }
295
+ </script>
296
+
297
+ <style scoped></style>
@@ -0,0 +1,378 @@
1
+ <!-- 文件上传 -->
2
+ <template>
3
+ <div>
4
+ <template v-if="!disabled">
5
+ <el-input
6
+ ref="item"
7
+ :readonly="true"
8
+ :disabled="disabled"
9
+ :value="value"
10
+ :placeholder="$t('imatrixUIMessage.fileUpload')"
11
+ >
12
+ <el-button v-if="!disabled" slot="append" size="mini" icon="el-icon-upload2" @click="openAnnexUpload" />
13
+ </el-input>
14
+
15
+ <el-dialog
16
+ :title="$t('imatrixUIMessage.tips')"
17
+ :visible.sync="annexUploadFlag"
18
+ :append-to-body="true"
19
+ :show-close="true"
20
+ width="40%"
21
+ >
22
+ <el-upload id="upload" :show-file-list="false" :auto-upload="false" :on-change="uploadFile" action>
23
+ <el-button size="small" type="primary">
24
+ 选择文件
25
+ </el-button>
26
+ <span
27
+ slot="tip"
28
+ style="margin-left:12px"
29
+ class="el-upload__tip"
30
+ >
31
+ 上传文件不能超过{{ fileSetObj.limitFileSize }}M
32
+ <span v-if="fileSetObj.accept">,并且只接受{{ fileSetObj.accept }}类型文件</span>
33
+ </span>
34
+ </el-upload>
35
+ <br>
36
+ <el-row v-for="(file, index) in uploadingFile" :key="index">
37
+ <el-tag
38
+ size="small form-list-file"
39
+ >
40
+ <span>
41
+ <i class="el-icon-paperclip" />
42
+ <span style="margin-left:6.5px">{{ file.name }}</span>
43
+ </span>
44
+
45
+ <el-tooltip content="取消上传" placement="right" effect="light">
46
+ <i
47
+ class="el-icon-close"
48
+ style="margin-left:8px"
49
+ @click="cancelUpload(file.serverName)"
50
+ />
51
+ </el-tooltip>
52
+ </el-tag>
53
+ <el-progress :percentage="file.uploadProgress" />
54
+ </el-row>
55
+ <div
56
+ style="line-height 30px;"
57
+ >
58
+ <el-row>
59
+ <el-col>
60
+ <el-tag
61
+ v-for="(file, index) in fileContent"
62
+ :key="index"
63
+ size="small form-list-file"
64
+ >
65
+ <span @click="preview(file.name, file.serverName)">
66
+ <i class="el-icon-paperclip" />
67
+ <span style="margin-left:6.5px">{{ file.name }}</span>
68
+ </span>
69
+ <el-tooltip content="移除已上传文件" placement="right" effect="light">
70
+ <i
71
+ class="el-icon-close"
72
+ style="margin-left:8px"
73
+ @click="handleOnRemove(index,file)"
74
+ />
75
+ </el-tooltip>
76
+ </el-tag>
77
+ </el-col>
78
+ </el-row>
79
+ </div>
80
+ </el-dialog>
81
+ <el-dialog
82
+ :append-to-body="true"
83
+ :show-close="true"
84
+ :title="$t('imatrixUIPublicModel.previewImage')"
85
+ :visible.sync="showPreviewSingleImage"
86
+ @close="$emit('close')"
87
+ >
88
+ <span slot="title">{{ $t('imatrixUIPublicModel.previewImage') }}
89
+ <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
90
+ <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
91
+ </span>
92
+ <el-image :src="previewImageInfo.src" :preview-src-list="[previewImageInfo.src]" />
93
+ </el-dialog>
94
+ <el-dialog
95
+ :append-to-body="true"
96
+ :show-close="true"
97
+ :title="$t('imatrixUIPublicModel.preview')"
98
+ :visible.sync="showPreviewMulti"
99
+ width="30%"
100
+ @close="$emit('close')"
101
+ >
102
+ <span slot="title">{{ $t('imatrixUIPublicModel.preview') }}
103
+ <!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
104
+ <!-- <i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" /> -->
105
+ </span>
106
+ <el-table
107
+ :show-header="false"
108
+ :data="showFileList"
109
+ >
110
+ <el-table-column
111
+ width="300"
112
+ prop="showName"
113
+ />
114
+ <el-table-column align="right">
115
+ <template slot-scope="scope">
116
+ <el-tooltip :content="$t('imatrixUIPublicModel.preview')" class="item" effect="dark" placement="top">
117
+ <i class="el-icon-view" style="cursor:pointer;" @click="previewSingle(scope.row)" />
118
+ </el-tooltip>
119
+ </template>
120
+ </el-table-column>
121
+ <el-table-column v-if="!disabled">
122
+ <template slot-scope="scope">
123
+ <el-tooltip :content="$t('imatrixUIPublicModel.delete')" class="item" effect="dark" placement="top">
124
+ <i class="el-icon-delete" style="cursor:pointer;" @click="deleteRow(scope.$index)" />
125
+ </el-tooltip>
126
+ </template>
127
+ </el-table-column>
128
+ </el-table>
129
+ </el-dialog>
130
+ </template>
131
+ <template v-else>
132
+ <fs-preview :label="value" :file-list="showFileList" />
133
+ </template>
134
+ </div>
135
+ </template>
136
+
137
+ <script>
138
+
139
+ import { getToken } from '../../../src/utils/auth'
140
+ import { isImage } from '../../../src/utils/util'
141
+ import { isPlateSys, getSystemFrontendUrl } from '../../../src/utils/common-util'
142
+ import Vue from 'vue'
143
+ import FsPreview from '../../fs-preview/src/fs-preview.vue'
144
+ export default {
145
+ name: 'MultipartUploadList',
146
+ components: {
147
+ FsPreview
148
+ },
149
+ props: {
150
+ value: {
151
+ type: String,
152
+ default: null
153
+ },
154
+ entity: {
155
+ type: Object,
156
+ default: null
157
+ },
158
+ fileSetObj: {
159
+ type: Object,
160
+ default: () => {
161
+ return { limitFileSize: 10, multiple: false, accept: null }
162
+ }
163
+ },
164
+ disabled: {
165
+ type: Boolean,
166
+ default: false
167
+ }
168
+ },
169
+ data() {
170
+ const headers = { Authorization: getToken() }
171
+ let defaultAction = Vue.prototype.baseURL + '/common/fs-upload'
172
+ if (isPlateSys(Vue.prototype.systemCode)) {
173
+ defaultAction = Vue.prototype.baseAPI + '/component/super-form/uploads'
174
+ }
175
+ return {
176
+ deleteUuids: [],
177
+ headers,
178
+ defaultAction,
179
+ annexUploadFlag: false,
180
+ showPreviewSingleImage: false,
181
+ showPreviewMulti: false,
182
+ lastFileName: null,
183
+ previewImageInfo: {},
184
+ showFileList: [],
185
+ // /
186
+ uploadingFile: [], // 正在上传的文件
187
+ cancelUploadFile: [],
188
+ fileContent: [],
189
+ chunkSize: 5 * 1024 * 1024// 定义5M为一片
190
+
191
+ }
192
+ },
193
+ created() {
194
+
195
+ },
196
+ mounted() {
197
+ if (!this.fileSetObj.limitFileSize) {
198
+ this.fileSetObj.limitFileSize = 10
199
+ }
200
+ const name = this.entity[this.fileSetObj.showNameData.dbName]
201
+ const serverName = this.entity[this.fileSetObj.serverNameData.dbName]
202
+ if (name && serverName) {
203
+ const nameArr = name.split(',')
204
+ const serverNameArr = serverName.split(',')
205
+ nameArr.forEach((element, index) => {
206
+ this.fileContent.push({ name: element, serverName: serverNameArr[index] })
207
+ const token = getToken()
208
+ let url = Vue.prototype.baseURL + '/common/super-form/downloads?jwt=' + token
209
+ if (isPlateSys(Vue.prototype.systemCode)) {
210
+ url = Vue.prototype.baseAPI + '/component/super-form/downloads?jwt=' + token
211
+ }
212
+ const src = url + '&showName=' + encodeURI(element) + '&serverPath=' + serverNameArr[index]
213
+ this.showFileList.push({ showName: element, serverPath: serverNameArr[index], src: src })
214
+ })
215
+ }
216
+ },
217
+ methods: {
218
+ openAnnexUpload() {
219
+ this.annexUploadFlag = true
220
+ },
221
+ // //////
222
+ async uploadFile(res) {
223
+ if (this.uploadingFile.length > 0 && !this.fileSetObj.multiple) {
224
+ this.$message({
225
+ showClose: true,
226
+ message: '文件单选,请勿同时上传多份文件!',
227
+ type: 'warning'
228
+ })
229
+ return
230
+ }
231
+ // 占位 ,防止分片初始化未完成又选择文件上传
232
+ const uploadTimestamp = Date.now()
233
+ this.uploadingFile.push({ name: res.raw.name, uploadProgress: 0, serverName: uploadTimestamp })
234
+ // 获取用户选择的文件
235
+ const file = res.raw
236
+ const fileSize = file.size
237
+ // 计算当前选择文件需要的分片数量
238
+ const chunkCount = Math.ceil(fileSize / this.chunkSize)
239
+ console.log('文件大小:', (file.size / 1024 / 1024) + 'Mb', '分片数:', chunkCount)
240
+ console.log('向后端请求本次分片上传初始化')
241
+ const requestData = { fileName: file.name, chunkCount: chunkCount }
242
+ // 向后端请求本次分片上传初始化
243
+
244
+ this.$http.post(Vue.prototype.baseURL + '/common/mutipart-upload/create', requestData).then(
245
+ async res => {
246
+ console.log(this.cancelUploadFile, 'sssssssssssss')
247
+ if (this.cancelUploadFile.indexOf(requestData.serverName) > 0) {
248
+ return
249
+ }
250
+ const currentUploadInex = this.uploadingFile.findIndex(item => item.serverName === uploadTimestamp)
251
+ const serverName = res.serverName
252
+ this.uploadingFile[currentUploadInex] = { uploadProgress: 0, name: file.name, serverName: serverName, folder: res.folder }
253
+ console.log(this.uploadingFile, 'uploadingFile')
254
+ const chunkNames = []
255
+ for (let i = 0; i < chunkCount; i++) {
256
+ // 分片开始位置
257
+ const start = i * this.chunkSize
258
+ // 分片结束位置
259
+ const end = Math.min(fileSize, start + this.chunkSize)
260
+ // 取文件指定范围内的byte,从而得到分片数据
261
+ const _chunkFile = file.slice(start, end)
262
+ console.log('开始上传第' + (i + 1) + '个分片' + ',共' + chunkCount + '个')
263
+ const formData = new FormData()
264
+ formData.append('folder', res.folder)
265
+ formData.append('serverName', serverName)
266
+ formData.append('file', _chunkFile)
267
+ if (this.cancelUploadFile.indexOf(serverName) > 0) {
268
+ break
269
+ } else {
270
+ await this.$http.post(Vue.prototype.baseURL + '/common/mutipart-upload/upload', formData).then(uploadPieceRes => {
271
+ chunkNames.push(uploadPieceRes.uploadName)
272
+ const uploadProgress = parseInt(((i + 1) / chunkCount) * 100)
273
+ this.uploadingFile[currentUploadInex].uploadProgress = (uploadProgress > 100 ? 100 : uploadProgress)
274
+ this.$set(this.uploadingFile, currentUploadInex, this.uploadingFile[currentUploadInex])
275
+ console.log('第' + (i + 1) + '个分片上传完成', this.uploadingFile)
276
+ })
277
+ }
278
+ }
279
+ if (this.cancelUploadFile.indexOf(serverName) < 0) {
280
+ // 请求后端合并文件
281
+ this.composeFile(file.name, chunkCount, fileSize, serverName, chunkNames, res.folder)
282
+ } else {
283
+ await this.$http.post(Vue.prototype.baseURL + '/common/mutipart-upload/remove-chunks', { serverName: serverName, folder: res.folder }).then(uploadPieceRes => {
284
+ console.log('取消上传,并移除已上传的文件碎片')
285
+ })
286
+ }
287
+ })
288
+ },
289
+ /**
290
+ * 请求后端合并文件
291
+ * @param serverName
292
+ * @param fileName
293
+ */
294
+ composeFile(fileName, chunkSize, fileSize, serverName, chunkNames, folder) {
295
+ const data = {
296
+ fileName: fileName, // 文件名称
297
+ chunkSize: chunkSize, // 分片数量
298
+ fileSize: fileSize, // 文件大小byte
299
+ serverName: serverName, // serverName
300
+ chunkNames: chunkNames, // 上传分片的编号
301
+ folder: folder
302
+ }
303
+ console.log(data, '开始请求后端合并文件')
304
+ this.$http.post(Vue.prototype.baseURL + '/common/mutipart-upload/merge', data).then(res => {
305
+ this.uploadingFile.splice(this.uploadingFile.findIndex(item => item.serverName === serverName), 1)
306
+ if (this.fileSetObj.multiple) {
307
+ this.fileContent.push({ name: fileName, serverName: serverName })
308
+ const currentShowName = this.entity[this.fileSetObj.showNameData.dbName]
309
+ if (currentShowName && currentShowName.length > 0) {
310
+ this.setEntityValue(currentShowName + ',' + fileName,
311
+ this.entity[this.fileSetObj.serverNameData.dbName] + ',' + serverName)
312
+ } else {
313
+ this.setEntityValue(fileName, serverName)
314
+ }
315
+ } else {
316
+ this.fileContent = [{ name: fileName, serverName: serverName }]
317
+ this.setEntityValue(fileName, serverName)
318
+ }
319
+ // this.$emit('sendFileObjToParent', res.data)// 传递给父组件请求结果
320
+ console.log('合并文件完成', res, this.entity)
321
+ })
322
+ },
323
+ setEntityValue(fileName, serverName) {
324
+ this.$set(this.entity, this.fileSetObj.showNameData.dbName, fileName)
325
+ this.$set(this.entity, this.fileSetObj.serverNameData.dbName, serverName)
326
+ },
327
+ cancelUpload(serverName) {
328
+ this.$set(this.entity, 'DOC_NAME', null)
329
+ this.$set(this.entity, 'DOC_PATH', null)
330
+ this.cancelUploadFile.push(serverName)
331
+ this.uploadingFile.splice(this.uploadingFile.findIndex(item => item.serverName === serverName), 1)
332
+ },
333
+ preview(name, serverName) {
334
+ if (isImage(name)) {
335
+ this.previewImageInfo = {
336
+ src: Vue.prototype.baseURL + '/common/super-form/downloads?jwt=' + getToken() + '&showName=' + name + '&serverPath=' + serverName
337
+ }
338
+ this.showPreviewSingleImage = true
339
+ } else {
340
+ this.previewDoc(name, serverName)
341
+ }
342
+ },
343
+ previewDoc(name, serverName) {
344
+ const token = getToken()
345
+ let previewUrl = Vue.prototype.baseURL + '/common/fs-upload/preview?jwt=' + token
346
+ if (isPlateSys(Vue.prototype.systemCode)) {
347
+ previewUrl = Vue.prototype.baseAPI + '/component/fs-upload/preview?jwt=' + token
348
+ }
349
+ if (Vue.prototype.customPreviewUrl) {
350
+ window.open(getSystemFrontendUrl(Vue.prototype.portalUrl) + '/#/file-service/preview?serverPath=' + serverName +
351
+ '&showName=' + encodeURI(name),
352
+ name
353
+ )
354
+ } else {
355
+ window.open(previewUrl + '&showName=' + encodeURI(name) + '&serverPath=' + serverName)
356
+ }
357
+ },
358
+ handleOnRemove(index) {
359
+ this.fileContent.splice(index, 1)
360
+ if (this.fileSetObj.multiple) {
361
+ const nameArr = []
362
+ const serverNameArr = []
363
+ this.fileContent.forEach(element => {
364
+ if (element.name && element.serverName) {
365
+ nameArr.push(element.name)
366
+ serverNameArr.push(element.serverName)
367
+ }
368
+ })
369
+ this.setEntityValue(nameArr.join(','), serverNameArr.join(','))
370
+ } else {
371
+ this.setEntityValue(null, null)
372
+ }
373
+ }
374
+ }
375
+ }
376
+ </script>
377
+
378
+ <style scoped></style>
@@ -0,0 +1,6 @@
1
+ import OrganizationInput from './src/organization-input.vue'
2
+ OrganizationInput.install = function(Vue) {
3
+ Vue.component(OrganizationInput.name, OrganizationInput)
4
+ }
5
+
6
+ export default OrganizationInput