Commit 87353f90 authored by 田翔's avatar 田翔

fix: 重置时增加排序重置

parent 7f023aaa
{
"name": "panda-xform",
"version": "4.1.7",
"description": "4.1.7 BUG修复",
"version": "4.1.8",
"description": "4.1.8 重置时增加排序重置",
"keywords": [
"panda-xform"
],
......
......@@ -201,6 +201,11 @@ const SearchGroup = forwardRef((props, ref) => {
return params;
};
const reset = () => {
form.resetFields()
btnsClick('重置')
}
const btnsClick = type => {
props?.btnsClick?.(type, null);
};
......@@ -238,7 +243,7 @@ const SearchGroup = forwardRef((props, ref) => {
/>
</Form.Item>
<Form.Item style={{ marginBottom: 0 }}>
<Button type="primary" onClick={() => btnsClick('重置')}>
<Button type="primary" onClick={() => reset()}>
重置
</Button>
</Form.Item>
......
......@@ -27,17 +27,14 @@ const TablePack = (props, ref) => {
useImperativeHandle(ref, () => ({
setFilteredInfo,
setSortedInfo,
}))
const { parent, readOnly, config, fieldList, loading, dataSource, rowSelection, onRow, tableChange, btnsClick } = props
const [filteredInfo, setFilteredInfo] = useState({})
const [sortedInfo, setSortedInfo] = useState({})
const inputRef = useRef()
const handleReset = (clearFilters, confirm) => {
clearFilters()
confirm({ closeDropdown: true })
}
const getColumnSearchProps = (dataIndex) => ({
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => {
return (
......@@ -141,6 +138,7 @@ const TablePack = (props, ref) => {
width: 120,
ellipsis: true,
sorter: true,
sortOrder: sortedInfo.columnKey === v ? sortedInfo.order : null,
filteredValue: filteredInfo[v] || null,
...getColumnSearchProps(v),
render: (value, r) => {
......@@ -162,7 +160,7 @@ const TablePack = (props, ref) => {
})
})
return array
}, [config, fieldList, filteredInfo])
}, [config, fieldList, filteredInfo, sortedInfo])
const columns = useMemo(() => {
let columns = [
......
......@@ -18,18 +18,20 @@ import FormRender from '../FormRender'
const Account = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1
const { accountName, readOnly } = props
const [detailShow, setDetailShow] = useState(false)
const [params, setParams] = useState({
const userID = window?.globalConfig?.userInfo?.OID || 1
const initParams = {
userID: userID,
accountName,
sortFields: '录入时间',
direction: 'desc',
total: 0,
pageIndex: 1,
pageSize: 100
})
pageSize: 100,
queryWheres: [],
}
const [detailShow, setDetailShow] = useState(false)
const [params, setParams] = useState(initParams)
const [loading, setLoading] = useState(false)
const [dataSource, setDataSource] = useState([])
const [config, setConfig] = useState({ webShowFieldGroup: '', addFieldGroup: '', formJson: {} })
......@@ -49,8 +51,9 @@ const Account = (props) => {
}
if (type === '重置') {
tablePackRef.current.setFilteredInfo({})
setParams({ ...params, queryWheres: [] })
getDataSource({ queryWheres: [] })
tablePackRef.current.setSortedInfo({})
setParams(initParams)
getDataSource(initParams)
}
if (type === '编辑' || type === '详情') {
const { code, data, msg } = await GetTableDataInfo({ accountName, id })
......@@ -131,7 +134,6 @@ const Account = (props) => {
}
const search = (values) => {
setParams({ ...params, ...values })
getDataSource({ ...values })
}
......@@ -147,7 +149,7 @@ const Account = (props) => {
const { code, data, msg } = await GetAccountPageList({ ...params, ...param })
if (code === 0) {
setDataSource(isJson(data.jsonData) ? JSON.parse(data.jsonData) : [])
setParams({ ...params, total: data.totalCount, pageIndex: data.pageIndex, pageSize: data.pageSize })
setParams({ ...params, ...param, total: data.totalCount, pageIndex: data.pageIndex, pageSize: data.pageSize })
} else {
setDataSource([])
message.error(msg)
......@@ -165,6 +167,7 @@ const Account = (props) => {
}
const tableChange = (page, filters, sorter) => {
tablePackRef.current.setSortedInfo({ order: sorter.order, columnKey: sorter.field })
let queryWheres = []
Object.keys(filters).forEach(k => {
if (filters[k]?.[0]) {
......@@ -180,6 +183,8 @@ const Account = (props) => {
getDataSource(param)
}
console.log('params', params)
useEffect(() => {
getData()
}, [])
......
......@@ -55,13 +55,13 @@ const PrintXform = (props) => {
{
formTable.map(v => {
return (
<div className={styles.printGroup}>
<div className={styles.printGroup} key={v.fieldName}>
<div className={styles.groupName}>{v.title}</div>
<div className={styles.boxs}>
{
v.child.map(s => {
return (
<div className={styles.box} style={{ width: s.width }}>
<div key={s.fieldName} className={styles.box} style={{ width: s.width }}>
<div className={styles.itemLeft} style={{ width: s.labelWidth }}>{s.title}</div>
<div className={styles.itemRight}>{s.fieldValue}</div>
</div>
......
......@@ -130,8 +130,8 @@ const XRender = (props, ref) => {
watch={watch}
onMount={onMount}
/>
{print ? <PrintXform schemaForm={schemaForm} form={form} /> : null}
</Spin>
{print ? <PrintXform schemaForm={schemaForm} form={form} /> : null}
</div>
)
......
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