eoss-ui 0.3.97
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/CHANGELOG.md +929 -0
- package/README.md +30 -0
- package/lib/button-group.js +2857 -0
- package/lib/button.js +2884 -0
- package/lib/card.js +603 -0
- package/lib/cascader.js +373 -0
- package/lib/checkbox-group.js +3099 -0
- package/lib/clients.js +375 -0
- package/lib/config/api.js +205 -0
- package/lib/data-table-form.js +3848 -0
- package/lib/data-table.js +6315 -0
- package/lib/date-picker.js +2821 -0
- package/lib/dialog.js +3730 -0
- package/lib/enterprise.js +372 -0
- package/lib/eoss-ui.common.js +65365 -0
- package/lib/error-page.js +293 -0
- package/lib/flow-group.js +4200 -0
- package/lib/flow-list.js +4350 -0
- package/lib/flow.js +12893 -0
- package/lib/form.js +15635 -0
- package/lib/handle-user.js +2900 -0
- package/lib/handler.js +3118 -0
- package/lib/index.js +1 -0
- package/lib/input-number.js +2743 -0
- package/lib/input.js +2935 -0
- package/lib/label.js +411 -0
- package/lib/login.js +5048 -0
- package/lib/main.js +5816 -0
- package/lib/mainComp.js +6530 -0
- package/lib/menu.js +529 -0
- package/lib/nav.js +3048 -0
- package/lib/notify.js +1079 -0
- package/lib/page.js +3036 -0
- package/lib/pagination.js +354 -0
- package/lib/player.js +2904 -0
- package/lib/qr-code.js +2860 -0
- package/lib/radio-group.js +3091 -0
- package/lib/select-ganged.js +3242 -0
- package/lib/select.js +3295 -0
- package/lib/selector-panel.js +4425 -0
- package/lib/selector.js +3722 -0
- package/lib/sizer.js +3067 -0
- package/lib/steps.js +2943 -0
- package/lib/switch.js +2784 -0
- package/lib/table-form.js +6211 -0
- package/lib/tabs-panel.js +274 -0
- package/lib/tabs.js +4988 -0
- package/lib/theme-chalk/base.css +1 -0
- package/lib/theme-chalk/button-group.css +1 -0
- package/lib/theme-chalk/button.css +0 -0
- package/lib/theme-chalk/card.css +1 -0
- package/lib/theme-chalk/cascader.css +0 -0
- package/lib/theme-chalk/checkbox-group.css +1 -0
- package/lib/theme-chalk/clients.css +1 -0
- package/lib/theme-chalk/data-table-form.css +1 -0
- package/lib/theme-chalk/data-table.css +1 -0
- package/lib/theme-chalk/date-picker.css +1 -0
- package/lib/theme-chalk/dialog.css +1 -0
- package/lib/theme-chalk/enterprise.css +1 -0
- package/lib/theme-chalk/error-page.css +1 -0
- package/lib/theme-chalk/flow-chart.css +0 -0
- package/lib/theme-chalk/flow-group.css +1 -0
- package/lib/theme-chalk/flow-list.css +1 -0
- package/lib/theme-chalk/flow.css +1 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/form.css +1 -0
- package/lib/theme-chalk/handle-user.css +1 -0
- package/lib/theme-chalk/handler.css +1 -0
- package/lib/theme-chalk/icon.css +1 -0
- package/lib/theme-chalk/index.css +1 -0
- package/lib/theme-chalk/input-number.css +0 -0
- package/lib/theme-chalk/input.css +1 -0
- package/lib/theme-chalk/label.css +1 -0
- package/lib/theme-chalk/login.css +1 -0
- package/lib/theme-chalk/main.css +1 -0
- package/lib/theme-chalk/mainComp.css +0 -0
- package/lib/theme-chalk/menu.css +1 -0
- package/lib/theme-chalk/nav.css +1 -0
- package/lib/theme-chalk/notify.css +0 -0
- package/lib/theme-chalk/page.css +1 -0
- package/lib/theme-chalk/pagination.css +1 -0
- package/lib/theme-chalk/player.css +1 -0
- package/lib/theme-chalk/qr-code.css +1 -0
- package/lib/theme-chalk/radio-group.css +1 -0
- package/lib/theme-chalk/radio.css +1 -0
- package/lib/theme-chalk/select-ganged.css +1 -0
- package/lib/theme-chalk/select.css +0 -0
- package/lib/theme-chalk/selector-panel.css +1 -0
- package/lib/theme-chalk/selector.css +1 -0
- package/lib/theme-chalk/sizer.css +1 -0
- package/lib/theme-chalk/steps.css +1 -0
- package/lib/theme-chalk/switch.css +1 -0
- package/lib/theme-chalk/table-form.css +0 -0
- package/lib/theme-chalk/tabs-panel.css +0 -0
- package/lib/theme-chalk/tabs.css +1 -0
- package/lib/theme-chalk/tips.css +1 -0
- package/lib/theme-chalk/toolbar.css +1 -0
- package/lib/theme-chalk/tree-group.css +1 -0
- package/lib/theme-chalk/tree.css +1 -0
- package/lib/theme-chalk/upload.css +1 -0
- package/lib/theme-chalk/wujie.css +0 -0
- package/lib/theme-chalk/wxlogin.css +1 -0
- package/lib/tips.js +2830 -0
- package/lib/toolbar.js +531 -0
- package/lib/tree-group.js +3373 -0
- package/lib/tree.js +3482 -0
- package/lib/upload.js +3913 -0
- package/lib/utils/bus.js +9 -0
- package/lib/utils/date-util.js +318 -0
- package/lib/utils/http.js +58 -0
- package/lib/utils/rules.js +19 -0
- package/lib/utils/store.js +22 -0
- package/lib/utils/util.js +2056 -0
- package/lib/wujie.js +2845 -0
- package/lib/wxlogin.js +2799 -0
- package/package.json +151 -0
- package/packages/button/index.js +5 -0
- package/packages/button/src/main.vue +264 -0
- package/packages/button-group/index.js +5 -0
- package/packages/button-group/src/main.vue +130 -0
- package/packages/card/index.js +5 -0
- package/packages/card/src/main.vue +144 -0
- package/packages/cascader/index.js +5 -0
- package/packages/cascader/src/main.vue +144 -0
- package/packages/checkbox-group/index.js +5 -0
- package/packages/checkbox-group/src/main.vue +285 -0
- package/packages/clients/index.js +5 -0
- package/packages/clients/src/main.vue +50 -0
- package/packages/data-table/index.js +5 -0
- package/packages/data-table/src/children.vue +40 -0
- package/packages/data-table/src/column.vue +796 -0
- package/packages/data-table/src/main copy.vue +1383 -0
- package/packages/data-table/src/main.vue +1229 -0
- package/packages/data-table/src/mixins/table.js +12 -0
- package/packages/data-table/src/sizer.vue +160 -0
- package/packages/data-table-form/index.js +5 -0
- package/packages/data-table-form/src/colgroup.vue +17 -0
- package/packages/data-table-form/src/main.vue +167 -0
- package/packages/data-table-form/src/table.vue +192 -0
- package/packages/data-table-form/src/tbody.vue +219 -0
- package/packages/data-table-form/src/thead.vue +68 -0
- package/packages/date-picker/index.js +5 -0
- package/packages/date-picker/src/main.vue +185 -0
- package/packages/dialog/index.js +5 -0
- package/packages/dialog/src/main.vue +442 -0
- package/packages/enterprise/index.js +5 -0
- package/packages/enterprise/src/main.vue +66 -0
- package/packages/error-page/index.js +5 -0
- package/packages/error-page/src/main.vue +44 -0
- package/packages/flow/index.js +5 -0
- package/packages/flow/src/component/CommonOpinions.vue +290 -0
- package/packages/flow/src/component/CustomPreset.vue +311 -0
- package/packages/flow/src/component/FileList.vue +97 -0
- package/packages/flow/src/component/Preset.vue +253 -0
- package/packages/flow/src/component/SendMsg.vue +221 -0
- package/packages/flow/src/component/TimeLimit.vue +190 -0
- package/packages/flow/src/component/taskUnionExamine.vue +507 -0
- package/packages/flow/src/form.vue +120 -0
- package/packages/flow/src/main.vue +2107 -0
- package/packages/flow/src/processForm.vue +866 -0
- package/packages/flow/src/processReject.vue +262 -0
- package/packages/flow/src/selectUser.vue +425 -0
- package/packages/flow/src/startTaskRead.vue +556 -0
- package/packages/flow/src/table.vue +51 -0
- package/packages/flow-group/index.js +5 -0
- package/packages/flow-group/src/main.vue +540 -0
- package/packages/flow-list/index.js +5 -0
- package/packages/flow-list/src/flow-table.vue +445 -0
- package/packages/flow-list/src/main.vue +456 -0
- package/packages/form/index.js +5 -0
- package/packages/form/src/main.vue +4429 -0
- package/packages/form/src/table.vue +1196 -0
- package/packages/handle-user/index.js +5 -0
- package/packages/handle-user/src/main.vue +122 -0
- package/packages/handler/index.js +5 -0
- package/packages/handler/src/main.vue +306 -0
- package/packages/input/index.js +5 -0
- package/packages/input/src/main.vue +307 -0
- package/packages/input-number/index.js +5 -0
- package/packages/input-number/src/main.vue +106 -0
- package/packages/label/index.js +5 -0
- package/packages/label/src/main.vue +208 -0
- package/packages/login/index.js +5 -0
- package/packages/login/src/main.vue +1193 -0
- package/packages/login/src/resetPassword.vue +332 -0
- package/packages/main/index.js +5 -0
- package/packages/main/src/main.vue +1496 -0
- package/packages/main/src/message.vue +239 -0
- package/packages/main/src/notice.vue +145 -0
- package/packages/main/src/settings.vue +105 -0
- package/packages/main/src/userinfo.vue +430 -0
- package/packages/mainComp/index.js +5 -0
- package/packages/mainComp/src/async-component/index.vue +85 -0
- package/packages/mainComp/src/main.vue +1934 -0
- package/packages/mainComp/src/message.vue +239 -0
- package/packages/mainComp/src/notice.vue +152 -0
- package/packages/mainComp/src/settings.vue +105 -0
- package/packages/mainComp/src/userinfo.vue +423 -0
- package/packages/menu/index.js +5 -0
- package/packages/menu/src/main.vue +401 -0
- package/packages/nav/index.js +5 -0
- package/packages/nav/src/main.vue +250 -0
- package/packages/notify/index.js +5 -0
- package/packages/notify/src/main.vue +538 -0
- package/packages/page/index.js +5 -0
- package/packages/page/src/main.vue +167 -0
- package/packages/pagination/index.js +5 -0
- package/packages/pagination/src/main.vue +77 -0
- package/packages/player/index.js +5 -0
- package/packages/player/src/main.vue +194 -0
- package/packages/qr-code/index.js +5 -0
- package/packages/qr-code/src/main.vue +154 -0
- package/packages/radio/index.js +5 -0
- package/packages/radio/src/main.vue +259 -0
- package/packages/radio-group/index.js +6 -0
- package/packages/radio-group/src/main.vue +267 -0
- package/packages/select/index.js +5 -0
- package/packages/select/src/main.vue +683 -0
- package/packages/select-ganged/index.js +5 -0
- package/packages/select-ganged/src/main.vue +686 -0
- package/packages/selector/index.js +5 -0
- package/packages/selector/src/main.vue +588 -0
- package/packages/selector-panel/index.js +5 -0
- package/packages/selector-panel/src/main.vue +968 -0
- package/packages/selector-panel/src/selection.vue +142 -0
- package/packages/selector-panel/src/tree.vue +129 -0
- package/packages/sizer/index.js +5 -0
- package/packages/sizer/src/main.vue +254 -0
- package/packages/steps/index.js +5 -0
- package/packages/steps/src/main.vue +175 -0
- package/packages/switch/index.js +5 -0
- package/packages/switch/src/main.vue +154 -0
- package/packages/table-form/index.js +5 -0
- package/packages/tabs/index.js +5 -0
- package/packages/tabs/src/main.vue +749 -0
- package/packages/tabs-panel/index.js +5 -0
- package/packages/tabs-panel/src/main.vue +18 -0
- package/packages/theme-chalk/README.md +33 -0
- package/packages/theme-chalk/lib/base.css +1 -0
- package/packages/theme-chalk/lib/button-group.css +1 -0
- package/packages/theme-chalk/lib/button.css +0 -0
- package/packages/theme-chalk/lib/card.css +1 -0
- package/packages/theme-chalk/lib/cascader.css +0 -0
- package/packages/theme-chalk/lib/checkbox-group.css +1 -0
- package/packages/theme-chalk/lib/clients.css +1 -0
- package/packages/theme-chalk/lib/data-table-form.css +1 -0
- package/packages/theme-chalk/lib/data-table.css +1 -0
- package/packages/theme-chalk/lib/date-picker.css +1 -0
- package/packages/theme-chalk/lib/dialog.css +1 -0
- package/packages/theme-chalk/lib/enterprise.css +1 -0
- package/packages/theme-chalk/lib/error-page.css +1 -0
- package/packages/theme-chalk/lib/flow-chart.css +0 -0
- package/packages/theme-chalk/lib/flow-group.css +1 -0
- package/packages/theme-chalk/lib/flow-list.css +1 -0
- package/packages/theme-chalk/lib/flow.css +1 -0
- 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/form.css +1 -0
- package/packages/theme-chalk/lib/handle-user.css +1 -0
- package/packages/theme-chalk/lib/handler.css +1 -0
- package/packages/theme-chalk/lib/icon.css +1 -0
- package/packages/theme-chalk/lib/index.css +1 -0
- package/packages/theme-chalk/lib/input-number.css +0 -0
- package/packages/theme-chalk/lib/input.css +1 -0
- package/packages/theme-chalk/lib/label.css +1 -0
- package/packages/theme-chalk/lib/login.css +1 -0
- package/packages/theme-chalk/lib/main.css +1 -0
- package/packages/theme-chalk/lib/mainComp.css +0 -0
- package/packages/theme-chalk/lib/menu.css +1 -0
- package/packages/theme-chalk/lib/nav.css +1 -0
- package/packages/theme-chalk/lib/notify.css +0 -0
- package/packages/theme-chalk/lib/page.css +1 -0
- package/packages/theme-chalk/lib/pagination.css +1 -0
- package/packages/theme-chalk/lib/player.css +1 -0
- package/packages/theme-chalk/lib/qr-code.css +1 -0
- package/packages/theme-chalk/lib/radio-group.css +1 -0
- package/packages/theme-chalk/lib/radio.css +1 -0
- package/packages/theme-chalk/lib/select-ganged.css +1 -0
- package/packages/theme-chalk/lib/select.css +0 -0
- package/packages/theme-chalk/lib/selector-panel.css +1 -0
- package/packages/theme-chalk/lib/selector.css +1 -0
- package/packages/theme-chalk/lib/sizer.css +1 -0
- package/packages/theme-chalk/lib/steps.css +1 -0
- package/packages/theme-chalk/lib/switch.css +1 -0
- package/packages/theme-chalk/lib/table-form.css +0 -0
- package/packages/theme-chalk/lib/tabs-panel.css +0 -0
- package/packages/theme-chalk/lib/tabs.css +1 -0
- package/packages/theme-chalk/lib/tips.css +1 -0
- package/packages/theme-chalk/lib/toolbar.css +1 -0
- package/packages/theme-chalk/lib/tree-group.css +1 -0
- package/packages/theme-chalk/lib/tree.css +1 -0
- package/packages/theme-chalk/lib/upload.css +1 -0
- package/packages/theme-chalk/lib/wujie.css +0 -0
- package/packages/theme-chalk/lib/wxlogin.css +1 -0
- package/packages/theme-chalk/package.json +35 -0
- package/packages/theme-chalk/src/base.scss +165 -0
- package/packages/theme-chalk/src/button-group.scss +9 -0
- package/packages/theme-chalk/src/button.scss +0 -0
- package/packages/theme-chalk/src/card.scss +55 -0
- package/packages/theme-chalk/src/cascader.scss +0 -0
- package/packages/theme-chalk/src/checkbox-group.scss +8 -0
- package/packages/theme-chalk/src/clients.scss +72 -0
- package/packages/theme-chalk/src/common/var.scss +1516 -0
- package/packages/theme-chalk/src/data-table-form.scss +55 -0
- package/packages/theme-chalk/src/data-table.scss +202 -0
- package/packages/theme-chalk/src/date-picker.scss +8 -0
- package/packages/theme-chalk/src/dialog.scss +52 -0
- package/packages/theme-chalk/src/enterprise.scss +5 -0
- package/packages/theme-chalk/src/error-page.scss +18 -0
- package/packages/theme-chalk/src/flow-chart.scss +0 -0
- package/packages/theme-chalk/src/flow-group.scss +101 -0
- package/packages/theme-chalk/src/flow-list.scss +41 -0
- package/packages/theme-chalk/src/flow.scss +285 -0
- 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 +451 -0
- package/packages/theme-chalk/src/handle-user.scss +40 -0
- package/packages/theme-chalk/src/handler.scss +131 -0
- package/packages/theme-chalk/src/icon.scss +1714 -0
- package/packages/theme-chalk/src/index.scss +50 -0
- package/packages/theme-chalk/src/input-number.scss +0 -0
- package/packages/theme-chalk/src/input.scss +3 -0
- package/packages/theme-chalk/src/label.scss +24 -0
- package/packages/theme-chalk/src/login.scss +490 -0
- package/packages/theme-chalk/src/main.scss +483 -0
- package/packages/theme-chalk/src/mainComp.scss +0 -0
- package/packages/theme-chalk/src/menu.scss +201 -0
- package/packages/theme-chalk/src/mixins/color.scss +117 -0
- package/packages/theme-chalk/src/mixins/mixins.scss +25 -0
- package/packages/theme-chalk/src/nav.scss +73 -0
- package/packages/theme-chalk/src/notify.scss +0 -0
- package/packages/theme-chalk/src/page.scss +3 -0
- package/packages/theme-chalk/src/pagination.scss +14 -0
- package/packages/theme-chalk/src/player.scss +9 -0
- package/packages/theme-chalk/src/qr-code.scss +17 -0
- package/packages/theme-chalk/src/radio-group.scss +9 -0
- package/packages/theme-chalk/src/radio.scss +3 -0
- package/packages/theme-chalk/src/select-ganged.scss +9 -0
- package/packages/theme-chalk/src/select.scss +0 -0
- package/packages/theme-chalk/src/selector-panel.scss +203 -0
- package/packages/theme-chalk/src/selector.scss +85 -0
- package/packages/theme-chalk/src/sizer.scss +36 -0
- package/packages/theme-chalk/src/steps.scss +88 -0
- package/packages/theme-chalk/src/switch.scss +3 -0
- package/packages/theme-chalk/src/table-form.scss +1 -0
- package/packages/theme-chalk/src/tabs-panel.scss +0 -0
- package/packages/theme-chalk/src/tabs.scss +91 -0
- package/packages/theme-chalk/src/tips.scss +7 -0
- package/packages/theme-chalk/src/toolbar.scss +121 -0
- package/packages/theme-chalk/src/tree-group.scss +64 -0
- package/packages/theme-chalk/src/tree.scss +140 -0
- package/packages/theme-chalk/src/upload.scss +131 -0
- package/packages/theme-chalk/src/wujie.scss +0 -0
- package/packages/theme-chalk/src/wxlogin.scss +3 -0
- package/packages/tips/index.js +5 -0
- package/packages/tips/src/main.vue +126 -0
- package/packages/toolbar/index.js +5 -0
- package/packages/toolbar/src/main.vue +377 -0
- package/packages/tree/index.js +5 -0
- package/packages/tree/src/main.vue +636 -0
- package/packages/tree-group/index.js +5 -0
- package/packages/tree-group/src/main.vue +435 -0
- package/packages/upload/index.js +5 -0
- package/packages/upload/src/main.vue +1033 -0
- package/packages/upload/src/picture.js +15 -0
- package/packages/wujie/index.js +5 -0
- package/packages/wujie/src/main.vue +137 -0
- package/packages/wxlogin/index.js +5 -0
- package/packages/wxlogin/src/main.vue +110 -0
- package/src/config/api.js +211 -0
- package/src/index.js +167 -0
- package/src/utils/bus.js +3 -0
- package/src/utils/date-util.js +312 -0
- package/src/utils/http.js +50 -0
- package/src/utils/rules.js +18 -0
- package/src/utils/store.js +21 -0
- package/src/utils/util.js +2105 -0
|
@@ -0,0 +1,1033 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-upload
|
|
3
|
+
ref="upload"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
class="es-upload"
|
|
6
|
+
:list-type="listType"
|
|
7
|
+
:wait="1000"
|
|
8
|
+
:height="boxHeight"
|
|
9
|
+
:multiple="portrait ? false : multiple"
|
|
10
|
+
:action="url"
|
|
11
|
+
:show-file-list="showList"
|
|
12
|
+
:file-list="lists"
|
|
13
|
+
:result-file="resultFile"
|
|
14
|
+
:disabled="isDisabled"
|
|
15
|
+
:class="[
|
|
16
|
+
{
|
|
17
|
+
'es-avatar-uploader': portrait,
|
|
18
|
+
'es-upload-readonly': isDisabled
|
|
19
|
+
},
|
|
20
|
+
'es-upload-' + listType
|
|
21
|
+
]"
|
|
22
|
+
:previewAdjunct="host + previewAdjunct"
|
|
23
|
+
:headers="headers"
|
|
24
|
+
:data="datas"
|
|
25
|
+
:show-info="showList ? showInfo : []"
|
|
26
|
+
:auto-upload="autoUpload"
|
|
27
|
+
:response="true"
|
|
28
|
+
:operate="operate"
|
|
29
|
+
:accept="accepts"
|
|
30
|
+
:drag-sort="isSort"
|
|
31
|
+
:preview="preview"
|
|
32
|
+
:exclude="excludes"
|
|
33
|
+
:download="isDownload"
|
|
34
|
+
:icons="_icons"
|
|
35
|
+
:picture="_picture"
|
|
36
|
+
:before-upload="handleBeforeUpload"
|
|
37
|
+
:before-remove="handleBeforeRemove"
|
|
38
|
+
:on-preview="handlePreview"
|
|
39
|
+
:on-downloads="handleDownloads"
|
|
40
|
+
:on-download="handleDownload"
|
|
41
|
+
:on-sort="handleSort"
|
|
42
|
+
:on-success="handleSuccess"
|
|
43
|
+
:on-change="handleChange"
|
|
44
|
+
:on-remove="handleRemove"
|
|
45
|
+
:on-error="handleError"
|
|
46
|
+
>
|
|
47
|
+
<template v-if="prepend">
|
|
48
|
+
<template v-if="Array.isArray(prepend)">
|
|
49
|
+
<el-button
|
|
50
|
+
v-for="(item, index) in prepend"
|
|
51
|
+
v-bind="{ ...item, size: btnSize }"
|
|
52
|
+
:key="index"
|
|
53
|
+
@click.stop="handleClick(item)"
|
|
54
|
+
>
|
|
55
|
+
{{ item.label || item.text }}
|
|
56
|
+
</el-button>
|
|
57
|
+
</template>
|
|
58
|
+
<el-button
|
|
59
|
+
v-else
|
|
60
|
+
v-bind="{ ...prepend, size: btnSize }"
|
|
61
|
+
@click.stop="handleClick(prepend)"
|
|
62
|
+
>
|
|
63
|
+
{{ prepend.label || prepend.text }}
|
|
64
|
+
</el-button>
|
|
65
|
+
</template>
|
|
66
|
+
<slot>
|
|
67
|
+
<expand-dom v-if="render" :render="render"></expand-dom>
|
|
68
|
+
<template v-else>
|
|
69
|
+
<template v-if="portrait">
|
|
70
|
+
<img
|
|
71
|
+
v-if="profile"
|
|
72
|
+
:src="profile"
|
|
73
|
+
class="avatar"
|
|
74
|
+
:style="{ width: width, height: height }"
|
|
75
|
+
/>
|
|
76
|
+
<i
|
|
77
|
+
v-else
|
|
78
|
+
class="avatar-uploader-icon"
|
|
79
|
+
:class="{ 'el-icon-plus': !isDisabled }"
|
|
80
|
+
:style="{ width: width, height: height, lineHeight: height }"
|
|
81
|
+
></i>
|
|
82
|
+
</template>
|
|
83
|
+
<template v-else>
|
|
84
|
+
<i
|
|
85
|
+
class="el-icon-plus es-uploader-icon"
|
|
86
|
+
v-if="selectType === 'icon-plus'"
|
|
87
|
+
></i>
|
|
88
|
+
<el-button
|
|
89
|
+
v-else
|
|
90
|
+
class="es-upload-button"
|
|
91
|
+
:class="icon"
|
|
92
|
+
:type="selectType"
|
|
93
|
+
:size="btnSize"
|
|
94
|
+
>{{ text ? text : autoUpload ? '点击上传' : '选择文件' }}</el-button
|
|
95
|
+
>
|
|
96
|
+
<el-button
|
|
97
|
+
class="es-upload-button"
|
|
98
|
+
v-if="!autoUpload"
|
|
99
|
+
:type="uploadType"
|
|
100
|
+
:size="btnSize"
|
|
101
|
+
@click.stop="handleUpload"
|
|
102
|
+
>
|
|
103
|
+
上传文件
|
|
104
|
+
</el-button>
|
|
105
|
+
<el-button
|
|
106
|
+
v-if="showFileList && isDownloads"
|
|
107
|
+
slot="handle"
|
|
108
|
+
class="es-upload-button es-upload-downloads"
|
|
109
|
+
:size="btnSize"
|
|
110
|
+
@click.stop="handleDownloads"
|
|
111
|
+
>
|
|
112
|
+
批量下载
|
|
113
|
+
</el-button>
|
|
114
|
+
</template>
|
|
115
|
+
</template>
|
|
116
|
+
</slot>
|
|
117
|
+
<template v-if="append">
|
|
118
|
+
<template v-if="Array.isArray(append)">
|
|
119
|
+
<el-button
|
|
120
|
+
v-for="(item, index) in append"
|
|
121
|
+
v-bind="{ ...item, size: btnSize }"
|
|
122
|
+
:key="index"
|
|
123
|
+
@click.stop="handleClick(item)"
|
|
124
|
+
>
|
|
125
|
+
{{ item.label || item.text }}
|
|
126
|
+
</el-button>
|
|
127
|
+
</template>
|
|
128
|
+
<el-button
|
|
129
|
+
v-else
|
|
130
|
+
v-bind="{ ...append, size: btnSize }"
|
|
131
|
+
@click.stop="handleClick(append)"
|
|
132
|
+
>
|
|
133
|
+
{{ append.label || append.text }}
|
|
134
|
+
</el-button>
|
|
135
|
+
</template>
|
|
136
|
+
<template slot="tip">
|
|
137
|
+
<slot name="tip">
|
|
138
|
+
<div v-if="tips" class="el-upload__tip">{{ tips }}</div>
|
|
139
|
+
</slot>
|
|
140
|
+
</template>
|
|
141
|
+
|
|
142
|
+
<es-dialog :title="title" :visible.sync="showImg" slot="dialog">
|
|
143
|
+
<div
|
|
144
|
+
v-loading="imgChange"
|
|
145
|
+
element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
146
|
+
class="es-upload-dialog"
|
|
147
|
+
>
|
|
148
|
+
<img v-show="!imgChange" ref="showImg" :src="imgUrl" :style="styles" />
|
|
149
|
+
</div>
|
|
150
|
+
</es-dialog>
|
|
151
|
+
<es-dialog :title="title" :visible.sync="showVideo" slot="dialog">
|
|
152
|
+
<es-player
|
|
153
|
+
autoplay
|
|
154
|
+
type="video/mp4"
|
|
155
|
+
:is-pause="!showVideo"
|
|
156
|
+
:source="source"
|
|
157
|
+
></es-player>
|
|
158
|
+
</es-dialog>
|
|
159
|
+
</el-upload>
|
|
160
|
+
</template>
|
|
161
|
+
<script>
|
|
162
|
+
import {
|
|
163
|
+
getAdjunctProperties,
|
|
164
|
+
uploads,
|
|
165
|
+
uploadOnlyOne,
|
|
166
|
+
getAdjunctFileInfos,
|
|
167
|
+
uploadDownloads,
|
|
168
|
+
previewAdjunctOffice,
|
|
169
|
+
previewAdjunct,
|
|
170
|
+
previewAdjunct2,
|
|
171
|
+
uploadSort,
|
|
172
|
+
delAdjunct,
|
|
173
|
+
downloadByAdjunctId
|
|
174
|
+
} from 'eoss-ui/src/config/api.js';
|
|
175
|
+
import util from 'eoss-ui/src/utils/util.js';
|
|
176
|
+
import picture from './picture.js';
|
|
177
|
+
export default {
|
|
178
|
+
name: 'EsUpload',
|
|
179
|
+
components: {
|
|
180
|
+
expandDom: {
|
|
181
|
+
functional: true,
|
|
182
|
+
props: {
|
|
183
|
+
render: [Function, String]
|
|
184
|
+
},
|
|
185
|
+
render: (h, ctx) => {
|
|
186
|
+
if (typeof ctx.props.render == 'string') {
|
|
187
|
+
try {
|
|
188
|
+
return util.toFunction(ctx.props.render)(h, params);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return ctx.props.render(h);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
inheritAttrs: false,
|
|
198
|
+
inject: {
|
|
199
|
+
elForm: {
|
|
200
|
+
default: ''
|
|
201
|
+
},
|
|
202
|
+
elFormItem: {
|
|
203
|
+
default: ''
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
props: {
|
|
207
|
+
prepend: [Array, Object],
|
|
208
|
+
append: [Array, Object],
|
|
209
|
+
render: Function,
|
|
210
|
+
template: String,
|
|
211
|
+
value: [String, Array, Object],
|
|
212
|
+
name: String,
|
|
213
|
+
method: {
|
|
214
|
+
type: String,
|
|
215
|
+
default: 'get'
|
|
216
|
+
},
|
|
217
|
+
text: String,
|
|
218
|
+
icon: String,
|
|
219
|
+
headers: {
|
|
220
|
+
type: Object,
|
|
221
|
+
default() {
|
|
222
|
+
return util.getStorage();
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
listType: {
|
|
226
|
+
type: String,
|
|
227
|
+
default: 'text' // text,picture,picture-card
|
|
228
|
+
},
|
|
229
|
+
operate: {
|
|
230
|
+
type: Boolean,
|
|
231
|
+
default: true
|
|
232
|
+
},
|
|
233
|
+
accept: String,
|
|
234
|
+
// 附件code
|
|
235
|
+
code: String,
|
|
236
|
+
// 业务id
|
|
237
|
+
ownId: String,
|
|
238
|
+
requiredOwnId: Boolean,
|
|
239
|
+
//
|
|
240
|
+
downloads: {
|
|
241
|
+
type: Boolean,
|
|
242
|
+
default: false
|
|
243
|
+
},
|
|
244
|
+
// 附件扩展编码
|
|
245
|
+
extendCode: String,
|
|
246
|
+
// 是否添加文件md5值
|
|
247
|
+
fileMd5: {
|
|
248
|
+
type: Boolean,
|
|
249
|
+
default: false
|
|
250
|
+
},
|
|
251
|
+
// 额外的参数
|
|
252
|
+
data: {
|
|
253
|
+
type: Object,
|
|
254
|
+
default() {
|
|
255
|
+
return {};
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
param: {
|
|
259
|
+
type: Object,
|
|
260
|
+
default() {
|
|
261
|
+
return {};
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
// 单文件大小
|
|
265
|
+
size: Number,
|
|
266
|
+
// 是否头像模式上传
|
|
267
|
+
portrait: {
|
|
268
|
+
type: Boolean,
|
|
269
|
+
default: false
|
|
270
|
+
},
|
|
271
|
+
photo: [String, Boolean],
|
|
272
|
+
//头像按钮框宽度
|
|
273
|
+
width: String,
|
|
274
|
+
//头像按钮框高度度
|
|
275
|
+
height: String,
|
|
276
|
+
// 自定义的文字提示
|
|
277
|
+
tips: {
|
|
278
|
+
type: String,
|
|
279
|
+
default: ''
|
|
280
|
+
},
|
|
281
|
+
dragSort: {
|
|
282
|
+
type: Boolean,
|
|
283
|
+
default: false
|
|
284
|
+
},
|
|
285
|
+
// 上传成功后绑定到file的内容
|
|
286
|
+
showInfo: {
|
|
287
|
+
type: Array,
|
|
288
|
+
default() {
|
|
289
|
+
return ['uploadTime', 'fileSize', 'userName'];
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
// 上传地址
|
|
293
|
+
action: String,
|
|
294
|
+
// 自动上传
|
|
295
|
+
autoUpload: {
|
|
296
|
+
type: Boolean,
|
|
297
|
+
default: true
|
|
298
|
+
},
|
|
299
|
+
// 是否支持多选文件
|
|
300
|
+
multiple: {
|
|
301
|
+
type: Boolean,
|
|
302
|
+
default: true
|
|
303
|
+
},
|
|
304
|
+
// 显示文件列表
|
|
305
|
+
showFileList: {
|
|
306
|
+
type: Boolean,
|
|
307
|
+
default: true
|
|
308
|
+
},
|
|
309
|
+
// 上传的文件列表
|
|
310
|
+
fileList: [Array, String],
|
|
311
|
+
filesParam: {
|
|
312
|
+
type: Object,
|
|
313
|
+
default() {
|
|
314
|
+
return {};
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
state: {
|
|
318
|
+
type: Number,
|
|
319
|
+
default: 1
|
|
320
|
+
},
|
|
321
|
+
selectType: {
|
|
322
|
+
type: String,
|
|
323
|
+
default: 'primary'
|
|
324
|
+
},
|
|
325
|
+
uploadType: {
|
|
326
|
+
type: String,
|
|
327
|
+
default: 'success'
|
|
328
|
+
},
|
|
329
|
+
host: {
|
|
330
|
+
type: String,
|
|
331
|
+
default() {
|
|
332
|
+
return util.getStorage('host') ? util.getStorage('host') : '';
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
message: Object,
|
|
336
|
+
btnSize: {
|
|
337
|
+
type: String,
|
|
338
|
+
default: 'medium'
|
|
339
|
+
},
|
|
340
|
+
// 只读
|
|
341
|
+
readonly: {
|
|
342
|
+
type: Boolean,
|
|
343
|
+
default: false
|
|
344
|
+
},
|
|
345
|
+
disabled: Boolean,
|
|
346
|
+
preview: { type: [Boolean, String], default: true },
|
|
347
|
+
exclude: String,
|
|
348
|
+
download: { type: [Boolean, String], default: true },
|
|
349
|
+
deleted: { type: [Boolean, String], default: true },
|
|
350
|
+
remove: { type: [Boolean, String], default: true },
|
|
351
|
+
beforeUpload: Function,
|
|
352
|
+
onPreview: Function,
|
|
353
|
+
// 文件列表排序
|
|
354
|
+
onSort: Function,
|
|
355
|
+
beforeRemove: Function,
|
|
356
|
+
onDownloads: Function,
|
|
357
|
+
onDownload: Function,
|
|
358
|
+
onSort: Function,
|
|
359
|
+
onSuccess: Function,
|
|
360
|
+
onChange: Function,
|
|
361
|
+
onRemove: Function,
|
|
362
|
+
onError: Function,
|
|
363
|
+
dangerouslyUseHTMLString: Boolean,
|
|
364
|
+
fileCount: Number,
|
|
365
|
+
listHeight: String,
|
|
366
|
+
display: Boolean,
|
|
367
|
+
resultFile: {
|
|
368
|
+
type: Boolean,
|
|
369
|
+
default: true
|
|
370
|
+
},
|
|
371
|
+
properties: {
|
|
372
|
+
type: String,
|
|
373
|
+
default() {
|
|
374
|
+
return getAdjunctProperties;
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
icons: {
|
|
378
|
+
type: Object,
|
|
379
|
+
default() {
|
|
380
|
+
return {};
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
picture: {
|
|
384
|
+
type: Object,
|
|
385
|
+
default() {
|
|
386
|
+
return {};
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
data() {
|
|
391
|
+
return {
|
|
392
|
+
lists: [],
|
|
393
|
+
image: '',
|
|
394
|
+
fileAccept: '',
|
|
395
|
+
fileSize: 0,
|
|
396
|
+
fileTotalSize: 0,
|
|
397
|
+
showImg: false,
|
|
398
|
+
imgChange: false,
|
|
399
|
+
title: '',
|
|
400
|
+
imgUrl: '',
|
|
401
|
+
styles: {},
|
|
402
|
+
showVideo: false,
|
|
403
|
+
videoChange: false,
|
|
404
|
+
source: '',
|
|
405
|
+
excludeNames: '',
|
|
406
|
+
previewAdjunct: previewAdjunct,
|
|
407
|
+
boxHeight: this.listHeight
|
|
408
|
+
};
|
|
409
|
+
},
|
|
410
|
+
computed: {
|
|
411
|
+
_icons() {
|
|
412
|
+
return {
|
|
413
|
+
ppt: 'es-icon-ppt',
|
|
414
|
+
png: 'es-icon-picture',
|
|
415
|
+
gif: 'es-icon-picture',
|
|
416
|
+
jpg: 'es-icon-picture',
|
|
417
|
+
xls: 'es-icon-excel',
|
|
418
|
+
xlsx: 'es-icon-excel',
|
|
419
|
+
docx: 'es-icon-word',
|
|
420
|
+
doc: 'es-icon-word',
|
|
421
|
+
rar: 'es-icon-zip',
|
|
422
|
+
zip: 'es-icon-zip',
|
|
423
|
+
txt: 'es-icon-txt',
|
|
424
|
+
ipa: 'es-icon-ios',
|
|
425
|
+
apk: 'es-icon-android',
|
|
426
|
+
mp4: 'es-icon-video',
|
|
427
|
+
avi: 'es-icon-video',
|
|
428
|
+
mp3: 'es-icon-audioo',
|
|
429
|
+
wma: 'es-icon-audioo',
|
|
430
|
+
pdf: 'es-icon-pdf',
|
|
431
|
+
...this.icons
|
|
432
|
+
};
|
|
433
|
+
},
|
|
434
|
+
_picture() {
|
|
435
|
+
return {
|
|
436
|
+
...picture,
|
|
437
|
+
...this.picture
|
|
438
|
+
};
|
|
439
|
+
},
|
|
440
|
+
isRequiredOwnId() {
|
|
441
|
+
if (!this.fileList || !this.fileList.length) {
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
return this.requiredOwnId;
|
|
445
|
+
},
|
|
446
|
+
show() {
|
|
447
|
+
if ((this.photo && typeof this.photo === 'string') || this.value) {
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
if (this.photo && typeof this.photo === 'string') {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
return this.showFileList;
|
|
454
|
+
},
|
|
455
|
+
url() {
|
|
456
|
+
let url = this.action
|
|
457
|
+
? this.action
|
|
458
|
+
: this.portrait || !this.multiple
|
|
459
|
+
? uploadOnlyOne
|
|
460
|
+
: uploads;
|
|
461
|
+
return url.indexOf(this.host) > -1 ? url : this.host + url;
|
|
462
|
+
},
|
|
463
|
+
excludes() {
|
|
464
|
+
return this.exclude ? this.exclude : this.excludeNames;
|
|
465
|
+
},
|
|
466
|
+
accepts() {
|
|
467
|
+
return this.accept
|
|
468
|
+
? this.accept
|
|
469
|
+
: this.fileAccept
|
|
470
|
+
? this.fileAccept
|
|
471
|
+
: this.portrait
|
|
472
|
+
? 'image/*'
|
|
473
|
+
: undefined;
|
|
474
|
+
},
|
|
475
|
+
sizes() {
|
|
476
|
+
return this.size ? this.size : this.fileSize ? this.fileSize : 0;
|
|
477
|
+
},
|
|
478
|
+
getAdjunctFileInfos() {
|
|
479
|
+
return typeof this.fileList === 'string'
|
|
480
|
+
? this.fileList
|
|
481
|
+
: getAdjunctFileInfos;
|
|
482
|
+
},
|
|
483
|
+
showList() {
|
|
484
|
+
return this.portrait || !this.multiple ? false : this.showFileList;
|
|
485
|
+
},
|
|
486
|
+
isDownloads() {
|
|
487
|
+
return this.downloads;
|
|
488
|
+
},
|
|
489
|
+
isDownload() {
|
|
490
|
+
if (this.download) {
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
return false;
|
|
494
|
+
},
|
|
495
|
+
isDisabled() {
|
|
496
|
+
if (this.readonly || this.disabled) {
|
|
497
|
+
return true;
|
|
498
|
+
} else {
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
isRemove() {
|
|
503
|
+
if (this.remove || this.deleted) {
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
return false;
|
|
507
|
+
},
|
|
508
|
+
isSort() {
|
|
509
|
+
return this.dragSort && !this.isDisabled;
|
|
510
|
+
},
|
|
511
|
+
datas() {
|
|
512
|
+
if (this.data) {
|
|
513
|
+
return util.extend({}, this.data, this.params);
|
|
514
|
+
}
|
|
515
|
+
return this.params;
|
|
516
|
+
},
|
|
517
|
+
params() {
|
|
518
|
+
let params = { userId: util.getStorage('userId'), ...this.param };
|
|
519
|
+
if (this.code !== undefined) {
|
|
520
|
+
params.code = this.code;
|
|
521
|
+
}
|
|
522
|
+
if (this.ownId !== undefined) {
|
|
523
|
+
params.ownId = this.ownId;
|
|
524
|
+
}
|
|
525
|
+
return params;
|
|
526
|
+
},
|
|
527
|
+
showMessage() {
|
|
528
|
+
if (this.message !== undefined) {
|
|
529
|
+
return util.extend({}, { success: true, error: true }, this.message);
|
|
530
|
+
}
|
|
531
|
+
return { success: true, error: true };
|
|
532
|
+
},
|
|
533
|
+
profile() {
|
|
534
|
+
if (this.image) {
|
|
535
|
+
if (typeof this.image === 'string') {
|
|
536
|
+
return this.image;
|
|
537
|
+
}
|
|
538
|
+
return (
|
|
539
|
+
this.host + previewAdjunct + '?adjunctId=' + this.image.adjunctId
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
if (this.value) {
|
|
543
|
+
if (typeof this.value === 'string') {
|
|
544
|
+
if (this.value.indexOf('data:image/') === -1) {
|
|
545
|
+
let val = util.jointUrl({
|
|
546
|
+
url: this.value,
|
|
547
|
+
reg: this.host + '/main2'
|
|
548
|
+
});
|
|
549
|
+
return val;
|
|
550
|
+
}
|
|
551
|
+
if (
|
|
552
|
+
this.value.indexOf(previewAdjunct) === -1 ||
|
|
553
|
+
this.value.indexOf('/') === -1
|
|
554
|
+
) {
|
|
555
|
+
return this.host + previewAdjunct + '?adjunctId=' + this.value;
|
|
556
|
+
}
|
|
557
|
+
return this.value;
|
|
558
|
+
} else if (Array.isArray(this.value)) {
|
|
559
|
+
let adjunctId = this.value[0].response
|
|
560
|
+
? this.value[0].response.adjunctId
|
|
561
|
+
: this.value[0].adjunctId;
|
|
562
|
+
return this.host + previewAdjunct + '?adjunctId=' + adjunctId;
|
|
563
|
+
} else {
|
|
564
|
+
let adjunctId = this.value.response
|
|
565
|
+
? this.value.response.adjunctId
|
|
566
|
+
: this.value.adjunctId;
|
|
567
|
+
return this.host + previewAdjunct + '?adjunctId=' + adjunctId;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (
|
|
571
|
+
this.photo &&
|
|
572
|
+
typeof this.photo === 'string' &&
|
|
573
|
+
this.photo.indexOf('data:image/') === -1
|
|
574
|
+
) {
|
|
575
|
+
let val = util.jointUrl({
|
|
576
|
+
url: this.photo,
|
|
577
|
+
reg: this.host + '/main2'
|
|
578
|
+
});
|
|
579
|
+
return val;
|
|
580
|
+
}
|
|
581
|
+
return this.photo;
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
watch: {
|
|
585
|
+
fileList: {
|
|
586
|
+
immediate: true,
|
|
587
|
+
deep: true,
|
|
588
|
+
handler(val) {
|
|
589
|
+
if (Array.isArray(val) && val.length > 0) {
|
|
590
|
+
this.lists = val;
|
|
591
|
+
} else {
|
|
592
|
+
this.getFiles(this.params);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
params: {
|
|
597
|
+
deep: true,
|
|
598
|
+
handler(val) {
|
|
599
|
+
this.getFiles(val);
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
lists: {
|
|
603
|
+
deep: true,
|
|
604
|
+
handler(val) {
|
|
605
|
+
this.$emit('update:fileCount', val.length);
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
display(val) {
|
|
609
|
+
val && this.getHeight();
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
created() {
|
|
613
|
+
this.getAdjunctPropertie();
|
|
614
|
+
},
|
|
615
|
+
mounted() {
|
|
616
|
+
this.$nextTick(() => {
|
|
617
|
+
this.getHeight();
|
|
618
|
+
});
|
|
619
|
+
},
|
|
620
|
+
methods: {
|
|
621
|
+
getHeight() {
|
|
622
|
+
if (this.height === 'auto') {
|
|
623
|
+
let pt =
|
|
624
|
+
parseInt(util.getStyle(this.$el.parentNode, 'padding-top'), 10) || 0;
|
|
625
|
+
let pb =
|
|
626
|
+
parseInt(util.getStyle(this.$el.parentNode, 'padding-bottom'), 10) ||
|
|
627
|
+
0;
|
|
628
|
+
let btn = this.$refs.upload.$children[0].$el.offsetHeight || 0;
|
|
629
|
+
this.boxHeight =
|
|
630
|
+
this.$el.parentNode.offsetHeight - pt - pb - btn + 'px';
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
//根据code获取附件参数配置
|
|
634
|
+
getAdjunctPropertie() {
|
|
635
|
+
if (this.code !== undefined) {
|
|
636
|
+
util
|
|
637
|
+
.ajax({
|
|
638
|
+
method: this.method,
|
|
639
|
+
url: this.properties,
|
|
640
|
+
data: { code: this.code },
|
|
641
|
+
params: { code: this.code }
|
|
642
|
+
})
|
|
643
|
+
.then(res => {
|
|
644
|
+
if (res.rCode === 0) {
|
|
645
|
+
if (res.results) {
|
|
646
|
+
this.excludeNames = res.results.excludeName;
|
|
647
|
+
this.fileAccept = res.results.fileTypeExtName.replace(
|
|
648
|
+
new RegExp(';', 'gm'),
|
|
649
|
+
','
|
|
650
|
+
);
|
|
651
|
+
this.fileSize = res.results.limitFileSize
|
|
652
|
+
? res.results.limitFileSize / 1024 / 1024
|
|
653
|
+
: 0;
|
|
654
|
+
this.fileTotalSize = res.results.limitTotalSize;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
})
|
|
658
|
+
.catch(err => {
|
|
659
|
+
if (err.message && err.message !== 'canceled') {
|
|
660
|
+
this.$message.error(err.message);
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
getFiles(params) {
|
|
666
|
+
if (
|
|
667
|
+
!this.show ||
|
|
668
|
+
(this.isRequiredOwnId &&
|
|
669
|
+
!Object.prototype.hasOwnProperty.call(params, 'ownId'))
|
|
670
|
+
) {
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
util
|
|
674
|
+
.ajax({
|
|
675
|
+
method: this.method,
|
|
676
|
+
url: this.getAdjunctFileInfos,
|
|
677
|
+
data: params,
|
|
678
|
+
params: params,
|
|
679
|
+
format: false
|
|
680
|
+
})
|
|
681
|
+
.then(res => {
|
|
682
|
+
if (res.rCode === 0) {
|
|
683
|
+
if (this.portrait === true) {
|
|
684
|
+
this.image = JSON.parse(JSON.stringify(res.results))[0];
|
|
685
|
+
} else {
|
|
686
|
+
this.lists = JSON.parse(JSON.stringify(res.results));
|
|
687
|
+
this.$emit('input', this.lists);
|
|
688
|
+
}
|
|
689
|
+
} else {
|
|
690
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
691
|
+
this.$message.error(msg);
|
|
692
|
+
}
|
|
693
|
+
})
|
|
694
|
+
.catch(err => {
|
|
695
|
+
if (err.message && err.message !== 'canceled') {
|
|
696
|
+
this.$message.error(err.message);
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
},
|
|
700
|
+
handleUpload() {
|
|
701
|
+
this.$refs.upload.submit();
|
|
702
|
+
},
|
|
703
|
+
handlePreview(res) {
|
|
704
|
+
if (this.preview) {
|
|
705
|
+
if (this.onPreview) {
|
|
706
|
+
this.onPreview(res);
|
|
707
|
+
} else {
|
|
708
|
+
let file = res.response ? res.response : res;
|
|
709
|
+
let url =
|
|
710
|
+
typeof this.preview === 'string'
|
|
711
|
+
? this.preview
|
|
712
|
+
: typeof this.preview === 'function'
|
|
713
|
+
? this.preview(file)
|
|
714
|
+
: null;
|
|
715
|
+
if (res.status === 'success') {
|
|
716
|
+
let suffix = file.suffix;
|
|
717
|
+
suffix = suffix.toLowerCase();
|
|
718
|
+
if (
|
|
719
|
+
suffix.includes('doc') ||
|
|
720
|
+
suffix.includes('docx') ||
|
|
721
|
+
suffix.includes('xls') ||
|
|
722
|
+
suffix.includes('xlsx') ||
|
|
723
|
+
suffix.includes('ppt')
|
|
724
|
+
) {
|
|
725
|
+
util.win.open(
|
|
726
|
+
this.host +
|
|
727
|
+
(url ? url : previewAdjunctOffice) +
|
|
728
|
+
'?cmd=view&bucketName=' +
|
|
729
|
+
file.absolutePath +
|
|
730
|
+
'&fileId=' +
|
|
731
|
+
file.adjunctId +
|
|
732
|
+
'&fileName=' +
|
|
733
|
+
file.newName
|
|
734
|
+
);
|
|
735
|
+
} else if (suffix.includes('pdf')) {
|
|
736
|
+
util.win.open(
|
|
737
|
+
this.host +
|
|
738
|
+
(url ? url : previewAdjunct2) +
|
|
739
|
+
'/' +
|
|
740
|
+
file.originalName +
|
|
741
|
+
'?adjunctId=' +
|
|
742
|
+
file.adjunctId
|
|
743
|
+
);
|
|
744
|
+
} else if (
|
|
745
|
+
suffix.includes('jpge') ||
|
|
746
|
+
suffix.includes('jpg') ||
|
|
747
|
+
suffix.includes('gif') ||
|
|
748
|
+
suffix.includes('png')
|
|
749
|
+
) {
|
|
750
|
+
this.imgUrl =
|
|
751
|
+
this.host +
|
|
752
|
+
(url ? url : previewAdjunct) +
|
|
753
|
+
'?adjunctId=' +
|
|
754
|
+
file.adjunctId;
|
|
755
|
+
this.title = file.originalName;
|
|
756
|
+
this.showImg = true;
|
|
757
|
+
this.$nextTick(() => {
|
|
758
|
+
this.loadImage();
|
|
759
|
+
});
|
|
760
|
+
} else if (suffix.includes('mp4')) {
|
|
761
|
+
this.source = {
|
|
762
|
+
src:
|
|
763
|
+
this.host +
|
|
764
|
+
(url ? url : previewAdjunct) +
|
|
765
|
+
'?adjunctId=' +
|
|
766
|
+
file.adjunctId
|
|
767
|
+
};
|
|
768
|
+
this.title = file.originalName;
|
|
769
|
+
this.showVideo = true;
|
|
770
|
+
} else {
|
|
771
|
+
util.win.open(
|
|
772
|
+
this.host +
|
|
773
|
+
(url ? url : previewAdjunct) +
|
|
774
|
+
'?adjunctId=' +
|
|
775
|
+
file.adjunctId
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
} else {
|
|
779
|
+
util.win.open(URL.createObjectURL(file.raw));
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
loadImage() {
|
|
785
|
+
this.$refs.showImg.onload = () => {
|
|
786
|
+
this.imgChange = false;
|
|
787
|
+
let w = this.$refs.showImg.naturalWidth;
|
|
788
|
+
let h = this.$refs.showImg.naturalHeight;
|
|
789
|
+
let pw = this.$refs.showImg.parentNode.offsetWidth;
|
|
790
|
+
let ph = this.$refs.showImg.parentNode.offsetHeight;
|
|
791
|
+
if (w / h > pw / ph) {
|
|
792
|
+
this.styles = { 'max-width': '100%' };
|
|
793
|
+
} else {
|
|
794
|
+
this.styles = { 'max-height': '100%' };
|
|
795
|
+
}
|
|
796
|
+
if (w < pw) {
|
|
797
|
+
this.styles.width = w + 'px';
|
|
798
|
+
}
|
|
799
|
+
if (h < ph) {
|
|
800
|
+
this.styles.height = h + 'px';
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
},
|
|
804
|
+
isLt(file) {
|
|
805
|
+
const flag =
|
|
806
|
+
this.sizes === 0 ? true : file.size / 1024 / 1024 < this.sizes;
|
|
807
|
+
if (!flag) {
|
|
808
|
+
this.$message.error('上传头像图片大小不能超过 ' + this.sizes + 'MB!');
|
|
809
|
+
}
|
|
810
|
+
return flag;
|
|
811
|
+
},
|
|
812
|
+
handleBeforeUpload(file) {
|
|
813
|
+
if (this.portrait) {
|
|
814
|
+
const flag = this.isLt(file);
|
|
815
|
+
if (flag && this.beforeUpload) {
|
|
816
|
+
return this.beforeUpload(file);
|
|
817
|
+
}
|
|
818
|
+
return flag;
|
|
819
|
+
}
|
|
820
|
+
if (this.beforeUpload) {
|
|
821
|
+
return this.beforeUpload(file);
|
|
822
|
+
}
|
|
823
|
+
return true;
|
|
824
|
+
},
|
|
825
|
+
handleBeforeRemove(file, fileList) {
|
|
826
|
+
if (file && file.status === 'success') {
|
|
827
|
+
return this.$confirm('确定删除文件吗?', '提示', {
|
|
828
|
+
confirmButtonText: '确定',
|
|
829
|
+
cancelButtonText: '取消',
|
|
830
|
+
type: 'warning'
|
|
831
|
+
})
|
|
832
|
+
.then(() => {
|
|
833
|
+
if (this.beforeRemove) {
|
|
834
|
+
return this.beforeRemove(file, fileList);
|
|
835
|
+
} else if (file.status === 'success') {
|
|
836
|
+
let userName =
|
|
837
|
+
file.userName ||
|
|
838
|
+
(file.response && file.response.userName) ||
|
|
839
|
+
util.getStorage('userName');
|
|
840
|
+
// eslint-disable-next-line no-undef
|
|
841
|
+
return new Promise((resolve, reject) => {
|
|
842
|
+
let url =
|
|
843
|
+
typeof this.deleted === 'string'
|
|
844
|
+
? this.deleted
|
|
845
|
+
: this.remove === 'string'
|
|
846
|
+
? this.remove
|
|
847
|
+
: delAdjunct;
|
|
848
|
+
util
|
|
849
|
+
.ajax({
|
|
850
|
+
method: this.method,
|
|
851
|
+
url: url,
|
|
852
|
+
data: {
|
|
853
|
+
userName: userName,
|
|
854
|
+
id: file.adjunctId || file.response.adjunctId
|
|
855
|
+
},
|
|
856
|
+
params: {
|
|
857
|
+
userName: userName,
|
|
858
|
+
id: file.adjunctId || file.response.adjunctId
|
|
859
|
+
}
|
|
860
|
+
})
|
|
861
|
+
.then(res => {
|
|
862
|
+
if (res.rCode === 0) {
|
|
863
|
+
this.$message.success(res.msg);
|
|
864
|
+
resolve();
|
|
865
|
+
} else {
|
|
866
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
867
|
+
this.$message.error(msg);
|
|
868
|
+
reject();
|
|
869
|
+
}
|
|
870
|
+
})
|
|
871
|
+
.catch(err => {
|
|
872
|
+
if (err.message && err.message !== 'canceled') {
|
|
873
|
+
this.$message.error(err.message);
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
return true;
|
|
879
|
+
})
|
|
880
|
+
.catch(() => {
|
|
881
|
+
return flag;
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
handleDownloads() {
|
|
886
|
+
let url =
|
|
887
|
+
typeof this.downloads === 'string' ? this.downloads : uploadDownloads;
|
|
888
|
+
util.win.open(
|
|
889
|
+
this.host +
|
|
890
|
+
url +
|
|
891
|
+
'?ownId=' +
|
|
892
|
+
this.ownId +
|
|
893
|
+
'&code=' +
|
|
894
|
+
this.code +
|
|
895
|
+
(this.extendCode ? '&extendCode=' + this.extendCode : '')
|
|
896
|
+
);
|
|
897
|
+
},
|
|
898
|
+
handleDownload(file) {
|
|
899
|
+
if (file.status === 'success') {
|
|
900
|
+
let url =
|
|
901
|
+
typeof this.download === 'string'
|
|
902
|
+
? this.download
|
|
903
|
+
: downloadByAdjunctId;
|
|
904
|
+
util.win.open(
|
|
905
|
+
this.host +
|
|
906
|
+
url +
|
|
907
|
+
'?adjunctId=' +
|
|
908
|
+
(file.adjunctId || file.response.adjunctId)
|
|
909
|
+
);
|
|
910
|
+
} else {
|
|
911
|
+
this.aLinkDownload(file);
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
handleClick(res) {
|
|
915
|
+
if (res.event && typeof res.event === 'function') {
|
|
916
|
+
res.event(res);
|
|
917
|
+
} else {
|
|
918
|
+
this.$emit('click', res);
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
aLinkDownload(file) {
|
|
922
|
+
var a = document.createElement('a');
|
|
923
|
+
let event = new MouseEvent('click');
|
|
924
|
+
a.href = URL.createObjectURL(file.raw);
|
|
925
|
+
a.download = file.name;
|
|
926
|
+
a.dispatchEvent(event);
|
|
927
|
+
},
|
|
928
|
+
handleSort(files) {
|
|
929
|
+
if (this.isSort) {
|
|
930
|
+
if (this.onSort) {
|
|
931
|
+
this.onSort(files);
|
|
932
|
+
} else {
|
|
933
|
+
let ids = files.map(item => {
|
|
934
|
+
if (item.status === 'success') {
|
|
935
|
+
return item.adjunctId || item.response.adjunctId;
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
ids = ids.join(',');
|
|
939
|
+
util
|
|
940
|
+
.ajax({
|
|
941
|
+
method: this.method,
|
|
942
|
+
url: uploadSort,
|
|
943
|
+
data: {
|
|
944
|
+
ids: ids
|
|
945
|
+
},
|
|
946
|
+
params: {
|
|
947
|
+
ids: ids
|
|
948
|
+
}
|
|
949
|
+
})
|
|
950
|
+
.then(res => {
|
|
951
|
+
if (res.rCode === 0) {
|
|
952
|
+
this.$message.success(res.msg);
|
|
953
|
+
} else {
|
|
954
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
955
|
+
this.$message.error(msg);
|
|
956
|
+
}
|
|
957
|
+
})
|
|
958
|
+
.catch(err => {
|
|
959
|
+
if (err.message && err.message !== 'canceled') {
|
|
960
|
+
this.$message.error(err.message);
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
handleSuccess(response, file, fileList) {
|
|
967
|
+
if (this.portrait) {
|
|
968
|
+
this.image = URL.createObjectURL(file.raw);
|
|
969
|
+
}
|
|
970
|
+
if (this.showMessage.success) {
|
|
971
|
+
if (response.rCode) {
|
|
972
|
+
if (this.dangerouslyUseHTMLString) {
|
|
973
|
+
this.$alert(
|
|
974
|
+
response.msg ? response.msg : '上传失败:请联系管理员',
|
|
975
|
+
'提示',
|
|
976
|
+
{
|
|
977
|
+
dangerouslyUseHTMLString: true,
|
|
978
|
+
setHeight: response.msg
|
|
979
|
+
}
|
|
980
|
+
).catch();
|
|
981
|
+
} else {
|
|
982
|
+
this.$message({
|
|
983
|
+
type: 'error',
|
|
984
|
+
message: response.msg || '成功!'
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
} else {
|
|
988
|
+
this.$message.success(response.msg);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
this.onSuccess && this.onSuccess(response, file, fileList);
|
|
992
|
+
this.$emit('success', response, file, fileList);
|
|
993
|
+
if (this.resultFile) {
|
|
994
|
+
if (this.portrait) {
|
|
995
|
+
this.$emit('input', file);
|
|
996
|
+
} else {
|
|
997
|
+
this.$emit('input', fileList);
|
|
998
|
+
}
|
|
999
|
+
if (this.elForm) {
|
|
1000
|
+
this.elForm.clearValidate(this.name);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
handleChange(file, fileList) {
|
|
1005
|
+
this.$emit('change', fileList);
|
|
1006
|
+
this.onChange && this.onChange(file, fileList);
|
|
1007
|
+
},
|
|
1008
|
+
handleRemove(file, fileList) {
|
|
1009
|
+
this.$emit('input', fileList);
|
|
1010
|
+
this.$emit('remove', file, fileList);
|
|
1011
|
+
this.$emit('change', fileList);
|
|
1012
|
+
this.onRemove && this.onRemove(file, fileList);
|
|
1013
|
+
},
|
|
1014
|
+
handleError(err, file, fileList) {
|
|
1015
|
+
if (this.showMessage.error) {
|
|
1016
|
+
if (this.dangerouslyUseHTMLString) {
|
|
1017
|
+
this.$alert(err.msg ? err.msg : '上传失败:请联系管理员', '提示', {
|
|
1018
|
+
dangerouslyUseHTMLString: true,
|
|
1019
|
+
setHeight: err.msg
|
|
1020
|
+
}).catch();
|
|
1021
|
+
} else {
|
|
1022
|
+
this.$message({
|
|
1023
|
+
type: 'error',
|
|
1024
|
+
message: '上传失败:' + (err.msg ? err.msg : '请联系管理员')
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
this.$emit('error', err, file, fileList);
|
|
1029
|
+
this.onError && this.onError(err, file, fileList);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
</script>
|