@ibiz-template/runtime 0.6.4 → 0.6.7

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 (32) hide show
  1. package/dist/index.esm.js +123 -33
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  4. package/out/controller/common/control/md-control.controller.js +3 -0
  5. package/out/controller/control/report-panel/report-panel.service.d.ts.map +1 -1
  6. package/out/controller/control/report-panel/report-panel.service.js +1 -2
  7. package/out/controller/control/toolbar/toolbar.controllerr.d.ts.map +1 -1
  8. package/out/controller/control/toolbar/toolbar.controllerr.js +2 -1
  9. package/out/controller/utils/data-file-util/data-file-util.d.ts +2 -2
  10. package/out/controller/utils/data-file-util/data-file-util.d.ts.map +1 -1
  11. package/out/controller/utils/data-file-util/data-file-util.js +13 -4
  12. package/out/model/utils/util.d.ts +12 -1
  13. package/out/model/utils/util.d.ts.map +1 -1
  14. package/out/model/utils/util.js +37 -0
  15. package/out/service/service/authority/de-authority.service.d.ts.map +1 -1
  16. package/out/service/service/authority/de-authority.service.js +7 -2
  17. package/out/service/service/entity/de.service.js +3 -3
  18. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  19. package/out/service/service/entity/method/de-action.js +17 -12
  20. package/out/service/service/entity/method/method.d.ts +8 -1
  21. package/out/service/service/entity/method/method.d.ts.map +1 -1
  22. package/out/service/service/entity/method/method.js +11 -4
  23. package/out/service/service/file/file.service.js +1 -1
  24. package/out/service/utils/app-counter/app-counter.d.ts +10 -0
  25. package/out/service/utils/app-counter/app-counter.d.ts.map +1 -1
  26. package/out/service/utils/app-counter/app-counter.js +23 -0
  27. package/out/service/utils/util/util.d.ts +8 -0
  28. package/out/service/utils/util/util.d.ts.map +1 -1
  29. package/out/service/utils/util/util.js +19 -0
  30. package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
  31. package/out/ui-action/provider/front-ui-action-provider.js +6 -6
  32. package/package.json +2 -3
package/dist/index.esm.js CHANGED
@@ -804,6 +804,33 @@ function getControlPanel(control) {
804
804
  }
805
805
  return layoutPanel;
806
806
  }
807
+ function findAppDEMethod(appDataEntity, id) {
808
+ const models = appDataEntity.appDEMethods;
809
+ if (models && id) {
810
+ const model = findModelChild(models, id);
811
+ if (model) {
812
+ return model;
813
+ }
814
+ const model2 = models.find((item) => {
815
+ switch (item.methodType) {
816
+ case "DEACTION": {
817
+ const { actionTag } = item;
818
+ return (actionTag == null ? void 0 : actionTag.toLowerCase()) === id.toLowerCase();
819
+ }
820
+ case "FETCH": {
821
+ const { dataSetTag } = item;
822
+ return "fetch".concat(dataSetTag == null ? void 0 : dataSetTag.toLowerCase()) === id.toLowerCase();
823
+ }
824
+ default:
825
+ return false;
826
+ }
827
+ });
828
+ if (model2) {
829
+ return model2;
830
+ }
831
+ }
832
+ return null;
833
+ }
807
834
 
808
835
  // src/model/layout/layout.ts
809
836
  import { isArray as isArray2, isObject, isString } from "lodash-es";
@@ -6101,6 +6128,7 @@ var AppCounter = class {
6101
6128
  * @type {IData}
6102
6129
  */
6103
6130
  this.data = {};
6131
+ this.countChange = this.countChange.bind(this);
6104
6132
  }
6105
6133
  /**
6106
6134
  * 计数器是否已经销毁
@@ -6125,6 +6153,26 @@ var AppCounter = class {
6125
6153
  this.setParams(context, params);
6126
6154
  this.interval();
6127
6155
  await this.load();
6156
+ if (this.model.appDataEntityId) {
6157
+ ibiz.mc.command.change.on(this.countChange);
6158
+ }
6159
+ }
6160
+ /**
6161
+ * 接受计数器实体数据变更,刷新计数器
6162
+ *
6163
+ * @author chitanda
6164
+ * @date 2024-03-07 14:03:00
6165
+ * @protected
6166
+ * @param {IPortalMessage} msg
6167
+ */
6168
+ countChange(msg) {
6169
+ const data = msg.data;
6170
+ if (this.model.appDataEntityId) {
6171
+ const codeName = calcDeCodeNameById(this.model.appDataEntityId);
6172
+ if (data && data.srfdecodename === codeName) {
6173
+ this.refresh();
6174
+ }
6175
+ }
6128
6176
  }
6129
6177
  /**
6130
6178
  * 设置上下文以及查询参数
@@ -6241,6 +6289,7 @@ var AppCounter = class {
6241
6289
  this.context.destroy();
6242
6290
  this.destroyInterval();
6243
6291
  this.evt.reset();
6292
+ ibiz.mc.command.change.on(this.countChange);
6244
6293
  }
6245
6294
  };
6246
6295
 
@@ -7273,6 +7322,20 @@ function fieldValueToBoolean(value) {
7273
7322
  return !!value;
7274
7323
  }
7275
7324
  }
7325
+ function convertToObject(input) {
7326
+ const result = {};
7327
+ if (!input) {
7328
+ return result;
7329
+ }
7330
+ const pairs = input.split(",");
7331
+ if (pairs && pairs.length > 0) {
7332
+ pairs.forEach((pair) => {
7333
+ const [key, value] = pair.split(":");
7334
+ result[key] = parseInt(value, 10);
7335
+ });
7336
+ }
7337
+ return result;
7338
+ }
7276
7339
 
7277
7340
  // src/service/utils/dyna-sys-params/dyna-sys-params.ts
7278
7341
  async function calcDynaSysParams(appDataEntityId, context, opts = {}) {
@@ -7930,7 +7993,7 @@ var FileService = class {
7930
7993
  */
7931
7994
  exportData(dataExport, fetchAction, context, params) {
7932
7995
  const resPath = calcResPath(context, this.model);
7933
- const exportUrl = "".concat(resPath, "/").concat(this.model.codeName2.toLowerCase(), "/exportdata/").concat(fetchAction.toLowerCase(), "/?srfexporttag=").concat(dataExport.codeName);
7996
+ const exportUrl = "".concat(resPath, "/").concat(this.model.deapicodeName2, "/exportdata/").concat(fetchAction.toLowerCase(), "/?srfexporttag=").concat(dataExport.codeName);
7934
7997
  return ibiz.net.request(exportUrl, {
7935
7998
  method: "post",
7936
7999
  data: params,
@@ -8460,7 +8523,7 @@ var DEService = class {
8460
8523
  if (this.methodMap.has(cacheId)) {
8461
8524
  return this.methodMap.get(cacheId);
8462
8525
  }
8463
- const model = findModelChild(this.model.appDEMethods, id);
8526
+ const model = findAppDEMethod(this.model, id);
8464
8527
  if (!model) {
8465
8528
  throw new RuntimeModelError10(this.model, "\u672A\u627E\u5230\u670D\u52A1\u65B9\u6CD5: ".concat(id));
8466
8529
  }
@@ -8613,7 +8676,7 @@ var DEService = class {
8613
8676
  */
8614
8677
  calcSsePath(context, isHistories = false) {
8615
8678
  const srfkey = context[this.model.codeName.toLowerCase()];
8616
- const curPath = "/".concat(this.model.codeName2.toLowerCase(), "/ssechatcompletion").concat(isHistories ? "/histories" : "").concat(srfkey ? "/".concat(srfkey) : "");
8679
+ const curPath = "/".concat(this.model.deapicodeName2, "/ssechatcompletion").concat(isHistories ? "/histories" : "").concat(srfkey ? "/".concat(srfkey) : "");
8617
8680
  const resPath = calcResPath(context, this.model);
8618
8681
  return resPath + curPath;
8619
8682
  }
@@ -9136,8 +9199,11 @@ var DeAuthorityService = class {
9136
9199
  * @return {*} {Promise<boolean>}
9137
9200
  */
9138
9201
  async calcByDataAccessAction(dataAccessAction, data) {
9139
- if (data.srfopprivs && !data.srfopprivs.includes(dataAccessAction)) {
9140
- return false;
9202
+ if (data.srfdataaccaction) {
9203
+ const dataAccactions = convertToObject(data.srfdataaccaction);
9204
+ if (!dataAccactions[dataAccessAction]) {
9205
+ return false;
9206
+ }
9141
9207
  }
9142
9208
  const mainStateResult = await this.calcByDeMainState(
9143
9209
  dataAccessAction,
@@ -9662,13 +9728,14 @@ var Method = class {
9662
9728
  async request(path2, context, data, params, header) {
9663
9729
  const { actionType, requestMethod } = this.method;
9664
9730
  if (actionType === "REMOTE") {
9665
- const methodName = this.method.codeName.toLowerCase();
9731
+ const methodName = this.method.requestPath;
9666
9732
  let res = null;
9667
9733
  switch (requestMethod) {
9668
9734
  case "POST":
9669
9735
  res = await this.app.net.post(
9670
9736
  this.mergeRequestPath(path2, methodName),
9671
9737
  data || params || {},
9738
+ {},
9672
9739
  header
9673
9740
  );
9674
9741
  break;
@@ -9707,8 +9774,15 @@ var Method = class {
9707
9774
  }
9708
9775
  throw new RuntimeModelError11(this.method, "\u672A\u652F\u6301\u7684\u884C\u4E3A\u7C7B\u578B[".concat(actionType, "]"));
9709
9776
  }
9777
+ /**
9778
+ * 合并请求路径
9779
+ * @author lionlau
9780
+ * @param path
9781
+ * @param methodName 方法名,以 / 开始
9782
+ * @returns
9783
+ */
9710
9784
  mergeRequestPath(path2, methodName) {
9711
- return "".concat(path2, "/").concat(methodName);
9785
+ return methodName ? "".concat(path2).concat(methodName) : "".concat(path2);
9712
9786
  }
9713
9787
  /**
9714
9788
  * 根据上下文计算当前请求路径
@@ -9720,7 +9794,7 @@ var Method = class {
9720
9794
  * @return {*} {string} 拼接结果说明: /祖父实体/祖父实体主键/爷爷实体/爷爷实体主键/父实体/父实体主键/当前实体
9721
9795
  */
9722
9796
  calcPath(context) {
9723
- const curPath = "/".concat(this.entity.codeName2.toLowerCase());
9797
+ const curPath = "/".concat(this.entity.deapicodeName2);
9724
9798
  const resPath = calcResPath(context, this.entity);
9725
9799
  return resPath + curPath;
9726
9800
  }
@@ -10971,35 +11045,36 @@ var DEActionMethod = class extends Method {
10971
11045
  if (data && !this.isLocalMode) {
10972
11046
  data = await this.inputHandle(context, data);
10973
11047
  }
10974
- switch (this.method.codeName) {
10975
- case "Create":
11048
+ const methodTag = this.method.actionTag ? this.method.actionTag.toUpperCase() : this.method.codeName.toUpperCase();
11049
+ switch (methodTag) {
11050
+ case "CREATE":
10976
11051
  result = await this.create(context, data, params || {}, header);
10977
11052
  break;
10978
- case "Get":
11053
+ case "GET":
10979
11054
  result = await this.get(context, params, header);
10980
11055
  break;
10981
- case "GetDraft":
11056
+ case "GETDRAFT":
10982
11057
  result = await this.getDraft(context, params, header);
10983
11058
  break;
10984
- case "Remove":
11059
+ case "REMOVE":
10985
11060
  result = await this.remove(context, params);
10986
11061
  break;
10987
- case "Update":
11062
+ case "UPDATE":
10988
11063
  result = await this.update(context, data, params, header);
10989
11064
  break;
10990
- case "CreateTemp":
11065
+ case "CREATETEMP":
10991
11066
  result = await this.createTemp(context, data);
10992
11067
  break;
10993
- case "GetTemp":
11068
+ case "GETTEMP":
10994
11069
  result = await this.getTemp(context, data);
10995
11070
  break;
10996
- case "GetDraftTemp":
11071
+ case "GETDRAFTTEMP":
10997
11072
  result = await this.getDraftTemp(context, params);
10998
11073
  break;
10999
- case "RemoveTemp":
11074
+ case "REMOVETEMP":
11000
11075
  result = await this.removeTemp(context, data);
11001
11076
  break;
11002
- case "UpdateTemp":
11077
+ case "UPDATETEMP":
11003
11078
  result = await this.updateTemp(context, data);
11004
11079
  break;
11005
11080
  default: {
@@ -11133,7 +11208,11 @@ var DEActionMethod = class extends Method {
11133
11208
  return this.getDraftTemp(context, params);
11134
11209
  }
11135
11210
  const path2 = this.calcPath(context);
11136
- const res = await this.app.net.get("".concat(path2, "/getdraft"), params, header);
11211
+ const res = await this.app.net.get(
11212
+ this.mergeRequestPath(path2, this.method.requestPath),
11213
+ params,
11214
+ header
11215
+ );
11137
11216
  res.data = await this.result.handle(context, res.data);
11138
11217
  return res;
11139
11218
  }
@@ -14340,13 +14419,17 @@ function listenAsyncAction(id) {
14340
14419
  ibiz.mc.command.asyncAction.on(callBack);
14341
14420
  });
14342
14421
  }
14343
- async function asyncImportData(file, appDataEntity, dataImport) {
14422
+ async function asyncImportData(file, appDataEntity, dataImport, context) {
14344
14423
  const data = new FormData();
14345
14424
  data.append("file", file);
14346
- let url = "".concat(appDataEntity.codeName2.toLowerCase(), "/").concat(asyncImportUrl);
14425
+ let url = "/".concat(appDataEntity.deapicodeName2, "/").concat(asyncImportUrl);
14347
14426
  if (dataImport == null ? void 0 : dataImport.codeName) {
14348
14427
  url += "?srfimporttag=".concat(dataImport.codeName);
14349
14428
  }
14429
+ if (context) {
14430
+ const resPath = calcResPath(context, appDataEntity);
14431
+ url = resPath + url;
14432
+ }
14350
14433
  const res = await ibiz.net.request(url, {
14351
14434
  method: "post",
14352
14435
  data,
@@ -14358,13 +14441,17 @@ async function asyncImportData(file, appDataEntity, dataImport) {
14358
14441
  "OBJECTCREATED"
14359
14442
  );
14360
14443
  }
14361
- async function importData(file, appDataEntity, dataImport) {
14444
+ async function importData(file, appDataEntity, dataImport, context) {
14362
14445
  const data = new FormData();
14363
14446
  data.append("file", file);
14364
- let url = "".concat(appDataEntity.codeName2.toLowerCase(), "/").concat(importUrl);
14447
+ let url = "/".concat(appDataEntity.deapicodeName2, "/").concat(importUrl);
14365
14448
  if (dataImport == null ? void 0 : dataImport.codeName) {
14366
14449
  url += "?srfimporttag=".concat(dataImport.codeName);
14367
14450
  }
14451
+ if (context) {
14452
+ const resPath = calcResPath(context, appDataEntity);
14453
+ url = resPath + url;
14454
+ }
14368
14455
  const res = await ibiz.net.request(url, {
14369
14456
  method: "post",
14370
14457
  data,
@@ -16272,7 +16359,10 @@ var MDControlController = class extends ControlController {
16272
16359
  importName,
16273
16360
  {
16274
16361
  dismiss: () => modal.dismiss(),
16275
- appDataEntity
16362
+ dataImport,
16363
+ appDataEntity,
16364
+ context: this.context,
16365
+ params: this.params
16276
16366
  },
16277
16367
  {
16278
16368
  width: "auto",
@@ -20141,7 +20231,7 @@ var FrontUIActionProvider = class extends UIActionProviderBase {
20141
20231
  * @return {*}
20142
20232
  */
20143
20233
  async executePrint(action, args) {
20144
- var _a, _b, _c;
20234
+ var _a, _b;
20145
20235
  const { resultContext, resultParams } = await this.handleParams(
20146
20236
  action,
20147
20237
  args.context,
@@ -20158,7 +20248,7 @@ var FrontUIActionProvider = class extends UIActionProviderBase {
20158
20248
  if (appDEPrint) {
20159
20249
  let requestUrl = "";
20160
20250
  if (resultContext && resultContext[appDataEntity.codeName.toLowerCase()]) {
20161
- requestUrl += "/".concat((_b = appDataEntity.codeName2) == null ? void 0 : _b.toLowerCase(), "/printdata/").concat(resultContext[appDataEntity.codeName.toLowerCase()]);
20251
+ requestUrl += "/".concat(appDataEntity.deapicodeName2, "/printdata/").concat(resultContext[appDataEntity.codeName.toLowerCase()]);
20162
20252
  } else {
20163
20253
  throw new RuntimeError48("\u6CA1\u6709\u627E\u5230\u6570\u636E\u4E3B\u952E");
20164
20254
  }
@@ -20173,7 +20263,7 @@ var FrontUIActionProvider = class extends UIActionProviderBase {
20173
20263
  if (res.ok) {
20174
20264
  if (resultParams && resultParams.srfcontenttype) {
20175
20265
  const disposition = res.headers["content-disposition"];
20176
- const filename = (_c = disposition.split(";").find((str) => str.indexOf("filename=") !== -1)) == null ? void 0 : _c.slice(9);
20266
+ const filename = (_b = disposition.split(";").find((str) => str.indexOf("filename=") !== -1)) == null ? void 0 : _b.slice(9);
20177
20267
  const href = URL.createObjectURL(res.data);
20178
20268
  const a = document.createElement("a");
20179
20269
  a.href = href;
@@ -20251,7 +20341,7 @@ var FrontUIActionProvider = class extends UIActionProviderBase {
20251
20341
  * @return {*}
20252
20342
  */
20253
20343
  async executeDataExport(action, args) {
20254
- var _a, _b;
20344
+ var _a;
20255
20345
  const { resultParams } = await this.handleParams(
20256
20346
  action,
20257
20347
  args.context,
@@ -20266,7 +20356,7 @@ var FrontUIActionProvider = class extends UIActionProviderBase {
20266
20356
  return dataExport.id === action.appDEDataExportId;
20267
20357
  });
20268
20358
  if (appDEDataExport) {
20269
- const url = "/".concat((_b = appDataEntity.codeName2) == null ? void 0 : _b.toLowerCase(), "/exportdata/fetchdefault?srfexporttag=").concat(appDEDataExport.codeName);
20359
+ const url = "/".concat(appDataEntity.deapicodeName2, "/exportdata/fetchdefault?srfexporttag=").concat(appDEDataExport.codeName);
20270
20360
  const params = {
20271
20361
  page: 0,
20272
20362
  size: appDEDataExport.maxRowCount ? appDEDataExport.maxRowCount : 1e3,
@@ -20428,7 +20518,7 @@ var ToolbarController = class extends ControlController {
20428
20518
  for (let i = 0; i < item.controlLogics.length; i++) {
20429
20519
  const controlLogic = item.controlLogics[i];
20430
20520
  const itemState = this.state.buttonsState[item.id];
20431
- if (controlLogic.itemName === item.id && controlLogic.triggerType === "ITEMVISIBLE") {
20521
+ if (controlLogic.itemName === item.id && controlLogic.triggerType === "ITEMVISIBLE" && itemState) {
20432
20522
  itemState.visible = false;
20433
20523
  break;
20434
20524
  }
@@ -33476,12 +33566,11 @@ var ReportPanelService = class extends ControlService {
33476
33566
  * @returns {*} {Promise<IHttpResponse>}
33477
33567
  */
33478
33568
  async fetch(context, params = {}) {
33479
- var _a;
33480
33569
  this.dataEntity = await ibiz.hub.getAppDataEntity(
33481
33570
  this.model.appDataEntityId,
33482
33571
  this.model.appId
33483
33572
  );
33484
- const url = "".concat((_a = this.dataEntity.codeName2) == null ? void 0 : _a.toLowerCase(), "/report?srfreporttag=").concat(this.model.codeName);
33573
+ const url = "".concat(this.dataEntity.deapicodeName2, "/report?srfreporttag=").concat(this.model.codeName);
33485
33574
  let res = await ibiz.net.request(url, {
33486
33575
  method: "post",
33487
33576
  data: params
@@ -37422,6 +37511,7 @@ export {
37422
37511
  fieldValueToBoolean,
37423
37512
  filterFieldLogics,
37424
37513
  filterValueRules,
37514
+ findAppDEMethod,
37425
37515
  findChildFormDetails,
37426
37516
  findDELogic,
37427
37517
  findEditItem,