centaline-data-driven 1.6.64 → 1.6.65

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.
@@ -304,6 +304,7 @@ export default {
304
304
  vmodel: Object,
305
305
  api: String,
306
306
  },
307
+ inject: ['ViewerFileToggle', 'ChangeFileList'],
307
308
  data() {
308
309
  return {
309
310
  disableUpload: false,
@@ -351,13 +352,33 @@ export default {
351
352
  self.load(data);
352
353
  });
353
354
  }
354
- this.disableUpload = this.model.lock;
355
- if (!this.disableUpload && this.model.max && this.model.max > 0) {
356
- if (this.model.getfileListLength() >= this.model.max) {
357
- this.disableUpload = true;
355
+ self.disableUpload = self.model.lock;
356
+ if (!self.disableUpload && self.model.max && self.model.max > 0) {
357
+ if (self.model.getfileListLength() >= self.model.max) {
358
+ self.disableUpload = true;
358
359
  }
359
360
  }
361
+
362
+ this.$watch(
363
+ function () {
364
+ return JSON.stringify(this.model.fileList);
365
+ },
366
+ function (newStr) {
367
+ self.$nextTick(function () {
368
+ if (self.model.mediaViewPageType == 3) {
369
+ const { album } = self.buildMediaAlbum(
370
+ self.model.sourceList
371
+ );
372
+
373
+ const MediaAlbum = [album];
374
+ self.ChangeFileList(MediaAlbum, 0, 0);
375
+ }
376
+ });
377
+ }
378
+ );
360
379
  });
380
+
381
+
361
382
  },
362
383
  methods: {
363
384
  load(data) {
@@ -407,20 +428,46 @@ export default {
407
428
  return [];
408
429
  }
409
430
  },
431
+ buildMediaAlbum(sourceList, sourceFile, albumLabel) {
432
+ const label = (this.model && this.model.label) || '媒体';
433
+
434
+ // 过滤掉已删除的文件
435
+ const validFiles = sourceList.filter(item => item.flagDeleted !== true);
436
+
437
+ // 按 model.fileList 的顺序重新排序 validFiles
438
+ const orderedFiles = [];
439
+ if (this.model && this.model.fileList) {
440
+ this.model.fileList.forEach(fileItem => {
441
+ // fileItem.source 指向 sourceList 中的原始对象
442
+ if (fileItem.source && validFiles.includes(fileItem.source)) {
443
+ orderedFiles.push(fileItem.source);
444
+ }
445
+ });
446
+ }
447
+
448
+ // 构建相册对象
449
+ const album = {
450
+ albumName: label,
451
+ medias: orderedFiles.length ? orderedFiles : validFiles
452
+ };
453
+ const index = sourceFile ? album.medias.findIndex(v => v === sourceFile) : 0;
454
+
455
+ return { album, index };
456
+ },
410
457
  viewerfile(file) {
411
458
  var self = this;
412
- var MediaAlbum = [{ albumName: this.model.label || "媒体", medias: [] }];
413
-
414
- let fileList = this.model.sourceList.filter((item) => {
415
- return item.flagDeleted !== true;
416
- });
417
- fileList.forEach((v) => {
418
- MediaAlbum[0].medias.push(v);
419
- });
420
- var index = MediaAlbum[0].medias.findIndex(
421
- (v) => (v === file.source)
459
+ const { album, index } = this.buildMediaAlbum(
460
+ this.model.sourceList,
461
+ file.source,
462
+ this.model.label
422
463
  );
423
464
 
465
+ const MediaAlbum = [album];
466
+ if (self.model.mediaViewPageType == 3) {
467
+ this.ViewerFileToggle(true, MediaAlbum, 0, index);
468
+ return;
469
+ }
470
+
424
471
  if (self.model.moreActionRouter) {
425
472
  let submitData = {};
426
473
  submitData = self.model.form.self.getFileData(self.model.moreActionRouter);
@@ -923,6 +970,7 @@ export default {
923
970
  }
924
971
  }
925
972
  },
973
+
926
974
  beforeDestroy() {
927
975
  clearTimeout(this.qrtimer);
928
976
  if (this.timeoutHandle1) {