doway-coms 1.3.1 → 1.3.3

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": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -4,7 +4,7 @@
4
4
  <div
5
5
  class="attach-wrapper"
6
6
  v-for="internalRow in internalRows.filter(
7
- x => x.sysRowState != 'delete'
7
+ (x) => x.sysRowState != 'delete'
8
8
  )"
9
9
  :key="internalRow.attach.fileName"
10
10
  >
@@ -20,9 +20,7 @@
20
20
  margin: 0;
21
21
  padding: 0;
22
22
  "
23
- :src="
24
- `${internalServiceUrl}/GetAttachFile/${internalRow.attach.id}?accessToken=${store.getters.token}`
25
- "
23
+ :src="`${internalServiceUrl}/GetAttachFile/${internalRow.attach.id}?accessToken=${$store.getters.token}`"
26
24
  />
27
25
  <a-icon
28
26
  class="attach-delete"
@@ -54,7 +52,7 @@
54
52
  :data-mimetype="internalRow.attach.contentType"
55
53
  />
56
54
  <a-icon
57
- class=" attach-delete"
55
+ class="attach-delete"
58
56
  type="close-circle"
59
57
  v-if="edit === true"
60
58
  @click="removeAttach(internalRow.attach)"
@@ -96,7 +94,7 @@
96
94
  :data="uploadData"
97
95
  v-if="edit === true"
98
96
  @change="handleAvatarSuccess"
99
- :show-file-list="false"
97
+ :showUploadList="false"
100
98
  :before-upload="beforeAvatarUpload"
101
99
  >
102
100
  <div
@@ -159,302 +157,304 @@
159
157
  </template>
160
158
 
161
159
  <script>
162
- import { notification,Upload } from 'ant-design-vue'
163
- import { sysRowState } from '../../utils/enum'
164
- import { Checkbox,Modal } from 'vxe-table'
165
- import store from '../../utils/store'
166
- import {attachGetAttachUrlApi,attachSearchApi} from '../../utils/api'
160
+ import { notification, Upload } from "ant-design-vue";
161
+ import { sysRowState } from "../../utils/enum";
162
+ import { Checkbox, Modal } from "vxe-table";
163
+ import { attachGetAttachUrlApi, attachSearchApi } from "../../utils/api";
167
164
 
168
165
  export default {
169
- name: 'BasePictureCard',
170
- components:{
171
- 'VxeCheckbox':Checkbox,
172
- 'a-upload':Upload,
173
- 'VxeModal':Modal
166
+ name: "BasePictureCard",
167
+ components: {
168
+ VxeCheckbox: Checkbox,
169
+ "a-upload": Upload,
170
+ VxeModal: Modal,
174
171
  },
175
172
  data() {
176
173
  return {
177
- demo1: '',
178
- demo2: '',
179
- internalServiceUrl: '',
180
- downFilePath: '',
181
- downFileName: '',
174
+ demo1: "",
175
+ demo2: "",
176
+ internalServiceUrl: "",
177
+ downFilePath: "",
178
+ downFileName: "",
182
179
  isShowPdf: false,
183
180
  pdfData: null,
184
181
  internalUrls: [],
185
182
  internalRows: [],
186
183
  picName: [],
187
- dialogImageUrl: '',
188
- dialogViewType: '',
184
+ dialogImageUrl: "",
185
+ dialogViewType: "",
189
186
  sysRowState: sysRowState,
190
187
  dialogVisible: false,
191
188
  uploadData: {
192
- picType: '',
193
- picAction: '',
194
- resId: ''
189
+ picType: "",
190
+ picAction: "",
191
+ resId: "",
195
192
  },
196
193
  uploadHeaders: {
197
- Authorization: null
194
+ Authorization: null,
198
195
  },
199
- isFullscreen: false
200
- }
196
+ isFullscreen: false,
197
+ };
201
198
  },
202
199
  props: {
203
200
  showEmptyText: {
204
201
  type: Boolean,
205
- default: true
202
+ default: true,
206
203
  },
207
204
  picType: {
208
205
  type: String,
209
- default: 'cust'
206
+ default: "cust",
210
207
  },
211
208
  value: {
212
- type: String
209
+ type: String,
213
210
  },
214
211
  resId: {
215
- type: String
212
+ type: String,
216
213
  },
217
214
  dataName: {
218
- type: String
215
+ type: String,
219
216
  },
220
217
  edit: {
221
218
  // 列信息
222
- type: Boolean
219
+ type: Boolean,
223
220
  },
224
221
  limitSize: {
225
222
  // 限制上传大小
226
223
  type: Number,
227
- default: 5
224
+ default: 5,
228
225
  },
229
226
  limitType: {
230
227
  // 限制上传类型
231
228
  type: Array,
232
229
  default: () => {
233
- return []
234
- }
230
+ return [];
231
+ },
235
232
  },
236
233
  formRow: {
237
234
  type: Object,
238
235
  default: () => {
239
- return {}
240
- }
236
+ return {};
237
+ },
241
238
  },
242
239
  width: {
243
240
  type: String,
244
- default: '100px'
241
+ default: "100px",
245
242
  },
246
243
  height: {
247
244
  type: String,
248
- default: '100px'
245
+ default: "100px",
249
246
  },
250
247
  rows: {
251
248
  // 表格数据
252
249
  type: Array,
253
- default: function() {
254
- return []
255
- }
250
+ default: function () {
251
+ return [];
252
+ },
256
253
  },
257
254
  cols: {
258
255
  // 表格列信息
259
256
  type: Array,
260
- default: function() {
261
- return []
262
- }
257
+ default: function () {
258
+ return [];
259
+ },
263
260
  },
264
261
  formState: {
265
262
  // 表格列信息
266
263
  type: String,
267
- default: ''
268
- }
264
+ default: "",
265
+ },
269
266
  },
270
267
  watch: {
271
268
  rows: {
272
- handler: function(newVal) {
273
- this.getAttachInfo(newVal)
269
+ handler: function (newVal) {
270
+ this.getAttachInfo(newVal);
274
271
  },
275
- deep: true
272
+ deep: true,
276
273
  },
277
274
  resId: {
278
- handler: function(newVal) {
279
- this.uploadData.resId = newVal
280
- }
281
- }
275
+ handler: function (newVal) {
276
+ this.uploadData.resId = newVal;
277
+ },
278
+ },
282
279
  },
283
280
  created() {},
284
281
  mounted() {
285
282
  // 请求头加入token
286
- this.uploadHeaders.Authorization = `Bearer ${store.getters.token}`
287
-
288
- this.internalServiceUrl = attachGetAttachUrlApi()
289
- this.uploadData.picType = this.picType
290
- this.uploadData.resId = this.resId
291
- this.uploadData.picAction = this.internalServiceUrl + '/UploadAttach'
292
- this.getAttachInfo(this.rows)
283
+ this.uploadHeaders.Authorization = `Bearer ${this.$store.getters.token}`;
284
+
285
+ this.internalServiceUrl = attachGetAttachUrlApi();
286
+ this.uploadData.picType = this.picType;
287
+ this.uploadData.resId = this.resId;
288
+ this.uploadData.picAction = this.internalServiceUrl + "/UploadAttach";
289
+ this.getAttachInfo(this.rows);
293
290
  },
294
291
  methods: {
295
- getCurrentToken(){
296
- return store.getters.token
292
+ getCurrentToken() {
293
+ return this.$store.getters.token;
297
294
  },
298
295
  /**
299
296
  * 获取附件信息
300
297
  */
301
298
  getAttachInfo(newRows) {
302
- let attachIds = []
299
+ let attachIds = [];
303
300
  for (let i = 0; i < newRows.length; i++) {
304
301
  if (newRows[i].attach) {
305
- continue
302
+ continue;
306
303
  }
307
- attachIds.push(newRows[i].attachId)
304
+ attachIds.push(newRows[i].attachId);
308
305
  newRows[i].attach = {
309
- fileName: '',
310
- contentType: '',
311
- content: '',
312
- name: '',
313
- id: newRows[i].attachId
314
- }
306
+ fileName: "",
307
+ contentType: "",
308
+ content: "",
309
+ name: "",
310
+ id: newRows[i].attachId,
311
+ };
315
312
  }
316
313
  if (attachIds.length == 0) {
317
- this.internalRows = newRows
318
- return
314
+ this.internalRows = newRows;
315
+ return;
319
316
  }
320
317
  let postData = {
321
- fields: 'id,fileName,contentType,name,content,isDefault',
318
+ fields: "id,fileName,contentType,name,content,isDefault",
322
319
  begin: 1,
323
320
  size: 0,
324
- exp: 'id in ('
325
- }
321
+ exp: "id in (",
322
+ };
326
323
  for (let i = 0; i < attachIds.length; i++) {
327
- postData.exp = postData.exp + attachIds[i] + ','
324
+ postData.exp = postData.exp + attachIds[i] + ",";
328
325
  }
329
- let vm = this
330
- postData.exp = postData.exp.substr(0, postData.exp.length - 1) + ')'
326
+ let vm = this;
327
+ postData.exp = postData.exp.substr(0, postData.exp.length - 1) + ")";
331
328
  attachSearchApi(postData)
332
- .then(responseData => {
329
+ .then((responseData) => {
333
330
  for (let i = 0; i < responseData.content.length; i++) {
334
331
  for (let x = 0; x < newRows.length; x++) {
335
332
  if (responseData.content[i].id === newRows[x].attachId) {
336
- newRows[x].attach.fileName = responseData.content[i].fileName
337
- newRows[x].attach.name = responseData.content[i].name
338
- newRows[x].attach.content = responseData.content[i].content
333
+ newRows[x].attach.fileName = responseData.content[i].fileName;
334
+ newRows[x].attach.name = responseData.content[i].name;
335
+ newRows[x].attach.content = responseData.content[i].content;
339
336
  newRows[x].attach.contentType =
340
- responseData.content[i].contentType
337
+ responseData.content[i].contentType;
341
338
  // newRows[x].attach.isDefault = false
342
- break
339
+ break;
343
340
  }
344
341
  }
345
342
  }
346
- vm.internalRows = newRows
343
+ vm.internalRows = newRows;
347
344
  })
348
- .catch(() => {})
345
+ .catch(() => {});
349
346
  },
350
347
  attachFileClick(attachFile) {},
351
348
  handleAvatarSuccess(info) {
352
- if (info.file.status == 'done') {
349
+ if (info.file.status == "done") {
353
350
  let addRow = {
354
351
  attachId: info.file.response.content.id,
355
352
  sysRowState: sysRowState.add,
356
- attach: info.file.response.content
357
- }
358
- this.internalRows.push(addRow)
359
- this.$emit('add', this.dataName, info.file.response.content)
360
- let tempField
353
+ attach: info.file.response.content,
354
+ };
355
+ this.internalRows.push(addRow);
356
+ this.$emit("add", this.dataName, info.file.response.content);
357
+ let tempField;
361
358
  for (let i = 0; i < this.cols.length; i++) {
362
359
  // 赋值关联字段数据
363
- let tempValue = addRow
364
- tempField = this.cols[i].field
360
+ let tempValue = addRow;
361
+ tempField = this.cols[i].field;
365
362
  if (this.cols[i].isAuto) {
366
- tempValue[tempField] = store.getters.newId() + ''
367
- continue
363
+ tempValue[tempField] = this.$store.getters.newId() + "";
364
+ continue;
368
365
  }
369
366
  if (
370
- this.cols[i].controlType === 'text' &&
367
+ this.cols[i].controlType === "text" &&
371
368
  this.cols[i].linkValueField !== null &&
372
- this.cols[i].linkValueField !== '' &&
369
+ this.cols[i].linkValueField !== "" &&
373
370
  this.cols[i].linkValueField !== undefined
374
371
  ) {
375
- tempValue[tempField] = this.formRow[this.cols[i].linkValueField]
372
+ tempValue[tempField] = this.formRow[this.cols[i].linkValueField];
376
373
  }
377
374
  }
378
375
  }
379
-
380
376
  },
381
377
  beforeAvatarUpload(file) {
382
378
  // const isPic = file.type === 'image/jpeg' || file.type === 'image/png'
383
379
  if (file.size / 1024 / 1024 > this.limitSize) {
384
380
  notification.error({
385
- message: '错误',
386
- description: '上传图片大小不能超过 ' + this.limitSize + 'MB!'
387
- })
381
+ message: "错误",
382
+ description: "上传图片大小不能超过 " + this.limitSize + "MB!",
383
+ });
388
384
  }
389
385
  if (this.limitType.length > 0 && !this.limitType[file.type]) {
390
386
  notification.error({
391
- message: '错误',
392
- description: '上传附件格式错误!'
393
- })
387
+ message: "错误",
388
+ description: "上传附件格式错误!",
389
+ });
394
390
  }
395
- return true
391
+ return true;
396
392
  },
397
393
  handleRemove(file, fileList) {
398
394
  // this.dialogVisible = !this.dialogVisible
399
395
  // alert(this.dialogVisible)
400
- this.internalUrls = fileList
401
- this.$emit('remove', this.dataName, file.response.data)
396
+ this.internalUrls = fileList;
397
+ this.$emit("remove", this.dataName, file.response.data);
402
398
  // this.$emit('remove', this.dataName, file.response.data)
403
399
  },
404
400
  circleAttach(attachFile, internalRow) {
405
- let vm = this
401
+ let vm = this;
406
402
  // if(internalRow.isDefault == true){
407
- this.internalRows.forEach(element => {
403
+ this.internalRows.forEach((element) => {
408
404
  if (element.id !== internalRow.id) {
409
- element.isDefault = false
405
+ element.isDefault = false;
410
406
  }
411
- })
407
+ });
412
408
  // }
413
409
  },
414
410
  removeAttach(attachFile) {
415
-
416
411
  for (let i = 0; i < this.internalRows.length; i++) {
417
412
  if (this.internalRows[i].attachId === attachFile.id) {
418
413
  if (this.internalRows[i].sysRowState === sysRowState.add) {
419
- this.internalRows.splice(i, 1)
414
+ this.internalRows.splice(i, 1);
420
415
  } else {
421
- this.$set(this.internalRows[i], 'sysRowState', sysRowState.delete)
416
+ this.$set(this.internalRows[i], "sysRowState", sysRowState.delete);
422
417
  }
423
- break
418
+ break;
424
419
  }
425
420
  }
426
- this.$emit('remove', attachFile.id)
421
+ this.$emit("remove", attachFile.id);
427
422
  },
428
423
  downloadAttach(attachFile) {
429
- window.open(this.internalServiceUrl + '/DownAttachFile/' + attachFile.id+`?accessToken=${this.$store.getters.token}`)
424
+ window.open(
425
+ this.internalServiceUrl +
426
+ "/DownAttachFile/" +
427
+ attachFile.id +
428
+ `?accessToken=${this.$store.getters.token}`
429
+ );
430
430
  },
431
431
  /**
432
432
  * 查看附件
433
433
  */
434
434
  viewAttach(attachFile) {
435
- if (attachFile.contentType === 'application/pdf') {
436
- this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${store.getters.token}`
437
- this.dialogViewType = attachFile.contentType
438
- this.dialogVisible = true
439
- } else if (attachFile.content === 'image') {
440
- this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${store.getters.token}`
441
- this.dialogViewType = attachFile.contentType
442
- this.dialogVisible = true
435
+ if (attachFile.contentType === "application/pdf") {
436
+ this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
437
+ this.dialogViewType = attachFile.contentType;
438
+ this.dialogVisible = true;
439
+ } else if (attachFile.content === "image") {
440
+ this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
441
+ this.dialogViewType = attachFile.contentType;
442
+ this.dialogVisible = true;
443
443
  }
444
444
  },
445
445
  closePdf() {
446
- this.isShowPdf = false
446
+ this.isShowPdf = false;
447
447
  },
448
448
  // 放大
449
449
  screenClick() {
450
- this.isFullscreen = true
450
+ this.isFullscreen = true;
451
451
  },
452
452
  // 局部展示
453
453
  narrowClick() {
454
- this.isFullscreen = false
455
- }
456
- }
457
- }
454
+ this.isFullscreen = false;
455
+ },
456
+ },
457
+ };
458
458
  </script>
459
459
 
460
460
  <style lang="scss" scoped>