doway-coms 2.10.25 → 2.10.26

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": "doway-coms",
3
- "version": "2.10.25",
3
+ "version": "2.10.26",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -14,8 +14,8 @@
14
14
  <slot name='header' :row="internalRow"></slot>
15
15
  <div class="attach" v-if="internalRow.attach.content === 'image'">
16
16
  <img
17
- @click="attachFileClick(internalRow.attach)"
18
- :style="{ height: height, lineHeight: height, width: width }"
17
+ @click="attachFileClick(internalRow)"
18
+ :style="{ height: height+'px', lineHeight: height+'px', width: width+'px' }"
19
19
  style="
20
20
  border: 1px solid #ccc;
21
21
  border-radius: 6px;
@@ -44,8 +44,8 @@
44
44
  </div>
45
45
  <div class="attach" v-else-if="internalRow.attach.contentType == 'application/pdf'">
46
46
  <img
47
- @click="attachFileClick(internalRow.attach)"
48
- :style="{ height: height, lineHeight: height, width: width }"
47
+ @click="attachFileClick(internalRow)"
48
+ :style="{ height: height+'px', lineHeight: height+'px', width: width+'px' }"
49
49
  src="../../styles/icon/pdf_file.svg"
50
50
  />
51
51
  <a-icon
@@ -67,8 +67,8 @@
67
67
  </div>
68
68
  <div class="attach" v-else>
69
69
  <img
70
- @click="attachFileClick(internalRow.attach)"
71
- :style="{ height: height, lineHeight: height, width: width }"
70
+ @click="attachFileClick(internalRow)"
71
+ :style="{ height: height+'px', lineHeight: height+'px', width: width +'px'}"
72
72
  src="../../styles/icon/uploaded_file.svg"
73
73
  :data-mimetype="internalRow.attach.contentType"
74
74
  />
@@ -97,11 +97,13 @@
97
97
  </div>
98
98
  </template>
99
99
  </div>
100
- <div v-show="edit===true" @click="selectClick" ref="updateLoadContentView"
100
+ <a-spin tip="上传中" :spinning="uploading">
101
+ <div v-show="edit===true" @click="selectClick"
101
102
  style="border: 1px solid #d9d9d9; border-radius: 6px"
102
- :style="{ width: width, height: height, lineHeight: height,borderColor:currentSelectId==='empty'?'blue':null }"
103
+ :style="{ width: width+'px', height: height+'px' }"
103
104
  >
104
- <span style="cursor: default;">&nbsp;</span>
105
+
106
+ <!-- <span style="cursor: default;">&nbsp;</span> -->
105
107
  <a-upload
106
108
  class="avatar-uploader"
107
109
  :headers="uploadHeaders"
@@ -115,11 +117,15 @@
115
117
  <a-icon
116
118
  type="plus"
117
119
  class="avatar-uploader-icon"
118
- style="text-align: center;width:50px;height: 50px;line-height:50px;"
120
+ :style="{ width: width+'px', height: height+'px', lineHeight: height+'px' }"
121
+ style="text-align: center;"
119
122
  />
120
-
121
- </a-upload>
122
- </div>
123
+ </a-upload>
124
+ <div ref="updateLoadContentView" :style="{color:currentSelectId==='empty'?'blue':null}"
125
+ v-clickoutside="removeSelect">点击后ctrl+v</div>
126
+ </div>
127
+ </a-spin>
128
+
123
129
  <div v-if="edit !== true && showEmptyText && internalRows.length === 0">
124
130
  没有附件信息哦,请编辑添加附件信息
125
131
  </div>
@@ -153,8 +159,9 @@
153
159
  </template>
154
160
 
155
161
  <script>
156
- import { notification, Upload } from "ant-design-vue";
162
+ import { notification, Upload,Spin } from "ant-design-vue";
157
163
  import { sysRowState } from "../../utils/enum";
164
+ import clickoutside from '../../directive/clickoutside'
158
165
  import { Checkbox, Modal } from "vxe-table";
159
166
  import { attachGetAttachUrlApi, attachSearchApi } from "../../utils/api";
160
167
  import request from '../../utils/request'
@@ -164,9 +171,14 @@ export default {
164
171
  VxeCheckbox: Checkbox,
165
172
  "a-upload": Upload,
166
173
  VxeModal: Modal,
174
+ 'a-spin':Spin
175
+ },
176
+ directives: {
177
+ clickoutside
167
178
  },
168
179
  data() {
169
180
  return {
181
+ uploading:false,
170
182
  currentSelectId:null,
171
183
  uploadFileList:[],
172
184
  demo1: "",
@@ -240,12 +252,12 @@ export default {
240
252
  },
241
253
  },
242
254
  width: {
243
- type: String,
244
- default: "100px",
255
+ type: Number,
256
+ default: 100,
245
257
  },
246
258
  height: {
247
- type: String,
248
- default: "100px",
259
+ type: Number,
260
+ default: 100,
249
261
  },
250
262
  rows: {
251
263
  // 表格数据
@@ -354,7 +366,9 @@ export default {
354
366
  })
355
367
  .catch(() => {});
356
368
  },
357
- attachFileClick(attachFile) {},
369
+ attachFileClick(attachFile) {
370
+ // console.debug('attachFileClick',attachFile)
371
+ },
358
372
  handleAvatarSuccess(info) {
359
373
  if (info.file.status == "done") {
360
374
  let addRow = {
@@ -466,17 +480,31 @@ export default {
466
480
  * 黏贴附件
467
481
  */
468
482
  async pasteFileClick(e){
469
- console.debug('e',e)
483
+ if(this.currentSelectId!=='empty'){
484
+ return
485
+ }
486
+ // console.debug('e',e)
470
487
  const items = e.clipboardData.files;
488
+ if(items.length===0){
489
+ return
490
+ }
471
491
  console.debug('items',items)
492
+ this.uploading = true
493
+ try
494
+ {
472
495
  for (const item of items) {
473
496
  // if (item.type.startsWith('image/') || item.type.startsWith('application/')) {
474
497
  // this.pasteFile = URL.createObjectURL(item)
475
498
  //'复制文件'+this.$store.getters.newId() +'.png'
476
499
  // let type = item.type
477
- this.pasteFile =item //new File([item],`复制文件${this.$store.getters.newId()}.${type.split('/')[1]}` , { type });
478
- this.uploadPasteFile()
479
- return
500
+ // this.pasteFile =item //new File([item],`复制文件${this.$store.getters.newId()}.${type.split('/')[1]}` , { type });
501
+ // this.uploadPasteFile()
502
+ const formData = new FormData();
503
+ formData.append('file', item)
504
+ formData.append('picType', this.uploadData.picType)
505
+ formData.append('resId', this.uploadData.resId)
506
+ let res = await request({url:this.uploadData.picAction,method:'post',data:formData,headers:{'Content-Type': 'multipart/form-data'}})
507
+ this.handleAvatarSuccess({file:{status:'done',response:res}})
480
508
  // console.debug('file',file)
481
509
  // this.uploadFileList = [file];
482
510
  // const reader = new FileReader();
@@ -487,6 +515,14 @@ export default {
487
515
  // reader.readAsDataURL(blob);
488
516
  // }
489
517
  }
518
+ }
519
+ finally{
520
+ this.uploading = false
521
+ }
522
+ },
523
+ removeSelect(){
524
+ console.debug('removeSelect')
525
+ this.currentSelectId = null
490
526
  },
491
527
  selectClick(event){
492
528
  this.currentSelectId = 'empty'
@@ -500,17 +536,8 @@ export default {
500
536
  // })
501
537
  // this.$refs.updateLoadContentView.focus()
502
538
  },
503
- uploadPasteFile(){
504
- const formData = new FormData();
505
- formData.append('file', this.pasteFile)
506
- formData.append('picType', this.uploadData.picType)
507
- formData.append('resId', this.uploadData.resId)
508
- request({url:this.uploadData.picAction,method:'post',data:formData,headers:{'Content-Type': 'multipart/form-data'}})
509
- .then(res=>{
510
- this.handleAvatarSuccess({file:{status:'done',response:res}})
511
- }).catch(err=>{
512
- console.debug(err)
513
- })
539
+ async uploadPasteFile(){
540
+
514
541
  }
515
542
  },
516
543
  };