@bit-sun/business-component 4.2.0-alpha.7 → 4.2.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.
package/.umirc.ts CHANGED
@@ -35,7 +35,7 @@ export default defineConfig({
35
35
  proxy: {
36
36
  '/bop/api/': {
37
37
  // target: 'http://bitsun.product.app.business-operation-platform.v1-dev:8050', // 开发环境
38
- target: 'https://occp-dev.xtepchina.com/', // 测试环境
38
+ target: 'https://ocean-test.bitsun-inc.com/', // 测试环境
39
39
  // target: 'http://yxzttest.yangzijiang.com/', // 扬子江测试环境
40
40
  // target: 'http://yxzt.yangzijiang.com/', // 扬子江测试环境
41
41
  changeOrigin: true,
@@ -48,37 +48,37 @@ export default defineConfig({
48
48
  // target: 'http://bitsun.product.app.business-operation-platform.v1-dev:8050', // 开发环境
49
49
  // 英伦
50
50
  // target: 'http://47.100.87.54:9102/', // 开发环境
51
- target: 'https://occp-dev.xtepchina.com/', // 测试环境
51
+ target: 'https://ocean-test.bitsun-inc.com/', // 测试环境
52
52
  // target: 'http://www.i-baby.net/', // 生产
53
53
  changeOrigin: true,
54
54
  // pathRewrite: { '^/wms-ops/': '/wms-ops/' }, // 开发环境
55
55
  },
56
56
  '/user/': {
57
- target: 'https://occp-dev.xtepchina.com/', // 开发环境
57
+ target: 'https://ocean-test.bitsun-inc.com/', // 开发环境
58
58
  changeOrigin: true,
59
59
  },
60
60
  '/drp-ops/': {
61
- target: 'https://occp-dev.xtepchina.com/', // 开发环境
61
+ target: 'https://ocean-test.bitsun-inc.com/', // 开发环境
62
62
  changeOrigin: true,
63
63
  },
64
64
  '/channel-manage/': {
65
- target: 'https://occp-dev.xtepchina.com/', // 开发环境
65
+ target: 'https://ocean-test.bitsun-inc.com/', // 开发环境
66
66
  changeOrigin: true,
67
67
  },
68
68
  '/items/': {
69
- target: 'https://occp-dev.xtepchina.com/', // 开发环境
69
+ target: 'https://ocean-test.bitsun-inc.com/', // 开发环境
70
70
  changeOrigin: true,
71
71
  },
72
72
  '/stock/': {
73
- target: 'https://occp-dev.xtepchina.com/', // 开发环境
73
+ target: 'https://ocean-test.bitsun-inc.com/', // 开发环境
74
74
  changeOrigin: true,
75
75
  },
76
76
  '/basic/': {
77
- target: 'https://occp-dev.xtepchina.com/', // 开发环境
77
+ target: 'https://ocean-test.bitsun-inc.com/', // 开发环境
78
78
  changeOrigin: true,
79
79
  },
80
80
  '/srm-ops/': {
81
- target: 'https://occp-dev.xtepchina.com/', // 开发环境
81
+ target: 'https://ocean-test.bitsun-inc.com/', // 开发环境
82
82
  changeOrigin: true,
83
83
  },
84
84
  },
package/dist/index.d.ts CHANGED
@@ -33,6 +33,7 @@ export { default as EllipsisTooltip } from './components/Functional/EllipsisTool
33
33
  export * from './components/Functional/BsAntdSula/index';
34
34
  export { default as RuleComponent } from './components/Solution/RuleComponent';
35
35
  export { default as RuleSetter } from './components/Solution/RuleSetter';
36
+ export { default as RenderCompItem } from './components/Solution/RuleComponent/RenderCompItem';
36
37
  export { processDetailButtonsVisible as processDetailButtonsVisible } from './components/Business/DetailPageWrapper';
37
38
  export { default as ExtendedCollapse } from './components/Common/ExtendedCollapse';
38
39
  export { default as Section } from './components/Common/Section';
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import axios from 'axios';
2
2
  import request$1 from 'umi-request';
3
3
  import cookie from 'js-cookie';
4
4
  import { message as message$1, Tooltip, Image, Popover, Card, Avatar, Badge, Menu, Input, InputNumber, Space, Button, Dropdown, Upload, Checkbox, Modal, ConfigProvider, Tag, Select, Spin, Form, Table, Empty, Row, Col, Tabs, TreeSelect, DatePicker, Typography, Alert, Breadcrumb, Drawer as Drawer$1, List, Radio, Tree, Result, Affix, Cascader, TimePicker, Divider, Switch, Collapse } from 'antd';
5
- import _, { omit, uniqBy, escapeRegExp, isNil, isBoolean, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
5
+ import _, { omit, uniqBy, escapeRegExp, isNil, cloneDeep, isEmpty, isBoolean, debounce, throttle } from 'lodash';
6
6
  import memoizeOne from 'memoize-one';
7
7
  import { formatMessage, history, useLocation, Link, useModel, setLocale, useIntl, request as request$3 } from 'umi';
8
8
  import isEqual from 'lodash/isEqual';
@@ -21,7 +21,7 @@ import { SortableHandle, SortableElement, SortableContainer } from 'react-sortab
21
21
  import { arrayMoveImmutable } from 'array-move';
22
22
  import classNames from 'classnames';
23
23
  import ProLayout from '@ant-design/pro-layout';
24
- import cloneDeep from 'lodash/cloneDeep';
24
+ import cloneDeep$1 from 'lodash/cloneDeep';
25
25
  import debounce$1 from 'lodash/debounce';
26
26
  import { DndProvider, useDrop, useDrag } from 'react-dnd';
27
27
  import { HTML5Backend } from 'react-dnd-html5-backend';
@@ -5743,6 +5743,29 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
5743
5743
  removeListener();
5744
5744
  };
5745
5745
  }, [isModalVisible]);
5746
+ var safeJSONParse = function safeJSONParse(str) {
5747
+ try {
5748
+ return JSON.parse(str);
5749
+ } catch (error) {
5750
+ console.warn('JSON解析失败:', error);
5751
+ return null;
5752
+ }
5753
+ };
5754
+ // 获取回显的value值 如果开启了搜索条件 则需要过滤掉搜索条件
5755
+ var getShowValue = function getShowValue(value) {
5756
+ var newValue = cloneDeep(value);
5757
+ if (selectProps.useSearchCondition && newValue) {
5758
+ // 回显的时候 把搜索项的内容去掉
5759
+ if (selectMode) {
5760
+ newValue = newValue.filter(function (item) {
5761
+ var parsedItem = safeJSONParse(decodeURIComponent(item));
5762
+ // 过滤掉JSON对象(搜索条件),保留非JSON数据(实际选择项)
5763
+ return !parsedItem || !(parsedItem && _typeof(parsedItem) === 'object' && !Array.isArray(parsedItem));
5764
+ });
5765
+ }
5766
+ }
5767
+ return newValue;
5768
+ };
5746
5769
  var showModal = function showModal() {
5747
5770
  if (sDisabled) return;
5748
5771
  setSelectOpen(false);
@@ -5752,12 +5775,13 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
5752
5775
  // 回显
5753
5776
  if (value) {
5754
5777
  if (selectMode) {
5755
- setSelectedRowKeys(labelInValue ? value.map(function (i) {
5778
+ var newValue = getShowValue(value);
5779
+ setSelectedRowKeys(labelInValue ? newValue.map(function (i) {
5756
5780
  return i.key;
5757
- }) : value);
5758
- setSelectedRows(labelInValue ? value.map(function (i) {
5781
+ }) : newValue);
5782
+ setSelectedRows(labelInValue ? newValue.map(function (i) {
5759
5783
  return _defineProperty(_defineProperty(_defineProperty({}, mappingValueField, i.key), "value", i.key), "text", i.label);
5760
- }) : value.map(function (i) {
5784
+ }) : newValue.map(function (i) {
5761
5785
  return _defineProperty(_defineProperty({}, mappingValueField, i), "value", i);
5762
5786
  }));
5763
5787
  setPopValue(labelInValue ? value.map(function (i) {
@@ -5794,7 +5818,24 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
5794
5818
  formaData(selectedValue, source);
5795
5819
  } else {
5796
5820
  var formatResult = selectMode ? [] : null;
5797
- onChange(formatResult, selectedValue);
5821
+ // 支持使用查询条件 筛选
5822
+ if (selectProps.useSearchCondition) {
5823
+ var formValue = form.getFieldsValue();
5824
+ // 一次性处理数据转换和过滤
5825
+ var processedFormValue = Object.keys(formValue).reduce(function (acc, key) {
5826
+ var value = formValue[key];
5827
+ // 过滤空值(确保trim函数存在)
5828
+ var trimmedValue = typeof value === 'string' ? value.trim() : value;
5829
+ if (trimmedValue && trimmedValue !== '') {
5830
+ acc[key] = trimmedValue;
5831
+ }
5832
+ return acc;
5833
+ }, {});
5834
+ var result = encodeURIComponent(JSON.stringify(processedFormValue));
5835
+ onChange(isEmpty(processedFormValue) ? formatResult : selectMode ? [result] : result, selectedValue);
5836
+ } else {
5837
+ onChange(formatResult, selectedValue);
5838
+ }
5798
5839
  }
5799
5840
  };
5800
5841
  var handleOk = function handleOk() {
@@ -5824,7 +5865,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
5824
5865
  setConfirmLoading(false);
5825
5866
  });
5826
5867
  } else {
5827
- handleSelectOver(popvalue);
5868
+ handleSelectOver(selectedRows.length ? popvalue : []);
5828
5869
  handleCancel();
5829
5870
  }
5830
5871
  };
@@ -6450,9 +6491,25 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
6450
6491
  confirmLoading: confirmLoading,
6451
6492
  onOk: handleOk,
6452
6493
  onCancel: handleCancel,
6453
- footer: selectMode || (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalRadioNeedFooter) ? [/*#__PURE__*/React$1.createElement(Button, {
6494
+ footer: selectMode || (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalRadioNeedFooter) ? [selectProps.useSearchCondition ? (/*#__PURE__*/React$1.createElement("div", {
6495
+ key: "instructions",
6496
+ style: {
6497
+ position: 'absolute',
6498
+ width: 'calc(100% - 500px)',
6499
+ textAlign: 'left'
6500
+ }
6501
+ }, /*#__PURE__*/React$1.createElement("div", null, "\u64CD\u4F5C\u8BF4\u660E\uFF1A\u7ED3\u679C\u96C6\u8FC7\u591A\u65F6\uFF0C\u53EF\u65E0\u9700\u9009\u62E9\u5177\u4F53\u6570\u636E\uFF0C\u7CFB\u7EDF\u5C06\u76F4\u63A5\u6309\u5DF2\u8BBE\u7B5B\u9009\u6761\u4EF6\u67E5\u8BE2"), /*#__PURE__*/React$1.createElement(Input, {
6502
+ style: {
6503
+ marginTop: '3px',
6504
+ height: '22px'
6505
+ },
6506
+ value: value
6507
+ }))) : /*#__PURE__*/React$1.createElement(React$1.Fragment, null), /*#__PURE__*/React$1.createElement(Button, {
6454
6508
  key: "back",
6455
- onClick: handleCancel
6509
+ onClick: handleCancel,
6510
+ style: {
6511
+ margin: selectProps.useSearchCondition ? '10px 0' : 0
6512
+ }
6456
6513
  }, "\u53D6\u6D88"), /*#__PURE__*/React$1.createElement(Button, {
6457
6514
  key: "submit",
6458
6515
  type: "primary",
@@ -20215,7 +20272,7 @@ var searchMenuData = function searchMenuData(router, name, callBack) {
20215
20272
  }
20216
20273
  var btnAuth = JSON.parse(localStorage.getItem(getMenuAuthDataKey()) || '[]');
20217
20274
  var resultList = [];
20218
- var newRouter = cloneDeep(router);
20275
+ var newRouter = cloneDeep$1(router);
20219
20276
  var _deep = function deep(router) {
20220
20277
  if (router && Array.isArray(router)) {
20221
20278
  router.forEach(function (item) {
@@ -21156,7 +21213,7 @@ var GlobalHeaderCom = function GlobalHeaderCom(props) {
21156
21213
  };
21157
21214
  var initRoute = function initRoute(router, name) {
21158
21215
  var resultList = [];
21159
- var newRouter = cloneDeep$1(router);
21216
+ var newRouter = cloneDeep(router);
21160
21217
  var btnAuth = JSON.parse(localStorage.getItem(getMenuAuthDataKey()) || '[]');
21161
21218
  var _deep = function deep(router) {
21162
21219
  if (router && Array.isArray(router)) {
@@ -40734,4 +40791,4 @@ var SystemLog = function SystemLog(_ref) {
40734
40791
  });
40735
40792
  };
40736
40793
 
40737
- export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, CustomSelector, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, index$8 as ExtendedCollapse, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, JsonQueryTable, ModalUtils, index$6 as MoreTreeTable, ParagraphCopier, PropertySelector, QueryMutipleInput, QueryMutipleSearchSelect, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, Section, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, SystemLog, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, _coverToParallel as coverToParallel, createUniqID, downloadExcel, ergodicMenuRoutes, formContainerAndItemLayout, _formatter as formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, paramsControl, parseWidth, precisionQuantity, processDetailButtonsVisible, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, textIcon, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
40794
+ export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, CustomSelector, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, index$8 as ExtendedCollapse, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, JsonQueryTable, ModalUtils, index$6 as MoreTreeTable, ParagraphCopier, PropertySelector, QueryMutipleInput, QueryMutipleSearchSelect, RenderCompItem, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, Section, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, SystemLog, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, _coverToParallel as coverToParallel, createUniqID, downloadExcel, ergodicMenuRoutes, formContainerAndItemLayout, _formatter as formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, paramsControl, parseWidth, precisionQuantity, processDetailButtonsVisible, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, textIcon, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
package/dist/index.js CHANGED
@@ -5766,6 +5766,29 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
5766
5766
  removeListener();
5767
5767
  };
5768
5768
  }, [isModalVisible]);
5769
+ var safeJSONParse = function safeJSONParse(str) {
5770
+ try {
5771
+ return JSON.parse(str);
5772
+ } catch (error) {
5773
+ console.warn('JSON解析失败:', error);
5774
+ return null;
5775
+ }
5776
+ };
5777
+ // 获取回显的value值 如果开启了搜索条件 则需要过滤掉搜索条件
5778
+ var getShowValue = function getShowValue(value) {
5779
+ var newValue = _.cloneDeep(value);
5780
+ if (selectProps.useSearchCondition && newValue) {
5781
+ // 回显的时候 把搜索项的内容去掉
5782
+ if (selectMode) {
5783
+ newValue = newValue.filter(function (item) {
5784
+ var parsedItem = safeJSONParse(decodeURIComponent(item));
5785
+ // 过滤掉JSON对象(搜索条件),保留非JSON数据(实际选择项)
5786
+ return !parsedItem || !(parsedItem && _typeof(parsedItem) === 'object' && !Array.isArray(parsedItem));
5787
+ });
5788
+ }
5789
+ }
5790
+ return newValue;
5791
+ };
5769
5792
  var showModal = function showModal() {
5770
5793
  if (sDisabled) return;
5771
5794
  setSelectOpen(false);
@@ -5775,12 +5798,13 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
5775
5798
  // 回显
5776
5799
  if (value) {
5777
5800
  if (selectMode) {
5778
- setSelectedRowKeys(labelInValue ? value.map(function (i) {
5801
+ var newValue = getShowValue(value);
5802
+ setSelectedRowKeys(labelInValue ? newValue.map(function (i) {
5779
5803
  return i.key;
5780
- }) : value);
5781
- setSelectedRows(labelInValue ? value.map(function (i) {
5804
+ }) : newValue);
5805
+ setSelectedRows(labelInValue ? newValue.map(function (i) {
5782
5806
  return _defineProperty(_defineProperty(_defineProperty({}, mappingValueField, i.key), "value", i.key), "text", i.label);
5783
- }) : value.map(function (i) {
5807
+ }) : newValue.map(function (i) {
5784
5808
  return _defineProperty(_defineProperty({}, mappingValueField, i), "value", i);
5785
5809
  }));
5786
5810
  setPopValue(labelInValue ? value.map(function (i) {
@@ -5817,7 +5841,24 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
5817
5841
  formaData(selectedValue, source);
5818
5842
  } else {
5819
5843
  var formatResult = selectMode ? [] : null;
5820
- onChange(formatResult, selectedValue);
5844
+ // 支持使用查询条件 筛选
5845
+ if (selectProps.useSearchCondition) {
5846
+ var formValue = form.getFieldsValue();
5847
+ // 一次性处理数据转换和过滤
5848
+ var processedFormValue = Object.keys(formValue).reduce(function (acc, key) {
5849
+ var value = formValue[key];
5850
+ // 过滤空值(确保trim函数存在)
5851
+ var trimmedValue = typeof value === 'string' ? value.trim() : value;
5852
+ if (trimmedValue && trimmedValue !== '') {
5853
+ acc[key] = trimmedValue;
5854
+ }
5855
+ return acc;
5856
+ }, {});
5857
+ var result = encodeURIComponent(JSON.stringify(processedFormValue));
5858
+ onChange(_.isEmpty(processedFormValue) ? formatResult : selectMode ? [result] : result, selectedValue);
5859
+ } else {
5860
+ onChange(formatResult, selectedValue);
5861
+ }
5821
5862
  }
5822
5863
  };
5823
5864
  var handleOk = function handleOk() {
@@ -5847,7 +5888,7 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
5847
5888
  setConfirmLoading(false);
5848
5889
  });
5849
5890
  } else {
5850
- handleSelectOver(popvalue);
5891
+ handleSelectOver(selectedRows.length ? popvalue : []);
5851
5892
  handleCancel();
5852
5893
  }
5853
5894
  };
@@ -6473,9 +6514,25 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
6473
6514
  confirmLoading: confirmLoading,
6474
6515
  onOk: handleOk,
6475
6516
  onCancel: handleCancel,
6476
- footer: selectMode || (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalRadioNeedFooter) ? [/*#__PURE__*/React__default['default'].createElement(antd.Button, {
6517
+ footer: selectMode || (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalRadioNeedFooter) ? [selectProps.useSearchCondition ? (/*#__PURE__*/React__default['default'].createElement("div", {
6518
+ key: "instructions",
6519
+ style: {
6520
+ position: 'absolute',
6521
+ width: 'calc(100% - 500px)',
6522
+ textAlign: 'left'
6523
+ }
6524
+ }, /*#__PURE__*/React__default['default'].createElement("div", null, "\u64CD\u4F5C\u8BF4\u660E\uFF1A\u7ED3\u679C\u96C6\u8FC7\u591A\u65F6\uFF0C\u53EF\u65E0\u9700\u9009\u62E9\u5177\u4F53\u6570\u636E\uFF0C\u7CFB\u7EDF\u5C06\u76F4\u63A5\u6309\u5DF2\u8BBE\u7B5B\u9009\u6761\u4EF6\u67E5\u8BE2"), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
6525
+ style: {
6526
+ marginTop: '3px',
6527
+ height: '22px'
6528
+ },
6529
+ value: value
6530
+ }))) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
6477
6531
  key: "back",
6478
- onClick: handleCancel
6532
+ onClick: handleCancel,
6533
+ style: {
6534
+ margin: selectProps.useSearchCondition ? '10px 0' : 0
6535
+ }
6479
6536
  }, "\u53D6\u6D88"), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
6480
6537
  key: "submit",
6481
6538
  type: "primary",
@@ -40789,6 +40846,7 @@ exports.ParagraphCopier = ParagraphCopier;
40789
40846
  exports.PropertySelector = PropertySelector;
40790
40847
  exports.QueryMutipleInput = QueryMutipleInput;
40791
40848
  exports.QueryMutipleSearchSelect = QueryMutipleSearchSelect;
40849
+ exports.RenderCompItem = RenderCompItem;
40792
40850
  exports.RuleComponent = RuleObjectComponent;
40793
40851
  exports.RuleSetter = index$7;
40794
40852
  exports.SearchSelect = SearchSelect;
@@ -0,0 +1,283 @@
1
+ # 按钮流程控制架构与使用说明(重构版)
2
+
3
+ ## 背景
4
+ 为统一“列表页与详情页按钮显隐”的流程控制,新增了一套基于本地数据源的轻量机制,支持按业务类型、单据状态与资源编码进行控制,同时不改变既有权限与显隐表达式的使用方式。
5
+
6
+ ## 架构概览
7
+ - 核心思想:数据先标注、视图只引用,不侵入既有权限与显隐逻辑
8
+ - 统一数据源:`BUSINESS_FLOW_BUTTONS`(本地存储)
9
+ - 列表页:在 `converter` 增强每条记录,生成 `__flowAllowedMap`;权限列在生成最终 `columns` 时对 `visible` 追加流程布尔条件
10
+ - 详情页:提供 `processDetailButtonsVisible(buttons, params)` 对外方法,融合原 `visible` 与流程允许判定后返回按钮数组
11
+ - 保护策略:未传 `tradeType` 或无匹配配置时不执行任何流程控制;只控制 `controlButtons` 范围内按钮
12
+
13
+ ## 核心数据源
14
+ - 本地存储键:`BUSINESS_FLOW_BUTTONS`
15
+ - 结构:
16
+ ```json
17
+ [
18
+ {
19
+ "tradeType": 180,
20
+ "controlButtons": ["DRP_Sale_Sales_submit", "DRP_Sale_Sales_examine"],
21
+ "config": [
22
+ { "fromStatus": 1, "buttons": ["DRP_Sale_Sales_submit"] },
23
+ { "fromStatus": 25, "buttons": ["DRP_Sale_Sales_examine", "DRP_Sale_Sales_back"] }
24
+ ]
25
+ }
26
+ ]
27
+ ```
28
+ - 说明:
29
+ - `tradeType`:业务类型
30
+ - `controlButtons`:参与流程控制的按钮编码集合(控制范围);不在此集合的按钮不受流程控制影响
31
+ - `config[].fromStatus`:状态值
32
+ - `config[].buttons`:该状态下允许显示的按钮编码集合
33
+
34
+ ## 控制原则
35
+ - 未传入 `tradeType` 时,不执行任何流程控制逻辑(列表与详情一致)
36
+ - 仅对 `controlButtons` 范围内的按钮做流程控制;其他按钮不改动
37
+ - 顶部按钮:在控制范围内,保留“所有状态允许集合”中的按钮
38
+ - 列权限按钮:在控制范围内,于既有 `visible` 表达式末尾追加 `&& record.__flowAllowedMap['<code>'] == true`
39
+ - 权限不重复判断:流程控制不改动既有权限过滤(仍使用 `authFn` / `shouldUseAuth`)
40
+
41
+ ## 列表页实现
42
+ - 文件:`src/components/Business/BsSulaQueryTable/index.tsx`
43
+ - 行状态读取:
44
+ - 属性:`statusFieldPath`(可选,支持嵌套路径,如 `saleInfo.tradeStatus`)
45
+ - 未配置时自动探测:`status`、`orderStatus`、`flowStatus`、`tradeStatus`、`currentStatus`
46
+ - 数据增强(convert):
47
+ - 覆盖 `remoteDataSource.converter` 为管道:原 `converter` → 增强阶段
48
+ - 增强阶段为每条记录生成 `__flowAllowedMap`:`{ [code]: true | undefined }`
49
+ - 仅在传入 `tradeType` 且存在非空 `controlButtons` 时启用
50
+ - 列权限按钮 `visible` 合并:
51
+ - 仅在传入 `tradeType` 且存在非空控制范围时,对 `isPermissionColumn: true` 且 `render` 为数组的列追加流程布尔条件
52
+ - 合并格式:
53
+ - 原:`#{record.tradeStatus == 25}`
54
+ - 新:`#{(record.tradeStatus == 25) && (record.__flowAllowedMap['DRP_Sale_Sales_examine'] == true)}`
55
+
56
+ ## 详情页实现
57
+ - 文件:`src/components/Business/DetailPageWrapper/index.tsx`
58
+ - 入口方法(对外):
59
+ ```ts
60
+ processDetailButtonsVisible(buttons: any[], params: any): any[]
61
+ // params: { tradeType: number; fromStatus: number; 以及按钮 visible 表达式使用到的上下文 }
62
+ ```
63
+ - 行为:
64
+ - 求值原 `visible` 表达式为布尔
65
+ - 仅在传入 `tradeType` 且按钮 `code ∈ controlButtons` 时,叠加“当前 fromStatus 的允许集合”判定
66
+ - 返回 `visible` 为最终布尔值的按钮数组,直接用于渲染
67
+
68
+ ## 调试日志(列表)
69
+ - 顶部按钮:`[FlowCtrl:top]`、`[FlowCtrl:top-element]`
70
+ - 数据增强:`__flowAllowedMap` 可在表格数据中查看
71
+ - 列合并:最终 `columns` 中的按钮 `visible` 可直接检视字符串是否追加流程条件
72
+
73
+ ## 快速使用示例
74
+ - 设置数据源:
75
+ ```js
76
+ localStorage.setItem('BUSINESS_FLOW_BUTTONS', JSON.stringify([
77
+ {
78
+ tradeType: 180,
79
+ controlButtons: ['DRP_Sale_Order_edit'],
80
+ config: [
81
+ { fromStatus: 1, buttons: ['DRP_Sale_Order_edit'] },
82
+ { fromStatus: 25, buttons: [] }
83
+ ]
84
+ }
85
+ ]));
86
+ ```
87
+ - 列表组件传参:
88
+ ```tsx
89
+ <BsSulaQueryTable
90
+ tradeType={180}
91
+ statusFieldPath="saleInfo.tradeStatus"
92
+ {...otherProps}
93
+ />
94
+ ```
95
+ - 列权限列按钮(最终 `columns`):
96
+ - 原:`visible: '#{record.tradeStatus == 25}'`
97
+ - 新:内部自动生成为 `#{(record.tradeStatus == 25) && (record.__flowAllowedMap['DRP_Sale_Sales_examine'] == true)}`(仅控制范围内按钮)
98
+ - 详情页使用:
99
+ ```ts
100
+ const processed = processDetailButtonsVisible(buttons, { tradeType, fromStatus, viewMode, tradeStatus, detail, orderNo });
101
+ ```
102
+
103
+ ## 列表跳转详情(携带查询参数)
104
+ - 示例(销售单):
105
+ ```tsx
106
+ <Button
107
+ onClick={() => {
108
+ history.push({
109
+ pathname: `/sales-management/sales-slip/view/${record.id}/${record.orderNo}`,
110
+ search: `?fromStatus=${record.saleInfo.tradeStatus}`,
111
+ });
112
+ }}
113
+ type="link"
114
+ >
115
+ {text}
116
+ </Button>
117
+ ```
118
+ - 说明:
119
+ - 详情页通过查询参数 `fromStatus` 获取当前单据状态;与 `processDetailButtonsVisible` 的 `fromStatus` 对齐
120
+ - 列表需设置 `statusFieldPath: 'saleInfo.tradeStatus'` 以生成 `__flowAllowedMap`
121
+ - 建议所有“查看详情”链接统一携带 `fromStatus`,保持列表与详情流程控制的一致性
122
+
123
+ ### 详情页读取 fromStatus 并使用
124
+ ```ts
125
+ import { useLocation } from 'umi';
126
+
127
+ const { search } = useLocation();
128
+ const qs = new URLSearchParams(search);
129
+ const fromStatus = Number(qs.get('fromStatus') || '');
130
+
131
+ // 与按钮可见性处理对齐
132
+ const processed = processDetailButtonsVisible(buttons, {
133
+ tradeType: 180,
134
+ fromStatus,
135
+ // 其他上下文
136
+ });
137
+
138
+ // 传入 DetailPageWrapper(如需)
139
+ <DetailPageWrapper
140
+ actionList={processed}
141
+ tradeType={180}
142
+ fromStatus={fromStatus}
143
+ />;
144
+ ```
145
+
146
+ ## 详情页示例(重构)
147
+ 两部分:下部按钮数组 + 顶部 DetailPageWrapper 按钮。
148
+
149
+ 1) 下部按钮数组(以部分按钮为例):
150
+ ```ts
151
+ actionsRender: processDetailButtonsVisible([
152
+ {
153
+ type: 'button',
154
+ props: { type: 'primary', children: '提交' },
155
+ code: 'DRP_Sale_Sales_submit',
156
+ visible: viewMode && tradeStatus == 1,
157
+ confirm: '是否提交该销售单?',
158
+ action: [ (ctx) => { /* 提交逻辑 */ } ],
159
+ },
160
+ {
161
+ type: 'button',
162
+ props: { type: 'primary', children: '驳回' },
163
+ code: 'DRP_Sale_Sales_back',
164
+ visible: viewMode && tradeStatus == 25,
165
+ confirm: '确认驳回 ?',
166
+ action: [ { url: `/drp-ops/new/tradeSubOrder/trigger?code=${orderNo}&event=7`, method: 'POST', converter: () => { message.success('驳回成功'); refreshForm(); } } ],
167
+ },
168
+ {
169
+ type: 'button',
170
+ props: { type: 'primary', children: '审核' },
171
+ code: 'DRP_Sale_Sales_examine',
172
+ visible: viewMode && tradeStatus == 25,
173
+ action: [ (ctx) => onAuditing(detail) ],
174
+ },
175
+ // ... 其他按钮
176
+ ], {
177
+ tradeType: 180,
178
+ fromStatus: tradeStatus,
179
+ viewMode,
180
+ tradeStatus,
181
+ detail,
182
+ orderNo,
183
+ modeType,
184
+ isProcessing,
185
+ hasDeletedOnce,
186
+ })
187
+ ```
188
+
189
+ 2) 顶部 DetailPageWrapper 按钮:
190
+ ```tsx
191
+ <DetailPageWrapper
192
+ title="详情页演示"
193
+ actionList={processDetailButtonsVisible(topButtons, { tradeType, fromStatus: tradeStatus, viewMode, tradeStatus })}
194
+ tradeType={180}
195
+ fromStatus={tradeStatus}
196
+ />
197
+ ```
198
+
199
+ ## 参数说明
200
+ - 列表组件:
201
+ - `tradeType: number`(必须)
202
+ - `statusFieldPath: string`(可选,嵌套路径,如 `saleInfo.tradeStatus`)
203
+ - 详情方法 `processDetailButtonsVisible(buttons, params)`:
204
+ - `params.tradeType: number`(必须)
205
+ - `params.fromStatus: number`(必须)
206
+ - 其他上下文:`viewMode`、`tradeStatus`、`detail`、`orderNo`、`modeType`、`isProcessing`、`hasDeletedOnce` 等按需传入
207
+ - visible 格式:
208
+ - 字符串表达式:`'#{viewMode && tradeStatus == 25}'`
209
+ - 布尔或未定义:`true/false/undefined`(未定义视为 `true`)
210
+
211
+ ## tradeType 映射
212
+ - 180:销售单
213
+ - 可按业务扩展其他类型(在 `BUSINESS_FLOW_BUTTONS` 中新增对应项)
214
+
215
+ ## 初始化数据结构示例
216
+ ```js
217
+ const flowConfig = [
218
+ {
219
+ tradeType: 180,
220
+ controlButtons: ['DRP_Sale_Order_edit'],
221
+ config: [
222
+ { fromStatus: 1, buttons: ['DRP_Sale_Order_edit'] },
223
+ { fromStatus: 25, buttons: [] },
224
+ ],
225
+ },
226
+ ];
227
+ localStorage.setItem('BUSINESS_FLOW_BUTTONS', JSON.stringify(flowConfig));
228
+ ```
229
+
230
+ ### 详情页示例(重构)
231
+ 两部分:下部按钮数组 + 顶部 DetailPageWrapper 按钮。
232
+
233
+ 1) 下部按钮数组(以提交/驳回为例):
234
+ ```ts
235
+ actionsRender: processDetailButtonsVisible([
236
+ {
237
+ type: 'button',
238
+ props: { type: 'primary', children: '提交' },
239
+ code: 'DRP_Sale_Sales_submit',
240
+ visible: viewMode && tradeStatus == 1,
241
+ confirm: '是否提交该销售单?',
242
+ action: [ (ctx) => { /* 业务处理 */ } ],
243
+ },
244
+ {
245
+ type: 'button',
246
+ props: { type: 'primary', children: '驳回' },
247
+ code: 'DRP_Sale_Sales_back',
248
+ visible: viewMode && tradeStatus == 25,
249
+ confirm: '确认驳回 ?',
250
+ action: [ { url: `/drp-ops/new/tradeSubOrder/trigger?code=${orderNo}&event=7`, method: 'POST', converter: () => { message.success('驳回成功'); refreshForm(); } } ],
251
+ },
252
+ // ... 其他按钮
253
+ ], {
254
+ tradeType: 180,
255
+ fromStatus: tradeStatus,
256
+ viewMode,
257
+ tradeStatus,
258
+ detail,
259
+ orderNo,
260
+ modeType,
261
+ isProcessing,
262
+ hasDeletedOnce,
263
+ })
264
+ ```
265
+
266
+ 2) 顶部 DetailPageWrapper 按钮(保持原传参方式):
267
+ ```tsx
268
+ <DetailPageWrapper
269
+ title="详情页演示"
270
+ actionList={processDetailButtonsVisible(topButtons, { tradeType, fromStatus: tradeStatus, viewMode, tradeStatus })}
271
+ tradeType={180}
272
+ fromStatus={tradeStatus}
273
+ />
274
+ ```
275
+
276
+ ## 常见问题
277
+ - 按钮未展示且不在控制范围:流程控制不会影响非控制按钮,请确认是否是权限或原 `visible` 条件拦截
278
+ - 顶部按钮未展示:仅在控制范围内按“所有状态允许集合”过滤;不在控制范围的顶栏按钮不受影响
279
+ - 未传 `tradeType`:不会执行任何流程控制(顶栏/列表/详情均一致)
280
+
281
+ ## 变更范围
282
+ - 列表:`BsSulaQueryTable/index.tsx`(convert增强、columns合并、顶部过滤与保护)
283
+ - 详情:`DetailPageWrapper/index.tsx`(流程过滤保护)与 `processDetailButtonsVisible` 方法导出
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.2.0-alpha.7",
3
+ "version": "4.2.0-alpha.9",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -4,7 +4,7 @@ import { useDebounceFn } from 'ahooks';
4
4
  import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag, Row, Col, Space, Tabs, Empty, DatePicker } from 'antd';
5
5
  import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
6
6
  import request from '@/utils/request';
7
- import _, { escapeRegExp, isNil, values } from "lodash"
7
+ import _, { escapeRegExp, isNil, values, cloneDeep, isEmpty } from "lodash"
8
8
  import './index.less';
9
9
  import { BusinessSearchSelect, QueryMutipleInput, QueryMutipleSearchSelect } from '@/index';
10
10
  import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder, getShowStr, handleTableColumns } from './utils';
@@ -362,6 +362,30 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
362
362
  };
363
363
  },[isModalVisible])
364
364
 
365
+ const safeJSONParse = (str: string) => {
366
+ try {
367
+ return JSON.parse(str);
368
+ } catch (error) {
369
+ console.warn('JSON解析失败:', error);
370
+ return null;
371
+ }
372
+ };
373
+
374
+ // 获取回显的value值 如果开启了搜索条件 则需要过滤掉搜索条件
375
+ const getShowValue = (value: any) => {
376
+ let newValue = cloneDeep(value);
377
+ if(selectProps.useSearchCondition && newValue) {
378
+ // 回显的时候 把搜索项的内容去掉
379
+ if(selectMode) {
380
+ newValue = newValue.filter((item: any) => {
381
+ const parsedItem = safeJSONParse(decodeURIComponent(item));
382
+ // 过滤掉JSON对象(搜索条件),保留非JSON数据(实际选择项)
383
+ return !parsedItem || !(parsedItem && typeof parsedItem === 'object' && !Array.isArray(parsedItem));
384
+ });
385
+ }
386
+ }
387
+ return newValue;
388
+ }
365
389
  const showModal = () => {
366
390
  if(sDisabled) return;
367
391
 
@@ -373,8 +397,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
373
397
  // 回显
374
398
  if (value) {
375
399
  if (selectMode) {
376
- setSelectedRowKeys(labelInValue ? value.map(i => i.key) : value)
377
- setSelectedRows(labelInValue ? value.map(i => ({ [mappingValueField]: i.key, value: i.key, text: i.label })) : value.map(i => ({ [mappingValueField]: i, value: i })))
400
+ const newValue = getShowValue(value);
401
+ setSelectedRowKeys(labelInValue ? newValue.map(i => i.key) : newValue)
402
+ setSelectedRows(labelInValue ? newValue.map(i => ({ [mappingValueField]: i.key, value: i.key, text: i.label })) : newValue.map(i => ({ [mappingValueField]: i, value: i })))
378
403
  setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
379
404
  setIndeterminate(!!value.length && value.length < itemsTotal);
380
405
  setCheckedAll(itemsTotal && value.length === itemsTotal);
@@ -395,8 +420,25 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
395
420
  setSelectDataSource(source,source?.length)
396
421
  formaData(selectedValue, source);
397
422
  } else {
398
- const formatResult = selectMode ? [] : null
399
- onChange(formatResult, selectedValue)
423
+ var formatResult = selectMode ? [] : null;
424
+ // 支持使用查询条件 筛选
425
+ if (selectProps.useSearchCondition) {
426
+ var formValue = form.getFieldsValue();
427
+ // 一次性处理数据转换和过滤
428
+ var processedFormValue = Object.keys(formValue).reduce(function (acc, key) {
429
+ var value = formValue[key];
430
+ // 过滤空值(确保trim函数存在)
431
+ var trimmedValue = typeof value === 'string' ? value.trim() : value;
432
+ if (trimmedValue && trimmedValue !== '') {
433
+ acc[key] = trimmedValue;
434
+ }
435
+ return acc;
436
+ }, {});
437
+ const result = encodeURIComponent(JSON.stringify(processedFormValue))
438
+ onChange(isEmpty(processedFormValue) ? formatResult : selectMode ? [result] : result, selectedValue);
439
+ } else {
440
+ onChange(formatResult, selectedValue);
441
+ }
400
442
  }
401
443
  }
402
444
  const handleOk = () => {
@@ -426,7 +468,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
426
468
  setConfirmLoading(false)
427
469
  })
428
470
  } else {
429
- handleSelectOver(popvalue)
471
+ handleSelectOver(selectedRows.length ? popvalue : [])
430
472
  handleCancel();
431
473
  }
432
474
  };
@@ -934,7 +976,20 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
934
976
  footer={
935
977
  selectMode || modalTableProps?.modalRadioNeedFooter
936
978
  ? [
937
- <Button key="back" onClick={handleCancel}>
979
+ selectProps.useSearchCondition ? (
980
+ <div
981
+ key="instructions"
982
+ style={{
983
+ position: 'absolute',
984
+ width: 'calc(100% - 500px)',
985
+ textAlign: 'left'
986
+ }}
987
+ >
988
+ <div>操作说明:结果集过多时,可无需选择具体数据,系统将直接按已设筛选条件查询</div>
989
+ <Input style={{marginTop: '3px', height: '22px'}} value={value} />
990
+ </div>
991
+ ) : <></>,
992
+ <Button key="back" onClick={handleCancel} style={{margin: selectProps.useSearchCondition ? '10px 0' : 0}}>
938
993
  取消
939
994
  </Button>,
940
995
  <Button
@@ -0,0 +1,189 @@
1
+ # RenderCompItem 组件说明文档
2
+
3
+ `RenderCompItem` 是一个通用的表单控件渲染组件,它根据传入的配置对象 (`ites`) 动态渲染不同类型的 Ant Design 表单组件或业务封装组件。
4
+
5
+ ## 1. 组件引入
6
+
7
+ ```typescript
8
+ import RenderCompItem from '@/components/Solution/RuleComponent/RenderCompItem';
9
+ ```
10
+
11
+ ## 2. Props 参数说明
12
+
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | `ites` | `object` | 是 | 核心配置对象,决定渲染什么组件(见下文详解) |
16
+ | `showValue` | `(code: string, type?: string) => any` | 是 | 获取组件当前值的回调函数 |
17
+ | `handleEdit` | `(code: string, value: any) => void` | 是 | 组件值发生变化时的回调函数 |
18
+ | `disabled` | `boolean` | 否 | 是否禁用组件 |
19
+ | `regularDataList` | `array` | 否 | 用于表达式 (`Formula`) 组件的数据源列表 |
20
+ | `others` | `object` | 否 | 扩展属性(目前主要用于 `CustomSelector` 的配置,**注意:源码中可能未正确解构此参数,使用自定义选择器时需检查**) |
21
+
22
+ ## 3. `ites` 配置详解
23
+
24
+ `ites` 对象通过 `inputType`、`valueType` 和 `choiceType` 的组合来决定渲染的具体组件。
25
+
26
+ ### 3.1 基础输入类 (`inputType: 10`)
27
+
28
+ 当 `inputType` 为 `10` 时,根据 `valueType` 区分:
29
+
30
+ | valueType | 组件类型 | 说明 | 对应 Antd 组件 |
31
+ | --- | --- | --- | --- |
32
+ | `21` | 文本输入 | 默认字符串输入 | `Input` |
33
+ | `22` | 小数输入 | 保留2位小数 | `InputNumber` |
34
+ | `23` | 整数输入 | 整数,无小数 | `InputNumber` |
35
+ | `24` | 布尔开关 | Switch 开关 | `Switch` |
36
+ | `32` | 日期时间 | 选择日期和时间 | `DatePicker` (showTime) |
37
+ | `40` | 时间范围 | 选择时间范围 | `RangePicker` (showTime) |
38
+ | `41` | 日期 | 仅选择日期 | `DatePicker` |
39
+
40
+ ### 3.2 选择类 (`inputType: 20 | 30`)
41
+
42
+ * `inputType: 20`: 单选
43
+ * `inputType: 30`: 多选
44
+
45
+ 根据 `choiceType` 区分具体业务组件:
46
+
47
+ | choiceType | 组件类型 | 说明 | 数据源/依赖 |
48
+ | --- | --- | --- | --- |
49
+ | `10` | 枚举选择 | 静态选项 | 需提供 `ites.enumeration` 对象 (key-value) |
50
+ | `20` | 数据字典 | 字典选择 | 需提供 `ites.dictionaryCode` |
51
+ | `110` | 物理仓 | 业务选择器 | `BusinessSearchSelect` (physicalWarehouse) |
52
+ | `120` | 逻辑仓 | 业务选择器 | `BusinessSearchSelect` (realWarehouse) |
53
+ | `130` | 虚拟仓 | 业务选择器 | `BusinessSearchSelect` (virtualWarehouse) |
54
+ | `140` | 渠道仓 | 业务选择器 | `BusinessSearchSelect` (channelWarehouse) |
55
+ | `150` | SPU | 业务选择器 | `BusinessSearchSelect` (spuCommodity) |
56
+ | `160` | SKU | 业务选择器 | `BusinessSearchSelect` (skuCommodity) |
57
+ | `190` | 省市区 | 级联选择 | `BsCascader` |
58
+ | `210` | 行政组织 | 树形选择 | `BusinessTreeSearchSelect` (department) |
59
+ | `220` | 采购组织 | 树形选择 | `BusinessTreeSearchSelect` (purchase-organization) |
60
+ | `230` | 销售组织 | 树形选择 | `BusinessTreeSearchSelect` (sales-organization) |
61
+ | `240` | 供应商 | 业务选择器 | `BusinessSearchSelect` (supplier2) |
62
+ | `250` | 客户 | 业务选择器 | `BusinessSearchSelect` (customer2) |
63
+ | `260` | 店铺 | 业务选择器 | `BusinessSearchSelect` (shopFile2) |
64
+ | `270` | 员工 | 业务选择器 | `BusinessSearchSelect` (employee2) |
65
+ | `280` | 库存组织 | 树形选择 | `BusinessTreeSearchSelect` (stock-organization) |
66
+ | `290` | 结算组织 | 树形选择 | `BusinessTreeSearchSelect` (settle-organization) |
67
+ | `310` / `311`| 配送方式 | 业务选择器 | `BusinessSearchSelect` (deliveryMode) |
68
+ | `360` | 角色 | 业务选择器 | `BusinessSearchSelect` (role) |
69
+ | `410` | 品牌 | 业务选择器 | `BusinessSearchSelect` (brand) |
70
+ | `420` | 类目 | 树形选择 | `BusinessTreeSearchSelect` (background-category) |
71
+ | `40` | 自定义 | 自定义组件 | `CustomSelector` (依赖 `others.customSelectorConfig`) |
72
+
73
+ ### 3.3 表达式 (`inputType: 40`)
74
+
75
+ 渲染 `Formula` 组件,用于配置计算公式。依赖 `regularDataList` 作为变量源。
76
+
77
+ ## 4. 使用示例
78
+
79
+ ```tsx
80
+ import React, { useState } from 'react';
81
+ import RenderCompItem from './RenderCompItem';
82
+
83
+ const Demo = () => {
84
+ const [formData, setFormData] = useState<any>({});
85
+
86
+ // 模拟数据回显
87
+ const showValue = (code: string) => {
88
+ return formData[code];
89
+ };
90
+
91
+ // 模拟数据更新
92
+ const handleEdit = (code: string, value: any) => {
93
+ console.log('Update:', code, value);
94
+ setFormData((prev: any) => ({ ...prev, [code]: value }));
95
+ };
96
+
97
+ // 配置项示例:文本输入
98
+ const inputConfig = {
99
+ code: 'userName',
100
+ inputType: 10,
101
+ valueType: 21,
102
+ defaultValue: '张三'
103
+ };
104
+
105
+ // 配置项示例:静态下拉选择
106
+ const selectConfig = {
107
+ code: 'status',
108
+ inputType: 20, // 单选
109
+ choiceType: 10, // 枚举
110
+ enumeration: {
111
+ '1': '启用',
112
+ '0': '禁用'
113
+ }
114
+ };
115
+
116
+ // 配置项示例:SKU 选择器 (多选)
117
+ const skuSelectConfig = {
118
+ code: 'skuCodes',
119
+ inputType: 30, // 多选
120
+ choiceType: 160, // SKU 选择器
121
+ };
122
+
123
+ // 配置项示例:数据字典选择 (单选)
124
+ const dictSelectConfig = {
125
+ code: 'warehouseType',
126
+ inputType: 20, // 单选
127
+ choiceType: 20, // 数据字典
128
+ dictionaryCode: 'SC0001' // 传入字典编码,组件会自动请求接口获取字典数据
129
+ };
130
+
131
+ return (
132
+ <div>
133
+ <div style={{ marginBottom: 20 }}>
134
+ <label>用户名:</label>
135
+ <RenderCompItem
136
+ ites={inputConfig}
137
+ showValue={showValue}
138
+ handleEdit={handleEdit}
139
+ regularDataList={[]}
140
+ />
141
+ </div>
142
+
143
+ <div style={{ marginBottom: 20 }}>
144
+ <label>状态:</label>
145
+ <RenderCompItem
146
+ ites={selectConfig}
147
+ showValue={showValue}
148
+ handleEdit={handleEdit}
149
+ regularDataList={[]}
150
+ />
151
+ </div>
152
+
153
+ <div style={{ marginBottom: 20 }}>
154
+ <label>商品SKU:</label>
155
+ <RenderCompItem
156
+ ites={skuSelectConfig}
157
+ showValue={showValue}
158
+ handleEdit={handleEdit}
159
+ regularDataList={[]}
160
+ />
161
+ </div>
162
+
163
+ <div>
164
+ <label>仓库类型(数据字典):</label>
165
+ <RenderCompItem
166
+ ites={dictSelectConfig}
167
+ showValue={showValue}
168
+ handleEdit={handleEdit}
169
+ regularDataList={[]}
170
+ />
171
+ </div>
172
+ </div>
173
+ );
174
+ };
175
+
176
+ export default Demo;
177
+ ```
178
+
179
+ ## 5. 依赖说明
180
+
181
+ 该组件依赖以下项目内部组件和库:
182
+ * `antd`
183
+ * `bssula` (request)
184
+ * `@/components/Functional/BsAntdSula` (BsCascader)
185
+ * `@/index` (BusinessSearchSelect, BusinessTreeSearchSelect)
186
+ * 内部组件: `./Formula`, `./InnerSelect`, `./CustomPlugin/CustomSelector`
187
+ * 工具函数: `../../../utils/utils`
188
+
189
+ 使用前请确保相关依赖已安装且路径正确。
package/src/index.ts CHANGED
@@ -43,6 +43,7 @@ export { default as EllipsisTooltip} from './components/Functional/EllipsisToolt
43
43
  export * from './components/Functional/BsAntdSula/index';
44
44
  export { default as RuleComponent} from './components/Solution/RuleComponent';
45
45
  export { default as RuleSetter} from './components/Solution/RuleSetter';
46
+ export { default as RenderCompItem} from './components/Solution/RuleComponent/RenderCompItem';
46
47
 
47
48
  export { processDetailButtonsVisible as processDetailButtonsVisible } from './components/Business/DetailPageWrapper';
48
49