cloud-web-corejs 1.0.54-dev.684 → 1.0.54-dev.686

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.
@@ -0,0 +1,1112 @@
1
+ import ElImageViewer from "../../../components/VabUpload/image-viewer";
2
+ import { treeScollx } from "../../../utils/global";
3
+
4
+ let modules = {};
5
+ modules = {
6
+ props: {
7
+ storeAreaCode: String,
8
+ prefix: String,
9
+ isPrivate: {
10
+ type: Boolean,
11
+ default: false,
12
+ },
13
+ visiable: {
14
+ type: Boolean,
15
+ default: false,
16
+ },
17
+ multiple: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ callback: Function,
22
+ },
23
+ components: {
24
+ ElImageViewer,
25
+ },
26
+ provide() {
27
+ return {
28
+ current_prefix: this.current_prefix,
29
+ storeAreaCode: this.storeAreaCode,
30
+ billConfig: this.billConfig,
31
+ isBillEnabled: this.isBillEnabled,
32
+ billRowField: this.billRowField,
33
+ billDialogParam: this.billDialogParam,
34
+ dataId: this.dataId,
35
+ getTitle: () => {
36
+ return this.title;
37
+ },
38
+ getIsPrivate: () => {
39
+ return this.isPrivate;
40
+ },
41
+ getObjectForeignId: () => {
42
+ return this.objectForeignId;
43
+ },
44
+ };
45
+ },
46
+ async mounted() {
47
+ if (this.isPrivate) {
48
+ await this.getCurrentUser();
49
+ }
50
+ //初始化单据弹框
51
+ if (this.isBillEnabled) {
52
+ this.billDialogContent = this.billConfig.billDialog;
53
+ }
54
+
55
+ this.initTitle();
56
+ this.initTableList();
57
+ },
58
+ watch: {
59
+ filterText(val) {
60
+ this.$refs.tree.filter(val);
61
+ },
62
+ },
63
+ data() {
64
+ let pageSize = 1000;
65
+ let categoryPageSize = 1000;
66
+ return {
67
+ showFileObjAuthDialog: false,
68
+ fileObjAuth: {},
69
+ showDialog: true,
70
+ option: {
71
+ private: this.isPrivate,
72
+ isCategoryEdit: true,
73
+ mouseCheck: true,
74
+ storeAreaCode: this.storeAreaCode,
75
+ current_prefix: this.prefix,
76
+ },
77
+ showBillDialog: false,
78
+ billDialogContent: null,
79
+ checkBillDatas: [],
80
+ title: "",
81
+ folderStatus: false,
82
+ filterText: "",
83
+ defaultProps: {
84
+ children: "children",
85
+ label: "fileName",
86
+ isLeaf: "leaf",
87
+ },
88
+ resolveFunc: function () {},
89
+ fileAttachmentCategorys: [],
90
+ currentFileCategoryCode: null,
91
+ chooseIndex: -1,
92
+ imageDTOs: [],
93
+ showViewer: false,
94
+ showPropertiesDialog: false,
95
+ editAttachment: null,
96
+ vxeOption: {},
97
+ showType: 2,
98
+ formData: {},
99
+ showAdvancedSearch: false,
100
+ advancedFormData: {},
101
+ pageSize: pageSize,
102
+ page: {
103
+ current: 1,
104
+ size: pageSize,
105
+ total: 0,
106
+ records: [],
107
+ },
108
+ categoryPageSize: categoryPageSize,
109
+ categoryPage: {
110
+ current: 1,
111
+ size: categoryPageSize,
112
+ total: 0,
113
+ records: [],
114
+ },
115
+ showEditCategoryDialog: false,
116
+ editCategory: {},
117
+ currentFileCategory: null,
118
+ rootCategory: false,
119
+ currentNode: null,
120
+ treeNodeArr: [],
121
+ checkRows: [],
122
+ showCategoryMoveDialog: false,
123
+ checkList: [],
124
+ handleType: 1, //1移动,2复制
125
+ showFileHistoryDialog: false,
126
+ operateFileHistory: null,
127
+ showShareDialog: false,
128
+ shareAttachment: null,
129
+ checkAll: false,
130
+ fileArr: [],
131
+ checkList2: [],
132
+ showRecycleBinDialog: false,
133
+
134
+ showVideoDialog: false,
135
+ videoOption: null,
136
+
137
+ //个人文档
138
+ userInfo: {
139
+ id: null,
140
+ nickName: null,
141
+ },
142
+ treeFlag: false,
143
+ currentUser: {},
144
+ showUserDialog: false,
145
+ isDocAdmin: false,
146
+
147
+ //圈选
148
+ is_show_mask: false,
149
+ box_screen_left: 0,
150
+ box_screen_top: 0,
151
+ start_x: 0,
152
+ start_y: 0,
153
+ end_x: 0,
154
+ end_y: 0,
155
+ scrollTop1: 0,
156
+ scrollTop2: 0,
157
+ };
158
+ },
159
+ computed: {
160
+ isEdit() {
161
+ return this.option.isEdit !== false;
162
+ },
163
+ isCategoryEdit() {
164
+ if (this.isEdit === false) {
165
+ return false;
166
+ }
167
+ return this.option.isCategoryEdit === true;
168
+ },
169
+ mouseCheck() {
170
+ return this.option.mouseCheck === true;
171
+ },
172
+ dataId() {
173
+ // return this.option.dataId;
174
+ let dataId = this.isBillEnabled
175
+ ? this.checkBillDatas.map((row) => row.id)
176
+ : this.option.dataId
177
+ ? [this.option.dataId]
178
+ : [0];
179
+ return dataId;
180
+ },
181
+ objectForeignId() {
182
+ if (this.option.private) {
183
+ return [this.userInfo.id || 0];
184
+ } else {
185
+ return this.dataId && this.dataId.length ? this.dataId : [0];
186
+ }
187
+ },
188
+ current_prefix() {
189
+ return this.option.current_prefix;
190
+ },
191
+ pictureDtoList() {
192
+ return this.page.records.filter((row) => {
193
+ return row.url && this.$commonFileUtil.isPictureFile(row.url);
194
+ });
195
+ },
196
+ //圈选
197
+ getMaskStyle: function () {
198
+ return this.getStyle();
199
+ },
200
+ checkAllDisabled() {
201
+ return this.page.records.filter((row) => !row.dirs).length === 0;
202
+ },
203
+ checkAllIndeterminate() {
204
+ return (
205
+ this.checkList.length > 0 &&
206
+ this.checkList.length <
207
+ this.page.records.filter((row) => !row.dirs).length
208
+ );
209
+ },
210
+ billConfig() {
211
+ return this.option.billConfig || {};
212
+ },
213
+ billRowField() {
214
+ let billConfig = this.billConfig;
215
+ return billConfig.rowField || "id";
216
+ },
217
+ isBillEnabled() {
218
+ return this.billConfig.enabled || false;
219
+ },
220
+ billDialogParam() {
221
+ if (this.isBillEnabled && this.billConfig.billDialogParam) {
222
+ return this.billConfig.billDialogParam();
223
+ }
224
+ },
225
+ checkBillNames: {
226
+ get() {
227
+ let dataProps = this.billConfig.dataProps;
228
+ return this.checkBillDatas
229
+ .map((row) => {
230
+ return row[dataProps.label];
231
+ })
232
+ .join(",");
233
+ },
234
+ set(val) {
235
+ if (!val) {
236
+ this.checkBillDatas = [];
237
+ }
238
+ },
239
+ },
240
+ currentCategoryId() {
241
+ return this.currentFileCategory &&
242
+ this.currentFileCategory.id &&
243
+ this.currentFileCategory.id > 0
244
+ ? this.currentFileCategory.id
245
+ : 0;
246
+ },
247
+ target() {
248
+ return this.$refs.privateProfileDialog;
249
+ },
250
+ },
251
+ methods: {
252
+ handleShow(options) {
253
+ this.showDialog = true;
254
+ this.option = {
255
+ ...this.option,
256
+ ...options,
257
+ };
258
+ },
259
+ dialogPrimary() {
260
+ let checkRows = this.getCheckRows();
261
+ let items = checkRows.map((row) => {
262
+ return {
263
+ thumbnail: row.thumbnail,
264
+ extension: row.extension,
265
+ large: row.large,
266
+ fileSize: row.fileSize,
267
+ domain: row.domain,
268
+ source: row.source,
269
+ medium: row.medium,
270
+ url: row.url,
271
+ sourceSn: row.sn,
272
+
273
+ attachCode: row.attachCode,
274
+ docCategory: row.docCategory,
275
+ drawingCode: row.drawingCode,
276
+ version: row.version,
277
+ };
278
+ });
279
+ this.handleClose();
280
+ let data = {
281
+ rows: checkRows,
282
+ fileRows: items,
283
+ };
284
+ this.$emit("confirm", data);
285
+ this.callback && this.callback(data);
286
+ },
287
+ handleClose() {
288
+ this.showDialog = false;
289
+ this.$emit("update:visiable", false);
290
+ if (this.$el && this.$el.parentNode) {
291
+ this.$el.parentNode.removeChild(this.$el);
292
+ }
293
+ this.$destroy();
294
+ },
295
+ getTopNode() {
296
+ return this.$refs.tree.root.childNodes[0];
297
+ },
298
+ getFileName(row) {
299
+ if (row.extension) {
300
+ let index = row.fileName.lastIndexOf("." + row.extension);
301
+ return row.fileName.substring(0, index);
302
+ } else {
303
+ return row.fileName;
304
+ }
305
+ },
306
+ openShareDialog(shareAttachment) {
307
+ this.showShareDialog = true;
308
+ this.shareAttachment = shareAttachment;
309
+ },
310
+ getCheckRows() {
311
+ let checkRows = [];
312
+ if (this.showType === 1) {
313
+ let checkList = this.checkList;
314
+ checkRows = this.page.records.filter((row) =>
315
+ checkList.includes(row.id)
316
+ );
317
+ } else {
318
+ checkRows = this.$refs["table-m1"].getCheckboxRecords(true);
319
+ }
320
+ return checkRows;
321
+ },
322
+ getRows() {
323
+ let rows = [];
324
+ if (this.showType === 1) {
325
+ rows = this.page.records;
326
+ } else {
327
+ rows = this.$refs["table-m1"].getTableData().fullData;
328
+ }
329
+ return rows;
330
+ },
331
+ changeShowType() {
332
+ this.showType = this.showType === 1 ? 2 : 1;
333
+ this.searchEvent();
334
+ },
335
+ changeCategory(row, node) {
336
+ if (!node) {
337
+ node = this.$refs.tree.getNode(row.id + "");
338
+ this.$refs.tree.setCurrentKey(row);
339
+ }
340
+ if (row.id) {
341
+ node.expand();
342
+ }
343
+ this.formData = {};
344
+ this.advancedFormData = {};
345
+ this.handleNodeData(node);
346
+ this.searchEvent();
347
+ },
348
+ searchEvent() {
349
+ this.doSearch();
350
+ },
351
+ resetEvent() {
352
+ this.formData = {};
353
+ this.doSearch();
354
+ },
355
+ doSearch() {
356
+ this.checkList = [];
357
+ this.checkAll = false;
358
+ this.initAttchInfo();
359
+ /*if (this.showType == 1) {
360
+ this.initAttchInfo();
361
+ } else if (this.showType == 2) {
362
+ this.$refs['table-m1'].commitProxy('reload');
363
+ }*/
364
+ },
365
+ openPropertiesDialog(attachment) {
366
+ this.editAttachment = attachment;
367
+ this.showPropertiesDialog = true;
368
+ },
369
+ getShowUrl(attachment, field) {
370
+ if (!field) field = "medium";
371
+ return this.$commonFileUtil.getShowUrl(
372
+ attachment.domain +
373
+ (attachment[field] ? attachment[field] : attachment.url)
374
+ );
375
+ },
376
+ isVideo(fileSuffix) {
377
+ let videoTypes = ["webm", "ogg", "3gp", "mp4"];
378
+ return videoTypes.includes(fileSuffix);
379
+ },
380
+ hasPreview(attachment) {
381
+ let fileSuffix = this.$commonFileUtil.getFileSuffix(attachment.url);
382
+ return (
383
+ this.$commonFileUtil.isPictureFile(attachment.url) ||
384
+ this.$commonFileUtil.isPreviewFile(attachment.url)
385
+ );
386
+ },
387
+ openPreview(attachment) {
388
+ if (this.$commonFileUtil.isPictureFile(attachment.url)) {
389
+ this.imageDTOs = this.pictureDtoList;
390
+ this.chooseIndex = this.pictureDtoList.findIndex(
391
+ (row) => row.id === attachment.id
392
+ );
393
+ this.showViewer = true;
394
+ } else if (this.$commonFileUtil.isPreviewFile(attachment.url)) {
395
+ this.$openFilePreview(attachment);
396
+ }
397
+ },
398
+ filterNode(value, data) {
399
+ if (!value) return true;
400
+ return data.fileName.indexOf(value) !== -1;
401
+ },
402
+ initAttchInfo(page) {
403
+ let defaultPage = {
404
+ current: 1,
405
+ size: this.pageSize,
406
+ total: 0,
407
+ records: [],
408
+ };
409
+ page = page || {
410
+ current: 1,
411
+ size: this.pageSize,
412
+ };
413
+
414
+ let parent = this.currentCategoryId;
415
+ this.target.$http({
416
+ method: "post",
417
+ url: this.current_prefix + "/file_obj/listPage",
418
+ data: {
419
+ parent: parent,
420
+ objectForeignId: this.objectForeignId,
421
+ privateDir: this.isPrivate ? 1 : 0,
422
+ storeAreaCode: this.storeAreaCode,
423
+ ...this.formData,
424
+ ...this.advancedFormData,
425
+ ...page,
426
+ },
427
+ isLoading: true,
428
+ success: (res) => {
429
+ this.page = res.objx ? res.objx : defaultPage;
430
+ },
431
+ });
432
+ },
433
+ initTableList() {
434
+ let that = this;
435
+ let tableOption = {
436
+ vue: this,
437
+ tableRef: "table-m1",
438
+ tableName: "pcp_product_file_list-m1",
439
+ config: {
440
+ height: "auto",
441
+ pagerConfig: {
442
+ autoHidden: false,
443
+ enabled: true,
444
+ },
445
+ checkboxConfig: {
446
+ checkMethod: ({ row }) => {
447
+ return !row.dirs;
448
+ },
449
+ },
450
+ },
451
+ columns: [
452
+ { type: "checkbox", width: 48, resizable: false, fixed: "left" },
453
+ {
454
+ title: "文件名称",
455
+ field: "fileName",
456
+ width: 250,
457
+ fixed: "left",
458
+ slots: {
459
+ default: ({ row, $rowIndex }) => {
460
+ let h = this.$createElement;
461
+ if (!row.dirs) {
462
+ let showUrl = that.getShowUrl(row, "thumbnail");
463
+ return [
464
+ h(
465
+ "a",
466
+ {
467
+ staticClass: "a-link img",
468
+ on: {
469
+ click: (event) => {
470
+ event.stopPropagation();
471
+ that.openPreview(row);
472
+ },
473
+ },
474
+ },
475
+ [
476
+ h(
477
+ "el-tooltip",
478
+ {
479
+ props: {
480
+ enterable: false,
481
+ effect: "dark",
482
+ content: "预览",
483
+ placement: "top",
484
+ "popper-class": "tooltip-skin",
485
+ },
486
+ },
487
+ [
488
+ h("el-image", {
489
+ props: {
490
+ src: showUrl,
491
+ },
492
+ }),
493
+ ]
494
+ ),
495
+ ]
496
+ ),
497
+ h("span", row.fileName),
498
+ ];
499
+ } else {
500
+ return [
501
+ h(
502
+ "a",
503
+ {
504
+ staticClass: "a-link img",
505
+ on: {
506
+ click: (event) => {
507
+ event.stopPropagation();
508
+ that.changeCategory(row);
509
+ },
510
+ },
511
+ },
512
+ [
513
+ h(
514
+ "div",
515
+ {
516
+ staticClass: "img",
517
+ },
518
+ [
519
+ h("svg-icon", {
520
+ props: { "icon-class": "ico-wenjianjia" },
521
+ }),
522
+ h("span", row.fileName),
523
+ ]
524
+ ),
525
+ ]
526
+ ),
527
+ ];
528
+ }
529
+ },
530
+ },
531
+ },
532
+ {
533
+ title: "文件大小",
534
+ field: "fileSize",
535
+ width: 150,
536
+ slots: {
537
+ default: ({ row, $rowIndex }) => {
538
+ if (!row.dirs) {
539
+ return this.formatFileSize(row.fileSize);
540
+ }
541
+ },
542
+ },
543
+ },
544
+ {
545
+ title: "版本号",
546
+ field: "version",
547
+ width: 150,
548
+ slots: {
549
+ default: ({ row, $rowIndex }) => {
550
+ if (!row.dirs) {
551
+ return row.version;
552
+ }
553
+ },
554
+ },
555
+ },
556
+ { title: "说明", field: "note", width: 250 },
557
+ /*{
558
+ title: '状态',
559
+ field: 'status',
560
+ width: 150,
561
+ slots: {
562
+ default: ({row, $rowIndex}) => {
563
+ if (!row.dirs) {
564
+ return row.status === 1 ? '已归档' : '未归档';
565
+ }
566
+ }
567
+ }
568
+ },*/
569
+ { title: "创建人", field: "createBy", width: 150 },
570
+ {
571
+ field: "createDate",
572
+ title: "创建时间",
573
+ width: 150,
574
+ },
575
+ {
576
+ width: 47,
577
+ fixed: "right",
578
+ title: "",
579
+ sortable: false,
580
+ slots: {
581
+ default: ({ row, $rowIndex, items }) => {
582
+ let isEdit = this.isEdit;
583
+ let isCategoryEdit = this.isCategoryEdit;
584
+ let fileObjAuth = this.fileObjAuth;
585
+ if (!row.dirs) {
586
+ return [
587
+ this.getBtnVnode({
588
+ class: "el-icon-download",
589
+ title: "下载",
590
+ show: fileObjAuth.downloadAuth === 1,
591
+ click: (event) => {
592
+ this.$commonFileUtil.downloadFile(
593
+ row.domain + row.url,
594
+ row.fileName
595
+ );
596
+ },
597
+ }),
598
+ ];
599
+ }
600
+ },
601
+ },
602
+ },
603
+ ],
604
+ callback(a, b) {},
605
+ };
606
+ this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
607
+ this.vxeOption = opts;
608
+ });
609
+ },
610
+ getBtnVnode(opt) {
611
+ let h = this.$createElement;
612
+ let show = opt.show === false ? false : true;
613
+ if (show) {
614
+ return h(
615
+ "a",
616
+ {
617
+ staticClass: "a-link",
618
+ on: {
619
+ click: (event) => {
620
+ opt.click && opt.click(event);
621
+ },
622
+ },
623
+ },
624
+ [
625
+ h(
626
+ "el-tooltip",
627
+ {
628
+ props: {
629
+ enterable: false,
630
+ effect: "dark",
631
+ content: opt.title,
632
+ placement: "top",
633
+ "popper-class": "tooltip-skin",
634
+ },
635
+ },
636
+ [
637
+ h("i", {
638
+ staticClass: opt.class,
639
+ }),
640
+ ]
641
+ ),
642
+ ]
643
+ );
644
+ }
645
+ },
646
+ changePageNew({ type, currentPage, pageSize, $event }) {
647
+ this.checkList = [];
648
+ this.checkAll = false;
649
+ this.initAttchInfo({
650
+ current: currentPage,
651
+ size: pageSize,
652
+ });
653
+ },
654
+ handleNodeClick(data, node, v) {
655
+ if (!data.moreBtn) {
656
+ this.changeCategory(data, node);
657
+ } else {
658
+ this.showModeCategory(data, node, v);
659
+ }
660
+ },
661
+ doNav(t) {
662
+ let node = this.$refs.tree.getNode(t.data.id + "");
663
+ this.$refs.tree.setCurrentKey(node.data);
664
+ this.handleNodeClick(node.data, node, this);
665
+ },
666
+ showModeCategory(data, node, v) {
667
+ let param = {
668
+ parent: data.parent,
669
+ dirs: true,
670
+ storeAreaCode: this.storeAreaCode,
671
+ size: this.categoryPageSize,
672
+ current: data.next,
673
+ };
674
+ if (this.isPrivate) {
675
+ param.objectForeignId = this.objectForeignId;
676
+ param.privateDir = 1;
677
+ }
678
+ this.target.$http({
679
+ url: this.current_prefix + "/file_obj/listPage",
680
+ method: "post",
681
+ data: param,
682
+ isLoading: true,
683
+ success: (res) => {
684
+ let page = res.objx;
685
+ let rows = page && page.records ? page.records : [];
686
+ this.$refs.tree.remove(node);
687
+ if (page.pages > page.current) {
688
+ rows.push({
689
+ parent: param.parent,
690
+ fileName: "更多",
691
+ moreBtn: true,
692
+ leaf: true,
693
+ pages: page.pages,
694
+ current: page.current,
695
+ next: page.current + 1,
696
+ });
697
+ }
698
+ rows.forEach((value) => {
699
+ value.leaf = !value.hasChild;
700
+ });
701
+ rows.forEach((row) => {
702
+ this.$refs.tree.append(row, param.parent);
703
+ });
704
+ },
705
+ });
706
+ },
707
+ // 异步树叶子节点懒加载逻辑
708
+ loadNode(node, resolve, callback) {
709
+ let id = node && node.data && node.data.id ? node.data.id || "" : "";
710
+ node.resolve = resolve;
711
+ let url, param;
712
+ url = this.current_prefix + "/file_obj/listPage";
713
+ if (!id) {
714
+ param = {
715
+ dirs: true,
716
+ storeAreaCode: this.storeAreaCode,
717
+ size: this.categoryPageSize,
718
+ };
719
+ } else {
720
+ param = {
721
+ dirs: true,
722
+ parent: id,
723
+ storeAreaCode: this.storeAreaCode,
724
+ size: this.categoryPageSize,
725
+ };
726
+ }
727
+ if (this.isPrivate) {
728
+ param.objectForeignId = this.objectForeignId;
729
+ param.privateDir = 1;
730
+ }
731
+ this.target.$http({
732
+ url: url,
733
+ method: "post",
734
+ data: param,
735
+ success: (res) => {
736
+ let page = res.objx;
737
+ let rows = page && page.records ? page.records : [];
738
+ if (page.pages > page.current) {
739
+ rows.push({
740
+ parent: param.parent,
741
+ fileName: "更多",
742
+ moreBtn: true,
743
+ leaf: true,
744
+ pages: page.pages,
745
+ current: page.current,
746
+ next: page.current + 1,
747
+ });
748
+ }
749
+
750
+ // moreBtn
751
+ rows.forEach((value) => {
752
+ value.leaf = !value.hasChild;
753
+ });
754
+ if (node.level === 0) {
755
+ setTimeout(() => {
756
+ this.$refs.tree.setCurrentKey(node.childNodes[0].data);
757
+ this.handleNodeData(node.childNodes[0]);
758
+ node.childNodes[0].expand();
759
+ }, 200);
760
+ this.$nextTick(() => {
761
+ callback && callback();
762
+ });
763
+ this.searchEvent();
764
+ } else {
765
+ this.$nextTick(() => {
766
+ callback && callback();
767
+ });
768
+ }
769
+ let items = [];
770
+ if (node.level === 0) {
771
+ let item = {
772
+ parent: null,
773
+ fileName: this.title,
774
+ leaf: rows.length === 0,
775
+ allFileBtn: true,
776
+ id: 0,
777
+ children: rows,
778
+ };
779
+ items.push(item);
780
+ } else {
781
+ items = rows;
782
+ }
783
+
784
+ resolve(items);
785
+ },
786
+ });
787
+ },
788
+ editFileCategory(category) {
789
+ let currentFileCategory = category || this.currentFileCategory;
790
+ if (!currentFileCategory) {
791
+ this.$message({
792
+ message: "请选择文件夹",
793
+ type: "error",
794
+ showClose: true,
795
+ duration: 3000,
796
+ });
797
+ return;
798
+ }
799
+ this.editCategory = Object.assign({}, currentFileCategory);
800
+ this.showEditCategoryDialog = true;
801
+ },
802
+ handleNodeData(node) {
803
+ let treeNodeArr = [];
804
+ let tree = this.$refs.tree;
805
+ // let firstNode = tree.root.childNodes[0];
806
+ if (node) {
807
+ treeNodeArr.push(node);
808
+ let end = false;
809
+ let pNode = node;
810
+ while (!end) {
811
+ pNode = pNode.parent;
812
+ if (pNode && pNode.data) {
813
+ let pData = pNode.data;
814
+ treeNodeArr.push(pNode);
815
+ end = pNode.level <= 1;
816
+ } else {
817
+ end = true;
818
+ }
819
+ }
820
+ treeNodeArr = treeNodeArr.reverse();
821
+ }
822
+ /*treeNodeArr.unshift(firstNode)
823
+ if (!node) {
824
+ node = firstNode;
825
+ }*/
826
+ this.currentFileCategory = node ? node.data : null;
827
+ this.currentNode = node;
828
+ this.$set(this, "treeNodeArr", treeNodeArr);
829
+ this.getFileObjAuth();
830
+ },
831
+ getFileObjAuth() {
832
+ this.target.$http({
833
+ url: this.current_prefix + `/file_obj_auth/getFileObjAuth`,
834
+ method: `post`,
835
+ data: {
836
+ fileObjId: this.currentCategoryId,
837
+ storeAreaCode: this.storeAreaCode,
838
+ },
839
+ isLoading: true,
840
+ modalStrictly: true,
841
+ success: (res) => {
842
+ this.fileObjAuth = res.objx || {};
843
+ },
844
+ });
845
+ },
846
+ mulDownload() {
847
+ let checkRows = this.getCheckRows();
848
+ if (!checkRows.length) {
849
+ this.$message({
850
+ message: "请选择需要下载的文件",
851
+ type: "error",
852
+ showClose: true,
853
+ duration: 3000,
854
+ });
855
+ return;
856
+ }
857
+ checkRows.forEach((row) => {
858
+ this.$commonFileUtil.downloadFile(row.domain + row.url, row.fileName);
859
+ // this.downLoadFile(row);
860
+ });
861
+ },
862
+ mulDownload2() {
863
+ let checkRows = this.getCheckRows();
864
+ if (!checkRows.length) {
865
+ this.$message({
866
+ message: "请选择需要下载的文件",
867
+ type: "error",
868
+ showClose: true,
869
+ duration: 3000,
870
+ });
871
+ return;
872
+ }
873
+ /*let dirFile = checkRows.find(row => row.dirs);
874
+ if (dirFile) {
875
+ this.$message({
876
+ message: '文件夹不支持下载',
877
+ type: 'error',
878
+ showClose: true,
879
+ duration: 3000,
880
+ });
881
+ return;
882
+ }*/
883
+ this.getDownloadDomian((domain) => {
884
+ this.getFileWhole(checkRows, (fileWhole) => {
885
+ // let fileName = this.$moment().format('YYYYMMDDHHmmss');
886
+ this.target.$http({
887
+ method: "post",
888
+ url: domain + "/docfile/download",
889
+ /*data: {
890
+ "fileName": fileName,
891
+ "children": checkRows,
892
+ "dirs": true
893
+ },*/
894
+ data: fileWhole,
895
+ isLoading: true,
896
+ success: (res) => {
897
+ // this.downLoadFile2(res.objx.url)
898
+ window.open(res.objx.url);
899
+ },
900
+ });
901
+ });
902
+ });
903
+ /*checkRows.forEach(row => {
904
+ this.$commonFileUtil.downloadFile(row.domain + row.url, row.fileName);
905
+ })*/
906
+ },
907
+ getDownloadDomian(callback) {
908
+ this.target.$http({
909
+ method: "post",
910
+ url: USER_PREFIX + "/common/fileDownloadUrl",
911
+ data: {},
912
+ isLoading: true,
913
+ success: (res) => {
914
+ callback(res.objx);
915
+ },
916
+ });
917
+ },
918
+ getFileWhole(rows, callback) {
919
+ let ids = rows.map((row) => row.id);
920
+ this.target.$http({
921
+ method: "post",
922
+ url: this.current_prefix + "/file_obj/getFileWhole",
923
+ data: ids,
924
+ isLoading: true,
925
+ success: (res) => {
926
+ callback(res.objx);
927
+ },
928
+ });
929
+ },
930
+ downLoadFile2(fileUrl) {
931
+ let that = this;
932
+ that.target.$http({
933
+ method: "get",
934
+ url: fileUrl,
935
+ data: {},
936
+ /*headers: {
937
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
938
+ },*/
939
+ responseType: "blob",
940
+ resultType: "other",
941
+ isLoading: true,
942
+ callback: (res, response) => {
943
+ let fileName = fileUrl.slice(fileUrl.lastIndexOf("/") + 1);
944
+ const blobUrl = window.URL.createObjectURL(res);
945
+ const a = document.createElement("a");
946
+ a.download = fileName;
947
+ a.href = blobUrl;
948
+ a.click();
949
+ },
950
+ });
951
+ },
952
+ downLoadFile(row) {
953
+ let that = this;
954
+ let fileUrl = row.domain + row.url;
955
+ that.target.$http({
956
+ method: "get",
957
+ url: fileUrl,
958
+ data: {},
959
+ /*headers: {
960
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
961
+ },*/
962
+ responseType: "blob",
963
+ resultType: "other",
964
+ isLoading: true,
965
+ callback: (res, response) => {
966
+ const blobUrl = window.URL.createObjectURL(res);
967
+ const a = document.createElement("a");
968
+ a.download = row.fileName;
969
+ a.href = blobUrl;
970
+ a.click();
971
+ },
972
+ });
973
+ },
974
+ checkChange() {
975
+ let rows = this.getRows().filter((row) => !row.dirs);
976
+ let checkRows = this.getCheckRows();
977
+ this.checkAll = rows.length && rows.length === checkRows.length;
978
+ },
979
+ changeCheckAll(val) {
980
+ let rows = this.getRows();
981
+ this.checkList = val
982
+ ? rows.filter((row) => !row.dirs).map((row) => row.id)
983
+ : [];
984
+ if (this.showType === 2) {
985
+ this.$refs["table-m1"].setAllCheckboxRow(val);
986
+ }
987
+ },
988
+ tableCheckChange() {
989
+ let checkRows = this.getCheckRows();
990
+ this.checkList = checkRows.map((row) => row.id);
991
+ this.checkChange();
992
+ },
993
+ tableCheckAll(val) {
994
+ let checkRows = this.getCheckRows();
995
+ this.checkList = checkRows.map((row) => row.id);
996
+ this.checkChange();
997
+ },
998
+ initTitle() {
999
+ this.target.$http({
1000
+ method: "post",
1001
+ url: USER_PREFIX + "/file_store_area/getByCode",
1002
+ data: {
1003
+ stringOne: this.storeAreaCode,
1004
+ },
1005
+ isLoading: true,
1006
+ success: (res) => {
1007
+ let fileStoreArea = res.objx;
1008
+ if (fileStoreArea) {
1009
+ this.title = fileStoreArea.storeAreaName;
1010
+ this.$nextTick(() => {
1011
+ treeScollx({
1012
+ target: this.$refs.privateProfileDialog,
1013
+ type: "default",
1014
+ });
1015
+ this.treeFlag = true;
1016
+ });
1017
+ } else {
1018
+ this.$baseAlert("文档工作区未维护");
1019
+ }
1020
+ },
1021
+ });
1022
+ },
1023
+ formatFileSize(fileSize) {
1024
+ fileSize = fileSize || 0;
1025
+ if (fileSize < 1024) {
1026
+ return fileSize + "B";
1027
+ } else if (fileSize < 1024 * 1024) {
1028
+ var temp = fileSize / 1024;
1029
+ temp = temp.toFixed(2);
1030
+ return temp + "KB";
1031
+ } else if (fileSize < 1024 * 1024 * 1024) {
1032
+ var temp = fileSize / (1024 * 1024);
1033
+ temp = temp.toFixed(2);
1034
+ return temp + "MB";
1035
+ } else {
1036
+ var temp = fileSize / (1024 * 1024 * 1024);
1037
+ temp = temp.toFixed(2);
1038
+ return temp + "GB";
1039
+ }
1040
+ },
1041
+ deleteBillData(index) {
1042
+ this.checkBillDatas.splice(index, 1);
1043
+ this.searchEvent();
1044
+ },
1045
+ getBillLabel(item) {
1046
+ let billConfig = this.billConfig;
1047
+ let dataProps = billConfig.dataProps;
1048
+ return item[dataProps.label];
1049
+ },
1050
+ openBillDialog() {
1051
+ this.showBillDialog = true;
1052
+ },
1053
+ confirmBillDialog(rows) {
1054
+ // this.checkBillDatas = rows;
1055
+
1056
+ let billRowField = this.billRowField;
1057
+ let checkBillDatas = this.checkBillDatas;
1058
+ let fieldDatas = checkBillDatas.map((row) => {
1059
+ return row[billRowField];
1060
+ });
1061
+ let newRows = rows.filter((row) => {
1062
+ return !fieldDatas.includes(row[billRowField]);
1063
+ });
1064
+ this.checkBillDatas.push(...newRows);
1065
+ this.searchEvent();
1066
+ },
1067
+ clearBill() {
1068
+ this.checkBillDatas = [];
1069
+ this.searchEvent();
1070
+ },
1071
+ //个人文档
1072
+ async getCurrentUser() {
1073
+ return this.target.$http({
1074
+ url: USER_PREFIX + "/user/currentUser",
1075
+ method: "post",
1076
+ success: (res) => {
1077
+ this.currentUser = res.objx;
1078
+ this.confirmUser([this.currentUser]);
1079
+ this.getIsDocAdmin();
1080
+ },
1081
+ });
1082
+ },
1083
+ confirmUser(rows) {
1084
+ if (rows) {
1085
+ let row = rows[0];
1086
+ this.userInfo.id = row.id;
1087
+ this.userInfo.nickName = row.nickName;
1088
+ this.reflushTree();
1089
+ }
1090
+ },
1091
+ setCurrentUser(flag) {
1092
+ this.confirmUser([this.currentUser]);
1093
+ this.reflushTree();
1094
+ },
1095
+ reflushTree() {
1096
+ this.treeFlag = false;
1097
+ setTimeout(() => {
1098
+ this.treeFlag = true;
1099
+ }, 200);
1100
+ },
1101
+ getIsDocAdmin() {
1102
+ return this.target.$http({
1103
+ url: USER_PREFIX + "/file_obj/isDocAdmin",
1104
+ method: "post",
1105
+ success: (res) => {
1106
+ this.isDocAdmin = res.objx || false;
1107
+ },
1108
+ });
1109
+ },
1110
+ },
1111
+ };
1112
+ export default modules;