@kmkf-fe-packages/kmkf-work-order-service-component 0.20.1 → 0.20.2-alpha.1
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/ActionList/index.d.ts +2 -1
- package/dist/esm/FlowTemplateDetail/components/ActionList/index.js +47 -38
- package/dist/esm/FlowTemplateDetail/components/FormRender/index.js +80 -32
- package/dist/esm/FlowTemplateDetail/components/SubmitRemindModal/index.d.ts +7 -0
- package/dist/esm/FlowTemplateDetail/components/SubmitRemindModal/index.js +33 -0
- package/dist/esm/FlowTemplateDetail/index.js +163 -119
- package/dist/esm/FormRender/index.js +45 -14
- package/dist/esm/FormRenderTemplateId/index.js +45 -14
- package/dist/esm/common/cache/index.d.ts +2 -0
- package/dist/esm/common/cache/index.js +11 -1
- package/dist/esm/common/constant.d.ts +14 -0
- package/dist/esm/common/constant.js +15 -0
- package/dist/esm/common/utils/tools.js +6 -1
- package/dist/esm/model/flowTemplateDetail/index.d.ts +1 -1
- package/dist/esm/model/flowTemplateDetail/index.js +23 -16
- package/dist/esm/model/flowTemplateDetail/selector.d.ts +14 -0
- package/dist/esm/model/flowTemplateDetail/selector.js +3 -0
- package/dist/esm/model/flowTemplateDetail/types.d.ts +9 -0
- package/dist/esm/model/flowTemplateDetail/types.js +8 -1
- package/dist/esm/model/logicFlow/selector.d.ts +3 -0
- package/package.json +5 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { NodeType, FlowStatus } from '../../../model/flowTemplateDetail/types';
|
|
2
|
+
import { NodeType, FlowStatus, FlowType } from '../../../model/flowTemplateDetail/types';
|
|
3
3
|
interface ActionListProps {
|
|
4
4
|
flowStatus: FlowStatus | undefined;
|
|
5
|
+
flowType: FlowType;
|
|
5
6
|
nodeType: NodeType;
|
|
6
7
|
handleAction: (s: string) => void;
|
|
7
8
|
hasPreNode: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Menu, Button, Space, Dropdown } from 'antd';
|
|
3
3
|
import { DownOutlined } from '@ant-design/icons';
|
|
4
|
-
import { FlowStatus } from "../../../model/flowTemplateDetail/types";
|
|
4
|
+
import { FlowStatus, FlowType } from "../../../model/flowTemplateDetail/types";
|
|
5
5
|
import styles from "./index.module.less";
|
|
6
6
|
var getActionMap = function getActionMap(nodeStatus, hasPreNode) {
|
|
7
7
|
// 非开始节点看状态
|
|
@@ -16,41 +16,49 @@ var getActionMap = function getActionMap(nodeStatus, hasPreNode) {
|
|
|
16
16
|
return ['save', 'submit'];
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
var buttonMap = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
19
|
+
var buttonMap = function buttonMap(flowType) {
|
|
20
|
+
return {
|
|
21
|
+
save: {
|
|
22
|
+
label: '暂存',
|
|
23
|
+
type: 'default',
|
|
24
|
+
style: {
|
|
25
|
+
backgroundColor: flowType === FlowType.SINGLE_PAGE ? '#52c41a' : '',
|
|
26
|
+
color: flowType === FlowType.SINGLE_PAGE ? '#fff' : '#000'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
submit: {
|
|
30
|
+
label: flowType === FlowType.SINGLE_PAGE ? '完结' : '提交',
|
|
31
|
+
type: 'primary'
|
|
32
|
+
},
|
|
33
|
+
forward: {
|
|
34
|
+
label: '转交',
|
|
35
|
+
type: 'default'
|
|
36
|
+
},
|
|
37
|
+
rejected: {
|
|
38
|
+
label: '驳回',
|
|
39
|
+
type: 'default'
|
|
40
|
+
},
|
|
41
|
+
close: {
|
|
42
|
+
label: '关闭',
|
|
43
|
+
type: 'default'
|
|
44
|
+
},
|
|
45
|
+
stop: {
|
|
46
|
+
label: '暂停',
|
|
47
|
+
type: 'default'
|
|
48
|
+
},
|
|
49
|
+
open: {
|
|
50
|
+
label: '启用',
|
|
51
|
+
type: 'primary'
|
|
52
|
+
}
|
|
53
|
+
};
|
|
48
54
|
};
|
|
49
55
|
var ActionList = function ActionList(props) {
|
|
50
56
|
var _buttonList$slice;
|
|
51
57
|
var _props$flowStatus = props.flowStatus,
|
|
52
58
|
flowStatus = _props$flowStatus === void 0 ? FlowStatus.NON_START : _props$flowStatus,
|
|
53
59
|
hasPreNode = props.hasPreNode,
|
|
60
|
+
_props$flowType = props.flowType,
|
|
61
|
+
flowType = _props$flowType === void 0 ? FlowType.SINGLE_PAGE : _props$flowType,
|
|
54
62
|
handleAction = props.handleAction;
|
|
55
63
|
var buttonList = getActionMap(flowStatus, hasPreNode);
|
|
56
64
|
var menu = function menu(list) {
|
|
@@ -59,12 +67,12 @@ var ActionList = function ActionList(props) {
|
|
|
59
67
|
key: index,
|
|
60
68
|
label: /*#__PURE__*/React.createElement(Button, {
|
|
61
69
|
type: "link",
|
|
62
|
-
"data-spm-click": buttonMap[item].label,
|
|
63
|
-
"data-spm-param": buttonMap[item].label,
|
|
70
|
+
"data-spm-click": buttonMap(flowType)[item].label,
|
|
71
|
+
"data-spm-param": buttonMap(flowType)[item].label,
|
|
64
72
|
onClick: function onClick() {
|
|
65
73
|
return handleAction(item);
|
|
66
74
|
}
|
|
67
|
-
}, buttonMap[item].label)
|
|
75
|
+
}, buttonMap(flowType)[item].label)
|
|
68
76
|
};
|
|
69
77
|
});
|
|
70
78
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
@@ -80,16 +88,17 @@ var ActionList = function ActionList(props) {
|
|
|
80
88
|
return e.preventDefault();
|
|
81
89
|
}
|
|
82
90
|
}, /*#__PURE__*/React.createElement(Space, null, "\u66F4\u591A", /*#__PURE__*/React.createElement(DownOutlined, null)))), (_buttonList$slice = buttonList.slice(0, 3)) === null || _buttonList$slice === void 0 ? void 0 : _buttonList$slice.map(function (button, index) {
|
|
83
|
-
var _buttonMap$button, _buttonMap$button2, _buttonMap$button3;
|
|
91
|
+
var _buttonMap$button, _buttonMap$button2, _buttonMap$button3, _buttonMap$button4;
|
|
84
92
|
return /*#__PURE__*/React.createElement(Button, {
|
|
85
93
|
key: "button".concat(index),
|
|
86
|
-
type: buttonMap[button].type,
|
|
94
|
+
type: buttonMap(flowType)[button].type,
|
|
87
95
|
onClick: function onClick() {
|
|
88
96
|
return handleAction(button);
|
|
89
97
|
},
|
|
90
|
-
"data-spm-click": (_buttonMap$button = buttonMap[button]) === null || _buttonMap$button === void 0 ? void 0 : _buttonMap$button.label,
|
|
91
|
-
"data-spm-param": (_buttonMap$button2 = buttonMap[button]) === null || _buttonMap$button2 === void 0 ? void 0 : _buttonMap$button2.label
|
|
92
|
-
|
|
98
|
+
"data-spm-click": (_buttonMap$button = buttonMap(flowType)[button]) === null || _buttonMap$button === void 0 ? void 0 : _buttonMap$button.label,
|
|
99
|
+
"data-spm-param": (_buttonMap$button2 = buttonMap(flowType)[button]) === null || _buttonMap$button2 === void 0 ? void 0 : _buttonMap$button2.label,
|
|
100
|
+
style: (_buttonMap$button3 = buttonMap(flowType)[button]) === null || _buttonMap$button3 === void 0 ? void 0 : _buttonMap$button3.style
|
|
101
|
+
}, (_buttonMap$button4 = buttonMap(flowType)[button]) === null || _buttonMap$button4 === void 0 ? void 0 : _buttonMap$button4.label);
|
|
93
102
|
})));
|
|
94
103
|
};
|
|
95
104
|
export default ActionList;
|
|
@@ -35,6 +35,7 @@ import { PlatForm } from "../../../model/flowTemplateDetail/types";
|
|
|
35
35
|
import { groupByPreNode, getCurrentNodeModifiedShowHideRule } from "./common";
|
|
36
36
|
import { getCalculationComponentValue } from "../../../common/utils/arithmetic";
|
|
37
37
|
import "./index.less";
|
|
38
|
+
import { CHILD_FIELD_TYPE, CHILD_FIELD_VALUE } from "../../../common/constant";
|
|
38
39
|
var hasComponent = function hasComponent(componentDtoList, workOrderComponentType) {
|
|
39
40
|
var _componentDtoList$fin;
|
|
40
41
|
return (_componentDtoList$fin = componentDtoList.find(function (item) {
|
|
@@ -637,6 +638,37 @@ var FormRender = function FormRender(props, ref) {
|
|
|
637
638
|
type: info.workOrderComponentType
|
|
638
639
|
});
|
|
639
640
|
};
|
|
641
|
+
var conditionItemResult = function conditionItemResult(item, getFieldValue) {
|
|
642
|
+
var _item$leftValue$split, _item$leftValue$split2, _item$compareSymbol;
|
|
643
|
+
//现支持子组件控制显隐,格式为${uniqueKey}_${type}与普通组件做区分
|
|
644
|
+
var isChildField = item.leftValue.includes('_');
|
|
645
|
+
var prefixId = isChildField ? (_item$leftValue$split = item.leftValue.split('_')) === null || _item$leftValue$split === void 0 ? void 0 : _item$leftValue$split[0] : item.leftValue;
|
|
646
|
+
var childFieldType = isChildField ? (_item$leftValue$split2 = item.leftValue.split('_')) === null || _item$leftValue$split2 === void 0 ? void 0 : _item$leftValue$split2[1] : '';
|
|
647
|
+
var dependenceDetail = getComponentDetailByFieldId(prefixId);
|
|
648
|
+
console.log('dependenceDetail', dependenceDetail);
|
|
649
|
+
if (isChildField && CHILD_FIELD_TYPE[childFieldType]) {
|
|
650
|
+
var _dependenceDetail;
|
|
651
|
+
var childType = CHILD_FIELD_TYPE[childFieldType];
|
|
652
|
+
dependenceDetail = ((_dependenceDetail = dependenceDetail) === null || _dependenceDetail === void 0 ? void 0 : _dependenceDetail[childType]) || dependenceDetail;
|
|
653
|
+
}
|
|
654
|
+
var leftValue = getFieldValue(prefixId);
|
|
655
|
+
console.log('leftValue1', leftValue);
|
|
656
|
+
if (isChildField) {
|
|
657
|
+
var _leftValue;
|
|
658
|
+
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]] : '';
|
|
659
|
+
console.log('leftValue2', leftValue);
|
|
660
|
+
}
|
|
661
|
+
if (typeof dependenceDetail.formDataTransform === 'function') {
|
|
662
|
+
leftValue = dependenceDetail.formDataTransform(leftValue);
|
|
663
|
+
console.log('leftValue3', leftValue);
|
|
664
|
+
}
|
|
665
|
+
// TODO: 如果依赖的组件是隐藏的,当前依赖项为false
|
|
666
|
+
if (Reflect.has(currentComponentDisplayStatus.current, prefixId) && !currentComponentDisplayStatus.current[prefixId]) {
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
console.log('getExpression', leftValue, item.rightValue);
|
|
670
|
+
return getExpression((_item$compareSymbol = item.compareSymbol) === null || _item$compareSymbol === void 0 ? void 0 : _item$compareSymbol.toUpperCase(), leftValue, item.rightValue);
|
|
671
|
+
};
|
|
640
672
|
var newRenderColumnItem = function newRenderColumnItem(effects) {
|
|
641
673
|
return function (item) {
|
|
642
674
|
var _item$componentConfig = item.componentConfig,
|
|
@@ -697,11 +729,6 @@ var FormRender = function FormRender(props, ref) {
|
|
|
697
729
|
noStyle: true,
|
|
698
730
|
shouldUpdate: function shouldUpdate(prevValues, currentValues) {
|
|
699
731
|
return true; // TODO: 修复重复依赖的问题 https://tb.raycloud.com/task/64e4491e0b8b5c001e1099b9
|
|
700
|
-
// 对所有依赖项进行是否需要更新判断,只有当当前组件的依赖项发生了变化的时候,我们才会进行渲染判断
|
|
701
|
-
return Array.from(dependenciesFields).reduce(function (cur, nxt) {
|
|
702
|
-
if (cur) return true;
|
|
703
|
-
return cur || (prevValues === null || prevValues === void 0 ? void 0 : prevValues[nxt]) !== (currentValues === null || currentValues === void 0 ? void 0 : currentValues[nxt]);
|
|
704
|
-
}, false);
|
|
705
732
|
}
|
|
706
733
|
}, function (_ref4) {
|
|
707
734
|
var getFieldValue = _ref4.getFieldValue;
|
|
@@ -715,37 +742,58 @@ var FormRender = function FormRender(props, ref) {
|
|
|
715
742
|
// 满足所有
|
|
716
743
|
if (linkCondition === 'every') {
|
|
717
744
|
return every(conditionList, function (item) {
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
//
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
745
|
+
//现支持子组件控制显隐,格式为${uniqueKey}_${type}与普通组件做区分
|
|
746
|
+
// const isChildField = item.leftValue.includes('_');
|
|
747
|
+
// const prefixId = isChildField ? item.leftValue.split('_')?.[0] : item.leftValue;
|
|
748
|
+
// const childFieldType = isChildField ? item.leftValue.split('_')?.[1] : '';
|
|
749
|
+
// let dependenceDetail = getComponentDetailByFieldId(prefixId);
|
|
750
|
+
// if (isChildField && CHILD_FIELD_TYPE[childFieldType]) {
|
|
751
|
+
// const childType = CHILD_FIELD_TYPE[childFieldType];
|
|
752
|
+
// dependenceDetail = dependenceDetail?.[childType] || dependenceDetail;
|
|
753
|
+
// }
|
|
754
|
+
|
|
755
|
+
// let leftValue = getFieldValue(prefixId);
|
|
756
|
+
// if (isChildField) {
|
|
757
|
+
// leftValue = (leftValue as Record<string, any>)?.[childFieldType];
|
|
758
|
+
// }
|
|
759
|
+
// if (typeof dependenceDetail.formDataTransform === 'function') {
|
|
760
|
+
// leftValue = dependenceDetail.formDataTransform(leftValue);
|
|
761
|
+
// }
|
|
762
|
+
// // TODO: 如果依赖的组件是隐藏的,当前依赖项为false
|
|
763
|
+
// if (
|
|
764
|
+
// Reflect.has(currentComponentDisplayStatus.current, prefixId) &&
|
|
765
|
+
// !currentComponentDisplayStatus.current[prefixId]
|
|
766
|
+
// ) {
|
|
767
|
+
// return false;
|
|
768
|
+
// }
|
|
769
|
+
// return getExpression(
|
|
770
|
+
// item.compareSymbol?.toUpperCase(),
|
|
771
|
+
// leftValue,
|
|
772
|
+
// item.rightValue,
|
|
773
|
+
// );
|
|
774
|
+
return conditionItemResult(item, getFieldValue);
|
|
734
775
|
});
|
|
735
776
|
}
|
|
736
777
|
// 满足其中之一
|
|
737
778
|
return some(conditionList, function (item) {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
//
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
return
|
|
779
|
+
// const dependenceDetail = getComponentDetailByFieldId(item.leftValue);
|
|
780
|
+
// let leftValue = getFieldValue(item.leftValue);
|
|
781
|
+
// if (typeof dependenceDetail.formDataTransform === 'function') {
|
|
782
|
+
// leftValue = dependenceDetail.formDataTransform(leftValue);
|
|
783
|
+
// }
|
|
784
|
+
// // TODO: 如果依赖的组件是隐藏的,当前依赖项为false
|
|
785
|
+
// if (
|
|
786
|
+
// Reflect.has(currentComponentDisplayStatus.current, item.leftValue) &&
|
|
787
|
+
// !currentComponentDisplayStatus.current[item.leftValue]
|
|
788
|
+
// ) {
|
|
789
|
+
// return false;
|
|
790
|
+
// }
|
|
791
|
+
// return getExpression(
|
|
792
|
+
// item.compareSymbol?.toUpperCase(),
|
|
793
|
+
// leftValue,
|
|
794
|
+
// item.rightValue,
|
|
795
|
+
// );
|
|
796
|
+
return conditionItemResult(item, getFieldValue);
|
|
749
797
|
});
|
|
750
798
|
}, false);
|
|
751
799
|
// TODO: 当组件的显影状态发生变化
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
import { Modal, Checkbox } from 'antd';
|
|
9
|
+
import cache from "../../../common/cache";
|
|
10
|
+
export default (function (props) {
|
|
11
|
+
var onCallback = props.onCallback,
|
|
12
|
+
onClose = props.onClose;
|
|
13
|
+
var _useState = useState(false),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
remind = _useState2[0],
|
|
16
|
+
setRemind = _useState2[1];
|
|
17
|
+
var onOk = function onOk() {
|
|
18
|
+
remind && cache.setRemind();
|
|
19
|
+
onCallback();
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
22
|
+
visible: true,
|
|
23
|
+
title: "\u63D0\u9192",
|
|
24
|
+
okText: "\u786E\u5B9A",
|
|
25
|
+
cancelText: "\u53D6\u6D88",
|
|
26
|
+
onOk: onOk,
|
|
27
|
+
onCancel: onClose
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "\u786E\u8BA4\u5B8C\u7ED3\u5DE5\u5355\u5417?\u5B8C\u7ED3\u540E\u5DE5\u5355\u5185\u5BB9\u4E0D\u53EF\u53D8\u66F4"), /*#__PURE__*/React.createElement(Checkbox, {
|
|
29
|
+
onChange: function onChange(e) {
|
|
30
|
+
return setRemind(e.target.checked);
|
|
31
|
+
}
|
|
32
|
+
}, "\u77E5\u9053\u4E86\uFF0C\u4E0D\u7528\u518D\u63D0\u9192\u6211\u4E86")));
|
|
33
|
+
});
|