|
|
@@ -1,6 +1,7 @@
|
|
|
import React from 'react'
|
|
|
import { Input, Icon, Button, Popconfirm, Switch } from 'antd'
|
|
|
import { connect } from 'dva'
|
|
|
+import DeleteBox from '../common/deleteBox/deleteBox'
|
|
|
import './header.less'
|
|
|
|
|
|
class Header extends React.Component {
|
|
|
@@ -8,7 +9,8 @@ class Header extends React.Component {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
visibleConfirm: false,
|
|
|
- visibleSettingBox: false
|
|
|
+ visibleSettingBox: false,
|
|
|
+ visibleDeleteBox: false,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -25,6 +27,7 @@ class Header extends React.Component {
|
|
|
|
|
|
render() {
|
|
|
const { dashboardDesigner, dispatch } = this.props;
|
|
|
+ const { visibleDeleteBox } = this.state;
|
|
|
const { editMode } = dashboardDesigner;
|
|
|
|
|
|
return (
|
|
|
@@ -127,6 +130,23 @@ class Header extends React.Component {
|
|
|
dispatch({ type: 'dashboard/remoteAdd' });
|
|
|
}
|
|
|
}}><Icon type='save' />保存</Button>}
|
|
|
+ {this.isOwner() && <Button style={{ marginLeft: '8px' }} onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ visibleDeleteBox: true
|
|
|
+ });
|
|
|
+ }}><Icon type='delete' />删除</Button>}
|
|
|
+ {visibleDeleteBox && <DeleteBox
|
|
|
+ visibleBox={visibleDeleteBox}
|
|
|
+ text={<div><span>确定要删除报表【{dashboardDesigner.name}】吗?</span></div>}
|
|
|
+ hideBox={() => {
|
|
|
+ this.setState({
|
|
|
+ visibleDeleteBox: false
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ okHandler={() => {
|
|
|
+ dispatch({ type: 'dashboard/remoteDelete', code: dashboardDesigner.code })
|
|
|
+ dispatch({ type: 'main/redirect', path: '/workshop/dashboard' });
|
|
|
+ }} />}
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|