154 lines
4.5 KiB
TypeScript
154 lines
4.5 KiB
TypeScript
|
|
import { MyColumns, MyProTableProps, useCurrentPermissions } from '@/common';
|
|||
|
|
import { Selects } from '@/components/Select';
|
|||
|
|
import { Apis } from '@/gen/Apis';
|
|||
|
|
import {
|
|||
|
|
HouseWorkOrdersLocationEnum,
|
|||
|
|
HouseWorkOrdersStatusEnum,
|
|||
|
|
HouseWorkOrdersTypeEnum,
|
|||
|
|
} from '@/gen/Enums';
|
|||
|
|
import { ProTable } from '@ant-design/pro-components';
|
|||
|
|
import { Space } from 'antd';
|
|||
|
|
import WorkOrderShow from '../../list/modals/WorkOrderShow';
|
|||
|
|
|
|||
|
|
export default function Index({ title = '已回访工单' }) {
|
|||
|
|
const getCurrentPermissions = useCurrentPermissions();
|
|||
|
|
let tableRender = (item: any, action: any) => {
|
|||
|
|
return getCurrentPermissions(
|
|||
|
|
{
|
|||
|
|
show: (
|
|||
|
|
<WorkOrderShow item={item} title="详情" reload={action?.reload} />
|
|||
|
|
),
|
|||
|
|
},
|
|||
|
|
'IsVisited',
|
|||
|
|
);
|
|||
|
|
};
|
|||
|
|
return (
|
|||
|
|
<ProTable
|
|||
|
|
{...MyProTableProps.props}
|
|||
|
|
// headerTitle="已回访工单"
|
|||
|
|
request={async (params, sort) =>
|
|||
|
|
MyProTableProps.request(
|
|||
|
|
{
|
|||
|
|
...params,
|
|||
|
|
type: [
|
|||
|
|
HouseWorkOrdersTypeEnum.Repair.value,
|
|||
|
|
HouseWorkOrdersTypeEnum.Incident.value,
|
|||
|
|
HouseWorkOrdersTypeEnum.Complaint.value,
|
|||
|
|
],
|
|||
|
|
is_visited: true,
|
|||
|
|
status: HouseWorkOrdersStatusEnum.Completed.value,
|
|||
|
|
},
|
|||
|
|
sort,
|
|||
|
|
Apis.WorkOrder.HouseWorkOrders.List,
|
|||
|
|
)
|
|||
|
|
}
|
|||
|
|
// options={false}
|
|||
|
|
headerTitle={title}
|
|||
|
|
columns={[
|
|||
|
|
MyColumns.ID({
|
|||
|
|
search: false,
|
|||
|
|
}),
|
|||
|
|
Selects?.AssetProjects({
|
|||
|
|
title: '选择项目',
|
|||
|
|
key: 'asset_projects_id',
|
|||
|
|
hidden: true,
|
|||
|
|
}),
|
|||
|
|
MyColumns.EnumTag({
|
|||
|
|
title: '工单状态',
|
|||
|
|
dataIndex: 'status',
|
|||
|
|
valueEnum: HouseWorkOrdersStatusEnum,
|
|||
|
|
search: false,
|
|||
|
|
}),
|
|||
|
|
MyColumns.EnumTag({
|
|||
|
|
title: '工单类型',
|
|||
|
|
dataIndex: 'type',
|
|||
|
|
valueEnum: HouseWorkOrdersTypeEnum,
|
|||
|
|
search: false,
|
|||
|
|
}),
|
|||
|
|
{
|
|||
|
|
title: '项目名称',
|
|||
|
|
dataIndex: 'project_name',
|
|||
|
|
hidden: true,
|
|||
|
|
},
|
|||
|
|
MyColumns.EnumTag({
|
|||
|
|
title: '报修位置',
|
|||
|
|
dataIndex: 'location',
|
|||
|
|
valueEnum: HouseWorkOrdersLocationEnum,
|
|||
|
|
search: false,
|
|||
|
|
}),
|
|||
|
|
{
|
|||
|
|
title: '位置信息',
|
|||
|
|
dataIndex: ['asset_house', 'full_name'],
|
|||
|
|
render: (_, record) => {
|
|||
|
|
return (
|
|||
|
|
<Space>
|
|||
|
|
{record?.asset_house?.full_name
|
|||
|
|
? record?.asset_house?.full_name
|
|||
|
|
: record?.asset_project?.name}
|
|||
|
|
</Space>
|
|||
|
|
);
|
|||
|
|
},
|
|||
|
|
search: {
|
|||
|
|
transform: (value) => {
|
|||
|
|
return { house_name: value };
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '工单描述',
|
|||
|
|
dataIndex: 'content',
|
|||
|
|
search: false,
|
|||
|
|
width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽)
|
|||
|
|
render: (text) => (
|
|||
|
|
<div
|
|||
|
|
style={{
|
|||
|
|
width: '100%', // 继承列宽
|
|||
|
|
// height: '60px', // 设置固定高度,约显示3行文本
|
|||
|
|
overflow: 'hidden', // 超出隐藏
|
|||
|
|
textOverflow: 'ellipsis', // 省略号
|
|||
|
|
display: '-webkit-box',
|
|||
|
|
WebkitBoxOrient: 'vertical',
|
|||
|
|
WebkitLineClamp: 1, // 显示3行
|
|||
|
|
}}
|
|||
|
|
>
|
|||
|
|
{text}
|
|||
|
|
</div>
|
|||
|
|
),
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '回访记录',
|
|||
|
|
dataIndex: 'visited_remark',
|
|||
|
|
search: false,
|
|||
|
|
width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽)
|
|||
|
|
render: (text) => (
|
|||
|
|
<div
|
|||
|
|
style={{
|
|||
|
|
width: '100%', // 继承列宽
|
|||
|
|
// height: '60px', // 设置固定高度,约显示3行文本
|
|||
|
|
overflow: 'hidden', // 超出隐藏
|
|||
|
|
textOverflow: 'ellipsis', // 省略号
|
|||
|
|
display: '-webkit-box',
|
|||
|
|
WebkitBoxOrient: 'vertical',
|
|||
|
|
WebkitLineClamp: 1, // 显示3行
|
|||
|
|
}}
|
|||
|
|
>
|
|||
|
|
{text}
|
|||
|
|
</div>
|
|||
|
|
),
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '回访时间',
|
|||
|
|
dataIndex: 'visited_time',
|
|||
|
|
search: false,
|
|||
|
|
},
|
|||
|
|
// MyColumns.CreatedAt(),
|
|||
|
|
MyColumns.Option({
|
|||
|
|
render: (_, item: any, index, action) => (
|
|||
|
|
<Space key={index}>{tableRender(item, action)}</Space>
|
|||
|
|
),
|
|||
|
|
}),
|
|||
|
|
]}
|
|||
|
|
/>
|
|||
|
|
);
|
|||
|
|
}
|