This commit is contained in:
zhangds 2022-08-10 17:27:25 +08:00
commit facec5e5b4
12 changed files with 740 additions and 695 deletions

View File

@ -888,8 +888,4 @@ export const batchSend = (data) => {
return req("post", baseurl + `/keys/batchSend`, data); return req("post", baseurl + `/keys/batchSend`, data);
}; };
export const exportKey = (data) => {
return req("get", baseurl + "/key/export", data);
};
export { req }; export { req };

View File

@ -1,114 +1,105 @@
import React from 'react' import React from 'react'
import ReactDom from 'react-dom'; import ReactDom from 'react-dom'
import "./main.css" import './main.css'
import { import { Icon, Menu, Checkbox, Switch, Sweetalert, Notify } from 'zent'
Icon, import _ from 'lodash'
Menu, import Pagination from '../pagination/main.js'
Checkbox, import GridEdit from '../gridEdit/main.js'
Switch, import Input from '../input/main.js'
Sweetalert, import GridCheckBar from '../gridCheckBar/main.js'
Notify
} from 'zent';
import _ from "lodash";
import Pagination from "../pagination/main.js"
import GridEdit from "../gridEdit/main.js"
import Input from "../input/main.js"
import GridCheckBar from "../gridCheckBar/main.js"
//tabbar组件机构{title:"",index:""} //tabbar组件机构{title:"",index:""}
//props {} //props {}
// type : normal slot // type : normal slot
//tableColumn 表格列属性结构 type width,label,background,textAlign //tableColumn 表格列属性结构 type width,label,background,textAlign
export default class menu extends React.Component { export default class menu extends React.Component {
static defaultProps = { static defaultProps = {
isShowPageBar: true, //是否显示页码 isShowPageBar: true, //是否显示页码
isMultiple: true, isMultiple: true,
isSwitch: true, isSwitch: true,
page: '', page: '',
headBackgroud: "", headBackgroud: '',
spliteColor: "#f9fafc", spliteColor: '#f9fafc',
countbarVisible: true, countbarVisible: true,
maxheight: 400, maxheight: 400,
isBorder: false, isBorder: false,
Column: [{ Column: [
title: "推广计划名称", {
prop: "name", title: '推广计划名称',
width: "300px", prop: 'name',
textAlign: "flex-start", width: '300px',
type: "normal", textAlign: 'flex-start',
type: 'normal',
sort: false, sort: false,
total: false, total: false,
valueType: "text" valueType: 'text'
}, },
{ {
title: "操作", title: '操作',
prop: "edit", prop: 'edit',
width: "220px", width: '220px',
textAlign: "flex-start", textAlign: 'flex-start',
type: "slot", type: 'slot',
sort: false, sort: false,
total: false, total: false,
valueType: "text" valueType: 'text'
}, },
{ {
title: "曝光量", title: '曝光量',
prop: "num1", prop: 'num1',
width: "auto", width: 'auto',
textAlign: "left", textAlign: 'left',
type: "normal", type: 'normal',
sort: true, sort: true,
total: true, total: true,
valueType: "number" valueType: 'number'
}, },
{ {
title: "点击量", title: '点击量',
prop: "num2", prop: 'num2',
width: "auto", width: 'auto',
textAlign: "left", textAlign: 'left',
type: "normal", type: 'normal',
sort: true, sort: true,
total: true, total: true,
valueType: "number" valueType: 'number'
}, },
{ {
title: "点击率", title: '点击率',
prop: "num3", prop: 'num3',
width: "auto", width: 'auto',
textAlign: "left", textAlign: 'left',
type: "normal", type: 'normal',
sort: true, sort: true,
total: true, total: true,
valueType: "percentage" valueType: 'percentage'
}, },
{ {
title: "点击均价", title: '点击均价',
prop: "price", prop: 'price',
width: "auto", width: 'auto',
textAlign: "left", textAlign: 'left',
type: "normal", type: 'normal',
sort: true, sort: true,
total: true, total: true,
valueType: "price" valueType: 'price'
}, },
{ {
title: "花费", title: '花费',
prop: "totalprice", prop: 'totalprice',
width: "auto", width: 'auto',
textAlign: "left", textAlign: 'left',
type: "normal", type: 'normal',
sort: true, sort: true,
total: true, total: true,
valueType: "price" valueType: 'price'
}, }
], ],
tableData: [{ tableData: [
{
id: 0, id: 0,
name: "推广计划-2021-10-19 17:43", name: '推广计划-2021-10-19 17:43',
num1: 0, num1: 0,
num2: 0, num2: 0,
num3: 0, num3: 0,
@ -116,16 +107,14 @@ export default class menu extends React.Component {
totalprice: 0 totalprice: 0
} }
], ],
emptyText: "抱歉,暂无相关数据记录", emptyText: '抱歉,暂无相关数据记录',
dataCount: 0, dataCount: 0,
curIndex:0, curIndex: 0
} }
constructor(props) { constructor(props) {
super(props); super(props)
let tableData = []; let tableData = []
// 如果是多选 // 如果是多选
// if (props.isMultiple) { // if (props.isMultiple) {
// tableData = _.map(props.tableData, (item) => { // tableData = _.map(props.tableData, (item) => {
@ -139,8 +128,6 @@ export default class menu extends React.Component {
// }) // })
// } // }
this.state = { this.state = {
switchLoading: false, switchLoading: false,
allChecked: false, allChecked: false,
@ -155,36 +142,32 @@ export default class menu extends React.Component {
postion: null, postion: null,
historyrow_id: null, historyrow_id: null,
curRow: null, curRow: null,
emptyText: "抱歉,暂无相关数据记录", emptyText: props.emptyText || '抱歉,暂无相关数据记录',
edit_title:"", edit_title: '',
edit_column:"" edit_column: ''
} }
} }
scrollFunc = function (e) {}
scrollFunc = function (e) {
}
componentDidMount() { componentDidMount() {
const dom = ReactDom.findDOMNode(this); const dom = ReactDom.findDOMNode(this)
if (dom.attachEvent) { if (dom.attachEvent) {
dom.attachEvent('onmousewheel',this.scrollFunc); dom.attachEvent('onmousewheel', this.scrollFunc)
} }
//Firefox使用addEventListener添加滚轮事件 //Firefox使用addEventListener添加滚轮事件
if (dom.addEventListener) {//firefox if (dom.addEventListener) {
dom.addEventListener('DOMMouseScroll', this.scrollFunc, false); //firefox
dom.addEventListener('DOMMouseScroll', this.scrollFunc, false)
} }
//Safari与Chrome属于同一类型 //Safari与Chrome属于同一类型
dom.onmousewheel = this.scrollFunc; dom.onmousewheel = this.scrollFunc
} }
//多选 //多选
AllCheckChange = (e) => { AllCheckChange = (e) => {
if (this.state.tableData.length == 0) {
if(this.state.tableData.length == 0) return
{
return;
} }
this.setState({ this.setState({
@ -195,21 +178,18 @@ export default class menu extends React.Component {
}) })
let tableData = _.map(this.state.tableData, (item) => { let tableData = _.map(this.state.tableData, (item) => {
return item.checked = e.target.checked; return (item.checked = e.target.checked)
}) })
this.setState({ this.setState({
tableData: this.state.tableData tableData: this.state.tableData
}) })
let selection = _.filter(this.state.tableData, (item) => { let selection = _.filter(this.state.tableData, (item) => {
return item.checked == true; return item.checked == true
}) })
this.props.checkChange(selection) this.props.checkChange(selection)
} }
allChecked(status) {
allChecked(status)
{
this.setState({ allChecked: status }) this.setState({ allChecked: status })
let tabledata = _.map(this.state.tableData, (item) => { let tabledata = _.map(this.state.tableData, (item) => {
item.checked = false item.checked = false
@ -219,19 +199,15 @@ export default class menu extends React.Component {
indeterminate: false indeterminate: false
}) })
this.setState({ tableData: tabledata }) this.setState({ tableData: tabledata })
} }
checkChange(index, e) { checkChange(index, e) {
this.state.tableData[index].checked = e.target.checked; this.state.tableData[index].checked = e.target.checked
this.setState({ this.setState({
tableData: this.state.tableData tableData: this.state.tableData
}) })
let selection = _.filter(this.state.tableData, (item) => { let selection = _.filter(this.state.tableData, (item) => {
return item.checked == true; return item.checked == true
}) })
this.props.checkChange(selection) this.props.checkChange(selection)
@ -242,37 +218,30 @@ export default class menu extends React.Component {
this.setState({ this.setState({
allChecked: true allChecked: true
}) })
} } else if (selection.length == 0) {
else if(selection.length == 0)
{
this.setState({ this.setState({
indeterminate: false indeterminate: false
}) })
this.setState({ this.setState({
allChecked: false allChecked: false
}) })
} } else {
else {
this.setState({ this.setState({
indeterminate: true indeterminate: true
}) })
} }
} }
getCellValue(column, rowData) { getCellValue(column, rowData) {
let value = _.get(rowData, column) let value = _.get(rowData, column)
return value||value==0 ? value : "-" return value || value == 0 ? value : '-'
} }
switchChange(index, e) { switchChange(index, e) {
this.state.tableData[index].switched = e
this.state.tableData[index].switched = e;
this.setState({ this.setState({
tableData: this.state.tableData tableData: this.state.tableData
}) })
} }
editRow(e, column, row) { editRow(e, column, row) {
@ -282,62 +251,48 @@ export default class menu extends React.Component {
this.setState({ curRow: row }) this.setState({ curRow: row })
let pos = {} let pos = {}
pos.x = e.clientX; pos.x = e.clientX
pos.y = e.clientY; pos.y = e.clientY
this.setState({postion:pos}); this.setState({ postion: pos })
if(this.state.historyrow_id == row.id) if (this.state.historyrow_id == row.id) {
{
this.setState({ editShow: !this.state.editShow }) this.setState({ editShow: !this.state.editShow })
} } else {
else{
this.setState({ editShow: true }) this.setState({ editShow: true })
this.setState({ historyrow_id: row.id }) this.setState({ historyrow_id: row.id })
} }
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (this.state.tableData != nextProps.tableData) {
if(this.state.tableData != nextProps.tableData) this.setState({ tableData: nextProps.tableData })
{ this.setState({ page: nextProps.page })
this.setState({tableData: nextProps.tableData});
this.setState({page: nextProps.page});
this.setState({ dataCount: nextProps.dataCount }) this.setState({ dataCount: nextProps.dataCount })
} }
} }
onConfirm = () => { onConfirm = () => {}
} onCancel = () => {}
onCancel = () => {
}
total = (e) => { total = (e) => {
let sum = 0 let sum = 0
if (e.total) { if (e.total) {
for (let i = 0; i < this.state.tableData.length; i++) { for (let i = 0; i < this.state.tableData.length; i++) {
let row = this.state.tableData[i] let row = this.state.tableData[i]
let num = row[e.prop] == "" ? 0 : row[e.prop]; let num = row[e.prop] == '' ? 0 : row[e.prop]
sum += num; sum += num
} }
if (e.valueType == "percentage") { if (e.valueType == 'percentage') {
return sum <= 0 ? "0.00%" : sum.toFixed(2) + "%"; return sum <= 0 ? '0.00%' : sum.toFixed(2) + '%'
} }
if (e.valueType == "price") { if (e.valueType == 'price') {
return sum <= 0 ? "0.00" : sum.toFixed(2); return sum <= 0 ? '0.00' : sum.toFixed(2)
} }
} else { } else {
return ""; return ''
} }
return sum; return sum
} }
//当前页码条数 //当前页码条数
onCountChange(e) { onCountChange(e) {
@ -350,18 +305,14 @@ export default class menu extends React.Component {
this.setState({ pageLoading: false }) this.setState({ pageLoading: false })
}, 500) }, 500)
} }
pageShow(e){ pageShow(e) {}
gridEditChange(e) {}
}
gridEditChange(e){
}
getSelectData() { getSelectData() {
let selectList = this.state.tableData.filter((o) => {
let selectList = this.state.tableData.filter((o)=>{return o.checked == true}) return o.checked == true
selectList = _.map(selectList, o => _.omit(o, ['checked'])); })
selectList = _.map(selectList, (o) => _.omit(o, ['checked']))
return selectList return selectList
} }
rowItemClick(index) { rowItemClick(index) {
console.log(index) console.log(index)
@ -369,169 +320,157 @@ export default class menu extends React.Component {
this.setState({ curIndex: index }) this.setState({ curIndex: index })
} }
render() { render() {
const { const { data, ComponentHandler } = this.props
data, var column_width = 0
ComponentHandler
} = this.props;
var column_width = 0;
let auto_column_width = this.state.Column.length > 12 ? "100px" : 100 / (this.state.Column.length - 2) + "%"; let auto_column_width =
this.state.Column.length > 12
? '100px'
: 100 / (this.state.Column.length - 2) + '%'
return ( <div><div className = "gird" style={{"border": this.props.isBorder ? "1px solid #dfe1e6":"none"}} id="grid" >
<div className = "th-head" > {
this.props.isMultiple ? ( < div className = "th-td"
style = {
{
"width": "50px",
"textAlign": "left",
"background":this.props.headBackgroud,
}
} >
<Checkbox checked = {
this.state.allChecked
}
indeterminate = {
this.state.indeterminate
}
onChange = {
this.AllCheckChange
} > < /Checkbox> < /
div > ) : null
} {
this.props.isSwitch ? ( < div className = "th-td"
style = {
{
"width": "30px",
"textAlign": "left",
"visibility": "hidden",
"background":this.props.headBackgroud,
}
} >
<Switch size = {
"small"
}
checked = {
true
}
onChange = {
() => {
this.switchChange()
}
} > </Switch> </div> ) : null
}
{
this.state.Column.map((item, index) => {
column_width = item.width == "auto" ? auto_column_width : item.width;
return ( <div className = "th-td"
style = {
{
"width": column_width,
"justifyContent": item.textAlign,
"background":this.props.headBackgroud,
}
}
key = {
index
} > {
item.title
}
{
item.sort ? ( <
Icon type = "arrow-down" / >
) : null
} </div>
)
})
} </div>
<div className={this.state.pageLoading ? "grid-loading show" : "grid-loading"} >
<div className="loading-bar"></div>
<div className="loading-txt">数据加载中,请耐心等待</div>
</div>
<div className={this.state.pageLoading ? "th-body hide" : "th-body"} style={{"maxHeight":this.props.maxheight+"px"}} > {
this.state.tableData.length == 0 ? ( < div className = "empty-text" > {
this.state.emptyText
} < /div>): (
this.state.tableData.map((item, index) => {
return ( <div className = { this.state.curIndex == index ? "tr active" :"tr" } onClick={(e)=>{this.rowItemClick(index)}}
style = {
{
"background": index % 2 == 0 ? this.props.spliteColor : "#ffffff"
}
}
key = {
index
} > {
this.props.isMultiple ? ( < div className = "td"
style = {
{
"width": "50px",
"textAlign": "left"
}
} >
<Checkbox checked = {
item.checked
}
disabled={item.disabled}
onChange = {
(e) => {
this.checkChange(index, e)
}
} > </Checkbox> </div> ) : null
}
{
this.props.isSwitch ? ( < div className = "td"
style = {
{
"width": "30px",
"textAlign": "left"
}
} >
<Switch size = {
"small"
}
checked = {
item.switched
}
onChange = {
(e) => {
this.switchChange(index,e)
}
}
loading = {
this.state.switchLoading
} > < /Switch> < /div > ) : null
}
{
this.state.Column.map((child, c_index) => {
column_width = child.width == "auto" ? auto_column_width : child.width;
return ( return (
child.type == "normal" ? ( < <div>
div className = "td" <div
style = { className='gird'
{ style={{ border: this.props.isBorder ? '1px solid #dfe1e6' : 'none' }}
"width": column_width, id='grid'>
"justifyContent": child.textAlign <div className='th-head'>
} {' '}
} {this.props.isMultiple ? (
key = { <div
c_index className='th-td'
} > { style={{
this.getCellValue(child.prop,item) width: '50px',
} textAlign: 'left',
background: this.props.headBackgroud
}}>
<Checkbox
checked={this.state.allChecked}
indeterminate={this.state.indeterminate}
onChange={this.AllCheckChange}>
{' '}
</Checkbox>{' '}
</div> </div>
) : null}{' '}
{this.props.isSwitch ? (
<div
className='th-td'
style={{
width: '30px',
textAlign: 'left',
visibility: 'hidden',
background: this.props.headBackgroud
}}>
<Switch
size={'small'}
checked={true}
onChange={() => {
this.switchChange()
}}>
{' '}
</Switch>{' '}
</div>
) : null}
{this.state.Column.map((item, index) => {
column_width =
item.width == 'auto' ? auto_column_width : item.width
return (
<div
className='th-td'
style={{
width: column_width,
justifyContent: item.textAlign,
background: this.props.headBackgroud
}}
key={index}>
{' '}
{item.title}
{item.sort ? <Icon type='arrow-down' /> : null}{' '}
</div>
)
})}{' '}
</div>
<div
className={
this.state.pageLoading ? 'grid-loading show' : 'grid-loading'
}>
<div className='loading-bar'></div>
<div className='loading-txt'>数据加载中,请耐心等待</div>
</div>
<div
className={this.state.pageLoading ? 'th-body hide' : 'th-body'}
style={{ maxHeight: this.props.maxheight + 'px' }}>
{' '}
{this.state.tableData.length == 0 ? (
<div className='empty-text'> {this.state.emptyText} </div>
) : (
this.state.tableData.map((item, index) => {
return (
<div
className={
this.state.curIndex == index ? 'tr active' : 'tr'
}
onClick={(e) => {
this.rowItemClick(index)
}}
style={{
background:
index % 2 == 0 ? this.props.spliteColor : '#ffffff'
}}
key={index}>
{' '}
{this.props.isMultiple ? (
<div
className='td'
style={{
width: '50px',
textAlign: 'left'
}}>
<Checkbox
checked={item.checked}
disabled={item.disabled}
onChange={(e) => {
this.checkChange(index, e)
}}>
{' '}
</Checkbox>{' '}
</div>
) : null}
{this.props.isSwitch ? (
<div
className='td'
style={{
width: '30px',
textAlign: 'left'
}}>
<Switch
size={'small'}
checked={item.switched}
onChange={(e) => {
this.switchChange(index, e)
}}
loading={this.state.switchLoading}>
{' '}
</Switch>{' '}
</div>
) : null}
{this.state.Column.map((child, c_index) => {
column_width =
child.width == 'auto' ? auto_column_width : child.width
return child.type == 'normal' ? (
<div
className='td'
style={{
width: column_width,
justifyContent: child.textAlign
}}
key={c_index}>
{' '}
{this.getCellValue(child.prop, item)}
</div>
) : (
// <Icon type = "edit" // <Icon type = "edit"
// className = "td-edit" // className = "td-edit"
// ref={"edit"+item.id} // ref={"edit"+item.id}
@ -540,118 +479,102 @@ export default class menu extends React.Component {
// } // }
// > // >
// </Icon> // </Icon>
) : ( <div className = "td" <div
style = { className='td'
{ style={{
"width": column_width, width: column_width,
"justifyContent": child.textAlign justifyContent: child.textAlign
} }}
} key={c_index}>
key = { {' '}
c_index {ComponentHandler(child.prop, item, index)}{' '}
} > { </div>
ComponentHandler(child.prop, item,index)
} </div>
) )
) })}{' '}
</div>
})
} </div>
) )
}) })
) )}
} {this.state.editShow ? (
{ <GridEdit
this.state.editShow ? pos={this.state.postion}
(<GridEdit pos={this.state.postion} title={this.state.edit_title} column={this.state.edit_column} onCancel={()=>{ title={this.state.edit_title}
this.setState({editShow:false}) } } onOk={(row)=>{ this.setState({editShow:false});console.log("当前数据行",row) }} row={this.state.curRow} column={this.state.edit_column}
/>) : null onCancel={() => {
} this.setState({ editShow: false })
<div className = "sortbar" > }}
onOk={(row) => {
this.setState({ editShow: false })
</div> console.log('当前数据行', row)
}}
row={this.state.curRow}
/>
) : null}
<div className='sortbar'></div>
</div> </div>
<div className={!this.state.pageLoading && this.props.countbarVisible ? "tfoot" : "tfoot hide"} <div
style = { className={
{ !this.state.pageLoading && this.props.countbarVisible
"background": this.props.spliteColor ? 'tfoot'
} : 'tfoot hide'
} > <div className = "th-td-total"
style = {
{
"width": "130px"
}
} >
总计({
this.state.tableData.length
} }
style={{
background: this.props.spliteColor
}}>
{' '}
<div
className='th-td-total'
style={{
width: '130px'
}}>
总计({this.state.tableData.length}
条数据): 条数据):
</div> </div>
{ {this.state.Column.map((child, c_index) => {
this.state.Column.map((child, c_index) => { column_width =
column_width = child.width == "auto" ? auto_column_width : child.width; child.width == 'auto' ? auto_column_width : child.width
return ( <div className = "td total" return (
style = { <div
{ className='td total'
"width": column_width, style={{
"textAlign": child.textAlign width: column_width,
} textAlign: child.textAlign
} }}
key = { key={c_index}>
c_index {' '}
} > { {this.total(child)}{' '}
this.total(child) </div>
} </div>
) )
}) })}{' '}
} < /div> </div>
</div> </div>
{ {this.props.isShowPageBar ? (
this.props.isShowPageBar ? ( <div className={this.state.pageLoading ? 'pagebar hide' : 'pagebar'}>
<div className={this.state.pageLoading ? "pagebar hide":"pagebar"} > <Pagination
<Pagination data = { data={{
{ count: this.props.dataCount
count: this.props.dataCount, }}
} onPrevClick={(e) => {
}
onPrevClick = {
(e) => {
this.gridPageLoad() this.gridPageLoad()
this.props.pageChange(e); this.props.pageChange(e)
} }}
}
page={this.props.page} page={this.props.page}
pageFn={(e) => this.setState({ page: e })} pageFn={(e) => this.setState({ page: e })}
onNextClick = { onNextClick={(e) => {
(e) => {
this.gridPageLoad() this.gridPageLoad()
this.props.pageChange(e); this.props.pageChange(e)
} }}
} onJumpPage={(e) => {
onJumpPage={
(e)=>{
this.gridPageLoad() this.gridPageLoad()
this.props.pageChange(e); this.props.pageChange(e)
} }}
} onCountChange={(e) => {
onCountChange ={
(e)=>{
this.onCountChange(e) this.onCountChange(e)
} }}></Pagination>
}> </div>
</Pagination> ) : null}
</div>):null
}
</div> </div>
) )
} }

View File

@ -2,21 +2,27 @@
* @Author: Wind * @Author: Wind
* @Date: 2022-07-25 10:53:41 * @Date: 2022-07-25 10:53:41
* @LastEditors: Wind * @LastEditors: Wind
* @LastEditTime: 2022-07-28 15:29:24 * @LastEditTime: 2022-08-10 15:52:01
* @Description:key列表查询组件 * @Description:key列表查询组件
* @FilePath: \frontend\src\components\keysFind\index.jsx * @FilePath: \frontend\src\components\keysFind\index.jsx
*/ */
import './index.less' import './index.less'
import { useState } from 'react' import { useState, useEffect } from 'react'
import { Button, Select, DateRangePicker } from 'zent' import { Button, Select, DateRangePicker, Notify } from 'zent'
import Ipt from '@/components/input/main' import Ipt from '@/components/input/main'
import Form from '@/components/form/main' import Form from '@/components/form/main'
import FormItem from '@/components/form-item/main' import FormItem from '@/components/form-item/main'
import _ from 'lodash' import _ from 'lodash'
import {
getReSellerOption,
handelResponse,
getPlanChoseOption
} from '../../assets/api'
import { FixedSizeList } from 'react-window'
const stateList = [ const stateList = [
{ key: 0, text: '全部' }, { key: 0, text: '全部' },
{ key: 1, text: '待使用' }, { key: 1, text: '使用' },
{ key: 2, text: '已使用' }, { key: 2, text: '已使用' },
{ key: 3, text: '已完结' }, { key: 3, text: '已完结' },
{ key: 4, text: '已作废' } { key: 4, text: '已作废' }
@ -26,20 +32,67 @@ function init() {
date: [], date: [],
reseller: '', reseller: '',
plan: '', plan: '',
state: '', state: { key: 0, text: '全部' },
key: '' key: ''
} }
} }
export default ({ onQuery }) => { export default ({ onQuery }) => {
const [models, setModels] = useState(init()) const [models, setModels] = useState(init())
const [resellerOption, setResellerOption] = useState([]) /* 分销商 */
const [planChoseOption, setPlanChoseOption] = useState([]) /* 营销计划 */
useEffect(() => {
/* 获取分销商 */
getReSellerOption().then((res) =>
handelResponse(
res,
(req, msg) => {
const data = req.map((item) => ({
key: item.direct_reseller_id,
text: item.name
}))
setResellerOption(data)
},
(err) => {}
)
)
/* 获取营销计划 */
getPlanChoseOption().then((res) =>
handelResponse(
res,
(req, msg) => {
const data = req.map((item) => ({
key: item.id,
text: item.title
}))
setPlanChoseOption(data)
},
(err) => {}
)
)
}, [])
function renderOptionList(options, renderOption) {
return (
<FixedSizeList
height={256}
itemCount={options.length}
itemSize={32}
width={200}>
{({ index, style }) => (
<div style={style}>{renderOption(options[index], index)}</div>
)}
</FixedSizeList>
)
}
function onChange(data) { function onChange(data) {
return { return {
begin_time: data.date[0] || null, begin_time: data.date[0] || null,
end_time: data.date[1] || null, end_time: data.date[1] || null,
reseller_name: data.reseller || null, reseller_id: data.reseller?.key || null,
plan_name: data.plan || null, plan_id: data.plan?.key || null,
status: data.state?.key || null, status: data.state?.key || null,
key: data.key || null key: data.key || null
} }
@ -69,26 +122,26 @@ export default ({ onQuery }) => {
/> />
</FormItem> </FormItem>
<FormItem labelname='分销商:' required='' labelwidth='70px'> <FormItem labelname='分销商:' required='' labelwidth='70px'>
<Ipt <Select
value={models.reseller} value={models.reseller}
countShow={false} options={resellerOption}
labelWidth='0px' placeholder='请选择'
placeholder='请输入' renderOptionList={renderOptionList}
width={204} width={204}
onClearItem={() => setModels({ ...models, reseller: '' })} clearable
onChange={(va) => setModels({ ...models, reseller: va })} onChange={(va) => setModels({ ...models, reseller: va })}
/> />
</FormItem> </FormItem>
<FormItem labelname='计划名称:' required='' labelwidth='90px'> <FormItem labelname='计划名称:' required='' labelwidth='90px'>
<Ipt <Select
value={models.plan} value={models.plan}
countShow={false} options={planChoseOption}
labelWidth='0px' placeholder='请选择'
placeholder='请输入' renderOptionList={renderOptionList}
width={204} width={204}
clearable
onChange={(va) => setModels({ ...models, plan: va })} onChange={(va) => setModels({ ...models, plan: va })}
onClearItem={() => setModels({ ...models, plan: '' })}
/> />
</FormItem> </FormItem>
<FormItem labelname='KEY' required='' labelwidth='50px'> <FormItem labelname='KEY' required='' labelwidth='50px'>
@ -103,8 +156,20 @@ export default ({ onQuery }) => {
/> />
</FormItem> </FormItem>
<div> <div className='button_box'>
<Button type='primary' onClick={() => onQuery(onChange(models))}> <Button
type='primary'
onClick={() => {
if (
onChange(models).plan_id ||
onChange(models).reseller_id ||
onChange(models).key
) {
onQuery(onChange(models))
} else {
Notify.warn('请输入【分销商】或【计划名称】或【key】进行查询')
}
}}>
查询 查询
</Button> </Button>
<Button <Button

View File

@ -1,10 +1,16 @@
.keysFind { .keysFind {
width: 100%; width: 1200px;
display: flex; display: flex;
align-items: center; align-items: center;
.form-label {
height: 80% !important;
}
.form-compontent { .form-compontent {
padding-top: 0px !important; padding-top: 0px !important;
height: 65% !important;
.iptfillself:not(:last-child) { .iptfillself:not(:last-child) {
margin-bottom: 0 !important; margin-bottom: 0 !important;
@ -23,10 +29,13 @@
.form-Item { .form-Item {
width: auto; width: auto;
margin-right: 15px; margin-right: 15px;
margin-bottom: 15px; margin-bottom: 25px;
} }
} }
.button_box {
margin-top: 8px;
}
.zent-datepicker .zent-datepicker-trigger { .zent-datepicker .zent-datepicker-trigger {

View File

@ -52,13 +52,13 @@ const receiveTypeList = [
] ]
const week = [ const week = [
{ key: 'Mon', text: '星期一' }, { key: 'Mon', text: '一' },
{ key: 'Tue', text: '星期二' }, { key: 'Tue', text: '二' },
{ key: 'Wed', text: '星期三' }, { key: 'Wed', text: '三' },
{ key: 'Thu', text: '星期四' }, { key: 'Thu', text: '四' },
{ key: 'Fri', text: '星期五' }, { key: 'Fri', text: '五' },
{ key: 'Sat', text: '星期六' }, { key: 'Sat', text: '六' },
{ key: 'Sun', text: '星期天' } { key: 'Sun', text: '天' }
] ]
// //
const earlyPerList = ['70', '50', '30', '20'] const earlyPerList = ['70', '50', '30', '20']
@ -781,7 +781,7 @@ export default class addKnockGold extends Component {
/> />
</FormItem> </FormItem>
{this.state.model.channel == 1 ? ( {this.state.model.channel == 1 ? (
<FormItem labelname='模板编号' prop='temp_no' id='batch_number'> <FormItem labelname='模板编号' prop='temp_no' id='batch_number'>
<Ipt <Ipt
onChange={(value) => { onChange={(value) => {
this.onHandleChange(value, 'temp_no') this.onHandleChange(value, 'temp_no')
@ -1239,6 +1239,7 @@ export default class addKnockGold extends Component {
style={{ marginLeft: '25px' }}> style={{ marginLeft: '25px' }}>
{week.map((week) => ( {week.map((week) => (
<Checkbox <Checkbox
className='checkbox'
disabled={this.props?.data?.id ? true : false} disabled={this.props?.data?.id ? true : false}
value={week.text} value={week.text}
key={week.key}> key={week.key}>
@ -1261,7 +1262,7 @@ export default class addKnockGold extends Component {
model[index] = value model[index] = value
this.onHandleChange(model, 'ruleDate') this.onHandleChange(model, 'ruleDate')
}} }}
width={158} width={205}
disabledTime={this.onDisabledRange} disabledTime={this.onDisabledRange}
/> />
{this.addOrMoveFunction( {this.addOrMoveFunction(
@ -1291,7 +1292,7 @@ export default class addKnockGold extends Component {
}}> }}>
<Radio value='irregular'>有效期内不规则日期可用</Radio> <Radio value='irregular'>有效期内不规则日期可用</Radio>
</RadioGroup> </RadioGroup>
<p className='notice' style={{ width: '600px' }}> <p className='notice' style={{ width: '500px' }}>
可在有效期内任意选择时间天数以及可用时段 可在有效期内任意选择时间天数以及可用时段
因当前微信支持问题如选择不规则时间微信卡包内当前仅会展示有效期建议 因当前微信支持问题如选择不规则时间微信卡包内当前仅会展示有效期建议
将具体可用日期以及时间段填写在使用说明内 将具体可用日期以及时间段填写在使用说明内
@ -1305,7 +1306,7 @@ export default class addKnockGold extends Component {
this.props?.data?.id ? true : false, this.props?.data?.id ? true : false,
this.props?.data?.id ? true : false this.props?.data?.id ? true : false
]} ]}
width={234} width={205}
value={this.state.model.irregularDate[index]} value={this.state.model.irregularDate[index]}
onChange={(value) => { onChange={(value) => {
const model = this.state.model.irregularDate const model = this.state.model.irregularDate
@ -1339,7 +1340,7 @@ export default class addKnockGold extends Component {
model[index] = value model[index] = value
this.onHandleChange(model, 'irregularTime') this.onHandleChange(model, 'irregularTime')
}} }}
width={158} width={205}
disabledTime={this.onDisabledRange} disabledTime={this.onDisabledRange}
/> />
{this.addOrMoveFunction( {this.addOrMoveFunction(

View File

@ -182,6 +182,12 @@
} }
#usable_time { #usable_time {
align-items: flex-start !important;
.form-label {
padding-top: 25px;
}
.form-compontent { .form-compontent {
.boxTime { .boxTime {
display: flex; display: flex;
@ -236,7 +242,7 @@
.move { .move {
margin-left: 25px; margin-left: 25px;
color: #ccc; color: red;
cursor: pointer; cursor: pointer;
} }
} }
@ -336,6 +342,10 @@
} }
} }
.checkbox {
margin-right: 22px !important;
}
.userSelect { .userSelect {
width: 520px; width: 520px;
min-height: 150px; min-height: 150px;

View File

@ -153,7 +153,9 @@ export default class acclist extends React.Component {
getReseller(req.reseller_id).then((res) => { getReseller(req.reseller_id).then((res) => {
handelResponse(res, (req, msg) => { handelResponse(res, (req, msg) => {
this.setState({ reseller: req }) this.setState({ reseller: req })
this.setState({
direct_reseller_id: req.direct_reseller_id
})
this.setState({ phone_list: req.contact_phone }) this.setState({ phone_list: req.contact_phone })
this.setState({ email_list: req.contact_email }) this.setState({ email_list: req.contact_email })
}) })

View File

@ -186,20 +186,18 @@ export default class acclist extends React.Component {
} }
/* 处理可复制数据逻辑 */ /* 处理可复制数据逻辑 */
copyElementFunction({ key_batch_id, status, end_time, keyBatch, id ,title}) { copyElementFunction({ key_batch_id, status, keyBatch, id, title }) {
const today = moment().format('yyyy-MM-DD HH:mm:ss')
let element = '' let element = ''
if ( if (
![-1, 6, 7].includes(status) && ![-1, 6, 7].includes(status) &&
![6, 7].includes(keyBatch?.status) && ![6, 7].includes(keyBatch?.status) &&
end_time > today &&
!keyBatch?.approval_status && !keyBatch?.approval_status &&
keyBatch?.discard === 0 keyBatch?.discard === 0
) { ) {
element = ( element = (
<span <span
className='grid-link' className='grid-link'
style={{ marginLeft: '10px' }} style={{}}
onClick={(e) => this.copyFunction(key_batch_id, id, keyBatch, title)}> onClick={(e) => this.copyFunction(key_batch_id, id, keyBatch, title)}>
复制 复制
</span> </span>
@ -208,7 +206,6 @@ export default class acclist extends React.Component {
element = ( element = (
<span <span
style={{ style={{
marginLeft: '10px',
paddingRight: '10px', paddingRight: '10px',
color: '#d8dbdd' color: '#d8dbdd'
}}> }}>
@ -585,6 +582,7 @@ export default class acclist extends React.Component {
编辑 编辑
</span> </span>
)} )}
{this.copyElementFunction(rowData)}
{rowData.status != 4 && rowData.status != 5 ? ( {rowData.status != 4 && rowData.status != 5 ? (
<span <span
className='grid-link' className='grid-link'
@ -609,7 +607,6 @@ export default class acclist extends React.Component {
) : ( ) : (
<span style={{ color: '#d8dbdd' }}>撤销审批</span> <span style={{ color: '#d8dbdd' }}>撤销审批</span>
)} )}
{this.copyElementFunction(rowData)}
</div> </div>
) )
} }

View File

@ -305,7 +305,13 @@ export default class acclist extends React.Component {
handelResponse( handelResponse(
res, res,
(req, msg) => { (req, msg) => {
this.setState({ distdata: req.data }) const newData = req.data.map((item) => {
if ([1, 2, 8, 7].includes(item.status)) {
item.disabled = true
}
return item
})
this.setState({ distdata: newData })
this.setState({ planStatus: req.plan.status }) //计划状态 this.setState({ planStatus: req.plan.status }) //计划状态
this.setState({ dataCount: req.total }) this.setState({ dataCount: req.total })
sessionStorage.setItem('key_plan_status', req.plan.status) sessionStorage.setItem('key_plan_status', req.plan.status)
@ -584,8 +590,16 @@ export default class acclist extends React.Component {
/* 批量发送按钮 */ /* 批量发送按钮 */
bulkSendFunction() { bulkSendFunction() {
if (!this.state.gridSelection[0]?.reseller_id) let isNotify = ''
return Notify.warn('请勾选需要批量发送的key批次') this.state.gridSelection.filter((item) => {
if (![4, 5, 6].includes(item.status)) {
return (isNotify = true)
}
})
if (isNotify) {
return Notify.warn('只有状态为进行中、暂停中、已完结的允许发送')
}
this.getResellerInfoFunction(this.state.gridSelection[0].reseller_id) this.getResellerInfoFunction(this.state.gridSelection[0].reseller_id)
this.setState({ isBulkSend: true }) this.setState({ isBulkSend: true })
} }
@ -771,7 +785,10 @@ export default class acclist extends React.Component {
disabled={this.state.disabled}> disabled={this.state.disabled}>
新建key 新建key
</Button> </Button>
<Button type='primary' onClick={() => this.bulkSendFunction()}> <Button
type='primary'
onClick={() => this.bulkSendFunction()}
disabled={!this.state.gridSelection[0]?.reseller_id}>
批量发送 批量发送
</Button> </Button>
</div> </div>
@ -871,11 +888,18 @@ export default class acclist extends React.Component {
str = ( str = (
<span> <span>
<a className='grid-link disabled'>编辑</a> <a className='grid-link disabled'>编辑</a>
{ {[1, 2, 8].includes(rowData.status) ||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):( [2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a> <a className='grid-link disabled'>复制</a>
) ) : (
} <a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span className='grid-link disabled'>撤销审批</span> <span className='grid-link disabled'>撤销审批</span>
@ -898,11 +922,18 @@ export default class acclist extends React.Component {
str = ( str = (
<span> <span>
<a className='grid-link disabled'>编辑</a> <a className='grid-link disabled'>编辑</a>
{ {[1, 2, 8].includes(rowData.status) ||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):( [2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a> <a className='grid-link disabled'>复制</a>
) ) : (
} <a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span <span
className='grid-link' className='grid-link'
onClick={(e) => this.onReCall(e, rowData)}> onClick={(e) => this.onReCall(e, rowData)}>
@ -950,11 +981,18 @@ export default class acclist extends React.Component {
}}> }}>
编辑 编辑
</a> </a>
{ {[1, 2, 8].includes(rowData.status) ||
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):( [2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a> <a className='grid-link disabled'>复制</a>
) ) : (
} <a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span className='grid-link disabled'>撤销审批</span> <span className='grid-link disabled'>撤销审批</span>
<Dropdown <Dropdown

View File

@ -25,7 +25,6 @@ import {
keyBatchUsage, keyBatchUsage,
keyBatchCancel, keyBatchCancel,
handelResponse, handelResponse,
getkeyDetailList,
getKeysList, getKeysList,
batchUploadVoid, batchUploadVoid,
batchUploadUsed, batchUploadUsed,
@ -104,7 +103,7 @@ export default class acclist extends React.Component {
} }
componentDidMount(e) { componentDidMount(e) {
this.iptsureFn(); // this.iptsureFn();
} }
componentWillMount() { componentWillMount() {
this.setState({ tableHeight: window.innerHeight - 430 }); this.setState({ tableHeight: window.innerHeight - 430 });
@ -628,6 +627,7 @@ export default class acclist extends React.Component {
pageChange={(e) => { pageChange={(e) => {
this.onPageChange(e); this.onPageChange(e);
}} }}
emptyText="查询 请输入【分销商】或【计划名称】或【key】进行查询"
countChange={(e) => { countChange={(e) => {
this.onCountChange(e); this.onCountChange(e);
}} }}

View File

@ -311,7 +311,11 @@ export default class adduserinfo extends React.Component{
//获取角色 //获取角色
getRoleFn(){ getRoleFn(){
let _self=this; let _self=this;
getRole().then(res=>{ let data={
page:1,
limit:1000
}
getRole(data).then(res=>{
handelResponse(res,(response,msg)=>{ handelResponse(res,(response,msg)=>{
let roleList=response.data.map(item=>{ let roleList=response.data.map(item=>{

Binary file not shown.