100 lines
3.0 KiB
JavaScript
100 lines
3.0 KiB
JavaScript
import React from 'react';
|
|
import { connect } from 'dva';
|
|
import { Button, Row, Tag, Form, Tree,Select,Table,InputNumber} from 'antd';
|
|
import { extendRule, initFilter, extendInclude, guid, getDataFieldValue,} from "../../../utils/common";
|
|
import EditBaseComponent from '../../../baseComponents/EditBaseComponent';
|
|
|
|
import {message} from "antd/lib/index";
|
|
|
|
const { TreeNode } = Tree;
|
|
|
|
class BoxQueryPage extends EditBaseComponent {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
data: [],
|
|
};
|
|
};
|
|
onLoadData(){
|
|
const data=this.props.data;
|
|
if(data&&data.id){
|
|
const json=initFilter(this.props.login.OrgId,'','',1,1,data.id);
|
|
extendInclude(json,'Nav_Product');
|
|
extendInclude(json,'Nav_SubBox');
|
|
extendInclude(json,'Nav_SN');
|
|
extendInclude(json,'Nav_PdtOrder');
|
|
extendInclude(json,'Nav_Work');
|
|
this.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
payload: json,
|
|
url:'WH/Box/BoxQuery',
|
|
onComplete: (ret) => {
|
|
this.setState({
|
|
data:ret?[ret]:[],
|
|
})
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
renderBoxTree=(data)=>{
|
|
if(data&&data.length){
|
|
return data.map(t=>{
|
|
let title='空';
|
|
let key='';
|
|
if(t.Nav_Box){
|
|
title=<Tag color="#108ee9">{t.Nav_Box.CODE}</Tag>;
|
|
key=t.Nav_Box.ID;
|
|
}
|
|
else if(t.Nav_BoxDetail&&t.Nav_BoxDetail.Nav_SubBox){
|
|
title=<Tag color="#108ee9">{t.Nav_BoxDetail.Nav_SubBox.CODE}</Tag>;
|
|
key=t.Nav_BoxDetail.ID;
|
|
}
|
|
else if(t.Nav_BoxDetail&&t.Nav_BoxDetail.Nav_SN){
|
|
title=<><Tag color="#000000a6">{t.Nav_BoxDetail.Nav_SN.CODE}</Tag>-
|
|
<Tag color="green">{t.Nav_BoxDetail.Nav_Product.CODE}</Tag></>;
|
|
key=t.Nav_BoxDetail.ID;
|
|
}
|
|
else if(t.Nav_BoxDetail&&t.Nav_BoxDetail.Nav_Work){
|
|
title=<><Tag color="#000000a6">{t.Nav_BoxDetail.Nav_Work.CODE}</Tag>-
|
|
<Tag color="green">{t.Nav_BoxDetail.Nav_Product.CODE}</Tag>-
|
|
<Tag color="#f50">{t.Nav_BoxDetail.QTY}</Tag></>;
|
|
key=t.Nav_BoxDetail.ID;
|
|
}
|
|
else if(t.Nav_BoxDetail&&t.Nav_BoxDetail.Nav_PdtOrder){
|
|
title=<><Tag color="#000000a6">{t.Nav_BoxDetail.Nav_PdtOrder.PDT_CODE}</Tag>-
|
|
<Tag color="green">{t.Nav_BoxDetail.Nav_Product.CODE}</Tag>-
|
|
<Tag color="#f50">{t.Nav_BoxDetail.QTY}</Tag></>;
|
|
key=t.Nav_BoxDetail.ID;
|
|
}
|
|
if(t.Nav_QueryDetails&&t.Nav_QueryDetails.length){
|
|
return <TreeNode title={title} key={key} isLeaf={false}>
|
|
{
|
|
this.renderBoxTree(t.Nav_QueryDetails)
|
|
}
|
|
</TreeNode>
|
|
}
|
|
return <TreeNode title={title} key={key} isLeaf={true}/>
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
<div>
|
|
<Tree>
|
|
{
|
|
this.renderBoxTree(this.state.data)
|
|
}
|
|
</Tree>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
export default connect(({ login, loading,custom }) => ({ login, loading,custom }))(Form.create()(BoxQueryPage));
|