cy-element-ui 1.0.28 → 1.0.30
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 +23 -14
- package/lib/alert.js +4 -4
- package/lib/aside.js +2 -2
- package/lib/autocomplete.js +4 -4
- package/lib/avatar.js +2 -2
- package/lib/backtop.js +4 -4
- package/lib/badge.js +4 -4
- package/lib/breadcrumb-item.js +4 -4
- package/lib/breadcrumb.js +2 -2
- package/lib/button-group.js +2 -2
- package/lib/button.js +2 -2
- package/lib/calendar.js +6 -6
- package/lib/card.js +2 -2
- package/lib/carousel-item.js +4 -4
- package/lib/carousel.js +2 -2
- package/lib/cascader-panel.js +4 -4
- package/lib/cascader.js +4 -4
- package/lib/checkbox-button.js +4 -4
- package/lib/checkbox-group.js +2 -2
- package/lib/checkbox.js +4 -4
- package/lib/col.js +2 -2
- package/lib/collapse-item.js +4 -4
- package/lib/collapse.js +2 -2
- package/lib/color-picker.js +45 -45
- package/lib/container.js +2 -2
- package/lib/date-picker.js +49 -45
- package/lib/descriptions-item.js +2 -2
- package/lib/descriptions.js +2 -2
- package/lib/dialog.js +4 -4
- package/lib/divider.js +4 -4
- package/lib/drawer.js +6 -6
- package/lib/dropdown-item.js +2 -2
- package/lib/dropdown-menu.js +2 -2
- package/lib/dropdown.js +10 -10
- package/lib/element-ui.common.js +1801 -388
- package/lib/empty.js +4 -4
- package/lib/fileUpload.js +978 -0
- package/lib/footer.js +2 -2
- package/lib/form-item.js +4 -4
- package/lib/form.js +4 -4
- package/lib/header.js +2 -2
- package/lib/icon.js +2 -2
- package/lib/image.js +12 -12
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +2 -2
- package/lib/input-number.js +2 -2
- package/lib/input.js +4 -4
- package/lib/link.js +2 -2
- package/lib/loading.js +4 -4
- package/lib/locale/format.js +0 -1
- package/lib/main.js +2 -2
- package/lib/menu-item-group.js +4 -4
- package/lib/menu-item.js +2 -2
- package/lib/menu.js +3 -3
- package/lib/message-box.js +7 -7
- package/lib/message.js +4 -4
- package/lib/notification.js +4 -4
- package/lib/option-group.js +2 -2
- package/lib/option.js +2 -2
- package/lib/page-header.js +2 -2
- package/lib/pagination.js +4 -4
- package/lib/popconfirm.js +12 -12
- package/lib/popover.js +4 -4
- package/lib/progress.js +4 -4
- package/lib/radio-button.js +4 -4
- package/lib/radio-group.js +2 -2
- package/lib/radio.js +4 -4
- package/lib/rate.js +9 -9
- package/lib/result.js +2 -2
- package/lib/row.js +2 -2
- package/lib/scrollbar.js +2 -2
- package/lib/select.js +2 -2
- package/lib/skeleton-item.js +2 -2
- package/lib/skeleton.js +2 -2
- package/lib/slider.js +4 -4
- package/lib/spinner.js +2 -2
- package/lib/statistic.js +4 -4
- package/lib/step.js +4 -4
- package/lib/steps.js +11 -11
- package/lib/subTitle.js +293 -0
- package/lib/submenu.js +2 -3
- package/lib/switch.js +2 -2
- package/lib/tab-pane.js +2 -2
- package/lib/tabDialog.js +787 -0
- package/lib/table-column.js +4 -4
- package/lib/table.js +19 -16
- package/lib/tabs.js +4 -4
- package/lib/tag.js +2 -2
- package/lib/time-picker.js +2 -2
- package/lib/time-select.js +2 -2
- package/lib/timeline-item.js +4 -4
- package/lib/timeline.js +2 -2
- package/lib/tooltip.js +2 -2
- package/lib/transfer.js +7 -7
- package/lib/tree.js +11 -11
- package/lib/{treeselect.js → treeSelect.js} +31 -31
- package/lib/upload.js +14 -14
- package/package.json +5 -1
- package/packages/alert/src/main.vue +1 -1
- package/packages/autocomplete/src/autocomplete.vue +3 -3
- 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 +1 -1
- package/packages/calendar/src/date-table.vue +3 -3
- package/packages/calendar/src/main.vue +5 -5
- package/packages/carousel/src/item.vue +1 -1
- package/packages/cascader/src/cascader.vue +2 -2
- package/packages/cascader-panel/src/cascader-menu.vue +4 -4
- package/packages/cascader-panel/src/node.js +3 -4
- package/packages/cascader-panel/src/store.js +1 -2
- package/packages/checkbox/src/checkbox-button.vue +8 -8
- package/packages/checkbox/src/checkbox.vue +1 -1
- package/packages/col/src/col.js +5 -5
- package/packages/collapse/src/collapse-item.vue +1 -1
- package/packages/color-picker/src/color.js +4 -4
- package/packages/color-picker/src/components/alpha-slider.vue +12 -12
- package/packages/color-picker/src/components/hue-slider.vue +6 -6
- package/packages/color-picker/src/components/picker-dropdown.vue +1 -1
- package/packages/color-picker/src/components/predefine.vue +4 -4
- package/packages/color-picker/src/components/sv-panel.vue +4 -4
- package/packages/color-picker/src/main.vue +8 -8
- package/packages/date-picker/src/basic/date-table.vue +19 -19
- package/packages/date-picker/src/basic/month-table.vue +8 -9
- package/packages/date-picker/src/basic/year-table.vue +38 -38
- package/packages/date-picker/src/panel/date-range.vue +1 -1
- package/packages/date-picker/src/panel/date.vue +5 -5
- package/packages/date-picker/src/panel/month-range.vue +1 -1
- package/packages/descriptions/src/descriptions-row.js +3 -3
- package/packages/descriptions/src/index.js +1 -1
- package/packages/divider/src/main.vue +1 -1
- package/packages/drawer/src/main.vue +2 -2
- package/packages/dropdown/src/dropdown.vue +1 -1
- 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/form/src/form-item.vue +3 -3
- package/packages/form/src/form.vue +1 -1
- package/packages/image/src/image-viewer.vue +4 -4
- package/packages/infinite-scroll/src/main.js +2 -3
- package/packages/input/src/calcTextareaHeight.js +2 -2
- package/packages/input/src/input.vue +15 -15
- package/packages/menu/src/menu-item-group.vue +1 -1
- package/packages/menu/src/menu.vue +4 -4
- package/packages/menu/src/submenu.vue +3 -4
- package/packages/message/src/main.js +1 -1
- package/packages/notification/src/main.js +1 -1
- package/packages/pagination/src/pager.vue +1 -1
- package/packages/popconfirm/src/main.vue +28 -28
- package/packages/popover/src/main.vue +1 -1
- package/packages/progress/src/progress.vue +10 -10
- package/packages/radio/src/radio-button.vue +2 -2
- package/packages/radio/src/radio.vue +1 -1
- 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/slider/src/main.vue +2 -2
- package/packages/statistic/src/main.vue +6 -7
- 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/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 +7 -7
- 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 +16 -16
- package/packages/tabs/src/tab-bar.vue +3 -3
- package/packages/tabs/src/tab-nav.vue +13 -13
- package/packages/tabs/src/tabs.vue +3 -3
- package/packages/tag/src/tag.vue +3 -3
- 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 -0
- 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 +5 -1
- 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 → treeSelect.scss} +93 -87
- package/packages/timeline/src/item.vue +2 -2
- package/packages/tooltip/src/main.js +1 -1
- package/packages/tree/src/tree-node.vue +3 -3
- package/packages/treeSelect/index.js +8 -0
- package/packages/{treeselect → treeSelect}/src/main.vue +246 -243
- package/packages/upload/src/ajax.js +3 -3
- package/packages/upload/src/upload-list.vue +1 -1
- package/packages/upload/src/upload.vue +1 -1
- package/src/index.js +13 -5
- package/src/locale/format.js +1 -2
- package/src/mixins/migrating.js +2 -2
- package/src/utils/types.js +1 -1
- package/types/element-ui.d.ts +18 -5
- 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/packages/theme-cy/lib/treeselect.css +0 -1
- 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>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:is-auto-width="labelStyle && labelStyle.width === 'auto'"
|
|
14
14
|
:update-all="form.labelWidth === 'auto'">
|
|
15
15
|
<label :for="labelFor" class="el-form-item__label" :style="labelStyle" v-if="label || $slots.label">
|
|
16
|
-
<slot name="label">{{label + form.labelSuffix}}</slot>
|
|
16
|
+
<slot name="label">{{ label + form.labelSuffix }}</slot>
|
|
17
17
|
</label>
|
|
18
18
|
</label-wrap>
|
|
19
19
|
<div class="el-form-item__content" :style="contentStyle">
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
: (elForm && elForm.inlineMessage || false)
|
|
32
32
|
}"
|
|
33
33
|
>
|
|
34
|
-
{{validateMessage}}
|
|
34
|
+
{{ validateMessage }}
|
|
35
35
|
</div>
|
|
36
36
|
</slot>
|
|
37
37
|
</transition>
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
this.validate('change');
|
|
289
289
|
},
|
|
290
290
|
updateComputedLabelWidth(width) {
|
|
291
|
-
this.computedLabelWidth = width ? `${width}px` : '';
|
|
291
|
+
this.computedLabelWidth = width ? `${ width }px` : '';
|
|
292
292
|
},
|
|
293
293
|
addValidateEvents() {
|
|
294
294
|
const rules = this.getRules();
|
|
@@ -70,7 +70,7 @@ const Mode = {
|
|
|
70
70
|
const mousewheelEventName = isFirefox() ? 'DOMMouseScroll' : 'mousewheel';
|
|
71
71
|
|
|
72
72
|
export default {
|
|
73
|
-
name: '
|
|
73
|
+
name: 'ElImageViewer',
|
|
74
74
|
|
|
75
75
|
props: {
|
|
76
76
|
urlList: {
|
|
@@ -135,10 +135,10 @@ export default {
|
|
|
135
135
|
imgStyle() {
|
|
136
136
|
const { scale, deg, offsetX, offsetY, enableTransition } = this.transform;
|
|
137
137
|
const style = {
|
|
138
|
-
transform: `scale(${scale}) rotate(${deg}deg)`,
|
|
138
|
+
transform: `scale(${ scale }) rotate(${ deg }deg)`,
|
|
139
139
|
transition: enableTransition ? 'transform .3s' : '',
|
|
140
|
-
'margin-left': `${offsetX}px`,
|
|
141
|
-
'margin-top': `${offsetY}px`
|
|
140
|
+
'margin-left': `${ offsetX }px`,
|
|
141
|
+
'margin-top': `${ offsetY }px`
|
|
142
142
|
};
|
|
143
143
|
if (this.mode === Mode.CONTAIN) {
|
|
144
144
|
style.maxWidth = style.maxHeight = '100%';
|
|
@@ -66,7 +66,7 @@ const getScrollOptions = (el, vm) => {
|
|
|
66
66
|
|
|
67
67
|
return entries(attributes).reduce((map, [key, option]) => {
|
|
68
68
|
const { type, default: defaultValue } = option;
|
|
69
|
-
let value = el.getAttribute(`infinite-scroll-${key}`);
|
|
69
|
+
let value = el.getAttribute(`infinite-scroll-${ key }`);
|
|
70
70
|
value = isUndefined(vm[value]) ? value : vm[value];
|
|
71
71
|
switch (type) {
|
|
72
72
|
case Number:
|
|
@@ -113,8 +113,7 @@ const handleScroll = function(cb) {
|
|
|
113
113
|
} else if (observer) {
|
|
114
114
|
observer.disconnect();
|
|
115
115
|
this[scope].observer = null;
|
|
116
|
-
}
|
|
117
|
-
|
|
116
|
+
}
|
|
118
117
|
};
|
|
119
118
|
|
|
120
119
|
export default {
|
|
@@ -44,7 +44,7 @@ function calculateNodeStyling(targetElement) {
|
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
const contextStyle = CONTEXT_STYLE
|
|
47
|
-
.map(name => `${name}:${style.getPropertyValue(name)}`)
|
|
47
|
+
.map(name => `${ name }:${ style.getPropertyValue(name) }`)
|
|
48
48
|
.join(';');
|
|
49
49
|
|
|
50
50
|
return { contextStyle, paddingSize, borderSize, boxSizing };
|
|
@@ -67,7 +67,7 @@ export default function calcTextareaHeight(
|
|
|
67
67
|
contextStyle
|
|
68
68
|
} = calculateNodeStyling(targetElement);
|
|
69
69
|
|
|
70
|
-
hiddenTextarea.setAttribute('style', `${contextStyle};${HIDDEN_STYLE}`);
|
|
70
|
+
hiddenTextarea.setAttribute('style', `${ contextStyle };${ HIDDEN_STYLE }`);
|
|
71
71
|
hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
|
|
72
72
|
|
|
73
73
|
let height = hiddenTextarea.scrollHeight;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="[
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
type === 'textarea' ? 'el-textarea' : 'el-input',
|
|
4
|
+
inputSize ? 'el-input--' + inputSize : '',
|
|
5
|
+
{
|
|
6
|
+
'is-disabled': inputDisabled,
|
|
7
|
+
'is-exceed': inputExceed,
|
|
8
|
+
'el-input-group': $slots.prepend || $slots.append,
|
|
9
|
+
'el-input-group--append': $slots.append,
|
|
10
|
+
'el-input-group--prepend': $slots.prepend,
|
|
11
|
+
'el-input--prefix': $slots.prefix || prefixIcon,
|
|
12
|
+
'el-input--suffix': $slots.suffix || suffixIcon || clearable || showPassword
|
|
13
|
+
}
|
|
14
14
|
]"
|
|
15
15
|
@mouseenter="hovering = true"
|
|
16
16
|
@mouseleave="hovering = false"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
<span class="el-input__prefix" v-if="$slots.prefix || prefixIcon">
|
|
44
44
|
<slot name="prefix"></slot>
|
|
45
45
|
<i class="el-input__icon"
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
v-if="prefixIcon"
|
|
47
|
+
:class="prefixIcon">
|
|
48
48
|
</i>
|
|
49
49
|
</span>
|
|
50
50
|
<!-- 后置内容 -->
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
this.$emit('change', event.target.value);
|
|
374
374
|
},
|
|
375
375
|
calcIconOffset(place) {
|
|
376
|
-
let elList = [].slice.call(this.$el.querySelectorAll(`.el-input__${place}`) || []);
|
|
376
|
+
let elList = [].slice.call(this.$el.querySelectorAll(`.el-input__${ place }`) || []);
|
|
377
377
|
if (!elList.length) return;
|
|
378
378
|
let el = null;
|
|
379
379
|
for (let i = 0; i < elList.length; i++) {
|
|
@@ -390,7 +390,7 @@
|
|
|
390
390
|
|
|
391
391
|
const pendant = pendantMap[place];
|
|
392
392
|
if (this.$slots[pendant]) {
|
|
393
|
-
el.style.transform = `translateX(${place === 'suffix' ? '-' : ''}${this.$el.querySelector(`.el-input-group__${pendant}`).offsetWidth}px)`;
|
|
393
|
+
el.style.transform = `translateX(${ place === 'suffix' ? '-' : '' }${ this.$el.querySelector(`.el-input-group__${ pendant }`).offsetWidth }px)`;
|
|
394
394
|
} else {
|
|
395
395
|
el.removeAttribute('style');
|
|
396
396
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<li class="el-menu-item-group">
|
|
3
3
|
<div class="el-menu-item-group__title" :style="{paddingLeft: levelPadding + 'px'}">
|
|
4
|
-
<template v-if="!$slots.title">{{title}}</template>
|
|
4
|
+
<template v-if="!$slots.title">{{ title }}</template>
|
|
5
5
|
<slot v-else name="title"></slot>
|
|
6
6
|
</div>
|
|
7
7
|
<ul>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export default {
|
|
8
8
|
name: 'ElMenu',
|
|
9
9
|
|
|
10
|
-
render
|
|
10
|
+
render(h) {
|
|
11
11
|
const component = (
|
|
12
12
|
<ul
|
|
13
13
|
role="menubar"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
class={{
|
|
17
17
|
'el-menu--horizontal': this.mode === 'horizontal',
|
|
18
18
|
'el-menu--collapse': this.collapse,
|
|
19
|
-
|
|
19
|
+
'el-menu': true
|
|
20
20
|
}}
|
|
21
21
|
>
|
|
22
22
|
{ this.$slots.default }
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
}
|
|
140
140
|
},
|
|
141
141
|
watch: {
|
|
142
|
-
defaultActive(value){
|
|
143
|
-
if(!this.items[value]){
|
|
142
|
+
defaultActive(value) {
|
|
143
|
+
if (!this.items[value]) {
|
|
144
144
|
this.activeIndex = null
|
|
145
145
|
}
|
|
146
146
|
this.updateActiveIndex(value)
|
|
@@ -178,8 +178,7 @@
|
|
|
178
178
|
}
|
|
179
179
|
this.dispatch('ElMenu', 'submenu-click', this);
|
|
180
180
|
},
|
|
181
|
-
handleMouseenter(event, showTimeout = this.showTimeout) {
|
|
182
|
-
|
|
181
|
+
handleMouseenter(event, showTimeout = this.showTimeout) {
|
|
183
182
|
if (!('ActiveXObject' in window) && event.type === 'focus' && !event.relatedTarget) {
|
|
184
183
|
return;
|
|
185
184
|
}
|
|
@@ -284,13 +283,13 @@
|
|
|
284
283
|
<div
|
|
285
284
|
ref="menu"
|
|
286
285
|
v-show={opened}
|
|
287
|
-
class={[`el-menu--${mode}`, popperClass]}
|
|
286
|
+
class={[`el-menu--${ mode }`, popperClass]}
|
|
288
287
|
on-mouseenter={($event) => this.handleMouseenter($event, 100)}
|
|
289
288
|
on-mouseleave={() => this.handleMouseleave(true)}
|
|
290
289
|
on-focus={($event) => this.handleMouseenter($event, 100)}>
|
|
291
290
|
<ul
|
|
292
291
|
role="menu"
|
|
293
|
-
class={['el-menu el-menu--popup', `el-menu--popup-${currentPlacement}`]}
|
|
292
|
+
class={['el-menu el-menu--popup', `el-menu--popup-${ currentPlacement }`]}
|
|
294
293
|
style={{ backgroundColor: rootMenu.backgroundColor || '' }}>
|
|
295
294
|
{$slots.default}
|
|
296
295
|
</ul>
|
|
@@ -75,7 +75,7 @@ Message.close = function(id, userOnClose) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
if (len <= 1 || index === -1 || index > instances.length - 1) return;
|
|
78
|
-
for (let i = index; i < len - 1
|
|
78
|
+
for (let i = index; i < len - 1; i++) {
|
|
79
79
|
let dom = instances[i].$el;
|
|
80
80
|
dom.style['top'] =
|
|
81
81
|
parseInt(dom.style['top'], 10) - removedHeight - 16 + 'px';
|
|
@@ -77,7 +77,7 @@ Notification.close = function(id, userOnClose) {
|
|
|
77
77
|
if (len <= 1) return;
|
|
78
78
|
const position = instance.position;
|
|
79
79
|
const removedHeight = instance.dom.offsetHeight;
|
|
80
|
-
for (let i = index; i < len - 1
|
|
80
|
+
for (let i = index; i < len - 1; i++) {
|
|
81
81
|
if (instances[i].position === position) {
|
|
82
82
|
instances[i].dom.style[instance.verticalProperty] =
|
|
83
83
|
parseInt(instances[i].dom.style[instance.verticalProperty], 10) - removedHeight - 16 + 'px';
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
}
|
|
135
135
|
} else if (showPrevMore && showNextMore) {
|
|
136
136
|
const offset = Math.floor(pagerCount / 2) - 1;
|
|
137
|
-
for (let i = currentPage - offset
|
|
137
|
+
for (let i = currentPage - offset; i <= currentPage + offset; i++) {
|
|
138
138
|
array.push(i);
|
|
139
139
|
}
|
|
140
140
|
} else {
|