提交 a506980d authored 作者: 王鹏飞's avatar 王鹏飞

fix(admin): keep audit detail navigation nested

上级 77cf6ebc
......@@ -12,7 +12,7 @@ const { RangePicker } = DatePicker;
export default function AuditListView() {
const list = useAuditList(); const navigate = useNavigate(); const { operationPermissionsList = [] } = useSelector((state: any) => state.user); const [previewId, setPreviewId] = useState<any>();
const filters: AppListFilterItem<AuditFilters>[] = [{ name: "name", label: "书籍名称", render: (field) => <Input allowClear autoComplete="off" value={field.value || ""} onChange={(event) => field.onChange(event.target.value)} placeholder="请输入书籍名称" /> }, { name: "authors", label: "作者", render: (field) => <Input allowClear autoComplete="off" value={field.value || ""} onChange={(event) => field.onChange(event.target.value)} placeholder="请输入作者" /> }, { name: "time", label: "创建时间", render: (field) => <RangePicker value={field.value} onChange={(value) => field.onChange(value)} /> }];
const columns: ColumnsType<any> = [{ title: "ID", dataIndex: "id", align: "center" }, { title: "书籍图片", dataIndex: "img", align: "center", render: (src) => <Image width={80} height={80} src={src} /> }, { title: "书籍名称", dataIndex: "name", align: "center" }, { title: "作者", dataIndex: "authors", align: "center" }, { title: "创建时间", dataIndex: "create_time", align: "center" }, { title: "更新时间", dataIndex: "update_time", align: "center" }, { title: "操作", render: (_, row) => <Space>{operationPermissionsList.includes("/books/audit/getInfoByChapterId") && <Button onClick={(event) => { event.stopPropagation(); setPreviewId(row.id); }}>预览</Button>}{operationPermissionsList.includes("/books/audit/add") && <Button onClick={(event) => { event.stopPropagation(); navigate("../detail", { state: { id: row.id }, replace: true }); }}>审核</Button>}</Space> }];
const columns: ColumnsType<any> = [{ title: "ID", dataIndex: "id", align: "center" }, { title: "书籍图片", dataIndex: "img", align: "center", render: (src) => <Image width={80} height={80} src={src} /> }, { title: "书籍名称", dataIndex: "name", align: "center" }, { title: "作者", dataIndex: "authors", align: "center" }, { title: "创建时间", dataIndex: "create_time", align: "center" }, { title: "更新时间", dataIndex: "update_time", align: "center" }, { title: "操作", render: (_, row) => <Space>{operationPermissionsList.includes("/books/audit/getInfoByChapterId") && <Button onClick={(event) => { event.stopPropagation(); setPreviewId(row.id); }}>预览</Button>}{operationPermissionsList.includes("/books/audit/add") && <Button onClick={(event) => { event.stopPropagation(); navigate("detail", { state: { id: row.id } }); }}>审核</Button>}</Space> }];
return <div><AppList rowKey="id" columns={columns} data={{ rows: list.rows, total: list.total, loading: list.loading, error: list.error }} filters={{ value: list.filters, items: filters, onChange: list.setFilters, onSearch: list.search, onReset: list.reset, onRefresh: list.refresh }} pagination={{ page: list.page, pageSize: list.pageSize, pageSizeOptions: [10, 20, 30, 40], onChange: list.changePage, onPageSizeChange: list.changePageSize }} onRetry={list.retry} tableProps={{ onRow: (row) => ({ onClick: () => setPreviewId(row.id) }) }} />
<Modal open={Boolean(previewId)} footer={null} destroyOnClose keyboard={false} closeIcon={<CloseOutlined style={{ fontSize: 20, color: "#fff" }} />} maskClosable={false} classNames={{ body: "phone-body", wrapper: "phone-wrapper" }} wrapClassName="wrap-phone-privew" width="494px" centered onCancel={() => setPreviewId(undefined)}><PreviewModal bookId={previewId} /></Modal>
</div>;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论