eoss-ui 0.7.51 → 0.7.53
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/button-group.js +290 -279
- package/lib/button.js +290 -280
- package/lib/calendar.js +2 -2
- package/lib/calogin.js +523 -512
- package/lib/card.js +2 -2
- package/lib/cascader.js +2 -2
- package/lib/checkbox-group.js +294 -283
- package/lib/clients.js +2 -2
- package/lib/config/api.js +3 -1
- package/lib/data-table-form.js +293 -282
- package/lib/data-table.js +292 -281
- package/lib/date-picker.js +290 -280
- package/lib/dialog.js +293 -282
- package/lib/enable-drag.js +2 -2
- package/lib/enterprise.js +2 -2
- package/lib/eoss-ui.common.js +5515 -5675
- package/lib/error-page.js +2 -2
- package/lib/flow-group.js +354 -362
- package/lib/flow-list.js +435 -412
- package/lib/flow.js +608 -599
- package/lib/form.js +295 -284
- package/lib/handle-user.js +384 -392
- package/lib/handler.js +290 -280
- package/lib/icon.js +291 -281
- package/lib/icons.js +5 -5
- package/lib/index.js +1 -1
- package/lib/input-number.js +290 -280
- package/lib/input.js +294 -284
- package/lib/label.js +2 -2
- package/lib/layout.js +4 -4
- package/lib/login.js +303 -292
- package/lib/main.js +466 -455
- package/lib/menu.js +4 -4
- package/lib/nav.js +292 -282
- package/lib/notify.js +74 -71
- package/lib/page.js +290 -280
- package/lib/pagination.js +290 -280
- package/lib/player.js +373 -385
- package/lib/qr-code.js +305 -295
- package/lib/radio-group.js +301 -291
- package/lib/retrial-auth.js +294 -284
- package/lib/select-ganged.js +292 -282
- package/lib/select.js +299 -289
- package/lib/selector-panel.js +295 -284
- package/lib/selector.js +292 -282
- package/lib/sizer.js +290 -280
- package/lib/steps.js +292 -282
- package/lib/switch.js +290 -280
- package/lib/table-form.js +297 -287
- package/lib/tabs-panel.js +2 -2
- package/lib/tabs.js +290 -280
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/data-table.css +1 -1
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/icon.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/main.css +1 -1
- package/lib/theme-chalk/menu.css +1 -1
- package/lib/theme-chalk/simplicity.css +1 -1
- package/lib/theme-chalk/sizer.css +1 -1
- package/lib/theme-chalk/upload.css +1 -1
- package/lib/tips.js +292 -282
- package/lib/toolbar.js +2 -2
- package/lib/tree-group.js +290 -280
- package/lib/tree.js +292 -282
- package/lib/upload.js +304 -293
- package/lib/utils/util.js +8 -12
- package/lib/wujie.js +290 -280
- package/lib/wxlogin.js +290 -280
- package/package.json +160 -160
- package/packages/button/index.js +5 -5
- package/packages/button/src/main.vue +418 -418
- package/packages/button-group/index.js +5 -5
- package/packages/button-group/src/main.vue +346 -346
- package/packages/calendar/index.js +5 -5
- package/packages/calogin/index.js +5 -5
- package/packages/calogin/src/main.vue +412 -412
- package/packages/calogin/src/plugin.js +915 -915
- package/packages/card/index.js +5 -5
- package/packages/card/src/main.vue +156 -156
- package/packages/cascader/index.js +5 -5
- package/packages/cascader/src/main.vue +168 -168
- package/packages/checkbox-group/index.js +5 -5
- package/packages/checkbox-group/src/main.vue +333 -333
- package/packages/clients/index.js +5 -5
- package/packages/clients/src/main.vue +151 -151
- package/packages/data-table/index.js +5 -5
- package/packages/data-table/src/children.vue +39 -39
- package/packages/data-table/src/column.vue +992 -992
- package/packages/data-table/src/main.vue +1840 -1840
- package/packages/data-table/src/sizer.vue +195 -195
- package/packages/data-table-form/index.js +5 -5
- package/packages/data-table-form/src/checkbox.vue +101 -101
- package/packages/data-table-form/src/colgroup.vue +17 -17
- package/packages/data-table-form/src/main.vue +181 -181
- package/packages/data-table-form/src/radio.vue +65 -65
- package/packages/data-table-form/src/table.vue +233 -233
- package/packages/data-table-form/src/tbody.vue +336 -336
- package/packages/data-table-form/src/thead.vue +68 -68
- package/packages/date-picker/index.js +5 -5
- package/packages/date-picker/src/main.vue +236 -236
- package/packages/dialog/index.js +5 -5
- package/packages/enable-drag/index.js +5 -5
- package/packages/enterprise/index.js +5 -5
- package/packages/enterprise/src/main.vue +66 -66
- package/packages/error-page/index.js +5 -5
- package/packages/error-page/src/main.vue +44 -44
- package/packages/flow/index.js +5 -5
- package/packages/flow/src/component/Circulate.vue +413 -413
- package/packages/flow/src/component/CommonOpinions.vue +373 -373
- package/packages/flow/src/component/CustomPreset.vue +322 -322
- package/packages/flow/src/component/FileList.vue +97 -97
- package/packages/flow/src/component/FreeCirculation.vue +240 -240
- package/packages/flow/src/component/Preset.vue +255 -255
- package/packages/flow/src/component/SendMsg.vue +242 -242
- package/packages/flow/src/component/TimeLimit.vue +190 -190
- package/packages/flow/src/component/taskUnionExamine.vue +756 -756
- package/packages/flow/src/form.vue +121 -121
- package/packages/flow/src/freeStartFlow.vue +2846 -2846
- package/packages/flow/src/main.vue +3878 -3879
- package/packages/flow/src/processForm.vue +1365 -1365
- package/packages/flow/src/processReject.vue +309 -309
- package/packages/flow/src/reset.vue +942 -942
- package/packages/flow/src/startTaskRead.vue +692 -692
- package/packages/flow/src/supervise.vue +159 -159
- package/packages/flow/src/table.vue +58 -58
- package/packages/flow-group/index.js +5 -5
- package/packages/flow-group/src/main.vue +717 -717
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +1801 -1787
- package/packages/form/index.js +5 -5
- package/packages/form/src/main.vue +3901 -3901
- package/packages/form/src/table.vue +1512 -1512
- package/packages/handle-user/index.js +5 -5
- package/packages/handle-user/src/main.vue +137 -137
- package/packages/handler/index.js +5 -5
- package/packages/handler/src/main.vue +496 -496
- package/packages/icon/index.js +5 -5
- package/packages/icon/src/main.vue +104 -104
- package/packages/icons/index.js +5 -5
- package/packages/icons/src/icon.json +1 -1
- package/packages/icons/src/main.vue +81 -81
- package/packages/input/index.js +5 -5
- package/packages/input/src/main.vue +356 -356
- package/packages/input-number/index.js +5 -5
- package/packages/input-number/src/main.vue +106 -106
- package/packages/label/index.js +5 -5
- package/packages/label/src/main.vue +457 -457
- package/packages/layout/index.js +5 -5
- package/packages/layout/src/item.vue +152 -152
- package/packages/layout/src/main.vue +31 -31
- package/packages/login/index.js +5 -5
- package/packages/login/src/main.vue +2082 -2082
- package/packages/login/src/resetPassword.vue +557 -557
- package/packages/main/index.js +5 -5
- package/packages/main/src/default/message.vue +249 -249
- package/packages/main/src/default/notice.vue +157 -157
- package/packages/main/src/default/userinfo.vue +503 -503
- package/packages/main/src/public/online.vue +89 -89
- package/packages/main/src/public/search.vue +464 -464
- package/packages/main/src/public/settings.vue +227 -227
- package/packages/main/src/simplicity/apps.vue +388 -388
- package/packages/main/src/simplicity/avatar.vue +82 -82
- package/packages/main/src/simplicity/handler.vue +160 -160
- package/packages/main/src/simplicity/index.vue +2277 -2277
- package/packages/main/src/simplicity/lists.vue +84 -84
- package/packages/main/src/simplicity/menu-list.vue +135 -135
- package/packages/main/src/simplicity/message.vue +293 -293
- package/packages/main/src/simplicity/notice.vue +222 -222
- package/packages/main/src/simplicity/router-page.vue +45 -45
- package/packages/main/src/simplicity/sub-menu.vue +274 -274
- package/packages/main/src/simplicity/user.vue +259 -259
- package/packages/main/src/simplicity/userinfo.vue +401 -401
- package/packages/menu/index.js +5 -5
- package/packages/menu/src/main.vue +595 -595
- package/packages/nav/index.js +5 -5
- package/packages/nav/src/main.vue +351 -351
- package/packages/notify/index.js +5 -5
- package/packages/notify/src/main.vue +538 -538
- package/packages/page/index.js +5 -5
- package/packages/page/src/main.vue +167 -167
- package/packages/pagination/index.js +5 -5
- package/packages/pagination/src/main.vue +96 -96
- package/packages/player/index.js +5 -5
- package/packages/player/src/main.vue +194 -194
- package/packages/qr-code/index.js +5 -5
- package/packages/qr-code/src/main.vue +170 -170
- package/packages/radio-group/index.js +6 -6
- package/packages/radio-group/src/main.vue +319 -319
- package/packages/retrial-auth/index.js +5 -5
- package/packages/retrial-auth/src/main.vue +280 -280
- package/packages/select/index.js +5 -5
- package/packages/select/src/main.vue +782 -782
- package/packages/select-ganged/index.js +5 -5
- package/packages/select-ganged/src/main.vue +724 -724
- package/packages/selector/index.js +5 -5
- package/packages/selector/src/main.vue +761 -761
- package/packages/selector-panel/index.js +5 -5
- package/packages/selector-panel/src/main.vue +1027 -1027
- package/packages/selector-panel/src/selection.vue +170 -170
- package/packages/selector-panel/src/tree.vue +129 -129
- package/packages/sizer/index.js +5 -5
- package/packages/sizer/src/main.vue +254 -254
- package/packages/steps/index.js +5 -5
- package/packages/steps/src/main.vue +181 -181
- package/packages/switch/index.js +5 -5
- package/packages/switch/src/main.vue +170 -170
- package/packages/table-form/index.js +5 -5
- package/packages/tabs/index.js +5 -5
- package/packages/tabs/src/main.vue +788 -788
- package/packages/tabs-panel/index.js +5 -5
- package/packages/tabs-panel/src/main.vue +29 -29
- package/packages/theme-chalk/lib/base.css +1 -1
- package/packages/theme-chalk/lib/data-table.css +1 -1
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/icon.css +1 -1
- package/packages/theme-chalk/lib/index.css +1 -1
- package/packages/theme-chalk/lib/main.css +1 -1
- package/packages/theme-chalk/lib/menu.css +1 -1
- package/packages/theme-chalk/lib/simplicity.css +1 -1
- package/packages/theme-chalk/lib/sizer.css +1 -1
- package/packages/theme-chalk/lib/upload.css +1 -1
- package/packages/theme-chalk/src/base.scss +261 -261
- package/packages/theme-chalk/src/button-group.scss +176 -176
- package/packages/theme-chalk/src/button.scss +24 -24
- package/packages/theme-chalk/src/calendar.scss +113 -113
- package/packages/theme-chalk/src/card.scss +99 -99
- package/packages/theme-chalk/src/checkbox-group.scss +8 -8
- package/packages/theme-chalk/src/clients.scss +87 -87
- package/packages/theme-chalk/src/data-table-form.scss +67 -67
- package/packages/theme-chalk/src/data-table.scss +297 -293
- package/packages/theme-chalk/src/date-picker.scss +7 -7
- package/packages/theme-chalk/src/dialog.scss +77 -77
- package/packages/theme-chalk/src/enable-drag.scss +181 -181
- package/packages/theme-chalk/src/enterprise.scss +5 -5
- package/packages/theme-chalk/src/error-page.scss +18 -18
- package/packages/theme-chalk/src/flow-group.scss +110 -110
- package/packages/theme-chalk/src/flow-list.scss +39 -39
- package/packages/theme-chalk/src/flow.scss +351 -351
- package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/src/form.scss +501 -501
- package/packages/theme-chalk/src/handle-user.scss +40 -40
- package/packages/theme-chalk/src/handler.scss +148 -148
- package/packages/theme-chalk/src/icon.scss +1540 -1456
- package/packages/theme-chalk/src/icons.scss +99 -99
- package/packages/theme-chalk/src/input.scss +9 -9
- package/packages/theme-chalk/src/label.scss +24 -24
- package/packages/theme-chalk/src/layout.scss +46 -46
- package/packages/theme-chalk/src/login.scss +1006 -1006
- package/packages/theme-chalk/src/main.scss +663 -663
- package/packages/theme-chalk/src/menu.scss +224 -224
- package/packages/theme-chalk/src/mixins/color.scss +117 -117
- package/packages/theme-chalk/src/nav.scss +111 -111
- package/packages/theme-chalk/src/page.scss +3 -3
- package/packages/theme-chalk/src/pagination.scss +29 -29
- package/packages/theme-chalk/src/player.scss +9 -9
- package/packages/theme-chalk/src/qr-code.scss +17 -17
- package/packages/theme-chalk/src/radio-group.scss +9 -9
- package/packages/theme-chalk/src/retrial-auth.scss +38 -38
- package/packages/theme-chalk/src/select-ganged.scss +8 -8
- package/packages/theme-chalk/src/select.scss +8 -8
- package/packages/theme-chalk/src/selector-panel.scss +204 -204
- package/packages/theme-chalk/src/selector.scss +114 -114
- package/packages/theme-chalk/src/simplicity.scss +1395 -1395
- package/packages/theme-chalk/src/sizer.scss +36 -36
- package/packages/theme-chalk/src/steps.scss +88 -88
- package/packages/theme-chalk/src/switch.scss +3 -3
- package/packages/theme-chalk/src/table-form.scss +1 -1
- package/packages/theme-chalk/src/tabs.scss +87 -87
- package/packages/theme-chalk/src/tips.scss +7 -7
- package/packages/theme-chalk/src/toolbar.scss +179 -179
- package/packages/theme-chalk/src/tree-group.scss +72 -72
- package/packages/theme-chalk/src/tree.scss +165 -165
- package/packages/theme-chalk/src/upload.scss +172 -172
- package/packages/theme-chalk/src/wxlogin.scss +3 -3
- package/packages/tips/index.js +5 -5
- package/packages/tips/src/main.vue +141 -141
- package/packages/toolbar/index.js +5 -5
- package/packages/toolbar/src/main.vue +430 -430
- package/packages/tree/index.js +5 -5
- package/packages/tree-group/index.js +5 -5
- package/packages/upload/index.js +5 -5
- package/packages/upload/src/main.vue +1344 -1344
- package/packages/upload/src/picture.js +15 -15
- package/packages/wujie/index.js +5 -5
- package/packages/wujie/src/main.vue +145 -145
- package/packages/wxlogin/index.js +5 -5
- package/packages/wxlogin/src/main.vue +128 -128
- package/src/config/api.js +317 -315
- package/src/config/image.js +2 -2
- package/src/index.js +163 -163
- package/src/utils/bus.js +3 -3
- package/src/utils/date-util.js +312 -312
- package/src/utils/http.js +50 -50
- package/src/utils/rules.js +18 -18
- package/src/utils/store.js +21 -21
- package/src/utils/util.js +7 -10
- package/src/utils/webSocket.js +107 -107
- package/packages/.DS_Store +0 -0
- package/packages/calogin/.DS_Store +0 -0
- package/packages/date-picker/.DS_Store +0 -0
- package/packages/date-picker/src/.DS_Store +0 -0
- package/packages/dialog/.DS_Store +0 -0
- package/packages/flow/.DS_Store +0 -0
- package/packages/flow/src/.DS_Store +0 -0
- package/packages/flow-list/.DS_Store +0 -0
- package/packages/form/.DS_Store +0 -0
- package/packages/icon/.DS_Store +0 -0
- package/packages/login/.DS_Store +0 -0
- package/packages/main/.DS_Store +0 -0
- package/packages/main/src/.DS_Store +0 -0
- package/packages/menu/.DS_Store +0 -0
- package/packages/select/.DS_Store +0 -0
- package/packages/selector/.DS_Store +0 -0
- package/packages/selector-panel/.DS_Store +0 -0
- package/packages/theme-chalk/src/.DS_Store +0 -0
- package/packages/upload/.DS_Store +0 -0
- package/src/.DS_Store +0 -0
- package/src/utils/.DS_Store +0 -0
|
@@ -1,1344 +1,1344 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-upload
|
|
3
|
-
v-if="isRender && uploadUrl"
|
|
4
|
-
ref="upload"
|
|
5
|
-
v-bind="$attrs"
|
|
6
|
-
class="es-upload"
|
|
7
|
-
:portrait="portrait"
|
|
8
|
-
:list-type="listType"
|
|
9
|
-
:wait="1000"
|
|
10
|
-
:height="boxHeight"
|
|
11
|
-
:multiple="portrait ? false : multiple"
|
|
12
|
-
:action="uploadUrl"
|
|
13
|
-
:show-file-list="showList"
|
|
14
|
-
:file-list="lists"
|
|
15
|
-
:result-file="resultFile"
|
|
16
|
-
:disabled="isDisabled || isReadonly"
|
|
17
|
-
:readonly="isReadonly"
|
|
18
|
-
:class="[
|
|
19
|
-
{
|
|
20
|
-
'es-avatar-uploader': portrait && !$slots.default,
|
|
21
|
-
'es-upload-readonly': isReadonly && !downloads
|
|
22
|
-
},
|
|
23
|
-
'es-upload-' + listType
|
|
24
|
-
]"
|
|
25
|
-
:previewAdjunct="host + previewAdjunct"
|
|
26
|
-
:headers="headers"
|
|
27
|
-
:data="datas"
|
|
28
|
-
:show-info="showList ? showInfo : undefined"
|
|
29
|
-
:auto-upload="autoUpload"
|
|
30
|
-
:response="true"
|
|
31
|
-
:operate="operate"
|
|
32
|
-
:accept="accepts"
|
|
33
|
-
:drag-sort="isSort"
|
|
34
|
-
:preview="preview"
|
|
35
|
-
:exclude="excludes"
|
|
36
|
-
:download="isDownload"
|
|
37
|
-
:deleted="isRemove"
|
|
38
|
-
:fileIcons="_icons"
|
|
39
|
-
:picture="_picture"
|
|
40
|
-
:before-upload="handleBeforeUpload"
|
|
41
|
-
:before-remove="handleBeforeRemove"
|
|
42
|
-
:on-preview="handlePreview"
|
|
43
|
-
:on-downloads="handleDownloads"
|
|
44
|
-
:on-download="handleDownload"
|
|
45
|
-
:on-sort="handleSort"
|
|
46
|
-
:on-success="handleSuccess"
|
|
47
|
-
:on-change="handleChange"
|
|
48
|
-
:on-remove="handleRemove"
|
|
49
|
-
:on-error="handleError"
|
|
50
|
-
>
|
|
51
|
-
<template v-if="prepend">
|
|
52
|
-
<template v-if="Array.isArray(prepend)">
|
|
53
|
-
<el-button
|
|
54
|
-
v-for="(item, index) in prepend"
|
|
55
|
-
v-bind="{ ...item, size: btnSize }"
|
|
56
|
-
:key="index"
|
|
57
|
-
@click.stop="handleClick(item)"
|
|
58
|
-
>
|
|
59
|
-
{{ item.label || item.text }}
|
|
60
|
-
</el-button>
|
|
61
|
-
</template>
|
|
62
|
-
<el-button
|
|
63
|
-
v-else
|
|
64
|
-
v-bind="{ ...prepend, size: btnSize }"
|
|
65
|
-
@click.stop="handleClick(prepend)"
|
|
66
|
-
>
|
|
67
|
-
{{ prepend.label || prepend.text }}
|
|
68
|
-
</el-button>
|
|
69
|
-
</template>
|
|
70
|
-
<slot>
|
|
71
|
-
<expand-dom v-if="render" :render="render"></expand-dom>
|
|
72
|
-
<template v-else>
|
|
73
|
-
<template v-if="portrait">
|
|
74
|
-
<img
|
|
75
|
-
v-if="profile"
|
|
76
|
-
:src="profile"
|
|
77
|
-
class="avatar"
|
|
78
|
-
:style="{ width: width, height: height }"
|
|
79
|
-
/>
|
|
80
|
-
<i
|
|
81
|
-
v-else
|
|
82
|
-
class="avatar-uploader-icon"
|
|
83
|
-
:class="{ 'el-icon-plus': !isReadonly, 'is-disabled': isDisabled }"
|
|
84
|
-
:style="{ width: width, height: height, lineHeight: height }"
|
|
85
|
-
></i>
|
|
86
|
-
</template>
|
|
87
|
-
<template v-else>
|
|
88
|
-
<template v-if="!isReadonly">
|
|
89
|
-
<i
|
|
90
|
-
class="el-icon-plus es-uploader-icon"
|
|
91
|
-
:class="{ 'is-disabled': isDisabled }"
|
|
92
|
-
v-if="selectType === 'icon-plus'"
|
|
93
|
-
></i>
|
|
94
|
-
<el-button
|
|
95
|
-
v-else
|
|
96
|
-
class="es-upload-button"
|
|
97
|
-
:class="icon"
|
|
98
|
-
:type="selectType"
|
|
99
|
-
:size="btnSize"
|
|
100
|
-
:disabled="isDisabled"
|
|
101
|
-
>{{
|
|
102
|
-
text ? text : autoUpload ? '点击上传' : '选择文件'
|
|
103
|
-
}}</el-button
|
|
104
|
-
>
|
|
105
|
-
<el-button
|
|
106
|
-
class="es-upload-button"
|
|
107
|
-
v-if="!autoUpload"
|
|
108
|
-
:type="uploadType"
|
|
109
|
-
:size="btnSize"
|
|
110
|
-
:disabled="isDisabled"
|
|
111
|
-
@click.stop="handleUpload"
|
|
112
|
-
>
|
|
113
|
-
上传文件
|
|
114
|
-
</el-button>
|
|
115
|
-
</template>
|
|
116
|
-
<el-button
|
|
117
|
-
v-if="showFileList && isDownloads"
|
|
118
|
-
slot="handle"
|
|
119
|
-
class="es-upload-button es-upload-downloads"
|
|
120
|
-
:size="btnSize"
|
|
121
|
-
@click.stop="handleDownloads"
|
|
122
|
-
>
|
|
123
|
-
批量下载
|
|
124
|
-
</el-button>
|
|
125
|
-
</template>
|
|
126
|
-
</template>
|
|
127
|
-
</slot>
|
|
128
|
-
<template v-if="append">
|
|
129
|
-
<template v-if="Array.isArray(append)">
|
|
130
|
-
<el-button
|
|
131
|
-
v-for="(item, index) in append"
|
|
132
|
-
v-bind="{ ...item, size: btnSize }"
|
|
133
|
-
:key="index"
|
|
134
|
-
@click.stop="handleClick(item)"
|
|
135
|
-
>
|
|
136
|
-
{{ item.label || item.text }}
|
|
137
|
-
</el-button>
|
|
138
|
-
</template>
|
|
139
|
-
<el-button
|
|
140
|
-
v-else
|
|
141
|
-
v-bind="{ ...append, size: btnSize }"
|
|
142
|
-
@click.stop="handleClick(append)"
|
|
143
|
-
>
|
|
144
|
-
{{ append.label || append.text }}
|
|
145
|
-
</el-button>
|
|
146
|
-
</template>
|
|
147
|
-
<template slot="tip">
|
|
148
|
-
<slot name="tip">
|
|
149
|
-
<div v-if="tips" class="el-upload__tip">{{ tips }}</div>
|
|
150
|
-
</slot>
|
|
151
|
-
</template>
|
|
152
|
-
<el-image-viewer
|
|
153
|
-
slot="dialog"
|
|
154
|
-
v-if="previewScale && showImg"
|
|
155
|
-
:z-index="9999"
|
|
156
|
-
:initial-index="0"
|
|
157
|
-
:url-list="[imgUrl]"
|
|
158
|
-
:on-close="closeViewer"
|
|
159
|
-
></el-image-viewer>
|
|
160
|
-
<es-dialog v-else :title="title" :visible.sync="showImg" slot="dialog">
|
|
161
|
-
<div
|
|
162
|
-
v-loading="imgChange"
|
|
163
|
-
element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
164
|
-
class="es-upload-dialog"
|
|
165
|
-
>
|
|
166
|
-
<img v-show="!imgChange" ref="showImg" :src="imgUrl" :style="styles" />
|
|
167
|
-
</div>
|
|
168
|
-
</es-dialog>
|
|
169
|
-
<es-dialog :title="title" :visible.sync="showVideo" slot="dialog">
|
|
170
|
-
<es-player
|
|
171
|
-
autoplay
|
|
172
|
-
type="video/mp4"
|
|
173
|
-
:is-pause="!showVideo"
|
|
174
|
-
:source="source"
|
|
175
|
-
></es-player>
|
|
176
|
-
</es-dialog>
|
|
177
|
-
</el-upload>
|
|
178
|
-
</template>
|
|
179
|
-
<script>
|
|
180
|
-
import {
|
|
181
|
-
getAdjunctProperties,
|
|
182
|
-
uploads,
|
|
183
|
-
uploadOnlyOne,
|
|
184
|
-
getAdjunctFileInfos,
|
|
185
|
-
uploadDownloads,
|
|
186
|
-
previewAdjunctOffice,
|
|
187
|
-
previewAdjunct,
|
|
188
|
-
previewAdjunct2,
|
|
189
|
-
uploadSort,
|
|
190
|
-
delAdjunct,
|
|
191
|
-
downloadByAdjunctId
|
|
192
|
-
} from 'eoss-ui/src/config/api.js';
|
|
193
|
-
import { debounce } from 'throttle-debounce';
|
|
194
|
-
import util from 'eoss-ui/src/utils/util.js';
|
|
195
|
-
import picture from './picture.js';
|
|
196
|
-
import store from 'eoss-ui/src/utils/store';
|
|
197
|
-
import { Base64 } from 'js-base64';
|
|
198
|
-
export default {
|
|
199
|
-
name: 'EsUpload',
|
|
200
|
-
components: {
|
|
201
|
-
expandDom: {
|
|
202
|
-
functional: true,
|
|
203
|
-
props: {
|
|
204
|
-
render: [Function, String]
|
|
205
|
-
},
|
|
206
|
-
render: (h, ctx) => {
|
|
207
|
-
if (typeof ctx.props.render == 'string') {
|
|
208
|
-
try {
|
|
209
|
-
return util.toFunction(ctx.props.render)(h, params);
|
|
210
|
-
} catch (error) {
|
|
211
|
-
throw error;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return ctx.props.render(h);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
inheritAttrs: false,
|
|
219
|
-
inject: {
|
|
220
|
-
elForm: {
|
|
221
|
-
default: ''
|
|
222
|
-
},
|
|
223
|
-
elFormItem: {
|
|
224
|
-
default: ''
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
props: {
|
|
228
|
-
prepend: [Array, Object],
|
|
229
|
-
append: [Array, Object],
|
|
230
|
-
render: Function,
|
|
231
|
-
template: String,
|
|
232
|
-
value: [String, Array, Object],
|
|
233
|
-
name: String,
|
|
234
|
-
method: {
|
|
235
|
-
type: String,
|
|
236
|
-
default: 'get'
|
|
237
|
-
},
|
|
238
|
-
text: String,
|
|
239
|
-
icon: {
|
|
240
|
-
type: Boolean,
|
|
241
|
-
default: true
|
|
242
|
-
},
|
|
243
|
-
headers: Object,
|
|
244
|
-
listType: {
|
|
245
|
-
type: String,
|
|
246
|
-
default: 'table' // text,table,picture,picture-card
|
|
247
|
-
},
|
|
248
|
-
operate: {
|
|
249
|
-
type: Boolean,
|
|
250
|
-
default: true
|
|
251
|
-
},
|
|
252
|
-
accept: String,
|
|
253
|
-
// 附件code
|
|
254
|
-
code: String,
|
|
255
|
-
// 业务id
|
|
256
|
-
ownId: String,
|
|
257
|
-
//附件文档id
|
|
258
|
-
documentId: String,
|
|
259
|
-
requiredOwnId: {
|
|
260
|
-
type: Boolean,
|
|
261
|
-
default: true
|
|
262
|
-
},
|
|
263
|
-
//
|
|
264
|
-
downloads: {
|
|
265
|
-
type: Boolean,
|
|
266
|
-
default: false
|
|
267
|
-
},
|
|
268
|
-
// 附件扩展编码
|
|
269
|
-
extendCode: String,
|
|
270
|
-
// 是否添加文件md5值
|
|
271
|
-
fileMd5: {
|
|
272
|
-
type: Boolean,
|
|
273
|
-
default: false
|
|
274
|
-
},
|
|
275
|
-
// 额外的参数
|
|
276
|
-
data: {
|
|
277
|
-
type: Object,
|
|
278
|
-
default() {
|
|
279
|
-
return {};
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
param: {
|
|
283
|
-
type: Object,
|
|
284
|
-
default() {
|
|
285
|
-
return {};
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
// 单文件大小
|
|
289
|
-
size: Number,
|
|
290
|
-
totalSize: Number,
|
|
291
|
-
// 是否头像模式上传
|
|
292
|
-
portrait: {
|
|
293
|
-
type: Boolean,
|
|
294
|
-
default: false
|
|
295
|
-
},
|
|
296
|
-
photo: [String, Boolean],
|
|
297
|
-
//头像按钮框宽度
|
|
298
|
-
width: String,
|
|
299
|
-
//头像按钮框高度度
|
|
300
|
-
height: String,
|
|
301
|
-
// 自定义的文字提示
|
|
302
|
-
tips: {
|
|
303
|
-
type: String,
|
|
304
|
-
default: ''
|
|
305
|
-
},
|
|
306
|
-
dragSort: {
|
|
307
|
-
type: Boolean,
|
|
308
|
-
default: false
|
|
309
|
-
},
|
|
310
|
-
// 上传成功后绑定到file的内容
|
|
311
|
-
showInfo: {
|
|
312
|
-
type: Array,
|
|
313
|
-
default() {
|
|
314
|
-
return [
|
|
315
|
-
{ label: '上传时间', field: 'uploadTime', width: 170 },
|
|
316
|
-
{ label: '大小', field: 'fileSize', width: 100 },
|
|
317
|
-
{ label: '上传人', field: 'userName', width: 100 }
|
|
318
|
-
];
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
// 上传地址
|
|
322
|
-
action: String,
|
|
323
|
-
// 自动上传
|
|
324
|
-
autoUpload: {
|
|
325
|
-
type: Boolean,
|
|
326
|
-
default: true
|
|
327
|
-
},
|
|
328
|
-
// 是否支持多选文件
|
|
329
|
-
multiple: {
|
|
330
|
-
type: Boolean,
|
|
331
|
-
default: true
|
|
332
|
-
},
|
|
333
|
-
// 显示文件列表
|
|
334
|
-
showFileList: {
|
|
335
|
-
type: Boolean,
|
|
336
|
-
default: true
|
|
337
|
-
},
|
|
338
|
-
// 上传的文件列表
|
|
339
|
-
fileList: [Array, String],
|
|
340
|
-
requestFiles: {
|
|
341
|
-
type: Boolean,
|
|
342
|
-
default: true
|
|
343
|
-
},
|
|
344
|
-
filesParam: {
|
|
345
|
-
type: Object,
|
|
346
|
-
default() {
|
|
347
|
-
return {};
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
state: {
|
|
351
|
-
type: Number,
|
|
352
|
-
default: 1
|
|
353
|
-
},
|
|
354
|
-
selectType: {
|
|
355
|
-
type: String,
|
|
356
|
-
default: 'primary'
|
|
357
|
-
},
|
|
358
|
-
uploadType: {
|
|
359
|
-
type: String,
|
|
360
|
-
default: 'success'
|
|
361
|
-
},
|
|
362
|
-
host: {
|
|
363
|
-
type: String,
|
|
364
|
-
default() {
|
|
365
|
-
return util.getStorage('host') ? util.getStorage('host') : '';
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
|
-
message: Object,
|
|
369
|
-
btnSize: {
|
|
370
|
-
type: String,
|
|
371
|
-
default: 'medium'
|
|
372
|
-
},
|
|
373
|
-
// 只读
|
|
374
|
-
readonly: {
|
|
375
|
-
type: Boolean,
|
|
376
|
-
default: false
|
|
377
|
-
},
|
|
378
|
-
disabled: Boolean,
|
|
379
|
-
preview: { type: [Boolean, String], default: true },
|
|
380
|
-
exclude: String,
|
|
381
|
-
download: { type: [Boolean, String], default: true },
|
|
382
|
-
deleted: { type: [Boolean, String], default: true },
|
|
383
|
-
remove: { type: [Boolean, String], default: true },
|
|
384
|
-
beforeUpload: Function,
|
|
385
|
-
onPreview: Function,
|
|
386
|
-
// 文件列表排序
|
|
387
|
-
onSort: Function,
|
|
388
|
-
beforeRemove: Function,
|
|
389
|
-
onDownloads: Function,
|
|
390
|
-
onDownload: Function,
|
|
391
|
-
onSort: Function,
|
|
392
|
-
onSuccess: Function,
|
|
393
|
-
onChange: Function,
|
|
394
|
-
onRemove: Function,
|
|
395
|
-
onError: Function,
|
|
396
|
-
dangerouslyUseHTMLString: Boolean,
|
|
397
|
-
fileCount: Number,
|
|
398
|
-
listHeight: String,
|
|
399
|
-
display: Boolean,
|
|
400
|
-
resultFile: {
|
|
401
|
-
type: Boolean,
|
|
402
|
-
default: true
|
|
403
|
-
},
|
|
404
|
-
properties: {
|
|
405
|
-
type: String,
|
|
406
|
-
default() {
|
|
407
|
-
return getAdjunctProperties;
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
fileIcons: {
|
|
411
|
-
type: Object,
|
|
412
|
-
default() {
|
|
413
|
-
return {};
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
picture: {
|
|
417
|
-
type: Object,
|
|
418
|
-
default() {
|
|
419
|
-
return {};
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
previewScale: {
|
|
423
|
-
type: Boolean,
|
|
424
|
-
default: true
|
|
425
|
-
},
|
|
426
|
-
useCaseCode: String
|
|
427
|
-
},
|
|
428
|
-
data() {
|
|
429
|
-
return {
|
|
430
|
-
uploadUrl: this.action,
|
|
431
|
-
lists: [],
|
|
432
|
-
image: '',
|
|
433
|
-
fileAccept: '',
|
|
434
|
-
fileSize: 0,
|
|
435
|
-
fileTotalSize: 0,
|
|
436
|
-
filesTotalSize: 0,
|
|
437
|
-
showImg: false,
|
|
438
|
-
imgChange: false,
|
|
439
|
-
title: '',
|
|
440
|
-
imgUrl: '',
|
|
441
|
-
styles: {},
|
|
442
|
-
showVideo: false,
|
|
443
|
-
videoChange: false,
|
|
444
|
-
source: '',
|
|
445
|
-
excludeNames: '',
|
|
446
|
-
boxHeight: this.listHeight,
|
|
447
|
-
previewAdjunct: previewAdjunct,
|
|
448
|
-
kkfileview: null,
|
|
449
|
-
dochubConfig: {}
|
|
450
|
-
};
|
|
451
|
-
},
|
|
452
|
-
computed: {
|
|
453
|
-
isRender() {
|
|
454
|
-
let useCaseCodes = util.getStorage('useCaseCodes');
|
|
455
|
-
if (useCaseCodes && this.useCaseCode) {
|
|
456
|
-
return useCaseCodes.indexOf(this.useCaseCode) > -1;
|
|
457
|
-
}
|
|
458
|
-
return true;
|
|
459
|
-
},
|
|
460
|
-
_icons() {
|
|
461
|
-
return {
|
|
462
|
-
ppt: 'es-icon-ppt',
|
|
463
|
-
png: 'es-icon-tupian',
|
|
464
|
-
gif: 'es-icon-tupian',
|
|
465
|
-
jpg: 'es-icon-tupian',
|
|
466
|
-
jpeg: 'es-icon-tupian',
|
|
467
|
-
xls: 'es-icon-excel',
|
|
468
|
-
xlsx: 'es-icon-excel',
|
|
469
|
-
docx: 'es-icon-word',
|
|
470
|
-
doc: 'es-icon-word',
|
|
471
|
-
rar: 'es-icon-zip',
|
|
472
|
-
zip: 'es-icon-zip',
|
|
473
|
-
txt: 'es-icon-txt',
|
|
474
|
-
ipa: 'es-icon-ios',
|
|
475
|
-
apk: 'es-icon-android',
|
|
476
|
-
mp4: 'es-icon-video',
|
|
477
|
-
avi: 'es-icon-video',
|
|
478
|
-
mp3: 'es-icon-audioo',
|
|
479
|
-
wma: 'es-icon-audioo',
|
|
480
|
-
pdf: 'es-icon-pdf',
|
|
481
|
-
...this.fileIcons
|
|
482
|
-
};
|
|
483
|
-
},
|
|
484
|
-
_picture() {
|
|
485
|
-
return {
|
|
486
|
-
...picture,
|
|
487
|
-
...this.picture
|
|
488
|
-
};
|
|
489
|
-
},
|
|
490
|
-
show() {
|
|
491
|
-
if ((this.photo && typeof this.photo === 'string') || this.value) {
|
|
492
|
-
return false;
|
|
493
|
-
}
|
|
494
|
-
return this.showFileList;
|
|
495
|
-
},
|
|
496
|
-
excludes() {
|
|
497
|
-
return this.exclude ? this.exclude : this.excludeNames;
|
|
498
|
-
},
|
|
499
|
-
accepts() {
|
|
500
|
-
return this.accept
|
|
501
|
-
? this.accept
|
|
502
|
-
: this.fileAccept
|
|
503
|
-
? this.fileAccept
|
|
504
|
-
: this.portrait
|
|
505
|
-
? 'image/*'
|
|
506
|
-
: undefined;
|
|
507
|
-
},
|
|
508
|
-
_size() {
|
|
509
|
-
return this.size ? this.size : this.fileSize ? this.fileSize : 0;
|
|
510
|
-
},
|
|
511
|
-
_totalSize() {
|
|
512
|
-
return this.totalSize
|
|
513
|
-
? this.totalSize
|
|
514
|
-
: this.fileTotalSize
|
|
515
|
-
? this.fileTotalSize
|
|
516
|
-
: 0;
|
|
517
|
-
},
|
|
518
|
-
getAdjunctFileInfos() {
|
|
519
|
-
return typeof this.fileList === 'string'
|
|
520
|
-
? this.fileList
|
|
521
|
-
: getAdjunctFileInfos;
|
|
522
|
-
},
|
|
523
|
-
showList() {
|
|
524
|
-
return this.portrait ? false : this.showFileList;
|
|
525
|
-
},
|
|
526
|
-
isDownloads() {
|
|
527
|
-
return this.downloads;
|
|
528
|
-
},
|
|
529
|
-
isDownload() {
|
|
530
|
-
if (this.download) {
|
|
531
|
-
return true;
|
|
532
|
-
}
|
|
533
|
-
return false;
|
|
534
|
-
},
|
|
535
|
-
isDisabled() {
|
|
536
|
-
return this.disabled || (this.elForm || {}).disabled;
|
|
537
|
-
},
|
|
538
|
-
isReadonly() {
|
|
539
|
-
return this.readonly || (this.elForm || {}).readonly;
|
|
540
|
-
},
|
|
541
|
-
isRemove() {
|
|
542
|
-
if (this.remove == false || this.deleted == false) {
|
|
543
|
-
return false;
|
|
544
|
-
}
|
|
545
|
-
return true;
|
|
546
|
-
},
|
|
547
|
-
isSort() {
|
|
548
|
-
// return this.dragSort && !this.isDisabled && this.isReadonly;
|
|
549
|
-
return this.dragSort && !this.isDisabled;
|
|
550
|
-
},
|
|
551
|
-
datas() {
|
|
552
|
-
if (this.data) {
|
|
553
|
-
return util.extend({}, this.data, this.params);
|
|
554
|
-
}
|
|
555
|
-
return this.params;
|
|
556
|
-
},
|
|
557
|
-
params() {
|
|
558
|
-
let params = { userId: util.getStorage('userId'), ...this.param };
|
|
559
|
-
if (this.code !== undefined) {
|
|
560
|
-
params.code = this.code;
|
|
561
|
-
params.bucketCode = this.code;
|
|
562
|
-
}
|
|
563
|
-
if (this.ownId !== undefined) {
|
|
564
|
-
params.ownId = this.ownId;
|
|
565
|
-
params.businessId = this.ownId;
|
|
566
|
-
}
|
|
567
|
-
return params;
|
|
568
|
-
},
|
|
569
|
-
showMessage() {
|
|
570
|
-
if (this.message !== undefined) {
|
|
571
|
-
return util.extend({}, { success: true, error: true }, this.message);
|
|
572
|
-
}
|
|
573
|
-
return { success: true, error: true };
|
|
574
|
-
},
|
|
575
|
-
profile() {
|
|
576
|
-
const previewAdjunct =
|
|
577
|
-
this.dochubConfig.downloadDocumentUrl || this.previewAdjunct;
|
|
578
|
-
if (this.image) {
|
|
579
|
-
if (typeof this.image === 'string') {
|
|
580
|
-
return this.image;
|
|
581
|
-
}
|
|
582
|
-
return `${this.host}${previewAdjunct}?documentId=${
|
|
583
|
-
this.image.adjunctId
|
|
584
|
-
}&adjunctId=${this.image.adjunctId}&_tt=${new Date().getTime()}`;
|
|
585
|
-
}
|
|
586
|
-
if (this.value) {
|
|
587
|
-
if (typeof this.value === 'string') {
|
|
588
|
-
if (this.value.indexOf('data:image/') === 0) {
|
|
589
|
-
return this.value;
|
|
590
|
-
} else if (this.value.indexOf(previewAdjunct) > -1) {
|
|
591
|
-
let val =
|
|
592
|
-
this.host +
|
|
593
|
-
util.jointUrl({
|
|
594
|
-
url: this.value,
|
|
595
|
-
reg: '/main2'
|
|
596
|
-
});
|
|
597
|
-
return val;
|
|
598
|
-
} else if (this.value.indexOf('/') === -1) {
|
|
599
|
-
return `${this.host}${previewAdjunct}?documentId=${
|
|
600
|
-
this.value
|
|
601
|
-
}&adjunctId=${this.value}&_tt=${new Date().getTime()}`;
|
|
602
|
-
}
|
|
603
|
-
return this.value;
|
|
604
|
-
} else if (Array.isArray(this.value)) {
|
|
605
|
-
let adjunctId = this.value[0].response
|
|
606
|
-
? this.value[0].response.adjunctId
|
|
607
|
-
: this.value[0].adjunctId;
|
|
608
|
-
return `${
|
|
609
|
-
this.host
|
|
610
|
-
}${previewAdjunct}?documentId=${adjunctId}&adjunctId=${adjunctId}&_tt=${new Date().getTime()}`;
|
|
611
|
-
} else {
|
|
612
|
-
let adjunctId = this.value.response
|
|
613
|
-
? this.value.response.adjunctId
|
|
614
|
-
: this.value.adjunctId;
|
|
615
|
-
return `${
|
|
616
|
-
this.host
|
|
617
|
-
}${previewAdjunct}?documentId=${adjunctId}&adjunctId=${adjunctId}&_tt=${new Date().getTime()}`;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
if (this.photo && typeof this.photo === 'string') {
|
|
621
|
-
if (this.photo.indexOf('data:image/') === 0) {
|
|
622
|
-
return this.photo;
|
|
623
|
-
} else if (this.photo.indexOf(previewAdjunct) > -1) {
|
|
624
|
-
let val =
|
|
625
|
-
this.host +
|
|
626
|
-
util.jointUrl({
|
|
627
|
-
url: this.value,
|
|
628
|
-
reg: '/main2'
|
|
629
|
-
});
|
|
630
|
-
return val;
|
|
631
|
-
} else if (this.photo.indexOf('/') === -1) {
|
|
632
|
-
return `${this.host}${previewAdjunct}?documentId=${
|
|
633
|
-
this.photo
|
|
634
|
-
}&adjunctId=${this.photo}&_tt=${new Date().getTime()}`;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
return this.photo;
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
watch: {
|
|
641
|
-
fileList: {
|
|
642
|
-
immediate: true,
|
|
643
|
-
deep: true,
|
|
644
|
-
handler(val) {
|
|
645
|
-
if (Array.isArray(val) && val.length > 0) {
|
|
646
|
-
this.lists = val;
|
|
647
|
-
let filesTotalSize = 0;
|
|
648
|
-
val.forEach((item) => {
|
|
649
|
-
if (
|
|
650
|
-
Object.prototype.hasOwnProperty.call(item, 'fileSize') &&
|
|
651
|
-
item.fileSize
|
|
652
|
-
) {
|
|
653
|
-
filesTotalSize += parseFloat(item.fileSize, 10);
|
|
654
|
-
} else {
|
|
655
|
-
filesTotalSize += item.size
|
|
656
|
-
? Math.round((item.size / 1024) * 10) / 10
|
|
657
|
-
: 0;
|
|
658
|
-
}
|
|
659
|
-
});
|
|
660
|
-
this.filesTotalSize = filesTotalSize;
|
|
661
|
-
this.$emit('input', val);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
},
|
|
665
|
-
value: {
|
|
666
|
-
immediate: true,
|
|
667
|
-
deep: true,
|
|
668
|
-
handler(val) {
|
|
669
|
-
if (val && typeof val === 'object' && this.showFileList) {
|
|
670
|
-
if (Array.isArray(val)) {
|
|
671
|
-
this.lists = val;
|
|
672
|
-
} else {
|
|
673
|
-
this.lists = [val];
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
},
|
|
678
|
-
params: {
|
|
679
|
-
deep: true,
|
|
680
|
-
handler() {
|
|
681
|
-
this.getFiles();
|
|
682
|
-
}
|
|
683
|
-
},
|
|
684
|
-
lists: {
|
|
685
|
-
deep: true,
|
|
686
|
-
handler(val) {
|
|
687
|
-
this.$emit('update:fileCount', val.length);
|
|
688
|
-
this.$emit('getFilesAmount', val.length);
|
|
689
|
-
}
|
|
690
|
-
},
|
|
691
|
-
display(val) {
|
|
692
|
-
val && this.getHeight();
|
|
693
|
-
}
|
|
694
|
-
},
|
|
695
|
-
beforeCreate() {
|
|
696
|
-
this.getFiles = debounce(500, () => {
|
|
697
|
-
this.getFileLists();
|
|
698
|
-
});
|
|
699
|
-
this.getAdjunctPropertie = debounce(500, () => {
|
|
700
|
-
this.getAdjunctProperties();
|
|
701
|
-
});
|
|
702
|
-
},
|
|
703
|
-
created() {
|
|
704
|
-
const dochubConfig = sessionStorage.getItem('dochubConfig');
|
|
705
|
-
if (dochubConfig) {
|
|
706
|
-
this.dochubConfig = JSON.parse(dochubConfig);
|
|
707
|
-
}
|
|
708
|
-
this.getAdjunctPropertie();
|
|
709
|
-
},
|
|
710
|
-
mounted() {
|
|
711
|
-
this.$nextTick(() => {
|
|
712
|
-
this.getHeight();
|
|
713
|
-
});
|
|
714
|
-
},
|
|
715
|
-
methods: {
|
|
716
|
-
getHeight() {
|
|
717
|
-
if (this.height === 'auto') {
|
|
718
|
-
let pt =
|
|
719
|
-
parseInt(util.getStyle(this.$el.parentNode, 'padding-top'), 10) || 0;
|
|
720
|
-
let pb =
|
|
721
|
-
parseInt(util.getStyle(this.$el.parentNode, 'padding-bottom'), 10) ||
|
|
722
|
-
0;
|
|
723
|
-
let btn = this.$refs.upload
|
|
724
|
-
? this.$refs.upload.$children[0].$el.offsetHeight || 0
|
|
725
|
-
: 0;
|
|
726
|
-
this.boxHeight =
|
|
727
|
-
this.$el.parentNode.offsetHeight - pt - pb - btn + 'px';
|
|
728
|
-
}
|
|
729
|
-
},
|
|
730
|
-
//根据code获取附件参数配置
|
|
731
|
-
getAdjunctProperties() {
|
|
732
|
-
if (this.code !== undefined) {
|
|
733
|
-
let config = store.get(this.code);
|
|
734
|
-
if (config) {
|
|
735
|
-
this.fileAccept = config.accept;
|
|
736
|
-
this.fileSize = config.size;
|
|
737
|
-
this.fileTotalSize = config.totalSize;
|
|
738
|
-
if (config.dochubConfig) {
|
|
739
|
-
this.dochubConfig = config.dochubConfig;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
let url =
|
|
743
|
-
this.portrait || this.documentId
|
|
744
|
-
? this.dochubConfig.reuploadDocumentUrl || uploadOnlyOne
|
|
745
|
-
: this.dochubConfig.uploadDocumentUrl || uploads;
|
|
746
|
-
this.uploadUrl = url.indexOf(this.host) > -1 ? url : this.host + url;
|
|
747
|
-
this.requestFiles && this.getFiles();
|
|
748
|
-
} else {
|
|
749
|
-
util
|
|
750
|
-
.ajax({
|
|
751
|
-
method: this.method,
|
|
752
|
-
url: this.properties,
|
|
753
|
-
data: { code: this.code, ...this.param },
|
|
754
|
-
params: { code: this.code, ...this.param }
|
|
755
|
-
})
|
|
756
|
-
.then((res) => {
|
|
757
|
-
if (res.rCode === 0) {
|
|
758
|
-
if (res.results) {
|
|
759
|
-
this.excludeNames = res.results.excludeName;
|
|
760
|
-
if (res.results.fileTypeExtName) {
|
|
761
|
-
let fileTypeExtName =
|
|
762
|
-
res.results.fileTypeExtName.split(';');
|
|
763
|
-
this.fileAccept = fileTypeExtName
|
|
764
|
-
.filter((item) => {
|
|
765
|
-
return item;
|
|
766
|
-
})
|
|
767
|
-
.join(',');
|
|
768
|
-
}
|
|
769
|
-
if (res.results.dochubConfig) {
|
|
770
|
-
this.dochubConfig = res.results.dochubConfig;
|
|
771
|
-
sessionStorage.setItem(
|
|
772
|
-
'dochubConfig',
|
|
773
|
-
JSON.stringify(res.results.dochubConfig)
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
let url = this.portrait
|
|
777
|
-
? this.dochubConfig.reuploadDocumentUrl || uploadOnlyOne
|
|
778
|
-
: this.dochubConfig.uploadDocumentUrl || uploads;
|
|
779
|
-
this.uploadUrl =
|
|
780
|
-
url.indexOf(this.host) > -1 ? url : this.host + url;
|
|
781
|
-
if (res.results.kkViewRootPath) {
|
|
782
|
-
this.kkfileview = res.results.kkViewRootPath;
|
|
783
|
-
}
|
|
784
|
-
this.fileSize = res.results.limitFileSize
|
|
785
|
-
? res.results.limitFileSize
|
|
786
|
-
: 0;
|
|
787
|
-
this.fileTotalSize = res.results.limitTotalSize;
|
|
788
|
-
store.set(this.code, {
|
|
789
|
-
accept: this.fileAccept,
|
|
790
|
-
size: this.fileSize,
|
|
791
|
-
totalSize: this.fileTotalSize,
|
|
792
|
-
dochubConfig: this.dochubConfig
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
this.requestFiles && this.getFiles();
|
|
796
|
-
}
|
|
797
|
-
})
|
|
798
|
-
.catch((err) => {
|
|
799
|
-
if (err.message && err.message !== 'canceled') {
|
|
800
|
-
this.$message.error(err.message);
|
|
801
|
-
}
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
},
|
|
806
|
-
getFileLists() {
|
|
807
|
-
if (
|
|
808
|
-
!this.show ||
|
|
809
|
-
(this.fileList &&
|
|
810
|
-
Array.isArray(this.fileList) &&
|
|
811
|
-
this.fileList.length) ||
|
|
812
|
-
(this.requiredOwnId &&
|
|
813
|
-
!Object.prototype.hasOwnProperty.call(this.params, 'ownId'))
|
|
814
|
-
) {
|
|
815
|
-
return false;
|
|
816
|
-
}
|
|
817
|
-
let url =
|
|
818
|
-
typeof this.fileList === 'string'
|
|
819
|
-
? this.fileList
|
|
820
|
-
: this.dochubConfig.getDocumentList
|
|
821
|
-
? this.dochubConfig.getDocumentList
|
|
822
|
-
: getAdjunctFileInfos;
|
|
823
|
-
util
|
|
824
|
-
.ajax({
|
|
825
|
-
method: this.method,
|
|
826
|
-
url: url,
|
|
827
|
-
data: this.params,
|
|
828
|
-
params: this.params,
|
|
829
|
-
format: false
|
|
830
|
-
})
|
|
831
|
-
.then((res) => {
|
|
832
|
-
if (res.rCode === 0) {
|
|
833
|
-
if (this.portrait === true) {
|
|
834
|
-
this.image = JSON.parse(JSON.stringify(res.results))[0];
|
|
835
|
-
} else {
|
|
836
|
-
this.lists = JSON.parse(JSON.stringify(res.results));
|
|
837
|
-
let filesTotalSize = 0;
|
|
838
|
-
this.lists.forEach((item) => {
|
|
839
|
-
if (
|
|
840
|
-
Object.prototype.hasOwnProperty.call(item, 'fileSize') &&
|
|
841
|
-
item.fileSize
|
|
842
|
-
) {
|
|
843
|
-
filesTotalSize += parseFloat(item.fileSize, 10);
|
|
844
|
-
} else {
|
|
845
|
-
filesTotalSize += item.size
|
|
846
|
-
? Math.round((item.size / 1024) * 10) / 10
|
|
847
|
-
: 0;
|
|
848
|
-
}
|
|
849
|
-
});
|
|
850
|
-
this.filesTotalSize = filesTotalSize;
|
|
851
|
-
if (this.lists.length) {
|
|
852
|
-
this.$emit('input', this.lists);
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
} else {
|
|
856
|
-
let msg = res.msg || '系统错误,请联系管理员!';
|
|
857
|
-
this.$message.error(msg);
|
|
858
|
-
}
|
|
859
|
-
})
|
|
860
|
-
.catch((err) => {
|
|
861
|
-
if (err.message && err.message !== 'canceled') {
|
|
862
|
-
this.$message.error(err.message);
|
|
863
|
-
}
|
|
864
|
-
});
|
|
865
|
-
},
|
|
866
|
-
handleUpload() {
|
|
867
|
-
this.$refs.upload.submit();
|
|
868
|
-
},
|
|
869
|
-
openKkfileview(file) {
|
|
870
|
-
let host = util.win.location.origin;
|
|
871
|
-
if (this.host) {
|
|
872
|
-
if (util.startWith(this.host, 'http')) {
|
|
873
|
-
host = this.host;
|
|
874
|
-
} else {
|
|
875
|
-
host += this.host;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
let url = encodeURIComponent(
|
|
879
|
-
Base64.encode(
|
|
880
|
-
host +
|
|
881
|
-
(typeof this.download === 'string'
|
|
882
|
-
? this.download
|
|
883
|
-
: downloadByAdjunctId) +
|
|
884
|
-
`?adjunctId=${
|
|
885
|
-
file.adjunctId || file.response.adjunctId
|
|
886
|
-
}&fullfilename=${file.originalName}`
|
|
887
|
-
)
|
|
888
|
-
);
|
|
889
|
-
util.win.open(`${this.kkfileview}?url=${url}`);
|
|
890
|
-
},
|
|
891
|
-
handlePreview(res) {
|
|
892
|
-
if (this.preview) {
|
|
893
|
-
if (this.onPreview) {
|
|
894
|
-
this.onPreview(res);
|
|
895
|
-
} else {
|
|
896
|
-
let file = res.response ? res.response : res;
|
|
897
|
-
let url =
|
|
898
|
-
typeof this.preview === 'string'
|
|
899
|
-
? this.preview
|
|
900
|
-
: typeof this.preview === 'function'
|
|
901
|
-
? this.preview(file)
|
|
902
|
-
: null;
|
|
903
|
-
if (res.status === 'success' || res.status == 0) {
|
|
904
|
-
let suffix = file.suffix;
|
|
905
|
-
suffix = suffix.toLowerCase();
|
|
906
|
-
if (this.dochubConfig.previewDocumentUrl) {
|
|
907
|
-
if (
|
|
908
|
-
suffix.includes('jpge') ||
|
|
909
|
-
suffix.includes('jpg') ||
|
|
910
|
-
suffix.includes('gif') ||
|
|
911
|
-
suffix.includes('png')
|
|
912
|
-
) {
|
|
913
|
-
this.imgUrl =
|
|
914
|
-
res.url && util.startWith(url, ['http', '/', true])
|
|
915
|
-
? res.url
|
|
916
|
-
: this.host +
|
|
917
|
-
(url
|
|
918
|
-
? url
|
|
919
|
-
: `${this.dochubConfig.downloadDocumentUrl}?documentId=${file.adjunctId}`);
|
|
920
|
-
this.title = file.originalName;
|
|
921
|
-
this.showImg = true;
|
|
922
|
-
this.$nextTick(() => {
|
|
923
|
-
this.loadImage();
|
|
924
|
-
});
|
|
925
|
-
} else if (suffix.includes('mp4')) {
|
|
926
|
-
this.source = {
|
|
927
|
-
src:
|
|
928
|
-
this.host +
|
|
929
|
-
(url
|
|
930
|
-
? url
|
|
931
|
-
: `${this.dochubConfig.downloadDocumentUrl}?documentId=${file.adjunctId}`)
|
|
932
|
-
};
|
|
933
|
-
this.title = file.originalName;
|
|
934
|
-
this.showVideo = true;
|
|
935
|
-
} else {
|
|
936
|
-
util.win.open(
|
|
937
|
-
this.host +
|
|
938
|
-
(url
|
|
939
|
-
? url
|
|
940
|
-
: `${this.dochubConfig.previewDocumentUrl}?documentId=${file.adjunctId}&action=附件预览`)
|
|
941
|
-
);
|
|
942
|
-
}
|
|
943
|
-
} else {
|
|
944
|
-
if (
|
|
945
|
-
suffix.includes('doc') ||
|
|
946
|
-
suffix.includes('docx') ||
|
|
947
|
-
suffix.includes('xls') ||
|
|
948
|
-
suffix.includes('xlsx') ||
|
|
949
|
-
suffix.includes('ppt')
|
|
950
|
-
) {
|
|
951
|
-
if (this.kkfileview) {
|
|
952
|
-
this.openKkfileview(file);
|
|
953
|
-
} else {
|
|
954
|
-
util.win.open(
|
|
955
|
-
this.host +
|
|
956
|
-
(url ? url : previewAdjunctOffice) +
|
|
957
|
-
'?cmd=view&bucketName=' +
|
|
958
|
-
file.absolutePath +
|
|
959
|
-
'&fileId=' +
|
|
960
|
-
file.adjunctId +
|
|
961
|
-
'&fileName=' +
|
|
962
|
-
file.newName
|
|
963
|
-
);
|
|
964
|
-
}
|
|
965
|
-
} else if (suffix.includes('pdf')) {
|
|
966
|
-
if (this.kkfileview) {
|
|
967
|
-
this.openKkfileview(file);
|
|
968
|
-
} else {
|
|
969
|
-
util.win.open(
|
|
970
|
-
this.host +
|
|
971
|
-
(url ? url : previewAdjunct2) +
|
|
972
|
-
'/' +
|
|
973
|
-
file.originalName +
|
|
974
|
-
'?adjunctId=' +
|
|
975
|
-
file.adjunctId
|
|
976
|
-
);
|
|
977
|
-
}
|
|
978
|
-
} else if (
|
|
979
|
-
suffix.includes('jpge') ||
|
|
980
|
-
suffix.includes('jpg') ||
|
|
981
|
-
suffix.includes('gif') ||
|
|
982
|
-
suffix.includes('png')
|
|
983
|
-
) {
|
|
984
|
-
this.imgUrl =
|
|
985
|
-
res.url && util.startWith(url, ['http', '/', true])
|
|
986
|
-
? res.url
|
|
987
|
-
: this.host +
|
|
988
|
-
(url ? url : this.previewAdjunct) +
|
|
989
|
-
'?adjunctId=' +
|
|
990
|
-
file.adjunctId;
|
|
991
|
-
this.title = file.originalName;
|
|
992
|
-
this.showImg = true;
|
|
993
|
-
this.$nextTick(() => {
|
|
994
|
-
this.loadImage();
|
|
995
|
-
});
|
|
996
|
-
} else if (suffix.includes('mp4')) {
|
|
997
|
-
this.source = {
|
|
998
|
-
src:
|
|
999
|
-
this.host +
|
|
1000
|
-
(url ? url : this.previewAdjunct) +
|
|
1001
|
-
'?adjunctId=' +
|
|
1002
|
-
file.adjunctId
|
|
1003
|
-
};
|
|
1004
|
-
this.title = file.originalName;
|
|
1005
|
-
this.showVideo = true;
|
|
1006
|
-
} else {
|
|
1007
|
-
if (this.kkfileview) {
|
|
1008
|
-
this.openKkfileview(file);
|
|
1009
|
-
} else {
|
|
1010
|
-
util.win.open(
|
|
1011
|
-
this.host +
|
|
1012
|
-
(url ? url : this.previewAdjunct) +
|
|
1013
|
-
'?adjunctId=' +
|
|
1014
|
-
file.adjunctId
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
} else {
|
|
1020
|
-
util.win.open(URL.createObjectURL(file.raw));
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
},
|
|
1025
|
-
closeViewer() {
|
|
1026
|
-
this.showImg = false;
|
|
1027
|
-
},
|
|
1028
|
-
loadImage() {
|
|
1029
|
-
this.$refs.showImg &&
|
|
1030
|
-
(this.$refs.showImg.onload = () => {
|
|
1031
|
-
this.imgChange = false;
|
|
1032
|
-
let w = this.$refs.showImg.naturalWidth;
|
|
1033
|
-
let h = this.$refs.showImg.naturalHeight;
|
|
1034
|
-
let pw = this.$refs.showImg.parentNode.offsetWidth;
|
|
1035
|
-
let ph = this.$refs.showImg.parentNode.offsetHeight;
|
|
1036
|
-
if (w / h > pw / ph) {
|
|
1037
|
-
this.styles = { 'max-width': '100%' };
|
|
1038
|
-
} else {
|
|
1039
|
-
this.styles = { 'max-height': '100%' };
|
|
1040
|
-
}
|
|
1041
|
-
if (w < pw) {
|
|
1042
|
-
this.styles.width = w + 'px';
|
|
1043
|
-
}
|
|
1044
|
-
if (h < ph) {
|
|
1045
|
-
this.styles.height = h + 'px';
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
},
|
|
1049
|
-
isLt(file) {
|
|
1050
|
-
let flag = false;
|
|
1051
|
-
let flieArr = file.name.split('.');
|
|
1052
|
-
let suffix = '.' + flieArr[flieArr.length - 1].toLowerCase();
|
|
1053
|
-
if (this.accepts) {
|
|
1054
|
-
let accepts = this.accepts.toLowerCase().split(',');
|
|
1055
|
-
flag = accepts.includes(suffix);
|
|
1056
|
-
if (!flag) {
|
|
1057
|
-
this.$message.error(`文件类型错误,请上传${this.accepts}类型文件!`);
|
|
1058
|
-
return flag;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
let size = this._size;
|
|
1062
|
-
let text = '单个附件';
|
|
1063
|
-
let se = Math.round((file.size / 1024) * 10) / 10;
|
|
1064
|
-
if (this._size === 0 && this._totalSize === 0) {
|
|
1065
|
-
flag = true;
|
|
1066
|
-
} else if (this._size > 0 && this._totalSize === 0) {
|
|
1067
|
-
flag = se < this._size;
|
|
1068
|
-
size = this._size;
|
|
1069
|
-
text = '单个附件';
|
|
1070
|
-
} else if (this._size === 0 && this._totalSize > 0) {
|
|
1071
|
-
flag = this.filesTotalSize + se < this._totalSize;
|
|
1072
|
-
size = this._totalSize;
|
|
1073
|
-
text = '附件总';
|
|
1074
|
-
} else {
|
|
1075
|
-
flag = se < this._size && this.filesTotalSize + se < this._totalSize;
|
|
1076
|
-
if (se < this._size) {
|
|
1077
|
-
size = this._size;
|
|
1078
|
-
text = '单个附件';
|
|
1079
|
-
} else {
|
|
1080
|
-
size = this._totalSize;
|
|
1081
|
-
text = '附件总';
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
if (!flag) {
|
|
1085
|
-
this.$message.error(`上传${text}大小不能超过${size}KB!`);
|
|
1086
|
-
return flag;
|
|
1087
|
-
}
|
|
1088
|
-
return flag;
|
|
1089
|
-
},
|
|
1090
|
-
handleBeforeUpload(file) {
|
|
1091
|
-
const flag = this.isLt(file);
|
|
1092
|
-
if (this.portrait) {
|
|
1093
|
-
if (flag && this.beforeUpload) {
|
|
1094
|
-
return this.beforeUpload(file);
|
|
1095
|
-
}
|
|
1096
|
-
return flag;
|
|
1097
|
-
}
|
|
1098
|
-
if (this.beforeUpload) {
|
|
1099
|
-
if (flag) {
|
|
1100
|
-
return this.beforeUpload(file);
|
|
1101
|
-
}
|
|
1102
|
-
return flag;
|
|
1103
|
-
}
|
|
1104
|
-
return flag;
|
|
1105
|
-
},
|
|
1106
|
-
handleBeforeRemove(file, fileList) {
|
|
1107
|
-
if (file && (file.status === 'success' || file.status == 0)) {
|
|
1108
|
-
return this.$confirm('确定删除文件吗?', '提示', {
|
|
1109
|
-
confirmButtonText: '确定',
|
|
1110
|
-
cancelButtonText: '取消',
|
|
1111
|
-
type: 'warning'
|
|
1112
|
-
})
|
|
1113
|
-
.then(() => {
|
|
1114
|
-
if (this.beforeRemove) {
|
|
1115
|
-
return this.beforeRemove(file, fileList);
|
|
1116
|
-
} else if (file.status === 'success' || file.status == 0) {
|
|
1117
|
-
let userName =
|
|
1118
|
-
file.userName ||
|
|
1119
|
-
(file.response && file.response.userName) ||
|
|
1120
|
-
util.getStorage('userName');
|
|
1121
|
-
// eslint-disable-next-line no-undef
|
|
1122
|
-
return new Promise((resolve, reject) => {
|
|
1123
|
-
let url =
|
|
1124
|
-
typeof this.deleted === 'string'
|
|
1125
|
-
? this.deleted
|
|
1126
|
-
: this.remove === 'string'
|
|
1127
|
-
? this.remove
|
|
1128
|
-
: this.dochubConfig.deleteDocumentUrl || delAdjunct;
|
|
1129
|
-
util
|
|
1130
|
-
.ajax({
|
|
1131
|
-
method: this.method,
|
|
1132
|
-
url: url,
|
|
1133
|
-
data: {
|
|
1134
|
-
userName: userName,
|
|
1135
|
-
documentId: file.adjunctId || file.response.adjunctId,
|
|
1136
|
-
id: file.adjunctId || file.response.adjunctId
|
|
1137
|
-
},
|
|
1138
|
-
params: {
|
|
1139
|
-
userName: userName,
|
|
1140
|
-
documentId: file.adjunctId || file.response.adjunctId,
|
|
1141
|
-
id: file.adjunctId || file.response.adjunctId
|
|
1142
|
-
}
|
|
1143
|
-
})
|
|
1144
|
-
.then((res) => {
|
|
1145
|
-
if (res.rCode === 0) {
|
|
1146
|
-
let se =
|
|
1147
|
-
this.filesTotalSize -
|
|
1148
|
-
Math.round((file.size / 1024) * 10) / 10;
|
|
1149
|
-
this.filesTotalSize = se;
|
|
1150
|
-
this.$message.success(res.msg);
|
|
1151
|
-
resolve();
|
|
1152
|
-
} else {
|
|
1153
|
-
let msg = res.msg || '系统错误,请联系管理员!';
|
|
1154
|
-
this.$message.error(msg);
|
|
1155
|
-
reject();
|
|
1156
|
-
}
|
|
1157
|
-
})
|
|
1158
|
-
.catch((err) => {
|
|
1159
|
-
if (err.message && err.message !== 'canceled') {
|
|
1160
|
-
this.$message.error(err.message);
|
|
1161
|
-
}
|
|
1162
|
-
});
|
|
1163
|
-
});
|
|
1164
|
-
}
|
|
1165
|
-
return true;
|
|
1166
|
-
})
|
|
1167
|
-
.catch(() => {
|
|
1168
|
-
return flag;
|
|
1169
|
-
});
|
|
1170
|
-
}
|
|
1171
|
-
},
|
|
1172
|
-
handleDownloads() {
|
|
1173
|
-
let url =
|
|
1174
|
-
typeof this.downloads === 'string'
|
|
1175
|
-
? this.downloads
|
|
1176
|
-
: this.dochubConfig.compressDownloadDocumentUrl || uploadDownloads;
|
|
1177
|
-
util.win.open(
|
|
1178
|
-
this.host +
|
|
1179
|
-
url +
|
|
1180
|
-
'?ownId=' +
|
|
1181
|
-
this.ownId +
|
|
1182
|
-
'&code=' +
|
|
1183
|
-
this.code +
|
|
1184
|
-
(this.extendCode ? '&extendCode=' + this.extendCode : '') +
|
|
1185
|
-
'&businessId=' +
|
|
1186
|
-
this.ownId +
|
|
1187
|
-
'&fileName=文档.zip' +
|
|
1188
|
-
'&bucketCode=' +
|
|
1189
|
-
this.code
|
|
1190
|
-
);
|
|
1191
|
-
},
|
|
1192
|
-
handleDownload(file) {
|
|
1193
|
-
if (file.status === 'success' || file.status == 0) {
|
|
1194
|
-
let url =
|
|
1195
|
-
typeof this.download === 'string'
|
|
1196
|
-
? this.download
|
|
1197
|
-
: this.dochubConfig.downloadDocumentUrl || downloadByAdjunctId;
|
|
1198
|
-
util.win.open(
|
|
1199
|
-
this.host +
|
|
1200
|
-
url +
|
|
1201
|
-
'?adjunctId=' +
|
|
1202
|
-
(file.adjunctId || file.response.adjunctId) +
|
|
1203
|
-
'&documentId=' +
|
|
1204
|
-
(file.adjunctId || file.response.adjunctId)
|
|
1205
|
-
);
|
|
1206
|
-
} else {
|
|
1207
|
-
this.aLinkDownload(file);
|
|
1208
|
-
}
|
|
1209
|
-
},
|
|
1210
|
-
handleClick(res) {
|
|
1211
|
-
if (res.event && typeof res.event === 'function') {
|
|
1212
|
-
res.event(res);
|
|
1213
|
-
} else {
|
|
1214
|
-
this.$emit('click', res);
|
|
1215
|
-
}
|
|
1216
|
-
},
|
|
1217
|
-
aLinkDownload(file) {
|
|
1218
|
-
var a = document.createElement('a');
|
|
1219
|
-
let event = new MouseEvent('click');
|
|
1220
|
-
a.href = URL.createObjectURL(file.raw);
|
|
1221
|
-
a.download = file.name;
|
|
1222
|
-
a.dispatchEvent(event);
|
|
1223
|
-
},
|
|
1224
|
-
handleSort(files) {
|
|
1225
|
-
if (this.isSort) {
|
|
1226
|
-
if (this.onSort) {
|
|
1227
|
-
this.onSort(files);
|
|
1228
|
-
} else {
|
|
1229
|
-
let ids = files.map((item) => {
|
|
1230
|
-
if (item.status === 'success' || item.status == 0) {
|
|
1231
|
-
return item.adjunctId || item.response.adjunctId;
|
|
1232
|
-
}
|
|
1233
|
-
});
|
|
1234
|
-
ids = ids.join(',');
|
|
1235
|
-
util
|
|
1236
|
-
.ajax({
|
|
1237
|
-
method: this.method,
|
|
1238
|
-
url: this.dochubConfig.sortDocumentsUrl || uploadSort,
|
|
1239
|
-
data: {
|
|
1240
|
-
ids: ids,
|
|
1241
|
-
documentIds: ids,
|
|
1242
|
-
ownId: this.ownId,
|
|
1243
|
-
code: this.code,
|
|
1244
|
-
bucketCode: this.code,
|
|
1245
|
-
businessId: this.ownId
|
|
1246
|
-
},
|
|
1247
|
-
params: {
|
|
1248
|
-
ids: ids,
|
|
1249
|
-
documentIds: ids,
|
|
1250
|
-
ownId: this.ownId,
|
|
1251
|
-
code: this.code,
|
|
1252
|
-
bucketCode: this.code,
|
|
1253
|
-
businessId: this.ownId
|
|
1254
|
-
}
|
|
1255
|
-
})
|
|
1256
|
-
.then((res) => {
|
|
1257
|
-
if (res.rCode === 0) {
|
|
1258
|
-
this.$message.success(res.msg);
|
|
1259
|
-
} else {
|
|
1260
|
-
let msg = res.msg || '系统错误,请联系管理员!';
|
|
1261
|
-
this.$message.error(msg);
|
|
1262
|
-
}
|
|
1263
|
-
})
|
|
1264
|
-
.catch((err) => {
|
|
1265
|
-
if (err.message && err.message !== 'canceled') {
|
|
1266
|
-
this.$message.error(err.message);
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
},
|
|
1272
|
-
handleSuccess(response, file, fileList) {
|
|
1273
|
-
if (this.portrait) {
|
|
1274
|
-
this.image = URL.createObjectURL(file.raw);
|
|
1275
|
-
}
|
|
1276
|
-
if (this.showMessage.success) {
|
|
1277
|
-
if (response.rCode) {
|
|
1278
|
-
if (this.dangerouslyUseHTMLString) {
|
|
1279
|
-
this.$alert(
|
|
1280
|
-
response.msg ? response.msg : '上传失败:请联系管理员',
|
|
1281
|
-
'提示',
|
|
1282
|
-
{
|
|
1283
|
-
dangerouslyUseHTMLString: true,
|
|
1284
|
-
setHeight: response.msg
|
|
1285
|
-
}
|
|
1286
|
-
).catch();
|
|
1287
|
-
} else {
|
|
1288
|
-
this.$message({
|
|
1289
|
-
type: 'error',
|
|
1290
|
-
message: response.msg || '成功!'
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
} else {
|
|
1294
|
-
this.$message.success(response.msg);
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
let se =
|
|
1298
|
-
this.filesTotalSize +
|
|
1299
|
-
(this.resultFile ? Math.round((file.size / 1024) * 10) / 10 : 0);
|
|
1300
|
-
this.filesTotalSize = se;
|
|
1301
|
-
this.onSuccess &&
|
|
1302
|
-
this.onSuccess(response, file, fileList, this.dochubConfig);
|
|
1303
|
-
this.$emit('success', response, file, fileList, this.dochubConfig);
|
|
1304
|
-
if (this.resultFile) {
|
|
1305
|
-
if (this.portrait) {
|
|
1306
|
-
this.$emit('input', file);
|
|
1307
|
-
} else {
|
|
1308
|
-
this.$emit('input', fileList);
|
|
1309
|
-
}
|
|
1310
|
-
if (this.elForm) {
|
|
1311
|
-
this.elForm.clearValidate(this.name);
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
},
|
|
1315
|
-
handleChange(file, fileList) {
|
|
1316
|
-
this.$emit('change', fileList);
|
|
1317
|
-
this.onChange && this.onChange(file, fileList);
|
|
1318
|
-
},
|
|
1319
|
-
handleRemove(file, fileList) {
|
|
1320
|
-
this.$emit('input', fileList.length ? fileList : '');
|
|
1321
|
-
this.$emit('remove', file, fileList);
|
|
1322
|
-
this.$emit('change', fileList);
|
|
1323
|
-
this.onRemove && this.onRemove(file, fileList);
|
|
1324
|
-
},
|
|
1325
|
-
handleError(err, file, fileList) {
|
|
1326
|
-
if (this.showMessage.error) {
|
|
1327
|
-
if (this.dangerouslyUseHTMLString) {
|
|
1328
|
-
this.$alert(err.msg ? err.msg : '上传失败:请联系管理员', '提示', {
|
|
1329
|
-
dangerouslyUseHTMLString: true,
|
|
1330
|
-
setHeight: err.msg
|
|
1331
|
-
}).catch();
|
|
1332
|
-
} else {
|
|
1333
|
-
this.$message({
|
|
1334
|
-
type: 'error',
|
|
1335
|
-
message: '上传失败:' + (err.msg ? err.msg : '请联系管理员')
|
|
1336
|
-
});
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
this.$emit('error', err, file, fileList);
|
|
1340
|
-
this.onError && this.onError(err, file, fileList);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
};
|
|
1344
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<el-upload
|
|
3
|
+
v-if="isRender && uploadUrl"
|
|
4
|
+
ref="upload"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
class="es-upload"
|
|
7
|
+
:portrait="portrait"
|
|
8
|
+
:list-type="listType"
|
|
9
|
+
:wait="1000"
|
|
10
|
+
:height="boxHeight"
|
|
11
|
+
:multiple="portrait ? false : multiple"
|
|
12
|
+
:action="uploadUrl"
|
|
13
|
+
:show-file-list="showList"
|
|
14
|
+
:file-list="lists"
|
|
15
|
+
:result-file="resultFile"
|
|
16
|
+
:disabled="isDisabled || isReadonly"
|
|
17
|
+
:readonly="isReadonly"
|
|
18
|
+
:class="[
|
|
19
|
+
{
|
|
20
|
+
'es-avatar-uploader': portrait && !$slots.default,
|
|
21
|
+
'es-upload-readonly': isReadonly && !downloads
|
|
22
|
+
},
|
|
23
|
+
'es-upload-' + listType
|
|
24
|
+
]"
|
|
25
|
+
:previewAdjunct="host + previewAdjunct"
|
|
26
|
+
:headers="headers"
|
|
27
|
+
:data="datas"
|
|
28
|
+
:show-info="showList ? showInfo : undefined"
|
|
29
|
+
:auto-upload="autoUpload"
|
|
30
|
+
:response="true"
|
|
31
|
+
:operate="operate"
|
|
32
|
+
:accept="accepts"
|
|
33
|
+
:drag-sort="isSort"
|
|
34
|
+
:preview="preview"
|
|
35
|
+
:exclude="excludes"
|
|
36
|
+
:download="isDownload"
|
|
37
|
+
:deleted="isRemove"
|
|
38
|
+
:fileIcons="_icons"
|
|
39
|
+
:picture="_picture"
|
|
40
|
+
:before-upload="handleBeforeUpload"
|
|
41
|
+
:before-remove="handleBeforeRemove"
|
|
42
|
+
:on-preview="handlePreview"
|
|
43
|
+
:on-downloads="handleDownloads"
|
|
44
|
+
:on-download="handleDownload"
|
|
45
|
+
:on-sort="handleSort"
|
|
46
|
+
:on-success="handleSuccess"
|
|
47
|
+
:on-change="handleChange"
|
|
48
|
+
:on-remove="handleRemove"
|
|
49
|
+
:on-error="handleError"
|
|
50
|
+
>
|
|
51
|
+
<template v-if="prepend">
|
|
52
|
+
<template v-if="Array.isArray(prepend)">
|
|
53
|
+
<el-button
|
|
54
|
+
v-for="(item, index) in prepend"
|
|
55
|
+
v-bind="{ ...item, size: btnSize }"
|
|
56
|
+
:key="index"
|
|
57
|
+
@click.stop="handleClick(item)"
|
|
58
|
+
>
|
|
59
|
+
{{ item.label || item.text }}
|
|
60
|
+
</el-button>
|
|
61
|
+
</template>
|
|
62
|
+
<el-button
|
|
63
|
+
v-else
|
|
64
|
+
v-bind="{ ...prepend, size: btnSize }"
|
|
65
|
+
@click.stop="handleClick(prepend)"
|
|
66
|
+
>
|
|
67
|
+
{{ prepend.label || prepend.text }}
|
|
68
|
+
</el-button>
|
|
69
|
+
</template>
|
|
70
|
+
<slot>
|
|
71
|
+
<expand-dom v-if="render" :render="render"></expand-dom>
|
|
72
|
+
<template v-else>
|
|
73
|
+
<template v-if="portrait">
|
|
74
|
+
<img
|
|
75
|
+
v-if="profile"
|
|
76
|
+
:src="profile"
|
|
77
|
+
class="avatar"
|
|
78
|
+
:style="{ width: width, height: height }"
|
|
79
|
+
/>
|
|
80
|
+
<i
|
|
81
|
+
v-else
|
|
82
|
+
class="avatar-uploader-icon"
|
|
83
|
+
:class="{ 'el-icon-plus': !isReadonly, 'is-disabled': isDisabled }"
|
|
84
|
+
:style="{ width: width, height: height, lineHeight: height }"
|
|
85
|
+
></i>
|
|
86
|
+
</template>
|
|
87
|
+
<template v-else>
|
|
88
|
+
<template v-if="!isReadonly">
|
|
89
|
+
<i
|
|
90
|
+
class="el-icon-plus es-uploader-icon"
|
|
91
|
+
:class="{ 'is-disabled': isDisabled }"
|
|
92
|
+
v-if="selectType === 'icon-plus'"
|
|
93
|
+
></i>
|
|
94
|
+
<el-button
|
|
95
|
+
v-else
|
|
96
|
+
class="es-upload-button"
|
|
97
|
+
:class="icon"
|
|
98
|
+
:type="selectType"
|
|
99
|
+
:size="btnSize"
|
|
100
|
+
:disabled="isDisabled"
|
|
101
|
+
>{{
|
|
102
|
+
text ? text : autoUpload ? '点击上传' : '选择文件'
|
|
103
|
+
}}</el-button
|
|
104
|
+
>
|
|
105
|
+
<el-button
|
|
106
|
+
class="es-upload-button"
|
|
107
|
+
v-if="!autoUpload"
|
|
108
|
+
:type="uploadType"
|
|
109
|
+
:size="btnSize"
|
|
110
|
+
:disabled="isDisabled"
|
|
111
|
+
@click.stop="handleUpload"
|
|
112
|
+
>
|
|
113
|
+
上传文件
|
|
114
|
+
</el-button>
|
|
115
|
+
</template>
|
|
116
|
+
<el-button
|
|
117
|
+
v-if="showFileList && isDownloads"
|
|
118
|
+
slot="handle"
|
|
119
|
+
class="es-upload-button es-upload-downloads"
|
|
120
|
+
:size="btnSize"
|
|
121
|
+
@click.stop="handleDownloads"
|
|
122
|
+
>
|
|
123
|
+
批量下载
|
|
124
|
+
</el-button>
|
|
125
|
+
</template>
|
|
126
|
+
</template>
|
|
127
|
+
</slot>
|
|
128
|
+
<template v-if="append">
|
|
129
|
+
<template v-if="Array.isArray(append)">
|
|
130
|
+
<el-button
|
|
131
|
+
v-for="(item, index) in append"
|
|
132
|
+
v-bind="{ ...item, size: btnSize }"
|
|
133
|
+
:key="index"
|
|
134
|
+
@click.stop="handleClick(item)"
|
|
135
|
+
>
|
|
136
|
+
{{ item.label || item.text }}
|
|
137
|
+
</el-button>
|
|
138
|
+
</template>
|
|
139
|
+
<el-button
|
|
140
|
+
v-else
|
|
141
|
+
v-bind="{ ...append, size: btnSize }"
|
|
142
|
+
@click.stop="handleClick(append)"
|
|
143
|
+
>
|
|
144
|
+
{{ append.label || append.text }}
|
|
145
|
+
</el-button>
|
|
146
|
+
</template>
|
|
147
|
+
<template slot="tip">
|
|
148
|
+
<slot name="tip">
|
|
149
|
+
<div v-if="tips" class="el-upload__tip">{{ tips }}</div>
|
|
150
|
+
</slot>
|
|
151
|
+
</template>
|
|
152
|
+
<el-image-viewer
|
|
153
|
+
slot="dialog"
|
|
154
|
+
v-if="previewScale && showImg"
|
|
155
|
+
:z-index="9999"
|
|
156
|
+
:initial-index="0"
|
|
157
|
+
:url-list="[imgUrl]"
|
|
158
|
+
:on-close="closeViewer"
|
|
159
|
+
></el-image-viewer>
|
|
160
|
+
<es-dialog v-else :title="title" :visible.sync="showImg" slot="dialog">
|
|
161
|
+
<div
|
|
162
|
+
v-loading="imgChange"
|
|
163
|
+
element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
164
|
+
class="es-upload-dialog"
|
|
165
|
+
>
|
|
166
|
+
<img v-show="!imgChange" ref="showImg" :src="imgUrl" :style="styles" />
|
|
167
|
+
</div>
|
|
168
|
+
</es-dialog>
|
|
169
|
+
<es-dialog :title="title" :visible.sync="showVideo" slot="dialog">
|
|
170
|
+
<es-player
|
|
171
|
+
autoplay
|
|
172
|
+
type="video/mp4"
|
|
173
|
+
:is-pause="!showVideo"
|
|
174
|
+
:source="source"
|
|
175
|
+
></es-player>
|
|
176
|
+
</es-dialog>
|
|
177
|
+
</el-upload>
|
|
178
|
+
</template>
|
|
179
|
+
<script>
|
|
180
|
+
import {
|
|
181
|
+
getAdjunctProperties,
|
|
182
|
+
uploads,
|
|
183
|
+
uploadOnlyOne,
|
|
184
|
+
getAdjunctFileInfos,
|
|
185
|
+
uploadDownloads,
|
|
186
|
+
previewAdjunctOffice,
|
|
187
|
+
previewAdjunct,
|
|
188
|
+
previewAdjunct2,
|
|
189
|
+
uploadSort,
|
|
190
|
+
delAdjunct,
|
|
191
|
+
downloadByAdjunctId
|
|
192
|
+
} from 'eoss-ui/src/config/api.js';
|
|
193
|
+
import { debounce } from 'throttle-debounce';
|
|
194
|
+
import util from 'eoss-ui/src/utils/util.js';
|
|
195
|
+
import picture from './picture.js';
|
|
196
|
+
import store from 'eoss-ui/src/utils/store';
|
|
197
|
+
import { Base64 } from 'js-base64';
|
|
198
|
+
export default {
|
|
199
|
+
name: 'EsUpload',
|
|
200
|
+
components: {
|
|
201
|
+
expandDom: {
|
|
202
|
+
functional: true,
|
|
203
|
+
props: {
|
|
204
|
+
render: [Function, String]
|
|
205
|
+
},
|
|
206
|
+
render: (h, ctx) => {
|
|
207
|
+
if (typeof ctx.props.render == 'string') {
|
|
208
|
+
try {
|
|
209
|
+
return util.toFunction(ctx.props.render)(h, params);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return ctx.props.render(h);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
inheritAttrs: false,
|
|
219
|
+
inject: {
|
|
220
|
+
elForm: {
|
|
221
|
+
default: ''
|
|
222
|
+
},
|
|
223
|
+
elFormItem: {
|
|
224
|
+
default: ''
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
props: {
|
|
228
|
+
prepend: [Array, Object],
|
|
229
|
+
append: [Array, Object],
|
|
230
|
+
render: Function,
|
|
231
|
+
template: String,
|
|
232
|
+
value: [String, Array, Object],
|
|
233
|
+
name: String,
|
|
234
|
+
method: {
|
|
235
|
+
type: String,
|
|
236
|
+
default: 'get'
|
|
237
|
+
},
|
|
238
|
+
text: String,
|
|
239
|
+
icon: {
|
|
240
|
+
type: Boolean,
|
|
241
|
+
default: true
|
|
242
|
+
},
|
|
243
|
+
headers: Object,
|
|
244
|
+
listType: {
|
|
245
|
+
type: String,
|
|
246
|
+
default: 'table' // text,table,picture,picture-card
|
|
247
|
+
},
|
|
248
|
+
operate: {
|
|
249
|
+
type: Boolean,
|
|
250
|
+
default: true
|
|
251
|
+
},
|
|
252
|
+
accept: String,
|
|
253
|
+
// 附件code
|
|
254
|
+
code: String,
|
|
255
|
+
// 业务id
|
|
256
|
+
ownId: String,
|
|
257
|
+
//附件文档id
|
|
258
|
+
documentId: String,
|
|
259
|
+
requiredOwnId: {
|
|
260
|
+
type: Boolean,
|
|
261
|
+
default: true
|
|
262
|
+
},
|
|
263
|
+
//
|
|
264
|
+
downloads: {
|
|
265
|
+
type: Boolean,
|
|
266
|
+
default: false
|
|
267
|
+
},
|
|
268
|
+
// 附件扩展编码
|
|
269
|
+
extendCode: String,
|
|
270
|
+
// 是否添加文件md5值
|
|
271
|
+
fileMd5: {
|
|
272
|
+
type: Boolean,
|
|
273
|
+
default: false
|
|
274
|
+
},
|
|
275
|
+
// 额外的参数
|
|
276
|
+
data: {
|
|
277
|
+
type: Object,
|
|
278
|
+
default() {
|
|
279
|
+
return {};
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
param: {
|
|
283
|
+
type: Object,
|
|
284
|
+
default() {
|
|
285
|
+
return {};
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
// 单文件大小
|
|
289
|
+
size: Number,
|
|
290
|
+
totalSize: Number,
|
|
291
|
+
// 是否头像模式上传
|
|
292
|
+
portrait: {
|
|
293
|
+
type: Boolean,
|
|
294
|
+
default: false
|
|
295
|
+
},
|
|
296
|
+
photo: [String, Boolean],
|
|
297
|
+
//头像按钮框宽度
|
|
298
|
+
width: String,
|
|
299
|
+
//头像按钮框高度度
|
|
300
|
+
height: String,
|
|
301
|
+
// 自定义的文字提示
|
|
302
|
+
tips: {
|
|
303
|
+
type: String,
|
|
304
|
+
default: ''
|
|
305
|
+
},
|
|
306
|
+
dragSort: {
|
|
307
|
+
type: Boolean,
|
|
308
|
+
default: false
|
|
309
|
+
},
|
|
310
|
+
// 上传成功后绑定到file的内容
|
|
311
|
+
showInfo: {
|
|
312
|
+
type: Array,
|
|
313
|
+
default() {
|
|
314
|
+
return [
|
|
315
|
+
{ label: '上传时间', field: 'uploadTime', width: 170 },
|
|
316
|
+
{ label: '大小', field: 'fileSize', width: 100 },
|
|
317
|
+
{ label: '上传人', field: 'userName', width: 100 }
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
// 上传地址
|
|
322
|
+
action: String,
|
|
323
|
+
// 自动上传
|
|
324
|
+
autoUpload: {
|
|
325
|
+
type: Boolean,
|
|
326
|
+
default: true
|
|
327
|
+
},
|
|
328
|
+
// 是否支持多选文件
|
|
329
|
+
multiple: {
|
|
330
|
+
type: Boolean,
|
|
331
|
+
default: true
|
|
332
|
+
},
|
|
333
|
+
// 显示文件列表
|
|
334
|
+
showFileList: {
|
|
335
|
+
type: Boolean,
|
|
336
|
+
default: true
|
|
337
|
+
},
|
|
338
|
+
// 上传的文件列表
|
|
339
|
+
fileList: [Array, String],
|
|
340
|
+
requestFiles: {
|
|
341
|
+
type: Boolean,
|
|
342
|
+
default: true
|
|
343
|
+
},
|
|
344
|
+
filesParam: {
|
|
345
|
+
type: Object,
|
|
346
|
+
default() {
|
|
347
|
+
return {};
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
state: {
|
|
351
|
+
type: Number,
|
|
352
|
+
default: 1
|
|
353
|
+
},
|
|
354
|
+
selectType: {
|
|
355
|
+
type: String,
|
|
356
|
+
default: 'primary'
|
|
357
|
+
},
|
|
358
|
+
uploadType: {
|
|
359
|
+
type: String,
|
|
360
|
+
default: 'success'
|
|
361
|
+
},
|
|
362
|
+
host: {
|
|
363
|
+
type: String,
|
|
364
|
+
default() {
|
|
365
|
+
return util.getStorage('host') ? util.getStorage('host') : '';
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
message: Object,
|
|
369
|
+
btnSize: {
|
|
370
|
+
type: String,
|
|
371
|
+
default: 'medium'
|
|
372
|
+
},
|
|
373
|
+
// 只读
|
|
374
|
+
readonly: {
|
|
375
|
+
type: Boolean,
|
|
376
|
+
default: false
|
|
377
|
+
},
|
|
378
|
+
disabled: Boolean,
|
|
379
|
+
preview: { type: [Boolean, String], default: true },
|
|
380
|
+
exclude: String,
|
|
381
|
+
download: { type: [Boolean, String], default: true },
|
|
382
|
+
deleted: { type: [Boolean, String], default: true },
|
|
383
|
+
remove: { type: [Boolean, String], default: true },
|
|
384
|
+
beforeUpload: Function,
|
|
385
|
+
onPreview: Function,
|
|
386
|
+
// 文件列表排序
|
|
387
|
+
onSort: Function,
|
|
388
|
+
beforeRemove: Function,
|
|
389
|
+
onDownloads: Function,
|
|
390
|
+
onDownload: Function,
|
|
391
|
+
onSort: Function,
|
|
392
|
+
onSuccess: Function,
|
|
393
|
+
onChange: Function,
|
|
394
|
+
onRemove: Function,
|
|
395
|
+
onError: Function,
|
|
396
|
+
dangerouslyUseHTMLString: Boolean,
|
|
397
|
+
fileCount: Number,
|
|
398
|
+
listHeight: String,
|
|
399
|
+
display: Boolean,
|
|
400
|
+
resultFile: {
|
|
401
|
+
type: Boolean,
|
|
402
|
+
default: true
|
|
403
|
+
},
|
|
404
|
+
properties: {
|
|
405
|
+
type: String,
|
|
406
|
+
default() {
|
|
407
|
+
return getAdjunctProperties;
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
fileIcons: {
|
|
411
|
+
type: Object,
|
|
412
|
+
default() {
|
|
413
|
+
return {};
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
picture: {
|
|
417
|
+
type: Object,
|
|
418
|
+
default() {
|
|
419
|
+
return {};
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
previewScale: {
|
|
423
|
+
type: Boolean,
|
|
424
|
+
default: true
|
|
425
|
+
},
|
|
426
|
+
useCaseCode: String
|
|
427
|
+
},
|
|
428
|
+
data() {
|
|
429
|
+
return {
|
|
430
|
+
uploadUrl: this.action,
|
|
431
|
+
lists: [],
|
|
432
|
+
image: '',
|
|
433
|
+
fileAccept: '',
|
|
434
|
+
fileSize: 0,
|
|
435
|
+
fileTotalSize: 0,
|
|
436
|
+
filesTotalSize: 0,
|
|
437
|
+
showImg: false,
|
|
438
|
+
imgChange: false,
|
|
439
|
+
title: '',
|
|
440
|
+
imgUrl: '',
|
|
441
|
+
styles: {},
|
|
442
|
+
showVideo: false,
|
|
443
|
+
videoChange: false,
|
|
444
|
+
source: '',
|
|
445
|
+
excludeNames: '',
|
|
446
|
+
boxHeight: this.listHeight,
|
|
447
|
+
previewAdjunct: previewAdjunct,
|
|
448
|
+
kkfileview: null,
|
|
449
|
+
dochubConfig: {}
|
|
450
|
+
};
|
|
451
|
+
},
|
|
452
|
+
computed: {
|
|
453
|
+
isRender() {
|
|
454
|
+
let useCaseCodes = util.getStorage('useCaseCodes');
|
|
455
|
+
if (useCaseCodes && this.useCaseCode) {
|
|
456
|
+
return useCaseCodes.indexOf(this.useCaseCode) > -1;
|
|
457
|
+
}
|
|
458
|
+
return true;
|
|
459
|
+
},
|
|
460
|
+
_icons() {
|
|
461
|
+
return {
|
|
462
|
+
ppt: 'es-icon-ppt',
|
|
463
|
+
png: 'es-icon-tupian',
|
|
464
|
+
gif: 'es-icon-tupian',
|
|
465
|
+
jpg: 'es-icon-tupian',
|
|
466
|
+
jpeg: 'es-icon-tupian',
|
|
467
|
+
xls: 'es-icon-excel',
|
|
468
|
+
xlsx: 'es-icon-excel',
|
|
469
|
+
docx: 'es-icon-word',
|
|
470
|
+
doc: 'es-icon-word',
|
|
471
|
+
rar: 'es-icon-zip',
|
|
472
|
+
zip: 'es-icon-zip',
|
|
473
|
+
txt: 'es-icon-txt',
|
|
474
|
+
ipa: 'es-icon-ios',
|
|
475
|
+
apk: 'es-icon-android',
|
|
476
|
+
mp4: 'es-icon-video',
|
|
477
|
+
avi: 'es-icon-video',
|
|
478
|
+
mp3: 'es-icon-audioo',
|
|
479
|
+
wma: 'es-icon-audioo',
|
|
480
|
+
pdf: 'es-icon-pdf',
|
|
481
|
+
...this.fileIcons
|
|
482
|
+
};
|
|
483
|
+
},
|
|
484
|
+
_picture() {
|
|
485
|
+
return {
|
|
486
|
+
...picture,
|
|
487
|
+
...this.picture
|
|
488
|
+
};
|
|
489
|
+
},
|
|
490
|
+
show() {
|
|
491
|
+
if ((this.photo && typeof this.photo === 'string') || this.value) {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
return this.showFileList;
|
|
495
|
+
},
|
|
496
|
+
excludes() {
|
|
497
|
+
return this.exclude ? this.exclude : this.excludeNames;
|
|
498
|
+
},
|
|
499
|
+
accepts() {
|
|
500
|
+
return this.accept
|
|
501
|
+
? this.accept
|
|
502
|
+
: this.fileAccept
|
|
503
|
+
? this.fileAccept
|
|
504
|
+
: this.portrait
|
|
505
|
+
? 'image/*'
|
|
506
|
+
: undefined;
|
|
507
|
+
},
|
|
508
|
+
_size() {
|
|
509
|
+
return this.size ? this.size : this.fileSize ? this.fileSize : 0;
|
|
510
|
+
},
|
|
511
|
+
_totalSize() {
|
|
512
|
+
return this.totalSize
|
|
513
|
+
? this.totalSize
|
|
514
|
+
: this.fileTotalSize
|
|
515
|
+
? this.fileTotalSize
|
|
516
|
+
: 0;
|
|
517
|
+
},
|
|
518
|
+
getAdjunctFileInfos() {
|
|
519
|
+
return typeof this.fileList === 'string'
|
|
520
|
+
? this.fileList
|
|
521
|
+
: getAdjunctFileInfos;
|
|
522
|
+
},
|
|
523
|
+
showList() {
|
|
524
|
+
return this.portrait ? false : this.showFileList;
|
|
525
|
+
},
|
|
526
|
+
isDownloads() {
|
|
527
|
+
return this.downloads;
|
|
528
|
+
},
|
|
529
|
+
isDownload() {
|
|
530
|
+
if (this.download) {
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
return false;
|
|
534
|
+
},
|
|
535
|
+
isDisabled() {
|
|
536
|
+
return this.disabled || (this.elForm || {}).disabled;
|
|
537
|
+
},
|
|
538
|
+
isReadonly() {
|
|
539
|
+
return this.readonly || (this.elForm || {}).readonly;
|
|
540
|
+
},
|
|
541
|
+
isRemove() {
|
|
542
|
+
if (this.remove == false || this.deleted == false) {
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
return true;
|
|
546
|
+
},
|
|
547
|
+
isSort() {
|
|
548
|
+
// return this.dragSort && !this.isDisabled && this.isReadonly;
|
|
549
|
+
return this.dragSort && !this.isDisabled;
|
|
550
|
+
},
|
|
551
|
+
datas() {
|
|
552
|
+
if (this.data) {
|
|
553
|
+
return util.extend({}, this.data, this.params);
|
|
554
|
+
}
|
|
555
|
+
return this.params;
|
|
556
|
+
},
|
|
557
|
+
params() {
|
|
558
|
+
let params = { userId: util.getStorage('userId'), ...this.param };
|
|
559
|
+
if (this.code !== undefined) {
|
|
560
|
+
params.code = this.code;
|
|
561
|
+
params.bucketCode = this.code;
|
|
562
|
+
}
|
|
563
|
+
if (this.ownId !== undefined) {
|
|
564
|
+
params.ownId = this.ownId;
|
|
565
|
+
params.businessId = this.ownId;
|
|
566
|
+
}
|
|
567
|
+
return params;
|
|
568
|
+
},
|
|
569
|
+
showMessage() {
|
|
570
|
+
if (this.message !== undefined) {
|
|
571
|
+
return util.extend({}, { success: true, error: true }, this.message);
|
|
572
|
+
}
|
|
573
|
+
return { success: true, error: true };
|
|
574
|
+
},
|
|
575
|
+
profile() {
|
|
576
|
+
const previewAdjunct =
|
|
577
|
+
this.dochubConfig.downloadDocumentUrl || this.previewAdjunct;
|
|
578
|
+
if (this.image) {
|
|
579
|
+
if (typeof this.image === 'string') {
|
|
580
|
+
return this.image;
|
|
581
|
+
}
|
|
582
|
+
return `${this.host}${previewAdjunct}?documentId=${
|
|
583
|
+
this.image.adjunctId
|
|
584
|
+
}&adjunctId=${this.image.adjunctId}&_tt=${new Date().getTime()}`;
|
|
585
|
+
}
|
|
586
|
+
if (this.value) {
|
|
587
|
+
if (typeof this.value === 'string') {
|
|
588
|
+
if (this.value.indexOf('data:image/') === 0) {
|
|
589
|
+
return this.value;
|
|
590
|
+
} else if (this.value.indexOf(previewAdjunct) > -1) {
|
|
591
|
+
let val =
|
|
592
|
+
this.host +
|
|
593
|
+
util.jointUrl({
|
|
594
|
+
url: this.value,
|
|
595
|
+
reg: '/main2'
|
|
596
|
+
});
|
|
597
|
+
return val;
|
|
598
|
+
} else if (this.value.indexOf('/') === -1) {
|
|
599
|
+
return `${this.host}${previewAdjunct}?documentId=${
|
|
600
|
+
this.value
|
|
601
|
+
}&adjunctId=${this.value}&_tt=${new Date().getTime()}`;
|
|
602
|
+
}
|
|
603
|
+
return this.value;
|
|
604
|
+
} else if (Array.isArray(this.value)) {
|
|
605
|
+
let adjunctId = this.value[0].response
|
|
606
|
+
? this.value[0].response.adjunctId
|
|
607
|
+
: this.value[0].adjunctId;
|
|
608
|
+
return `${
|
|
609
|
+
this.host
|
|
610
|
+
}${previewAdjunct}?documentId=${adjunctId}&adjunctId=${adjunctId}&_tt=${new Date().getTime()}`;
|
|
611
|
+
} else {
|
|
612
|
+
let adjunctId = this.value.response
|
|
613
|
+
? this.value.response.adjunctId
|
|
614
|
+
: this.value.adjunctId;
|
|
615
|
+
return `${
|
|
616
|
+
this.host
|
|
617
|
+
}${previewAdjunct}?documentId=${adjunctId}&adjunctId=${adjunctId}&_tt=${new Date().getTime()}`;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (this.photo && typeof this.photo === 'string') {
|
|
621
|
+
if (this.photo.indexOf('data:image/') === 0) {
|
|
622
|
+
return this.photo;
|
|
623
|
+
} else if (this.photo.indexOf(previewAdjunct) > -1) {
|
|
624
|
+
let val =
|
|
625
|
+
this.host +
|
|
626
|
+
util.jointUrl({
|
|
627
|
+
url: this.value,
|
|
628
|
+
reg: '/main2'
|
|
629
|
+
});
|
|
630
|
+
return val;
|
|
631
|
+
} else if (this.photo.indexOf('/') === -1) {
|
|
632
|
+
return `${this.host}${previewAdjunct}?documentId=${
|
|
633
|
+
this.photo
|
|
634
|
+
}&adjunctId=${this.photo}&_tt=${new Date().getTime()}`;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return this.photo;
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
watch: {
|
|
641
|
+
fileList: {
|
|
642
|
+
immediate: true,
|
|
643
|
+
deep: true,
|
|
644
|
+
handler(val) {
|
|
645
|
+
if (Array.isArray(val) && val.length > 0) {
|
|
646
|
+
this.lists = val;
|
|
647
|
+
let filesTotalSize = 0;
|
|
648
|
+
val.forEach((item) => {
|
|
649
|
+
if (
|
|
650
|
+
Object.prototype.hasOwnProperty.call(item, 'fileSize') &&
|
|
651
|
+
item.fileSize
|
|
652
|
+
) {
|
|
653
|
+
filesTotalSize += parseFloat(item.fileSize, 10);
|
|
654
|
+
} else {
|
|
655
|
+
filesTotalSize += item.size
|
|
656
|
+
? Math.round((item.size / 1024) * 10) / 10
|
|
657
|
+
: 0;
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
this.filesTotalSize = filesTotalSize;
|
|
661
|
+
this.$emit('input', val);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
value: {
|
|
666
|
+
immediate: true,
|
|
667
|
+
deep: true,
|
|
668
|
+
handler(val) {
|
|
669
|
+
if (val && typeof val === 'object' && this.showFileList) {
|
|
670
|
+
if (Array.isArray(val)) {
|
|
671
|
+
this.lists = val;
|
|
672
|
+
} else {
|
|
673
|
+
this.lists = [val];
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
params: {
|
|
679
|
+
deep: true,
|
|
680
|
+
handler() {
|
|
681
|
+
this.getFiles();
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
lists: {
|
|
685
|
+
deep: true,
|
|
686
|
+
handler(val) {
|
|
687
|
+
this.$emit('update:fileCount', val.length);
|
|
688
|
+
this.$emit('getFilesAmount', val.length);
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
display(val) {
|
|
692
|
+
val && this.getHeight();
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
beforeCreate() {
|
|
696
|
+
this.getFiles = debounce(500, () => {
|
|
697
|
+
this.getFileLists();
|
|
698
|
+
});
|
|
699
|
+
this.getAdjunctPropertie = debounce(500, () => {
|
|
700
|
+
this.getAdjunctProperties();
|
|
701
|
+
});
|
|
702
|
+
},
|
|
703
|
+
created() {
|
|
704
|
+
const dochubConfig = sessionStorage.getItem('dochubConfig');
|
|
705
|
+
if (dochubConfig) {
|
|
706
|
+
this.dochubConfig = JSON.parse(dochubConfig);
|
|
707
|
+
}
|
|
708
|
+
this.getAdjunctPropertie();
|
|
709
|
+
},
|
|
710
|
+
mounted() {
|
|
711
|
+
this.$nextTick(() => {
|
|
712
|
+
this.getHeight();
|
|
713
|
+
});
|
|
714
|
+
},
|
|
715
|
+
methods: {
|
|
716
|
+
getHeight() {
|
|
717
|
+
if (this.height === 'auto') {
|
|
718
|
+
let pt =
|
|
719
|
+
parseInt(util.getStyle(this.$el.parentNode, 'padding-top'), 10) || 0;
|
|
720
|
+
let pb =
|
|
721
|
+
parseInt(util.getStyle(this.$el.parentNode, 'padding-bottom'), 10) ||
|
|
722
|
+
0;
|
|
723
|
+
let btn = this.$refs.upload
|
|
724
|
+
? this.$refs.upload.$children[0].$el.offsetHeight || 0
|
|
725
|
+
: 0;
|
|
726
|
+
this.boxHeight =
|
|
727
|
+
this.$el.parentNode.offsetHeight - pt - pb - btn + 'px';
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
//根据code获取附件参数配置
|
|
731
|
+
getAdjunctProperties() {
|
|
732
|
+
if (this.code !== undefined) {
|
|
733
|
+
let config = store.get(this.code);
|
|
734
|
+
if (config) {
|
|
735
|
+
this.fileAccept = config.accept;
|
|
736
|
+
this.fileSize = config.size;
|
|
737
|
+
this.fileTotalSize = config.totalSize;
|
|
738
|
+
if (config.dochubConfig) {
|
|
739
|
+
this.dochubConfig = config.dochubConfig;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
let url =
|
|
743
|
+
this.portrait || this.documentId
|
|
744
|
+
? this.dochubConfig.reuploadDocumentUrl || uploadOnlyOne
|
|
745
|
+
: this.dochubConfig.uploadDocumentUrl || uploads;
|
|
746
|
+
this.uploadUrl = url.indexOf(this.host) > -1 ? url : this.host + url;
|
|
747
|
+
this.requestFiles && this.getFiles();
|
|
748
|
+
} else {
|
|
749
|
+
util
|
|
750
|
+
.ajax({
|
|
751
|
+
method: this.method,
|
|
752
|
+
url: this.properties,
|
|
753
|
+
data: { code: this.code, ...this.param },
|
|
754
|
+
params: { code: this.code, ...this.param }
|
|
755
|
+
})
|
|
756
|
+
.then((res) => {
|
|
757
|
+
if (res.rCode === 0) {
|
|
758
|
+
if (res.results) {
|
|
759
|
+
this.excludeNames = res.results.excludeName;
|
|
760
|
+
if (res.results.fileTypeExtName) {
|
|
761
|
+
let fileTypeExtName =
|
|
762
|
+
res.results.fileTypeExtName.split(';');
|
|
763
|
+
this.fileAccept = fileTypeExtName
|
|
764
|
+
.filter((item) => {
|
|
765
|
+
return item;
|
|
766
|
+
})
|
|
767
|
+
.join(',');
|
|
768
|
+
}
|
|
769
|
+
if (res.results.dochubConfig) {
|
|
770
|
+
this.dochubConfig = res.results.dochubConfig;
|
|
771
|
+
sessionStorage.setItem(
|
|
772
|
+
'dochubConfig',
|
|
773
|
+
JSON.stringify(res.results.dochubConfig)
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
let url = this.portrait
|
|
777
|
+
? this.dochubConfig.reuploadDocumentUrl || uploadOnlyOne
|
|
778
|
+
: this.dochubConfig.uploadDocumentUrl || uploads;
|
|
779
|
+
this.uploadUrl =
|
|
780
|
+
url.indexOf(this.host) > -1 ? url : this.host + url;
|
|
781
|
+
if (res.results.kkViewRootPath) {
|
|
782
|
+
this.kkfileview = res.results.kkViewRootPath;
|
|
783
|
+
}
|
|
784
|
+
this.fileSize = res.results.limitFileSize
|
|
785
|
+
? res.results.limitFileSize
|
|
786
|
+
: 0;
|
|
787
|
+
this.fileTotalSize = res.results.limitTotalSize;
|
|
788
|
+
store.set(this.code, {
|
|
789
|
+
accept: this.fileAccept,
|
|
790
|
+
size: this.fileSize,
|
|
791
|
+
totalSize: this.fileTotalSize,
|
|
792
|
+
dochubConfig: this.dochubConfig
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
this.requestFiles && this.getFiles();
|
|
796
|
+
}
|
|
797
|
+
})
|
|
798
|
+
.catch((err) => {
|
|
799
|
+
if (err.message && err.message !== 'canceled') {
|
|
800
|
+
this.$message.error(err.message);
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
},
|
|
806
|
+
getFileLists() {
|
|
807
|
+
if (
|
|
808
|
+
!this.show ||
|
|
809
|
+
(this.fileList &&
|
|
810
|
+
Array.isArray(this.fileList) &&
|
|
811
|
+
this.fileList.length) ||
|
|
812
|
+
(this.requiredOwnId &&
|
|
813
|
+
!Object.prototype.hasOwnProperty.call(this.params, 'ownId'))
|
|
814
|
+
) {
|
|
815
|
+
return false;
|
|
816
|
+
}
|
|
817
|
+
let url =
|
|
818
|
+
typeof this.fileList === 'string'
|
|
819
|
+
? this.fileList
|
|
820
|
+
: this.dochubConfig.getDocumentList
|
|
821
|
+
? this.dochubConfig.getDocumentList
|
|
822
|
+
: getAdjunctFileInfos;
|
|
823
|
+
util
|
|
824
|
+
.ajax({
|
|
825
|
+
method: this.method,
|
|
826
|
+
url: url,
|
|
827
|
+
data: this.params,
|
|
828
|
+
params: this.params,
|
|
829
|
+
format: false
|
|
830
|
+
})
|
|
831
|
+
.then((res) => {
|
|
832
|
+
if (res.rCode === 0) {
|
|
833
|
+
if (this.portrait === true) {
|
|
834
|
+
this.image = JSON.parse(JSON.stringify(res.results))[0];
|
|
835
|
+
} else {
|
|
836
|
+
this.lists = JSON.parse(JSON.stringify(res.results));
|
|
837
|
+
let filesTotalSize = 0;
|
|
838
|
+
this.lists.forEach((item) => {
|
|
839
|
+
if (
|
|
840
|
+
Object.prototype.hasOwnProperty.call(item, 'fileSize') &&
|
|
841
|
+
item.fileSize
|
|
842
|
+
) {
|
|
843
|
+
filesTotalSize += parseFloat(item.fileSize, 10);
|
|
844
|
+
} else {
|
|
845
|
+
filesTotalSize += item.size
|
|
846
|
+
? Math.round((item.size / 1024) * 10) / 10
|
|
847
|
+
: 0;
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
this.filesTotalSize = filesTotalSize;
|
|
851
|
+
if (this.lists.length) {
|
|
852
|
+
this.$emit('input', this.lists);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
} else {
|
|
856
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
857
|
+
this.$message.error(msg);
|
|
858
|
+
}
|
|
859
|
+
})
|
|
860
|
+
.catch((err) => {
|
|
861
|
+
if (err.message && err.message !== 'canceled') {
|
|
862
|
+
this.$message.error(err.message);
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
},
|
|
866
|
+
handleUpload() {
|
|
867
|
+
this.$refs.upload.submit();
|
|
868
|
+
},
|
|
869
|
+
openKkfileview(file) {
|
|
870
|
+
let host = util.win.location.origin;
|
|
871
|
+
if (this.host) {
|
|
872
|
+
if (util.startWith(this.host, 'http')) {
|
|
873
|
+
host = this.host;
|
|
874
|
+
} else {
|
|
875
|
+
host += this.host;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
let url = encodeURIComponent(
|
|
879
|
+
Base64.encode(
|
|
880
|
+
host +
|
|
881
|
+
(typeof this.download === 'string'
|
|
882
|
+
? this.download
|
|
883
|
+
: downloadByAdjunctId) +
|
|
884
|
+
`?adjunctId=${
|
|
885
|
+
file.adjunctId || file.response.adjunctId
|
|
886
|
+
}&fullfilename=${file.originalName}`
|
|
887
|
+
)
|
|
888
|
+
);
|
|
889
|
+
util.win.open(`${this.kkfileview}?url=${url}`);
|
|
890
|
+
},
|
|
891
|
+
handlePreview(res) {
|
|
892
|
+
if (this.preview) {
|
|
893
|
+
if (this.onPreview) {
|
|
894
|
+
this.onPreview(res);
|
|
895
|
+
} else {
|
|
896
|
+
let file = res.response ? res.response : res;
|
|
897
|
+
let url =
|
|
898
|
+
typeof this.preview === 'string'
|
|
899
|
+
? this.preview
|
|
900
|
+
: typeof this.preview === 'function'
|
|
901
|
+
? this.preview(file)
|
|
902
|
+
: null;
|
|
903
|
+
if (res.status === 'success' || res.status == 0) {
|
|
904
|
+
let suffix = file.suffix;
|
|
905
|
+
suffix = suffix.toLowerCase();
|
|
906
|
+
if (this.dochubConfig.previewDocumentUrl) {
|
|
907
|
+
if (
|
|
908
|
+
suffix.includes('jpge') ||
|
|
909
|
+
suffix.includes('jpg') ||
|
|
910
|
+
suffix.includes('gif') ||
|
|
911
|
+
suffix.includes('png')
|
|
912
|
+
) {
|
|
913
|
+
this.imgUrl =
|
|
914
|
+
res.url && util.startWith(url, ['http', '/', true])
|
|
915
|
+
? res.url
|
|
916
|
+
: this.host +
|
|
917
|
+
(url
|
|
918
|
+
? url
|
|
919
|
+
: `${this.dochubConfig.downloadDocumentUrl}?documentId=${file.adjunctId}`);
|
|
920
|
+
this.title = file.originalName;
|
|
921
|
+
this.showImg = true;
|
|
922
|
+
this.$nextTick(() => {
|
|
923
|
+
this.loadImage();
|
|
924
|
+
});
|
|
925
|
+
} else if (suffix.includes('mp4')) {
|
|
926
|
+
this.source = {
|
|
927
|
+
src:
|
|
928
|
+
this.host +
|
|
929
|
+
(url
|
|
930
|
+
? url
|
|
931
|
+
: `${this.dochubConfig.downloadDocumentUrl}?documentId=${file.adjunctId}`)
|
|
932
|
+
};
|
|
933
|
+
this.title = file.originalName;
|
|
934
|
+
this.showVideo = true;
|
|
935
|
+
} else {
|
|
936
|
+
util.win.open(
|
|
937
|
+
this.host +
|
|
938
|
+
(url
|
|
939
|
+
? url
|
|
940
|
+
: `${this.dochubConfig.previewDocumentUrl}?documentId=${file.adjunctId}&action=附件预览`)
|
|
941
|
+
);
|
|
942
|
+
}
|
|
943
|
+
} else {
|
|
944
|
+
if (
|
|
945
|
+
suffix.includes('doc') ||
|
|
946
|
+
suffix.includes('docx') ||
|
|
947
|
+
suffix.includes('xls') ||
|
|
948
|
+
suffix.includes('xlsx') ||
|
|
949
|
+
suffix.includes('ppt')
|
|
950
|
+
) {
|
|
951
|
+
if (this.kkfileview) {
|
|
952
|
+
this.openKkfileview(file);
|
|
953
|
+
} else {
|
|
954
|
+
util.win.open(
|
|
955
|
+
this.host +
|
|
956
|
+
(url ? url : previewAdjunctOffice) +
|
|
957
|
+
'?cmd=view&bucketName=' +
|
|
958
|
+
file.absolutePath +
|
|
959
|
+
'&fileId=' +
|
|
960
|
+
file.adjunctId +
|
|
961
|
+
'&fileName=' +
|
|
962
|
+
file.newName
|
|
963
|
+
);
|
|
964
|
+
}
|
|
965
|
+
} else if (suffix.includes('pdf')) {
|
|
966
|
+
if (this.kkfileview) {
|
|
967
|
+
this.openKkfileview(file);
|
|
968
|
+
} else {
|
|
969
|
+
util.win.open(
|
|
970
|
+
this.host +
|
|
971
|
+
(url ? url : previewAdjunct2) +
|
|
972
|
+
'/' +
|
|
973
|
+
file.originalName +
|
|
974
|
+
'?adjunctId=' +
|
|
975
|
+
file.adjunctId
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
} else if (
|
|
979
|
+
suffix.includes('jpge') ||
|
|
980
|
+
suffix.includes('jpg') ||
|
|
981
|
+
suffix.includes('gif') ||
|
|
982
|
+
suffix.includes('png')
|
|
983
|
+
) {
|
|
984
|
+
this.imgUrl =
|
|
985
|
+
res.url && util.startWith(url, ['http', '/', true])
|
|
986
|
+
? res.url
|
|
987
|
+
: this.host +
|
|
988
|
+
(url ? url : this.previewAdjunct) +
|
|
989
|
+
'?adjunctId=' +
|
|
990
|
+
file.adjunctId;
|
|
991
|
+
this.title = file.originalName;
|
|
992
|
+
this.showImg = true;
|
|
993
|
+
this.$nextTick(() => {
|
|
994
|
+
this.loadImage();
|
|
995
|
+
});
|
|
996
|
+
} else if (suffix.includes('mp4')) {
|
|
997
|
+
this.source = {
|
|
998
|
+
src:
|
|
999
|
+
this.host +
|
|
1000
|
+
(url ? url : this.previewAdjunct) +
|
|
1001
|
+
'?adjunctId=' +
|
|
1002
|
+
file.adjunctId
|
|
1003
|
+
};
|
|
1004
|
+
this.title = file.originalName;
|
|
1005
|
+
this.showVideo = true;
|
|
1006
|
+
} else {
|
|
1007
|
+
if (this.kkfileview) {
|
|
1008
|
+
this.openKkfileview(file);
|
|
1009
|
+
} else {
|
|
1010
|
+
util.win.open(
|
|
1011
|
+
this.host +
|
|
1012
|
+
(url ? url : this.previewAdjunct) +
|
|
1013
|
+
'?adjunctId=' +
|
|
1014
|
+
file.adjunctId
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
} else {
|
|
1020
|
+
util.win.open(URL.createObjectURL(file.raw));
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
closeViewer() {
|
|
1026
|
+
this.showImg = false;
|
|
1027
|
+
},
|
|
1028
|
+
loadImage() {
|
|
1029
|
+
this.$refs.showImg &&
|
|
1030
|
+
(this.$refs.showImg.onload = () => {
|
|
1031
|
+
this.imgChange = false;
|
|
1032
|
+
let w = this.$refs.showImg.naturalWidth;
|
|
1033
|
+
let h = this.$refs.showImg.naturalHeight;
|
|
1034
|
+
let pw = this.$refs.showImg.parentNode.offsetWidth;
|
|
1035
|
+
let ph = this.$refs.showImg.parentNode.offsetHeight;
|
|
1036
|
+
if (w / h > pw / ph) {
|
|
1037
|
+
this.styles = { 'max-width': '100%' };
|
|
1038
|
+
} else {
|
|
1039
|
+
this.styles = { 'max-height': '100%' };
|
|
1040
|
+
}
|
|
1041
|
+
if (w < pw) {
|
|
1042
|
+
this.styles.width = w + 'px';
|
|
1043
|
+
}
|
|
1044
|
+
if (h < ph) {
|
|
1045
|
+
this.styles.height = h + 'px';
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
},
|
|
1049
|
+
isLt(file) {
|
|
1050
|
+
let flag = false;
|
|
1051
|
+
let flieArr = file.name.split('.');
|
|
1052
|
+
let suffix = '.' + flieArr[flieArr.length - 1].toLowerCase();
|
|
1053
|
+
if (this.accepts) {
|
|
1054
|
+
let accepts = this.accepts.toLowerCase().split(',');
|
|
1055
|
+
flag = accepts.includes(suffix);
|
|
1056
|
+
if (!flag) {
|
|
1057
|
+
this.$message.error(`文件类型错误,请上传${this.accepts}类型文件!`);
|
|
1058
|
+
return flag;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
let size = this._size;
|
|
1062
|
+
let text = '单个附件';
|
|
1063
|
+
let se = Math.round((file.size / 1024) * 10) / 10;
|
|
1064
|
+
if (this._size === 0 && this._totalSize === 0) {
|
|
1065
|
+
flag = true;
|
|
1066
|
+
} else if (this._size > 0 && this._totalSize === 0) {
|
|
1067
|
+
flag = se < this._size;
|
|
1068
|
+
size = this._size;
|
|
1069
|
+
text = '单个附件';
|
|
1070
|
+
} else if (this._size === 0 && this._totalSize > 0) {
|
|
1071
|
+
flag = this.filesTotalSize + se < this._totalSize;
|
|
1072
|
+
size = this._totalSize;
|
|
1073
|
+
text = '附件总';
|
|
1074
|
+
} else {
|
|
1075
|
+
flag = se < this._size && this.filesTotalSize + se < this._totalSize;
|
|
1076
|
+
if (se < this._size) {
|
|
1077
|
+
size = this._size;
|
|
1078
|
+
text = '单个附件';
|
|
1079
|
+
} else {
|
|
1080
|
+
size = this._totalSize;
|
|
1081
|
+
text = '附件总';
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
if (!flag) {
|
|
1085
|
+
this.$message.error(`上传${text}大小不能超过${size}KB!`);
|
|
1086
|
+
return flag;
|
|
1087
|
+
}
|
|
1088
|
+
return flag;
|
|
1089
|
+
},
|
|
1090
|
+
handleBeforeUpload(file) {
|
|
1091
|
+
const flag = this.isLt(file);
|
|
1092
|
+
if (this.portrait) {
|
|
1093
|
+
if (flag && this.beforeUpload) {
|
|
1094
|
+
return this.beforeUpload(file);
|
|
1095
|
+
}
|
|
1096
|
+
return flag;
|
|
1097
|
+
}
|
|
1098
|
+
if (this.beforeUpload) {
|
|
1099
|
+
if (flag) {
|
|
1100
|
+
return this.beforeUpload(file);
|
|
1101
|
+
}
|
|
1102
|
+
return flag;
|
|
1103
|
+
}
|
|
1104
|
+
return flag;
|
|
1105
|
+
},
|
|
1106
|
+
handleBeforeRemove(file, fileList) {
|
|
1107
|
+
if (file && (file.status === 'success' || file.status == 0)) {
|
|
1108
|
+
return this.$confirm('确定删除文件吗?', '提示', {
|
|
1109
|
+
confirmButtonText: '确定',
|
|
1110
|
+
cancelButtonText: '取消',
|
|
1111
|
+
type: 'warning'
|
|
1112
|
+
})
|
|
1113
|
+
.then(() => {
|
|
1114
|
+
if (this.beforeRemove) {
|
|
1115
|
+
return this.beforeRemove(file, fileList);
|
|
1116
|
+
} else if (file.status === 'success' || file.status == 0) {
|
|
1117
|
+
let userName =
|
|
1118
|
+
file.userName ||
|
|
1119
|
+
(file.response && file.response.userName) ||
|
|
1120
|
+
util.getStorage('userName');
|
|
1121
|
+
// eslint-disable-next-line no-undef
|
|
1122
|
+
return new Promise((resolve, reject) => {
|
|
1123
|
+
let url =
|
|
1124
|
+
typeof this.deleted === 'string'
|
|
1125
|
+
? this.deleted
|
|
1126
|
+
: this.remove === 'string'
|
|
1127
|
+
? this.remove
|
|
1128
|
+
: this.dochubConfig.deleteDocumentUrl || delAdjunct;
|
|
1129
|
+
util
|
|
1130
|
+
.ajax({
|
|
1131
|
+
method: this.method,
|
|
1132
|
+
url: url,
|
|
1133
|
+
data: {
|
|
1134
|
+
userName: userName,
|
|
1135
|
+
documentId: file.adjunctId || file.response.adjunctId,
|
|
1136
|
+
id: file.adjunctId || file.response.adjunctId
|
|
1137
|
+
},
|
|
1138
|
+
params: {
|
|
1139
|
+
userName: userName,
|
|
1140
|
+
documentId: file.adjunctId || file.response.adjunctId,
|
|
1141
|
+
id: file.adjunctId || file.response.adjunctId
|
|
1142
|
+
}
|
|
1143
|
+
})
|
|
1144
|
+
.then((res) => {
|
|
1145
|
+
if (res.rCode === 0) {
|
|
1146
|
+
let se =
|
|
1147
|
+
this.filesTotalSize -
|
|
1148
|
+
Math.round((file.size / 1024) * 10) / 10;
|
|
1149
|
+
this.filesTotalSize = se;
|
|
1150
|
+
this.$message.success(res.msg);
|
|
1151
|
+
resolve();
|
|
1152
|
+
} else {
|
|
1153
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
1154
|
+
this.$message.error(msg);
|
|
1155
|
+
reject();
|
|
1156
|
+
}
|
|
1157
|
+
})
|
|
1158
|
+
.catch((err) => {
|
|
1159
|
+
if (err.message && err.message !== 'canceled') {
|
|
1160
|
+
this.$message.error(err.message);
|
|
1161
|
+
}
|
|
1162
|
+
});
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
return true;
|
|
1166
|
+
})
|
|
1167
|
+
.catch(() => {
|
|
1168
|
+
return flag;
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
handleDownloads() {
|
|
1173
|
+
let url =
|
|
1174
|
+
typeof this.downloads === 'string'
|
|
1175
|
+
? this.downloads
|
|
1176
|
+
: this.dochubConfig.compressDownloadDocumentUrl || uploadDownloads;
|
|
1177
|
+
util.win.open(
|
|
1178
|
+
this.host +
|
|
1179
|
+
url +
|
|
1180
|
+
'?ownId=' +
|
|
1181
|
+
this.ownId +
|
|
1182
|
+
'&code=' +
|
|
1183
|
+
this.code +
|
|
1184
|
+
(this.extendCode ? '&extendCode=' + this.extendCode : '') +
|
|
1185
|
+
'&businessId=' +
|
|
1186
|
+
this.ownId +
|
|
1187
|
+
'&fileName=文档.zip' +
|
|
1188
|
+
'&bucketCode=' +
|
|
1189
|
+
this.code
|
|
1190
|
+
);
|
|
1191
|
+
},
|
|
1192
|
+
handleDownload(file) {
|
|
1193
|
+
if (file.status === 'success' || file.status == 0) {
|
|
1194
|
+
let url =
|
|
1195
|
+
typeof this.download === 'string'
|
|
1196
|
+
? this.download
|
|
1197
|
+
: this.dochubConfig.downloadDocumentUrl || downloadByAdjunctId;
|
|
1198
|
+
util.win.open(
|
|
1199
|
+
this.host +
|
|
1200
|
+
url +
|
|
1201
|
+
'?adjunctId=' +
|
|
1202
|
+
(file.adjunctId || file.response.adjunctId) +
|
|
1203
|
+
'&documentId=' +
|
|
1204
|
+
(file.adjunctId || file.response.adjunctId)
|
|
1205
|
+
);
|
|
1206
|
+
} else {
|
|
1207
|
+
this.aLinkDownload(file);
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
handleClick(res) {
|
|
1211
|
+
if (res.event && typeof res.event === 'function') {
|
|
1212
|
+
res.event(res);
|
|
1213
|
+
} else {
|
|
1214
|
+
this.$emit('click', res);
|
|
1215
|
+
}
|
|
1216
|
+
},
|
|
1217
|
+
aLinkDownload(file) {
|
|
1218
|
+
var a = document.createElement('a');
|
|
1219
|
+
let event = new MouseEvent('click');
|
|
1220
|
+
a.href = URL.createObjectURL(file.raw);
|
|
1221
|
+
a.download = file.name;
|
|
1222
|
+
a.dispatchEvent(event);
|
|
1223
|
+
},
|
|
1224
|
+
handleSort(files) {
|
|
1225
|
+
if (this.isSort) {
|
|
1226
|
+
if (this.onSort) {
|
|
1227
|
+
this.onSort(files);
|
|
1228
|
+
} else {
|
|
1229
|
+
let ids = files.map((item) => {
|
|
1230
|
+
if (item.status === 'success' || item.status == 0) {
|
|
1231
|
+
return item.adjunctId || item.response.adjunctId;
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
ids = ids.join(',');
|
|
1235
|
+
util
|
|
1236
|
+
.ajax({
|
|
1237
|
+
method: this.method,
|
|
1238
|
+
url: this.dochubConfig.sortDocumentsUrl || uploadSort,
|
|
1239
|
+
data: {
|
|
1240
|
+
ids: ids,
|
|
1241
|
+
documentIds: ids,
|
|
1242
|
+
ownId: this.ownId,
|
|
1243
|
+
code: this.code,
|
|
1244
|
+
bucketCode: this.code,
|
|
1245
|
+
businessId: this.ownId
|
|
1246
|
+
},
|
|
1247
|
+
params: {
|
|
1248
|
+
ids: ids,
|
|
1249
|
+
documentIds: ids,
|
|
1250
|
+
ownId: this.ownId,
|
|
1251
|
+
code: this.code,
|
|
1252
|
+
bucketCode: this.code,
|
|
1253
|
+
businessId: this.ownId
|
|
1254
|
+
}
|
|
1255
|
+
})
|
|
1256
|
+
.then((res) => {
|
|
1257
|
+
if (res.rCode === 0) {
|
|
1258
|
+
this.$message.success(res.msg);
|
|
1259
|
+
} else {
|
|
1260
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
1261
|
+
this.$message.error(msg);
|
|
1262
|
+
}
|
|
1263
|
+
})
|
|
1264
|
+
.catch((err) => {
|
|
1265
|
+
if (err.message && err.message !== 'canceled') {
|
|
1266
|
+
this.$message.error(err.message);
|
|
1267
|
+
}
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1272
|
+
handleSuccess(response, file, fileList) {
|
|
1273
|
+
if (this.portrait) {
|
|
1274
|
+
this.image = URL.createObjectURL(file.raw);
|
|
1275
|
+
}
|
|
1276
|
+
if (this.showMessage.success) {
|
|
1277
|
+
if (response.rCode) {
|
|
1278
|
+
if (this.dangerouslyUseHTMLString) {
|
|
1279
|
+
this.$alert(
|
|
1280
|
+
response.msg ? response.msg : '上传失败:请联系管理员',
|
|
1281
|
+
'提示',
|
|
1282
|
+
{
|
|
1283
|
+
dangerouslyUseHTMLString: true,
|
|
1284
|
+
setHeight: response.msg
|
|
1285
|
+
}
|
|
1286
|
+
).catch();
|
|
1287
|
+
} else {
|
|
1288
|
+
this.$message({
|
|
1289
|
+
type: 'error',
|
|
1290
|
+
message: response.msg || '成功!'
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
} else {
|
|
1294
|
+
this.$message.success(response.msg);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
let se =
|
|
1298
|
+
this.filesTotalSize +
|
|
1299
|
+
(this.resultFile ? Math.round((file.size / 1024) * 10) / 10 : 0);
|
|
1300
|
+
this.filesTotalSize = se;
|
|
1301
|
+
this.onSuccess &&
|
|
1302
|
+
this.onSuccess(response, file, fileList, this.dochubConfig);
|
|
1303
|
+
this.$emit('success', response, file, fileList, this.dochubConfig);
|
|
1304
|
+
if (this.resultFile) {
|
|
1305
|
+
if (this.portrait) {
|
|
1306
|
+
this.$emit('input', file);
|
|
1307
|
+
} else {
|
|
1308
|
+
this.$emit('input', fileList);
|
|
1309
|
+
}
|
|
1310
|
+
if (this.elForm) {
|
|
1311
|
+
this.elForm.clearValidate(this.name);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
},
|
|
1315
|
+
handleChange(file, fileList) {
|
|
1316
|
+
this.$emit('change', fileList);
|
|
1317
|
+
this.onChange && this.onChange(file, fileList);
|
|
1318
|
+
},
|
|
1319
|
+
handleRemove(file, fileList) {
|
|
1320
|
+
this.$emit('input', fileList.length ? fileList : '');
|
|
1321
|
+
this.$emit('remove', file, fileList);
|
|
1322
|
+
this.$emit('change', fileList);
|
|
1323
|
+
this.onRemove && this.onRemove(file, fileList);
|
|
1324
|
+
},
|
|
1325
|
+
handleError(err, file, fileList) {
|
|
1326
|
+
if (this.showMessage.error) {
|
|
1327
|
+
if (this.dangerouslyUseHTMLString) {
|
|
1328
|
+
this.$alert(err.msg ? err.msg : '上传失败:请联系管理员', '提示', {
|
|
1329
|
+
dangerouslyUseHTMLString: true,
|
|
1330
|
+
setHeight: err.msg
|
|
1331
|
+
}).catch();
|
|
1332
|
+
} else {
|
|
1333
|
+
this.$message({
|
|
1334
|
+
type: 'error',
|
|
1335
|
+
message: '上传失败:' + (err.msg ? err.msg : '请联系管理员')
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
this.$emit('error', err, file, fileList);
|
|
1340
|
+
this.onError && this.onError(err, file, fileList);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
</script>
|