Commit 700f0cf1 authored by 田翔's avatar 田翔

fix: bug修复

parent 2e2c6966
...@@ -206,62 +206,63 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -206,62 +206,63 @@ const SearchGroup = forwardRef((props, ref) => {
}; };
return ( return (
<div className={styles.accountFlexWrapper}> <Row className={styles.controlRow}>
<Row className={styles.controlRow}> <Form layout={'inline'} form={form} onValuesChange={onValuesChange}>
<Form layout={'horizontal'} form={form} onValuesChange={onValuesChange}> {
<Space className={styles.controlRowLeft} wrap> showPicker ? (
{showPicker ? ( <Form.Item label={`录入时间`} name="time" style={{ marginBottom: 0 }}>
<Form.Item label={`录入时间`} name="time" className={styles.noMarginBottom}> <RangePicker
<RangePicker
size="middle"
value={[...dateArray]}
locale={locale}
// defaultValue={rangerOptions[timeQuantumStr]}
showTime={formatterStr === 'YYYY-MM-DD HH:mm:ss'}
ranges={{ ...rangerOptions }}
format={formatterStr}
style={{ width: 300 }}
// onChange={dateChange}
/>
</Form.Item>
) : (
''
)}
<Form.Item label={'快捷搜索'} name="info" className={styles.noMarginBottom}>
<Search
size="middle" size="middle"
style={{ value={[...dateArray]}
width: 320, locale={locale}
verticalAlign: 'middle', // defaultValue={rangerOptions[timeQuantumStr]}
marginLeft: '10px', showTime={formatterStr === 'YYYY-MM-DD HH:mm:ss'}
}} ranges={{ ...rangerOptions }}
placeholder="请输入值" format={formatterStr}
onSearch={onSearch} style={{ width: 300 }}
// onChange={dateChange}
/> />
</Form.Item> </Form.Item>
</Space> ) : null
</Form> }
{/* 按钮区域 */} <Form.Item label={'快捷搜索'} name="info" style={{ marginBottom: 0 }}>
<div className={styles.controlRowRight}> <Search
<div className={styles.controlBtns}> size="middle"
{ style={{
!readOnly ? ( width: 320,
<Button verticalAlign: 'middle',
type="primary" marginLeft: '10px',
size="middle" }}
onClick={() => btnsClick('添加')} placeholder="请输入值"
icon={<PlusOutlined />} onSearch={onSearch}
style={{ marginLeft: 20 }} />
> </Form.Item>
添加 <Form.Item style={{ marginBottom: 0 }}>
</Button> <Button type="primary" onClick={() => btnsClick('重置')}>
) : null 重置
} </Button>
</div> </Form.Item>
</Form>
{/* 按钮区域 */}
<div className={styles.controlRowRight}>
<div className={styles.controlBtns}>
{
!readOnly ? (
<Button
type="primary"
size="middle"
onClick={() => btnsClick('添加')}
icon={<PlusOutlined />}
style={{ marginLeft: 20 }}
>
添加
</Button>
) : null
}
</div> </div>
</Row> </div>
</div> </Row>
); )
}); })
export default SearchGroup; export default SearchGroup
.accountFlexWrapper { .controlRow {
width: 100%; width: 100%;
height: 100%; //min-height: 630px; height: 100%;
display: flex; display: flex;
flex-direction: column; justify-content: space-between;
.controlRow { align-items: center;
background: #ffffff;
.controlRowRight {
max-width: 30%;
display: flex; display: flex;
justify-content: space-between; align-items: flex-end;
background: #ffffff; .controlBtns {
margin: 8px;
// padding: 8px;
gap: 10px;
:global {
.panda-civ-water-form-horizontal {
max-width: 68%;
}
}
.controlRowLeft {
flex: 1;
}
.controlRowRight {
// max-width: 230px;
max-width: 30%;
display: flex; display: flex;
align-items: flex-end; justify-content: flex-end;
.controlBtns { }
:global {
.panda-civ-water-dropdown-button {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
:global {
.panda-civ-water-dropdown-button {
display: flex;
justify-content: flex-end;
}
}
}
.noMarginBottom {
margin-bottom: 0;
:global {
.panda-civ-water-form-item-control-input-content {
display: flex;
}
}
} }
} }
.accountManageControlWrapper { .noMarginBottom {
position: relative; margin-bottom: 0;
padding: 6px 10px; :global {
margin: 8px 8px 10px; .panda-civ-water-form-item-control-input-content {
background: #fff; display: flex;
.firstRow {
.searchBtn {
margin-left: 10px;
margin-right: 10px;
} }
} }
.collapseButton {
display: flex;
justify-content: center;
align-items: center;
background: #ffffff;
color: rgba(0, 0, 0, .65);
padding: 0;
position: absolute;
height: 10px;
width: 25px;
left: 0;
bottom: -10px;
border: 1px solid rgba(0, 0, 0, .2);
border-top: none;
cursor: pointer;
}
}
.accountTableWrapper {
flex: 1;
padding: 8px 8px 0px 8px;
margin: 0px 8px 8px;
background: #fff;
overflow: hidden;
.buttonHover:hover {
opacity: 0.6;
}
} }
} }
\ No newline at end of file
import React, { useMemo, useRef } from 'react' import React, { useMemo, useState, useRef, forwardRef, useImperativeHandle } from 'react'
import { Table, Tooltip, Button, Popconfirm, Input, Space } from 'antd' import { Table, Tooltip, Button, Popconfirm, Input, Space, useTable } from 'antd'
import { SearchOutlined } from '@ant-design/icons' import { SearchOutlined } from '@ant-design/icons'
import FileView from './components/FileView' import FileView from './components/FileView'
import CoordView from './components/CoordView' import CoordView from './components/CoordView'
...@@ -23,10 +23,15 @@ const getFileInfo = (formJson) => { ...@@ -23,10 +23,15 @@ const getFileInfo = (formJson) => {
return obj return obj
} }
const TablePack = (props) => { const TablePack = (props, ref) => {
useImperativeHandle(ref, () => ({
setFilteredInfo,
}))
const { parent, readOnly, config, loading, dataSource, rowSelection, onRow, tableChange, btnsClick } = props const { parent, readOnly, config, loading, dataSource, rowSelection, onRow, tableChange, btnsClick } = props
const searchInput = useRef(null) const [filteredInfo, setFilteredInfo] = useState({})
const inputRef = useRef()
const handleReset = (clearFilters, confirm) => { const handleReset = (clearFilters, confirm) => {
clearFilters() clearFilters()
...@@ -34,43 +39,57 @@ const TablePack = (props) => { ...@@ -34,43 +39,57 @@ const TablePack = (props) => {
} }
const getColumnSearchProps = (dataIndex) => ({ const getColumnSearchProps = (dataIndex) => ({
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => ( filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => {
<div return (
style={{ padding: 8 }} <div
onKeyDown={(e) => e.stopPropagation()} style={{ padding: 8 }}
> onKeyDown={(e) => e.stopPropagation()}
<Input >
ref={searchInput} <Input
placeholder={`搜索 ${dataIndex}`} ref={inputRef}
value={selectedKeys[0]} placeholder={`搜索 ${dataIndex}`}
onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])} value={selectedKeys[0]}
onPressEnter={() => confirm({ closeDropdown: true })} onChange={e => {
style={{ setSelectedKeys(e.target.value ? [e.target.value] : [])
marginBottom: 8, }}
display: 'block', onPressEnter={() => {
width: '280px', setFilteredInfo({ ...filteredInfo, [dataIndex]: selectedKeys[0] })
}} confirm({ closeDropdown: true })
/> }}
<Space> style={{
<Button marginBottom: 8,
type="primary" display: 'block',
onClick={() => confirm({ closeDropdown: true })} width: '280px',
icon={<SearchOutlined />} }}
size="small" />
style={{ width: 90 }} <Space>
> <Button
搜索 type="primary"
</Button> onClick={() => {
<Button setFilteredInfo({ ...filteredInfo, [dataIndex]: selectedKeys[0] })
onClick={() => handleReset(clearFilters, confirm)} confirm({ closeDropdown: true })
size="small" }}
style={{ width: 90 }} icon={<SearchOutlined />}
> size="small"
重置 style={{ width: 90 }}
</Button> >
</Space> 搜索
</div> </Button>
), <Button
onClick={() => {
setFilteredInfo({ ...filteredInfo, [dataIndex]: [] })
clearFilters()
confirm({ closeDropdown: true })
}}
size="small"
style={{ width: 90 }}
>
重置
</Button>
</Space>
</div>
)
},
filterIcon: (filtered) => ( filterIcon: (filtered) => (
<SearchOutlined <SearchOutlined
style={{ style={{
...@@ -117,7 +136,7 @@ const TablePack = (props) => { ...@@ -117,7 +136,7 @@ const TablePack = (props) => {
width: 120, width: 120,
ellipsis: true, ellipsis: true,
sorter: true, sorter: true,
filterSearch: true, filteredValue: filteredInfo[v] || null,
...getColumnSearchProps(v), ...getColumnSearchProps(v),
render: (value, r) => { render: (value, r) => {
let props = { ...json[v], value } let props = { ...json[v], value }
...@@ -138,7 +157,7 @@ const TablePack = (props) => { ...@@ -138,7 +157,7 @@ const TablePack = (props) => {
}) })
}) })
return array return array
}, [config]) }, [config, filteredInfo])
const columns = useMemo(() => { const columns = useMemo(() => {
let columns = [ let columns = [
...@@ -221,4 +240,4 @@ const TablePack = (props) => { ...@@ -221,4 +240,4 @@ const TablePack = (props) => {
} }
export default TablePack export default forwardRef(TablePack)
\ No newline at end of file \ No newline at end of file
...@@ -37,6 +37,7 @@ const Account = (props) => { ...@@ -37,6 +37,7 @@ const Account = (props) => {
const [submitLoading, setSubmitLoading] = useState(false) const [submitLoading, setSubmitLoading] = useState(false)
const [operation, setOperation] = useState({ id: null, state: '添加' }) const [operation, setOperation] = useState({ id: null, state: '添加' })
const formRenderRef = useRef() const formRenderRef = useRef()
const tablePackRef = useRef()
const btnsClick = async (type, id) => { const btnsClick = async (type, id) => {
const { addFieldGroup, editFieldGroup, formJson } = config const { addFieldGroup, editFieldGroup, formJson } = config
...@@ -46,6 +47,11 @@ const Account = (props) => { ...@@ -46,6 +47,11 @@ const Account = (props) => {
if (type === '添加') { if (type === '添加') {
saveClick(addField, formJson, [], type) saveClick(addField, formJson, [], type)
} }
if (type === '重置') {
tablePackRef.current.setFilteredInfo({})
setParams({ ...params, queryWheres: [] })
getDataSource({ queryWheres: [] })
}
if (type === '编辑' || type === '详情') { if (type === '编辑' || type === '详情') {
const { code, data, msg } = await GetTableDataInfo({ accountName, id }) const { code, data, msg } = await GetTableDataInfo({ accountName, id })
if (code === 0) { if (code === 0) {
...@@ -197,6 +203,7 @@ const Account = (props) => { ...@@ -197,6 +203,7 @@ const Account = (props) => {
dataSource={dataSource} dataSource={dataSource}
btnsClick={btnsClick} btnsClick={btnsClick}
tableChange={tableChange} tableChange={tableChange}
ref={tablePackRef}
/> />
</div> </div>
</div> </div>
......
...@@ -65,10 +65,12 @@ const ComboBox = (props) => { ...@@ -65,10 +65,12 @@ const ComboBox = (props) => {
}, [sourceType, enums, isStoreID]) }, [sourceType, enums, isStoreID])
const handleChange = (value) => { const handleChange = (value) => {
if (isMultiple || isEdit) { if (addons) {
onChange(value.join(',') || '') if (isMultiple || isEdit) {
} else { onChange(value.join(',') || '')
onChange(value || '') } else {
onChange(value || '')
}
} }
} }
......
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