import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { FooterToolbar, PageContainer } from "@ant-design/pro-components"; import { Button, Divider, message, Modal, Typography } from "antd"; import { CardDetail, PreviewFile } from "@component/ui"; import { useRequest } from "ahooks"; import { dateFormatter, themeMessage, useRoutes, formatImageUrl } from "@component/utils"; import { getDocumentInfo, onAudit, onUpDownShelve } from "./action"; export default function MessageTask() { const { Title, Paragraph } = Typography; const { paramsParse, historyBack } = useRoutes(); const { data, loading } = useRequest(getDocumentInfo, { defaultParams: { documentsId: paramsParse.documentsId } }); const { runAsync } = useRequest(onAudit, { manual: true, onSuccess(result) { themeMessage(result); }, onError(result) { message.error(result.message); } }); const { runAsync: upDownRun } = useRequest(onUpDownShelve, { manual: true, onSuccess(result) { themeMessage(result); }, onError(result) { message.error(result.message); } }); function onAudits(status) { Modal.confirm({ content: status == 3 ? "请确认是否审核通过?" : "请确认是否审核驳回?", onOk() { return runAsync({ auditStatus: status, documentsId: data === null || data === void 0 ? void 0 : data.documentsId }).then((res) => { if (res.type === "success") { historyBack(); } }); } }); } function onUpDown(status) { Modal.confirm({ content: status == 10 ? "请确认是否上架?" : "请确认是否下架?", onOk() { return upDownRun({ auditStatus: status, documentsId: data === null || data === void 0 ? void 0 : data.documentsId }).then((res) => { if (res.type === "success") { historyBack(); } }); } }); } return (_jsxs(PageContainer, Object.assign({ header: { title: null }, loading: loading }, { children: [_jsxs("div", Object.assign({ className: "page-content-detail", style: { padding: "20px" } }, { children: [_jsx(Title, Object.assign({ align: "center", level: 2 }, { children: data === null || data === void 0 ? void 0 : data.documentsName })), _jsxs(Paragraph, Object.assign({ align: "left", style: { color: "#899094" } }, { children: ["\u5185\u5BB9\u5206\u7C7B\uFF1A", [data === null || data === void 0 ? void 0 : data.contentClassifyName, data === null || data === void 0 ? void 0 : data.contentClassifyValName].join("/")] })), _jsxs(Paragraph, Object.assign({ align: "left", style: { color: "#899094" } }, { children: ["\u884C\u4E1A\u5206\u7C7B\uFF1A", [data === null || data === void 0 ? void 0 : data.industryClassifyName, data === null || data === void 0 ? void 0 : data.industryClassifyValName].join("/")] })), _jsxs(Paragraph, Object.assign({ align: "left", style: { color: "#899094" } }, { children: ["\u670D\u52A1\u7C7B\u522B\uFF1A", data === null || data === void 0 ? void 0 : data.aqServiceName] })), _jsx(Paragraph, Object.assign({ style: { whiteSpace: "pre-line", lineHeight: "200%" } }, { children: data === null || data === void 0 ? void 0 : data.content })), (data === null || data === void 0 ? void 0 : data.auditAt) && (_jsxs(Paragraph, Object.assign({ align: "right", style: { color: "#899094" } }, { children: [_jsxs("span", Object.assign({ style: { marginRight: 30 } }, { children: ["\u5BA1\u6838\u65F6\u95F4\uFF1A", dateFormatter(data === null || data === void 0 ? void 0 : data.auditAt)] })), _jsxs("span", { children: ["\u5BA1\u6838\u4EBA\uFF1A", data === null || data === void 0 ? void 0 : data.auditUserName] })] }))), (data === null || data === void 0 ? void 0 : data.upDownShelveStatus) && (_jsxs(_Fragment, { children: [(data === null || data === void 0 ? void 0 : data.upDownShelveStatus) == 1 && (_jsxs(Paragraph, Object.assign({ align: "right", style: { color: "#899094" } }, { children: [_jsxs("span", Object.assign({ style: { marginRight: 30 } }, { children: ["\u4E0A\u67B6\u65F6\u95F4\uFF1A", dateFormatter(data === null || data === void 0 ? void 0 : data.upShelveAt)] })), _jsxs("span", { children: ["\u4E0A\u67B6\u4EBA\uFF1A", data === null || data === void 0 ? void 0 : data.upDownShelveUserName] })] }))), (data === null || data === void 0 ? void 0 : data.upDownShelveStatus) == 2 && (_jsxs(Paragraph, Object.assign({ align: "right", style: { color: "#899094" } }, { children: [_jsxs("span", Object.assign({ style: { marginRight: 30 } }, { children: ["\u4E0B\u67B6\u65F6\u95F4\uFF1A", dateFormatter(data === null || data === void 0 ? void 0 : data.upShelveAt)] })), _jsxs("span", { children: ["\u4E0B\u67B6\u4EBA\uFF1A", data === null || data === void 0 ? void 0 : data.downShelveAt] })] })))] })), _jsx(Divider, { className: "self-pro-divider", style: { marginTop: "10px" } }), _jsx(CardDetail, Object.assign({ title: "\u76F8\u5173\u9644\u4EF6" }, { children: _jsx(PreviewFile, { disabled: true, listType: "picture-card", fileList: formatImageUrl(data === null || data === void 0 ? void 0 : data.attachments) }) }))] })), (paramsParse === null || paramsParse === void 0 ? void 0 : paramsParse.review) && (_jsxs(FooterToolbar, { children: [(data === null || data === void 0 ? void 0 : data.auditStatus) == 1 && (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ type: "primary", onClick: () => onAudits(3) }, { children: "\u5BA1\u6838\u901A\u8FC7" })), _jsx(Button, Object.assign({ type: "primary", onClick: () => onAudits(4) }, { children: "\u5BA1\u6838\u4E0D\u901A\u8FC7" }))] })), ((data === null || data === void 0 ? void 0 : data.auditStatus) == 3 || (data === null || data === void 0 ? void 0 : data.auditStatus) == 10) && (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ type: "default", disabled: (data === null || data === void 0 ? void 0 : data.auditStatus) == 10, onClick: () => onUpDown(10) }, { children: "\u4E0A\u67B6" })), _jsx(Button, Object.assign({ type: "default", disabled: (data === null || data === void 0 ? void 0 : data.auditStatus) != 10, onClick: () => onUpDown(20) }, { children: "\u4E0B\u67B6" }))] })), _jsx(Button, Object.assign({ type: "default" }, { children: "\u9000\u51FA" }))] }))] }))); }