dev-v2
parent
3b8eefa933
commit
8642997c3e
@ -0,0 +1,125 @@
|
||||
import {
|
||||
judgePurchaseAgentForAdminUsingGet,
|
||||
purchaseAgentDetailForAdminUsingGet,
|
||||
} from '@/services/pop-b2b2c/pbcPurchaseAgentInfoController';
|
||||
import { ProCard } from '@ant-design/pro-components';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Access, useAccess, useParams } from '@umijs/max';
|
||||
import { Button, Descriptions, Image, message } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
const Detail: React.FC<any> = () => {
|
||||
const params = useParams();
|
||||
const access: any = useAccess();
|
||||
|
||||
const [info, setInfo] = useState<API.PbcPurchaseAgentInfo_>({});
|
||||
|
||||
const getInfo = () => {
|
||||
if (params.id) {
|
||||
purchaseAgentDetailForAdminUsingGet({ pbcId: parseInt(params.id) }).then((res) => {
|
||||
if (res.retcode && res.data) {
|
||||
setInfo(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getInfo();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
header={{
|
||||
title: '',
|
||||
}}
|
||||
footer={
|
||||
info.pbcReviewStatus === 0
|
||||
? [
|
||||
<Button
|
||||
key="back"
|
||||
onClick={() => {
|
||||
history.back();
|
||||
}}
|
||||
>
|
||||
返回
|
||||
</Button>,
|
||||
<Access key="no" accessible={access.purchaseAgentApproval}>
|
||||
<Button
|
||||
type="primary"
|
||||
danger
|
||||
onClick={async () => {
|
||||
if (params.id) {
|
||||
await judgePurchaseAgentForAdminUsingGet({
|
||||
pbcId: parseInt(params.id),
|
||||
pbcReviewStatus: 2,
|
||||
}).then((res) => {
|
||||
if (res.retcode) {
|
||||
message.success('成功驳回');
|
||||
getInfo();
|
||||
} else {
|
||||
message.error(res.retmsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
审核驳回
|
||||
</Button>
|
||||
</Access>,
|
||||
<Access key="pass" accessible={access.purchaseAgentApproval}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
if (params.id) {
|
||||
judgePurchaseAgentForAdminUsingGet({
|
||||
pbcId: parseInt(params.id),
|
||||
pbcReviewStatus: 1
|
||||
}).then((res) => {
|
||||
if (res.retcode) {
|
||||
message.success('审核通过');
|
||||
getInfo();
|
||||
} else {
|
||||
message.error(res.retmsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
审核通过
|
||||
</Button>
|
||||
</Access>,
|
||||
]
|
||||
: [
|
||||
<Button
|
||||
key="back"
|
||||
onClick={() => {
|
||||
history.back();
|
||||
}}
|
||||
>
|
||||
返回
|
||||
</Button>,
|
||||
]
|
||||
}
|
||||
>
|
||||
<ProCard style={{ marginBottom: 12 }}>
|
||||
<Descriptions bordered title="基本信息" column={2}>
|
||||
<Descriptions.Item label="采购员姓名">{info.pbcPurchaseAgentName}</Descriptions.Item>
|
||||
<Descriptions.Item label="年龄">{info.pbcPurchaseAgentAge}</Descriptions.Item>
|
||||
<Descriptions.Item label="联系电话">{info.pbcPurchaseAgentMobile}</Descriptions.Item>
|
||||
<Descriptions.Item label="从业年数">{info.pbcPurchaseAgentWorkingAge}年</Descriptions.Item>
|
||||
<Descriptions.Item label="常驻区域">{info.pbcPurchaseAgentResidentArea}</Descriptions.Item>
|
||||
<Descriptions.Item label="申请时间">{info.pbcCreateAt}</Descriptions.Item>
|
||||
<Descriptions.Item label="擅长面料用途" span={2}>
|
||||
{info.pbcPurchaseAgentFabricUse}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="头像" span={2}>
|
||||
<Image width={200} src={info.pbcPurchaseAgentImage} />
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</ProCard>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default Detail;
|
@ -0,0 +1,141 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import Constants from '@/constants';
|
||||
import { Image } from 'antd';
|
||||
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { handlePageQuery } from '@/utils/utils';
|
||||
import { getPurchaseAgentPageForAdminUsingPost } from '@/services/pop-b2b2c/pbcPurchaseAgentInfoController';
|
||||
import { Link } from '@umijs/max';
|
||||
|
||||
/**
|
||||
* 查询表格
|
||||
* @param param0
|
||||
*/
|
||||
const fetchData = async (params: API.PbcPurchaseAgentInfo_) => {
|
||||
const msg = await getPurchaseAgentPageForAdminUsingPost(params);
|
||||
return {
|
||||
data: msg.data?.records,
|
||||
total: msg.data?.total,
|
||||
success: msg.retcode,
|
||||
} as any;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
const TableList: React.FC<{}> = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [tabActiveKey, setTabActiveKey] = useState<string>('0')
|
||||
|
||||
const columns: ProColumns<API.PbcPurchaseAgentInfo_>[] = [
|
||||
{
|
||||
title: '采购员姓名',
|
||||
dataIndex: 'pbcPurchaseAgentName',
|
||||
},
|
||||
{
|
||||
title: '年龄',
|
||||
dataIndex: 'pbcPurchaseAgentAge',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '联系电话',
|
||||
dataIndex: 'pbcPurchaseAgentMobile',
|
||||
},
|
||||
{
|
||||
title: '从业年数',
|
||||
dataIndex: 'pbcPurchaseAgentWorkingAge',
|
||||
search: false,
|
||||
render: (text) => text ? `${text}年` : '-'
|
||||
},
|
||||
{
|
||||
title: '常驻区域',
|
||||
dataIndex: 'pbcPurchaseAgentResidentArea',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '擅长面料用途',
|
||||
dataIndex: 'pbcPurchaseAgentFabricUse',
|
||||
ellipsis: true,
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '头像',
|
||||
dataIndex: 'pbcPurchaseAgentImage',
|
||||
search: false,
|
||||
render: (text: any) => text ? <Image width={50} src={text} /> : '-'
|
||||
},
|
||||
{
|
||||
title: '申请日期',
|
||||
dataIndex: 'pbcCreateAt',
|
||||
valueType: 'dateTimeRange',
|
||||
render: (text, record) => record.pbcCreateAt
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'pbcReviewStatus',
|
||||
valueEnum: Constants.pbcApprovalStatus,
|
||||
search: false
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
valueType: 'option',
|
||||
render: (text, record) => (
|
||||
<span>
|
||||
<Link to={'/purchase-agent/detail/' + record.pbcId}>详情</Link>
|
||||
</span>
|
||||
),
|
||||
},
|
||||
];
|
||||
return (
|
||||
<PageContainer
|
||||
header={{
|
||||
title: '',
|
||||
breadcrumb: {},
|
||||
}}
|
||||
tabActiveKey={tabActiveKey}
|
||||
onTabChange={(key) => setTabActiveKey(key)}
|
||||
tabList={[
|
||||
{
|
||||
tab: "待审核",
|
||||
key: "0"
|
||||
},
|
||||
{
|
||||
tab: "审核通过",
|
||||
key: "1"
|
||||
},
|
||||
{
|
||||
tab: "审核驳回",
|
||||
key: "2"
|
||||
},
|
||||
]}
|
||||
>
|
||||
<ProTable<API.PbcPurchaseAgentInfo_>
|
||||
columns={columns}
|
||||
actionRef={actionRef}
|
||||
request={(param: any) => {
|
||||
const queryParam = handlePageQuery(param);
|
||||
return fetchData(queryParam);
|
||||
}}
|
||||
rowKey="pbcId"
|
||||
size="small"
|
||||
bordered
|
||||
search={{
|
||||
labelWidth: 'auto',
|
||||
span: 6
|
||||
}}
|
||||
params={{ pbcPurchaseAgentStatus: tabActiveKey }}
|
||||
pagination={{
|
||||
defaultPageSize: 20,
|
||||
showSizeChanger: true,
|
||||
}}
|
||||
scroll={{
|
||||
y: 'calc(100vh - 320px)',
|
||||
}}
|
||||
dateFormatter="string"
|
||||
options={false}
|
||||
toolBarRender={() => []}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableList;
|
Loading…
Reference in New Issue