@ibiz-template/runtime 0.5.7-alpha.8 → 0.6.0-alpha.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 (133) hide show
  1. package/dist/index.esm.js +475 -82
  2. package/dist/index.system.min.js +1 -1
  3. package/out/application.d.ts.map +1 -1
  4. package/out/application.js +0 -1
  5. package/out/command/app/open-app-view/open-app-view.d.ts +1 -1
  6. package/out/command/app/open-app-view/open-app-view.d.ts.map +1 -1
  7. package/out/command/app/open-app-view/open-app-view.js +4 -3
  8. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  9. package/out/controller/control/grid/grid/grid.controller.js +4 -3
  10. package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +43 -5
  11. package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -1
  12. package/out/controller/control/search-bar/search-bar-filter.controller.js +79 -6
  13. package/out/controller/control/search-bar/search-bar.controller.d.ts +10 -1
  14. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  15. package/out/controller/control/search-bar/search-bar.controller.js +48 -6
  16. package/out/controller/control/search-bar/use-searchcond.d.ts.map +1 -1
  17. package/out/controller/control/search-bar/use-searchcond.js +7 -1
  18. package/out/controller/notification/internal-message.controller.d.ts +21 -2
  19. package/out/controller/notification/internal-message.controller.d.ts.map +1 -1
  20. package/out/controller/notification/internal-message.controller.js +91 -3
  21. package/out/controller/notification/notice.controller.d.ts +3 -1
  22. package/out/controller/notification/notice.controller.d.ts.map +1 -1
  23. package/out/controller/notification/notice.controller.js +6 -0
  24. package/out/hub/config/app-view-config-service.d.ts +14 -0
  25. package/out/hub/config/app-view-config-service.d.ts.map +1 -1
  26. package/out/hub/config/app-view-config-service.js +27 -11
  27. package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts +4 -0
  28. package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts.map +1 -1
  29. package/out/interface/common/i-open-view-options/i-open-view-options.d.ts +9 -0
  30. package/out/interface/common/i-open-view-options/i-open-view-options.d.ts.map +1 -1
  31. package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts +59 -3
  32. package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts.map +1 -1
  33. package/out/interface/controller/controller/notice/i-notice.controller.d.ts +16 -0
  34. package/out/interface/controller/controller/notice/i-notice.controller.d.ts.map +1 -1
  35. package/out/interface/controller/controller/notice/index.d.ts +2 -2
  36. package/out/interface/controller/controller/notice/index.d.ts.map +1 -1
  37. package/out/interface/controller/state/control/i-grid.state.d.ts +7 -0
  38. package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
  39. package/out/interface/controller/state/control/i-search-bar.state.d.ts +14 -0
  40. package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
  41. package/out/interface/provider/i-internal-message.provider.d.ts +1 -1
  42. package/out/interface/provider/i-internal-message.provider.d.ts.map +1 -1
  43. package/out/interface/service/service/i-app-de.service.d.ts +1 -1
  44. package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
  45. package/out/interface/service/service/i-internal-message.service.d.ts +16 -1
  46. package/out/interface/service/service/i-internal-message.service.d.ts.map +1 -1
  47. package/out/interface/service/service/i-mark-open-data.service.d.ts +20 -1
  48. package/out/interface/service/service/i-mark-open-data.service.d.ts.map +1 -1
  49. package/out/interface/service/service/index.d.ts +1 -1
  50. package/out/interface/service/service/index.d.ts.map +1 -1
  51. package/out/interface/util/i-notification-util/i-notification-util.d.ts +7 -0
  52. package/out/interface/util/i-notification-util/i-notification-util.d.ts.map +1 -1
  53. package/out/logic-scheduler/executor/app-de-ui-logic-executor.js +1 -1
  54. package/out/logic-scheduler/executor/app-ui-logic-executor.js +2 -2
  55. package/out/service/de-service-util.d.ts +1 -1
  56. package/out/service/de-service-util.d.ts.map +1 -1
  57. package/out/service/de-service-util.js +2 -2
  58. package/out/service/service/control/control.service.d.ts +10 -2
  59. package/out/service/service/control/control.service.d.ts.map +1 -1
  60. package/out/service/service/control/control.service.js +17 -1
  61. package/out/service/service/control/md-control.service.d.ts +2 -2
  62. package/out/service/service/control/md-control.service.d.ts.map +1 -1
  63. package/out/service/service/entity/de.service.d.ts +1 -1
  64. package/out/service/service/entity/de.service.d.ts.map +1 -1
  65. package/out/service/service/entity/de.service.js +2 -2
  66. package/out/service/service/entity/method/de-action.d.ts +6 -6
  67. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  68. package/out/service/service/entity/method/de-action.js +16 -16
  69. package/out/service/service/entity/method/fetch.d.ts +1 -1
  70. package/out/service/service/entity/method/fetch.d.ts.map +1 -1
  71. package/out/service/service/entity/method/fetch.js +2 -2
  72. package/out/service/service/entity/method/method.d.ts +2 -2
  73. package/out/service/service/entity/method/method.d.ts.map +1 -1
  74. package/out/service/service/entity/method/method.js +4 -4
  75. package/out/service/service/internal-message/internal-message.service.d.ts +16 -1
  76. package/out/service/service/internal-message/internal-message.service.d.ts.map +1 -1
  77. package/out/service/service/internal-message/internal-message.service.js +42 -0
  78. package/out/service/service/mark-open-data/mark-open-data.service.d.ts +26 -1
  79. package/out/service/service/mark-open-data/mark-open-data.service.d.ts.map +1 -1
  80. package/out/service/service/mark-open-data/mark-open-data.service.js +45 -0
  81. package/out/service/utils/dyna-sys-params/dyna-sys-params.d.ts +1 -1
  82. package/out/service/utils/dyna-sys-params/dyna-sys-params.js +4 -4
  83. package/out/service/utils/util/util.d.ts.map +1 -1
  84. package/out/service/utils/util/util.js +21 -1
  85. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  86. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +3 -0
  87. package/out/ui-action/provider/front-ui-action-provider.d.ts +10 -0
  88. package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
  89. package/out/ui-action/provider/front-ui-action-provider.js +25 -1
  90. package/out/ui-logic/index.d.ts.map +1 -1
  91. package/out/ui-logic/index.js +1 -2
  92. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  93. package/out/utils/open-redirect-view/open-redirect-view.js +11 -1
  94. package/package.json +5 -5
  95. package/src/application.ts +0 -2
  96. package/src/command/app/open-app-view/open-app-view.ts +6 -3
  97. package/src/controller/control/grid/grid/grid.controller.ts +4 -5
  98. package/src/controller/control/search-bar/search-bar-filter.controller.ts +90 -10
  99. package/src/controller/control/search-bar/search-bar.controller.ts +67 -11
  100. package/src/controller/control/search-bar/use-searchcond.ts +9 -2
  101. package/src/controller/notification/internal-message.controller.ts +102 -6
  102. package/src/controller/notification/notice.controller.ts +9 -1
  103. package/src/hub/config/app-view-config-service.ts +29 -0
  104. package/src/interface/common/i-app-view-config-service/i-app-view-config-service.ts +4 -0
  105. package/src/interface/common/i-open-view-options/i-open-view-options.ts +10 -0
  106. package/src/interface/controller/controller/notice/i-internal-message.controller.ts +66 -3
  107. package/src/interface/controller/controller/notice/i-notice.controller.ts +18 -0
  108. package/src/interface/controller/controller/notice/index.ts +2 -2
  109. package/src/interface/controller/state/control/i-grid.state.ts +8 -0
  110. package/src/interface/controller/state/control/i-search-bar.state.ts +16 -0
  111. package/src/interface/provider/i-internal-message.provider.ts +1 -2
  112. package/src/interface/service/service/i-app-de.service.ts +1 -0
  113. package/src/interface/service/service/i-internal-message.service.ts +18 -1
  114. package/src/interface/service/service/i-mark-open-data.service.ts +31 -1
  115. package/src/interface/service/service/index.ts +1 -0
  116. package/src/interface/util/i-notification-util/i-notification-util.ts +9 -0
  117. package/src/logic-scheduler/executor/app-de-ui-logic-executor.ts +1 -1
  118. package/src/logic-scheduler/executor/app-ui-logic-executor.ts +2 -2
  119. package/src/service/de-service-util.ts +2 -1
  120. package/src/service/service/control/control.service.ts +20 -2
  121. package/src/service/service/control/md-control.service.ts +2 -2
  122. package/src/service/service/entity/de.service.ts +2 -1
  123. package/src/service/service/entity/method/de-action.ts +16 -7
  124. package/src/service/service/entity/method/fetch.ts +2 -1
  125. package/src/service/service/entity/method/method.ts +5 -0
  126. package/src/service/service/internal-message/internal-message.service.ts +46 -2
  127. package/src/service/service/mark-open-data/mark-open-data.service.ts +61 -1
  128. package/src/service/utils/dyna-sys-params/dyna-sys-params.ts +6 -6
  129. package/src/service/utils/util/util.ts +20 -1
  130. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +2 -0
  131. package/src/ui-action/provider/front-ui-action-provider.ts +25 -1
  132. package/src/ui-logic/index.ts +1 -2
  133. package/src/utils/open-redirect-view/open-redirect-view.ts +10 -1
package/dist/index.esm.js CHANGED
@@ -1243,6 +1243,15 @@ async function getDERedirectToView(appView, context, params = {}, opts = {}) {
1243
1243
  if (rdTag.startsWith("view://")) {
1244
1244
  const url = new URL(rdTag);
1245
1245
  if (url.searchParams.size > 0) {
1246
+ const navCtx = url.searchParams.get("srfnavctx");
1247
+ if (navCtx) {
1248
+ try {
1249
+ Object.assign(context, JSON.parse(navCtx));
1250
+ } catch (error) {
1251
+ ibiz.log.error("\u91CD\u5B9A\u5411[".concat(rdTag, "] \u4E2D srfnavctx \u53C2\u6570\u89E3\u6790\u5931\u8D25"), error);
1252
+ }
1253
+ url.searchParams.delete("srfnavctx");
1254
+ }
1246
1255
  url.searchParams.forEach((value, _key) => {
1247
1256
  params[_key] = value;
1248
1257
  });
@@ -7199,7 +7208,26 @@ var SearchFilter = class {
7199
7208
 
7200
7209
  // src/service/utils/util/util.ts
7201
7210
  function fieldValueToBoolean(value) {
7202
- return [1, "1", true, "true"].includes(value);
7211
+ if (typeof value === "boolean") {
7212
+ return value;
7213
+ }
7214
+ if (typeof value === "number") {
7215
+ return value > 0;
7216
+ }
7217
+ if (typeof value === "string") {
7218
+ switch (value) {
7219
+ case "true":
7220
+ return true;
7221
+ case "false":
7222
+ return false;
7223
+ default: {
7224
+ const num = Number(value);
7225
+ return Number.isNaN(num) ? false : num > 0;
7226
+ }
7227
+ }
7228
+ } else {
7229
+ return !!value;
7230
+ }
7203
7231
  }
7204
7232
 
7205
7233
  // src/service/utils/dyna-sys-params/dyna-sys-params.ts
@@ -7216,15 +7244,15 @@ async function calcDynaSysParams(appDataEntityId, context, opts = {}) {
7216
7244
  loadModelParams.srfkey = srfkey;
7217
7245
  }
7218
7246
  }
7219
- if (viewParams.srfparentkey && viewParams.srfparentdeanme) {
7247
+ if (viewParams.srfparentkey && viewParams.srfparentdename) {
7220
7248
  loadModelParams.srfparentkey = viewParams.srfparentkey;
7221
- loadModelParams.srfparentdeanme = viewParams.srfparentdeanme;
7249
+ loadModelParams.srfparentdename = viewParams.srfparentdename;
7222
7250
  } else {
7223
7251
  const match = getMatchResPath(context, appDe);
7224
7252
  if (match && match.keys.length > 1) {
7225
7253
  const parentDeKey = match.keys[match.keys.length - 2];
7226
7254
  loadModelParams.srfparentkey = viewParams.srfparentkey || context[parentDeKey];
7227
- loadModelParams.srfparentdeanme = viewParams.srfparentdeanme || parentDeKey;
7255
+ loadModelParams.srfparentdename = viewParams.srfparentdename || parentDeKey;
7228
7256
  }
7229
7257
  }
7230
7258
  return loadModelParams;
@@ -8402,10 +8430,10 @@ var DEService = class {
8402
8430
  * @param {IParams} [params2={}] 查询参数
8403
8431
  * @return {*} {Promise<IHttpResponse>}
8404
8432
  */
8405
- async exec(id, context, params, params2) {
8433
+ async exec(id, context, params, params2, header) {
8406
8434
  const method = await this.getMethod(id);
8407
8435
  if (method) {
8408
- return method.exec(context, params, params2);
8436
+ return method.exec(context, params, params2, header);
8409
8437
  }
8410
8438
  throw new RuntimeError19("".concat(this.model.codeName, "\u672A\u652F\u6301\u300C").concat(id, "\u300D\u65B9\u6CD5"));
8411
8439
  }
@@ -8820,15 +8848,32 @@ var ControlService = class {
8820
8848
  * @returns {*} {Promise<IHttpResponse>}
8821
8849
  */
8822
8850
  async exec(methodName, context, data, params) {
8851
+ const header = this.handleCustomRequestHeader();
8823
8852
  const res = await this.app.deService.exec(
8824
8853
  this.model.appDataEntityId,
8825
8854
  methodName,
8826
8855
  context,
8827
8856
  data,
8828
- params
8857
+ params,
8858
+ header
8829
8859
  );
8830
8860
  return res;
8831
8861
  }
8862
+ /**
8863
+ * 处理自定义请求头
8864
+ *
8865
+ * @author zk
8866
+ * @date 2024-02-02 11:02:55
8867
+ * @memberof ControlService
8868
+ */
8869
+ handleCustomRequestHeader() {
8870
+ const customHeader = {};
8871
+ const { enableItemPrivilege } = this.model;
8872
+ if (enableItemPrivilege) {
8873
+ Object.assign(customHeader, { srfdataaccaction: true });
8874
+ }
8875
+ return customHeader;
8876
+ }
8832
8877
  /**
8833
8878
  * 处理响应
8834
8879
  *
@@ -9557,7 +9602,7 @@ var Method = class {
9557
9602
  * @param {IParams} params
9558
9603
  * @return {*} {Promise<HttpResponse<any>>}
9559
9604
  */
9560
- async request(path2, context, data, params) {
9605
+ async request(path2, context, data, params, header) {
9561
9606
  const { actionType, requestMethod } = this.method;
9562
9607
  if (actionType === "REMOTE") {
9563
9608
  const methodName = this.method.codeName.toLowerCase();
@@ -9566,19 +9611,22 @@ var Method = class {
9566
9611
  case "POST":
9567
9612
  res = await this.app.net.post(
9568
9613
  this.mergeRequestPath(path2, methodName),
9569
- data || params || {}
9614
+ data || params || {},
9615
+ header
9570
9616
  );
9571
9617
  break;
9572
9618
  case "GET":
9573
9619
  res = await this.app.net.get(
9574
9620
  this.mergeRequestPath(path2, methodName),
9575
- data || params
9621
+ data || params,
9622
+ header
9576
9623
  );
9577
9624
  break;
9578
9625
  case "PUT": {
9579
9626
  res = await this.app.net.put(
9580
9627
  this.mergeRequestPath(path2, methodName),
9581
- data || params || {}
9628
+ data || params || {},
9629
+ header
9582
9630
  );
9583
9631
  break;
9584
9632
  }
@@ -10757,7 +10805,7 @@ var DEActionMethod = class extends Method {
10757
10805
  }
10758
10806
  return this.input.handle(context, data);
10759
10807
  }
10760
- async exec(context, data, params) {
10808
+ async exec(context, data, params, header) {
10761
10809
  let result;
10762
10810
  if (data && !["READ", "GETDRAFT"].includes(this.method.actionMode)) {
10763
10811
  await execFieldLogics(this.entity, "change", context, data, params);
@@ -10774,19 +10822,19 @@ var DEActionMethod = class extends Method {
10774
10822
  }
10775
10823
  switch (this.method.codeName) {
10776
10824
  case "Create":
10777
- result = await this.create(context, data, params || {});
10825
+ result = await this.create(context, data, params || {}, header);
10778
10826
  break;
10779
10827
  case "Get":
10780
- result = await this.get(context, params);
10828
+ result = await this.get(context, params, header);
10781
10829
  break;
10782
10830
  case "GetDraft":
10783
- result = await this.getDraft(context, params);
10831
+ result = await this.getDraft(context, params, header);
10784
10832
  break;
10785
10833
  case "Remove":
10786
10834
  result = await this.remove(context, params);
10787
10835
  break;
10788
10836
  case "Update":
10789
- result = await this.update(context, data, params);
10837
+ result = await this.update(context, data, params, header);
10790
10838
  break;
10791
10839
  case "CreateTemp":
10792
10840
  result = await this.createTemp(context, data);
@@ -10812,7 +10860,7 @@ var DEActionMethod = class extends Method {
10812
10860
  }
10813
10861
  path2 = "".concat(path2, "/").concat(srfkey);
10814
10862
  }
10815
- const res = await this.request(path2, context, data, params);
10863
+ const res = await this.request(path2, context, data, params, header);
10816
10864
  res.data = await this.result.handle(context, res.data);
10817
10865
  result = res;
10818
10866
  }
@@ -10838,7 +10886,7 @@ var DEActionMethod = class extends Method {
10838
10886
  * @param {IData} data
10839
10887
  * @return {*} {Promise<IHttpResponse<IData>>}
10840
10888
  */
10841
- async create(context, data, params) {
10889
+ async create(context, data, params, header) {
10842
10890
  if (!data) {
10843
10891
  throw new RuntimeError23("create\u884C\u4E3A\u6CA1\u6709\u4F20data");
10844
10892
  }
@@ -10846,7 +10894,7 @@ var DEActionMethod = class extends Method {
10846
10894
  return this.createTemp(context, this.createEntity(data));
10847
10895
  }
10848
10896
  const path2 = this.calcPath(context);
10849
- const res = await this.app.net.post(path2, data, params);
10897
+ const res = await this.app.net.post(path2, data, params, header);
10850
10898
  res.data = await this.result.handle(context, res.data);
10851
10899
  return res;
10852
10900
  }
@@ -10859,14 +10907,15 @@ var DEActionMethod = class extends Method {
10859
10907
  * @param {IParams} [params]
10860
10908
  * @return {*} {Promise<IHttpResponse<IDataEntity>>}
10861
10909
  */
10862
- async remove(context, params) {
10910
+ async remove(context, params, header) {
10863
10911
  if (this.isLocalMode) {
10864
10912
  return this.removeTemp(context, params);
10865
10913
  }
10866
10914
  const path2 = this.calcPath(context);
10867
10915
  const res = await this.app.net.delete(
10868
10916
  "".concat(path2, "/").concat(context[this.entity.codeName.toLowerCase()]),
10869
- params
10917
+ params,
10918
+ header
10870
10919
  );
10871
10920
  return res;
10872
10921
  }
@@ -10880,7 +10929,7 @@ var DEActionMethod = class extends Method {
10880
10929
  * @param {IParams} [params={}]
10881
10930
  * @return {*} {Promise<IHttpResponse<IDataEntity>>}
10882
10931
  */
10883
- async update(context, data, params) {
10932
+ async update(context, data, params, header) {
10884
10933
  if (!data) {
10885
10934
  throw new RuntimeError23("update\u884C\u4E3A\u6CA1\u6709\u4F20data");
10886
10935
  }
@@ -10891,7 +10940,8 @@ var DEActionMethod = class extends Method {
10891
10940
  const res = await this.app.net.put(
10892
10941
  "".concat(path2, "/").concat(context[this.entity.codeName.toLowerCase()]),
10893
10942
  data,
10894
- params
10943
+ params,
10944
+ header
10895
10945
  );
10896
10946
  res.data = await this.result.handle(context, res.data);
10897
10947
  return res;
@@ -10905,14 +10955,15 @@ var DEActionMethod = class extends Method {
10905
10955
  * @param {IParams} [params]
10906
10956
  * @return {*} {Promise<IHttpResponse<IDataEntity>>}
10907
10957
  */
10908
- async get(context, params = {}) {
10958
+ async get(context, params = {}, header = {}) {
10909
10959
  if (this.isLocalMode) {
10910
10960
  return this.getTemp(context, params);
10911
10961
  }
10912
10962
  const path2 = this.calcPath(context);
10913
10963
  const res = await this.app.net.get(
10914
10964
  "".concat(path2, "/").concat(context[this.entity.codeName.toLowerCase()]),
10915
- params
10965
+ params,
10966
+ header
10916
10967
  );
10917
10968
  res.data = await this.result.handle(context, res.data);
10918
10969
  return res;
@@ -10926,12 +10977,12 @@ var DEActionMethod = class extends Method {
10926
10977
  * @param {IParams} [params]
10927
10978
  * @return {*} {Promise<IHttpResponse<IData>>}
10928
10979
  */
10929
- async getDraft(context, params) {
10980
+ async getDraft(context, params, header) {
10930
10981
  if (this.isLocalMode) {
10931
10982
  return this.getDraftTemp(context, params);
10932
10983
  }
10933
10984
  const path2 = this.calcPath(context);
10934
- const res = await this.app.net.get("".concat(path2, "/getdraft"), params);
10985
+ const res = await this.app.net.get("".concat(path2, "/getdraft"), params, header);
10935
10986
  res.data = await this.result.handle(context, res.data);
10936
10987
  return res;
10937
10988
  }
@@ -11232,7 +11283,7 @@ import { isArray as isArray7 } from "lodash-es";
11232
11283
  import { clone as clone15, isEmpty as isEmpty7, isNil as isNil11 } from "ramda";
11233
11284
  import { ascSort as ascSort2, descSort } from "qx-util";
11234
11285
  var FetchMethod = class extends Method {
11235
- async exec(context, params, params2) {
11286
+ async exec(context, params, params2, header) {
11236
11287
  const searchParams = params && !isArray7(params) ? params : params2 || {};
11237
11288
  let res;
11238
11289
  if (this.isLocalMode) {
@@ -11250,7 +11301,7 @@ var FetchMethod = class extends Method {
11250
11301
  case "REMOTE":
11251
11302
  {
11252
11303
  const path2 = this.calcPath(context);
11253
- res = await this.request(path2, context, params, params2);
11304
+ res = await this.request(path2, context, params, params2, header);
11254
11305
  }
11255
11306
  break;
11256
11307
  default:
@@ -11428,17 +11479,73 @@ var InternalMessageService = class {
11428
11479
  const res = await ibiz.net.get("".concat(this.baseUrl, "/").concat(messageId));
11429
11480
  return res;
11430
11481
  }
11482
+ /**
11483
+ * 设置已读
11484
+ * @author lxm
11485
+ * @date 2024-02-04 03:59:52
11486
+ * @param {string} messageId
11487
+ * @return {*} {Promise<void>}
11488
+ */
11489
+ async markRead(messageId) {
11490
+ await ibiz.net.post("".concat(this.baseUrl, "/").concat(messageId, "/mark_read"), {});
11491
+ }
11492
+ /**
11493
+ * 获取未读数据的总条数
11494
+ * @author lxm
11495
+ * @date 2024-02-04 09:34:32
11496
+ * @return {*} {Promise<number>}
11497
+ */
11498
+ async getUnreadNum() {
11499
+ const res = await ibiz.net.post("".concat(this.baseUrl, "/fetch_cur_receiver"), {
11500
+ page: 0,
11501
+ size: 1,
11502
+ sort: "update_time,desc",
11503
+ searchconds: [
11504
+ {
11505
+ condtype: "GROUP",
11506
+ condop: "AND",
11507
+ bnotmode: false,
11508
+ searchconds: [
11509
+ {
11510
+ condop: "EQ",
11511
+ condtype: "DEFIELD",
11512
+ fieldname: "status",
11513
+ value: "RECEIVED"
11514
+ }
11515
+ ]
11516
+ }
11517
+ ]
11518
+ });
11519
+ if (res.headers["x-total"]) {
11520
+ return Number(res.headers["x-total"]);
11521
+ }
11522
+ return 0;
11523
+ }
11431
11524
  };
11432
11525
 
11433
11526
  // src/service/service/mark-open-data/mark-open-data.service.ts
11434
11527
  var MarkOpenDataService = class {
11435
11528
  constructor() {
11529
+ /**
11530
+ * 回调集合
11531
+ * @author lxm
11532
+ * @date 2024-02-01 04:41:45
11533
+ */
11534
+ this.callbackMap = /* @__PURE__ */ new Map();
11436
11535
  /**
11437
11536
  * 基础路径
11438
11537
  * @author lxm
11439
11538
  * @date 2024-01-23 02:06:47
11440
11539
  */
11441
11540
  this.baseUrl = "/portal/markopendata";
11541
+ ibiz.mc.command.markOpenData.on((msg) => {
11542
+ const data = msg.data;
11543
+ const { entity, key } = data;
11544
+ const tag = "".concat(entity, "_").concat(key);
11545
+ if (this.callbackMap.has(tag)) {
11546
+ this.callbackMap.get(tag).forEach((cb) => cb(data));
11547
+ }
11548
+ });
11442
11549
  }
11443
11550
  async action(deName, key, action) {
11444
11551
  const res = await ibiz.net.get(
@@ -11446,6 +11553,37 @@ var MarkOpenDataService = class {
11446
11553
  );
11447
11554
  return res;
11448
11555
  }
11556
+ /**
11557
+ * 监听指定实体指定主键的消息
11558
+ * @author lxm
11559
+ * @date 2024-02-01 04:45:31
11560
+ * @param {string} deName
11561
+ * @param {string} key
11562
+ * @param {MarkOpenDataCallbackFun} callback
11563
+ */
11564
+ subscribe(deName, key, callback) {
11565
+ const tag = "".concat(deName, "_").concat(key);
11566
+ const callbacks = this.callbackMap.get(tag) || [];
11567
+ callbacks.push(callback);
11568
+ this.callbackMap.set(tag, callbacks);
11569
+ }
11570
+ /**
11571
+ * 取消监听指定实体指定主键的消息
11572
+ * @author lxm
11573
+ * @date 2024-02-01 04:48:19
11574
+ * @param {string} deName
11575
+ * @param {string} key
11576
+ * @param {MarkOpenDataCallbackFun} callback
11577
+ */
11578
+ unsubscribe(deName, key, callback) {
11579
+ const tag = "".concat(deName, "_").concat(key);
11580
+ const callbacks = this.callbackMap.get(tag) || [];
11581
+ const index = callbacks.indexOf(callback);
11582
+ if (index > -1) {
11583
+ callbacks.splice(index, 1);
11584
+ this.callbackMap.set(tag, callbacks);
11585
+ }
11586
+ }
11449
11587
  };
11450
11588
 
11451
11589
  // src/service/vo/tree-node-data/tree-node-data.ts
@@ -11577,6 +11715,8 @@ var TreeDataSetNodeData = class _TreeDataSetNodeData extends TreeNodeData {
11577
11715
  this._textHtml = this.calcTextHtml(model);
11578
11716
  if (model.leafFlagAppDEFieldId) {
11579
11717
  this._leaf = fieldValueToBoolean(data[model.leafFlagAppDEFieldId]);
11718
+ } else if (model.childCntAppDEFieldId) {
11719
+ this._leaf = !fieldValueToBoolean(data[model.childCntAppDEFieldId]);
11580
11720
  }
11581
11721
  const dataItemKeyMap = /* @__PURE__ */ new Map();
11582
11722
  const dataItemDefaultMap = /* @__PURE__ */ new Map();
@@ -12449,9 +12589,9 @@ var _DEServiceUtil = class _DEServiceUtil {
12449
12589
  * @param {(IParams | undefined)} [params2] 视图参数
12450
12590
  * @return {*} {Promise<IHttpResponse<IData>>}
12451
12591
  */
12452
- async exec(appDataEntityId, methodName, context, params, params2) {
12592
+ async exec(appDataEntityId, methodName, context, params, params2, header) {
12453
12593
  const service = await this.getService(context, appDataEntityId);
12454
- return service.exec(methodName, context, params, params2);
12594
+ return service.exec(methodName, context, params, params2, header);
12455
12595
  }
12456
12596
  };
12457
12597
  /**
@@ -12530,7 +12670,7 @@ var _OpenAppViewCommand = class _OpenAppViewCommand {
12530
12670
  case "POPUPAPP":
12531
12671
  throw new ModelError15(appView, "\u672A\u652F\u6301\u7684\u89C6\u56FE\u6253\u5F00\u6A21\u5F0F: POPUPAPP");
12532
12672
  case "POPOVER":
12533
- return this.openPopover(appView, opts.event, context, params);
12673
+ return this.openPopover(appView, context, params, opts);
12534
12674
  case "DRAWER_LEFT":
12535
12675
  case "DRAWER_RIGHT":
12536
12676
  case "DRAWER_TOP":
@@ -12594,11 +12734,14 @@ var _OpenAppViewCommand = class _OpenAppViewCommand {
12594
12734
  * @param {IParams} [params={}]
12595
12735
  * @return {*} {Promise<IModalData>}
12596
12736
  */
12597
- async openPopover(appView, event, context, params = {}) {
12737
+ async openPopover(appView, context, params = {}, opts = {}) {
12738
+ const { event, modalOption } = opts;
12598
12739
  if (!event) {
12599
12740
  throw new RuntimeError25("\u6C14\u6CE1\u6253\u5F00\u7F3A\u5C11event");
12600
12741
  }
12601
- return ibiz.openView.popover(appView.id, event, context, params);
12742
+ return ibiz.openView.popover(appView.id, event, context, params, {
12743
+ ...modalOption
12744
+ });
12602
12745
  }
12603
12746
  /**
12604
12747
  * 抽屉模式打开
@@ -12937,7 +13080,6 @@ var Application = class {
12937
13080
  this.model.appId
12938
13081
  );
12939
13082
  this.mqtt.evt.on("message", (message) => {
12940
- console.log("message", message);
12941
13083
  ibiz.mc.command.next(message);
12942
13084
  });
12943
13085
  await this.mqtt.connect();
@@ -13003,6 +13145,32 @@ var AppViewConfigService = class {
13003
13145
  }
13004
13146
  return id;
13005
13147
  }
13148
+ /**
13149
+ * 获取视图自定义Option
13150
+ *
13151
+ * @author zk
13152
+ * @date 2024-01-31 11:01:20
13153
+ * @protected
13154
+ * @param {IAppView} model
13155
+ * @return {*} {IData}
13156
+ * @memberof AppViewConfigService
13157
+ */
13158
+ getCustomOption(model) {
13159
+ var _a;
13160
+ const { appViewParams } = model;
13161
+ const optionProperty = (_a = appViewParams == null ? void 0 : appViewParams.find(
13162
+ (item) => item.id === "modaloption"
13163
+ )) == null ? void 0 : _a.value;
13164
+ let modalOption = {};
13165
+ if (optionProperty) {
13166
+ try {
13167
+ modalOption = JSON.parse(optionProperty);
13168
+ } catch (error) {
13169
+ ibiz.log.error("\u89C6\u56FE\u53C2\u6570modalOption \u89E3\u6790\u5931\u8D25\uFF1A".concat(error));
13170
+ }
13171
+ }
13172
+ return { modalOption };
13173
+ }
13006
13174
  has(key) {
13007
13175
  const id = this.calcAppViewId(key);
13008
13176
  return this.viewConfigs.has(id);
@@ -13027,7 +13195,8 @@ var AppViewConfigService = class {
13027
13195
  width: model.width,
13028
13196
  height: model.height,
13029
13197
  appDataEntityId: model.appDataEntityId,
13030
- redirectView: model.redirectView
13198
+ redirectView: model.redirectView,
13199
+ ...this.getCustomOption(model)
13031
13200
  });
13032
13201
  }
13033
13202
  return this.viewConfigs.get(id);
@@ -18919,8 +19088,7 @@ async function execUILogic(deUILogicId, appDataEntityId, parameters) {
18919
19088
  uiLogicMap.set(deUILogic, new UILogic(deUILogic));
18920
19089
  }
18921
19090
  const uiLogic = uiLogicMap.get(deUILogic);
18922
- await uiLogic.exec(parameters);
18923
- return null;
19091
+ return uiLogic.exec(parameters);
18924
19092
  }
18925
19093
 
18926
19094
  // src/ui-action/uiaction-util.ts
@@ -19428,12 +19596,13 @@ var FrontUIActionProvider = class extends UIActionProviderBase {
19428
19596
  data,
19429
19597
  params
19430
19598
  );
19599
+ const options = this.handleViewOptionParams(resultParams);
19431
19600
  const res = await ibiz.commands.execute(
19432
19601
  OpenAppViewCommand.TAG,
19433
19602
  frontPSAppView,
19434
19603
  resultContext,
19435
19604
  resultParams,
19436
- { event, noWaitRoute }
19605
+ { event, noWaitRoute, ...options }
19437
19606
  );
19438
19607
  if (!(res == null ? void 0 : res.ok)) {
19439
19608
  actionResult.cancel = true;
@@ -19465,6 +19634,27 @@ var FrontUIActionProvider = class extends UIActionProviderBase {
19465
19634
  }
19466
19635
  return actionResult;
19467
19636
  }
19637
+ /**
19638
+ * 处理打开视图配置自定义参数 modalOption
19639
+ *
19640
+ * @author zk
19641
+ * @date 2024-02-01 01:02:28
19642
+ * @param {IData} param
19643
+ * @return {*} {IData}
19644
+ * @memberof FrontUIActionProvider
19645
+ */
19646
+ handleViewOptionParams(param) {
19647
+ if (param.modaloption) {
19648
+ try {
19649
+ const modalOption = JSON.parse(param.modaloption);
19650
+ delete param.modaloption;
19651
+ return { modalOption };
19652
+ } catch (error) {
19653
+ ibiz.log.error("\u89C6\u56FE\u53C2\u6570modalOption \u89E3\u6790\u5931\u8D25\uFF1A".concat(error));
19654
+ }
19655
+ }
19656
+ return {};
19657
+ }
19468
19658
  /**
19469
19659
  * 处理模式:用户自定义
19470
19660
  * @author lxm
@@ -25862,10 +26052,9 @@ var GridController = class extends MDControlController {
25862
26052
  var _a2;
25863
26053
  const type = (_a2 = _args.params) == null ? void 0 : _a2.type;
25864
26054
  let data2 = [];
25865
- if (type === "activatedPage") {
26055
+ if (!type || type === "activatedPage") {
25866
26056
  data2 = this.state.rows.map((row) => row.data);
25867
- }
25868
- if (type === "maxRowCount" || type === "customPage") {
26057
+ } else if (type === "maxRowCount" || type === "customPage") {
25869
26058
  const { size } = this.state;
25870
26059
  const { startPage, endPage } = _args.params;
25871
26060
  const params = type === "customPage" ? {
@@ -25874,8 +26063,7 @@ var GridController = class extends MDControlController {
25874
26063
  size: (endPage - startPage + 1) * size
25875
26064
  } : { size: 1e3, page: 0 };
25876
26065
  data2 = await this.loadData({ viewParam: params });
25877
- }
25878
- if (type === "selectedRows") {
26066
+ } else if (type === "selectedRows") {
25879
26067
  data2 = this.getData();
25880
26068
  }
25881
26069
  if (data2.length === 0) {
@@ -27602,8 +27790,9 @@ var PickupViewPanelController = class extends ControlController {
27602
27790
  };
27603
27791
 
27604
27792
  // src/controller/control/search-bar/search-bar.controller.ts
27605
- import { mergeInLeft as mergeInLeft3 } from "@ibiz-template/core";
27606
- import { clone as clone28 } from "ramda";
27793
+ import { mergeInLeft as mergeInLeft3, recursiveIterate as recursiveIterate10 } from "@ibiz-template/core";
27794
+ import { clone as clone28, isNil as isNil26 } from "ramda";
27795
+ import { isString as isString2 } from "lodash-es";
27607
27796
 
27608
27797
  // src/controller/control/search-bar/search-bar-filter.controller.ts
27609
27798
  import { RuntimeModelError as RuntimeModelError63 } from "@ibiz-template/core";
@@ -27611,10 +27800,11 @@ var ExcludeOPs = [
27611
27800
  "ISNULL" /* IS_NULL */,
27612
27801
  "ISNOTNULL" /* IS_NOT_NULL */
27613
27802
  ];
27803
+ var ScriptValueRegex = /\$\{[^}]*\}/;
27614
27804
  var SearchBarFilterController = class {
27615
- constructor(model, appDataEntity, context, params) {
27805
+ constructor(model, searchbar) {
27616
27806
  this.model = model;
27617
- this.appDataEntity = appDataEntity;
27807
+ this.searchbar = searchbar;
27618
27808
  /**
27619
27809
  * 不需要编辑器
27620
27810
  * @author lxm
@@ -27623,17 +27813,34 @@ var SearchBarFilterController = class {
27623
27813
  */
27624
27814
  this.noEditor = false;
27625
27815
  var _a;
27626
- this.context = context;
27627
- this.params = params;
27628
27816
  let field;
27629
27817
  if (model.appDEFieldId) {
27630
- field = findFieldById(appDataEntity, model.appDEFieldId);
27818
+ field = findFieldById(this.appDataEntity, model.appDEFieldId);
27631
27819
  }
27632
27820
  this.fieldName = field ? field.codeName.toLowerCase() : model.id;
27633
27821
  this.label = model.caption || (field == null ? void 0 : field.logicName) || model.id;
27634
27822
  this.valueOP = (_a = model.defsearchMode) == null ? void 0 : _a.valueOP;
27635
27823
  this.noEditor = this.valueOP ? ExcludeOPs.includes(this.valueOP) : !this.model.editor;
27636
27824
  }
27825
+ get context() {
27826
+ return this.searchbar.context;
27827
+ }
27828
+ get params() {
27829
+ return this.searchbar.params;
27830
+ }
27831
+ /**
27832
+ * 值项
27833
+ * @author lxm
27834
+ * @date 2024-02-04 06:25:42
27835
+ * @readonly
27836
+ * @type {(string | undefined)}
27837
+ */
27838
+ get valueItem() {
27839
+ return this.editor ? this.editor.valueItem : void 0;
27840
+ }
27841
+ get appDataEntity() {
27842
+ return this.searchbar.appDataEntity;
27843
+ }
27637
27844
  /**
27638
27845
  * 初始化
27639
27846
  * @author lxm
@@ -27654,6 +27861,60 @@ var SearchBarFilterController = class {
27654
27861
  }
27655
27862
  }
27656
27863
  }
27864
+ /**
27865
+ * 格式化给多数据查询接口的值
27866
+ * @author lxm
27867
+ * @date 2024-02-04 11:31:32
27868
+ * @param {*} value
27869
+ * @return {*} {*}
27870
+ */
27871
+ formatValue(node) {
27872
+ const { value, valueItem } = node;
27873
+ if (this.valueItem && valueItem) {
27874
+ delete node.valueItem;
27875
+ return valueItem;
27876
+ }
27877
+ if (ScriptValueRegex.test(value)) {
27878
+ return ScriptFactory.execSingleLine("`".concat(value, "`"), {
27879
+ ...this.searchbar.getEventArgs()
27880
+ });
27881
+ }
27882
+ return value;
27883
+ }
27884
+ /**
27885
+ * 计算要递给编辑器的参数
27886
+ * @author lxm
27887
+ * @date 2024-02-04 06:35:28
27888
+ * @param {IFilterLeafNode} node
27889
+ * @return {*} {{ value: unknown; data: IData }}
27890
+ */
27891
+ calcEditorProps(node) {
27892
+ const tempData = {};
27893
+ let editorValue = node.value;
27894
+ if (node.disabled && ScriptValueRegex.test(editorValue)) {
27895
+ editorValue = editorValue.replace("${context.srfpersonid}", "\u5F53\u524D\u7528\u6237");
27896
+ editorValue = editorValue.replace("${context.srforgid}", "\u5F53\u524D\u7EC4\u7EC7");
27897
+ }
27898
+ if (this.valueItem) {
27899
+ tempData[this.valueItem] = node.valueItem;
27900
+ }
27901
+ return { value: editorValue, data: tempData };
27902
+ }
27903
+ /**
27904
+ * 编辑器值变更处理
27905
+ * @author lxm
27906
+ * @date 2024-02-04 06:42:04
27907
+ * @param {IFilterLeafNode} node
27908
+ * @param {unknown} value
27909
+ * @param {string} [name]
27910
+ */
27911
+ onEditorChange(node, value, name) {
27912
+ if (this.valueItem && name === this.valueItem) {
27913
+ node.valueItem = value;
27914
+ } else {
27915
+ node.value = value;
27916
+ }
27917
+ }
27657
27918
  };
27658
27919
 
27659
27920
  // src/controller/control/search-bar/search-bar.service.ts
@@ -28018,12 +28279,17 @@ function formatFilters(node) {
28018
28279
  searchconds: node.children.map((item) => formatFilters(item))
28019
28280
  };
28020
28281
  }
28021
- return {
28282
+ const leafNode = node;
28283
+ const temp = {
28022
28284
  condtype: "DEFIELD",
28023
28285
  fieldname: node.field,
28024
28286
  condop: node.valueOP,
28025
28287
  value: node.value
28026
28288
  };
28289
+ if (leafNode.valueItem) {
28290
+ temp.valueItem = leafNode.valueItem;
28291
+ }
28292
+ return temp;
28027
28293
  }
28028
28294
  function parseFilters(data) {
28029
28295
  if (data.condtype === "GROUP") {
@@ -28040,7 +28306,8 @@ function parseFilters(data) {
28040
28306
  leaf: true,
28041
28307
  field: data.fieldname || null,
28042
28308
  valueOP: data.condop || null,
28043
- value: data.value || null
28309
+ value: data.value || null,
28310
+ valueItem: data.valueItem || void 0
28044
28311
  };
28045
28312
  }
28046
28313
  throw new RuntimeError58("\u65E0\u6548\u7684condtype:".concat(data.condtype));
@@ -28064,6 +28331,7 @@ function calcSearchConds(filterNodes) {
28064
28331
  }
28065
28332
 
28066
28333
  // src/controller/control/search-bar/search-bar.controller.ts
28334
+ var ScriptValueRegex2 = /\$\{[^}]*\}/;
28067
28335
  var SearchBarController = class extends ControlController {
28068
28336
  constructor() {
28069
28337
  super(...arguments);
@@ -28134,7 +28402,7 @@ var SearchBarController = class extends ControlController {
28134
28402
  * @Date: 2023-12-22 13:50:16
28135
28403
  */
28136
28404
  get grid() {
28137
- return this.ctx.getController("grid");
28405
+ return this.ctx.getController("grid") || this.ctx.getController("treegrid");
28138
28406
  }
28139
28407
  initState() {
28140
28408
  super.initState();
@@ -28259,6 +28527,22 @@ var SearchBarController = class extends ControlController {
28259
28527
  onSearch() {
28260
28528
  this.evt.emit("onSearch", void 0);
28261
28529
  }
28530
+ /**
28531
+ * 找到过滤项控制器
28532
+ * @author lxm
28533
+ * @date 2024-02-04 11:29:31
28534
+ * @param {(string | null)} fieldName
28535
+ * @param {(string | null)} valueOP
28536
+ * @return {*} {(SearchBarFilterController | undefined)}
28537
+ */
28538
+ findFilterController(fieldName, valueOP) {
28539
+ return this.filterControllers.find((item) => {
28540
+ if (item.fieldName === fieldName) {
28541
+ return item.valueOP ? item.valueOP === valueOP : true;
28542
+ }
28543
+ return false;
28544
+ });
28545
+ }
28262
28546
  /**
28263
28547
  * 获取搜索栏的过滤参数(包括快速搜索,快速分组和过滤器的参数)
28264
28548
  * @author lxm
@@ -28304,12 +28588,7 @@ var SearchBarController = class extends ControlController {
28304
28588
  var _a;
28305
28589
  if ((_a = this.searchBarFilters) == null ? void 0 : _a.length) {
28306
28590
  this.searchBarFilters.forEach((item) => {
28307
- const filterController = new SearchBarFilterController(
28308
- item,
28309
- this.appDataEntity,
28310
- this.context,
28311
- this.params
28312
- );
28591
+ const filterController = new SearchBarFilterController(item, this);
28313
28592
  this.filterControllers.push(filterController);
28314
28593
  });
28315
28594
  await Promise.all(
@@ -28323,11 +28602,28 @@ var SearchBarController = class extends ControlController {
28323
28602
  * @date 2023-10-13 05:53:35
28324
28603
  * @return {*} {IData}
28325
28604
  */
28326
- calcFilters() {
28605
+ calcFilters(valueFormat = true) {
28327
28606
  if (!this.enableFilter) {
28328
28607
  return;
28329
28608
  }
28330
28609
  const searchconds = calcSearchConds(this.state.filterNodes);
28610
+ if (valueFormat && searchconds) {
28611
+ recursiveIterate10(
28612
+ searchconds[0],
28613
+ (node) => {
28614
+ if (node.condtype === "DEFIELD" && !isNil26(node.value)) {
28615
+ const controller = this.findFilterController(
28616
+ node.fieldname,
28617
+ node.condop
28618
+ );
28619
+ if (controller) {
28620
+ node.value = controller.formatValue(node);
28621
+ }
28622
+ }
28623
+ },
28624
+ { childrenFields: ["searchconds"] }
28625
+ );
28626
+ }
28331
28627
  return searchconds;
28332
28628
  }
28333
28629
  /**
@@ -28443,7 +28739,7 @@ var SearchBarController = class extends ControlController {
28443
28739
  */
28444
28740
  async handleSave() {
28445
28741
  if (this.grid && this.state.selectedSearchGroupItem) {
28446
- const filters = this.calcFilters();
28742
+ const filters = this.calcFilters(false);
28447
28743
  const saveParams = {
28448
28744
  searchconds: filters,
28449
28745
  sort: this.grid.state.sortQuery,
@@ -28497,6 +28793,13 @@ var SearchBarController = class extends ControlController {
28497
28793
  } else {
28498
28794
  this.state.filterNodes = getOriginFilterNodes();
28499
28795
  }
28796
+ recursiveIterate10(this.state.filterNodes[0], (node) => {
28797
+ if (node.leaf) {
28798
+ if (node.field && node.valueOP && isString2(node.value) && ScriptValueRegex2.test(node.value)) {
28799
+ node.disabled = true;
28800
+ }
28801
+ }
28802
+ });
28500
28803
  if (this.grid && groupItem && groupItem.searchGroupData) {
28501
28804
  this.grid.setGroupParams(groupItem.searchGroupData);
28502
28805
  await this.grid.load({ isInitialLoad: true });
@@ -28744,7 +29047,7 @@ var TabExpPanelController = class extends ControlController {
28744
29047
  import {
28745
29048
  RuntimeError as RuntimeError59,
28746
29049
  RuntimeModelError as RuntimeModelError64,
28747
- recursiveIterate as recursiveIterate10
29050
+ recursiveIterate as recursiveIterate11
28748
29051
  } from "@ibiz-template/core";
28749
29052
 
28750
29053
  // src/controller/control/tree/tree.service.ts
@@ -29203,7 +29506,7 @@ var TreeController = class extends MDControlController {
29203
29506
  if ((_a2 = contextMenu == null ? void 0 : contextMenu.detoolbarItems) == null ? void 0 : _a2.length) {
29204
29507
  let itemNum = 0;
29205
29508
  const items = [];
29206
- recursiveIterate10(
29509
+ recursiveIterate11(
29207
29510
  contextMenu,
29208
29511
  (item) => {
29209
29512
  if (item.itemType === "DEUIACTION") {
@@ -29295,7 +29598,7 @@ var TreeController = class extends MDControlController {
29295
29598
  */
29296
29599
  async afterLoadNodes(nodes) {
29297
29600
  this.state.items = [];
29298
- recursiveIterate10(
29601
+ recursiveIterate11(
29299
29602
  { _children: this.state.rootNodes },
29300
29603
  (node) => {
29301
29604
  this.state.items.push(node);
@@ -29479,7 +29782,7 @@ var TreeController = class extends MDControlController {
29479
29782
  */
29480
29783
  calcExpandedKeys(nodes) {
29481
29784
  let expandedKeys = [...this.state.expandedKeys];
29482
- recursiveIterate10(
29785
+ recursiveIterate11(
29483
29786
  { _children: nodes },
29484
29787
  (node) => {
29485
29788
  var _a;
@@ -30097,7 +30400,7 @@ var WizardPanelController = class extends ControlController {
30097
30400
 
30098
30401
  // src/controller/control/md-ctrl/md-ctrl.controller.ts
30099
30402
  import { RuntimeModelError as RuntimeModelError65 } from "@ibiz-template/core";
30100
- import { isNil as isNil26 } from "ramda";
30403
+ import { isNil as isNil27 } from "ramda";
30101
30404
 
30102
30405
  // src/controller/control/md-ctrl/md-ctrl.service.ts
30103
30406
  var MDCtrlService = class extends MDControlService {
@@ -30324,7 +30627,7 @@ var MDCtrlController = class extends MDControlController {
30324
30627
  const groupMap = /* @__PURE__ */ new Map();
30325
30628
  items.forEach((item) => {
30326
30629
  const groupVal = item[groupAppDEFieldId];
30327
- if (isNil26(groupVal)) {
30630
+ if (isNil27(groupVal)) {
30328
30631
  return;
30329
30632
  }
30330
30633
  if (!groupMap.has(groupVal)) {
@@ -30401,7 +30704,7 @@ var MDCtrlController = class extends MDControlController {
30401
30704
 
30402
30705
  // src/controller/control/kanban/kanban.controller.ts
30403
30706
  import { RuntimeError as RuntimeError61, RuntimeModelError as RuntimeModelError66 } from "@ibiz-template/core";
30404
- import { isNil as isNil27 } from "ramda";
30707
+ import { isNil as isNil28 } from "ramda";
30405
30708
 
30406
30709
  // src/controller/control/kanban/kanban.service.ts
30407
30710
  var KanbanService = class extends DataViewControlService {
@@ -30486,7 +30789,7 @@ var KanbanController = class extends DataViewControlController {
30486
30789
  const isAsc = minorSortDir === "ASC";
30487
30790
  items.forEach((item) => {
30488
30791
  const sortValue = item[sortField];
30489
- if (isNil27(sortValue)) {
30792
+ if (isNil28(sortValue)) {
30490
30793
  item[sortField] = 0;
30491
30794
  } else {
30492
30795
  const toNum = Number(sortValue);
@@ -30593,7 +30896,7 @@ var KanbanController = class extends DataViewControlController {
30593
30896
  const groupMap = /* @__PURE__ */ new Map();
30594
30897
  items.forEach((item) => {
30595
30898
  const groupVal = item[groupAppDEFieldId];
30596
- if (isNil27(groupVal)) {
30899
+ if (isNil28(groupVal)) {
30597
30900
  return;
30598
30901
  }
30599
30902
  if (!groupMap.has(groupVal)) {
@@ -30923,7 +31226,7 @@ import {
30923
31226
  RuntimeError as RuntimeError62,
30924
31227
  RuntimeModelError as RuntimeModelError67,
30925
31228
  awaitTimeout as awaitTimeout3,
30926
- recursiveIterate as recursiveIterate11
31229
+ recursiveIterate as recursiveIterate12
30927
31230
  } from "@ibiz-template/core";
30928
31231
  import { clone as clone29 } from "ramda";
30929
31232
 
@@ -31145,7 +31448,7 @@ var TreeGridExController = class extends TreeController {
31145
31448
  }
31146
31449
  async afterLoadNodes(nodes) {
31147
31450
  await super.afterLoadNodes(nodes);
31148
- recursiveIterate11(
31451
+ recursiveIterate12(
31149
31452
  { _children: nodes },
31150
31453
  (node) => {
31151
31454
  this.state.rows[node._uuid] = new TreeGridExRowState(node, this);
@@ -33201,10 +33504,13 @@ var HubController = class {
33201
33504
  }
33202
33505
  };
33203
33506
 
33507
+ // src/controller/notification/notice.controller.ts
33508
+ import { QXEvent as QXEvent9 } from "qx-util";
33509
+
33204
33510
  // src/controller/notification/async-action.controller.ts
33205
33511
  import { QXEvent as QXEvent7 } from "qx-util";
33206
33512
  import { clone as clone31 } from "ramda";
33207
- import { isNil as isNil28, isNumber as isNumber2 } from "lodash-es";
33513
+ import { isNil as isNil29, isNumber as isNumber2 } from "lodash-es";
33208
33514
  import dayjs7 from "dayjs";
33209
33515
  var AsyncActionController = class {
33210
33516
  constructor() {
@@ -33279,14 +33585,14 @@ var AsyncActionController = class {
33279
33585
  data[key] = dayjs7(data[key]).format("YYYY-MM-DD HH:mm:ss");
33280
33586
  }
33281
33587
  });
33282
- if (!isNil28(data.actionresult)) {
33588
+ if (!isNil29(data.actionresult)) {
33283
33589
  try {
33284
33590
  const json = JSON.parse(data.actionresult);
33285
33591
  data.actionresult = json;
33286
33592
  } catch (error) {
33287
33593
  }
33288
33594
  }
33289
- if (!isNil28(data.completionrate)) {
33595
+ if (!isNil29(data.completionrate)) {
33290
33596
  const num = Number(data.completionrate);
33291
33597
  if (Number.isNaN(num)) {
33292
33598
  data.completionrate = void 0;
@@ -33343,10 +33649,17 @@ var AsyncActionController = class {
33343
33649
 
33344
33650
  // src/controller/notification/internal-message.controller.ts
33345
33651
  import { QXEvent as QXEvent8 } from "qx-util";
33652
+ function isHTML(str) {
33653
+ if (str === "")
33654
+ return false;
33655
+ const doc = new DOMParser().parseFromString(str, "text/html");
33656
+ return Array.from(doc.body.childNodes).some((node) => node.nodeType === 1);
33657
+ }
33346
33658
  var InternalMessageController = class {
33347
33659
  constructor() {
33348
33660
  this.evt = new QXEvent8();
33349
33661
  this.total = 0;
33662
+ this.unreadCount = 0;
33350
33663
  /**
33351
33664
  * 当前分页
33352
33665
  * @author lxm
@@ -33356,18 +33669,47 @@ var InternalMessageController = class {
33356
33669
  this.page = 0;
33357
33670
  this.size = 20;
33358
33671
  this.messages = [];
33672
+ this.unreadOnly = false;
33359
33673
  this.service = new InternalMessageService();
33360
33674
  }
33361
33675
  async init() {
33362
- this.load();
33676
+ await this.load();
33363
33677
  this.listenMqtt();
33678
+ await this.refreshUnreadCount();
33364
33679
  }
33365
33680
  async load() {
33366
- await this.fetch(false);
33681
+ try {
33682
+ await this.fetch(false);
33683
+ } catch (error) {
33684
+ ibiz.log.error(error);
33685
+ }
33367
33686
  }
33368
33687
  async loadMore() {
33369
33688
  await this.fetch(true);
33370
33689
  }
33690
+ async refreshUnreadCount() {
33691
+ try {
33692
+ this.unreadCount = await this.service.getUnreadNum();
33693
+ this.evt.emit("unreadCountChange", this.unreadCount);
33694
+ } catch (error) {
33695
+ ibiz.log.error(error);
33696
+ }
33697
+ }
33698
+ /**
33699
+ * 切换是否只读
33700
+ * @author lxm
33701
+ * @date 2024-02-04 10:21:22
33702
+ * @param {val} [boolean] 是否只读
33703
+ */
33704
+ toggleUnReadOnly(val) {
33705
+ const nextVal = val === void 0 ? !this.unreadOnly : val;
33706
+ if (this.unreadOnly === nextVal) {
33707
+ return;
33708
+ }
33709
+ this.unreadOnly = nextVal;
33710
+ this.evt.emit("unreadOnlyChange", this.unreadOnly);
33711
+ this.load();
33712
+ }
33371
33713
  async fetch(loadMore = false) {
33372
33714
  if (loadMore === false) {
33373
33715
  this.page = 0;
@@ -33379,6 +33721,23 @@ var InternalMessageController = class {
33379
33721
  size: this.size,
33380
33722
  sort: "update_time,desc"
33381
33723
  };
33724
+ if (this.unreadOnly) {
33725
+ fetchParams.searchconds = [
33726
+ {
33727
+ condtype: "GROUP",
33728
+ condop: "AND",
33729
+ bnotmode: false,
33730
+ searchconds: [
33731
+ {
33732
+ condop: "EQ",
33733
+ condtype: "DEFIELD",
33734
+ fieldname: "status",
33735
+ value: "RECEIVED"
33736
+ }
33737
+ ]
33738
+ }
33739
+ ];
33740
+ }
33382
33741
  const res = await this.service.fetch(fetchParams);
33383
33742
  this.total = res.total;
33384
33743
  if (loadMore) {
@@ -33400,14 +33759,44 @@ var InternalMessageController = class {
33400
33759
  if (msg.subtype !== "INTERNALMESSAGE") {
33401
33760
  return;
33402
33761
  }
33403
- ibiz.notification.info({ desc: msg.content, position: "bottom-right" });
33762
+ if (msg.content) {
33763
+ ibiz.notification.info({
33764
+ isHtmlDesc: isHTML(msg.content),
33765
+ desc: msg.content,
33766
+ position: "bottom-right"
33767
+ });
33768
+ }
33404
33769
  });
33405
33770
  }
33771
+ async markRead(message) {
33772
+ if (message.status !== "RECEIVED") {
33773
+ return;
33774
+ }
33775
+ const find = this.messages.find((msg) => msg.id === message.id);
33776
+ if (!find) {
33777
+ return;
33778
+ }
33779
+ await this.service.markRead(message.id);
33780
+ this.evt.emit("unreadCountChange", this.unreadCount);
33781
+ this.evt.emit("dataChange");
33782
+ }
33783
+ /**
33784
+ * 获取完整信息
33785
+ * @author lxm
33786
+ * @date 2024-01-30 05:03:25
33787
+ * @param {string} id
33788
+ * @return {*} {Promise<IInternalMessage>}
33789
+ */
33790
+ async get(id) {
33791
+ const res = await this.service.get(id);
33792
+ return res.data;
33793
+ }
33406
33794
  };
33407
33795
 
33408
33796
  // src/controller/notification/notice.controller.ts
33409
33797
  var NoticeController = class {
33410
33798
  constructor() {
33799
+ this.evt = new QXEvent9();
33411
33800
  this.total = 0;
33412
33801
  this.asyncAction = new AsyncActionController();
33413
33802
  this.internalMessage = new InternalMessageController();
@@ -33415,6 +33804,10 @@ var NoticeController = class {
33415
33804
  async init() {
33416
33805
  await this.internalMessage.init();
33417
33806
  await this.asyncAction.init();
33807
+ this.internalMessage.evt.on("unreadCountChange", () => {
33808
+ this.total = this.internalMessage.unreadCount;
33809
+ this.evt.emit("totalChange", this.total);
33810
+ });
33418
33811
  }
33419
33812
  };
33420
33813
 
@@ -34690,7 +35083,7 @@ var AppDEUILogicExecutor = class extends LogicExecutor {
34690
35083
  if (!appDEUILogicId) {
34691
35084
  throw new RuntimeModelError71(this.logic, "\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");
34692
35085
  }
34693
- execUILogic(appDEUILogicId, appDataEntityId, executeParams);
35086
+ return execUILogic(appDEUILogicId, appDataEntityId, executeParams);
34694
35087
  }
34695
35088
  };
34696
35089
 
@@ -35250,7 +35643,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
35250
35643
  openView,
35251
35644
  tempContext,
35252
35645
  tempParams,
35253
- rest
35646
+ { ...rest, openMode: openViewRef.openMode }
35254
35647
  );
35255
35648
  }
35256
35649
  async calcOpenViewRef(appUILogic, parameters) {
@@ -35355,7 +35748,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
35355
35748
  newViewRef.refAppViewId,
35356
35749
  tempContext,
35357
35750
  tempParams,
35358
- rest
35751
+ { ...rest, openMode: newViewRef.openMode }
35359
35752
  );
35360
35753
  if (enableBatchAdd && result.data) {
35361
35754
  await this.doBatchAdd(