Commit c4907700 authored by 田翔's avatar 田翔

fix: 下拉框搜索优化

parent 29523d40
{
"name": "panda-xform",
"version": "6.0.24",
"description": "6.0.24 日期选择器优化",
"version": "6.0.25",
"description": "6.0.25 下拉框搜索优化",
"keywords": [
"panda-xform"
],
......@@ -37,6 +37,7 @@
"http-proxy-middleware": "^1.0.6",
"jspdf": "^2.5.1",
"moment": "^2.29.1",
"ofd.js": "^1.4.9",
"qrcode.react": "^3.1.0",
"rc-tween-one": "^3.0.6",
"react": "17.0.2",
......@@ -137,4 +138,4 @@
"publishConfig": {
"registry": "https://g.civnet.cn:4873"
}
}
\ No newline at end of file
}
......@@ -11,23 +11,6 @@ const UserSelect = (props) => {
const [pullDown, setPullDown] = useState([])
const [searchValue, setSearchValue] = useState('')
const options = useMemo(() => {
let array = []
pullDown.forEach(v => {
if (searchValue) {
if (v?.label?.includes(searchValue)) {
array.push(v)
}
} else {
array.push(v)
}
})
if (array.length > 200) {
return array.slice(0, 199)
}
return array
}, [pullDown, searchValue])
const valueShow = useMemo(() => {
if (isMultiple) {
return value ? value.split(',') : []
......@@ -44,7 +27,20 @@ const UserSelect = (props) => {
const { code, data, msg } = await getUserSelector(role, isMySite ? userID : false, time)
if (code === 0) {
if (data) {
setPullDown(data.dropdownList.map(v => { return { label: v.userName, value: v[property], groupName: v.groupName } }))
setPullDown(data.dropdownList.map((v, i) => {
let length = v.groupName?.length
return {
label: (
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span>{v.userName}</span>
<span style={{ fontSize: '12px', color: '#b4b1b1', }}>{length > 20 ? `...${v.groupName.slice(length - 20, length)}` : v.groupName}</span>
</div>
),
userName: v.userName,
value: v[property],
groupName: v.groupName
}
}))
} else {
setPullDown([])
}
......@@ -73,8 +69,6 @@ const UserSelect = (props) => {
}
}, [])
console.log('options', options)
return (
<Select
mode={isMultiple ? 'multiple' : null}
......@@ -87,21 +81,10 @@ const UserSelect = (props) => {
searchValue={searchValue}
style={{ width: '100%' }}
onFocus={selectFocus}
filterOption={(input, option) => (option?.userName || '').toLowerCase().includes(input.toLowerCase())}
options={pullDown}
onChange={selectChange}
>
{
options.map((v, i) => {
let length = v.groupName?.length
return (
<Select.Option key={v.value + i} value={v.value}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span>{v.label}</span>
<span style={{ fontSize: '12px', color: '#b4b1b1', }}>{v.groupName?.length > 20 ? `...${v.groupName.slice(v.groupName.length - 20, length)}` : v.groupName}</span>
</div>
</Select.Option>
)
})
}
</Select>
)
......
......@@ -4,6 +4,7 @@ import { Upload, Button, message, Tabs } from 'antd'
import { UploadOutlined, FileOutline, ArrowDownOutlined } from '@ant-design/icons'
import FileViewer from 'react-file-viewer'
import Viewer from 'react-viewer'
import OFD from 'ofd.js'
import { uploadFileUrl, downloadFileUrl, downloadFile } from '../../../../apis/process'
import { filenameVerification } from '../../../../utils'
import Drag from '../../../components/Drag'
......@@ -181,6 +182,9 @@ const FileUpload = (props) => {
})
})
}
// if (fileType === 'ofd') {
// }
setVisible(true)
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment