@ibiz-template/runtime 0.7.5 → 0.7.7-dev.0

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 (64) hide show
  1. package/dist/index.esm.js +540 -64
  2. package/dist/index.system.min.js +1 -1
  3. package/out/application.d.ts +1 -9
  4. package/out/application.d.ts.map +1 -1
  5. package/out/application.js +1 -2
  6. package/out/controller/common/view/view.controller.d.ts +11 -0
  7. package/out/controller/common/view/view.controller.d.ts.map +1 -1
  8. package/out/controller/common/view/view.controller.js +26 -2
  9. package/out/controller/control/dashboard/custom-dashboard.controller.d.ts +80 -6
  10. package/out/controller/control/dashboard/custom-dashboard.controller.d.ts.map +1 -1
  11. package/out/controller/control/dashboard/custom-dashboard.controller.js +109 -14
  12. package/out/controller/control/dashboard/dashboard.controller.d.ts +8 -0
  13. package/out/controller/control/dashboard/dashboard.controller.d.ts.map +1 -1
  14. package/out/controller/control/dashboard/dashboard.controller.js +17 -0
  15. package/out/controller/control/dashboard/portlet/chart-portlet/chart-portlet.controller.d.ts +7 -0
  16. package/out/controller/control/dashboard/portlet/chart-portlet/chart-portlet.controller.d.ts.map +1 -1
  17. package/out/controller/control/dashboard/portlet/chart-portlet/chart-portlet.controller.js +11 -0
  18. package/out/controller/control/dashboard/portlet/list-portlet/list-portlet.controller.d.ts +7 -0
  19. package/out/controller/control/dashboard/portlet/list-portlet/list-portlet.controller.d.ts.map +1 -1
  20. package/out/controller/control/dashboard/portlet/list-portlet/list-portlet.controller.js +11 -0
  21. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.d.ts +31 -2
  22. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.d.ts.map +1 -1
  23. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.js +62 -15
  24. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.state.d.ts +15 -0
  25. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.state.d.ts.map +1 -1
  26. package/out/controller/control/dashboard/portlet/view-portlet/view-portlet.controller.d.ts +7 -0
  27. package/out/controller/control/dashboard/portlet/view-portlet/view-portlet.controller.d.ts.map +1 -1
  28. package/out/controller/control/dashboard/portlet/view-portlet/view-portlet.controller.js +12 -0
  29. package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
  30. package/out/controller/control/form/form/form.controller.js +2 -1
  31. package/out/controller/control/grid/grid/grid.controller.d.ts +8 -0
  32. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  33. package/out/controller/control/grid/grid/grid.controller.js +34 -0
  34. package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
  35. package/out/controller/control/tree/tree.controller.js +1 -1
  36. package/out/controller/control/wizard-panel/wizard-panel.controller.d.ts +18 -0
  37. package/out/controller/control/wizard-panel/wizard-panel.controller.d.ts.map +1 -1
  38. package/out/controller/control/wizard-panel/wizard-panel.controller.js +70 -1
  39. package/out/engine/md-view.engine.d.ts.map +1 -1
  40. package/out/engine/md-view.engine.js +4 -1
  41. package/out/interface/common/i-app-service/i-app-service.d.ts +1 -9
  42. package/out/interface/common/i-app-service/i-app-service.d.ts.map +1 -1
  43. package/out/interface/controller/controller/control/portlet/i-portlet.controller.d.ts +14 -0
  44. package/out/interface/controller/controller/control/portlet/i-portlet.controller.d.ts.map +1 -1
  45. package/out/interface/controller/controller/view/i-view.controller.d.ts +8 -0
  46. package/out/interface/controller/controller/view/i-view.controller.d.ts.map +1 -1
  47. package/out/interface/controller/event/control/i-dashboard.event.d.ts +15 -1
  48. package/out/interface/controller/event/control/i-dashboard.event.d.ts.map +1 -1
  49. package/out/interface/controller/state/control/i-wizard-panel.state.d.ts +7 -0
  50. package/out/interface/controller/state/control/i-wizard-panel.state.d.ts.map +1 -1
  51. package/out/interface/controller/state/control/portlet/i-portlet.state.d.ts +15 -0
  52. package/out/interface/controller/state/control/portlet/i-portlet.state.d.ts.map +1 -1
  53. package/out/interface/controller/state/view/i-view.state.d.ts +8 -0
  54. package/out/interface/controller/state/view/i-view.state.d.ts.map +1 -1
  55. package/out/service/de-service-util.d.ts.map +1 -1
  56. package/out/service/de-service-util.js +11 -2
  57. package/out/service/service/util/util.service.d.ts +55 -5
  58. package/out/service/service/util/util.service.d.ts.map +1 -1
  59. package/out/service/service/util/util.service.js +108 -6
  60. package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
  61. package/out/service/vo/tree-node-data/tree-node-data.js +7 -1
  62. package/out/utils/error-handler/default-error-handler.d.ts.map +1 -1
  63. package/out/utils/error-handler/default-error-handler.js +3 -0
  64. package/package.json +4 -4
package/dist/index.esm.js CHANGED
@@ -97,6 +97,8 @@ var DefaultErrorHandler = class {
97
97
  } else if (error instanceof HttpError) {
98
98
  if (error.status === 401) {
99
99
  ibiz.message.error("\u6CA1\u6709\u6CE8\u518C\u65E0\u6743\u9650\u9519\u8BEF\u5904\u7406\u5668");
100
+ } else if (error.status === 404) {
101
+ ibiz.mc.error.send(error);
100
102
  } else {
101
103
  ibiz.notification.error({
102
104
  title: "",
@@ -12432,11 +12434,62 @@ var UtilService = class {
12432
12434
  /**
12433
12435
  * Creates an instance of UtilService.
12434
12436
  * @author tony001
12435
- * @date 2024-04-23 11:04:49
12436
- * @param {IApplication} appModel
12437
+ * @date 2024-04-24 14:04:41
12438
+ * @param {IAppUtil} appUtil
12437
12439
  */
12438
- constructor(appModel) {
12439
- this.appModel = appModel;
12440
+ constructor(appUtil) {
12441
+ this.appUtil = appUtil;
12442
+ /**
12443
+ * 存储实体模型
12444
+ *
12445
+ * @author tony001
12446
+ * @date 2024-04-24 15:04:36
12447
+ * @type {(IAppDataEntity | null)}
12448
+ */
12449
+ this.stoageAppDataEntity = null;
12450
+ /**
12451
+ * 存储服务
12452
+ *
12453
+ * @author tony001
12454
+ * @date 2024-04-24 14:04:36
12455
+ * @type {(IAppDEService | null)}
12456
+ */
12457
+ this.appDEService = null;
12458
+ }
12459
+ /**
12460
+ * 获取存储服务
12461
+ *
12462
+ * @author tony001
12463
+ * @date 2024-04-24 14:04:21
12464
+ * @private
12465
+ * @param {IContext} context
12466
+ * @param {IParams} params
12467
+ * @return {*} {Promise<IAppDEService>}
12468
+ */
12469
+ async getAppDEService(context) {
12470
+ if (this.appDEService) {
12471
+ return this.appDEService;
12472
+ }
12473
+ const { appId: appId2, name, stoageAppDataEntityId } = this.appUtil;
12474
+ if (appId2 && stoageAppDataEntityId) {
12475
+ const app = ibiz.hub.getApp(appId2);
12476
+ this.stoageAppDataEntity = await ibiz.hub.getAppDataEntity(
12477
+ stoageAppDataEntityId,
12478
+ appId2
12479
+ );
12480
+ const appDEService = await app.deService.getService(
12481
+ context,
12482
+ stoageAppDataEntityId
12483
+ );
12484
+ if (appDEService) {
12485
+ this.appDEService = appDEService;
12486
+ return appDEService;
12487
+ }
12488
+ throw new Error(
12489
+ "\u5E94\u7528\u529F\u80FD[".concat(name, "]\u672A\u627E\u5230\u5B58\u50A8\u5B9E\u4F53[").concat(stoageAppDataEntityId, "]")
12490
+ );
12491
+ }
12492
+ throw new Error("\u5E94\u7528\u529F\u80FD[".concat(name, "]\u4E0D\u5B58\u5728"));
12440
12493
  }
12441
12494
  /**
12442
12495
  * 加载指定数据
@@ -12449,7 +12502,20 @@ var UtilService = class {
12449
12502
  * @return {*} {Promise<IData>}
12450
12503
  */
12451
12504
  async load(tag, context, params) {
12452
- throw new Error("\u6682\u672A\u5B9E\u73B0");
12505
+ const tempContext = context.clone();
12506
+ const dataService = await this.getAppDEService(tempContext);
12507
+ tempContext[this.stoageAppDataEntity.codeName.toLowerCase()] = tag;
12508
+ const { getAppDEActionId } = this.appUtil;
12509
+ try {
12510
+ const res = await dataService.exec(
12511
+ getAppDEActionId || "get",
12512
+ tempContext,
12513
+ params
12514
+ );
12515
+ return this.handleResponse(res);
12516
+ } catch (error) {
12517
+ return {};
12518
+ }
12453
12519
  }
12454
12520
  /**
12455
12521
  * 保存指定数据
@@ -12463,12 +12529,69 @@ var UtilService = class {
12463
12529
  * @return {*} {Promise<IData>}
12464
12530
  */
12465
12531
  async save(tag, context, params, data) {
12466
- throw new Error("\u6682\u672A\u5B9E\u73B0");
12532
+ const dataService = await this.getAppDEService(context);
12533
+ const {
12534
+ context: tempContext,
12535
+ params: tempParams,
12536
+ data: tempData
12537
+ } = this.handleRequestData(tag, context, params, data);
12538
+ return dataService.exec("save", tempContext, tempData, tempParams);
12539
+ }
12540
+ /**
12541
+ * 处理请求数据
12542
+ *
12543
+ * @author tony001
12544
+ * @date 2024-04-24 15:04:02
12545
+ * @private
12546
+ * @param {IContext} context
12547
+ * @param {IParams} params
12548
+ * @param {IData} data
12549
+ * @return {*} {{ context: IContext; params: IParams; data: IData }}
12550
+ */
12551
+ handleRequestData(tag, context, params, data) {
12552
+ const {
12553
+ modelIdAppDEFieldId,
12554
+ modelAppDEFieldId,
12555
+ appIdAppDEFieldId,
12556
+ userIdAppDEFieldId,
12557
+ stoageAppDataEntityId
12558
+ } = this.appUtil;
12559
+ if (!this.stoageAppDataEntity) {
12560
+ throw new Error("\u672A\u627E\u5230\u5B58\u50A8\u5B9E\u4F53[".concat(stoageAppDataEntityId, "]"));
12561
+ }
12562
+ const tempContext = context.clone();
12563
+ const tempData = {};
12564
+ tempContext[this.stoageAppDataEntity.codeName.toLowerCase()] = tag;
12565
+ const { keyAppDEFieldId } = this.stoageAppDataEntity;
12566
+ tempData[keyAppDEFieldId] = tag;
12567
+ tempData[modelIdAppDEFieldId] = params == null ? void 0 : params.modelId;
12568
+ tempData[modelAppDEFieldId] = JSON.stringify(data);
12569
+ tempData[appIdAppDEFieldId] = tempContext.srfappid;
12570
+ tempData[userIdAppDEFieldId] = tempContext.srfpersonid;
12571
+ tempData.type = params == null ? void 0 : params.type;
12572
+ tempData.owner_type = params == null ? void 0 : params.ownerType;
12573
+ tempData.owner_id = params == null ? void 0 : params.ownerId;
12574
+ return { context: tempContext, params, data: tempData };
12575
+ }
12576
+ /**
12577
+ * 处理响应数据
12578
+ *
12579
+ * @author tony001
12580
+ * @date 2024-04-24 16:04:45
12581
+ * @private
12582
+ * @param {IData} response
12583
+ * @return {*} {IData}
12584
+ */
12585
+ handleResponse(response) {
12586
+ const { data } = response;
12587
+ const { modelAppDEFieldId } = this.appUtil;
12588
+ return JSON.parse(data[modelAppDEFieldId]);
12467
12589
  }
12468
12590
  };
12469
12591
 
12470
12592
  // src/service/vo/tree-node-data/tree-node-data.ts
12471
12593
  import { createUUID as createUUID5 } from "qx-util";
12594
+ import { isBase64Image } from "@ibiz-template/core";
12472
12595
  var TreeNodeData = class {
12473
12596
  constructor(model, parentNodeData, opts) {
12474
12597
  this._uuid = createUUID5();
@@ -12515,7 +12638,11 @@ var TreeNodeData = class {
12515
12638
  icon.imagePath = sysImage.imagePath;
12516
12639
  }
12517
12640
  if (sysImage.rawContent) {
12518
- icon.htmlStr = sysImage.rawContent;
12641
+ if (isBase64Image(sysImage.rawContent)) {
12642
+ icon.imagePath = sysImage.rawContent;
12643
+ } else {
12644
+ icon.htmlStr = sysImage.rawContent;
12645
+ }
12519
12646
  }
12520
12647
  }
12521
12648
  return Object.values(icon).length > 0 ? icon : void 0;
@@ -13362,7 +13489,7 @@ var MqttService = class {
13362
13489
  };
13363
13490
 
13364
13491
  // src/service/de-service-util.ts
13365
- import { RuntimeError as RuntimeError24 } from "@ibiz-template/core";
13492
+ import { HttpError as HttpError6, RuntimeError as RuntimeError24 } from "@ibiz-template/core";
13366
13493
  var _DEServiceUtil = class _DEServiceUtil {
13367
13494
  /**
13368
13495
  * Creates an instance of DEServiceUtil.
@@ -13514,7 +13641,21 @@ var _DEServiceUtil = class _DEServiceUtil {
13514
13641
  */
13515
13642
  async exec(appDataEntityId, methodName, context, params, params2, header) {
13516
13643
  const service = await this.getService(context, appDataEntityId);
13517
- return service.exec(methodName, context, params, params2, header);
13644
+ try {
13645
+ const result = await service.exec(
13646
+ methodName,
13647
+ context,
13648
+ params,
13649
+ params2,
13650
+ header
13651
+ );
13652
+ return result;
13653
+ } catch (error) {
13654
+ if (error instanceof HttpError6) {
13655
+ error.tag = context.srfviewid;
13656
+ }
13657
+ throw error;
13658
+ }
13518
13659
  }
13519
13660
  };
13520
13661
  /**
@@ -13872,7 +14013,6 @@ var Application = class {
13872
14013
  this.deService = new DEServiceUtil(model);
13873
14014
  this.codeList = new CodeListService(model);
13874
14015
  this.authority = new AuthorityService(model);
13875
- this.utilservice = new UtilService(model);
13876
14016
  }
13877
14017
  /**
13878
14018
  * 当前应用标识
@@ -14203,7 +14343,11 @@ var TreeGridExNotifyState = /* @__PURE__ */ ((TreeGridExNotifyState2) => {
14203
14343
 
14204
14344
  // src/controller/common/view/view.controller.ts
14205
14345
  import { notNilEmpty as notNilEmpty7 } from "qx-util";
14206
- import { IBizContext as IBizContext3, RuntimeError as RuntimeError34 } from "@ibiz-template/core";
14346
+ import {
14347
+ HttpError as HttpError7,
14348
+ IBizContext as IBizContext3,
14349
+ RuntimeError as RuntimeError34
14350
+ } from "@ibiz-template/core";
14207
14351
  import { isEmpty as isEmpty9, isNil as isNil22, isNotNil as isNotNil2 } from "ramda";
14208
14352
 
14209
14353
  // src/controller/utils/loading/loading.state.ts
@@ -15895,6 +16039,7 @@ var ViewController = class extends BaseController {
15895
16039
  this.modal = new Modal({});
15896
16040
  this.providers = {};
15897
16041
  this.engines = [];
16042
+ this.error = {};
15898
16043
  this.slotProps = {};
15899
16044
  this.counters = {};
15900
16045
  /**
@@ -15918,6 +16063,7 @@ var ViewController = class extends BaseController {
15918
16063
  }
15919
16064
  this.ctx.init(this);
15920
16065
  this.initEngines();
16066
+ this.handleViewError = this.handleViewError.bind(this);
15921
16067
  }
15922
16068
  get _evt() {
15923
16069
  return this.evt;
@@ -16010,7 +16156,8 @@ var ViewController = class extends BaseController {
16010
16156
  appCounterRefs.map(async (counterRef) => {
16011
16157
  const counter = await CounterService.getCounterByRef(
16012
16158
  counterRef,
16013
- this.context
16159
+ this.context,
16160
+ { ...this.params }
16014
16161
  );
16015
16162
  this.counters[counterRef.id] = counter;
16016
16163
  })
@@ -16028,6 +16175,7 @@ var ViewController = class extends BaseController {
16028
16175
  this.state.srfactiveviewdata = null;
16029
16176
  this.state.viewMessages = {};
16030
16177
  this.state.isClosing = false;
16178
+ this.state.hasError = false;
16031
16179
  }
16032
16180
  async onCreated() {
16033
16181
  await super.onCreated();
@@ -16072,6 +16220,7 @@ var ViewController = class extends BaseController {
16072
16220
  if (this.engines.length) {
16073
16221
  await Promise.all(this.engines.map((engine2) => engine2.onCreated()));
16074
16222
  }
16223
+ ibiz.mc.error.on(this.handleViewError);
16075
16224
  }
16076
16225
  async onMounted() {
16077
16226
  var _a;
@@ -16098,6 +16247,7 @@ var ViewController = class extends BaseController {
16098
16247
  }
16099
16248
  this.context.destroy();
16100
16249
  ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name, "](").concat(this.model.id, ")\u9500\u6BC1"));
16250
+ ibiz.mc.error.off(this.handleViewError);
16101
16251
  }
16102
16252
  /**
16103
16253
  * 处理上下文和导航参数相关的,如自定义导航参数的处理
@@ -16112,6 +16262,7 @@ var ViewController = class extends BaseController {
16112
16262
  const domain = ibiz.uiDomainManager.create(this.id);
16113
16263
  this.context.srfsessionid = domain.id;
16114
16264
  }
16265
+ this.context.srfviewid = this.id;
16115
16266
  const navContexts = this.model.appViewNavContexts;
16116
16267
  let context = {};
16117
16268
  if (notNilEmpty7(navContexts)) {
@@ -16268,6 +16419,21 @@ var ViewController = class extends BaseController {
16268
16419
  );
16269
16420
  }
16270
16421
  }
16422
+ /**
16423
+ * 处理视图错误
16424
+ *
16425
+ * @author tony001
16426
+ * @date 2024-04-28 12:04:27
16427
+ * @protected
16428
+ * @param {IPortalMessage} msg
16429
+ */
16430
+ handleViewError(msg) {
16431
+ const { type, data } = msg;
16432
+ if (type === "ERROR" && data instanceof HttpError7 && data.tag === this.id) {
16433
+ this.error = data;
16434
+ this.state.hasError = true;
16435
+ }
16436
+ }
16271
16437
  };
16272
16438
 
16273
16439
  // src/controller/common/view/app-data-upload-view.controller.ts
@@ -16588,7 +16754,7 @@ var CodeListEditorController = class extends EditorController {
16588
16754
 
16589
16755
  // src/controller/common/control/control.controller.ts
16590
16756
  import {
16591
- HttpError as HttpError6,
16757
+ HttpError as HttpError8,
16592
16758
  IBizContext as IBizContext4,
16593
16759
  IBizParams,
16594
16760
  NoticeError as NoticeError2,
@@ -16955,7 +17121,7 @@ var ControlController = class extends BaseController {
16955
17121
  return;
16956
17122
  }
16957
17123
  if (opts == null ? void 0 : opts.error) {
16958
- if (opts.error instanceof HttpError6 && opts.error.status !== 500) {
17124
+ if (opts.error instanceof HttpError8 && opts.error.status !== 500) {
16959
17125
  throw opts.error;
16960
17126
  }
16961
17127
  ibiz.log.error(opts.error);
@@ -22096,6 +22262,23 @@ var DashboardController = class extends ControlController {
22096
22262
  })
22097
22263
  );
22098
22264
  }
22265
+ /**
22266
+ * 初始化
22267
+ *
22268
+ * @param {IData} [config={}]
22269
+ * @return {*} {Promise<void>}
22270
+ * @memberof DashboardController
22271
+ */
22272
+ async initPortletsConfig(config = {}) {
22273
+ Object.keys(config).forEach((key) => {
22274
+ const portlet = this.portlets[key];
22275
+ if (portlet) {
22276
+ portlet.config = config[key];
22277
+ portlet.state.title = portlet.config.srftitle;
22278
+ Object.assign(portlet.params, portlet.config);
22279
+ }
22280
+ });
22281
+ }
22099
22282
  /**
22100
22283
  * 通知所有表单成员表单操作过程中的数据变更
22101
22284
  *
@@ -22113,6 +22296,7 @@ var DashboardController = class extends ControlController {
22113
22296
  };
22114
22297
 
22115
22298
  // src/controller/control/dashboard/custom-dashboard.controller.ts
22299
+ import { merge } from "lodash-es";
22116
22300
  var CustomDashboardController = class {
22117
22301
  /**
22118
22302
  * Creates an instance of BaseController.
@@ -22120,7 +22304,7 @@ var CustomDashboardController = class {
22120
22304
  * @date 2023-04-26 06:46:21
22121
22305
  * @param {CTX} ctx 跨组件上下文环境,内部机制不暴露
22122
22306
  */
22123
- constructor(model) {
22307
+ constructor(model, dashboard) {
22124
22308
  /**
22125
22309
  * 自定义布局模型数据
22126
22310
  *
@@ -22143,19 +22327,93 @@ var CustomDashboardController = class {
22143
22327
  */
22144
22328
  this.layoutRowH = 80;
22145
22329
  /**
22146
- * 看板模型
22330
+ * 门户配置
22147
22331
  *
22148
- * @author: zhujiamin
22149
- * @Date: 2023-09-20 16:43:39
22332
+ * @type {IData}
22333
+ * @memberof CustomDashboardController
22150
22334
  */
22151
- this.model = null;
22152
- var _a, _b;
22335
+ this.portletConfig = {};
22336
+ /**
22337
+ * 自定义定制范围类型(public:公开,personal:个人,data:数据,默认是按照个人区分,配置了应用功能组件才生效)
22338
+ *
22339
+ * @author tony001
22340
+ * @date 2024-04-24 19:04:47
22341
+ * @type {('public' | 'personal' | 'data')}
22342
+ */
22343
+ this.type = "personal";
22344
+ /**
22345
+ * 所属数据类型(仅限自定义定制为data类型时生效,配置了应用功能组件才生效)
22346
+ *
22347
+ * @author tony001
22348
+ * @date 2024-04-24 19:04:06
22349
+ * @type {string}
22350
+ */
22351
+ this.ownerType = "";
22352
+ /**
22353
+ * 所属数据标识(仅限自定义定制为data类型时生效,配置了应用功能组件才生效)
22354
+ *
22355
+ * @author tony001
22356
+ * @date 2024-04-24 19:04:18
22357
+ * @type {string}
22358
+ */
22359
+ this.ownerId = "";
22153
22360
  this.model = model;
22154
- this.config = new ConfigService(
22155
- model.appId,
22156
- "dynadashboard",
22157
- "dashboard_".concat(((_a = this.model.appDataEntityId) == null ? void 0 : _a.toLowerCase()) || "app", "_").concat((_b = this.model.codeName) == null ? void 0 : _b.toLowerCase())
22158
- );
22361
+ this.context = dashboard.context;
22362
+ this.params = dashboard.params;
22363
+ this.init(dashboard.controlParams);
22364
+ }
22365
+ /**
22366
+ * 初始化
22367
+ *
22368
+ * @author tony001
22369
+ * @date 2024-04-24 20:04:14
22370
+ * @private
22371
+ */
22372
+ init(controlParams) {
22373
+ var _a, _b;
22374
+ this.type = "personal";
22375
+ this.ownerId = this.context.srfpersonid;
22376
+ if (controlParams.type) {
22377
+ this.type = controlParams.type;
22378
+ }
22379
+ if (controlParams.owner_type) {
22380
+ this.ownerType = controlParams.owner_type;
22381
+ }
22382
+ if (controlParams.owner_id) {
22383
+ this.ownerId = this.context[controlParams.owner_id];
22384
+ }
22385
+ if (this.model.appDynaDashboardUtilId) {
22386
+ const app = ibiz.hub.getApp(this.context.srfappid);
22387
+ this.util = new UtilService(
22388
+ app.getAppUtil(this.model.appDynaDashboardUtilId)
22389
+ );
22390
+ } else {
22391
+ this.config = new ConfigService(
22392
+ this.model.appId,
22393
+ "dynadashboard",
22394
+ "dashboard_".concat(((_a = this.model.appDataEntityId) == null ? void 0 : _a.toLowerCase()) || "app", "_").concat((_b = this.model.codeName) == null ? void 0 : _b.toLowerCase())
22395
+ );
22396
+ }
22397
+ }
22398
+ /**
22399
+ * 获取资源标识
22400
+ *
22401
+ * @author tony001
22402
+ * @date 2024-04-24 14:04:55
22403
+ * @private
22404
+ * @return {*} {string}
22405
+ */
22406
+ getResourceTag() {
22407
+ var _a, _b;
22408
+ const base = "".concat(this.context.srfappid, "_dashboard_").concat(((_a = this.model.appDataEntityId) == null ? void 0 : _a.toLowerCase()) || "app", "_").concat((_b = this.model.codeName) == null ? void 0 : _b.toLowerCase());
22409
+ switch (this.type) {
22410
+ case "personal":
22411
+ return "".concat(base, "_").concat(this.context.srfpersonid);
22412
+ case "data":
22413
+ return "".concat(base, "_").concat(this.ownerType, "_").concat(this.ownerId);
22414
+ default:
22415
+ return base;
22416
+ }
22159
22417
  }
22160
22418
  /**
22161
22419
  * 加载自定义布局模型数据
@@ -22164,7 +22422,16 @@ var CustomDashboardController = class {
22164
22422
  * @Date: 2023-09-20 16:22:49
22165
22423
  */
22166
22424
  async loadCustomModelData() {
22167
- const res = await this.config.load();
22425
+ let res;
22426
+ if (this.model.appDynaDashboardUtilId) {
22427
+ res = await this.util.load(
22428
+ this.getResourceTag(),
22429
+ this.context,
22430
+ this.params
22431
+ );
22432
+ } else {
22433
+ res = await this.config.load();
22434
+ }
22168
22435
  if (res.model) {
22169
22436
  this.customModelData = res.model;
22170
22437
  }
@@ -22174,7 +22441,10 @@ var CustomDashboardController = class {
22174
22441
  if (res.rowH) {
22175
22442
  this.layoutRowH = res.rowH;
22176
22443
  }
22177
- return this.customModelData;
22444
+ if (res.config) {
22445
+ this.portletConfig = res.config;
22446
+ }
22447
+ return { model: this.customModelData, config: this.portletConfig };
22178
22448
  }
22179
22449
  /**
22180
22450
  * 保存自定义布局模型数据
@@ -22182,19 +22452,42 @@ var CustomDashboardController = class {
22182
22452
  * @author: zhujiamin
22183
22453
  * @Date: 2023-09-20 16:22:49
22184
22454
  */
22185
- async saveCustomModelData(model) {
22186
- const res = await this.config.save({
22455
+ async saveCustomModelData(model, config = {}) {
22456
+ merge(this.portletConfig, config);
22457
+ let res;
22458
+ const data = {
22187
22459
  model,
22188
22460
  colNum: this.layoutColNum,
22189
- rowH: this.layoutRowH
22190
- });
22461
+ rowH: this.layoutRowH,
22462
+ config: this.portletConfig
22463
+ };
22464
+ if (this.model.appDynaDashboardUtilId) {
22465
+ res = await this.util.save(
22466
+ this.getResourceTag(),
22467
+ this.context,
22468
+ {
22469
+ ...this.params,
22470
+ type: this.type,
22471
+ ownerType: this.ownerType,
22472
+ ownerId: this.ownerId,
22473
+ modelId: this.model.id
22474
+ },
22475
+ data
22476
+ );
22477
+ } else {
22478
+ res = await this.config.save(data);
22479
+ }
22191
22480
  if (res) {
22192
22481
  this.customModelData = model;
22193
22482
  }
22194
- return model;
22483
+ return { model, config: this.portletConfig };
22195
22484
  }
22196
22485
  };
22197
22486
 
22487
+ // src/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.ts
22488
+ import { merge as merge2 } from "lodash-es";
22489
+ import { IBizContext as IBizContext5, IBizParams as IBizParams2 } from "@ibiz-template/core";
22490
+
22198
22491
  // src/controller/control/dashboard/portlet/portlet-part/portlet-part.state.ts
22199
22492
  var PortletPartState = class {
22200
22493
  constructor() {
@@ -22224,26 +22517,38 @@ var PortletPartState = class {
22224
22517
  // src/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.ts
22225
22518
  var PortletPartController = class {
22226
22519
  /**
22227
- * 门户部件的上下文参数
22228
- *
22520
+ * Creates an instance of PortletPartController.
22229
22521
  * @author lxm
22230
- * @date 2022-10-23 16:10:50
22231
- * @readonly
22232
- * @type {IContext}
22522
+ * @date 2022-10-21 10:10:44
22523
+ * @param {T} model
22524
+ * @param {DashboardController} dashboard 数据看板控制器
22525
+ * @param {IPortletContainerController} [parent] 父容器控制器,最上级不存在
22233
22526
  */
22234
- get context() {
22235
- return this.dashboard.context;
22527
+ constructor(model, dashboard, parent) {
22528
+ /**
22529
+ * 门户配置
22530
+ *
22531
+ * @type {IData}
22532
+ * @memberof PortletPartController
22533
+ */
22534
+ this.config = {};
22535
+ this.model = model;
22536
+ this.dashboard = dashboard;
22537
+ this.parent = parent;
22538
+ this.state = this.createState();
22539
+ this.state.context = IBizContext5.create({}, this.dashboard.context);
22540
+ this.params = new IBizParams2({}, this.dashboard.params);
22236
22541
  }
22237
22542
  /**
22238
- * 门户部件的视图参数
22543
+ * 门户部件的上下文参数
22239
22544
  *
22240
22545
  * @author lxm
22241
- * @date 2022-10-23 16:10:21
22546
+ * @date 2022-10-23 16:10:50
22242
22547
  * @readonly
22243
- * @type {IParams}
22548
+ * @type {IContext}
22244
22549
  */
22245
- get params() {
22246
- return this.dashboard.params;
22550
+ get context() {
22551
+ return this.state.context;
22247
22552
  }
22248
22553
  /**
22249
22554
  * 获取容器类名集合
@@ -22256,18 +22561,17 @@ var PortletPartController = class {
22256
22561
  return [...this.state.class.container, ...this.state.class.containerDyna];
22257
22562
  }
22258
22563
  /**
22259
- * Creates an instance of PortletPartController.
22260
- * @author lxm
22261
- * @date 2022-10-21 10:10:44
22262
- * @param {T} model
22263
- * @param {DashboardController} dashboard 数据看板控制器
22264
- * @param {IPortletContainerController} [parent] 父容器控制器,最上级不存在
22564
+ * 内容控制器
22565
+ * @author zzq
22566
+ * @readonly
22567
+ * @type {IController | undefined}
22568
+ * @memberof PortletPartController
22265
22569
  */
22266
- constructor(model, dashboard, parent) {
22267
- this.model = model;
22268
- this.dashboard = dashboard;
22269
- this.parent = parent;
22270
- this.state = this.createState();
22570
+ get contentController() {
22571
+ const { contentControlId } = this.model;
22572
+ if (contentControlId) {
22573
+ return this.dashboard.getController(contentControlId);
22574
+ }
22271
22575
  }
22272
22576
  /**
22273
22577
  * 子类不可覆盖或重写此方法,在 init 时需要重写的使用 onInit 方法。
@@ -22281,7 +22585,7 @@ var PortletPartController = class {
22281
22585
  }
22282
22586
  async onInit() {
22283
22587
  this.onDataChange = this.onDataChange.bind(this);
22284
- const { layoutPos, sysCss } = this.model;
22588
+ const { layoutPos, sysCss, title, titleLanguageRes } = this.model;
22285
22589
  if (layoutPos) {
22286
22590
  const { width, height } = calcLayoutHeightWidth(this.model);
22287
22591
  this.state.layout.width = "".concat(width);
@@ -22290,6 +22594,12 @@ var PortletPartController = class {
22290
22594
  if (sysCss == null ? void 0 : sysCss.cssName) {
22291
22595
  this.state.class.container.push(sysCss.cssName);
22292
22596
  }
22597
+ if (titleLanguageRes) {
22598
+ this.state.title = ibiz.i18n.t(titleLanguageRes.lanResTag, title);
22599
+ } else {
22600
+ this.state.title = title;
22601
+ }
22602
+ this.config = { srftitle: this.state.title };
22293
22603
  await this.initActionStates();
22294
22604
  }
22295
22605
  /**
@@ -22302,6 +22612,30 @@ var PortletPartController = class {
22302
22612
  createState() {
22303
22613
  return new PortletPartState();
22304
22614
  }
22615
+ /**
22616
+ * 刷新门户部件
22617
+ *
22618
+ * @author zzq
22619
+ * @date 2024-04-25 10:03:33
22620
+ */
22621
+ refresh() {
22622
+ }
22623
+ /**
22624
+ * 设置配置数据
22625
+ *
22626
+ * @param {IData} config
22627
+ * @memberof PortletPartController
22628
+ */
22629
+ async setConfig(config) {
22630
+ merge2(this.config, config);
22631
+ this.state.title = this.config.srftitle;
22632
+ delete config.srftitle;
22633
+ merge2(this.params, config);
22634
+ this.dashboard.evt.emit("onConfigChange", {
22635
+ name: this.model.id,
22636
+ config: this.config
22637
+ });
22638
+ }
22305
22639
  /**
22306
22640
  * 数据改变方法
22307
22641
  * @param {DataChangeEvent} event
@@ -22367,10 +22701,11 @@ var PortletPartController = class {
22367
22701
  await UIActionUtil.execAndResolved(
22368
22702
  actionId,
22369
22703
  {
22370
- context: this.dashboard.context,
22371
- params: this.dashboard.params,
22704
+ context: this.context,
22705
+ params: this.params,
22372
22706
  data,
22373
22707
  view: this.dashboard.view,
22708
+ ctrl: this,
22374
22709
  event
22375
22710
  },
22376
22711
  detail.appId
@@ -22421,6 +22756,19 @@ var ContainerPortletController = class extends PortletPartController {
22421
22756
 
22422
22757
  // src/controller/control/dashboard/portlet/view-portlet/view-portlet.controller.ts
22423
22758
  var ViewPortletController = class extends PortletPartController {
22759
+ /**
22760
+ * 刷新门户部件
22761
+ *
22762
+ * @author zzq
22763
+ * @date 2024-04-25 10:03:33
22764
+ */
22765
+ refresh() {
22766
+ if (this.contentController) {
22767
+ this.contentController.callUIAction(
22768
+ "Refresh" /* REFRESH */
22769
+ );
22770
+ }
22771
+ }
22424
22772
  };
22425
22773
 
22426
22774
  // src/controller/control/dashboard/portlet/menu-portlet/menu-portlet.controller.ts
@@ -22429,6 +22777,17 @@ var MenuPortletController = class extends PortletPartController {
22429
22777
 
22430
22778
  // src/controller/control/dashboard/portlet/chart-portlet/chart-portlet.controller.ts
22431
22779
  var ChartPortletController = class extends PortletPartController {
22780
+ /**
22781
+ * 刷新门户部件
22782
+ *
22783
+ * @author zzq
22784
+ * @date 2024-04-25 10:03:33
22785
+ */
22786
+ refresh() {
22787
+ if (this.contentController) {
22788
+ this.contentController.refresh();
22789
+ }
22790
+ }
22432
22791
  };
22433
22792
 
22434
22793
  // src/controller/control/dashboard/portlet/actionbar-portlet/actionbar-portlet.controller.ts
@@ -22441,6 +22800,17 @@ var HtmlPortletController = class extends PortletPartController {
22441
22800
 
22442
22801
  // src/controller/control/dashboard/portlet/list-portlet/list-portlet.controller.ts
22443
22802
  var ListPortletController = class extends PortletPartController {
22803
+ /**
22804
+ * 刷新门户部件
22805
+ *
22806
+ * @author zzq
22807
+ * @date 2024-04-25 10:03:33
22808
+ */
22809
+ refresh() {
22810
+ if (this.contentController) {
22811
+ this.contentController.refresh();
22812
+ }
22813
+ }
22444
22814
  };
22445
22815
 
22446
22816
  // src/controller/control/dashboard/portlet/rawitem-portlet/rawitem-portlet.controller.ts
@@ -23950,7 +24320,7 @@ var FormController = class extends ControlController {
23950
24320
  const counter = await CounterService.getCounterByRef(
23951
24321
  counterRef,
23952
24322
  this.context,
23953
- dataKey ? { customId: dataKey } : void 0
24323
+ dataKey ? { customId: dataKey, ...this.params } : { ...this.params }
23954
24324
  );
23955
24325
  this.counters[counterRef.id] = counter;
23956
24326
  })
@@ -26221,7 +26591,7 @@ var FormTabPanelController = class extends FormDetailController {
26221
26591
  // src/controller/control/form/edit-form/edit-form.controller.ts
26222
26592
  import {
26223
26593
  awaitTimeout,
26224
- IBizContext as IBizContext5,
26594
+ IBizContext as IBizContext6,
26225
26595
  isElementSame as isElementSame2,
26226
26596
  mergeInLeft as mergeInLeft2,
26227
26597
  RuntimeError as RuntimeError55
@@ -26936,7 +27306,7 @@ var EditFormController = class extends FormController {
26936
27306
  switch (autoSaveMode) {
26937
27307
  case 3:
26938
27308
  saveParam.data = this.getDiffData();
26939
- saveParam.context = IBizContext5.create({ srfsimple: true });
27309
+ saveParam.context = IBizContext6.create({ srfsimple: true });
26940
27310
  break;
26941
27311
  default:
26942
27312
  }
@@ -27707,6 +28077,36 @@ var GridController = class extends MDControlController {
27707
28077
  this.dataExportParam.header = degridColumns.map((item) => item.caption);
27708
28078
  }
27709
28079
  }
28080
+ /**
28081
+ * 填充导出代码表
28082
+ * @author zzq
28083
+ * @date 2024-04-23 16:10:17
28084
+ * @protected
28085
+ * @return {*} {Promise<void>}
28086
+ */
28087
+ async fillExportCodelistMap() {
28088
+ if (this.model.dedataExportId) {
28089
+ return;
28090
+ }
28091
+ const fillCodeList = async (key, fieldColumnC) => {
28092
+ const dataItems = await fieldColumnC.loadCodeList();
28093
+ this.allExportCodelistMap.set(key, dataItems);
28094
+ };
28095
+ const exportColumnsPromises = [];
28096
+ for (const [key, codeListItems] of this.allExportCodelistMap) {
28097
+ if (!codeListItems) {
28098
+ const fieldColumn = this.fieldColumns[key];
28099
+ if (fieldColumn.codeListItems) {
28100
+ this.allExportCodelistMap.set(key, fieldColumn.codeListItems);
28101
+ } else {
28102
+ exportColumnsPromises.push(fillCodeList(key, fieldColumn));
28103
+ }
28104
+ }
28105
+ }
28106
+ if (exportColumnsPromises.length > 0) {
28107
+ await Promise.all(exportColumnsPromises);
28108
+ }
28109
+ }
27710
28110
  /**
27711
28111
  * 初始化表格分组
27712
28112
  * @author lxm
@@ -28475,6 +28875,7 @@ var GridController = class extends MDControlController {
28475
28875
  if (!header) {
28476
28876
  throw new RuntimeError56("\u65E0\u8868\u683C\u5217");
28477
28877
  }
28878
+ await this.fillExportCodelistMap();
28478
28879
  const data = await this.getExportData(args.params);
28479
28880
  const formatData = this.formatExcelData(data);
28480
28881
  const table = formatData.map((v) => Object.values(v));
@@ -32399,7 +32800,8 @@ var TreeController = class extends MDControlController {
32399
32800
  if (appCounterRef) {
32400
32801
  this.counter = await CounterService.getCounterByRef(
32401
32802
  appCounterRef,
32402
- this.context
32803
+ this.context,
32804
+ { ...this.params }
32403
32805
  );
32404
32806
  }
32405
32807
  }
@@ -33145,14 +33547,22 @@ var WizardPanelController = class extends ControlController {
33145
33547
  */
33146
33548
  this.formData = {};
33147
33549
  }
33550
+ /**
33551
+ * 获取向导面板数据
33552
+ * @returns
33553
+ */
33554
+ getData() {
33555
+ return [this.formData];
33556
+ }
33148
33557
  initState() {
33149
33558
  super.initState();
33559
+ this.state.buttonsState = new ButtonContainerState();
33150
33560
  }
33151
33561
  async onCreated() {
33152
33562
  var _a, _b;
33153
33563
  await super.onCreated();
33154
33564
  this.model.dewizard.dewizardForms.forEach((wizardForm) => {
33155
- var _a2, _b2, _c;
33565
+ var _a2, _b2, _c, _d;
33156
33566
  if (wizardForm.firstForm) {
33157
33567
  this.firstForm = wizardForm;
33158
33568
  }
@@ -33162,7 +33572,17 @@ var WizardPanelController = class extends ControlController {
33162
33572
  });
33163
33573
  const stepTag = wizardStep == null ? void 0 : wizardStep.stepTag;
33164
33574
  this.stepTags[formName] = stepTag;
33575
+ (_d = wizardForm.stepActions) == null ? void 0 : _d.forEach((step) => {
33576
+ const name = "".concat(wizardForm.formTag, "@").concat(step);
33577
+ const buttonState = new UIActionButtonState(
33578
+ name,
33579
+ this.context.srfappid
33580
+ );
33581
+ buttonState.visible = !this.getStepScriptCode(wizardForm, step);
33582
+ this.state.buttonsState.addState(name, buttonState);
33583
+ });
33165
33584
  });
33585
+ this.state.buttonsState.init();
33166
33586
  (_b = (_a = this.model.dewizard) == null ? void 0 : _a.dewizardSteps) == null ? void 0 : _b.forEach((step) => {
33167
33587
  this.steps.push(step.stepTag);
33168
33588
  });
@@ -33229,7 +33649,11 @@ var WizardPanelController = class extends ControlController {
33229
33649
  async onFormMounted(activeFormTag, event) {
33230
33650
  const formController = event.ctrl;
33231
33651
  this.formControllers.set(activeFormTag, formController);
33652
+ formController.evt.on("onFormDataChange", (evt) => {
33653
+ this.calcButtonState(evt.data[0]);
33654
+ });
33232
33655
  const data = await formController.load();
33656
+ this.calcButtonState(formController.data);
33233
33657
  Object.assign(this.formData, data);
33234
33658
  }
33235
33659
  /**
@@ -33398,6 +33822,55 @@ var WizardPanelController = class extends ControlController {
33398
33822
  await this.activeFormController.save();
33399
33823
  await this.finish();
33400
33824
  }
33825
+ /**
33826
+ * 获取向导表单步骤脚本代码
33827
+ * @param wizardForm
33828
+ * @param step
33829
+ */
33830
+ getStepScriptCode(wizardForm, step) {
33831
+ switch (step) {
33832
+ case "PREV":
33833
+ return wizardForm.goPrevEnableScriptCode;
33834
+ case "NEXT":
33835
+ return wizardForm.goNextEnableScriptCode;
33836
+ case "FINISH":
33837
+ return wizardForm.goFinishEnableScriptCode;
33838
+ default:
33839
+ }
33840
+ }
33841
+ /**
33842
+ * 计算按钮状态
33843
+ *
33844
+ * @param item 数据
33845
+ * @memberof WizardPanelController
33846
+ */
33847
+ async calcButtonState(item) {
33848
+ var _a;
33849
+ const { activeWizardForm } = this;
33850
+ if (activeWizardForm) {
33851
+ let data = item;
33852
+ if (data && data instanceof ControlVO) {
33853
+ data = data.getOrigin();
33854
+ }
33855
+ (_a = activeWizardForm.stepActions) == null ? void 0 : _a.forEach((step) => {
33856
+ const buttonState = this.state.buttonsState["".concat(activeWizardForm.formTag, "@").concat(step)];
33857
+ const scriptCode = this.getStepScriptCode(activeWizardForm, step);
33858
+ if (buttonState && scriptCode) {
33859
+ buttonState.visible = !!ScriptFactory.execScriptFn(
33860
+ {
33861
+ view: this.view,
33862
+ context: this.context,
33863
+ params: this.params,
33864
+ data,
33865
+ env: ibiz.env
33866
+ },
33867
+ scriptCode,
33868
+ { isAsync: false, singleRowReturn: true }
33869
+ );
33870
+ }
33871
+ });
33872
+ }
33873
+ }
33401
33874
  };
33402
33875
 
33403
33876
  // src/controller/control/md-ctrl/md-ctrl.controller.ts
@@ -38080,7 +38553,10 @@ var MDViewEngine = class extends ViewEngineBase {
38080
38553
  * @return {*} {Promise<void>}
38081
38554
  */
38082
38555
  async onXDataActive(event) {
38083
- await this.openData(event);
38556
+ const res = await this.openData(event);
38557
+ if (!res.cancel) {
38558
+ this.refresh();
38559
+ }
38084
38560
  }
38085
38561
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
38086
38562
  async call(key, args) {