import { Button, Divider, Dropdown, Menu, Modal, Popconfirm, Row } from 'antd'; import { DialogForm, Visible } from 'components/dataView'; import { DesError } from 'components/decorators'; import lodash from 'lodash'; import { observer } from 'mobx-react'; import * as React from 'react'; import { onAuthorizeActions } from 'store/system/authorize'; import Store from '../store'; import { InfoForm, InsertForm, UpdateForm } from './forms'; import { FormattedMessage } from 'react-intl'; import { getLocalesTemplate } from 'locale'; /** * 动作事件 */ export const ActionEvents = { /** * 导入 */ onImport() { Store.PageState.visiblePort = true; }, /** * 导出 */ onExport() { Store.onExport() }, /** * 批量导出 */ onExportIds() { Store.onExportIds() }, /** * 删除 * @param data */ onDelete(data) { Store.onDelete(data) }, /** * 删除 */ onDeleteList() { const length = Store.DataSource.selectedRowKeys.length Modal.confirm({ title: getLocalesTemplate('action.deleteConfirm', { text: length }), onOk: async () => { Store.onDelete(Store.DataSource.selectedRowKeys) }, onCancel() { }, }); }, } /** * 表格 所有 动作 */ @DesError @observer class PageAction extends React.Component { render() { const { selectedRowKeys } = Store.DataSource; const deletelength = selectedRowKeys.length; const disabled = deletelength < 1; return ( } icon="plus" > } icon="edit" disabled={deletelength != 1} > (lodash.find(selectedRowKeys))} /> }> ); } } /** * 表格 行 动作 */ @DesError @observer class RowAction extends React.Component<{ /** 数据详情 */ data: any; [key: string]: any; }, any> { render() { const { data } = this.props return ( } showSubmit={false} type="a" > } type="a" > } onConfirm={() => { ActionEvents.onDelete(data) }} > ); } } export default { /** * 页面动作 */ pageAction: PageAction, /** * 数据行动作 */ rowAction: RowAction }