| | |
| | | } |
| | | }; |
| | | |
| | | const handleComplete = async (rows, intl) => { |
| | | if (!rows) return true; |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.completeing', defaultMessage: '正在完成' })); |
| | | try { |
| | | const resp = await Http.doPost('api/task/complete/' + rows.map((row) => row.id).join(',')); |
| | | if (resp.code === 200) { |
| | | message.success(intl.formatMessage({ id: 'page.complete.success', defaultMessage: '完成成功' })); |
| | | return true; |
| | | } else { |
| | | message.error(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.error(intl.formatMessage({ id: 'page.complete.fail', defaultMessage: '完成失败,请重试!' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | | } |
| | | }; |
| | | |
| | | const handleCancel = async (rows, intl) => { |
| | | if (!rows) return true; |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.canceling', defaultMessage: '正在取消' })); |
| | | try { |
| | | const resp = await Http.doPost('api/task/cancel/' + rows.map((row) => row.id).join(',')); |
| | | if (resp.code === 200) { |
| | | message.success(intl.formatMessage({ id: 'page.cancel.success', defaultMessage: '取消成功' })); |
| | | return true; |
| | | } else { |
| | | message.error(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.error(intl.formatMessage({ id: 'page.cancel.fail', defaultMessage: '取消失败,请重试!' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | | } |
| | | }; |
| | | |
| | | const handleExport = async (intl) => { |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '正在导出' })); |
| | | try { |
| | |
| | | { |
| | | title: '操作', |
| | | dataIndex: 'option', |
| | | width: 140, |
| | | width: 240, |
| | | valueType: 'option', |
| | | render: (_, record) => [ |
| | | <Button |
| | |
| | | > |
| | | <FormattedMessage id='page.edit' defaultMessage='编辑' /> |
| | | </Button>, |
| | | // <Button |
| | | // type="link" |
| | | // danger |
| | | // key="batchRemove" |
| | | // onClick={async () => { |
| | | // Modal.confirm({ |
| | | // title: intl.formatMessage({ id: 'page.delete', defaultMessage: '删除' }), |
| | | // content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '确定删除该项吗?' }), |
| | | // onOk: async () => { |
| | | // const success = await handleRemove([record], intl); |
| | | // if (success) { |
| | | // if (actionRef.current) { |
| | | // actionRef.current.reload(); |
| | | // } |
| | | // } |
| | | // }, |
| | | // }); |
| | | // }} |
| | | // > |
| | | // <FormattedMessage id='page.delete' defaultMessage='删除' /> |
| | | // </Button>, |
| | | <Button |
| | | type="link" |
| | | danger |
| | | key="batchRemove" |
| | | key="complete" |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: intl.formatMessage({ id: 'page.delete', defaultMessage: '删除' }), |
| | | content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '确定删除该项吗?' }), |
| | | title: intl.formatMessage({ id: 'page.complete', defaultMessage: '完成' }), |
| | | content: intl.formatMessage({ id: 'page.complete.confirm', defaultMessage: '确定完成该项吗?' }), |
| | | onOk: async () => { |
| | | const success = await handleRemove([record], intl); |
| | | const success = await handleComplete([record], intl); |
| | | if (success) { |
| | | if (actionRef.current) { |
| | | actionRef.current.reload(); |
| | |
| | | }); |
| | | }} |
| | | > |
| | | <FormattedMessage id='page.delete' defaultMessage='删除' /> |
| | | <FormattedMessage id='page.complete' defaultMessage='完成' /> |
| | | </Button>, |
| | | <Button |
| | | type="link" |
| | | key="cancel" |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: intl.formatMessage({ id: 'page.cancel', defaultMessage: '取消' }), |
| | | content: intl.formatMessage({ id: 'page.cancel.confirm', defaultMessage: '确定取消该项吗?' }), |
| | | onOk: async () => { |
| | | const success = await handleCancel([record], intl); |
| | | if (success) { |
| | | if (actionRef.current) { |
| | | actionRef.current.reload(); |
| | | } |
| | | } |
| | | }, |
| | | }); |
| | | }} |
| | | > |
| | | <FormattedMessage id='page.cancel' defaultMessage='取消' /> |
| | | </Button>, |
| | | ], |
| | | }, |
| | | ]; |