@kyfe/fms-vue2-components 0.0.8 → 0.0.11
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/dist/{date-picker-bottom.08bb5468.js → date-picker-bottom.deb0334b.js} +1 -1
- package/dist/{date-picker-dropdown.6bdf8884.js → date-picker-dropdown.8820ef37.js} +1 -1
- package/dist/{date-picker-right.0b16e9e5.js → date-picker-right.90fb4b93.js} +1 -1
- package/dist/{date-picker-top.bb84a0cf.js → date-picker-top.535bf0c5.js} +1 -1
- package/dist/{date-week-month.7ac3a67e.js → date-week-month.f258023a.js} +1 -1
- package/dist/fms-approval-header/index.js +100 -0
- package/dist/fms-approval-header/style.css +1 -0
- package/dist/fms-copy-box/index.js +1 -1
- package/dist/fms-ks-clamp-text/index.js +2 -2
- package/dist/fms-ks-components/index.js +2 -2
- package/dist/{fms-ks-components.53289d17.js → fms-ks-components.c4804aac.js} +121 -121
- package/dist/fms-ks-decrypt/index.js +2 -2
- package/dist/{fms-ks-decrypt.2f88e659.js → fms-ks-decrypt.e9bc1873.js} +1 -1
- package/dist/fms-ks-form-grid/index.js +1 -1
- package/dist/fms-ks-select/index.js +2 -2
- package/dist/fms-ks-select-box/index.js +2 -2
- package/dist/fms-ks-uploader/index.js +350 -0
- package/dist/fms-ks-uploader/style.css +1 -0
- package/dist/index.js +70 -33
- package/dist/{mixin.7a8d8392.js → mixin.ce520697.js} +1 -1
- package/dist/oa-datetime-picker-new/style.css +1 -1
- package/package.json +2 -2
- package/src/components/fms-approval-header/fms-approval-header.vue +258 -0
- package/src/components/fms-approval-header/index.js +7 -0
- package/src/components/fms-approval-header//345/256/241/346/240/270/345/244/264/351/203/250.md +0 -0
- package/src/components/fms-ks-uploader/fms-ks-uploader.vue +570 -0
- package/src/components/fms-ks-uploader/index.js +7 -0
- package/src/index.js +34 -2
- /package/dist/{filter.c93f4ddb.js → filter.8157a654.js} +0 -0
- /package/dist/{fms-ks-clamp-text.24eb5e8d.js → fms-ks-clamp-text.29353cc2.js} +0 -0
- /package/dist/{fms-ks-select-box.a00f0f08.js → fms-ks-select-box.b75cf9d8.js} +0 -0
- /package/dist/{fms-ks-select.59416fd8.js → fms-ks-select.002b6536.js} +0 -0
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="component"
|
|
4
|
+
class="uploader-wrapper"
|
|
5
|
+
v-bind="attrs"
|
|
6
|
+
>
|
|
7
|
+
<div v-for="(item, index) in fileList" :key="item.url" class="preview-item">
|
|
8
|
+
<img :class="{ pdf: getFileType(item) === 'pdf' }" :src="getImg(item)" alt="img" />
|
|
9
|
+
<div v-if="!disabled" class="close-icon" @click.prevent="onDeleteFile(item, index)"></div>
|
|
10
|
+
<div v-if="!isImage(item)" class="preview-text">
|
|
11
|
+
{{ item.name }}
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div v-if="!isHideUploadBtn" class="upload-button" @click="chooseSelectMode">
|
|
15
|
+
<van-icon name="plus" />
|
|
16
|
+
</div>
|
|
17
|
+
<van-action-sheet
|
|
18
|
+
v-model="isShowAction"
|
|
19
|
+
:actions="actions"
|
|
20
|
+
@select="onActionSelect"
|
|
21
|
+
/>
|
|
22
|
+
</component>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import { isIos } from '@kyfe/fms-utils/device'
|
|
27
|
+
import { isEqual, get, invoke, merge } from 'lodash'
|
|
28
|
+
|
|
29
|
+
/** 文件选择的方式 */
|
|
30
|
+
const ALLOW_METHODS = {
|
|
31
|
+
/** 从相册选择 */
|
|
32
|
+
ALBUM: 0,
|
|
33
|
+
/** 从文件选择 */
|
|
34
|
+
FILE: 1,
|
|
35
|
+
/** 拍照 */
|
|
36
|
+
CAMERA: 2,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const MODE = {
|
|
40
|
+
/** 使用腾讯云上传 */
|
|
41
|
+
TENCENT: 0,
|
|
42
|
+
/** 使用基础服务部的上传 */
|
|
43
|
+
KYE: 1,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
name: "FmsKsUploader",
|
|
48
|
+
props: {
|
|
49
|
+
sortable: Boolean,
|
|
50
|
+
disabled: Boolean,
|
|
51
|
+
isHideUploadBtn: Boolean,
|
|
52
|
+
component: {
|
|
53
|
+
type: [String, Object, Function],
|
|
54
|
+
default: 'div'
|
|
55
|
+
},
|
|
56
|
+
mode: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: MODE.KYE,
|
|
59
|
+
},
|
|
60
|
+
accept: {
|
|
61
|
+
type: Array,
|
|
62
|
+
default: () => [],
|
|
63
|
+
},
|
|
64
|
+
limit: {
|
|
65
|
+
type: Number,
|
|
66
|
+
default: 9,
|
|
67
|
+
},
|
|
68
|
+
value: {
|
|
69
|
+
type: Array,
|
|
70
|
+
default: () => [],
|
|
71
|
+
},
|
|
72
|
+
/** 最大上传MB */
|
|
73
|
+
maxSize: Number,
|
|
74
|
+
/** action面板显示之前的回调,返回true就不展示面板 */
|
|
75
|
+
beforeActionSheetShow: Function,
|
|
76
|
+
/** 配置actionSheet允许的方式, 0从相册选择, 1从文件选择, 2拍照 */
|
|
77
|
+
allowMethods: {
|
|
78
|
+
type: Array,
|
|
79
|
+
default: () => [ALLOW_METHODS.ALBUM, ALLOW_METHODS.FILE, ALLOW_METHODS.CAMERA],
|
|
80
|
+
},
|
|
81
|
+
/** 上传之前的函数,返回true则忽略本次上传 */
|
|
82
|
+
beforeUpload: Function,
|
|
83
|
+
/** 获取原生方法的参数 */
|
|
84
|
+
getNativeFnParams: Function,
|
|
85
|
+
/** 根据文件信息获取文件类型的方法 */
|
|
86
|
+
getFileTypeFn: Function,
|
|
87
|
+
/** 获取腾讯云upload配置的方法 */
|
|
88
|
+
getTencentUploadConfig: Function,
|
|
89
|
+
/** 基础服务部上传的bizCode */
|
|
90
|
+
bizCode: String,
|
|
91
|
+
/** 基础服务部上传的bizId */
|
|
92
|
+
bizId: String,
|
|
93
|
+
/** 如果需要根据id进行排序则需要传此属性 */
|
|
94
|
+
fileIdSortList: {
|
|
95
|
+
type: Array,
|
|
96
|
+
default: () => [],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
data() {
|
|
100
|
+
return {
|
|
101
|
+
fileList: [...this.value],
|
|
102
|
+
isShowAction: false,
|
|
103
|
+
insetBizId: '',
|
|
104
|
+
tokenConfig: {},
|
|
105
|
+
uploadId: String(Date.now()),
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
computed: {
|
|
109
|
+
attrs() {
|
|
110
|
+
return merge({
|
|
111
|
+
list: this.fileList,
|
|
112
|
+
handle: '.preview-item',
|
|
113
|
+
ghostClass: 'ghost',
|
|
114
|
+
disabled: !this.sortable || this.disabled,
|
|
115
|
+
options: {
|
|
116
|
+
delay: 100
|
|
117
|
+
}
|
|
118
|
+
}, this.$attrs)
|
|
119
|
+
},
|
|
120
|
+
actions() {
|
|
121
|
+
const allActions = [
|
|
122
|
+
{ name: '从相册选择', id: ALLOW_METHODS.ALBUM },
|
|
123
|
+
{ name: '从文件选择', id: ALLOW_METHODS.FILE },
|
|
124
|
+
{ name: '拍照', id: ALLOW_METHODS.CAMERA },
|
|
125
|
+
]
|
|
126
|
+
return this.allowMethods.map((idx) => allActions[idx])
|
|
127
|
+
},
|
|
128
|
+
actionFnMap() {
|
|
129
|
+
return [this.getFileFromAlbum, this.getFileFromFolder, this.getFileFromCamera]
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* 是否上传到基础服务部
|
|
133
|
+
*/
|
|
134
|
+
ifToKye() {
|
|
135
|
+
return this.mode === MODE.KYE
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
watch: {
|
|
139
|
+
value(v) {
|
|
140
|
+
const { fileList } = this
|
|
141
|
+
const isSame = isEqual(
|
|
142
|
+
v.map((it) => it.id),
|
|
143
|
+
fileList.map((it) => it.id)
|
|
144
|
+
)
|
|
145
|
+
if (isSame) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
this.fileList = v
|
|
149
|
+
},
|
|
150
|
+
fileList() {
|
|
151
|
+
this.$emit('input', this.fileList)
|
|
152
|
+
},
|
|
153
|
+
bizId() {
|
|
154
|
+
this.getFilesByBizId()
|
|
155
|
+
},
|
|
156
|
+
bizCode() {
|
|
157
|
+
this.getFilesByBizId()
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
mounted() {
|
|
161
|
+
if (this.ifToKye) {
|
|
162
|
+
this.getFilesByBizId()
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
methods: {
|
|
166
|
+
async getSortedFiledList(bizId, bizCode) {
|
|
167
|
+
const params = this.fileIdSortList.map((sourceFileId) => ({
|
|
168
|
+
sourceBizId: bizId,
|
|
169
|
+
sourceBizCode: bizCode,
|
|
170
|
+
sourceFileId,
|
|
171
|
+
targetBizId: this.insetBizId,
|
|
172
|
+
targetBizCode: bizCode,
|
|
173
|
+
}))
|
|
174
|
+
const fileList = await this.$http('file.file.copyBucketFile', '10214', params)
|
|
175
|
+
this.fileList = fileList
|
|
176
|
+
},
|
|
177
|
+
async getDefaultFieldList(bizId, bizCode) {
|
|
178
|
+
const fileList = await this.$http('file.file.copyBucket', '10214', [
|
|
179
|
+
{
|
|
180
|
+
sourceBizId: bizId,
|
|
181
|
+
sourceBizCode: bizCode,
|
|
182
|
+
targetBizId: this.insetBizId,
|
|
183
|
+
targetBizCode: bizCode,
|
|
184
|
+
},
|
|
185
|
+
])
|
|
186
|
+
this.fileList = fileList
|
|
187
|
+
},
|
|
188
|
+
async getFilesByBizId() {
|
|
189
|
+
const { bizId, bizCode } = this
|
|
190
|
+
if (!bizId || !bizCode) {
|
|
191
|
+
return
|
|
192
|
+
}
|
|
193
|
+
await this.getBizId()
|
|
194
|
+
if (this.fileIdSortList.length) {
|
|
195
|
+
this.getSortedFiledList(bizId, bizCode)
|
|
196
|
+
} else {
|
|
197
|
+
this.getDefaultFieldList(bizId, bizCode)
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
async getUploadToken() {
|
|
201
|
+
const isNeedReGet = get(this.tokenConfig, 'expiredTime', 0) * 1000 < Date.now()
|
|
202
|
+
if (!isNeedReGet) {
|
|
203
|
+
return this.tokenConfig
|
|
204
|
+
}
|
|
205
|
+
const res = await this.getTencentUploadConfig()
|
|
206
|
+
this.tokenConfig = res
|
|
207
|
+
return this.tokenConfig
|
|
208
|
+
},
|
|
209
|
+
async onDeleteFile(item, index) {
|
|
210
|
+
if (this.ifToKye) {
|
|
211
|
+
const loading = window.vant.Toast.loading({ forbidClick: true, duration: 0 })
|
|
212
|
+
try {
|
|
213
|
+
await this.$http('file.deleteByIds', '10147', { ids: [item.id] })
|
|
214
|
+
} catch (e) {
|
|
215
|
+
console.log(e)
|
|
216
|
+
} finally {
|
|
217
|
+
if (loading.type === 'loading') {
|
|
218
|
+
window.vant.Toast.clear()
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
this.fileList.splice(index, 1)
|
|
223
|
+
},
|
|
224
|
+
getFileType(fileInfo) {
|
|
225
|
+
if (typeof this.getFileTypeFn === 'function') {
|
|
226
|
+
return this.getFileTypeFn(fileInfo)
|
|
227
|
+
}
|
|
228
|
+
const extendName = fileInfo.extendName.toLowerCase()
|
|
229
|
+
if (extendName === 'pdf') {
|
|
230
|
+
return 'pdf'
|
|
231
|
+
}
|
|
232
|
+
if (['doc', 'docx', 'xls', 'xlsx'].includes(extendName)) {
|
|
233
|
+
return 'doc'
|
|
234
|
+
}
|
|
235
|
+
if (extendName === 'mp4') {
|
|
236
|
+
return 'video'
|
|
237
|
+
}
|
|
238
|
+
return 'img'
|
|
239
|
+
},
|
|
240
|
+
isImage(fileInfo) {
|
|
241
|
+
const fileType = this.getFileType(fileInfo)
|
|
242
|
+
return fileType === 'img'
|
|
243
|
+
},
|
|
244
|
+
getImg(fileInfo) {
|
|
245
|
+
const imgMap = {
|
|
246
|
+
pdf: 'https://erphostjs.kye-erp.com/fms/fms-deposit-new/introduce/PDF.svg',
|
|
247
|
+
doc: 'https://erphostjs.kye-erp.com/fms/fms-deposit-new/introduce/word-icon.png',
|
|
248
|
+
img: fileInfo.url,
|
|
249
|
+
video:
|
|
250
|
+
'https://erphostjs.kye-erp.com/fms/fms-deposit-new/introduce/video-icon.webp',
|
|
251
|
+
}
|
|
252
|
+
const fileType = this.getFileType(fileInfo)
|
|
253
|
+
return imgMap[fileType] || imgMap.pdf
|
|
254
|
+
},
|
|
255
|
+
async getFileFromAlbum() {
|
|
256
|
+
const loading = window.vant.Toast.loading({ forbidClick: true, duration: 0 })
|
|
257
|
+
try {
|
|
258
|
+
const params = {
|
|
259
|
+
totalCount: this.limit,
|
|
260
|
+
usedOriginal: true,
|
|
261
|
+
}
|
|
262
|
+
if (isIos) {
|
|
263
|
+
// 640 960 1280 1920 3840
|
|
264
|
+
params.presetName = '1280'
|
|
265
|
+
} else {
|
|
266
|
+
/**
|
|
267
|
+
* 视频分辨率的压缩比例
|
|
268
|
+
* 0:默认跟原视频一致
|
|
269
|
+
* 1:原视频分辨率的一半
|
|
270
|
+
* 2:原视频分辨率的0.35
|
|
271
|
+
*/
|
|
272
|
+
params.ratioOfCompressionOfVideoResolution = '0'
|
|
273
|
+
}
|
|
274
|
+
const fileList = await window.ks.callFunc({
|
|
275
|
+
method: 'pickAssets',
|
|
276
|
+
params: invoke(this, 'getNativeFnParams', 'pickAssets', params) || params,
|
|
277
|
+
})
|
|
278
|
+
this.uploadFile(fileList)
|
|
279
|
+
} finally {
|
|
280
|
+
if (loading.type === 'loading') {
|
|
281
|
+
window.vant.Toast.clear()
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
async getFileFromFolder() {
|
|
286
|
+
const loading = window.vant.Toast.loading({ forbidClick: true, duration: 0 })
|
|
287
|
+
try {
|
|
288
|
+
const fileInfo = await window.ks.callFunc({
|
|
289
|
+
method: 'pickerSystemFile',
|
|
290
|
+
params: invoke(this, 'getNativeFnParams', 'pickerSystemFile', {}) || {},
|
|
291
|
+
})
|
|
292
|
+
this.uploadFile([fileInfo])
|
|
293
|
+
} finally {
|
|
294
|
+
if (loading.type === 'loading') {
|
|
295
|
+
window.vant.Toast.clear()
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
async getFileFromCamera() {
|
|
300
|
+
const defaultParams = {
|
|
301
|
+
take_photo_or_record_or_both: 2,
|
|
302
|
+
}
|
|
303
|
+
const fileInfo = await window.ks.callFunc({
|
|
304
|
+
method: 'takeByCamera',
|
|
305
|
+
params:
|
|
306
|
+
invoke(this, 'getNativeFnParams', 'takeByCamera', defaultParams) ||
|
|
307
|
+
defaultParams,
|
|
308
|
+
})
|
|
309
|
+
this.uploadFile(fileInfo)
|
|
310
|
+
},
|
|
311
|
+
validateLimit(fileList) {
|
|
312
|
+
const isBiggerThanLimit = fileList.length + this.fileList.length > this.limit
|
|
313
|
+
if (isBiggerThanLimit) {
|
|
314
|
+
window.vant.Toast(`最多只能上传${this.limit}个文件`)
|
|
315
|
+
}
|
|
316
|
+
return isBiggerThanLimit
|
|
317
|
+
},
|
|
318
|
+
validateFileType(fileList) {
|
|
319
|
+
// 选择的文件是否满足类型
|
|
320
|
+
const { accept } = this
|
|
321
|
+
if (!accept.length) {
|
|
322
|
+
return false
|
|
323
|
+
}
|
|
324
|
+
const typeNotMatch = fileList.some((it) => {
|
|
325
|
+
return !accept.some(
|
|
326
|
+
(extendName) => extendName.toLowerCase() === it.extendName.toLowerCase()
|
|
327
|
+
)
|
|
328
|
+
})
|
|
329
|
+
if (typeNotMatch) {
|
|
330
|
+
window.vant.Toast(`只能上传${accept.join('、')}格式的文件`)
|
|
331
|
+
}
|
|
332
|
+
return typeNotMatch
|
|
333
|
+
},
|
|
334
|
+
validateMaxSize(fileList) {
|
|
335
|
+
const { maxSize } = this
|
|
336
|
+
if (!maxSize) {
|
|
337
|
+
return false
|
|
338
|
+
}
|
|
339
|
+
const isTooBig = fileList.some((it) => +it.fileSize > maxSize * 1024 * 1024)
|
|
340
|
+
if (isTooBig) {
|
|
341
|
+
window.vant.Toast(`最大只能上传${maxSize}M`)
|
|
342
|
+
}
|
|
343
|
+
return isTooBig
|
|
344
|
+
},
|
|
345
|
+
async beforeUploadFn(fileList) {
|
|
346
|
+
const validateFns = [
|
|
347
|
+
this.validateLimit,
|
|
348
|
+
this.validateFileType,
|
|
349
|
+
this.validateMaxSize,
|
|
350
|
+
this.beforeUpload,
|
|
351
|
+
]
|
|
352
|
+
for (let fn of validateFns) {
|
|
353
|
+
if (typeof fn !== 'function') {
|
|
354
|
+
continue
|
|
355
|
+
}
|
|
356
|
+
const isBreak = await fn(fileList)
|
|
357
|
+
if (isBreak) {
|
|
358
|
+
return true
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return false
|
|
362
|
+
},
|
|
363
|
+
async uploadToTencent(fileList) {
|
|
364
|
+
const tokenConfig = await this.getUploadToken()
|
|
365
|
+
if (!tokenConfig.uploadId) {
|
|
366
|
+
tokenConfig.uploadId = this.uploadId
|
|
367
|
+
}
|
|
368
|
+
const promises = fileList.map(async (it) => {
|
|
369
|
+
const cosPath = `resource/upload/deposit/${process.env.NODE_ENV}/${Date.now()}/${
|
|
370
|
+
it.fileName
|
|
371
|
+
}`
|
|
372
|
+
const defaultParams = {
|
|
373
|
+
srcPath: it.filePath,
|
|
374
|
+
cosPath,
|
|
375
|
+
...tokenConfig,
|
|
376
|
+
}
|
|
377
|
+
const params =
|
|
378
|
+
invoke(this, 'getNativeFnParams', 'uploadTencentCos', defaultParams, it) ||
|
|
379
|
+
defaultParams
|
|
380
|
+
return ks.callFunc({ method: 'uploadTencentCos', params }).then((url) => {
|
|
381
|
+
return {
|
|
382
|
+
url,
|
|
383
|
+
extendName: it.extendName,
|
|
384
|
+
size: it.fileSize,
|
|
385
|
+
name: it.fileName,
|
|
386
|
+
cosPath,
|
|
387
|
+
}
|
|
388
|
+
})
|
|
389
|
+
})
|
|
390
|
+
window.vant.Toast.loading({ forbidClick: true, duration: 0 })
|
|
391
|
+
const res = await Promise.allSettled(promises)
|
|
392
|
+
window.vant.Toast.clear()
|
|
393
|
+
const fileResult = res
|
|
394
|
+
.filter((item) => item.status === 'fulfilled')
|
|
395
|
+
.map((item) => item.value)
|
|
396
|
+
this.fileList = [...this.fileList, ...fileResult]
|
|
397
|
+
},
|
|
398
|
+
async getBizId() {
|
|
399
|
+
if (this.insetBizId) {
|
|
400
|
+
return
|
|
401
|
+
}
|
|
402
|
+
this.insetBizId = await this.$http('system.idcenter.get', '10147', {
|
|
403
|
+
random: Math.random(),
|
|
404
|
+
})
|
|
405
|
+
},
|
|
406
|
+
async uploadToKye(fileList) {
|
|
407
|
+
await this.getBizId()
|
|
408
|
+
// 记录上传前的id,用于保证排序稳定不变
|
|
409
|
+
const fileIdsMap = this.fileList
|
|
410
|
+
.map((it) => it.id)
|
|
411
|
+
.reduce((memo, cur, index) => {
|
|
412
|
+
memo[cur] = index + 1
|
|
413
|
+
return memo
|
|
414
|
+
}, {})
|
|
415
|
+
const fileInfos = await window.ks.callFunc({
|
|
416
|
+
method: 'uploadAssets',
|
|
417
|
+
params: {
|
|
418
|
+
filePaths: fileList.map((it) => it.filePath),
|
|
419
|
+
fileNames: fileList.map((it) => it.fileName),
|
|
420
|
+
bizCode: this.bizCode,
|
|
421
|
+
bizId: this.insetBizId,
|
|
422
|
+
},
|
|
423
|
+
})
|
|
424
|
+
this.fileList = fileInfos.sort((a, b) => {
|
|
425
|
+
const idxA = fileIdsMap[a.id] || Number.MAX_SAFE_INTEGER
|
|
426
|
+
const idxB = fileIdsMap[b.id] || Number.MAX_SAFE_INTEGER
|
|
427
|
+
return idxA - idxB
|
|
428
|
+
})
|
|
429
|
+
},
|
|
430
|
+
async uploadFile(fileList) {
|
|
431
|
+
const addFileExtend = (fileInfo) => {
|
|
432
|
+
const { filePath } = fileInfo
|
|
433
|
+
const extNameSignIndex = filePath.lastIndexOf('.')
|
|
434
|
+
let extendName = extNameSignIndex > -1 ? filePath.slice(extNameSignIndex) : ''
|
|
435
|
+
extendName = extendName.toLowerCase()
|
|
436
|
+
fileInfo.extendName = extendName.slice(1)
|
|
437
|
+
if (!fileInfo.fileName.endsWith(extendName)) {
|
|
438
|
+
fileInfo.fileName += extendName
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
fileList.forEach(addFileExtend)
|
|
442
|
+
const isBreak = await this.beforeUploadFn(fileList)
|
|
443
|
+
if (isBreak) {
|
|
444
|
+
return
|
|
445
|
+
}
|
|
446
|
+
const uploadFn = {
|
|
447
|
+
[MODE.KYE]: this.uploadToKye,
|
|
448
|
+
[MODE.TENCENT]: this.uploadToTencent,
|
|
449
|
+
}
|
|
450
|
+
invoke(uploadFn, this.mode, fileList)
|
|
451
|
+
},
|
|
452
|
+
|
|
453
|
+
onActionSelect(item) {
|
|
454
|
+
invoke(this.actionFnMap, item.id)
|
|
455
|
+
this.isShowAction = false
|
|
456
|
+
},
|
|
457
|
+
async chooseSelectMode() {
|
|
458
|
+
if (this.disabled) {
|
|
459
|
+
return
|
|
460
|
+
}
|
|
461
|
+
const { beforeActionSheetShow } = this
|
|
462
|
+
if (beforeActionSheetShow) {
|
|
463
|
+
const isBreak = await beforeActionSheetShow()
|
|
464
|
+
if (isBreak) {
|
|
465
|
+
return
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if (this.actions.length !== 1) {
|
|
469
|
+
this.isShowAction = true
|
|
470
|
+
return
|
|
471
|
+
}
|
|
472
|
+
invoke(this.actionFnMap, this.actions[0].id)
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
}
|
|
476
|
+
</script>
|
|
477
|
+
|
|
478
|
+
<style scoped lang="less">
|
|
479
|
+
.uploader-wrapper {
|
|
480
|
+
display: grid;
|
|
481
|
+
grid-template-columns: repeat(auto-fill, 52px);
|
|
482
|
+
grid-auto-rows: 52px;
|
|
483
|
+
flex: 1;
|
|
484
|
+
border-radius: 4px;
|
|
485
|
+
gap: 12px;
|
|
486
|
+
}
|
|
487
|
+
.upload-button {
|
|
488
|
+
width: 52px;
|
|
489
|
+
height: 52px;
|
|
490
|
+
border-radius: 4px;
|
|
491
|
+
border: 1px dashed #e3e3e8;
|
|
492
|
+
display: grid;
|
|
493
|
+
place-items: center;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.preview-item {
|
|
497
|
+
border-radius: 4px;
|
|
498
|
+
position: relative;
|
|
499
|
+
background: #f7f8fa;
|
|
500
|
+
img {
|
|
501
|
+
display: block;
|
|
502
|
+
width: 100%;
|
|
503
|
+
height: 100%;
|
|
504
|
+
object-fit: cover;
|
|
505
|
+
border-radius: 4px;
|
|
506
|
+
}
|
|
507
|
+
img.pdf {
|
|
508
|
+
width: 26px;
|
|
509
|
+
height: 26px;
|
|
510
|
+
margin: auto;
|
|
511
|
+
margin-top: 12px;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
/deep/ .van-uploader {
|
|
515
|
+
padding: 0;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.close-icon {
|
|
519
|
+
position: absolute;
|
|
520
|
+
right: 0;
|
|
521
|
+
top: -1px;
|
|
522
|
+
transform: translateX(50%);
|
|
523
|
+
border: 1px solid #fff;
|
|
524
|
+
background: #b0b3bf;
|
|
525
|
+
width: 14px;
|
|
526
|
+
height: 14px;
|
|
527
|
+
border-radius: 50%;
|
|
528
|
+
|
|
529
|
+
&::before,
|
|
530
|
+
&::after {
|
|
531
|
+
content: '';
|
|
532
|
+
display: block;
|
|
533
|
+
width: 60%;
|
|
534
|
+
margin: auto;
|
|
535
|
+
height: 2px;
|
|
536
|
+
border-radius: 999px;
|
|
537
|
+
background: #fff;
|
|
538
|
+
position: absolute;
|
|
539
|
+
top: 50%;
|
|
540
|
+
left: 50%;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
&::before {
|
|
544
|
+
transform: translate(-50%, -50%) rotate(45deg);
|
|
545
|
+
transform-origin: center center;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
&::after {
|
|
549
|
+
transform: translate(-50%, -50%) rotate(-45deg);
|
|
550
|
+
transform-origin: center center;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.preview-text {
|
|
555
|
+
line-height: 12px;
|
|
556
|
+
background: rgba(0, 0, 0, 0.5);
|
|
557
|
+
border-radius: 0 0 4px 4px;
|
|
558
|
+
font-size: 8px;
|
|
559
|
+
color: #fff;
|
|
560
|
+
position: absolute;
|
|
561
|
+
bottom: 0;
|
|
562
|
+
left: 0;
|
|
563
|
+
right: 0;
|
|
564
|
+
padding: 0 4px;
|
|
565
|
+
text-align: center;
|
|
566
|
+
white-space: nowrap;
|
|
567
|
+
text-overflow: ellipsis;
|
|
568
|
+
overflow: hidden;
|
|
569
|
+
}
|
|
570
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import FmsCopyBox from './components/fms-copy-box/index'
|
|
3
|
+
import FmsKsClampText from './components/fms-ks-clamp-text/index'
|
|
4
|
+
import FmsKsMoreLines from './components/fms-ks-more-lines/index'
|
|
5
|
+
import FmsKsPagePopup from './components/fms-ks-page-popup/index'
|
|
6
|
+
import FmsKsSelect from './components/fms-ks-select/index'
|
|
7
|
+
import FmsKsSelectBox from './components/fms-ks-select-box/index'
|
|
8
|
+
import FmsKsBlockTitle from './components/fms-ks-block-title/index'
|
|
9
|
+
import FmsKsWarnDrawer from './components/fms-ks-warn-drawer/index'
|
|
3
10
|
import FmsEmpty from './components/fms-empty/index'
|
|
4
11
|
import FmsKsDecrypt from './components/fms-ks-decrypt/index'
|
|
5
12
|
import FmsKsFileUpload from './components/fms-ks-file-upload/index'
|
|
@@ -7,10 +14,21 @@ import FmsKsFileView from './components/fms-ks-file-view/index'
|
|
|
7
14
|
import FmsScrollList from './components/fms-scroll-list/index'
|
|
8
15
|
import FmsKsFormGrid from './components/fms-ks-form-grid'
|
|
9
16
|
import FmsKsSearchTips from './components/fms-ks-search-tips'
|
|
17
|
+
import FmsKsSearchTipsNew from './components/fms-ks-search-tips-new'
|
|
10
18
|
import FmsKsUpload from './components/fms-ks-upload/index'
|
|
19
|
+
import FmsKsPicker from './components/fms-ks-picker/index'
|
|
20
|
+
import FmsKsUploader from './components/fms-ks-uploader/index'
|
|
21
|
+
import FmsApprovalHeader from './components/fms-approval-header/index'
|
|
11
22
|
|
|
12
23
|
const components = [
|
|
13
24
|
FmsCopyBox,
|
|
25
|
+
FmsKsClampText,
|
|
26
|
+
FmsKsMoreLines,
|
|
27
|
+
FmsKsPagePopup,
|
|
28
|
+
FmsKsSelect,
|
|
29
|
+
FmsKsSelectBox,
|
|
30
|
+
FmsKsBlockTitle,
|
|
31
|
+
FmsKsWarnDrawer,
|
|
14
32
|
FmsEmpty,
|
|
15
33
|
FmsKsDecrypt,
|
|
16
34
|
FmsKsFileUpload,
|
|
@@ -18,7 +36,10 @@ const components = [
|
|
|
18
36
|
FmsScrollList,
|
|
19
37
|
FmsKsFormGrid,
|
|
20
38
|
FmsKsSearchTips,
|
|
21
|
-
FmsKsUpload
|
|
39
|
+
FmsKsUpload,
|
|
40
|
+
FmsKsSearchTipsNew,
|
|
41
|
+
FmsKsPicker,
|
|
42
|
+
FmsApprovalHeader,
|
|
22
43
|
]
|
|
23
44
|
|
|
24
45
|
const install = function(Vue) {
|
|
@@ -30,6 +51,13 @@ const install = function(Vue) {
|
|
|
30
51
|
// 按需导出
|
|
31
52
|
export {
|
|
32
53
|
FmsCopyBox,
|
|
54
|
+
FmsKsClampText,
|
|
55
|
+
FmsKsMoreLines,
|
|
56
|
+
FmsKsPagePopup,
|
|
57
|
+
FmsKsSelect,
|
|
58
|
+
FmsKsSelectBox,
|
|
59
|
+
FmsKsBlockTitle,
|
|
60
|
+
FmsKsWarnDrawer,
|
|
33
61
|
FmsEmpty,
|
|
34
62
|
FmsKsDecrypt,
|
|
35
63
|
FmsKsFileUpload,
|
|
@@ -37,7 +65,11 @@ export {
|
|
|
37
65
|
FmsScrollList,
|
|
38
66
|
FmsKsFormGrid,
|
|
39
67
|
FmsKsSearchTips,
|
|
40
|
-
FmsKsUpload
|
|
68
|
+
FmsKsUpload,
|
|
69
|
+
FmsKsSearchTipsNew,
|
|
70
|
+
FmsKsPicker,
|
|
71
|
+
FmsKsUploader,
|
|
72
|
+
FmsApprovalHeader,
|
|
41
73
|
}
|
|
42
74
|
// 全量导出
|
|
43
75
|
export default {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|