diff --git a/src/views/products/Detail/Header.jsx b/src/views/products/Detail/Header.jsx index 42d7f27..0964917 100644 --- a/src/views/products/Detail/Header.jsx +++ b/src/views/products/Detail/Header.jsx @@ -15,6 +15,10 @@ import VendorSelector from '@/components/VendorSelector'; import AuditStateSelector from '@/components/AuditStateSelector'; import NewProductModal from './NewProductModal'; +import AgencyContract from './../Print/AgencyContract'; +import { saveAs } from "file-saver"; +import { Packer } from "docx"; + const Header = ({ refresh, ...props }) => { const location = useLocation(); const isEditPage = location.pathname.includes('edit'); @@ -25,7 +29,8 @@ const Header = ({ refresh, ...props }) => { const isPermitted = useAuthStore((state) => state.isPermitted); const [activeAgency, setActiveAgency] = useProductsStore((state) => [state.activeAgency, state.setActiveAgency]); const [switchParams, setSwitchParams] = useProductsStore((state) => [state.switchParams, state.setSwitchParams]); - const [activeAgencyState] = useProductsStore((state) => [state.activeAgencyState]); + // const [activeAgencyState] = useProductsStore((state) => [state.activeAgencyState]); + // const [agencyProducts] = useProductsStore((state) => [state.agencyProducts]); const stateMapVal = useProductsAuditStatesMapVal(); const { message, notification } = App.useApp(); const navigate = useNavigate(); @@ -75,6 +80,9 @@ const Header = ({ refresh, ...props }) => { }; const handleAuditAgency = (state) => { + // const s = Object.keys(agencyProducts).map((typeKey) => { + + // }); postAgencyProductsAuditAction(state, { travel_agency_id: activeAgency.travel_agency_id, use_year: switchParams.use_year }) .then((json) => { if (json.errcode === 0) { @@ -120,6 +128,16 @@ const Header = ({ refresh, ...props }) => { }); }; + + const handleDownload = () => { + const documentCreator = new AgencyContract(); + const doc = documentCreator.create([]); + + Packer.toBlob(doc).then(blob => { + saveAs(blob, `${pickYear}地接合同-${Date.now().toString(32)}.docx`); + }); + }; + return (