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

fix: bug修复

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