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 () { render () {
const TabPane = Tabs.TabPane const TabPane = Tabs.TabPane
const { isLoading, isSave, mockJson='', mockURL } = this.state const { isLoading, isSave, mockJson='', mockURL } = this.state
console.log(mockURL)
return ( return (
<section className="add-interface-box"> <section className="add-interface-box">
<div className="content"> <div className="content">

View File

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

View File

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

View File

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

View File

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