@bit-sun/business-component 2.0.2 → 2.0.3
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/AddSelectBusiness/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +506 -82
- package/dist/index.js +506 -81
- package/package.json +1 -1
- package/src/components/Business/AddSelectBusiness/index.md +37 -0
- package/src/components/Business/AddSelectBusiness/index.tsx +295 -0
- package/src/components/Business/CommodityEntry/index.tsx +5 -2
- package/src/components/Functional/AddSelect/index.less +10 -1
- package/src/components/Functional/AddSelect/index.tsx +102 -15
- package/src/components/Functional/DataImport/index.tsx +0 -1
- package/src/components/Functional/DataValidation/index.tsx +8 -1
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: '组件'
|
|
4
|
+
order: 1
|
|
5
|
+
group:
|
|
6
|
+
title: 业务组件
|
|
7
|
+
order: 1
|
|
8
|
+
title: 业务档录入器
|
|
9
|
+
order: 1
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# BusinessSearchSelect
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 商品选择录入器
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import React, { useState } from 'react';
|
|
19
|
+
import { Tabs } from 'antd';
|
|
20
|
+
import { AddSkuSelect } from '../../../index.ts';
|
|
21
|
+
|
|
22
|
+
export default () => {
|
|
23
|
+
const config = {
|
|
24
|
+
buttonText: 'context',
|
|
25
|
+
onSaveCallback: (rows) => {
|
|
26
|
+
console.log('save call', rows);
|
|
27
|
+
return Promise.resolve(true);
|
|
28
|
+
// return Promise.reject('FAILE')
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return (
|
|
32
|
+
<div>
|
|
33
|
+
<AddSkuSelect {...config} />
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
```
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Description:
|
|
3
|
+
* @Author: rodchen
|
|
4
|
+
* @Date: 2022-05-07 15:17:28
|
|
5
|
+
* @LastEditTime: 2022-05-08 21:01:21
|
|
6
|
+
* @LastEditors: rodchen
|
|
7
|
+
*/
|
|
8
|
+
import React, { useState } from 'react';
|
|
9
|
+
import { Tooltip, Select } from 'antd';
|
|
10
|
+
import { AddSelect } from '../../../index';
|
|
11
|
+
|
|
12
|
+
export const AddSkuSelect = (parProps: any) => {
|
|
13
|
+
const selectProps = {
|
|
14
|
+
mode: 'multiple',
|
|
15
|
+
}
|
|
16
|
+
const [value, setValue] = useState(selectProps?.mode ? [] : null);
|
|
17
|
+
const props = {
|
|
18
|
+
buttonText: parProps.buttonText || '新增',
|
|
19
|
+
value,
|
|
20
|
+
// labelInValue: true, // 非必填 默认为false
|
|
21
|
+
requestConfig: {
|
|
22
|
+
url: `/items/sku/pager/v2`,
|
|
23
|
+
filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
|
|
24
|
+
otherParams: {}, // 默认参数
|
|
25
|
+
mappingTextField: 'name',
|
|
26
|
+
mappingValueField: 'skuCode',
|
|
27
|
+
},
|
|
28
|
+
selectProps,
|
|
29
|
+
onChange: (value: any) => {
|
|
30
|
+
console.log(value)
|
|
31
|
+
setValue(value)
|
|
32
|
+
},
|
|
33
|
+
onSaveCallback: parProps.onSaveCallback
|
|
34
|
+
// onSaveCallback: (rows) => {
|
|
35
|
+
// console.log('save call', rows);
|
|
36
|
+
// // return Promise.resolve(true);
|
|
37
|
+
// // return Promise.reject('FAILE')
|
|
38
|
+
// }
|
|
39
|
+
};
|
|
40
|
+
const modalTableProps = {
|
|
41
|
+
modalTableTitle: '选择商品',
|
|
42
|
+
tableSearchForm: [
|
|
43
|
+
{
|
|
44
|
+
name: 'qp-skuCode-like', label: 'SKU编码'
|
|
45
|
+
},
|
|
46
|
+
{ name: 'qp-skuName-like', label: 'SKU名称' },
|
|
47
|
+
{ name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
|
|
48
|
+
type: 'select',
|
|
49
|
+
props: {
|
|
50
|
+
mode: 'multiple',
|
|
51
|
+
notFoundContent: '暂无数据',
|
|
52
|
+
allowClear: true,
|
|
53
|
+
showSearch: true,
|
|
54
|
+
showArrow: true,
|
|
55
|
+
maxTagCount: 1,
|
|
56
|
+
optionFilterProp: 'children',
|
|
57
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
58
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
59
|
+
},
|
|
60
|
+
} },
|
|
61
|
+
{ name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
|
|
62
|
+
type: 'treeSelect',
|
|
63
|
+
props: {
|
|
64
|
+
treeData: [],
|
|
65
|
+
treeCheckable: true,
|
|
66
|
+
showSearch: true,
|
|
67
|
+
allowClear: true,
|
|
68
|
+
showArrow: true,
|
|
69
|
+
treeNodeFilterProp: 'title',
|
|
70
|
+
treeDefaultExpandAll: true,
|
|
71
|
+
maxTagCount: 1,
|
|
72
|
+
placeholder: '请选择',
|
|
73
|
+
style: {
|
|
74
|
+
width: '100%',
|
|
75
|
+
},
|
|
76
|
+
dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
|
|
77
|
+
},
|
|
78
|
+
} }
|
|
79
|
+
],
|
|
80
|
+
tableColumns: [
|
|
81
|
+
{
|
|
82
|
+
title: 'SKU编码',
|
|
83
|
+
width: 150,
|
|
84
|
+
dataIndex: 'skuCode',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: 'SKU名称',
|
|
88
|
+
width: 200,
|
|
89
|
+
ellipsis: {
|
|
90
|
+
showTitle: false,
|
|
91
|
+
},
|
|
92
|
+
render: (text: any) => (
|
|
93
|
+
<Tooltip placement="topLeft" title={text}>
|
|
94
|
+
{text}
|
|
95
|
+
</Tooltip>
|
|
96
|
+
),
|
|
97
|
+
dataIndex: 'name',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: '国际条码',
|
|
101
|
+
width: 100,
|
|
102
|
+
ellipsis: {
|
|
103
|
+
showTitle: false,
|
|
104
|
+
},
|
|
105
|
+
dataIndex: 'barCode',
|
|
106
|
+
render: (text: any) => (
|
|
107
|
+
<Tooltip placement="topLeft" title={text}>
|
|
108
|
+
{text}
|
|
109
|
+
</Tooltip>
|
|
110
|
+
),
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
title: '所属SPU名称',
|
|
114
|
+
width: 100,
|
|
115
|
+
ellipsis: {
|
|
116
|
+
showTitle: false,
|
|
117
|
+
},
|
|
118
|
+
dataIndex: 'itemName',
|
|
119
|
+
render: (text: any) => (
|
|
120
|
+
<Tooltip placement="topLeft" title={text}>
|
|
121
|
+
{text}
|
|
122
|
+
</Tooltip>
|
|
123
|
+
),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: '所属SPU编码',
|
|
127
|
+
width: 100,
|
|
128
|
+
ellipsis: {
|
|
129
|
+
showTitle: false,
|
|
130
|
+
},
|
|
131
|
+
dataIndex: 'itemCode',
|
|
132
|
+
render: (text: any) => (
|
|
133
|
+
<Tooltip placement="topLeft" title={text}>
|
|
134
|
+
{text}
|
|
135
|
+
</Tooltip>
|
|
136
|
+
),
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
title: '外部编码',
|
|
140
|
+
width: 100,
|
|
141
|
+
ellipsis: {
|
|
142
|
+
showTitle: false,
|
|
143
|
+
},
|
|
144
|
+
render: (text: any) => (
|
|
145
|
+
<Tooltip placement="topLeft" title={text}>
|
|
146
|
+
{text}
|
|
147
|
+
</Tooltip>
|
|
148
|
+
),
|
|
149
|
+
dataIndex: 'externalCode',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: '规格',
|
|
153
|
+
width: 100,
|
|
154
|
+
ellipsis: {
|
|
155
|
+
showTitle: false,
|
|
156
|
+
},
|
|
157
|
+
render: (text: any) => (
|
|
158
|
+
<Tooltip placement="topLeft" title={text}>
|
|
159
|
+
{text}
|
|
160
|
+
</Tooltip>
|
|
161
|
+
),
|
|
162
|
+
dataIndex: 'propertyNameAndValue',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
title: '类目',
|
|
166
|
+
width: 100,
|
|
167
|
+
ellipsis: {
|
|
168
|
+
showTitle: false,
|
|
169
|
+
},
|
|
170
|
+
render: (text: any) => (
|
|
171
|
+
<Tooltip placement="topLeft" title={text}>
|
|
172
|
+
{text}
|
|
173
|
+
</Tooltip>
|
|
174
|
+
),
|
|
175
|
+
dataIndex: 'categoryName',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
title: '品类',
|
|
179
|
+
width: 100,
|
|
180
|
+
ellipsis: {
|
|
181
|
+
showTitle: false,
|
|
182
|
+
},
|
|
183
|
+
render: (text: any) => (
|
|
184
|
+
<Tooltip placement="topLeft" title={text}>
|
|
185
|
+
{text}
|
|
186
|
+
</Tooltip>
|
|
187
|
+
),
|
|
188
|
+
dataIndex: 'className',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
title: '品牌',
|
|
192
|
+
width: 100,
|
|
193
|
+
ellipsis: {
|
|
194
|
+
showTitle: false,
|
|
195
|
+
},
|
|
196
|
+
render: (text: any) => (
|
|
197
|
+
<Tooltip placement="topLeft" title={text}>
|
|
198
|
+
{text}
|
|
199
|
+
</Tooltip>
|
|
200
|
+
),
|
|
201
|
+
dataIndex: 'brandName',
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
selectColumn: [
|
|
205
|
+
{
|
|
206
|
+
title: 'SKU编码',
|
|
207
|
+
width: 150,
|
|
208
|
+
dataIndex: 'skuCode',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
title: 'SKU名称',
|
|
212
|
+
width: 200,
|
|
213
|
+
ellipsis: {
|
|
214
|
+
showTitle: false,
|
|
215
|
+
},
|
|
216
|
+
render: (text: any) => (
|
|
217
|
+
<Tooltip placement="topLeft" title={text}>
|
|
218
|
+
{text}
|
|
219
|
+
</Tooltip>
|
|
220
|
+
),
|
|
221
|
+
dataIndex: 'name',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
title: '数量',
|
|
225
|
+
width: 100,
|
|
226
|
+
isInputItem: true,
|
|
227
|
+
dataIndex: 'count',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
title: '单位',
|
|
231
|
+
dataIndex: 'selectUnitCode',
|
|
232
|
+
width: 80,
|
|
233
|
+
ellipsis: {
|
|
234
|
+
showTitle: false,
|
|
235
|
+
},
|
|
236
|
+
render: (text: any, record: any) => {
|
|
237
|
+
let baseUnitCode = '';
|
|
238
|
+
if (record?.packingUnitList) {
|
|
239
|
+
let base = record.packingUnitList.filter((item: any) => item.unitCode)
|
|
240
|
+
if (base.length) {
|
|
241
|
+
baseUnitCode = base[0].unitCode
|
|
242
|
+
record.selectUnitCode = base[0].unitCode
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (baseUnitCode) {
|
|
247
|
+
return <>
|
|
248
|
+
<Select defaultValue={baseUnitCode} onChange={(value) => {record.selectUnitCode = value}} style={{width: '60px'}}>
|
|
249
|
+
{record.packingUnitList && record.packingUnitList.map((item: any) => {
|
|
250
|
+
return <Select.Option value={item.unitCode}>{item.name}</Select.Option>
|
|
251
|
+
})}
|
|
252
|
+
</Select>
|
|
253
|
+
</>
|
|
254
|
+
}
|
|
255
|
+
return <></>
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
title: '所属SPU编码',
|
|
260
|
+
width: 150,
|
|
261
|
+
ellipsis: {
|
|
262
|
+
showTitle: false,
|
|
263
|
+
},
|
|
264
|
+
dataIndex: 'itemCode',
|
|
265
|
+
render: (text: any) => (
|
|
266
|
+
<Tooltip placement="topLeft" title={text}>
|
|
267
|
+
{text}
|
|
268
|
+
</Tooltip>
|
|
269
|
+
),
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
title: '规格',
|
|
273
|
+
width: 200,
|
|
274
|
+
ellipsis: {
|
|
275
|
+
showTitle: false,
|
|
276
|
+
},
|
|
277
|
+
render: (text: any) => (
|
|
278
|
+
<Tooltip placement="topLeft" title={text}>
|
|
279
|
+
{text}
|
|
280
|
+
</Tooltip>
|
|
281
|
+
),
|
|
282
|
+
dataIndex: 'propertyNameAndValue',
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<div>
|
|
289
|
+
<AddSelect
|
|
290
|
+
{...props}
|
|
291
|
+
modalTableProps={modalTableProps}
|
|
292
|
+
/>
|
|
293
|
+
</div>
|
|
294
|
+
);
|
|
295
|
+
};
|
|
@@ -9,10 +9,12 @@ const CommodityEntry = (props: any) => {
|
|
|
9
9
|
const {
|
|
10
10
|
buttonName=' + 录入商品',
|
|
11
11
|
modalTitle = '录入商品',
|
|
12
|
+
buttonProps = {},
|
|
12
13
|
callbackHideModal,
|
|
13
14
|
callbackHandleOk,
|
|
14
15
|
columns=["skuCode", "quantity", "price"],
|
|
15
|
-
validDataUrl="/items/
|
|
16
|
+
validDataUrl="/items/sku/import/check",
|
|
17
|
+
isBrandAuth = true // 默认做品牌过滤
|
|
16
18
|
} = props;
|
|
17
19
|
|
|
18
20
|
const [modalProps, setModalProps]: any = useState({
|
|
@@ -58,13 +60,14 @@ const CommodityEntry = (props: any) => {
|
|
|
58
60
|
|
|
59
61
|
return (
|
|
60
62
|
<div>
|
|
61
|
-
<Button onClick={handleShowModal}>{buttonName}</Button>
|
|
63
|
+
<Button onClick={handleShowModal} {...buttonProps}>{buttonName}</Button>
|
|
62
64
|
{modalProps.visible && (
|
|
63
65
|
<Modal {...modalProps} onOk={handleOk} onCancel={handleCancel} destroyOnClose={true} zIndex={15}>
|
|
64
66
|
<DataValidation
|
|
65
67
|
onRef={(ref) => { dataValidationRef = ref }}
|
|
66
68
|
columns={columns}
|
|
67
69
|
validDataUrl={validDataUrl}
|
|
70
|
+
isBrandAuth={isBrandAuth}
|
|
68
71
|
/>
|
|
69
72
|
</Modal>
|
|
70
73
|
) || ''}
|
|
@@ -73,6 +73,15 @@
|
|
|
73
73
|
.ant-checkbox-wrapper {
|
|
74
74
|
justify-content: center;
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
.ant-form-item-label {
|
|
78
|
+
padding: 0PX;
|
|
79
|
+
line-height: 23px !important;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ant-form-item-label > label {
|
|
83
|
+
font-size: 12px;
|
|
84
|
+
}
|
|
76
85
|
|
|
77
86
|
.ant-table-thead {
|
|
78
87
|
th {
|
|
@@ -171,7 +180,7 @@
|
|
|
171
180
|
margin-bottom: 10px;
|
|
172
181
|
}
|
|
173
182
|
&_formItems {
|
|
174
|
-
padding: 10px;
|
|
183
|
+
padding: 7px 10px;
|
|
175
184
|
}
|
|
176
185
|
}
|
|
177
186
|
.select_list_searchButton {
|
|
@@ -9,6 +9,54 @@ import _ from "loadsh"
|
|
|
9
9
|
import './index.less';
|
|
10
10
|
import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
|
|
11
11
|
|
|
12
|
+
const loadSelectSource = (url: string, params?: any) => {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
axios
|
|
15
|
+
.get(`${url}?${stringify(params)}`)
|
|
16
|
+
.then((result: any) => {
|
|
17
|
+
result = result.data;
|
|
18
|
+
if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
|
|
19
|
+
message.error(result.msg);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
resolve(result);
|
|
23
|
+
})
|
|
24
|
+
.catch((err) => {
|
|
25
|
+
reject(err);
|
|
26
|
+
});
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const formatSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['code', 'name']) => {
|
|
31
|
+
const data = reData && reData[position]?.data;
|
|
32
|
+
const list = Array.isArray(data) ? data :(data?.items || data?.list || data?.children || []);
|
|
33
|
+
const formatData = list?.length ? list.map((v: any) => ({ text: v[resKeyValue[1]], value: v[resKeyValue[0]] })) : [];
|
|
34
|
+
changeSearchForm[changePosition] = {...changeSearchForm[changePosition], initialSource: formatData}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// 格式化树选择器数据源
|
|
38
|
+
const mapSearchTree = (treeDataItem: any, resKeyValue: any) => {
|
|
39
|
+
const haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
|
|
40
|
+
return {
|
|
41
|
+
title: treeDataItem[resKeyValue[1]],
|
|
42
|
+
value: treeDataItem[resKeyValue[0]],
|
|
43
|
+
parentId: treeDataItem.parent,
|
|
44
|
+
data: { ...treeDataItem },
|
|
45
|
+
isLeaf: !haveChildren,
|
|
46
|
+
disabled: haveChildren,
|
|
47
|
+
children: haveChildren ? treeDataItem.children.map((i: any) => mapSearchTree(i, resKeyValue)) : [],
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const formatTreeDataSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['id', 'name']) => {
|
|
51
|
+
const data = reData && reData[position]?.data;
|
|
52
|
+
const formatData = (data &&
|
|
53
|
+
Array.isArray(data) &&
|
|
54
|
+
data.length &&
|
|
55
|
+
data.map((ites: any) => mapSearchTree(ites, resKeyValue))) ||
|
|
56
|
+
[]
|
|
57
|
+
changeSearchForm[changePosition].field.props.treeData = formatData;
|
|
58
|
+
}
|
|
59
|
+
|
|
12
60
|
const { Option } = Select;
|
|
13
61
|
|
|
14
62
|
const AddSelect = (props: any) => {
|
|
@@ -23,7 +71,8 @@ const AddSelect = (props: any) => {
|
|
|
23
71
|
sourceName,
|
|
24
72
|
needModalTable = true,
|
|
25
73
|
getPopupContainer = undefined,
|
|
26
|
-
onSaveCallback
|
|
74
|
+
onSaveCallback,
|
|
75
|
+
buttonText = '添加'
|
|
27
76
|
} = props;
|
|
28
77
|
const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField = 'name', mappingTextShowKeyField, mappingValueField = 'code', mappingTextShowTextField } = requestConfig || {};
|
|
29
78
|
const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
|
|
@@ -74,6 +123,7 @@ const AddSelect = (props: any) => {
|
|
|
74
123
|
);
|
|
75
124
|
|
|
76
125
|
const [form] = Form.useForm();
|
|
126
|
+
const [tableSearchForm, setTableSearchForm] = useState(modalTableProps?.tableSearchForm)
|
|
77
127
|
const [caretLeftFlag, setCaretLeftFlag] = useState(true);
|
|
78
128
|
const [tableData, setTableData] = useState([]);
|
|
79
129
|
const [tablePagination, setTablePagination] = useState({ total: 0, size: "small", current: 1, pageSize: tableInitPageSize })
|
|
@@ -303,7 +353,21 @@ const AddSelect = (props: any) => {
|
|
|
303
353
|
}
|
|
304
354
|
|
|
305
355
|
useEffect(() => {
|
|
306
|
-
run('init')
|
|
356
|
+
// run('init')
|
|
357
|
+
Promise.all([
|
|
358
|
+
loadSelectSource(`/items/brand/queryBrandList`, {
|
|
359
|
+
pageSize: 5000,
|
|
360
|
+
currentPage: 1,
|
|
361
|
+
'ctl-withAuth': true
|
|
362
|
+
}),
|
|
363
|
+
loadSelectSource(`/items/category/queryCategoryTree`, {
|
|
364
|
+
pageSize: 5000,
|
|
365
|
+
currentPage: 1,
|
|
366
|
+
}),
|
|
367
|
+
]).then((x: any)=>{
|
|
368
|
+
formatSource(x,0, 2, tableSearchForm,['id','name'])
|
|
369
|
+
formatTreeDataSource(x,1, 3, tableSearchForm)
|
|
370
|
+
})
|
|
307
371
|
}, [])
|
|
308
372
|
|
|
309
373
|
useEffect(() => {
|
|
@@ -317,7 +381,7 @@ const AddSelect = (props: any) => {
|
|
|
317
381
|
}, [sourceName])
|
|
318
382
|
|
|
319
383
|
const showModal = () => {
|
|
320
|
-
getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
|
|
384
|
+
// getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
|
|
321
385
|
setIsModalVisible(true);
|
|
322
386
|
// 回显
|
|
323
387
|
if (value) {
|
|
@@ -335,6 +399,10 @@ const AddSelect = (props: any) => {
|
|
|
335
399
|
setPopValue(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value }]);
|
|
336
400
|
}
|
|
337
401
|
}
|
|
402
|
+
|
|
403
|
+
setTimeout(() => {
|
|
404
|
+
document.getElementById("first-query")?.focus()
|
|
405
|
+
}, 50)
|
|
338
406
|
};
|
|
339
407
|
|
|
340
408
|
const handleSelectOver = (selectedValue: any) => {
|
|
@@ -358,6 +426,7 @@ const AddSelect = (props: any) => {
|
|
|
358
426
|
if(true) {
|
|
359
427
|
message.success('保存成功')
|
|
360
428
|
deleteSelectRows();
|
|
429
|
+
document.getElementById('first-query')?.focus()
|
|
361
430
|
!isContinue && handleCancel();
|
|
362
431
|
} else {
|
|
363
432
|
message.error(res)
|
|
@@ -384,9 +453,10 @@ const AddSelect = (props: any) => {
|
|
|
384
453
|
form.resetFields();
|
|
385
454
|
setTableFormParams({});
|
|
386
455
|
setIsModalVisible(false);
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
456
|
+
setTableData([])
|
|
457
|
+
// if (selectMode) {
|
|
458
|
+
// run();
|
|
459
|
+
// }
|
|
390
460
|
};
|
|
391
461
|
|
|
392
462
|
const onSearchChange = (e) => {
|
|
@@ -435,6 +505,13 @@ const AddSelect = (props: any) => {
|
|
|
435
505
|
};
|
|
436
506
|
|
|
437
507
|
const onChangeSelectedKeys = (selectKeys, selectRows) => {
|
|
508
|
+
if(selectKeys.length - selectedRowKeys.length > 0) {
|
|
509
|
+
if (selectKeys.length - selectedRowKeys.length === 1) {
|
|
510
|
+
selectRows[selectRows.length -1]['needFocus'] = true;
|
|
511
|
+
} else {
|
|
512
|
+
selectRows[selectedRowKeys.length]['needFocus'] = true;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
438
515
|
setPopValue(selectRows);
|
|
439
516
|
setSelectedRowKeys(selectKeys)
|
|
440
517
|
// setIndeterminate(!!filterRows.length && filterRows.length < tablePagination?.total);
|
|
@@ -520,7 +597,11 @@ const AddSelect = (props: any) => {
|
|
|
520
597
|
// 默认type是input
|
|
521
598
|
return (
|
|
522
599
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
523
|
-
<Input id={index === 0 ? "
|
|
600
|
+
<Input id={index === 0 ? "first-query" : 'index'} style={{ width: '100%' }} onKeyDown={(e) => {
|
|
601
|
+
if (e.keyCode === 13) {
|
|
602
|
+
onSearchTable()
|
|
603
|
+
}
|
|
604
|
+
}} placeholder='请输入' allowClear maxLength={100} {...i?.field?.props} />
|
|
524
605
|
</Form.Item>
|
|
525
606
|
)
|
|
526
607
|
})
|
|
@@ -563,19 +644,25 @@ const AddSelect = (props: any) => {
|
|
|
563
644
|
let inputIndex = 0;
|
|
564
645
|
let selectColumns = [... modalTableProps.selectColumn.map(item => {
|
|
565
646
|
const inputLength = modalTableProps.selectColumn.filter(item => item.isInputItem).length
|
|
566
|
-
const currentIndex = inputIndex
|
|
647
|
+
const currentIndex = inputIndex
|
|
648
|
+
|
|
567
649
|
if (item.isInputItem) {
|
|
568
650
|
inputIndex++;
|
|
569
651
|
return {
|
|
570
652
|
...item,
|
|
571
653
|
render: (text, record, index) => {
|
|
654
|
+
// let
|
|
655
|
+
if(record.needFocus === true && currentIndex === 0) {
|
|
656
|
+
|
|
657
|
+
}
|
|
572
658
|
return (
|
|
573
659
|
<InputNumber
|
|
574
660
|
defaultValue={text || 0}
|
|
575
661
|
min={0}
|
|
662
|
+
autoFocus={record.needFocus}
|
|
576
663
|
keyboard={false}
|
|
577
664
|
onChange={(value) => {
|
|
578
|
-
record[
|
|
665
|
+
record[item.dataIndex] = value
|
|
579
666
|
}}
|
|
580
667
|
// onFocus={(e)=> {
|
|
581
668
|
// let dom1 = e.currentTarget;
|
|
@@ -585,7 +672,7 @@ const AddSelect = (props: any) => {
|
|
|
585
672
|
onKeyDown={(e) => {
|
|
586
673
|
if(e.keyCode === 13 && e.ctrlKey) {
|
|
587
674
|
handleOk(true)
|
|
588
|
-
document.getElementById("
|
|
675
|
+
document.getElementById("first-query")?.focus()
|
|
589
676
|
}
|
|
590
677
|
if(e.keyCode === 8 && e.ctrlKey) {
|
|
591
678
|
message.success('删除当前行')
|
|
@@ -659,13 +746,13 @@ const AddSelect = (props: any) => {
|
|
|
659
746
|
return item
|
|
660
747
|
}), {
|
|
661
748
|
title: '操作',
|
|
662
|
-
width:
|
|
749
|
+
width: 50,
|
|
663
750
|
fixed: 'right',
|
|
664
751
|
render: (text, record, index) => {
|
|
665
752
|
return (
|
|
666
|
-
<
|
|
753
|
+
<span style={{cursor: 'pointer', color: '#005CFF' }} onClick={() => {
|
|
667
754
|
deleteRecord(record)
|
|
668
|
-
}} type={"
|
|
755
|
+
}} type={"text"}>删除</span>
|
|
669
756
|
)
|
|
670
757
|
}
|
|
671
758
|
},]
|
|
@@ -674,7 +761,7 @@ const AddSelect = (props: any) => {
|
|
|
674
761
|
<div className={'add_select'}>
|
|
675
762
|
<div className="add_select_show" id={`add_select_div_${uniqueValue}`}>
|
|
676
763
|
<Button onClick={showModal} type="primary">
|
|
677
|
-
|
|
764
|
+
{buttonText}
|
|
678
765
|
</Button>
|
|
679
766
|
</div>
|
|
680
767
|
{needModalTable && isModalVisible && (
|
|
@@ -720,7 +807,7 @@ const AddSelect = (props: any) => {
|
|
|
720
807
|
<div className={'select_list_columns'}>
|
|
721
808
|
<div className={'select_list_columns_formItems'}>
|
|
722
809
|
<Form form={form} layout='vertical' key='modalForm'>
|
|
723
|
-
{formItem(
|
|
810
|
+
{formItem(tableSearchForm)}
|
|
724
811
|
</Form>
|
|
725
812
|
</div>
|
|
726
813
|
</div>
|
|
@@ -400,13 +400,20 @@ class DataValidation extends React.Component {
|
|
|
400
400
|
};
|
|
401
401
|
|
|
402
402
|
resetData = () => {
|
|
403
|
-
const { validDataUrl, updateData, columns } = this.props;
|
|
403
|
+
const { validDataUrl, updateData, columns, isBrandAuth } = this.props;
|
|
404
404
|
const resultData = this.getData().filter(d => {
|
|
405
405
|
return _.compact(Object.values(d)).length
|
|
406
406
|
})
|
|
407
407
|
|
|
408
|
+
// 处理业务参数
|
|
409
|
+
let otherParams={}
|
|
410
|
+
if(isBrandAuth){
|
|
411
|
+
otherParams = { brandAuth: 'ctl-withAuth' }
|
|
412
|
+
}
|
|
413
|
+
|
|
408
414
|
axios
|
|
409
415
|
.post(validDataUrl, {
|
|
416
|
+
...otherParams,
|
|
410
417
|
columns: columns,
|
|
411
418
|
data: resultData,
|
|
412
419
|
})
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ export { default as QueryMutipleInput } from './components/Functional/QueryMutip
|
|
|
24
24
|
export { default as SearchSelect } from './components/Functional/SearchSelect';
|
|
25
25
|
export { default as AddSelect } from './components/Functional/AddSelect';
|
|
26
26
|
export { default as BusinessSearchSelect } from './components/Business/SearchSelect';
|
|
27
|
+
export * from './components/Business/AddSelectBusiness';
|
|
27
28
|
export { default as CommodityEntry } from './components/Business/CommodityEntry';
|
|
28
29
|
export { default as CheckOneUser } from './utils/CheckOneUser';
|
|
29
30
|
export { default as TreeSearchSelect } from './components/Functional/TreeSearchSelect';
|