feat: 删除确认框

This commit is contained in:
waliang.wang 2017-07-26 17:22:12 +08:00
parent cb25bbebe0
commit 8ed2e5f36e
5 changed files with 15 additions and 8 deletions

View File

@ -239,7 +239,7 @@ class AddInterface extends Component {
render () {
const TabPane = Tabs.TabPane
const { isLoading, isSave, mockJson='', mockURL } = this.state
console.log(mockURL)
return (
<section className="add-interface-box">
<div className="content">

View File

@ -86,8 +86,8 @@ export default class InterfaceTest extends Component {
a:1
},
success: (res, header) => {
this.setState({res})
console.log(header)
this.setState({res})
}
})
}

View File

@ -11,7 +11,6 @@ import {
// 重新渲染页面
const getReqList = function (self) {
const [reqList, seqGroup] = [[], self.props.seqGroup]
console.log('seqGroup', seqGroup)
seqGroup.map((value, key) => {
reqList.push(<ReqList key={key} value={value} dataNum={value.id} />)
})

View File

@ -40,7 +40,6 @@ class ReqMethod extends Component {
@autobind
handleChange (value) {
console.log('value', value)
this.props.pushInterfaceMethod(value)
}

View File

@ -1,7 +1,8 @@
import React, { Component } from 'react'
import { Table } from 'antd'
import { Table, Popconfirm, message } from 'antd'
import PropTypes from 'prop-types'
import axios from 'axios'
import { autobind } from 'core-decorators'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'
import { deleteInterfaceData } from '../../../actions/interfaceAction.js'
@ -29,6 +30,12 @@ class InterfaceTable extends Component {
super(props)
}
@autobind
confirm (interfaceId) {
this.deleteInterface(interfaceId)
message.success('删除成功!');
}
deleteInterfaceData (interfaceId) {
let interfaceArr = []
let { interfaceData } = this.props
@ -70,15 +77,17 @@ class InterfaceTable extends Component {
title: '功能',
'key': 'action',
render: (data) => {
const deleteInterface = this.deleteInterface.bind(this, data._id)
console.log(data)
// const deleteInterface = this.deleteInterface.bind(this, data._id)
const confirm = this.confirm.bind(this, data._id)
return (
<span>
<Link to={`/AddInterface/edit/${data._id}`}><span>编辑</span></Link>
<span className="ant-divider" />
<Link to={`/AddInterface/edit/${data._id}`}><span>测试</span></Link>
<span className="ant-divider" />
<a onClick={deleteInterface}>删除</a>
<Popconfirm title="是否删除接口!" onConfirm={confirm} okText="Yes" cancelText="No">
<a href="">删除</a>
</Popconfirm>
</span>
)
}