cloud-web-corejs 1.0.54-dev.674 → 1.0.54-dev.675

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/src/utils/vab.js CHANGED
@@ -1,10 +1,6 @@
1
1
  /**version-1.0*/
2
2
  let install = {};
3
3
 
4
- function reqImg(a) {
5
- return require("@/resources/images/" + a);
6
- }
7
-
8
4
  import request from "./request";
9
5
  import * as lodash from "lodash";
10
6
  import { Loading, Message, MessageBox, Notification, Form } from "element-ui";
@@ -30,6 +26,65 @@ let imFun = {
30
26
  prefixConfig,
31
27
  };
32
28
 
29
+ function reqImg(a) {
30
+ return require("@/resources/images/" + a);
31
+ }
32
+
33
+ const FILE_ICON_NAME_MAP = {
34
+ word: "ico-wrod.svg",
35
+ excel: "ico-excel.svg",
36
+ ppt: "ico-ppt.svg",
37
+ pdf: "ico-pdf.svg",
38
+ picture: "ico-photo.svg",
39
+ video: "ico-video.svg",
40
+ audio: "ico-music.svg",
41
+ html: "ico-html.svg",
42
+ txt: "ico-txt.svg",
43
+ java: "ico-java.svg",
44
+ vue: "ico-vue.svg",
45
+ xml: "ico-xml.svg",
46
+ flash: "ico-flash.svg",
47
+ zip: "ico-yasuobao.svg",
48
+ exe: "ico-ext.svg",
49
+ psd: "ico-psd.svg",
50
+ folder: "ico-wenjianjia.svg",
51
+ other: "ico-default_wenjian.svg",
52
+ };
53
+
54
+ const FILE_ICON_TYPE_MAP = {
55
+ doc: "word",
56
+ docx: "word",
57
+ xls: "excel",
58
+ xlsx: "excel",
59
+ ppt: "ppt",
60
+ pptx: "ppt",
61
+ pdf: "pdf",
62
+ jpg: "picture",
63
+ jpeg: "picture",
64
+ png: "picture",
65
+ gif: "picture",
66
+ mp3: "video",
67
+ mp4: "video",
68
+ mpg: "video",
69
+ mkv: "video",
70
+ rmvb: "video",
71
+ avi: "video",
72
+ mov: "video",
73
+ wav: "audio",
74
+ html: "html",
75
+ htm: "html",
76
+ txt: "txt",
77
+ java: "java",
78
+ vue: "vue",
79
+ xml: "xml",
80
+ swf: "flash",
81
+ zip: "zip",
82
+ rar: "zip",
83
+ "7z": "zip",
84
+ // exe: 'exe',
85
+ psd: "psd",
86
+ };
87
+
33
88
  const accessToken = imFun.store.getters["user/token"];
34
89
 
35
90
  const loadingText = "";
@@ -62,9 +117,9 @@ install = (Vue, opts = {}) => {
62
117
  option.addCreateInfo = defaultOption.addCreateInfo;
63
118
  }
64
119
  if (
65
- opts.queryCreateInfo === null ||
66
- opts.queryCreateInfo === undefined ||
67
- opts.queryCreateInfo === true
120
+ opts.queryCreateInfo === null
121
+ || opts.queryCreateInfo === undefined
122
+ || opts.queryCreateInfo === true
68
123
  ) {
69
124
  option.queryCreateInfo = defaultOption.queryCreateInfo;
70
125
  }
@@ -537,102 +592,27 @@ install = (Vue, opts = {}) => {
537
592
  return this.getFileIconRequire(filename);
538
593
  }
539
594
  },
540
- getFileIconRequire: function (name, showType) {
541
- let iconType = this.getDiyFileIconType(name);
542
- if (!iconType) {
543
- iconType = "other";
544
- }
545
- let fileIconNameMap = {
546
- word: "ico-wrod.svg",
547
- excel: "ico-excel.svg",
548
- ppt: "ico-ppt.svg",
549
- pdf: "ico-pdf.svg",
550
- picture: "ico-photo.svg",
551
- video: "ico-video.svg",
552
- audio: "ico-music.svg",
553
- html: "ico-html.svg",
554
- txt: "ico-txt.svg",
555
- flash: "ico-flash.svg",
556
- zip: "ico-yasuobao.svg",
557
- exe: "ico-ext.svg",
558
- psd: "ico-psd.svg",
559
- folder: "ico-wenjianjia.svg",
560
- other: "ico-default_wenjian.svg",
561
- };
595
+ resolveFileIconName: function (name, showType) {
596
+ let iconType = this.getDiyFileIconType(name) || "other";
562
597
  if (showType) {
563
598
  iconType = showType;
564
599
  }
565
- let fileIcenName = fileIconNameMap[iconType];
566
- return reqImg(fileIcenName);
600
+ return FILE_ICON_NAME_MAP[iconType];
601
+ },
602
+ getFileIconRequire: function (name, showType) {
603
+ return reqImg(this.resolveFileIconName(name, showType));
567
604
  },
568
605
  getFileIconPath: function (name, showType) {
569
- let iconType = this.getDiyFileIconType(name);
570
- if (!iconType) {
571
- iconType = "other";
572
- }
573
- let fileIconNameMap = {
574
- word: "ico-wrod.svg",
575
- excel: "ico-excel.svg",
576
- ppt: "ico-ppt.svg",
577
- pdf: "ico-pdf.svg",
578
- picture: "ico-photo.svg",
579
- video: "ico-video.svg",
580
- audio: "ico-music.svg",
581
- html: "ico-html.svg",
582
- txt: "ico-txt.svg",
583
- flash: "ico-flash.svg",
584
- zip: "ico-yasuobao.svg",
585
- exe: "ico-ext.svg",
586
- psd: "ico-psd.svg",
587
- folder: "ico-wenjianjia.svg",
588
- other: "ico-default_wenjian.svg",
589
- };
590
- if (showType) {
591
- iconType = showType;
592
- }
593
- let fileIcenName = fileIconNameMap[iconType];
594
- let path = "/resources/images/" + fileIcenName;
595
- return path;
606
+ return "/resources/images/" + this.resolveFileIconName(name, showType);
596
607
  },
597
608
  getDiyFileIconType: function (name) {
598
- let fileIconTypeMap = {
599
- doc: "word",
600
- docx: "word",
601
- xls: "excel",
602
- xlsx: "excel",
603
- ppt: "ppt",
604
- pptx: "ppt",
605
- pdf: "pdf",
606
- jpg: "picture",
607
- jpeg: "picture",
608
- png: "picture",
609
- gif: "picture",
610
- mp3: "video",
611
- mp4: "video",
612
- mpg: "video",
613
- mkv: "video",
614
- rmvb: "video",
615
- avi: "video",
616
- mov: "video",
617
- wav: "audio",
618
- html: "html",
619
- htm: "html",
620
- txt: "txt",
621
- swf: "flash",
622
- zip: "zip",
623
- rar: "zip",
624
- "7z": "zip",
625
- // exe: 'exe',
626
- psd: "psd",
627
- };
628
-
629
609
  let suffix = this.getFileSuffix(name);
630
610
  if (suffix === "") {
631
611
  // 默认是文本类型
632
612
  return "";
633
613
  }
634
614
 
635
- let iconType = fileIconTypeMap[suffix];
615
+ let iconType = FILE_ICON_TYPE_MAP[suffix];
636
616
  if (undefined === iconType) {
637
617
  return "";
638
618
  }
@@ -799,8 +779,8 @@ install = (Vue, opts = {}) => {
799
779
  if (Array.isArray(attachment)) {
800
780
  let currentFile = attachment[index];
801
781
  let typeStr = Object.prototype.toString.call(currentFile);
802
- let url =
803
- typeStr === "[object Object]"
782
+ let url
783
+ = typeStr === "[object Object]"
804
784
  ? currentFile.domain + currentFile.url
805
785
  : currentFile;
806
786
  if (that.$commonFileUtil.isPictureFile(url)) {
@@ -810,8 +790,8 @@ install = (Vue, opts = {}) => {
810
790
  }
811
791
  } else {
812
792
  let typeStr = Object.prototype.toString.call(attachment);
813
- let url =
814
- typeStr === "[object Object]"
793
+ let url
794
+ = typeStr === "[object Object]"
815
795
  ? attachment.domain + attachment.url
816
796
  : attachment;
817
797
  if (that.$commonFileUtil.isPictureFile(url)) {
@@ -839,11 +819,11 @@ install = (Vue, opts = {}) => {
839
819
  let visibleKey = target.$attrs["visible-key"] || "showEdit";
840
820
  let parentTarget = target.$attrs["parent-target"] || target.$parent;
841
821
  let originTarget = parentTarget.$refs._viewDialog ? parentTarget : target;
842
- let updateParam =
843
- param !== null &&
844
- param !== undefined &&
845
- param.updateParam !== null &&
846
- param.updateParam !== undefined
822
+ let updateParam
823
+ = param !== null
824
+ && param !== undefined
825
+ && param.updateParam !== null
826
+ && param.updateParam !== undefined
847
827
  ? param.updateParam
848
828
  : {};
849
829
  for (let key in updateParam) {
@@ -1068,8 +1048,8 @@ install = (Vue, opts = {}) => {
1068
1048
  let price;
1069
1049
  if (priceRoundType === "roundHalfUp") {
1070
1050
  price = (
1071
- Math.round(value * Math.pow(10, priceScale)) /
1072
- Math.pow(10, priceScale)
1051
+ Math.round(value * Math.pow(10, priceScale))
1052
+ / Math.pow(10, priceScale)
1073
1053
  ).toFixed(priceScale);
1074
1054
  } else if (priceRoundType === "roundUp") {
1075
1055
  price = (
@@ -1077,8 +1057,8 @@ install = (Vue, opts = {}) => {
1077
1057
  ).toFixed(priceScale);
1078
1058
  } else {
1079
1059
  price = (
1080
- Math.floor(value * Math.pow(10, priceScale)) /
1081
- Math.pow(10, priceScale)
1060
+ Math.floor(value * Math.pow(10, priceScale))
1061
+ / Math.pow(10, priceScale)
1082
1062
  ).toFixed(priceScale);
1083
1063
  }
1084
1064
  return price;
@@ -1107,8 +1087,8 @@ install = (Vue, opts = {}) => {
1107
1087
  /* dicts.forEach((item) => {
1108
1088
  dictMap[item.sn] = item.value;
1109
1089
  }); */
1110
- option.success &&
1111
- option.success({
1090
+ option.success
1091
+ && option.success({
1112
1092
  dicts,
1113
1093
  dictMap,
1114
1094
  });
@@ -1243,8 +1223,8 @@ install = (Vue, opts = {}) => {
1243
1223
  return i18n._t(path, lang, { zh: { [path]: path } }, null, values);
1244
1224
  } else {
1245
1225
  return (
1246
- i18n.t(path, values) ||
1247
- i18n._t(path, lang, { zh: { [path]: path } }, null, values)
1226
+ i18n.t(path, values)
1227
+ || i18n._t(path, lang, { zh: { [path]: path } }, null, values)
1248
1228
  );
1249
1229
  }
1250
1230
  }