import React, { useState, useEffect } from 'react';
import { Form, Modal, Button, Table, message, Input, Icon, Pagination } from 'antd';
import request from '../../../utils/request';
import apis from '../../../services/apis';
import router from 'umi/router';
const { Column, ColumnGroup } = Table;
const SelectContact = props => {
const [data, setData] = useState([]);
const [visible, setVisible] = useState(false);
const [group, setGroup] = useState({ groupId: undefined, groupName: '新增' })
useEffect(() => {
}, [props.value])
// 查询列表
const getList = (params) => {
request({ ...apis.contact.list, params: { ...params } }).then((data) => {
console.log(data)
setData(data)
})
}
useEffect(() => {
getList({ pageNum: 1, pageSize: 10, })
}, []);
// 提交事件
const handleSubmit = (e, props) => {
e.preventDefault();
e.stopPropagation();
props.form.validateFields((err, values) => {
if (!err) {
getList({ pageNum: 1, pageSize: 10, ...values })
}
});
}
function handleReset() {
props.form.resetFields();
getList({ pageNum: 1, pageSize: 10 })
}
const changePageNum = (pageNumber) => {
getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
}
const toAdd = () => {
router.push({
pathname: '/contact/contact/add',
});
}
const selectData = (record) => {
request({ ...apis.fund.addContact, urlData: { id: record.contactId } }).then((data) => {
message.success('新增成功!');
props.onClick()
setVisible(false)
})
}
const columns = [
{
title: '姓名',
dataIndex: 'contactName',
key: 'contactName',
align: 'center',
ellipsis: true,
},
{
title: '性别',
dataIndex: 'sex',
key: 'sex',
align: 'center',
ellipsis: true,
render: text => {text == 1 ? '男' : text == 2 ? '女' : ''},
},
{
title: '头像',
dataIndex: 'avatar',
key: 'avatar',
align: 'center',
ellipsis: true,
render: text => ,
},
{
title: '固话',
dataIndex: 'telephone',
key: 'telephone',
align: 'center',
ellipsis: true,
},
{
title: '手机号',
dataIndex: 'phone',
key: 'phone',
align: 'center',
ellipsis: true,
},
{
title: '对外头衔',
dataIndex: 'appellation',
key: 'appellation',
align: 'center',
ellipsis: true,
},
{
title: '操作',
align: 'center',
width: '20%',
render: (text, record) => (
selectData(record)} style={{ color: 'blue' }}>选择
),
},
];
const { getFieldDecorator } = props.form
return (