-
- {this.props.operator}
-
+
{this.props.operator}
-
@@ -193,14 +208,15 @@ export default class QueryList extends Component {
}>
- {
- !!this.state.dataSource && !!this.state.dataSource.length &&
+ {!!this.state.dataSource && !!this.state.dataSource.length && (
this.onListChange(current, pageSize)}
+ onChange={(current, pageSize) =>
+ this.onListChange(current, pageSize)
+ }
/>
- }
+ )}
diff --git a/web-react/src/components/query-table/index.jsx b/web-react/src/components/query-table/index.jsx
index 31e9b69..b842720 100644
--- a/web-react/src/components/query-table/index.jsx
+++ b/web-react/src/components/query-table/index.jsx
@@ -2,7 +2,9 @@ import React, { Component } from 'react'
import { Form, Button, Table, Tooltip } from 'antd'
import { AntIcon } from 'components'
-const clearChildren = (data) => {
+const propsMap = ['autoLoad', 'loadData', 'pageIndex', 'pageSize']
+
+const clearChildren = data => {
data.forEach(p => {
if (p.children) {
if (p.children.length) {
@@ -16,11 +18,10 @@ const clearChildren = (data) => {
}
/**
- * 渲染查询栏
- * @returns
- */
+ * 渲染查询栏
+ * @returns
+ */
function renderQueryBar() {
-
const { query, moreQuery, onQueryChange } = this.props
return (
@@ -28,21 +29,26 @@ function renderQueryBar() {
- }>查询
+ }>
+ 查询
+
- this.onResetQuery()} icon={} />
+ this.onResetQuery()}
+ icon={}
+ />
- {
- moreQuery && 更多查询条件
- }
+ {moreQuery && 更多查询条件}
@@ -54,14 +60,13 @@ function renderTable(props, on) {
}
export default class QueryTable extends Component {
-
state = {
// 加载状态
loading: false,
// 表格类型
type: '',
// 数据
- dataSource: []
+ dataSource: [],
}
// 查询表单实例
@@ -78,8 +83,8 @@ export default class QueryTable extends Component {
size: 'small',
showSizeChanger: true,
showQuickJumper: true,
- showTotal: (total) => `总共${total}条数据`,
- position: ['bottomLeft']
+ showTotal: total => `总共${total}条数据`,
+ position: ['bottomLeft'],
}
// 默认选中页码
@@ -97,7 +102,8 @@ export default class QueryTable extends Component {
super(props)
this.autoLoad = typeof this.props.autoLoad === 'boolean' ? this.props.autoLoad : true
- this.loadData = typeof this.props.loadData === 'function' ? this.props.loadData : async () => { }
+ this.loadData =
+ typeof this.props.loadData === 'function' ? this.props.loadData : async () => {}
if (this.props.pageIndex) {
this.pageIndex = this.props.pageIndex
@@ -125,22 +131,25 @@ export default class QueryTable extends Component {
onLoadData = async () => {
this.onLoading()
- const res = await this.loadData({
- pageIndex: this.pagination.current,
- pageSize: this.pagination.pageSize,
- ...this.sorter
- }, this.query)
+ const res = await this.loadData(
+ {
+ pageIndex: this.pagination.current,
+ pageSize: this.pagination.pageSize,
+ ...this.sorter,
+ },
+ this.query
+ )
if (res.rows || res.data || res.items) {
this.setState({
type: 'table',
- dataSource: res.rows || res.data || res.items
+ dataSource: res.rows || res.data || res.items,
})
this.pagination.total = res.totalCount
} else if (res) {
this.setState({
type: 'tree',
- dataSource: clearChildren(res)
+ dataSource: clearChildren(res),
})
this.pagination = false
@@ -155,8 +164,8 @@ export default class QueryTable extends Component {
onLoading = () => {
this.setState({
loading: {
- indicator: