super-page-runtime 2.0.25 → 2.0.27

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.
Files changed (27) hide show
  1. package/dist/es/components/runtime/utils/api/api-util.js +9 -1
  2. package/dist/es/components/runtime/utils/assemblys-config.js +6 -0
  3. package/dist/es/components/runtime/utils/barcode-util.d.ts +8 -0
  4. package/dist/es/components/runtime/utils/barcode-util.js +36 -0
  5. package/dist/es/components/runtime/utils/common-util.js +1 -1
  6. package/dist/es/components/runtime/utils/events/event-util.js +1 -12
  7. package/dist/es/components/runtime/utils/events/print-label.d.ts +5 -0
  8. package/dist/es/components/runtime/utils/events/print-label.js +153 -0
  9. package/dist/es/components/runtime/utils/events/standard-event.d.ts +2 -0
  10. package/dist/es/components/runtime/utils/events/standard-event.js +61 -27
  11. package/dist/es/components/runtime/utils/page-helper-util.js +1 -0
  12. package/dist/es/components/runtime/utils/page-init-util.d.ts +1 -1
  13. package/dist/es/components/runtime/utils/page-init-util.js +16 -7
  14. package/dist/es/components/runtime/utils/table-utils.js +1 -10
  15. package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue.js +4 -0
  16. package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue2.js +96 -0
  17. package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue2.js +1 -1
  18. package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue2.js +5 -33
  19. package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +4 -3
  20. package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +15 -9
  21. package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue2.js +3 -2
  22. package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +25 -1
  23. package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +77 -39
  24. package/dist/es/components/runtime/views/assemblys/object-render.vue.js +1 -1
  25. package/dist/es/components/runtime/views/super-page-dialog.vue.js +3 -0
  26. package/dist/es/components/runtime/views/super-page.vue.js +49 -39
  27. package/package.json +4 -3
@@ -1,7 +1,7 @@
1
1
  import { getSystemBackendUrl } from "agilebuilder-ui/src/utils/common-util";
2
2
  import { getSessionCache } from "agilebuilder-ui/src/utils/auth";
3
3
  import http from "agilebuilder-ui/src/utils/request";
4
- import { getBaseUrl } from "../common-util.js";
4
+ import { getBaseUrl, getListCode } from "../common-util.js";
5
5
  import { getAdditionalParamMap, dealCompleteTaskParam } from "../events/standard-event.js";
6
6
  import { packageCustomRules, getWorkflowRules } from "../events/validator-util.js";
7
7
  import { handleEvent } from "../events/event-util.js";
@@ -66,6 +66,14 @@ function getCommonFormData(pageContext) {
66
66
  if (taskId) {
67
67
  param["taskId"] = taskId;
68
68
  }
69
+ if (pageContext.tableUuids) {
70
+ let listCodes = [];
71
+ pageContext.tableUuids.forEach((tableUuid) => {
72
+ const listCode = getListCode(pageCode, pageVersion, tableUuid);
73
+ listCodes.push(listCode);
74
+ });
75
+ param["tableNames"] = listCodes;
76
+ }
69
77
  const urlForView = backendUrl + "/dsc/commons/gets";
70
78
  http.post(urlForView, param).then((commonEntity) => {
71
79
  if (commonEntity) {
@@ -182,6 +182,12 @@ const assemblyGroups = [
182
182
  runtimeComponent: defineAsyncComponent(() => {
183
183
  return import("../views/assemblys/button/dropdown/dropdown-runtime.vue.js");
184
184
  })
185
+ }, {
186
+ name: "print-label",
187
+ label: "打印标签",
188
+ runtimeComponent: defineAsyncComponent(() => {
189
+ return import("../views/assemblys/button/print-label/printlabel-runtime.vue.js");
190
+ })
185
191
  }]
186
192
  },
187
193
  {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 跟据规则生成条码
3
+ */
4
+ export declare function generateCodeByRule(rules: any[], data: any): string;
5
+ declare const _default: {
6
+ generateCodeByRule: typeof generateCodeByRule;
7
+ };
8
+ export default _default;
@@ -0,0 +1,36 @@
1
+ function generateCodeByRule(rules, data) {
2
+ let allVariablesPresent = true;
3
+ let value = "";
4
+ rules.forEach((item) => {
5
+ if (item.propDbName !== "-1" && item.propDbName !== -1) {
6
+ const filedValue = data[item.propDbName];
7
+ if (item.supplementaryCharacters && item.length) {
8
+ if (!filedValue) {
9
+ value += "".padEnd(item.length, item.supplementaryCharacters);
10
+ } else {
11
+ if (filedValue.length > item.length) {
12
+ value += filedValue.substring(0, item.supplementaryCharacters);
13
+ } else {
14
+ value += filedValue.padEnd(item.length, item.supplementaryCharacters);
15
+ }
16
+ }
17
+ } else {
18
+ if (!filedValue) {
19
+ allVariablesPresent = false;
20
+ } else {
21
+ value += filedValue;
22
+ }
23
+ }
24
+ } else {
25
+ value += item.fixedValue;
26
+ }
27
+ });
28
+ console.log("跟据规则生成条码:" + value);
29
+ if (allVariablesPresent) {
30
+ return value;
31
+ }
32
+ return null;
33
+ }
34
+ export {
35
+ generateCodeByRule
36
+ };
@@ -65,7 +65,7 @@ function upperFirstCase(str) {
65
65
  return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
66
66
  }
67
67
  function getListCode(pageCode, pageVersion, tableUuid) {
68
- return pageCode + "__V" + pageVersion + "__" + tableUuid;
68
+ return "V" + pageVersion + "__" + pageCode + "__" + tableUuid;
69
69
  }
70
70
  function deepCopy(srcObj) {
71
71
  if (typeof srcObj !== "object" || srcObj === null) {
@@ -104,6 +104,7 @@ function handleEventUtil($event, pageContext, configure, eventType, isExecute, o
104
104
  const isListButton = isListPage(pageContext);
105
105
  if (isListButton) {
106
106
  otherParams["selections"] = selections;
107
+ otherParams["id"] = selectionIds && selectionIds.length > 0 ? selectionIds[0] : null;
107
108
  otherParams["ids"] = selectionIds;
108
109
  }
109
110
  const tableConfigure = gridRef.getTableConfigure();
@@ -590,25 +591,13 @@ function headerClick(pageContext, configureObj, params) {
590
591
  function fileUploadBeforeUpload(params) {
591
592
  return getHandleEvent(null, params.pageContext, params.configureObj, "before-upload", params);
592
593
  }
593
- function fileUploadUploaded(pageContext, configureObj, params) {
594
- return handleEvent(null, pageContext, configureObj, "uploaded", params);
595
- }
596
- function fileUploadBeforeDelete(pageContext, configureObj, params) {
597
- return handleEvent(null, pageContext, configureObj, "before-delete", params);
598
- }
599
- function fileUploadDeleted(pageContext, configureObj, params) {
600
- return handleEvent(null, pageContext, configureObj, "deleted", params);
601
- }
602
594
  export {
603
595
  canExecuteButton,
604
596
  cellClick,
605
597
  cellDblClick,
606
598
  doAfterClickEvent,
607
599
  doBeforeClickEvent,
608
- fileUploadBeforeDelete,
609
600
  fileUploadBeforeUpload,
610
- fileUploadDeleted,
611
- fileUploadUploaded,
612
601
  getClickEventFuncByType,
613
602
  getCustomFunc,
614
603
  getEventFuncByType,
@@ -0,0 +1,5 @@
1
+ export declare function printLabel(params: any, templateUuid: string): void;
2
+ declare const _default: {
3
+ printLabel: typeof printLabel;
4
+ };
5
+ export default _default;
@@ -0,0 +1,153 @@
1
+ import http from "agilebuilder-ui/src/utils/request";
2
+ import { hiprint } from "vue-plugin-hiprint";
3
+ import { generateCodeByRule } from "../barcode-util.js";
4
+ function printLabel(params, templateUuid) {
5
+ http.post(window["$vueApp"].config.globalProperties.baseAPI + "/dc/print-models/by-codes", [
6
+ templateUuid
7
+ ]).then((res) => {
8
+ const templateJson = JSON.parse(res[0].template);
9
+ const barCodeOptions = [];
10
+ templateJson.panels.forEach((panel) => {
11
+ panel.printElements.forEach((element) => {
12
+ if (element.options.textType === "barcode" || element.options.textType === "qrcode") {
13
+ barCodeOptions.push(element.options);
14
+ }
15
+ });
16
+ });
17
+ const printTemplate = new hiprint.PrintTemplate({
18
+ template: templateJson
19
+ });
20
+ const ext = {
21
+ callback: () => {
22
+ console.log("浏览器打印窗口已打开");
23
+ },
24
+ styleHandler: () => {
25
+ return "";
26
+ }
27
+ };
28
+ const options = { leftOffset: -1, topOffset: -1 };
29
+ if (params.pageContext.pageType) {
30
+ if (params.pageContext.pageType === "list") {
31
+ printListData(params, barCodeOptions, printTemplate, options, ext);
32
+ } else if (params.pageContext.pageType === "form") {
33
+ printFormData(params, barCodeOptions, printTemplate, options, ext);
34
+ }
35
+ } else {
36
+ printFormData(params, barCodeOptions, printTemplate, options, ext);
37
+ }
38
+ });
39
+ }
40
+ function printListData(params, barCodeOptions, printTemplate, options, ext) {
41
+ if (barCodeOptions.length > 0) {
42
+ const valuePromises = [];
43
+ const selections = JSON.parse(JSON.stringify(params.selections));
44
+ barCodeOptions.forEach((barCodeOption) => {
45
+ valuePromises.push(resloveListData(barCodeOption, selections));
46
+ });
47
+ Promise.all(valuePromises).then((allBarValues) => {
48
+ allBarValues.forEach((barValues) => {
49
+ barValues.forEach((item) => {
50
+ const index = item.index;
51
+ const selection = selections[index];
52
+ if (!selection[item.type]) {
53
+ selection[item.type] = {};
54
+ }
55
+ selection[item.type][item.name] = item.value;
56
+ });
57
+ });
58
+ printTemplate.print(selections, options, ext);
59
+ });
60
+ } else {
61
+ printTemplate.print(params.selections, options, ext);
62
+ }
63
+ }
64
+ function resloveListData(barCodeOption, selections) {
65
+ return new Promise((reslove, reject) => {
66
+ const fields = barCodeOption.field.split(".");
67
+ const barcodeValues = [];
68
+ if (fields.length < 2) {
69
+ reslove([]);
70
+ }
71
+ try {
72
+ getBarcodeModelsByName(fields[1]).then((res) => {
73
+ selections.forEach((selection, index) => {
74
+ const barcodeValue = {
75
+ type: fields[0],
76
+ name: fields[1],
77
+ value: null,
78
+ index
79
+ // 记录当前行索引
80
+ };
81
+ barcodeValue.value = generateCodeByRule(JSON.parse(res.barcodeModelItems), selection);
82
+ barcodeValues.push(barcodeValue);
83
+ });
84
+ reslove(barcodeValues);
85
+ });
86
+ } catch (error) {
87
+ console.error("获取条码规则失败:", error);
88
+ reslove([]);
89
+ }
90
+ });
91
+ }
92
+ function printFormData(params, barCodeOptions, printTemplate, options, ext) {
93
+ if (barCodeOptions.length > 0) {
94
+ const valuePromises = [];
95
+ barCodeOptions.forEach((barCodeOption) => {
96
+ valuePromises.push(getFormBarCodeValue(params.pageContext, barCodeOption));
97
+ });
98
+ Promise.all(valuePromises).then((barcodeRuleValues) => {
99
+ const codeValue = {};
100
+ barcodeRuleValues.forEach((item) => {
101
+ if (item.type && item.name && item.value) {
102
+ if (!codeValue[item.type]) {
103
+ codeValue[item.type] = {};
104
+ }
105
+ codeValue[item.type][item.name] = item.value;
106
+ }
107
+ });
108
+ const data = {};
109
+ Object.assign(data, params.pageContext.entity, codeValue);
110
+ printTemplate.print(data, options, ext);
111
+ });
112
+ } else {
113
+ const data = {};
114
+ Object.assign(data, params.pageContext.entity);
115
+ printTemplate.print(data, options, ext);
116
+ }
117
+ }
118
+ function getFormBarCodeValue(pageContext, barCodeOption) {
119
+ return new Promise((reslove, reject) => {
120
+ const fields = barCodeOption.field.split(".");
121
+ const barcodeRule = {
122
+ type: null,
123
+ name: null,
124
+ value: null
125
+ };
126
+ if (fields.length < 2) {
127
+ reslove(barcodeRule);
128
+ }
129
+ barcodeRule.type = fields[0];
130
+ barcodeRule.name = fields[1];
131
+ try {
132
+ getBarcodeModelsByName(barcodeRule.name).then((res) => {
133
+ const rule = JSON.parse(res.barcodeModelItems);
134
+ barcodeRule.value = generateCodeByRule(rule, pageContext.entity.data);
135
+ reslove(barcodeRule);
136
+ });
137
+ } catch (error) {
138
+ console.error("获取条码规则失败:", error);
139
+ reslove(barcodeRule);
140
+ }
141
+ });
142
+ }
143
+ function getBarcodeModelsByName(name) {
144
+ const encodedParam = encodeURIComponent(name);
145
+ return http.get(
146
+ window["$vueApp"].config.globalProperties.baseAPI + `/dc/setting-barcode-models/by-name?name=${encodedParam}`
147
+ );
148
+ }
149
+ const printLabelUtil = { printLabel };
150
+ export {
151
+ printLabelUtil as default,
152
+ printLabel
153
+ };
@@ -36,6 +36,8 @@ export declare const standardEvents: {
36
36
  retrieveTask: (params: any) => Promise<unknown>;
37
37
  viewDetail: (params: any) => void;
38
38
  lineEditCreate: (params: any) => void;
39
+ printLabel: (params: any) => void;
40
+ queryCharts: (params: any) => void;
39
41
  };
40
42
  export declare function exportFormReport(pageContext: any, configureObj: any, templateFile: any, isPdf: any): void;
41
43
  export declare function getSaveFormRequestWithRow(pageContext: any, configureObj: any, url: any, isUnControlVersion: any, mainDefaultValueColumns: any, dynamicColumnInfo: any, row: any): any;
@@ -12,6 +12,8 @@ import { setStoreInfo } from "../store-util.js";
12
12
  import { refreshPage } from "../api/api-util.js";
13
13
  import { updateWithPageValue } from "agilebuilder-ui/src/utils/jump-page-utils";
14
14
  import { getPermissionCodes } from "../page-init-util.js";
15
+ import { updateChartDatasources } from "../page-helper-util.js";
16
+ import printLabelUtil from "./print-label.js";
15
17
  const standardEvents = {
16
18
  // 表单标准事件保存save
17
19
  save: function(params) {
@@ -206,6 +208,37 @@ const standardEvents = {
206
208
  lineEditCreate: function(params) {
207
209
  console.log("列表行编辑 新建lineEditCreate--params=", params);
208
210
  return lineEditCreateFunc(params);
211
+ },
212
+ printLabel: function(params) {
213
+ console.log("打印标签 打印标签事件--params=", params);
214
+ return printLabel(params);
215
+ },
216
+ queryCharts: function(params) {
217
+ console.log("查询统计图--params=", params);
218
+ const pageContext = params.pageContext;
219
+ const chartConfigs = pageContext.initChartServiceConfigs;
220
+ if (!chartConfigs || chartConfigs.length == 0) {
221
+ console.log("无需要查询的统计图数据");
222
+ return;
223
+ }
224
+ const configure = params.configureObj;
225
+ let runtimeProps = null;
226
+ if (configure && configure.runtime) {
227
+ runtimeProps = configure.runtime.props;
228
+ }
229
+ const hisState = runtimeProps ? runtimeProps.state : void 0;
230
+ if (runtimeProps) {
231
+ runtimeProps.state = "disabled";
232
+ }
233
+ updateChartDatasources(pageContext, chartConfigs, void 0).then(() => {
234
+ if (runtimeProps) {
235
+ runtimeProps.state = hisState;
236
+ }
237
+ }).catch(() => {
238
+ if (runtimeProps) {
239
+ runtimeProps.state = hisState;
240
+ }
241
+ });
209
242
  }
210
243
  };
211
244
  function exportFormReport(pageContext, configureObj, templateFile, isPdf) {
@@ -241,7 +274,7 @@ function exportFormReport(pageContext, configureObj, templateFile, isPdf) {
241
274
  if (logSetting) {
242
275
  param["logSettingText"] = logSetting;
243
276
  }
244
- let additionalParamMap = getAdditionalParamMap(pageContext);
277
+ const additionalParamMap = getAdditionalParamMap(pageContext);
245
278
  param["additionalParamMap"] = additionalParamMap;
246
279
  let exportResult;
247
280
  if (isPdf) {
@@ -363,7 +396,6 @@ function getCommonFormRequestParam(pageContext, configureObj, isUnControlVersion
363
396
  }
364
397
  const param = {
365
398
  entity,
366
- pageModel: pageContext.entity.page,
367
399
  tableName: pageContext.tableName,
368
400
  formNoRuleCode: pageContext.formNoRuleCode,
369
401
  isWorkflowEntity: isWorkflow,
@@ -391,14 +423,6 @@ function getCommonFormRequestParam(pageContext, configureObj, isUnControlVersion
391
423
  param["dataConversionRule"] = conversionCodes;
392
424
  }
393
425
  }
394
- const autoSetValueData = configureObj.props.base.setValueList;
395
- if (autoSetValueData) {
396
- if (isArrayFn(autoSetValueData)) {
397
- param["autoSetValueData"] = autoSetValueData.join(",");
398
- } else if (typeof autoSetValueData === "string") {
399
- param["autoSetValueData"] = autoSetValueData;
400
- }
401
- }
402
426
  const logSetting = configureObj.props.logSetting;
403
427
  if (logSetting) {
404
428
  param["logSettingText"] = logSetting;
@@ -416,7 +440,7 @@ function getCommonFormRequestParam(pageContext, configureObj, isUnControlVersion
416
440
  if (mainDefaultValueColumns) {
417
441
  param["mainDefaultValueColumns"] = mainDefaultValueColumns;
418
442
  }
419
- let additionalParamMap = getAdditionalParamMap(pageContext);
443
+ const additionalParamMap = getAdditionalParamMap(pageContext);
420
444
  param["additionalParamMap"] = additionalParamMap;
421
445
  if (isUnControlVersion !== void 0) {
422
446
  param["unControlVersion"] = isUnControlVersion;
@@ -491,7 +515,7 @@ function dealAfterWithForm(pageContext, configureObj, data, successTip) {
491
515
  }
492
516
  }
493
517
  function afterSuccessOperateInForm(pageContext, configureObj, dataModel) {
494
- let successOperation = configureObj.props.base.successOperation;
518
+ const successOperation = configureObj.props.base.successOperation;
495
519
  if (!successOperation || successOperation === null) {
496
520
  return;
497
521
  }
@@ -521,7 +545,11 @@ function closeDialog(pageContext, dataModel, isNeedValueMapping) {
521
545
  const isNeedValueMappingFinal = isNeedValueMapping !== void 0 && isNeedValueMapping === true && dataModel && dataModel !== void 0;
522
546
  const parentPageCode = pageContext.entity && pageContext.entity.request ? pageContext.entity.request.parentPageCode : null;
523
547
  const eventPageInfo = parentPageCode + "_";
524
- eventBus.$emit(eventPageInfo + "close-dialog", { isNeedValueMapping: isNeedValueMappingFinal, dataModel, sourceTableName });
548
+ eventBus.$emit(eventPageInfo + "close-dialog", {
549
+ isNeedValueMapping: isNeedValueMappingFinal,
550
+ dataModel,
551
+ sourceTableName
552
+ });
525
553
  } else if (jumpMode === "openWindow" || jumpMode === "newTab") {
526
554
  if (window.parent) {
527
555
  window.parent.close();
@@ -555,7 +583,7 @@ function updateValuesWhenCloseDialog(parentPageContext, parentConfigureObj, sour
555
583
  function dealAfterWithList(pageContext, configureObj, row, successTip) {
556
584
  let successOperation = configureObj.props.base.successOperation;
557
585
  const isNeedValueMapping = configureObj.props.base.isNeedValueMapping;
558
- let tableUuid = configureObj.props.base.tableUuid;
586
+ const tableUuid = configureObj.props.base.tableUuid;
559
587
  if (!successOperation) {
560
588
  successOperation = "refresh";
561
589
  }
@@ -841,7 +869,7 @@ function doImportFinally(params, fileObj) {
841
869
  if (functionCodes) {
842
870
  param.append("functionCode", functionCodes);
843
871
  }
844
- let additionalParamMap = getAdditionalParamMap(pageContext);
872
+ const additionalParamMap = getAdditionalParamMap(pageContext);
845
873
  param.append("additionalParamMapStr", JSON.stringify(additionalParamMap));
846
874
  const isPermission = buttonConfigureBase.isPermission === void 0 || buttonConfigureBase.isPermission === "true" || buttonConfigureBase.isPermission;
847
875
  param.append("isPermission", isPermission + "");
@@ -996,14 +1024,6 @@ function getWorkflowSaveParams(params) {
996
1024
  param["dataConversionRule"] = conversionCodes;
997
1025
  }
998
1026
  }
999
- const autoSetValueData = configureObj.props.base.setValueList;
1000
- if (autoSetValueData) {
1001
- if (isArrayFn(autoSetValueData)) {
1002
- param["autoSetValueData"] = autoSetValueData.join(",");
1003
- } else if (typeof autoSetValueData === "string") {
1004
- param["autoSetValueData"] = autoSetValueData;
1005
- }
1006
- }
1007
1027
  if (pageContext.beanName) {
1008
1028
  param["beanName"] = pageContext.beanName;
1009
1029
  }
@@ -1014,7 +1034,7 @@ function getWorkflowSaveParams(params) {
1014
1034
  if (!param.systemCode) {
1015
1035
  param.systemCode = systemCode;
1016
1036
  }
1017
- let additionalParamMap = getAdditionalParamMap(pageContext);
1037
+ const additionalParamMap = getAdditionalParamMap(pageContext);
1018
1038
  param["additionalParamMap"] = additionalParamMap;
1019
1039
  if (additionalParamMap.ids && additionalParamMap.ids.length > 0) {
1020
1040
  param["ids"] = additionalParamMap.ids;
@@ -1219,7 +1239,6 @@ function doAssign(params, selectNodeInfo) {
1219
1239
  function getTransactTaskParam(params) {
1220
1240
  const pageContext = params.pageContext;
1221
1241
  const dataModel = pageContext.entity.data;
1222
- const pageModel = pageContext.entity.page;
1223
1242
  const systemCode = pageContext.systemCode;
1224
1243
  const permissionPrefix = pageContext.code;
1225
1244
  const additionalParamMap = getAdditionalParamMap(pageContext);
@@ -1228,7 +1247,6 @@ function getTransactTaskParam(params) {
1228
1247
  beanName: pageContext.beanName,
1229
1248
  id: dataId,
1230
1249
  entity: dataModel,
1231
- pageModel,
1232
1250
  additionalParamMap,
1233
1251
  tableName: pageContext.tableName,
1234
1252
  functionCode: permissionPrefix + ".xxx",
@@ -1427,7 +1445,7 @@ function getTaskInformitions(params) {
1427
1445
  return;
1428
1446
  }
1429
1447
  const permissionPrefix = pageContext.code;
1430
- let additionalParamMap = getAdditionalParamMap(pageContext);
1448
+ const additionalParamMap = getAdditionalParamMap(pageContext);
1431
1449
  const requestParams = {
1432
1450
  beanName: pageContext.beanName,
1433
1451
  additionalParamMap,
@@ -1526,6 +1544,22 @@ function lineEditCreateFunc(params) {
1526
1544
  gridRef.createRow(params);
1527
1545
  }
1528
1546
  }
1547
+ function printLabel(params) {
1548
+ let templateUuid = null;
1549
+ try {
1550
+ if (params.menuItem) {
1551
+ templateUuid = params.menuItem.templateUuid;
1552
+ } else {
1553
+ templateUuid = params.configureObj.props.base.template[0].templateUuid;
1554
+ }
1555
+ if (!templateUuid) {
1556
+ throw new Error("未找到模板");
1557
+ }
1558
+ } catch (e) {
1559
+ console.error("打印标签失败,未在配置中找到找到模板", e, params);
1560
+ }
1561
+ printLabelUtil.printLabel(params, templateUuid);
1562
+ }
1529
1563
  function isVisibleWorkflowButton(standardEventName, buttonInfo, completeTaskParam) {
1530
1564
  let isVisible = true;
1531
1565
  if (standardEventName && buttonInfo) {
@@ -339,6 +339,7 @@ function setValueForVariableName(entity, variableName, newValue) {
339
339
  setVariableValue(entity, fields, newValue);
340
340
  }
341
341
  function setVariableValue(entity, fields, newValue) {
342
+ debugger;
342
343
  if (!entity || !fields || fields.length == 0) {
343
344
  return;
344
345
  }
@@ -22,7 +22,7 @@ export declare function convertToPageContext(pageDesign: PageDesign, pageRequest
22
22
  * @param pageContext 页面对象
23
23
  * @param formItemConfigure 表单元素配置参数
24
24
  */
25
- export declare function getFormModelFields(pageContext: PageContext, formItemConfigure: Component): string[];
25
+ export declare function getFormModelFields(pageContext: PageContext, formItemConfigure: Component, prop?: string): string[];
26
26
  /**
27
27
  * 获取组件的权限编码
28
28
  * @param configure
@@ -49,9 +49,9 @@ function convertToPageContext(pageDesign, pageRequest) {
49
49
  system: {}
50
50
  }
51
51
  };
52
- if (pageDesign.props.activeWorkflow && pageDesign.props.workflowSource && pageDesign.props.workflowSource === "link") {
52
+ if (pageDesign.props && pageDesign.props.activeWorkflow && pageDesign.props.workflowSource && pageDesign.props.workflowSource === "link") {
53
53
  pageContext.workflowCode = pageDesign.props.linkWorkflowCode;
54
- } else if (pageDesign.props.activeWorkflow && pageDesign.props.workflowSource && pageDesign.props.workflowSource === "create") {
54
+ } else if (pageDesign.props && pageDesign.props.activeWorkflow && pageDesign.props.workflowSource && pageDesign.props.workflowSource === "create") {
55
55
  pageContext.workflowCode = pageDesign.props.createWorkflowCode;
56
56
  }
57
57
  if (pageDesign.variables) {
@@ -111,15 +111,21 @@ function getRequestObject(pageRequest) {
111
111
  ;
112
112
  return requestObj;
113
113
  }
114
- function getFormModelFields(pageContext, formItemConfigure) {
114
+ function getFormModelFields(pageContext, formItemConfigure, prop) {
115
115
  if (!formItemConfigure) {
116
116
  return ["temp"];
117
117
  }
118
118
  const entity = pageContext.entity;
119
- const propsBase = formItemConfigure.props.base ? formItemConfigure.props.base : {};
120
- let propName = propsBase.prop;
119
+ let propsBase;
120
+ let propName = prop;
121
+ if (!prop) {
122
+ propsBase = formItemConfigure.props.base ? formItemConfigure.props.base : {};
123
+ propName = propsBase.prop;
124
+ }
121
125
  let fields = null;
122
- if (!propName || !propName.startsWith("${")) {
126
+ if (prop) {
127
+ fields = ["data", prop];
128
+ } else if (!propName || !propName.startsWith("${")) {
123
129
  fields = ["page", formItemConfigure.uuid];
124
130
  } else {
125
131
  propName = propName.substring(2, propName.length - 1);
@@ -129,7 +135,7 @@ function getFormModelFields(pageContext, formItemConfigure) {
129
135
  }
130
136
  }
131
137
  if (entity.data.ID == void 0 && entity.data.ID == void 0) {
132
- if (propsBase.defaultValue) {
138
+ if (propsBase && propsBase.defaultValue) {
133
139
  let defaultValue = formatVariableValue(pageContext, propsBase.defaultValue);
134
140
  if (defaultValue != null && defaultValue != void 0) {
135
141
  let isMultiple = false;
@@ -204,6 +210,9 @@ function packageFormRules(pageContext, configure) {
204
210
  const prop = configure.props && configure.props.base ? configure.props.base.prop : null;
205
211
  if (prop) {
206
212
  const propName = getFormPropName(prop);
213
+ if (!pageContext.rules) {
214
+ pageContext.rules = {};
215
+ }
207
216
  if (!pageContext.rules[propName]) {
208
217
  pageContext.rules[propName] = [];
209
218
  }
@@ -1,15 +1,6 @@
1
1
  import { getBaseUrl } from "./common-util.js";
2
2
  import http from "agilebuilder-ui/src/utils/request";
3
3
  import eventBus from "./eventBus.js";
4
- function getDataTypeMap(backendUrl, tableName) {
5
- return new Promise((resolve, reject) => {
6
- getDataTypeMapRequest(backendUrl, tableName).then((dataTypeMap) => {
7
- resolve(dataTypeMap);
8
- }).catch(() => {
9
- reject(new Error("获得数据表:" + tableName + "的字段类型集合失败"));
10
- });
11
- });
12
- }
13
4
  function getDataTypeMapRequest(backendUrl, tableName) {
14
5
  const baseUrl = getBaseUrl(backendUrl);
15
6
  return http.get(baseUrl + "/dsc/commons/tables/" + tableName + "/data-types");
@@ -18,6 +9,6 @@ function popupToPage(params) {
18
9
  eventBus.$emit(params.pageCode + "_open-dialog", params);
19
10
  }
20
11
  export {
21
- getDataTypeMap,
12
+ getDataTypeMapRequest,
22
13
  popupToPage
23
14
  };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./printlabel-runtime.vue2.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,96 @@
1
+ import { defineComponent, ref, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
2
+ import "agilebuilder-ui";
3
+ import { handleEvent } from "../../../../utils/events/event-util.js";
4
+ import _sfc_main$1 from "../button/button-runtime.vue2.js";
5
+ const _hoisted_1 = { key: 1 };
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ __name: "printlabel-runtime",
8
+ props: {
9
+ pageContext: {},
10
+ configure: {}
11
+ },
12
+ setup(__props) {
13
+ const props = __props;
14
+ const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
15
+ const designProperty = ref(runtimeInfo.props ? runtimeInfo.props : {});
16
+ const showDropdown = ref(false);
17
+ if (designProperty.value.template && designProperty.value.template.length > 1) {
18
+ showDropdown.value = true;
19
+ }
20
+ const runtimeStyle = runtimeInfo.style;
21
+ const runtimeClass = runtimeInfo.class;
22
+ return (_ctx, _cache) => {
23
+ const _component_el_button = resolveComponent("el-button");
24
+ const _component_ArrowDown = resolveComponent("ArrowDown");
25
+ const _component_el_icon = resolveComponent("el-icon");
26
+ const _component_el_text = resolveComponent("el-text");
27
+ const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
28
+ const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
29
+ const _component_el_dropdown = resolveComponent("el-dropdown");
30
+ return !showDropdown.value ? (openBlock(), createBlock(_sfc_main$1, {
31
+ key: 0,
32
+ configure: _ctx.configure,
33
+ pageContext: _ctx.pageContext
34
+ }, null, 8, ["configure", "pageContext"])) : (openBlock(), createBlock(_component_el_dropdown, {
35
+ key: 1,
36
+ class: normalizeClass(unref(runtimeClass)),
37
+ style: normalizeStyle(unref(runtimeStyle)),
38
+ placement: designProperty.value.placement,
39
+ "split-button": designProperty.value.splitButton,
40
+ disabled: designProperty.value.state === "disabled",
41
+ type: designProperty.value.buttonType,
42
+ size: designProperty.value.size,
43
+ trigger: designProperty.value.trigger
44
+ }, {
45
+ dropdown: withCtx(() => [
46
+ createVNode(_component_el_dropdown_menu, null, {
47
+ default: withCtx(() => [
48
+ (openBlock(true), createElementBlock(Fragment, null, renderList(designProperty.value.template, (item, index) => {
49
+ return openBlock(), createBlock(_component_el_dropdown_item, {
50
+ key: item,
51
+ onClick: ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "click", { menuItem: item })
52
+ }, {
53
+ default: withCtx(() => [
54
+ createTextVNode(toDisplayString(item.label), 1)
55
+ ]),
56
+ _: 2
57
+ }, 1032, ["onClick"]);
58
+ }), 128))
59
+ ]),
60
+ _: 1
61
+ })
62
+ ]),
63
+ default: withCtx(() => [
64
+ designProperty.value.triggerElement === "button" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
65
+ !designProperty.value.splitButton ? (openBlock(), createBlock(_component_el_button, {
66
+ key: 0,
67
+ size: designProperty.value.size,
68
+ type: designProperty.value.buttonType,
69
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "menuClick"))
70
+ }, {
71
+ default: withCtx(() => [
72
+ createTextVNode(toDisplayString(designProperty.value.title), 1)
73
+ ]),
74
+ _: 1
75
+ }, 8, ["size", "type"])) : (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(designProperty.value.title), 1))
76
+ ], 64)) : (openBlock(), createBlock(_component_el_text, { key: 1 }, {
77
+ default: withCtx(() => [
78
+ createTextVNode(toDisplayString(designProperty.value.title) + " ", 1),
79
+ createVNode(_component_el_icon, null, {
80
+ default: withCtx(() => [
81
+ createVNode(_component_ArrowDown)
82
+ ]),
83
+ _: 1
84
+ })
85
+ ]),
86
+ _: 1
87
+ }))
88
+ ]),
89
+ _: 1
90
+ }, 8, ["class", "style", "placement", "split-button", "disabled", "type", "size", "trigger"]));
91
+ };
92
+ }
93
+ });
94
+ export {
95
+ _sfc_main as default
96
+ };
@@ -22,7 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
22
  justify: designProperty.value.flexJustify,
23
23
  gutter: designProperty.value.flexGutter,
24
24
  align: designProperty.value.alignItems,
25
- style: normalizeStyle(unref(runtimeStyle)),
25
+ style: normalizeStyle([{ "display": "flex" }, unref(runtimeStyle)]),
26
26
  class: normalizeClass(unref(runtimeClass))
27
27
  }, {
28
28
  default: withCtx(() => [
@@ -2,6 +2,7 @@ import { defineComponent, computed, ref, onMounted, watch, resolveComponent, ope
2
2
  import qrcode from "qrcode";
3
3
  import JsBarcode from "jsbarcode";
4
4
  import { getFormModelFields } from "../../../../utils/page-init-util.js";
5
+ import { generateCodeByRule } from "../../../../utils/barcode-util.js";
5
6
  import { getVariableValue, setVariableValue } from "../../../../utils/page-helper-util.js";
6
7
  import { handleEvent } from "../../../../utils/events/event-util.js";
7
8
  import "agilebuilder-ui/src/utils/request";
@@ -78,7 +79,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
78
79
  () => props.pageContext.entity.data[item.fieldName],
79
80
  (newValue, oldValue) => {
80
81
  if (newValue !== void 0 && newValue !== null) {
81
- generateCodeByRule(rule);
82
+ const codeValue = generateCodeByRule(rule, props.pageContext.entity.data);
83
+ if (codeValue) {
84
+ generateCode(codeValue);
85
+ }
82
86
  }
83
87
  }
84
88
  );
@@ -101,38 +105,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
101
105
  generateCode(barCodeValue);
102
106
  }
103
107
  }
104
- function generateCodeByRule(rule) {
105
- let allVariablesPresent = true;
106
- let value = "";
107
- rule.forEach((item) => {
108
- if (item.fieldName !== "-1" && item.fieldName !== -1) {
109
- const filedValue = props.pageContext.entity.data[item.fieldName];
110
- if (item.suppliement && item.fieldLength) {
111
- if (!filedValue) {
112
- value += "".padEnd(item.fieldLength, item.suppliement);
113
- } else {
114
- if (filedValue.length > item.fieldLength) {
115
- value += filedValue.substring(0, item.fieldLength);
116
- } else {
117
- value += filedValue.padEnd(item.fieldLength, item.suppliement);
118
- }
119
- }
120
- } else {
121
- if (!filedValue) {
122
- allVariablesPresent = false;
123
- } else {
124
- value += filedValue;
125
- }
126
- }
127
- } else {
128
- value += item.fixedValue;
129
- }
130
- });
131
- console.log(value);
132
- if (allVariablesPresent) {
133
- generateCode(value);
134
- }
135
- }
136
108
  function generateCode(value) {
137
109
  createCode(value);
138
110
  setValue(value);
@@ -4,7 +4,7 @@ import { setTableEvents, getEventFuncByType, canExecuteButton, doAfterClickEvent
4
4
  import { getListCode, getRealRestApiPath } from "../../../../utils/common-util.js";
5
5
  import { getAdditionalParamMap, getSaveFormRequestWithRow, standardEvents } from "../../../../utils/events/standard-event.js";
6
6
  import { isPromise } from "agilebuilder-ui/src/utils/common-util";
7
- import { getDataTypeMap, popupToPage } from "../../../../utils/table-utils.js";
7
+ import { getDataTypeMapRequest, popupToPage } from "../../../../utils/table-utils.js";
8
8
  import eventBus from "../../../../utils/eventBus.js";
9
9
  import { getPermissionCodes } from "../../../../utils/page-init-util.js";
10
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -22,7 +22,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
22
  const runtimeClass = runtimeInfo.class;
23
23
  const systemCode = pageContext.systemCode;
24
24
  const backendUrl = pageContext.backendUrl;
25
- const tableName = pageContext.tableName;
25
+ debugger;
26
+ const tableName = configure.props && configure.props.dataOrigin && configure.props.dataOrigin.tableName;
26
27
  let baseURL = pageContext.backendUrl;
27
28
  if (!baseURL) {
28
29
  baseURL = window["$vueApp"].config.globalProperties.baseURL;
@@ -155,7 +156,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
155
156
  if (!backendUrl && !tableName) {
156
157
  return;
157
158
  }
158
- getDataTypeMap(backendUrl, tableName).then((result) => {
159
+ getDataTypeMapRequest(backendUrl, tableName).then((result) => {
159
160
  if (!pageContext["dataTypeMaps"]) {
160
161
  pageContext["dataTypeMaps"] = {};
161
162
  }
@@ -16,8 +16,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
16
16
  const props = __props;
17
17
  const pageContext = props.pageContext;
18
18
  const configure = props.configure;
19
+ const listCode = getListCode(pageContext.code, pageContext.version, configure.uuid);
19
20
  const dataModel = pageContext.entity.data;
20
- const prop = configure.props && configure.props.base ? configure.props.base.prop : null;
21
+ const prop = listCode;
21
22
  const additionalParamMap = getAdditionalParamMap(pageContext);
22
23
  const tableEvents = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
23
24
  const selections = ref([]);
@@ -28,7 +29,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
28
29
  const runtimeStyle = runtimeInfo.style;
29
30
  const runtimeClass = runtimeInfo.class;
30
31
  const entity = props.pageContext.entity ? props.pageContext.entity : {};
31
- let dynamicFields = getFormModelFields(props.pageContext, props.configure);
32
+ let dynamicFields = getFormModelFields(props.pageContext, props.configure, prop);
32
33
  const listViewShowFlag = ref(false);
33
34
  const baseURL = window["$vueApp"].config.globalProperties.baseURL;
34
35
  const listViewOptions = ref({
@@ -50,13 +51,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
50
51
  if (runtimeClass) {
51
52
  listViewOptions.value["tableClass"] = runtimeClass;
52
53
  }
53
- if (configure.props && configure.props.base && configure.props.base.subPaging === void 0 || configure.props.base.subPaging === null || configure.props.base.subPaging === false) {
54
- listViewOptions.value.showPageArea = false;
55
- } else {
54
+ if (configure.props && configure.props.base && configure.props.base.subPaging === true) {
56
55
  listViewOptions.value.showPageArea = true;
56
+ } else {
57
+ listViewOptions.value.showPageArea = false;
57
58
  }
58
59
  const gridRef = ref(null);
59
- const listCode = getListCode(pageContext.code, pageContext.version, configure.uuid);
60
60
  function currencyListViewSetting(canRrefreshSubtableData) {
61
61
  if (canRrefreshSubtableData === void 0) {
62
62
  canRrefreshSubtableData = judgeInitializationSubTable();
@@ -115,11 +115,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
115
115
  return getVariableValue(entity, dynamicFields);
116
116
  }
117
117
  function changeInitializationSubTable(canRrefreshSubtableData) {
118
+ debugger;
118
119
  currencyListViewSetting(canRrefreshSubtableData);
119
120
  listViewOptions.value["isPageInfo"] = false;
120
- listViewOptions.value["subTableData"] = null;
121
+ listViewOptions.value["subTableData"] = getValue();
121
122
  listViewOptions.value.extraParam["subTableListViewCode"] = listCode;
122
- listViewOptions.value.extraParam["subtableSetting"] = configure.props || !configure.props.otherSettings ? JSON.stringify(configure.props.otherSettings.subtableSetting) : null;
123
+ listViewOptions.value.extraParam["subtableSetting"] = configure.props && configure.props.otherSettings ? JSON.stringify(configure.props.otherSettings.subtableSetting) : null;
123
124
  listViewOptions.value.extraParam["additionalParamMap"] = additionalParamMap;
124
125
  listViewOptions.value.extraParam["entityMap"] = pageContext.entity.data;
125
126
  setGridDataEventOptions();
@@ -129,7 +130,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
129
130
  setGridToStore();
130
131
  }, 10);
131
132
  }
132
- changeInitializationSubTable();
133
133
  function setGridDataEventOptions() {
134
134
  setSubTableValidateInfo();
135
135
  setTableEvents(listViewOptions.value, tableEvents, pageContext, configure);
@@ -164,6 +164,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
164
164
  }
165
165
  listViewOptions.value["actionPermission"] = actionPermission;
166
166
  }
167
+ if (!listViewOptions.value["operations"]) {
168
+ listViewOptions.value["operations"] = {};
169
+ }
167
170
  const subTableOperations = getOperations();
168
171
  listViewOptions.value["operations"]["operation"] = subTableOperations;
169
172
  listViewOptions.value["subTableCanAdd"] = isShowAdd();
@@ -175,6 +178,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
175
178
  pageContext.tableUuids.push(configure.uuid);
176
179
  }
177
180
  function getOperations() {
181
+ debugger;
178
182
  let operations = [];
179
183
  if (isShowAdd()) {
180
184
  const addButton = {
@@ -207,6 +211,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
207
211
  }
208
212
  return operations;
209
213
  }
214
+ changeInitializationSubTable();
210
215
  function getEntityId(row) {
211
216
  if (row && row.id) {
212
217
  return row.id;
@@ -281,6 +286,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
281
286
  gridRef.value.deleteRow(rowIndex, listCode, false);
282
287
  }
283
288
  function changeGridData(gridData) {
289
+ debugger;
284
290
  setVariableValue(entity, dynamicFields, gridData);
285
291
  }
286
292
  function changeRowsPerpage(pageSize) {
@@ -19,7 +19,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19
19
  const tableUuid = props.configure.uuid;
20
20
  const superGridItems = props.pageContext.superGridItems;
21
21
  const superGridSetting = superGridItems ? superGridItems[tableUuid] : null;
22
- tableConfigure.value = superGridSetting.configure ? JSON.parse(superGridSetting.configure) : null;
22
+ tableConfigure.value = superGridSetting ? superGridSetting.configure ? JSON.parse(superGridSetting.configure) : null : props.configure;
23
+ debugger;
23
24
  const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
24
25
  runtimeInfo.style;
25
26
  runtimeInfo.class;
@@ -71,7 +72,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
71
72
  ref_key: "gridRef",
72
73
  ref: gridRef,
73
74
  pageContext: _ctx.pageContext,
74
- configure: _ctx.configure
75
+ configure: tableConfigure.value
75
76
  }, null, 8, ["pageContext", "configure"])) : (openBlock(), createBlock(_sfc_main$2, {
76
77
  key: 1,
77
78
  ref_key: "gridRef",
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, computed, ref, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, toDisplayString, createCommentVNode } from "vue";
2
2
  import { getFormModelFields } from "../../../../utils/page-init-util.js";
3
3
  import { getVariableValue, setVariableValue } from "../../../../utils/page-helper-util.js";
4
- import { handleEvent } from "../../../../utils/events/event-util.js";
4
+ import { getCustomFunc, handleEvent } from "../../../../utils/events/event-util.js";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "datepicker-runtime",
7
7
  props: {
@@ -25,6 +25,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25
25
  const runtimeClass = runtimeInfo.class;
26
26
  const headerStyle = runtimeInfo.headerStyle;
27
27
  const designProperty = ref(runtimeInfo.props ? runtimeInfo.props : {});
28
+ if (designProperty.value.shortcutsFunc) {
29
+ const func = getCustomFunc(props.pageContext, designProperty.value.shortcutsFunc);
30
+ if (func) {
31
+ let returns = func.apply(func, [
32
+ {
33
+ pageContext: props.pageContext,
34
+ configureObj: props.configure
35
+ }
36
+ ]);
37
+ if (returns) {
38
+ if (typeof returns === "object") {
39
+ returns = [returns];
40
+ }
41
+ if (!designProperty.value.shortcuts) {
42
+ designProperty.value.shortcuts = [];
43
+ }
44
+ for (let r of returns) {
45
+ if (r.text && r.value) {
46
+ designProperty.value.shortcuts.push(r);
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
28
52
  return (_ctx, _cache) => {
29
53
  const _component_el_time_picker = resolveComponent("el-time-picker");
30
54
  const _component_el_date_picker = resolveComponent("el-date-picker");
@@ -1,6 +1,8 @@
1
- import { defineComponent, ref, watch, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, toDisplayString, createCommentVNode, createVNode } from "vue";
1
+ import { defineComponent, ref, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, toDisplayString, createCommentVNode, createVNode } from "vue";
2
2
  import { getVariableValue, setVariableValue } from "../../../../utils/page-helper-util.js";
3
- import { fileUploadBeforeUpload, fileUploadUploaded, fileUploadBeforeDelete, fileUploadDeleted } from "../../../../utils/events/event-util.js";
3
+ import { fileUploadBeforeUpload } from "../../../../utils/events/event-util.js";
4
+ import http from "agilebuilder-ui/src/utils/request";
5
+ import FsUploadNew from "agilebuilder-ui";
4
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
7
  __name: "fileupload-runtime",
6
8
  props: {
@@ -14,25 +16,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
16
  const runtimeStyle = runtimeInfo.style;
15
17
  const runtimeClass = runtimeInfo.class;
16
18
  const headerStyle = runtimeInfo.headerStyle;
17
- const fileSetObj = designProperty.value.fileSetObj;
18
- fileSetObj.beforeUpload = beforeUpload;
19
- fileSetObj.pageContext = props.pageContext;
20
- fileSetObj.configureObj = props.configure;
21
19
  const entity = props.pageContext.entity ? props.pageContext.entity : {};
22
20
  const propsBase = props.configure.props.base ? props.configure.props.base : {};
23
- propsBase.prop;
24
21
  const pathFields = getFieldsByVariable(propsBase.prop);
25
22
  const nameFields = getFieldsByVariable(propsBase.propName);
26
- const initNames = getVariableValue(entity, nameFields);
27
23
  const initPaths = getVariableValue(entity, pathFields);
28
- const fileInfo = ref({
29
- name: initNames ? initNames : "",
30
- serverPath: initPaths ? initPaths : ""
31
- });
32
- watch(fileInfo, () => {
33
- setVariableValue(entity, nameFields, fileInfo.name);
34
- setVariableValue(entity, pathFields, fileInfo.serverPath);
35
- });
24
+ const fileList = ref([]);
25
+ const fileInfo = ref({});
26
+ const baseURL = window.$vueApp.config.globalProperties.baseURL;
27
+ const baseAPI = window.$vueApp.config.globalProperties.baseAPI;
28
+ let url = baseURL;
29
+ if (!isPlateSys(props.pageContext.systemCode)) {
30
+ url = baseAPI;
31
+ }
32
+ if (initPaths) {
33
+ const uuids = initPaths.split(",");
34
+ if (uuids.length > 0) {
35
+ http.post(url + "/common/fs-upload/search-file-names").then((result) => {
36
+ const names = [];
37
+ for (let index = 0; index < uuids.length; index++) {
38
+ const uuid = uuids[index];
39
+ names.push(result[uuid]);
40
+ fileList.value.push({ showName: result[uuid], serverPath: uuid });
41
+ }
42
+ if (designProperty.value.displayType === "input") {
43
+ fileInfo.value.showName = names.join(",");
44
+ fileInfo.value.serverPath = uuids.join(",");
45
+ }
46
+ });
47
+ }
48
+ }
36
49
  function getFieldsByVariable(variableName) {
37
50
  if (!variableName) {
38
51
  return [];
@@ -45,17 +58,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
45
58
  function beforeUpload(params) {
46
59
  return fileUploadBeforeUpload(params);
47
60
  }
48
- function uploaded(params) {
49
- return fileUploadUploaded(props.pageContext, props.configure, params);
50
- }
51
- function beforeDelete(params) {
52
- return fileUploadBeforeDelete(props.pageContext, props.configure, params);
53
- }
54
- function deleted(params) {
55
- return fileUploadDeleted(props.pageContext, props.configure, params);
61
+ const onSuccess = (response, uploadFile, uploadFiles) => {
62
+ updateValue();
63
+ };
64
+ const onRemove = (file) => {
65
+ updateValue();
66
+ };
67
+ const updateValue = () => {
68
+ const names = [];
69
+ const uuids = [];
70
+ for (let index = 0; index < fileList.value.length; index++) {
71
+ names.push(fileList.value[index].showName);
72
+ uuids.push(fileList.value[index].serverPath);
73
+ }
74
+ setVariableValue(props.pageContext.entity, pathFields, uuids.join(","));
75
+ setVariableValue(props.pageContext.entity, nameFields, names.join(","));
76
+ };
77
+ function isPlateSys(systemCode) {
78
+ if (systemCode && (systemCode === "agilebuilder" || systemCode === "portal" || systemCode === "mms" || systemCode === "task" || systemCode === "wf" || systemCode === "dc" || systemCode === "mc" || systemCode === "mobile" || systemCode === "acs" || systemCode === "bs" || systemCode === "pcm")) {
79
+ return true;
80
+ } else {
81
+ return false;
82
+ }
56
83
  }
57
84
  return (_ctx, _cache) => {
58
- const _component_FsUploadList = resolveComponent("FsUploadList");
59
85
  const _component_el_form_item = resolveComponent("el-form-item");
60
86
  return designProperty.value.tittleShow ? (openBlock(), createBlock(_component_el_form_item, {
61
87
  key: 0,
@@ -71,25 +97,37 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
71
97
  }, toDisplayString(designProperty.value.title), 5)) : createCommentVNode("", true)
72
98
  ]),
73
99
  default: withCtx(() => [
74
- createVNode(_component_FsUploadList, {
100
+ createVNode(unref(FsUploadNew), {
75
101
  disabled: designProperty.value.state == "disabled",
76
- fileSetObj: designProperty.value.fileSetObj,
77
- fileInfo: fileInfo.value,
78
- onUploaded: uploaded,
79
- onBeforeDelete: beforeDelete,
80
- onDeleted: deleted
81
- }, null, 8, ["disabled", "fileSetObj", "fileInfo"])
102
+ displayType: designProperty.value.displayType,
103
+ accept: designProperty.value.accept,
104
+ multiple: designProperty.value.multiple,
105
+ placeholder: designProperty.value.placeholder,
106
+ limit: designProperty.value.limit,
107
+ "limit-file-size": designProperty.value.limitFileSize,
108
+ "file-info": fileInfo.value,
109
+ "file-list": fileList.value,
110
+ "on-success": onSuccess,
111
+ "on-remove": onRemove,
112
+ "before-upload": beforeUpload
113
+ }, null, 8, ["disabled", "displayType", "accept", "multiple", "placeholder", "limit", "limit-file-size", "file-info", "file-list"])
82
114
  ]),
83
115
  _: 1
84
- }, 8, ["required", "class", "label-width", "style"])) : (openBlock(), createBlock(_component_FsUploadList, {
116
+ }, 8, ["required", "class", "label-width", "style"])) : (openBlock(), createBlock(unref(FsUploadNew), {
85
117
  key: 1,
86
118
  disabled: designProperty.value.state == "disabled",
87
- fileSetObj: designProperty.value.fileSetObj,
88
- fileInfo: fileInfo.value,
89
- onUploaded: uploaded,
90
- onBeforeDelete: beforeDelete,
91
- onDeleted: deleted
92
- }, null, 8, ["disabled", "fileSetObj", "fileInfo"]));
119
+ displayType: designProperty.value.displayType,
120
+ accept: designProperty.value.accept,
121
+ multiple: designProperty.value.multiple,
122
+ placeholder: designProperty.value.placeholder,
123
+ limit: designProperty.value.limit,
124
+ "limit-file-size": designProperty.value.limitFileSize,
125
+ "file-info": fileInfo.value,
126
+ "file-list": fileList.value,
127
+ "on-success": onSuccess,
128
+ "on-remove": onRemove,
129
+ "before-upload": beforeUpload
130
+ }, null, 8, ["disabled", "displayType", "accept", "multiple", "placeholder", "limit", "limit-file-size", "file-info", "file-list"]));
93
131
  };
94
132
  }
95
133
  });
@@ -142,7 +142,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
142
142
  pageContext: _ctx.pageContext
143
143
  }, null, 8, ["style", "class", "configure", "pageContext"])), [
144
144
  [vShow, unref(showFlag)],
145
- [_directive_permission, unref(permissionCodes)]
145
+ [_directive_permission, unref(permissionCodes) ? unref(permissionCodes) : "true"]
146
146
  ]);
147
147
  };
148
148
  }
@@ -40,6 +40,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
40
  } catch (error) {
41
41
  console.error(error);
42
42
  }
43
+ if (dataId.value === null || dataId.value === void 0) {
44
+ dataId.value = props.parentPageEventParams["id"];
45
+ }
43
46
  }
44
47
  pageRequest.value["parentPageCode"] = myJumpPageSetting && myJumpPageSetting["parentPageCode"] ? myJumpPageSetting["parentPageCode"] : null;
45
48
  pageRequest.value["parentPageVersion"] = myJumpPageSetting && myJumpPageSetting["parentPageVersion"] ? myJumpPageSetting["parentPageVersion"] : null;
@@ -173,7 +173,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
173
173
  parentPageContext.value = params.pageContext;
174
174
  parentConfigureObj.value = params.configureObj;
175
175
  parentEventParams.value = params.eventParams;
176
- openDialog(parentConfigureObj.value);
176
+ openDialog(parentConfigureObj.value, parentEventParams.value);
177
177
  });
178
178
  eventBus.$on(
179
179
  eventPageInfo.value + "close-dialog",
@@ -181,7 +181,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
181
181
  closeDialog({ isNeedValueMapping, dataModel, sourceTableName });
182
182
  }
183
183
  );
184
- getFormData(pageContext.value);
185
184
  watch(
186
185
  () => pageContext.value.isRefresh,
187
186
  (newValue) => {
@@ -194,6 +193,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
194
193
  }
195
194
  }
196
195
  );
196
+ return getFormData(pageContext.value);
197
197
  }
198
198
  function initOptionDatas(pageContext2, optionConfigs) {
199
199
  if (!optionConfigs || optionConfigs.length == 0) {
@@ -219,28 +219,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
219
219
  }
220
220
  }
221
221
  onMounted(() => {
222
- if (props.pageDesign != null) {
223
- pageDesignResult.value = props.pageDesign;
224
- setTimeout(() => {
225
- initPageDesign(props.pageDesign);
226
- if (props.pageDesign.tableRuntimes && Object.keys(props.pageDesign.tableRuntimes).length > 0) {
227
- queryPageSuperGrids(props.pageDesign, pageContext.value, props.publishVersion).then((superGridItems) => {
228
- pageContext.value.superGridItems = superGridItems;
229
- isShowPage.value = true;
230
- }).catch(() => {
231
- isShowPage.value = true;
232
- });
233
- } else {
234
- isShowPage.value = true;
235
- }
236
- }, 0);
237
- } else if (props.pageCode) {
238
- queryPageDesignByCode(props.pageCode).then((result) => {
239
- pageDesignResult.value = result;
240
- initPageDesign(result);
241
- isShowPage.value = true;
242
- });
243
- }
222
+ initPage();
244
223
  if (thisRef.value) {
245
224
  setTimeout(() => {
246
225
  const parentNode = thisRef.value.parentNode ? thisRef.value.parentNode : thisRef.value;
@@ -251,6 +230,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
251
230
  }, 10);
252
231
  }
253
232
  });
233
+ function initPage() {
234
+ if (props.pageDesign != null) {
235
+ pageDesignResult.value = props.pageDesign;
236
+ setTimeout(() => {
237
+ initPageDesign(props.pageDesign).then(() => {
238
+ if (props.pageDesign.tableRuntimes && Object.keys(props.pageDesign.tableRuntimes).length > 0) {
239
+ queryPageSuperGrids(props.pageDesign, pageContext.value, props.publishVersion).then((superGridItems) => {
240
+ pageContext.value.superGridItems = superGridItems;
241
+ isShowPage.value = true;
242
+ }).catch(() => {
243
+ isShowPage.value = true;
244
+ });
245
+ } else {
246
+ isShowPage.value = true;
247
+ }
248
+ });
249
+ }, 0);
250
+ } else if (props.pageCode) {
251
+ queryPageDesignByCode(props.pageCode).then((appPageDesign) => {
252
+ if (appPageDesign && appPageDesign.designJson) {
253
+ const designJson = appPageDesign.designJson;
254
+ const pageConf = JSON.parse(designJson);
255
+ pageDesignResult.value = pageConf;
256
+ initPageDesign(pageConf).then(() => {
257
+ isShowPage.value = true;
258
+ });
259
+ }
260
+ });
261
+ }
262
+ }
254
263
  onUpdated(() => {
255
264
  nextTick(() => {
256
265
  if (pageContext.value && thisRef.value) {
@@ -337,16 +346,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
337
346
  doRemoveSigners(buttonParams.value, selectRemoveTasks);
338
347
  }
339
348
  const router = useRouter();
340
- function openDialog(configureObj) {
349
+ function openDialog(configureObj, eventParams) {
341
350
  const myJumpPageSetting = configureObj && configureObj["props"] && configureObj["props"].linkPage ? configureObj["props"].linkPage : null;
342
351
  if (myJumpPageSetting && myJumpPageSetting.jumpPageUrl) {
343
352
  const additionalParamMap = getAdditionalParamMap(pageContext);
344
- let dataId;
345
- let ids;
346
- if (additionalParamMap) {
347
- dataId = additionalParamMap.id;
348
- ids = additionalParamMap.ids;
349
- }
353
+ let dataId = eventParams ? eventParams.id : null;
354
+ let ids = eventParams ? eventParams.ids : null;
350
355
  const dataModel = pageContext.value.entity.data;
351
356
  const pageModel = pageContext.value.entity.page;
352
357
  let entity = {};
@@ -380,14 +385,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
380
385
  console.error("页面配置信息不存在");
381
386
  }
382
387
  }
383
- function closeDialog({ isNeedValueMapping, dataModel, sourceTableName }) {
384
- if (isNeedValueMapping) {
385
- updateValuesWhenCloseDialog(
386
- parentPageContext.value,
387
- parentConfigureObj.value,
388
- dataModel,
389
- sourceTableName
390
- );
388
+ function closeDialog(params) {
389
+ if (params) {
390
+ const isNeedValueMapping = params.isNeedValueMapping;
391
+ const dataModel = params.dataModel;
392
+ const sourceTableName = params.sourceTableName;
393
+ if (isNeedValueMapping) {
394
+ updateValuesWhenCloseDialog(
395
+ parentPageContext.value,
396
+ parentConfigureObj.value,
397
+ dataModel,
398
+ sourceTableName
399
+ );
400
+ }
391
401
  }
392
402
  parentPageContext.value = null;
393
403
  parentConfigureObj.value = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-page-runtime",
3
- "version": "2.0.25",
3
+ "version": "2.0.27",
4
4
  "description": "AgileBuilder super page runtime",
5
5
  "license": "ISC",
6
6
  "main": "dist/es/index.js",
@@ -35,7 +35,8 @@
35
35
  "vue-awesome": "^4.5.0",
36
36
  "vue-codemirror": "^6.1.1",
37
37
  "vue-draggable-plus": "^0.3.5",
38
- "vue-echarts": "^6.6.9"
38
+ "vue-echarts": "^6.6.9",
39
+ "vue-plugin-hiprint": "^0.0.56"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@element-plus/icons": "^0.0.11",
@@ -47,7 +48,7 @@
47
48
  "@vitejs/plugin-vue-jsx": "^3.1.0",
48
49
  "@vue/eslint-config-prettier": "^8.0.0",
49
50
  "@vue/test-utils": "^2.4.4",
50
- "agilebuilder-ui": "1.0.19",
51
+ "agilebuilder-ui": "1.0.22",
51
52
  "axios": "^1.6.8",
52
53
  "cypress": "^13.6.6",
53
54
  "element-plus": "^2.6.1",