完成批量发送key 接口对接
This commit is contained in:
parent
a04373396b
commit
18000eba59
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +1,13 @@
|
|||
/* key列表 */
|
||||
import ReactDOM from 'react-dom'
|
||||
import React, { Component } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import React from 'react'
|
||||
import {
|
||||
Input,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
Notify,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Button,
|
||||
RadioGroup,
|
||||
Radio,
|
||||
Tag,
|
||||
Sweetalert,
|
||||
CombinedDateRangePicker,
|
||||
Dropdown,
|
||||
|
@ -27,21 +22,15 @@ import '../../../assets/comm.css'
|
|||
import Ipt from '../../../components/input/main'
|
||||
import Grid from '../../../components/gird/main.js'
|
||||
import TabPage from '../../../components/tabPage/main.js'
|
||||
import Filterbar from '../../../components/filterbar/main.js'
|
||||
import menu from '../../../assets/enum.js'
|
||||
import {
|
||||
terminateApprovals,
|
||||
getKeyList,
|
||||
handelResponse,
|
||||
planSend,
|
||||
startOrStopKeybatch,
|
||||
resKeyEmail,
|
||||
planResend,
|
||||
putKeyEmail,
|
||||
cancelKey,
|
||||
keysIsSend,
|
||||
getReseller,
|
||||
postKeyEmail
|
||||
batchSend
|
||||
} from '../../../assets/api.js'
|
||||
import _ from 'lodash'
|
||||
const Column = [
|
||||
|
@ -237,7 +226,8 @@ export default class acclist extends React.Component {
|
|||
email: '',
|
||||
email_radio: -1,
|
||||
phone_radio: -1,
|
||||
menuVisible: false
|
||||
menuVisible: false,
|
||||
isBulkSend: false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,7 +239,7 @@ export default class acclist extends React.Component {
|
|||
let emailReg = new RegExp(
|
||||
'^[A-Za-z0-9\u4e00-\u9fa5.]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$'
|
||||
)
|
||||
let key_id = sessionStorage.getItem('key_batch_id')
|
||||
let ids = [JSON.parse(sessionStorage.getItem('key_batch_id'))]
|
||||
let data = {
|
||||
phone:
|
||||
this.state.phone_radio > -1
|
||||
|
@ -265,8 +255,11 @@ export default class acclist extends React.Component {
|
|||
Notify.error('手机号格式不正确')
|
||||
return
|
||||
}
|
||||
|
||||
postKeyEmail(key_id, data).then((res) => {
|
||||
/* 批量发送 */
|
||||
if (this.state.isBulkSend) {
|
||||
ids = this.state.gridSelection.map((item) => item.id)
|
||||
}
|
||||
batchSend({ ids, ...data }).then((res) => {
|
||||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
|
@ -565,23 +558,19 @@ export default class acclist extends React.Component {
|
|||
this.setState({ email: e.target.value })
|
||||
}
|
||||
|
||||
menuItemClick(key, row, isMany = false) {
|
||||
/* isMany 是否是批量发送 */
|
||||
let ids = row.id
|
||||
if (isMany) {
|
||||
ids = this.state.gridSelection.map((item) => item.id)
|
||||
}
|
||||
console.log(ids)
|
||||
let self = this
|
||||
if (key == 1) {
|
||||
getReseller(row.reseller_id).then((res) => {
|
||||
/* 获取经销商信息 */
|
||||
getResellerInfoFunction(reseller_id) {
|
||||
getReseller(reseller_id).then((res) => {
|
||||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
this.setState({ phone_list: req.contact_phone })
|
||||
this.setState({ email_list: req.contact_email })
|
||||
this.setState({ audit_visible: true })
|
||||
sessionStorage.setItem('key_batch_id', row.id)
|
||||
this.setState({
|
||||
phone_list: req.contact_phone,
|
||||
email_list: req.contact_email,
|
||||
audit_visible: true,
|
||||
phone_radio: -1,
|
||||
email_radio: -1
|
||||
})
|
||||
},
|
||||
(err) => {
|
||||
Notify.error(err)
|
||||
|
@ -589,6 +578,23 @@ export default class acclist extends React.Component {
|
|||
)
|
||||
})
|
||||
}
|
||||
|
||||
/* 批量发送按钮 */
|
||||
bulkSendFunction() {
|
||||
if (!this.state.gridSelection[0]?.reseller_id)
|
||||
return Notify.warn('请勾选需要批量发送的key批次')
|
||||
this.getResellerInfoFunction(this.state.gridSelection[0].reseller_id)
|
||||
this.setState({ isBulkSend: true })
|
||||
}
|
||||
|
||||
menuItemClick(key, row) {
|
||||
/* isMany 是否是批量发送 */
|
||||
let self = this
|
||||
if (key == 1) {
|
||||
this.setState({ isBulkSend: false })
|
||||
this.getResellerInfoFunction(row.reseller_id)
|
||||
sessionStorage.setItem('key_batch_id', row.id)
|
||||
}
|
||||
if (key == 5) {
|
||||
let plan_id = row.id
|
||||
|
||||
|
@ -762,9 +768,7 @@ export default class acclist extends React.Component {
|
|||
disabled={this.state.disabled}>
|
||||
新建key
|
||||
</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
onClick={(e) => this.menuItemClick(1, [], true)}>
|
||||
<Button type='primary' onClick={() => this.bulkSendFunction()}>
|
||||
批量发送
|
||||
</Button>
|
||||
</div>
|
||||
|
@ -995,6 +999,7 @@ export default class acclist extends React.Component {
|
|||
return (
|
||||
<Radio
|
||||
value={index}
|
||||
key={index}
|
||||
onClick={() => {
|
||||
if (
|
||||
item ==
|
||||
|
@ -1023,6 +1028,7 @@ export default class acclist extends React.Component {
|
|||
return (
|
||||
<Radio
|
||||
value={index}
|
||||
key={index}
|
||||
onClick={() => {
|
||||
if (
|
||||
item ==
|
||||
|
|
Loading…
Reference in New Issue