@bit-sun/business-component 4.2.0-alpha.22 → 4.2.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -5339,8 +5339,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
5339
5339
|
searchStartLength = _ref.searchStartLength,
|
|
5340
5340
|
_ref$isQuery = _ref.isQuery,
|
|
5341
5341
|
isQuery = _ref$isQuery === void 0 ? false : _ref$isQuery,
|
|
5342
|
-
_ref$requestType = _ref.requestType
|
|
5343
|
-
requestType = _ref$requestType === void 0 ? 'get' : _ref$requestType;
|
|
5342
|
+
_ref$requestType = _ref.requestType;
|
|
5344
5343
|
var requestConfig = _objectSpread2({
|
|
5345
5344
|
url: url,
|
|
5346
5345
|
method: method,
|
|
@@ -5627,9 +5626,16 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
5627
5626
|
var getRequest;
|
|
5628
5627
|
var methodName = method === null || method === void 0 ? void 0 : (_method$toLocaleLower = method.toLocaleLowerCase) === null || _method$toLocaleLower === void 0 ? void 0 : _method$toLocaleLower.call(method);
|
|
5629
5628
|
if (['post', 'patch', 'put'].includes(methodName)) {
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5629
|
+
var bodyData = convertBodyParams(queryParams);
|
|
5630
|
+
var urlStr = convertUrlQueryParams(queryParams);
|
|
5631
|
+
// Fix: support sending params in body
|
|
5632
|
+
if (requestConfig.isBodyRequest) {
|
|
5633
|
+
if (!bodyData) {
|
|
5634
|
+
bodyData = convertQueryParams(queryParams);
|
|
5635
|
+
}
|
|
5636
|
+
urlStr = '';
|
|
5637
|
+
}
|
|
5638
|
+
getRequest = requestUtil[methodName]("".concat(url).concat(urlStr), bodyData, {
|
|
5633
5639
|
headers: _objectSpread2({}, extralHeaders)
|
|
5634
5640
|
});
|
|
5635
5641
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -5362,8 +5362,7 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
|
|
|
5362
5362
|
searchStartLength = _ref.searchStartLength,
|
|
5363
5363
|
_ref$isQuery = _ref.isQuery,
|
|
5364
5364
|
isQuery = _ref$isQuery === void 0 ? false : _ref$isQuery,
|
|
5365
|
-
_ref$requestType = _ref.requestType
|
|
5366
|
-
requestType = _ref$requestType === void 0 ? 'get' : _ref$requestType;
|
|
5365
|
+
_ref$requestType = _ref.requestType;
|
|
5367
5366
|
var requestConfig = _objectSpread2({
|
|
5368
5367
|
url: url,
|
|
5369
5368
|
method: method,
|
|
@@ -5650,9 +5649,16 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
|
|
|
5650
5649
|
var getRequest;
|
|
5651
5650
|
var methodName = method === null || method === void 0 ? void 0 : (_method$toLocaleLower = method.toLocaleLowerCase) === null || _method$toLocaleLower === void 0 ? void 0 : _method$toLocaleLower.call(method);
|
|
5652
5651
|
if (['post', 'patch', 'put'].includes(methodName)) {
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5652
|
+
var bodyData = convertBodyParams(queryParams);
|
|
5653
|
+
var urlStr = convertUrlQueryParams(queryParams);
|
|
5654
|
+
// Fix: support sending params in body
|
|
5655
|
+
if (requestConfig.isBodyRequest) {
|
|
5656
|
+
if (!bodyData) {
|
|
5657
|
+
bodyData = convertQueryParams(queryParams);
|
|
5658
|
+
}
|
|
5659
|
+
urlStr = '';
|
|
5660
|
+
}
|
|
5661
|
+
getRequest = requestUtil[methodName]("".concat(url).concat(urlStr), bodyData, {
|
|
5656
5662
|
headers: _objectSpread2({}, extralHeaders)
|
|
5657
5663
|
});
|
|
5658
5664
|
} else {
|
package/package.json
CHANGED
|
@@ -138,4 +138,113 @@ export default () => {
|
|
|
138
138
|
};
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
+
## POST Body Request Demo
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import React, { useState } from 'react';
|
|
145
|
+
import { Button } from 'antd';
|
|
146
|
+
import { SearchSelect } from '../../../index';
|
|
147
|
+
|
|
148
|
+
export default () => {
|
|
149
|
+
const [tableSource, setTableSource] = useState([]);
|
|
150
|
+
const userInfo = { employeeResVo: { id: 'mock-id' } }; // Mock userInfo
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<SearchSelect
|
|
154
|
+
selectBusinessType="salesOrder" // Custom key
|
|
155
|
+
modalTableProps={{
|
|
156
|
+
modalTableTitle: '选择销售单明细',
|
|
157
|
+
tableSearchForm: [
|
|
158
|
+
{
|
|
159
|
+
name: 'orderNo',
|
|
160
|
+
label: '单据编号',
|
|
161
|
+
item: {
|
|
162
|
+
type: 'input'
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'orderDate',
|
|
167
|
+
label: '单据日期',
|
|
168
|
+
item: {
|
|
169
|
+
type: 'rangepicker'
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'saleOrgCode',
|
|
174
|
+
label: '销售组织',
|
|
175
|
+
item: {
|
|
176
|
+
type: 'select',
|
|
177
|
+
props: {
|
|
178
|
+
showSearch: true,
|
|
179
|
+
optionFilterProp: 'children'
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
remoteSource: {
|
|
183
|
+
url: `/user/orgViewNode/listNoPage?qp-orgViewCode-eq=sales-organizational-view&qp-employeeId-eq=${userInfo?.employeeResVo?.id}`,
|
|
184
|
+
method: 'GET',
|
|
185
|
+
converter: ({ data }: { data: any }) => {
|
|
186
|
+
return (
|
|
187
|
+
(data &&
|
|
188
|
+
Array.isArray(data) &&
|
|
189
|
+
data.length &&
|
|
190
|
+
data.map((v: any) => ({ text: v.name, value: v.code }))) ||
|
|
191
|
+
[]
|
|
192
|
+
);
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'customerCode',
|
|
198
|
+
label: '客户',
|
|
199
|
+
item: {
|
|
200
|
+
type: 'bs-customer2SearchSelect',
|
|
201
|
+
props: {
|
|
202
|
+
selectBusinessType: 'customer2',
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
tableColumns: [
|
|
208
|
+
{ title: '单据编号', key: 'orderNo' },
|
|
209
|
+
{ title: '单据日期', key: 'orderDate' },
|
|
210
|
+
{ title: '销售组织', key: 'saleDepartmentName' },
|
|
211
|
+
{ title: '客户', key: 'customerName' },
|
|
212
|
+
{ title: 'SKU', key: 'skuCode' },
|
|
213
|
+
{ title: '商品名称', key: 'spuName' },
|
|
214
|
+
{ title: '数量', key: 'planQuantity' },
|
|
215
|
+
{ title: '销售金额', key: 'saleTaxedAmount' },
|
|
216
|
+
],
|
|
217
|
+
}}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
fieldComponent={<Button type="primary">新增</Button>}
|
|
221
|
+
selectProps={{
|
|
222
|
+
mode: 'multiple', // Allow multiple selection
|
|
223
|
+
}}
|
|
224
|
+
onSaveCallback={(rows: any) => {
|
|
225
|
+
if (!rows || rows.length === 0) return;
|
|
226
|
+
const newDetails = rows.map((item: any) => ({
|
|
227
|
+
key: Date.now() + Math.random(),
|
|
228
|
+
saleOrderNo: item.orderNo,
|
|
229
|
+
saleOrderDetailLineNo: item.lineNo,
|
|
230
|
+
skuCode: item.skuCode,
|
|
231
|
+
quantity: item.planQuantity,
|
|
232
|
+
saleAmount: item.saleTaxedAmount,
|
|
233
|
+
subsidyAmount: 0,
|
|
234
|
+
}));
|
|
235
|
+
setTableSource([...tableSource, ...newDetails]);
|
|
236
|
+
return Promise.resolve();
|
|
237
|
+
}}
|
|
238
|
+
requestConfig={{
|
|
239
|
+
url: '/drp-ops/new/tradeSubOrder/pageListAndDetailByData',
|
|
240
|
+
method: 'post',
|
|
241
|
+
isBodyRequest: true, // Enable body params for POST
|
|
242
|
+
mappingValueField: 'detailId', // Unique ID for selection
|
|
243
|
+
mappingTextField: 'orderNo', // Just for display if needed
|
|
244
|
+
}}
|
|
245
|
+
/>
|
|
246
|
+
);
|
|
247
|
+
};
|
|
248
|
+
```
|
|
249
|
+
|
|
141
250
|
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -7,7 +7,7 @@ import request from '@/utils/request';
|
|
|
7
7
|
import _, { escapeRegExp, isNil, values, cloneDeep, isEmpty } from "lodash"
|
|
8
8
|
import './index.less';
|
|
9
9
|
import { BusinessSearchSelect, QueryMutipleInput, QueryMutipleSearchSelect } from '@/index';
|
|
10
|
-
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder, getShowStr, handleTableColumns } from './utils';
|
|
10
|
+
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder, getShowStr, handleTableColumns, convertQueryParams } from './utils';
|
|
11
11
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
12
12
|
import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
|
|
13
13
|
import PropertySelector from '@/components/Business/PropertyModal';
|
|
@@ -242,7 +242,17 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
242
242
|
let getRequest;
|
|
243
243
|
const methodName = method?.toLocaleLowerCase?.();
|
|
244
244
|
if(['post','patch','put'].includes(methodName)) {
|
|
245
|
-
|
|
245
|
+
let bodyData = convertBodyParams(queryParams);
|
|
246
|
+
let urlStr = convertUrlQueryParams(queryParams);
|
|
247
|
+
|
|
248
|
+
// Fix: support sending params in body
|
|
249
|
+
if(requestConfig.isBodyRequest) {
|
|
250
|
+
if(!bodyData) {
|
|
251
|
+
bodyData = convertQueryParams(queryParams);
|
|
252
|
+
}
|
|
253
|
+
urlStr = '';
|
|
254
|
+
}
|
|
255
|
+
getRequest = request[methodName](`${url}${urlStr}`,bodyData, { headers: { ...extralHeaders }})
|
|
246
256
|
} else {
|
|
247
257
|
getRequest = request.get( `${url}${convertUrlQueryParams(queryParams)}`,{headers: { ...extralHeaders }})
|
|
248
258
|
}
|