diff --git a/client/containers/Group/GroupList/GroupList.js b/client/containers/Group/GroupList/GroupList.js index 7736e187..504b5817 100644 --- a/client/containers/Group/GroupList/GroupList.js +++ b/client/containers/Group/GroupList/GroupList.js @@ -1,14 +1,14 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' -import { Button, Icon, Popconfirm, Modal, Input, message, Menu, Row, Col } from 'antd' +import { Button, Icon, Modal,Alert, Input, message, Menu, Row, Col } from 'antd' import { autobind } from 'core-decorators'; import axios from 'axios'; import { withRouter } from 'react-router'; const { TextArea } = Input; const Search = Input.Search; const TYPE_EDIT = 'edit'; - +const confirm = Modal.confirm; import { fetchGroupList, setCurrGroup, @@ -155,6 +155,30 @@ export default class GroupList extends Component { this.props.history.replace(`${currGroup._id}`); } + showConfirm =()=> { + let that = this; + confirm({ + title: that.props.currGroup.group_name, + content:
+ +
请输入分组名称:
+
, + onOk() { + let groupName = document.getElementById('group_name').value; + if(that.props.currGroup.group_name !== groupName){ + message.error('分组名称有误') + return new Promise((resolve, reject)=>{ + reject('error') + }) + }else{ + that.deleteGroup() + } + + }, + onCancel() { } + }); + } + @autobind async deleteGroup() { const self = this; @@ -163,7 +187,7 @@ export default class GroupList extends Component { if (res.data.errcode) { message.error(res.data.errmsg); } else { - message.success('删除成功'); + message.success('删除成功') await self.props.fetchGroupList() const currGroup = self.props.groupList[0] || { group_name: '', group_desc: '' }; self.setState({groupList: self.props.groupList}); @@ -185,9 +209,8 @@ export default class GroupList extends Component { render () { const { currGroup } = this.props; const delmark = this.showModal(TYPE_EDIT)}/> - const editmark = ( - - ) + const editmark = {this.showConfirm()}} type="delete" title="删除分组"/> + return ( diff --git a/server/models/interface.js b/server/models/interface.js index 6505b526..9303fc30 100644 --- a/server/models/interface.js +++ b/server/models/interface.js @@ -113,7 +113,7 @@ class interfaceModel extends baseModel { } delByProjectId(id){ - return this.model.delete({ + return this.model.deleteMany({ project_id: id }) } diff --git a/server/models/interfaceCase.js b/server/models/interfaceCase.js index 5ef7620e..86f8c4cd 100644 --- a/server/models/interfaceCase.js +++ b/server/models/interfaceCase.js @@ -61,7 +61,7 @@ class interfaceCase extends baseModel { } delByProjectId(id){ - return this.model.delete({ + return this.model.deleteMany({ project_id: id }) } diff --git a/server/models/interfaceCol.js b/server/models/interfaceCol.js index cf76b444..7dac9413 100644 --- a/server/models/interfaceCol.js +++ b/server/models/interfaceCol.js @@ -47,7 +47,7 @@ class interfaceCol extends baseModel { } delByProjectId(id){ - return this.model.delete({ + return this.model.deleteMany({ project_id: id }) } diff --git a/server/models/project.js b/server/models/project.js index 7c73e10e..5ef0c23b 100644 --- a/server/models/project.js +++ b/server/models/project.js @@ -88,7 +88,7 @@ class projectModel extends baseModel { } delByGroupid(groupId){ - return this.model.delete({ + return this.model.deleteMany({ group_id: groupId }) } diff --git a/server_dist/models/interface.js b/server_dist/models/interface.js index eae8a1e8..ae7c4e6f 100644 --- a/server_dist/models/interface.js +++ b/server_dist/models/interface.js @@ -157,7 +157,7 @@ var interfaceModel = function (_baseModel) { }, { key: 'delByProjectId', value: function delByProjectId(id) { - return this.model.delete({ + return this.model.deleteMany({ project_id: id }); } diff --git a/server_dist/models/interfaceCase.js b/server_dist/models/interfaceCase.js index 3a63fec6..785cb488 100644 --- a/server_dist/models/interfaceCase.js +++ b/server_dist/models/interfaceCase.js @@ -105,7 +105,7 @@ var interfaceCase = function (_baseModel) { }, { key: 'delByProjectId', value: function delByProjectId(id) { - return this.model.delete({ + return this.model.deleteMany({ project_id: id }); } diff --git a/server_dist/models/interfaceCol.js b/server_dist/models/interfaceCol.js index 03a46f2a..1d9011e4 100644 --- a/server_dist/models/interfaceCol.js +++ b/server_dist/models/interfaceCol.js @@ -92,7 +92,7 @@ var interfaceCol = function (_baseModel) { }, { key: 'delByProjectId', value: function delByProjectId(id) { - return this.model.delete({ + return this.model.deleteMany({ project_id: id }); } diff --git a/server_dist/models/project.js b/server_dist/models/project.js index dffc8b21..aecfd3a8 100644 --- a/server_dist/models/project.js +++ b/server_dist/models/project.js @@ -134,7 +134,7 @@ var projectModel = function (_baseModel) { }, { key: 'delByGroupid', value: function delByGroupid(groupId) { - return this.model.delete({ + return this.model.deleteMany({ group_id: groupId }); }