2018-12-21 09:58:52 +08:00
|
|
|
|
/**
|
|
|
|
|
*
|
2019-04-15 20:14:02 +08:00
|
|
|
|
* @title 基本表格
|
2019-04-18 10:50:38 +08:00
|
|
|
|
* @parent 基础 Basic
|
2019-04-23 20:11:38 +08:00
|
|
|
|
* @description 单元格数据过长时,可结合Tooltip组件使用。
|
|
|
|
|
* demo0101
|
2018-12-21 09:58:52 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React, { Component } from "react";
|
2019-04-15 20:14:02 +08:00
|
|
|
|
import {Button,Tooltip} from "tinper-bee";
|
2018-12-21 09:58:52 +08:00
|
|
|
|
import Table from "../../src";
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
2019-04-23 20:11:38 +08:00
|
|
|
|
title: "员工编号", dataIndex: "a", key: "a", width: 120, className: "rowClassName",
|
2019-02-25 16:44:05 +08:00
|
|
|
|
fixed:'left',
|
2018-12-21 09:58:52 +08:00
|
|
|
|
render: (text, record, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<Tooltip inverse overlay={text}>
|
|
|
|
|
<span tootip={text} style={{
|
2019-04-25 14:12:43 +08:00
|
|
|
|
display: "block",
|
2019-04-18 15:31:24 +08:00
|
|
|
|
width: "80px",
|
2018-12-21 09:58:52 +08:00
|
|
|
|
textOverflow: "ellipsis",
|
|
|
|
|
overflow: "hidden",
|
|
|
|
|
whiteSpace: "nowrap",
|
2019-04-25 14:12:43 +08:00
|
|
|
|
verticalAlign: "bottom",
|
2018-12-21 09:58:52 +08:00
|
|
|
|
}}>{text}</span>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-04-23 20:11:38 +08:00
|
|
|
|
{ title: "员工姓名", dataIndex: "b", key: "b", width:100 },
|
|
|
|
|
{ title: "性别", dataIndex: "c", key: "c", width: 100 },
|
|
|
|
|
{ title: "部门", dataIndex: "d", key: "d", width: 100 },
|
|
|
|
|
{ title: "职级", dataIndex: "e", key: "e", width: 100 }
|
2018-12-21 09:58:52 +08:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const data = [
|
2019-04-23 20:11:38 +08:00
|
|
|
|
{ a: "ASVAL_201903280005", b: "小张", c: "男", d: "财务二科", e: "M1", key: "1" },
|
|
|
|
|
{ a: "ASVAL_201903200004", b: "小明", c: "男", d: "财务一科", e: "T1", key: "2" },
|
|
|
|
|
{ a: "ASVAL_201903120002", b: "小红", c: "女", d: "财务一科", e: "T2", key: "3" }
|
2018-12-21 09:58:52 +08:00
|
|
|
|
];
|
|
|
|
|
|
2019-04-16 13:35:25 +08:00
|
|
|
|
class Demo01 extends Component {
|
2018-12-21 09:58:52 +08:00
|
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
2019-04-16 13:35:25 +08:00
|
|
|
|
data: data
|
2018-12-21 09:58:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-15 20:14:02 +08:00
|
|
|
|
handleClick = () => {
|
|
|
|
|
console.log('这是第' , this.currentIndex , '行');
|
|
|
|
|
console.log('内容:' , this.currentRecord);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-21 09:58:52 +08:00
|
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<Table
|
|
|
|
|
columns={columns}
|
|
|
|
|
data={data}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-16 13:35:25 +08:00
|
|
|
|
export default Demo01;
|