@bit-sun/business-component 4.0.4 → 4.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -1,7 +1,7 @@
1
1
  // @ts-nocheck
2
2
  import { BsCascader } from '@/components/Functional/BsAntdSula';
3
3
  import { BusinessSearchSelect, BusinessTreeSearchSelect } from '@/index';
4
- import { getDictionarySource, uuid } from '../../../utils/utils';
4
+ import { getDictionarySource, judgeIsEmpty, uuid } from '../../../utils/utils';
5
5
  import { useRequest } from 'ahooks';
6
6
  import { Input, InputNumber, DatePicker, Switch, Select } from 'antd';
7
7
  import React, { useEffect, useState } from 'react'
@@ -81,8 +81,10 @@ export default function RenderCompItem(props:any){
81
81
  (ites?.valueType === 23 || ites?.valueType === 22) && (
82
82
  <InputNumber
83
83
  disabled={disabled}
84
- max={Number.MAX_SAFE_INTEGER}
85
- min={ites?.valueType === 23 ? 0 : Number.MIN_SAFE_INTEGER}
84
+ // max={Number.MAX_SAFE_INTEGER}
85
+ max={judgeIsEmpty(ites?.maxValue) ? Number.MAX_SAFE_INTEGER : ites.maxValue}
86
+ // min={ites?.valueType === 23 ? 0 : Number.MIN_SAFE_INTEGER}
87
+ min={judgeIsEmpty(ites?.minValue) ? (ites?.valueType === 23 ? 0 : Number.MIN_SAFE_INTEGER) : ites.minValue}
86
88
  precision={ites?.valueType === 23 ? 0 : 2}
87
89
  defaultValue={ites.defaultValue}
88
90
  style={style2}
@@ -322,6 +322,9 @@ class RuleObjectComponent extends Component {
322
322
  handleOperatingAction,
323
323
  ruleGroupInfo,
324
324
  needShowAction = true,
325
+ extraConfig,
326
+ customTitleSubStyle,
327
+ customTitlePreStyle,
325
328
  } = this.props;
326
329
  const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1; // 业务调用规则实例设计器
327
330
  const ruleGroupName = ruleGroupInfo?.ruleGroupList?.[0]?.name || '规则分组';
@@ -335,6 +338,7 @@ class RuleObjectComponent extends Component {
335
338
  background: '#fff',
336
339
  width: '160px',
337
340
  textAlign: 'center',
341
+ ...(customTitlePreStyle || {}),
338
342
  }; // height:22
339
343
  const titleSubCommon = {
340
344
  display: 'flex',
@@ -346,6 +350,7 @@ class RuleObjectComponent extends Component {
346
350
  width: '166px',
347
351
  top: '-32px', // titlePre(height + top)
348
352
  left: '200px', // titlePre(2 * left + width) 左右间距为titlePre的left: 20px
353
+ ...(customTitleSubStyle || {}),
349
354
  }; // height: 24
350
355
  const titleSubPre2 = {
351
356
  ...titlePre,
@@ -354,7 +359,7 @@ class RuleObjectComponent extends Component {
354
359
  top: '-56px', // titleSubPre(top + height)
355
360
  left: '386px', // titlePre(left + width + 20)
356
361
  }
357
- const ruleListBox = (!onlyOneRule || ruleGroupInfo) ? { border: '1px dashed #d9d9d9', marginBottom: 10, overflowX: 'clip' } : {};
362
+ const ruleListBox = (!onlyOneRule || ruleGroupInfo) ? { border: '1px dashed #d9d9d9', marginBottom: 10, overflowX: 'clip', position: 'relative' } : {};
358
363
  const isRuleActionConfig =
359
364
  ruleTypeData?.length || ruleReturnConfig?.length;
360
365
  return (
@@ -383,7 +388,8 @@ class RuleObjectComponent extends Component {
383
388
  disabled,
384
389
  };
385
390
  return (
386
- <div style={ruleListBox}>
391
+ // rule-line-class方便开发自定义样式,勿删
392
+ <div className={'rule-line-class'} style={ruleListBox}>
387
393
  {!onlyOneRule && !ruleGroupInfo && (
388
394
  <div style={titlePre}>规则{classDataIndex + 1}</div>
389
395
  )}
@@ -398,7 +404,18 @@ class RuleObjectComponent extends Component {
398
404
  </div>
399
405
  {isRuleInstance && (
400
406
  <div style={titleSubPre}>
401
- <span style={{ marginRight: 10, display: 'block' }}>优先级</span>
407
+ <span
408
+ style={{
409
+ marginRight: 10,
410
+ display: 'block',
411
+ width: '100px',
412
+ textAlign: 'right',
413
+ overflow: 'hidden',
414
+ textOverflow:'ellipsis',
415
+ whiteSpace: 'nowrap'
416
+ }}>
417
+ 优先级
418
+ </span>
402
419
  <Select
403
420
  size='small'
404
421
  disabled={canChangePriority ? !canChangePriority : disabled}
@@ -438,13 +455,57 @@ class RuleObjectComponent extends Component {
438
455
  />
439
456
  </div>
440
457
  )}
458
+ {/* 规则组额外extStrField */}
459
+ {
460
+ extraConfig && extraConfig.map((extraItem, index) => (
461
+ <div style={titleSubPre}>
462
+ <span
463
+ style={{
464
+ marginRight: 10,
465
+ display: 'block',
466
+ width: '100px',
467
+ textAlign: 'right',
468
+ overflow: 'hidden',
469
+ textOverflow:'ellipsis',
470
+ whiteSpace: 'nowrap'
471
+ }}
472
+ >
473
+ {extraItem?.label}
474
+ </span>
475
+ <Select
476
+ size='small'
477
+ style={{ width: 100 }}
478
+ mode={extraItem?.mode || null}
479
+ disabled={disabled}
480
+ value={ extraItem?.mode === 'multiple' ? (item[extraItem?.code] ? item[extraItem?.code].split(',') : []) : item[extraItem?.code] }
481
+ onChange={(v) => {
482
+ item[extraItem?.code] = Array.isArray(v) ? v.join(',') : v;
483
+ this.setState(
484
+ {
485
+ ruleClassData,
486
+ },
487
+ () => {
488
+ callBack(ruleClassData);
489
+ },
490
+ );
491
+ }}
492
+ >
493
+ {extraItem?.optionList?.map((s,sindex) => (
494
+ <Option value={s?.value}>{s?.text}</Option>
495
+ ))}
496
+ </Select>
497
+ </div>
498
+ ))
499
+ }
441
500
  </>
442
501
  )}
443
502
  <div
444
503
  style={{
445
504
  textAlign: 'right',
446
- marginTop: '-24px',
447
505
  display: canDelete ? 'block' : 'none',
506
+ position: 'absolute',
507
+ right: '5px',
508
+ top: '5px',
448
509
  }}
449
510
  >
450
511
  <Button
@@ -1476,7 +1537,6 @@ class RuleObjectComponent extends Component {
1476
1537
  classDataIndex
1477
1538
  ].extraInfo.response.map((i) => {
1478
1539
  if (i.code && keys.some((r) => r === i.code) && !i.enable) {
1479
- console.log('i', i);
1480
1540
  return { ...i, enable: true };
1481
1541
  }
1482
1542
  return i;
@@ -28,6 +28,8 @@ export default forwardRef((props: any, ref) => {
28
28
  baseRuleDetailList = [],
29
29
  systemVariableList = [],
30
30
  defRuleDetail = {},
31
+ customerValidator,
32
+ saveUrl = '',
31
33
  } = props;
32
34
  const sceneId = scenceParams?.sceneId;
33
35
  const sceneName = scenceParams?.sceneName;
@@ -258,6 +260,12 @@ export default forwardRef((props: any, ref) => {
258
260
 
259
261
  const handleSave = (needCheckOnlyOne: boolean = false) => {
260
262
  const ruleResultList = handleRuleResultList(callbackData, ruleTypeData);
263
+
264
+ // 自定义规则数据保存校验
265
+ if (customerValidator && !customerValidator(ruleResultList, ruleTypeData)) {
266
+ return Promise.reject();
267
+ }
268
+
261
269
  if (needCheckOnlyOne && ruleResultList?.length === 0) {
262
270
  message.warning('请至少配置一个规则!');
263
271
  return Promise.reject();
@@ -284,6 +292,14 @@ export default forwardRef((props: any, ref) => {
284
292
 
285
293
  // setLoading(true);
286
294
 
295
+ // 退货协议特殊处理逻辑,拼接业务类型值extStrField02
296
+ let extStrField02List: any[] = [];
297
+ ruleResultList.forEach((item: any) => {
298
+ const itemList = item?.extStrField02 ? item?.extStrField02.split(',') : [];
299
+ extStrField02List = [...extStrField02List, ...itemList];
300
+ })
301
+ let extStrField02 = Array.from(new Set(extStrField02List)).join(',');
302
+
287
303
  // 兼容没有规则组的情况
288
304
  const params = ruleGroupList?.length
289
305
  ? ruleGroupList.map((groupItem: any) => ({
@@ -298,6 +314,7 @@ export default forwardRef((props: any, ref) => {
298
314
  ...(instanceName ? { name: instanceName || i?.name } : {}),
299
315
  })),
300
316
  ...(extStrField01 ? { extStrField01 } : {}),
317
+ ...(extStrField02 ? { extStrField02 } : {}),
301
318
  ruleId: groupItem.id,
302
319
  templateId: sceneId,
303
320
  }))
@@ -310,6 +327,7 @@ export default forwardRef((props: any, ref) => {
310
327
  ...(extStrField01
311
328
  ? { extStrField01: extStrField01 || i?.extStrField01 }
312
329
  : {}),
330
+ ...(extStrField02 ? { extStrField02 } : {}),
313
331
  ...(instanceName ? { name: instanceName || i?.name } : {}),
314
332
  })),
315
333
  ...(extStrField01 ? { extStrField01 } : {}),
@@ -317,7 +335,7 @@ export default forwardRef((props: any, ref) => {
317
335
  },
318
336
  ];
319
337
 
320
- const handleUrl = `/basic/ruleDetail/addAndUpdate`;
338
+ const handleUrl = saveUrl || `/basic/ruleDetail/addAndUpdate`;
321
339
  const handleMethod = 'POST';
322
340
 
323
341
  return request({
@@ -165,6 +165,7 @@ export const handleRuleShowBack = (data: any, functionRuleList: any, ruleReturnL
165
165
  priority: item.priority,
166
166
  status: item.status,
167
167
  extStrField01: item?.extStrField01,
168
+ extStrField02: item?.extStrField02,
168
169
  name: item?.name,
169
170
  };
170
171
  if (item?.expression) {
@@ -409,6 +410,7 @@ export const handleRuleResultList = (data: any, ruleTypeData: any) => {
409
410
  priority: i.priority,
410
411
  status: i.status,
411
412
  extStrField01: i?.extStrField01,
413
+ extStrField02: i?.extStrField02,
412
414
  name: i?.name,
413
415
  };
414
416
  });
@@ -182,6 +182,8 @@ export default forwardRef((props: any, ref) => {
182
182
  <Card bordered={false} bodyStyle={{ paddingTop: 0 }}>
183
183
  <BaseRule
184
184
  ref={baseRuleRef}
185
+ customerValidator={props?.customerValidator}
186
+ saveUrl={props?.saveUrl}
185
187
  scenceParams={{
186
188
  sceneId: currentSceneId,
187
189
  sceneName: currentSceneName,
@@ -220,6 +220,7 @@ body {
220
220
 
221
221
  .ant-input-affix-wrapper {
222
222
  padding: 0 11px;
223
+ height: 24px;
223
224
  }
224
225
  }
225
226