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.
Files changed (210) hide show
  1. package/README.md +23 -14
  2. package/lib/alert.js +4 -4
  3. package/lib/aside.js +2 -2
  4. package/lib/autocomplete.js +4 -4
  5. package/lib/avatar.js +2 -2
  6. package/lib/backtop.js +4 -4
  7. package/lib/badge.js +4 -4
  8. package/lib/breadcrumb-item.js +4 -4
  9. package/lib/breadcrumb.js +2 -2
  10. package/lib/button-group.js +2 -2
  11. package/lib/button.js +2 -2
  12. package/lib/calendar.js +6 -6
  13. package/lib/card.js +2 -2
  14. package/lib/carousel-item.js +4 -4
  15. package/lib/carousel.js +2 -2
  16. package/lib/cascader-panel.js +4 -4
  17. package/lib/cascader.js +4 -4
  18. package/lib/checkbox-button.js +4 -4
  19. package/lib/checkbox-group.js +2 -2
  20. package/lib/checkbox.js +4 -4
  21. package/lib/col.js +2 -2
  22. package/lib/collapse-item.js +4 -4
  23. package/lib/collapse.js +2 -2
  24. package/lib/color-picker.js +45 -45
  25. package/lib/container.js +2 -2
  26. package/lib/date-picker.js +49 -45
  27. package/lib/descriptions-item.js +2 -2
  28. package/lib/descriptions.js +2 -2
  29. package/lib/dialog.js +4 -4
  30. package/lib/divider.js +4 -4
  31. package/lib/drawer.js +6 -6
  32. package/lib/dropdown-item.js +2 -2
  33. package/lib/dropdown-menu.js +2 -2
  34. package/lib/dropdown.js +10 -10
  35. package/lib/element-ui.common.js +1801 -388
  36. package/lib/empty.js +4 -4
  37. package/lib/fileUpload.js +978 -0
  38. package/lib/footer.js +2 -2
  39. package/lib/form-item.js +4 -4
  40. package/lib/form.js +4 -4
  41. package/lib/header.js +2 -2
  42. package/lib/icon.js +2 -2
  43. package/lib/image.js +12 -12
  44. package/lib/index.js +1 -1
  45. package/lib/infinite-scroll.js +2 -2
  46. package/lib/input-number.js +2 -2
  47. package/lib/input.js +4 -4
  48. package/lib/link.js +2 -2
  49. package/lib/loading.js +4 -4
  50. package/lib/locale/format.js +0 -1
  51. package/lib/main.js +2 -2
  52. package/lib/menu-item-group.js +4 -4
  53. package/lib/menu-item.js +2 -2
  54. package/lib/menu.js +3 -3
  55. package/lib/message-box.js +7 -7
  56. package/lib/message.js +4 -4
  57. package/lib/notification.js +4 -4
  58. package/lib/option-group.js +2 -2
  59. package/lib/option.js +2 -2
  60. package/lib/page-header.js +2 -2
  61. package/lib/pagination.js +4 -4
  62. package/lib/popconfirm.js +12 -12
  63. package/lib/popover.js +4 -4
  64. package/lib/progress.js +4 -4
  65. package/lib/radio-button.js +4 -4
  66. package/lib/radio-group.js +2 -2
  67. package/lib/radio.js +4 -4
  68. package/lib/rate.js +9 -9
  69. package/lib/result.js +2 -2
  70. package/lib/row.js +2 -2
  71. package/lib/scrollbar.js +2 -2
  72. package/lib/select.js +2 -2
  73. package/lib/skeleton-item.js +2 -2
  74. package/lib/skeleton.js +2 -2
  75. package/lib/slider.js +4 -4
  76. package/lib/spinner.js +2 -2
  77. package/lib/statistic.js +4 -4
  78. package/lib/step.js +4 -4
  79. package/lib/steps.js +11 -11
  80. package/lib/subTitle.js +293 -0
  81. package/lib/submenu.js +2 -3
  82. package/lib/switch.js +2 -2
  83. package/lib/tab-pane.js +2 -2
  84. package/lib/tabDialog.js +787 -0
  85. package/lib/table-column.js +4 -4
  86. package/lib/table.js +19 -16
  87. package/lib/tabs.js +4 -4
  88. package/lib/tag.js +2 -2
  89. package/lib/time-picker.js +2 -2
  90. package/lib/time-select.js +2 -2
  91. package/lib/timeline-item.js +4 -4
  92. package/lib/timeline.js +2 -2
  93. package/lib/tooltip.js +2 -2
  94. package/lib/transfer.js +7 -7
  95. package/lib/tree.js +11 -11
  96. package/lib/{treeselect.js → treeSelect.js} +31 -31
  97. package/lib/upload.js +14 -14
  98. package/package.json +5 -1
  99. package/packages/alert/src/main.vue +1 -1
  100. package/packages/autocomplete/src/autocomplete.vue +3 -3
  101. package/packages/avatar/src/main.vue +5 -5
  102. package/packages/backtop/src/main.vue +3 -3
  103. package/packages/badge/src/main.vue +1 -1
  104. package/packages/breadcrumb/src/breadcrumb-item.vue +1 -1
  105. package/packages/calendar/src/date-table.vue +3 -3
  106. package/packages/calendar/src/main.vue +5 -5
  107. package/packages/carousel/src/item.vue +1 -1
  108. package/packages/cascader/src/cascader.vue +2 -2
  109. package/packages/cascader-panel/src/cascader-menu.vue +4 -4
  110. package/packages/cascader-panel/src/node.js +3 -4
  111. package/packages/cascader-panel/src/store.js +1 -2
  112. package/packages/checkbox/src/checkbox-button.vue +8 -8
  113. package/packages/checkbox/src/checkbox.vue +1 -1
  114. package/packages/col/src/col.js +5 -5
  115. package/packages/collapse/src/collapse-item.vue +1 -1
  116. package/packages/color-picker/src/color.js +4 -4
  117. package/packages/color-picker/src/components/alpha-slider.vue +12 -12
  118. package/packages/color-picker/src/components/hue-slider.vue +6 -6
  119. package/packages/color-picker/src/components/picker-dropdown.vue +1 -1
  120. package/packages/color-picker/src/components/predefine.vue +4 -4
  121. package/packages/color-picker/src/components/sv-panel.vue +4 -4
  122. package/packages/color-picker/src/main.vue +8 -8
  123. package/packages/date-picker/src/basic/date-table.vue +19 -19
  124. package/packages/date-picker/src/basic/month-table.vue +8 -9
  125. package/packages/date-picker/src/basic/year-table.vue +38 -38
  126. package/packages/date-picker/src/panel/date-range.vue +1 -1
  127. package/packages/date-picker/src/panel/date.vue +5 -5
  128. package/packages/date-picker/src/panel/month-range.vue +1 -1
  129. package/packages/descriptions/src/descriptions-row.js +3 -3
  130. package/packages/descriptions/src/index.js +1 -1
  131. package/packages/divider/src/main.vue +1 -1
  132. package/packages/drawer/src/main.vue +2 -2
  133. package/packages/dropdown/src/dropdown.vue +1 -1
  134. package/packages/empty/src/index.vue +1 -1
  135. package/packages/fileUpload/index.js +8 -0
  136. package/packages/fileUpload/src/main.vue +430 -0
  137. package/packages/form/src/form-item.vue +3 -3
  138. package/packages/form/src/form.vue +1 -1
  139. package/packages/image/src/image-viewer.vue +4 -4
  140. package/packages/infinite-scroll/src/main.js +2 -3
  141. package/packages/input/src/calcTextareaHeight.js +2 -2
  142. package/packages/input/src/input.vue +15 -15
  143. package/packages/menu/src/menu-item-group.vue +1 -1
  144. package/packages/menu/src/menu.vue +4 -4
  145. package/packages/menu/src/submenu.vue +3 -4
  146. package/packages/message/src/main.js +1 -1
  147. package/packages/notification/src/main.js +1 -1
  148. package/packages/pagination/src/pager.vue +1 -1
  149. package/packages/popconfirm/src/main.vue +28 -28
  150. package/packages/popover/src/main.vue +1 -1
  151. package/packages/progress/src/progress.vue +10 -10
  152. package/packages/radio/src/radio-button.vue +2 -2
  153. package/packages/radio/src/radio.vue +1 -1
  154. package/packages/row/src/row.js +3 -3
  155. package/packages/scrollbar/src/main.js +2 -2
  156. package/packages/scrollbar/src/util.js +1 -1
  157. package/packages/slider/src/main.vue +2 -2
  158. package/packages/statistic/src/main.vue +6 -7
  159. package/packages/steps/src/step.vue +2 -2
  160. package/packages/steps/src/steps.vue +4 -4
  161. package/packages/subTitle/index.js +8 -0
  162. package/packages/subTitle/src/main.vue +33 -0
  163. package/packages/tabDialog/index.js +23 -0
  164. package/packages/tabDialog/src/dialog/drag.js +63 -0
  165. package/packages/tabDialog/src/dialog/dragHeight.js +34 -0
  166. package/packages/tabDialog/src/dialog/dragWidth.js +30 -0
  167. package/packages/tabDialog/src/main.vue +277 -0
  168. package/packages/table/src/filter-panel.vue +7 -7
  169. package/packages/table/src/store/index.js +1 -1
  170. package/packages/table/src/table-body.js +2 -2
  171. package/packages/table/src/table-column.js +1 -1
  172. package/packages/table/src/table-header.js +1 -1
  173. package/packages/table/src/table-layout.js +1 -1
  174. package/packages/table/src/table.vue +16 -16
  175. package/packages/tabs/src/tab-bar.vue +3 -3
  176. package/packages/tabs/src/tab-nav.vue +13 -13
  177. package/packages/tabs/src/tabs.vue +3 -3
  178. package/packages/tag/src/tag.vue +3 -3
  179. package/packages/theme-cy/lib/element.css +1 -0
  180. package/packages/theme-cy/lib/fileUpload.css +1 -0
  181. package/packages/theme-cy/lib/index.css +1 -1
  182. package/packages/theme-cy/lib/subTitle.css +1 -0
  183. package/packages/theme-cy/lib/tabDialog.css +1 -0
  184. package/packages/theme-cy/lib/treeSelect.css +1 -0
  185. package/packages/theme-cy/src/element.scss +45 -0
  186. package/packages/theme-cy/src/fileUpload.scss +30 -0
  187. package/packages/theme-cy/src/index.scss +5 -1
  188. package/packages/theme-cy/src/subTitle.scss +26 -0
  189. package/packages/theme-cy/src/tabDialog.scss +43 -0
  190. package/packages/theme-cy/src/{treeselect.scss → treeSelect.scss} +93 -87
  191. package/packages/timeline/src/item.vue +2 -2
  192. package/packages/tooltip/src/main.js +1 -1
  193. package/packages/tree/src/tree-node.vue +3 -3
  194. package/packages/treeSelect/index.js +8 -0
  195. package/packages/{treeselect → treeSelect}/src/main.vue +246 -243
  196. package/packages/upload/src/ajax.js +3 -3
  197. package/packages/upload/src/upload-list.vue +1 -1
  198. package/packages/upload/src/upload.vue +1 -1
  199. package/src/index.js +13 -5
  200. package/src/locale/format.js +1 -2
  201. package/src/mixins/migrating.js +2 -2
  202. package/src/utils/types.js +1 -1
  203. package/types/element-ui.d.ts +18 -5
  204. package/types/fileUpload.d.ts +5 -0
  205. package/types/subTitle.d.ts +5 -0
  206. package/types/tabDialog.d.ts +5 -0
  207. package/types/treeSelect.d.ts +5 -0
  208. package/packages/theme-cy/lib/treeselect.css +0 -1
  209. package/packages/treeselect/index.js +0 -8
  210. package/types/treeselect.d.ts +0 -5
@@ -0,0 +1,978 @@
1
+ module.exports =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId]) {
11
+ /******/ return installedModules[moduleId].exports;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ i: moduleId,
16
+ /******/ l: false,
17
+ /******/ exports: {}
18
+ /******/ };
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+ /******/
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.l = true;
25
+ /******/
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+ /******/
30
+ /******/
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+ /******/
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+ /******/
37
+ /******/ // define getter function for harmony exports
38
+ /******/ __webpack_require__.d = function(exports, name, getter) {
39
+ /******/ if(!__webpack_require__.o(exports, name)) {
40
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
+ /******/ }
42
+ /******/ };
43
+ /******/
44
+ /******/ // define __esModule on exports
45
+ /******/ __webpack_require__.r = function(exports) {
46
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ /******/ }
49
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
+ /******/ };
51
+ /******/
52
+ /******/ // create a fake namespace object
53
+ /******/ // mode & 1: value is a module id, require it
54
+ /******/ // mode & 2: merge all properties of value into the ns
55
+ /******/ // mode & 4: return value when already ns object
56
+ /******/ // mode & 8|1: behave like require
57
+ /******/ __webpack_require__.t = function(value, mode) {
58
+ /******/ if(mode & 1) value = __webpack_require__(value);
59
+ /******/ if(mode & 8) return value;
60
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
+ /******/ var ns = Object.create(null);
62
+ /******/ __webpack_require__.r(ns);
63
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
+ /******/ return ns;
66
+ /******/ };
67
+ /******/
68
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
69
+ /******/ __webpack_require__.n = function(module) {
70
+ /******/ var getter = module && module.__esModule ?
71
+ /******/ function getDefault() { return module['default']; } :
72
+ /******/ function getModuleExports() { return module; };
73
+ /******/ __webpack_require__.d(getter, 'a', getter);
74
+ /******/ return getter;
75
+ /******/ };
76
+ /******/
77
+ /******/ // Object.prototype.hasOwnProperty.call
78
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
+ /******/
80
+ /******/ // __webpack_public_path__
81
+ /******/ __webpack_require__.p = "/dist/";
82
+ /******/
83
+ /******/
84
+ /******/ // Load entry module and return exports
85
+ /******/ return __webpack_require__(__webpack_require__.s = 136);
86
+ /******/ })
87
+ /************************************************************************/
88
+ /******/ ({
89
+
90
+ /***/ 0:
91
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
+
93
+ "use strict";
94
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
95
+ /* globals __VUE_SSR_CONTEXT__ */
96
+
97
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
98
+ // This module is a runtime utility for cleaner component module output and will
99
+ // be included in the final webpack user bundle.
100
+
101
+ function normalizeComponent(
102
+ scriptExports,
103
+ render,
104
+ staticRenderFns,
105
+ functionalTemplate,
106
+ injectStyles,
107
+ scopeId,
108
+ moduleIdentifier /* server only */,
109
+ shadowMode /* vue-cli only */
110
+ ) {
111
+ // Vue.extend constructor export interop
112
+ var options =
113
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
114
+
115
+ // render functions
116
+ if (render) {
117
+ options.render = render
118
+ options.staticRenderFns = staticRenderFns
119
+ options._compiled = true
120
+ }
121
+
122
+ // functional template
123
+ if (functionalTemplate) {
124
+ options.functional = true
125
+ }
126
+
127
+ // scopedId
128
+ if (scopeId) {
129
+ options._scopeId = 'data-v-' + scopeId
130
+ }
131
+
132
+ var hook
133
+ if (moduleIdentifier) {
134
+ // server build
135
+ hook = function (context) {
136
+ // 2.3 injection
137
+ context =
138
+ context || // cached call
139
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
140
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
141
+ // 2.2 with runInNewContext: true
142
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
143
+ context = __VUE_SSR_CONTEXT__
144
+ }
145
+ // inject component styles
146
+ if (injectStyles) {
147
+ injectStyles.call(this, context)
148
+ }
149
+ // register component module identifier for async chunk inferrence
150
+ if (context && context._registeredComponents) {
151
+ context._registeredComponents.add(moduleIdentifier)
152
+ }
153
+ }
154
+ // used by ssr in case component is cached and beforeCreate
155
+ // never gets called
156
+ options._ssrRegister = hook
157
+ } else if (injectStyles) {
158
+ hook = shadowMode
159
+ ? function () {
160
+ injectStyles.call(
161
+ this,
162
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
163
+ )
164
+ }
165
+ : injectStyles
166
+ }
167
+
168
+ if (hook) {
169
+ if (options.functional) {
170
+ // for template-only hot-reload because in that case the render fn doesn't
171
+ // go through the normalizer
172
+ options._injectStyles = hook
173
+ // register for functional component in vue file
174
+ var originalRender = options.render
175
+ options.render = function renderWithStyleInjection(h, context) {
176
+ hook.call(context)
177
+ return originalRender(h, context)
178
+ }
179
+ } else {
180
+ // inject component registration as beforeCreate hook
181
+ var existing = options.beforeCreate
182
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
183
+ }
184
+ }
185
+
186
+ return {
187
+ exports: scriptExports,
188
+ options: options
189
+ }
190
+ }
191
+
192
+
193
+ /***/ }),
194
+
195
+ /***/ 13:
196
+ /***/ (function(module, exports) {
197
+
198
+ module.exports = require("element-ui/lib/button");
199
+
200
+ /***/ }),
201
+
202
+ /***/ 136:
203
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
204
+
205
+ "use strict";
206
+ // ESM COMPAT FLAG
207
+ __webpack_require__.r(__webpack_exports__);
208
+
209
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/fileUpload/src/main.vue?vue&type=template&id=38e31161
210
+ var render = function () {
211
+ var _vm = this
212
+ var _h = _vm.$createElement
213
+ var _c = _vm._self._c || _h
214
+ return _c(
215
+ "div",
216
+ { staticClass: "cy-file-upload" },
217
+ [
218
+ _c(
219
+ "div",
220
+ { staticClass: "cy-file-upload-btn-box" },
221
+ [
222
+ _vm.showImportTemplate
223
+ ? [
224
+ _c(
225
+ "el-button",
226
+ {
227
+ staticClass: "cy-file-upload-uploader",
228
+ staticStyle: { "margin-right": "10px" },
229
+ attrs: { size: "mini", type: "success", size: _vm.btnSize },
230
+ on: { click: _vm.importTemplate },
231
+ },
232
+ [_vm._v("下载模板")]
233
+ ),
234
+ ]
235
+ : _vm._e(),
236
+ !_vm.disabled
237
+ ? _c(
238
+ "el-upload",
239
+ {
240
+ ref: "upload",
241
+ staticClass: "cy-file-upload-uploader",
242
+ attrs: {
243
+ action: _vm.baseUrl + _vm.uploadFileUrl,
244
+ "before-upload": _vm.handleBeforeUpload,
245
+ data: _vm.data,
246
+ name: _vm.name,
247
+ "file-list": _vm.fileList,
248
+ limit: _vm.limit,
249
+ accept: _vm.fileAccept,
250
+ "on-error": _vm.handleUploadError,
251
+ "on-exceed": _vm.handleExceed,
252
+ "on-success": _vm.handleUploadSuccess,
253
+ "show-file-list": false,
254
+ headers: _vm.headers,
255
+ },
256
+ },
257
+ [
258
+ _c(
259
+ "el-button",
260
+ {
261
+ attrs: {
262
+ size: _vm.btnSize,
263
+ type: _vm.btnColor,
264
+ loading: _vm.downloadLoading,
265
+ icon: _vm.btnIcon,
266
+ plain: _vm.btnPlain,
267
+ },
268
+ },
269
+ [_vm._v(_vm._s(_vm.btnText))]
270
+ ),
271
+ ],
272
+ 1
273
+ )
274
+ : _vm._e(),
275
+ ],
276
+ 2
277
+ ),
278
+ _vm.showTip && !_vm.onlyBtn && !_vm.disabled
279
+ ? _c(
280
+ "div",
281
+ {
282
+ staticClass: "el-upload__tip",
283
+ attrs: { slot: "tip" },
284
+ slot: "tip",
285
+ },
286
+ [
287
+ _vm._v("\n\t\t请上传\n\t\t"),
288
+ _vm.fileSize
289
+ ? [
290
+ _vm._v(" 大小不超过 "),
291
+ _c("b", { staticStyle: { color: "#f56c6c" } }, [
292
+ _vm._v(_vm._s(_vm.fileSize) + "MB"),
293
+ ]),
294
+ ]
295
+ : _vm._e(),
296
+ _vm.fileType && !_vm.fileType.includes("*")
297
+ ? [
298
+ _vm._v(" 格式为 "),
299
+ _c("b", { staticStyle: { color: "#f56c6c" } }, [
300
+ _vm._v(_vm._s(_vm.fileType.join("/"))),
301
+ ]),
302
+ ]
303
+ : _vm._e(),
304
+ _vm._v("\n\t\t的文件\n\t"),
305
+ ],
306
+ 2
307
+ )
308
+ : _vm._e(),
309
+ !_vm.onlyBtn
310
+ ? [
311
+ !_vm.isThumbnail
312
+ ? _c(
313
+ "ul",
314
+ {
315
+ staticClass:
316
+ "cy-file-upload-list el-upload-list el-upload-list--text",
317
+ },
318
+ _vm._l(_vm.fileList, function (file, index) {
319
+ return _c(
320
+ "li",
321
+ {
322
+ key: file.id,
323
+ staticClass:
324
+ "el-upload-list__item ele-upload-list__item-content",
325
+ },
326
+ [
327
+ _c(
328
+ "el-link",
329
+ {
330
+ staticClass: "link_icon",
331
+ attrs: { underline: false },
332
+ nativeOn: {
333
+ click: function ($event) {
334
+ return _vm.downloadAttach(file)
335
+ },
336
+ },
337
+ },
338
+ [
339
+ _c("span", { staticClass: "el-icon-document" }, [
340
+ _vm._v(
341
+ " " +
342
+ _vm._s(_vm.getFileName(file.file_name)) +
343
+ " "
344
+ ),
345
+ ]),
346
+ ]
347
+ ),
348
+ _c(
349
+ "div",
350
+ {
351
+ staticClass:
352
+ "ele-upload-list__item-content-action flex_shrink",
353
+ },
354
+ [
355
+ _vm.isDownload
356
+ ? _c(
357
+ "el-link",
358
+ {
359
+ attrs: {
360
+ underline: false,
361
+ type: "primary",
362
+ },
363
+ on: {
364
+ click: function ($event) {
365
+ return _vm.downloadAttach(file)
366
+ },
367
+ },
368
+ },
369
+ [_vm._v("下载")]
370
+ )
371
+ : _vm._e(),
372
+ _vm.isPreview
373
+ ? _c(
374
+ "el-link",
375
+ {
376
+ attrs: {
377
+ underline: false,
378
+ type: "primary",
379
+ },
380
+ on: {
381
+ click: function ($event) {
382
+ return _vm.previewFile(file)
383
+ },
384
+ },
385
+ },
386
+ [_vm._v("预览")]
387
+ )
388
+ : _vm._e(),
389
+ !_vm.disabled
390
+ ? _c(
391
+ "el-link",
392
+ {
393
+ attrs: { underline: false, type: "danger" },
394
+ on: {
395
+ click: function ($event) {
396
+ return _vm.handleDelete(index)
397
+ },
398
+ },
399
+ },
400
+ [_vm._v("删除")]
401
+ )
402
+ : _vm._e(),
403
+ ],
404
+ 1
405
+ ),
406
+ ],
407
+ 1
408
+ )
409
+ }),
410
+ 0
411
+ )
412
+ : _vm._e(),
413
+ ]
414
+ : _vm._e(),
415
+ ],
416
+ 2
417
+ )
418
+ }
419
+ var staticRenderFns = []
420
+ render._withStripped = true
421
+
422
+
423
+ // CONCATENATED MODULE: ./packages/fileUpload/src/main.vue?vue&type=template&id=38e31161
424
+
425
+ // EXTERNAL MODULE: external "element-ui/lib/upload"
426
+ var upload_ = __webpack_require__(55);
427
+ var upload_default = /*#__PURE__*/__webpack_require__.n(upload_);
428
+
429
+ // EXTERNAL MODULE: external "element-ui/lib/link"
430
+ var link_ = __webpack_require__(56);
431
+ var link_default = /*#__PURE__*/__webpack_require__.n(link_);
432
+
433
+ // EXTERNAL MODULE: external "element-ui/lib/button"
434
+ var button_ = __webpack_require__(13);
435
+ var button_default = /*#__PURE__*/__webpack_require__.n(button_);
436
+
437
+ // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/fileUpload/src/main.vue?vue&type=script&lang=js
438
+ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
439
+
440
+ //
441
+ //
442
+ //
443
+ //
444
+ //
445
+ //
446
+ //
447
+ //
448
+ //
449
+ //
450
+ //
451
+ //
452
+ //
453
+ //
454
+ //
455
+ //
456
+ //
457
+ //
458
+ //
459
+ //
460
+ //
461
+ //
462
+ //
463
+ //
464
+ //
465
+ //
466
+ //
467
+ //
468
+ //
469
+ //
470
+ //
471
+ //
472
+ //
473
+ //
474
+ //
475
+ //
476
+ //
477
+ //
478
+ //
479
+ //
480
+ //
481
+ //
482
+ //
483
+ //
484
+ //
485
+ //
486
+ //
487
+ //
488
+ //
489
+ //
490
+ //
491
+ //
492
+ //
493
+ //
494
+ //
495
+ //
496
+ //
497
+ //
498
+ //
499
+ //
500
+ //
501
+ //
502
+ //
503
+ //
504
+ //
505
+ //
506
+ //
507
+ //
508
+
509
+
510
+
511
+
512
+
513
+ /* harmony default export */ var mainvue_type_script_lang_js = ({
514
+ name: 'CyFileUpload',
515
+ component: [upload_default.a, link_default.a, button_default.a],
516
+ props: {
517
+ // 值
518
+ value: {
519
+ type: [Array, String],
520
+ default: function _default() {
521
+ return [];
522
+ }
523
+ },
524
+ // 数量限制
525
+ limit: {
526
+ type: Number,
527
+ default: 1000
528
+ },
529
+ // 大小限制(MB)
530
+ fileSize: {
531
+ type: Number,
532
+ default: 1000
533
+ },
534
+ // 文件类型, ['*']不限制文件类型, 例如['png', 'jpg', 'jpeg']
535
+ fileType: {
536
+ type: Array,
537
+ default: function _default() {
538
+ return ['jpg', 'jpeg', 'png', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf'];
539
+ }
540
+ },
541
+ // 是否显示提示
542
+ isShowTip: {
543
+ type: Boolean,
544
+ default: true
545
+ },
546
+ // 上传的图片服务器地址
547
+ uploadFileUrl: {
548
+ type: String,
549
+ default: '/design/resource_file/upload_file'
550
+ },
551
+ // 请求参数
552
+ data: {
553
+ type: Object,
554
+ default: function _default() {
555
+ return {};
556
+ }
557
+ },
558
+ // 上传时的文件字段名
559
+ name: {
560
+ type: String,
561
+ default: 'file'
562
+ },
563
+ disabled: {
564
+ type: Boolean,
565
+ default: false
566
+ },
567
+ // 是否显示预览按钮
568
+ isPreview: {
569
+ type: Boolean,
570
+ default: true
571
+ },
572
+ // 只显示上传按钮
573
+ onlyBtn: {
574
+ type: Boolean,
575
+ default: false
576
+ },
577
+ // 上传按钮 文字
578
+ btnText: {
579
+ type: String,
580
+ default: '选取文件'
581
+ },
582
+ // 上传按钮 大小
583
+ btnSize: {
584
+ type: String,
585
+ default: 'mini'
586
+ },
587
+ // 上传按钮 颜色
588
+ btnColor: {
589
+ type: String,
590
+ default: 'primary'
591
+ },
592
+ // 上传按钮 图标
593
+ btnIcon: {
594
+ type: String,
595
+ default: ''
596
+ },
597
+ // 上传按钮 是否为朴素按钮
598
+ btnPlain: {
599
+ type: Boolean,
600
+ default: false
601
+ },
602
+ // 是否显示上传成功提示
603
+ isSuccessMsg: {
604
+ type: Boolean,
605
+ default: true
606
+ },
607
+ // 是否显示下载模板按钮
608
+ showImportTemplate: {
609
+ type: Boolean,
610
+ default: false
611
+ },
612
+ // 下载模板地址
613
+ importTemplateName: {
614
+ type: String,
615
+ default: 'template.xls'
616
+ },
617
+ // 列表是否以缩略图展示
618
+ isThumbnail: {
619
+ type: Boolean,
620
+ default: false
621
+ },
622
+ // 图片预览压缩率0-1,仅isThumbnail为true有效
623
+ imgRatio: {
624
+ type: Number,
625
+ default: 1
626
+ },
627
+ // 是否允许下载
628
+ isDownload: {
629
+ type: Boolean,
630
+ default: true
631
+ },
632
+ // 删除前回调, 必须为Promise
633
+ deleteBefore: {
634
+ type: Function
635
+ },
636
+
637
+ // 服务器转发代理规则,匹配请求路径的前缀
638
+ baseUrl: {
639
+ type: String,
640
+ default: ''
641
+ },
642
+ // 获取token的方法
643
+ getToken: {
644
+ type: Function,
645
+ default: function _default() {
646
+ return '';
647
+ }
648
+ },
649
+ // 下载接口方法,必须返回一个Promise
650
+ fileDownLoad: {
651
+ type: Function,
652
+ default: function _default() {
653
+ return Promise.resolve();
654
+ }
655
+ },
656
+ // 文件预览方法
657
+ getFilePreviewUrl: {
658
+ type: Function,
659
+ default: function _default() {
660
+ return '';
661
+ }
662
+ }
663
+ },
664
+ data: function data() {
665
+ return {
666
+ fileList: [],
667
+ downloadLoading: false
668
+ };
669
+ },
670
+
671
+ watch: {
672
+ value: {
673
+ handler: function handler(val) {
674
+ if (val) {
675
+ if (typeof val === 'string') {
676
+ this.fileList = [{
677
+ file_name: this.getFileName(val),
678
+ file_path: val,
679
+ id: this.createUUID()
680
+ }];
681
+ } else {
682
+ this.fileList = val.map(function (item) {
683
+ return Object.assign({}, item);
684
+ });
685
+ }
686
+ } else {
687
+ this.fileList = [];
688
+ return [];
689
+ }
690
+ },
691
+
692
+ deep: true,
693
+ immediate: true
694
+ }
695
+ },
696
+ computed: {
697
+ // 是否显示提示
698
+ showTip: function showTip() {
699
+ return this.isShowTip && (this.fileType && !this.fileType.includes('*') || this.fileSize);
700
+ },
701
+ fileAccept: function fileAccept() {
702
+ var arr = this.fileType.includes('*') ? [] : this.fileType.map(function (item) {
703
+ return '.' + item;
704
+ });
705
+ return arr.join();
706
+ },
707
+ headers: function headers() {
708
+ return {
709
+ Authorization: 'Bearer ' + this.getToken()
710
+ };
711
+ }
712
+ },
713
+ methods: {
714
+ /**
715
+ * 上传前校检格式和大小
716
+ */
717
+ handleBeforeUpload: function handleBeforeUpload(file) {
718
+ this.downloadLoading = true;
719
+ // 校检文件类型
720
+ if (this.fileType && !this.fileType.includes('*')) {
721
+ var fileExtension = this.getFileExtension(file.name);
722
+ if (!this.fileType.includes(fileExtension)) {
723
+ this.$message.error('\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E, \u8BF7\u4E0A\u4F20' + this.fileType.join('/') + '\u683C\u5F0F\u6587\u4EF6!');
724
+ this.downloadLoading = false;
725
+ return false;
726
+ }
727
+ }
728
+ // 校检文件大小
729
+ if (this.fileSize) {
730
+ var isLt = file.size / 1024 / 1024 < this.fileSize;
731
+ if (!isLt) {
732
+ this.$message.error('\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ' + this.fileSize + ' MB!');
733
+ this.downloadLoading = false;
734
+ return false;
735
+ }
736
+ }
737
+ return true;
738
+ },
739
+
740
+
741
+ /**
742
+ * 文件个数超出
743
+ */
744
+ handleExceed: function handleExceed() {
745
+ if (this.limit === 1) {
746
+ this.$message.error('只能上传单个文件!');
747
+ } else {
748
+ this.$message.error('\u4E0A\u4F20\u6587\u4EF6\u6570\u91CF\u4E0D\u80FD\u8D85\u8FC7 ' + this.limit + ' \u4E2A!');
749
+ }
750
+ this.downloadLoading = false;
751
+ },
752
+
753
+
754
+ /**
755
+ * 上传失败
756
+ */
757
+ handleUploadError: function handleUploadError(err) {
758
+ this.$message.error('上传失败, 请重试');
759
+ this.downloadLoading = false;
760
+ },
761
+
762
+
763
+ /**
764
+ * 上传成功回调
765
+ */
766
+ handleUploadSuccess: function handleUploadSuccess(res, file) {
767
+ if (res.code !== 200) {
768
+ this.$message.error(res.msg);
769
+ } else {
770
+ if (this.isSuccessMsg) this.$message.success('上传成功');
771
+ this.fileList.push(res.data);
772
+ }
773
+ this.downloadLoading = false;
774
+ this.$emit('input', this.fileList);
775
+ },
776
+
777
+
778
+ /**
779
+ * 删除文件
780
+ */
781
+ handleDelete: function handleDelete(index) {
782
+ var _this = this;
783
+
784
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
785
+ var res;
786
+ return regeneratorRuntime.wrap(function _callee$(_context) {
787
+ while (1) {
788
+ switch (_context.prev = _context.next) {
789
+ case 0:
790
+ if (!_this.deleteBefore) {
791
+ _context.next = 13;
792
+ break;
793
+ }
794
+
795
+ _context.prev = 1;
796
+ _context.next = 4;
797
+ return _this.deleteBefore(_this.fileList[index], index);
798
+
799
+ case 4:
800
+ res = _context.sent;
801
+
802
+ if (res) {
803
+ _context.next = 7;
804
+ break;
805
+ }
806
+
807
+ return _context.abrupt('return');
808
+
809
+ case 7:
810
+ _context.next = 13;
811
+ break;
812
+
813
+ case 9:
814
+ _context.prev = 9;
815
+ _context.t0 = _context['catch'](1);
816
+
817
+ console.log(_context.t0);
818
+ return _context.abrupt('return');
819
+
820
+ case 13:
821
+ _this.fileList.splice(index, 1);
822
+ _this.$emit('input', _this.fileList);
823
+
824
+ case 15:
825
+ case 'end':
826
+ return _context.stop();
827
+ }
828
+ }
829
+ }, _callee, _this, [[1, 9]]);
830
+ }))();
831
+ },
832
+
833
+
834
+ /**
835
+ * 获取文件名称
836
+ */
837
+ getFileName: function getFileName(name) {
838
+ if (name.lastIndexOf('/') > -1) {
839
+ return name.slice(name.lastIndexOf('/') + 1).toLowerCase();
840
+ } else {
841
+ return name;
842
+ }
843
+ },
844
+
845
+
846
+ /**
847
+ * 获取文件类型,后缀
848
+ */
849
+ getFileExtension: function getFileExtension(name) {
850
+ if (name.lastIndexOf('.') > -1) {
851
+ return name.slice(name.lastIndexOf('.') + 1).toLowerCase();
852
+ }
853
+ return '';
854
+ },
855
+
856
+
857
+ /**
858
+ * 查看 预览
859
+ */
860
+ previewFile: function previewFile(file) {
861
+ window.open(this.getFilePreviewUrl(file));
862
+ },
863
+
864
+
865
+ /**
866
+ * 附件下载
867
+ * */
868
+ downloadAttach: function downloadAttach(file) {
869
+ var _this2 = this;
870
+
871
+ if (!this.isDownload) return;
872
+
873
+ var id = file.id,
874
+ file_name = file.file_name,
875
+ file_type = file.file_type;
876
+
877
+ this.downloadLoading = true;
878
+ this.fileDownLoad(id).then(function (res) {
879
+ var blob = new Blob([res]);
880
+ if ('download' in document.createElement('a')) {
881
+ var link = document.createElement('a');
882
+ link.download = file_name;
883
+ link.style.display = 'none';
884
+ link.href = URL.createObjectURL(blob);
885
+ document.body.appendChild(link);
886
+ link.click();
887
+ URL.revokeObjectURL(link.href);
888
+ document.body.removeChild(link);
889
+ } else {
890
+ navigator.msSaveBlob(blob, file_name);
891
+ }
892
+ _this2.downloadLoading = false;
893
+ }).catch(function (err) {
894
+ _this2.downloadLoading = false;
895
+ console.log(err);
896
+ _this2.$message.error('文件下载失败!');
897
+ });
898
+ },
899
+
900
+
901
+ /**
902
+ * 下载模板操作
903
+ */
904
+ importTemplate: function importTemplate() {
905
+ var link = document.createElement('a');
906
+ link.style.display = 'none';
907
+ link.setAttribute('href', '/static/' + this.importTemplateName);
908
+ link.download = this.importTemplateName; // 下载的文件名
909
+ document.body.appendChild(link);
910
+ link.click();
911
+ document.body.removeChild(link);
912
+ },
913
+
914
+
915
+ /**
916
+ * 自定义生成UUID
917
+ */
918
+ createUUID: function createUUID() {
919
+ return 'xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function (c) {
920
+ var r = Math.random() * 16 | 0;
921
+ var v = c === 'x' ? r : r & 0x3 | 0x8;
922
+ return v.toString(16);
923
+ });
924
+ }
925
+ }
926
+ });
927
+ // CONCATENATED MODULE: ./packages/fileUpload/src/main.vue?vue&type=script&lang=js
928
+ /* harmony default export */ var src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
929
+ // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
930
+ var componentNormalizer = __webpack_require__(0);
931
+
932
+ // CONCATENATED MODULE: ./packages/fileUpload/src/main.vue
933
+
934
+
935
+
936
+
937
+
938
+ /* normalize component */
939
+
940
+ var component = Object(componentNormalizer["a" /* default */])(
941
+ src_mainvue_type_script_lang_js,
942
+ render,
943
+ staticRenderFns,
944
+ false,
945
+ null,
946
+ null,
947
+ null
948
+
949
+ )
950
+
951
+ /* harmony default export */ var main = (component.exports);
952
+ // CONCATENATED MODULE: ./packages/fileUpload/index.js
953
+
954
+
955
+ /* istanbul ignore next */
956
+ main.install = function (Vue) {
957
+ Vue.component(main.name, main);
958
+ };
959
+
960
+ /* harmony default export */ var packages_fileUpload = __webpack_exports__["default"] = (main);
961
+
962
+ /***/ }),
963
+
964
+ /***/ 55:
965
+ /***/ (function(module, exports) {
966
+
967
+ module.exports = require("element-ui/lib/upload");
968
+
969
+ /***/ }),
970
+
971
+ /***/ 56:
972
+ /***/ (function(module, exports) {
973
+
974
+ module.exports = require("element-ui/lib/link");
975
+
976
+ /***/ })
977
+
978
+ /******/ });