@bit-sun/business-component 1.1.1 → 1.1.5
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/package.json +3 -2
- package/src/components/QueryMutipleInput/index.tsx +1 -1
- package/src/components/SearchSelect/business/BusinessSearchSelect.tsx +24 -0
- package/src/components/SearchSelect/business/BusinessUtils.ts +264 -0
- package/src/components/SearchSelect/business/index.md +55 -0
- package/src/components/SearchSelect/index.less +115 -0
- package/src/components/SearchSelect/index.md +138 -0
- package/src/components/SearchSelect/index.tsx +493 -0
- package/src/index.ts +3 -1
- package/dist/components/DataValidation/index.d.ts +0 -144
- package/dist/components/QueryMutipleInput/index.d.ts +0 -5
- package/dist/index.d.ts +0 -3
- package/dist/index.esm.js +0 -2386
- package/dist/index.js +0 -2399
- package/dist/utils/CheckOneUser/index.d.ts +0 -2
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { useDebounceFn } from 'ahooks';
|
|
4
|
+
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox } from 'antd';
|
|
5
|
+
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
import { stringify } from 'querystring';
|
|
8
|
+
import _ from "loadsh"
|
|
9
|
+
import './index.less';
|
|
10
|
+
|
|
11
|
+
const { Option } = Select;
|
|
12
|
+
|
|
13
|
+
const SearchSelect = (props: any) => {
|
|
14
|
+
const {
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
selectProps={},
|
|
18
|
+
modalTableProps={},
|
|
19
|
+
labelInValue=false,
|
|
20
|
+
requestConfig,
|
|
21
|
+
ctx,
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
25
|
+
const initVal = value || (selectMode ? [] : null);
|
|
26
|
+
const pageSize = 100 // 下拉框默认分页 条数
|
|
27
|
+
const tableInitPageSize = 10 // 弹框默认分页 条数
|
|
28
|
+
const currentPage = 1
|
|
29
|
+
const selectParamsKey = requestConfig?.filter || 'qp-codeAndName-like'
|
|
30
|
+
const currentSelectProps = {
|
|
31
|
+
...selectProps,
|
|
32
|
+
// 以下属性不可更改----设计配置项
|
|
33
|
+
showSearch: false,
|
|
34
|
+
filterOption: false,
|
|
35
|
+
allowClear: true,
|
|
36
|
+
listHeight: 160,
|
|
37
|
+
optionLabelProp: "label",
|
|
38
|
+
autoClearSearchValue: false
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const [items, setItems] = useState([]);
|
|
42
|
+
const [scrollPage, setScrollPage] = useState(1);
|
|
43
|
+
const [itemsTotal, setItemsTotal] = useState(0);
|
|
44
|
+
const [fetching, setFetching] = useState(false);
|
|
45
|
+
const [searchValue, setSearchValue] = useState('');
|
|
46
|
+
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
47
|
+
const [popvalue, setPopValue] = useState(initVal);
|
|
48
|
+
const { run } = useDebounceFn(
|
|
49
|
+
() => {
|
|
50
|
+
// 防抖函数 待定
|
|
51
|
+
getData({ [selectParamsKey]: searchValue })
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
wait: 1000,
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const [form] = Form.useForm();
|
|
59
|
+
const [caretLeftFlag, setCaretLeftFlag] = useState(true);
|
|
60
|
+
const [tableData, setTableData] = useState([]);
|
|
61
|
+
const [tablePagination, setTablePagination] = useState({ showQuickJumper: true, total: 0, current: 1, pageSize: tableInitPageSize })
|
|
62
|
+
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
63
|
+
const [selectedRows, setSelectedRows] = useState([]);
|
|
64
|
+
const [doubleArr, setDoubleArr] = useState([]); // 存放双数组的数组
|
|
65
|
+
const [filterRows, setFilterRows] = useState([]); // 存放拼接后的一维数组的变量
|
|
66
|
+
const [checkedAll, setCheckedAll] = useState(false)
|
|
67
|
+
const [indeterminate, setIndeterminate] = useState(false)
|
|
68
|
+
|
|
69
|
+
// 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
70
|
+
const getData = (params={}, type=1) => {
|
|
71
|
+
if (!requestConfig) return;
|
|
72
|
+
const { url, otherParams, isMap } = requestConfig;
|
|
73
|
+
|
|
74
|
+
setFetching(true)
|
|
75
|
+
|
|
76
|
+
// 处理dependence参数
|
|
77
|
+
const fixedParam = {};
|
|
78
|
+
if (requestConfig.fixedparameter && requestConfig.fieldValToParam && ctx) {
|
|
79
|
+
requestConfig.fixedparameter.forEach((item: any, index: any) => {
|
|
80
|
+
const fixedParamVal = ctx.form.getFieldValue(requestConfig.fieldValToParam[index]);
|
|
81
|
+
if (fixedParamVal) {
|
|
82
|
+
fixedParam[item] = fixedParamVal;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const queryParams = {
|
|
88
|
+
pageSize,
|
|
89
|
+
currentPage,
|
|
90
|
+
...otherParams, // 默认参数
|
|
91
|
+
...fixedParam,
|
|
92
|
+
...params,
|
|
93
|
+
sorter: 'desc-createTime'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
axios
|
|
97
|
+
.get(`${url}?${stringify(queryParams)}`)
|
|
98
|
+
.then((result: any) => {
|
|
99
|
+
setFetching(false)
|
|
100
|
+
result = result.data;
|
|
101
|
+
if (result.status !== '0') {
|
|
102
|
+
message.error(result.msg);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const res = result.data;
|
|
106
|
+
let source = [];
|
|
107
|
+
if (isMap) {
|
|
108
|
+
source = Object.keys(res).map((d, i) => {
|
|
109
|
+
return {
|
|
110
|
+
text: Object.values(res)[i],
|
|
111
|
+
value: d,
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
const keys = res.list ? 'list' : 'items';
|
|
116
|
+
source = res
|
|
117
|
+
? res[keys]
|
|
118
|
+
? res[keys].map((item: any) => {
|
|
119
|
+
return {
|
|
120
|
+
...item,
|
|
121
|
+
text: requestConfig.splicing
|
|
122
|
+
? `${item[requestConfig?.mappingValueField]}-${
|
|
123
|
+
item[requestConfig.mappingTextField]
|
|
124
|
+
}`
|
|
125
|
+
: item[requestConfig?.mappingTextField],
|
|
126
|
+
value: item[requestConfig.mappingValueField],
|
|
127
|
+
};
|
|
128
|
+
})
|
|
129
|
+
: Array.isArray(res) &&
|
|
130
|
+
res?.map((item: Record<string, any>) => {
|
|
131
|
+
return {
|
|
132
|
+
...item,
|
|
133
|
+
text: requestConfig.splicing
|
|
134
|
+
? `${item[requestConfig?.mappingValueField]}-${
|
|
135
|
+
item[requestConfig.mappingTextField]
|
|
136
|
+
}`
|
|
137
|
+
: item[requestConfig?.mappingTextField],
|
|
138
|
+
value: item[requestConfig.mappingValueField],
|
|
139
|
+
};
|
|
140
|
+
})
|
|
141
|
+
: [];
|
|
142
|
+
}
|
|
143
|
+
source = Array.isArray(source) ? source : []
|
|
144
|
+
if(type === 1) {
|
|
145
|
+
ctx?.form?.setFieldSource('supplierCode', source)
|
|
146
|
+
setItems(source)
|
|
147
|
+
setItemsTotal(Number(res?.total))
|
|
148
|
+
} else {
|
|
149
|
+
setTableData(source)
|
|
150
|
+
setTablePagination({...tablePagination, total: Number(res?.total), pageSize: Number(res?.size), current: Number(res?.page)})
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
.catch((err) => { setFetching(false) });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const SelectScroll = e => {
|
|
157
|
+
e.persist();
|
|
158
|
+
const { target } = e;
|
|
159
|
+
const totalPage = Math.ceil(itemsTotal / pageSize)
|
|
160
|
+
// 判断是否滑动到底部
|
|
161
|
+
const isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight
|
|
162
|
+
// 判断数据是否还没有加载到了最后一页
|
|
163
|
+
const canPageAdd = scrollPage < totalPage
|
|
164
|
+
if (isTouchGround && canPageAdd) {
|
|
165
|
+
const nextScrollPage = scrollPage + 1;
|
|
166
|
+
setScrollPage(nextScrollPage);
|
|
167
|
+
getData({currentPage: nextScrollPage}); // 调用api方法
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
getData()
|
|
173
|
+
}, [])
|
|
174
|
+
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if(value) {
|
|
177
|
+
setPopValue(value);
|
|
178
|
+
onChange(value);
|
|
179
|
+
}
|
|
180
|
+
}, [value]);
|
|
181
|
+
|
|
182
|
+
const showModal = () => {
|
|
183
|
+
getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
|
|
184
|
+
setIsModalVisible(true);
|
|
185
|
+
// 回显
|
|
186
|
+
if(value) {
|
|
187
|
+
if(selectMode) {
|
|
188
|
+
setSelectedRowKeys(labelInValue ? value.map(i => i.key) : value)
|
|
189
|
+
setSelectedRows(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })))
|
|
190
|
+
setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
|
|
191
|
+
setIndeterminate(!!value.length && value.length < itemsTotal);
|
|
192
|
+
setCheckedAll(value.length === itemsTotal);
|
|
193
|
+
} else {
|
|
194
|
+
setSelectedRowKeys(labelInValue ? [value.key] : [value])
|
|
195
|
+
setSelectedRows(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value.key }])
|
|
196
|
+
setPopValue(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value.key }]);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const handleOk = () => {
|
|
202
|
+
if(popvalue?.length) {
|
|
203
|
+
formaData(popvalue);
|
|
204
|
+
}
|
|
205
|
+
setIsModalVisible(false);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const formaData = (value) => {
|
|
209
|
+
if(labelInValue) {
|
|
210
|
+
const formatResult = value.map((i: any) => ({ key: i.code, label: i.name, value: i.code }))
|
|
211
|
+
onChange(selectMode ? formatResult : formatResult[0])
|
|
212
|
+
} else {
|
|
213
|
+
const formatResult = selectMode ? value.map((i: any) => i.value) : _.get(value[0], 'value')
|
|
214
|
+
onChange(formatResult)
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const handleCancel = () => {
|
|
219
|
+
setIsModalVisible(false);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const onSearchChange = (e) => {
|
|
223
|
+
setSearchValue(e.target.value);
|
|
224
|
+
run();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const onSearchBlur = () => {
|
|
228
|
+
setSearchValue('')
|
|
229
|
+
run();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const onSearchTable = () => {
|
|
233
|
+
const params = form.getFieldsValue();
|
|
234
|
+
getData({ ...params, pageSize: tableInitPageSize }, 2)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const onResetTable = () => {
|
|
238
|
+
form.resetFields();
|
|
239
|
+
handleTableChange({ pageSize: tableInitPageSize, currentPage: 1 })
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const handleTableChange = (pagination) => {
|
|
243
|
+
getData({ pageSize: pagination.pageSize, currentPage: pagination.current }, 2)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const onChangeCheckAll = (e) => {
|
|
247
|
+
if(e.target.checked) {
|
|
248
|
+
// 如果下拉框有所有数据就处理选中所有,如果没有 就默认查出所有数据
|
|
249
|
+
if(items.length === itemsTotal) {
|
|
250
|
+
const currentItemsData = JSON.parse(JSON.stringify(items))
|
|
251
|
+
setSelectedRowKeys(currentItemsData.map(i => i.value))
|
|
252
|
+
setSelectedRows(currentItemsData)
|
|
253
|
+
setPopValue(currentItemsData);
|
|
254
|
+
} else {
|
|
255
|
+
// TODO 请求接口获取所有数据
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
setSelectedRowKeys([])
|
|
259
|
+
setSelectedRows([])
|
|
260
|
+
setPopValue([]);
|
|
261
|
+
}
|
|
262
|
+
setIndeterminate(false);
|
|
263
|
+
setCheckedAll(e.target.checked);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const LightHeightOption = (props) => {
|
|
267
|
+
const {
|
|
268
|
+
filterTxt, text,
|
|
269
|
+
} = props
|
|
270
|
+
const heightLightTxt = (txt, heightTxt) => {
|
|
271
|
+
if (heightTxt === '') {
|
|
272
|
+
return txt
|
|
273
|
+
}
|
|
274
|
+
// 前面filterOption 不区分大小写,这里用i
|
|
275
|
+
const regexp = new RegExp(heightTxt, 'gi')
|
|
276
|
+
return txt.replace(regexp, `<span style="color:red">${heightTxt}</span>`)
|
|
277
|
+
}
|
|
278
|
+
return (
|
|
279
|
+
<div ref={(nodeElement) => {
|
|
280
|
+
if (nodeElement) {
|
|
281
|
+
nodeElement.innerHTML = heightLightTxt(text, filterTxt)
|
|
282
|
+
}
|
|
283
|
+
}}
|
|
284
|
+
/>
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// 扁平化二维数组的方法
|
|
289
|
+
const mapRows = params => {
|
|
290
|
+
var res = [];
|
|
291
|
+
for (var i = 0; i < params.length; i++) {
|
|
292
|
+
if (Array.isArray(params[i])) {
|
|
293
|
+
// 去重
|
|
294
|
+
res = _.uniqBy(res.concat(mapRows(params[i])), 'value');
|
|
295
|
+
} else {
|
|
296
|
+
res.push(params[i]);
|
|
297
|
+
// 去重
|
|
298
|
+
res = _.uniqBy(res, 'value')
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return res.filter(Boolean); //去掉undefined的情况
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
const onChangeSelectedKeys=(selectKeys,selectRows) => {
|
|
305
|
+
const nowPage = tablePagination?.current;
|
|
306
|
+
|
|
307
|
+
let filterRows = [];
|
|
308
|
+
let sksResult = [];
|
|
309
|
+
|
|
310
|
+
if(selectMode) {
|
|
311
|
+
// 处理多选分页累计选中
|
|
312
|
+
// 勾选生成二维数组
|
|
313
|
+
doubleArr[nowPage ? nowPage - 1 : 0] = selectRows
|
|
314
|
+
// console.log(doubleArr)
|
|
315
|
+
setDoubleArr(doubleArr)
|
|
316
|
+
// 这块扁平化成为一位数组
|
|
317
|
+
filterRows = mapRows(doubleArr);
|
|
318
|
+
// console.log(filterRows)
|
|
319
|
+
setFilterRows(filterRows)
|
|
320
|
+
|
|
321
|
+
sksResult = filterRows.map((i) => i.value)
|
|
322
|
+
} else {
|
|
323
|
+
// 处理单选
|
|
324
|
+
filterRows = selectRows;
|
|
325
|
+
sksResult = selectRows.map((i) => i.value)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
setSelectedRowKeys(sksResult)
|
|
329
|
+
setSelectedRows(filterRows)
|
|
330
|
+
setPopValue(filterRows);
|
|
331
|
+
setIndeterminate(!!filterRows.length && filterRows.length < tablePagination?.total);
|
|
332
|
+
setCheckedAll(filterRows.length === tablePagination?.total);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const rowSelection = {
|
|
336
|
+
type: selectMode ? 'checkbox' : 'radio',
|
|
337
|
+
selectedRowKeys,
|
|
338
|
+
onChange: (sks, srs) => {
|
|
339
|
+
onChangeSelectedKeys(sks, srs)
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
const onDoubleClickSelect = (e, record) => {
|
|
344
|
+
if(!selectMode) {
|
|
345
|
+
const srs = [JSON.parse(JSON.stringify(record))]
|
|
346
|
+
const sks = srs.map((i:any) => i.value)
|
|
347
|
+
onChangeSelectedKeys(sks, srs)
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const themeColor = { color: '#1890ff' }
|
|
352
|
+
|
|
353
|
+
const formItem = (list) => {
|
|
354
|
+
if(isModalVisible && list?.length) {
|
|
355
|
+
return list.map((i: any) => {
|
|
356
|
+
if(i?.type === 'select' || i?.field?.type === 'select') {
|
|
357
|
+
return (
|
|
358
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
359
|
+
<Select style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}>
|
|
360
|
+
{i?.initialSource?.length && i?.initialSource.map((m: any) => (
|
|
361
|
+
<Option value={m.value} key={m.value}>{m.text}</Option>
|
|
362
|
+
))}
|
|
363
|
+
</Select>
|
|
364
|
+
</Form.Item>
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// 默认type是input
|
|
369
|
+
return (
|
|
370
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
371
|
+
<Input style={{ width: '100%' }} placeholder='请输入' allowClear maxLength={100} {...i?.field?.props} />
|
|
372
|
+
</Form.Item>
|
|
373
|
+
)
|
|
374
|
+
})
|
|
375
|
+
} else {
|
|
376
|
+
return null
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return (
|
|
381
|
+
<div className={'search_select'}>
|
|
382
|
+
<div className="search_select_show" id='search_select_div'>
|
|
383
|
+
<Select
|
|
384
|
+
virtual
|
|
385
|
+
labelInValue={labelInValue}
|
|
386
|
+
value={value}
|
|
387
|
+
onChange={onChange}
|
|
388
|
+
dropdownRender={menu => (
|
|
389
|
+
<>
|
|
390
|
+
<Input
|
|
391
|
+
value={searchValue}
|
|
392
|
+
style={{ width: '98%', marginLeft: '1%' }}
|
|
393
|
+
placeholder="请输入"
|
|
394
|
+
onChange={e=> onSearchChange(e)}
|
|
395
|
+
onBlur={onSearchBlur}
|
|
396
|
+
onKeyDown={(e) => {
|
|
397
|
+
// 阻止多选的冒泡
|
|
398
|
+
e.stopPropagation()
|
|
399
|
+
}}
|
|
400
|
+
/>
|
|
401
|
+
<Divider style={{ margin: '8px 0' }} />
|
|
402
|
+
{menu}
|
|
403
|
+
</>
|
|
404
|
+
)}
|
|
405
|
+
notFoundContent={
|
|
406
|
+
fetching ? <Spin size="small" /> :
|
|
407
|
+
<div style={{ textAlign: 'center'}}>
|
|
408
|
+
<div style={{ marginBottom: 16 }}>
|
|
409
|
+
<CopyOutlined style={{ fontSize: '50px' }} />
|
|
410
|
+
</div>
|
|
411
|
+
<div>无匹配结果,请更换其他内容再试</div>
|
|
412
|
+
</div>
|
|
413
|
+
}
|
|
414
|
+
onPopupScroll={SelectScroll}
|
|
415
|
+
{...currentSelectProps}
|
|
416
|
+
getPopupContainer={() => document.getElementById('search_select_div')}
|
|
417
|
+
style={{ width: 'calc(100% - 30px)' }}
|
|
418
|
+
placeholder="请选择"
|
|
419
|
+
>
|
|
420
|
+
{items.map(item => (
|
|
421
|
+
<Option key={item.value} label={item.text}>
|
|
422
|
+
{LightHeightOption({ text: `${item.value} ${item.text}`, filterTxt: searchValue })}
|
|
423
|
+
</Option>
|
|
424
|
+
))}
|
|
425
|
+
</Select>
|
|
426
|
+
<Button style={{width: '30px', padding: '2px', height: 'auto'}} onClick={showModal} type="primary">
|
|
427
|
+
<SearchOutlined />
|
|
428
|
+
</Button>
|
|
429
|
+
</div>
|
|
430
|
+
<Modal
|
|
431
|
+
width='80%'
|
|
432
|
+
title={modalTableProps?.modalTableTitle}
|
|
433
|
+
visible={isModalVisible}
|
|
434
|
+
onOk={handleOk}
|
|
435
|
+
onCancel={handleCancel}
|
|
436
|
+
footer={[
|
|
437
|
+
<Button key="back" onClick={handleCancel}>
|
|
438
|
+
取消
|
|
439
|
+
</Button>,
|
|
440
|
+
<Button key="submit" type="primary" onClick={handleOk} disabled={selectProps?.disabled || props?.disabled}>
|
|
441
|
+
确定
|
|
442
|
+
</Button>,
|
|
443
|
+
]}
|
|
444
|
+
>
|
|
445
|
+
<div className={'search_select_wrapper'}>
|
|
446
|
+
<div className={'search_select_wrapper_click_flag'} onClick={() => setCaretLeftFlag(!caretLeftFlag)}>
|
|
447
|
+
<CaretLeftOutlined className={caretLeftFlag ? 'search_select_wrapper_click_flag_arrow' : 'search_select_wrapper_click_flag_arrow_1' } />
|
|
448
|
+
</div>
|
|
449
|
+
<div className={caretLeftFlag ? 'search_select_wrapper_left' : 'search_select_wrapper_left1'}>
|
|
450
|
+
<div className={'select_list_columns'}>
|
|
451
|
+
<div className={'select_list_columns_tips'}>搜索</div>
|
|
452
|
+
<div className={'select_list_columns_formItems'}>
|
|
453
|
+
<Form form={form} layout='vertical' key='modalForm'>
|
|
454
|
+
{formItem(modalTableProps?.tableSearchForm)}
|
|
455
|
+
</Form>
|
|
456
|
+
</div>
|
|
457
|
+
</div>
|
|
458
|
+
<div className={'select_list_searchButton'}>
|
|
459
|
+
<Button key='reset' className={'select_list_button_space'} onClick={onResetTable}>重置</Button>
|
|
460
|
+
<Button key='search' type="primary" onClick={onSearchTable}>查询</Button>
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
<div className={caretLeftFlag ? 'search_select_wrapper_right': 'search_select_wrapper_right1'}>
|
|
464
|
+
<div>
|
|
465
|
+
<div className={'select_list_selectTips'}>
|
|
466
|
+
<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 ? '勾选后点击确定按钮完成选择' : '双击数据行或单击按钮完成选择'}</div>
|
|
468
|
+
</div>
|
|
469
|
+
<Table
|
|
470
|
+
size='small'
|
|
471
|
+
rowSelection={rowSelection}
|
|
472
|
+
columns={modalTableProps?.tableColumns}
|
|
473
|
+
dataSource={tableData}
|
|
474
|
+
pagination={tablePagination}
|
|
475
|
+
onChange={handleTableChange}
|
|
476
|
+
rowKey='code'
|
|
477
|
+
scroll={{ x: modalTableProps.overScrollX || 'max-content', y: modalTableProps.overScrollY || null }}
|
|
478
|
+
onRow={record => {
|
|
479
|
+
return {
|
|
480
|
+
onDoubleClick: event => onDoubleClickSelect(event, record),
|
|
481
|
+
};
|
|
482
|
+
}}
|
|
483
|
+
/>
|
|
484
|
+
{selectMode ? <div className={'select_list_selectAll'}><Checkbox indeterminate={indeterminate} checked={checkedAll} onChange={onChangeCheckAll} /> 全选所有页面</div> : ''}
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
</Modal>
|
|
489
|
+
</div>
|
|
490
|
+
);
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
export default SearchSelect;
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import axios from 'axios';
|
|
10
|
+
// import 'antd/dist/antd.css';
|
|
10
11
|
|
|
11
12
|
const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
12
13
|
|
|
@@ -15,4 +16,5 @@ axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
|
|
|
15
16
|
export { default as DataValidation } from './components/DataValidation';
|
|
16
17
|
export { default as QueryMutipleInput } from './components/QueryMutipleInput';
|
|
17
18
|
export { default as CheckOneUser } from './utils/CheckOneUser';
|
|
18
|
-
|
|
19
|
+
export { default as SearchSelect } from './components/SearchSelect';
|
|
20
|
+
export { default as BusinessSearchSelect } from './components/SearchSelect/business/BusinessSearchSelect';
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './index.less';
|
|
3
|
-
declare class DataValidation extends React.Component {
|
|
4
|
-
constructor(props: any);
|
|
5
|
-
onDragEnd(result: any): void;
|
|
6
|
-
getCount: () => {
|
|
7
|
-
total: any;
|
|
8
|
-
error: any;
|
|
9
|
-
};
|
|
10
|
-
setConfig: (data: any) => {
|
|
11
|
-
container: string;
|
|
12
|
-
showtoolbar: boolean;
|
|
13
|
-
hook: {
|
|
14
|
-
columnTitleCellRenderBefore: (columnAbc: any, postion: any, ctx: any) => void;
|
|
15
|
-
cellRenderBefore: (cell: any, postion: any, sheetFile: any, ctx: any) => void;
|
|
16
|
-
cellAllRenderBefore: (data: any, sheetFile: any, ctx: any) => void;
|
|
17
|
-
};
|
|
18
|
-
data: {
|
|
19
|
-
name: string;
|
|
20
|
-
color: string;
|
|
21
|
-
index: number;
|
|
22
|
-
status: number;
|
|
23
|
-
order: number;
|
|
24
|
-
hide: number;
|
|
25
|
-
row: number;
|
|
26
|
-
column: number;
|
|
27
|
-
defaultRowHeight: number;
|
|
28
|
-
defaultColWidth: number;
|
|
29
|
-
config: {};
|
|
30
|
-
celldata: any;
|
|
31
|
-
scrollLeft: number;
|
|
32
|
-
luckysheet_select_save: never[];
|
|
33
|
-
calcChain: never[];
|
|
34
|
-
isPivotTable: boolean;
|
|
35
|
-
pivotTable: {};
|
|
36
|
-
filter_select: {};
|
|
37
|
-
filter: null;
|
|
38
|
-
luckysheet_alternateformat_save: {
|
|
39
|
-
cellrange: {
|
|
40
|
-
row: number[];
|
|
41
|
-
column: number[];
|
|
42
|
-
};
|
|
43
|
-
format: {
|
|
44
|
-
head: {
|
|
45
|
-
fc: string;
|
|
46
|
-
bc: string;
|
|
47
|
-
};
|
|
48
|
-
one: {
|
|
49
|
-
bc: string;
|
|
50
|
-
};
|
|
51
|
-
two: {
|
|
52
|
-
bc: string;
|
|
53
|
-
};
|
|
54
|
-
foot: {
|
|
55
|
-
fc: string;
|
|
56
|
-
bc: string;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
hasRowHeader: boolean;
|
|
60
|
-
hasRowFooter: boolean;
|
|
61
|
-
}[];
|
|
62
|
-
luckysheet_alternateformat_save_modelCustom: {
|
|
63
|
-
head: {
|
|
64
|
-
fc: string;
|
|
65
|
-
bc: string;
|
|
66
|
-
};
|
|
67
|
-
one: {
|
|
68
|
-
fc: string;
|
|
69
|
-
bc: string;
|
|
70
|
-
};
|
|
71
|
-
two: {
|
|
72
|
-
fc: string;
|
|
73
|
-
bc: string;
|
|
74
|
-
};
|
|
75
|
-
foot: {
|
|
76
|
-
fc: string;
|
|
77
|
-
bc: string;
|
|
78
|
-
};
|
|
79
|
-
}[];
|
|
80
|
-
luckysheet_conditionformat_save: {};
|
|
81
|
-
frozen: {};
|
|
82
|
-
chart: never[];
|
|
83
|
-
zoomRatio: number;
|
|
84
|
-
image: never[];
|
|
85
|
-
showGridLines: number;
|
|
86
|
-
dataVerification: {};
|
|
87
|
-
}[];
|
|
88
|
-
cellRightClickConfig: {
|
|
89
|
-
copy: boolean;
|
|
90
|
-
copyAs: boolean;
|
|
91
|
-
paste: boolean;
|
|
92
|
-
insertRow: boolean;
|
|
93
|
-
insertColumn: boolean;
|
|
94
|
-
deleteCell: boolean;
|
|
95
|
-
hideRow: boolean;
|
|
96
|
-
hideColumn: boolean;
|
|
97
|
-
rowHeight: boolean;
|
|
98
|
-
columnWidth: boolean;
|
|
99
|
-
clear: boolean;
|
|
100
|
-
matrix: boolean;
|
|
101
|
-
sort: boolean;
|
|
102
|
-
filter: boolean;
|
|
103
|
-
chart: boolean;
|
|
104
|
-
image: boolean;
|
|
105
|
-
link: boolean;
|
|
106
|
-
data: boolean;
|
|
107
|
-
cellFormat: boolean;
|
|
108
|
-
};
|
|
109
|
-
showsheetbar: boolean;
|
|
110
|
-
optionstate: boolean;
|
|
111
|
-
showstatisticBarConfig: {
|
|
112
|
-
count: boolean;
|
|
113
|
-
view: boolean;
|
|
114
|
-
zoom: boolean;
|
|
115
|
-
};
|
|
116
|
-
column: number;
|
|
117
|
-
columnHeaderHeight: number;
|
|
118
|
-
lang: string;
|
|
119
|
-
defaultFontSize: string;
|
|
120
|
-
frozen: {
|
|
121
|
-
type: string;
|
|
122
|
-
range: {
|
|
123
|
-
row_focus: number;
|
|
124
|
-
column_focus: number;
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
componentDidMount(): void;
|
|
129
|
-
componentWillUnmount(): void;
|
|
130
|
-
getValidateData: () => {
|
|
131
|
-
successData: any;
|
|
132
|
-
failData: any;
|
|
133
|
-
};
|
|
134
|
-
getData: () => any;
|
|
135
|
-
resetData: () => void;
|
|
136
|
-
filterData: (type: string) => void;
|
|
137
|
-
toggleData: () => void;
|
|
138
|
-
onChange: (e: any) => void;
|
|
139
|
-
errorChange: (e: any) => void;
|
|
140
|
-
menuList: JSX.Element;
|
|
141
|
-
leftMenu: JSX.Element;
|
|
142
|
-
render(): JSX.Element;
|
|
143
|
-
}
|
|
144
|
-
export default DataValidation;
|
package/dist/index.d.ts
DELETED