|
|
@@ -1,52 +1,78 @@
|
|
|
import React from 'react'
|
|
|
-import { Modal, Table, Col, Row, Button, Input, Icon} from 'antd'
|
|
|
+import { Modal, Table, Col, Row, Button, Input, Icon, Switch} from 'antd'
|
|
|
import { connect } from 'dva'
|
|
|
+import DistributeObjectBox from './distributeObjectBox';
|
|
|
+import DistributePolicyRuleBox from './distributePolicyRuleBox';
|
|
|
|
|
|
const Search = Input.Search;
|
|
|
|
|
|
-const columns = [{
|
|
|
- title: '策略名',
|
|
|
- dataIndex: 'policyName',
|
|
|
- render: policyName => <span>{policyName}<Icon type='copy'/></span>
|
|
|
-}, {
|
|
|
- title: '分发对象',
|
|
|
- dataIndex: 'targets',
|
|
|
- render: targets => {return (
|
|
|
- <div>
|
|
|
- {targets.map(item => {return <p>{item.value}</p>})}
|
|
|
- <Button>添加对象</Button>
|
|
|
- </div>
|
|
|
- )}
|
|
|
-}, {
|
|
|
- title: '行开放策略',
|
|
|
- dataIndex: 'rowFilters',
|
|
|
- render: rowFilters => {return (
|
|
|
- <div>
|
|
|
- {rowFilters.map(filter => {return <p>{filter.value}</p>})}
|
|
|
- <Button>设置规则</Button>
|
|
|
- </div>
|
|
|
- )}
|
|
|
-}]
|
|
|
-
|
|
|
-const data = [{
|
|
|
- key: '1',
|
|
|
- policyName: '分发策略1',
|
|
|
- targets: [{value:'部门为销售'}, {value:'部门为售后'}],
|
|
|
- rowFilters: [{value:'部门字段包含售后,销售'}, {value:'公司名包含公司A'}],
|
|
|
- columns: [{name:'department', alias:'部门', enabled: true}, {name:'company', alias:'公司', enabled: false}]
|
|
|
-}];
|
|
|
-
|
|
|
|
|
|
class DistributeBox extends React.Component {
|
|
|
constructor(props){
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
filterLabel: '',
|
|
|
+ visibleDistributeObjectBox: false,
|
|
|
+ visibleDistributePolicyRuleBox: false,
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ hideDistributeObjectBox= () => {
|
|
|
+ this.setState(
|
|
|
+ {visibleDistributeObjectBox:false})
|
|
|
+ }
|
|
|
+
|
|
|
+ hideDistributePolicyRuleBox= () => {
|
|
|
+ this.setState(
|
|
|
+ {visibleDistributePolicyRuleBox:false})
|
|
|
+ }
|
|
|
render() {
|
|
|
- const { selectedRecord } = this.state;
|
|
|
+ const { selectedRecord, visibleDistributeObjectBox, visibleDistributePolicyRuleBox } = this.state;
|
|
|
const { dataSource, visibleDistributeBox, hideBox } = this.props
|
|
|
+
|
|
|
+ const columns = [
|
|
|
+ {
|
|
|
+ title: '启用',
|
|
|
+ dataIndex:'enabled',
|
|
|
+ render: enabled => <Switch defaultChecked={enabled} />
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '策略名',
|
|
|
+ dataIndex: 'policyName',
|
|
|
+ render: policyName => <span>{policyName}<Icon type='copy'/></span>
|
|
|
+ }, {
|
|
|
+ title: '分发对象',
|
|
|
+ dataIndex: 'targets',
|
|
|
+ render: targets => {return (
|
|
|
+ <div>
|
|
|
+ {targets.map((item, index) => {return <p key={index}>{item.value}</p>})}
|
|
|
+ <Button onClick={() => {this.setState({visibleDistributeObjectBox:true})}}>添加对象</Button>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ }, {
|
|
|
+ title: '行开放策略',
|
|
|
+ dataIndex: 'rowFilters',
|
|
|
+ render: rowFilters => {return (
|
|
|
+ <div>
|
|
|
+ {rowFilters.map((filter, index) => {return <p key={index}>{filter.value}</p>})}
|
|
|
+ <Button onClick={() => {this.setState({visibleDistributePolicyRuleBox:true})}}>设置规则</Button>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ }, {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'operation',
|
|
|
+ render: () => { return <span>预览 删除</span>}
|
|
|
+ }]
|
|
|
+
|
|
|
+ const data = [{
|
|
|
+ key: '1',
|
|
|
+ enabled: true,
|
|
|
+ policyName: '分发策略1',
|
|
|
+ targets: [{value:'部门为销售'}, {value:'部门为售后'}],
|
|
|
+ rowFilters: [{value:'部门字段包含售后,销售'}, {value:'公司名包含公司A'}],
|
|
|
+ columns: [{name:'department', alias:'部门', enabled: true}, {name:'company', alias:'公司', enabled: false}]
|
|
|
+ }];
|
|
|
+
|
|
|
return (
|
|
|
<Modal
|
|
|
width={1200}
|
|
|
@@ -61,28 +87,39 @@ class DistributeBox extends React.Component {
|
|
|
maskClosable={false}
|
|
|
destroyOnClose={true}
|
|
|
>
|
|
|
- <Table
|
|
|
- columns={columns}
|
|
|
- dataSource={data}
|
|
|
- bordered
|
|
|
- title={() => {
|
|
|
- return (
|
|
|
- <div style={{display:"flex", justifyContent:"space-between"}}>
|
|
|
- <Col>
|
|
|
- <Search
|
|
|
- style={{display:"inline"}}
|
|
|
- placeholder="input search text"
|
|
|
- onSearch={value => console.log(value)}
|
|
|
- enterButton
|
|
|
- />
|
|
|
- </Col>
|
|
|
- <Col>
|
|
|
- <Button>显示影响</Button>
|
|
|
- <Button>新增策略</Button>
|
|
|
- </Col>
|
|
|
- </div>) }
|
|
|
- }
|
|
|
- />
|
|
|
+ <div>
|
|
|
+ <Table
|
|
|
+ columns={columns}
|
|
|
+ dataSource={data}
|
|
|
+ bordered
|
|
|
+ title={() => {
|
|
|
+ return (
|
|
|
+ <div style={{ display: "flex", justifyContent: "space-between" }}>
|
|
|
+ <Col>
|
|
|
+ <Search
|
|
|
+ style={{ display: "inline" }}
|
|
|
+ placeholder="input search text"
|
|
|
+ onSearch={value => console.log(value)}
|
|
|
+ enterButton
|
|
|
+ />
|
|
|
+ </Col>
|
|
|
+ <Col>
|
|
|
+ <Button>新增策略</Button>
|
|
|
+ </Col>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <DistributeObjectBox
|
|
|
+ visibleDistributeObjectBox={visibleDistributeObjectBox}
|
|
|
+ onCancel={this.hideDistributeObjectBox}
|
|
|
+ />
|
|
|
+ <DistributePolicyRuleBox
|
|
|
+ visibleDistributePolicyRuleBox={visibleDistributePolicyRuleBox}
|
|
|
+ onCancel={this.hideDistributePolicyRuleBox}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
</Modal>
|
|
|
)
|
|
|
|