@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/.gitlab-ci.yml +174 -0
- package/dist/components/SearchSelect/business/BusinessUtils.d.ts +4 -4
- package/dist/index.esm.js +265 -100
- package/dist/index.js +264 -99
- package/package.json +2 -2
- package/src/components/SearchSelect/business/BusinessSearchSelect.tsx +3 -2
- package/src/components/SearchSelect/business/BusinessUtils.ts +162 -71
- package/src/components/SearchSelect/business/index.md +43 -2
- package/src/components/SearchSelect/index.less +1 -1
- package/src/components/SearchSelect/index.md +3 -3
- package/src/components/SearchSelect/index.tsx +42 -26
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import React, { createContext, useContext, useEffect, forwardRef, createElement, useState } from 'react';
|
|
3
|
-
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table } from 'antd';
|
|
3
|
+
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect } from 'antd';
|
|
4
4
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import _ from 'loadsh';
|
|
@@ -1265,6 +1265,14 @@ function injectCSS(css) {
|
|
|
1265
1265
|
return styleNode;
|
|
1266
1266
|
}
|
|
1267
1267
|
var containerCache = new Map();
|
|
1268
|
+
|
|
1269
|
+
function findExistNode(key) {
|
|
1270
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1271
|
+
var container = getContainer(option);
|
|
1272
|
+
return Array.from(containerCache.get(container).children).find(function (node) {
|
|
1273
|
+
return node.tagName === 'STYLE' && node[MARK_KEY] === key;
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1268
1276
|
function updateCSS(css, key) {
|
|
1269
1277
|
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1270
1278
|
var container = getContainer(option); // Get real parent
|
|
@@ -1276,9 +1284,7 @@ function updateCSS(css, key) {
|
|
|
1276
1284
|
parentNode.removeChild(placeholderStyle);
|
|
1277
1285
|
}
|
|
1278
1286
|
|
|
1279
|
-
var existNode =
|
|
1280
|
-
return node.tagName === 'STYLE' && node[MARK_KEY] === key;
|
|
1281
|
-
});
|
|
1287
|
+
var existNode = findExistNode(key, option);
|
|
1282
1288
|
|
|
1283
1289
|
if (existNode) {
|
|
1284
1290
|
var _option$csp3, _option$csp4;
|
|
@@ -2413,7 +2419,7 @@ function getStorageVale(storageKeyString) {
|
|
|
2413
2419
|
return "";
|
|
2414
2420
|
}
|
|
2415
2421
|
|
|
2416
|
-
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.
|
|
2422
|
+
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";
|
|
2417
2423
|
styleInject(css_248z$2);
|
|
2418
2424
|
|
|
2419
2425
|
var Option = Select.Option;
|
|
@@ -2429,6 +2435,20 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2429
2435
|
labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
|
|
2430
2436
|
requestConfig = props.requestConfig,
|
|
2431
2437
|
ctx = props.ctx;
|
|
2438
|
+
|
|
2439
|
+
var _ref = requestConfig || {},
|
|
2440
|
+
url = _ref.url,
|
|
2441
|
+
otherParams = _ref.otherParams,
|
|
2442
|
+
isMap = _ref.isMap,
|
|
2443
|
+
fixedparameter = _ref.fixedparameter,
|
|
2444
|
+
fieldValToParam = _ref.fieldValToParam,
|
|
2445
|
+
_ref$mappingTextField = _ref.mappingTextField,
|
|
2446
|
+
mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
|
|
2447
|
+
_ref$mappingValueFiel = _ref.mappingValueField,
|
|
2448
|
+
mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
|
|
2449
|
+
_ref$sourceName = _ref.sourceName,
|
|
2450
|
+
sourceName = _ref$sourceName === void 0 ? 'supplierCode' : _ref$sourceName;
|
|
2451
|
+
|
|
2432
2452
|
var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
2433
2453
|
|
|
2434
2454
|
var initVal = value || (selectMode ? [] : null);
|
|
@@ -2485,8 +2505,22 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2485
2505
|
setPopValue = _useState14[1];
|
|
2486
2506
|
|
|
2487
2507
|
var _useDebounceFn = useDebounceFn(function () {
|
|
2508
|
+
// 优化搜索参数 支持传多个
|
|
2509
|
+
var searchParams = {};
|
|
2510
|
+
|
|
2511
|
+
if (typeof selectParamsKey === 'string') {
|
|
2512
|
+
searchParams = _defineProperty({}, selectParamsKey, searchValue);
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
if (Array.isArray(selectParamsKey)) {
|
|
2516
|
+
selectParamsKey.forEach(function (i) {
|
|
2517
|
+
searchParams = _objectSpread2(_objectSpread2({}, searchParams), {}, _defineProperty({}, i, searchValue));
|
|
2518
|
+
});
|
|
2519
|
+
} // 防抖函数 待定
|
|
2520
|
+
|
|
2521
|
+
|
|
2488
2522
|
// 防抖函数 待定
|
|
2489
|
-
getData(
|
|
2523
|
+
getData(searchParams);
|
|
2490
2524
|
}, {
|
|
2491
2525
|
wait: 1000
|
|
2492
2526
|
}),
|
|
@@ -2553,16 +2587,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2553
2587
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2554
2588
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
2555
2589
|
if (!requestConfig) return;
|
|
2556
|
-
var url = requestConfig.url,
|
|
2557
|
-
otherParams = requestConfig.otherParams,
|
|
2558
|
-
isMap = requestConfig.isMap;
|
|
2559
2590
|
setFetching(true); // 处理dependence参数
|
|
2560
2591
|
|
|
2561
2592
|
var fixedParam = {};
|
|
2562
2593
|
|
|
2563
|
-
if (
|
|
2564
|
-
|
|
2565
|
-
var fixedParamVal = ctx.form.getFieldValue(
|
|
2594
|
+
if (fixedparameter && fieldValToParam && ctx) {
|
|
2595
|
+
fixedparameter.forEach(function (item, index) {
|
|
2596
|
+
var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
2566
2597
|
|
|
2567
2598
|
if (fixedParamVal) {
|
|
2568
2599
|
fixedParam[item] = fixedParamVal;
|
|
@@ -2570,12 +2601,10 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2570
2601
|
});
|
|
2571
2602
|
}
|
|
2572
2603
|
|
|
2573
|
-
var queryParams = _objectSpread2(_objectSpread2(_objectSpread2(
|
|
2604
|
+
var queryParams = _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2574
2605
|
pageSize: pageSize,
|
|
2575
2606
|
currentPage: currentPage
|
|
2576
|
-
}, otherParams), fixedParam), params)
|
|
2577
|
-
sorter: 'desc-createTime'
|
|
2578
|
-
});
|
|
2607
|
+
}, otherParams), fixedParam), params);
|
|
2579
2608
|
|
|
2580
2609
|
axios.get("".concat(url, "?").concat(stringify(queryParams))).then(function (result) {
|
|
2581
2610
|
setFetching(false);
|
|
@@ -2600,13 +2629,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2600
2629
|
var keys = res.list ? 'list' : 'items';
|
|
2601
2630
|
source = res ? res[keys] ? res[keys].map(function (item) {
|
|
2602
2631
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2603
|
-
text:
|
|
2604
|
-
value: item[
|
|
2632
|
+
text: item[mappingTextField],
|
|
2633
|
+
value: item[mappingValueField]
|
|
2605
2634
|
});
|
|
2606
2635
|
}) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
|
|
2607
2636
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2608
|
-
text:
|
|
2609
|
-
value: item[
|
|
2637
|
+
text: item[mappingTextField],
|
|
2638
|
+
value: item[mappingValueField]
|
|
2610
2639
|
});
|
|
2611
2640
|
})) : [];
|
|
2612
2641
|
}
|
|
@@ -2616,7 +2645,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2616
2645
|
if (type === 1) {
|
|
2617
2646
|
var _ctx$form;
|
|
2618
2647
|
|
|
2619
|
-
ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(
|
|
2648
|
+
ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(sourceName, source);
|
|
2620
2649
|
setItems(source);
|
|
2621
2650
|
setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
|
|
2622
2651
|
} else {
|
|
@@ -2700,13 +2729,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2700
2729
|
value: value.key,
|
|
2701
2730
|
text: value.label
|
|
2702
2731
|
}] : [{
|
|
2703
|
-
value: value
|
|
2732
|
+
value: value
|
|
2704
2733
|
}]);
|
|
2705
2734
|
setPopValue(labelInValue ? [{
|
|
2706
2735
|
value: value.key,
|
|
2707
2736
|
text: value.label
|
|
2708
2737
|
}] : [{
|
|
2709
|
-
value: value
|
|
2738
|
+
value: value
|
|
2710
2739
|
}]);
|
|
2711
2740
|
}
|
|
2712
2741
|
}
|
|
@@ -2769,10 +2798,11 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2769
2798
|
};
|
|
2770
2799
|
|
|
2771
2800
|
var handleTableChange = function handleTableChange(pagination) {
|
|
2772
|
-
|
|
2801
|
+
var params = form.getFieldsValue();
|
|
2802
|
+
getData(_objectSpread2(_objectSpread2({}, params), {}, {
|
|
2773
2803
|
pageSize: pagination.pageSize,
|
|
2774
2804
|
currentPage: pagination.current
|
|
2775
|
-
}, 2);
|
|
2805
|
+
}), 2);
|
|
2776
2806
|
};
|
|
2777
2807
|
|
|
2778
2808
|
var onChangeCheckAll = function onChangeCheckAll(e) {
|
|
@@ -2895,7 +2925,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2895
2925
|
var formItem = function formItem(list) {
|
|
2896
2926
|
if (isModalVisible && (list === null || list === void 0 ? void 0 : list.length)) {
|
|
2897
2927
|
return list.map(function (i) {
|
|
2898
|
-
var _i$field, _i$field3;
|
|
2928
|
+
var _i$field, _i$field3, _i$field5;
|
|
2899
2929
|
|
|
2900
2930
|
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') {
|
|
2901
2931
|
var _i$field2, _i$initialSource;
|
|
@@ -2915,6 +2945,21 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2915
2945
|
key: m.value
|
|
2916
2946
|
}, m.text);
|
|
2917
2947
|
}))));
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
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') {
|
|
2951
|
+
var _i$field4;
|
|
2952
|
+
|
|
2953
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
2954
|
+
name: i.name,
|
|
2955
|
+
label: i.label,
|
|
2956
|
+
key: i.name
|
|
2957
|
+
}, /*#__PURE__*/React.createElement(TreeSelect, _objectSpread2({
|
|
2958
|
+
style: {
|
|
2959
|
+
width: '100%'
|
|
2960
|
+
},
|
|
2961
|
+
placeholder: "\u8BF7\u9009\u62E9"
|
|
2962
|
+
}, i === null || i === void 0 ? void 0 : (_i$field4 = i.field) === null || _i$field4 === void 0 ? void 0 : _i$field4.props)));
|
|
2918
2963
|
} // 默认type是input
|
|
2919
2964
|
|
|
2920
2965
|
|
|
@@ -2929,7 +2974,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
2929
2974
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
2930
2975
|
allowClear: true,
|
|
2931
2976
|
maxLength: 100
|
|
2932
|
-
}, i === null || i === void 0 ? void 0 : (_i$
|
|
2977
|
+
}, i === null || i === void 0 ? void 0 : (_i$field5 = i.field) === null || _i$field5 === void 0 ? void 0 : _i$field5.props)));
|
|
2933
2978
|
});
|
|
2934
2979
|
} else {
|
|
2935
2980
|
return null;
|
|
@@ -3021,7 +3066,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3021
3066
|
key: "submit",
|
|
3022
3067
|
type: "primary",
|
|
3023
3068
|
onClick: handleOk,
|
|
3024
|
-
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
3069
|
+
disabled: !tableData.length || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
3025
3070
|
}, "\u786E\u5B9A")]
|
|
3026
3071
|
}, /*#__PURE__*/React.createElement("div", {
|
|
3027
3072
|
className: 'search_select_wrapper'
|
|
@@ -3070,14 +3115,14 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3070
3115
|
style: {
|
|
3071
3116
|
color: 'rgba(127, 127, 127, 0.6470588235294118)'
|
|
3072
3117
|
}
|
|
3073
|
-
}, selectMode ? '勾选后点击确定按钮完成选择' : '
|
|
3118
|
+
}, selectMode ? '勾选后点击确定按钮完成选择' : '双击数据行或点击单选图标完成选择')), /*#__PURE__*/React.createElement(Table, {
|
|
3074
3119
|
size: 'small',
|
|
3075
3120
|
rowSelection: rowSelection,
|
|
3076
3121
|
columns: modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns,
|
|
3077
3122
|
dataSource: tableData,
|
|
3078
3123
|
pagination: tablePagination,
|
|
3079
3124
|
onChange: handleTableChange,
|
|
3080
|
-
rowKey:
|
|
3125
|
+
rowKey: mappingValueField,
|
|
3081
3126
|
scroll: {
|
|
3082
3127
|
x: modalTableProps.overScrollX || 'max-content',
|
|
3083
3128
|
y: modalTableProps.overScrollY || null
|
|
@@ -3160,14 +3205,15 @@ var loadSelectSource = function loadSelectSource(url, params) {
|
|
|
3160
3205
|
});
|
|
3161
3206
|
};
|
|
3162
3207
|
|
|
3163
|
-
function commonFun(type) {
|
|
3208
|
+
function commonFun(type, prefixUrl) {
|
|
3164
3209
|
// 默认type === 'supplier' 供应商选择器
|
|
3165
3210
|
var requestConfig = {
|
|
3166
|
-
url: "/
|
|
3167
|
-
filter: 'qp-
|
|
3168
|
-
otherParams: {
|
|
3169
|
-
|
|
3170
|
-
|
|
3211
|
+
url: "".concat(prefixUrl.selectPrefix, "/supplier"),
|
|
3212
|
+
filter: 'qp-nameAndCode-like',
|
|
3213
|
+
otherParams: {
|
|
3214
|
+
sorter: 'desc-id'
|
|
3215
|
+
} // 默认参数
|
|
3216
|
+
|
|
3171
3217
|
};
|
|
3172
3218
|
/*
|
|
3173
3219
|
* 处理 格式化下拉框数据源
|
|
@@ -3179,18 +3225,47 @@ function commonFun(type) {
|
|
|
3179
3225
|
* */
|
|
3180
3226
|
|
|
3181
3227
|
var formatSource = function formatSource(reData, position, changePosition, changeSearchForm) {
|
|
3182
|
-
var _reData$position
|
|
3228
|
+
var _reData$position;
|
|
3183
3229
|
|
|
3184
|
-
var
|
|
3185
|
-
var
|
|
3230
|
+
var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['code', 'name'];
|
|
3231
|
+
var data = reData && ((_reData$position = reData[position]) === null || _reData$position === void 0 ? void 0 : _reData$position.data);
|
|
3232
|
+
var list = Array.isArray(data) ? data : (data === null || data === void 0 ? void 0 : data.items) || (data === null || data === void 0 ? void 0 : data.list) || [];
|
|
3233
|
+
var formatData = (list === null || list === void 0 ? void 0 : list.length) ? list.map(function (v) {
|
|
3186
3234
|
return {
|
|
3187
|
-
text: v
|
|
3188
|
-
value: v
|
|
3235
|
+
text: v[resKeyValue[1]],
|
|
3236
|
+
value: v[resKeyValue[0]]
|
|
3189
3237
|
};
|
|
3190
3238
|
}) : [];
|
|
3191
3239
|
changeSearchForm[changePosition] = _objectSpread2(_objectSpread2({}, changeSearchForm[changePosition]), {}, {
|
|
3192
3240
|
initialSource: formatData
|
|
3193
3241
|
});
|
|
3242
|
+
}; // 格式化树选择器数据源
|
|
3243
|
+
|
|
3244
|
+
|
|
3245
|
+
var mapSearchTree = function mapSearchTree(treeDataItem, resKeyValue) {
|
|
3246
|
+
var haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
|
|
3247
|
+
return {
|
|
3248
|
+
title: treeDataItem[resKeyValue[1]],
|
|
3249
|
+
key: treeDataItem[resKeyValue[0]],
|
|
3250
|
+
parentId: treeDataItem.parent,
|
|
3251
|
+
data: _objectSpread2({}, treeDataItem),
|
|
3252
|
+
isLeaf: !haveChildren,
|
|
3253
|
+
disabled: haveChildren,
|
|
3254
|
+
children: haveChildren ? treeDataItem.children.map(function (i) {
|
|
3255
|
+
return mapSearchTree(i, resKeyValue);
|
|
3256
|
+
}) : []
|
|
3257
|
+
};
|
|
3258
|
+
};
|
|
3259
|
+
|
|
3260
|
+
var formatTreeDataSource = function formatTreeDataSource(reData, position, changePosition, changeSearchForm) {
|
|
3261
|
+
var _reData$position2;
|
|
3262
|
+
|
|
3263
|
+
var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['id', 'name'];
|
|
3264
|
+
var data = reData && ((_reData$position2 = reData[position]) === null || _reData$position2 === void 0 ? void 0 : _reData$position2.data);
|
|
3265
|
+
var formatData = data && Array.isArray(data) && data.length && data.map(function (ites) {
|
|
3266
|
+
return mapSearchTree(ites, resKeyValue);
|
|
3267
|
+
}) || [];
|
|
3268
|
+
changeSearchForm[changePosition].field.props.treeData = formatData;
|
|
3194
3269
|
};
|
|
3195
3270
|
|
|
3196
3271
|
var tableSearchForm = [];
|
|
@@ -3220,23 +3295,7 @@ function commonFun(type) {
|
|
|
3220
3295
|
return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
3221
3296
|
}
|
|
3222
3297
|
}
|
|
3223
|
-
}
|
|
3224
|
-
// init: true, // 初始请求数据源
|
|
3225
|
-
// url: '/bop/api/company',
|
|
3226
|
-
// params: {
|
|
3227
|
-
// pageSize: 5000,
|
|
3228
|
-
// currentPage: 1,
|
|
3229
|
-
// 'qp-companyType-eq': '30',
|
|
3230
|
-
// },
|
|
3231
|
-
// converter({ data }: any) {
|
|
3232
|
-
// if (data?.items == undefined || data?.items?.length == 0) {
|
|
3233
|
-
// return [];
|
|
3234
|
-
// }
|
|
3235
|
-
// return data?.items.map((v: any) => ({ text: v.name, value: v.code }));
|
|
3236
|
-
// },
|
|
3237
|
-
// },
|
|
3238
|
-
// initialSource: [{ text: '英伦宝贝儿童用品有限公司', value: 'A0001' }]
|
|
3239
|
-
|
|
3298
|
+
}
|
|
3240
3299
|
}, {
|
|
3241
3300
|
name: 'qp-accountingCode-in',
|
|
3242
3301
|
type: 'select',
|
|
@@ -3255,22 +3314,7 @@ function commonFun(type) {
|
|
|
3255
3314
|
return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
3256
3315
|
}
|
|
3257
3316
|
}
|
|
3258
|
-
}
|
|
3259
|
-
// init: true, // 初始请求数据源
|
|
3260
|
-
// url: `/bop/api/accountingSubject`,
|
|
3261
|
-
// params: {
|
|
3262
|
-
// pageSize: 5000,
|
|
3263
|
-
// currentPage: 1,
|
|
3264
|
-
// },
|
|
3265
|
-
// converter({ data }: any ) {
|
|
3266
|
-
// if (data?.items == undefined || data?.items?.length == 0) {
|
|
3267
|
-
// return [];
|
|
3268
|
-
// }
|
|
3269
|
-
// return data?.items.map((v: any) => ({ text: v.name, value: v.code }));
|
|
3270
|
-
// },
|
|
3271
|
-
// },
|
|
3272
|
-
// initialSource: [{ text: '上海哲雄母婴用品有限公司', value: 'F002' }, { text: '上海英伦宝贝儿童用品有限公司', value: 'F001' }]
|
|
3273
|
-
|
|
3317
|
+
}
|
|
3274
3318
|
}, {
|
|
3275
3319
|
name: 'qp-companyCode-in',
|
|
3276
3320
|
type: 'select',
|
|
@@ -3289,41 +3333,21 @@ function commonFun(type) {
|
|
|
3289
3333
|
return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
3290
3334
|
}
|
|
3291
3335
|
}
|
|
3292
|
-
}
|
|
3293
|
-
// init: true, // 初始请求数据源
|
|
3294
|
-
// url: '/bop/api/company',
|
|
3295
|
-
// params: {
|
|
3296
|
-
// pageSize: 5000,
|
|
3297
|
-
// currentPage: 1,
|
|
3298
|
-
// 'qp-companyType-eq': '20',
|
|
3299
|
-
// },
|
|
3300
|
-
// converter: ({ data }: any) => {
|
|
3301
|
-
// return data.items
|
|
3302
|
-
// ? data.items.map((item: any) => {
|
|
3303
|
-
// return {
|
|
3304
|
-
// text: item.name,
|
|
3305
|
-
// value: item.code,
|
|
3306
|
-
// };
|
|
3307
|
-
// })
|
|
3308
|
-
// : [];
|
|
3309
|
-
// },
|
|
3310
|
-
// },
|
|
3311
|
-
// initialSource: [{ text: '上海哲雄母婴用品有限公司', value: 'F002' }, { text: '上海英伦宝贝儿童用品有限公司', value: 'F001' }]
|
|
3312
|
-
|
|
3336
|
+
}
|
|
3313
3337
|
}, {
|
|
3314
3338
|
name: 'qp-sharingType-eq',
|
|
3315
3339
|
type: 'select',
|
|
3316
3340
|
label: '共享类型',
|
|
3317
3341
|
initialSource: getDictionarySource('UC000013')
|
|
3318
3342
|
}];
|
|
3319
|
-
Promise.all([loadSelectSource(
|
|
3343
|
+
Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
|
|
3320
3344
|
pageSize: 5000,
|
|
3321
3345
|
currentPage: 1,
|
|
3322
3346
|
'qp-companyType-eq': '30'
|
|
3323
|
-
}), loadSelectSource(
|
|
3347
|
+
}), loadSelectSource("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
|
|
3324
3348
|
pageSize: 5000,
|
|
3325
3349
|
currentPage: 1
|
|
3326
|
-
}), loadSelectSource(
|
|
3350
|
+
}), loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
|
|
3327
3351
|
pageSize: 5000,
|
|
3328
3352
|
currentPage: 1,
|
|
3329
3353
|
'qp-companyType-eq': '20'
|
|
@@ -3361,6 +3385,143 @@ function commonFun(type) {
|
|
|
3361
3385
|
}]
|
|
3362
3386
|
}; // 商品选择器
|
|
3363
3387
|
|
|
3388
|
+
if (type === 'skuCommodity') {
|
|
3389
|
+
requestConfig = {
|
|
3390
|
+
url: "".concat(prefixUrl.selectPrefix, "/sku"),
|
|
3391
|
+
filter: 'qp-nameAndCode-like',
|
|
3392
|
+
mappingTextField: 'name',
|
|
3393
|
+
mappingValueField: 'skuCode',
|
|
3394
|
+
otherParams: {
|
|
3395
|
+
'qp-approveStatus-eq': 2,
|
|
3396
|
+
sorter: 'desc-id'
|
|
3397
|
+
},
|
|
3398
|
+
sourceName: 'skuCode'
|
|
3399
|
+
};
|
|
3400
|
+
tableSearchForm = [{
|
|
3401
|
+
name: 'qp-name-like',
|
|
3402
|
+
label: 'SKU名称'
|
|
3403
|
+
}, {
|
|
3404
|
+
name: 'qp-skuCode-like',
|
|
3405
|
+
label: 'SKU编码'
|
|
3406
|
+
}, {
|
|
3407
|
+
name: 'qp-barCode-like',
|
|
3408
|
+
label: '条形码'
|
|
3409
|
+
}, {
|
|
3410
|
+
name: 'qp-itemName-like',
|
|
3411
|
+
label: '所属SPU名称'
|
|
3412
|
+
}, {
|
|
3413
|
+
name: 'qp-itemCode-like',
|
|
3414
|
+
label: '所属SPU编码'
|
|
3415
|
+
}, {
|
|
3416
|
+
name: 'qp-brandId-in',
|
|
3417
|
+
type: 'select',
|
|
3418
|
+
label: '品牌',
|
|
3419
|
+
field: {
|
|
3420
|
+
type: 'select',
|
|
3421
|
+
props: {
|
|
3422
|
+
mode: 'multiple',
|
|
3423
|
+
notFoundContent: '暂无数据',
|
|
3424
|
+
allowClear: true,
|
|
3425
|
+
showSearch: true,
|
|
3426
|
+
showArrow: true,
|
|
3427
|
+
maxTagCount: 1,
|
|
3428
|
+
optionFilterProp: 'children',
|
|
3429
|
+
filterOption: function filterOption(input, option) {
|
|
3430
|
+
return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
}, {
|
|
3435
|
+
name: 'qp-categoryId-in',
|
|
3436
|
+
type: 'treeSelect',
|
|
3437
|
+
label: '类目',
|
|
3438
|
+
field: {
|
|
3439
|
+
type: 'treeSelect',
|
|
3440
|
+
props: {
|
|
3441
|
+
treeData: [],
|
|
3442
|
+
treeCheckable: true,
|
|
3443
|
+
showSearch: true,
|
|
3444
|
+
allowClear: true,
|
|
3445
|
+
showArrow: true,
|
|
3446
|
+
treeNodeFilterProp: 'title',
|
|
3447
|
+
treeDefaultExpandAll: true,
|
|
3448
|
+
maxTagCount: 1,
|
|
3449
|
+
placeholder: '请选择',
|
|
3450
|
+
style: {
|
|
3451
|
+
width: '100%'
|
|
3452
|
+
},
|
|
3453
|
+
dropdownStyle: {
|
|
3454
|
+
maxHeight: 400,
|
|
3455
|
+
maxWidth: 100,
|
|
3456
|
+
overflow: 'auto'
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
}, {
|
|
3461
|
+
name: 'qp-classId-in',
|
|
3462
|
+
type: 'select',
|
|
3463
|
+
label: '品类',
|
|
3464
|
+
field: {
|
|
3465
|
+
type: 'select',
|
|
3466
|
+
props: {
|
|
3467
|
+
mode: 'multiple',
|
|
3468
|
+
notFoundContent: '暂无数据',
|
|
3469
|
+
allowClear: true,
|
|
3470
|
+
showSearch: true,
|
|
3471
|
+
showArrow: true,
|
|
3472
|
+
maxTagCount: 1,
|
|
3473
|
+
optionFilterProp: 'children',
|
|
3474
|
+
filterOption: function filterOption(input, option) {
|
|
3475
|
+
return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
}];
|
|
3480
|
+
Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/brand/queryBrandList"), {
|
|
3481
|
+
pageSize: 5000,
|
|
3482
|
+
currentPage: 1
|
|
3483
|
+
}), loadSelectSource("".concat(prefixUrl.formSelectFix, "/category/queryCategoryTree"), {
|
|
3484
|
+
pageSize: 5000,
|
|
3485
|
+
currentPage: 1
|
|
3486
|
+
}), loadSelectSource("".concat(prefixUrl.formSelectFix, "/class/withProperty"), {
|
|
3487
|
+
pageSize: 5000,
|
|
3488
|
+
currentPage: 1
|
|
3489
|
+
})]).then(function (x) {
|
|
3490
|
+
formatSource(x, 0, 5, tableSearchForm, ['id', 'name']);
|
|
3491
|
+
formatTreeDataSource(x, 1, 6, tableSearchForm);
|
|
3492
|
+
formatSource(x, 2, 7, tableSearchForm, ['id', 'name']);
|
|
3493
|
+
});
|
|
3494
|
+
modalTableProps = {
|
|
3495
|
+
modalTableTitle: '选择SKU',
|
|
3496
|
+
tableSearchForm: tableSearchForm,
|
|
3497
|
+
tableColumns: [{
|
|
3498
|
+
title: 'SKU编码',
|
|
3499
|
+
dataIndex: 'skuCode'
|
|
3500
|
+
}, {
|
|
3501
|
+
title: 'SKU名称',
|
|
3502
|
+
dataIndex: 'name'
|
|
3503
|
+
}, {
|
|
3504
|
+
title: '所属SPU',
|
|
3505
|
+
dataIndex: 'itemName'
|
|
3506
|
+
}, {
|
|
3507
|
+
title: '规格',
|
|
3508
|
+
dataIndex: 'skuSpec'
|
|
3509
|
+
}, {
|
|
3510
|
+
title: '类目',
|
|
3511
|
+
dataIndex: 'categoryName'
|
|
3512
|
+
}, {
|
|
3513
|
+
title: '品类',
|
|
3514
|
+
dataIndex: 'className'
|
|
3515
|
+
}, {
|
|
3516
|
+
title: '品牌',
|
|
3517
|
+
dataIndex: 'brandName'
|
|
3518
|
+
}, {
|
|
3519
|
+
title: '条形码',
|
|
3520
|
+
dataIndex: 'barCode'
|
|
3521
|
+
}]
|
|
3522
|
+
};
|
|
3523
|
+
} // 仓库选择器
|
|
3524
|
+
|
|
3364
3525
|
return {
|
|
3365
3526
|
modalTableProps: modalTableProps,
|
|
3366
3527
|
requestConfig: requestConfig
|
|
@@ -3368,9 +3529,13 @@ function commonFun(type) {
|
|
|
3368
3529
|
}
|
|
3369
3530
|
|
|
3370
3531
|
var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
3371
|
-
var businessType = (props === null || props === void 0 ? void 0 : props.
|
|
3532
|
+
var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
|
|
3533
|
+
var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
|
|
3534
|
+
selectPrefix: '/bop/api',
|
|
3535
|
+
formSelectFix: '/bop/api'
|
|
3536
|
+
};
|
|
3372
3537
|
|
|
3373
|
-
var _commonFun = commonFun(businessType),
|
|
3538
|
+
var _commonFun = commonFun(businessType, prefixUrl),
|
|
3374
3539
|
requestConfig = _commonFun.requestConfig,
|
|
3375
3540
|
modalTableProps = _commonFun.modalTableProps;
|
|
3376
3541
|
|