import React, { useState, useEffect } from 'react'; import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar } from 'antd'; import moment from 'moment'; import request from '../../../utils/request'; import apis from '../../../services/apis'; import Styles from './style.less'; import BuildSelect from '../../../components/SelectButton/BuildSelect' import AuthButton from '@/components/AuthButton'; const { Option } = Select; // eslint-disable-next-line @typescript-eslint/no-unused-vars const { Meta } = Card; const tempDate = [{ code: 's101' }] /** * * * @param {*} props * @returns */ function body(props) { const { getFieldDecorator } = props.form // eslint-disable-next-line react-hooks/rules-of-hooks const [dataSource, setDataSource] = useState({ records: [] }) // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { getList({ pageNumber: 1, pageSize: 9 }) }, []) function getList(params) { // 网路请求 request({ ...apis.customer.report, params: { ...params } }).then(res => { setDataSource(res) }).catch(err => { // eslint-disable-next-line no-unused-expressions }) } // 提交事件 function handleSubmit(e) { e.preventDefault(); props.form.validateFields((err, values) => { if (!err) { getList({ pageNum: 1, pageSize: 10, ...values }) } }); } // Change 事件 function handleSelectChange(e) { // eslint-disable-next-line no-console console.log(e) } // 分页 function onChange(pageNum) { // eslint-disable-next-line react-hooks/rules-of-hooks getList({ pageNumber: pageNum, pageSize: 9 }) } /** * 重置搜索 */ function handleReset() { props.form.resetFields(); getList({ pageNumber: 1, pageSize: 9 }) } function exportReport() { request({ ...apis.customer.customerRecommendReportExport, params: { ...props.form.getFieldsValue() }, responseType: 'blob' }) .then(response => { download(response) }) } function download(data) { if (!data) { return } const url = window.URL.createObjectURL(new Blob([data])) const link = document.createElement('a') link.style.display = 'none' link.href = url link.setAttribute('download', '报备客户.xlsx') document.body.append(link) link.click() } const columns = [ { title: '头像', dataIndex: 'picture', key: 'picture', render: (_, record) => , }, { title: '姓名', dataIndex: 'name', key: 'name', }, { title: '电话', dataIndex: 'phone', key: 'phone', }, { title: '性别', dataIndex: 'sex', key: 'sex', // eslint-disable-next-line no-nested-ternary render: (_, record) => <>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}, }, { title: '意向项目', dataIndex: 'intentionName', key: 'intentionName', }, { title: '置业顾问', dataIndex: 'consultantName', key: 'consultantName', }, { title: '置业顾问手机号', dataIndex: 'consultTel', key: 'consultTel', }, ] return ( <>
handleSubmit(e, props)} > {getFieldDecorator('name')( } placeholder="姓名" />, )} {getFieldDecorator('tel')( } placeholder="电话" />, )} {getFieldDecorator('consultName')( , )} {getFieldDecorator('consultTel')( , )} {getFieldDecorator('sex')( , )} {getFieldDecorator('buildingId')( , )}
); } const WrappedBody = Form.create({ name: 'body' })(body); export default WrappedBody