@kmkf-fe-packages/kmkf-work-order-service-component 0.12.0-alpha.8 → 0.12.0-alpha.9
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.
|
@@ -16,7 +16,7 @@ export declare const getCurrentNodeModifiedShowHideRule: (list: {
|
|
|
16
16
|
}>;
|
|
17
17
|
displayComponentList: Array<string>;
|
|
18
18
|
}[];
|
|
19
|
-
export declare const getCalculationComponentValue: ({ calculationTypeComponentList, allValues }: {
|
|
19
|
+
export declare const getCalculationComponentValue: ({ calculationTypeComponentList, allValues, componentShowMap }: {
|
|
20
20
|
calculationTypeComponentList: Array<{
|
|
21
21
|
uniqueKey: string;
|
|
22
22
|
name: string;
|
|
@@ -24,4 +24,5 @@ export declare const getCalculationComponentValue: ({ calculationTypeComponentLi
|
|
|
24
24
|
workOrderComponentType: string;
|
|
25
25
|
}>;
|
|
26
26
|
allValues: any;
|
|
27
|
+
componentShowMap: any;
|
|
27
28
|
}) => any;
|
|
@@ -156,7 +156,8 @@ var parseExpression = function parseExpression(expression) {
|
|
|
156
156
|
// TODO: 获取计算组件的值
|
|
157
157
|
export var getCalculationComponentValue = function getCalculationComponentValue(_ref3) {
|
|
158
158
|
var calculationTypeComponentList = _ref3.calculationTypeComponentList,
|
|
159
|
-
allValues = _ref3.allValues
|
|
159
|
+
allValues = _ref3.allValues,
|
|
160
|
+
componentShowMap = _ref3.componentShowMap;
|
|
160
161
|
return calculationTypeComponentList === null || calculationTypeComponentList === void 0 ? void 0 : calculationTypeComponentList.reduce(function (cur, nxt) {
|
|
161
162
|
var componentInstance = factory(nxt.workOrderComponentType, {
|
|
162
163
|
id: nxt.uniqueKey,
|
|
@@ -176,6 +177,8 @@ export var getCalculationComponentValue = function getCalculationComponentValue(
|
|
|
176
177
|
effects: {},
|
|
177
178
|
type: nxt.componentType
|
|
178
179
|
});
|
|
180
|
+
// 如果当前计算组件是隐藏的时候,直接返回0
|
|
181
|
+
if (!componentShowMap[innerComponentInstance === null || innerComponentInstance === void 0 ? void 0 : innerComponentInstance.id]) return '0';
|
|
179
182
|
return "".concat(cur).concat(Number(get(allValues, innerComponentInstance === null || innerComponentInstance === void 0 ? void 0 : innerComponentInstance.id, 0)));
|
|
180
183
|
}
|
|
181
184
|
return "".concat(cur).concat(nxt === null || nxt === void 0 ? void 0 : nxt.label);
|
|
@@ -734,8 +734,10 @@ var FormRender = function FormRender(props) {
|
|
|
734
734
|
// TODO: 当组件从显示变成隐藏的时候,我们将当前表单中这个字段值清空;否则对计算组件会存在影响
|
|
735
735
|
// TODO: 为什么不直接使用form.setFieldsValue这个API呢?handleWatchFormValueChange这个方法只会在UI层面的onChange才会促发,这里需要手动在调用一次
|
|
736
736
|
if (currentComponentDisplayStatus.current[instance === null || instance === void 0 ? void 0 : instance.id] && !show) {
|
|
737
|
+
// 发现组件从显示变成隐藏后,立即将其变成隐藏状态,执行计算组件逻辑的时候会使用到这个标示
|
|
738
|
+
currentComponentDisplayStatus.current[instance === null || instance === void 0 ? void 0 : instance.id] = show;
|
|
737
739
|
var formData = form.getFieldsValue();
|
|
738
|
-
handleWatchFormValueChange(
|
|
740
|
+
handleWatchFormValueChange(undefined, formData);
|
|
739
741
|
}
|
|
740
742
|
currentComponentDisplayStatus.current[instance === null || instance === void 0 ? void 0 : instance.id] = show;
|
|
741
743
|
checkFillMapping(show, uniqueKey, workOrderComponentType);
|
|
@@ -803,9 +805,11 @@ var FormRender = function FormRender(props) {
|
|
|
803
805
|
}, [templateDetail]);
|
|
804
806
|
var handleWatchFormValueChange = function handleWatchFormValueChange(changedValues) {
|
|
805
807
|
var allValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
808
|
+
var componentShowMap = currentComponentDisplayStatus.current;
|
|
806
809
|
var formValue = getCalculationComponentValue({
|
|
807
810
|
calculationTypeComponentList: calculationTypeComponentList,
|
|
808
|
-
allValues: allValues
|
|
811
|
+
allValues: allValues,
|
|
812
|
+
componentShowMap: componentShowMap
|
|
809
813
|
});
|
|
810
814
|
form.setFieldsValue(_objectSpread(_objectSpread({}, allValues), formValue));
|
|
811
815
|
//缓存防止bs商品组件联动返填获取不到值
|
|
@@ -905,8 +909,7 @@ var FormRender = function FormRender(props) {
|
|
|
905
909
|
}, formProps), preNodeFormItems), /*#__PURE__*/React.createElement(Form, _extends({
|
|
906
910
|
form: form
|
|
907
911
|
}, formProps, {
|
|
908
|
-
onValuesChange: handleWatchFormValueChange
|
|
909
|
-
preserve: false
|
|
912
|
+
onValuesChange: handleWatchFormValueChange
|
|
910
913
|
}), /*#__PURE__*/React.createElement(ShopName, {
|
|
911
914
|
shopList: shopList,
|
|
912
915
|
handleChangeShopId: handleChangeShopId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/kmkf-work-order-service-component",
|
|
3
|
-
"version": "0.12.0-alpha.
|
|
3
|
+
"version": "0.12.0-alpha.9",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "efe559cc7532982656328c5871f1a0702cbbb48f",
|
|
76
76
|
"gitHooks": {
|
|
77
77
|
"pre-commit": "lint-staged"
|
|
78
78
|
}
|