@bit-sun/business-component 2.0.13 → 2.0.16
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 +97 -24
- package/dist/index.js +96 -23
- 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/BillEntry/index.tsx +0 -1
- package/src/components/Functional/DataValidation/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/index.tsx +134 -69
|
@@ -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,
|
|
@@ -3484,7 +3486,8 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3484
3486
|
_props$needModalTable = props.needModalTable,
|
|
3485
3487
|
needModalTable = _props$needModalTable === void 0 ? true : _props$needModalTable,
|
|
3486
3488
|
_props$getPopupContai = props.getPopupContainer,
|
|
3487
|
-
_getPopupContainer = _props$getPopupContai === void 0 ? undefined : _props$getPopupContai
|
|
3489
|
+
_getPopupContainer = _props$getPopupContai === void 0 ? undefined : _props$getPopupContai,
|
|
3490
|
+
fieldComponent = props.fieldComponent;
|
|
3488
3491
|
|
|
3489
3492
|
var _ref = requestConfig || {},
|
|
3490
3493
|
url = _ref.url,
|
|
@@ -3497,7 +3500,11 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3497
3500
|
mappingTextShowKeyField = _ref.mappingTextShowKeyField,
|
|
3498
3501
|
_ref$mappingValueFiel = _ref.mappingValueField,
|
|
3499
3502
|
mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
|
|
3500
|
-
mappingTextShowTextField = _ref.mappingTextShowTextField
|
|
3503
|
+
mappingTextShowTextField = _ref.mappingTextShowTextField,
|
|
3504
|
+
_ref$init = _ref.init,
|
|
3505
|
+
init = _ref$init === void 0 ? true : _ref$init,
|
|
3506
|
+
_ref$extralHeaders = _ref.extralHeaders,
|
|
3507
|
+
extralHeaders = _ref$extralHeaders === void 0 ? {} : _ref$extralHeaders;
|
|
3501
3508
|
|
|
3502
3509
|
var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
|
|
3503
3510
|
var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -3635,8 +3642,30 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3635
3642
|
var _useState33 = useState(false),
|
|
3636
3643
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
3637
3644
|
tooltipVisible = _useState34[0],
|
|
3638
|
-
setTooltipVisible = _useState34[1];
|
|
3645
|
+
setTooltipVisible = _useState34[1];
|
|
3639
3646
|
|
|
3647
|
+
useImperativeHandle(ref, function () {
|
|
3648
|
+
return {
|
|
3649
|
+
refreshDataSource: function refreshDataSource() {
|
|
3650
|
+
var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3651
|
+
|
|
3652
|
+
if (reset) {
|
|
3653
|
+
if (init) {
|
|
3654
|
+
run('init');
|
|
3655
|
+
} else {
|
|
3656
|
+
setItems([]);
|
|
3657
|
+
setItemsTotal(0);
|
|
3658
|
+
}
|
|
3659
|
+
} else {
|
|
3660
|
+
run();
|
|
3661
|
+
}
|
|
3662
|
+
},
|
|
3663
|
+
clearDataSource: function clearDataSource() {
|
|
3664
|
+
setItems([]);
|
|
3665
|
+
setItemsTotal(0);
|
|
3666
|
+
}
|
|
3667
|
+
};
|
|
3668
|
+
}); // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
3640
3669
|
|
|
3641
3670
|
var getData = function getData() {
|
|
3642
3671
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -3759,7 +3788,9 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3759
3788
|
currentPage: currentPage
|
|
3760
3789
|
}, otherParams), fixedParam), params);
|
|
3761
3790
|
|
|
3762
|
-
axios.get("".concat(url, "?").concat(stringify(queryParams))
|
|
3791
|
+
axios.get("".concat(url, "?").concat(stringify(queryParams)), {
|
|
3792
|
+
headers: _objectSpread2({}, extralHeaders)
|
|
3793
|
+
}).then(function (result) {
|
|
3763
3794
|
var _result, _result2;
|
|
3764
3795
|
|
|
3765
3796
|
setFetching(false);
|
|
@@ -3882,7 +3913,9 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3882
3913
|
};
|
|
3883
3914
|
|
|
3884
3915
|
useEffect(function () {
|
|
3885
|
-
|
|
3916
|
+
if (init) {
|
|
3917
|
+
run('init');
|
|
3918
|
+
}
|
|
3886
3919
|
}, []);
|
|
3887
3920
|
useEffect(function () {
|
|
3888
3921
|
if (value) {
|
|
@@ -3980,14 +4013,36 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3980
4013
|
}
|
|
3981
4014
|
};
|
|
3982
4015
|
|
|
4016
|
+
var refreshItems = function refreshItems() {
|
|
4017
|
+
// 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
|
|
4018
|
+
if (fieldValToParam && ctx) {
|
|
4019
|
+
var formValueList = [];
|
|
4020
|
+
fieldValToParam.forEach(function (item, index) {
|
|
4021
|
+
var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
4022
|
+
formValueList.push(fixedParamVal);
|
|
4023
|
+
});
|
|
4024
|
+
|
|
4025
|
+
if (formValueList.filter(function (item) {
|
|
4026
|
+
return item;
|
|
4027
|
+
}).length > 0) {
|
|
4028
|
+
run();
|
|
4029
|
+
} else {
|
|
4030
|
+
setItems([]);
|
|
4031
|
+
setItemsTotal(0);
|
|
4032
|
+
}
|
|
4033
|
+
} else {
|
|
4034
|
+
run();
|
|
4035
|
+
}
|
|
4036
|
+
};
|
|
4037
|
+
|
|
3983
4038
|
var onSearchChange = function onSearchChange(e) {
|
|
3984
4039
|
setSearchValue(e.target.value);
|
|
3985
|
-
|
|
4040
|
+
refreshItems();
|
|
3986
4041
|
};
|
|
3987
4042
|
|
|
3988
4043
|
var onSearchBlur = function onSearchBlur() {
|
|
3989
4044
|
setSearchValue('');
|
|
3990
|
-
|
|
4045
|
+
refreshItems();
|
|
3991
4046
|
};
|
|
3992
4047
|
|
|
3993
4048
|
var onSearchTable = function onSearchTable() {
|
|
@@ -4139,13 +4194,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4139
4194
|
},
|
|
4140
4195
|
getCheckboxProps: function getCheckboxProps() {
|
|
4141
4196
|
return {
|
|
4142
|
-
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
4197
|
+
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled) || !items.length
|
|
4143
4198
|
};
|
|
4144
4199
|
}
|
|
4145
4200
|
};
|
|
4146
4201
|
|
|
4147
4202
|
var onDoubleClickSelect = function onDoubleClickSelect(e, record) {
|
|
4148
|
-
if (!selectMode) {
|
|
4203
|
+
if (!selectMode && !((selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled) || !items.length)) {
|
|
4149
4204
|
var srs = [JSON.parse(JSON.stringify(record))];
|
|
4150
4205
|
var sks = srs.map(function (i) {
|
|
4151
4206
|
return i.value;
|
|
@@ -4268,7 +4323,14 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4268
4323
|
|
|
4269
4324
|
return /*#__PURE__*/React.createElement("div", {
|
|
4270
4325
|
className: 'search_select'
|
|
4271
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4326
|
+
}, fieldComponent ? /*#__PURE__*/React.createElement("div", {
|
|
4327
|
+
onClick: function onClick() {
|
|
4328
|
+
var _fieldComponent$props, _fieldComponent$props2;
|
|
4329
|
+
|
|
4330
|
+
(_fieldComponent$props = fieldComponent.props) === null || _fieldComponent$props === void 0 ? void 0 : (_fieldComponent$props2 = _fieldComponent$props.onClick) === null || _fieldComponent$props2 === void 0 ? void 0 : _fieldComponent$props2.call(_fieldComponent$props);
|
|
4331
|
+
showModal();
|
|
4332
|
+
}
|
|
4333
|
+
}, fieldComponent) : /*#__PURE__*/React.createElement("div", {
|
|
4272
4334
|
className: "search_select_show",
|
|
4273
4335
|
id: "search_select_div_".concat(uniqueValue)
|
|
4274
4336
|
}, /*#__PURE__*/React.createElement(Select, _objectSpread2(_objectSpread2({
|
|
@@ -4276,6 +4338,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4276
4338
|
labelInValue: labelInValue,
|
|
4277
4339
|
value: value,
|
|
4278
4340
|
onChange: onChange,
|
|
4341
|
+
disabled: props.disabled,
|
|
4279
4342
|
dropdownRender: function dropdownRender(menu) {
|
|
4280
4343
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
|
|
4281
4344
|
value: searchValue,
|
|
@@ -4428,7 +4491,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4428
4491
|
onChange: onChangeCheckAll,
|
|
4429
4492
|
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
4430
4493
|
}), " \u5168\u9009\u6240\u6709\u9875\u9762") : '')))));
|
|
4431
|
-
};
|
|
4494
|
+
});
|
|
4432
4495
|
|
|
4433
4496
|
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
4497
|
styleInject(css_248z$4);
|
|
@@ -6077,7 +6140,6 @@ var BillEntry = function BillEntry(_ref3) {
|
|
|
6077
6140
|
title: '单位',
|
|
6078
6141
|
dataIndex: 'selectUnitCode',
|
|
6079
6142
|
width: 100,
|
|
6080
|
-
isSelectItem: true,
|
|
6081
6143
|
render: function render(text, record) {
|
|
6082
6144
|
var _record$packingUnitLi;
|
|
6083
6145
|
|
|
@@ -7985,13 +8047,13 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
|
|
|
7985
8047
|
}
|
|
7986
8048
|
|
|
7987
8049
|
var MemoSearchSelect = /*#__PURE__*/React.memo(SearchSelect);
|
|
7988
|
-
|
|
7989
|
-
var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
8050
|
+
var BusinessSearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
7990
8051
|
var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
|
|
7991
8052
|
var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
|
|
7992
8053
|
selectPrefix: handleDefaultPrefixUrl(businessType),
|
|
7993
8054
|
formSelectFix: handleDefaultPrefixUrl(businessType)
|
|
7994
8055
|
};
|
|
8056
|
+
var innerRef = useRef();
|
|
7995
8057
|
|
|
7996
8058
|
var _commonFun = commonFun(businessType, prefixUrl, (props === null || props === void 0 ? void 0 : props.requestConfig) || {}, (props === null || props === void 0 ? void 0 : props.modalTableProps) || {}),
|
|
7997
8059
|
requestConfig = _commonFun.requestConfig,
|
|
@@ -8005,9 +8067,17 @@ var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
|
8005
8067
|
modalTableProps: modalTableProps
|
|
8006
8068
|
});
|
|
8007
8069
|
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8070
|
+
useImperativeHandle(ref, function () {
|
|
8071
|
+
return {
|
|
8072
|
+
getRef: function getRef() {
|
|
8073
|
+
return innerRef;
|
|
8074
|
+
}
|
|
8075
|
+
};
|
|
8076
|
+
});
|
|
8077
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MemoSearchSelect, _objectSpread2(_objectSpread2({}, currentProps), {}, {
|
|
8078
|
+
ref: innerRef
|
|
8079
|
+
})));
|
|
8080
|
+
});
|
|
8011
8081
|
var BusinessSearchSelect$1 = /*#__PURE__*/React.memo(BusinessSearchSelect, function (props, nextProps) {
|
|
8012
8082
|
if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
8013
8083
|
return false;
|
|
@@ -8320,7 +8390,9 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
8320
8390
|
_props$validDataUrl = props.validDataUrl,
|
|
8321
8391
|
validDataUrl = _props$validDataUrl === void 0 ? "/items/sku/import/check" : _props$validDataUrl,
|
|
8322
8392
|
_props$isBrandAuth = props.isBrandAuth,
|
|
8323
|
-
isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth
|
|
8393
|
+
isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth,
|
|
8394
|
+
_props$isCheckStockNu = props.isCheckStockNum,
|
|
8395
|
+
isCheckStockNum = _props$isCheckStockNu === void 0 ? true : _props$isCheckStockNu;
|
|
8324
8396
|
|
|
8325
8397
|
var _useState = useState({
|
|
8326
8398
|
maskClosable: false,
|
|
@@ -8384,7 +8456,8 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
8384
8456
|
},
|
|
8385
8457
|
columns: columns,
|
|
8386
8458
|
validDataUrl: validDataUrl,
|
|
8387
|
-
isBrandAuth: isBrandAuth
|
|
8459
|
+
isBrandAuth: isBrandAuth,
|
|
8460
|
+
isCheckStockNum: isCheckStockNum
|
|
8388
8461
|
})) || '');
|
|
8389
8462
|
};
|
|
8390
8463
|
|
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,
|
|
@@ -3495,7 +3497,8 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3495
3497
|
_props$needModalTable = props.needModalTable,
|
|
3496
3498
|
needModalTable = _props$needModalTable === void 0 ? true : _props$needModalTable,
|
|
3497
3499
|
_props$getPopupContai = props.getPopupContainer,
|
|
3498
|
-
_getPopupContainer = _props$getPopupContai === void 0 ? undefined : _props$getPopupContai
|
|
3500
|
+
_getPopupContainer = _props$getPopupContai === void 0 ? undefined : _props$getPopupContai,
|
|
3501
|
+
fieldComponent = props.fieldComponent;
|
|
3499
3502
|
|
|
3500
3503
|
var _ref = requestConfig || {},
|
|
3501
3504
|
url = _ref.url,
|
|
@@ -3508,7 +3511,11 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3508
3511
|
mappingTextShowKeyField = _ref.mappingTextShowKeyField,
|
|
3509
3512
|
_ref$mappingValueFiel = _ref.mappingValueField,
|
|
3510
3513
|
mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
|
|
3511
|
-
mappingTextShowTextField = _ref.mappingTextShowTextField
|
|
3514
|
+
mappingTextShowTextField = _ref.mappingTextShowTextField,
|
|
3515
|
+
_ref$init = _ref.init,
|
|
3516
|
+
init = _ref$init === void 0 ? true : _ref$init,
|
|
3517
|
+
_ref$extralHeaders = _ref.extralHeaders,
|
|
3518
|
+
extralHeaders = _ref$extralHeaders === void 0 ? {} : _ref$extralHeaders;
|
|
3512
3519
|
|
|
3513
3520
|
var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
|
|
3514
3521
|
var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -3646,8 +3653,30 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3646
3653
|
var _useState33 = React.useState(false),
|
|
3647
3654
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
3648
3655
|
tooltipVisible = _useState34[0],
|
|
3649
|
-
setTooltipVisible = _useState34[1];
|
|
3656
|
+
setTooltipVisible = _useState34[1];
|
|
3650
3657
|
|
|
3658
|
+
React.useImperativeHandle(ref, function () {
|
|
3659
|
+
return {
|
|
3660
|
+
refreshDataSource: function refreshDataSource() {
|
|
3661
|
+
var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3662
|
+
|
|
3663
|
+
if (reset) {
|
|
3664
|
+
if (init) {
|
|
3665
|
+
run('init');
|
|
3666
|
+
} else {
|
|
3667
|
+
setItems([]);
|
|
3668
|
+
setItemsTotal(0);
|
|
3669
|
+
}
|
|
3670
|
+
} else {
|
|
3671
|
+
run();
|
|
3672
|
+
}
|
|
3673
|
+
},
|
|
3674
|
+
clearDataSource: function clearDataSource() {
|
|
3675
|
+
setItems([]);
|
|
3676
|
+
setItemsTotal(0);
|
|
3677
|
+
}
|
|
3678
|
+
};
|
|
3679
|
+
}); // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
3651
3680
|
|
|
3652
3681
|
var getData = function getData() {
|
|
3653
3682
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -3770,7 +3799,9 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3770
3799
|
currentPage: currentPage
|
|
3771
3800
|
}, otherParams), fixedParam), params);
|
|
3772
3801
|
|
|
3773
|
-
axios__default['default'].get("".concat(url, "?").concat(querystring.stringify(queryParams))
|
|
3802
|
+
axios__default['default'].get("".concat(url, "?").concat(querystring.stringify(queryParams)), {
|
|
3803
|
+
headers: _objectSpread2({}, extralHeaders)
|
|
3804
|
+
}).then(function (result) {
|
|
3774
3805
|
var _result, _result2;
|
|
3775
3806
|
|
|
3776
3807
|
setFetching(false);
|
|
@@ -3893,7 +3924,9 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3893
3924
|
};
|
|
3894
3925
|
|
|
3895
3926
|
React.useEffect(function () {
|
|
3896
|
-
|
|
3927
|
+
if (init) {
|
|
3928
|
+
run('init');
|
|
3929
|
+
}
|
|
3897
3930
|
}, []);
|
|
3898
3931
|
React.useEffect(function () {
|
|
3899
3932
|
if (value) {
|
|
@@ -3991,14 +4024,36 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
3991
4024
|
}
|
|
3992
4025
|
};
|
|
3993
4026
|
|
|
4027
|
+
var refreshItems = function refreshItems() {
|
|
4028
|
+
// 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
|
|
4029
|
+
if (fieldValToParam && ctx) {
|
|
4030
|
+
var formValueList = [];
|
|
4031
|
+
fieldValToParam.forEach(function (item, index) {
|
|
4032
|
+
var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
4033
|
+
formValueList.push(fixedParamVal);
|
|
4034
|
+
});
|
|
4035
|
+
|
|
4036
|
+
if (formValueList.filter(function (item) {
|
|
4037
|
+
return item;
|
|
4038
|
+
}).length > 0) {
|
|
4039
|
+
run();
|
|
4040
|
+
} else {
|
|
4041
|
+
setItems([]);
|
|
4042
|
+
setItemsTotal(0);
|
|
4043
|
+
}
|
|
4044
|
+
} else {
|
|
4045
|
+
run();
|
|
4046
|
+
}
|
|
4047
|
+
};
|
|
4048
|
+
|
|
3994
4049
|
var onSearchChange = function onSearchChange(e) {
|
|
3995
4050
|
setSearchValue(e.target.value);
|
|
3996
|
-
|
|
4051
|
+
refreshItems();
|
|
3997
4052
|
};
|
|
3998
4053
|
|
|
3999
4054
|
var onSearchBlur = function onSearchBlur() {
|
|
4000
4055
|
setSearchValue('');
|
|
4001
|
-
|
|
4056
|
+
refreshItems();
|
|
4002
4057
|
};
|
|
4003
4058
|
|
|
4004
4059
|
var onSearchTable = function onSearchTable() {
|
|
@@ -4150,13 +4205,13 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4150
4205
|
},
|
|
4151
4206
|
getCheckboxProps: function getCheckboxProps() {
|
|
4152
4207
|
return {
|
|
4153
|
-
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
4208
|
+
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled) || !items.length
|
|
4154
4209
|
};
|
|
4155
4210
|
}
|
|
4156
4211
|
};
|
|
4157
4212
|
|
|
4158
4213
|
var onDoubleClickSelect = function onDoubleClickSelect(e, record) {
|
|
4159
|
-
if (!selectMode) {
|
|
4214
|
+
if (!selectMode && !((selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled) || !items.length)) {
|
|
4160
4215
|
var srs = [JSON.parse(JSON.stringify(record))];
|
|
4161
4216
|
var sks = srs.map(function (i) {
|
|
4162
4217
|
return i.value;
|
|
@@ -4279,7 +4334,14 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4279
4334
|
|
|
4280
4335
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4281
4336
|
className: 'search_select'
|
|
4282
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4337
|
+
}, fieldComponent ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4338
|
+
onClick: function onClick() {
|
|
4339
|
+
var _fieldComponent$props, _fieldComponent$props2;
|
|
4340
|
+
|
|
4341
|
+
(_fieldComponent$props = fieldComponent.props) === null || _fieldComponent$props === void 0 ? void 0 : (_fieldComponent$props2 = _fieldComponent$props.onClick) === null || _fieldComponent$props2 === void 0 ? void 0 : _fieldComponent$props2.call(_fieldComponent$props);
|
|
4342
|
+
showModal();
|
|
4343
|
+
}
|
|
4344
|
+
}, fieldComponent) : /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4283
4345
|
className: "search_select_show",
|
|
4284
4346
|
id: "search_select_div_".concat(uniqueValue)
|
|
4285
4347
|
}, /*#__PURE__*/React__default['default'].createElement(antd.Select, _objectSpread2(_objectSpread2({
|
|
@@ -4287,6 +4349,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4287
4349
|
labelInValue: labelInValue,
|
|
4288
4350
|
value: value,
|
|
4289
4351
|
onChange: onChange,
|
|
4352
|
+
disabled: props.disabled,
|
|
4290
4353
|
dropdownRender: function dropdownRender(menu) {
|
|
4291
4354
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
|
|
4292
4355
|
value: searchValue,
|
|
@@ -4439,7 +4502,7 @@ var SearchSelect = function SearchSelect(props) {
|
|
|
4439
4502
|
onChange: onChangeCheckAll,
|
|
4440
4503
|
disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
|
|
4441
4504
|
}), " \u5168\u9009\u6240\u6709\u9875\u9762") : '')))));
|
|
4442
|
-
};
|
|
4505
|
+
});
|
|
4443
4506
|
|
|
4444
4507
|
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
4508
|
styleInject(css_248z$4);
|
|
@@ -6088,7 +6151,6 @@ var BillEntry = function BillEntry(_ref3) {
|
|
|
6088
6151
|
title: '单位',
|
|
6089
6152
|
dataIndex: 'selectUnitCode',
|
|
6090
6153
|
width: 100,
|
|
6091
|
-
isSelectItem: true,
|
|
6092
6154
|
render: function render(text, record) {
|
|
6093
6155
|
var _record$packingUnitLi;
|
|
6094
6156
|
|
|
@@ -7996,13 +8058,13 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
|
|
|
7996
8058
|
}
|
|
7997
8059
|
|
|
7998
8060
|
var MemoSearchSelect = /*#__PURE__*/React__default['default'].memo(SearchSelect);
|
|
7999
|
-
|
|
8000
|
-
var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
8061
|
+
var BusinessSearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
8001
8062
|
var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
|
|
8002
8063
|
var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
|
|
8003
8064
|
selectPrefix: handleDefaultPrefixUrl(businessType),
|
|
8004
8065
|
formSelectFix: handleDefaultPrefixUrl(businessType)
|
|
8005
8066
|
};
|
|
8067
|
+
var innerRef = React.useRef();
|
|
8006
8068
|
|
|
8007
8069
|
var _commonFun = commonFun(businessType, prefixUrl, (props === null || props === void 0 ? void 0 : props.requestConfig) || {}, (props === null || props === void 0 ? void 0 : props.modalTableProps) || {}),
|
|
8008
8070
|
requestConfig = _commonFun.requestConfig,
|
|
@@ -8016,9 +8078,17 @@ var BusinessSearchSelect = function BusinessSearchSelect(props) {
|
|
|
8016
8078
|
modalTableProps: modalTableProps
|
|
8017
8079
|
});
|
|
8018
8080
|
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8081
|
+
React.useImperativeHandle(ref, function () {
|
|
8082
|
+
return {
|
|
8083
|
+
getRef: function getRef() {
|
|
8084
|
+
return innerRef;
|
|
8085
|
+
}
|
|
8086
|
+
};
|
|
8087
|
+
});
|
|
8088
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MemoSearchSelect, _objectSpread2(_objectSpread2({}, currentProps), {}, {
|
|
8089
|
+
ref: innerRef
|
|
8090
|
+
})));
|
|
8091
|
+
});
|
|
8022
8092
|
var BusinessSearchSelect$1 = /*#__PURE__*/React__default['default'].memo(BusinessSearchSelect, function (props, nextProps) {
|
|
8023
8093
|
if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
8024
8094
|
return false;
|
|
@@ -8331,7 +8401,9 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
8331
8401
|
_props$validDataUrl = props.validDataUrl,
|
|
8332
8402
|
validDataUrl = _props$validDataUrl === void 0 ? "/items/sku/import/check" : _props$validDataUrl,
|
|
8333
8403
|
_props$isBrandAuth = props.isBrandAuth,
|
|
8334
|
-
isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth
|
|
8404
|
+
isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth,
|
|
8405
|
+
_props$isCheckStockNu = props.isCheckStockNum,
|
|
8406
|
+
isCheckStockNum = _props$isCheckStockNu === void 0 ? true : _props$isCheckStockNu;
|
|
8335
8407
|
|
|
8336
8408
|
var _useState = React.useState({
|
|
8337
8409
|
maskClosable: false,
|
|
@@ -8395,7 +8467,8 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
8395
8467
|
},
|
|
8396
8468
|
columns: columns,
|
|
8397
8469
|
validDataUrl: validDataUrl,
|
|
8398
|
-
isBrandAuth: isBrandAuth
|
|
8470
|
+
isBrandAuth: isBrandAuth,
|
|
8471
|
+
isCheckStockNum: isCheckStockNum
|
|
8399
8472
|
})) || '');
|
|
8400
8473
|
};
|
|
8401
8474
|
|
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
|
+
});
|
|
@@ -416,7 +416,6 @@ const BillEntry: React.FC = ({ onSaveCallback }) => {
|
|
|
416
416
|
title: '单位',
|
|
417
417
|
dataIndex: 'selectUnitCode',
|
|
418
418
|
width: 100,
|
|
419
|
-
isSelectItem: true,
|
|
420
419
|
render: (text: any, record: any) => {
|
|
421
420
|
if (record?.packingUnitList?.length) {
|
|
422
421
|
const basePackUnit = record?.packingUnitList[0]
|
|
@@ -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,33 @@ 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
|
+
fieldComponent,
|
|
26
27
|
} = props;
|
|
27
|
-
const {
|
|
28
|
+
const {
|
|
29
|
+
url,
|
|
30
|
+
otherParams,// 默认参数
|
|
31
|
+
isMap,
|
|
32
|
+
fixedparameter,
|
|
33
|
+
fieldValToParam,
|
|
34
|
+
mappingTextField = 'name',
|
|
35
|
+
mappingTextShowKeyField,
|
|
36
|
+
mappingValueField = 'code',
|
|
37
|
+
mappingTextShowTextField,
|
|
38
|
+
init = true,// 是否初始请求
|
|
39
|
+
extralHeaders = {},// 额外请求头参数
|
|
40
|
+
} = requestConfig || {};
|
|
28
41
|
const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
|
|
29
42
|
|
|
30
43
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -57,10 +70,10 @@ const SearchSelect = (props: any) => {
|
|
|
57
70
|
(v?: any) => {
|
|
58
71
|
// 优化搜索参数 支持传多个
|
|
59
72
|
let searchParams = {};
|
|
60
|
-
if(typeof selectParamsKey === 'string') {
|
|
73
|
+
if (typeof selectParamsKey === 'string') {
|
|
61
74
|
searchParams = v ? { [selectParamsInitKey]: initVal } : { [selectParamsKey]: searchValue }
|
|
62
75
|
}
|
|
63
|
-
if(Array.isArray(selectParamsKey)) {
|
|
76
|
+
if (Array.isArray(selectParamsKey)) {
|
|
64
77
|
selectParamsKey.forEach((i: any) => {
|
|
65
78
|
searchParams = { ...searchParams, [i]: searchValue }
|
|
66
79
|
})
|
|
@@ -84,8 +97,27 @@ const SearchSelect = (props: any) => {
|
|
|
84
97
|
const [tableFormParams, setTableFormParams] = useState({});
|
|
85
98
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
86
99
|
|
|
100
|
+
useImperativeHandle(ref, () => ({
|
|
101
|
+
refreshDataSource: (reset: boolean = false) => {
|
|
102
|
+
if (reset) {
|
|
103
|
+
if (init) {
|
|
104
|
+
run('init');
|
|
105
|
+
} else {
|
|
106
|
+
setItems([]);
|
|
107
|
+
setItemsTotal(0);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
run();
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
clearDataSource: () => {
|
|
114
|
+
setItems([]);
|
|
115
|
+
setItemsTotal(0);
|
|
116
|
+
},
|
|
117
|
+
}))
|
|
118
|
+
|
|
87
119
|
// 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
88
|
-
const getData = (params={}, type=1) => {
|
|
120
|
+
const getData = (params = {}, type = 1) => {
|
|
89
121
|
if (!requestConfig) return;
|
|
90
122
|
|
|
91
123
|
setFetching(true)
|
|
@@ -145,13 +177,13 @@ const SearchSelect = (props: any) => {
|
|
|
145
177
|
delete params[key];
|
|
146
178
|
} else if (typeof element === 'boolean' && key.indexOf('*checkBox*') >= 0) {
|
|
147
179
|
const dataParams = key.split('*checkBox*');
|
|
148
|
-
if(element){
|
|
180
|
+
if (element) {
|
|
149
181
|
params[dataParams[0]] = 0
|
|
150
182
|
}
|
|
151
183
|
delete params[key];
|
|
152
|
-
}else if (element && key.indexOf('*cascader*') >= 0) {
|
|
184
|
+
} else if (element && key.indexOf('*cascader*') >= 0) {
|
|
153
185
|
const dataParams = key.split('*cascader*');
|
|
154
|
-
params[dataParams[0]] = element[element.length -1]
|
|
186
|
+
params[dataParams[0]] = element[element.length - 1]
|
|
155
187
|
delete params[key];
|
|
156
188
|
} else if (element && key.indexOf('*date*') >= 0) {
|
|
157
189
|
const dataParams = key.split('*date*')
|
|
@@ -185,9 +217,9 @@ const SearchSelect = (props: any) => {
|
|
|
185
217
|
params[`qp-${dataParams}-${params[key][0]}`] = params[key][1]
|
|
186
218
|
}
|
|
187
219
|
delete params[key]
|
|
188
|
-
}else if (Array.isArray(element)) {
|
|
220
|
+
} else if (Array.isArray(element)) {
|
|
189
221
|
params[key] = element.join(',');
|
|
190
|
-
} else if(element == null || element === undefined || String(element).trim() === '') {
|
|
222
|
+
} else if (element == null || element === undefined || String(element).trim() === '') {
|
|
191
223
|
delete params[key]
|
|
192
224
|
}
|
|
193
225
|
}
|
|
@@ -202,7 +234,11 @@ const SearchSelect = (props: any) => {
|
|
|
202
234
|
}
|
|
203
235
|
|
|
204
236
|
axios
|
|
205
|
-
.get(
|
|
237
|
+
.get(
|
|
238
|
+
`${url}?${stringify(queryParams)}`,
|
|
239
|
+
{
|
|
240
|
+
headers: { ...extralHeaders }
|
|
241
|
+
})
|
|
206
242
|
.then((result: any) => {
|
|
207
243
|
setFetching(false)
|
|
208
244
|
result = result.data;
|
|
@@ -225,9 +261,9 @@ const SearchSelect = (props: any) => {
|
|
|
225
261
|
? res[keys]
|
|
226
262
|
? res[keys].map((item: any) => {
|
|
227
263
|
let textShowText = item[mappingTextField]
|
|
228
|
-
if(mappingTextShowTextField) {
|
|
264
|
+
if (mappingTextShowTextField) {
|
|
229
265
|
textShowText = []
|
|
230
|
-
if(Array.isArray(mappingTextShowTextField)) {
|
|
266
|
+
if (Array.isArray(mappingTextShowTextField)) {
|
|
231
267
|
mappingTextShowTextField.forEach((r: any) => {
|
|
232
268
|
textShowText.push(item[r])
|
|
233
269
|
})
|
|
@@ -246,9 +282,9 @@ const SearchSelect = (props: any) => {
|
|
|
246
282
|
: Array.isArray(res) &&
|
|
247
283
|
res?.map((item: Record<string, any>) => {
|
|
248
284
|
let textShowText = item[mappingTextField]
|
|
249
|
-
if(mappingTextShowTextField) {
|
|
285
|
+
if (mappingTextShowTextField) {
|
|
250
286
|
textShowText = []
|
|
251
|
-
if(Array.isArray(mappingTextShowTextField)) {
|
|
287
|
+
if (Array.isArray(mappingTextShowTextField)) {
|
|
252
288
|
mappingTextShowTextField.forEach((r: any) => {
|
|
253
289
|
textShowText.push(item[r])
|
|
254
290
|
})
|
|
@@ -267,13 +303,13 @@ const SearchSelect = (props: any) => {
|
|
|
267
303
|
: [];
|
|
268
304
|
}
|
|
269
305
|
source = Array.isArray(source) ? source : []
|
|
270
|
-
if(type === 1) {
|
|
306
|
+
if (type === 1) {
|
|
271
307
|
ctx?.form?.setFieldSource(resultSourceKey, source)
|
|
272
308
|
setItems(source)
|
|
273
309
|
setItemsTotal(Number(res?.total || res?.totalCount || source.length))
|
|
274
310
|
} else {
|
|
275
311
|
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))})
|
|
312
|
+
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
313
|
}
|
|
278
314
|
})
|
|
279
315
|
.catch((err) => { setFetching(false) });
|
|
@@ -290,26 +326,28 @@ const SearchSelect = (props: any) => {
|
|
|
290
326
|
if (isTouchGround && canPageAdd) {
|
|
291
327
|
const nextScrollPage = scrollPage + 1;
|
|
292
328
|
setScrollPage(nextScrollPage);
|
|
293
|
-
getData({currentPage: nextScrollPage}); // 调用api方法
|
|
329
|
+
getData({ currentPage: nextScrollPage }); // 调用api方法
|
|
294
330
|
}
|
|
295
331
|
|
|
296
332
|
//判断是否滑动到顶部
|
|
297
|
-
const isTouchTop = target.scrollTop ===0 // <=0
|
|
333
|
+
const isTouchTop = target.scrollTop === 0 // <=0
|
|
298
334
|
// 判断数据是否到第一页
|
|
299
335
|
const canPageJian = scrollPage > 1
|
|
300
336
|
if (isTouchTop && canPageJian) {
|
|
301
337
|
const preScrollPage = scrollPage - 1;
|
|
302
338
|
setScrollPage(preScrollPage);
|
|
303
|
-
getData({currentPage: preScrollPage}); // 调用api方法
|
|
339
|
+
getData({ currentPage: preScrollPage }); // 调用api方法
|
|
304
340
|
}
|
|
305
341
|
}
|
|
306
342
|
|
|
307
343
|
useEffect(() => {
|
|
308
|
-
|
|
344
|
+
if (init) {
|
|
345
|
+
run('init')
|
|
346
|
+
}
|
|
309
347
|
}, [])
|
|
310
348
|
|
|
311
349
|
useEffect(() => {
|
|
312
|
-
if(value) {
|
|
350
|
+
if (value) {
|
|
313
351
|
setPopValue(value);
|
|
314
352
|
}
|
|
315
353
|
}, [value]);
|
|
@@ -322,14 +360,14 @@ const SearchSelect = (props: any) => {
|
|
|
322
360
|
getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
|
|
323
361
|
setIsModalVisible(true);
|
|
324
362
|
// 回显
|
|
325
|
-
if(value) {
|
|
326
|
-
if(selectMode) {
|
|
363
|
+
if (value) {
|
|
364
|
+
if (selectMode) {
|
|
327
365
|
setSelectedRowKeys(labelInValue ? value.map(i => i.key) : value)
|
|
328
366
|
setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
|
|
329
367
|
setIndeterminate(!!value.length && value.length < itemsTotal);
|
|
330
368
|
setCheckedAll(itemsTotal && value.length === itemsTotal);
|
|
331
369
|
// 需清空数据
|
|
332
|
-
if(!value.length) {
|
|
370
|
+
if (!value.length) {
|
|
333
371
|
setDoubleArr([])
|
|
334
372
|
}
|
|
335
373
|
} else {
|
|
@@ -340,7 +378,7 @@ const SearchSelect = (props: any) => {
|
|
|
340
378
|
};
|
|
341
379
|
|
|
342
380
|
const handleSelectOver = (selectedValue: any) => {
|
|
343
|
-
if(selectedValue?.length) {
|
|
381
|
+
if (selectedValue?.length) {
|
|
344
382
|
formaData(selectedValue);
|
|
345
383
|
// 解决选择最后1页的sku,返回后,不显示名称问题
|
|
346
384
|
const source = _.uniqBy(items.concat(selectedValue), 'value')
|
|
@@ -355,7 +393,7 @@ const SearchSelect = (props: any) => {
|
|
|
355
393
|
};
|
|
356
394
|
|
|
357
395
|
const formaData = (value) => {
|
|
358
|
-
if(labelInValue) {
|
|
396
|
+
if (labelInValue) {
|
|
359
397
|
const formatResult = value.map((i: any) => ({ key: i[mappingValueField], label: i[mappingTextField], value: i[mappingValueField] }))
|
|
360
398
|
onChange(selectMode ? formatResult : formatResult[0])
|
|
361
399
|
} else {
|
|
@@ -368,26 +406,45 @@ const SearchSelect = (props: any) => {
|
|
|
368
406
|
form.resetFields();
|
|
369
407
|
setTableFormParams({});
|
|
370
408
|
setIsModalVisible(false);
|
|
371
|
-
if(selectMode) {
|
|
409
|
+
if (selectMode) {
|
|
372
410
|
run();
|
|
373
411
|
}
|
|
374
412
|
};
|
|
375
413
|
|
|
414
|
+
const refreshItems = () => {
|
|
415
|
+
// 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
|
|
416
|
+
if (fieldValToParam && ctx) {
|
|
417
|
+
let formValueList = [];
|
|
418
|
+
fieldValToParam.forEach((item: any, index: any) => {
|
|
419
|
+
const fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
420
|
+
formValueList.push(fixedParamVal);
|
|
421
|
+
});
|
|
422
|
+
if (formValueList.filter((item: any) => item).length > 0) {
|
|
423
|
+
run();
|
|
424
|
+
} else {
|
|
425
|
+
setItems([]);
|
|
426
|
+
setItemsTotal(0);
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
run();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
376
433
|
const onSearchChange = (e) => {
|
|
377
434
|
setSearchValue(e.target.value);
|
|
378
|
-
|
|
435
|
+
refreshItems();
|
|
379
436
|
}
|
|
380
437
|
|
|
381
438
|
const onSearchBlur = () => {
|
|
382
|
-
setSearchValue('')
|
|
383
|
-
|
|
439
|
+
setSearchValue('');
|
|
440
|
+
refreshItems();
|
|
384
441
|
}
|
|
385
442
|
|
|
386
443
|
const onSearchTable = () => {
|
|
387
444
|
const params = form.getFieldsValue();
|
|
388
445
|
setTableFormParams(params);
|
|
389
446
|
getData({ ...params, pageSize: tableInitPageSize }, 2)
|
|
390
|
-
if(selectMode){
|
|
447
|
+
if (selectMode) {
|
|
391
448
|
getData(params)
|
|
392
449
|
}
|
|
393
450
|
}
|
|
@@ -403,18 +460,18 @@ const SearchSelect = (props: any) => {
|
|
|
403
460
|
}
|
|
404
461
|
|
|
405
462
|
const onChangeCheckAll = (e) => {
|
|
406
|
-
if(e.target.checked) {
|
|
463
|
+
if (e.target.checked) {
|
|
407
464
|
// 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
|
|
408
465
|
// 如果超过100条 就默认查出所有数据
|
|
409
466
|
const currentItemsData = JSON.parse(JSON.stringify(items))
|
|
410
467
|
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))
|
|
468
|
+
for (let i = 0; i <= totalPage - 1; i++) {
|
|
469
|
+
doubleArr[i] = currentItemsData.slice(tablePagination?.pageSize * i, tablePagination?.pageSize * (i + 1))
|
|
413
470
|
}
|
|
414
471
|
setDoubleArr(doubleArr)
|
|
415
472
|
setSelectedRowKeys(currentItemsData.map(i => i.value))
|
|
416
473
|
setPopValue(currentItemsData);
|
|
417
|
-
if(items.length < itemsTotal) {
|
|
474
|
+
if (items.length < itemsTotal) {
|
|
418
475
|
// TODO 请求接口获取所有数据
|
|
419
476
|
}
|
|
420
477
|
} else {
|
|
@@ -466,13 +523,13 @@ const SearchSelect = (props: any) => {
|
|
|
466
523
|
return res.filter(Boolean); //去掉undefined的情况
|
|
467
524
|
};
|
|
468
525
|
|
|
469
|
-
const onChangeSelectedKeys=(selectKeys,selectRows) => {
|
|
526
|
+
const onChangeSelectedKeys = (selectKeys, selectRows) => {
|
|
470
527
|
const nowPage = tablePagination?.current;
|
|
471
528
|
|
|
472
529
|
let filterRows = []; // 存放拼接后的一维数组的变量
|
|
473
530
|
let sksResult = [];
|
|
474
531
|
|
|
475
|
-
if(selectMode) {
|
|
532
|
+
if (selectMode) {
|
|
476
533
|
// 处理多选分页累计选中
|
|
477
534
|
// 勾选生成二维数组
|
|
478
535
|
doubleArr[nowPage ? nowPage - 1 : 0] = selectRows
|
|
@@ -500,7 +557,7 @@ const SearchSelect = (props: any) => {
|
|
|
500
557
|
|
|
501
558
|
// 生成唯一值
|
|
502
559
|
const makeUniqueValue = () => {
|
|
503
|
-
const generateUnitKey = (((1+Math.random())*0x10000)|0).toString(16);
|
|
560
|
+
const generateUnitKey = (((1 + Math.random()) * 0x10000) | 0).toString(16);
|
|
504
561
|
setUniqueValue(generateUnitKey);
|
|
505
562
|
return generateUnitKey;
|
|
506
563
|
}
|
|
@@ -511,15 +568,17 @@ const SearchSelect = (props: any) => {
|
|
|
511
568
|
onChange: (sks, srs) => {
|
|
512
569
|
onChangeSelectedKeys(sks, srs)
|
|
513
570
|
},
|
|
514
|
-
getCheckboxProps: () =>
|
|
515
|
-
|
|
516
|
-
|
|
571
|
+
getCheckboxProps: () => {
|
|
572
|
+
return ({
|
|
573
|
+
disabled: selectProps?.disabled || props?.disabled || !items.length,
|
|
574
|
+
})
|
|
575
|
+
},
|
|
517
576
|
};
|
|
518
577
|
|
|
519
578
|
const onDoubleClickSelect = (e, record) => {
|
|
520
|
-
if(!selectMode) {
|
|
579
|
+
if (!selectMode && !(selectProps?.disabled || props?.disabled || !items.length)) {
|
|
521
580
|
const srs = [JSON.parse(JSON.stringify(record))]
|
|
522
|
-
const sks = srs.map((i:any) => i.value)
|
|
581
|
+
const sks = srs.map((i: any) => i.value)
|
|
523
582
|
onChangeSelectedKeys(sks, srs)
|
|
524
583
|
}
|
|
525
584
|
}
|
|
@@ -527,9 +586,9 @@ const SearchSelect = (props: any) => {
|
|
|
527
586
|
const themeColor = { color: '#1890ff' }
|
|
528
587
|
|
|
529
588
|
const formItem = (list) => {
|
|
530
|
-
if(isModalVisible && list?.length) {
|
|
589
|
+
if (isModalVisible && list?.length) {
|
|
531
590
|
return list.map((i: any) => {
|
|
532
|
-
if(i?.type === 'select' || i?.field?.type === 'select') {
|
|
591
|
+
if (i?.type === 'select' || i?.field?.type === 'select') {
|
|
533
592
|
return (
|
|
534
593
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
535
594
|
<Select style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}>
|
|
@@ -541,7 +600,7 @@ const SearchSelect = (props: any) => {
|
|
|
541
600
|
)
|
|
542
601
|
}
|
|
543
602
|
|
|
544
|
-
if(i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
|
|
603
|
+
if (i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
|
|
545
604
|
return (
|
|
546
605
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
547
606
|
<TreeSelect style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}></TreeSelect>
|
|
@@ -549,7 +608,7 @@ const SearchSelect = (props: any) => {
|
|
|
549
608
|
)
|
|
550
609
|
}
|
|
551
610
|
|
|
552
|
-
if(i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
611
|
+
if (i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
553
612
|
return (
|
|
554
613
|
<div>
|
|
555
614
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
@@ -586,16 +645,16 @@ const SearchSelect = (props: any) => {
|
|
|
586
645
|
}
|
|
587
646
|
|
|
588
647
|
const maxTagPlaceholder = (selectedValues) => {
|
|
589
|
-
const onClose = (e: any,item: any) => {
|
|
648
|
+
const onClose = (e: any, item: any) => {
|
|
590
649
|
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)
|
|
650
|
+
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
651
|
onChange(newValue);
|
|
593
652
|
}
|
|
594
653
|
return (
|
|
595
654
|
<Tooltip title={selectedValues.map((i: any) => (
|
|
596
655
|
<Tag
|
|
597
656
|
closable={true}
|
|
598
|
-
onClose={(e) => onClose(e,i)}
|
|
657
|
+
onClose={(e) => onClose(e, i)}
|
|
599
658
|
style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
600
659
|
>
|
|
601
660
|
{i.label}
|
|
@@ -608,19 +667,25 @@ const SearchSelect = (props: any) => {
|
|
|
608
667
|
|
|
609
668
|
return (
|
|
610
669
|
<div className={'search_select'}>
|
|
611
|
-
|
|
670
|
+
{fieldComponent ?
|
|
671
|
+
(<div onClick={() => {
|
|
672
|
+
fieldComponent.props?.onClick?.()
|
|
673
|
+
showModal()
|
|
674
|
+
}}>{fieldComponent}</div>) :
|
|
675
|
+
(<div className="search_select_show" id={`search_select_div_${uniqueValue}`}>
|
|
612
676
|
<Select
|
|
613
677
|
virtual
|
|
614
678
|
labelInValue={labelInValue}
|
|
615
679
|
value={value}
|
|
616
680
|
onChange={onChange}
|
|
681
|
+
disabled={props.disabled}
|
|
617
682
|
dropdownRender={menu => (
|
|
618
683
|
<>
|
|
619
684
|
<Input
|
|
620
685
|
value={searchValue}
|
|
621
686
|
style={{ width: '98%', marginLeft: '1%' }}
|
|
622
687
|
placeholder="请输入"
|
|
623
|
-
onChange={e=> onSearchChange(e)}
|
|
688
|
+
onChange={e => onSearchChange(e)}
|
|
624
689
|
onBlur={onSearchBlur}
|
|
625
690
|
onKeyDown={(e) => {
|
|
626
691
|
// 阻止多选的冒泡
|
|
@@ -633,7 +698,7 @@ const SearchSelect = (props: any) => {
|
|
|
633
698
|
)}
|
|
634
699
|
notFoundContent={
|
|
635
700
|
fetching ? <Spin size="small" /> :
|
|
636
|
-
<div style={{ textAlign: 'center'}}>
|
|
701
|
+
<div style={{ textAlign: 'center' }}>
|
|
637
702
|
<div style={{ marginBottom: 16 }}>
|
|
638
703
|
<CopyOutlined style={{ fontSize: '50px' }} />
|
|
639
704
|
</div>
|
|
@@ -641,7 +706,7 @@ const SearchSelect = (props: any) => {
|
|
|
641
706
|
</div>
|
|
642
707
|
}
|
|
643
708
|
onPopupScroll={SelectScroll}
|
|
644
|
-
style={{ width: needModalTable?'calc(100% - 30px)':'calc(100%)' }}
|
|
709
|
+
style={{ width: needModalTable ? 'calc(100% - 30px)' : 'calc(100%)' }}
|
|
645
710
|
placeholder="请选择"
|
|
646
711
|
maxTagPlaceholder={maxTagPlaceholder}
|
|
647
712
|
{...currentSelectProps}
|
|
@@ -654,11 +719,11 @@ const SearchSelect = (props: any) => {
|
|
|
654
719
|
))}
|
|
655
720
|
</Select>
|
|
656
721
|
{needModalTable && (
|
|
657
|
-
<Button style={{width: '30px', padding: '2px', height: 'auto'}} onClick={showModal} type="primary">
|
|
722
|
+
<Button style={{ width: '30px', padding: '2px', height: 'auto' }} onClick={showModal} type="primary">
|
|
658
723
|
<SearchOutlined />
|
|
659
724
|
</Button>
|
|
660
725
|
)}
|
|
661
|
-
</div>
|
|
726
|
+
</div>)}
|
|
662
727
|
{needModalTable && isModalVisible && (
|
|
663
728
|
<Modal
|
|
664
729
|
width='80%'
|
|
@@ -666,7 +731,7 @@ const SearchSelect = (props: any) => {
|
|
|
666
731
|
visible={isModalVisible}
|
|
667
732
|
onOk={handleOk}
|
|
668
733
|
onCancel={handleCancel}
|
|
669
|
-
footer={selectMode?[
|
|
734
|
+
footer={selectMode ? [
|
|
670
735
|
<Button key="back" onClick={handleCancel}>
|
|
671
736
|
取消
|
|
672
737
|
</Button>,
|
|
@@ -678,11 +743,11 @@ const SearchSelect = (props: any) => {
|
|
|
678
743
|
>
|
|
679
744
|
确定
|
|
680
745
|
</Button>,
|
|
681
|
-
]:null}
|
|
746
|
+
] : null}
|
|
682
747
|
>
|
|
683
748
|
<div className={'search_select_wrapper'}>
|
|
684
749
|
<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'
|
|
750
|
+
<CaretLeftOutlined className={caretLeftFlag ? 'search_select_wrapper_click_flag_arrow' : 'search_select_wrapper_click_flag_arrow_1'} />
|
|
686
751
|
</div>
|
|
687
752
|
<div className={caretLeftFlag ? 'search_select_wrapper_left' : 'search_select_wrapper_left1'}>
|
|
688
753
|
<div className={'select_list_columns'}>
|
|
@@ -694,11 +759,11 @@ const SearchSelect = (props: any) => {
|
|
|
694
759
|
</div>
|
|
695
760
|
</div>
|
|
696
761
|
<div className={'select_list_searchButton'}>
|
|
697
|
-
<Button key='reset' className={'select_list_button_space'}
|
|
762
|
+
<Button key='reset' className={'select_list_button_space'} onClick={onResetTable}>重置</Button>
|
|
698
763
|
<Button key='search' type="primary" onClick={onSearchTable}>查询</Button>
|
|
699
764
|
</div>
|
|
700
765
|
</div>
|
|
701
|
-
<div className={caretLeftFlag ? 'search_select_wrapper_right': 'search_select_wrapper_right1'}>
|
|
766
|
+
<div className={caretLeftFlag ? 'search_select_wrapper_right' : 'search_select_wrapper_right1'}>
|
|
702
767
|
<div>
|
|
703
768
|
<div className={'select_list_selectTips'}>
|
|
704
769
|
<div style={{ marginLeft: 8 }}>搜索结果共<span style={themeColor}>{tablePagination?.total || 0}</span>项{selectMode ? <span>, 本次已选<span style={themeColor}>{selectedRowKeys?.length || 0}</span>项</span> : ''}</div>
|
|
@@ -727,6 +792,6 @@ const SearchSelect = (props: any) => {
|
|
|
727
792
|
)}
|
|
728
793
|
</div>
|
|
729
794
|
);
|
|
730
|
-
};
|
|
795
|
+
});
|
|
731
796
|
|
|
732
797
|
export default SearchSelect;
|