@ibiz-template/runtime 0.5.7-alpha.9 → 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 (93) hide show
  1. package/dist/index.esm.js +326 -58
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +43 -5
  4. package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -1
  5. package/out/controller/control/search-bar/search-bar-filter.controller.js +79 -6
  6. package/out/controller/control/search-bar/search-bar.controller.d.ts +10 -1
  7. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  8. package/out/controller/control/search-bar/search-bar.controller.js +26 -8
  9. package/out/controller/control/search-bar/use-searchcond.d.ts.map +1 -1
  10. package/out/controller/control/search-bar/use-searchcond.js +7 -1
  11. package/out/controller/notification/internal-message.controller.d.ts +21 -2
  12. package/out/controller/notification/internal-message.controller.d.ts.map +1 -1
  13. package/out/controller/notification/internal-message.controller.js +91 -3
  14. package/out/controller/notification/notice.controller.d.ts +3 -1
  15. package/out/controller/notification/notice.controller.d.ts.map +1 -1
  16. package/out/controller/notification/notice.controller.js +6 -0
  17. package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts +59 -3
  18. package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts.map +1 -1
  19. package/out/interface/controller/controller/notice/i-notice.controller.d.ts +16 -0
  20. package/out/interface/controller/controller/notice/i-notice.controller.d.ts.map +1 -1
  21. package/out/interface/controller/controller/notice/index.d.ts +2 -2
  22. package/out/interface/controller/controller/notice/index.d.ts.map +1 -1
  23. package/out/interface/controller/state/control/i-grid.state.d.ts +7 -0
  24. package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
  25. package/out/interface/controller/state/control/i-search-bar.state.d.ts +7 -0
  26. package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
  27. package/out/interface/provider/i-internal-message.provider.d.ts +1 -1
  28. package/out/interface/provider/i-internal-message.provider.d.ts.map +1 -1
  29. package/out/interface/service/service/i-app-de.service.d.ts +1 -1
  30. package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
  31. package/out/interface/service/service/i-internal-message.service.d.ts +16 -1
  32. package/out/interface/service/service/i-internal-message.service.d.ts.map +1 -1
  33. package/out/interface/util/i-notification-util/i-notification-util.d.ts +7 -0
  34. package/out/interface/util/i-notification-util/i-notification-util.d.ts.map +1 -1
  35. package/out/logic-scheduler/executor/app-de-ui-logic-executor.js +1 -1
  36. package/out/logic-scheduler/executor/app-ui-logic-executor.js +2 -2
  37. package/out/service/de-service-util.d.ts +1 -1
  38. package/out/service/de-service-util.d.ts.map +1 -1
  39. package/out/service/de-service-util.js +2 -2
  40. package/out/service/service/control/control.service.d.ts +10 -2
  41. package/out/service/service/control/control.service.d.ts.map +1 -1
  42. package/out/service/service/control/control.service.js +17 -1
  43. package/out/service/service/control/md-control.service.d.ts +2 -2
  44. package/out/service/service/control/md-control.service.d.ts.map +1 -1
  45. package/out/service/service/entity/de.service.d.ts +1 -1
  46. package/out/service/service/entity/de.service.d.ts.map +1 -1
  47. package/out/service/service/entity/de.service.js +2 -2
  48. package/out/service/service/entity/method/de-action.d.ts +6 -6
  49. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  50. package/out/service/service/entity/method/de-action.js +16 -16
  51. package/out/service/service/entity/method/fetch.d.ts +1 -1
  52. package/out/service/service/entity/method/fetch.d.ts.map +1 -1
  53. package/out/service/service/entity/method/fetch.js +2 -2
  54. package/out/service/service/entity/method/method.d.ts +2 -2
  55. package/out/service/service/entity/method/method.d.ts.map +1 -1
  56. package/out/service/service/entity/method/method.js +4 -4
  57. package/out/service/service/internal-message/internal-message.service.d.ts +16 -1
  58. package/out/service/service/internal-message/internal-message.service.d.ts.map +1 -1
  59. package/out/service/service/internal-message/internal-message.service.js +42 -0
  60. package/out/service/utils/util/util.d.ts.map +1 -1
  61. package/out/service/utils/util/util.js +21 -1
  62. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  63. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +3 -0
  64. package/out/ui-logic/index.d.ts.map +1 -1
  65. package/out/ui-logic/index.js +1 -2
  66. package/package.json +5 -5
  67. package/src/controller/control/search-bar/search-bar-filter.controller.ts +90 -10
  68. package/src/controller/control/search-bar/search-bar.controller.ts +33 -18
  69. package/src/controller/control/search-bar/use-searchcond.ts +9 -2
  70. package/src/controller/notification/internal-message.controller.ts +102 -6
  71. package/src/controller/notification/notice.controller.ts +9 -1
  72. package/src/interface/controller/controller/notice/i-internal-message.controller.ts +66 -3
  73. package/src/interface/controller/controller/notice/i-notice.controller.ts +18 -0
  74. package/src/interface/controller/controller/notice/index.ts +2 -2
  75. package/src/interface/controller/state/control/i-grid.state.ts +8 -0
  76. package/src/interface/controller/state/control/i-search-bar.state.ts +8 -0
  77. package/src/interface/provider/i-internal-message.provider.ts +1 -2
  78. package/src/interface/service/service/i-app-de.service.ts +1 -0
  79. package/src/interface/service/service/i-internal-message.service.ts +18 -1
  80. package/src/interface/util/i-notification-util/i-notification-util.ts +9 -0
  81. package/src/logic-scheduler/executor/app-de-ui-logic-executor.ts +1 -1
  82. package/src/logic-scheduler/executor/app-ui-logic-executor.ts +2 -2
  83. package/src/service/de-service-util.ts +2 -1
  84. package/src/service/service/control/control.service.ts +20 -2
  85. package/src/service/service/control/md-control.service.ts +2 -2
  86. package/src/service/service/entity/de.service.ts +2 -1
  87. package/src/service/service/entity/method/de-action.ts +16 -7
  88. package/src/service/service/entity/method/fetch.ts +2 -1
  89. package/src/service/service/entity/method/method.ts +5 -0
  90. package/src/service/service/internal-message/internal-message.service.ts +46 -2
  91. package/src/service/utils/util/util.ts +20 -1
  92. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +2 -0
  93. package/src/ui-logic/index.ts +1 -2
package/dist/index.esm.js CHANGED
@@ -7208,7 +7208,26 @@ var SearchFilter = class {
7208
7208
 
7209
7209
  // src/service/utils/util/util.ts
7210
7210
  function fieldValueToBoolean(value) {
7211
- 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
+ }
7212
7231
  }
7213
7232
 
7214
7233
  // src/service/utils/dyna-sys-params/dyna-sys-params.ts
@@ -8411,10 +8430,10 @@ var DEService = class {
8411
8430
  * @param {IParams} [params2={}] 查询参数
8412
8431
  * @return {*} {Promise<IHttpResponse>}
8413
8432
  */
8414
- async exec(id, context, params, params2) {
8433
+ async exec(id, context, params, params2, header) {
8415
8434
  const method = await this.getMethod(id);
8416
8435
  if (method) {
8417
- return method.exec(context, params, params2);
8436
+ return method.exec(context, params, params2, header);
8418
8437
  }
8419
8438
  throw new RuntimeError19("".concat(this.model.codeName, "\u672A\u652F\u6301\u300C").concat(id, "\u300D\u65B9\u6CD5"));
8420
8439
  }
@@ -8829,15 +8848,32 @@ var ControlService = class {
8829
8848
  * @returns {*} {Promise<IHttpResponse>}
8830
8849
  */
8831
8850
  async exec(methodName, context, data, params) {
8851
+ const header = this.handleCustomRequestHeader();
8832
8852
  const res = await this.app.deService.exec(
8833
8853
  this.model.appDataEntityId,
8834
8854
  methodName,
8835
8855
  context,
8836
8856
  data,
8837
- params
8857
+ params,
8858
+ header
8838
8859
  );
8839
8860
  return res;
8840
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
+ }
8841
8877
  /**
8842
8878
  * 处理响应
8843
8879
  *
@@ -9566,7 +9602,7 @@ var Method = class {
9566
9602
  * @param {IParams} params
9567
9603
  * @return {*} {Promise<HttpResponse<any>>}
9568
9604
  */
9569
- async request(path2, context, data, params) {
9605
+ async request(path2, context, data, params, header) {
9570
9606
  const { actionType, requestMethod } = this.method;
9571
9607
  if (actionType === "REMOTE") {
9572
9608
  const methodName = this.method.codeName.toLowerCase();
@@ -9575,19 +9611,22 @@ var Method = class {
9575
9611
  case "POST":
9576
9612
  res = await this.app.net.post(
9577
9613
  this.mergeRequestPath(path2, methodName),
9578
- data || params || {}
9614
+ data || params || {},
9615
+ header
9579
9616
  );
9580
9617
  break;
9581
9618
  case "GET":
9582
9619
  res = await this.app.net.get(
9583
9620
  this.mergeRequestPath(path2, methodName),
9584
- data || params
9621
+ data || params,
9622
+ header
9585
9623
  );
9586
9624
  break;
9587
9625
  case "PUT": {
9588
9626
  res = await this.app.net.put(
9589
9627
  this.mergeRequestPath(path2, methodName),
9590
- data || params || {}
9628
+ data || params || {},
9629
+ header
9591
9630
  );
9592
9631
  break;
9593
9632
  }
@@ -10766,7 +10805,7 @@ var DEActionMethod = class extends Method {
10766
10805
  }
10767
10806
  return this.input.handle(context, data);
10768
10807
  }
10769
- async exec(context, data, params) {
10808
+ async exec(context, data, params, header) {
10770
10809
  let result;
10771
10810
  if (data && !["READ", "GETDRAFT"].includes(this.method.actionMode)) {
10772
10811
  await execFieldLogics(this.entity, "change", context, data, params);
@@ -10783,19 +10822,19 @@ var DEActionMethod = class extends Method {
10783
10822
  }
10784
10823
  switch (this.method.codeName) {
10785
10824
  case "Create":
10786
- result = await this.create(context, data, params || {});
10825
+ result = await this.create(context, data, params || {}, header);
10787
10826
  break;
10788
10827
  case "Get":
10789
- result = await this.get(context, params);
10828
+ result = await this.get(context, params, header);
10790
10829
  break;
10791
10830
  case "GetDraft":
10792
- result = await this.getDraft(context, params);
10831
+ result = await this.getDraft(context, params, header);
10793
10832
  break;
10794
10833
  case "Remove":
10795
10834
  result = await this.remove(context, params);
10796
10835
  break;
10797
10836
  case "Update":
10798
- result = await this.update(context, data, params);
10837
+ result = await this.update(context, data, params, header);
10799
10838
  break;
10800
10839
  case "CreateTemp":
10801
10840
  result = await this.createTemp(context, data);
@@ -10821,7 +10860,7 @@ var DEActionMethod = class extends Method {
10821
10860
  }
10822
10861
  path2 = "".concat(path2, "/").concat(srfkey);
10823
10862
  }
10824
- const res = await this.request(path2, context, data, params);
10863
+ const res = await this.request(path2, context, data, params, header);
10825
10864
  res.data = await this.result.handle(context, res.data);
10826
10865
  result = res;
10827
10866
  }
@@ -10847,7 +10886,7 @@ var DEActionMethod = class extends Method {
10847
10886
  * @param {IData} data
10848
10887
  * @return {*} {Promise<IHttpResponse<IData>>}
10849
10888
  */
10850
- async create(context, data, params) {
10889
+ async create(context, data, params, header) {
10851
10890
  if (!data) {
10852
10891
  throw new RuntimeError23("create\u884C\u4E3A\u6CA1\u6709\u4F20data");
10853
10892
  }
@@ -10855,7 +10894,7 @@ var DEActionMethod = class extends Method {
10855
10894
  return this.createTemp(context, this.createEntity(data));
10856
10895
  }
10857
10896
  const path2 = this.calcPath(context);
10858
- const res = await this.app.net.post(path2, data, params);
10897
+ const res = await this.app.net.post(path2, data, params, header);
10859
10898
  res.data = await this.result.handle(context, res.data);
10860
10899
  return res;
10861
10900
  }
@@ -10868,14 +10907,15 @@ var DEActionMethod = class extends Method {
10868
10907
  * @param {IParams} [params]
10869
10908
  * @return {*} {Promise<IHttpResponse<IDataEntity>>}
10870
10909
  */
10871
- async remove(context, params) {
10910
+ async remove(context, params, header) {
10872
10911
  if (this.isLocalMode) {
10873
10912
  return this.removeTemp(context, params);
10874
10913
  }
10875
10914
  const path2 = this.calcPath(context);
10876
10915
  const res = await this.app.net.delete(
10877
10916
  "".concat(path2, "/").concat(context[this.entity.codeName.toLowerCase()]),
10878
- params
10917
+ params,
10918
+ header
10879
10919
  );
10880
10920
  return res;
10881
10921
  }
@@ -10889,7 +10929,7 @@ var DEActionMethod = class extends Method {
10889
10929
  * @param {IParams} [params={}]
10890
10930
  * @return {*} {Promise<IHttpResponse<IDataEntity>>}
10891
10931
  */
10892
- async update(context, data, params) {
10932
+ async update(context, data, params, header) {
10893
10933
  if (!data) {
10894
10934
  throw new RuntimeError23("update\u884C\u4E3A\u6CA1\u6709\u4F20data");
10895
10935
  }
@@ -10900,7 +10940,8 @@ var DEActionMethod = class extends Method {
10900
10940
  const res = await this.app.net.put(
10901
10941
  "".concat(path2, "/").concat(context[this.entity.codeName.toLowerCase()]),
10902
10942
  data,
10903
- params
10943
+ params,
10944
+ header
10904
10945
  );
10905
10946
  res.data = await this.result.handle(context, res.data);
10906
10947
  return res;
@@ -10914,14 +10955,15 @@ var DEActionMethod = class extends Method {
10914
10955
  * @param {IParams} [params]
10915
10956
  * @return {*} {Promise<IHttpResponse<IDataEntity>>}
10916
10957
  */
10917
- async get(context, params = {}) {
10958
+ async get(context, params = {}, header = {}) {
10918
10959
  if (this.isLocalMode) {
10919
10960
  return this.getTemp(context, params);
10920
10961
  }
10921
10962
  const path2 = this.calcPath(context);
10922
10963
  const res = await this.app.net.get(
10923
10964
  "".concat(path2, "/").concat(context[this.entity.codeName.toLowerCase()]),
10924
- params
10965
+ params,
10966
+ header
10925
10967
  );
10926
10968
  res.data = await this.result.handle(context, res.data);
10927
10969
  return res;
@@ -10935,12 +10977,12 @@ var DEActionMethod = class extends Method {
10935
10977
  * @param {IParams} [params]
10936
10978
  * @return {*} {Promise<IHttpResponse<IData>>}
10937
10979
  */
10938
- async getDraft(context, params) {
10980
+ async getDraft(context, params, header) {
10939
10981
  if (this.isLocalMode) {
10940
10982
  return this.getDraftTemp(context, params);
10941
10983
  }
10942
10984
  const path2 = this.calcPath(context);
10943
- const res = await this.app.net.get("".concat(path2, "/getdraft"), params);
10985
+ const res = await this.app.net.get("".concat(path2, "/getdraft"), params, header);
10944
10986
  res.data = await this.result.handle(context, res.data);
10945
10987
  return res;
10946
10988
  }
@@ -11241,7 +11283,7 @@ import { isArray as isArray7 } from "lodash-es";
11241
11283
  import { clone as clone15, isEmpty as isEmpty7, isNil as isNil11 } from "ramda";
11242
11284
  import { ascSort as ascSort2, descSort } from "qx-util";
11243
11285
  var FetchMethod = class extends Method {
11244
- async exec(context, params, params2) {
11286
+ async exec(context, params, params2, header) {
11245
11287
  const searchParams = params && !isArray7(params) ? params : params2 || {};
11246
11288
  let res;
11247
11289
  if (this.isLocalMode) {
@@ -11259,7 +11301,7 @@ var FetchMethod = class extends Method {
11259
11301
  case "REMOTE":
11260
11302
  {
11261
11303
  const path2 = this.calcPath(context);
11262
- res = await this.request(path2, context, params, params2);
11304
+ res = await this.request(path2, context, params, params2, header);
11263
11305
  }
11264
11306
  break;
11265
11307
  default:
@@ -11437,6 +11479,48 @@ var InternalMessageService = class {
11437
11479
  const res = await ibiz.net.get("".concat(this.baseUrl, "/").concat(messageId));
11438
11480
  return res;
11439
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
+ }
11440
11524
  };
11441
11525
 
11442
11526
  // src/service/service/mark-open-data/mark-open-data.service.ts
@@ -11631,6 +11715,8 @@ var TreeDataSetNodeData = class _TreeDataSetNodeData extends TreeNodeData {
11631
11715
  this._textHtml = this.calcTextHtml(model);
11632
11716
  if (model.leafFlagAppDEFieldId) {
11633
11717
  this._leaf = fieldValueToBoolean(data[model.leafFlagAppDEFieldId]);
11718
+ } else if (model.childCntAppDEFieldId) {
11719
+ this._leaf = !fieldValueToBoolean(data[model.childCntAppDEFieldId]);
11634
11720
  }
11635
11721
  const dataItemKeyMap = /* @__PURE__ */ new Map();
11636
11722
  const dataItemDefaultMap = /* @__PURE__ */ new Map();
@@ -12503,9 +12589,9 @@ var _DEServiceUtil = class _DEServiceUtil {
12503
12589
  * @param {(IParams | undefined)} [params2] 视图参数
12504
12590
  * @return {*} {Promise<IHttpResponse<IData>>}
12505
12591
  */
12506
- async exec(appDataEntityId, methodName, context, params, params2) {
12592
+ async exec(appDataEntityId, methodName, context, params, params2, header) {
12507
12593
  const service = await this.getService(context, appDataEntityId);
12508
- return service.exec(methodName, context, params, params2);
12594
+ return service.exec(methodName, context, params, params2, header);
12509
12595
  }
12510
12596
  };
12511
12597
  /**
@@ -19002,8 +19088,7 @@ async function execUILogic(deUILogicId, appDataEntityId, parameters) {
19002
19088
  uiLogicMap.set(deUILogic, new UILogic(deUILogic));
19003
19089
  }
19004
19090
  const uiLogic = uiLogicMap.get(deUILogic);
19005
- await uiLogic.exec(parameters);
19006
- return null;
19091
+ return uiLogic.exec(parameters);
19007
19092
  }
19008
19093
 
19009
19094
  // src/ui-action/uiaction-util.ts
@@ -27715,10 +27800,11 @@ var ExcludeOPs = [
27715
27800
  "ISNULL" /* IS_NULL */,
27716
27801
  "ISNOTNULL" /* IS_NOT_NULL */
27717
27802
  ];
27803
+ var ScriptValueRegex = /\$\{[^}]*\}/;
27718
27804
  var SearchBarFilterController = class {
27719
- constructor(model, appDataEntity, context, params) {
27805
+ constructor(model, searchbar) {
27720
27806
  this.model = model;
27721
- this.appDataEntity = appDataEntity;
27807
+ this.searchbar = searchbar;
27722
27808
  /**
27723
27809
  * 不需要编辑器
27724
27810
  * @author lxm
@@ -27727,17 +27813,34 @@ var SearchBarFilterController = class {
27727
27813
  */
27728
27814
  this.noEditor = false;
27729
27815
  var _a;
27730
- this.context = context;
27731
- this.params = params;
27732
27816
  let field;
27733
27817
  if (model.appDEFieldId) {
27734
- field = findFieldById(appDataEntity, model.appDEFieldId);
27818
+ field = findFieldById(this.appDataEntity, model.appDEFieldId);
27735
27819
  }
27736
27820
  this.fieldName = field ? field.codeName.toLowerCase() : model.id;
27737
27821
  this.label = model.caption || (field == null ? void 0 : field.logicName) || model.id;
27738
27822
  this.valueOP = (_a = model.defsearchMode) == null ? void 0 : _a.valueOP;
27739
27823
  this.noEditor = this.valueOP ? ExcludeOPs.includes(this.valueOP) : !this.model.editor;
27740
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
+ }
27741
27844
  /**
27742
27845
  * 初始化
27743
27846
  * @author lxm
@@ -27758,6 +27861,60 @@ var SearchBarFilterController = class {
27758
27861
  }
27759
27862
  }
27760
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
+ }
27761
27918
  };
27762
27919
 
27763
27920
  // src/controller/control/search-bar/search-bar.service.ts
@@ -28122,12 +28279,17 @@ function formatFilters(node) {
28122
28279
  searchconds: node.children.map((item) => formatFilters(item))
28123
28280
  };
28124
28281
  }
28125
- return {
28282
+ const leafNode = node;
28283
+ const temp = {
28126
28284
  condtype: "DEFIELD",
28127
28285
  fieldname: node.field,
28128
28286
  condop: node.valueOP,
28129
28287
  value: node.value
28130
28288
  };
28289
+ if (leafNode.valueItem) {
28290
+ temp.valueItem = leafNode.valueItem;
28291
+ }
28292
+ return temp;
28131
28293
  }
28132
28294
  function parseFilters(data) {
28133
28295
  if (data.condtype === "GROUP") {
@@ -28144,7 +28306,8 @@ function parseFilters(data) {
28144
28306
  leaf: true,
28145
28307
  field: data.fieldname || null,
28146
28308
  valueOP: data.condop || null,
28147
- value: data.value || null
28309
+ value: data.value || null,
28310
+ valueItem: data.valueItem || void 0
28148
28311
  };
28149
28312
  }
28150
28313
  throw new RuntimeError58("\u65E0\u6548\u7684condtype:".concat(data.condtype));
@@ -28168,7 +28331,7 @@ function calcSearchConds(filterNodes) {
28168
28331
  }
28169
28332
 
28170
28333
  // src/controller/control/search-bar/search-bar.controller.ts
28171
- var ScriptValueRegex = /\$\{[^}]*\}/;
28334
+ var ScriptValueRegex2 = /\$\{[^}]*\}/;
28172
28335
  var SearchBarController = class extends ControlController {
28173
28336
  constructor() {
28174
28337
  super(...arguments);
@@ -28364,6 +28527,22 @@ var SearchBarController = class extends ControlController {
28364
28527
  onSearch() {
28365
28528
  this.evt.emit("onSearch", void 0);
28366
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
+ }
28367
28546
  /**
28368
28547
  * 获取搜索栏的过滤参数(包括快速搜索,快速分组和过滤器的参数)
28369
28548
  * @author lxm
@@ -28409,12 +28588,7 @@ var SearchBarController = class extends ControlController {
28409
28588
  var _a;
28410
28589
  if ((_a = this.searchBarFilters) == null ? void 0 : _a.length) {
28411
28590
  this.searchBarFilters.forEach((item) => {
28412
- const filterController = new SearchBarFilterController(
28413
- item,
28414
- this.appDataEntity,
28415
- this.context,
28416
- this.params
28417
- );
28591
+ const filterController = new SearchBarFilterController(item, this);
28418
28592
  this.filterControllers.push(filterController);
28419
28593
  });
28420
28594
  await Promise.all(
@@ -28428,19 +28602,23 @@ var SearchBarController = class extends ControlController {
28428
28602
  * @date 2023-10-13 05:53:35
28429
28603
  * @return {*} {IData}
28430
28604
  */
28431
- calcFilters() {
28605
+ calcFilters(valueFormat = true) {
28432
28606
  if (!this.enableFilter) {
28433
28607
  return;
28434
28608
  }
28435
28609
  const searchconds = calcSearchConds(this.state.filterNodes);
28436
- if (searchconds) {
28610
+ if (valueFormat && searchconds) {
28437
28611
  recursiveIterate10(
28438
28612
  searchconds[0],
28439
28613
  (node) => {
28440
- if (node.condtype === "DEFIELD" && !isNil26(node.value) && ScriptValueRegex.test(node.value)) {
28441
- node.value = ScriptFactory.execSingleLine("`".concat(node.value, "`"), {
28442
- ...this.getEventArgs()
28443
- });
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
+ }
28444
28622
  }
28445
28623
  },
28446
28624
  { childrenFields: ["searchconds"] }
@@ -28561,7 +28739,7 @@ var SearchBarController = class extends ControlController {
28561
28739
  */
28562
28740
  async handleSave() {
28563
28741
  if (this.grid && this.state.selectedSearchGroupItem) {
28564
- const filters = this.calcFilters();
28742
+ const filters = this.calcFilters(false);
28565
28743
  const saveParams = {
28566
28744
  searchconds: filters,
28567
28745
  sort: this.grid.state.sortQuery,
@@ -28617,7 +28795,7 @@ var SearchBarController = class extends ControlController {
28617
28795
  }
28618
28796
  recursiveIterate10(this.state.filterNodes[0], (node) => {
28619
28797
  if (node.leaf) {
28620
- if (node.field && node.valueOP && isString2(node.value) && ScriptValueRegex.test(node.value)) {
28798
+ if (node.field && node.valueOP && isString2(node.value) && ScriptValueRegex2.test(node.value)) {
28621
28799
  node.disabled = true;
28622
28800
  }
28623
28801
  }
@@ -33326,6 +33504,9 @@ var HubController = class {
33326
33504
  }
33327
33505
  };
33328
33506
 
33507
+ // src/controller/notification/notice.controller.ts
33508
+ import { QXEvent as QXEvent9 } from "qx-util";
33509
+
33329
33510
  // src/controller/notification/async-action.controller.ts
33330
33511
  import { QXEvent as QXEvent7 } from "qx-util";
33331
33512
  import { clone as clone31 } from "ramda";
@@ -33468,10 +33649,17 @@ var AsyncActionController = class {
33468
33649
 
33469
33650
  // src/controller/notification/internal-message.controller.ts
33470
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
+ }
33471
33658
  var InternalMessageController = class {
33472
33659
  constructor() {
33473
33660
  this.evt = new QXEvent8();
33474
33661
  this.total = 0;
33662
+ this.unreadCount = 0;
33475
33663
  /**
33476
33664
  * 当前分页
33477
33665
  * @author lxm
@@ -33481,18 +33669,47 @@ var InternalMessageController = class {
33481
33669
  this.page = 0;
33482
33670
  this.size = 20;
33483
33671
  this.messages = [];
33672
+ this.unreadOnly = false;
33484
33673
  this.service = new InternalMessageService();
33485
33674
  }
33486
33675
  async init() {
33487
- this.load();
33676
+ await this.load();
33488
33677
  this.listenMqtt();
33678
+ await this.refreshUnreadCount();
33489
33679
  }
33490
33680
  async load() {
33491
- await this.fetch(false);
33681
+ try {
33682
+ await this.fetch(false);
33683
+ } catch (error) {
33684
+ ibiz.log.error(error);
33685
+ }
33492
33686
  }
33493
33687
  async loadMore() {
33494
33688
  await this.fetch(true);
33495
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
+ }
33496
33713
  async fetch(loadMore = false) {
33497
33714
  if (loadMore === false) {
33498
33715
  this.page = 0;
@@ -33504,6 +33721,23 @@ var InternalMessageController = class {
33504
33721
  size: this.size,
33505
33722
  sort: "update_time,desc"
33506
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
+ }
33507
33741
  const res = await this.service.fetch(fetchParams);
33508
33742
  this.total = res.total;
33509
33743
  if (loadMore) {
@@ -33525,14 +33759,44 @@ var InternalMessageController = class {
33525
33759
  if (msg.subtype !== "INTERNALMESSAGE") {
33526
33760
  return;
33527
33761
  }
33528
- 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
+ }
33529
33769
  });
33530
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
+ }
33531
33794
  };
33532
33795
 
33533
33796
  // src/controller/notification/notice.controller.ts
33534
33797
  var NoticeController = class {
33535
33798
  constructor() {
33799
+ this.evt = new QXEvent9();
33536
33800
  this.total = 0;
33537
33801
  this.asyncAction = new AsyncActionController();
33538
33802
  this.internalMessage = new InternalMessageController();
@@ -33540,6 +33804,10 @@ var NoticeController = class {
33540
33804
  async init() {
33541
33805
  await this.internalMessage.init();
33542
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
+ });
33543
33811
  }
33544
33812
  };
33545
33813
 
@@ -34815,7 +35083,7 @@ var AppDEUILogicExecutor = class extends LogicExecutor {
34815
35083
  if (!appDEUILogicId) {
34816
35084
  throw new RuntimeModelError71(this.logic, "\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");
34817
35085
  }
34818
- execUILogic(appDEUILogicId, appDataEntityId, executeParams);
35086
+ return execUILogic(appDEUILogicId, appDataEntityId, executeParams);
34819
35087
  }
34820
35088
  };
34821
35089
 
@@ -35375,7 +35643,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
35375
35643
  openView,
35376
35644
  tempContext,
35377
35645
  tempParams,
35378
- rest
35646
+ { ...rest, openMode: openViewRef.openMode }
35379
35647
  );
35380
35648
  }
35381
35649
  async calcOpenViewRef(appUILogic, parameters) {
@@ -35480,7 +35748,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
35480
35748
  newViewRef.refAppViewId,
35481
35749
  tempContext,
35482
35750
  tempParams,
35483
- rest
35751
+ { ...rest, openMode: newViewRef.openMode }
35484
35752
  );
35485
35753
  if (enableBatchAdd && result.data) {
35486
35754
  await this.doBatchAdd(