super-page-runtime 2.0.10 → 2.0.15

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 (49) hide show
  1. package/dist/es/components/runtime/utils/api/api-util.d.ts +6 -1
  2. package/dist/es/components/runtime/utils/api/api-util.js +140 -2
  3. package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +279 -0
  4. package/dist/es/components/runtime/utils/charts/chart-gauge-util.js +74 -0
  5. package/dist/es/components/runtime/utils/charts/chart-pie-util.js +118 -0
  6. package/dist/es/components/runtime/utils/charts/chart-radar-util.js +100 -0
  7. package/dist/es/components/runtime/utils/charts/chart-scatter-util.js +74 -0
  8. package/dist/es/components/runtime/utils/charts/chart-util.d.ts +40 -0
  9. package/dist/es/components/runtime/utils/charts/chart-util.js +288 -14
  10. package/dist/es/components/runtime/utils/events/event-util.d.ts +5 -0
  11. package/dist/es/components/runtime/utils/events/event-util.js +42 -10
  12. package/dist/es/components/runtime/utils/events/standard-event.d.ts +1 -0
  13. package/dist/es/components/runtime/utils/events/standard-event.js +54 -5
  14. package/dist/es/components/runtime/utils/events/validator-util.d.ts +8 -0
  15. package/dist/es/components/runtime/utils/events/validator-util.js +83 -57
  16. package/dist/es/components/runtime/utils/interfaces/page-design-types.d.ts +0 -1
  17. package/dist/es/components/runtime/utils/page-helper-util.d.ts +22 -0
  18. package/dist/es/components/runtime/utils/page-helper-util.js +59 -50
  19. package/dist/es/components/runtime/utils/page-init-util.d.ts +1 -0
  20. package/dist/es/components/runtime/utils/page-init-util.js +29 -4
  21. package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +8 -3
  22. package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +34 -322
  23. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +2 -1
  24. package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue2.js +66 -12
  25. package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue2.js +91 -4
  26. package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue2.js +65 -4
  27. package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue2.js +65 -4
  28. package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +36 -1
  29. package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +1 -1
  30. package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +2 -4
  31. package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +22 -58
  32. package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +16 -3
  33. package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +10 -1
  34. package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +25 -2
  35. package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +5 -1
  36. package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +3 -2
  37. package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +14 -11
  38. package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +2 -0
  39. package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +14 -11
  40. package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +3 -1
  41. package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +4 -1
  42. package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +7 -1
  43. package/dist/es/components/runtime/views/assemblys/object-render.vue.js +2 -1
  44. package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +1 -1
  45. package/dist/es/components/runtime/views/super-page-dialog.vue.js +3 -0
  46. package/dist/es/components/runtime/views/super-page.vue.js +84 -130
  47. package/dist/es/index.d.ts +2 -2
  48. package/dist/es/index.js +2 -1
  49. package/package.json +2 -2
@@ -48,6 +48,7 @@ export declare function getSaveFormRequest(pageContext: any, configureObj: any,
48
48
  * @param isListButton
49
49
  */
50
50
  export declare function dealAfterOperate(pageContext: any, configureObj: any, data: any, successTip: any, isListButton?: boolean): void;
51
+ export declare function updateValuesWhenCloseDialog(parentPageContext: any, parentConfigureObj: any, sourceModel: any, sourceTableName: any): void;
51
52
  export declare function doImportFinally(params: any, fileObj: any): void;
52
53
  export declare function judgeDataNumber(buttonConfigureObj: any, ids: any): boolean;
53
54
  export declare function dealCompleteTaskParam(commonEntity: any, isInit: any, pageContext: any, params?: any, operationResult?: any): boolean;
@@ -2,13 +2,15 @@ import { getBaseUrl, getRealRestApiPath, isArrayFn, upperFirstCase, packageTempl
2
2
  import http from "agilebuilder-ui/src/utils/request";
3
3
  import { getI18n } from "agilebuilder-ui/src/utils/util";
4
4
  import { ElMessage, ElMessageBox } from "element-plus";
5
- import { useRoute } from "vue-router";
5
+ import { useRoute, useRouter } from "vue-router";
6
6
  import { setSessionCache, getToken } from "agilebuilder-ui/src/utils/auth";
7
7
  import { getComponentRef } from "../global-refs.js";
8
8
  import eventBus from "../eventBus.js";
9
9
  import axios from "axios";
10
- import { doAfterClickEvent } from "./event-util.js";
10
+ import { doAfterClickEvent, handleEventByEventName } from "./event-util.js";
11
11
  import { setStoreInfo } from "../store-util.js";
12
+ import { refreshPage } from "../api/api-util.js";
13
+ import { updateWithPageValue } from "agilebuilder-ui/src/utils/jump-page-utils";
12
14
  const standardEvents = {
13
15
  // 表单标准事件保存save
14
16
  save: function(params) {
@@ -67,6 +69,10 @@ const standardEvents = {
67
69
  // TODO: 待页面跳转功能完善后再实现
68
70
  back: function(params) {
69
71
  console.log("表单标准事件返回back--params=", params);
72
+ const pageContext = params.pageContext;
73
+ const dataModel = pageContext.entity ? pageContext.entity.data : {};
74
+ const isNeedValueMapping = params.configureObj.props && params.configureObj.props.base ? params.configureObj.props.base.isNeedValueMapping : false;
75
+ closeDialog(pageContext, dataModel, isNeedValueMapping);
70
76
  },
71
77
  // 列表标准事件删除delete
72
78
  delete: function(params) {
@@ -472,7 +478,6 @@ function afterSuccessOperateInForm(pageContext, configureObj, dataModel) {
472
478
  dataModel,
473
479
  isNeedValueMapping
474
480
  );
475
- pageContext.workflowCode ? true : false;
476
481
  if (!successOperation || successOperation === "" || successOperation === null) {
477
482
  successOperation = "refresh";
478
483
  }
@@ -487,14 +492,55 @@ function afterSuccessOperateInForm(pageContext, configureObj, dataModel) {
487
492
  if (route.query._t_) {
488
493
  setSessionCache(route.query._t_ + "_id", dataIdSessio);
489
494
  }
495
+ refreshPage(pageContext);
490
496
  }
491
497
  } else if (successOperation === "closeWindow" || successOperation === "closeWindowAndRefresh") {
498
+ closeDialog(pageContext, dataModel, isNeedValueMapping);
492
499
  console.log("afterSuccessOperateInForm--successOperation=--", successOperation);
493
500
  }
494
501
  }
502
+ function closeDialog(pageContext, dataModel, isNeedValueMapping) {
503
+ const jumpMode = pageContext.entity && pageContext.entity.request ? pageContext.entity.request.jumpMode : null;
504
+ if (jumpMode && jumpMode === "popup") {
505
+ const sourceTableName = pageContext.tableName;
506
+ const isNeedValueMappingFinal = isNeedValueMapping !== void 0 && isNeedValueMapping === true && dataModel && dataModel !== void 0;
507
+ const parentPageCode = pageContext.entity && pageContext.entity.request ? pageContext.entity.request.parentPageCode : null;
508
+ const eventPageInfo = parentPageCode + "_";
509
+ eventBus.$emit(eventPageInfo + "close-dialog", { isNeedValueMapping: isNeedValueMappingFinal, dataModel, sourceTableName });
510
+ } else if (jumpMode === "openWindow" || jumpMode === "newTab") {
511
+ if (window.parent) {
512
+ window.parent.close();
513
+ } else {
514
+ window.close();
515
+ }
516
+ } else {
517
+ const router = useRouter();
518
+ router.go(-1);
519
+ }
520
+ }
521
+ function updateValuesWhenCloseDialog(parentPageContext, parentConfigureObj, sourceModel, sourceTableName) {
522
+ const jumpPageSetting = parentConfigureObj.runtimeTemp && parentConfigureObj.runtimeTemp.jumpPageSetting ? parentConfigureObj.runtimeTemp.jumpPageSetting : null;
523
+ const targetTableName = parentPageContext.tableName;
524
+ console.log("update-value66-", sourceModel, sourceTableName);
525
+ updateWithPageValue(
526
+ sourceModel,
527
+ sourceTableName,
528
+ jumpPageSetting,
529
+ parentPageContext.entity.data,
530
+ targetTableName
531
+ );
532
+ const updateValueEventName = jumpPageSetting && jumpPageSetting.updateValueEvent ? jumpPageSetting.updateValueEvent : null;
533
+ handleEventByEventName(parentPageContext, parentConfigureObj, updateValueEventName, {
534
+ sourceModel,
535
+ sourceTableName,
536
+ jumpPageSetting,
537
+ entity: parentPageContext.entity.data,
538
+ targetTableName
539
+ });
540
+ }
495
541
  function dealAfterWithList(pageContext, configureObj, row, successTip) {
496
542
  let successOperation = configureObj.props.base.successOperation;
497
- configureObj.props.base.isNeedValueMapping;
543
+ const isNeedValueMapping = configureObj.props.base.isNeedValueMapping;
498
544
  const tableUuid = configureObj.props.base.tableUuid;
499
545
  if (!successOperation) {
500
546
  successOperation = "refresh";
@@ -507,6 +553,8 @@ function dealAfterWithList(pageContext, configureObj, row, successTip) {
507
553
  } else {
508
554
  console.error("tableUuid is empty");
509
555
  }
556
+ } else if (successOperation === "closeWindow" || successOperation === "closeWindowAndRefresh") {
557
+ closeDialog(pageContext, row, isNeedValueMapping);
510
558
  }
511
559
  if (successTip) {
512
560
  ElMessage({
@@ -1620,5 +1668,6 @@ export {
1620
1668
  getTaskInformitions,
1621
1669
  isVisibleWorkflowButton,
1622
1670
  judgeDataNumber,
1623
- standardEvents
1671
+ standardEvents,
1672
+ updateValuesWhenCloseDialog
1624
1673
  };
@@ -1,4 +1,12 @@
1
1
  export declare function setObjectPropRule(prop: any, rules: any, leafRule: any): {};
2
2
  export declare function validator(entity: any, rules: any, columns: any, rowIndex: any, isSql: any): any;
3
3
  export declare function validateDataModelFunc(pageContext: any, configureObj: any, isEnableRequired: any): Promise<unknown>;
4
+ /**
5
+ * 封装自定义校验规则
6
+ * @param orgCustomRules 自定义规则
7
+ * @param orgRules 原来的表单规则
8
+ * @returns 添加了自定义规则后的规则
9
+ */
10
+ export declare function packageCustomRules(orgCustomRules: any, orgRules: any): any;
4
11
  export declare function i18nValidateRulesMessage(rules: any): {};
12
+ export declare function getWorkflowRules(pageContext: any): any;
@@ -171,7 +171,7 @@ function validateDataModelFunc(pageContext, configureObj, isEnableRequired) {
171
171
  if (isEnableRequired === void 0 || isEnableRequired === null) {
172
172
  isEnableRequired = configureObj.props.verification.required;
173
173
  if (typeof isEnableRequired === "undefined") {
174
- isEnableRequired = true;
174
+ isEnableRequired = false;
175
175
  }
176
176
  }
177
177
  return validateDataModel(isEnableRequired, data, rules, pageContext);
@@ -179,11 +179,10 @@ function validateDataModelFunc(pageContext, configureObj, isEnableRequired) {
179
179
  function validateDataModel(isEnableRequired, dataModel, rules, pageContext) {
180
180
  if (isEnableRequired) {
181
181
  const isWorkflow = pageContext.workflowCode ? true : false;
182
- const customRules = pageContext.customRules;
183
182
  if (isWorkflow) {
184
- return validateWorkflowFormDataModel(dataModel, pageContext, customRules);
183
+ return validateWorkflowFormDataModel(dataModel, pageContext);
185
184
  } else {
186
- return validateCommonFormDataModel(dataModel, pageContext, rules, customRules);
185
+ return validateCommonFormDataModel(dataModel, pageContext, rules);
187
186
  }
188
187
  } else {
189
188
  return new Promise((resolve, reject) => {
@@ -191,78 +190,80 @@ function validateDataModel(isEnableRequired, dataModel, rules, pageContext) {
191
190
  });
192
191
  }
193
192
  }
194
- function validateWorkflowFormDataModel(dataModel, pageContext, customRules) {
193
+ function validateWorkflowFormDataModel(dataModel, pageContext) {
195
194
  return new Promise((resolve, reject) => {
196
195
  const additionalParamMap = pageContext.entity.request;
197
196
  const contextParameter = pageContext.entity.context;
198
197
  const taskParamMap = pageContext.entity.task;
199
198
  const isSql = true;
200
199
  const subTablePageInfo = pageContext.subTablePageInfo;
201
- let workflowFieldPermissionRules = window["$vueApp"].config.globalProperties.$getValidator(
202
- pageContext.completeTaskParam.fieldPermissions,
203
- dataModel,
204
- isSql,
205
- additionalParamMap,
206
- taskParamMap,
207
- contextParameter
208
- );
209
- workflowFieldPermissionRules = packageCustomRules(customRules, workflowFieldPermissionRules);
210
200
  let result = false;
211
- if (!workflowFieldPermissionRules) {
201
+ const handleModels = JSON.parse(JSON.stringify(dataModel));
202
+ let rules = pageContext.rules;
203
+ if (!rules) {
212
204
  result = true;
213
205
  } else {
214
- result = window["$vueApp"].config.globalProperties.$formValidator(
215
- dataModel,
216
- workflowFieldPermissionRules,
217
- isSql,
218
- additionalParamMap,
219
- taskParamMap,
220
- contextParameter,
221
- subTablePageInfo
222
- );
206
+ result = validator(handleModels, rules, null, null, true);
223
207
  }
224
- if (result !== true) {
225
- ElMessage({
226
- showClose: true,
227
- message: result + "",
228
- type: "warning"
229
- });
230
- resolve(false);
231
- } else {
232
- const validatorResult = [];
233
- const customUuids = pageContext.customValidatorUuids;
234
- if (customUuids) {
235
- customUuids.forEach((componentUuid) => {
236
- const customRef = getComponentRef(pageContext, componentUuid);
237
- if (customRef) {
238
- validatorResult.push(customRef.validator());
239
- }
240
- });
208
+ if (result === true) {
209
+ let workflowFieldPermissionRules = pageContext.workflowRules;
210
+ if (!workflowFieldPermissionRules) {
211
+ result = true;
212
+ } else {
213
+ result = window["$vueApp"].config.globalProperties.$formValidator(
214
+ dataModel,
215
+ workflowFieldPermissionRules,
216
+ isSql,
217
+ additionalParamMap,
218
+ taskParamMap,
219
+ contextParameter,
220
+ subTablePageInfo
221
+ );
241
222
  }
242
- if (validatorResult && validatorResult.length > 0) {
243
- Promise.all(validatorResult).then((values) => {
244
- if (values.includes(false)) {
245
- resolve(false);
246
- } else {
247
- if (Object.keys(dataModel).indexOf("validateErrorField") >= 0) {
248
- delete dataModel.validateErrorField;
249
- }
250
- resolve(dataModel);
251
- }
223
+ if (result !== true) {
224
+ ElMessage({
225
+ showClose: true,
226
+ message: result + "",
227
+ type: "warning"
252
228
  });
229
+ resolve(false);
253
230
  } else {
254
- if (Object.keys(dataModel).indexOf("validateErrorField") >= 0) {
255
- delete dataModel.validateErrorField;
231
+ const validatorResult = [];
232
+ const customUuids = pageContext.customValidatorUuids;
233
+ if (customUuids) {
234
+ customUuids.forEach((componentUuid) => {
235
+ const customRef = getComponentRef(pageContext, componentUuid);
236
+ if (customRef) {
237
+ validatorResult.push(customRef.validator());
238
+ }
239
+ });
240
+ }
241
+ if (validatorResult && validatorResult.length > 0) {
242
+ Promise.all(validatorResult).then((values) => {
243
+ if (values.includes(false)) {
244
+ resolve(false);
245
+ } else {
246
+ if (Object.keys(dataModel).indexOf("validateErrorField") >= 0) {
247
+ delete dataModel.validateErrorField;
248
+ }
249
+ resolve(dataModel);
250
+ }
251
+ });
252
+ } else {
253
+ if (Object.keys(dataModel).indexOf("validateErrorField") >= 0) {
254
+ delete dataModel.validateErrorField;
255
+ }
256
+ resolve(dataModel);
256
257
  }
257
- resolve(dataModel);
258
258
  }
259
+ } else {
260
+ reject(new Error(getI18n().t("superPageRuntimeMessage.formDataVerificationFailed")).message);
259
261
  }
260
262
  });
261
263
  }
262
- function validateCommonFormDataModel(dataModel, pageContext, rules, customRules) {
264
+ function validateCommonFormDataModel(dataModel, pageContext, rules) {
263
265
  return new Promise((resolve, reject) => {
264
266
  const handleModels = JSON.parse(JSON.stringify(dataModel));
265
- rules = packageCustomRules(customRules, rules);
266
267
  if (!rules) {
267
268
  resolve(handleModels);
268
269
  } else {
@@ -288,9 +289,12 @@ function validateCommonFormDataModel(dataModel, pageContext, rules, customRules)
288
289
  });
289
290
  }
290
291
  function packageCustomRules(orgCustomRules, orgRules) {
291
- if (!orgCustomRules || !orgRules) {
292
+ if (!orgCustomRules) {
292
293
  return;
293
294
  }
295
+ if (!orgRules) {
296
+ orgRules = {};
297
+ }
294
298
  const customRulesKeys = Object.keys(orgCustomRules);
295
299
  const customRules = orgCustomRules;
296
300
  customRulesKeys.forEach((key) => {
@@ -381,8 +385,30 @@ function i18nValidateRulesMessage(rules) {
381
385
  }
382
386
  return newRules;
383
387
  }
388
+ function getWorkflowRules(pageContext) {
389
+ const dataModel = pageContext.entity.data;
390
+ const pageModel = pageContext.entity.page;
391
+ const data = { ...pageModel, ...dataModel };
392
+ const additionalParamMap = pageContext.entity.request;
393
+ const contextParameter = pageContext.entity.context;
394
+ const taskParamMap = pageContext.entity.task;
395
+ const isSql = true;
396
+ let workflowFieldPermissionRules = window["$vueApp"].config.globalProperties.$getValidator(
397
+ pageContext.completeTaskParam.fieldPermissions,
398
+ data,
399
+ isSql,
400
+ additionalParamMap,
401
+ taskParamMap,
402
+ contextParameter
403
+ );
404
+ const customRules = pageContext.customRules;
405
+ workflowFieldPermissionRules = packageCustomRules(customRules, workflowFieldPermissionRules);
406
+ return workflowFieldPermissionRules;
407
+ }
384
408
  export {
409
+ getWorkflowRules,
385
410
  i18nValidateRulesMessage,
411
+ packageCustomRules,
386
412
  setObjectPropRule,
387
413
  validateDataModelFunc,
388
414
  validator
@@ -67,7 +67,6 @@ export interface PageDesign extends Component {
67
67
  name: string;
68
68
  notIdInitializationList?: Array<any>;
69
69
  subTablePageInfo?: object;
70
- customValidatorUuids?: Array<string>;
71
70
  customEvents?: Array<any>;
72
71
  }
73
72
  /**
@@ -64,6 +64,13 @@ export declare function autoSetAfterSelect(component: Component, pageContext: Pa
64
64
  * @returns
65
65
  */
66
66
  export declare function getVariableValue(entity: any, fields: string[]): any;
67
+ /**
68
+ * 设置参数值
69
+ * @param entity
70
+ * @param fields
71
+ * @param newValue 新的值
72
+ */
73
+ export declare function setValueForVariableName(entity: any, variableName: string, newValue: any): void;
67
74
  /**
68
75
  * 设置参数值
69
76
  * @param entity
@@ -71,6 +78,13 @@ export declare function getVariableValue(entity: any, fields: string[]): any;
71
78
  * @param newValue 新的值
72
79
  */
73
80
  export declare function setVariableValue(entity: any, fields: string[], newValue: any): void;
81
+ /**
82
+ * 设置参数值
83
+ * @param entity
84
+ * @param fields
85
+ * @param newValue 新的值
86
+ */
87
+ export declare function setVariableValueWithProp(entity: any, prop: string, newValue: any): void;
74
88
  /**
75
89
  * 格式化变量值
76
90
  * @param pageContext
@@ -104,3 +118,11 @@ export declare function openLink(component: Component, pageContext: PageContext)
104
118
  * @param showConditions 显示条件
105
119
  */
106
120
  export declare function caculateShowCondition(pageContext: PageContext, configure: Component, showConditions: Array<any>): any;
121
+ /**
122
+ * 监控变化的字段
123
+ * @param pageContext
124
+ * @param targetFields
125
+ * @param triggerFunc
126
+ */
127
+ export declare function monitorFieldChange(pageContext: PageContext, monitorFields: Array<string>, triggerFunc: Function): void;
128
+ export declare function getFormPropName(prop: any): any;
@@ -2,6 +2,7 @@ import http from "agilebuilder-ui/src/utils/request";
2
2
  import dayjs from "dayjs";
3
3
  import { executeExpression } from "agilebuilder-ui/src/utils/calculator/calculator-util";
4
4
  import { getComponentRef } from "./global-refs.js";
5
+ import { watch } from "vue";
5
6
  function getComponentOptionConfigs(component, pageContext2) {
6
7
  if (!component.props || !component.props.dataOrigin) {
7
8
  return;
@@ -321,6 +322,14 @@ function getVariableValue(entity, fields) {
321
322
  }
322
323
  return tempObj;
323
324
  }
325
+ function setValueForVariableName(entity, variableName, newValue) {
326
+ if (!variableName || !variableName.startsWith("${")) {
327
+ return;
328
+ }
329
+ variableName = variableName.substring(2, variableName.length - 1);
330
+ const fields = variableName.split(".");
331
+ setVariableValue(entity, fields, newValue);
332
+ }
324
333
  function setVariableValue(entity, fields, newValue) {
325
334
  if (!entity || !fields || fields.length == 0) {
326
335
  return;
@@ -467,7 +476,11 @@ function getValueFromSource(valueSource, paramName, paramType) {
467
476
  if (firstIndex > -1) {
468
477
  const tempParamName = paramName.substring(0, firstIndex);
469
478
  const newParamName = paramName.substring(firstIndex + 1);
470
- return getValueFromSource(valueSource[tempParamName], newParamName, paramType);
479
+ let childValue = valueSource[tempParamName];
480
+ if (childValue && Array.isArray(childValue) && childValue.length > 0) {
481
+ childValue = childValue[0];
482
+ }
483
+ return getValueFromSource(childValue, newParamName, paramType);
471
484
  } else {
472
485
  if (paramType == "context") {
473
486
  if (paramName == "currentDate" || paramName == "currentTime") {
@@ -477,54 +490,6 @@ function getValueFromSource(valueSource, paramName, paramType) {
477
490
  return valueSource[paramName];
478
491
  }
479
492
  }
480
- function openLink(component, pageContext2) {
481
- const linkPage = component && component.props && component.props.linkPage ? component.props.linkPage : {};
482
- if (!linkPage.linkType) {
483
- alert("未指定打开方式!");
484
- return;
485
- }
486
- let linkUrl = "";
487
- if (linkPage.linkType == "url") {
488
- linkUrl = linkPage.jumpPageUrl;
489
- if (!linkUrl) {
490
- alert("未设置链接地址!");
491
- return;
492
- }
493
- } else {
494
- if (!linkPage.jumpPageCode) {
495
- alert("未选择页面!");
496
- return;
497
- }
498
- linkUrl = "page:" + linkPage.jumpPageCode;
499
- }
500
- let appendParams = "";
501
- if (linkPage.isNeedId) {
502
- const entity = pageContext2.entity ? pageContext2.entity : {};
503
- const data = entity.data ? entity.data : {};
504
- appendParams = "id=" + (data.id ? data.id : "");
505
- }
506
- if (linkPage.appendParams) {
507
- for (const p of linkPage.appendParams) {
508
- if (!p.name) {
509
- continue;
510
- }
511
- if (appendParams.length > 0) {
512
- appendParams += "&";
513
- }
514
- appendParams += p.name + "=";
515
- appendParams += formatVariableValue(pageContext2, p.value);
516
- }
517
- }
518
- if (appendParams) {
519
- if (linkUrl.indexOf("?") == -1) {
520
- linkUrl += "?";
521
- } else {
522
- linkUrl += "&";
523
- }
524
- linkUrl += appendParams;
525
- }
526
- alert("链接到:" + linkUrl);
527
- }
528
493
  function caculateShowCondition(pageContext, configure, showConditions) {
529
494
  if (!showConditions || showConditions.length == 0 || !pageContext || !pageContext.entity) {
530
495
  return true;
@@ -603,6 +568,49 @@ function caculateShowCondition(pageContext, configure, showConditions) {
603
568
  return true;
604
569
  }
605
570
  }
571
+ function monitorFieldChange(pageContext2, monitorFields, triggerFunc) {
572
+ if (!triggerFunc || !pageContext2 || !monitorFields || monitorFields.length == 0) {
573
+ return;
574
+ }
575
+ const monitorFieldInfos = [];
576
+ const preFields = [];
577
+ for (let propName of monitorFields) {
578
+ if (propName.startsWith("${")) {
579
+ propName = propName.substring(2, propName.length - 1);
580
+ const fields = propName.split(".");
581
+ if (fields[0] === "page" || fields[0] === "task" || fields[0] === "data") {
582
+ monitorFieldInfos.push(fields);
583
+ if (!preFields.includes(fields[0])) {
584
+ preFields.push(fields[0]);
585
+ }
586
+ }
587
+ }
588
+ }
589
+ const entity = pageContext2.entity;
590
+ let firstValue = getMonitorFieldValues(monitorFieldInfos, entity);
591
+ let monitorTimeout = false;
592
+ for (let preField of preFields) {
593
+ watch(entity[preField], () => {
594
+ if (monitorTimeout) {
595
+ clearTimeout(monitorTimeout);
596
+ }
597
+ monitorTimeout = setTimeout(function() {
598
+ const newValue = getMonitorFieldValues(monitorFieldInfos, entity);
599
+ if (firstValue != newValue) {
600
+ firstValue = newValue;
601
+ triggerFunc();
602
+ }
603
+ }, 200);
604
+ });
605
+ }
606
+ }
607
+ function getMonitorFieldValues(monitorFieldInfos, entity) {
608
+ let values = "";
609
+ for (let fieldInfo of monitorFieldInfos) {
610
+ values += "_" + getVariableValue(entity, fieldInfo);
611
+ }
612
+ return values;
613
+ }
606
614
  export {
607
615
  autoSetAfterSelect,
608
616
  caculateShowCondition,
@@ -613,9 +621,10 @@ export {
613
621
  getOptionDatasFromPage,
614
622
  getValueFromSource,
615
623
  getVariableValue,
616
- openLink,
624
+ monitorFieldChange,
617
625
  queryOptionDatasources,
618
626
  queryOptions,
627
+ setValueForVariableName,
619
628
  setVariableValue,
620
629
  updateChartDatasources,
621
630
  updateOptionDatasources
@@ -36,3 +36,4 @@ export declare function getPermissionCodes(configure: Component, pageContext: Pa
36
36
  * @returns
37
37
  */
38
38
  export declare function queryPageSuperGrids(pageDesign: any, pageContext: any, publishVersion: any): Promise<any>;
39
+ export declare function packageFormRules(pageContext: PageContext, configure: any): void;
@@ -16,8 +16,7 @@ function convertToPageContext(pageDesign, pageRequest) {
16
16
  code: pageDesign.code,
17
17
  version: pageDesign.version,
18
18
  dimensions: pageDesign.dimensions,
19
- rules: pageDesign.rules,
20
- // 表单验证规则
19
+ // rules: pageDesign.rules, // 表单验证规则。在runtime object-render中实时获得
21
20
  tableUuids: pageDesign.tableUuids,
22
21
  // 表格uuid集合
23
22
  tableNames: pageDesign.tableNames,
@@ -38,8 +37,6 @@ function convertToPageContext(pageDesign, pageRequest) {
38
37
  // 无ID或taskId时初始条件配置
39
38
  subTablePageInfo: pageDesign.subTablePageInfo,
40
39
  // 列表分页信息,格式是:{列表编码: 每页显示多少条记录},表单页面中校验有分页的子表时提示使用,提示信息格式:第 {pageNum} 页第 {row} 行记录
41
- customValidatorUuids: pageDesign.customEvents,
42
- // 自定义组件启用了“自定义校验”开关的uuid集合
43
40
  entity: {
44
41
  data: {},
45
42
  task: {},
@@ -69,6 +66,7 @@ function convertToPageContext(pageDesign, pageRequest) {
69
66
  }
70
67
  Object.assign(pageContext, pageDesign);
71
68
  pageContext.dimensions = getPageDimensions();
69
+ pageContext.events = pageDesign.runtime && pageDesign.runtime.events ? pageDesign.runtime.events : [];
72
70
  return pageContext;
73
71
  }
74
72
  function getPageDimensions() {
@@ -191,10 +189,37 @@ function queryPageSuperGrids(pageDesign, pageContext, publishVersion) {
191
189
  publishVersion
192
190
  });
193
191
  }
192
+ function packageFormRules(pageContext, configure) {
193
+ const isWorkflow = pageContext.workflowCode ? true : false;
194
+ if (isWorkflow) {
195
+ const requiredRules = configure.props && configure.props.rules ? configure.props.rules.filter((item) => item.required) : null;
196
+ if (requiredRules && requiredRules.length > 0) {
197
+ requiredRules.forEach((item) => {
198
+ item.required = false;
199
+ });
200
+ }
201
+ }
202
+ const prop = configure.props && configure.props.base ? configure.props.base.prop : null;
203
+ if (prop) {
204
+ const propName = getFormPropName(prop);
205
+ if (!pageContext.rules[propName]) {
206
+ pageContext.rules[propName] = [];
207
+ }
208
+ pageContext.rules[propName] = configure.props.rules;
209
+ }
210
+ }
211
+ function getFormPropName(prop) {
212
+ if (prop && prop.indexOf("${") >= 0) {
213
+ return prop.substring(prop.indexOf(".") + 1, prop.lastIndexOf("}"));
214
+ } else {
215
+ return prop;
216
+ }
217
+ }
194
218
  export {
195
219
  convertToPageContext,
196
220
  getFormModelFields,
197
221
  getPermissionCodes,
222
+ packageFormRules,
198
223
  queryPageDesignByCode,
199
224
  queryPageSuperGrids
200
225
  };
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, computed, ref, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
2
2
  import { ArrowDown } from "@element-plus/icons-vue";
3
3
  import { formatVariableValue } from "../../../../utils/page-helper-util.js";
4
+ import { handleEvent } from "../../../../utils/events/event-util.js";
4
5
  const _hoisted_1 = { key: 1 };
5
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
7
  __name: "dropdown-runtime",
@@ -65,12 +66,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
65
66
  createVNode(_component_el_dropdown_menu, null, {
66
67
  default: withCtx(() => [
67
68
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(listOptions), (item, index) => {
68
- return openBlock(), createBlock(_component_el_dropdown_item, { key: item }, {
69
+ return openBlock(), createBlock(_component_el_dropdown_item, {
70
+ key: item,
71
+ onClick: ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "menuClick", { menuItem: item })
72
+ }, {
69
73
  default: withCtx(() => [
70
74
  createTextVNode(toDisplayString(item.label), 1)
71
75
  ]),
72
76
  _: 2
73
- }, 1024);
77
+ }, 1032, ["onClick"]);
74
78
  }), 128))
75
79
  ]),
76
80
  _: 1
@@ -81,7 +85,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
81
85
  !unref(designProperty).splitButton ? (openBlock(), createBlock(_component_el_button, {
82
86
  key: 0,
83
87
  size: unref(designProperty).size,
84
- type: unref(designProperty).buttonType
88
+ type: unref(designProperty).buttonType,
89
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "menuClick"))
85
90
  }, {
86
91
  default: withCtx(() => [
87
92
  createTextVNode(toDisplayString(unref(designProperty).title), 1)