|  |  | 
 |  |  |     }, | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | const handleSave = async (val, intl) => { | 
 |  |  |     const hide = message.loading('正在添加'); | 
 |  |  |     try { | 
 |  |  |         const resp = await Http.doPost('api/operationRecord/save', val); | 
 |  |  |         if (resp.code === 200) { | 
 |  |  |             message.success('添加成功'); | 
 |  |  |             return true; | 
 |  |  |         } else { | 
 |  |  |             message.error(resp.msg); | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |     } catch (error) { | 
 |  |  |         message.error('添加失败请重试!'); | 
 |  |  |         return false; | 
 |  |  |     } finally { | 
 |  |  |         hide(); | 
 |  |  |     } | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | const handleUpdate = async (val, intl) => { | 
 |  |  |     const hide = message.loading('正在更新'); | 
 |  |  |     try { | 
 |  |  |         const resp = await Http.doPost('api/operationRecord/update', val); | 
 |  |  |         if (resp.code === 200) { | 
 |  |  |             message.success('更新成功'); | 
 |  |  |             return true; | 
 |  |  |         } else { | 
 |  |  |             message.error(resp.msg); | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |     } catch (error) { | 
 |  |  |         message.error('配置失败请重试!'); | 
 |  |  |         return false; | 
 |  |  |     } finally { | 
 |  |  |         hide(); | 
 |  |  |     } | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | const handleRemove = async (rows, intl) => { | 
 |  |  |     if (!rows) return true; | 
 |  |  |     const hide = message.loading('正在删除'); | 
 |  |  |     try { | 
 |  |  |         const resp = await Http.doPost('api/operationRecord/remove/' + rows.map((row) => row.id).join(',')); | 
 |  |  |         if (resp.code === 200) { | 
 |  |  |             message.success('删除成功'); | 
 |  |  |             return true; | 
 |  |  |         } else { | 
 |  |  |             message.error(resp.msg); | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |     } catch (error) { | 
 |  |  |         message.error('删除失败,请重试'); | 
 |  |  |         return false; | 
 |  |  |     } finally { | 
 |  |  |         hide(); | 
 |  |  |     } | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | const handleExport = async (intl) => { | 
 |  |  |     const hide = message.loading('正在导出'); | 
 |  |  |     const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '正在导出' })); | 
 |  |  |     try { | 
 |  |  |         const resp = await Http.doPostBlob('api/operationRecord/export'); | 
 |  |  |         const blob = new Blob([resp], { type: 'application/vnd.ms-excel' }); | 
 |  |  |         window.location.href = window.URL.createObjectURL(blob); | 
 |  |  |         message.success('导出成功'); | 
 |  |  |         message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '导出成功' })); | 
 |  |  |         return true; | 
 |  |  |     } catch (error) { | 
 |  |  |         message.error('导出失败,请重试'); | 
 |  |  |         message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '导出失败,请重试' })); | 
 |  |  |         return false; | 
 |  |  |     } finally { | 
 |  |  |         hide(); | 
 |  |  | 
 |  |  |  | 
 |  |  |     const columns = [ | 
 |  |  |         { | 
 |  |  |             title: 'No', | 
 |  |  |             title: intl.formatMessage({ | 
 |  |  |                 id: 'page.table.no', | 
 |  |  |                 defaultMessage: 'No' | 
 |  |  |             }), | 
 |  |  |             dataIndex: 'index', | 
 |  |  |             valueType: 'indexBorder', | 
 |  |  |             width: 48, | 
 |  |  | 
 |  |  |             valueType: 'option', | 
 |  |  |             hidden: true, | 
 |  |  |             render: (_, record) => [ | 
 |  |  |                 <Button | 
 |  |  |                     type="link" | 
 |  |  |                     key="edit" | 
 |  |  |                     hidden="true" | 
 |  |  |                     onClick={() => { | 
 |  |  |                         setModalVisible(true); | 
 |  |  |                         setCurrentRow(record); | 
 |  |  |                     }} | 
 |  |  |                 > | 
 |  |  |                     编辑 | 
 |  |  |                 </Button>, | 
 |  |  |                 <Button | 
 |  |  |                     type="link" | 
 |  |  |                     danger | 
 |  |  |                     key="batchRemove" | 
 |  |  |                     hidden="true" | 
 |  |  |                     onClick={async () => { | 
 |  |  |                         Modal.confirm({ | 
 |  |  |                             title: '删除', | 
 |  |  |                             content: '确定删除该项吗?', | 
 |  |  |                             onOk: async () => { | 
 |  |  |                                 const success = await handleRemove([record], intl); | 
 |  |  |                                 if (success) { | 
 |  |  |                                     if (actionRef.current) { | 
 |  |  |                                         actionRef.current.reload(); | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                             }, | 
 |  |  |                         }); | 
 |  |  |                     }} | 
 |  |  |                 > | 
 |  |  |                     删除 | 
 |  |  |                 </Button>, | 
 |  |  |             ], | 
 |  |  |         }, | 
 |  |  |     ]; | 
 |  |  | 
 |  |  |                         ), | 
 |  |  |                         actions: [ | 
 |  |  |                             <Button | 
 |  |  |                                 type="primary" | 
 |  |  |                                 key="save" | 
 |  |  |                                 hidden="true" | 
 |  |  |                                 onClick={async () => { | 
 |  |  |                                     setModalVisible(true) | 
 |  |  |                                 }} | 
 |  |  |                             > | 
 |  |  |                                 <PlusOutlined /> | 
 |  |  |                                 添加 | 
 |  |  |                             </Button>, | 
 |  |  |                             <Button | 
 |  |  |                                 key="export" | 
 |  |  |                                 onClick={async () => { | 
 |  |  |                                     handleExport(intl); | 
 |  |  |                                 }} | 
 |  |  |                             > | 
 |  |  |                                 <ExportOutlined /> | 
 |  |  |                                 导出 | 
 |  |  |                                 <FormattedMessage id='page.export' defaultMessage='导出' /> | 
 |  |  |                             </Button>, | 
 |  |  |                         ], | 
 |  |  |                     }} | 
 |  |  | 
 |  |  |                 /> | 
 |  |  |             </div> | 
 |  |  |  | 
 |  |  |             {selectedRows?.length > 0 && false && ( | 
 |  |  |                 <FooterToolbar | 
 |  |  |                     extra={ | 
 |  |  |                         <div> | 
 |  |  |                             已选择 | 
 |  |  |                             <a style={{ fontWeight: 600 }}>{selectedRows.length}</a> | 
 |  |  |                             项 | 
 |  |  |                         </div> | 
 |  |  |                     } | 
 |  |  |                 > | 
 |  |  |                     <Button | 
 |  |  |                         key="remove" | 
 |  |  |                         danger | 
 |  |  |                         onClick={async () => { | 
 |  |  |                             Modal.confirm({ | 
 |  |  |                                 title: '删除', | 
 |  |  |                                 content: '确定删除该项吗?', | 
 |  |  |                                 onOk: async () => { | 
 |  |  |                                     const success = await handleRemove(selectedRows, intl); | 
 |  |  |                                     if (success) { | 
 |  |  |                                         setSelectedRows([]); | 
 |  |  |                                         actionRef.current?.reloadAndRest?.(); | 
 |  |  |                                     } | 
 |  |  |                                 }, | 
 |  |  |                             }); | 
 |  |  |                         }} | 
 |  |  |                     > | 
 |  |  |                         批量删除 | 
 |  |  |                     </Button> | 
 |  |  |                 </FooterToolbar> | 
 |  |  |             )} | 
 |  |  |  | 
 |  |  |             <Edit | 
 |  |  |                 open={modalVisible} | 
 |  |  |                 values={currentRow || {}} | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 onSubmit={async (values) => { | 
 |  |  |                     let ok = false; | 
 |  |  |                     if (values.id) { | 
 |  |  |                         ok = await handleUpdate({ ...values }, intl) | 
 |  |  |                     } else { | 
 |  |  |                         ok = await handleSave({ ...values }, intl) | 
 |  |  |                     } | 
 |  |  |                     if (ok) { | 
 |  |  |                         setModalVisible(false); | 
 |  |  |                         setCurrentRow(undefined); | 
 |  |  |                         if (actionRef.current) { | 
 |  |  |                             actionRef.current.reload(); | 
 |  |  |                         } | 
 |  |  |                     setModalVisible(false); | 
 |  |  |                     setCurrentRow(undefined); | 
 |  |  |                     if (actionRef.current) { | 
 |  |  |                         actionRef.current.reload(); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 } |