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);
};
export const exportKey = (data) => {
return req("get", baseurl + "/key/export", data);
};
export { req };

View File

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

View File

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

View File

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

View File

@ -52,13 +52,13 @@ const receiveTypeList = [
]
const week = [
{ key: 'Mon', text: '星期一' },
{ key: 'Tue', text: '星期二' },
{ key: 'Wed', text: '星期三' },
{ key: 'Thu', text: '星期四' },
{ key: 'Fri', text: '星期五' },
{ key: 'Sat', text: '星期六' },
{ key: 'Sun', text: '星期天' }
{ key: 'Mon', text: '一' },
{ key: 'Tue', text: '二' },
{ key: 'Wed', text: '三' },
{ key: 'Thu', text: '四' },
{ key: 'Fri', text: '五' },
{ key: 'Sat', text: '六' },
{ key: 'Sun', text: '天' }
]
//
const earlyPerList = ['70', '50', '30', '20']
@ -781,7 +781,7 @@ export default class addKnockGold extends Component {
/>
</FormItem>
{this.state.model.channel == 1 ? (
<FormItem labelname='模板编号' prop='temp_no' id='batch_number'>
<FormItem labelname='模板编号' prop='temp_no' id='batch_number'>
<Ipt
onChange={(value) => {
this.onHandleChange(value, 'temp_no')
@ -1239,6 +1239,7 @@ export default class addKnockGold extends Component {
style={{ marginLeft: '25px' }}>
{week.map((week) => (
<Checkbox
className='checkbox'
disabled={this.props?.data?.id ? true : false}
value={week.text}
key={week.key}>
@ -1261,7 +1262,7 @@ export default class addKnockGold extends Component {
model[index] = value
this.onHandleChange(model, 'ruleDate')
}}
width={158}
width={205}
disabledTime={this.onDisabledRange}
/>
{this.addOrMoveFunction(
@ -1291,7 +1292,7 @@ export default class addKnockGold extends Component {
}}>
<Radio value='irregular'>有效期内不规则日期可用</Radio>
</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
]}
width={234}
width={205}
value={this.state.model.irregularDate[index]}
onChange={(value) => {
const model = this.state.model.irregularDate
@ -1339,7 +1340,7 @@ export default class addKnockGold extends Component {
model[index] = value
this.onHandleChange(model, 'irregularTime')
}}
width={158}
width={205}
disabledTime={this.onDisabledRange}
/>
{this.addOrMoveFunction(

View File

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

View File

@ -153,7 +153,9 @@ export default class acclist extends React.Component {
getReseller(req.reseller_id).then((res) => {
handelResponse(res, (req, msg) => {
this.setState({ reseller: req })
this.setState({
direct_reseller_id: req.direct_reseller_id
})
this.setState({ phone_list: req.contact_phone })
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}) {
const today = moment().format('yyyy-MM-DD HH:mm:ss')
copyElementFunction({ key_batch_id, status, keyBatch, id, title }) {
let element = ''
if (
![-1, 6, 7].includes(status) &&
![6, 7].includes(keyBatch?.status) &&
end_time > today &&
!keyBatch?.approval_status &&
keyBatch?.discard === 0
) {
element = (
<span
className='grid-link'
style={{ marginLeft: '10px' }}
style={{}}
onClick={(e) => this.copyFunction(key_batch_id, id, keyBatch, title)}>
复制
</span>
@ -208,7 +206,6 @@ export default class acclist extends React.Component {
element = (
<span
style={{
marginLeft: '10px',
paddingRight: '10px',
color: '#d8dbdd'
}}>
@ -585,6 +582,7 @@ export default class acclist extends React.Component {
编辑
</span>
)}
{this.copyElementFunction(rowData)}
{rowData.status != 4 && rowData.status != 5 ? (
<span
className='grid-link'
@ -609,7 +607,6 @@ export default class acclist extends React.Component {
) : (
<span style={{ color: '#d8dbdd' }}>撤销审批</span>
)}
{this.copyElementFunction(rowData)}
</div>
)
}

View File

@ -305,7 +305,13 @@ export default class acclist extends React.Component {
handelResponse(
res,
(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({ dataCount: req.total })
sessionStorage.setItem('key_plan_status', req.plan.status)
@ -584,8 +590,16 @@ export default class acclist extends React.Component {
/* 批量发送按钮 */
bulkSendFunction() {
if (!this.state.gridSelection[0]?.reseller_id)
return Notify.warn('请勾选需要批量发送的key批次')
let isNotify = ''
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.setState({ isBulkSend: true })
}
@ -771,7 +785,10 @@ export default class acclist extends React.Component {
disabled={this.state.disabled}>
新建key
</Button>
<Button type='primary' onClick={() => this.bulkSendFunction()}>
<Button
type='primary'
onClick={() => this.bulkSendFunction()}
disabled={!this.state.gridSelection[0]?.reseller_id}>
批量发送
</Button>
</div>
@ -871,11 +888,18 @@ export default class acclist extends React.Component {
str = (
<span>
<a className='grid-link disabled'>编辑</a>
{
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):(
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a>
)
}
{[1, 2, 8].includes(rowData.status) ||
[2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link disabled'>复制</a>
) : (
<a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span className='grid-link disabled'>撤销审批</span>
@ -898,11 +922,18 @@ export default class acclist extends React.Component {
str = (
<span>
<a className='grid-link disabled'>编辑</a>
{
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):(
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a>
)
}
{[1, 2, 8].includes(rowData.status) ||
[2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link disabled'>复制</a>
) : (
<a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span
className='grid-link'
onClick={(e) => this.onReCall(e, rowData)}>
@ -950,11 +981,18 @@ export default class acclist extends React.Component {
}}>
编辑
</a>
{
[1,2,8].includes(rowData.status)||[2,6,8,7].includes(this.state.planStatus)?(<a className='grid-link disabled'>复制</a>):(
<a className='grid-link' onClick={(e) => {this.onCopyRow(e, rowData)}}>复制</a>
)
}
{[1, 2, 8].includes(rowData.status) ||
[2, 6, 8, 7].includes(this.state.planStatus) ? (
<a className='grid-link disabled'>复制</a>
) : (
<a
className='grid-link'
onClick={(e) => {
this.onCopyRow(e, rowData)
}}>
复制
</a>
)}
<span className='grid-link disabled'>撤销审批</span>
<Dropdown

View File

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

View File

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

Binary file not shown.