@kmkf-fe-packages/kmkf-work-order-service-component 0.22.0 → 0.23.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,6 +37,7 @@ import { PlatForm } from "../../../model/flowTemplateDetail/types";
37
37
  import { groupByPreNode, getCurrentNodeModifiedShowHideRule } from "./common";
38
38
  import { getCalculationComponentValue } from "../../../common/utils/arithmetic";
39
39
  import "./index.less";
40
+ import { CHILD_FIELD_TYPE, CHILD_FIELD_VALUE } from "../../../common/constant";
40
41
  var hasComponent = function hasComponent(componentDtoList, workOrderComponentType) {
41
42
  var _componentDtoList$fin;
42
43
  return (_componentDtoList$fin = componentDtoList.find(function (item) {
@@ -677,6 +678,32 @@ var FormRender = function FormRender(props, ref) {
677
678
  type: info.workOrderComponentType
678
679
  });
679
680
  };
681
+ var conditionItemResult = function conditionItemResult(item, getFieldValue) {
682
+ var _item$leftValue$split, _item$leftValue$split2, _item$compareSymbol;
683
+ //现支持子组件控制显隐,格式为${uniqueKey}_${type}与普通组件做区分
684
+ var isChildField = item.leftValue.includes('_');
685
+ var prefixId = isChildField ? (_item$leftValue$split = item.leftValue.split('_')) === null || _item$leftValue$split === void 0 ? void 0 : _item$leftValue$split[0] : item.leftValue;
686
+ var childFieldType = isChildField ? (_item$leftValue$split2 = item.leftValue.split('_')) === null || _item$leftValue$split2 === void 0 ? void 0 : _item$leftValue$split2[1] : '';
687
+ var dependenceDetail = getComponentDetailByFieldId(prefixId);
688
+ if (isChildField && CHILD_FIELD_TYPE[childFieldType]) {
689
+ var _dependenceDetail;
690
+ var childType = CHILD_FIELD_TYPE[childFieldType];
691
+ dependenceDetail = ((_dependenceDetail = dependenceDetail) === null || _dependenceDetail === void 0 ? void 0 : _dependenceDetail[childType]) || dependenceDetail;
692
+ }
693
+ var leftValue = getFieldValue(prefixId);
694
+ if (isChildField) {
695
+ var _leftValue;
696
+ leftValue = CHILD_FIELD_VALUE !== null && CHILD_FIELD_VALUE !== void 0 && CHILD_FIELD_VALUE[childFieldType] ? (_leftValue = leftValue) === null || _leftValue === void 0 ? void 0 : _leftValue[CHILD_FIELD_VALUE[childFieldType]] : '';
697
+ }
698
+ if (typeof dependenceDetail.formDataTransform === 'function') {
699
+ leftValue = dependenceDetail.formDataTransform(leftValue);
700
+ }
701
+ // TODO: 如果依赖的组件是隐藏的,当前依赖项为false
702
+ if (Reflect.has(currentComponentDisplayStatus.current, prefixId) && !currentComponentDisplayStatus.current[prefixId]) {
703
+ return false;
704
+ }
705
+ return getExpression((_item$compareSymbol = item.compareSymbol) === null || _item$compareSymbol === void 0 ? void 0 : _item$compareSymbol.toUpperCase(), leftValue, item.rightValue);
706
+ };
680
707
  var newRenderColumnItem = function newRenderColumnItem(effects) {
681
708
  return function (item) {
682
709
  var _item$componentConfig = item.componentConfig,
@@ -750,37 +777,58 @@ var FormRender = function FormRender(props, ref) {
750
777
  // 满足所有
751
778
  if (linkCondition === 'every') {
752
779
  return every(conditionList, function (item) {
753
- var _item$compareSymbol;
754
- var dependenceDetail = getComponentDetailByFieldId(item.leftValue);
755
- var leftValue = getFieldValue(item.leftValue);
756
- if (typeof dependenceDetail.formDataTransform === 'function') {
757
- leftValue = dependenceDetail.formDataTransform(leftValue);
758
- }
759
- // TODO: 如果依赖的组件是隐藏的,当前依赖项为false
760
- if (Reflect.has(currentComponentDisplayStatus.current, item.leftValue) && !currentComponentDisplayStatus.current[item.leftValue]) {
761
- // console.log(
762
- // 'every',
763
- // item.leftValue,
764
- // currentComponentDisplayStatus.current[item.leftValue],
765
- // );
766
- return false;
767
- }
768
- return getExpression((_item$compareSymbol = item.compareSymbol) === null || _item$compareSymbol === void 0 ? void 0 : _item$compareSymbol.toUpperCase(), leftValue, item.rightValue);
780
+ //现支持子组件控制显隐,格式为${uniqueKey}_${type}与普通组件做区分
781
+ // const isChildField = item.leftValue.includes('_');
782
+ // const prefixId = isChildField ? item.leftValue.split('_')?.[0] : item.leftValue;
783
+ // const childFieldType = isChildField ? item.leftValue.split('_')?.[1] : '';
784
+ // let dependenceDetail = getComponentDetailByFieldId(prefixId);
785
+ // if (isChildField && CHILD_FIELD_TYPE[childFieldType]) {
786
+ // const childType = CHILD_FIELD_TYPE[childFieldType];
787
+ // dependenceDetail = dependenceDetail?.[childType] || dependenceDetail;
788
+ // }
789
+
790
+ // let leftValue = getFieldValue(prefixId);
791
+ // if (isChildField) {
792
+ // leftValue = (leftValue as Record<string, any>)?.[childFieldType];
793
+ // }
794
+ // if (typeof dependenceDetail.formDataTransform === 'function') {
795
+ // leftValue = dependenceDetail.formDataTransform(leftValue);
796
+ // }
797
+ // // TODO: 如果依赖的组件是隐藏的,当前依赖项为false
798
+ // if (
799
+ // Reflect.has(currentComponentDisplayStatus.current, prefixId) &&
800
+ // !currentComponentDisplayStatus.current[prefixId]
801
+ // ) {
802
+ // return false;
803
+ // }
804
+ // return getExpression(
805
+ // item.compareSymbol?.toUpperCase(),
806
+ // leftValue,
807
+ // item.rightValue,
808
+ // );
809
+ return conditionItemResult(item, getFieldValue);
769
810
  });
770
811
  }
771
812
  // 满足其中之一
772
813
  return some(conditionList, function (item) {
773
- var _item$compareSymbol2;
774
- var dependenceDetail = getComponentDetailByFieldId(item.leftValue);
775
- var leftValue = getFieldValue(item.leftValue);
776
- if (typeof dependenceDetail.formDataTransform === 'function') {
777
- leftValue = dependenceDetail.formDataTransform(leftValue);
778
- }
779
- // TODO: 如果依赖的组件是隐藏的,当前依赖项为false
780
- if (Reflect.has(currentComponentDisplayStatus.current, item.leftValue) && !currentComponentDisplayStatus.current[item.leftValue]) {
781
- return false;
782
- }
783
- return getExpression((_item$compareSymbol2 = item.compareSymbol) === null || _item$compareSymbol2 === void 0 ? void 0 : _item$compareSymbol2.toUpperCase(), leftValue, item.rightValue);
814
+ // const dependenceDetail = getComponentDetailByFieldId(item.leftValue);
815
+ // let leftValue = getFieldValue(item.leftValue);
816
+ // if (typeof dependenceDetail.formDataTransform === 'function') {
817
+ // leftValue = dependenceDetail.formDataTransform(leftValue);
818
+ // }
819
+ // // TODO: 如果依赖的组件是隐藏的,当前依赖项为false
820
+ // if (
821
+ // Reflect.has(currentComponentDisplayStatus.current, item.leftValue) &&
822
+ // !currentComponentDisplayStatus.current[item.leftValue]
823
+ // ) {
824
+ // return false;
825
+ // }
826
+ // return getExpression(
827
+ // item.compareSymbol?.toUpperCase(),
828
+ // leftValue,
829
+ // item.rightValue,
830
+ // );
831
+ return conditionItemResult(item, getFieldValue);
784
832
  });
785
833
  }, false);
786
834
  // TODO: 当组件的显影状态发生变化
@@ -133,8 +133,6 @@ var FlowTemplateDetail = function FlowTemplateDetail(props) {
133
133
  shopSourceStr = shop.shopSourceStr;
134
134
  }
135
135
 
136
- // console.log('shopList', shopList);
137
-
138
136
  // 提交请求锁
139
137
  var submitRequestLock = useRef(false);
140
138
  // 保存请求锁
@@ -32,6 +32,7 @@ import { factory, ShopList } from '@kmkf-fe-packages/services-components';
32
32
  import { AddressData, ExpressData, ExpressInterceptData, PlatData, LogisticsAddressData, getExpression, formatDisplayConfig, isNull } from '@kmkf-fe-packages/kmkf-utils';
33
33
  import { PlatForm } from "../WorkOrder/types";
34
34
  import "./index.less";
35
+ import { CHILD_FIELD_TYPE, CHILD_FIELD_VALUE } from "../common/constant";
35
36
  var ShopName = function ShopName(_ref) {
36
37
  var shopList = _ref.shopList,
37
38
  workOrderId = _ref.workOrderId,
@@ -648,6 +649,28 @@ var FormRender = function FormRender(props, ref) {
648
649
  type: info.workOrderComponentType
649
650
  });
650
651
  };
652
+ var conditionItemResult = function conditionItemResult(item, getFieldValue) {
653
+ var _item$leftValue$split, _item$leftValue$split2, _item$compareSymbol;
654
+ //现支持子组件控制显隐,格式为${uniqueKey}_${type}与普通组件做区分
655
+ var isChildField = item.leftValue.includes('_');
656
+ var prefixId = isChildField ? (_item$leftValue$split = item.leftValue.split('_')) === null || _item$leftValue$split === void 0 ? void 0 : _item$leftValue$split[0] : item.leftValue;
657
+ var childFieldType = isChildField ? (_item$leftValue$split2 = item.leftValue.split('_')) === null || _item$leftValue$split2 === void 0 ? void 0 : _item$leftValue$split2[1] : '';
658
+ var dependenceDetail = getComponentDetailByFieldId(prefixId);
659
+ if (isChildField && CHILD_FIELD_TYPE[childFieldType]) {
660
+ var _dependenceDetail;
661
+ var childType = CHILD_FIELD_TYPE[childFieldType];
662
+ dependenceDetail = ((_dependenceDetail = dependenceDetail) === null || _dependenceDetail === void 0 ? void 0 : _dependenceDetail[childType]) || dependenceDetail;
663
+ }
664
+ var leftValue = getFieldValue(prefixId);
665
+ if (isChildField) {
666
+ var _leftValue;
667
+ leftValue = CHILD_FIELD_VALUE !== null && CHILD_FIELD_VALUE !== void 0 && CHILD_FIELD_VALUE[childFieldType] ? (_leftValue = leftValue) === null || _leftValue === void 0 ? void 0 : _leftValue[CHILD_FIELD_VALUE[childFieldType]] : '';
668
+ }
669
+ if (typeof dependenceDetail.formDataTransform === 'function') {
670
+ leftValue = dependenceDetail.formDataTransform(leftValue);
671
+ }
672
+ return getExpression((_item$compareSymbol = item.compareSymbol) === null || _item$compareSymbol === void 0 ? void 0 : _item$compareSymbol.toUpperCase(), leftValue, item.rightValue);
673
+ };
651
674
  var newRenderColumnItem = function newRenderColumnItem(effects) {
652
675
  return function (item) {
653
676
  if (look) {
@@ -701,24 +724,32 @@ var FormRender = function FormRender(props, ref) {
701
724
  // 满足所有
702
725
  if (linkCondition === 'every') {
703
726
  return every(conditionList, function (item) {
704
- var _item$compareSymbol;
705
- var dependenceDetail = getComponentDetailByFieldId(item.leftValue);
706
- var leftValue = getFieldValue(item.leftValue);
707
- if (typeof dependenceDetail.formDataTransform === 'function') {
708
- leftValue = dependenceDetail.formDataTransform(leftValue);
709
- }
710
- return getExpression((_item$compareSymbol = item.compareSymbol) === null || _item$compareSymbol === void 0 ? void 0 : _item$compareSymbol.toUpperCase(), leftValue, item.rightValue);
727
+ return conditionItemResult(item, getFieldValue);
728
+ // const dependenceDetail = getComponentDetailByFieldId(item.leftValue);
729
+ // let leftValue = getFieldValue(item.leftValue);
730
+ // if (typeof dependenceDetail.formDataTransform === 'function') {
731
+ // leftValue = dependenceDetail.formDataTransform(leftValue);
732
+ // }
733
+ // return getExpression(
734
+ // item.compareSymbol?.toUpperCase(),
735
+ // leftValue,
736
+ // item.rightValue,
737
+ // );
711
738
  });
712
739
  }
713
740
  // 满足其中之一
714
741
  return some(conditionList, function (item) {
715
- var _item$compareSymbol2;
716
- var dependenceDetail = getComponentDetailByFieldId(item.leftValue);
717
- var leftValue = getFieldValue(item.leftValue);
718
- if (typeof dependenceDetail.formDataTransform === 'function') {
719
- leftValue = dependenceDetail.formDataTransform(leftValue);
720
- }
721
- return getExpression((_item$compareSymbol2 = item.compareSymbol) === null || _item$compareSymbol2 === void 0 ? void 0 : _item$compareSymbol2.toUpperCase(), leftValue, item.rightValue);
742
+ return conditionItemResult(item, getFieldValue);
743
+ // const dependenceDetail = getComponentDetailByFieldId(item.leftValue);
744
+ // let leftValue = getFieldValue(item.leftValue);
745
+ // if (typeof dependenceDetail.formDataTransform === 'function') {
746
+ // leftValue = dependenceDetail.formDataTransform(leftValue);
747
+ // }
748
+ // return getExpression(
749
+ // item.compareSymbol?.toUpperCase(),
750
+ // leftValue,
751
+ // item.rightValue,
752
+ // );
722
753
  });
723
754
  }, false);
724
755
  return instance.editRender({
@@ -31,6 +31,7 @@ import { queryTemplateDetail, addWorkOrder, queryWorkOrderDetail, updateWorkOrde
31
31
  import { factory, ShopList } from '@kmkf-fe-packages/services-components';
32
32
  import { AddressData, ExpressData, ExpressInterceptData, PlatData, LogisticsAddressData, formatDisplayConfig, getExpression, isNull } from '@kmkf-fe-packages/kmkf-utils';
33
33
  import "./index.less";
34
+ import { CHILD_FIELD_TYPE, CHILD_FIELD_VALUE } from "../common/constant";
34
35
  var ShopName = function ShopName(_ref) {
35
36
  var shopList = _ref.shopList,
36
37
  workOrderId = _ref.workOrderId,
@@ -632,6 +633,28 @@ var FormRender = function FormRender(props, ref) {
632
633
  type: info.workOrderComponentType
633
634
  });
634
635
  };
636
+ var conditionItemResult = function conditionItemResult(item, getFieldValue) {
637
+ var _item$leftValue$split, _item$leftValue$split2, _item$compareSymbol;
638
+ //现支持子组件控制显隐,格式为${uniqueKey}_${type}与普通组件做区分
639
+ var isChildField = item.leftValue.includes('_');
640
+ var prefixId = isChildField ? (_item$leftValue$split = item.leftValue.split('_')) === null || _item$leftValue$split === void 0 ? void 0 : _item$leftValue$split[0] : item.leftValue;
641
+ var childFieldType = isChildField ? (_item$leftValue$split2 = item.leftValue.split('_')) === null || _item$leftValue$split2 === void 0 ? void 0 : _item$leftValue$split2[1] : '';
642
+ var dependenceDetail = getComponentDetailByFieldId(prefixId);
643
+ if (isChildField && CHILD_FIELD_TYPE[childFieldType]) {
644
+ var _dependenceDetail;
645
+ var childType = CHILD_FIELD_TYPE[childFieldType];
646
+ dependenceDetail = ((_dependenceDetail = dependenceDetail) === null || _dependenceDetail === void 0 ? void 0 : _dependenceDetail[childType]) || dependenceDetail;
647
+ }
648
+ var leftValue = getFieldValue(prefixId);
649
+ if (isChildField) {
650
+ var _leftValue;
651
+ leftValue = CHILD_FIELD_VALUE !== null && CHILD_FIELD_VALUE !== void 0 && CHILD_FIELD_VALUE[childFieldType] ? (_leftValue = leftValue) === null || _leftValue === void 0 ? void 0 : _leftValue[CHILD_FIELD_VALUE[childFieldType]] : '';
652
+ }
653
+ if (typeof dependenceDetail.formDataTransform === 'function') {
654
+ leftValue = dependenceDetail.formDataTransform(leftValue);
655
+ }
656
+ return getExpression((_item$compareSymbol = item.compareSymbol) === null || _item$compareSymbol === void 0 ? void 0 : _item$compareSymbol.toUpperCase(), leftValue, item.rightValue);
657
+ };
635
658
  var newRenderColumnItem = function newRenderColumnItem(effects) {
636
659
  return function (item) {
637
660
  if (look) {
@@ -685,24 +708,32 @@ var FormRender = function FormRender(props, ref) {
685
708
  // 满足所有
686
709
  if (linkCondition === 'every') {
687
710
  return every(conditionList, function (item) {
688
- var _item$compareSymbol;
689
- var dependenceDetail = getComponentDetailByFieldId(item.leftValue);
690
- var leftValue = getFieldValue(item.leftValue);
691
- if (typeof dependenceDetail.formDataTransform === 'function') {
692
- leftValue = dependenceDetail.formDataTransform(leftValue);
693
- }
694
- return getExpression((_item$compareSymbol = item.compareSymbol) === null || _item$compareSymbol === void 0 ? void 0 : _item$compareSymbol.toUpperCase(), leftValue, item.rightValue);
711
+ return conditionItemResult(item, getFieldValue);
712
+ // const dependenceDetail = getComponentDetailByFieldId(item.leftValue);
713
+ // let leftValue = getFieldValue(item.leftValue);
714
+ // if (typeof dependenceDetail.formDataTransform === 'function') {
715
+ // leftValue = dependenceDetail.formDataTransform(leftValue);
716
+ // }
717
+ // return getExpression(
718
+ // item.compareSymbol?.toUpperCase(),
719
+ // leftValue,
720
+ // item.rightValue,
721
+ // );
695
722
  });
696
723
  }
697
724
  // 满足其中之一
698
725
  return some(conditionList, function (item) {
699
- var _item$compareSymbol2;
700
- var dependenceDetail = getComponentDetailByFieldId(item.leftValue);
701
- var leftValue = getFieldValue(item.leftValue);
702
- if (typeof dependenceDetail.formDataTransform === 'function') {
703
- leftValue = dependenceDetail.formDataTransform(leftValue);
704
- }
705
- return getExpression((_item$compareSymbol2 = item.compareSymbol) === null || _item$compareSymbol2 === void 0 ? void 0 : _item$compareSymbol2.toUpperCase(), leftValue, item.rightValue);
726
+ return conditionItemResult(item, getFieldValue);
727
+ // const dependenceDetail = getComponentDetailByFieldId(item.leftValue);
728
+ // let leftValue = getFieldValue(item.leftValue);
729
+ // if (typeof dependenceDetail.formDataTransform === 'function') {
730
+ // leftValue = dependenceDetail.formDataTransform(leftValue);
731
+ // }
732
+ // return getExpression(
733
+ // item.compareSymbol?.toUpperCase(),
734
+ // leftValue,
735
+ // item.rightValue,
736
+ // );
706
737
  });
707
738
  }, false);
708
739
  return instance.editRender({
@@ -47,3 +47,17 @@ export declare const NODE_TYPE: {
47
47
  className: string;
48
48
  };
49
49
  };
50
+ export declare const CHILD_FIELD_TYPE: {
51
+ enterprisePaymentRefundFee: string;
52
+ expressLogisticsCompany: string;
53
+ expressLogisticsCode: string;
54
+ returnLogisticsCompany: string;
55
+ returnLogisticsCode: string;
56
+ };
57
+ export declare const CHILD_FIELD_VALUE: {
58
+ enterprisePaymentRefundFee: string;
59
+ expressLogisticsCompany: string;
60
+ expressLogisticsCode: string;
61
+ returnLogisticsCompany: string;
62
+ returnLogisticsCode: string;
63
+ };
@@ -69,4 +69,19 @@ export var NODE_TYPE = {
69
69
  label: '自动',
70
70
  className: 'auto'
71
71
  }
72
+ };
73
+ // 显隐子组件映射
74
+ export var CHILD_FIELD_TYPE = {
75
+ enterprisePaymentRefundFee: 'paymentAmount',
76
+ expressLogisticsCompany: 'express',
77
+ expressLogisticsCode: 'expressCode',
78
+ returnLogisticsCompany: 'express',
79
+ returnLogisticsCode: 'expressCode'
80
+ };
81
+ export var CHILD_FIELD_VALUE = {
82
+ enterprisePaymentRefundFee: 'enterprisePaymentRefundFee',
83
+ expressLogisticsCompany: 'company',
84
+ expressLogisticsCode: 'order',
85
+ returnLogisticsCompany: 'company',
86
+ returnLogisticsCode: 'order'
72
87
  };
@@ -424,6 +424,12 @@ export var submitDataTransOldFormat = function submitDataTransOldFormat(nowData,
424
424
  name: item.name
425
425
  });
426
426
  });
427
+ // const fee = get(nowData, `${item.uniqueKey}.enterprisePaymentRefundFee`, '');
428
+ // contentVoList.push({
429
+ // uniqueKey: `${item.uniqueKey}_enterprisePaymentRefundFee`,
430
+ // content: fee ? (fee * 1).toFixed(2) : '',
431
+ // name: item.name,
432
+ // });
427
433
  params.buyerNick = get(nowData, "".concat(item.uniqueKey, ".enterprisePaymentBuyerNick"), '');
428
434
  params.buyerOpenUid = get(nowData, "".concat(item.uniqueKey, ".enterprisePaymentBuyerOpenUid"), '');
429
435
  } else if (item.workOrderComponentType === 'ITEM_ID') {
@@ -971,7 +977,6 @@ export var submitDataTransOldFormat = function submitDataTransOldFormat(nowData,
971
977
  contentList: contentVoList
972
978
  };
973
979
  });
974
- params.needTransForm = needTransForm;
975
980
  return result;
976
981
  };
977
982
  export var filterComponent = function filterComponent() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-work-order-service-component",
3
- "version": "0.22.0",
3
+ "version": "0.23.0-alpha.0",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -32,9 +32,9 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@ant-design/icons": "^4.7.0",
35
- "@kmkf-fe-packages/basic-components": "^0.22.0",
36
- "@kmkf-fe-packages/kmkf-utils": "^0.22.0",
37
- "@kmkf-fe-packages/services-components": "^0.22.0",
35
+ "@kmkf-fe-packages/basic-components": "^0.23.0-alpha.0",
36
+ "@kmkf-fe-packages/kmkf-utils": "^0.23.0-alpha.0",
37
+ "@kmkf-fe-packages/services-components": "^0.23.0-alpha.0",
38
38
  "@reduxjs/toolkit": "^1.8.5",
39
39
  "ahooks": "^3.7.4",
40
40
  "copy-to-clipboard": "^3.3.3",
@@ -74,7 +74,7 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "fc1fac5539ff277fa690815ce8f8df5827b643f8",
77
+ "gitHead": "c3067c39d74b6ffc99ff417e58f87486cf7a5d50",
78
78
  "gitHooks": {
79
79
  "pre-commit": "lint-staged"
80
80
  }