@bit-sun/business-component 4.2.0-alpha.21 → 4.2.0-alpha.22
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/index.esm.js +274 -11
- package/dist/index.js +274 -11
- package/package.json +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +60 -0
- package/src/components/Business/SearchSelect/index.md +2 -2
- package/src/components/Solution/RuleComponent/index.js +216 -8
- package/src/components/Solution/RuleComponent/ruleFiled.js +21 -5
|
@@ -35,12 +35,10 @@ import {
|
|
|
35
35
|
} from './util';
|
|
36
36
|
import { getDictionarySource, judgeIsEmpty, uuid } from '../../../utils/utils';
|
|
37
37
|
import { coverToParallel } from '../../../utils/TreeUtils';
|
|
38
|
-
import
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
BsCascader,
|
|
43
|
-
} from '../../../index';
|
|
38
|
+
import BusinessSearchSelect from '../../Business/SearchSelect';
|
|
39
|
+
import BusinessTreeSearchSelect from '../../Business/TreeSearchSelect';
|
|
40
|
+
import EllipsisTooltip from '../../Functional/EllipsisTooltip';
|
|
41
|
+
import { BsCascader } from '../../Functional/BsAntdSula/index';
|
|
44
42
|
import { request } from 'bssula';
|
|
45
43
|
import Formula from './Formula';
|
|
46
44
|
import RenderSpecificAction from './renderSpecificAction';
|
|
@@ -48,6 +46,19 @@ import RenderCompItem from './RenderCompItem';
|
|
|
48
46
|
|
|
49
47
|
const { RangePicker } = DatePicker;
|
|
50
48
|
|
|
49
|
+
const FIXED_DATA_TYPES = {
|
|
50
|
+
10: '字符串',
|
|
51
|
+
20: '短整数',
|
|
52
|
+
21: '长整数',
|
|
53
|
+
22: '小数',
|
|
54
|
+
40: '数组',
|
|
55
|
+
41: '布尔值',
|
|
56
|
+
12: '富文本',
|
|
57
|
+
30: '日期',
|
|
58
|
+
31: '时间',
|
|
59
|
+
32: '日期时间',
|
|
60
|
+
};
|
|
61
|
+
|
|
51
62
|
class RuleObjectComponent extends Component {
|
|
52
63
|
constructor(props) {
|
|
53
64
|
super(props);
|
|
@@ -151,6 +162,8 @@ class RuleObjectComponent extends Component {
|
|
|
151
162
|
value: element.id,
|
|
152
163
|
id: element.id,
|
|
153
164
|
dataTypeCode: element.valueType,
|
|
165
|
+
entityValueType: element.entityValueType,
|
|
166
|
+
entityInputType: element.entityInputType,
|
|
154
167
|
dataChoiceBusinessType: element.choiceType,
|
|
155
168
|
dataInputBusinessType: element.inputType,
|
|
156
169
|
info: element.info,
|
|
@@ -178,6 +191,8 @@ class RuleObjectComponent extends Component {
|
|
|
178
191
|
metaObjectCode: this.props.metaObjectCode || item.code,
|
|
179
192
|
...item,
|
|
180
193
|
dataTypeCode: item.valueType,
|
|
194
|
+
entityValueType: item.entityValueType,
|
|
195
|
+
entityInputType: item.entityInputType,
|
|
181
196
|
dataChoiceBusinessType: item.choiceType,
|
|
182
197
|
dataInputBusinessType: item.inputType,
|
|
183
198
|
}),
|
|
@@ -225,6 +240,8 @@ class RuleObjectComponent extends Component {
|
|
|
225
240
|
value: element.id,
|
|
226
241
|
id: element.id,
|
|
227
242
|
dataTypeCode: element.valueType,
|
|
243
|
+
entityValueType: element.entityValueType,
|
|
244
|
+
entityInputType: element.entityInputType,
|
|
228
245
|
dataChoiceBusinessType: element.choiceType,
|
|
229
246
|
dataInputBusinessType: element.inputType,
|
|
230
247
|
info: element.info,
|
|
@@ -689,6 +706,7 @@ class RuleObjectComponent extends Component {
|
|
|
689
706
|
disabled,
|
|
690
707
|
systemVariableList,
|
|
691
708
|
needShowInsertSQL,
|
|
709
|
+
needShowReqCondition,
|
|
692
710
|
} = this.props;
|
|
693
711
|
let thresholdQuery = {
|
|
694
712
|
...initialThresholdQuery,
|
|
@@ -824,6 +842,8 @@ class RuleObjectComponent extends Component {
|
|
|
824
842
|
itemDetail.elementName = nodeInfo.triggerNode.props.title;
|
|
825
843
|
itemDetail.dataTypeCode =
|
|
826
844
|
nodeInfo.triggerNode.props.dataTypeCode;
|
|
845
|
+
itemDetail.entityValueType = nodeInfo.triggerNode.props.entityValueType;
|
|
846
|
+
itemDetail.entityInputType = nodeInfo.triggerNode.props.entityInputType;
|
|
827
847
|
itemDetail.metaObjectCode =
|
|
828
848
|
nodeInfo.triggerNode.props.metaObjectCode;
|
|
829
849
|
itemDetail.isInsertParam = false;
|
|
@@ -1049,13 +1069,21 @@ class RuleObjectComponent extends Component {
|
|
|
1049
1069
|
<div
|
|
1050
1070
|
style={{
|
|
1051
1071
|
display:
|
|
1052
|
-
itemDetail.operationType == 'logic' &&
|
|
1072
|
+
itemDetail.operationType == 'logic' &&
|
|
1073
|
+
(!disabled ||
|
|
1074
|
+
(itemDetail.reqConditionData &&
|
|
1075
|
+
itemDetail.reqConditionData.reqParamName &&
|
|
1076
|
+
itemDetail.reqConditionData.params?.length))
|
|
1053
1077
|
? 'block'
|
|
1054
1078
|
: 'none',
|
|
1055
1079
|
}}
|
|
1056
1080
|
>
|
|
1057
1081
|
<span
|
|
1058
|
-
style={{
|
|
1082
|
+
style={{
|
|
1083
|
+
color: '#008fe0',
|
|
1084
|
+
cursor: 'pointer',
|
|
1085
|
+
display: disabled ? 'none' : 'inline',
|
|
1086
|
+
}}
|
|
1059
1087
|
type="link"
|
|
1060
1088
|
onClick={() => {
|
|
1061
1089
|
this.addPeerRule(itemDetail);
|
|
@@ -1070,6 +1098,123 @@ class RuleObjectComponent extends Component {
|
|
|
1070
1098
|
/>
|
|
1071
1099
|
添加条件
|
|
1072
1100
|
</span>
|
|
1101
|
+
{needShowReqCondition && (
|
|
1102
|
+
<span
|
|
1103
|
+
style={{
|
|
1104
|
+
marginLeft: 10,
|
|
1105
|
+
display: disabled ? 'none' : 'inline',
|
|
1106
|
+
}}
|
|
1107
|
+
>
|
|
1108
|
+
<Button
|
|
1109
|
+
type="link"
|
|
1110
|
+
disabled={
|
|
1111
|
+
disabled &&
|
|
1112
|
+
(!itemDetail.reqConditionData ||
|
|
1113
|
+
!itemDetail.reqConditionData.reqParamName ||
|
|
1114
|
+
!itemDetail.reqConditionData.params?.length)
|
|
1115
|
+
}
|
|
1116
|
+
style={{ padding: 0, height: 'auto' }}
|
|
1117
|
+
onClick={() => this.handleReqConditionToggle(itemDetail)}
|
|
1118
|
+
>
|
|
1119
|
+
{itemDetail.isReqCondition
|
|
1120
|
+
? '取消参数条件控制'
|
|
1121
|
+
: '参数条件控制'}
|
|
1122
|
+
</Button>
|
|
1123
|
+
</span>
|
|
1124
|
+
)}
|
|
1125
|
+
{(itemDetail.isReqCondition ||
|
|
1126
|
+
(disabled &&
|
|
1127
|
+
itemDetail.reqConditionData &&
|
|
1128
|
+
itemDetail.reqConditionData.reqParamName &&
|
|
1129
|
+
itemDetail.reqConditionData.params?.length)) &&
|
|
1130
|
+
itemDetail.reqConditionData && (
|
|
1131
|
+
<div
|
|
1132
|
+
style={{
|
|
1133
|
+
marginTop: 10,
|
|
1134
|
+
display:
|
|
1135
|
+
disabled &&
|
|
1136
|
+
(!itemDetail.reqConditionData.reqParamName ||
|
|
1137
|
+
!itemDetail.reqConditionData.params?.length)
|
|
1138
|
+
? 'none'
|
|
1139
|
+
: 'flex',
|
|
1140
|
+
alignItems: 'center',
|
|
1141
|
+
background: '#f5f5f5',
|
|
1142
|
+
padding: '10px',
|
|
1143
|
+
borderRadius: '4px',
|
|
1144
|
+
}}
|
|
1145
|
+
>
|
|
1146
|
+
<span style={{ marginRight: 8, flexShrink: 0 }}>
|
|
1147
|
+
请求参数名称:
|
|
1148
|
+
</span>
|
|
1149
|
+
<Input
|
|
1150
|
+
disabled={disabled}
|
|
1151
|
+
style={{ width: 150, marginRight: 10 }}
|
|
1152
|
+
value={itemDetail.reqConditionData.reqParamName}
|
|
1153
|
+
onChange={(e) =>
|
|
1154
|
+
this.handleReqDataChange(
|
|
1155
|
+
itemDetail,
|
|
1156
|
+
'reqParamName',
|
|
1157
|
+
e.target.value,
|
|
1158
|
+
)
|
|
1159
|
+
}
|
|
1160
|
+
/>
|
|
1161
|
+
|
|
1162
|
+
<span style={{ marginRight: 8, flexShrink: 0 }}>类型:</span>
|
|
1163
|
+
<Select
|
|
1164
|
+
disabled={disabled}
|
|
1165
|
+
style={{ width: 120, marginRight: 10 }}
|
|
1166
|
+
value={itemDetail.reqConditionData.dataTypeCode}
|
|
1167
|
+
onChange={(val) =>
|
|
1168
|
+
this.handleReqDataChange(itemDetail, 'dataTypeCode', val)
|
|
1169
|
+
}
|
|
1170
|
+
>
|
|
1171
|
+
{Object.keys(FIXED_DATA_TYPES).map((code) => (
|
|
1172
|
+
<Select.Option key={code} value={code}>
|
|
1173
|
+
{FIXED_DATA_TYPES[code]}
|
|
1174
|
+
</Select.Option>
|
|
1175
|
+
))}
|
|
1176
|
+
</Select>
|
|
1177
|
+
|
|
1178
|
+
<Select
|
|
1179
|
+
disabled={disabled}
|
|
1180
|
+
style={{ width: 120, marginRight: 10 }}
|
|
1181
|
+
value={itemDetail.reqConditionData.operationCode}
|
|
1182
|
+
onChange={(val) =>
|
|
1183
|
+
this.handleReqDataChange(itemDetail, 'operationCode', val)
|
|
1184
|
+
}
|
|
1185
|
+
>
|
|
1186
|
+
{[
|
|
1187
|
+
{ 'code': '1', 'name': '在集合' },
|
|
1188
|
+
{ 'code': '2', 'name': '不等于' },
|
|
1189
|
+
{ code: '3', name: '小于' },
|
|
1190
|
+
{ code: '4', name: '大于' },
|
|
1191
|
+
{ code: '5', name: '等于' },
|
|
1192
|
+
].map((op) => (
|
|
1193
|
+
<Select.Option key={op.code} value={op.code}>
|
|
1194
|
+
{op.name}
|
|
1195
|
+
</Select.Option>
|
|
1196
|
+
))}
|
|
1197
|
+
</Select>
|
|
1198
|
+
|
|
1199
|
+
<RuleField
|
|
1200
|
+
customerWidth={'180px'}
|
|
1201
|
+
isQueryParams={true}
|
|
1202
|
+
selectOperation={itemDetail.reqConditionData.operationCode}
|
|
1203
|
+
dataTypeCode={itemDetail.reqConditionData.dataTypeCode}
|
|
1204
|
+
values={itemDetail.reqConditionData.params || []}
|
|
1205
|
+
valueNames={itemDetail.reqConditionData.paramNames || []}
|
|
1206
|
+
callback={(newValues, newValueNames) =>
|
|
1207
|
+
this.handleReqDataChange(
|
|
1208
|
+
itemDetail,
|
|
1209
|
+
'params',
|
|
1210
|
+
newValues,
|
|
1211
|
+
newValueNames,
|
|
1212
|
+
)
|
|
1213
|
+
}
|
|
1214
|
+
disabled={disabled}
|
|
1215
|
+
/>
|
|
1216
|
+
</div>
|
|
1217
|
+
)}
|
|
1073
1218
|
</div>
|
|
1074
1219
|
</div>
|
|
1075
1220
|
</div>
|
|
@@ -1497,6 +1642,8 @@ class RuleObjectComponent extends Component {
|
|
|
1497
1642
|
delete itemDetail.params;
|
|
1498
1643
|
delete itemDetail.paramNames;
|
|
1499
1644
|
delete itemDetail.dataTypeCode;
|
|
1645
|
+
delete itemDetail.entityValueType;
|
|
1646
|
+
delete itemDetail.entityInputType;
|
|
1500
1647
|
delete itemDetail.elementId;
|
|
1501
1648
|
delete itemDetail.elementName;
|
|
1502
1649
|
delete itemDetail.metaObjectCode;
|
|
@@ -1562,6 +1709,8 @@ class RuleObjectComponent extends Component {
|
|
|
1562
1709
|
parentDetail.elementName = parentDetail.subExpression[0].elementName;
|
|
1563
1710
|
parentDetail.dataTypeCode =
|
|
1564
1711
|
parentDetail.subExpression[0].dataTypeCode;
|
|
1712
|
+
parentDetail.entityValueType = parentDetail.subExpression[0].entityValueType;
|
|
1713
|
+
parentDetail.entityInputType = parentDetail.subExpression[0].entityInputType;
|
|
1565
1714
|
delete parentDetail.subExpression;
|
|
1566
1715
|
}
|
|
1567
1716
|
}
|
|
@@ -1647,6 +1796,65 @@ class RuleObjectComponent extends Component {
|
|
|
1647
1796
|
);
|
|
1648
1797
|
};
|
|
1649
1798
|
|
|
1799
|
+
handleReqConditionToggle = (itemDetail) => {
|
|
1800
|
+
const { ruleClassData } = this.state;
|
|
1801
|
+
const { callBack } = this.props;
|
|
1802
|
+
itemDetail.isReqCondition = !itemDetail.isReqCondition;
|
|
1803
|
+
if (itemDetail.isReqCondition && !itemDetail.reqConditionData) {
|
|
1804
|
+
itemDetail.reqConditionData = {
|
|
1805
|
+
operationType: 'relation',
|
|
1806
|
+
dataTypeCode: '10',
|
|
1807
|
+
entityInputType: '10',
|
|
1808
|
+
entityValueType: '10',
|
|
1809
|
+
operationCode: '',
|
|
1810
|
+
reqParamName: '',
|
|
1811
|
+
params: [],
|
|
1812
|
+
paramNames: [],
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
this.setState(
|
|
1816
|
+
{
|
|
1817
|
+
ruleClassData,
|
|
1818
|
+
},
|
|
1819
|
+
() => {
|
|
1820
|
+
callBack(ruleClassData);
|
|
1821
|
+
},
|
|
1822
|
+
);
|
|
1823
|
+
};
|
|
1824
|
+
|
|
1825
|
+
handleReqDataChange = (itemDetail, field, value, valueNames) => {
|
|
1826
|
+
const { ruleClassData } = this.state;
|
|
1827
|
+
const { callBack } = this.props;
|
|
1828
|
+
if (!itemDetail.reqConditionData) return;
|
|
1829
|
+
|
|
1830
|
+
if (field === 'dataTypeCode') {
|
|
1831
|
+
itemDetail.reqConditionData.dataTypeCode = value;
|
|
1832
|
+
itemDetail.reqConditionData.entityInputType = value;
|
|
1833
|
+
itemDetail.reqConditionData.entityValueType = value;
|
|
1834
|
+
itemDetail.reqConditionData.operationCode = '';
|
|
1835
|
+
itemDetail.reqConditionData.params = [];
|
|
1836
|
+
itemDetail.reqConditionData.paramNames = [];
|
|
1837
|
+
} else if (field === 'operationCode') {
|
|
1838
|
+
itemDetail.reqConditionData.operationCode = value;
|
|
1839
|
+
} else if (field === 'reqParamName') {
|
|
1840
|
+
itemDetail.reqConditionData.reqParamName = value;
|
|
1841
|
+
} else if (field === 'params') {
|
|
1842
|
+
itemDetail.reqConditionData.params = value;
|
|
1843
|
+
if (valueNames) {
|
|
1844
|
+
itemDetail.reqConditionData.paramNames = valueNames;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
this.setState(
|
|
1849
|
+
{
|
|
1850
|
+
ruleClassData,
|
|
1851
|
+
},
|
|
1852
|
+
() => {
|
|
1853
|
+
callBack(ruleClassData);
|
|
1854
|
+
},
|
|
1855
|
+
);
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1650
1858
|
render() {
|
|
1651
1859
|
const { onlyOneRule, callBack, disabled, headerButtonComponentFun } = this.props;
|
|
1652
1860
|
const { ruleClassData, modalParams } = this.state;
|
|
@@ -8,11 +8,9 @@ import { handleError } from '../../../utils/requestUtils';
|
|
|
8
8
|
import { queryIdentityInfo, findChangedThresholdQuery, setParams, dateFormat, fullDateFormat } from './util';
|
|
9
9
|
import { request as SulaRequest } from 'bssula';
|
|
10
10
|
import { stringify } from 'querystring';
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
BsCascader
|
|
15
|
-
} from '../../../index';
|
|
11
|
+
import BusinessSearchSelect from '../../Business/SearchSelect';
|
|
12
|
+
import BusinessTreeSearchSelect from '../../Business/TreeSearchSelect';
|
|
13
|
+
import { BsCascader } from '../../Functional/BsAntdSula/index';
|
|
16
14
|
import CustomSelector from './CustomPlugin/CustomSelector';
|
|
17
15
|
const { RangePicker } = DatePicker;
|
|
18
16
|
|
|
@@ -29,6 +27,7 @@ export default class RuleField extends Component {
|
|
|
29
27
|
thresholdQuery: {},
|
|
30
28
|
thresholdList: [],
|
|
31
29
|
options: [],
|
|
30
|
+
isQueryParams: false
|
|
32
31
|
};
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -45,6 +44,7 @@ export default class RuleField extends Component {
|
|
|
45
44
|
queryIdentify,
|
|
46
45
|
propertyCode,
|
|
47
46
|
queryIdentifyType,
|
|
47
|
+
isQueryParams
|
|
48
48
|
} = this.props;
|
|
49
49
|
this.setState(
|
|
50
50
|
{
|
|
@@ -57,6 +57,7 @@ export default class RuleField extends Component {
|
|
|
57
57
|
dataTypeCode,
|
|
58
58
|
dataChoiceBusinessType,
|
|
59
59
|
dataInputBusinessType,
|
|
60
|
+
isQueryParams,
|
|
60
61
|
others,
|
|
61
62
|
fieldValues: [...values],
|
|
62
63
|
options,
|
|
@@ -283,11 +284,26 @@ export default class RuleField extends Component {
|
|
|
283
284
|
itemDetail={},
|
|
284
285
|
others={},
|
|
285
286
|
propertyCode,
|
|
287
|
+
isQueryParams
|
|
286
288
|
} = this.props;
|
|
287
289
|
const { thresholdList } = this.state;
|
|
288
290
|
const styleCommon = {
|
|
289
291
|
width: customerWidth || '180px',
|
|
290
292
|
};
|
|
293
|
+
|
|
294
|
+
if(isQueryParams) {
|
|
295
|
+
return <Input
|
|
296
|
+
defaultValue={values.join(',')}
|
|
297
|
+
disabled={disabled}
|
|
298
|
+
style={styleCommon}
|
|
299
|
+
onBlur={(e) => {
|
|
300
|
+
values = e.target.value.split(',');
|
|
301
|
+
valueNames = e.target.value.split(',');
|
|
302
|
+
callback(values, valueNames);
|
|
303
|
+
}}
|
|
304
|
+
/>
|
|
305
|
+
}
|
|
306
|
+
|
|
291
307
|
if (!selectOperation) return <Input disabled style={styleCommon}></Input>;
|
|
292
308
|
const SET_TYPE = ['in', 'nin', 'cn', 'ncn','5']; //集合类型 (数字为 兼容用户管理子应用使用规则组件)
|
|
293
309
|
const INTERVAL_TYPE = ['be', 'bed', 'nbe', 'nbed', 'ber', 'bel']; //区间类型
|