完成批量发送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列表 */
|
/* key列表 */
|
||||||
import ReactDOM from 'react-dom'
|
import React from 'react'
|
||||||
import React, { Component } from 'react'
|
|
||||||
import { Link } from 'react-router-dom'
|
|
||||||
import {
|
import {
|
||||||
Input,
|
Input,
|
||||||
openDialog,
|
|
||||||
closeDialog,
|
|
||||||
Notify,
|
Notify,
|
||||||
Menu,
|
Menu,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Button,
|
Button,
|
||||||
RadioGroup,
|
RadioGroup,
|
||||||
Radio,
|
Radio,
|
||||||
Tag,
|
|
||||||
Sweetalert,
|
Sweetalert,
|
||||||
CombinedDateRangePicker,
|
CombinedDateRangePicker,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
|
@ -27,21 +22,15 @@ import '../../../assets/comm.css'
|
||||||
import Ipt from '../../../components/input/main'
|
import Ipt from '../../../components/input/main'
|
||||||
import Grid from '../../../components/gird/main.js'
|
import Grid from '../../../components/gird/main.js'
|
||||||
import TabPage from '../../../components/tabPage/main.js'
|
import TabPage from '../../../components/tabPage/main.js'
|
||||||
import Filterbar from '../../../components/filterbar/main.js'
|
|
||||||
import menu from '../../../assets/enum.js'
|
import menu from '../../../assets/enum.js'
|
||||||
import {
|
import {
|
||||||
terminateApprovals,
|
terminateApprovals,
|
||||||
getKeyList,
|
getKeyList,
|
||||||
handelResponse,
|
handelResponse,
|
||||||
planSend,
|
|
||||||
startOrStopKeybatch,
|
startOrStopKeybatch,
|
||||||
resKeyEmail,
|
|
||||||
planResend,
|
|
||||||
putKeyEmail,
|
|
||||||
cancelKey,
|
cancelKey,
|
||||||
keysIsSend,
|
|
||||||
getReseller,
|
getReseller,
|
||||||
postKeyEmail
|
batchSend
|
||||||
} from '../../../assets/api.js'
|
} from '../../../assets/api.js'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
const Column = [
|
const Column = [
|
||||||
|
@ -237,7 +226,8 @@ export default class acclist extends React.Component {
|
||||||
email: '',
|
email: '',
|
||||||
email_radio: -1,
|
email_radio: -1,
|
||||||
phone_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(
|
let emailReg = new RegExp(
|
||||||
'^[A-Za-z0-9\u4e00-\u9fa5.]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$'
|
'^[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 = {
|
let data = {
|
||||||
phone:
|
phone:
|
||||||
this.state.phone_radio > -1
|
this.state.phone_radio > -1
|
||||||
|
@ -265,8 +255,11 @@ export default class acclist extends React.Component {
|
||||||
Notify.error('手机号格式不正确')
|
Notify.error('手机号格式不正确')
|
||||||
return
|
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(
|
handelResponse(
|
||||||
res,
|
res,
|
||||||
(req, msg) => {
|
(req, msg) => {
|
||||||
|
@ -565,29 +558,42 @@ export default class acclist extends React.Component {
|
||||||
this.setState({ email: e.target.value })
|
this.setState({ email: e.target.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
menuItemClick(key, row, isMany = false) {
|
/* 获取经销商信息 */
|
||||||
|
getResellerInfoFunction(reseller_id) {
|
||||||
|
getReseller(reseller_id).then((res) => {
|
||||||
|
handelResponse(
|
||||||
|
res,
|
||||||
|
(req, msg) => {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 批量发送按钮 */
|
||||||
|
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 是否是批量发送 */
|
/* isMany 是否是批量发送 */
|
||||||
let ids = row.id
|
|
||||||
if (isMany) {
|
|
||||||
ids = this.state.gridSelection.map((item) => item.id)
|
|
||||||
}
|
|
||||||
console.log(ids)
|
|
||||||
let self = this
|
let self = this
|
||||||
if (key == 1) {
|
if (key == 1) {
|
||||||
getReseller(row.reseller_id).then((res) => {
|
this.setState({ isBulkSend: false })
|
||||||
handelResponse(
|
this.getResellerInfoFunction(row.reseller_id)
|
||||||
res,
|
sessionStorage.setItem('key_batch_id', row.id)
|
||||||
(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)
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
Notify.error(err)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if (key == 5) {
|
if (key == 5) {
|
||||||
let plan_id = row.id
|
let plan_id = row.id
|
||||||
|
@ -762,9 +768,7 @@ export default class acclist extends React.Component {
|
||||||
disabled={this.state.disabled}>
|
disabled={this.state.disabled}>
|
||||||
新建key
|
新建key
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button type='primary' onClick={() => this.bulkSendFunction()}>
|
||||||
type='primary'
|
|
||||||
onClick={(e) => this.menuItemClick(1, [], true)}>
|
|
||||||
批量发送
|
批量发送
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -995,6 +999,7 @@ export default class acclist extends React.Component {
|
||||||
return (
|
return (
|
||||||
<Radio
|
<Radio
|
||||||
value={index}
|
value={index}
|
||||||
|
key={index}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (
|
if (
|
||||||
item ==
|
item ==
|
||||||
|
@ -1023,6 +1028,7 @@ export default class acclist extends React.Component {
|
||||||
return (
|
return (
|
||||||
<Radio
|
<Radio
|
||||||
value={index}
|
value={index}
|
||||||
|
key={index}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (
|
if (
|
||||||
item ==
|
item ==
|
||||||
|
|
Loading…
Reference in New Issue