cloud-web-corejs 1.0.54-dev.696 → 1.0.54-dev.698

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,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.696",
4
+ "version": "1.0.54-dev.698",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -35,68 +35,156 @@ function parseExportContent(content) {
35
35
  }
36
36
  }
37
37
 
38
- export function getExportExtraConfig(url, options = {}) {
39
- if (options.extraExport) {
40
- return options.extraExport;
38
+ function uniqueFileName(fileName, usedNames) {
39
+ if (!usedNames[fileName]) {
40
+ usedNames[fileName] = 1;
41
+ return fileName;
41
42
  }
43
+ usedNames[fileName] += 1;
44
+ return `${fileName}_${usedNames[fileName]}`;
45
+ }
46
+
47
+ const ARCHIVE_TYPE = {
48
+ FORM_SCRIPT: "formScript",
49
+ FORM_TEMPLATE: "formTemplate",
50
+ TABLE: "table",
51
+ };
52
+
53
+ const ARCHIVE_URL_MAP = [
54
+ { match: "/form_develop/exportFormScript", type: ARCHIVE_TYPE.FORM_SCRIPT },
55
+ { match: "/form_develop/exportFormTemplate", type: ARCHIVE_TYPE.FORM_TEMPLATE },
56
+ { match: "/form_develop/exportSzTaMb", type: ARCHIVE_TYPE.TABLE },
57
+ ];
58
+
59
+ export function getExportArchiveType(url) {
42
60
  if (!url) return null;
43
- if (url.includes("/form_develop/exportFormScript")) {
44
- return {
45
- field: "script",
46
- getExtraFileName(item) {
47
- const scriptCode = item.scriptCode || "script";
48
- const formCode = item.formCode;
49
- return formCode
50
- ? `${scriptCode} - ${formCode} - item(script)`
51
- : `${scriptCode} - item(script)`;
52
- },
53
- };
54
- }
55
- if (url.includes("/form_develop/exportFormTemplate")) {
56
- return {
57
- field: "formViewContent",
58
- getExtraFileName(item) {
59
- return `${item.formCode || "form"} - item(form)`;
60
- },
61
- };
61
+ const config = ARCHIVE_URL_MAP.find((item) => url.includes(item.match));
62
+ return config ? config.type : null;
63
+ }
64
+
65
+ function getFormScriptPrefix(item) {
66
+ const scriptCode = item.scriptCode || "script";
67
+ const formCode = item.formCode;
68
+ return formCode ? `S-${scriptCode}-${formCode}` : `S-${scriptCode}`;
69
+ }
70
+
71
+ function appendFormTemplateExtraFiles(item, extraFiles, usedNames) {
72
+ const formCode = item.formCode || "form";
73
+
74
+ if (!isNull(item.formViewContent)) {
75
+ const formatted = formatJsonContent(item.formViewContent);
76
+ item.formViewContent = formatted;
77
+ extraFiles.push({
78
+ fileName: uniqueFileName(`F-${formCode}-Item`, usedNames),
79
+ content: formatted,
80
+ });
62
81
  }
63
- return null;
82
+
83
+ (item.formScriptDTOs || []).forEach((scriptItem) => {
84
+ if (!scriptItem || isNull(scriptItem.script)) return;
85
+ const scriptCode = scriptItem.scriptCode || "script";
86
+ const scriptFormCode = scriptItem.formCode || formCode;
87
+ const formatted = formatJsonContent(scriptItem.script);
88
+ scriptItem.script = formatted;
89
+ extraFiles.push({
90
+ fileName: uniqueFileName(
91
+ `FS-${scriptCode}-${scriptFormCode}-Item`,
92
+ usedNames
93
+ ),
94
+ content: formatted,
95
+ });
96
+ });
64
97
  }
65
98
 
66
- export function processExportContent(content, extraConfig) {
67
- if (!extraConfig) {
68
- return { mainContent: content, extraFiles: [] };
99
+ function formatExportFields(item, archiveType) {
100
+ if (archiveType === ARCHIVE_TYPE.FORM_SCRIPT && !isNull(item.script)) {
101
+ item.script = formatJsonContent(item.script);
102
+ return;
103
+ }
104
+ if (archiveType === ARCHIVE_TYPE.FORM_TEMPLATE) {
105
+ if (!isNull(item.formViewContent)) {
106
+ item.formViewContent = formatJsonContent(item.formViewContent);
107
+ }
108
+ (item.formScriptDTOs || []).forEach((scriptItem) => {
109
+ if (scriptItem && !isNull(scriptItem.script)) {
110
+ scriptItem.script = formatJsonContent(scriptItem.script);
111
+ }
112
+ });
69
113
  }
114
+ }
70
115
 
71
- const { field, getExtraFileName } = extraConfig;
72
- const { list, isArray, invalid } = parseExportContent(content);
116
+ function processFormScriptArchive(item) {
117
+ const prefix = getFormScriptPrefix(item);
118
+ formatExportFields(item, ARCHIVE_TYPE.FORM_SCRIPT);
119
+ const extraFiles = [];
73
120
 
74
- if (invalid || !list.length) {
75
- return { mainContent: content, extraFiles: [] };
121
+ if (!isNull(item.script)) {
122
+ extraFiles.push({
123
+ fileName: `${prefix}-Item`,
124
+ content: item.script,
125
+ });
76
126
  }
77
127
 
128
+ return {
129
+ mainContent: JSON.stringify(item, null, 2),
130
+ mainFileName: `${prefix}-Source`,
131
+ extraFiles,
132
+ };
133
+ }
134
+
135
+ function processFormTemplateArchive(item) {
136
+ const formCode = item.formCode || "form";
78
137
  const extraFiles = [];
79
138
  const usedNames = {};
80
139
 
81
- list.forEach((item, index) => {
82
- if (!item || isNull(item[field])) return;
140
+ appendFormTemplateExtraFiles(item, extraFiles, usedNames);
83
141
 
84
- const formatted = formatJsonContent(item[field]);
85
- item[field] = formatted;
142
+ return {
143
+ mainContent: JSON.stringify(item, null, 2),
144
+ mainFileName: `F-${formCode}-Source`,
145
+ extraFiles,
146
+ };
147
+ }
86
148
 
87
- let fileName = getExtraFileName(item, index);
88
- if (!fileName) return;
149
+ function processTableArchive(item) {
150
+ return {
151
+ mainContent: JSON.stringify(item, null, 2),
152
+ mainFileName: `T-${item.taBm || "table"}`,
153
+ extraFiles: [],
154
+ };
155
+ }
89
156
 
90
- if (usedNames[fileName]) {
91
- usedNames[fileName] += 1;
92
- fileName = `${fileName}_${usedNames[fileName]}`;
93
- } else {
94
- usedNames[fileName] = 1;
95
- }
157
+ export function processArchiveExport(content, archiveType) {
158
+ const { list, invalid } = parseExportContent(content);
159
+ if (invalid || !list.length) {
160
+ return { mainContent: content, mainFileName: null, extraFiles: [] };
161
+ }
96
162
 
97
- extraFiles.push({ fileName, content: formatted });
98
- });
163
+ const item = list[0];
164
+ switch (archiveType) {
165
+ case ARCHIVE_TYPE.FORM_SCRIPT:
166
+ return processFormScriptArchive(item);
167
+ case ARCHIVE_TYPE.FORM_TEMPLATE:
168
+ return processFormTemplateArchive(item);
169
+ case ARCHIVE_TYPE.TABLE:
170
+ return processTableArchive(item);
171
+ default:
172
+ return { mainContent: content, mainFileName: null, extraFiles: [] };
173
+ }
174
+ }
175
+
176
+ /** 批量导出:仅格式化主 JSON 中的大字段,不额外拆文件 */
177
+ export function formatBatchExportContent(content, url) {
178
+ const archiveType = getExportArchiveType(url);
179
+ if (!archiveType || archiveType === ARCHIVE_TYPE.TABLE) {
180
+ return content;
181
+ }
182
+
183
+ const { list, isArray, invalid } = parseExportContent(content);
184
+ if (invalid || !list.length) {
185
+ return content;
186
+ }
99
187
 
100
- const mainContent = JSON.stringify(isArray ? list : list[0], null, 2);
101
- return { mainContent, extraFiles };
188
+ list.forEach((item) => formatExportFields(item, archiveType));
189
+ return JSON.stringify(isArray ? list : list[0], null, 2);
102
190
  }
@@ -3,10 +3,11 @@ import vue from "vue";
3
3
  import excelImport from "./index.vue";
4
4
  import exportDialog from "./exportDialog.vue";
5
5
  import { getBdEnv } from "@base/api/user";
6
- import { encrypt, decrypt } from "@base/utils/aes";
6
+ import { encrypt } from "@base/utils/aes";
7
7
  import {
8
- getExportExtraConfig,
9
- processExportContent,
8
+ formatBatchExportContent,
9
+ getExportArchiveType,
10
+ processArchiveExport,
10
11
  } from "./exportUtil";
11
12
 
12
13
  import { getToken } from "../../utils/auth";
@@ -59,7 +60,6 @@ moudule.install = function (Vue) {
59
60
  Vue.prototype.$jsonImport = toDo;
60
61
 
61
62
  Vue.prototype.$jsonExport = async function (options) {
62
- let reqData = {};
63
63
  let targetRef = options.targetRef;
64
64
  let abcEnabled = options.abcEnabled !== false;
65
65
  let editAuth = options.editAuth;
@@ -101,27 +101,23 @@ moudule.install = function (Vue) {
101
101
  success: (res) => {
102
102
  let content = res.objx;
103
103
  if (content && content !== "[]") {
104
- let fileName;
105
- if (options.fileName) {
106
- fileName = options.fileName;
107
- } else {
108
- let timeStr = res.time
109
- .replaceAll(":", "")
110
- .replaceAll("-", "")
111
- .replaceAll(" ", "");
112
- fileName = options.title + "(" + timeStr + ")";
113
- }
114
- const extraConfig = getExportExtraConfig(options.url, options);
115
- if (extraConfig) {
116
- const processed = processExportContent(content, extraConfig);
117
- content = processed.mainContent;
118
- const extraFiles = resolveExtraFileNames(
119
- processed.extraFiles,
120
- options.fileName
121
- );
122
- downloadTxt(fileName, content);
123
- downloadExtraFiles(extraFiles);
104
+ const archiveType = options.plaintext
105
+ && getExportArchiveType(options.url);
106
+
107
+ if (archiveType) {
108
+ const processed = processArchiveExport(content, archiveType);
109
+ downloadTxt(processed.mainFileName, processed.mainContent);
110
+ downloadExtraFiles(processed.extraFiles);
124
111
  } else {
112
+ content = formatBatchExportContent(content, options.url);
113
+ let fileName = options.fileName;
114
+ if (!fileName) {
115
+ const timeStr = res.time
116
+ .replaceAll(":", "")
117
+ .replaceAll("-", "")
118
+ .replaceAll(" ", "");
119
+ fileName = `${options.title}(${timeStr})`;
120
+ }
125
121
  downloadTxt(fileName, content);
126
122
  }
127
123
  } else {
@@ -161,19 +157,6 @@ moudule.install = function (Vue) {
161
157
  };
162
158
  };
163
159
 
164
- function resolveExtraFileNames(extraFiles, mainFileName) {
165
- if (!extraFiles || !extraFiles.length) return [];
166
- return extraFiles.map((file) => {
167
- if (mainFileName && file.fileName === mainFileName) {
168
- return {
169
- ...file,
170
- fileName: `${file.fileName}-content`,
171
- };
172
- }
173
- return file;
174
- });
175
- }
176
-
177
160
  function downloadExtraFiles(extraFiles) {
178
161
  if (!extraFiles || !extraFiles.length) return;
179
162
  extraFiles.forEach((file, index) => {
@@ -142,9 +142,15 @@
142
142
  :key="'menuModule' + menuModule.id"
143
143
  @click.native="rourteTo(menuModule)"
144
144
  >
145
- <i :class="getMenuClass(menuModule, 1)" v-if="menuModule.children.length <= 0"></i>
145
+ <i
146
+ :class="getMenuClass(menuModule, 1)"
147
+ v-if="menuModule.children.length <= 0"
148
+ ></i>
146
149
  <template slot="title">
147
- <i :class="getMenuClass(menuModule, 1)" v-if="menuModule.children.length > 0"></i>
150
+ <i
151
+ :class="getMenuClass(menuModule, 1)"
152
+ v-if="menuModule.children.length > 0"
153
+ ></i>
148
154
  <span>{{ getMenuName(menuModule) }}</span>
149
155
  </template>
150
156
  <component
@@ -173,7 +179,7 @@
173
179
  </el-menu-item>
174
180
  </component>
175
181
  </component>
176
- <el-menu-item
182
+ <!-- <el-menu-item
177
183
  @click.native="openCreateCompanyDialog"
178
184
  index="xx"
179
185
  v-if="isFormDev"
@@ -182,7 +188,7 @@
182
188
  <i :class="getMenuClass({}, 1)"></i>
183
189
  <span>新建企业</span>
184
190
  </template>
185
- </el-menu-item>
191
+ </el-menu-item> -->
186
192
  </el-scrollbar>
187
193
  </el-menu>
188
194
  <div class="menu-btn">
@@ -797,7 +803,7 @@ export default {
797
803
  if (sh >= 0) {
798
804
  $snav.style["margin-top"] = sh1 + "px";
799
805
  } else if (sh < 0) {
800
- let bd = sh1 + sh ;
806
+ let bd = sh1 + sh;
801
807
 
802
808
  $snav.style["margin-top"] = bd + "px";
803
809
  $snav.querySelector(".ico-arrow").style["margin-top"] =
@@ -1057,30 +1063,49 @@ export default {
1057
1063
  position: relative;
1058
1064
  background-color: rgba(0, 0, 0, 0.2);
1059
1065
  word-break: break-word;
1060
- .el-scrollbar__view >{
1061
- .el-menu-item{padding:0 11px !important;
1062
- span{font-size:14px;}
1066
+ .el-scrollbar__view > {
1067
+ .el-menu-item {
1068
+ padding: 0 11px !important;
1069
+ span {
1070
+ font-size: 14px;
1071
+ }
1063
1072
  }
1064
- .el-submenu > .el-submenu__title{padding:0 11px !important;
1065
- span{font-size:14px;}
1066
- ~ .el-menu{
1067
- padding:5px 0;display: grid;
1068
- > .el-menu-item{
1069
- span{line-height:1.4;height: 26px;}
1073
+ .el-submenu > .el-submenu__title {
1074
+ padding: 0 11px !important;
1075
+ span {
1076
+ font-size: 14px;
1077
+ }
1078
+ ~ .el-menu {
1079
+ padding: 5px 0;
1080
+ display: grid;
1081
+ > .el-menu-item {
1082
+ span {
1083
+ line-height: 1.4;
1084
+ height: 26px;
1085
+ }
1070
1086
  }
1071
- .el-submenu.is-opened .el-submenu__title{background-color:#FFF;opacity:1;
1072
- span{color:$baseColor;}
1073
- i.iconfont{color:$baseColor}
1087
+ .el-submenu.is-opened .el-submenu__title {
1088
+ background-color: #fff;
1089
+ opacity: 1;
1090
+ span {
1091
+ color: $baseColor;
1092
+ }
1093
+ i.iconfont {
1094
+ color: $baseColor;
1095
+ }
1074
1096
  }
1075
1097
  }
1076
-
1077
1098
  }
1078
1099
  }
1079
- .el-submenu__title,.el-menu-item {
1100
+ .el-submenu__title,
1101
+ .el-menu-item {
1080
1102
  padding: 0 11px;
1081
1103
  height: 48px;
1082
1104
  line-height: 48px;
1083
- &:hover,&.is-active{background-color:rgba(0, 0, 0, 0.29)}
1105
+ &:hover,
1106
+ &.is-active {
1107
+ background-color: rgba(0, 0, 0, 0.29);
1108
+ }
1084
1109
  i {
1085
1110
  color: #fff;
1086
1111
  font-size: 13px;
@@ -1119,18 +1144,22 @@ export default {
1119
1144
  &.is-opened .el-submenu__title {
1120
1145
  //background-color: rgba(27, 66, 97) !important;
1121
1146
  }
1122
- .el-submenu .el-menu{display:none}
1147
+ .el-submenu .el-menu {
1148
+ display: none;
1149
+ }
1123
1150
  }
1124
1151
 
1125
1152
  .el-submenu {
1126
- &.is-opened{
1127
- > .el-submenu__title{background-color:rgba(0, 0, 0, 0.29)}
1153
+ &.is-opened {
1154
+ > .el-submenu__title {
1155
+ background-color: rgba(0, 0, 0, 0.29);
1156
+ }
1128
1157
  }
1129
1158
  .el-menu {
1130
1159
  background: rgba(0, 0, 0, 0.35);
1131
1160
  box-shadow: 0px -5px 8px #00000014 inset;
1132
1161
  //padding:4px 0;
1133
- .el-submenu__title{
1162
+ .el-submenu__title {
1134
1163
  height: auto;
1135
1164
  line-height: 1.4;
1136
1165
  font-size: 12px;
@@ -1164,13 +1193,18 @@ export default {
1164
1193
  zoom: 0.8;
1165
1194
  display: none;
1166
1195
  }
1167
- span{height:auto;text-align: left !important;}
1196
+ span {
1197
+ height: auto;
1198
+ text-align: left !important;
1199
+ }
1168
1200
  &:hover,
1169
1201
  &.on {
1170
1202
  opacity: 1;
1171
1203
  background-color: #fbfdfe !important;
1172
1204
  color: $baseColor !important;
1173
- i.iconfont{color:$baseColor}
1205
+ i.iconfont {
1206
+ color: $baseColor;
1207
+ }
1174
1208
  .el-icon-arrow-right {
1175
1209
  color: $baseColor;
1176
1210
  }
@@ -1178,7 +1212,7 @@ export default {
1178
1212
  }
1179
1213
  }
1180
1214
 
1181
- .el-menu-item{
1215
+ .el-menu-item {
1182
1216
  height: auto;
1183
1217
  line-height: 1.4;
1184
1218
  padding-left: 33px !important;
@@ -1201,7 +1235,7 @@ export default {
1201
1235
  line-height: 20px;
1202
1236
  left: 7px;
1203
1237
  font-size: 18px;
1204
- color:#D0D6DB;
1238
+ color: #d0d6db;
1205
1239
  }
1206
1240
 
1207
1241
  [class^="el-icon-"] {
@@ -1214,7 +1248,6 @@ export default {
1214
1248
  width: 14px;
1215
1249
  zoom: 0.8;
1216
1250
  display: none;
1217
-
1218
1251
  }
1219
1252
 
1220
1253
  &:hover,
@@ -1223,7 +1256,8 @@ export default {
1223
1256
  background-color: #fbfdfe !important;
1224
1257
  color: $baseColor !important;
1225
1258
 
1226
- .el-icon-arrow-right,i.iconfont {
1259
+ .el-icon-arrow-right,
1260
+ i.iconfont {
1227
1261
  color: $baseColor;
1228
1262
  }
1229
1263
  }
@@ -1546,46 +1580,61 @@ export default {
1546
1580
  // .el-submenu .el-menu {
1547
1581
  // height: auto !important;
1548
1582
  // }
1549
- .el-menu--vertical{
1550
- > .el-menu--popup{overflow: auto;//不用atuo 超出不出滚动条
1551
- .el-submenu__title, .el-menu-item{
1552
- height: auto !important;
1553
- line-height: 1.4 !important;
1554
- padding: 8px 0;
1555
- text-align: left;
1556
- white-space: normal;
1557
- word-break: break-word;
1558
- background:none;
1559
- i.iconfont{color:#FFF;margin-right:8px;}
1583
+ .el-menu--vertical {
1584
+ > .el-menu--popup {
1585
+ overflow: auto; //不用atuo 超出不出滚动条
1586
+ .el-submenu__title,
1587
+ .el-menu-item {
1588
+ height: auto !important;
1589
+ line-height: 1.4 !important;
1590
+ padding: 8px 0;
1591
+ text-align: left;
1592
+ white-space: normal;
1593
+ word-break: break-word;
1594
+ background: none;
1595
+ i.iconfont {
1596
+ color: #fff;
1597
+ margin-right: 8px;
1560
1598
  }
1561
- }
1562
- .el-submenu{
1563
- .el-submenu__title{
1564
- .el-submenu__icon-arrow{display:none}
1565
1599
  }
1566
- &:hover{
1567
- .el-submenu__title{
1600
+ }
1601
+ .el-submenu {
1602
+ .el-submenu__title {
1603
+ .el-submenu__icon-arrow {
1604
+ display: none;
1605
+ }
1606
+ }
1607
+ &:hover {
1608
+ .el-submenu__title {
1568
1609
  background-color: rgba(0, 0, 0, 0.29) !important;
1569
- i.iconfont{color:$baseColor}
1610
+ i.iconfont {
1611
+ color: $baseColor;
1612
+ }
1570
1613
  }
1571
1614
  }
1572
1615
 
1573
- &.is-opened{
1574
- .el-submenu__title{
1616
+ &.is-opened {
1617
+ .el-submenu__title {
1575
1618
  background-color: rgba(0, 0, 0, 0.29) !important;
1576
- i.iconfont{color:$baseColor}
1619
+ i.iconfont {
1620
+ color: $baseColor;
1621
+ }
1577
1622
  }
1578
1623
  }
1579
1624
  }
1580
- .el-menu-item{
1581
- &:hover{
1582
- background-color: rgba(0, 0, 0, 0.29) !important;
1583
- i.iconfont{color:$baseColor}
1625
+ .el-menu-item {
1626
+ &:hover {
1627
+ background-color: rgba(0, 0, 0, 0.29) !important;
1628
+ i.iconfont {
1629
+ color: $baseColor;
1630
+ }
1584
1631
  }
1585
1632
 
1586
- &.is-opened{
1587
- background-color: rgba(0, 0, 0, 0.29) !important;
1588
- i.iconfont{color:$baseColor}
1633
+ &.is-opened {
1634
+ background-color: rgba(0, 0, 0, 0.29) !important;
1635
+ i.iconfont {
1636
+ color: $baseColor;
1637
+ }
1589
1638
  }
1590
1639
  }
1591
1640
  // .el-menu-item{
@@ -286,9 +286,6 @@ modules = {
286
286
  data: [row.id],
287
287
  url: USER_PREFIX + "/form_develop/exportFormScript",
288
288
  plaintext: 1,
289
- fileName: row.formCode
290
- ? `${row.scriptCode} - ${row.formCode}(script)`
291
- : `${row.scriptCode}(script)`,
292
289
  abcEnabled: true,
293
290
  });
294
291
  },
@@ -487,7 +487,6 @@ modules = {
487
487
  data: [row.id],
488
488
  url: USER_PREFIX + "/form_develop/exportFormScript",
489
489
  plaintext: 1,
490
- fileName: `${row.scriptCode} - ${row.formCode}(script)`,
491
490
  abcEnabled: true,
492
491
  editAuth: this.currentFormType.editAuth,
493
492
  selectTypeAuth: this.currentFormType.selectTypeAuth,
@@ -696,7 +696,6 @@ modules = {
696
696
  data: [row.id],
697
697
  url: USER_PREFIX + "/form_develop/exportFormTemplate",
698
698
  plaintext: 1,
699
- fileName: row.formCode + "(form)",
700
699
  abcEnabled: true,
701
700
  editAuth: this.currentFormType.editAuth,
702
701
  selectTypeAuth: this.currentFormType.selectTypeAuth,
@@ -450,7 +450,6 @@ modules = {
450
450
  data: [row.id],
451
451
  url: USER_PREFIX + "/form_develop/exportSzTaMb",
452
452
  plaintext: 1,
453
- fileName: row.taBm + "(table)",
454
453
  abcEnabled: true,
455
454
  editAuth: this.currentFormType.editAuth,
456
455
  selectTypeAuth: this.currentFormType.selectTypeAuth,