@ibiz-template/runtime 0.5.0-beta.0 → 0.5.0-beta.1

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 (70) hide show
  1. package/dist/index.esm.js +352 -553
  2. package/dist/index.system.min.js +2 -2
  3. package/out/controller/common/control/md-control.controller.d.ts +21 -1
  4. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  5. package/out/controller/common/control/md-control.controller.js +31 -0
  6. package/out/controller/control/gantt/gantt.controller.d.ts +6 -189
  7. package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
  8. package/out/controller/control/gantt/gantt.controller.js +6 -412
  9. package/out/controller/control/gantt/gantt.service.d.ts +2 -2
  10. package/out/controller/control/gantt/gantt.service.d.ts.map +1 -1
  11. package/out/controller/control/gantt/gantt.service.js +5 -5
  12. package/out/controller/control/list/list.controller.d.ts +1 -30
  13. package/out/controller/control/list/list.controller.d.ts.map +1 -1
  14. package/out/controller/control/list/list.controller.js +0 -41
  15. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  16. package/out/controller/control/search-bar/search-bar.controller.js +48 -4
  17. package/out/controller/control/search-bar/search-bar.service.d.ts +24 -0
  18. package/out/controller/control/search-bar/search-bar.service.d.ts.map +1 -1
  19. package/out/controller/control/search-bar/search-bar.service.js +62 -16
  20. package/out/interface/controller/event/control/i-gantt.event.d.ts +2 -44
  21. package/out/interface/controller/event/control/i-gantt.event.d.ts.map +1 -1
  22. package/out/interface/controller/state/control/i-gantt.state.d.ts +2 -41
  23. package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
  24. package/out/interface/controller/state/control/i-search-bar.state.d.ts +8 -1
  25. package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
  26. package/out/interface/service/i-parent-config/i-parent-config.d.ts +67 -0
  27. package/out/interface/service/i-parent-config/i-parent-config.d.ts.map +1 -0
  28. package/out/interface/service/i-parent-config/i-parent-config.js +1 -0
  29. package/out/interface/service/index.d.ts +1 -0
  30. package/out/interface/service/index.d.ts.map +1 -1
  31. package/out/service/dto/method.dto.d.ts +20 -0
  32. package/out/service/dto/method.dto.d.ts.map +1 -1
  33. package/out/service/dto/method.dto.js +63 -1
  34. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +0 -1
  35. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
  36. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.js +1 -2
  37. package/out/service/vo/gantt-node-data/gantt-node-data-util.d.ts +0 -7
  38. package/out/service/vo/gantt-node-data/gantt-node-data-util.d.ts.map +1 -1
  39. package/out/service/vo/gantt-node-data/gantt-node-data-util.js +0 -18
  40. package/out/ui-action/provider/ui-action-provider-base.d.ts +10 -0
  41. package/out/ui-action/provider/ui-action-provider-base.d.ts.map +1 -1
  42. package/out/ui-action/provider/ui-action-provider-base.js +20 -9
  43. package/out/utils/index.d.ts +1 -1
  44. package/out/utils/index.d.ts.map +1 -1
  45. package/out/utils/index.js +1 -1
  46. package/out/utils/open-redirect-view/open-redirect-view.d.ts +25 -1
  47. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  48. package/out/utils/open-redirect-view/open-redirect-view.js +72 -31
  49. package/out/utils/ui-domain/ui-domain.d.ts +28 -0
  50. package/out/utils/ui-domain/ui-domain.d.ts.map +1 -1
  51. package/out/utils/ui-domain/ui-domain.js +40 -0
  52. package/package.json +5 -5
  53. package/src/controller/common/control/md-control.controller.ts +43 -0
  54. package/src/controller/control/gantt/gantt.controller.ts +7 -492
  55. package/src/controller/control/gantt/gantt.service.ts +5 -5
  56. package/src/controller/control/list/list.controller.ts +0 -54
  57. package/src/controller/control/search-bar/search-bar.controller.ts +63 -10
  58. package/src/controller/control/search-bar/search-bar.service.ts +70 -16
  59. package/src/interface/controller/event/control/i-gantt.event.ts +2 -38
  60. package/src/interface/controller/state/control/i-gantt.state.ts +2 -47
  61. package/src/interface/controller/state/control/i-search-bar.state.ts +9 -1
  62. package/src/interface/service/i-parent-config/i-parent-config.ts +66 -0
  63. package/src/interface/service/index.ts +1 -0
  64. package/src/service/dto/method.dto.ts +74 -1
  65. package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +1 -4
  66. package/src/service/vo/gantt-node-data/gantt-node-data-util.ts +0 -21
  67. package/src/ui-action/provider/ui-action-provider-base.ts +34 -15
  68. package/src/utils/index.ts +1 -0
  69. package/src/utils/open-redirect-view/open-redirect-view.ts +93 -38
  70. package/src/utils/ui-domain/ui-domain.ts +44 -0
package/dist/index.esm.js CHANGED
@@ -1091,15 +1091,14 @@ async function toLocalOpenWFRedirectView(context, linkUrl, opts = {}) {
1091
1091
  context.srfprocessinstanceid = params.srfprocessinstanceid;
1092
1092
  delete params.srfprocessinstanceid;
1093
1093
  }
1094
- await ibiz.commands.execute(
1095
- OpenAppViewCommand.TAG,
1096
- deRdView.id,
1094
+ return {
1097
1095
  context,
1098
1096
  params,
1099
- opts
1100
- );
1097
+ opts,
1098
+ viewId: deRdView.id
1099
+ };
1101
1100
  }
1102
- async function openDERedirectView(appView, context, params = {}, opts = {}) {
1101
+ async function getDERedirectToView(appView, context, params = {}, opts = {}) {
1103
1102
  var _a;
1104
1103
  const navContext = appView.appViewNavContexts || [];
1105
1104
  const navContextData = convertNavData(navContext, params, context);
@@ -1128,20 +1127,17 @@ async function openDERedirectView(appView, context, params = {}, opts = {}) {
1128
1127
  linkUrl = linkUrl.slice(linkUrl.indexOf("appredirectview?"));
1129
1128
  }
1130
1129
  if (linkUrl.startsWith("http://") || linkUrl.startsWith("https://")) {
1131
- return new Promise((resolve) => {
1132
- const newWindow = window.open(linkUrl, "_blank");
1133
- if (newWindow) {
1134
- newWindow.callback = () => {
1135
- resolve({ ok: true, data: [] });
1136
- };
1137
- }
1138
- });
1130
+ return { type: "url", url: linkUrl };
1139
1131
  }
1140
1132
  if (linkUrl.startsWith("appredirectview?")) {
1141
- await toLocalOpenWFRedirectView(context, linkUrl, opts);
1142
- return { ok: true, data: [] };
1133
+ const toView = await toLocalOpenWFRedirectView(
1134
+ context,
1135
+ linkUrl,
1136
+ opts
1137
+ );
1138
+ return { type: "view", ...toView };
1143
1139
  }
1144
- return { ok: false, data: [] };
1140
+ throw new RuntimeError("\u672A\u652F\u6301\u7684linkUrl\u683C\u5F0F:".concat(linkUrl));
1145
1141
  }
1146
1142
  }
1147
1143
  } finally {
@@ -1152,27 +1148,29 @@ async function openDERedirectView(appView, context, params = {}, opts = {}) {
1152
1148
  const rdTagItems = rdTag.split(":");
1153
1149
  const wfRdTag = rdTagItems.length === 2 ? rdTag : rdTagItems.slice(0, 2).join(":");
1154
1150
  const deRdTag = "".concat(entity.name.toUpperCase(), ":").concat(rdTag);
1155
- const allRefViews = appView.redirectAppViewRefs;
1156
- const refView = allRefViews == null ? void 0 : allRefViews.find((view) => {
1151
+ const allRefViews = [];
1152
+ if (appView.redirectAppViewRefs) {
1153
+ allRefViews.push(...appView.redirectAppViewRefs);
1154
+ }
1155
+ if (appView.appViewRefs) {
1156
+ allRefViews.push(...appView.appViewRefs);
1157
+ }
1158
+ const refView = allRefViews.find((view) => {
1157
1159
  const matchKey = view.name || view.id;
1158
1160
  return matchKey === deRdTag || matchKey === rdTag || matchKey === wfRdTag;
1159
1161
  });
1160
1162
  if (refView) {
1161
1163
  const viewId = refView.refAppViewId;
1162
1164
  if (viewId) {
1163
- const result = await ibiz.commands.execute(
1164
- OpenAppViewCommand.TAG,
1165
+ return {
1166
+ type: "view",
1165
1167
  viewId,
1166
1168
  context,
1167
1169
  params,
1168
- { ...opts, data: [curData] }
1169
- );
1170
- if (result) {
1171
- return result;
1172
- }
1173
- } else {
1174
- throw new RuntimeModelError2(refView, "\u672A\u914D\u7F6E\u5B9E\u9645\u5F15\u7528\u89C6\u56FE");
1170
+ opts: { ...opts, data: [curData] }
1171
+ };
1175
1172
  }
1173
+ throw new RuntimeModelError2(refView, "\u672A\u914D\u7F6E\u5B9E\u9645\u5F15\u7528\u89C6\u56FE");
1176
1174
  } else {
1177
1175
  ibiz.log.error(
1178
1176
  "\u91CD\u5B9A\u5411\u89C6\u56FE\u5F15\u7528\u6709\uFF1A",
@@ -1187,7 +1185,34 @@ async function openDERedirectView(appView, context, params = {}, opts = {}) {
1187
1185
  "\u672A\u627E\u5230\u91CD\u5B9A\u5411\u6807\u8BC6[".concat(rdTag, "]\u6216[").concat(deRdTag, "]\u6216\u5DE5\u4F5C\u6D41[").concat(wfRdTag, "]\u5BF9\u5E94\u89C6\u56FE")
1188
1186
  );
1189
1187
  }
1190
- return { ok: true, data: [] };
1188
+ }
1189
+ async function openDERedirectView(appView, context, params = {}, opts = {}) {
1190
+ let toView;
1191
+ try {
1192
+ toView = await getDERedirectToView(appView, context, params, opts);
1193
+ } catch (error) {
1194
+ ibiz.log.error(error);
1195
+ return { ok: false, data: [] };
1196
+ }
1197
+ if (toView.type === "url") {
1198
+ const openUrl = toView.url;
1199
+ return new Promise((resolve) => {
1200
+ const newWindow = window.open(openUrl, "_blank");
1201
+ if (newWindow) {
1202
+ newWindow.callback = () => {
1203
+ resolve({ ok: true, data: [] });
1204
+ };
1205
+ }
1206
+ });
1207
+ }
1208
+ const result = await ibiz.commands.execute(
1209
+ OpenAppViewCommand.TAG,
1210
+ toView.viewId,
1211
+ toView.context,
1212
+ toView.params,
1213
+ toView.opts
1214
+ );
1215
+ return result || { ok: true, data: [] };
1191
1216
  }
1192
1217
  async function calcDERdTag(entity, rdView, params, data) {
1193
1218
  let rdTag = "";
@@ -1196,7 +1221,7 @@ async function calcDERdTag(entity, rdView, params, data) {
1196
1221
  const { codeName } = findFieldById(entity, typeFieldId);
1197
1222
  const value = data[codeName.toLowerCase()];
1198
1223
  if (notNilEmpty3(value)) {
1199
- return "".concat(value);
1224
+ return "".concat(value.toUpperCase());
1200
1225
  }
1201
1226
  ibiz.log.warn(
1202
1227
  "\u91CD\u5B9A\u5411\u89C6\u56FE[".concat(rdView.name, "]\u81EA\u5B9A\u4E49\u7C7B\u522B\u5C5E\u6027[").concat(typeFieldId, "]\u503C\u4E3A\u7A7A"),
@@ -2709,12 +2734,50 @@ var UIDomain = class {
2709
2734
  * @param {string} [id]
2710
2735
  */
2711
2736
  constructor(id) {
2737
+ /**
2738
+ * DTO 父子关系映射
2739
+ *
2740
+ * @author chitanda
2741
+ * @date 2023-12-26 15:12:13
2742
+ * @protected
2743
+ * @type {Map<string, IParentConfig[]>}
2744
+ */
2745
+ this.rsMap = /* @__PURE__ */ new Map();
2712
2746
  if (id) {
2713
2747
  this.id = id;
2714
2748
  } else {
2715
2749
  this.id = createUUID();
2716
2750
  }
2717
2751
  }
2752
+ /**
2753
+ * 设置当前界面域下,指定实体的相关父关系以及属性。在 DTO 包解析时设置此参数,销毁时清空
2754
+ *
2755
+ * @author chitanda
2756
+ * @date 2023-12-26 15:12:31
2757
+ * @param {string} entity
2758
+ * @param {IParentConfig} config
2759
+ */
2760
+ setDERConfig(deCodeName, config) {
2761
+ if (!this.rsMap.has(deCodeName)) {
2762
+ this.rsMap.set(deCodeName, []);
2763
+ }
2764
+ const arr = this.rsMap.get(deCodeName);
2765
+ arr.push(config);
2766
+ }
2767
+ /**
2768
+ * 获取当前界面域下,具体实体的关系(在数据加载完成之后才有值)
2769
+ *
2770
+ * @author chitanda
2771
+ * @date 2023-12-26 16:12:07
2772
+ * @param {string} deCodeName
2773
+ * @return {*} {IParentConfig[]}
2774
+ */
2775
+ getDERConfig(deCodeName) {
2776
+ if (this.rsMap.has(deCodeName)) {
2777
+ return this.rsMap.get(deCodeName);
2778
+ }
2779
+ return [];
2780
+ }
2718
2781
  /**
2719
2782
  * 界面域销毁
2720
2783
  *
@@ -2722,6 +2785,7 @@ var UIDomain = class {
2722
2785
  * @date 2023-12-22 15:12:49
2723
2786
  */
2724
2787
  destroy() {
2788
+ this.rsMap.clear();
2725
2789
  const apps = ibiz.hub.getAllApps();
2726
2790
  apps.forEach((app) => {
2727
2791
  app.deService.reset({
@@ -6830,6 +6894,15 @@ var MethodDto = class _MethodDto {
6830
6894
  this.isLocalMode = isLocalMode;
6831
6895
  this.dto = dto;
6832
6896
  this.dtoMap = /* @__PURE__ */ new Map();
6897
+ /**
6898
+ * 当前 DTO 是否已经计算过关系相关逻辑
6899
+ *
6900
+ * @link this.calcRs
6901
+ * @author chitanda
6902
+ * @date 2023-12-26 16:12:18
6903
+ * @protected
6904
+ */
6905
+ this.isCalcRs = false;
6833
6906
  if (dto) {
6834
6907
  this.app = ibiz.hub.getApp(entity.appId);
6835
6908
  this.fields = dto.appDEMethodDTOFields || [];
@@ -6887,6 +6960,7 @@ var MethodDto = class _MethodDto {
6887
6960
  */
6888
6961
  async get(context, data) {
6889
6962
  const params = {};
6963
+ const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
6890
6964
  for (let i = 0; i < this.fields.length; i++) {
6891
6965
  const field = this.fields[i];
6892
6966
  const key = field.codeName.toLowerCase();
@@ -6908,11 +6982,19 @@ var MethodDto = class _MethodDto {
6908
6982
  if (!field.refAppDataEntityId) {
6909
6983
  break;
6910
6984
  }
6985
+ let configs = uiDomain.getDERConfig(field.refAppDataEntityId);
6986
+ const index = configs.findIndex(
6987
+ (config) => config.majorDECodeName === this.entity.codeName
6988
+ );
6989
+ configs = configs.slice(index + 1);
6911
6990
  const dto = await this.getFieldDto(context, field);
6912
6991
  const filterParams = {};
6913
6992
  if (field.refPickupAppDEFieldId) {
6914
6993
  filterParams[field.refPickupAppDEFieldId] = data.srfkey;
6915
6994
  }
6995
+ configs.forEach((config) => {
6996
+ filterParams[config.pickupDEFName.toLowerCase()] = null;
6997
+ });
6916
6998
  const items = await dto.select(context, filterParams);
6917
6999
  if (items) {
6918
7000
  const arr = [];
@@ -6946,6 +7028,7 @@ var MethodDto = class _MethodDto {
6946
7028
  if (this.isLocalMode) {
6947
7029
  this.service.local.clear();
6948
7030
  }
7031
+ await this.calcRs(context);
6949
7032
  return Promise.all(
6950
7033
  data.map(async (datum) => {
6951
7034
  const all = this.fields.filter((field) => field.type === "DTOS").map(async (field) => {
@@ -6964,7 +7047,6 @@ var MethodDto = class _MethodDto {
6964
7047
  item[field.refPickupAppDEFieldId] = pKey;
6965
7048
  });
6966
7049
  await dto.sets(context, items);
6967
- delete datum[key];
6968
7050
  } else {
6969
7051
  await dto.sets(context, []);
6970
7052
  }
@@ -6981,6 +7063,48 @@ var MethodDto = class _MethodDto {
6981
7063
  })
6982
7064
  );
6983
7065
  }
7066
+ /**
7067
+ * 递归计算当前 DTO 相关实体的父关系配置
7068
+ *
7069
+ * @author chitanda
7070
+ * @date 2023-12-26 16:12:13
7071
+ * @protected
7072
+ * @param {IContext} context
7073
+ * @param {number} [depth=0] 递归层级,避免进入死循环。最大递归层级为 10
7074
+ * @return {*} {Promise<void>}
7075
+ */
7076
+ async calcRs(context, depth = 0) {
7077
+ if (this.isCalcRs || depth > 10) {
7078
+ return;
7079
+ }
7080
+ this.isCalcRs = true;
7081
+ depth += 1;
7082
+ const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
7083
+ const dtoFields = this.fields.filter((field) => field.type === "DTOS");
7084
+ for (let i = 0; i < dtoFields.length; i++) {
7085
+ const field = dtoFields[i];
7086
+ if (!field.refAppDataEntityId) {
7087
+ continue;
7088
+ }
7089
+ const configs = uiDomain.getDERConfig(field.refAppDataEntityId);
7090
+ const index = configs.findIndex(
7091
+ (config) => config.pickupDEFName === field.refPickupAppDEFieldId
7092
+ );
7093
+ if (index === -1) {
7094
+ const dto = await this.getFieldDto(context, field);
7095
+ uiDomain.setDERConfig(field.refAppDataEntityId, {
7096
+ majorDEName: this.entity.name,
7097
+ majorDECodeName: this.entity.codeName,
7098
+ majorDECodeName2: this.entity.codeName2,
7099
+ minorDEName: dto.entity.name,
7100
+ minorDECodeName: dto.entity.codeName,
7101
+ minorDECodeName2: dto.entity.codeName2,
7102
+ pickupDEFName: field.refPickupAppDEFieldId
7103
+ });
7104
+ await dto.calcRs(context, depth);
7105
+ }
7106
+ }
7107
+ }
6984
7108
  /**
6985
7109
  * 获取子属性 DTO
6986
7110
  *
@@ -9381,18 +9505,6 @@ var calcDataItemValue = (fieldCodeName, nodeModel, data = {}) => {
9381
9505
  }
9382
9506
  return result;
9383
9507
  };
9384
- var calcNodeDataItem = (nodeModel, data) => {
9385
- var _a;
9386
- const dataItem = {};
9387
- (_a = nodeModel.detreeNodeDataItems) == null ? void 0 : _a.forEach((item) => {
9388
- if (item.id && item.appDEFieldId) {
9389
- Object.assign(dataItem, {
9390
- [item.id.toLowerCase()]: data[item.appDEFieldId.toLowerCase()]
9391
- });
9392
- }
9393
- });
9394
- return dataItem;
9395
- };
9396
9508
 
9397
9509
  // src/service/vo/gantt-node-data/gantt-static-node-data.ts
9398
9510
  var GanttStaticNodeData = class extends TreeStaticNodeData {
@@ -9454,7 +9566,6 @@ var GanttDataSetNodeData = class extends TreeDataSetNodeData {
9454
9566
  nodeModel,
9455
9567
  data
9456
9568
  );
9457
- this.nodeDataItem = calcNodeDataItem(nodeModel, data);
9458
9569
  }
9459
9570
  };
9460
9571
 
@@ -12596,6 +12707,36 @@ var MDControlController = class extends ControlController {
12596
12707
  this.state.mdctrlActiveMode = 0;
12597
12708
  this.state.groups = [];
12598
12709
  }
12710
+ /**
12711
+ * 批操作工具栏
12712
+ *
12713
+ * @author zk
12714
+ * @date 2023-08-02 06:08:34
12715
+ * @readonly
12716
+ * @type {(IToolbarController | undefined)}
12717
+ * @memberof ListController
12718
+ */
12719
+ get batchToolbarController() {
12720
+ const controller = this.view.getController(
12721
+ "".concat(this.model.name, "_batchtoolbar")
12722
+ );
12723
+ return controller;
12724
+ }
12725
+ /**
12726
+ * 快速工具栏
12727
+ *
12728
+ * @author zk
12729
+ * @date 2023-08-02 06:08:34
12730
+ * @readonly
12731
+ * @type {(IToolbarController | undefined)}
12732
+ * @memberof ListController
12733
+ */
12734
+ get quickToolbarController() {
12735
+ const controller = this.view.getController(
12736
+ "".concat(this.model.name, "_quicktoolbar")
12737
+ );
12738
+ return controller;
12739
+ }
12599
12740
  async onCreated() {
12600
12741
  var _a;
12601
12742
  await super.onCreated();
@@ -12854,6 +12995,7 @@ var MDControlController = class extends ControlController {
12854
12995
  });
12855
12996
  }
12856
12997
  setSelection(selection) {
12998
+ var _a, _b;
12857
12999
  const { selectedData } = this.state;
12858
13000
  if (!isElementSame(selectedData, selection)) {
12859
13001
  this.state.selectedData = selection;
@@ -12861,6 +13003,15 @@ var MDControlController = class extends ControlController {
12861
13003
  data: selection
12862
13004
  });
12863
13005
  }
13006
+ const data = selection == null ? void 0 : selection[0];
13007
+ (_a = this.batchToolbarController) == null ? void 0 : _a.calcButtonState(
13008
+ data,
13009
+ this.model.appDataEntityId
13010
+ );
13011
+ (_b = this.quickToolbarController) == null ? void 0 : _b.calcButtonState(
13012
+ data,
13013
+ this.model.appDataEntityId
13014
+ );
12864
13015
  }
12865
13016
  /**
12866
13017
  * 行单击事件
@@ -16015,7 +16166,6 @@ var UIActionProviderBase = class {
16015
16166
  * @return {*} {Promise<IUIActionResult>}
16016
16167
  */
16017
16168
  async exec(action, args) {
16018
- const { context, params, data } = args;
16019
16169
  const result = {
16020
16170
  refresh: action.reloadData,
16021
16171
  refreshMode: action.refreshMode,
@@ -16037,12 +16187,17 @@ var UIActionProviderBase = class {
16037
16187
  if (result.cancel === true) {
16038
16188
  return this.returnError(result);
16039
16189
  }
16040
- const nextActionParams = {
16041
- ...args,
16042
- context: result.nextContext || context,
16043
- data: result.data || data,
16044
- params: result.nextParams || params
16045
- };
16190
+ if (action.uilogicAttachMode === "AFTER") {
16191
+ if (!appDEUILogicId) {
16192
+ throw new RuntimeModelError46(action, "\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");
16193
+ }
16194
+ await execUILogic(
16195
+ appDEUILogicId,
16196
+ appDataEntityId,
16197
+ this.mergeArgsByResult(args, result)
16198
+ );
16199
+ }
16200
+ const nextActionParams = this.mergeArgsByResult(args, result);
16046
16201
  if (action.closeEditView) {
16047
16202
  this.doNextAction(action, nextActionParams, action.appId);
16048
16203
  } else {
@@ -16058,14 +16213,25 @@ var UIActionProviderBase = class {
16058
16213
  }
16059
16214
  }
16060
16215
  }
16061
- if (action.uilogicAttachMode === "AFTER") {
16062
- if (!appDEUILogicId) {
16063
- throw new RuntimeModelError46(action, "\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");
16064
- }
16065
- await execUILogic(appDEUILogicId, appDataEntityId, args);
16066
- }
16067
16216
  return result;
16068
16217
  }
16218
+ /**
16219
+ * 根据界面行为逻辑返回值,合并参数获得后续逻辑要用的参数
16220
+ * @author lxm
16221
+ * @date 2023-12-25 02:42:23
16222
+ * @protected
16223
+ * @param {IUILogicParams} args 当前环境的参数
16224
+ * @param {IUIActionResult} result 上一次逻辑执行的结果
16225
+ * @return {*} {IUILogicParams}
16226
+ */
16227
+ mergeArgsByResult(args, result) {
16228
+ return {
16229
+ ...args,
16230
+ context: result.nextContext || args.context,
16231
+ data: result.data || args.data,
16232
+ params: result.nextParams || args.params
16233
+ };
16234
+ }
16069
16235
  /**
16070
16236
  * 有错误和取消时对result做的处理
16071
16237
  * @author lxm
@@ -23470,57 +23636,6 @@ var ListController = class extends MDControlController {
23470
23636
  }
23471
23637
  }
23472
23638
  }
23473
- /**
23474
- * 工具栏
23475
- *
23476
- * @author zk
23477
- * @date 2023-08-02 06:08:34
23478
- * @readonly
23479
- * @type {(IToolbarController | undefined)}
23480
- * @memberof ListController
23481
- */
23482
- get batchToolbarController() {
23483
- const controller = this.view.getController(
23484
- "".concat(this.model.name, "_batchtoolbar")
23485
- );
23486
- return controller;
23487
- }
23488
- /**
23489
- * 工具栏
23490
- *
23491
- * @author zk
23492
- * @date 2023-08-02 06:08:34
23493
- * @readonly
23494
- * @type {(IToolbarController | undefined)}
23495
- * @memberof ListController
23496
- */
23497
- get quickToolbarController() {
23498
- const controller = this.view.getController(
23499
- "".concat(this.model.name, "_quicktoolbar")
23500
- );
23501
- return controller;
23502
- }
23503
- /**
23504
- * 根据数据计算工具栏权限和状态
23505
- *
23506
- * @author zk
23507
- * @date 2023-08-02 06:08:11
23508
- * @param {IData[]} selection
23509
- * @memberof ListController
23510
- */
23511
- setSelection(selection) {
23512
- var _a, _b;
23513
- super.setSelection(selection);
23514
- const data = selection == null ? void 0 : selection[0];
23515
- (_a = this.batchToolbarController) == null ? void 0 : _a.calcButtonState(
23516
- data,
23517
- this.model.appDataEntityId
23518
- );
23519
- (_b = this.quickToolbarController) == null ? void 0 : _b.calcButtonState(
23520
- data,
23521
- this.model.appDataEntityId
23522
- );
23523
- }
23524
23639
  /**
23525
23640
  * 加载更多
23526
23641
  * @author lxm
@@ -24487,30 +24602,43 @@ var SearchBarService = class {
24487
24602
  });
24488
24603
  return res;
24489
24604
  }
24605
+ /**
24606
+ * 批量新建
24607
+ * @param {IData} data
24608
+ * @return {*}
24609
+ * @author: zhujiamin
24610
+ * @Date: 2023-12-26 15:49:00
24611
+ */
24612
+ async createBatch(data) {
24613
+ const createParams = this.convertFrontDataToBack(data);
24614
+ const res = await this.app.net.post("".concat(this.themeUrl), createParams);
24615
+ return res;
24616
+ }
24490
24617
  /**
24491
24618
  * 更新数据
24492
24619
  *
24493
24620
  */
24494
24621
  async update(id, data) {
24495
- const updateParams = { app_view_tag: this.viewTag };
24496
- if (data.theme_model) {
24497
- Object.assign(updateParams, {
24498
- theme_model: JSON.stringify(data.theme_model)
24499
- });
24500
- }
24501
- if (data.caption) {
24502
- Object.assign(updateParams, {
24503
- name: data.caption
24504
- });
24505
- }
24506
- if (typeof data.show === "boolean") {
24507
- Object.assign(updateParams, {
24508
- show: data.show
24509
- });
24510
- }
24622
+ const [updateParams] = this.convertFrontDataToBack([data]);
24511
24623
  const res = await this.app.net.put("".concat(this.themeUrl, "/").concat(id), updateParams);
24512
24624
  return res;
24513
24625
  }
24626
+ /**
24627
+ * 批量更新数据
24628
+ * @param {IData} data
24629
+ * @return {*}
24630
+ * @author: zhujiamin
24631
+ * @Date: 2023-12-26 11:11:34
24632
+ */
24633
+ async updateBatch(data) {
24634
+ const updateParams = this.convertFrontDataToBack(data);
24635
+ const idUrl = updateParams.map((item) => item.id).join(";");
24636
+ const res = await this.app.net.put(
24637
+ "".concat(this.themeUrl, "/").concat(idUrl),
24638
+ updateParams
24639
+ );
24640
+ return res;
24641
+ }
24514
24642
  /**
24515
24643
  * 转换后台数据成前端需要的格式
24516
24644
  * @param {IData} data
@@ -24527,6 +24655,41 @@ var SearchBarService = class {
24527
24655
  if (item.theme_model) {
24528
24656
  tempItem.searchGroupData = JSON.parse(item.theme_model);
24529
24657
  }
24658
+ if (typeof item.valid_flag === "number") {
24659
+ tempItem.show = item.valid_flag === 1;
24660
+ }
24661
+ if (item.order_value) {
24662
+ tempItem.order = item.order_value;
24663
+ }
24664
+ return tempItem;
24665
+ });
24666
+ }
24667
+ /**
24668
+ * 转换前端数据成后台需要的格式
24669
+ * @param {IData} data
24670
+ * @return {*}
24671
+ * @author: zhujiamin
24672
+ * @Date: 2023-12-22 11:19:50
24673
+ */
24674
+ convertFrontDataToBack(data) {
24675
+ return data.map((item) => {
24676
+ const tempItem = {
24677
+ appId: item.appId,
24678
+ app_view_tag: this.viewTag,
24679
+ id: item.id
24680
+ };
24681
+ if (item.caption) {
24682
+ tempItem.name = item.caption;
24683
+ }
24684
+ if (item.searchGroupData && Object.keys(item.searchGroupData).length > 0) {
24685
+ tempItem.theme_model = JSON.stringify(item.searchGroupData);
24686
+ }
24687
+ if (typeof item.show === "boolean") {
24688
+ tempItem.valid_flag = item.show ? 1 : 0;
24689
+ }
24690
+ if (item.order) {
24691
+ tempItem.order_value = item.order;
24692
+ }
24530
24693
  return tempItem;
24531
24694
  });
24532
24695
  }
@@ -24563,7 +24726,7 @@ var SearchBarController = class extends ControlController {
24563
24726
  * @author: zhujiamin
24564
24727
  * @Date: 2023-12-21 10:17:43
24565
24728
  */
24566
- this.isBackendSearchGroup = true;
24729
+ this.isBackendSearchGroup = this.model.searchBarStyle === "SEARCHBAR2";
24567
24730
  }
24568
24731
  /**
24569
24732
  * 表格控制器
@@ -24781,12 +24944,42 @@ var SearchBarController = class extends ControlController {
24781
24944
  this.state.searchBarGroups = [];
24782
24945
  if (this.isBackendSearchGroup) {
24783
24946
  if (this.model.searchBarGroups && this.model.searchBarGroups.length > 0) {
24784
- this.state.searchBarGroups = this.model.searchBarGroups.map((item) => ({
24785
- ...item,
24786
- show: true,
24787
- saved: false,
24788
- searchGroupData: {}
24789
- }));
24947
+ this.state.searchBarGroups = this.model.searchBarGroups.map(
24948
+ (item, index) => {
24949
+ const tempGroup = {
24950
+ ...item,
24951
+ saved: false,
24952
+ show: true,
24953
+ searchGroupData: {},
24954
+ order: (index + 1) * 100
24955
+ };
24956
+ if (item.data) {
24957
+ try {
24958
+ const tempData = JSON.parse(item.data);
24959
+ if (tempData.theme_model) {
24960
+ if (tempData.theme_model.sort) {
24961
+ tempGroup.searchGroupData.sort = tempData.theme_model.sort;
24962
+ }
24963
+ if (tempData.theme_model.columnstates) {
24964
+ tempGroup.searchGroupData.columnstates = tempData.theme_model.columnstates;
24965
+ }
24966
+ if (tempData.theme_model.filternodes) {
24967
+ tempGroup.searchGroupData.filternodes = tempData.theme_model.filternodes;
24968
+ }
24969
+ if (tempData.theme_model.searchconds) {
24970
+ tempGroup.searchGroupData.searchconds = tempData.theme_model.searchconds;
24971
+ }
24972
+ }
24973
+ if (tempData.valid_flag) {
24974
+ tempGroup.show = tempData.valid_flag === "1";
24975
+ }
24976
+ } catch (error) {
24977
+ ibiz.log.error(error);
24978
+ }
24979
+ }
24980
+ return tempGroup;
24981
+ }
24982
+ );
24790
24983
  }
24791
24984
  const res = await this.service.fetch();
24792
24985
  if (res.ok) {
@@ -24798,16 +24991,26 @@ var SearchBarController = class extends ControlController {
24798
24991
  mergeInLeft3(existGroup, group);
24799
24992
  existGroup.saved = true;
24800
24993
  } else {
24994
+ const tempMaxOrderIndex = this.state.searchBarGroups.reduce(
24995
+ (maxIndex, item, currentIndex) => item.order > this.state.searchBarGroups[maxIndex].order ? currentIndex : maxIndex,
24996
+ 0
24997
+ );
24801
24998
  this.state.searchBarGroups.push({
24802
- ...group,
24803
24999
  appId: this.context.srfappid,
24804
- show: true,
24805
25000
  saved: true,
24806
- searchGroupData: {}
25001
+ show: true,
25002
+ searchGroupData: {},
25003
+ order: (tempMaxOrderIndex + 2) * 100,
25004
+ // 以后台给的为准
25005
+ ...group
24807
25006
  });
24808
25007
  }
24809
25008
  });
24810
25009
  }
25010
+ this.state.searchBarGroups.sort((a, b) => a.order - b.order);
25011
+ this.state.searchBarGroups.forEach((item, index) => {
25012
+ item.order = (index + 1) * 100;
25013
+ });
24811
25014
  }
24812
25015
  }
24813
25016
  /**
@@ -24828,8 +25031,9 @@ var SearchBarController = class extends ControlController {
24828
25031
  };
24829
25032
  if (this.state.selectedSearchGroupItem.saved) {
24830
25033
  await this.service.update(this.state.selectedSearchGroupItem.id, {
24831
- theme_model: saveParams,
24832
- show: this.state.selectedSearchGroupItem.show
25034
+ searchGroupData: saveParams,
25035
+ show: this.state.selectedSearchGroupItem.show,
25036
+ order: this.state.selectedSearchGroupItem.order
24833
25037
  });
24834
25038
  ibiz.message.success("\u4FDD\u5B58\u6210\u529F");
24835
25039
  } else {
@@ -24861,6 +25065,7 @@ var SearchBarController = class extends ControlController {
24861
25065
  const res = await this.service.get(groupItem.id);
24862
25066
  if (res.ok) {
24863
25067
  mergeInLeft3(groupItem, res.data);
25068
+ groupItem.show = true;
24864
25069
  }
24865
25070
  }
24866
25071
  if (groupItem.searchGroupData && groupItem.searchGroupData.filternodes) {
@@ -28341,9 +28546,6 @@ var ReportPanelController = class extends ControlController {
28341
28546
  }
28342
28547
  };
28343
28548
 
28344
- // src/controller/control/gantt/gantt.controller.ts
28345
- import { recursiveIterate as recursiveIterate12 } from "@ibiz-template/core";
28346
-
28347
28549
  // src/controller/control/gantt/gantt.service.ts
28348
28550
  import { ModelError as ModelError30 } from "@ibiz-template/core";
28349
28551
  var GanttService = class extends TreeService {
@@ -28375,12 +28577,12 @@ var GanttService = class extends TreeService {
28375
28577
  * @param {TreeFetchOpts} opts
28376
28578
  * @return {*} {(Promise<IGanttNodeData[] | undefined>)}
28377
28579
  */
28378
- async fetchGanttChildNodes(parentNodeData, opts) {
28580
+ async fetchChildNodes(parentNodeData, opts) {
28379
28581
  const { hasQuery } = opts;
28380
28582
  let childrenNodes = [];
28381
28583
  if (!parentNodeData) {
28382
28584
  const rootNode = getRootNode(this.model);
28383
- childrenNodes = await this.fetchGanttNodeDatasByType(
28585
+ childrenNodes = await this.fetchNodeDatasByType(
28384
28586
  rootNode,
28385
28587
  void 0,
28386
28588
  void 0,
@@ -28400,7 +28602,7 @@ var GanttService = class extends TreeService {
28400
28602
  this.model,
28401
28603
  childNodeRS.childDETreeNodeId
28402
28604
  );
28403
- return this.fetchGanttNodeDatasByType(
28605
+ return this.fetchNodeDatasByType(
28404
28606
  childNode,
28405
28607
  childNodeRS,
28406
28608
  parentNodeData,
@@ -28427,7 +28629,7 @@ var GanttService = class extends TreeService {
28427
28629
  * @param {TreeFetchOpts} opts
28428
28630
  * @return {*} {Promise<IGanttNodeData[]>}
28429
28631
  */
28430
- async fetchGanttNodeDatasByType(nodeModel, nodeRS, parentNodeData, opts) {
28632
+ async fetchNodeDatasByType(nodeModel, nodeRS, parentNodeData, opts) {
28431
28633
  const leaf = getChildNodeRSs(this.model, {
28432
28634
  parentId: nodeModel.id,
28433
28635
  hasQuery: opts.hasQuery
@@ -28475,7 +28677,7 @@ var GanttService = class extends TreeService {
28475
28677
  result.map(async (childNode, index) => {
28476
28678
  if (expanded && // 全展开合只展开首节点expanded都为true
28477
28679
  (!expandFirstOnly || expandFirstOnly && index === 0) || isExpandedRoot) {
28478
- const subChildrenNodes = await this.fetchGanttChildNodes(
28680
+ const subChildrenNodes = await this.fetchChildNodes(
28479
28681
  childNode,
28480
28682
  opts
28481
28683
  );
@@ -28597,54 +28799,7 @@ var GanttService = class extends TreeService {
28597
28799
  };
28598
28800
 
28599
28801
  // src/controller/control/gantt/gantt.controller.ts
28600
- var GanttController = class extends MDControlController {
28601
- constructor() {
28602
- super(...arguments);
28603
- /**
28604
- * 表格列适配器
28605
- *
28606
- * @type {{ [key: string]: IGridColumnProvider }}
28607
- * @memberof GanttController
28608
- */
28609
- this.providers = {};
28610
- /**
28611
- * 所有表格列控制器集合
28612
- *
28613
- * @type {{ [key: string]: GridColumnController }}
28614
- * @memberof GanttController
28615
- */
28616
- this.columns = {};
28617
- /**
28618
- * 所有表格属性列的控制器
28619
- *
28620
- * @type {{ [key: string]: GridFieldColumnController }}
28621
- * @memberof GanttController
28622
- */
28623
- this.fieldColumns = {};
28624
- /**
28625
- * 所有表格操作列的控制器
28626
- *
28627
- * @type {{ [key: string]: GridUAColumnController }}
28628
- * @memberof GanttController
28629
- */
28630
- this.uaColumns = {};
28631
- /**
28632
- * 上下文菜单控制器
28633
- *
28634
- * @author tony001
28635
- * @date 2023-12-11 16:12:57
28636
- * @type {{ [p: string]: ContextMenuController }}
28637
- */
28638
- this.contextMenus = {};
28639
- /**
28640
- * 是否启用快速搜索
28641
- *
28642
- * @author tony001
28643
- * @date 2023-12-11 16:12:13
28644
- * @type {boolean}
28645
- */
28646
- this.enableQuickSearch = false;
28647
- }
28802
+ var GanttController = class extends TreeGridExController {
28648
28803
  /**
28649
28804
  * 初始化状态
28650
28805
  *
@@ -28654,9 +28809,6 @@ var GanttController = class extends MDControlController {
28654
28809
  */
28655
28810
  initState() {
28656
28811
  super.initState();
28657
- this.state.size = 0;
28658
- this.state.query = "";
28659
- this.state.columnStates = [];
28660
28812
  this.state.rootNodes = [];
28661
28813
  this.state.ganttStyle = {};
28662
28814
  }
@@ -28669,131 +28821,16 @@ var GanttController = class extends MDControlController {
28669
28821
  */
28670
28822
  onDataChange(msg) {
28671
28823
  }
28672
- async onCreated() {
28673
- var _a, _b;
28674
- await super.onCreated();
28675
- await this.initGridColumns();
28676
- this.initColumnStates();
28677
- if ((_a = this.model.detreeNodes) == null ? void 0 : _a[0].enableQuickSearch) {
28678
- this.enableQuickSearch = true;
28679
- }
28680
- if (this.dataEntity) {
28681
- const searchFields = (_b = this.dataEntity.appDEFields) == null ? void 0 : _b.filter((field) => {
28682
- return field.enableQuickSearch;
28683
- });
28684
- const placeHolders = [];
28685
- searchFields == null ? void 0 : searchFields.forEach((searchField) => {
28686
- if ((searchField == null ? void 0 : searchField.lnlanguageRes) && searchField.lnlanguageRes.lanResTag) {
28687
- placeHolders.push(
28688
- ibiz.i18n.t(
28689
- searchField.lnlanguageRes.lanResTag,
28690
- searchField.logicName
28691
- )
28692
- );
28693
- } else if (searchField == null ? void 0 : searchField.logicName) {
28694
- placeHolders.push(searchField.logicName);
28695
- }
28696
- });
28697
- if (placeHolders.length > 0) {
28698
- this.state.placeHolder = placeHolders.join("\u3001");
28699
- }
28700
- }
28701
- this.service = new GanttService(this.model);
28702
- await this.service.init(this.context);
28703
- this.model.detreeNodes.forEach((node) => {
28704
- var _a2, _b2;
28705
- if ((_b2 = (_a2 = node.decontextMenu) == null ? void 0 : _a2.detoolbarItems) == null ? void 0 : _b2.length) {
28706
- this.contextMenus[node.decontextMenu.id] = new ContextMenuController(
28707
- node.decontextMenu,
28708
- this.context,
28709
- this.params,
28710
- this.ctx
28711
- );
28712
- }
28713
- });
28714
- await Promise.all(
28715
- Object.values(this.contextMenus).map((menu) => menu.created())
28716
- );
28717
- }
28718
28824
  /**
28719
- * 初始化表格列
28720
- *
28721
- * @protected
28722
- * @return {*} {Promise<void>}
28723
- * @memberof GanttController
28724
- */
28725
- async initGridColumns() {
28726
- if (this.model.detreeColumns) {
28727
- await Promise.all(
28728
- this.model.detreeColumns.map(
28729
- async (column) => this.initColumnsController(column)
28730
- )
28731
- );
28732
- }
28733
- }
28734
- /**
28735
- * 初始化表格属性列,操作列,编辑项控制器
28825
+ * 初始化对应类型的部件服务
28736
28826
  *
28737
28827
  * @protected
28738
- * @param {IDETreeColumn} column
28739
28828
  * @return {*} {Promise<void>}
28740
28829
  * @memberof GanttController
28741
28830
  */
28742
- async initColumnsController(column) {
28743
- const provider = await getGridColumnProvider(column);
28744
- if (!provider) {
28745
- return;
28746
- }
28747
- this.providers[column.codeName] = provider;
28748
- const controller = await provider.createController(column, this);
28749
- this.columns[column.codeName] = controller;
28750
- if (column.columnType === "DEFGRIDCOLUMN") {
28751
- this.fieldColumns[column.codeName] = controller;
28752
- } else if (column.columnType === "UAGRIDCOLUMN") {
28753
- this.uaColumns[column.codeName] = controller;
28754
- }
28755
- }
28756
- /**
28757
- * 初始化表格列状态
28758
- *
28759
- * @protected
28760
- * @memberof GanttController
28761
- */
28762
- initColumnStates() {
28763
- recursiveIterate12(
28764
- this.model,
28765
- (column) => {
28766
- if (column.columnType !== "GROUPGRIDCOLUMN") {
28767
- this.state.columnStates.push({
28768
- key: column.codeName,
28769
- caption: column.caption,
28770
- hidden: !!column.hideDefault,
28771
- uaColumn: column.columnType === "UAGRIDCOLUMN"
28772
- });
28773
- }
28774
- },
28775
- { childrenFields: ["detreeColumns"] }
28776
- );
28777
- this.calcColumnFixed();
28778
- }
28779
- /**
28780
- * 计算列的固定状态
28781
- *
28782
- * @protected
28783
- * @memberof GanttController
28784
- */
28785
- calcColumnFixed() {
28786
- const showColumns = this.state.columnStates.filter(
28787
- (column) => !column.hidden
28788
- );
28789
- const allNum = showColumns.length;
28790
- showColumns.forEach((column, index) => {
28791
- if (column.uaColumn) {
28792
- column.fixed = index + 1 <= Math.floor(allNum / 2) ? "left" : "right";
28793
- } else {
28794
- column.fixed = "right";
28795
- }
28796
- });
28831
+ async initService() {
28832
+ this.service = new GanttService(this.model);
28833
+ await this.service.init(this.context);
28797
28834
  }
28798
28835
  /**
28799
28836
  * 设置甘特图样式
@@ -28804,214 +28841,6 @@ var GanttController = class extends MDControlController {
28804
28841
  setGanttStyle(style) {
28805
28842
  this.state.ganttStyle = style;
28806
28843
  }
28807
- /**
28808
- * 加载
28809
- *
28810
- * @author tony001
28811
- * @date 2023-12-12 11:12:08
28812
- * @param {MDCtrlLoadParams} [args={}]
28813
- * @return {*} {Promise<IGanttNodeData[]>}
28814
- */
28815
- async load(args = {}) {
28816
- const isInitialLoad = args.isInitialLoad === true;
28817
- if (isInitialLoad) {
28818
- await this.startLoading();
28819
- }
28820
- let nodes;
28821
- try {
28822
- nodes = await this.loadNodes();
28823
- } finally {
28824
- if (isInitialLoad) {
28825
- await this.endLoading();
28826
- }
28827
- }
28828
- await this.afterLoad(args, nodes);
28829
- this.state.isLoaded = true;
28830
- await this.evt.emit("onLoadSuccess", {
28831
- isInitialLoad
28832
- });
28833
- return nodes;
28834
- }
28835
- /**
28836
- * 获取节点模型
28837
- *
28838
- * @param {string} id
28839
- * @return {*} {(IDETreeNode | undefined)}
28840
- * @memberof GanttController
28841
- */
28842
- getNodeModel(id) {
28843
- var _a;
28844
- return (_a = this.model.detreeNodes) == null ? void 0 : _a.find((item) => item.id === id);
28845
- }
28846
- /**
28847
- * 获取查询参数
28848
- *
28849
- * @author tony001
28850
- * @date 2023-12-12 11:12:22
28851
- * @param {IParams} [extraParams]
28852
- * @return {*} {Promise<IParams>}
28853
- */
28854
- async getFetchParams(extraParams) {
28855
- const params = await super.getFetchParams(extraParams);
28856
- if (this.state.query) {
28857
- params.query = this.state.query;
28858
- }
28859
- return params;
28860
- }
28861
- /**
28862
- * 加载节点
28863
- *
28864
- * @author tony001
28865
- * @date 2023-12-12 11:12:33
28866
- * @param {IGanttNodeData} [parentNode]
28867
- * @return {*} {Promise<IGanttNodeData[]>}
28868
- */
28869
- async loadNodes(parentNode) {
28870
- const params = await this.getFetchParams();
28871
- const hasQuery = !!params.query;
28872
- this.state.isLoading = true;
28873
- let nodes;
28874
- try {
28875
- nodes = await this.service.fetchGanttChildNodes(parentNode, {
28876
- context: this.context.clone(),
28877
- params,
28878
- hasQuery,
28879
- defaultExpandedKeys: []
28880
- }) || [];
28881
- } finally {
28882
- this.state.isLoading = false;
28883
- }
28884
- if (parentNode) {
28885
- parentNode.children = nodes;
28886
- } else {
28887
- this.state.rootNodes = nodes;
28888
- }
28889
- this.state.items = [];
28890
- recursiveIterate12(
28891
- { children: this.state.rootNodes },
28892
- (node) => {
28893
- this.state.items.push(node);
28894
- }
28895
- );
28896
- return nodes;
28897
- }
28898
- /**
28899
- * 甘特节点点击事件
28900
- *
28901
- * @param {IGanttNodeData} nodeData
28902
- * @return {*} {Promise<void>}
28903
- * @memberof GanttController
28904
- */
28905
- async onGanttNodeClick(nodeData) {
28906
- if (this.state.singleSelect) {
28907
- const { selectedData } = this.state;
28908
- const filterArr = selectedData.filter((item) => item.id !== nodeData.id);
28909
- if (filterArr.length === selectedData.length) {
28910
- this.setSelection(
28911
- this.state.singleSelect ? [nodeData] : selectedData.concat([nodeData])
28912
- );
28913
- } else {
28914
- this.setSelection(filterArr);
28915
- }
28916
- }
28917
- if (this.state.mdctrlActiveMode === 1) {
28918
- await this.setActive(nodeData);
28919
- }
28920
- }
28921
- /**
28922
- * 甘特节点双击事件
28923
- *
28924
- * @param {IGanttNodeData} nodeData
28925
- * @return {*} {Promise<void>}
28926
- * @memberof GanttController
28927
- */
28928
- async onDbGanttNodeClick(nodeData) {
28929
- if (this.state.mdctrlActiveMode === 2) {
28930
- await this.setActive(nodeData);
28931
- }
28932
- }
28933
- /**
28934
- * 设置激活
28935
- *
28936
- * @param {IGanttNodeData} item
28937
- * @return {*} {Promise<void>}
28938
- * @memberof GanttController
28939
- */
28940
- setActive(item) {
28941
- const nodeParams = this.parseGanttNodeData(item);
28942
- return this.evt.emit("onActive", { ...nodeParams, nodeData: item });
28943
- }
28944
- /**
28945
- * 设置选中
28946
- *
28947
- * @param {IData[]} selection
28948
- * @memberof GanttController
28949
- */
28950
- setSelection(selection) {
28951
- const selectionIds = selection.map((item) => item.id);
28952
- const filterArr = this.state.items.filter(
28953
- (item) => selectionIds.includes(item.id)
28954
- );
28955
- super.setSelection(filterArr);
28956
- }
28957
- /**
28958
- * 执行界面行为
28959
- *
28960
- * @param {string} uiActionId
28961
- * @param {IGanttNodeData} nodeData
28962
- * @param {MouseEvent} event
28963
- * @param {string} appId
28964
- * @return {*} {Promise<void>}
28965
- * @memberof GanttController
28966
- */
28967
- async doUIAction(uiActionId, nodeData, event, appId) {
28968
- const eventArgs = this.getEventArgs();
28969
- const nodeParams = this.parseGanttNodeData(nodeData);
28970
- const result = await UIActionUtil.exec(
28971
- uiActionId,
28972
- {
28973
- ...eventArgs,
28974
- ...nodeParams,
28975
- event
28976
- },
28977
- appId
28978
- );
28979
- if (result.closeView) {
28980
- this.view.closeView();
28981
- } else if (result.refresh) {
28982
- switch (result.refreshMode) {
28983
- case 1:
28984
- this.refreshNodeChildren(nodeData);
28985
- break;
28986
- case 2:
28987
- this.refreshNodeChildren(nodeData, true);
28988
- break;
28989
- case 3:
28990
- this.refresh();
28991
- break;
28992
- default:
28993
- }
28994
- }
28995
- }
28996
- /**
28997
- * 解析甘特节点获取通用数据,和完整的上下文和视图参数。
28998
- *
28999
- * @protected
29000
- * @param {IGanttNodeData} nodeData
29001
- * @return {*} {{
29002
- * data: IData[];
29003
- * context: IContext;
29004
- * params: IParams;
29005
- * }}
29006
- * @memberof GanttController
29007
- */
29008
- parseGanttNodeData(nodeData) {
29009
- return {
29010
- data: [{ ...nodeData, ...nodeData.deData || {} }],
29011
- context: Object.assign(this.context.clone(), nodeData.context || {}),
29012
- params: { ...this.params, ...nodeData.params || {} }
29013
- };
29014
- }
29015
28844
  /**
29016
28845
  * 转化节点数据项
29017
28846
  * vo -> do
@@ -29069,37 +28898,6 @@ var GanttController = class extends MDControlController {
29069
28898
  }
29070
28899
  }
29071
28900
  }
29072
- /**
29073
- * 刷新指定树节点的子节点数据
29074
- *
29075
- * @param {(IGanttNodeData | IData)} nodeData 指定树节点数据,可以是节点数据,也可以是对应的实体数据
29076
- * @param {boolean} [refreshParent=false] 是否是刷新给定节点数据的父节点的子节点数据
29077
- * @return {*} {Promise<void>}
29078
- * @memberof GanttController
29079
- */
29080
- async refreshNodeChildren(nodeData, refreshParent = false) {
29081
- const key = nodeData.srfkey ? "srfkey" : "id";
29082
- const currentNode = this.state.items.find(
29083
- (item) => item[key] === nodeData[key]
29084
- );
29085
- if (!currentNode) {
29086
- ibiz.log.error("\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u6811\u8282\u70B9\u6570\u636E", nodeData);
29087
- return;
29088
- }
29089
- if (refreshParent) {
29090
- const { parent } = currentNode;
29091
- if (!parent || !this.model.rootVisible && this.state.rootNodes.includes(parent)) {
29092
- this.refresh();
29093
- return;
29094
- }
29095
- }
29096
- const targetNode = refreshParent ? currentNode.parent : currentNode;
29097
- const nodes = await this.loadNodes(targetNode);
29098
- this.evt.emit("onAfterRefreshParent", {
29099
- parentNode: targetNode,
29100
- children: nodes
29101
- });
29102
- }
29103
28901
  };
29104
28902
 
29105
28903
  // src/controller/hub.controller.ts
@@ -31561,6 +31359,7 @@ export {
31561
31359
  getControlProvider,
31562
31360
  getControlsByView,
31563
31361
  getDEMethodProvider,
31362
+ getDERedirectToView,
31564
31363
  getDeACMode,
31565
31364
  getDefaultValue,
31566
31365
  getEditorProvider,