cy-element-ui 1.0.4 → 1.0.6
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/README.md +22 -13
- package/lib/alert.js +211 -203
- package/lib/aside.js +29 -29
- package/lib/autocomplete.js +4615 -483
- package/lib/avatar.js +152 -126
- package/lib/backtop.js +117 -125
- package/lib/badge.js +128 -134
- package/lib/breadcrumb-item.js +146 -122
- package/lib/breadcrumb.js +97 -96
- package/lib/button-group.js +68 -65
- package/lib/button.js +67 -87
- package/lib/calendar.js +2475 -603
- package/lib/card.js +101 -100
- package/lib/carousel-item.js +854 -210
- package/lib/carousel.js +575 -408
- package/lib/cascader-panel.js +3546 -1153
- package/lib/cascader.js +7376 -970
- package/lib/checkbox-button.js +337 -290
- package/lib/checkbox-group.js +176 -105
- package/lib/checkbox.js +240 -220
- package/lib/col.js +113 -68
- package/lib/collapse-item.js +1228 -225
- package/lib/collapse.js +163 -123
- package/lib/color-picker.js +5223 -1251
- package/lib/container.js +98 -88
- package/lib/date-picker.js +8396 -3945
- package/lib/descriptions-item.js +53 -32
- package/lib/descriptions.js +697 -334
- package/lib/dialog.js +1725 -247
- package/lib/directives/mousewheel.js +14 -20
- package/lib/directives/repeat-click.js +27 -30
- package/lib/divider.js +38 -45
- package/lib/drawer.js +1032 -238
- package/lib/dropdown-item.js +159 -111
- package/lib/dropdown-menu.js +2445 -117
- package/lib/dropdown.js +1675 -366
- package/lib/element-ui.common.js +49110 -39985
- package/lib/empty.js +1084 -203
- package/lib/fileUpload.js +3900 -0
- package/lib/footer.js +29 -29
- package/lib/form-item.js +1236 -467
- package/lib/form.js +326 -258
- package/lib/header.js +80 -80
- package/lib/icon.js +71 -68
- package/lib/image.js +2389 -743
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +814 -150
- package/lib/input-number.js +2181 -444
- package/lib/input.js +1197 -517
- package/lib/link.js +117 -135
- package/lib/loading.js +1130 -363
- package/lib/locale/format.js +38 -49
- package/lib/locale/index.js +38 -52
- package/lib/locale/lang/af-ZA.js +130 -123
- package/lib/locale/lang/ar.js +123 -122
- package/lib/locale/lang/az.js +122 -121
- package/lib/locale/lang/bg.js +133 -123
- package/lib/locale/lang/bn.js +121 -121
- package/lib/locale/lang/ca.js +123 -122
- package/lib/locale/lang/cs-CZ.js +127 -125
- package/lib/locale/lang/da.js +124 -122
- package/lib/locale/lang/de.js +126 -124
- package/lib/locale/lang/ee.js +125 -123
- package/lib/locale/lang/el.js +125 -123
- package/lib/locale/lang/en.js +127 -123
- package/lib/locale/lang/eo.js +125 -123
- package/lib/locale/lang/es.js +123 -122
- package/lib/locale/lang/eu.js +128 -123
- package/lib/locale/lang/fa.js +125 -123
- package/lib/locale/lang/fi.js +125 -123
- package/lib/locale/lang/fr.js +125 -122
- package/lib/locale/lang/he.js +130 -123
- package/lib/locale/lang/hr.js +128 -123
- package/lib/locale/lang/hu.js +124 -122
- package/lib/locale/lang/hy-AM.js +125 -123
- package/lib/locale/lang/id.js +124 -123
- package/lib/locale/lang/is.js +124 -123
- package/lib/locale/lang/it.js +123 -122
- package/lib/locale/lang/ja.js +125 -123
- package/lib/locale/lang/kg.js +125 -123
- package/lib/locale/lang/km.js +124 -123
- package/lib/locale/lang/ko.js +125 -123
- package/lib/locale/lang/ku.js +125 -123
- package/lib/locale/lang/kz.js +125 -123
- package/lib/locale/lang/lo-LA.js +121 -121
- package/lib/locale/lang/lt.js +125 -123
- package/lib/locale/lang/lv.js +125 -123
- package/lib/locale/lang/mn.js +125 -123
- package/lib/locale/lang/ms.js +123 -122
- package/lib/locale/lang/nb-NO.js +123 -122
- package/lib/locale/lang/nl.js +125 -123
- package/lib/locale/lang/pl.js +125 -123
- package/lib/locale/lang/pt-br.js +124 -123
- package/lib/locale/lang/pt.js +133 -123
- package/lib/locale/lang/ro.js +125 -123
- package/lib/locale/lang/ru-RU.js +124 -123
- package/lib/locale/lang/si.js +127 -123
- package/lib/locale/lang/sk.js +126 -125
- package/lib/locale/lang/sl.js +125 -123
- package/lib/locale/lang/sr-Latn.js +124 -123
- package/lib/locale/lang/sr.js +128 -123
- package/lib/locale/lang/sv-SE.js +128 -123
- package/lib/locale/lang/sw.js +127 -123
- package/lib/locale/lang/ta.js +130 -122
- package/lib/locale/lang/th.js +127 -123
- package/lib/locale/lang/tk.js +129 -123
- package/lib/locale/lang/tr-TR.js +125 -123
- package/lib/locale/lang/ua.js +124 -123
- package/lib/locale/lang/ug-CN.js +124 -123
- package/lib/locale/lang/uz-UZ.js +124 -123
- package/lib/locale/lang/vi.js +124 -123
- package/lib/locale/lang/zh-CN.js +124 -123
- package/lib/locale/lang/zh-TW.js +128 -123
- package/lib/main.js +23 -21
- package/lib/menu-item-group.js +105 -111
- package/lib/menu-item.js +3558 -253
- package/lib/menu.js +1680 -528
- package/lib/message-box.js +3427 -684
- package/lib/message.js +1677 -229
- package/lib/mixins/emitter.js +28 -30
- package/lib/mixins/focus.js +10 -11
- package/lib/mixins/locale.js +12 -14
- package/lib/mixins/migrating.js +38 -45
- package/lib/notification.js +1707 -269
- package/lib/option-group.js +190 -139
- package/lib/option.js +949 -196
- package/lib/page-header.js +964 -42
- package/lib/pagination.js +6947 -641
- package/lib/popconfirm.js +3951 -223
- package/lib/popover.js +3247 -369
- package/lib/progress.js +254 -244
- package/lib/radio-button.js +259 -226
- package/lib/radio-group.js +249 -186
- package/lib/radio.js +263 -253
- package/lib/rate.js +1399 -420
- package/lib/result.js +183 -227
- package/lib/row.js +58 -41
- package/lib/scrollbar.js +1331 -278
- package/lib/select.js +5816 -1428
- package/lib/skeleton-item.js +133 -145
- package/lib/skeleton.js +82 -91
- package/lib/slider.js +5157 -702
- package/lib/spinner.js +113 -101
- package/lib/statistic.js +10205 -254
- package/lib/step.js +274 -311
- package/lib/steps.js +854 -117
- package/lib/subTitle.js +292 -0
- package/lib/submenu.js +2867 -429
- package/lib/switch.js +1051 -291
- package/lib/tab-pane.js +125 -135
- package/lib/tabDialog.js +2658 -0
- package/lib/table-column.js +1975 -751
- package/lib/table.js +8019 -3979
- package/lib/tabs.js +1455 -605
- package/lib/tag.js +73 -68
- package/lib/theme-chalk/src/index.scss +3 -0
- package/lib/time-picker.js +6821 -1944
- package/lib/time-select.js +6297 -1186
- package/lib/timeline-item.js +43 -84
- package/lib/timeline.js +43 -39
- package/lib/tooltip.js +3185 -287
- package/lib/transfer.js +2943 -625
- package/lib/transitions/collapse-transition.js +69 -87
- package/lib/tree.js +3312 -1791
- package/lib/treeSelect.js +4436 -0
- package/lib/umd/locale/af-ZA.js +145 -138
- package/lib/umd/locale/ar.js +138 -137
- package/lib/umd/locale/az.js +139 -137
- package/lib/umd/locale/bg.js +148 -138
- package/lib/umd/locale/bn.js +138 -137
- package/lib/umd/locale/ca.js +138 -137
- package/lib/umd/locale/cs-CZ.js +142 -140
- package/lib/umd/locale/da.js +139 -137
- package/lib/umd/locale/de.js +141 -139
- package/lib/umd/locale/ee.js +140 -138
- package/lib/umd/locale/el.js +140 -138
- package/lib/umd/locale/en.js +142 -138
- package/lib/umd/locale/eo.js +140 -138
- package/lib/umd/locale/es.js +138 -137
- package/lib/umd/locale/eu.js +143 -138
- package/lib/umd/locale/fa.js +140 -138
- package/lib/umd/locale/fi.js +140 -138
- package/lib/umd/locale/fr.js +140 -137
- package/lib/umd/locale/he.js +145 -138
- package/lib/umd/locale/hr.js +143 -138
- package/lib/umd/locale/hu.js +139 -137
- package/lib/umd/locale/hy-AM.js +140 -138
- package/lib/umd/locale/id.js +139 -138
- package/lib/umd/locale/is.js +139 -138
- package/lib/umd/locale/it.js +138 -137
- package/lib/umd/locale/ja.js +140 -138
- package/lib/umd/locale/kg.js +140 -138
- package/lib/umd/locale/km.js +139 -138
- package/lib/umd/locale/ko.js +140 -138
- package/lib/umd/locale/ku.js +140 -138
- package/lib/umd/locale/kz.js +140 -138
- package/lib/umd/locale/lo-LA.js +138 -137
- package/lib/umd/locale/lt.js +140 -138
- package/lib/umd/locale/lv.js +140 -138
- package/lib/umd/locale/mn.js +140 -138
- package/lib/umd/locale/ms.js +138 -137
- package/lib/umd/locale/nb-NO.js +138 -137
- package/lib/umd/locale/nl.js +140 -138
- package/lib/umd/locale/pl.js +140 -138
- package/lib/umd/locale/pt-br.js +139 -138
- package/lib/umd/locale/pt.js +148 -138
- package/lib/umd/locale/ro.js +140 -138
- package/lib/umd/locale/ru-RU.js +139 -138
- package/lib/umd/locale/si.js +142 -138
- package/lib/umd/locale/sk.js +141 -140
- package/lib/umd/locale/sl.js +140 -138
- package/lib/umd/locale/sr-Latn.js +139 -138
- package/lib/umd/locale/sr.js +143 -138
- package/lib/umd/locale/sv-SE.js +143 -138
- package/lib/umd/locale/sw.js +142 -138
- package/lib/umd/locale/ta.js +145 -137
- package/lib/umd/locale/th.js +142 -138
- package/lib/umd/locale/tk.js +144 -138
- package/lib/umd/locale/tr-TR.js +140 -138
- package/lib/umd/locale/ua.js +139 -138
- package/lib/umd/locale/ug-CN.js +139 -138
- package/lib/umd/locale/uz-UZ.js +139 -138
- package/lib/umd/locale/vi.js +139 -138
- package/lib/umd/locale/zh-CN.js +139 -138
- package/lib/umd/locale/zh-TW.js +143 -138
- package/lib/upload.js +2377 -987
- package/lib/utils/after-leave.js +36 -33
- package/lib/utils/aria-dialog.js +55 -73
- package/lib/utils/aria-utils.js +67 -76
- package/lib/utils/clickoutside.js +52 -60
- package/lib/utils/date-util.js +198 -241
- package/lib/utils/date.js +6 -368
- package/lib/utils/date_source.js +349 -0
- package/lib/utils/dom.js +167 -183
- package/lib/utils/lodash.js +13 -9421
- package/lib/utils/lodash_source.js +9421 -0
- package/lib/utils/menu/aria-menubar.js +13 -18
- package/lib/utils/menu/aria-menuitem.js +43 -54
- package/lib/utils/menu/aria-submenu.js +50 -59
- package/lib/utils/merge.js +15 -17
- package/lib/utils/popper.js +1141 -1170
- package/lib/utils/popup/index.js +186 -230
- package/lib/utils/popup/popup-manager.js +159 -191
- package/lib/utils/resize-event.js +29 -44
- package/lib/utils/scroll-into-view.js +25 -33
- package/lib/utils/scrollbar-width.js +25 -36
- package/lib/utils/shared.js +3 -3
- package/lib/utils/types.js +19 -32
- package/lib/utils/util.js +187 -221
- package/lib/utils/vdom.js +5 -9
- package/lib/utils/vue-popper.js +166 -188
- package/package.json +22 -19
- package/packages/alert/src/main.vue +63 -63
- package/packages/aside/src/main.vue +9 -9
- package/packages/autocomplete/src/autocomplete-suggestions.vue +46 -46
- package/packages/autocomplete/src/autocomplete.vue +198 -198
- package/packages/avatar/src/main.vue +5 -5
- package/packages/backtop/src/main.vue +3 -3
- package/packages/badge/src/main.vue +1 -1
- package/packages/breadcrumb/src/breadcrumb-item.vue +26 -26
- package/packages/breadcrumb/src/breadcrumb.vue +22 -22
- package/packages/button/src/button-group.vue +3 -3
- package/packages/button/src/button.vue +44 -44
- package/packages/calendar/src/date-table.vue +3 -3
- package/packages/calendar/src/main.vue +7 -7
- package/packages/card/src/main.vue +9 -9
- package/packages/carousel/src/item.vue +98 -98
- package/packages/carousel/src/main.vue +2 -2
- package/packages/cascader/src/cascader.vue +4 -4
- package/packages/cascader-panel/src/cascader-menu.vue +4 -4
- package/packages/cascader-panel/src/cascader-node.vue +232 -232
- package/packages/cascader-panel/src/cascader-panel.vue +3 -3
- package/packages/cascader-panel/src/node.js +2 -3
- package/packages/cascader-panel/src/store.js +0 -1
- package/packages/checkbox/src/checkbox-button.vue +139 -139
- package/packages/checkbox/src/checkbox-group.vue +33 -33
- package/packages/checkbox/src/checkbox.vue +140 -140
- package/packages/col/src/col.js +5 -5
- package/packages/collapse/src/collapse-item.vue +55 -55
- package/packages/collapse/src/collapse.vue +54 -54
- package/packages/color-picker/src/color.js +4 -4
- package/packages/color-picker/src/components/alpha-slider.vue +100 -100
- package/packages/color-picker/src/components/hue-slider.vue +91 -91
- package/packages/color-picker/src/components/picker-dropdown.vue +64 -64
- package/packages/color-picker/src/components/predefine.vue +43 -43
- package/packages/color-picker/src/components/sv-panel.vue +70 -70
- package/packages/color-picker/src/main.vue +141 -141
- package/packages/container/src/main.vue +20 -20
- package/packages/date-picker/src/basic/date-table.vue +360 -360
- package/packages/date-picker/src/basic/month-table.vue +222 -223
- package/packages/date-picker/src/basic/time-spinner.vue +174 -174
- package/packages/date-picker/src/basic/year-table.vue +91 -91
- package/packages/date-picker/src/panel/date-range.vue +415 -415
- package/packages/date-picker/src/panel/date.vue +423 -423
- package/packages/date-picker/src/panel/month-range.vue +177 -177
- package/packages/date-picker/src/panel/time-range.vue +173 -173
- package/packages/date-picker/src/panel/time-select.vue +131 -131
- package/packages/date-picker/src/panel/time.vue +131 -131
- package/packages/date-picker/src/picker.vue +7 -7
- package/packages/descriptions/src/descriptions-row.js +3 -3
- package/packages/descriptions/src/index.js +1 -1
- package/packages/dialog/src/component.vue +155 -155
- package/packages/divider/src/main.vue +1 -1
- package/packages/drawer/src/main.vue +2 -2
- package/packages/dropdown/src/dropdown-item.vue +15 -15
- package/packages/dropdown/src/dropdown-menu.vue +47 -47
- package/packages/dropdown/src/dropdown.vue +260 -260
- package/packages/empty/src/index.vue +1 -1
- package/packages/fileUpload/index.js +8 -0
- package/packages/fileUpload/src/main.vue +430 -0
- package/packages/footer/src/main.vue +9 -9
- package/packages/form/src/form-item.vue +245 -245
- package/packages/form/src/form.vue +154 -154
- package/packages/header/src/main.vue +9 -9
- package/packages/icon/src/icon.vue +6 -6
- package/packages/image/src/image-viewer.vue +9 -9
- package/packages/image/src/main.vue +206 -206
- package/packages/infinite-scroll/src/main.js +1 -2
- package/packages/input/src/calcTextareaHeight.js +2 -2
- package/packages/input/src/input.vue +311 -311
- package/packages/input-number/src/input-number.vue +205 -205
- package/packages/loading/src/loading.vue +19 -19
- package/packages/main/src/main.vue +4 -4
- package/packages/menu/src/menu-item-group.vue +27 -27
- package/packages/menu/src/menu-item.vue +69 -69
- package/packages/menu/src/menu.vue +284 -284
- package/packages/menu/src/submenu.vue +308 -309
- package/packages/message/src/main.js +1 -1
- package/packages/message/src/main.vue +72 -72
- package/packages/message-box/src/main.vue +216 -216
- package/packages/notification/src/main.js +1 -1
- package/packages/notification/src/main.vue +93 -93
- package/packages/pagination/src/pager.vue +99 -99
- package/packages/popconfirm/src/main.vue +28 -28
- package/packages/popover/src/main.vue +6 -6
- package/packages/progress/src/progress.vue +174 -174
- package/packages/radio/src/radio-button.vue +64 -64
- package/packages/radio/src/radio-group.vue +88 -88
- package/packages/radio/src/radio.vue +74 -74
- package/packages/rate/src/main.vue +270 -270
- package/packages/row/src/row.js +3 -3
- package/packages/scrollbar/src/main.js +2 -2
- package/packages/scrollbar/src/util.js +1 -1
- package/packages/select/src/option-group.vue +46 -46
- package/packages/select/src/option.vue +122 -122
- package/packages/select/src/select-dropdown.vue +49 -49
- package/packages/select/src/select.vue +676 -676
- package/packages/skeleton/src/item.vue +12 -12
- package/packages/slider/src/button.vue +191 -191
- package/packages/slider/src/main.vue +314 -314
- package/packages/spinner/src/spinner.vue +16 -16
- package/packages/statistic/src/main.vue +5 -6
- package/packages/steps/src/step.vue +2 -2
- package/packages/steps/src/steps.vue +4 -4
- package/packages/subTitle/index.js +8 -0
- package/packages/subTitle/src/main.vue +33 -0
- package/packages/switch/src/component.vue +123 -123
- package/packages/tabDialog/index.js +23 -0
- package/packages/tabDialog/src/dialog/drag.js +63 -0
- package/packages/tabDialog/src/dialog/dragHeight.js +34 -0
- package/packages/tabDialog/src/dialog/dragWidth.js +30 -0
- package/packages/tabDialog/src/main.vue +277 -0
- package/packages/table/src/filter-panel.vue +128 -128
- package/packages/table/src/store/index.js +1 -1
- package/packages/table/src/table-body.js +2 -2
- package/packages/table/src/table-column.js +1 -1
- package/packages/table/src/table-header.js +1 -1
- package/packages/table/src/table-layout.js +1 -1
- package/packages/table/src/table.vue +416 -416
- package/packages/tabs/src/tab-bar.vue +43 -43
- package/packages/tabs/src/tab-nav.vue +250 -250
- package/packages/tabs/src/tab-pane.vue +34 -34
- package/packages/tabs/src/tabs.vue +165 -165
- package/packages/tag/src/tag.vue +52 -52
- package/packages/theme-cy/lib/element.css +1 -0
- package/packages/theme-cy/lib/fileUpload.css +1 -0
- package/packages/theme-cy/lib/index.css +1 -1
- package/packages/theme-cy/lib/subTitle.css +1 -0
- package/packages/theme-cy/lib/tabDialog.css +1 -0
- package/packages/theme-cy/lib/treeselect.css +1 -1
- package/packages/theme-cy/src/element.scss +45 -0
- package/packages/theme-cy/src/fileUpload.scss +30 -0
- package/packages/theme-cy/src/index.scss +4 -0
- package/packages/theme-cy/src/subTitle.scss +26 -0
- package/packages/theme-cy/src/tabDialog.scss +43 -0
- package/packages/theme-cy/src/treeselect.scss +20 -14
- package/packages/timeline/src/item.vue +24 -24
- package/packages/timeline/src/main.vue +27 -27
- package/packages/tooltip/src/main.js +1 -1
- package/packages/transfer/src/main.vue +169 -169
- package/packages/transfer/src/transfer-panel.vue +164 -164
- package/packages/tree/src/tree-node.vue +169 -169
- package/packages/tree/src/tree.vue +408 -408
- package/packages/treeSelect/index.js +8 -0
- package/packages/{treeselect → treeSelect}/src/main.vue +19 -19
- package/packages/upload/src/ajax.js +3 -3
- package/packages/upload/src/upload-dragger.vue +50 -50
- package/packages/upload/src/upload-list.vue +33 -33
- package/packages/upload/src/upload.vue +1 -1
- package/src/index.js +13 -5
- package/src/locale/format.js +0 -1
- package/src/mixins/migrating.js +2 -2
- package/src/utils/date.js +2 -368
- package/src/utils/date_source.js +368 -0
- package/src/utils/lodash.js +9 -18075
- package/src/utils/lodash_source.js +18075 -0
- package/src/utils/types.js +1 -1
- package/types/element-ui.d.ts +16 -3
- package/types/fileUpload.d.ts +5 -0
- package/types/subTitle.d.ts +5 -0
- package/types/tabDialog.d.ts +5 -0
- package/types/treeSelect.d.ts +5 -0
- package/lib/treeselect.js +0 -682
- package/packages/treeselect/index.js +0 -8
- package/types/treeselect.d.ts +0 -5
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="cy-file-upload">
|
|
3
|
+
<div class="cy-file-upload-btn-box">
|
|
4
|
+
<template v-if="showImportTemplate">
|
|
5
|
+
<!-- 下载模板按钮 -->
|
|
6
|
+
<el-button size="mini" type="success" :size="btnSize" class="cy-file-upload-uploader" style="margin-right: 10px;" @click="importTemplate">下载模板</el-button>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<el-upload
|
|
10
|
+
v-if="!disabled"
|
|
11
|
+
:action="baseUrl + uploadFileUrl"
|
|
12
|
+
:before-upload="handleBeforeUpload"
|
|
13
|
+
:data="data"
|
|
14
|
+
:name="name"
|
|
15
|
+
:file-list="fileList"
|
|
16
|
+
:limit="limit"
|
|
17
|
+
:accept="fileAccept"
|
|
18
|
+
:on-error="handleUploadError"
|
|
19
|
+
:on-exceed="handleExceed"
|
|
20
|
+
:on-success="handleUploadSuccess"
|
|
21
|
+
:show-file-list="false"
|
|
22
|
+
:headers="headers"
|
|
23
|
+
class="cy-file-upload-uploader"
|
|
24
|
+
ref="upload"
|
|
25
|
+
>
|
|
26
|
+
<!-- 上传按钮 -->
|
|
27
|
+
<el-button :size="btnSize" :type="btnColor" :loading="downloadLoading" :icon="btnIcon" :plain="btnPlain">{{ btnText }}</el-button>
|
|
28
|
+
</el-upload>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- 上传提示 -->
|
|
32
|
+
<div class="el-upload__tip" slot="tip" v-if="showTip && !onlyBtn && !disabled">
|
|
33
|
+
请上传
|
|
34
|
+
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b></template>
|
|
35
|
+
<template v-if="fileType && !fileType.includes('*')"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
|
|
36
|
+
的文件
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<!-- 文件列表 -->
|
|
40
|
+
<template v-if="!onlyBtn">
|
|
41
|
+
<ul v-if="!isThumbnail" class="cy-file-upload-list el-upload-list el-upload-list--text">
|
|
42
|
+
<li v-for="(file, index) in fileList" :key="file.id" class="el-upload-list__item ele-upload-list__item-content">
|
|
43
|
+
<el-link class="link_icon" :underline="false" @click.native="downloadAttach(file)">
|
|
44
|
+
<span class="el-icon-document"> {{ getFileName(file.file_name) }} </span>
|
|
45
|
+
</el-link>
|
|
46
|
+
<div class="ele-upload-list__item-content-action flex_shrink">
|
|
47
|
+
<el-link v-if="isDownload" :underline="false" @click="downloadAttach(file)" type="primary">下载</el-link>
|
|
48
|
+
<el-link v-if="isPreview" :underline="false" @click="previewFile(file)" type="primary">预览</el-link>
|
|
49
|
+
<el-link v-if="!disabled" :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
|
|
50
|
+
</div>
|
|
51
|
+
</li>
|
|
52
|
+
</ul>
|
|
53
|
+
|
|
54
|
+
<!-- <FileTypeList-->
|
|
55
|
+
<!-- v-else-->
|
|
56
|
+
<!-- :list="fileList"-->
|
|
57
|
+
<!-- :disabled="disabled"-->
|
|
58
|
+
<!-- :isDownload="isDownload"-->
|
|
59
|
+
<!-- :isPreview="isPreview"-->
|
|
60
|
+
<!-- :imgRatio="imgRatio"-->
|
|
61
|
+
<!-- @download="downloadAttach"-->
|
|
62
|
+
<!-- @click="previewFile"-->
|
|
63
|
+
<!-- @delete="handleDelete"-->
|
|
64
|
+
<!-- ></FileTypeList>-->
|
|
65
|
+
</template>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
import ElUpload from 'element-ui/packages/upload';
|
|
71
|
+
import ElLink from 'element-ui/packages/link';
|
|
72
|
+
import ElButton from 'element-ui/packages/button';
|
|
73
|
+
|
|
74
|
+
export default {
|
|
75
|
+
name: 'CyFileUpload',
|
|
76
|
+
component: [
|
|
77
|
+
ElUpload,
|
|
78
|
+
ElLink,
|
|
79
|
+
ElButton,
|
|
80
|
+
],
|
|
81
|
+
props: {
|
|
82
|
+
// 值
|
|
83
|
+
value: {
|
|
84
|
+
type: [Array, String],
|
|
85
|
+
default: () => [],
|
|
86
|
+
},
|
|
87
|
+
// 数量限制
|
|
88
|
+
limit: {
|
|
89
|
+
type: Number,
|
|
90
|
+
default: 1000,
|
|
91
|
+
},
|
|
92
|
+
// 大小限制(MB)
|
|
93
|
+
fileSize: {
|
|
94
|
+
type: Number,
|
|
95
|
+
default: 1000,
|
|
96
|
+
},
|
|
97
|
+
// 文件类型, ['*']不限制文件类型, 例如['png', 'jpg', 'jpeg']
|
|
98
|
+
fileType: {
|
|
99
|
+
type: Array,
|
|
100
|
+
default: () => ['jpg', 'jpeg', 'png', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf'],
|
|
101
|
+
},
|
|
102
|
+
// 是否显示提示
|
|
103
|
+
isShowTip: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: true
|
|
106
|
+
},
|
|
107
|
+
// 上传的图片服务器地址
|
|
108
|
+
uploadFileUrl: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: '/design/resource_file/upload_file'
|
|
111
|
+
},
|
|
112
|
+
// 请求参数
|
|
113
|
+
data: {
|
|
114
|
+
type: Object,
|
|
115
|
+
default: () => {
|
|
116
|
+
return {}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
// 上传时的文件字段名
|
|
120
|
+
name: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: 'file'
|
|
123
|
+
},
|
|
124
|
+
disabled: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: false
|
|
127
|
+
},
|
|
128
|
+
// 是否显示预览按钮
|
|
129
|
+
isPreview: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: true
|
|
132
|
+
},
|
|
133
|
+
// 只显示上传按钮
|
|
134
|
+
onlyBtn: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: false
|
|
137
|
+
},
|
|
138
|
+
// 上传按钮 文字
|
|
139
|
+
btnText: {
|
|
140
|
+
type: String,
|
|
141
|
+
default: '选取文件'
|
|
142
|
+
},
|
|
143
|
+
// 上传按钮 大小
|
|
144
|
+
btnSize: {
|
|
145
|
+
type: String,
|
|
146
|
+
default: 'mini'
|
|
147
|
+
},
|
|
148
|
+
// 上传按钮 颜色
|
|
149
|
+
btnColor: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: 'primary'
|
|
152
|
+
},
|
|
153
|
+
// 上传按钮 图标
|
|
154
|
+
btnIcon: {
|
|
155
|
+
type: String,
|
|
156
|
+
default: ''
|
|
157
|
+
},
|
|
158
|
+
// 上传按钮 是否为朴素按钮
|
|
159
|
+
btnPlain: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: false
|
|
162
|
+
},
|
|
163
|
+
// 是否显示上传成功提示
|
|
164
|
+
isSuccessMsg: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: true
|
|
167
|
+
},
|
|
168
|
+
// 是否显示下载模板按钮
|
|
169
|
+
showImportTemplate: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: false
|
|
172
|
+
},
|
|
173
|
+
// 下载模板地址
|
|
174
|
+
importTemplateName: {
|
|
175
|
+
type: String,
|
|
176
|
+
default: 'template.xls'
|
|
177
|
+
},
|
|
178
|
+
// 列表是否以缩略图展示
|
|
179
|
+
isThumbnail: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
default: false
|
|
182
|
+
},
|
|
183
|
+
// 图片预览压缩率0-1,仅isThumbnail为true有效
|
|
184
|
+
imgRatio: {
|
|
185
|
+
type: Number,
|
|
186
|
+
default: 1
|
|
187
|
+
},
|
|
188
|
+
// 是否允许下载
|
|
189
|
+
isDownload: {
|
|
190
|
+
type: Boolean,
|
|
191
|
+
default: true,
|
|
192
|
+
},
|
|
193
|
+
// 删除前回调, 必须为Promise
|
|
194
|
+
deleteBefore: {
|
|
195
|
+
type: Function,
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
// 服务器转发代理规则,匹配请求路径的前缀
|
|
199
|
+
baseUrl: {
|
|
200
|
+
type: String,
|
|
201
|
+
default: ''
|
|
202
|
+
},
|
|
203
|
+
// 获取token的方法
|
|
204
|
+
getToken: {
|
|
205
|
+
type: Function,
|
|
206
|
+
default: () => {
|
|
207
|
+
return ''
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
// 下载接口方法,必须返回一个Promise
|
|
211
|
+
fileDownLoad: {
|
|
212
|
+
type: Function,
|
|
213
|
+
default: () => Promise.resolve()
|
|
214
|
+
},
|
|
215
|
+
// 文件预览方法
|
|
216
|
+
getFilePreviewUrl: {
|
|
217
|
+
type: Function,
|
|
218
|
+
default: () => {
|
|
219
|
+
return ''
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
data() {
|
|
224
|
+
return {
|
|
225
|
+
fileList: [],
|
|
226
|
+
downloadLoading: false,
|
|
227
|
+
};
|
|
228
|
+
},
|
|
229
|
+
watch: {
|
|
230
|
+
value: {
|
|
231
|
+
handler(val) {
|
|
232
|
+
if (val) {
|
|
233
|
+
if (typeof val === 'string') {
|
|
234
|
+
this.fileList = [{
|
|
235
|
+
file_name: this.getFileName(val),
|
|
236
|
+
file_path: val,
|
|
237
|
+
id: this.createUUID(),
|
|
238
|
+
}];
|
|
239
|
+
} else {
|
|
240
|
+
this.fileList = val.map(item => {
|
|
241
|
+
return Object.assign({}, item);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
} else {
|
|
245
|
+
this.fileList = [];
|
|
246
|
+
return [];
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
deep: true,
|
|
250
|
+
immediate: true
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
computed: {
|
|
254
|
+
// 是否显示提示
|
|
255
|
+
showTip() {
|
|
256
|
+
return this.isShowTip && ((this.fileType && !this.fileType.includes('*')) || this.fileSize);
|
|
257
|
+
},
|
|
258
|
+
fileAccept() {
|
|
259
|
+
let arr = this.fileType.includes('*') ? [] : this.fileType.map(item => '.' + item);
|
|
260
|
+
return arr.join()
|
|
261
|
+
},
|
|
262
|
+
headers() {
|
|
263
|
+
return {
|
|
264
|
+
Authorization: 'Bearer ' + this.getToken(),
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
methods: {
|
|
269
|
+
/**
|
|
270
|
+
* 上传前校检格式和大小
|
|
271
|
+
*/
|
|
272
|
+
handleBeforeUpload(file) {
|
|
273
|
+
this.downloadLoading = true;
|
|
274
|
+
// 校检文件类型
|
|
275
|
+
if (this.fileType && !this.fileType.includes('*')) {
|
|
276
|
+
let fileExtension = this.getFileExtension(file.name);
|
|
277
|
+
if (!this.fileType.includes(fileExtension)) {
|
|
278
|
+
this.$message.error(`文件格式不正确, 请上传${ this.fileType.join('/') }格式文件!`);
|
|
279
|
+
this.downloadLoading = false;
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// 校检文件大小
|
|
284
|
+
if (this.fileSize) {
|
|
285
|
+
const isLt = file.size / 1024 / 1024 < this.fileSize;
|
|
286
|
+
if (!isLt) {
|
|
287
|
+
this.$message.error(`上传文件大小不能超过 ${ this.fileSize } MB!`);
|
|
288
|
+
this.downloadLoading = false;
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return true;
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* 文件个数超出
|
|
297
|
+
*/
|
|
298
|
+
handleExceed() {
|
|
299
|
+
if (this.limit === 1) {
|
|
300
|
+
this.$message.error('只能上传单个文件!');
|
|
301
|
+
} else {
|
|
302
|
+
this.$message.error(`上传文件数量不能超过 ${ this.limit } 个!`);
|
|
303
|
+
}
|
|
304
|
+
this.downloadLoading = false;
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* 上传失败
|
|
309
|
+
*/
|
|
310
|
+
handleUploadError(err) {
|
|
311
|
+
this.$message.error('上传失败, 请重试');
|
|
312
|
+
this.downloadLoading = false;
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* 上传成功回调
|
|
317
|
+
*/
|
|
318
|
+
handleUploadSuccess(res, file) {
|
|
319
|
+
if (res.code !== 200) {
|
|
320
|
+
this.$message.error(res.msg);
|
|
321
|
+
} else {
|
|
322
|
+
if (this.isSuccessMsg) this.$message.success('上传成功');
|
|
323
|
+
this.fileList.push(res.data);
|
|
324
|
+
}
|
|
325
|
+
this.downloadLoading = false;
|
|
326
|
+
this.$emit('input', this.fileList);
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* 删除文件
|
|
331
|
+
*/
|
|
332
|
+
async handleDelete(index) {
|
|
333
|
+
if (this.deleteBefore) {
|
|
334
|
+
try {
|
|
335
|
+
const res = await this.deleteBefore(this.fileList[index], index);
|
|
336
|
+
if (!res) return;
|
|
337
|
+
} catch (e) {
|
|
338
|
+
console.log(e);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
this.fileList.splice(index, 1);
|
|
343
|
+
this.$emit('input', this.fileList);
|
|
344
|
+
},
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* 获取文件名称
|
|
348
|
+
*/
|
|
349
|
+
getFileName(name) {
|
|
350
|
+
if (name.lastIndexOf('/') > -1) {
|
|
351
|
+
return name.slice(name.lastIndexOf('/') + 1).toLowerCase();
|
|
352
|
+
} else {
|
|
353
|
+
return name;
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* 获取文件类型,后缀
|
|
359
|
+
*/
|
|
360
|
+
getFileExtension(name) {
|
|
361
|
+
if (name.lastIndexOf('.') > -1) {
|
|
362
|
+
return name.slice(name.lastIndexOf('.') + 1).toLowerCase();
|
|
363
|
+
}
|
|
364
|
+
return ''
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* 查看 预览
|
|
369
|
+
*/
|
|
370
|
+
previewFile(file) {
|
|
371
|
+
window.open(this.getFilePreviewUrl(file));
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 附件下载
|
|
376
|
+
* */
|
|
377
|
+
downloadAttach(file) {
|
|
378
|
+
if (!this.isDownload) return;
|
|
379
|
+
|
|
380
|
+
let { id, file_name, file_type } = file;
|
|
381
|
+
this.downloadLoading = true;
|
|
382
|
+
this.fileDownLoad(id).then(res => {
|
|
383
|
+
const blob = new Blob([res]);
|
|
384
|
+
if ('download' in document.createElement('a')) {
|
|
385
|
+
const link = document.createElement('a');
|
|
386
|
+
link.download = file_name;
|
|
387
|
+
link.style.display = 'none';
|
|
388
|
+
link.href = URL.createObjectURL(blob);
|
|
389
|
+
document.body.appendChild(link);
|
|
390
|
+
link.click();
|
|
391
|
+
URL.revokeObjectURL(link.href);
|
|
392
|
+
document.body.removeChild(link);
|
|
393
|
+
} else {
|
|
394
|
+
navigator.msSaveBlob(blob, file_name);
|
|
395
|
+
}
|
|
396
|
+
this.downloadLoading = false;
|
|
397
|
+
})
|
|
398
|
+
.catch((err) => {
|
|
399
|
+
this.downloadLoading = false;
|
|
400
|
+
console.log(err);
|
|
401
|
+
this.$message.error('文件下载失败!');
|
|
402
|
+
});
|
|
403
|
+
},
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* 下载模板操作
|
|
407
|
+
*/
|
|
408
|
+
importTemplate() {
|
|
409
|
+
const link = document.createElement('a');
|
|
410
|
+
link.style.display = 'none';
|
|
411
|
+
link.setAttribute('href', '/static/' + this.importTemplateName);
|
|
412
|
+
link.download = this.importTemplateName; // 下载的文件名
|
|
413
|
+
document.body.appendChild(link);
|
|
414
|
+
link.click();
|
|
415
|
+
document.body.removeChild(link);
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* 自定义生成UUID
|
|
420
|
+
*/
|
|
421
|
+
createUUID() {
|
|
422
|
+
return 'xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, c => {
|
|
423
|
+
let r = Math.random() * 16 | 0;
|
|
424
|
+
let v = c === 'x' ? r : (r & 0x3 | 0x8);
|
|
425
|
+
return v.toString(16);
|
|
426
|
+
})
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
</script>
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export default {
|
|
9
|
+
name: 'ElFooter',
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
componentName: 'ElFooter',
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
13
|
+
props: {
|
|
14
|
+
height: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '60px'
|
|
18
17
|
}
|
|
19
|
-
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
20
|
</script>
|