bee-table/demo/demolist/Demo0404.js

104 lines
2.9 KiB
JavaScript
Raw Permalink Normal View History

2019-04-19 17:04:39 +08:00
/**
*
* @title 数据关联
* @parent 列渲染 Custom Render
* @description 数据行关联自定义菜单显示
2019-04-23 20:11:38 +08:00
* demo0404
2019-04-19 17:04:39 +08:00
*/
import React, { Component } from 'react';
import {Icon,Checkbox,Dropdown,Menu} from 'tinper-bee';
import Table from '../../src';
2019-04-23 18:25:34 +08:00
import multiSelect from "../../src/lib/newMultiSelect";
2019-04-19 17:04:39 +08:00
import sort from "../../src/lib/sort";
const { Item } = Menu;
const data = [
{
num:"NU0391025",
name: "aa",
sex: "男",
dept:'财务二科',
rank:"T1",
year:"1",
seniority:"1",
key: "1"
},
{
num:"NU0391026",
name: "bb",
sex: "女",
dept:'财务一科',
rank:"M1",
year:"1",
seniority:"1",
key: "2"
},
{
num:"NU0391027",
name: "dd",
sex: "女",
dept:'财务一科',
rank:"T2",
year:"2",
seniority:"2",
key: "3"
}
];
const MultiSelectTable = multiSelect(Table, Checkbox);
const ComplexTable = sort(MultiSelectTable, Icon);
2020-07-16 09:31:03 +08:00
class Demo13 extends Component {
2019-04-19 17:04:39 +08:00
constructor(props) {
super(props);
}
getSelectedDataFunc = data => {
console.log(data);
}
onSelect = (item) => {
console.log(item);
}
render() {
const menu1 = (
<Menu
onSelect={this.onSelect}>
<Item key="1">模态弹出</Item>
<Item key="2">链接跳转</Item>
<Item key="3">打开新页</Item>
</Menu>);
let columns = [
{ title: "关联",dataIndex: "link",key: "link",width: 80,
render: (text, record, index) => {
return (
<Dropdown
trigger={['click']}
overlay={menu1}
animation="slide-up"
>
2019-04-25 16:09:48 +08:00
<Icon type="uf-link" style={{color:'rgb(0, 72, 152)',fontSize:'12px'}}></Icon>
2019-04-19 17:04:39 +08:00
</Dropdown>
)
}
},
{ title: "员工编号",dataIndex: "num",key: "num",width: 200 },
{ title: "员工姓名",dataIndex: "name",key: "name", width: 200},
{ title: "员工性别",dataIndex: "sex",key: "sex",width: 200 },
{ title: "部门",dataIndex: "dept",key: "dept",width: 200},
{ title: "职级",dataIndex: "rank",key: "rank",width: 200},
{ title: "工龄",dataIndex: "year",key: "year",width: 200},
{ title: "司龄",dataIndex: "seniority",key: "seniority",width: 200}
];
return <ComplexTable
bordered
columns={columns}
data={data}
multiSelect={{type: "checkbox"}}
getSelectedDataFunc={this.getSelectedDataFunc}
autoCheckedByClickRows={false} //行点击是否触发勾选动作
2019-04-19 17:04:39 +08:00
/>
}
}
2020-07-16 09:31:03 +08:00
export default Demo13;