@bit-sun/business-component 3.2.4-alpha.1 → 3.2.4-alpha.3

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.
@@ -1,7 +1,7 @@
1
1
  export declare const formatOperationList: (data: any) => any;
2
2
  export declare const formatRegularList: (data: any) => any;
3
3
  export declare const handleRuleShowBack: (data: any, functionRuleList: any, ruleReturnList: any) => any;
4
- export declare const handleRuleRequireCheck: (saveData: any, ruleActionData: any, ruleReturnConfig: any) => {
4
+ export declare const handleRuleRequireCheck: (saveData: any, ruleActionData: any, ruleReturnConfig: any, isInstance?: boolean, regularDataList?: any) => {
5
5
  checkResult: boolean;
6
6
  checkInfo: any;
7
7
  };
package/dist/index.esm.js CHANGED
@@ -1659,6 +1659,20 @@ var keyToWord = function keyToWord(data, fieldMapping) {
1659
1659
  };
1660
1660
  /**---------------------数据写入excel-------结束------------------------*/
1661
1661
 
1662
+ // 获取树平行结构
1663
+ var _coverToParallel = function coverToParallel(treeData, result, chilKey) {
1664
+ var childrenKey = chilKey || 'children';
1665
+ treeData.forEach(function (el) {
1666
+ var _el$childrenKey;
1667
+ result.push(el);
1668
+ if ((el === null || el === void 0 ? void 0 : el[childrenKey]) && (el === null || el === void 0 ? void 0 : (_el$childrenKey = el[childrenKey]) === null || _el$childrenKey === void 0 ? void 0 : _el$childrenKey.length) > 0) {
1669
+ // 子级递归
1670
+ _coverToParallel(el === null || el === void 0 ? void 0 : el[childrenKey], result, chilKey);
1671
+ }
1672
+ });
1673
+ return result;
1674
+ };
1675
+
1662
1676
  var FORMAT_TIME_STR = 'YYYY-MM-DD HH:mm:ss';
1663
1677
  var FORMAT_DAY_STR = 'YYYY-MM-DD';
1664
1678
  var FUNCTION_GET = 'GET';
@@ -34651,17 +34665,6 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
34651
34665
  callBack(ruleClassData);
34652
34666
  });
34653
34667
  };
34654
- // 树结构 转化成 平行树 (递归函数)
34655
- _this.coverToParallel = function (treeData, result) {
34656
- treeData.forEach(function (el) {
34657
- result.push(el);
34658
- if (el.children && el.children.length > 0) {
34659
- // 子级递归
34660
- _this.coverToParallel(el.children, result);
34661
- }
34662
- });
34663
- return result;
34664
- };
34665
34668
  _this.renderRuleItem = function (itemDetail, parentDetail, floorIndex, classDataIndex, relateDatas) {
34666
34669
  var _itemDetail$subExpres, _itemDetail$params, _itemDetail$params$;
34667
34670
  var ruleTreeData = _this.state.ruleTreeData;
@@ -34688,7 +34691,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
34688
34691
  queryIdentify = _this.dynamicDictCodeToRangeIdMap["".concat(itemDetail.metaObjectCode, ".").concat(itemDetail.propertyPath)];
34689
34692
  queryIdentifyType = 'dynamicDictCodeIdentify';
34690
34693
  }
34691
- var parallelTreeData = _this.coverToParallel(ruleTreeData, []) || [];
34694
+ var parallelTreeData = _coverToParallel(ruleTreeData, []) || [];
34692
34695
  var currentTreeItem = (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId) && parallelTreeData.find(function (i) {
34693
34696
  var _i$key;
34694
34697
  return ((i === null || i === void 0 ? void 0 : (_i$key = i.key) === null || _i$key === void 0 ? void 0 : _i$key.indexOf('.')) > -1 ? i.id : i.key) === (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId);
@@ -35468,56 +35471,6 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
35468
35471
  var css_248z$u = ".goBack_btn_content {\n position: relative;\n overflow: auto;\n}\n.goBack_btn_content .goback_btn {\n float: right;\n}\n.base_rule p {\n margin: 0;\n}\n.base_rule .base_rule_content {\n margin-bottom: 20px;\n}\n.base_rule .base_rule_line_title {\n position: relative;\n margin-bottom: 20px;\n}\n.base_rule .base_rule_line_title .rule_title {\n height: 35px;\n padding: 0 10px;\n font-weight: bold;\n font-size: 16px;\n line-height: 35px;\n}\n.base_rule .base_rule_line_title .base_rule_btn_style {\n position: absolute;\n right: 0px;\n}\n.base_rule .base_rule_line_content {\n display: flex;\n padding: 14px 10px 10px;\n}\n.base_rule .base_rule_line_content .base_rule_icon_btn {\n margin-right: 10px;\n color: #89b9cf;\n font-size: 20px;\n}\n.base_rule .base_rule_line_content .base_rule_icon_btn:hover {\n cursor: pointer;\n}\n.base_rule .base_rule_line_content .base_rule_item_desc_content {\n height: 45px;\n line-height: 45px;\n}\n.base_rule .base_rule_line_content .base_rule_item_desc {\n margin-right: 15px;\n}\n.base_rule .base_rule_line_content .base_rule_item1 {\n align-items: center;\n width: 120px;\n color: #f8ab3c;\n font-size: 16px;\n}\n.base_rule .base_rule_line_content .base_rule_item2 {\n width: 1200px;\n}\n.base_rule .base_rule_line_content .base_rule_item3 {\n display: flex;\n align-items: center;\n justify-content: space-around;\n width: calc(100% - 600px);\n}\n.base_rule .base_rule_line_content .line_color_red {\n color: #ed869b;\n}\n.base_rule .base_rule_line_content .base_rule_item4 {\n width: 80px;\n}\n.base_rule .footer_line > span {\n color: #008fe0;\n font-weight: bold;\n font-size: 16px;\n}\n.rule_name_title {\n display: inline-block;\n height: 30px;\n margin-right: 10px;\n margin-bottom: 10px;\n padding-left: 10px;\n color: #f8ab3c;\n font-size: 16px;\n line-height: 30px;\n}\n.logical_operate_content {\n position: relative;\n}\n.logical_operate_content .top_line {\n position: absolute;\n top: 0;\n left: 50%;\n z-index: 999;\n width: 15px;\n height: 2px;\n background-color: #d6efe8;\n}\n.logical_operate_content .bottom_line {\n position: absolute;\n bottom: 0;\n left: 50%;\n z-index: 999;\n width: 15px;\n height: 2px;\n background-color: #d6efe8;\n}\n.logical_operate_content::before {\n position: absolute;\n top: 0;\n left: 50%;\n z-index: 998;\n width: 2px;\n height: 100%;\n overflow: hidden;\n background: #d6efe8;\n content: ' ';\n}\n.logical_item_btn {\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: 999;\n display: flex;\n align-items: center;\n width: 50px;\n height: 30px;\n margin-top: -15px;\n margin-left: -25px;\n padding: 0px;\n color: #008fe0;\n line-height: 30px;\n text-align: center;\n background-color: #ffffff;\n cursor: pointer;\n}\n.logical_item_btn1 {\n position: absolute;\n bottom: 0;\n left: 50%;\n z-index: 999;\n display: inline-block;\n width: 30px;\n height: 30px;\n margin-left: -15px;\n color: #008fe0;\n line-height: 30px;\n text-align: center;\n background-color: #ffffff;\n cursor: pointer;\n}\n.rule_field_style {\n display: inline-block;\n}\n.icon_btn_style {\n margin-right: 10px;\n font-size: 20px;\n}\n.choose_logical_type {\n height: 25px;\n margin: 0px;\n padding: 0 10px;\n line-height: 25px;\n cursor: pointer;\n}\n.choose_logical_type:first-child {\n border-bottom: 1px solid #d9d9d9;\n}\n.choose_logical_type:hover {\n color: white;\n background-color: #008fe0;\n}\n";
35469
35472
  styleInject(css_248z$u);
35470
35473
 
35471
- // expression规则集合
35472
- //{
35473
- // complex,
35474
- // dataTypeCode,
35475
- // elementId,
35476
- // elementName,
35477
- // metaObjectCode,
35478
- // operationCode,
35479
- // operationType,
35480
- // paramNames: [],
35481
- // params: [],
35482
- // propertyPath,
35483
- // subExpression: [
35484
- // complex,
35485
- // dataTypeCode,
35486
- // elementId,
35487
- // elementName,
35488
- // metaObjectCode,
35489
- // operationCode,
35490
- // operationType,
35491
- // paramNames: [],
35492
- // params: [],
35493
- // propertyPath,
35494
- // subExpression: [.....] // 继续嵌套
35495
- // ]
35496
- // }
35497
- // result 执行返回值/执行动作
35498
- //{
35499
- // "return": {
35500
- // "enable": true,
35501
- // "value": "ticketId"
35502
- // },
35503
- // "execute": [
35504
- // {
35505
- // "priority": 1,
35506
- // "code": "functionCode",
35507
- // "properties": {
35508
- // "${logisticsNum}": "dasdadasdadas"
35509
- // }
35510
- // },
35511
- // {
35512
- // "priority": 2,
35513
- // "code": "",
35514
- // "properties": {
35515
- // "${detailList.skuCode}": "ccxcx",
35516
- // "${logisticsNum}": "cxcxcx"
35517
- // }
35518
- // }
35519
- // ]
35520
- // }
35521
35474
  var formatOperationList = function formatOperationList(data) {
35522
35475
  var _result$find;
35523
35476
  var result = data || [];
@@ -35659,9 +35612,39 @@ var isNoEmpty = function isNoEmpty(data) {
35659
35612
  return Array.isArray(data) && data.length > 0 || !(data == null || data == undefined || String(data).trim() == '');
35660
35613
  };
35661
35614
  // 校验必填数据
35662
- var handleRuleRequireCheck = function handleRuleRequireCheck(saveData, ruleActionData, ruleReturnConfig) {
35615
+ var handleRuleRequireCheck = function handleRuleRequireCheck(saveData, ruleActionData, ruleReturnConfig, isInstance, regularDataList) {
35663
35616
  var checkResult = false; // 默认通过校验
35664
35617
  var checkInfo = []; // 没有选必填执行动作(暂不考虑);执行动作下的对象未选
35618
+ // 处理对象-设置了必填-规则实例保存时数据必填校验
35619
+ if (isInstance && (regularDataList === null || regularDataList === void 0 ? void 0 : regularDataList.length) && (saveData === null || saveData === void 0 ? void 0 : saveData.length)) {
35620
+ var list = _coverToParallel(regularDataList, [], 'propertyList'); // 平铺对象树
35621
+ var requiredList = list.filter(function (c) {
35622
+ return c.required == 1;
35623
+ }) || []; // 获取对象属性为true的集合
35624
+ (requiredList === null || requiredList === void 0 ? void 0 : requiredList.length) && saveData.forEach(function (s, index) {
35625
+ var _s$expression, _s$expression$subExpr, _s$expression2, _coverExpressionTree$;
35626
+ var coverExpressionTree = (s === null || s === void 0 ? void 0 : (_s$expression = s.expression) === null || _s$expression === void 0 ? void 0 : (_s$expression$subExpr = _s$expression.subExpression) === null || _s$expression$subExpr === void 0 ? void 0 : _s$expression$subExpr.length) ? _coverToParallel(s === null || s === void 0 ? void 0 : (_s$expression2 = s.expression) === null || _s$expression2 === void 0 ? void 0 : _s$expression2.subExpression, [], 'subExpression') : (s === null || s === void 0 ? void 0 : s.expression) && [s === null || s === void 0 ? void 0 : s.expression];
35627
+ (coverExpressionTree === null || coverExpressionTree === void 0 ? void 0 : coverExpressionTree.length) && (coverExpressionTree === null || coverExpressionTree === void 0 ? void 0 : (_coverExpressionTree$ = coverExpressionTree.forEach) === null || _coverExpressionTree$ === void 0 ? void 0 : _coverExpressionTree$.call(coverExpressionTree, function (e) {
35628
+ if (requiredList.some(function (r) {
35629
+ return r.id === e.elementId;
35630
+ })) {
35631
+ var _e$params, _e$params2;
35632
+ var isComplete = !!(e === null || e === void 0 ? void 0 : (_e$params = e.params) === null || _e$params === void 0 ? void 0 : _e$params.length) && isNoEmpty(e === null || e === void 0 ? void 0 : (_e$params2 = e.params) === null || _e$params2 === void 0 ? void 0 : _e$params2[0]);
35633
+ if (!isComplete) {
35634
+ checkResult = true;
35635
+ // 如果 e.elementName 不存在于 checkInfo 中,则添加
35636
+ if (Array.isArray(checkInfo) && e && typeof e.elementName === 'string') {
35637
+ var checkText = "\u89C4\u5219".concat(index + 1, ": \u5B58\u5728\u5BF9\u8C61\u3010").concat(e.elementName, "\u3011\u4FE1\u606F\u586B\u5199\u4E0D\u5B8C\u6574");
35638
+ var checkInfoSet = new Set(checkInfo);
35639
+ if (!checkInfoSet.has(checkText)) {
35640
+ checkInfo.push(checkText);
35641
+ }
35642
+ }
35643
+ }
35644
+ }
35645
+ }));
35646
+ });
35647
+ }
35665
35648
  // 校验返回值必填数据(兼容新/老数据: 配置对象为新数据/旧数据、规则返回值配置为老/新数据。组合一共是四种情况)
35666
35649
  if (((ruleReturnConfig === null || ruleReturnConfig === void 0 ? void 0 : ruleReturnConfig.required) || Array.isArray(ruleReturnConfig) && (ruleReturnConfig === null || ruleReturnConfig === void 0 ? void 0 : ruleReturnConfig.length)) && saveData.length) {
35667
35650
  var checkKey = 'code';
@@ -36113,7 +36096,7 @@ var BaseRule = /*#__PURE__*/forwardRef(function (props, ref) {
36113
36096
  message$1.warning('请至少配置一个规则!');
36114
36097
  return Promise.reject();
36115
36098
  }
36116
- var actionRequiredCheckObject = handleRuleRequireCheck(ruleResultList, ruleTypeData, ruleReturnConfig);
36099
+ var actionRequiredCheckObject = handleRuleRequireCheck(ruleResultList, ruleTypeData, ruleReturnConfig, type == 'instance', regularDataList);
36117
36100
  if (actionRequiredCheckObject === null || actionRequiredCheckObject === void 0 ? void 0 : actionRequiredCheckObject.checkResult) {
36118
36101
  var modal = Modal.warning({
36119
36102
  title: '保存校验提示',
@@ -36124,7 +36107,7 @@ var BaseRule = /*#__PURE__*/forwardRef(function (props, ref) {
36124
36107
  setTimeout(function () {
36125
36108
  modal.destroy();
36126
36109
  }, 10000);
36127
- return;
36110
+ return Promise.reject();
36128
36111
  }
36129
36112
  // setLoading(true);
36130
36113
  // 兼容没有规则组的情况
@@ -36447,4 +36430,4 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
36447
36430
  })));
36448
36431
  });
36449
36432
 
36450
- export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, CustomSelector, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, JsonQueryTable, index$6 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, createUniqID, downloadExcel, ergodicMenuRoutes, _formatter as formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, paramsControl, parseWidth, precisionQuantity, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, textIcon, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
36433
+ export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, CustomSelector, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, JsonQueryTable, index$6 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, _coverToParallel as coverToParallel, createUniqID, downloadExcel, ergodicMenuRoutes, _formatter as formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, paramsControl, parseWidth, precisionQuantity, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, textIcon, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
package/dist/index.js CHANGED
@@ -1682,6 +1682,20 @@ var keyToWord = function keyToWord(data, fieldMapping) {
1682
1682
  };
1683
1683
  /**---------------------数据写入excel-------结束------------------------*/
1684
1684
 
1685
+ // 获取树平行结构
1686
+ var _coverToParallel = function coverToParallel(treeData, result, chilKey) {
1687
+ var childrenKey = chilKey || 'children';
1688
+ treeData.forEach(function (el) {
1689
+ var _el$childrenKey;
1690
+ result.push(el);
1691
+ if ((el === null || el === void 0 ? void 0 : el[childrenKey]) && (el === null || el === void 0 ? void 0 : (_el$childrenKey = el[childrenKey]) === null || _el$childrenKey === void 0 ? void 0 : _el$childrenKey.length) > 0) {
1692
+ // 子级递归
1693
+ _coverToParallel(el === null || el === void 0 ? void 0 : el[childrenKey], result, chilKey);
1694
+ }
1695
+ });
1696
+ return result;
1697
+ };
1698
+
1685
1699
  var FORMAT_TIME_STR = 'YYYY-MM-DD HH:mm:ss';
1686
1700
  var FORMAT_DAY_STR = 'YYYY-MM-DD';
1687
1701
  var FUNCTION_GET = 'GET';
@@ -34674,17 +34688,6 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
34674
34688
  callBack(ruleClassData);
34675
34689
  });
34676
34690
  };
34677
- // 树结构 转化成 平行树 (递归函数)
34678
- _this.coverToParallel = function (treeData, result) {
34679
- treeData.forEach(function (el) {
34680
- result.push(el);
34681
- if (el.children && el.children.length > 0) {
34682
- // 子级递归
34683
- _this.coverToParallel(el.children, result);
34684
- }
34685
- });
34686
- return result;
34687
- };
34688
34691
  _this.renderRuleItem = function (itemDetail, parentDetail, floorIndex, classDataIndex, relateDatas) {
34689
34692
  var _itemDetail$subExpres, _itemDetail$params, _itemDetail$params$;
34690
34693
  var ruleTreeData = _this.state.ruleTreeData;
@@ -34711,7 +34714,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
34711
34714
  queryIdentify = _this.dynamicDictCodeToRangeIdMap["".concat(itemDetail.metaObjectCode, ".").concat(itemDetail.propertyPath)];
34712
34715
  queryIdentifyType = 'dynamicDictCodeIdentify';
34713
34716
  }
34714
- var parallelTreeData = _this.coverToParallel(ruleTreeData, []) || [];
34717
+ var parallelTreeData = _coverToParallel(ruleTreeData, []) || [];
34715
34718
  var currentTreeItem = (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId) && parallelTreeData.find(function (i) {
34716
34719
  var _i$key;
34717
34720
  return ((i === null || i === void 0 ? void 0 : (_i$key = i.key) === null || _i$key === void 0 ? void 0 : _i$key.indexOf('.')) > -1 ? i.id : i.key) === (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId);
@@ -35491,56 +35494,6 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
35491
35494
  var css_248z$u = ".goBack_btn_content {\n position: relative;\n overflow: auto;\n}\n.goBack_btn_content .goback_btn {\n float: right;\n}\n.base_rule p {\n margin: 0;\n}\n.base_rule .base_rule_content {\n margin-bottom: 20px;\n}\n.base_rule .base_rule_line_title {\n position: relative;\n margin-bottom: 20px;\n}\n.base_rule .base_rule_line_title .rule_title {\n height: 35px;\n padding: 0 10px;\n font-weight: bold;\n font-size: 16px;\n line-height: 35px;\n}\n.base_rule .base_rule_line_title .base_rule_btn_style {\n position: absolute;\n right: 0px;\n}\n.base_rule .base_rule_line_content {\n display: flex;\n padding: 14px 10px 10px;\n}\n.base_rule .base_rule_line_content .base_rule_icon_btn {\n margin-right: 10px;\n color: #89b9cf;\n font-size: 20px;\n}\n.base_rule .base_rule_line_content .base_rule_icon_btn:hover {\n cursor: pointer;\n}\n.base_rule .base_rule_line_content .base_rule_item_desc_content {\n height: 45px;\n line-height: 45px;\n}\n.base_rule .base_rule_line_content .base_rule_item_desc {\n margin-right: 15px;\n}\n.base_rule .base_rule_line_content .base_rule_item1 {\n align-items: center;\n width: 120px;\n color: #f8ab3c;\n font-size: 16px;\n}\n.base_rule .base_rule_line_content .base_rule_item2 {\n width: 1200px;\n}\n.base_rule .base_rule_line_content .base_rule_item3 {\n display: flex;\n align-items: center;\n justify-content: space-around;\n width: calc(100% - 600px);\n}\n.base_rule .base_rule_line_content .line_color_red {\n color: #ed869b;\n}\n.base_rule .base_rule_line_content .base_rule_item4 {\n width: 80px;\n}\n.base_rule .footer_line > span {\n color: #008fe0;\n font-weight: bold;\n font-size: 16px;\n}\n.rule_name_title {\n display: inline-block;\n height: 30px;\n margin-right: 10px;\n margin-bottom: 10px;\n padding-left: 10px;\n color: #f8ab3c;\n font-size: 16px;\n line-height: 30px;\n}\n.logical_operate_content {\n position: relative;\n}\n.logical_operate_content .top_line {\n position: absolute;\n top: 0;\n left: 50%;\n z-index: 999;\n width: 15px;\n height: 2px;\n background-color: #d6efe8;\n}\n.logical_operate_content .bottom_line {\n position: absolute;\n bottom: 0;\n left: 50%;\n z-index: 999;\n width: 15px;\n height: 2px;\n background-color: #d6efe8;\n}\n.logical_operate_content::before {\n position: absolute;\n top: 0;\n left: 50%;\n z-index: 998;\n width: 2px;\n height: 100%;\n overflow: hidden;\n background: #d6efe8;\n content: ' ';\n}\n.logical_item_btn {\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: 999;\n display: flex;\n align-items: center;\n width: 50px;\n height: 30px;\n margin-top: -15px;\n margin-left: -25px;\n padding: 0px;\n color: #008fe0;\n line-height: 30px;\n text-align: center;\n background-color: #ffffff;\n cursor: pointer;\n}\n.logical_item_btn1 {\n position: absolute;\n bottom: 0;\n left: 50%;\n z-index: 999;\n display: inline-block;\n width: 30px;\n height: 30px;\n margin-left: -15px;\n color: #008fe0;\n line-height: 30px;\n text-align: center;\n background-color: #ffffff;\n cursor: pointer;\n}\n.rule_field_style {\n display: inline-block;\n}\n.icon_btn_style {\n margin-right: 10px;\n font-size: 20px;\n}\n.choose_logical_type {\n height: 25px;\n margin: 0px;\n padding: 0 10px;\n line-height: 25px;\n cursor: pointer;\n}\n.choose_logical_type:first-child {\n border-bottom: 1px solid #d9d9d9;\n}\n.choose_logical_type:hover {\n color: white;\n background-color: #008fe0;\n}\n";
35492
35495
  styleInject(css_248z$u);
35493
35496
 
35494
- // expression规则集合
35495
- //{
35496
- // complex,
35497
- // dataTypeCode,
35498
- // elementId,
35499
- // elementName,
35500
- // metaObjectCode,
35501
- // operationCode,
35502
- // operationType,
35503
- // paramNames: [],
35504
- // params: [],
35505
- // propertyPath,
35506
- // subExpression: [
35507
- // complex,
35508
- // dataTypeCode,
35509
- // elementId,
35510
- // elementName,
35511
- // metaObjectCode,
35512
- // operationCode,
35513
- // operationType,
35514
- // paramNames: [],
35515
- // params: [],
35516
- // propertyPath,
35517
- // subExpression: [.....] // 继续嵌套
35518
- // ]
35519
- // }
35520
- // result 执行返回值/执行动作
35521
- //{
35522
- // "return": {
35523
- // "enable": true,
35524
- // "value": "ticketId"
35525
- // },
35526
- // "execute": [
35527
- // {
35528
- // "priority": 1,
35529
- // "code": "functionCode",
35530
- // "properties": {
35531
- // "${logisticsNum}": "dasdadasdadas"
35532
- // }
35533
- // },
35534
- // {
35535
- // "priority": 2,
35536
- // "code": "",
35537
- // "properties": {
35538
- // "${detailList.skuCode}": "ccxcx",
35539
- // "${logisticsNum}": "cxcxcx"
35540
- // }
35541
- // }
35542
- // ]
35543
- // }
35544
35497
  var formatOperationList = function formatOperationList(data) {
35545
35498
  var _result$find;
35546
35499
  var result = data || [];
@@ -35682,9 +35635,39 @@ var isNoEmpty = function isNoEmpty(data) {
35682
35635
  return Array.isArray(data) && data.length > 0 || !(data == null || data == undefined || String(data).trim() == '');
35683
35636
  };
35684
35637
  // 校验必填数据
35685
- var handleRuleRequireCheck = function handleRuleRequireCheck(saveData, ruleActionData, ruleReturnConfig) {
35638
+ var handleRuleRequireCheck = function handleRuleRequireCheck(saveData, ruleActionData, ruleReturnConfig, isInstance, regularDataList) {
35686
35639
  var checkResult = false; // 默认通过校验
35687
35640
  var checkInfo = []; // 没有选必填执行动作(暂不考虑);执行动作下的对象未选
35641
+ // 处理对象-设置了必填-规则实例保存时数据必填校验
35642
+ if (isInstance && (regularDataList === null || regularDataList === void 0 ? void 0 : regularDataList.length) && (saveData === null || saveData === void 0 ? void 0 : saveData.length)) {
35643
+ var list = _coverToParallel(regularDataList, [], 'propertyList'); // 平铺对象树
35644
+ var requiredList = list.filter(function (c) {
35645
+ return c.required == 1;
35646
+ }) || []; // 获取对象属性为true的集合
35647
+ (requiredList === null || requiredList === void 0 ? void 0 : requiredList.length) && saveData.forEach(function (s, index) {
35648
+ var _s$expression, _s$expression$subExpr, _s$expression2, _coverExpressionTree$;
35649
+ var coverExpressionTree = (s === null || s === void 0 ? void 0 : (_s$expression = s.expression) === null || _s$expression === void 0 ? void 0 : (_s$expression$subExpr = _s$expression.subExpression) === null || _s$expression$subExpr === void 0 ? void 0 : _s$expression$subExpr.length) ? _coverToParallel(s === null || s === void 0 ? void 0 : (_s$expression2 = s.expression) === null || _s$expression2 === void 0 ? void 0 : _s$expression2.subExpression, [], 'subExpression') : (s === null || s === void 0 ? void 0 : s.expression) && [s === null || s === void 0 ? void 0 : s.expression];
35650
+ (coverExpressionTree === null || coverExpressionTree === void 0 ? void 0 : coverExpressionTree.length) && (coverExpressionTree === null || coverExpressionTree === void 0 ? void 0 : (_coverExpressionTree$ = coverExpressionTree.forEach) === null || _coverExpressionTree$ === void 0 ? void 0 : _coverExpressionTree$.call(coverExpressionTree, function (e) {
35651
+ if (requiredList.some(function (r) {
35652
+ return r.id === e.elementId;
35653
+ })) {
35654
+ var _e$params, _e$params2;
35655
+ var isComplete = !!(e === null || e === void 0 ? void 0 : (_e$params = e.params) === null || _e$params === void 0 ? void 0 : _e$params.length) && isNoEmpty(e === null || e === void 0 ? void 0 : (_e$params2 = e.params) === null || _e$params2 === void 0 ? void 0 : _e$params2[0]);
35656
+ if (!isComplete) {
35657
+ checkResult = true;
35658
+ // 如果 e.elementName 不存在于 checkInfo 中,则添加
35659
+ if (Array.isArray(checkInfo) && e && typeof e.elementName === 'string') {
35660
+ var checkText = "\u89C4\u5219".concat(index + 1, ": \u5B58\u5728\u5BF9\u8C61\u3010").concat(e.elementName, "\u3011\u4FE1\u606F\u586B\u5199\u4E0D\u5B8C\u6574");
35661
+ var checkInfoSet = new Set(checkInfo);
35662
+ if (!checkInfoSet.has(checkText)) {
35663
+ checkInfo.push(checkText);
35664
+ }
35665
+ }
35666
+ }
35667
+ }
35668
+ }));
35669
+ });
35670
+ }
35688
35671
  // 校验返回值必填数据(兼容新/老数据: 配置对象为新数据/旧数据、规则返回值配置为老/新数据。组合一共是四种情况)
35689
35672
  if (((ruleReturnConfig === null || ruleReturnConfig === void 0 ? void 0 : ruleReturnConfig.required) || Array.isArray(ruleReturnConfig) && (ruleReturnConfig === null || ruleReturnConfig === void 0 ? void 0 : ruleReturnConfig.length)) && saveData.length) {
35690
35673
  var checkKey = 'code';
@@ -36136,7 +36119,7 @@ var BaseRule = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
36136
36119
  antd.message.warning('请至少配置一个规则!');
36137
36120
  return Promise.reject();
36138
36121
  }
36139
- var actionRequiredCheckObject = handleRuleRequireCheck(ruleResultList, ruleTypeData, ruleReturnConfig);
36122
+ var actionRequiredCheckObject = handleRuleRequireCheck(ruleResultList, ruleTypeData, ruleReturnConfig, type == 'instance', regularDataList);
36140
36123
  if (actionRequiredCheckObject === null || actionRequiredCheckObject === void 0 ? void 0 : actionRequiredCheckObject.checkResult) {
36141
36124
  var modal = antd.Modal.warning({
36142
36125
  title: '保存校验提示',
@@ -36147,7 +36130,7 @@ var BaseRule = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
36147
36130
  setTimeout(function () {
36148
36131
  modal.destroy();
36149
36132
  }, 10000);
36150
- return;
36133
+ return Promise.reject();
36151
36134
  }
36152
36135
  // setLoading(true);
36153
36136
  // 兼容没有规则组的情况
@@ -36507,6 +36490,7 @@ exports.TreeSearchSelect = TreeSearchSelect;
36507
36490
  exports.authFunc = authFunc;
36508
36491
  exports.calculateValidPeriod = calculateValidPeriod;
36509
36492
  exports.checkQuantityAccuracy = checkQuantityAccuracy;
36493
+ exports.coverToParallel = _coverToParallel;
36510
36494
  exports.createUniqID = createUniqID;
36511
36495
  exports.downloadExcel = downloadExcel;
36512
36496
  exports.ergodicMenuRoutes = ergodicMenuRoutes;
@@ -0,0 +1 @@
1
+ export declare const coverToParallel: (treeData: any, result: any[], chilKey: string) => any[];
@@ -4,6 +4,7 @@ import './LocalstorageUtils';
4
4
  import './utils';
5
5
  import './auth';
6
6
  import './xlsxUtil';
7
+ import './TreeUtils';
7
8
  export * from './requestUtils';
8
9
  export * from './checkUtils';
9
10
  export * from './LocalstorageUtils';
@@ -14,3 +15,4 @@ export * from './TableUtils';
14
15
  export * from './businessUtils';
15
16
  export * from './utils';
16
17
  export * from './xlsxUtil';
18
+ export * from './TreeUtils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "3.2.4-alpha.1",
3
+ "version": "3.2.4-alpha.3",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -34,6 +34,7 @@ import {
34
34
  isObj,
35
35
  } from './util';
36
36
  import { getDictionarySource, uuid } from '../../../utils/utils';
37
+ import { coverToParallel } from '../../../utils/TreeUtils';
37
38
  import {
38
39
  BusinessSearchSelect,
39
40
  BusinessTreeSearchSelect,
@@ -613,18 +614,6 @@ class RuleObjectComponent extends Component {
613
614
  );
614
615
  };
615
616
 
616
- // 树结构 转化成 平行树 (递归函数)
617
- coverToParallel = (treeData, result) => {
618
- treeData.forEach((el) => {
619
- result.push(el);
620
- if (el.children && el.children.length > 0) {
621
- // 子级递归
622
- this.coverToParallel(el.children, result);
623
- }
624
- });
625
- return result;
626
- };
627
-
628
617
  renderRuleItem = (
629
618
  itemDetail,
630
619
  parentDetail,
@@ -687,7 +676,7 @@ class RuleObjectComponent extends Component {
687
676
  queryIdentifyType = 'dynamicDictCodeIdentify';
688
677
  }
689
678
 
690
- const parallelTreeData = this.coverToParallel(ruleTreeData, []) || [];
679
+ const parallelTreeData = coverToParallel(ruleTreeData, []) || [];
691
680
  const currentTreeItem =
692
681
  itemDetail?.elementId &&
693
682
  parallelTreeData.find((i) => (i?.key?.indexOf('.') > -1 ? i.id : i.key) === itemDetail?.elementId);
@@ -265,7 +265,9 @@ export default forwardRef((props: any, ref) => {
265
265
  const actionRequiredCheckObject = handleRuleRequireCheck(
266
266
  ruleResultList,
267
267
  ruleTypeData,
268
- ruleReturnConfig
268
+ ruleReturnConfig,
269
+ type == 'instance',
270
+ regularDataList
269
271
  );
270
272
  if (actionRequiredCheckObject?.checkResult) {
271
273
  const modal = Modal.warning({
@@ -277,7 +279,7 @@ export default forwardRef((props: any, ref) => {
277
279
  setTimeout(() => {
278
280
  modal.destroy();
279
281
  }, 10000);
280
- return;
282
+ return Promise.reject();
281
283
  }
282
284
 
283
285
  // setLoading(true);
@@ -48,6 +48,7 @@
48
48
  // }
49
49
  // ]
50
50
  // }
51
+ import { coverToParallel } from '@/utils/TreeUtils';
51
52
  export const formatOperationList = (data: any) => {
52
53
  let result = data||[];
53
54
  result = result.concat([{
@@ -194,12 +195,39 @@ const isNoEmpty = (data: any) =>
194
195
  !(data == null || data == undefined || String(data).trim() == '');
195
196
 
196
197
  // 校验必填数据
197
- export const handleRuleRequireCheck = (saveData: any, ruleActionData: any, ruleReturnConfig: any) => {
198
+ export const handleRuleRequireCheck = (saveData: any, ruleActionData: any, ruleReturnConfig: any, isInstance?: boolean, regularDataList?: any) => {
198
199
  let checkResult = false; // 默认通过校验
199
- let checkInfo: any = []; // 没有选必填执行动作(暂不考虑);执行动作下的对象未选
200
+ const checkInfo: any = []; // 没有选必填执行动作(暂不考虑);执行动作下的对象未选
201
+
202
+ // 处理对象-设置了必填-规则实例保存时数据必填校验
203
+ if (isInstance && regularDataList?.length && saveData?.length) {
204
+ const list = coverToParallel(regularDataList,[],'propertyList'); // 平铺对象树
205
+ const requiredList = list.filter((c: any) => c.required == 1)||[]; // 获取对象属性为true的集合
206
+ requiredList?.length &&
207
+ saveData.forEach((s: any, index: number) => {
208
+ const coverExpressionTree = s?.expression?.subExpression?.length ? coverToParallel(s?.expression?.subExpression,[],'subExpression') : (s?.expression && [s?.expression]);
209
+ coverExpressionTree?.length &&
210
+ coverExpressionTree?.forEach?.((e: any) => {
211
+ if (requiredList.some((r: any) => r.id === e.elementId)) {
212
+ const isComplete = !!e?.params?.length && isNoEmpty(e?.params?.[0]);
213
+ if (!isComplete) {
214
+ checkResult = true;
215
+ // 如果 e.elementName 不存在于 checkInfo 中,则添加
216
+ if (Array.isArray(checkInfo) && e && typeof e.elementName === 'string') {
217
+ const checkText = `规则${index + 1}: 存在对象【${e.elementName}】信息填写不完整`
218
+ const checkInfoSet = new Set(checkInfo);
219
+ if (!checkInfoSet.has(checkText)) {
220
+ checkInfo.push(checkText);
221
+ }
222
+ }
223
+ }
224
+ }
225
+ });
226
+ });
227
+ }
200
228
 
201
229
  // 校验返回值必填数据(兼容新/老数据: 配置对象为新数据/旧数据、规则返回值配置为老/新数据。组合一共是四种情况)
202
- if((ruleReturnConfig?.required || (Array.isArray(ruleReturnConfig) && ruleReturnConfig?.length)) && saveData.length) {
230
+ if ((ruleReturnConfig?.required || (Array.isArray(ruleReturnConfig) && ruleReturnConfig?.length)) && saveData.length) {
203
231
  const checkKey = 'code'
204
232
 
205
233
  saveData.forEach((s: any, index: number) => {
@@ -0,0 +1,12 @@
1
+ // 获取树平行结构
2
+ export const coverToParallel = (treeData: any, result: any[],chilKey: string) =>{
3
+ let childrenKey = chilKey || 'children';
4
+ treeData.forEach((el: any)=>{
5
+ result.push(el);
6
+ if(el?.[childrenKey] && el?.[childrenKey]?.length>0) {
7
+ // 子级递归
8
+ coverToParallel(el?.[childrenKey],result,chilKey)
9
+ }
10
+ });
11
+ return result
12
+ };
@@ -4,6 +4,7 @@ import './LocalstorageUtils';
4
4
  import './utils';
5
5
  import './auth'
6
6
  import './xlsxUtil';
7
+ import './TreeUtils';
7
8
 
8
9
  // 导出所有工具函数
9
10
  export * from './requestUtils';
@@ -16,4 +17,5 @@ export * from './TableUtils';
16
17
  export * from './businessUtils';
17
18
  export * from './utils';
18
19
  export * from './xlsxUtil';
20
+ export * from './TreeUtils';
19
21