@bit-sun/business-component 1.1.6 → 1.1.11

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.js CHANGED
@@ -1276,6 +1276,14 @@ function injectCSS(css) {
1276
1276
  return styleNode;
1277
1277
  }
1278
1278
  var containerCache = new Map();
1279
+
1280
+ function findExistNode(key) {
1281
+ var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1282
+ var container = getContainer(option);
1283
+ return Array.from(containerCache.get(container).children).find(function (node) {
1284
+ return node.tagName === 'STYLE' && node[MARK_KEY] === key;
1285
+ });
1286
+ }
1279
1287
  function updateCSS(css, key) {
1280
1288
  var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1281
1289
  var container = getContainer(option); // Get real parent
@@ -1287,9 +1295,7 @@ function updateCSS(css, key) {
1287
1295
  parentNode.removeChild(placeholderStyle);
1288
1296
  }
1289
1297
 
1290
- var existNode = Array.from(containerCache.get(container).children).find(function (node) {
1291
- return node.tagName === 'STYLE' && node[MARK_KEY] === key;
1292
- });
1298
+ var existNode = findExistNode(key, option);
1293
1299
 
1294
1300
  if (existNode) {
1295
1301
  var _option$csp3, _option$csp4;
@@ -2424,7 +2430,7 @@ function getStorageVale(storageKeyString) {
2424
2430
  return "";
2425
2431
  }
2426
2432
 
2427
- var css_248z$2 = ".search_select_show {\n display: flex;\n}\n.search_select_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.search_select_expand_button span {\n position: absolute;\n height: 20px;\n line-height: 14px;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.search_select_wrapper {\n position: relative;\n display: flex;\n min-height: 60vh;\n max-height: 60vh;\n overflow: hidden;\n font-size: 14px;\n}\n.search_select_wrapper_click_flag {\n position: absolute;\n z-index: 10;\n}\n.search_select_wrapper_click_flag_arrow {\n transform: rotate(0deg);\n transition: transform 0.5s;\n}\n.search_select_wrapper_click_flag_arrow_1 {\n transform: rotate(-180deg);\n transition: transform 0.5s;\n}\n.search_select_wrapper_left {\n width: 28%;\n overflow-y: hidden;\n transition: all 0.3s;\n margin-left: 20px;\n}\n.search_select_wrapper_left1 {\n width: 0;\n height: 0;\n transition: all 0.3s;\n display: none;\n}\n.search_select_wrapper_right {\n width: 70%;\n margin-left: 1%;\n}\n.search_select_wrapper_right1 {\n width: 100%;\n margin-left: 20px;\n}\n.search_select_wrapper_right,\n.search_select_wrapper _right1 {\n overflow-x: auto;\n}\n.search_select_wrapper .select_list_columns {\n width: 100%;\n height: calc(60vh - 60px);\n overflow-y: auto;\n border: 1px solid #d8d8d8;\n}\n.search_select_wrapper .select_list_columns_tips {\n background: #eee;\n padding: 6px 20px;\n margin-bottom: 10px;\n}\n.search_select_wrapper .select_list_columns_formItems {\n padding: 0 20px;\n}\n.search_select_wrapper .select_list_searchButton {\n display: flex;\n margin: 10px 0px;\n justify-content: flex-end;\n}\n.search_select_wrapper .select_list_button_space {\n margin-right: 10px;\n}\n.search_select_wrapper .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 34px;\n line-height: 32px;\n background-color: #eee;\n margin-bottom: 10px;\n padding: 0 12px;\n}\n.search_select_wrapper .select_list_selectAll {\n position: relative;\n top: -40px;\n left: 20px;\n width: 160px;\n}\n";
2433
+ var css_248z$2 = ".search_select_show {\n display: flex;\n}\n.search_select_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.search_select_expand_button span {\n position: absolute;\n height: 20px;\n line-height: 14px;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.search_select_wrapper {\n position: relative;\n display: flex;\n min-height: 60vh;\n max-height: 60vh;\n overflow: hidden;\n font-size: 14px;\n}\n.search_select_wrapper_click_flag {\n position: absolute;\n z-index: 10;\n}\n.search_select_wrapper_click_flag_arrow {\n transform: rotate(0deg);\n transition: transform 0.5s;\n}\n.search_select_wrapper_click_flag_arrow_1 {\n transform: rotate(-180deg);\n transition: transform 0.5s;\n}\n.search_select_wrapper_left {\n width: 28%;\n overflow-y: hidden;\n transition: all 0.3s;\n margin-left: 20px;\n}\n.search_select_wrapper_left1 {\n width: 0;\n height: 0;\n transition: all 0.3s;\n display: none;\n}\n.search_select_wrapper_right {\n width: 70%;\n margin-left: 1%;\n}\n.search_select_wrapper_right1 {\n width: 100%;\n margin-left: 20px;\n}\n.search_select_wrapper_right,\n.search_select_wrapper_right1 {\n overflow-x: auto;\n}\n.search_select_wrapper .select_list_columns {\n width: 100%;\n height: calc(60vh - 60px);\n overflow-y: auto;\n border: 1px solid #d8d8d8;\n}\n.search_select_wrapper .select_list_columns_tips {\n background: #eee;\n padding: 6px 20px;\n margin-bottom: 10px;\n}\n.search_select_wrapper .select_list_columns_formItems {\n padding: 0 20px;\n}\n.search_select_wrapper .select_list_searchButton {\n display: flex;\n margin: 10px 0px;\n justify-content: flex-end;\n}\n.search_select_wrapper .select_list_button_space {\n margin-right: 10px;\n}\n.search_select_wrapper .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 34px;\n line-height: 32px;\n background-color: #eee;\n margin-bottom: 10px;\n padding: 0 12px;\n}\n.search_select_wrapper .select_list_selectAll {\n position: relative;\n top: -40px;\n left: 20px;\n width: 160px;\n}\n";
2428
2434
  styleInject(css_248z$2);
2429
2435
 
2430
2436
  var Option = antd.Select.Option;
@@ -2440,6 +2446,20 @@ var SearchSelect = function SearchSelect(props) {
2440
2446
  labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
2441
2447
  requestConfig = props.requestConfig,
2442
2448
  ctx = props.ctx;
2449
+
2450
+ var _ref = requestConfig || {},
2451
+ url = _ref.url,
2452
+ otherParams = _ref.otherParams,
2453
+ isMap = _ref.isMap,
2454
+ fixedparameter = _ref.fixedparameter,
2455
+ fieldValToParam = _ref.fieldValToParam,
2456
+ _ref$mappingTextField = _ref.mappingTextField,
2457
+ mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2458
+ _ref$mappingValueFiel = _ref.mappingValueField,
2459
+ mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
2460
+ _ref$sourceName = _ref.sourceName,
2461
+ sourceName = _ref$sourceName === void 0 ? 'supplierCode' : _ref$sourceName;
2462
+
2443
2463
  var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
2444
2464
 
2445
2465
  var initVal = value || (selectMode ? [] : null);
@@ -2496,8 +2516,22 @@ var SearchSelect = function SearchSelect(props) {
2496
2516
  setPopValue = _useState14[1];
2497
2517
 
2498
2518
  var _useDebounceFn = ahooks.useDebounceFn(function () {
2519
+ // 优化搜索参数 支持传多个
2520
+ var searchParams = {};
2521
+
2522
+ if (typeof selectParamsKey === 'string') {
2523
+ searchParams = _defineProperty({}, selectParamsKey, searchValue);
2524
+ }
2525
+
2526
+ if (Array.isArray(selectParamsKey)) {
2527
+ selectParamsKey.forEach(function (i) {
2528
+ searchParams = _objectSpread2(_objectSpread2({}, searchParams), {}, _defineProperty({}, i, searchValue));
2529
+ });
2530
+ } // 防抖函数 待定
2531
+
2532
+
2499
2533
  // 防抖函数 待定
2500
- getData(_defineProperty({}, selectParamsKey, searchValue));
2534
+ getData(searchParams);
2501
2535
  }, {
2502
2536
  wait: 1000
2503
2537
  }),
@@ -2564,16 +2598,13 @@ var SearchSelect = function SearchSelect(props) {
2564
2598
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2565
2599
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2566
2600
  if (!requestConfig) return;
2567
- var url = requestConfig.url,
2568
- otherParams = requestConfig.otherParams,
2569
- isMap = requestConfig.isMap;
2570
2601
  setFetching(true); // 处理dependence参数
2571
2602
 
2572
2603
  var fixedParam = {};
2573
2604
 
2574
- if (requestConfig.fixedparameter && requestConfig.fieldValToParam && ctx) {
2575
- requestConfig.fixedparameter.forEach(function (item, index) {
2576
- var fixedParamVal = ctx.form.getFieldValue(requestConfig.fieldValToParam[index]);
2605
+ if (fixedparameter && fieldValToParam && ctx) {
2606
+ fixedparameter.forEach(function (item, index) {
2607
+ var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
2577
2608
 
2578
2609
  if (fixedParamVal) {
2579
2610
  fixedParam[item] = fixedParamVal;
@@ -2581,12 +2612,10 @@ var SearchSelect = function SearchSelect(props) {
2581
2612
  });
2582
2613
  }
2583
2614
 
2584
- var queryParams = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
2615
+ var queryParams = _objectSpread2(_objectSpread2(_objectSpread2({
2585
2616
  pageSize: pageSize,
2586
2617
  currentPage: currentPage
2587
- }, otherParams), fixedParam), params), {}, {
2588
- sorter: 'desc-createTime'
2589
- });
2618
+ }, otherParams), fixedParam), params);
2590
2619
 
2591
2620
  axios__default['default'].get("".concat(url, "?").concat(querystring.stringify(queryParams))).then(function (result) {
2592
2621
  setFetching(false);
@@ -2611,13 +2640,13 @@ var SearchSelect = function SearchSelect(props) {
2611
2640
  var keys = res.list ? 'list' : 'items';
2612
2641
  source = res ? res[keys] ? res[keys].map(function (item) {
2613
2642
  return _objectSpread2(_objectSpread2({}, item), {}, {
2614
- text: requestConfig.splicing ? "".concat(item[requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.mappingValueField], "-").concat(item[requestConfig.mappingTextField]) : item[requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.mappingTextField],
2615
- value: item[requestConfig.mappingValueField]
2643
+ text: item[mappingTextField],
2644
+ value: item[mappingValueField]
2616
2645
  });
2617
2646
  }) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
2618
2647
  return _objectSpread2(_objectSpread2({}, item), {}, {
2619
- text: requestConfig.splicing ? "".concat(item[requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.mappingValueField], "-").concat(item[requestConfig.mappingTextField]) : item[requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.mappingTextField],
2620
- value: item[requestConfig.mappingValueField]
2648
+ text: item[mappingTextField],
2649
+ value: item[mappingValueField]
2621
2650
  });
2622
2651
  })) : [];
2623
2652
  }
@@ -2627,7 +2656,7 @@ var SearchSelect = function SearchSelect(props) {
2627
2656
  if (type === 1) {
2628
2657
  var _ctx$form;
2629
2658
 
2630
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource('supplierCode', source);
2659
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(sourceName, source);
2631
2660
  setItems(source);
2632
2661
  setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
2633
2662
  } else {
@@ -2711,13 +2740,13 @@ var SearchSelect = function SearchSelect(props) {
2711
2740
  value: value.key,
2712
2741
  text: value.label
2713
2742
  }] : [{
2714
- value: value.key
2743
+ value: value
2715
2744
  }]);
2716
2745
  setPopValue(labelInValue ? [{
2717
2746
  value: value.key,
2718
2747
  text: value.label
2719
2748
  }] : [{
2720
- value: value.key
2749
+ value: value
2721
2750
  }]);
2722
2751
  }
2723
2752
  }
@@ -2780,10 +2809,11 @@ var SearchSelect = function SearchSelect(props) {
2780
2809
  };
2781
2810
 
2782
2811
  var handleTableChange = function handleTableChange(pagination) {
2783
- getData({
2812
+ var params = form.getFieldsValue();
2813
+ getData(_objectSpread2(_objectSpread2({}, params), {}, {
2784
2814
  pageSize: pagination.pageSize,
2785
2815
  currentPage: pagination.current
2786
- }, 2);
2816
+ }), 2);
2787
2817
  };
2788
2818
 
2789
2819
  var onChangeCheckAll = function onChangeCheckAll(e) {
@@ -2906,7 +2936,7 @@ var SearchSelect = function SearchSelect(props) {
2906
2936
  var formItem = function formItem(list) {
2907
2937
  if (isModalVisible && (list === null || list === void 0 ? void 0 : list.length)) {
2908
2938
  return list.map(function (i) {
2909
- var _i$field, _i$field3;
2939
+ var _i$field, _i$field3, _i$field5;
2910
2940
 
2911
2941
  if ((i === null || i === void 0 ? void 0 : i.type) === 'select' || (i === null || i === void 0 ? void 0 : (_i$field = i.field) === null || _i$field === void 0 ? void 0 : _i$field.type) === 'select') {
2912
2942
  var _i$field2, _i$initialSource;
@@ -2926,6 +2956,21 @@ var SearchSelect = function SearchSelect(props) {
2926
2956
  key: m.value
2927
2957
  }, m.text);
2928
2958
  }))));
2959
+ }
2960
+
2961
+ if ((i === null || i === void 0 ? void 0 : i.type) === 'treeSelect' || (i === null || i === void 0 ? void 0 : (_i$field3 = i.field) === null || _i$field3 === void 0 ? void 0 : _i$field3.type) === 'treeSelect') {
2962
+ var _i$field4;
2963
+
2964
+ return /*#__PURE__*/React__default['default'].createElement(antd.Form.Item, {
2965
+ name: i.name,
2966
+ label: i.label,
2967
+ key: i.name
2968
+ }, /*#__PURE__*/React__default['default'].createElement(antd.TreeSelect, _objectSpread2({
2969
+ style: {
2970
+ width: '100%'
2971
+ },
2972
+ placeholder: "\u8BF7\u9009\u62E9"
2973
+ }, i === null || i === void 0 ? void 0 : (_i$field4 = i.field) === null || _i$field4 === void 0 ? void 0 : _i$field4.props)));
2929
2974
  } // 默认type是input
2930
2975
 
2931
2976
 
@@ -2940,7 +2985,7 @@ var SearchSelect = function SearchSelect(props) {
2940
2985
  placeholder: "\u8BF7\u8F93\u5165",
2941
2986
  allowClear: true,
2942
2987
  maxLength: 100
2943
- }, i === null || i === void 0 ? void 0 : (_i$field3 = i.field) === null || _i$field3 === void 0 ? void 0 : _i$field3.props)));
2988
+ }, i === null || i === void 0 ? void 0 : (_i$field5 = i.field) === null || _i$field5 === void 0 ? void 0 : _i$field5.props)));
2944
2989
  });
2945
2990
  } else {
2946
2991
  return null;
@@ -3032,7 +3077,7 @@ var SearchSelect = function SearchSelect(props) {
3032
3077
  key: "submit",
3033
3078
  type: "primary",
3034
3079
  onClick: handleOk,
3035
- disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
3080
+ disabled: !tableData.length || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
3036
3081
  }, "\u786E\u5B9A")]
3037
3082
  }, /*#__PURE__*/React__default['default'].createElement("div", {
3038
3083
  className: 'search_select_wrapper'
@@ -3081,14 +3126,14 @@ var SearchSelect = function SearchSelect(props) {
3081
3126
  style: {
3082
3127
  color: 'rgba(127, 127, 127, 0.6470588235294118)'
3083
3128
  }
3084
- }, selectMode ? '勾选后点击确定按钮完成选择' : '双击数据行或单击按钮完成选择')), /*#__PURE__*/React__default['default'].createElement(antd.Table, {
3129
+ }, selectMode ? '勾选后点击确定按钮完成选择' : '双击数据行或点击单选图标完成选择')), /*#__PURE__*/React__default['default'].createElement(antd.Table, {
3085
3130
  size: 'small',
3086
3131
  rowSelection: rowSelection,
3087
3132
  columns: modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns,
3088
3133
  dataSource: tableData,
3089
3134
  pagination: tablePagination,
3090
3135
  onChange: handleTableChange,
3091
- rowKey: 'code',
3136
+ rowKey: mappingValueField,
3092
3137
  scroll: {
3093
3138
  x: modalTableProps.overScrollX || 'max-content',
3094
3139
  y: modalTableProps.overScrollY || null
@@ -3171,14 +3216,15 @@ var loadSelectSource = function loadSelectSource(url, params) {
3171
3216
  });
3172
3217
  };
3173
3218
 
3174
- function commonFun(type) {
3219
+ function commonFun(type, prefixUrl) {
3175
3220
  // 默认type === 'supplier' 供应商选择器
3176
3221
  var requestConfig = {
3177
- url: "/bop/api/supplier",
3178
- filter: 'qp-codeAndName-like',
3179
- otherParams: {},
3180
- mappingTextField: 'name',
3181
- mappingValueField: 'code'
3222
+ url: "".concat(prefixUrl.selectPrefix, "/supplier"),
3223
+ filter: 'qp-nameAndCode-like',
3224
+ otherParams: {
3225
+ sorter: 'desc-id'
3226
+ } // 默认参数
3227
+
3182
3228
  };
3183
3229
  /*
3184
3230
  * 处理 格式化下拉框数据源
@@ -3190,18 +3236,47 @@ function commonFun(type) {
3190
3236
  * */
3191
3237
 
3192
3238
  var formatSource = function formatSource(reData, position, changePosition, changeSearchForm) {
3193
- var _reData$position, _reData$position$data;
3239
+ var _reData$position;
3194
3240
 
3195
- var data = reData && ((_reData$position = reData[position]) === null || _reData$position === void 0 ? void 0 : (_reData$position$data = _reData$position.data) === null || _reData$position$data === void 0 ? void 0 : _reData$position$data.items) || [];
3196
- var formatData = (data === null || data === void 0 ? void 0 : data.length) ? data.map(function (v) {
3241
+ var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['code', 'name'];
3242
+ var data = reData && ((_reData$position = reData[position]) === null || _reData$position === void 0 ? void 0 : _reData$position.data);
3243
+ var list = Array.isArray(data) ? data : (data === null || data === void 0 ? void 0 : data.items) || (data === null || data === void 0 ? void 0 : data.list) || [];
3244
+ var formatData = (list === null || list === void 0 ? void 0 : list.length) ? list.map(function (v) {
3197
3245
  return {
3198
- text: v.name,
3199
- value: v.code
3246
+ text: v[resKeyValue[1]],
3247
+ value: v[resKeyValue[0]]
3200
3248
  };
3201
3249
  }) : [];
3202
3250
  changeSearchForm[changePosition] = _objectSpread2(_objectSpread2({}, changeSearchForm[changePosition]), {}, {
3203
3251
  initialSource: formatData
3204
3252
  });
3253
+ }; // 格式化树选择器数据源
3254
+
3255
+
3256
+ var mapSearchTree = function mapSearchTree(treeDataItem, resKeyValue) {
3257
+ var haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
3258
+ return {
3259
+ title: treeDataItem[resKeyValue[1]],
3260
+ key: treeDataItem[resKeyValue[0]],
3261
+ parentId: treeDataItem.parent,
3262
+ data: _objectSpread2({}, treeDataItem),
3263
+ isLeaf: !haveChildren,
3264
+ disabled: haveChildren,
3265
+ children: haveChildren ? treeDataItem.children.map(function (i) {
3266
+ return mapSearchTree(i, resKeyValue);
3267
+ }) : []
3268
+ };
3269
+ };
3270
+
3271
+ var formatTreeDataSource = function formatTreeDataSource(reData, position, changePosition, changeSearchForm) {
3272
+ var _reData$position2;
3273
+
3274
+ var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['id', 'name'];
3275
+ var data = reData && ((_reData$position2 = reData[position]) === null || _reData$position2 === void 0 ? void 0 : _reData$position2.data);
3276
+ var formatData = data && Array.isArray(data) && data.length && data.map(function (ites) {
3277
+ return mapSearchTree(ites, resKeyValue);
3278
+ }) || [];
3279
+ changeSearchForm[changePosition].field.props.treeData = formatData;
3205
3280
  };
3206
3281
 
3207
3282
  var tableSearchForm = [];
@@ -3231,23 +3306,7 @@ function commonFun(type) {
3231
3306
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3232
3307
  }
3233
3308
  }
3234
- } // remoteSource: {
3235
- // init: true, // 初始请求数据源
3236
- // url: '/bop/api/company',
3237
- // params: {
3238
- // pageSize: 5000,
3239
- // currentPage: 1,
3240
- // 'qp-companyType-eq': '30',
3241
- // },
3242
- // converter({ data }: any) {
3243
- // if (data?.items == undefined || data?.items?.length == 0) {
3244
- // return [];
3245
- // }
3246
- // return data?.items.map((v: any) => ({ text: v.name, value: v.code }));
3247
- // },
3248
- // },
3249
- // initialSource: [{ text: '英伦宝贝儿童用品有限公司', value: 'A0001' }]
3250
-
3309
+ }
3251
3310
  }, {
3252
3311
  name: 'qp-accountingCode-in',
3253
3312
  type: 'select',
@@ -3266,22 +3325,7 @@ function commonFun(type) {
3266
3325
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3267
3326
  }
3268
3327
  }
3269
- } // remoteSource: {
3270
- // init: true, // 初始请求数据源
3271
- // url: `/bop/api/accountingSubject`,
3272
- // params: {
3273
- // pageSize: 5000,
3274
- // currentPage: 1,
3275
- // },
3276
- // converter({ data }: any ) {
3277
- // if (data?.items == undefined || data?.items?.length == 0) {
3278
- // return [];
3279
- // }
3280
- // return data?.items.map((v: any) => ({ text: v.name, value: v.code }));
3281
- // },
3282
- // },
3283
- // initialSource: [{ text: '上海哲雄母婴用品有限公司', value: 'F002' }, { text: '上海英伦宝贝儿童用品有限公司', value: 'F001' }]
3284
-
3328
+ }
3285
3329
  }, {
3286
3330
  name: 'qp-companyCode-in',
3287
3331
  type: 'select',
@@ -3300,41 +3344,21 @@ function commonFun(type) {
3300
3344
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3301
3345
  }
3302
3346
  }
3303
- } // remoteSource: {
3304
- // init: true, // 初始请求数据源
3305
- // url: '/bop/api/company',
3306
- // params: {
3307
- // pageSize: 5000,
3308
- // currentPage: 1,
3309
- // 'qp-companyType-eq': '20',
3310
- // },
3311
- // converter: ({ data }: any) => {
3312
- // return data.items
3313
- // ? data.items.map((item: any) => {
3314
- // return {
3315
- // text: item.name,
3316
- // value: item.code,
3317
- // };
3318
- // })
3319
- // : [];
3320
- // },
3321
- // },
3322
- // initialSource: [{ text: '上海哲雄母婴用品有限公司', value: 'F002' }, { text: '上海英伦宝贝儿童用品有限公司', value: 'F001' }]
3323
-
3347
+ }
3324
3348
  }, {
3325
3349
  name: 'qp-sharingType-eq',
3326
3350
  type: 'select',
3327
3351
  label: '共享类型',
3328
3352
  initialSource: getDictionarySource('UC000013')
3329
3353
  }];
3330
- Promise.all([loadSelectSource('/bop/api/company', {
3354
+ Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
3331
3355
  pageSize: 5000,
3332
3356
  currentPage: 1,
3333
3357
  'qp-companyType-eq': '30'
3334
- }), loadSelectSource('/bop/api/accountingSubject', {
3358
+ }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
3335
3359
  pageSize: 5000,
3336
3360
  currentPage: 1
3337
- }), loadSelectSource('/bop/api/company', {
3361
+ }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
3338
3362
  pageSize: 5000,
3339
3363
  currentPage: 1,
3340
3364
  'qp-companyType-eq': '20'
@@ -3372,6 +3396,143 @@ function commonFun(type) {
3372
3396
  }]
3373
3397
  }; // 商品选择器
3374
3398
 
3399
+ if (type === 'skuCommodity') {
3400
+ requestConfig = {
3401
+ url: "".concat(prefixUrl.selectPrefix, "/sku"),
3402
+ filter: 'qp-nameAndCode-like',
3403
+ mappingTextField: 'name',
3404
+ mappingValueField: 'skuCode',
3405
+ otherParams: {
3406
+ 'qp-approveStatus-eq': 2,
3407
+ sorter: 'desc-id'
3408
+ },
3409
+ sourceName: 'skuCode'
3410
+ };
3411
+ tableSearchForm = [{
3412
+ name: 'qp-name-like',
3413
+ label: 'SKU名称'
3414
+ }, {
3415
+ name: 'qp-skuCode-like',
3416
+ label: 'SKU编码'
3417
+ }, {
3418
+ name: 'qp-barCode-like',
3419
+ label: '条形码'
3420
+ }, {
3421
+ name: 'qp-itemName-like',
3422
+ label: '所属SPU名称'
3423
+ }, {
3424
+ name: 'qp-itemCode-like',
3425
+ label: '所属SPU编码'
3426
+ }, {
3427
+ name: 'qp-brandId-in',
3428
+ type: 'select',
3429
+ label: '品牌',
3430
+ field: {
3431
+ type: 'select',
3432
+ props: {
3433
+ mode: 'multiple',
3434
+ notFoundContent: '暂无数据',
3435
+ allowClear: true,
3436
+ showSearch: true,
3437
+ showArrow: true,
3438
+ maxTagCount: 1,
3439
+ optionFilterProp: 'children',
3440
+ filterOption: function filterOption(input, option) {
3441
+ return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3442
+ }
3443
+ }
3444
+ }
3445
+ }, {
3446
+ name: 'qp-categoryId-in',
3447
+ type: 'treeSelect',
3448
+ label: '类目',
3449
+ field: {
3450
+ type: 'treeSelect',
3451
+ props: {
3452
+ treeData: [],
3453
+ treeCheckable: true,
3454
+ showSearch: true,
3455
+ allowClear: true,
3456
+ showArrow: true,
3457
+ treeNodeFilterProp: 'title',
3458
+ treeDefaultExpandAll: true,
3459
+ maxTagCount: 1,
3460
+ placeholder: '请选择',
3461
+ style: {
3462
+ width: '100%'
3463
+ },
3464
+ dropdownStyle: {
3465
+ maxHeight: 400,
3466
+ maxWidth: 100,
3467
+ overflow: 'auto'
3468
+ }
3469
+ }
3470
+ }
3471
+ }, {
3472
+ name: 'qp-classId-in',
3473
+ type: 'select',
3474
+ label: '品类',
3475
+ field: {
3476
+ type: 'select',
3477
+ props: {
3478
+ mode: 'multiple',
3479
+ notFoundContent: '暂无数据',
3480
+ allowClear: true,
3481
+ showSearch: true,
3482
+ showArrow: true,
3483
+ maxTagCount: 1,
3484
+ optionFilterProp: 'children',
3485
+ filterOption: function filterOption(input, option) {
3486
+ return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3487
+ }
3488
+ }
3489
+ }
3490
+ }];
3491
+ Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/brand/queryBrandList"), {
3492
+ pageSize: 5000,
3493
+ currentPage: 1
3494
+ }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/category/queryCategoryTree"), {
3495
+ pageSize: 5000,
3496
+ currentPage: 1
3497
+ }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/class/withProperty"), {
3498
+ pageSize: 5000,
3499
+ currentPage: 1
3500
+ })]).then(function (x) {
3501
+ formatSource(x, 0, 5, tableSearchForm, ['id', 'name']);
3502
+ formatTreeDataSource(x, 1, 6, tableSearchForm);
3503
+ formatSource(x, 2, 7, tableSearchForm, ['id', 'name']);
3504
+ });
3505
+ modalTableProps = {
3506
+ modalTableTitle: '选择SKU',
3507
+ tableSearchForm: tableSearchForm,
3508
+ tableColumns: [{
3509
+ title: 'SKU编码',
3510
+ dataIndex: 'skuCode'
3511
+ }, {
3512
+ title: 'SKU名称',
3513
+ dataIndex: 'name'
3514
+ }, {
3515
+ title: '所属SPU',
3516
+ dataIndex: 'itemName'
3517
+ }, {
3518
+ title: '规格',
3519
+ dataIndex: 'skuSpec'
3520
+ }, {
3521
+ title: '类目',
3522
+ dataIndex: 'categoryName'
3523
+ }, {
3524
+ title: '品类',
3525
+ dataIndex: 'className'
3526
+ }, {
3527
+ title: '品牌',
3528
+ dataIndex: 'brandName'
3529
+ }, {
3530
+ title: '条形码',
3531
+ dataIndex: 'barCode'
3532
+ }]
3533
+ };
3534
+ } // 仓库选择器
3535
+
3375
3536
  return {
3376
3537
  modalTableProps: modalTableProps,
3377
3538
  requestConfig: requestConfig
@@ -3379,9 +3540,13 @@ function commonFun(type) {
3379
3540
  }
3380
3541
 
3381
3542
  var BusinessSearchSelect = function BusinessSearchSelect(props) {
3382
- var businessType = (props === null || props === void 0 ? void 0 : props.SelectBusinessType) || 'supplier';
3543
+ var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
3544
+ var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
3545
+ selectPrefix: '/bop/api',
3546
+ formSelectFix: '/bop/api'
3547
+ };
3383
3548
 
3384
- var _commonFun = commonFun(businessType),
3549
+ var _commonFun = commonFun(businessType, prefixUrl),
3385
3550
  requestConfig = _commonFun.requestConfig,
3386
3551
  modalTableProps = _commonFun.modalTableProps;
3387
3552
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.1.6",
3
+ "version": "1.1.11",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -47,4 +47,4 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  }
50
- }
50
+ }
@@ -4,9 +4,10 @@ import SearchSelect from '../index';
4
4
 
5
5
 
6
6
  const BusinessSearchSelect = (props: any) => {
7
- const businessType = props?.SelectBusinessType || 'supplier';
7
+ const businessType = props?.selectBusinessType || 'supplier';
8
+ const prefixUrl = props?.prefixUrl || { selectPrefix: '/bop/api', formSelectFix: '/bop/api' };
8
9
 
9
- const { requestConfig, modalTableProps } = commonFun(businessType);
10
+ const { requestConfig, modalTableProps } = commonFun(businessType, prefixUrl);
10
11
 
11
12
  const currentProps = {
12
13
  requestConfig,