mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-15 05:10:47 +08:00
feat: 删除项目的二次确认
This commit is contained in:
parent
fa6c10a261
commit
a07551d159
@ -167,11 +167,13 @@ export default class GroupList extends Component {
|
|||||||
showConfirm =()=> {
|
showConfirm =()=> {
|
||||||
let that = this;
|
let that = this;
|
||||||
confirm({
|
confirm({
|
||||||
title: "确认删除"+that.props.currGroup.group_name+"分组吗?",
|
title: "确认删除 "+that.props.currGroup.group_name+" 分组吗?",
|
||||||
content: <div style={{marginTop:'10px', fontSize: '12px', lineHeight: '25px'}}>
|
content: <div style={{marginTop:'10px', fontSize: '12px', lineHeight: '25px'}}>
|
||||||
<Alert message="警告:此操作非常危险,会删除该分组下面所有项目和接口,并且无法恢复!" type="warning" />
|
<Alert message="警告:此操作非常危险,会删除该分组下面所有项目和接口,并且无法恢复!" type="warning" />
|
||||||
|
<div style={{marginTop: '15px'}}>
|
||||||
<div style={{marginTop: '15px'}}><b>请输入分组名称确认此操作:</b><input id="group_name" /></div>
|
<p><b>请输入分组名称确认此操作:</b></p>
|
||||||
|
<Input id="group_name" />
|
||||||
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
onOk() {
|
onOk() {
|
||||||
let groupName = document.getElementById('group_name').value;
|
let groupName = document.getElementById('group_name').value;
|
||||||
|
@ -140,12 +140,11 @@ class ProjectMember extends Component {
|
|||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
onUserSelect(childState) {
|
onUserSelect(childState) {
|
||||||
console.log(childState);
|
|
||||||
this.setState({
|
this.setState({
|
||||||
inputUid: childState.uid
|
inputUid: childState.uid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentWillMount() {
|
async componentWillMount() {
|
||||||
const groupMemberList = await this.props.fetchGroupMemberList(this.props.projectMsg.group_id);
|
const groupMemberList = await this.props.fetchGroupMemberList(this.props.projectMsg.group_id);
|
||||||
const rojectMsg = await this.props.getProjectMsg(this.props.projectId);
|
const rojectMsg = await this.props.getProjectMsg(this.props.projectId);
|
||||||
@ -159,8 +158,6 @@ class ProjectMember extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
console.log(this.props);
|
|
||||||
console.log(this.state);
|
|
||||||
const columns = [{
|
const columns = [{
|
||||||
title: ' 项目成员 ('+this.state.projectMemberList.length + ') 人',
|
title: ' 项目成员 ('+this.state.projectMemberList.length + ') 人',
|
||||||
dataIndex: 'username',
|
dataIndex: 'username',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { Form, Input, Icon, Tooltip, Select, Button, Row, Col, message, Card, Radio } from 'antd';
|
import { Form, Input, Icon, Tooltip, Select, Button, Row, Col, message, Card, Radio, Alert, Modal } from 'antd';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { updateProject, delProject, getProjectMsg } from '../../../../reducer/modules/project';
|
import { updateProject, delProject, getProjectMsg } from '../../../../reducer/modules/project';
|
||||||
import { fetchGroupMsg } from '../../../../reducer/modules/group';
|
import { fetchGroupMsg } from '../../../../reducer/modules/group';
|
||||||
@ -8,6 +8,7 @@ const { TextArea } = Input;
|
|||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
const Option = Select.Option;
|
const Option = Select.Option;
|
||||||
const RadioGroup = Radio.Group;
|
const RadioGroup = Radio.Group;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
import '../Setting.scss';
|
import '../Setting.scss';
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
@ -138,6 +139,38 @@ class ProjectMessage extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showConfirm = () => {
|
||||||
|
let that = this;
|
||||||
|
confirm({
|
||||||
|
title: "确认删除 "+that.props.projectMsg.name+" 分组吗?",
|
||||||
|
content: <div style={{marginTop:'10px', fontSize: '12px', lineHeight: '25px'}}>
|
||||||
|
<Alert message="警告:此操作非常危险,会删除该分组下面所有项目和接口,并且无法恢复!" type="warning" banner/>
|
||||||
|
<div style={{marginTop: '15px'}}>
|
||||||
|
<p style={{marginBottom: '8px'}}><b>请输入项目名称确认此操作:</b></p>
|
||||||
|
<Input id="project_name" size="large" />
|
||||||
|
</div>
|
||||||
|
</div>,
|
||||||
|
onOk() {
|
||||||
|
let groupName = document.getElementById('project_name').value;
|
||||||
|
if(that.props.projectMsg.name !== groupName){
|
||||||
|
message.error('分组名称有误')
|
||||||
|
return new Promise((resolve, reject)=>{
|
||||||
|
reject('error')
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
that.props.delProject(that.props.projectId).then((res) => {
|
||||||
|
if (res.payload.data.errcode == 0) {
|
||||||
|
message.success('删除成功!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
iconType: 'delete',
|
||||||
|
onCancel() { }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async componentWillMount() {
|
async componentWillMount() {
|
||||||
await this.props.getProjectMsg(this.props.projectId);
|
await this.props.getProjectMsg(this.props.projectId);
|
||||||
const groupMsg = await this.props.fetchGroupMsg(this.props.projectMsg.group_id);
|
const groupMsg = await this.props.fetchGroupMsg(this.props.projectMsg.group_id);
|
||||||
@ -369,7 +402,7 @@ class ProjectMessage extends Component {
|
|||||||
<h3>删除项目</h3>
|
<h3>删除项目</h3>
|
||||||
<p>项目一旦删除,将无法恢复数据,请慎重操作!</p>
|
<p>项目一旦删除,将无法恢复数据,请慎重操作!</p>
|
||||||
</div>
|
</div>
|
||||||
<Button type="danger" ghost className="card-danger-btn" onClick={this.handleDelete}>删除</Button>
|
<Button type="danger" ghost className="card-danger-btn" onClick={this.showConfirm}>删除</Button>
|
||||||
</Card>
|
</Card>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user