解决bug

This commit is contained in:
red-deng-deng 2021-11-25 19:32:44 +08:00
parent 7120f63254
commit 6750d99ba8
6 changed files with 103 additions and 255 deletions

View File

@ -211,7 +211,15 @@ export default class commoditylist extends React.Component{
sessionStorage.setItem("dataInfo",rowData.product_id)
sessionStorage.setItem('breaknav',JSON.stringify(activerou));
}
//敲回车查询
sureFn(){
let data = {
code_batch_id:sessionStorage.getItem("code_id"),
page:this.state.page,
limit:this.state.limit
}
this.getTableList(data);//更新列表
}
render(){
const { current, pageSize } = this.state;
@ -225,7 +233,7 @@ export default class commoditylist extends React.Component{
</span>
{/* <Button type="info">批量操作</Button> */}
<Ipt icon="search" placeholder={"请输入商品名称进行匹配查询"} countShow={false} height={'36px'} width={'260px'} alignment={'left'}/>
<Ipt icon="search" placeholder={"请输入商品名称进行匹配查询"} countShow={false} height={'36px'} width={'260px'} value={this.state.key_word} onChange={(e)=>this.setState({key_word:e})} wordSearch={this.sureFn.bind(this)} alignment={'left'}/>
</p>
<div>
<Filterbar filterList={this.state.filterList} menuList={this.state.menuList}></Filterbar>

View File

@ -170,8 +170,8 @@ export default class acclist extends React.Component{
sessionStorage.setItem('breaknav',JSON.stringify(activerou));
}
tabFn(index){
this.setState({tabIndex:index})
this.setState({page:1})
this.setState({tabIndex:index,key_word:''})
this.setState({page:1,limit:10})
setTimeout(() => {
this.getCodeListFn({},index);
}, 10);

View File

@ -44,8 +44,8 @@ const Column = [{
name: 'thumb',
prop: 'thumb',
className: 'name',
type: "normal",
width: '200px'
type: "slot",
width: '10%'
}, {
title: '标题',
prop: 'title',
@ -239,7 +239,7 @@ export default class acclist extends React.Component {
tabChange(e) {
this.setState({page:1})
this.setState({limit:10})
this.setState({key_word:''});
let data={
page: 1,
limit:10,
@ -391,6 +391,12 @@ export default class acclist extends React.Component {
}
ComponentHandler = {
(com, rowData) => {
if(com=='thumb'){
return <Pop trigger="hover" position="right-center" content={<img src={rowData.thumb} alt="" style={{width:'375px',transform:'scale(.8)'}}/>}>
<img src={rowData.thumb} alt="" style={{width:'30px',height:'30px'}}/>
</Pop>
}
if (com == "name") {
return <Switch size = "small"
checked = {

View File

@ -1,7 +1,7 @@
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
import { Link } from "react-router-dom";
import { Button,Tag,Sweetalert,CombinedDateRangePicker,Notify,Switch} from 'zent';
import { Button,Tag,Sweetalert,CombinedDateRangePicker,Notify,Switch,Pop} from 'zent';
import "./main.less"
import _ from "lodash";
import "../../../assets/comm.css"
@ -14,10 +14,10 @@ import {handelResponse,getTheme,delTheme} from "../../../assets/api.js"
const Column = [
{
title: '缩略图',
name: 'pic',
prop:'pic',
name: 'thumb',
prop:'thumb',
type: "slot",
width:'auto',
width:'10%',
}, {
title: '标题',
prop:'title',
@ -209,6 +209,12 @@ delFn(e,row){
}}
ComponentHandler={(com,rowData)=>{
if(com=='thumb'){
return <Pop trigger="hover" position="right-center" content={<img src={rowData.thumb} alt="" style={{width:'375px',transform:'scale(.8)'}}/>}>
<img src={rowData.thumb} alt="" style={{width:'30px',height:'30px'}}/>
</Pop>
}
if (com == "client") {
return <span > < font className = "icon"
style = {

View File

@ -116,7 +116,8 @@ export default class acclist extends React.Component{
distdata3:[],
distdata11:[],
tableHeight:600,
email:"",
email:"",
key_word:'',
phone:"",
}
}
@ -146,7 +147,6 @@ export default class acclist extends React.Component{
this.getKeyList(data);
}
componentDidMount(e){
console.log(7777)
let data = {
page:1,
limit:10,
@ -190,12 +190,40 @@ export default class acclist extends React.Component{
}
tabFn(index){
this.setState({activepage:index});
if(index==0){
}
if(index==1){
this.setState({activepage:index,key_word:''});
if(index==1||index==2){
this.setState({distdata:[]});
}else{
if(index==3){
this.setState({activepage:4});
}
if(index==4){
this.setState({activepage:5});
}
if(index==5){
this.setState({activepage:6});
}
if(index==6){
this.setState({activepage:7});
}
this.setState({page:1,limit:10})
setTimeout(() => {
let data = {
page:1,
limit:10,
status:this.state.activepage,
plan_id: sessionStorage.getItem("key_plan_id")
}
if(index==0){
delete data.status;
}
this.getKeyList(data);
}, 10);
}
}
//作废
delFn(){
@ -279,7 +307,15 @@ onEditRow(status,row){
//敲回车查询
iptsureFn(){
this.getKeyList();
let data = {
page:1,
limit:10,
key_word:this.state.key_word,
plan_id: sessionStorage.getItem("key_plan_id")}
if(this.state.activepage){
data.status=this.state.activepage;
}
this.getKeyList(data);
}
componentWillMount(){
@ -440,7 +476,14 @@ phoneChange=(e)=>
cancelKey(row.id).then(res=>{
handelResponse(res,(response,msg)=>{
Notify.clear();
Notify.success("作废成功");
Notify.success(msg);
let data = {
page:1,
limit:10,
plan_id: sessionStorage.getItem("key_plan_id")
}
console.log(57777777);
self.getKeyList(data);
},(err)=>{
@ -455,7 +498,21 @@ phoneChange=(e)=>
}
}
// 监听组件内部状态的变化:
componentDidUpdate(prevProps,prevState){
// 参数分别为改变之前的数据状态对象
if(prevState.key_word!=this.state.key_word &&!this.state.key_word){
let data = {
page:1,
limit:10,
plan_id: sessionStorage.getItem("key_plan_id")}
if(this.state.activepage){
data.status=this.state.activepage;
}
this.getKeyList(data);
}
}
render(){
const date = <CombinedDateRangePicker
@ -471,11 +528,10 @@ phoneChange=(e)=>
<p className="codetable dflexj">
<Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}>新建key</Button>
{/* <Button type="info">批量操作</Button> */}
<Ipt icon="search" placeholder={"请输入key批次ID进行匹配查询"} wordSearch={this.iptsureFn.bind(this)} countShow={false} height={'36px'} width={'260px'} alignment={'left'} />
<Ipt icon="search" placeholder={"请输入key批次ID进行匹配查询"} onChange={(e)=>this.setState({key_word:e})} value={this.state.key_word} wordSearch={this.iptsureFn.bind(this)} countShow={false} height={'36px'} width={'260px'} onClearItem={(e)=>{this.setState({key_word:''})}} alignment={'left'} />
</p>
<div className="code-table">
{
this.state.activepage==0? <Grid
<Grid
spliteColor={'#fff'}
tableData={this.state.distdata}
Column={Column}
@ -483,6 +539,7 @@ phoneChange=(e)=>
countbarVisible={false}
isSwitch={false}
isMultiple={false}
page={this.state.page}
dataCount={this.state.dataCount}
pageChange={(e)=>{
this.pageChange(e)
@ -498,7 +555,6 @@ phoneChange=(e)=>
if(com == "status")
{
console.log(112121)
return <p className="dflexa" ><span><font className="icon" style={{background:menu.keysStatusBg(rowData.status)}}></font>{menu.keysStatus(rowData.status)}</span></p>
}
if(com == "edit")
@ -522,234 +578,7 @@ phoneChange=(e)=>
</span>
}
}}
/>:null
}
{
this.state.activepage==1? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata2}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
console.log(78979898)
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
console.log(112121)
return <p className="dflexa" ><span><font className="icon" style={{background:menu.keysStatusBg(rowData.status)}}></font>{menu.keysStatus(rowData.status)}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
{/* 进行 */}
{
this.state.activepage==2? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata11}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
console.log(66666)
return <p className="dflexa" ><span><font className="icon" style={{background:menu.keysStatusBg(rowData.status)}}></font>{menu.keysStatus(rowData.status)}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
{/* 暂停 */}
{
this.state.activepage==3? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata2}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
console.log(789789798)
return <p className="dflexa" ><span><font className="icon" style={{background:menu.keysStatusBg(rowData.status)}}></font>{menu.keysStatus(rowData.status)}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
{/* 一结束 */}
{
this.state.activepage==4? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata3}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
return <p className="dflexa" ><span><font className="icon" style={{background:menu.keysStatusBg(rowData.status)}}></font>{menu.keysStatus(rowData.status)}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
{/* 已作废 */}
{
this.state.activepage==5? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata4}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
return <p className="dflexa" ><span><font className="icon" style={{background:menu.keysStatusBg(rowData.status)}}></font>{menu.keysStatus(rowData.status)}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
/>
</div>
</TabPage>
</div>

View File

@ -66,10 +66,10 @@ export default class acclist extends React.Component{
getPlanList(data){
let queryParams = _.omitBy(data, (value) => {
return _.isNaN(value) || _.isNil(value) || '' == value
return _.isNaN(value) || _.isNil(value) || 0 == value
})
console.log(72,queryParams);
getPlanList(queryParams).then((res)=>{
handelResponse(res,(req,msg)=>{
this.setState({distdata:req.data})
@ -288,7 +288,6 @@ export default class acclist extends React.Component{
limit:10,
status:e,
key_word:this.state.key_word
}
this.getPlanList(data)