@kmkf-fe-packages/kmkf-work-order-service-component 0.19.2 → 0.19.3-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.
- package/dist/esm/FlowTemplateDetail/components/CurrentNode/index.d.ts +2 -2
- package/dist/esm/FlowTemplateDetail/components/CurrentNode/index.js +13 -3
- package/dist/esm/FlowTemplateDetail/components/FormRender/index.d.ts +2 -2
- package/dist/esm/FlowTemplateDetail/components/FormRender/index.js +18 -11
- package/dist/esm/FlowTemplateDetail/index.js +5 -1
- package/package.json +2 -2
|
@@ -12,5 +12,5 @@ declare type CurrentNodeProps = {
|
|
|
12
12
|
flowWorkOrderId?: string;
|
|
13
13
|
queryRemarkList: () => void;
|
|
14
14
|
};
|
|
15
|
-
declare const
|
|
16
|
-
export default
|
|
15
|
+
declare const _default: React.ForwardRefExoticComponent<CurrentNodeProps & React.RefAttributes<unknown>>;
|
|
16
|
+
export default _default;
|
|
@@ -17,7 +17,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
17
17
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
18
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
20
|
+
import React, { useEffect, useMemo, useState, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
21
21
|
import { useSelector, useDispatch } from 'react-redux';
|
|
22
22
|
import { message } from 'antd';
|
|
23
23
|
import { calcWorkOrderList } from "../../../common/utils/tools";
|
|
@@ -32,8 +32,17 @@ import { getTag, currentUserHasOperatorAuth, submitParams } from "../../common";
|
|
|
32
32
|
import styles from "./index.module.less";
|
|
33
33
|
import { PlatForm } from "../../../WorkOrder/types";
|
|
34
34
|
import { useSignal } from "../../../hooks/useSignal";
|
|
35
|
-
var CurrentNode = function CurrentNode(props) {
|
|
35
|
+
var CurrentNode = function CurrentNode(props, ref) {
|
|
36
36
|
var _currentNodeDetail$no, _currentNodeDetail$no2, _currentNodeDetail$no3, _currentNodeDetail$no4, _currentNodeDetail$wo10, _currentNodeDetail$wo11, _currentNodeDetail$wo12, _currentNodeDetail$wo13, _currentNodeDetail$wo14, _currentNodeDetail$wo15, _currentNodeDetail$wo16, _currentNodeDetail$wo17, _currentNodeDetail$wo18, _currentNodeDetail$no17, _currentNodeDetail$no18, _currentNodeDetail$wo19;
|
|
37
|
+
var formRenderRef = useRef(null);
|
|
38
|
+
useImperativeHandle(ref, function () {
|
|
39
|
+
return {
|
|
40
|
+
batchFillByMapping: function batchFillByMapping(values) {
|
|
41
|
+
var _formRenderRef$curren, _formRenderRef$curren2;
|
|
42
|
+
(_formRenderRef$curren = formRenderRef.current) === null || _formRenderRef$curren === void 0 ? void 0 : (_formRenderRef$curren2 = _formRenderRef$curren.batchFillByMapping) === null || _formRenderRef$curren2 === void 0 ? void 0 : _formRenderRef$curren2.call(_formRenderRef$curren, values);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
37
46
|
var shopList = props.shopList,
|
|
38
47
|
form = props.form,
|
|
39
48
|
onOpenWangWang = props.onOpenWangWang,
|
|
@@ -227,6 +236,7 @@ var CurrentNode = function CurrentNode(props) {
|
|
|
227
236
|
platform: plat.platform,
|
|
228
237
|
onOpenWangWang: onOpenWangWang
|
|
229
238
|
}) : /*#__PURE__*/React.createElement(FormRender, {
|
|
239
|
+
ref: formRenderRef,
|
|
230
240
|
isShowShopList: NodeType.START_NODE === (currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$no18 = currentNodeDetail.nodeInfo) === null || _currentNodeDetail$no18 === void 0 ? void 0 : _currentNodeDetail$no18.nodeType) && PlatForm.PC === plat.platform,
|
|
231
241
|
plat: plat,
|
|
232
242
|
templateDetail: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : currentNodeDetail.workOrderTemplateInfo,
|
|
@@ -248,4 +258,4 @@ var CurrentNode = function CurrentNode(props) {
|
|
|
248
258
|
flowAllShowHideRules: allShowHideRules
|
|
249
259
|
}))));
|
|
250
260
|
};
|
|
251
|
-
export default CurrentNode;
|
|
261
|
+
export default /*#__PURE__*/forwardRef(CurrentNode);
|
|
@@ -29,5 +29,5 @@ declare type FormRenderProps = {
|
|
|
29
29
|
canModifyPayment?: boolean;
|
|
30
30
|
flowAllShowHideRules?: CurrentFlowShowHideRules;
|
|
31
31
|
};
|
|
32
|
-
declare const
|
|
33
|
-
export default
|
|
32
|
+
declare const _default: React.ForwardRefExoticComponent<FormRenderProps & React.RefAttributes<unknown>>;
|
|
33
|
+
export default _default;
|
|
@@ -21,7 +21,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
21
21
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
22
22
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
23
23
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
-
import React, { useState, useRef, useEffect, useMemo } from 'react';
|
|
24
|
+
import React, { useState, useRef, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
25
25
|
import { ConfigProvider, Form } from 'antd';
|
|
26
26
|
import zhCN from 'antd/es/locale/zh_CN';
|
|
27
27
|
import { get, some, set, every, cloneDeep, isEmpty, intersection, throttle } from 'lodash';
|
|
@@ -45,7 +45,12 @@ var hasComponent = function hasComponent(componentDtoList, workOrderComponentTyp
|
|
|
45
45
|
// 记录显隐触发隐藏的组件。显示后,重新出发一遍映射规则
|
|
46
46
|
// TODO: 用useState会有bug, 不确定是哪里导致的
|
|
47
47
|
var hideByXYComponentsMap = {};
|
|
48
|
-
var FormRender = function FormRender(props) {
|
|
48
|
+
var FormRender = function FormRender(props, ref) {
|
|
49
|
+
useImperativeHandle(ref, function () {
|
|
50
|
+
return {
|
|
51
|
+
batchFillByMapping: batchFillByMapping
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
49
54
|
var shopList = props.shopList,
|
|
50
55
|
look = props.look,
|
|
51
56
|
currentShopId = props.shopId,
|
|
@@ -281,9 +286,7 @@ var FormRender = function FormRender(props) {
|
|
|
281
286
|
processTime: newRecord.processTime
|
|
282
287
|
}));
|
|
283
288
|
var initialValues = get(transData, '0', {});
|
|
284
|
-
|
|
285
|
-
fillByMapping(_key, initialValues[_key]);
|
|
286
|
-
}
|
|
289
|
+
batchFillByMapping(initialValues);
|
|
287
290
|
orderBackReplace(transData, templateDetail);
|
|
288
291
|
// TODO: 非开始节点录入,都会有workOrderId,这里判断是否有前置组件含有订单号;如果存在订单号,进行订单反填。
|
|
289
292
|
var tradeIdUniqueKey = hasComponent(templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.preNodeComponentDtoList, 'TRADE_ID_INPUT');
|
|
@@ -346,9 +349,7 @@ var FormRender = function FormRender(props) {
|
|
|
346
349
|
shopId: shopId
|
|
347
350
|
}));
|
|
348
351
|
// 默认值触发映射
|
|
349
|
-
|
|
350
|
-
fillByMapping(_key2, _initialValues[_key2]);
|
|
351
|
-
}
|
|
352
|
+
batchFillByMapping(_initialValues);
|
|
352
353
|
//如果有订单号 订单返填 通过订单号入口进行工单录入,需要将订单数据反填到工单
|
|
353
354
|
|
|
354
355
|
if (orderNo && shopId) {
|
|
@@ -412,6 +413,12 @@ var FormRender = function FormRender(props) {
|
|
|
412
413
|
}, 0);
|
|
413
414
|
};
|
|
414
415
|
|
|
416
|
+
// 批量映射
|
|
417
|
+
var batchFillByMapping = function batchFillByMapping(values) {
|
|
418
|
+
for (var _key in values) {
|
|
419
|
+
fillByMapping(_key, values[_key]);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
415
422
|
// 组件映射
|
|
416
423
|
var fillByMapping = function fillByMapping(triggerUniqueKey, value) {
|
|
417
424
|
var _mappingConfig$config;
|
|
@@ -422,8 +429,8 @@ var FormRender = function FormRender(props) {
|
|
|
422
429
|
form.setFieldsValue(mapping === null || mapping === void 0 ? void 0 : mapping[triggerValue]);
|
|
423
430
|
} else {
|
|
424
431
|
var resetSet = new Set();
|
|
425
|
-
for (var
|
|
426
|
-
for (var uniqueKey in mapping[
|
|
432
|
+
for (var _key2 in mapping) {
|
|
433
|
+
for (var uniqueKey in mapping[_key2]) {
|
|
427
434
|
resetSet.add(uniqueKey);
|
|
428
435
|
}
|
|
429
436
|
}
|
|
@@ -911,4 +918,4 @@ var FormRender = function FormRender(props) {
|
|
|
911
918
|
disabled: !!workOrderId || look
|
|
912
919
|
}), finalFormItems));
|
|
913
920
|
};
|
|
914
|
-
export default FormRender;
|
|
921
|
+
export default /*#__PURE__*/forwardRef(FormRender);
|
|
@@ -78,6 +78,7 @@ var FlowTemplateDetail = function FlowTemplateDetail(props) {
|
|
|
78
78
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
79
79
|
form = _Form$useForm2[0];
|
|
80
80
|
var controllerRef = useSignal();
|
|
81
|
+
var currentNodeRef = useRef(null);
|
|
81
82
|
var _useState3 = useState(sTid),
|
|
82
83
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
83
84
|
tid = _useState4[0],
|
|
@@ -844,10 +845,12 @@ var FlowTemplateDetail = function FlowTemplateDetail(props) {
|
|
|
844
845
|
|
|
845
846
|
// 填充表单
|
|
846
847
|
var handleFillWorkOrder = function handleFillWorkOrder() {
|
|
847
|
-
var _currentNodeDetail$wo23;
|
|
848
|
+
var _currentNodeDetail$wo23, _currentNodeRef$curre, _currentNodeRef$curre2;
|
|
848
849
|
var transData = calcWorkOrderList([currentTradeIdLinkWorkOrderId === null || currentTradeIdLinkWorkOrderId === void 0 ? void 0 : currentTradeIdLinkWorkOrderId.lastWorkOrderDetail], (currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo23 = currentNodeDetail.workOrderTemplateInfo) === null || _currentNodeDetail$wo23 === void 0 ? void 0 : _currentNodeDetail$wo23.componentDtoList) || []);
|
|
849
850
|
var formData = form.getFieldsValue();
|
|
850
851
|
form.setFieldsValue(_objectSpread(_objectSpread({}, formData), get(transData, '0', {})));
|
|
852
|
+
// 填充表单后触发映射
|
|
853
|
+
(_currentNodeRef$curre = currentNodeRef.current) === null || _currentNodeRef$curre === void 0 ? void 0 : (_currentNodeRef$curre2 = _currentNodeRef$curre.batchFillByMapping) === null || _currentNodeRef$curre2 === void 0 ? void 0 : _currentNodeRef$curre2.call(_currentNodeRef$curre, form.getFieldsValue());
|
|
851
854
|
};
|
|
852
855
|
// 查询备注记录
|
|
853
856
|
var queryRemarkList = function queryRemarkList() {
|
|
@@ -932,6 +935,7 @@ var FlowTemplateDetail = function FlowTemplateDetail(props) {
|
|
|
932
935
|
readonly: readonly
|
|
933
936
|
}));
|
|
934
937
|
}), currentNodeDetail && /*#__PURE__*/React.createElement(Timeline.Item, null, /*#__PURE__*/React.createElement(CurrentNode, {
|
|
938
|
+
ref: currentNodeRef,
|
|
935
939
|
flowTemplateId: flowTemplateId,
|
|
936
940
|
flowWorkOrderId: flowWorkOrderIdState,
|
|
937
941
|
shopList: shopList,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/kmkf-work-order-service-component",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3-alpha.0",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "daede9b93a6c3bce5d7cec79c8ef5fe5734c64d2",
|
|
78
78
|
"gitHooks": {
|
|
79
79
|
"pre-commit": "lint-staged"
|
|
80
80
|
}
|