diff --git a/src/pages/home/branch/dashboard/dashboard.js b/src/pages/home/branch/dashboard/dashboard.js index bff0ce3..e7d15fb 100644 --- a/src/pages/home/branch/dashboard/dashboard.js +++ b/src/pages/home/branch/dashboard/dashboard.js @@ -213,7 +213,6 @@ class Dashboard extends Component { } pageChange = e =>{ - api.get("/admin/board/get_new_companies", { page_no: e, page_size: 10 }).then(res => { this.setState({ company: res.result.records, diff --git a/src/pages/home/branch/setting/user.js b/src/pages/home/branch/setting/user.js index abc547c..1c077be 100644 --- a/src/pages/home/branch/setting/user.js +++ b/src/pages/home/branch/setting/user.js @@ -4,8 +4,6 @@ import { rsaKey } from "@/utils/rsaKey.js"; import api from "@/api/request" import FeTable from "@/components/table" -const { Search } = Input - const { Option } = Select class UserSet extends Component { @@ -15,16 +13,17 @@ class UserSet extends Component { visible: false, data: [], columns: [], - loading:false + loading: false, + total: 0 } } AddForm = React.createRef() componentDidMount() { - this.onSearch("") - } - + this.submit("") + } + setVisible = () => { this.setState({ @@ -38,34 +37,47 @@ class UserSet extends Component { }) } - onSearch = (value) => { - api.get("/admin/user/list_user", { - criteria: value, - skip: 1, - limit: 10 - }) + submit = (value) => { + const obj = { + search: value || {}, + sort: { + 创建时间: value.sort || 'desc' + }, + page_size: 10, + page_no: 1 + } + api.post("/admin/user/list_user", obj) .then(res => { - const col = Object.keys(res.result.data[0]).map((item, key) => { - return { - title: item, - dataIndex: item, - key, - align: 'center', - } - }) - col.push( - { - title: "operation", - dataIndex: "operation", - key: res.result.data[0].length - 1, - align: 'center', - render: (record) => , - } - ) - this.setState({ - data: res.result.data, - columns: col - }) + if (res.result.records.length !== 0) { + const col = Object.keys(res.result.records[0]).map((item, key) => { + return { + title: item, + dataIndex: item, + key, + align: 'center', + } + }) + col.push( + { + title: "operation", + dataIndex: "operation", + key: res.result.records[0].length - 1, + align: 'center', + render: (record) => , + } + ) + this.setState({ + data: res.result.records, + total: res.result.total, + columns: col + }) + } else { + this.setState({ + data: [], + total: 0, + columns: [] + }) + } }) .catch(err => { console.log(err) @@ -84,15 +96,23 @@ class UserSet extends Component { message.success(res.info) this.onSearch() }) - }else { + } else { return false } } + pageChange = e => { + api.get("/admin/board/get_new_companies", { page_no: e, page_size: 10 }).then(res => { + this.setState({ + data: res.result.records, + total: res.result.total + }) + }) + } onAdd = () => { this.setState({ - loading:true + loading: true }) const form = this.AddForm.current const data = { @@ -103,13 +123,13 @@ class UserSet extends Component { } api.post("/admin/user/create_user", data).then(res => { this.setState({ - loading:false - },()=>{ + loading: false + }, () => { message.success(res.info) this.onCancel() this.onSearch() }) - + }) } @@ -117,15 +137,43 @@ class UserSet extends Component { return ( - - +
+ + + + + + + + + + + + + + + + + + + +
- +