This commit is contained in:
姜棚 2021-11-29 21:03:29 +08:00
parent 6a935e75b0
commit d5bd8e1244
6 changed files with 134 additions and 20 deletions

View File

@ -1,4 +1,5 @@
import React from 'react'
import ReactDom from 'react-dom';
import "./main.css"
import {
Icon,
@ -160,7 +161,9 @@ export default class menu extends React.Component {
}
componentDidMount() {
}
//多选
AllCheckChange = (e) => {
@ -257,10 +260,14 @@ export default class menu extends React.Component {
}
componentWillReceiveProps(nextProps) {
this.setState({tableData: nextProps.tableData});
if(this.state.tableData != nextProps.tableData)
{
console.log("")
this.setState({tableData: nextProps.tableData});
this.setState({page: nextProps.page});
this.setState( {dataCount:nextProps.dataCount})
this.setState( {dataCount:nextProps.dataCount})
}
}
onConfirm = () => {
@ -325,8 +332,14 @@ export default class menu extends React.Component {
} = this.props;
var column_width = 0;
const 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"}} >
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"}} >
<div className = "th-head" > {
this.props.isMultiple ? ( < div className = "th-td"
style = {
@ -496,7 +509,7 @@ export default class menu extends React.Component {
key = {
c_index
} > {
ComponentHandler(child.prop, item)
ComponentHandler(child.prop, item,index)
} </div>
)
)

View File

@ -424,6 +424,7 @@ export default class acclist extends React.Component{
window.history.back()
},1000);
},(err)=>{
Notify.success(err);
})
})

View File

@ -20,7 +20,7 @@ export default class add extends React.Component{
curstep:1,
menuList:[
{id:1,title:"营销计划",child:[{step:1,title:"新建计划"}]},
{id:2,title:"key",child:[{step:1,title:"生key"},{step:2,title:"绑定卡券"}]},
{id:2,title:"key",child:[{step:1,title:"生key"},{step:2,title:"绑定卡券"}]},
{id:3,title:"落地页",child:[{step:1,title:"绑定落地页"}]},
],
phone_list:[],

View File

@ -22,7 +22,7 @@
overflow-y: auto;
}
.action-panel{
width: 80%;
width: 88%;
margin: 0 auto;
height: auto;
margin-bottom: 60px;
@ -244,4 +244,7 @@
width: 50px !important;
height: 50px !important;
}
}
}
// .zent-datepicker-trigger{
// width: 280px !important;
// }

View File

@ -20,7 +20,7 @@ export default class acclist extends React.Component{
type:2,
reseller:null,
return_id:"1",
date_time:""
date_time:[ moment().add(30, 'minutes').format("YYYY-MM-DD HH:mm:ss"),""]
},
reseller_option:[],
@ -95,10 +95,11 @@ export default class acclist extends React.Component{
let valide = false;
if(this.refs.form1.validator())
{
if(this.state.model.date_time[1] == "")
{
Notify.error("结束日期不能为空")
return;
}
let data = {};
data.title = this.state.model.title;
data.type = parseInt(this.state.model.type);
@ -262,6 +263,7 @@ export default class acclist extends React.Component{
className="zent-datepicker-plan"
showTime={{ format: 'HH:mm:ss', defaultTime: [moment().format("HH:mm:ss"), '23:59:59'],
}}
format="YYYY-MM-DD HH:mm:ss"
value={this.state.model.date_time}
onChange={(e)=>{

View File

@ -55,6 +55,7 @@ export default class acclist extends React.Component{
distdata:[],
oldData:null,
uploading:false,
rowIndex:-1,
}
}
@ -148,8 +149,10 @@ export default class acclist extends React.Component{
this.setState({codeInfo:codeInfo})
this.setState({tempdata:[]})
this.setState({drawerVisible:true})
this.setState({rowIndex:-1})
}
closeDraw(){
this.setState({drawerVisible:false})
}
addProduct(){
@ -277,10 +280,20 @@ export default class acclist extends React.Component{
})
temp.product = arr;
let tempdata = this.state.distdata;
tempdata.push(temp)
console.log(tempdata)
this.setState({distdata:tempdata})
if(this.state.rowIndex > -1)
{
console.log("编辑")
this.state.distdata[this.state.rowIndex] = temp;
this.setState({distdata:this.state.distdata})
}
else{
console.log("新增")
let tempdata = this.state.distdata;
tempdata.push(temp)
this.setState({distdata:tempdata})
}
}
@ -493,6 +506,75 @@ export default class acclist extends React.Component{
this.state.tempdata[rowIndex].contract_price = value;
this.setState({tempdata:this.state.tempdata})
}
rowItemClick(row,rowIndex){
console.log("编辑数据")
console.log(rowIndex)
console.log(row)
// begin_time: "2021-11-30 00:00:00"
// describe: "10"
// end_time: "2021-11-30 23:59:59"
// product: Array(1)
// 0:
// contract_price: "10"
// cost_price: "163.8000"
// describe_url: "https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20211129/eb98efd2fee424466ffc1b29c83e9f0a.png"
// official_price: "218.0000"
// product_id: 22
// product_name: "10"
// product_type: 1
// quantity: "1000"
// show_url: "https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20211129/0bfcda5e4dad7cb9bbae12787569c3cc.png"
// [[Prototype]]: Object
// length: 1
// [[Prototype]]: Array(0)
// quantity: "1000"
// range: "10"
// title: "dasdas"
let codeInfo ={ //数据模型不可少
code_name:row.title,
issued:row.quantity,//发放总量
describe:row.describe,
date_time:[row.begin_time,row.end_time],
range:row.range
}
let arr = _.map(row.product,(res)=>{
let obj = {};
obj.key = res.product_id;
obj.text= res.product_name;
return obj;
})
this.setState({rankoptions:arr})
this.setState({rank:arr})
this.setState({codeInfo:codeInfo})
this.setState({rowIndex:rowIndex})
let temp = _.map(row.product,(o)=>{
o.checked = true;
return o
})
this.setState({tempdata:temp})
this.setState({drawerVisible:true})
}
render(){
@ -536,7 +618,14 @@ export default class acclist extends React.Component{
name: 'restrict',
type: "slot",
width:'auto',
}
},
{
title: '操作',
prop: 'edit',
name: 'edit',
type: "slot",
width:'auto',
},
];
//校验规则
const rules = {
@ -753,12 +842,18 @@ export default class acclist extends React.Component{
checkChange ={(selection)=>{
}}
ComponentHandler={(com,rowData)=>{
ComponentHandler={(com,rowData,rowIndex)=>{
if(com == "restrict")
{
return <Input placeholder="请输入数量" type="number" width={120} value={rowData.restrict} onChange={(e)=>{this.onRestrict(e,rowData)}} />
}
if(com == "edit")
{
return <Button type="primary" onClick={(e)=>{this.rowItemClick(rowData,rowIndex)}}>编辑</Button>
}
}}
/>
</FormItem>