@bit-sun/business-component 1.1.6 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +174 -0
- package/dist/components/SearchSelect/business/BusinessUtils.d.ts +4 -4
- package/dist/index.esm.js +265 -100
- package/dist/index.js +264 -99
- package/package.json +2 -2
- package/src/components/SearchSelect/business/BusinessSearchSelect.tsx +3 -2
- package/src/components/SearchSelect/business/BusinessUtils.ts +162 -71
- package/src/components/SearchSelect/business/index.md +43 -2
- package/src/components/SearchSelect/index.less +1 -1
- package/src/components/SearchSelect/index.md +3 -3
- package/src/components/SearchSelect/index.tsx +42 -26
|
@@ -70,14 +70,14 @@ const loadSelectSource = (url: string, params?: any) => {
|
|
|
70
70
|
})
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
export function commonFun (type?: string) {
|
|
73
|
+
export function commonFun (type?: string, prefixUrl: any) {
|
|
74
74
|
// 默认type === 'supplier' 供应商选择器
|
|
75
75
|
let requestConfig = {
|
|
76
|
-
url:
|
|
77
|
-
filter: 'qp-
|
|
78
|
-
otherParams: {
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
url: `${prefixUrl.selectPrefix}/supplier`,
|
|
77
|
+
filter: 'qp-nameAndCode-like', // 过滤参数
|
|
78
|
+
otherParams: {
|
|
79
|
+
sorter: 'desc-id'
|
|
80
|
+
}, // 默认参数
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/*
|
|
@@ -88,12 +88,37 @@ export function commonFun (type?: string) {
|
|
|
88
88
|
* changePosition 必传 为搜索表单Form中需要更改数据源的Item项的位置
|
|
89
89
|
* changeSearchForm 必传 为搜索表单Form数据
|
|
90
90
|
* */
|
|
91
|
-
const formatSource = (reData: any, position: number, changePosition: number,changeSearchForm: any) => {
|
|
92
|
-
const data = reData && reData[position]?.data
|
|
93
|
-
const
|
|
91
|
+
const formatSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['code', 'name']) => {
|
|
92
|
+
const data = reData && reData[position]?.data;
|
|
93
|
+
const list = Array.isArray(data) ? data :(data?.items || data?.list || []);
|
|
94
|
+
const formatData = list?.length ? list.map((v: any) => ({ text: v[resKeyValue[1]], value: v[resKeyValue[0]] })) : [];
|
|
94
95
|
changeSearchForm[changePosition] = {...changeSearchForm[changePosition], initialSource: formatData}
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
// 格式化树选择器数据源
|
|
99
|
+
const mapSearchTree = (treeDataItem: any, resKeyValue: any) => {
|
|
100
|
+
const haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
|
|
101
|
+
return {
|
|
102
|
+
title: treeDataItem[resKeyValue[1]],
|
|
103
|
+
key: treeDataItem[resKeyValue[0]],
|
|
104
|
+
parentId: treeDataItem.parent,
|
|
105
|
+
data: { ...treeDataItem },
|
|
106
|
+
isLeaf: !haveChildren,
|
|
107
|
+
disabled: haveChildren,
|
|
108
|
+
children: haveChildren ? treeDataItem.children.map((i: any) => mapSearchTree(i, resKeyValue)) : [],
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const formatTreeDataSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['id', 'name']) => {
|
|
112
|
+
const data = reData && reData[position]?.data;
|
|
113
|
+
const formatData = (data &&
|
|
114
|
+
Array.isArray(data) &&
|
|
115
|
+
data.length &&
|
|
116
|
+
data.map((ites: any) => mapSearchTree(ites, resKeyValue))) ||
|
|
117
|
+
[]
|
|
118
|
+
changeSearchForm[changePosition].field.props.treeData = formatData;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
97
122
|
let tableSearchForm: any [] = [];
|
|
98
123
|
if(type === 'supplier') {
|
|
99
124
|
tableSearchForm = [
|
|
@@ -112,24 +137,7 @@ export function commonFun (type?: string) {
|
|
|
112
137
|
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
113
138
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
114
139
|
},
|
|
115
|
-
},
|
|
116
|
-
// remoteSource: {
|
|
117
|
-
// init: true, // 初始请求数据源
|
|
118
|
-
// url: '/bop/api/company',
|
|
119
|
-
// params: {
|
|
120
|
-
// pageSize: 5000,
|
|
121
|
-
// currentPage: 1,
|
|
122
|
-
// 'qp-companyType-eq': '30',
|
|
123
|
-
// },
|
|
124
|
-
// converter({ data }: any) {
|
|
125
|
-
// if (data?.items == undefined || data?.items?.length == 0) {
|
|
126
|
-
// return [];
|
|
127
|
-
// }
|
|
128
|
-
// return data?.items.map((v: any) => ({ text: v.name, value: v.code }));
|
|
129
|
-
// },
|
|
130
|
-
// },
|
|
131
|
-
// initialSource: [{ text: '英伦宝贝儿童用品有限公司', value: 'A0001' }]
|
|
132
|
-
},
|
|
140
|
+
} },
|
|
133
141
|
{ name: 'qp-accountingCode-in', type: 'select', label: '归属核算主体', field: {
|
|
134
142
|
type: 'select',
|
|
135
143
|
props: {
|
|
@@ -143,23 +151,7 @@ export function commonFun (type?: string) {
|
|
|
143
151
|
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
144
152
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
145
153
|
},
|
|
146
|
-
},
|
|
147
|
-
// remoteSource: {
|
|
148
|
-
// init: true, // 初始请求数据源
|
|
149
|
-
// url: `/bop/api/accountingSubject`,
|
|
150
|
-
// params: {
|
|
151
|
-
// pageSize: 5000,
|
|
152
|
-
// currentPage: 1,
|
|
153
|
-
// },
|
|
154
|
-
// converter({ data }: any ) {
|
|
155
|
-
// if (data?.items == undefined || data?.items?.length == 0) {
|
|
156
|
-
// return [];
|
|
157
|
-
// }
|
|
158
|
-
// return data?.items.map((v: any) => ({ text: v.name, value: v.code }));
|
|
159
|
-
// },
|
|
160
|
-
// },
|
|
161
|
-
// initialSource: [{ text: '上海哲雄母婴用品有限公司', value: 'F002' }, { text: '上海英伦宝贝儿童用品有限公司', value: 'F001' }]
|
|
162
|
-
},
|
|
154
|
+
} },
|
|
163
155
|
{ name: 'qp-companyCode-in', type: 'select', label: '归属法人公司', field: {
|
|
164
156
|
type: 'select',
|
|
165
157
|
props: {
|
|
@@ -173,41 +165,20 @@ export function commonFun (type?: string) {
|
|
|
173
165
|
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
174
166
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
175
167
|
},
|
|
176
|
-
},
|
|
177
|
-
// remoteSource: {
|
|
178
|
-
// init: true, // 初始请求数据源
|
|
179
|
-
// url: '/bop/api/company',
|
|
180
|
-
// params: {
|
|
181
|
-
// pageSize: 5000,
|
|
182
|
-
// currentPage: 1,
|
|
183
|
-
// 'qp-companyType-eq': '20',
|
|
184
|
-
// },
|
|
185
|
-
// converter: ({ data }: any) => {
|
|
186
|
-
// return data.items
|
|
187
|
-
// ? data.items.map((item: any) => {
|
|
188
|
-
// return {
|
|
189
|
-
// text: item.name,
|
|
190
|
-
// value: item.code,
|
|
191
|
-
// };
|
|
192
|
-
// })
|
|
193
|
-
// : [];
|
|
194
|
-
// },
|
|
195
|
-
// },
|
|
196
|
-
// initialSource: [{ text: '上海哲雄母婴用品有限公司', value: 'F002' }, { text: '上海英伦宝贝儿童用品有限公司', value: 'F001' }]
|
|
197
|
-
},
|
|
168
|
+
} },
|
|
198
169
|
{ name: 'qp-sharingType-eq', type: 'select', label: '共享类型', initialSource: getDictionarySource('UC000013') },
|
|
199
170
|
]
|
|
200
171
|
Promise.all([
|
|
201
|
-
loadSelectSource(
|
|
172
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/company`, {
|
|
202
173
|
pageSize: 5000,
|
|
203
174
|
currentPage: 1,
|
|
204
175
|
'qp-companyType-eq': '30',
|
|
205
176
|
}),
|
|
206
|
-
loadSelectSource(
|
|
177
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/accountingSubject`, {
|
|
207
178
|
pageSize: 5000,
|
|
208
179
|
currentPage: 1,
|
|
209
180
|
}),
|
|
210
|
-
loadSelectSource(
|
|
181
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/company`, {
|
|
211
182
|
pageSize: 5000,
|
|
212
183
|
currentPage: 1,
|
|
213
184
|
'qp-companyType-eq': '20',
|
|
@@ -251,8 +222,127 @@ export function commonFun (type?: string) {
|
|
|
251
222
|
}
|
|
252
223
|
|
|
253
224
|
// 商品选择器
|
|
254
|
-
if(type === '
|
|
255
|
-
|
|
225
|
+
if(type === 'skuCommodity') {
|
|
226
|
+
requestConfig = {
|
|
227
|
+
url: `${prefixUrl.selectPrefix}/sku`,
|
|
228
|
+
filter: 'qp-nameAndCode-like', // 过滤参数
|
|
229
|
+
mappingTextField: 'name',
|
|
230
|
+
mappingValueField: 'skuCode',
|
|
231
|
+
otherParams: {
|
|
232
|
+
'qp-approveStatus-eq':2,
|
|
233
|
+
sorter: 'desc-id'
|
|
234
|
+
}, // 默认参数
|
|
235
|
+
sourceName: 'skuCode',
|
|
236
|
+
}
|
|
237
|
+
tableSearchForm = [
|
|
238
|
+
{ name: 'qp-name-like', label: 'SKU名称' },
|
|
239
|
+
{ name: 'qp-skuCode-like', label: 'SKU编码' },
|
|
240
|
+
{ name: 'qp-barCode-like', label: '条形码' },
|
|
241
|
+
{ name: 'qp-itemName-like', label: '所属SPU名称' },
|
|
242
|
+
{ name: 'qp-itemCode-like', label: '所属SPU编码' },
|
|
243
|
+
{ name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
|
|
244
|
+
type: 'select',
|
|
245
|
+
props: {
|
|
246
|
+
mode: 'multiple',
|
|
247
|
+
notFoundContent: '暂无数据',
|
|
248
|
+
allowClear: true,
|
|
249
|
+
showSearch: true,
|
|
250
|
+
showArrow: true,
|
|
251
|
+
maxTagCount: 1,
|
|
252
|
+
optionFilterProp: 'children',
|
|
253
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
254
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
255
|
+
},
|
|
256
|
+
} },
|
|
257
|
+
{ name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
|
|
258
|
+
type: 'treeSelect',
|
|
259
|
+
props: {
|
|
260
|
+
treeData: [],
|
|
261
|
+
treeCheckable: true,
|
|
262
|
+
showSearch: true,
|
|
263
|
+
allowClear: true,
|
|
264
|
+
showArrow: true,
|
|
265
|
+
treeNodeFilterProp: 'title',
|
|
266
|
+
treeDefaultExpandAll: true,
|
|
267
|
+
maxTagCount: 1,
|
|
268
|
+
placeholder: '请选择',
|
|
269
|
+
style: {
|
|
270
|
+
width: '100%',
|
|
271
|
+
},
|
|
272
|
+
dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
|
|
273
|
+
},
|
|
274
|
+
} },
|
|
275
|
+
{ name: 'qp-classId-in', type: 'select', label: '品类', field: {
|
|
276
|
+
type: 'select',
|
|
277
|
+
props: {
|
|
278
|
+
mode: 'multiple',
|
|
279
|
+
notFoundContent: '暂无数据',
|
|
280
|
+
allowClear: true,
|
|
281
|
+
showSearch: true,
|
|
282
|
+
showArrow: true,
|
|
283
|
+
maxTagCount: 1,
|
|
284
|
+
optionFilterProp: 'children',
|
|
285
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
286
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
287
|
+
},
|
|
288
|
+
} },
|
|
289
|
+
]
|
|
290
|
+
Promise.all([
|
|
291
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/brand/queryBrandList`, {
|
|
292
|
+
pageSize: 5000,
|
|
293
|
+
currentPage: 1,
|
|
294
|
+
}),
|
|
295
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/category/queryCategoryTree`, {
|
|
296
|
+
pageSize: 5000,
|
|
297
|
+
currentPage: 1,
|
|
298
|
+
}),
|
|
299
|
+
loadSelectSource(`${prefixUrl.formSelectFix}/class/withProperty`, {
|
|
300
|
+
pageSize: 5000,
|
|
301
|
+
currentPage: 1,
|
|
302
|
+
}),
|
|
303
|
+
]).then((x: any)=>{
|
|
304
|
+
formatSource(x,0, 5, tableSearchForm,['id','name']);
|
|
305
|
+
formatTreeDataSource(x,1, 6, tableSearchForm);
|
|
306
|
+
formatSource(x,2, 7, tableSearchForm,['id','name']);
|
|
307
|
+
})
|
|
308
|
+
modalTableProps = {
|
|
309
|
+
modalTableTitle: '选择SKU',
|
|
310
|
+
tableSearchForm,
|
|
311
|
+
tableColumns: [
|
|
312
|
+
{
|
|
313
|
+
title: 'SKU编码',
|
|
314
|
+
dataIndex: 'skuCode',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
title: 'SKU名称',
|
|
318
|
+
dataIndex: 'name',
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
title: '所属SPU',
|
|
322
|
+
dataIndex: 'itemName',
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
title: '规格',
|
|
326
|
+
dataIndex: 'skuSpec',
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
title: '类目',
|
|
330
|
+
dataIndex: 'categoryName',
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
title: '品类',
|
|
334
|
+
dataIndex: 'className',
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
title: '品牌',
|
|
338
|
+
dataIndex: 'brandName',
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
title: '条形码',
|
|
342
|
+
dataIndex: 'barCode',
|
|
343
|
+
},
|
|
344
|
+
]
|
|
345
|
+
}
|
|
256
346
|
}
|
|
257
347
|
|
|
258
348
|
// 仓库选择器
|
|
@@ -260,5 +350,6 @@ export function commonFun (type?: string) {
|
|
|
260
350
|
|
|
261
351
|
}
|
|
262
352
|
|
|
353
|
+
console.log(requestConfig, 'requestConfig')
|
|
263
354
|
return { modalTableProps, requestConfig };
|
|
264
355
|
}
|
|
@@ -5,13 +5,13 @@ nav:
|
|
|
5
5
|
group:
|
|
6
6
|
title: 业务组件
|
|
7
7
|
order: 4
|
|
8
|
-
title:
|
|
8
|
+
title: 业务档案选择器
|
|
9
9
|
order: 0
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
## BusinessSearchSelect
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
供应商选择器 Select-GYS-001:
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
17
|
import React, { useState } from 'react';
|
|
@@ -36,6 +36,7 @@ export default () => {
|
|
|
36
36
|
// mappingTextField: 'name',
|
|
37
37
|
// mappingValueField: 'code',
|
|
38
38
|
// }, // 非必传,业务字段已根据业务默认默认
|
|
39
|
+
// prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' }, // 非必传,下拉框和tableForm下拉框接口前缀,默认为bop的接口
|
|
39
40
|
selectProps, // 非必传
|
|
40
41
|
onChange: (value: any) => {
|
|
41
42
|
console.log(value)
|
|
@@ -52,4 +53,44 @@ export default () => {
|
|
|
52
53
|
};
|
|
53
54
|
```
|
|
54
55
|
|
|
56
|
+
|
|
57
|
+
商品选择器 Select-SKU-001:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import React, { useState } from 'react';
|
|
61
|
+
import {BusinessSearchSelect} from '../../../index.ts';
|
|
62
|
+
|
|
63
|
+
export default () => {
|
|
64
|
+
const selectProps = {
|
|
65
|
+
// mode: 'multiple',
|
|
66
|
+
// maxTagCount: 1,
|
|
67
|
+
// disabled: true
|
|
68
|
+
}
|
|
69
|
+
const [value, setValue] = useState(selectProps?.mode ? [] : null);
|
|
70
|
+
const props = {
|
|
71
|
+
value,
|
|
72
|
+
onChange: (value: any) => {
|
|
73
|
+
console.log(value)
|
|
74
|
+
setValue(value)
|
|
75
|
+
},
|
|
76
|
+
requestConfig: {
|
|
77
|
+
url: `/bop/api/sku`,
|
|
78
|
+
filter: 'qp-nameAndCode-like',
|
|
79
|
+
mappingValueField: 'skuCode',
|
|
80
|
+
otherParams: {
|
|
81
|
+
sorter: 'desc-id'
|
|
82
|
+
}, // 默认参数
|
|
83
|
+
sourceName: 'skuCode',
|
|
84
|
+
},
|
|
85
|
+
selectProps,
|
|
86
|
+
selectBusinessType: 'skuCommodity',
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div>
|
|
91
|
+
<BusinessSearchSelect {...props} />
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
```
|
|
55
96
|
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -28,10 +28,10 @@ export default () => {
|
|
|
28
28
|
// labelInValue: true, // 非必填 默认为false
|
|
29
29
|
requestConfig: {
|
|
30
30
|
url: `http://test.i-baby.net/bop/api/supplier`,
|
|
31
|
-
filter: 'qp-name-like', // 过滤参数
|
|
31
|
+
filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
|
|
32
32
|
otherParams: {}, // 默认参数
|
|
33
|
-
mappingTextField: 'name',
|
|
34
|
-
mappingValueField: 'code',
|
|
33
|
+
// mappingTextField: 'name',
|
|
34
|
+
// mappingValueField: 'code',
|
|
35
35
|
},
|
|
36
36
|
selectProps,
|
|
37
37
|
onChange: (value: any) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
|
-
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox } from 'antd';
|
|
4
|
+
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
import { stringify } from 'querystring';
|
|
@@ -20,6 +20,7 @@ const SearchSelect = (props: any) => {
|
|
|
20
20
|
requestConfig,
|
|
21
21
|
ctx,
|
|
22
22
|
} = props;
|
|
23
|
+
const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingValueField='code', sourceName='supplierCode' } = requestConfig || {};
|
|
23
24
|
|
|
24
25
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
25
26
|
const initVal = value || (selectMode ? [] : null);
|
|
@@ -47,8 +48,18 @@ const SearchSelect = (props: any) => {
|
|
|
47
48
|
const [popvalue, setPopValue] = useState(initVal);
|
|
48
49
|
const { run } = useDebounceFn(
|
|
49
50
|
() => {
|
|
51
|
+
// 优化搜索参数 支持传多个
|
|
52
|
+
let searchParams = {};
|
|
53
|
+
if(typeof selectParamsKey === 'string') {
|
|
54
|
+
searchParams = { [selectParamsKey]: searchValue }
|
|
55
|
+
}
|
|
56
|
+
if(Array.isArray(selectParamsKey)) {
|
|
57
|
+
selectParamsKey.forEach((i: any) => {
|
|
58
|
+
searchParams = { ...searchParams, [i]: searchValue }
|
|
59
|
+
})
|
|
60
|
+
}
|
|
50
61
|
// 防抖函数 待定
|
|
51
|
-
getData(
|
|
62
|
+
getData(searchParams)
|
|
52
63
|
},
|
|
53
64
|
{
|
|
54
65
|
wait: 1000,
|
|
@@ -69,15 +80,14 @@ const SearchSelect = (props: any) => {
|
|
|
69
80
|
// 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
70
81
|
const getData = (params={}, type=1) => {
|
|
71
82
|
if (!requestConfig) return;
|
|
72
|
-
const { url, otherParams, isMap } = requestConfig;
|
|
73
83
|
|
|
74
84
|
setFetching(true)
|
|
75
85
|
|
|
76
86
|
// 处理dependence参数
|
|
77
87
|
const fixedParam = {};
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
const fixedParamVal = ctx.form.getFieldValue(
|
|
88
|
+
if (fixedparameter && fieldValToParam && ctx) {
|
|
89
|
+
fixedparameter.forEach((item: any, index: any) => {
|
|
90
|
+
const fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
81
91
|
if (fixedParamVal) {
|
|
82
92
|
fixedParam[item] = fixedParamVal;
|
|
83
93
|
}
|
|
@@ -90,7 +100,6 @@ const SearchSelect = (props: any) => {
|
|
|
90
100
|
...otherParams, // 默认参数
|
|
91
101
|
...fixedParam,
|
|
92
102
|
...params,
|
|
93
|
-
sorter: 'desc-createTime'
|
|
94
103
|
}
|
|
95
104
|
|
|
96
105
|
axios
|
|
@@ -118,31 +127,24 @@ const SearchSelect = (props: any) => {
|
|
|
118
127
|
? res[keys].map((item: any) => {
|
|
119
128
|
return {
|
|
120
129
|
...item,
|
|
121
|
-
text:
|
|
122
|
-
|
|
123
|
-
item[requestConfig.mappingTextField]
|
|
124
|
-
}`
|
|
125
|
-
: item[requestConfig?.mappingTextField],
|
|
126
|
-
value: item[requestConfig.mappingValueField],
|
|
130
|
+
text: item[mappingTextField],
|
|
131
|
+
value: item[mappingValueField],
|
|
127
132
|
};
|
|
128
133
|
})
|
|
129
134
|
: Array.isArray(res) &&
|
|
130
135
|
res?.map((item: Record<string, any>) => {
|
|
131
136
|
return {
|
|
132
137
|
...item,
|
|
133
|
-
text:
|
|
134
|
-
|
|
135
|
-
item[requestConfig.mappingTextField]
|
|
136
|
-
}`
|
|
137
|
-
: item[requestConfig?.mappingTextField],
|
|
138
|
-
value: item[requestConfig.mappingValueField],
|
|
138
|
+
text: item[mappingTextField],
|
|
139
|
+
value: item[mappingValueField],
|
|
139
140
|
};
|
|
140
141
|
})
|
|
141
142
|
: [];
|
|
142
143
|
}
|
|
143
144
|
source = Array.isArray(source) ? source : []
|
|
144
145
|
if(type === 1) {
|
|
145
|
-
|
|
146
|
+
console.log(sourceName, 'sourceName')
|
|
147
|
+
ctx?.form?.setFieldSource(sourceName, source)
|
|
146
148
|
setItems(source)
|
|
147
149
|
setItemsTotal(Number(res?.total))
|
|
148
150
|
} else {
|
|
@@ -192,8 +194,8 @@ const SearchSelect = (props: any) => {
|
|
|
192
194
|
setCheckedAll(value.length === itemsTotal);
|
|
193
195
|
} else {
|
|
194
196
|
setSelectedRowKeys(labelInValue ? [value.key] : [value])
|
|
195
|
-
setSelectedRows(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value
|
|
196
|
-
setPopValue(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value
|
|
197
|
+
setSelectedRows(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value }])
|
|
198
|
+
setPopValue(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value }]);
|
|
197
199
|
}
|
|
198
200
|
}
|
|
199
201
|
};
|
|
@@ -240,7 +242,8 @@ const SearchSelect = (props: any) => {
|
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
const handleTableChange = (pagination) => {
|
|
243
|
-
|
|
245
|
+
const params = form.getFieldsValue();
|
|
246
|
+
getData({ ...params, pageSize: pagination.pageSize, currentPage: pagination.current }, 2)
|
|
244
247
|
}
|
|
245
248
|
|
|
246
249
|
const onChangeCheckAll = (e) => {
|
|
@@ -365,6 +368,14 @@ const SearchSelect = (props: any) => {
|
|
|
365
368
|
)
|
|
366
369
|
}
|
|
367
370
|
|
|
371
|
+
if(i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
|
|
372
|
+
return (
|
|
373
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
374
|
+
<TreeSelect style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}></TreeSelect>
|
|
375
|
+
</Form.Item>
|
|
376
|
+
)
|
|
377
|
+
}
|
|
378
|
+
|
|
368
379
|
// 默认type是input
|
|
369
380
|
return (
|
|
370
381
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
@@ -437,7 +448,12 @@ const SearchSelect = (props: any) => {
|
|
|
437
448
|
<Button key="back" onClick={handleCancel}>
|
|
438
449
|
取消
|
|
439
450
|
</Button>,
|
|
440
|
-
<Button
|
|
451
|
+
<Button
|
|
452
|
+
key="submit"
|
|
453
|
+
type="primary"
|
|
454
|
+
onClick={handleOk}
|
|
455
|
+
disabled={!tableData.length || (selectProps?.disabled || props?.disabled)}
|
|
456
|
+
>
|
|
441
457
|
确定
|
|
442
458
|
</Button>,
|
|
443
459
|
]}
|
|
@@ -464,7 +480,7 @@ const SearchSelect = (props: any) => {
|
|
|
464
480
|
<div>
|
|
465
481
|
<div className={'select_list_selectTips'}>
|
|
466
482
|
<div style={{ marginLeft: 8 }}>搜索结果共<span style={themeColor}>{tablePagination?.total || 0}</span>项{selectMode ? <span>, 本次已选<span style={themeColor}>{selectedRowKeys?.length || 0}</span>项</span> : ''}</div>
|
|
467
|
-
<div style={{ color: 'rgba(127, 127, 127, 0.6470588235294118)' }}>{selectMode ? '勾选后点击确定按钮完成选择' : '
|
|
483
|
+
<div style={{ color: 'rgba(127, 127, 127, 0.6470588235294118)' }}>{selectMode ? '勾选后点击确定按钮完成选择' : '双击数据行或点击单选图标完成选择'}</div>
|
|
468
484
|
</div>
|
|
469
485
|
<Table
|
|
470
486
|
size='small'
|
|
@@ -473,7 +489,7 @@ const SearchSelect = (props: any) => {
|
|
|
473
489
|
dataSource={tableData}
|
|
474
490
|
pagination={tablePagination}
|
|
475
491
|
onChange={handleTableChange}
|
|
476
|
-
rowKey=
|
|
492
|
+
rowKey={mappingValueField}
|
|
477
493
|
scroll={{ x: modalTableProps.overScrollX || 'max-content', y: modalTableProps.overScrollY || null }}
|
|
478
494
|
onRow={record => {
|
|
479
495
|
return {
|