cloud-web-corejs 1.0.54-dev.697 → 1.0.54-dev.699

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.697",
4
+ "version": "1.0.54-dev.699",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -44,56 +44,32 @@ function uniqueFileName(fileName, usedNames) {
44
44
  return `${fileName}_${usedNames[fileName]}`;
45
45
  }
46
46
 
47
- export const EXPORT_ARCHIVE_TYPES = {
47
+ const ARCHIVE_TYPE = {
48
48
  FORM_SCRIPT: "formScript",
49
49
  FORM_TEMPLATE: "formTemplate",
50
50
  TABLE: "table",
51
51
  };
52
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
+
53
59
  export function getExportArchiveType(url) {
54
60
  if (!url) return null;
55
- if (url.includes("/form_develop/exportFormScript")) {
56
- return EXPORT_ARCHIVE_TYPES.FORM_SCRIPT;
57
- }
58
- if (url.includes("/form_develop/exportFormTemplate")) {
59
- return EXPORT_ARCHIVE_TYPES.FORM_TEMPLATE;
60
- }
61
- if (url.includes("/form_develop/exportSzTaMb")) {
62
- return EXPORT_ARCHIVE_TYPES.TABLE;
63
- }
64
- return null;
61
+ const config = ARCHIVE_URL_MAP.find((item) => url.includes(item.match));
62
+ return config ? config.type : null;
65
63
  }
66
64
 
67
- function getFormScriptArchivePrefix(item) {
65
+ function getFormScriptPrefix(item) {
68
66
  const scriptCode = item.scriptCode || "script";
69
67
  const formCode = item.formCode;
70
68
  return formCode ? `S-${scriptCode}-${formCode}` : `S-${scriptCode}`;
71
69
  }
72
70
 
73
- function processFormScriptArchiveItem(item) {
74
- const prefix = getFormScriptArchivePrefix(item);
75
- const extraFiles = [];
76
-
77
- if (!isNull(item.script)) {
78
- const formatted = formatJsonContent(item.script);
79
- item.script = formatted;
80
- extraFiles.push({
81
- fileName: `${prefix}-Item`,
82
- content: formatted,
83
- });
84
- }
85
-
86
- return {
87
- mainContent: JSON.stringify(item, null, 2),
88
- mainFileName: `${prefix}-Source`,
89
- extraFiles,
90
- };
91
- }
92
-
93
- function processFormTemplateArchiveItem(item) {
71
+ function appendFormTemplateExtraFiles(item, extraFiles, usedNames) {
94
72
  const formCode = item.formCode || "form";
95
- const extraFiles = [];
96
- const usedNames = {};
97
73
 
98
74
  if (!isNull(item.formViewContent)) {
99
75
  const formatted = formatJsonContent(item.formViewContent);
@@ -104,8 +80,7 @@ function processFormTemplateArchiveItem(item) {
104
80
  });
105
81
  }
106
82
 
107
- const formScriptDTOs = item.formScriptDTOs || [];
108
- formScriptDTOs.forEach((scriptItem) => {
83
+ (item.formScriptDTOs || []).forEach((scriptItem) => {
109
84
  if (!scriptItem || isNull(scriptItem.script)) return;
110
85
  const scriptCode = scriptItem.scriptCode || "script";
111
86
  const scriptFormCode = scriptItem.formCode || formCode;
@@ -119,6 +94,50 @@ function processFormTemplateArchiveItem(item) {
119
94
  content: formatted,
120
95
  });
121
96
  });
97
+ }
98
+
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
+ });
113
+ }
114
+ }
115
+
116
+ function processFormScriptArchive(item) {
117
+ const prefix = getFormScriptPrefix(item);
118
+ formatExportFields(item, ARCHIVE_TYPE.FORM_SCRIPT);
119
+ const extraFiles = [];
120
+
121
+ if (!isNull(item.script)) {
122
+ extraFiles.push({
123
+ fileName: `${prefix}-Item`,
124
+ content: item.script,
125
+ });
126
+ }
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";
137
+ const extraFiles = [];
138
+ const usedNames = {};
139
+
140
+ appendFormTemplateExtraFiles(item, extraFiles, usedNames);
122
141
 
123
142
  return {
124
143
  mainContent: JSON.stringify(item, null, 2),
@@ -127,11 +146,10 @@ function processFormTemplateArchiveItem(item) {
127
146
  };
128
147
  }
129
148
 
130
- function processTableArchiveItem(item) {
131
- const taBm = item.taBm || "table";
149
+ function processTableArchive(item) {
132
150
  return {
133
151
  mainContent: JSON.stringify(item, null, 2),
134
- mainFileName: `T-${taBm}`,
152
+ mainFileName: `T-${item.taBm || "table"}`,
135
153
  extraFiles: [],
136
154
  };
137
155
  }
@@ -144,87 +162,29 @@ export function processArchiveExport(content, archiveType) {
144
162
 
145
163
  const item = list[0];
146
164
  switch (archiveType) {
147
- case EXPORT_ARCHIVE_TYPES.FORM_SCRIPT:
148
- return processFormScriptArchiveItem(item);
149
- case EXPORT_ARCHIVE_TYPES.FORM_TEMPLATE:
150
- return processFormTemplateArchiveItem(item);
151
- case EXPORT_ARCHIVE_TYPES.TABLE:
152
- return processTableArchiveItem(item);
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);
153
171
  default:
154
172
  return { mainContent: content, mainFileName: null, extraFiles: [] };
155
173
  }
156
174
  }
157
175
 
158
- export function getExportExtraConfig(url, options = {}) {
159
- if (options.extraExport) {
160
- return options.extraExport;
161
- }
162
- if (!url) return null;
163
- if (url.includes("/form_develop/exportFormScript")) {
164
- return {
165
- field: "script",
166
- getExtraFileName(item) {
167
- const prefix = getFormScriptArchivePrefix(item);
168
- return `${prefix}-Item`;
169
- },
170
- };
171
- }
172
- if (url.includes("/form_develop/exportFormTemplate")) {
173
- return {
174
- field: "formViewContent",
175
- getExtraFileName(item) {
176
- return `F-${item.formCode || "form"}-Item`;
177
- },
178
- };
179
- }
180
- return null;
181
- }
182
-
183
- export function processExportContent(content, extraConfig) {
184
- if (!extraConfig) {
185
- return { mainContent: content, extraFiles: [] };
176
+ /** 批量导出:仅格式化主 JSON 中的大字段,不额外拆文件 */
177
+ export function formatBatchExportContent(content, url) {
178
+ const archiveType = getExportArchiveType(url);
179
+ if (!archiveType || archiveType === ARCHIVE_TYPE.TABLE) {
180
+ return content;
186
181
  }
187
182
 
188
- const { field, getExtraFileName } = extraConfig;
189
183
  const { list, isArray, invalid } = parseExportContent(content);
190
-
191
184
  if (invalid || !list.length) {
192
- return { mainContent: content, extraFiles: [] };
185
+ return content;
193
186
  }
194
187
 
195
- const extraFiles = [];
196
- const usedNames = {};
197
-
198
- list.forEach((item, index) => {
199
- if (!item || isNull(item[field])) return;
200
-
201
- const formatted = formatJsonContent(item[field]);
202
- item[field] = formatted;
203
-
204
- let fileName = getExtraFileName(item, index);
205
- if (!fileName) return;
206
-
207
- fileName = uniqueFileName(fileName, usedNames);
208
- extraFiles.push({ fileName, content: formatted });
209
-
210
- if (field === "formViewContent" && Array.isArray(item.formScriptDTOs)) {
211
- item.formScriptDTOs.forEach((scriptItem) => {
212
- if (!scriptItem || isNull(scriptItem.script)) return;
213
- const scriptCode = scriptItem.scriptCode || "script";
214
- const formCode = scriptItem.formCode || item.formCode || "form";
215
- const scriptFormatted = formatJsonContent(scriptItem.script);
216
- scriptItem.script = scriptFormatted;
217
- extraFiles.push({
218
- fileName: uniqueFileName(
219
- `FS-${scriptCode}-${formCode}-Item`,
220
- usedNames
221
- ),
222
- content: scriptFormatted,
223
- });
224
- });
225
- }
226
- });
227
-
228
- const mainContent = JSON.stringify(isArray ? list : list[0], null, 2);
229
- return { mainContent, extraFiles };
188
+ list.forEach((item) => formatExportFields(item, archiveType));
189
+ return JSON.stringify(isArray ? list : list[0], null, 2);
230
190
  }
@@ -3,12 +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
+ formatBatchExportContent,
8
9
  getExportArchiveType,
9
- getExportExtraConfig,
10
10
  processArchiveExport,
11
- processExportContent,
12
11
  } from "./exportUtil";
13
12
 
14
13
  import { getToken } from "../../utils/auth";
@@ -61,7 +60,6 @@ moudule.install = function (Vue) {
61
60
  Vue.prototype.$jsonImport = toDo;
62
61
 
63
62
  Vue.prototype.$jsonExport = async function (options) {
64
- let reqData = {};
65
63
  let targetRef = options.targetRef;
66
64
  let abcEnabled = options.abcEnabled !== false;
67
65
  let editAuth = options.editAuth;
@@ -103,35 +101,24 @@ moudule.install = function (Vue) {
103
101
  success: (res) => {
104
102
  let content = res.objx;
105
103
  if (content && content !== "[]") {
106
- let fileName;
107
104
  const archiveType = options.plaintext
108
105
  && getExportArchiveType(options.url);
109
106
 
110
107
  if (archiveType) {
111
108
  const processed = processArchiveExport(content, archiveType);
112
- content = processed.mainContent;
113
- fileName = processed.mainFileName || options.fileName;
114
- downloadTxt(fileName, content);
109
+ downloadTxt(processed.mainFileName, processed.mainContent);
115
110
  downloadExtraFiles(processed.extraFiles);
116
111
  } else {
117
- if (options.fileName) {
118
- fileName = options.fileName;
119
- } else {
120
- let timeStr = res.time
112
+ content = formatBatchExportContent(content, options.url);
113
+ let fileName = options.fileName;
114
+ if (!fileName) {
115
+ const timeStr = res.time
121
116
  .replaceAll(":", "")
122
117
  .replaceAll("-", "")
123
118
  .replaceAll(" ", "");
124
- fileName = options.title + "(" + timeStr + ")";
125
- }
126
- const extraConfig = getExportExtraConfig(options.url, options);
127
- if (extraConfig) {
128
- const processed = processExportContent(content, extraConfig);
129
- content = processed.mainContent;
130
- downloadTxt(fileName, content);
131
- downloadExtraFiles(processed.extraFiles);
132
- } else {
133
- downloadTxt(fileName, content);
119
+ fileName = `${options.title}(${timeStr})`;
134
120
  }
121
+ downloadTxt(fileName, content);
135
122
  }
136
123
  } else {
137
124
  this.$baseAlert(this.$t1("不存在需要导出的数据"));
@@ -280,11 +280,26 @@ export default {
280
280
  field: "remark",
281
281
  width: 150,
282
282
  },
283
+ {
284
+ title: this.$t1("创建人"),
285
+ field: "_createBy",
286
+ width: 150,
287
+ },
283
288
  {
284
289
  title: this.$t1("创建时间"),
285
290
  field: "createDate",
286
291
  width: 150,
287
292
  },
293
+ {
294
+ title: this.$t1("更新人"),
295
+ field: "_modifyBy",
296
+ width: 150,
297
+ },
298
+ {
299
+ title: this.$t1("更新时间"),
300
+ field: "modifyDate",
301
+ width: 150,
302
+ },
288
303
  {
289
304
  width: 90,
290
305
  fixed: "right",
@@ -79,6 +79,7 @@
79
79
  @reverCallback="searchEvent"
80
80
  ></formVersionButton>
81
81
  <a
82
+ v-if="exportArchiveEnabled"
82
83
  href="javascript:void(0);"
83
84
  class="a-link"
84
85
  @click="jsonExportArchive(row)"
@@ -147,6 +147,7 @@
147
147
  @reverCallback="searchEvent"
148
148
  ></formVersionButton>
149
149
  <a
150
+ v-if="exportArchiveEnabled"
150
151
  href="javascript:void(0);"
151
152
  class="a-link"
152
153
  @click="jsonExportArchive(row)"
@@ -3,6 +3,7 @@ import editView from "@base/views/bd/setting/form_script/edit.vue";
3
3
  import { getBdFlag } from "@base/api/user";
4
4
  import { getJsxEditLink, getJsxStatus } from "@base/views/bd/setting/utils/index";
5
5
  import formVersionButton from "@base/views/bd/setting/formVersion/link.vue";
6
+ import settingConfig from "@/settings";
6
7
 
7
8
  let modules = {};
8
9
  modules = {
@@ -28,6 +29,15 @@ modules = {
28
29
  isDev: true,
29
30
  };
30
31
  },
32
+ computed: {
33
+ exportArchiveEnabled() {
34
+ return settingConfig.exportArchiveEnabled === true;
35
+ },
36
+ operationColumnWidth() {
37
+ const btnWidth = 47;
38
+ return this.exportArchiveEnabled ? btnWidth * 2 : btnWidth;
39
+ },
40
+ },
31
41
  mounted() {
32
42
  this.getBdEnv();
33
43
  this.initTableList();
@@ -155,7 +165,7 @@ modules = {
155
165
  width: 150,
156
166
  },
157
167
  {
158
- width: 100,
168
+ width: this.operationColumnWidth,
159
169
  fixed: "right",
160
170
  title: "",
161
171
  sortable: false,
@@ -12,6 +12,7 @@ import {
12
12
  getJsxStatus,
13
13
  } from "@base/views/bd/setting/utils/index";
14
14
  import formVersionButton from "@base/views/bd/setting/formVersion/link.vue";
15
+ import settingConfig from "@/settings";
15
16
 
16
17
  let modules = {};
17
18
  modules = {
@@ -92,6 +93,13 @@ modules = {
92
93
  otherFlag() {
93
94
  return this.currentFormType?.menuKindCode === "other";
94
95
  },
96
+ exportArchiveEnabled() {
97
+ return settingConfig.exportArchiveEnabled === true;
98
+ },
99
+ operationColumnWidth() {
100
+ const btnWidth = 47;
101
+ return this.exportArchiveEnabled ? btnWidth * 2 : btnWidth;
102
+ },
95
103
  },
96
104
  mounted() {
97
105
  treeScollx({ target: this, type: "default" });
@@ -274,7 +282,7 @@ modules = {
274
282
  width: 150,
275
283
  },
276
284
  {
277
- width: 100,
285
+ width: this.operationColumnWidth,
278
286
  fixed: "right",
279
287
  title: "",
280
288
  sortable: false,
@@ -162,6 +162,7 @@
162
162
  @reverCallback="searchEvent"
163
163
  ></formVersionButton>
164
164
  <a
165
+ v-if="exportArchiveEnabled"
165
166
  href="javascript:void(0);"
166
167
  class="a-link"
167
168
  @click="jsonExportArchive(row)"
@@ -19,6 +19,7 @@ import {
19
19
  getJsxStatus,
20
20
  } from "@base/views/bd/setting/utils/index";
21
21
  import formVersionButton from "@base/views/bd/setting/formVersion/link.vue";
22
+ import settingConfig from "@/settings";
22
23
 
23
24
  let modules = {};
24
25
  modules = {
@@ -153,6 +154,13 @@ modules = {
153
154
  otherFlag() {
154
155
  return this.currentFormType?.menuKindCode === "other";
155
156
  },
157
+ exportArchiveEnabled() {
158
+ return settingConfig.exportArchiveEnabled === true;
159
+ },
160
+ operationColumnWidth() {
161
+ const btnWidth = 47;
162
+ return this.exportArchiveEnabled ? btnWidth * 3 : btnWidth * 2;
163
+ },
156
164
  },
157
165
  watch: {
158
166
  formDesTabs(val) {
@@ -402,7 +410,7 @@ modules = {
402
410
  width: 150,
403
411
  },
404
412
  {
405
- width: 135,
413
+ width: this.operationColumnWidth,
406
414
  fixed: "right",
407
415
  title: "",
408
416
  sortable: false,
@@ -151,6 +151,7 @@
151
151
  @reverCallback="searchEvent"
152
152
  ></formVersionButton>
153
153
  <a
154
+ v-if="exportArchiveEnabled"
154
155
  href="javascript:void(0);"
155
156
  class="a-link"
156
157
  @click="jsonExportArchive(row)"
@@ -10,6 +10,7 @@ import {getBdFlag} from "@base/api/user";
10
10
  import {getJsxEditLink, getJsxStatus} from "@base/views/bd/setting/utils";
11
11
  import { mapGetters } from "vuex";
12
12
  import formVersionButton from "@base/views/bd/setting/formVersion/link.vue";
13
+ import settingConfig from "@/settings";
13
14
 
14
15
  let modules = {};
15
16
  modules = {
@@ -103,6 +104,13 @@ modules = {
103
104
  ...mapGetters([
104
105
  "userFlag",
105
106
  ]),
107
+ exportArchiveEnabled() {
108
+ return settingConfig.exportArchiveEnabled === true;
109
+ },
110
+ operationColumnWidth() {
111
+ const btnWidth = 47;
112
+ return this.exportArchiveEnabled ? btnWidth * 2 : btnWidth;
113
+ },
106
114
  },
107
115
  methods: {
108
116
  searchEvent() {
@@ -249,7 +257,7 @@ modules = {
249
257
  width: 150
250
258
  },
251
259
  {
252
- width: 100,
260
+ width: this.operationColumnWidth,
253
261
  fixed: 'right',
254
262
  title: '',
255
263
  sortable: false,