this.onChange(e) }} />
>
);
}
}
/**
*
*主题列表
* @param {*} props
* @returns
*/
function body(props) {
const { getFieldDecorator, getFieldsValue } = 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: 10 })
}, [])
function openNotificationWithIcon(type, message) {
notification[type]({
message,
description:
'',
});
}
function getList(params) {
// 网路请求
request({ ...apis.customer.agents, params: { ...params } }).then(res => {
setDataSource(res)
}).catch(err => {
openNotificationWithIcon('error', err)
})
}
// 提交事件
function handleSubmit(e) {
e.preventDefault();
props.form.validateFields((err, values) => {
if (!err) {
getList({ pageNum: 1, pageSize: 10, ...values })
}
});
}
// eslint-disable-next-line react-hooks/rules-of-hooks
const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
// eslint-disable-next-line react-hooks/rules-of-hooks
const [gInviteData, setGInviteData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
// Change 事件
function handleSelectChange(e) {
// eslint-disable-next-line no-console
console.log(e)
}
function gM(row) {
setGVisibleData({ visible: true, customerId: row.personId, realtyConsultant: row.realtyConsultant })
setGInviteData({ visible: false })
}
function Invite(row) {
setGInviteData({ visible: true, customerId: row.personId, realtyConsultant: row.realtyConsultant })
setGVisibleData({ visible: false })
}
// 分页
function onChange(pageNum) {
// eslint-disable-next-line react-hooks/rules-of-hooks
getList({ pageNumber: pageNum, pageSize: 10 })
}
/**
* 重置搜索
*/
function handleReset() {
props.form.resetFields();
getList({ pageNumber: 1, pageSize: 10 })
}
function toAudit(cuurentId) {
router.push({
pathname: '/customer/recommendCustomer/audit',
query: {
id: cuurentId,
},
})
}
function exportIndependen() {
const fieldsValue = getFieldsValue()
console.log('fieldsValue', fieldsValue)
request({ ...apis.customer.customerRecommendAgentsExport, responseType: 'blob', params: { ...fieldsValue } })
.then(response => {
download(response)
}).catch(error => {
})
}
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: 'avatarurl',
key: 'avatarurl',
render: (_, record) => ,
},
{
title: '姓名',
dataIndex: 'nickname',
key: 'nickname',
render: (_, record) => <>{record.name || record.nickname}>,
},
{
title: '电话',
dataIndex: 'phone',
key: 'phone',
},
{
title: '性别',
dataIndex: 'gender',
key: 'gender',
// eslint-disable-next-line no-nested-ternary
render: (_, record) => <>{record.gender === '1' ? '男' : record.gender === '2' ? '女' : '未知'}>,
},
{
title: '类型',
dataIndex: 'personType',
key: 'personType',
render: (_, record) => <>{record.personType === 'channel agent' ? '专业经纪人' : '专业经纪人'}>,
},
{
title: '所属渠道',
dataIndex: 'channelName',
key: 'channelName',
render: (_, record) => <>{record.channelName}>,
},
{
title: '操作',
dataIndex: 'customerId',
key: 'customerId',
render: (_, record) => (
<>
{
<>
{/* 查看详细 */}
{/*
Invite(record)}>邀请经纪人
*/}
{/* */}
gM(record)}>推荐客户
>
}
>
),
},
]
//
// 渠道名称
//
//
//
return (
<>
{getFieldDecorator('channelId')(
// ,
)}
{getFieldDecorator('name')(
}
placeholder="姓名"
/>,
)}
{getFieldDecorator('tel')(
}
placeholder="电话"
/>,
)}
{/* 推荐客户 */}
setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })}/>
{/* 邀请经纪人 */}
setGInviteData({ visible: false, customerId: '', realtyConsultant: '' })} />
>
);
}
const WrappedBody = Form.create({ name: 'body' })(body);
export default WrappedBody