@bit-sun/business-component 2.0.14 → 2.0.15
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/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Functional/SearchSelect/index.d.ts +2 -1
- package/dist/index.esm.js +87 -22
- package/dist/index.js +86 -21
- package/package.json +1 -1
- package/src/components/Business/CommodityEntry/index.md +2 -1
- package/src/components/Business/CommodityEntry/index.tsx +3 -1
- package/src/components/Business/SearchSelect/index.tsx +16 -11
- package/src/components/Functional/DataValidation/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/index.tsx +126 -67
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: React.MemoExoticComponent<
|
|
2
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>>;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import './index.less';
|
|
2
|
-
declare const SearchSelect:
|
|
3
|
+
declare const SearchSelect: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
|
|
3
4
|
export default SearchSelect;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import React, { createContext, useContext, useEffect, forwardRef, createElement, useState, useRef, useMemo } from 'react';
|
|
2
|
+
import React, { createContext, useContext, useEffect, forwardRef, createElement, useState, useImperativeHandle, useRef, useMemo } from 'react';
|
|
3
3
|
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Popover } from 'antd';
|
|
4
4
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
5
5
|
import classNames from 'classnames';
|
|
@@ -2399,7 +2399,9 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2399
2399
|
validDataUrl = _this$props.validDataUrl,
|
|
2400
2400
|
updateData = _this$props.updateData,
|
|
2401
2401
|
columns = _this$props.columns,
|
|
2402
|
-
isBrandAuth = _this$props.isBrandAuth
|
|
2402
|
+
isBrandAuth = _this$props.isBrandAuth,
|
|
2403
|
+
_this$props$isCheckSt = _this$props.isCheckStockNum,
|
|
2404
|
+
isCheckStockNum = _this$props$isCheckSt === void 0 ? true : _this$props$isCheckSt;
|
|
2403
2405
|
|
|
2404
2406
|
var resultData = _this.getData().filter(function (d) {
|
|
2405
2407
|
return _.compact(Object.values(d)).length;
|
|
@@ -2416,7 +2418,8 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2416
2418
|
|
|
2417
2419
|
axios.post(validDataUrl, _objectSpread2(_objectSpread2({}, otherParams), {}, {
|
|
2418
2420
|
columns: columns,
|
|
2419
|
-
data: resultData
|
|
2421
|
+
data: resultData,
|
|
2422
|
+
checkStockNum: isCheckStockNum
|
|
2420
2423
|
})).then(function (result) {
|
|
2421
2424
|
result = result.data;
|
|
2422
2425
|
|
|
@@ -3468,8 +3471,7 @@ var css_248z$3 = ".search_select_show {\n display: flex;\n}\n.search_select_exp
|
|
|
3468
3471
|
styleInject(css_248z$3);
|
|
3469
3472
|
|
|
3470
3473
|
var Option = Select.Option;
|
|
3471
|
-
|
|
3472
|
-
var SearchSelect = function SearchSelect(props) {
|
|
3474
|
+
var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
3473
3475
|
var value = props.value,
|
|
3474
3476
|
onChange = props.onChange,
|
|
3475
3477
|
_props$selectProps = props.selectProps,
|
|
@@ -3497,7 +3499,11 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3497
3499
|
mappingTextShowKeyField = _ref.mappingTextShowKeyField,
|
|
3498
3500
|
_ref$mappingValueFiel = _ref.mappingValueField,
|
|
3499
3501
|
mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
|
|
3500
|
-
mappingTextShowTextField = _ref.mappingTextShowTextField
|
|
3502
|
+
mappingTextShowTextField = _ref.mappingTextShowTextField,
|
|
3503
|
+
_ref$init = _ref.init,
|
|
3504
|
+
init = _ref$init === void 0 ? true : _ref$init,
|
|
3505
|
+
_ref$extralHeaders = _ref.extralHeaders,
|
|
3506
|
+
extralHeaders = _ref$extralHeaders === void 0 ? {} : _ref$extralHeaders;
|
|
3501
3507
|
|
|
3502
3508
|
var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
|
|
3503
3509
|
var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -3635,8 +3641,30 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3635
3641
|
var _useState33 = useState(false),
|
|
3636
3642
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
3637
3643
|
tooltipVisible = _useState34[0],
|
|
3638
|
-
setTooltipVisible = _useState34[1];
|
|
3644
|
+
setTooltipVisible = _useState34[1];
|
|
3645
|
+
|
|
3646
|
+
useImperativeHandle(ref, function () {
|
|
3647
|
+
return {
|
|
3648
|
+
refreshDataSource: function refreshDataSource() {
|
|
3649
|
+
var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3639
3650
|
|
|
3651
|
+
if (reset) {
|
|
3652
|
+
if (init) {
|
|
3653
|
+
run('init');
|
|
3654
|
+
} else {
|
|
3655
|
+
setItems([]);
|
|
3656
|
+
setItemsTotal(0);
|
|
3657
|
+
}
|
|
3658
|
+
} else {
|
|
3659
|
+
run();
|
|
3660
|
+
}
|
|
3661
|
+
},
|
|
3662
|
+
clearDataSource: function clearDataSource() {
|
|
3663
|
+
setItems([]);
|
|
3664
|
+
setItemsTotal(0);
|
|
3665
|
+
}
|
|
3666
|
+
};
|
|
3667
|
+
}); // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
3640
3668
|
|
|
3641
3669
|
var getData = function getData() {
|
|
3642
3670
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -3759,7 +3787,9 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3759
3787
|
currentPage: currentPage
|
|
3760
3788
|
}, otherParams), fixedParam), params);
|
|
3761
3789
|
|
|
3762
|
-
axios.get("".concat(url, "?").concat(stringify(queryParams))
|
|
3790
|
+
axios.get("".concat(url, "?").concat(stringify(queryParams)), {
|
|
3791
|
+
headers: _objectSpread2({}, extralHeaders)
|
|
3792
|
+
}).then(function (result) {
|
|
3763
3793
|
var _result, _result2;
|
|
3764
3794
|
|
|
3765
3795
|
setFetching(false);
|
|
@@ -3882,7 +3912,9 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3882
3912
|
};
|
|
3883
3913
|
|
|
3884
3914
|
useEffect(function () {
|
|
3885
|
-
|
|
3915
|
+
if (init) {
|
|
3916
|
+
run('init');
|
|
3917
|
+
}
|
|
3886
3918
|
}, []);
|
|
3887
3919
|
useEffect(function () {
|
|
3888
3920
|
if (value) {
|
|
@@ -3980,14 +4012,36 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3980
4012
|
}
|
|
3981
4013
|
};
|
|
3982
4014
|
|
|
4015
|
+
var refreshItems = function refreshItems() {
|
|
4016
|
+
// 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
|
|
4017
|
+
if (fieldValToParam && ctx) {
|
|
4018
|
+
var formValueList = [];
|
|
4019
|
+
fieldValToParam.forEach(function (item, index) {
|
|
4020
|
+
var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
4021
|
+
formValueList.push(fixedParamVal);
|
|
4022
|
+
});
|
|
4023
|
+
|
|
4024
|
+
if (formValueList.filter(function (item) {
|
|
4025
|
+
return item;
|
|
4026
|
+
}).length > 0) {
|
|
4027
|
+
run();
|
|
4028
|
+
} else {
|
|
4029
|
+
setItems([]);
|
|
4030
|
+
setItemsTotal(0);
|
|
4031
|
+
}
|
|
4032
|
+
} else {
|
|
4033
|
+
run();
|
|
4034
|
+
}
|
|
4035
|
+
};
|
|
4036
|
+
|
|
3983
4037
|
var onSearchChange = function onSearchChange(e) {
|
|
3984
4038
|
setSearchValue(e.target.value);
|
|
3985
|
-
|
|
4039
|
+
refreshItems();
|
|
3986
4040
|
};
|
|
3987
4041
|
|
|
3988
4042
|
var onSearchBlur = function onSearchBlur() {
|
|
3989
4043
|
setSearchValue('');
|
|
3990
|
-
|
|
4044
|
+
refreshItems();
|
|
3991
4045
|
};
|
|
3992
4046
|
|
|
3993
4047
|
var onSearchTable = function onSearchTable() {
|
|
@@ -4139,13 +4193,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4139
4193
|
},
|
|
4140
4194
|
getCheckboxProps: function getCheckboxProps() {
|
|
4141
4195
|
return {
|
|
4142
|
-
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
4196
|
+
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled) || !items.length
|
|
4143
4197
|
};
|
|
4144
4198
|
}
|
|
4145
4199
|
};
|
|
4146
4200
|
|
|
4147
4201
|
var onDoubleClickSelect = function onDoubleClickSelect(e, record) {
|
|
4148
|
-
if (!selectMode) {
|
|
4202
|
+
if (!selectMode && !((selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled) || !items.length)) {
|
|
4149
4203
|
var srs = [JSON.parse(JSON.stringify(record))];
|
|
4150
4204
|
var sks = srs.map(function (i) {
|
|
4151
4205
|
return i.value;
|
|
@@ -4276,6 +4330,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4276
4330
|
labelInValue: labelInValue,
|
|
4277
4331
|
value: value,
|
|
4278
4332
|
onChange: onChange,
|
|
4333
|
+
disabled: props.disabled,
|
|
4279
4334
|
dropdownRender: function dropdownRender(menu) {
|
|
4280
4335
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
|
|
4281
4336
|
value: searchValue,
|
|
@@ -4428,7 +4483,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4428
4483
|
onChange: onChangeCheckAll,
|
|
4429
4484
|
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
4430
4485
|
}), " \u5168\u9009\u6240\u6709\u9875\u9762") : '')))));
|
|
4431
|
-
};
|
|
4486
|
+
});
|
|
4432
4487
|
|
|
4433
4488
|
var css_248z$4 = ".add_select_show {\n display: flex;\n}\n.add_select_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.add_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.add_select_header {\n border-bottom: 1px solid #D9D9D9;\n height: 24px;\n height: 40px;\n font-family: PingFangSC-Medium;\n font-weight: 500;\n font-size: 18px;\n color: #000000;\n letter-spacing: 0;\n line-height: 40px;\n margin-bottom: 10px;\n padding-left: 10px;\n}\n.add_select_header > span {\n margin-left: 20px;\n font-weight: 400;\n font-size: 12px;\n color: #666666;\n letter-spacing: 0;\n line-height: 40px;\n}\n.add_select_header > span > span {\n color: #ff0000;\n}\n.add_select_header_close span {\n position: absolute;\n color: black !important;\n right: 10px;\n top: 10px;\n}\n.add_select_quick_header {\n font-family: PingFangSC-Medium;\n font-weight: 500;\n font-size: 18px;\n color: #000000;\n letter-spacing: 0;\n}\n.add_select_quick_header_title {\n display: flex;\n justify-content: space-between;\n}\n.add_select_quick_header > span {\n font-weight: 400;\n font-size: 12px;\n color: #666666;\n letter-spacing: 0;\n line-height: 20px;\n}\n.add_select_quick_header > span > span {\n color: #ff0000;\n}\n.add_select_quick_header_close span {\n position: absolute;\n color: black !important;\n right: 10px;\n top: 10px;\n}\n.add_select_wrapper {\n position: relative;\n display: flex;\n max-height: 60vh;\n overflow: hidden;\n font-size: 14px;\n margin: 5px 10px;\n}\n.add_select_wrapper .ant-table-pagination.ant-pagination {\n margin: 5px;\n padding-right: 5px;\n}\n.add_select_wrapper .ant-checkbox-wrapper {\n justify-content: center;\n}\n.add_select_wrapper .ant-form-item-label {\n padding: 0PX;\n line-height: 23px !important;\n}\n.add_select_wrapper .ant-form-item-label > label {\n font-size: 12px;\n}\n.add_select_wrapper .ant-table-thead th {\n height: 20px !important;\n padding: 0px 8px !important;\n font-size: 12px !important;\n font-weight: 600 !important;\n line-height: 20px !important;\n}\n.add_select_wrapper .ant-modal-body {\n padding: 10px;\n}\n.add_select_wrapper .ant-table-wrapper {\n padding: 0px !important;\n}\n.add_select_wrapper .row-class {\n height: 24px;\n}\n.add_select_wrapper .row-class td {\n font-size: 12px !important;\n height: 24px !important;\n padding: 0px 8px !important;\n line-height: 20px !important;\n}\n.add_select_wrapper .ant-table-body {\n height: 240px;\n overflow-y: auto !important;\n}\n.add_select_wrapper .ant-row.ant-form-item {\n margin-bottom: 10px;\n}\n.add_select_wrapper_click_flag {\n position: absolute;\n z-index: 10;\n}\n.add_select_wrapper_click_flag_arrow {\n transform: rotate(0deg);\n transition: transform 0.5s;\n}\n.add_select_wrapper_click_flag_arrow_1 {\n transform: rotate(-180deg);\n transition: transform 0.5s;\n}\n.add_select_wrapper_left {\n flex-basis: 298px;\n width: 298px;\n overflow-y: hidden;\n transition: all 0.3s;\n margin-right: 10px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n}\n.add_select_wrapper_left1 {\n width: 0;\n height: 0;\n transition: all 0.3s;\n display: none;\n}\n.add_select_wrapper_right {\n width: 872px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n}\n.add_select_wrapper_right1 {\n width: 100%;\n margin-left: 10px;\n}\n.add_select_wrapper_right,\n.add_select_wrapper_right1 {\n overflow-x: auto;\n}\n.add_select_wrapper .select_list_columns {\n height: 272px;\n overflow-y: auto;\n border-bottom: 1px solid #D9D9D9;\n}\n.add_select_wrapper .select_list_columns_tips {\n background: #eee;\n padding: 6px 20px;\n margin-bottom: 10px;\n}\n.add_select_wrapper .select_list_columns_formItems {\n padding: 7px 10px;\n}\n.add_select_wrapper .select_list_searchButton {\n display: flex;\n margin: 10px;\n justify-content: flex-end;\n}\n.add_select_wrapper .select_list_button_space {\n margin-right: 10px;\n}\n.add_select_wrapper .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 24px;\n font-size: 12px;\n line-height: 24px;\n background: #F7F8FB;\n padding: 0 5px;\n border-bottom: 1px solid #D9D9D9;\n}\n.add_select_wrapper .select_list_selectAll {\n position: relative;\n top: -40px;\n left: 20px;\n width: 160px;\n}\n.add_select_wrapper_select {\n margin-top: 4px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n margin: 5px 10px;\n}\n.add_select_wrapper_select .ant-table-pagination.ant-pagination {\n margin: 9px;\n padding-right: 5px;\n}\n.add_select_wrapper_select .ant-modal-body {\n padding: 10px;\n}\n.add_select_wrapper_select .ant-table-wrapper {\n padding: 0px !important;\n}\n.add_select_wrapper_select .ant-table-thead th {\n height: 23px !important;\n padding: 0px 8px !important;\n font-size: 12px !important;\n font-weight: 600 !important;\n line-height: 23px !important;\n}\n.add_select_wrapper_select .ant-modal-close-x {\n height: 30px;\n}\n.add_select_wrapper_select .row-class {\n height: 30px;\n}\n.add_select_wrapper_select .row-class td {\n font-size: 12px !important;\n height: 30px !important;\n padding: 4px 8px !important;\n}\n.add_select_wrapper_select .ant-table-body {\n height: 200px;\n overflow-y: auto !important;\n}\n.add_select_wrapper_select .ant-row.ant-form-item {\n margin-bottom: 10px;\n}\n.add_select_wrapper_select .ant-input-number-input,\n.add_select_wrapper_select .ant-input {\n height: auto;\n height: 22px;\n padding: 0px 10px;\n font-size: 12px;\n}\n.add_select_wrapper_select .ant-select-selection-search-input {\n height: auto;\n height: 22px !important;\n padding: 0px 10px;\n font-size: 12px;\n}\n.add_select_wrapper_select .ant-select .ant-select-arrow {\n top: 13px;\n}\n.add_select_wrapper_select .ant-select-selector {\n position: relative;\n top: 1px;\n height: 23px !important;\n line-height: 23px !important;\n}\n.add_select_wrapper_select .ant-select-selector .ant-select-selection-item,\n.add_select_wrapper_select .ant-select-selector ant-select-selection-search {\n height: 23px !important;\n line-height: 23px !important;\n font-size: 12px;\n}\n.add_select_wrapper_select .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 24px;\n font-size: 12px;\n line-height: 24px;\n background: #F7F8FB;\n padding: 0 3px;\n border-bottom: 1px solid #D9D9D9;\n}\n.add_select_wrapper_select_quick {\n margin: 0;\n}\n.react-resizable {\n position: relative;\n background-clip: padding-box;\n}\n.react-resizable-handle {\n position: absolute;\n width: 10px;\n height: 100%;\n bottom: 0;\n right: -5px;\n cursor: col-resize;\n z-index: 1;\n}\n";
|
|
4434
4489
|
styleInject(css_248z$4);
|
|
@@ -6077,7 +6132,6 @@ var BillEntry = function BillEntry(_ref3) {
|
|
|
6077
6132
|
title: '单位',
|
|
6078
6133
|
dataIndex: 'selectUnitCode',
|
|
6079
6134
|
width: 100,
|
|
6080
|
-
isSelectItem: true,
|
|
6081
6135
|
render: function render(text, record) {
|
|
6082
6136
|
var _record$packingUnitLi;
|
|
6083
6137
|
|
|
@@ -7985,13 +8039,13 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
|
|
|
7985
8039
|
}
|
|
7986
8040
|
|
|
7987
8041
|
var MemoSearchSelect = /*#__PURE__*/React.memo(SearchSelect);
|
|
7988
|
-
|
|
7989
|
-
var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
8042
|
+
var BusinessSearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
7990
8043
|
var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
|
|
7991
8044
|
var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
|
|
7992
8045
|
selectPrefix: handleDefaultPrefixUrl(businessType),
|
|
7993
8046
|
formSelectFix: handleDefaultPrefixUrl(businessType)
|
|
7994
8047
|
};
|
|
8048
|
+
var innerRef = useRef();
|
|
7995
8049
|
|
|
7996
8050
|
var _commonFun = commonFun(businessType, prefixUrl, (props === null || props === void 0 ? void 0 : props.requestConfig) || {}, (props === null || props === void 0 ? void 0 : props.modalTableProps) || {}),
|
|
7997
8051
|
requestConfig = _commonFun.requestConfig,
|
|
@@ -8005,9 +8059,17 @@ var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
|
8005
8059
|
modalTableProps: modalTableProps
|
|
8006
8060
|
});
|
|
8007
8061
|
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8062
|
+
useImperativeHandle(ref, function () {
|
|
8063
|
+
return {
|
|
8064
|
+
getRef: function getRef() {
|
|
8065
|
+
return innerRef;
|
|
8066
|
+
}
|
|
8067
|
+
};
|
|
8068
|
+
});
|
|
8069
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MemoSearchSelect, _objectSpread2(_objectSpread2({}, currentProps), {}, {
|
|
8070
|
+
ref: innerRef
|
|
8071
|
+
})));
|
|
8072
|
+
});
|
|
8011
8073
|
var BusinessSearchSelect$1 = /*#__PURE__*/React.memo(BusinessSearchSelect, function (props, nextProps) {
|
|
8012
8074
|
if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
8013
8075
|
return false;
|
|
@@ -8320,7 +8382,9 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
8320
8382
|
_props$validDataUrl = props.validDataUrl,
|
|
8321
8383
|
validDataUrl = _props$validDataUrl === void 0 ? "/items/sku/import/check" : _props$validDataUrl,
|
|
8322
8384
|
_props$isBrandAuth = props.isBrandAuth,
|
|
8323
|
-
isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth
|
|
8385
|
+
isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth,
|
|
8386
|
+
_props$isCheckStockNu = props.isCheckStockNum,
|
|
8387
|
+
isCheckStockNum = _props$isCheckStockNu === void 0 ? true : _props$isCheckStockNu;
|
|
8324
8388
|
|
|
8325
8389
|
var _useState = useState({
|
|
8326
8390
|
maskClosable: false,
|
|
@@ -8384,7 +8448,8 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
8384
8448
|
},
|
|
8385
8449
|
columns: columns,
|
|
8386
8450
|
validDataUrl: validDataUrl,
|
|
8387
|
-
isBrandAuth: isBrandAuth
|
|
8451
|
+
isBrandAuth: isBrandAuth,
|
|
8452
|
+
isCheckStockNum: isCheckStockNum
|
|
8388
8453
|
})) || '');
|
|
8389
8454
|
};
|
|
8390
8455
|
|
package/dist/index.js
CHANGED
|
@@ -2410,7 +2410,9 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2410
2410
|
validDataUrl = _this$props.validDataUrl,
|
|
2411
2411
|
updateData = _this$props.updateData,
|
|
2412
2412
|
columns = _this$props.columns,
|
|
2413
|
-
isBrandAuth = _this$props.isBrandAuth
|
|
2413
|
+
isBrandAuth = _this$props.isBrandAuth,
|
|
2414
|
+
_this$props$isCheckSt = _this$props.isCheckStockNum,
|
|
2415
|
+
isCheckStockNum = _this$props$isCheckSt === void 0 ? true : _this$props$isCheckSt;
|
|
2414
2416
|
|
|
2415
2417
|
var resultData = _this.getData().filter(function (d) {
|
|
2416
2418
|
return ___default['default'].compact(Object.values(d)).length;
|
|
@@ -2427,7 +2429,8 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2427
2429
|
|
|
2428
2430
|
axios__default['default'].post(validDataUrl, _objectSpread2(_objectSpread2({}, otherParams), {}, {
|
|
2429
2431
|
columns: columns,
|
|
2430
|
-
data: resultData
|
|
2432
|
+
data: resultData,
|
|
2433
|
+
checkStockNum: isCheckStockNum
|
|
2431
2434
|
})).then(function (result) {
|
|
2432
2435
|
result = result.data;
|
|
2433
2436
|
|
|
@@ -3479,8 +3482,7 @@ var css_248z$3 = ".search_select_show {\n display: flex;\n}\n.search_select_exp
|
|
|
3479
3482
|
styleInject(css_248z$3);
|
|
3480
3483
|
|
|
3481
3484
|
var Option = antd.Select.Option;
|
|
3482
|
-
|
|
3483
|
-
var SearchSelect = function SearchSelect(props) {
|
|
3485
|
+
var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
3484
3486
|
var value = props.value,
|
|
3485
3487
|
onChange = props.onChange,
|
|
3486
3488
|
_props$selectProps = props.selectProps,
|
|
@@ -3508,7 +3510,11 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3508
3510
|
mappingTextShowKeyField = _ref.mappingTextShowKeyField,
|
|
3509
3511
|
_ref$mappingValueFiel = _ref.mappingValueField,
|
|
3510
3512
|
mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
|
|
3511
|
-
mappingTextShowTextField = _ref.mappingTextShowTextField
|
|
3513
|
+
mappingTextShowTextField = _ref.mappingTextShowTextField,
|
|
3514
|
+
_ref$init = _ref.init,
|
|
3515
|
+
init = _ref$init === void 0 ? true : _ref$init,
|
|
3516
|
+
_ref$extralHeaders = _ref.extralHeaders,
|
|
3517
|
+
extralHeaders = _ref$extralHeaders === void 0 ? {} : _ref$extralHeaders;
|
|
3512
3518
|
|
|
3513
3519
|
var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
|
|
3514
3520
|
var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -3646,8 +3652,30 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3646
3652
|
var _useState33 = React.useState(false),
|
|
3647
3653
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
3648
3654
|
tooltipVisible = _useState34[0],
|
|
3649
|
-
setTooltipVisible = _useState34[1];
|
|
3655
|
+
setTooltipVisible = _useState34[1];
|
|
3656
|
+
|
|
3657
|
+
React.useImperativeHandle(ref, function () {
|
|
3658
|
+
return {
|
|
3659
|
+
refreshDataSource: function refreshDataSource() {
|
|
3660
|
+
var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3650
3661
|
|
|
3662
|
+
if (reset) {
|
|
3663
|
+
if (init) {
|
|
3664
|
+
run('init');
|
|
3665
|
+
} else {
|
|
3666
|
+
setItems([]);
|
|
3667
|
+
setItemsTotal(0);
|
|
3668
|
+
}
|
|
3669
|
+
} else {
|
|
3670
|
+
run();
|
|
3671
|
+
}
|
|
3672
|
+
},
|
|
3673
|
+
clearDataSource: function clearDataSource() {
|
|
3674
|
+
setItems([]);
|
|
3675
|
+
setItemsTotal(0);
|
|
3676
|
+
}
|
|
3677
|
+
};
|
|
3678
|
+
}); // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
3651
3679
|
|
|
3652
3680
|
var getData = function getData() {
|
|
3653
3681
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -3770,7 +3798,9 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3770
3798
|
currentPage: currentPage
|
|
3771
3799
|
}, otherParams), fixedParam), params);
|
|
3772
3800
|
|
|
3773
|
-
axios__default['default'].get("".concat(url, "?").concat(querystring.stringify(queryParams))
|
|
3801
|
+
axios__default['default'].get("".concat(url, "?").concat(querystring.stringify(queryParams)), {
|
|
3802
|
+
headers: _objectSpread2({}, extralHeaders)
|
|
3803
|
+
}).then(function (result) {
|
|
3774
3804
|
var _result, _result2;
|
|
3775
3805
|
|
|
3776
3806
|
setFetching(false);
|
|
@@ -3893,7 +3923,9 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3893
3923
|
};
|
|
3894
3924
|
|
|
3895
3925
|
React.useEffect(function () {
|
|
3896
|
-
|
|
3926
|
+
if (init) {
|
|
3927
|
+
run('init');
|
|
3928
|
+
}
|
|
3897
3929
|
}, []);
|
|
3898
3930
|
React.useEffect(function () {
|
|
3899
3931
|
if (value) {
|
|
@@ -3991,14 +4023,36 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3991
4023
|
}
|
|
3992
4024
|
};
|
|
3993
4025
|
|
|
4026
|
+
var refreshItems = function refreshItems() {
|
|
4027
|
+
// 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
|
|
4028
|
+
if (fieldValToParam && ctx) {
|
|
4029
|
+
var formValueList = [];
|
|
4030
|
+
fieldValToParam.forEach(function (item, index) {
|
|
4031
|
+
var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
4032
|
+
formValueList.push(fixedParamVal);
|
|
4033
|
+
});
|
|
4034
|
+
|
|
4035
|
+
if (formValueList.filter(function (item) {
|
|
4036
|
+
return item;
|
|
4037
|
+
}).length > 0) {
|
|
4038
|
+
run();
|
|
4039
|
+
} else {
|
|
4040
|
+
setItems([]);
|
|
4041
|
+
setItemsTotal(0);
|
|
4042
|
+
}
|
|
4043
|
+
} else {
|
|
4044
|
+
run();
|
|
4045
|
+
}
|
|
4046
|
+
};
|
|
4047
|
+
|
|
3994
4048
|
var onSearchChange = function onSearchChange(e) {
|
|
3995
4049
|
setSearchValue(e.target.value);
|
|
3996
|
-
|
|
4050
|
+
refreshItems();
|
|
3997
4051
|
};
|
|
3998
4052
|
|
|
3999
4053
|
var onSearchBlur = function onSearchBlur() {
|
|
4000
4054
|
setSearchValue('');
|
|
4001
|
-
|
|
4055
|
+
refreshItems();
|
|
4002
4056
|
};
|
|
4003
4057
|
|
|
4004
4058
|
var onSearchTable = function onSearchTable() {
|
|
@@ -4150,13 +4204,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4150
4204
|
},
|
|
4151
4205
|
getCheckboxProps: function getCheckboxProps() {
|
|
4152
4206
|
return {
|
|
4153
|
-
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
4207
|
+
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled) || !items.length
|
|
4154
4208
|
};
|
|
4155
4209
|
}
|
|
4156
4210
|
};
|
|
4157
4211
|
|
|
4158
4212
|
var onDoubleClickSelect = function onDoubleClickSelect(e, record) {
|
|
4159
|
-
if (!selectMode) {
|
|
4213
|
+
if (!selectMode && !((selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled) || !items.length)) {
|
|
4160
4214
|
var srs = [JSON.parse(JSON.stringify(record))];
|
|
4161
4215
|
var sks = srs.map(function (i) {
|
|
4162
4216
|
return i.value;
|
|
@@ -4287,6 +4341,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4287
4341
|
labelInValue: labelInValue,
|
|
4288
4342
|
value: value,
|
|
4289
4343
|
onChange: onChange,
|
|
4344
|
+
disabled: props.disabled,
|
|
4290
4345
|
dropdownRender: function dropdownRender(menu) {
|
|
4291
4346
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
|
|
4292
4347
|
value: searchValue,
|
|
@@ -4439,7 +4494,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4439
4494
|
onChange: onChangeCheckAll,
|
|
4440
4495
|
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
4441
4496
|
}), " \u5168\u9009\u6240\u6709\u9875\u9762") : '')))));
|
|
4442
|
-
};
|
|
4497
|
+
});
|
|
4443
4498
|
|
|
4444
4499
|
var css_248z$4 = ".add_select_show {\n display: flex;\n}\n.add_select_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.add_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.add_select_header {\n border-bottom: 1px solid #D9D9D9;\n height: 24px;\n height: 40px;\n font-family: PingFangSC-Medium;\n font-weight: 500;\n font-size: 18px;\n color: #000000;\n letter-spacing: 0;\n line-height: 40px;\n margin-bottom: 10px;\n padding-left: 10px;\n}\n.add_select_header > span {\n margin-left: 20px;\n font-weight: 400;\n font-size: 12px;\n color: #666666;\n letter-spacing: 0;\n line-height: 40px;\n}\n.add_select_header > span > span {\n color: #ff0000;\n}\n.add_select_header_close span {\n position: absolute;\n color: black !important;\n right: 10px;\n top: 10px;\n}\n.add_select_quick_header {\n font-family: PingFangSC-Medium;\n font-weight: 500;\n font-size: 18px;\n color: #000000;\n letter-spacing: 0;\n}\n.add_select_quick_header_title {\n display: flex;\n justify-content: space-between;\n}\n.add_select_quick_header > span {\n font-weight: 400;\n font-size: 12px;\n color: #666666;\n letter-spacing: 0;\n line-height: 20px;\n}\n.add_select_quick_header > span > span {\n color: #ff0000;\n}\n.add_select_quick_header_close span {\n position: absolute;\n color: black !important;\n right: 10px;\n top: 10px;\n}\n.add_select_wrapper {\n position: relative;\n display: flex;\n max-height: 60vh;\n overflow: hidden;\n font-size: 14px;\n margin: 5px 10px;\n}\n.add_select_wrapper .ant-table-pagination.ant-pagination {\n margin: 5px;\n padding-right: 5px;\n}\n.add_select_wrapper .ant-checkbox-wrapper {\n justify-content: center;\n}\n.add_select_wrapper .ant-form-item-label {\n padding: 0PX;\n line-height: 23px !important;\n}\n.add_select_wrapper .ant-form-item-label > label {\n font-size: 12px;\n}\n.add_select_wrapper .ant-table-thead th {\n height: 20px !important;\n padding: 0px 8px !important;\n font-size: 12px !important;\n font-weight: 600 !important;\n line-height: 20px !important;\n}\n.add_select_wrapper .ant-modal-body {\n padding: 10px;\n}\n.add_select_wrapper .ant-table-wrapper {\n padding: 0px !important;\n}\n.add_select_wrapper .row-class {\n height: 24px;\n}\n.add_select_wrapper .row-class td {\n font-size: 12px !important;\n height: 24px !important;\n padding: 0px 8px !important;\n line-height: 20px !important;\n}\n.add_select_wrapper .ant-table-body {\n height: 240px;\n overflow-y: auto !important;\n}\n.add_select_wrapper .ant-row.ant-form-item {\n margin-bottom: 10px;\n}\n.add_select_wrapper_click_flag {\n position: absolute;\n z-index: 10;\n}\n.add_select_wrapper_click_flag_arrow {\n transform: rotate(0deg);\n transition: transform 0.5s;\n}\n.add_select_wrapper_click_flag_arrow_1 {\n transform: rotate(-180deg);\n transition: transform 0.5s;\n}\n.add_select_wrapper_left {\n flex-basis: 298px;\n width: 298px;\n overflow-y: hidden;\n transition: all 0.3s;\n margin-right: 10px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n}\n.add_select_wrapper_left1 {\n width: 0;\n height: 0;\n transition: all 0.3s;\n display: none;\n}\n.add_select_wrapper_right {\n width: 872px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n}\n.add_select_wrapper_right1 {\n width: 100%;\n margin-left: 10px;\n}\n.add_select_wrapper_right,\n.add_select_wrapper_right1 {\n overflow-x: auto;\n}\n.add_select_wrapper .select_list_columns {\n height: 272px;\n overflow-y: auto;\n border-bottom: 1px solid #D9D9D9;\n}\n.add_select_wrapper .select_list_columns_tips {\n background: #eee;\n padding: 6px 20px;\n margin-bottom: 10px;\n}\n.add_select_wrapper .select_list_columns_formItems {\n padding: 7px 10px;\n}\n.add_select_wrapper .select_list_searchButton {\n display: flex;\n margin: 10px;\n justify-content: flex-end;\n}\n.add_select_wrapper .select_list_button_space {\n margin-right: 10px;\n}\n.add_select_wrapper .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 24px;\n font-size: 12px;\n line-height: 24px;\n background: #F7F8FB;\n padding: 0 5px;\n border-bottom: 1px solid #D9D9D9;\n}\n.add_select_wrapper .select_list_selectAll {\n position: relative;\n top: -40px;\n left: 20px;\n width: 160px;\n}\n.add_select_wrapper_select {\n margin-top: 4px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n margin: 5px 10px;\n}\n.add_select_wrapper_select .ant-table-pagination.ant-pagination {\n margin: 9px;\n padding-right: 5px;\n}\n.add_select_wrapper_select .ant-modal-body {\n padding: 10px;\n}\n.add_select_wrapper_select .ant-table-wrapper {\n padding: 0px !important;\n}\n.add_select_wrapper_select .ant-table-thead th {\n height: 23px !important;\n padding: 0px 8px !important;\n font-size: 12px !important;\n font-weight: 600 !important;\n line-height: 23px !important;\n}\n.add_select_wrapper_select .ant-modal-close-x {\n height: 30px;\n}\n.add_select_wrapper_select .row-class {\n height: 30px;\n}\n.add_select_wrapper_select .row-class td {\n font-size: 12px !important;\n height: 30px !important;\n padding: 4px 8px !important;\n}\n.add_select_wrapper_select .ant-table-body {\n height: 200px;\n overflow-y: auto !important;\n}\n.add_select_wrapper_select .ant-row.ant-form-item {\n margin-bottom: 10px;\n}\n.add_select_wrapper_select .ant-input-number-input,\n.add_select_wrapper_select .ant-input {\n height: auto;\n height: 22px;\n padding: 0px 10px;\n font-size: 12px;\n}\n.add_select_wrapper_select .ant-select-selection-search-input {\n height: auto;\n height: 22px !important;\n padding: 0px 10px;\n font-size: 12px;\n}\n.add_select_wrapper_select .ant-select .ant-select-arrow {\n top: 13px;\n}\n.add_select_wrapper_select .ant-select-selector {\n position: relative;\n top: 1px;\n height: 23px !important;\n line-height: 23px !important;\n}\n.add_select_wrapper_select .ant-select-selector .ant-select-selection-item,\n.add_select_wrapper_select .ant-select-selector ant-select-selection-search {\n height: 23px !important;\n line-height: 23px !important;\n font-size: 12px;\n}\n.add_select_wrapper_select .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 24px;\n font-size: 12px;\n line-height: 24px;\n background: #F7F8FB;\n padding: 0 3px;\n border-bottom: 1px solid #D9D9D9;\n}\n.add_select_wrapper_select_quick {\n margin: 0;\n}\n.react-resizable {\n position: relative;\n background-clip: padding-box;\n}\n.react-resizable-handle {\n position: absolute;\n width: 10px;\n height: 100%;\n bottom: 0;\n right: -5px;\n cursor: col-resize;\n z-index: 1;\n}\n";
|
|
4445
4500
|
styleInject(css_248z$4);
|
|
@@ -6088,7 +6143,6 @@ var BillEntry = function BillEntry(_ref3) {
|
|
|
6088
6143
|
title: '单位',
|
|
6089
6144
|
dataIndex: 'selectUnitCode',
|
|
6090
6145
|
width: 100,
|
|
6091
|
-
isSelectItem: true,
|
|
6092
6146
|
render: function render(text, record) {
|
|
6093
6147
|
var _record$packingUnitLi;
|
|
6094
6148
|
|
|
@@ -7996,13 +8050,13 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
|
|
|
7996
8050
|
}
|
|
7997
8051
|
|
|
7998
8052
|
var MemoSearchSelect = /*#__PURE__*/React__default['default'].memo(SearchSelect);
|
|
7999
|
-
|
|
8000
|
-
var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
8053
|
+
var BusinessSearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
8001
8054
|
var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
|
|
8002
8055
|
var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
|
|
8003
8056
|
selectPrefix: handleDefaultPrefixUrl(businessType),
|
|
8004
8057
|
formSelectFix: handleDefaultPrefixUrl(businessType)
|
|
8005
8058
|
};
|
|
8059
|
+
var innerRef = React.useRef();
|
|
8006
8060
|
|
|
8007
8061
|
var _commonFun = commonFun(businessType, prefixUrl, (props === null || props === void 0 ? void 0 : props.requestConfig) || {}, (props === null || props === void 0 ? void 0 : props.modalTableProps) || {}),
|
|
8008
8062
|
requestConfig = _commonFun.requestConfig,
|
|
@@ -8016,9 +8070,17 @@ var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
|
8016
8070
|
modalTableProps: modalTableProps
|
|
8017
8071
|
});
|
|
8018
8072
|
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8073
|
+
React.useImperativeHandle(ref, function () {
|
|
8074
|
+
return {
|
|
8075
|
+
getRef: function getRef() {
|
|
8076
|
+
return innerRef;
|
|
8077
|
+
}
|
|
8078
|
+
};
|
|
8079
|
+
});
|
|
8080
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MemoSearchSelect, _objectSpread2(_objectSpread2({}, currentProps), {}, {
|
|
8081
|
+
ref: innerRef
|
|
8082
|
+
})));
|
|
8083
|
+
});
|
|
8022
8084
|
var BusinessSearchSelect$1 = /*#__PURE__*/React__default['default'].memo(BusinessSearchSelect, function (props, nextProps) {
|
|
8023
8085
|
if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
8024
8086
|
return false;
|
|
@@ -8331,7 +8393,9 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
8331
8393
|
_props$validDataUrl = props.validDataUrl,
|
|
8332
8394
|
validDataUrl = _props$validDataUrl === void 0 ? "/items/sku/import/check" : _props$validDataUrl,
|
|
8333
8395
|
_props$isBrandAuth = props.isBrandAuth,
|
|
8334
|
-
isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth
|
|
8396
|
+
isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth,
|
|
8397
|
+
_props$isCheckStockNu = props.isCheckStockNum,
|
|
8398
|
+
isCheckStockNum = _props$isCheckStockNu === void 0 ? true : _props$isCheckStockNu;
|
|
8335
8399
|
|
|
8336
8400
|
var _useState = React.useState({
|
|
8337
8401
|
maskClosable: false,
|
|
@@ -8395,7 +8459,8 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
8395
8459
|
},
|
|
8396
8460
|
columns: columns,
|
|
8397
8461
|
validDataUrl: validDataUrl,
|
|
8398
|
-
isBrandAuth: isBrandAuth
|
|
8462
|
+
isBrandAuth: isBrandAuth,
|
|
8463
|
+
isCheckStockNum: isCheckStockNum
|
|
8399
8464
|
})) || '');
|
|
8400
8465
|
};
|
|
8401
8466
|
|
package/package.json
CHANGED
|
@@ -14,7 +14,8 @@ const CommodityEntry = (props: any) => {
|
|
|
14
14
|
callbackHandleOk,
|
|
15
15
|
columns=["skuCode", "quantity", "price"],
|
|
16
16
|
validDataUrl="/items/sku/import/check",
|
|
17
|
-
isBrandAuth = true // 默认做品牌过滤
|
|
17
|
+
isBrandAuth = true, // 默认做品牌过滤
|
|
18
|
+
isCheckStockNum = true
|
|
18
19
|
} = props;
|
|
19
20
|
|
|
20
21
|
const [modalProps, setModalProps]: any = useState({
|
|
@@ -68,6 +69,7 @@ const CommodityEntry = (props: any) => {
|
|
|
68
69
|
columns={columns}
|
|
69
70
|
validDataUrl={validDataUrl}
|
|
70
71
|
isBrandAuth={isBrandAuth}
|
|
72
|
+
isCheckStockNum={isCheckStockNum}
|
|
71
73
|
/>
|
|
72
74
|
</Modal>
|
|
73
75
|
) || ''}
|
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: rodchen
|
|
4
4
|
* @Date: 2022-05-07 15:17:28
|
|
5
|
-
* @LastEditTime: 2022-
|
|
6
|
-
* @LastEditors:
|
|
5
|
+
* @LastEditTime: 2022-08-16 16:49:01
|
|
6
|
+
* @LastEditors: Sirius-kk
|
|
7
7
|
*/
|
|
8
|
-
import React, { useMemo } from 'react';
|
|
8
|
+
import React, { useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
9
9
|
import { commonFun } from './BusinessUtils';
|
|
10
10
|
import { handleDefaultPrefixUrl } from './utils';
|
|
11
11
|
import SearchSelect from '@/components/Functional/SearchSelect';
|
|
12
12
|
|
|
13
13
|
const MemoSearchSelect = React.memo(SearchSelect)
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const BusinessSearchSelect = forwardRef((props: any, ref: any) => {
|
|
16
16
|
const businessType = props?.selectBusinessType || 'supplier';
|
|
17
17
|
const prefixUrl = props?.prefixUrl || { selectPrefix: handleDefaultPrefixUrl(businessType), formSelectFix: handleDefaultPrefixUrl(businessType) };
|
|
18
|
+
const innerRef = useRef();
|
|
18
19
|
|
|
19
|
-
const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl,props?.requestConfig || {}, props?.modalTableProps || {});
|
|
20
|
+
const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl, props?.requestConfig || {}, props?.modalTableProps || {});
|
|
20
21
|
const currentProps = useMemo(() => {
|
|
21
22
|
return {
|
|
22
23
|
...props,
|
|
@@ -24,21 +25,25 @@ const BusinessSearchSelect = (props: any) => {
|
|
|
24
25
|
needModalTable,
|
|
25
26
|
modalTableProps
|
|
26
27
|
}
|
|
27
|
-
}, [props?.value])
|
|
28
|
+
}, [props?.value]);
|
|
29
|
+
|
|
30
|
+
useImperativeHandle(ref, () => ({
|
|
31
|
+
getRef: () => innerRef,
|
|
32
|
+
}))
|
|
28
33
|
|
|
29
34
|
return (
|
|
30
35
|
<div>
|
|
31
|
-
<MemoSearchSelect {...currentProps} />
|
|
36
|
+
<MemoSearchSelect {...currentProps} ref={innerRef} />
|
|
32
37
|
</div>
|
|
33
38
|
);
|
|
34
|
-
};
|
|
39
|
+
});
|
|
35
40
|
|
|
36
41
|
export default React.memo(BusinessSearchSelect, (props, nextProps) => {
|
|
37
|
-
if(props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
42
|
+
if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
38
43
|
return false
|
|
39
44
|
}
|
|
40
|
-
if(props && props.value !== nextProps.value) {
|
|
45
|
+
if (props && props.value !== nextProps.value) {
|
|
41
46
|
return false
|
|
42
47
|
}
|
|
43
48
|
return true
|
|
44
|
-
});
|
|
49
|
+
});
|
|
@@ -401,7 +401,7 @@ class DataValidation extends React.Component {
|
|
|
401
401
|
};
|
|
402
402
|
|
|
403
403
|
resetData = () => {
|
|
404
|
-
const { validDataUrl, updateData, columns, isBrandAuth } = this.props;
|
|
404
|
+
const { validDataUrl, updateData, columns, isBrandAuth, isCheckStockNum = true } = this.props;
|
|
405
405
|
const resultData = this.getData().filter(d => {
|
|
406
406
|
return _.compact(Object.values(d)).length
|
|
407
407
|
})
|
|
@@ -417,6 +417,7 @@ class DataValidation extends React.Component {
|
|
|
417
417
|
...otherParams,
|
|
418
418
|
columns: columns,
|
|
419
419
|
data: resultData,
|
|
420
|
+
checkStockNum: isCheckStockNum
|
|
420
421
|
})
|
|
421
422
|
.then((result) => {
|
|
422
423
|
result = result.data;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
4
|
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
@@ -11,20 +11,32 @@ import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
|
|
|
11
11
|
|
|
12
12
|
const { Option } = Select;
|
|
13
13
|
|
|
14
|
-
const SearchSelect = (props: any) => {
|
|
14
|
+
const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
15
15
|
const {
|
|
16
16
|
value, // 必传
|
|
17
17
|
onChange,
|
|
18
|
-
selectProps={},
|
|
19
|
-
modalTableProps={},
|
|
20
|
-
labelInValue=false,
|
|
18
|
+
selectProps = {},
|
|
19
|
+
modalTableProps = {},
|
|
20
|
+
labelInValue = false,
|
|
21
21
|
requestConfig,
|
|
22
22
|
ctx,
|
|
23
23
|
sourceName,
|
|
24
|
-
needModalTable=true,
|
|
25
|
-
getPopupContainer=undefined
|
|
24
|
+
needModalTable = true,
|
|
25
|
+
getPopupContainer = undefined
|
|
26
26
|
} = props;
|
|
27
|
-
const {
|
|
27
|
+
const {
|
|
28
|
+
url,
|
|
29
|
+
otherParams,// 默认参数
|
|
30
|
+
isMap,
|
|
31
|
+
fixedparameter,
|
|
32
|
+
fieldValToParam,
|
|
33
|
+
mappingTextField = 'name',
|
|
34
|
+
mappingTextShowKeyField,
|
|
35
|
+
mappingValueField = 'code',
|
|
36
|
+
mappingTextShowTextField,
|
|
37
|
+
init = true,// 是否初始请求
|
|
38
|
+
extralHeaders = {},// 额外请求头参数
|
|
39
|
+
} = requestConfig || {};
|
|
28
40
|
const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
|
|
29
41
|
|
|
30
42
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -57,10 +69,10 @@ const SearchSelect = (props: any) => {
|
|
|
57
69
|
(v?: any) => {
|
|
58
70
|
// 优化搜索参数 支持传多个
|
|
59
71
|
let searchParams = {};
|
|
60
|
-
if(typeof selectParamsKey === 'string') {
|
|
72
|
+
if (typeof selectParamsKey === 'string') {
|
|
61
73
|
searchParams = v ? { [selectParamsInitKey]: initVal } : { [selectParamsKey]: searchValue }
|
|
62
74
|
}
|
|
63
|
-
if(Array.isArray(selectParamsKey)) {
|
|
75
|
+
if (Array.isArray(selectParamsKey)) {
|
|
64
76
|
selectParamsKey.forEach((i: any) => {
|
|
65
77
|
searchParams = { ...searchParams, [i]: searchValue }
|
|
66
78
|
})
|
|
@@ -84,8 +96,27 @@ const SearchSelect = (props: any) => {
|
|
|
84
96
|
const [tableFormParams, setTableFormParams] = useState({});
|
|
85
97
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
86
98
|
|
|
99
|
+
useImperativeHandle(ref, () => ({
|
|
100
|
+
refreshDataSource: (reset: boolean = false) => {
|
|
101
|
+
if (reset) {
|
|
102
|
+
if (init) {
|
|
103
|
+
run('init');
|
|
104
|
+
} else {
|
|
105
|
+
setItems([]);
|
|
106
|
+
setItemsTotal(0);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
run();
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
clearDataSource: () => {
|
|
113
|
+
setItems([]);
|
|
114
|
+
setItemsTotal(0);
|
|
115
|
+
},
|
|
116
|
+
}))
|
|
117
|
+
|
|
87
118
|
// 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
88
|
-
const getData = (params={}, type=1) => {
|
|
119
|
+
const getData = (params = {}, type = 1) => {
|
|
89
120
|
if (!requestConfig) return;
|
|
90
121
|
|
|
91
122
|
setFetching(true)
|
|
@@ -145,13 +176,13 @@ const SearchSelect = (props: any) => {
|
|
|
145
176
|
delete params[key];
|
|
146
177
|
} else if (typeof element === 'boolean' && key.indexOf('*checkBox*') >= 0) {
|
|
147
178
|
const dataParams = key.split('*checkBox*');
|
|
148
|
-
if(element){
|
|
179
|
+
if (element) {
|
|
149
180
|
params[dataParams[0]] = 0
|
|
150
181
|
}
|
|
151
182
|
delete params[key];
|
|
152
|
-
}else if (element && key.indexOf('*cascader*') >= 0) {
|
|
183
|
+
} else if (element && key.indexOf('*cascader*') >= 0) {
|
|
153
184
|
const dataParams = key.split('*cascader*');
|
|
154
|
-
params[dataParams[0]] = element[element.length -1]
|
|
185
|
+
params[dataParams[0]] = element[element.length - 1]
|
|
155
186
|
delete params[key];
|
|
156
187
|
} else if (element && key.indexOf('*date*') >= 0) {
|
|
157
188
|
const dataParams = key.split('*date*')
|
|
@@ -185,9 +216,9 @@ const SearchSelect = (props: any) => {
|
|
|
185
216
|
params[`qp-${dataParams}-${params[key][0]}`] = params[key][1]
|
|
186
217
|
}
|
|
187
218
|
delete params[key]
|
|
188
|
-
}else if (Array.isArray(element)) {
|
|
219
|
+
} else if (Array.isArray(element)) {
|
|
189
220
|
params[key] = element.join(',');
|
|
190
|
-
} else if(element == null || element === undefined || String(element).trim() === '') {
|
|
221
|
+
} else if (element == null || element === undefined || String(element).trim() === '') {
|
|
191
222
|
delete params[key]
|
|
192
223
|
}
|
|
193
224
|
}
|
|
@@ -202,7 +233,11 @@ const SearchSelect = (props: any) => {
|
|
|
202
233
|
}
|
|
203
234
|
|
|
204
235
|
axios
|
|
205
|
-
.get(
|
|
236
|
+
.get(
|
|
237
|
+
`${url}?${stringify(queryParams)}`,
|
|
238
|
+
{
|
|
239
|
+
headers: { ...extralHeaders }
|
|
240
|
+
})
|
|
206
241
|
.then((result: any) => {
|
|
207
242
|
setFetching(false)
|
|
208
243
|
result = result.data;
|
|
@@ -225,9 +260,9 @@ const SearchSelect = (props: any) => {
|
|
|
225
260
|
? res[keys]
|
|
226
261
|
? res[keys].map((item: any) => {
|
|
227
262
|
let textShowText = item[mappingTextField]
|
|
228
|
-
if(mappingTextShowTextField) {
|
|
263
|
+
if (mappingTextShowTextField) {
|
|
229
264
|
textShowText = []
|
|
230
|
-
if(Array.isArray(mappingTextShowTextField)) {
|
|
265
|
+
if (Array.isArray(mappingTextShowTextField)) {
|
|
231
266
|
mappingTextShowTextField.forEach((r: any) => {
|
|
232
267
|
textShowText.push(item[r])
|
|
233
268
|
})
|
|
@@ -246,9 +281,9 @@ const SearchSelect = (props: any) => {
|
|
|
246
281
|
: Array.isArray(res) &&
|
|
247
282
|
res?.map((item: Record<string, any>) => {
|
|
248
283
|
let textShowText = item[mappingTextField]
|
|
249
|
-
if(mappingTextShowTextField) {
|
|
284
|
+
if (mappingTextShowTextField) {
|
|
250
285
|
textShowText = []
|
|
251
|
-
if(Array.isArray(mappingTextShowTextField)) {
|
|
286
|
+
if (Array.isArray(mappingTextShowTextField)) {
|
|
252
287
|
mappingTextShowTextField.forEach((r: any) => {
|
|
253
288
|
textShowText.push(item[r])
|
|
254
289
|
})
|
|
@@ -267,13 +302,13 @@ const SearchSelect = (props: any) => {
|
|
|
267
302
|
: [];
|
|
268
303
|
}
|
|
269
304
|
source = Array.isArray(source) ? source : []
|
|
270
|
-
if(type === 1) {
|
|
305
|
+
if (type === 1) {
|
|
271
306
|
ctx?.form?.setFieldSource(resultSourceKey, source)
|
|
272
307
|
setItems(source)
|
|
273
308
|
setItemsTotal(Number(res?.total || res?.totalCount || source.length))
|
|
274
309
|
} else {
|
|
275
310
|
setTableData(source)
|
|
276
|
-
setTablePagination({...tablePagination, total: Number(res?.total || res?.totalCount || source.length), pageSize: Number(res?.size || res?.pageSize || (params?.pageSize || pageSize)), current: Number(res?.page || res?.currentPage || (params?.currentPage || currentPage))})
|
|
311
|
+
setTablePagination({ ...tablePagination, total: Number(res?.total || res?.totalCount || source.length), pageSize: Number(res?.size || res?.pageSize || (params?.pageSize || pageSize)), current: Number(res?.page || res?.currentPage || (params?.currentPage || currentPage)) })
|
|
277
312
|
}
|
|
278
313
|
})
|
|
279
314
|
.catch((err) => { setFetching(false) });
|
|
@@ -290,26 +325,28 @@ const SearchSelect = (props: any) => {
|
|
|
290
325
|
if (isTouchGround && canPageAdd) {
|
|
291
326
|
const nextScrollPage = scrollPage + 1;
|
|
292
327
|
setScrollPage(nextScrollPage);
|
|
293
|
-
getData({currentPage: nextScrollPage}); // 调用api方法
|
|
328
|
+
getData({ currentPage: nextScrollPage }); // 调用api方法
|
|
294
329
|
}
|
|
295
330
|
|
|
296
331
|
//判断是否滑动到顶部
|
|
297
|
-
const isTouchTop = target.scrollTop ===0 // <=0
|
|
332
|
+
const isTouchTop = target.scrollTop === 0 // <=0
|
|
298
333
|
// 判断数据是否到第一页
|
|
299
334
|
const canPageJian = scrollPage > 1
|
|
300
335
|
if (isTouchTop && canPageJian) {
|
|
301
336
|
const preScrollPage = scrollPage - 1;
|
|
302
337
|
setScrollPage(preScrollPage);
|
|
303
|
-
getData({currentPage: preScrollPage}); // 调用api方法
|
|
338
|
+
getData({ currentPage: preScrollPage }); // 调用api方法
|
|
304
339
|
}
|
|
305
340
|
}
|
|
306
341
|
|
|
307
342
|
useEffect(() => {
|
|
308
|
-
|
|
343
|
+
if (init) {
|
|
344
|
+
run('init')
|
|
345
|
+
}
|
|
309
346
|
}, [])
|
|
310
347
|
|
|
311
348
|
useEffect(() => {
|
|
312
|
-
if(value) {
|
|
349
|
+
if (value) {
|
|
313
350
|
setPopValue(value);
|
|
314
351
|
}
|
|
315
352
|
}, [value]);
|
|
@@ -322,14 +359,14 @@ const SearchSelect = (props: any) => {
|
|
|
322
359
|
getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
|
|
323
360
|
setIsModalVisible(true);
|
|
324
361
|
// 回显
|
|
325
|
-
if(value) {
|
|
326
|
-
if(selectMode) {
|
|
362
|
+
if (value) {
|
|
363
|
+
if (selectMode) {
|
|
327
364
|
setSelectedRowKeys(labelInValue ? value.map(i => i.key) : value)
|
|
328
365
|
setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
|
|
329
366
|
setIndeterminate(!!value.length && value.length < itemsTotal);
|
|
330
367
|
setCheckedAll(itemsTotal && value.length === itemsTotal);
|
|
331
368
|
// 需清空数据
|
|
332
|
-
if(!value.length) {
|
|
369
|
+
if (!value.length) {
|
|
333
370
|
setDoubleArr([])
|
|
334
371
|
}
|
|
335
372
|
} else {
|
|
@@ -340,7 +377,7 @@ const SearchSelect = (props: any) => {
|
|
|
340
377
|
};
|
|
341
378
|
|
|
342
379
|
const handleSelectOver = (selectedValue: any) => {
|
|
343
|
-
if(selectedValue?.length) {
|
|
380
|
+
if (selectedValue?.length) {
|
|
344
381
|
formaData(selectedValue);
|
|
345
382
|
// 解决选择最后1页的sku,返回后,不显示名称问题
|
|
346
383
|
const source = _.uniqBy(items.concat(selectedValue), 'value')
|
|
@@ -355,7 +392,7 @@ const SearchSelect = (props: any) => {
|
|
|
355
392
|
};
|
|
356
393
|
|
|
357
394
|
const formaData = (value) => {
|
|
358
|
-
if(labelInValue) {
|
|
395
|
+
if (labelInValue) {
|
|
359
396
|
const formatResult = value.map((i: any) => ({ key: i[mappingValueField], label: i[mappingTextField], value: i[mappingValueField] }))
|
|
360
397
|
onChange(selectMode ? formatResult : formatResult[0])
|
|
361
398
|
} else {
|
|
@@ -368,26 +405,45 @@ const SearchSelect = (props: any) => {
|
|
|
368
405
|
form.resetFields();
|
|
369
406
|
setTableFormParams({});
|
|
370
407
|
setIsModalVisible(false);
|
|
371
|
-
if(selectMode) {
|
|
408
|
+
if (selectMode) {
|
|
372
409
|
run();
|
|
373
410
|
}
|
|
374
411
|
};
|
|
375
412
|
|
|
413
|
+
const refreshItems = () => {
|
|
414
|
+
// 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
|
|
415
|
+
if (fieldValToParam && ctx) {
|
|
416
|
+
let formValueList = [];
|
|
417
|
+
fieldValToParam.forEach((item: any, index: any) => {
|
|
418
|
+
const fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
419
|
+
formValueList.push(fixedParamVal);
|
|
420
|
+
});
|
|
421
|
+
if (formValueList.filter((item: any) => item).length > 0) {
|
|
422
|
+
run();
|
|
423
|
+
} else {
|
|
424
|
+
setItems([]);
|
|
425
|
+
setItemsTotal(0);
|
|
426
|
+
}
|
|
427
|
+
} else {
|
|
428
|
+
run();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
376
432
|
const onSearchChange = (e) => {
|
|
377
433
|
setSearchValue(e.target.value);
|
|
378
|
-
|
|
434
|
+
refreshItems();
|
|
379
435
|
}
|
|
380
436
|
|
|
381
437
|
const onSearchBlur = () => {
|
|
382
|
-
setSearchValue('')
|
|
383
|
-
|
|
438
|
+
setSearchValue('');
|
|
439
|
+
refreshItems();
|
|
384
440
|
}
|
|
385
441
|
|
|
386
442
|
const onSearchTable = () => {
|
|
387
443
|
const params = form.getFieldsValue();
|
|
388
444
|
setTableFormParams(params);
|
|
389
445
|
getData({ ...params, pageSize: tableInitPageSize }, 2)
|
|
390
|
-
if(selectMode){
|
|
446
|
+
if (selectMode) {
|
|
391
447
|
getData(params)
|
|
392
448
|
}
|
|
393
449
|
}
|
|
@@ -403,18 +459,18 @@ const SearchSelect = (props: any) => {
|
|
|
403
459
|
}
|
|
404
460
|
|
|
405
461
|
const onChangeCheckAll = (e) => {
|
|
406
|
-
if(e.target.checked) {
|
|
462
|
+
if (e.target.checked) {
|
|
407
463
|
// 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
|
|
408
464
|
// 如果超过100条 就默认查出所有数据
|
|
409
465
|
const currentItemsData = JSON.parse(JSON.stringify(items))
|
|
410
466
|
const totalPage = Math.ceil(itemsTotal / tablePagination?.pageSize)
|
|
411
|
-
for(let i=0; i <= totalPage-1; i++){
|
|
412
|
-
doubleArr[i] = currentItemsData.slice(tablePagination?.pageSize*i,tablePagination?.pageSize*(i+1))
|
|
467
|
+
for (let i = 0; i <= totalPage - 1; i++) {
|
|
468
|
+
doubleArr[i] = currentItemsData.slice(tablePagination?.pageSize * i, tablePagination?.pageSize * (i + 1))
|
|
413
469
|
}
|
|
414
470
|
setDoubleArr(doubleArr)
|
|
415
471
|
setSelectedRowKeys(currentItemsData.map(i => i.value))
|
|
416
472
|
setPopValue(currentItemsData);
|
|
417
|
-
if(items.length < itemsTotal) {
|
|
473
|
+
if (items.length < itemsTotal) {
|
|
418
474
|
// TODO 请求接口获取所有数据
|
|
419
475
|
}
|
|
420
476
|
} else {
|
|
@@ -466,13 +522,13 @@ const SearchSelect = (props: any) => {
|
|
|
466
522
|
return res.filter(Boolean); //去掉undefined的情况
|
|
467
523
|
};
|
|
468
524
|
|
|
469
|
-
const onChangeSelectedKeys=(selectKeys,selectRows) => {
|
|
525
|
+
const onChangeSelectedKeys = (selectKeys, selectRows) => {
|
|
470
526
|
const nowPage = tablePagination?.current;
|
|
471
527
|
|
|
472
528
|
let filterRows = []; // 存放拼接后的一维数组的变量
|
|
473
529
|
let sksResult = [];
|
|
474
530
|
|
|
475
|
-
if(selectMode) {
|
|
531
|
+
if (selectMode) {
|
|
476
532
|
// 处理多选分页累计选中
|
|
477
533
|
// 勾选生成二维数组
|
|
478
534
|
doubleArr[nowPage ? nowPage - 1 : 0] = selectRows
|
|
@@ -500,7 +556,7 @@ const SearchSelect = (props: any) => {
|
|
|
500
556
|
|
|
501
557
|
// 生成唯一值
|
|
502
558
|
const makeUniqueValue = () => {
|
|
503
|
-
const generateUnitKey = (((1+Math.random())*0x10000)|0).toString(16);
|
|
559
|
+
const generateUnitKey = (((1 + Math.random()) * 0x10000) | 0).toString(16);
|
|
504
560
|
setUniqueValue(generateUnitKey);
|
|
505
561
|
return generateUnitKey;
|
|
506
562
|
}
|
|
@@ -511,15 +567,17 @@ const SearchSelect = (props: any) => {
|
|
|
511
567
|
onChange: (sks, srs) => {
|
|
512
568
|
onChangeSelectedKeys(sks, srs)
|
|
513
569
|
},
|
|
514
|
-
getCheckboxProps: () =>
|
|
515
|
-
|
|
516
|
-
|
|
570
|
+
getCheckboxProps: () => {
|
|
571
|
+
return ({
|
|
572
|
+
disabled: selectProps?.disabled || props?.disabled || !items.length,
|
|
573
|
+
})
|
|
574
|
+
},
|
|
517
575
|
};
|
|
518
576
|
|
|
519
577
|
const onDoubleClickSelect = (e, record) => {
|
|
520
|
-
if(!selectMode) {
|
|
578
|
+
if (!selectMode && !(selectProps?.disabled || props?.disabled || !items.length)) {
|
|
521
579
|
const srs = [JSON.parse(JSON.stringify(record))]
|
|
522
|
-
const sks = srs.map((i:any) => i.value)
|
|
580
|
+
const sks = srs.map((i: any) => i.value)
|
|
523
581
|
onChangeSelectedKeys(sks, srs)
|
|
524
582
|
}
|
|
525
583
|
}
|
|
@@ -527,9 +585,9 @@ const SearchSelect = (props: any) => {
|
|
|
527
585
|
const themeColor = { color: '#1890ff' }
|
|
528
586
|
|
|
529
587
|
const formItem = (list) => {
|
|
530
|
-
if(isModalVisible && list?.length) {
|
|
588
|
+
if (isModalVisible && list?.length) {
|
|
531
589
|
return list.map((i: any) => {
|
|
532
|
-
if(i?.type === 'select' || i?.field?.type === 'select') {
|
|
590
|
+
if (i?.type === 'select' || i?.field?.type === 'select') {
|
|
533
591
|
return (
|
|
534
592
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
535
593
|
<Select style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}>
|
|
@@ -541,7 +599,7 @@ const SearchSelect = (props: any) => {
|
|
|
541
599
|
)
|
|
542
600
|
}
|
|
543
601
|
|
|
544
|
-
if(i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
|
|
602
|
+
if (i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
|
|
545
603
|
return (
|
|
546
604
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
547
605
|
<TreeSelect style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}></TreeSelect>
|
|
@@ -549,7 +607,7 @@ const SearchSelect = (props: any) => {
|
|
|
549
607
|
)
|
|
550
608
|
}
|
|
551
609
|
|
|
552
|
-
if(i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
610
|
+
if (i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
553
611
|
return (
|
|
554
612
|
<div>
|
|
555
613
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
@@ -586,16 +644,16 @@ const SearchSelect = (props: any) => {
|
|
|
586
644
|
}
|
|
587
645
|
|
|
588
646
|
const maxTagPlaceholder = (selectedValues) => {
|
|
589
|
-
const onClose = (e: any,item: any) => {
|
|
647
|
+
const onClose = (e: any, item: any) => {
|
|
590
648
|
e.preventDefault();
|
|
591
|
-
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value): JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
|
|
649
|
+
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value) : JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
|
|
592
650
|
onChange(newValue);
|
|
593
651
|
}
|
|
594
652
|
return (
|
|
595
653
|
<Tooltip title={selectedValues.map((i: any) => (
|
|
596
654
|
<Tag
|
|
597
655
|
closable={true}
|
|
598
|
-
onClose={(e) => onClose(e,i)}
|
|
656
|
+
onClose={(e) => onClose(e, i)}
|
|
599
657
|
style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
600
658
|
>
|
|
601
659
|
{i.label}
|
|
@@ -614,13 +672,14 @@ const SearchSelect = (props: any) => {
|
|
|
614
672
|
labelInValue={labelInValue}
|
|
615
673
|
value={value}
|
|
616
674
|
onChange={onChange}
|
|
675
|
+
disabled={props.disabled}
|
|
617
676
|
dropdownRender={menu => (
|
|
618
677
|
<>
|
|
619
678
|
<Input
|
|
620
679
|
value={searchValue}
|
|
621
680
|
style={{ width: '98%', marginLeft: '1%' }}
|
|
622
681
|
placeholder="请输入"
|
|
623
|
-
onChange={e=> onSearchChange(e)}
|
|
682
|
+
onChange={e => onSearchChange(e)}
|
|
624
683
|
onBlur={onSearchBlur}
|
|
625
684
|
onKeyDown={(e) => {
|
|
626
685
|
// 阻止多选的冒泡
|
|
@@ -633,7 +692,7 @@ const SearchSelect = (props: any) => {
|
|
|
633
692
|
)}
|
|
634
693
|
notFoundContent={
|
|
635
694
|
fetching ? <Spin size="small" /> :
|
|
636
|
-
<div style={{ textAlign: 'center'}}>
|
|
695
|
+
<div style={{ textAlign: 'center' }}>
|
|
637
696
|
<div style={{ marginBottom: 16 }}>
|
|
638
697
|
<CopyOutlined style={{ fontSize: '50px' }} />
|
|
639
698
|
</div>
|
|
@@ -641,7 +700,7 @@ const SearchSelect = (props: any) => {
|
|
|
641
700
|
</div>
|
|
642
701
|
}
|
|
643
702
|
onPopupScroll={SelectScroll}
|
|
644
|
-
style={{ width: needModalTable?'calc(100% - 30px)':'calc(100%)' }}
|
|
703
|
+
style={{ width: needModalTable ? 'calc(100% - 30px)' : 'calc(100%)' }}
|
|
645
704
|
placeholder="请选择"
|
|
646
705
|
maxTagPlaceholder={maxTagPlaceholder}
|
|
647
706
|
{...currentSelectProps}
|
|
@@ -654,7 +713,7 @@ const SearchSelect = (props: any) => {
|
|
|
654
713
|
))}
|
|
655
714
|
</Select>
|
|
656
715
|
{needModalTable && (
|
|
657
|
-
<Button style={{width: '30px', padding: '2px', height: 'auto'}} onClick={showModal} type="primary">
|
|
716
|
+
<Button style={{ width: '30px', padding: '2px', height: 'auto' }} onClick={showModal} type="primary">
|
|
658
717
|
<SearchOutlined />
|
|
659
718
|
</Button>
|
|
660
719
|
)}
|
|
@@ -666,7 +725,7 @@ const SearchSelect = (props: any) => {
|
|
|
666
725
|
visible={isModalVisible}
|
|
667
726
|
onOk={handleOk}
|
|
668
727
|
onCancel={handleCancel}
|
|
669
|
-
footer={selectMode?[
|
|
728
|
+
footer={selectMode ? [
|
|
670
729
|
<Button key="back" onClick={handleCancel}>
|
|
671
730
|
取消
|
|
672
731
|
</Button>,
|
|
@@ -678,11 +737,11 @@ const SearchSelect = (props: any) => {
|
|
|
678
737
|
>
|
|
679
738
|
确定
|
|
680
739
|
</Button>,
|
|
681
|
-
]:null}
|
|
740
|
+
] : null}
|
|
682
741
|
>
|
|
683
742
|
<div className={'search_select_wrapper'}>
|
|
684
743
|
<div className={'search_select_wrapper_click_flag'} onClick={() => setCaretLeftFlag(!caretLeftFlag)}>
|
|
685
|
-
<CaretLeftOutlined className={caretLeftFlag ? 'search_select_wrapper_click_flag_arrow' : 'search_select_wrapper_click_flag_arrow_1'
|
|
744
|
+
<CaretLeftOutlined className={caretLeftFlag ? 'search_select_wrapper_click_flag_arrow' : 'search_select_wrapper_click_flag_arrow_1'} />
|
|
686
745
|
</div>
|
|
687
746
|
<div className={caretLeftFlag ? 'search_select_wrapper_left' : 'search_select_wrapper_left1'}>
|
|
688
747
|
<div className={'select_list_columns'}>
|
|
@@ -694,11 +753,11 @@ const SearchSelect = (props: any) => {
|
|
|
694
753
|
</div>
|
|
695
754
|
</div>
|
|
696
755
|
<div className={'select_list_searchButton'}>
|
|
697
|
-
<Button key='reset' className={'select_list_button_space'}
|
|
756
|
+
<Button key='reset' className={'select_list_button_space'} onClick={onResetTable}>重置</Button>
|
|
698
757
|
<Button key='search' type="primary" onClick={onSearchTable}>查询</Button>
|
|
699
758
|
</div>
|
|
700
759
|
</div>
|
|
701
|
-
<div className={caretLeftFlag ? 'search_select_wrapper_right': 'search_select_wrapper_right1'}>
|
|
760
|
+
<div className={caretLeftFlag ? 'search_select_wrapper_right' : 'search_select_wrapper_right1'}>
|
|
702
761
|
<div>
|
|
703
762
|
<div className={'select_list_selectTips'}>
|
|
704
763
|
<div style={{ marginLeft: 8 }}>搜索结果共<span style={themeColor}>{tablePagination?.total || 0}</span>项{selectMode ? <span>, 本次已选<span style={themeColor}>{selectedRowKeys?.length || 0}</span>项</span> : ''}</div>
|
|
@@ -727,6 +786,6 @@ const SearchSelect = (props: any) => {
|
|
|
727
786
|
)}
|
|
728
787
|
</div>
|
|
729
788
|
);
|
|
730
|
-
};
|
|
789
|
+
});
|
|
731
790
|
|
|
732
791
|
export default SearchSelect;
|