meixioacomponent 0.3.89 → 0.3.92

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meixioacomponent",
3
- "version": "0.3.89",
3
+ "version": "0.3.92",
4
4
  "private": false,
5
5
  "author": "YuRi",
6
6
  "main": "lib/meixioacomponent.umd.min.js",
@@ -10,9 +10,9 @@
10
10
  type="file"
11
11
  ref="inputFile"
12
12
  :accept="accept"
13
- @change="inputFileChange"
14
13
  style="display: none;"
15
14
  v-if="type == 'upload'"
15
+ @change="onInputFileChange"
16
16
  :multiple="uploadType == 'single' ? false : true"
17
17
  />
18
18
  <base-icon
@@ -129,6 +129,11 @@ export default {
129
129
  default: false,
130
130
  },
131
131
 
132
+ autoUpload: {
133
+ type: Boolean,
134
+ default: true,
135
+ },
136
+
132
137
  cropperConfig: {
133
138
  type: Object,
134
139
  default: () => {
@@ -224,6 +229,7 @@ export default {
224
229
 
225
230
  async returnFiles(files) {
226
231
  let list = []
232
+ console.log(files)
227
233
  const { fileSize } = this.$props
228
234
  for (let i = 0; i < files.length; i++) {
229
235
  if (files[i].size < fileSize * 1048576) {
@@ -240,9 +246,26 @@ export default {
240
246
  return list
241
247
  },
242
248
 
249
+ onInputFileChange(e) {
250
+ const { autoUpload } = this.$props
251
+
252
+ if (!autoUpload) {
253
+ this.$emit('onInputFileChange', e)
254
+ return
255
+ }
256
+ this.inputFileChange(e)
257
+ },
258
+
243
259
  inputFileChange(e) {
244
- const { cropper, isGroup, fileType, uploadType } = this.$props
245
- let files = e.target.files
260
+ const { cropper, isGroup, fileType, uploadType, autoUpload } = this.$props
261
+
262
+ let files = null
263
+ if (autoUpload) {
264
+ files = e.target.files
265
+ } else {
266
+ files = e
267
+ }
268
+
246
269
  if (cropper && !isGroup && fileType == 'img' && uploadType == 'single') {
247
270
  this.userCropper(files[0])
248
271
  return
@@ -289,7 +312,7 @@ export default {
289
312
  },
290
313
 
291
314
  async onPasteFile() {
292
- const { disabled } = this.$props
315
+ const { disabled, autoUpload } = this.$props
293
316
  if (this.uploadLoading || disabled) return
294
317
  const items = (event.clipboardData || window.clipboardData).items
295
318
  const rowList = []
@@ -308,7 +331,17 @@ export default {
308
331
  }
309
332
  if (rowList.length <= 0) return
310
333
  let list = await this.returnFiles(rowList)
311
- this.emitEvent(list)
334
+
335
+ if (autoUpload) {
336
+ this.emitEvent(list)
337
+ } else {
338
+ console.log(list)
339
+ this.$emit('onInputFileChange', list)
340
+ }
341
+ },
342
+
343
+ getInputFileValue() {
344
+ return this.$refs.inputFile.value
312
345
  },
313
346
  },
314
347
  }
@@ -12,6 +12,7 @@ export const baseUploadMixins = {
12
12
 
13
13
  props: {
14
14
  uploadPath: {
15
+ type: [String, Array],
15
16
  default: () => {
16
17
  return [0, 1]
17
18
  },
@@ -40,7 +41,11 @@ export const baseUploadMixins = {
40
41
  }
41
42
  const { uploadPath } = this.$props
42
43
 
43
- componentConfig.setUploadUrl(uploadPath[0], uploadPath[1])
44
+ if (uploadPath instanceof Array) {
45
+ componentConfig.setUploadUrl(uploadPath[0], uploadPath[1])
46
+ } else {
47
+ componentConfig.setUploadCustomUrl(uploadPath)
48
+ }
44
49
 
45
50
  if (!this.uploadLoading) {
46
51
  useUpload.toUpload(this.module ? this.module : list, this.uploadEd)
@@ -0,0 +1,236 @@
1
+ <template>
2
+ <base-dialog
3
+ ref="dialog"
4
+ :modal="true"
5
+ :title="`批量上传`"
6
+ :isCache="true"
7
+ :isDestroy="true"
8
+ :width="`600px`"
9
+ @destroy="destroy"
10
+ :appendToBody="true"
11
+ :contentHeight="`200px`"
12
+ >
13
+ <div class="dialog-content" slot="dialog-content">
14
+ <el-steps :active="stepActive" simple>
15
+ <el-step title="上传文件" icon="el-icon-folder-add"></el-step>
16
+ <el-step title="导入数据" icon="el-icon-upload"></el-step>
17
+ <el-step title="导入完成" icon="el-icon-check"></el-step>
18
+ </el-steps>
19
+
20
+ <div class="custom-upload-content" v-on:paste="onPasteFile">
21
+ <span class="notice-text">
22
+ 请选择需要导入的文件(
23
+ <strong>点击此处后</strong>
24
+ >支持黏贴文件上传)
25
+ </span>
26
+ <div class="upload-handle-wrap" v-show="stepActive == 0">
27
+ <el-input
28
+ :disabled="true"
29
+ :size="`mini`"
30
+ v-model="fileName"
31
+ style="margin-right: var(--margin-4);"
32
+ ></el-input>
33
+ <el-button type="primary" size="mini" @click="onHandleFile">
34
+ 选择文件
35
+ </el-button>
36
+
37
+ <base-upload-item
38
+ :max="max"
39
+ v-model="module"
40
+ :disabled="disabled"
41
+ :fileType="fileType"
42
+ :auto-upload="false"
43
+ style="display: none;"
44
+ :uploadType="uploadType"
45
+ ref="baseUploadItemRef"
46
+ @uploadEd="uploadEd"
47
+ @onInputFileChange="onInputFileChange"
48
+ ></base-upload-item>
49
+
50
+ <slot name="upload-extend-notice"></slot>
51
+ </div>
52
+
53
+ <div class="upload-handle-wrap flex" v-show="stepActive == 1">
54
+ <base-default-svg
55
+ :wdith="200"
56
+ :text="`正在上传中`"
57
+ :svgName="`no-record`"
58
+ ></base-default-svg>
59
+ </div>
60
+ <div class="upload-handle-wrap flex" v-show="stepActive == 2">
61
+ <base-default-svg
62
+ :wdith="200"
63
+ v-if="!resultTemplate"
64
+ :text="result == 'fail' ? '上传失败' : '上传成功'"
65
+ :svgName="result == 'fail' ? '404' : 'no-data'"
66
+ ></base-default-svg>
67
+ <slot name="resultTemplate" v-else></slot>
68
+ </div>
69
+ </div>
70
+ </div>
71
+
72
+ <base-button-handle
73
+ slot="dialog-footer"
74
+ :size="`mini`"
75
+ :config="buttonConfig"
76
+ ></base-button-handle>
77
+ </base-dialog>
78
+ </template>
79
+
80
+ <script>
81
+ import BaseDefaultSvg from '../baseDefaultSvg/baseDefaultSvg.vue'
82
+ import baseUploadItem from '../baseUpload/baseUploadItem.vue'
83
+ export default {
84
+ data() {
85
+ return {
86
+ file: null,
87
+ result: false,
88
+ stepActive: 0,
89
+ fileName: null,
90
+ }
91
+ },
92
+ created() {},
93
+ mounted() {
94
+ this.$refs.dialog.showDialog()
95
+ },
96
+ props: {
97
+ // 需要上传的路径,地址支持自定义
98
+ uploadPath: {
99
+ type: [String, Array],
100
+ default: () => {
101
+ return [0, 1]
102
+ },
103
+ },
104
+ //是否是单文件
105
+ uploadType: {
106
+ type: String,
107
+ default: 'single',
108
+ },
109
+ //文件类型
110
+ fileType: {
111
+ type: String,
112
+ default: 'other',
113
+ },
114
+ //最大的上传数量
115
+ max: {
116
+ type: Number,
117
+ default: 99,
118
+ },
119
+ //是否禁用
120
+ disabled: {
121
+ type: Boolean,
122
+ default: false,
123
+ },
124
+ //v-model
125
+ value: {},
126
+
127
+ // resulte template slot插槽
128
+ resultTemplate: {
129
+ type: Boolean,
130
+ default: false,
131
+ },
132
+ },
133
+ components: { baseUploadItem, BaseDefaultSvg },
134
+ computed: {
135
+ module: {
136
+ set(val) {
137
+ this.$emit('input', val)
138
+ },
139
+ get() {
140
+ return this.$props.value
141
+ },
142
+ },
143
+ buttonConfig() {
144
+ return [
145
+ {
146
+ type: 'info',
147
+ text: '取消',
148
+ disabled: this.stepActive == 1 ? true : false,
149
+ click: () => {
150
+ this.$refs.dialog.closeDialog()
151
+ },
152
+ },
153
+ {
154
+ type: 'primary',
155
+ disabled: this.stepActive == 1 ? true : false,
156
+ text: this.stepActive == 0 ? '导入文件' : '确定',
157
+ click: () => {
158
+ if (this.stepActive == 0) {
159
+ this.$refs.baseUploadItemRef.inputFileChange(this.file)
160
+ this.stepActive += 1
161
+ } else if (this.stepActive == 2) {
162
+ this.$emit('uploadOver')
163
+ this.$refs.dialog.closeDialog()
164
+ }
165
+ },
166
+ },
167
+ ]
168
+ },
169
+ },
170
+ methods: {
171
+ destroy() {
172
+ this.$destroy()
173
+ },
174
+ uploadEd(e) {
175
+ this.stepActive = 2
176
+ const { url } = e[0]
177
+ if (url == 'cancel') {
178
+ this.result = 'fail'
179
+ } else {
180
+ result = 'success'
181
+ }
182
+ },
183
+ onHandleFile() {
184
+ this.$refs.baseUploadItemRef.clickFile()
185
+ },
186
+ onInputFileChange(e) {
187
+ this.fileName = e.target?.files[0].name || e[0].file.name
188
+ this.file =
189
+ e.target?.files ||
190
+ e.map((item) => {
191
+ return item.file
192
+ })
193
+ },
194
+ onPasteFile() {
195
+ const { disabled } = this.$props
196
+ const { stepActive } = this
197
+ if (stepActive == '0' && !disabled) {
198
+ this.$refs.baseUploadItemRef.onPasteFile()
199
+ }
200
+ },
201
+ },
202
+ }
203
+ </script>
204
+
205
+ <style lang="less" scoped>
206
+ .dialog-content {
207
+ width: 100%;
208
+ height: 100%;
209
+
210
+ /deep/ .el-steps--simple {
211
+ padding: 8px 8%;
212
+ }
213
+ .custom-upload-content {
214
+ width: 100%;
215
+ height: calc(100% - 36px);
216
+ margin-top: var(--margin-4);
217
+ .notice-text {
218
+ color: var(--font-color-s);
219
+ font-size: var(--font-size-s);
220
+ }
221
+ .upload-handle-wrap {
222
+ width: 100%;
223
+ height: auto;
224
+ display: flex;
225
+ overflow-y: auto;
226
+ margin-top: var(--margin-4);
227
+ }
228
+ .flex {
229
+ display: flex;
230
+ flex-flow: column;
231
+ align-items: center;
232
+ justify-content: center;
233
+ }
234
+ }
235
+ }
236
+ </style>
@@ -33,24 +33,25 @@
33
33
  </template>
34
34
 
35
35
  <script>
36
- import uploadItemVue from "./uploadItem.vue";
36
+ import uploadItemVue from './uploadItem.vue'
37
37
  //
38
- import Upload from "../../../utils/upload";
38
+ import Upload from '../../../utils/upload'
39
39
  export default {
40
- name: "upload",
40
+ name: 'upload',
41
41
  data() {
42
42
  return {
43
43
  isDown: false,
44
- };
44
+ uploadArray: [],
45
+ }
45
46
  },
46
47
  mounted() {
47
- this.startUpload();
48
+ this.startUpload()
48
49
  },
49
50
  components: {
50
51
  uploadItemVue,
51
52
  },
52
53
  props: {
53
- uploadArray: {
54
+ toUploadList: {
54
55
  type: Array,
55
56
  },
56
57
  uploadEdEvent: {
@@ -61,130 +62,130 @@ export default {
61
62
  computed: {
62
63
  filterArray() {
63
64
  return this.uploadArray.filter((item) => {
64
- return item.file;
65
- });
65
+ return item.file
66
+ })
66
67
  },
67
68
  wrapStyle() {
68
69
  return {
69
- bottom: this.isDown ? "-360px" : "0px",
70
- };
70
+ bottom: this.isDown ? '-360px' : '0px',
71
+ }
71
72
  },
72
73
  handleDownIcon() {
73
74
  if (this.isDown) {
74
- return "meixicomponenticon-shouqi";
75
+ return 'meixicomponenticon-shouqi'
75
76
  }
76
- return "meixicomponenticon-xiala";
77
+ return 'meixicomponenticon-xiala'
77
78
  },
78
79
 
79
80
  completed() {
80
- let uploadArray = this.$props.uploadArray;
81
+ let uploadArray = this.$props.uploadArray
81
82
  return (
82
83
  uploadArray.filter((item) => {
83
- return item.process == 100;
84
+ return item.process == 100
84
85
  }).length / uploadArray.length
85
- );
86
+ )
86
87
  },
87
88
  totalStyle() {
88
- return { width: `${this.completed * 100}%` };
89
+ return { width: `${this.completed * 100}%` }
89
90
  },
90
91
  },
91
92
  methods: {
92
93
  handleDown() {
93
- this.isDown = !this.isDown;
94
+ this.isDown = !this.isDown
94
95
  },
95
96
  async startUpload() {
96
- let uploadArray = this.$props.uploadArray;
97
+ let uploadArray = this.$props.toUploadList
97
98
  for (let i = 0; i < uploadArray.length; i++) {
98
- let item = uploadArray[i];
99
- this.createUpload(item);
99
+ let item = uploadArray[i]
100
+ this.createUpload(item)
100
101
  }
101
102
  },
102
103
 
103
104
  appendUploadItem(list) {
104
- let uploadArray = this.$props.uploadArray;
105
+ let uploadArray = this.uploadArray
105
106
  if (list instanceof Array) {
106
107
  list.forEach((item) => {
107
- uploadArray.push(item);
108
- this.createUpload(item);
109
- });
108
+ this.createUpload(item)
109
+ })
110
110
  } else {
111
- uploadArray.push(list);
111
+ uploadArray.push(list)
112
112
  }
113
113
  },
114
114
  createUpload(uploadItem) {
115
+ this.uploadArray.push(uploadItem)
115
116
  if (uploadItem.file && uploadItem.process != 100) {
116
117
  uploadItem.upload = new Upload({
117
118
  file: uploadItem.file,
118
119
  uploadProgressFn: (process) => {
119
- uploadItem.process = process;
120
+ uploadItem.process = process
120
121
  },
121
- });
122
+ })
122
123
  uploadItem.upload
123
124
  .start()
124
125
  .then((uploadEdUrl) => {
125
- this.$set(uploadItem, "url", uploadEdUrl);
126
+ this.$set(uploadItem, 'url', uploadEdUrl)
126
127
  // uploadItem.url = uploadEdUrl;
127
128
  if (uploadItem.cb) {
128
- uploadItem.cb([uploadItem]);
129
+ uploadItem.cb([uploadItem])
129
130
  }
130
- this.uploadEd();
131
+ this.uploadEd()
131
132
  })
132
133
  .catch((error) => {
133
134
  // uploadItem.url = "cancel";
134
- this.$set(uploadItem, "url", "cancel");
135
- this.uploadEd();
136
- });
135
+ this.$set(uploadItem, 'url', 'cancel')
136
+ this.uploadEd()
137
+ })
137
138
  }
138
139
  },
139
140
 
140
141
  uploadCancel() {
141
- let flag = this.$props.uploadArray.some((item) => {
142
- return item.upload?.state == 0;
143
- });
142
+ let flag = this.uploadArray.some((item) => {
143
+ return item.upload?.state == 0
144
+ })
144
145
 
145
146
  if (flag) {
146
- this.$confirm("此操作将取消当前未上传的文件, 是否继续?", "提示", {
147
- confirmButtonText: "确定",
148
- cancelButtonText: "取消",
149
- type: "warning",
147
+ this.$confirm('此操作将取消当前未上传的文件, 是否继续?', '提示', {
148
+ confirmButtonText: '确定',
149
+ cancelButtonText: '取消',
150
+ type: 'warning',
150
151
  })
151
152
  .then(() => {
152
- this.$props.uploadArray.forEach((item) => {
153
+ this.uploadArray.forEach((item) => {
153
154
  if (item.upload?.state == 0) {
154
- item.upload.cancel();
155
+ item.upload.cancel()
155
156
  }
156
- });
157
- this.uploadEd();
157
+ })
158
+ this.uploadEd()
158
159
  })
159
- .catch(() => {});
160
+ .catch(() => {})
160
161
  } else {
161
- this.uploadEd();
162
+ this.uploadEd()
162
163
  }
163
164
  },
164
165
 
165
166
  uploadEd() {
166
- let uploadArray = this.$props.uploadArray;
167
+ let uploadArray = this.uploadArray
167
168
  let flag = uploadArray.every((item) => {
168
- return !item.upload || item.upload.state != 0;
169
- });
169
+ return !item.upload || item.upload.state != 0
170
+ })
170
171
  if (flag) {
171
172
  if (this.$props.uploadEdEvent) {
172
173
  uploadArray = uploadArray.filter((item) => {
173
- return item.process == 100 || !item.upload;
174
- });
174
+ return item.process == 100 || !item.upload
175
+ })
175
176
 
176
- this.$props.uploadEdEvent(uploadArray);
177
+ this.$props.uploadEdEvent(uploadArray)
177
178
  }
178
179
  }
179
180
  },
180
181
 
181
182
  uploadFailed() {
182
183
  if (this.$props.uploadEdEvent) {
183
- this.$props.uploadEdEvent();
184
+ this.$props.uploadEdEvent()
184
185
  }
185
186
  },
186
187
  },
187
- };
188
+ }
188
189
  </script>
189
190
 
190
191
  <style lang="less" scoped>
@@ -128,7 +128,7 @@
128
128
  effect="dark"
129
129
  placement="top"
130
130
  :content="scope.row[`${item.key}`]"
131
- v-else-if="scope.row[`${item.key}`].length > 8"
131
+ v-else-if="isToolTip(scope.row[`${item.key}`])"
132
132
  >
133
133
  <span
134
134
  class="cell-content-text"
@@ -446,6 +446,12 @@ export default {
446
446
  oa_pro_table_skeletonVue,
447
447
  },
448
448
  methods: {
449
+ isToolTip(value) {
450
+ if (!value) {
451
+ return false
452
+ }
453
+ return value.toString().length > 10
454
+ },
449
455
  init() {
450
456
  canPush = !this.isAverageWidth
451
457
  this.initProScreenConfig()
@@ -22,7 +22,11 @@ const componentConfig = {
22
22
  },
23
23
 
24
24
  setUploadUrl: (storeType, uploadType) => {
25
- componentConfig.uploadUrl = `${componentConfig.uploadStoreList[storeType]}/${uploadType}/upload`
25
+ componentConfig.uploadUrl = `${componentConfig.uploadPrefix}/${componentConfig.uploadStoreList[storeType]}/${uploadType}/upload`
26
+ },
27
+
28
+ setUploadCustomUrl: (url) => {
29
+ componentConfig.uploadUrl = url
26
30
  },
27
31
 
28
32
  initConfig: (_store, _router) => {