Commit 5b876107 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复内外部状态字段

parent e035996a
/* /*
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-29 15:04:46 * @Date: 2020-09-29 15:04:46
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-11 16:39:17 * @LastEditTime: 2020-12-24 10:55:51
* @Description: 外部流转记录 * @Description: 外部流转记录
*/ */
import React from 'react'; import React from 'react';
import { REPAIR_OUTER_STATUS } from '@/constants'; import { REPAIR_OUTER_STATUS } from '@/constants';
import MellowCard from '@/components/MellowCard'; import MellowCard from '@/components/MellowCard';
import PolymericTable from '@/components/PolymericTable'; import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface'; import { EditableColumns } from '@/components/PolymericTable/interface';
import StatusTag from '@/components/StatusTag'; import StatusTag from '@/components/StatusTag';
import { REPAIR_OUTER_STATUS_TAG_MAP } from '../../constants'; import { REPAIR_OUTER_STATUS_TAG_MAP } from '../../constants';
interface OuterCirculationRecordProps { interface OuterCirculationRecordProps {
dataSource: { dataSource: {
roleName: string, roleName: string,
status: number | string, status: number | string,
operate: string, operate: string,
operateTime: string, operateTime: string,
opinion: string, opinion: string,
}[]; }[];
onPaginationChange?: (page: number, size: number) => void; onPaginationChange?: (page: number, size: number) => void;
}; };
const OuterCirculationRecord: React.FC<OuterCirculationRecordProps> = ({ const OuterCirculationRecord: React.FC<OuterCirculationRecordProps> = ({
dataSource = [], dataSource = [],
onPaginationChange, onPaginationChange,
}) => { }) => {
const columns: EditableColumns[] = [ const columns: EditableColumns[] = [
{ {
title: '序号', title: '序号',
dataIndex: 'order', dataIndex: 'order',
align: 'center', align: 'center',
render: (_, record, index) => index + 1, render: (_, record, index) => index + 1,
}, },
{ {
title: '操作角色', title: '操作角色',
dataIndex: 'roleName', dataIndex: 'roleName',
align: 'center', align: 'center',
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'statusName', dataIndex: 'status',
align: 'center', align: 'center',
render: (text, record) => <StatusTag type={REPAIR_OUTER_STATUS_TAG_MAP[record.status]} title={text} /> render: (text, record) => <StatusTag type={REPAIR_OUTER_STATUS_TAG_MAP[record.statusCode]} title={text} />
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'operate', dataIndex: 'operate',
align: 'center', align: 'center',
ellipsis: true, ellipsis: true,
}, },
{ {
title: '操作时间', title: '操作时间',
dataIndex: 'operateTime', dataIndex: 'operateTime',
align: 'center', align: 'center',
}, },
{ {
title: '审核意见', title: '审核意见',
dataIndex: 'opinion', dataIndex: 'opinion',
align: 'center', align: 'center',
ellipsis: true, ellipsis: true,
}, },
]; ];
const handlePaginationChange = (page, size) => { const handlePaginationChange = (page, size) => {
if (onPaginationChange) { if (onPaginationChange) {
onPaginationChange(page, size); onPaginationChange(page, size);
} }
}; };
return ( return (
<MellowCard <MellowCard
title="外部流转记录" title="外部流转记录"
> >
<PolymericTable <PolymericTable
rowKey="operateTime" rowKey="operateTime"
dataSource={dataSource} dataSource={dataSource}
columns={columns} columns={columns}
loading={false} loading={false}
pagination={null} pagination={null}
/> />
</MellowCard> </MellowCard>
); );
}; };
export default OuterCirculationRecord; export default OuterCirculationRecord;
\ No newline at end of file
/* /*
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-04 18:22:57 * @Date: 2020-11-04 18:22:57
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-11 17:15:08 * @LastEditTime: 2020-12-24 10:55:25
* @Description: 内、外部流转记录 * @Description: 内、外部流转记录
*/ */
import React from 'react'; import React from 'react';
import { import {
Tabs, Tabs,
Badge, Badge,
} from 'antd'; } from 'antd';
import PolymericTable from '@/components/PolymericTable'; import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface'; import { EditableColumns } from '@/components/PolymericTable/interface';
import MellowCard from '@/components/MellowCard'; import MellowCard from '@/components/MellowCard';
import StatusTag from '@/components/StatusTag'; import StatusTag from '@/components/StatusTag';
import { import {
REPAIR_OUTER_STATUS_TAG_MAP, REPAIR_OUTER_STATUS_TAG_MAP,
REPAIR_INNER_STATUS_BADGE_MAP, REPAIR_INNER_STATUS_BADGE_MAP,
} from '../../../constants'; } from '../../../constants';
import styles from './index.less'; import styles from './index.less';
export interface InnerHistoryItem { export interface InnerHistoryItem {
step: number; step: number;
operator: string; operator: string;
department: string; department: string;
jobTitle: string; jobTitle: string;
status: string; status: string;
operate: string; operate: string;
operateTime: string, operateTime: string,
opinion: string; opinion: string;
}; };
export interface OuterHistoryItem { export interface OuterHistoryItem {
roleName: string; roleName: string;
status: string; status: string;
operate: string; operate: string;
operateTime: string; operateTime: string;
opinion: string; opinion: string;
}; };
interface FlowRecordsProps { interface FlowRecordsProps {
outerHistory?: OuterHistoryItem[]; outerHistory?: OuterHistoryItem[];
innerHistory: InnerHistoryItem[]; innerHistory: InnerHistoryItem[];
}; };
const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHistory }) => { const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHistory }) => {
const outerColumns: EditableColumns[] = [ const outerColumns: EditableColumns[] = [
{ {
title: '序号', title: '序号',
dataIndex: 'index', dataIndex: 'index',
align: 'center', align: 'center',
render: (_, record, index) => index + 1, render: (_, record, index) => index + 1,
}, },
{ {
title: '操作角色', title: '操作角色',
dataIndex: 'roleName', dataIndex: 'roleName',
align: 'center', align: 'center',
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'statusName', dataIndex: 'status',
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => (
<StatusTag type={REPAIR_OUTER_STATUS_TAG_MAP[record.status]} title={text} /> <StatusTag type={REPAIR_OUTER_STATUS_TAG_MAP[record.statusCode]} title={text} />
), ),
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'operate', dataIndex: 'operate',
align: 'center', align: 'center',
}, },
{ {
title: '操作时间', title: '操作时间',
dataIndex: 'operateTime', dataIndex: 'operateTime',
align: 'center', align: 'center',
ellipsis: true, ellipsis: true,
}, },
{ {
title: '审核意见', title: '审核意见',
dataIndex: 'opinion', dataIndex: 'opinion',
align: 'center', align: 'center',
ellipsis: true, ellipsis: true,
}, },
]; ];
const innerColumns: EditableColumns[] = [ const innerColumns: EditableColumns[] = [
{ {
title: '序号', title: '序号',
dataIndex: 'step', dataIndex: 'step',
align: 'center', align: 'center',
}, },
{ {
title: '操作人', title: '操作人',
dataIndex: 'operator', dataIndex: 'operator',
align: 'center', align: 'center',
}, },
{ {
title: '部门', title: '部门',
dataIndex: 'department', dataIndex: 'department',
align: 'center', align: 'center',
}, },
{ {
title: '职位', title: '职位',
dataIndex: 'jobTitle', dataIndex: 'jobTitle',
align: 'center', align: 'center',
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'statusName', dataIndex: 'statusName',
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => (
<Badge color={REPAIR_INNER_STATUS_BADGE_MAP[record.status]} text={text} /> <Badge color={REPAIR_INNER_STATUS_BADGE_MAP[record.status]} text={text} />
), ),
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'operate', dataIndex: 'operate',
align: 'center', align: 'center',
}, },
{ {
title: '操作时间', title: '操作时间',
dataIndex: 'operateTime', dataIndex: 'operateTime',
align: 'center', align: 'center',
ellipsis: true, ellipsis: true,
}, },
{ {
title: '审核意见', title: '审核意见',
dataIndex: 'opinion', dataIndex: 'opinion',
align: 'center', align: 'center',
ellipsis: true, ellipsis: true,
}, },
]; ];
return ( return (
<MellowCard> <MellowCard>
<Tabs onChange={() => {}}> <Tabs onChange={() => {}}>
{outerHistory ? ( {outerHistory ? (
<Tabs.TabPane tab="外部流转记录" key="1"> <Tabs.TabPane tab="外部流转记录" key="1">
<PolymericTable <PolymericTable
rowKey="operateTime" rowKey="operateTime"
dataSource={outerHistory} dataSource={outerHistory}
columns={outerColumns} columns={outerColumns}
loading={false} loading={false}
pagination={null} pagination={null}
/> />
</Tabs.TabPane> </Tabs.TabPane>
) : null} ) : null}
<Tabs.TabPane tab="内部流转记录" key="2"> <Tabs.TabPane tab="内部流转记录" key="2">
<PolymericTable <PolymericTable
rowKey="operateTime" rowKey="operateTime"
dataSource={innerHistory} dataSource={innerHistory}
columns={innerColumns} columns={innerColumns}
loading={false} loading={false}
pagination={null} pagination={null}
/> />
</Tabs.TabPane> </Tabs.TabPane>
</Tabs> </Tabs>
</MellowCard> </MellowCard>
); );
}; };
export default FlowRecords; export default FlowRecords;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment