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.
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +115880 -110424
- package/lib/super-ui.umd.cjs +103 -95
- package/package.json +6 -3
- package/packages/department-tree/src/department-tree.vue +27 -10
- package/packages/department-tree-inline/src/department-tree-service.js +20 -41
- package/packages/department-tree-mobile/src/department-tree-app.vue +6 -6
- package/packages/department-tree-mobile/src/department-tree-inline-app.vue +15 -15
- package/packages/department-user-tree/src/department-user-tree.vue +17 -2
- package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +61 -26
- package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +64 -22
- package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -6
- package/packages/department-user-tree-inline/src/group-user/group-input.vue +162 -0
- package/packages/department-user-tree-inline/src/group-user/group-list.vue +99 -0
- package/packages/department-user-tree-inline/src/group-user/group-user.vue +42 -0
- package/packages/department-user-tree-inline/src/group-user-multiple-tree.vue +304 -0
- package/packages/department-user-tree-inline/src/group-user-single-tree.vue +155 -0
- package/packages/department-user-tree-inline/src/group-user-tree-service.js +74 -0
- package/packages/department-user-tree-inline/src/search-result.vue +34 -36
- package/packages/department-user-tree-mobile/src/department-user-tree-app.vue +6 -6
- package/packages/department-user-tree-mobile/src/department-user-tree-inline-app.vue +17 -19
- package/packages/department-user-tree-mobile/src/department-user-tree-service.ts +0 -11
- package/packages/dynamic-source-select/src/dynamic-source-select.vue +795 -799
- package/packages/dynamic-source-select/src/events.js +11 -16
- package/packages/fs-upload-list/src/fs-upload-list.vue +183 -122
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +246 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +480 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-component.vue +127 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-input.vue +246 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload.vue +255 -0
- package/packages/fs-upload-new/src/fs-button-upload.vue +10 -13
- package/packages/fs-upload-new/src/fs-drag-upload.vue +4 -8
- package/packages/fs-upload-new/src/fs-preview-new.vue +103 -36
- package/packages/fs-upload-new/src/fs-upload-new.vue +160 -13
- package/packages/index.js +11 -2
- package/packages/organization-input/src/organization-input.vue +493 -539
- package/packages/plugins/export-data-new.js +34 -1
- package/packages/rich-editor/index.vue +29 -0
- package/packages/row-form/index.js +7 -0
- package/packages/row-form/index.vue +211 -0
- package/packages/scan-code-input/src/scan-code-input.vue +136 -104
- package/packages/scan-code-input-browser/index.js +6 -0
- package/packages/{scan-code-input/src/scan-code-input-colse.vue → scan-code-input-browser/src/scan-code-input.vue} +1 -28
- package/packages/secret-info/index.vue +2 -2
- package/packages/super-grid/src/apis.js +158 -10
- package/packages/super-grid/src/components/grid-icon.vue +7 -14
- package/packages/super-grid/src/components/hyperlinks.vue +24 -8
- package/packages/super-grid/src/custom-formatter.js +312 -380
- package/packages/super-grid/src/dynamic-input.vue +346 -43
- package/packages/super-grid/src/formValidatorUtil.js +79 -15
- package/packages/super-grid/src/group-column.vue +5 -0
- package/packages/super-grid/src/normal-column-content.vue +1056 -0
- package/packages/super-grid/src/normal-column.vue +57 -740
- package/packages/super-grid/src/row-detail.vue +50 -0
- package/packages/super-grid/src/row-operation.vue +19 -10
- package/packages/super-grid/src/scan-util.ts +243 -0
- package/packages/super-grid/src/search-button.vue +18 -14
- package/packages/super-grid/src/search-form-advancedQuery.vue +9 -2
- package/packages/super-grid/src/search-form-item.vue +10 -3
- package/packages/super-grid/src/search-form-mobile.vue +250 -0
- package/packages/super-grid/src/search-form.vue +159 -82
- package/packages/super-grid/src/super-grid-service.js +51 -6
- package/packages/super-grid/src/super-grid.vue +657 -761
- package/packages/super-grid/src/utils.js +126 -170
- package/packages/super-nine-grid/src/super-nine-grid.vue +1032 -1141
- package/packages/workflow-button/src/workflow-button.vue +6 -1
- package/packages/workgroup-tree/src/workgroup-tree.vue +31 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +28 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +26 -0
- package/packages/workgroup-tree-mobile/index.js +6 -0
- package/packages/workgroup-tree-mobile/src/dept-result.vue +51 -0
- package/packages/workgroup-tree-mobile/src/workgroup-tree-app.vue +120 -0
- package/packages/workgroup-tree-mobile/src/workgroup-tree-inline-app.vue +375 -0
- package/packages/workgroup-tree-mobile/src/workgroup-tree-service.ts +62 -0
- package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +15 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +27 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +11 -0
- package/packages/workgroup-user-tree-mobile/index.js +6 -0
- package/packages/workgroup-user-tree-mobile/src/dept-path.vue +36 -0
- package/packages/workgroup-user-tree-mobile/src/dept-result.vue +58 -0
- package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-app.vue +119 -0
- package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-inline-app.vue +394 -0
- package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-service.ts +41 -0
- package/src/api/sso-service.js +44 -15
- package/src/directives/permission/permission.js +4 -3
- package/src/i18n/langs/cn.js +19 -3
- package/src/i18n/langs/en.js +18 -2
- package/src/permission.js +114 -122
- package/src/store/modules/user.js +32 -33
- package/src/styles/index.scss +1 -0
- package/src/styles/table.scss +12 -0
- package/src/styles/theme/dark-blue/button.scss +2 -2
- package/src/styles/theme/dark-blue/index.scss +1 -1
- package/src/styles/theme/dark-blue/sidebar.scss +10 -0
- package/src/styles/theme/dark-blue/table.scss +8 -52
- package/src/styles/theme/green/button.scss +2 -2
- package/src/styles/theme/green/green.scss +1 -1
- package/src/styles/theme/green/index.scss +1 -1
- package/src/styles/theme/green/sidebar.scss +20 -0
- package/src/styles/theme/green/table.scss +7 -51
- package/src/styles/theme/ocean-blue/button.scss +2 -2
- package/src/styles/theme/ocean-blue/index.scss +1 -1
- package/src/styles/theme/ocean-blue/ocean-blue.scss +1 -1
- package/src/styles/theme/ocean-blue/sidebar.scss +10 -0
- package/src/styles/theme/ocean-blue/table.scss +7 -52
- package/src/utils/auth.js +23 -3
- package/src/utils/calculator/calculator-factory.js +4 -4
- package/src/utils/calculator/calculator-util.js +14 -0
- package/src/utils/common-util.js +270 -124
- package/src/utils/i18n-util.js +145 -0
- package/src/utils/jump-page-utils.js +245 -314
- package/src/utils/permission.js +7 -1
- package/src/utils/permissionAuth.js +155 -37
- package/src/utils/request.js +10 -11
- package/src/utils/util.js +154 -205
- package/src/views/layout/EmptyLayout.vue +1 -1
- package/src/views/layout/components/Menubar/Item.vue +27 -4
- package/src/views/layout/components/Menubar/SidebarItem.vue +7 -3
- package/src/views/layout/components/Menubar/index.vue +14 -2
- package/src/views/layout/tab-content-index.vue +1 -1
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-input
|
|
4
|
+
ref="item"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
v-model="fileNames"
|
|
7
|
+
:placeholder="$t('imatrixUIMessage.fileUpload')"
|
|
8
|
+
:readonly="true"
|
|
9
|
+
>
|
|
10
|
+
<template v-slot:append>
|
|
11
|
+
<el-button :icon="Upload" size="default" @click="openAnnexUpload" />
|
|
12
|
+
</template>
|
|
13
|
+
</el-input>
|
|
14
|
+
|
|
15
|
+
<el-dialog
|
|
16
|
+
v-model="annexUploadFlag"
|
|
17
|
+
:append-to-body="true"
|
|
18
|
+
:show-close="true"
|
|
19
|
+
:title="$t('imatrixUIMessage.upload')"
|
|
20
|
+
width="80%"
|
|
21
|
+
@close="annexUploadFlag=false"
|
|
22
|
+
>
|
|
23
|
+
<FileUploadMobile
|
|
24
|
+
ref="fileUploadRef"
|
|
25
|
+
:disabled="disabled"
|
|
26
|
+
:fileInfo="fileInfo"
|
|
27
|
+
:systemCode="systemCode"
|
|
28
|
+
:accept="accept"
|
|
29
|
+
:multiple="multiple"
|
|
30
|
+
:limit="limit"
|
|
31
|
+
:limitFileSize="limitFileSize"
|
|
32
|
+
:placeholder="placeholder"
|
|
33
|
+
:action="action"
|
|
34
|
+
:headers="headers"
|
|
35
|
+
:file-list="fileList"
|
|
36
|
+
:beforeUpload="beforeUpload"
|
|
37
|
+
:onSuccess="onSuccess"
|
|
38
|
+
:beforeRemove="beforeRemove"
|
|
39
|
+
:onRemove="onRemove"
|
|
40
|
+
:beforeDownload="beforeDownload"
|
|
41
|
+
:pageContext="pageContext"
|
|
42
|
+
:configure="configure"
|
|
43
|
+
:openFsUpload="openFsUpload"
|
|
44
|
+
:componentId="componentId"
|
|
45
|
+
:componentName="componentName"
|
|
46
|
+
:listCode="listCode"
|
|
47
|
+
:openCameraOrChoosePhoto="openCameraOrChoosePhoto"
|
|
48
|
+
@uploadend="uploadendMobile"
|
|
49
|
+
@remove="removeMobileFile"
|
|
50
|
+
/>
|
|
51
|
+
</el-dialog>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script lang="ts" setup>
|
|
56
|
+
import { ref, defineEmits } from 'vue'
|
|
57
|
+
import { ElMessage } from 'element-plus'
|
|
58
|
+
import FileUploadMobile from './file-upload.vue'
|
|
59
|
+
import {
|
|
60
|
+
Upload
|
|
61
|
+
} from '@element-plus/icons-vue'
|
|
62
|
+
|
|
63
|
+
const props = defineProps({
|
|
64
|
+
openFsUpload: {
|
|
65
|
+
type: Object,
|
|
66
|
+
default: true
|
|
67
|
+
},
|
|
68
|
+
entity: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: () => {
|
|
71
|
+
return null
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
fileInfo: {
|
|
75
|
+
type: Object,
|
|
76
|
+
default: () => ({})
|
|
77
|
+
},
|
|
78
|
+
systemCode: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: ''
|
|
81
|
+
},
|
|
82
|
+
displayType: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: 'input'
|
|
85
|
+
},
|
|
86
|
+
// 是否禁止编辑,为true只能下载,不能删除和上传
|
|
87
|
+
disabled: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: false
|
|
90
|
+
},
|
|
91
|
+
accept: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: ''
|
|
94
|
+
},
|
|
95
|
+
multiple: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
limit: {
|
|
100
|
+
type: Number,
|
|
101
|
+
default: 1
|
|
102
|
+
},
|
|
103
|
+
// 文件大小限制,单位是M,默认是30M
|
|
104
|
+
limitFileSize: {
|
|
105
|
+
type: Number,
|
|
106
|
+
default: 30
|
|
107
|
+
},
|
|
108
|
+
placeholder: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: '拖拽文件 或 点击上传'
|
|
111
|
+
},
|
|
112
|
+
action: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: ''
|
|
115
|
+
},
|
|
116
|
+
headers: {
|
|
117
|
+
type: Object,
|
|
118
|
+
default: () => ({ Authorization: null })
|
|
119
|
+
},
|
|
120
|
+
// 已上传文件列表
|
|
121
|
+
fileList: {
|
|
122
|
+
type: Array,
|
|
123
|
+
default: () => []
|
|
124
|
+
},
|
|
125
|
+
onSuccess: {
|
|
126
|
+
type: Function,
|
|
127
|
+
default: () => {}
|
|
128
|
+
},
|
|
129
|
+
beforeRemove: {
|
|
130
|
+
type: Function,
|
|
131
|
+
default: () => {}
|
|
132
|
+
},
|
|
133
|
+
onRemove: {
|
|
134
|
+
type: Function,
|
|
135
|
+
default: () => {}
|
|
136
|
+
},
|
|
137
|
+
beforeDownload: {
|
|
138
|
+
type: Function,
|
|
139
|
+
default: () => {}
|
|
140
|
+
},
|
|
141
|
+
pageContext: {
|
|
142
|
+
type: Object,
|
|
143
|
+
default: () => ({})
|
|
144
|
+
},
|
|
145
|
+
configure: {
|
|
146
|
+
type: Object,
|
|
147
|
+
default: () => ({})
|
|
148
|
+
},
|
|
149
|
+
// 组件id,在表单或列表中应该唯一,一般传字段名即可
|
|
150
|
+
componentId: {
|
|
151
|
+
type: String,
|
|
152
|
+
default: function () {
|
|
153
|
+
return 'file-upload'
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
// 组件名称,一般是字段label
|
|
157
|
+
componentName: {
|
|
158
|
+
type: String,
|
|
159
|
+
default: function () {
|
|
160
|
+
return 'file-upload'
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
// 列表编码
|
|
164
|
+
listCode: {
|
|
165
|
+
type: String,
|
|
166
|
+
default: null
|
|
167
|
+
},
|
|
168
|
+
// 打开相机和相册选项,默认是都可以打开
|
|
169
|
+
openCameraOrChoosePhoto: {
|
|
170
|
+
type: String,
|
|
171
|
+
default: 'openCameraAndChoosePhoto'
|
|
172
|
+
},
|
|
173
|
+
beforeUpload: {
|
|
174
|
+
type: Function,
|
|
175
|
+
default: () => {}
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
const emits = defineEmits(['remove', 'uploadend'])
|
|
180
|
+
const annexUploadFlag = ref(false)
|
|
181
|
+
const fileNames = ref(null)
|
|
182
|
+
|
|
183
|
+
const openAnnexUpload = ()=>{
|
|
184
|
+
console.log('点击选择文件按钮---')
|
|
185
|
+
annexUploadFlag.value = true
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function uploadendMobile(fileList) {
|
|
189
|
+
const fileServerPaths = Array.from(props.fileList,({serverPath})=>serverPath)
|
|
190
|
+
console.log('uploadendMobile---props.fileList=', JSON.stringify(props.fileList),'fileServerPaths=',fileServerPaths, 'fileList=', JSON.stringify(fileList))
|
|
191
|
+
fileList.forEach(file=>{
|
|
192
|
+
// 如果已经存在就不要重复添加到fileList中了
|
|
193
|
+
if(fileServerPaths.indexOf(file.serverPath) < 0){
|
|
194
|
+
props.fileList.push({
|
|
195
|
+
showName: file.name,
|
|
196
|
+
serverPath: file.serverPath
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
console.log('uploadendMobile2222---props.fileList=', JSON.stringify(props.fileList),'fileServerPaths=',fileServerPaths, 'fileList=', JSON.stringify(fileList))
|
|
201
|
+
fileNames.value =props.fileList.map((item: any) => item.showName).join(',')
|
|
202
|
+
console.log('uploadendMobile3333---fileNames.value=', fileNames.value)
|
|
203
|
+
props.onSuccess()
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
function removeMobileFile(param) {
|
|
208
|
+
// console.log('removeMobileFile---props.fileList=', props.fileList, 'param=', param)
|
|
209
|
+
const deleteFile = param.rmFiles && param.rmFiles.length > 0 ? param.rmFiles[0] : null
|
|
210
|
+
if(deleteFile){
|
|
211
|
+
let index = props.fileList.findIndex((item: any) => item.serverPath === deleteFile.serverPath)
|
|
212
|
+
if (index > -1) {
|
|
213
|
+
// eslint-disable-next-line vue/no-mutating-props
|
|
214
|
+
props.fileList.splice(index, 1)
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
fileNames.value =props.fileList.map((item: any) => item.showName).join(',')
|
|
218
|
+
props.onRemove()
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const userAgent = ref(null)
|
|
222
|
+
const fileUploadRef = ref(null)
|
|
223
|
+
const userAgentOrg = navigator.userAgent
|
|
224
|
+
if (userAgentOrg.indexOf(' uni-app ') > 0) {
|
|
225
|
+
// 表示uni-app中访问的
|
|
226
|
+
userAgent.value = 'app'
|
|
227
|
+
} else {
|
|
228
|
+
// 表示手机浏览器访问的
|
|
229
|
+
userAgent.value = 'browser'
|
|
230
|
+
}
|
|
231
|
+
// 移动端选择文件结束
|
|
232
|
+
function pickFileDone(data) {
|
|
233
|
+
if (userAgent.value === 'app') {
|
|
234
|
+
fileUploadRef.value.pickFileDone(data)
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// 移动端上传文件结束
|
|
238
|
+
function uploadFileDone(data) {
|
|
239
|
+
if (userAgent.value === 'app') {
|
|
240
|
+
fileUploadRef.value.uploadFileDone(data)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
defineExpose({pickFileDone,uploadFileDone})
|
|
244
|
+
</script>
|
|
245
|
+
|
|
246
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<file-upload-app
|
|
4
|
+
v-if="userAgent === 'app'"
|
|
5
|
+
ref="fileUploadRef"
|
|
6
|
+
:file-list="fileList"
|
|
7
|
+
:multiple="multiple"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:fileInfo="fileInfo"
|
|
10
|
+
:systemCode="systemCode"
|
|
11
|
+
:accept="accept"
|
|
12
|
+
:limit="limit"
|
|
13
|
+
:limitFileSize="limitFileSize"
|
|
14
|
+
:placeholder="placeholder"
|
|
15
|
+
:action="action"
|
|
16
|
+
:headers="headers"
|
|
17
|
+
:beforeUpload="beforeUpload"
|
|
18
|
+
:onSuccess="onSuccess"
|
|
19
|
+
:beforeRemove="beforeRemove"
|
|
20
|
+
:onRemove="onRemove"
|
|
21
|
+
:beforeDownload="beforeDownload"
|
|
22
|
+
:pageContext="pageContext"
|
|
23
|
+
:configure="configure"
|
|
24
|
+
:openFsUpload="openFsUpload"
|
|
25
|
+
:componentId="componentId"
|
|
26
|
+
:componentName="componentName"
|
|
27
|
+
:listCode="listCode"
|
|
28
|
+
:openCameraOrChoosePhoto="openCameraOrChoosePhoto"
|
|
29
|
+
@uploadend="uploadedFile"
|
|
30
|
+
@remove="removeFile"
|
|
31
|
+
/>
|
|
32
|
+
<file-upload-browser
|
|
33
|
+
v-else-if="userAgent === 'browser'"
|
|
34
|
+
ref="fileUploadRef"
|
|
35
|
+
:file-list="fileList"
|
|
36
|
+
:multiple="multiple"
|
|
37
|
+
:disabled="disabled"
|
|
38
|
+
:fileInfo="fileInfo"
|
|
39
|
+
:systemCode="systemCode"
|
|
40
|
+
:accept="accept"
|
|
41
|
+
:limit="limit"
|
|
42
|
+
:limitFileSize="limitFileSize"
|
|
43
|
+
:placeholder="placeholder"
|
|
44
|
+
:action="action"
|
|
45
|
+
:headers="headers"
|
|
46
|
+
:beforeUpload="beforeUpload"
|
|
47
|
+
:onSuccess="onSuccess"
|
|
48
|
+
:beforeRemove="beforeRemove"
|
|
49
|
+
:onRemove="onRemove"
|
|
50
|
+
:beforeDownload="beforeDownload"
|
|
51
|
+
:pageContext="pageContext"
|
|
52
|
+
:configure="configure"
|
|
53
|
+
:openFsUpload="openFsUpload"
|
|
54
|
+
:componentId="componentId"
|
|
55
|
+
:componentName="componentName"
|
|
56
|
+
:listCode="listCode"
|
|
57
|
+
:openCameraOrChoosePhoto="openCameraOrChoosePhoto"
|
|
58
|
+
@uploadend="uploadedFile"
|
|
59
|
+
@remove="removeFile"
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
<script lang="ts" setup>
|
|
64
|
+
import { ref, defineEmits } from 'vue'
|
|
65
|
+
import { ElMessage } from 'element-plus'
|
|
66
|
+
import { useI18n } from 'vue-i18n'
|
|
67
|
+
import FileUploadApp from './file-upload-app.vue'
|
|
68
|
+
import FileUploadBrowser from './file-upload-browser.vue'
|
|
69
|
+
import apis from './api.js'
|
|
70
|
+
|
|
71
|
+
const props = defineProps({
|
|
72
|
+
openFsUpload: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: true
|
|
75
|
+
},
|
|
76
|
+
entity: {
|
|
77
|
+
type: Object,
|
|
78
|
+
default: () => {
|
|
79
|
+
return null
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
fileInfo: {
|
|
83
|
+
type: Object,
|
|
84
|
+
default: () => ({})
|
|
85
|
+
},
|
|
86
|
+
systemCode: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: ''
|
|
89
|
+
},
|
|
90
|
+
displayType: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: 'input'
|
|
93
|
+
},
|
|
94
|
+
// 是否禁止编辑,为true只能下载,不能删除和上传
|
|
95
|
+
disabled: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
accept: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: ''
|
|
102
|
+
},
|
|
103
|
+
multiple: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: false
|
|
106
|
+
},
|
|
107
|
+
limit: {
|
|
108
|
+
type: Number,
|
|
109
|
+
default: 1
|
|
110
|
+
},
|
|
111
|
+
// 文件大小限制,单位是M,默认是30M
|
|
112
|
+
limitFileSize: {
|
|
113
|
+
type: Number,
|
|
114
|
+
default: 30
|
|
115
|
+
},
|
|
116
|
+
placeholder: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: '拖拽文件 或 点击上传'
|
|
119
|
+
},
|
|
120
|
+
action: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: ''
|
|
123
|
+
},
|
|
124
|
+
headers: {
|
|
125
|
+
type: Object,
|
|
126
|
+
default: () => ({ Authorization: null })
|
|
127
|
+
},
|
|
128
|
+
// 已上传文件列表
|
|
129
|
+
fileList: {
|
|
130
|
+
type: Array,
|
|
131
|
+
default: () => []
|
|
132
|
+
},
|
|
133
|
+
onSuccess: {
|
|
134
|
+
type: Function,
|
|
135
|
+
default: () => {}
|
|
136
|
+
},
|
|
137
|
+
beforeRemove: {
|
|
138
|
+
type: Function,
|
|
139
|
+
default: () => {}
|
|
140
|
+
},
|
|
141
|
+
onRemove: {
|
|
142
|
+
type: Function,
|
|
143
|
+
default: () => {}
|
|
144
|
+
},
|
|
145
|
+
beforeDownload: {
|
|
146
|
+
type: Function,
|
|
147
|
+
default: () => {}
|
|
148
|
+
},
|
|
149
|
+
pageContext: {
|
|
150
|
+
type: Object,
|
|
151
|
+
default: () => ({})
|
|
152
|
+
},
|
|
153
|
+
configure: {
|
|
154
|
+
type: Object,
|
|
155
|
+
default: () => ({})
|
|
156
|
+
},
|
|
157
|
+
// 组件id,在表单或列表中应该唯一,一般传字段名即可
|
|
158
|
+
componentId: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: function () {
|
|
161
|
+
return 'file-upload'
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
// 组件名称,一般是字段label
|
|
165
|
+
componentName: {
|
|
166
|
+
type: String,
|
|
167
|
+
default: function () {
|
|
168
|
+
return 'file-upload'
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
// 列表编码
|
|
172
|
+
listCode: {
|
|
173
|
+
type: String,
|
|
174
|
+
default: null
|
|
175
|
+
},
|
|
176
|
+
// 打开相机和相册选项,默认是都可以打开
|
|
177
|
+
openCameraOrChoosePhoto: {
|
|
178
|
+
type: String,
|
|
179
|
+
default: 'openCameraAndChoosePhoto'
|
|
180
|
+
},
|
|
181
|
+
beforeUpload: {
|
|
182
|
+
type: Function,
|
|
183
|
+
default: () => {}
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
const baseAPI = window.$vueApp.config.globalProperties.baseAPI
|
|
187
|
+
const deleteServerFileUrl = baseAPI + '/component/super-form/deleteFile'
|
|
188
|
+
const emits = defineEmits(['uploadend', 'remove', 'pickup-file', 'close'])
|
|
189
|
+
const { t } = useI18n()
|
|
190
|
+
|
|
191
|
+
const userAgent = ref(null)
|
|
192
|
+
const userAgentDetail = ref(null)
|
|
193
|
+
const rmFileServerPaths = ref([])
|
|
194
|
+
const fileUploadRef = ref(null)
|
|
195
|
+
|
|
196
|
+
const userAgentOrg = navigator.userAgent
|
|
197
|
+
userAgentDetail.value = userAgentOrg
|
|
198
|
+
if (userAgentOrg.indexOf(' uni-app ') > 0) {
|
|
199
|
+
// 表示uni-app中访问的
|
|
200
|
+
userAgent.value = 'app'
|
|
201
|
+
} else {
|
|
202
|
+
// 表示手机浏览器访问的
|
|
203
|
+
userAgent.value = 'browser'
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// 点击确定(上传)按钮的回调方法
|
|
207
|
+
function uploadedFile(fileList) {
|
|
208
|
+
emits('uploadend', fileList)
|
|
209
|
+
}
|
|
210
|
+
function deleteServerFiles() {
|
|
211
|
+
return window.$vueApp.config.globalProperties.$http.post(deleteServerFileUrl, rmFileServerPaths.value)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function removeFile({ rmFiles, serverFiles, newFiles }) {
|
|
215
|
+
if (rmFiles && rmFiles.length > 0) {
|
|
216
|
+
rmFiles.forEach((item) => {
|
|
217
|
+
if (item.serverPath && rmFileServerPaths.value && rmFileServerPaths.value.indexOf(item.serverPath) < 0) {
|
|
218
|
+
rmFileServerPaths.value.push(item.serverPath)
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
if (rmFileServerPaths.value && rmFileServerPaths.value.length > 0) {
|
|
222
|
+
// 删除minio等服务器上的附件
|
|
223
|
+
deleteServerFiles().then(() => {
|
|
224
|
+
// 更新字段的值
|
|
225
|
+
ElMessage({
|
|
226
|
+
showClose: true,
|
|
227
|
+
message: t('fileUpload.updateSuccess'),
|
|
228
|
+
type: 'success'
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
emits('remove', { rmFiles, serverFiles, newFiles })
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// 移动端选择文件结束
|
|
236
|
+
function pickFileDone(data) {
|
|
237
|
+
if (userAgent.value === 'app') {
|
|
238
|
+
fileUploadRef.value.pickFileDone(data)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// 移动端上传文件结束
|
|
242
|
+
function uploadFileDone(data) {
|
|
243
|
+
if (userAgent.value === 'app') {
|
|
244
|
+
fileUploadRef.value.uploadFileDone(data)
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function clearTempFile() {
|
|
248
|
+
if (fileUploadRef.value) {
|
|
249
|
+
fileUploadRef.value.clearQueenFile()
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
defineExpose({pickFileDone,uploadFileDone})
|
|
253
|
+
</script>
|
|
254
|
+
|
|
255
|
+
<style lang="scss" scoped></style>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:show-file-list="false"
|
|
8
8
|
auto-upload
|
|
9
9
|
:headers="headers"
|
|
10
|
-
|
|
10
|
+
:disabled="!openFsUpload"
|
|
11
11
|
:action="defaultAction"
|
|
12
12
|
:multiple="multiple"
|
|
13
13
|
:before-upload="handleBeforeUpload"
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
>
|
|
17
17
|
<el-button size="small" type="primary">{{ placeholder }}</el-button>
|
|
18
18
|
<template #tip>
|
|
19
|
-
<el-text size="small"> {{ accept }}
|
|
19
|
+
<el-text size="small"> {{ accept }} {{$t('imatrixUIMessage.uploadFileTip',{fileSzie: limitFileSize})}}</el-text>
|
|
20
20
|
</template>
|
|
21
21
|
</el-upload>
|
|
22
22
|
<template v-if="fileList && fileList.length > 0">
|
|
23
|
-
<fs-preview-new :disabled="disabled" :file-list="fileList" :system-code="systemCode" />
|
|
23
|
+
<fs-preview-new :disabled="disabled" :file-list="fileList" :system-code="systemCode" :before-remove="beforeRemove" :on-remove="onRemove" :before-download="beforeDownload"/>
|
|
24
24
|
</template>
|
|
25
25
|
</template>
|
|
26
26
|
|
|
@@ -31,10 +31,10 @@ import { getToken } from '../../../src/utils/auth'
|
|
|
31
31
|
import type { UploadFile, UploadFiles } from 'element-plus'
|
|
32
32
|
import fsPreviewNew from './fs-preview-new.vue'
|
|
33
33
|
const props = defineProps({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
openFsUpload: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
38
38
|
systemCode: {
|
|
39
39
|
type: String,
|
|
40
40
|
default: ''
|
|
@@ -75,10 +75,6 @@ const props = defineProps({
|
|
|
75
75
|
type: Array<{ showName: string; serverPath: string }>,
|
|
76
76
|
default: () => []
|
|
77
77
|
},
|
|
78
|
-
handleBeforeUpload: {
|
|
79
|
-
type: Function,
|
|
80
|
-
default: () => {}
|
|
81
|
-
},
|
|
82
78
|
onSuccess: {
|
|
83
79
|
type: Function,
|
|
84
80
|
default: () => {}
|
|
@@ -116,7 +112,7 @@ if (props.action) {
|
|
|
116
112
|
defaultAction.value = props.action
|
|
117
113
|
} else {
|
|
118
114
|
let tempAction = baseURL + '/common/fs-upload'
|
|
119
|
-
if (
|
|
115
|
+
if (isPlateSys(props.systemCode)) {
|
|
120
116
|
tempAction = baseAPI + '/component/super-form/uploads'
|
|
121
117
|
}
|
|
122
118
|
defaultAction.value = tempAction
|
|
@@ -126,7 +122,8 @@ if (!props.headers || !props.headers['Authorization']) {
|
|
|
126
122
|
props.headers.Authorization = getToken()
|
|
127
123
|
}
|
|
128
124
|
const handleBeforeUpload = (file: File) => {
|
|
129
|
-
|
|
125
|
+
const isMobile = false
|
|
126
|
+
return props.beforeUpload({fileObj: file, files:[file], isMobile, pageContext: props.pageContext, configureObj: props.configure})
|
|
130
127
|
}
|
|
131
128
|
const onSuccess = (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
|
132
129
|
// eslint-disable-next-line vue/no-mutating-props
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
19
19
|
<div class="el-upload__text">{{ placeholder }}</div>
|
|
20
20
|
<template #tip>
|
|
21
|
-
<el-text size="small"> {{ accept }}
|
|
21
|
+
<el-text size="small"> {{ accept }} {{$t('imatrixUIMessage.uploadFileTip',{fileSzie: limitFileSize})}}</el-text>
|
|
22
22
|
</template>
|
|
23
23
|
</el-upload>
|
|
24
24
|
<template v-if="fileList && fileList.length > 0">
|
|
25
|
-
<fs-preview-new :disabled="disabled" :file-list="fileList" :system-code="systemCode" />
|
|
25
|
+
<fs-preview-new :disabled="disabled" :file-list="fileList" :system-code="systemCode" :before-remove="beforeRemove" :on-remove="onRemove" :before-download="beforeDownload" />
|
|
26
26
|
</template>
|
|
27
27
|
</template>
|
|
28
28
|
|
|
@@ -78,10 +78,6 @@ const props = defineProps({
|
|
|
78
78
|
type: Array<{ showName: string; serverPath: string }>,
|
|
79
79
|
default: () => []
|
|
80
80
|
},
|
|
81
|
-
handleBeforeUpload: {
|
|
82
|
-
type: Function,
|
|
83
|
-
default: () => {}
|
|
84
|
-
},
|
|
85
81
|
onSuccess: {
|
|
86
82
|
type: Function,
|
|
87
83
|
default: () => {}
|
|
@@ -119,7 +115,7 @@ if (props.action) {
|
|
|
119
115
|
defaultAction.value = props.action
|
|
120
116
|
} else {
|
|
121
117
|
let tempAction = baseURL + '/common/fs-upload'
|
|
122
|
-
if (
|
|
118
|
+
if (isPlateSys(props.systemCode)) {
|
|
123
119
|
tempAction = baseAPI + '/component/super-form/uploads'
|
|
124
120
|
}
|
|
125
121
|
defaultAction.value = tempAction
|
|
@@ -129,7 +125,7 @@ if (!props.headers || !props.headers['Authorization']) {
|
|
|
129
125
|
props.headers.Authorization = getToken()
|
|
130
126
|
}
|
|
131
127
|
const handleBeforeUpload = (file: File) => {
|
|
132
|
-
return props.
|
|
128
|
+
return props.beforeUpload(file)
|
|
133
129
|
}
|
|
134
130
|
const onSuccess = (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
|
135
131
|
// eslint-disable-next-line vue/no-mutating-props
|