人员详情

master
wangyunfei 2 weeks ago
parent 9f4005cbef
commit 13aed53204

@ -12,7 +12,6 @@ import {
import {connect, history} from '@umijs/max'; import {connect, history} from '@umijs/max';
import {Button, Card, Divider, Dropdown, message, Modal, Popconfirm, Space, Switch, Tag,Row,Col} from 'antd'; import {Button, Card, Divider, Dropdown, message, Modal, Popconfirm, Space, Switch, Tag,Row,Col} from 'antd';
import StandardTable from '@/components/StandardTable'; import StandardTable from '@/components/StandardTable';
import { MyIcon } from "@/components/Icon" import { MyIcon } from "@/components/Icon"
import style from "@/global.less"; import style from "@/global.less";
import TimeSheetCreateForm from './form/TimeSheetCreateForm'; //新增表单 import TimeSheetCreateForm from './form/TimeSheetCreateForm'; //新增表单

@ -2,34 +2,31 @@ import React, { PureComponent } from 'react';
import { import {
Card, Card,
Tree, Tree,
Input,
Button, Button,
Table,
Select, Select,
Space, Space,
Pagination,
Row, Row,
Col, Col,
Form, Pagination
} from 'antd'; } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import { import {
SearchOutlined,
ExpandOutlined, ExpandOutlined,
DownloadOutlined,
UserOutlined, UserOutlined,
TeamOutlined, TeamOutlined,
ApartmentOutlined, ApartmentOutlined,
SyncOutlined, SyncOutlined,
DollarOutlined, DollarOutlined,
SettingOutlined, SettingOutlined,
ClearOutlined, DownloadOutlined,
UserAddOutlined, UserAddOutlined,
EditOutlined, EditOutlined,
DeleteOutlined DeleteOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import styles from './StaffInfo.less'; import styles from './StaffInfo.less';
import StaffInfoAdd from './from/StaffInfoadd'; import StandardTable from '@/components/StandardTable';
import StaffInfoAdd from './form/StaffInfoadd';
import StaffInfoRenderSimpleForm from "./form/StaffInfoRenderSimpleForm" //表单
const { Option } = Select; const { Option } = Select;
@ -164,95 +161,9 @@ class StaffInfo extends PureComponent {
total: 356, total: 356,
} }
}; };
}
// 获取处理后的树形数据
getTreeData = () => {
const { organizationData } = this.state;
const processNode = (node) => ({
key: node.key,
title: (
<span className={styles['tree-node-title']}>
{this.getNodeIcon(node.title)}
<span className={styles['node-title']}>{node.title}</span>
<span className={styles['node-count']}>({node.count})</span>
</span>
),
children: node.children ? node.children.map(processNode) : undefined
});
return organizationData.map(processNode);
};
// 获取节点图标
getNodeIcon = (title) => {
if (title.includes('公司') || title.includes('集团')) return <ApartmentOutlined style={{ color: '#1890ff' }} />;
if (title.includes('技术') || title.includes('开发') || title.includes('测试')) return <SettingOutlined style={{ color: '#52c41a' }} />;
if (title.includes('产品') || title.includes('设计') || title.includes('体验')) return <TeamOutlined style={{ color: '#fa8c16' }} />;
if (title.includes('运营') || title.includes('市场') || title.includes('客户') || title.includes('商务')) return <TeamOutlined style={{ color: '#eb2f96' }} />;
if (title.includes('财务') || title.includes('会计') || title.includes('审计')) return <DollarOutlined style={{ color: '#722ed1' }} />;
if (title.includes('人事') || title.includes('HR') || title.includes('招聘') || title.includes('培训') || title.includes('薪酬')) return <UserOutlined style={{ color: '#13c2c2' }} />;
return <TeamOutlined style={{ color: '#666' }} />;
};
// 组织架构树数据 (保留原始数据以备后用)
treeData = [
{
title: '飞利信科技有限公司',
key: '0-0',
icon: <ApartmentOutlined />,
children: [
{
title: '技术部',
key: '0-0-0',
icon: <TeamOutlined />,
children: [
{
title: '前端组',
key: '0-0-0-0',
icon: <UserOutlined />
},
{
title: '后端组',
key: '0-0-0-1',
icon: <UserOutlined />
},
],
},
{
title: '产品部',
key: '0-0-1',
icon: <TeamOutlined />,
children: [
{
title: '产品设计组',
key: '0-0-1-0',
icon: <UserOutlined />
},
],
},
{
title: '运营部',
key: '0-0-2',
icon: <TeamOutlined />,
},
{
title: '财务部',
key: '0-0-3',
icon: <TeamOutlined />,
},
{
title: '人事部',
key: '0-0-4',
icon: <TeamOutlined />,
},
],
},
];
// 表格列配置 // 默认列配置
columns = [ this.defaultColumns = [
{ {
title: '序号', title: '序号',
dataIndex: 'id', dataIndex: 'id',
@ -316,6 +227,7 @@ class StaffInfo extends PureComponent {
size="small" size="small"
icon={<EditOutlined />} icon={<EditOutlined />}
title="编辑" title="编辑"
onClick={() => this.handleEdit(record)}
/> />
<Button <Button
type="link" type="link"
@ -323,11 +235,43 @@ class StaffInfo extends PureComponent {
danger danger
icon={<DeleteOutlined />} icon={<DeleteOutlined />}
title="删除" title="删除"
onClick={() => this.handleDelete(record)}
/> />
</Space> </Space>
), ),
}, },
]; ];
}
// 获取处理后的树形数据
getTreeData = () => {
const { organizationData } = this.state;
const processNode = (node) => ({
key: node.key,
title: (
<span className={styles['tree-node-title']}>
{this.getNodeIcon(node.title)}
<span className={styles['node-title']}>{node.title}</span>
<span className={styles['node-count']}>({node.count})</span>
</span>
),
children: node.children ? node.children.map(processNode) : undefined
});
return organizationData.map(processNode);
};
// 获取节点图标
getNodeIcon = (title) => {
if (title.includes('公司') || title.includes('集团')) return <ApartmentOutlined style={{ color: '#1890ff' }} />;
if (title.includes('技术') || title.includes('开发') || title.includes('测试')) return <SettingOutlined style={{ color: '#52c41a' }} />;
if (title.includes('产品') || title.includes('设计') || title.includes('体验')) return <TeamOutlined style={{ color: '#fa8c16' }} />;
if (title.includes('运营') || title.includes('市场') || title.includes('客户') || title.includes('商务')) return <TeamOutlined style={{ color: '#eb2f96' }} />;
if (title.includes('财务') || title.includes('会计') || title.includes('审计')) return <DollarOutlined style={{ color: '#722ed1' }} />;
if (title.includes('人事') || title.includes('HR') || title.includes('招聘') || title.includes('培训') || title.includes('薪酬')) return <UserOutlined style={{ color: '#13c2c2' }} />;
return <TeamOutlined style={{ color: '#666' }} />;
};
// 搜索处理 // 搜索处理
handleSearch = (values) => { handleSearch = (values) => {
@ -354,7 +298,7 @@ class StaffInfo extends PureComponent {
// 刷新树数据 // 刷新树数据
handleTreeRefresh = () => { handleTreeRefresh = () => {
console.log('刷新组织架构'); // console.log('刷新组织架构');
// 这里可以添加刷新树数据的逻辑 // 这里可以添加刷新树数据的逻辑
}; };
@ -380,6 +324,40 @@ class StaffInfo extends PureComponent {
} }
}; };
renderSimpleForm() {
const { prooperlog = {} } = this.props;
const { params = {} } = prooperlog;
const parentMethods = {
handleSearch: this.handleSearch,
handleFormReset: this.handleFormReset,
toggleForm: this.toggleForm,
submitButtons: styles.submitButtons,
params
};
return (
<StaffInfoRenderSimpleForm {...parentMethods} />
);
}
renderAdvancedForm() {
const { prooperlog: { params } } = this.props;
const parentMethods = {
handleSearch: this.handleSearch,
handleFormReset: this.handleFormReset,
toggleForm: this.toggleForm,
params
};
return (
<StaffInfoRenderSimpleForm {...parentMethods} />
);
}
renderForm() {
const { expandForm } = this.state;
return expandForm ? this.renderAdvancedForm() : this.renderSimpleForm();
}
// 分页处理 // 分页处理
onPaginationChange = (page, pageSize) => { onPaginationChange = (page, pageSize) => {
this.setState({ this.setState({
@ -435,6 +413,18 @@ class StaffInfo extends PureComponent {
history.push(`/topnavbar00/staffmanage/particulars`); history.push(`/topnavbar00/staffmanage/particulars`);
}; };
// 处理编辑
handleEdit = (record) => {
console.log('编辑员工:', record);
// 这里可以打开编辑弹窗或跳转到编辑页面
};
// 处理删除
handleDelete = (record) => {
console.log('删除员工:', record);
// 这里可以弹出确认框并执行删除操作
};
render() { render() {
const { tableData, pagination, expandedKeys, addModalVisible, addLoading } = this.state; const { tableData, pagination, expandedKeys, addModalVisible, addLoading } = this.state;
@ -492,100 +482,7 @@ class StaffInfo extends PureComponent {
<Col span={19}> <Col span={19}>
{/* 筛选条件 */} {/* 筛选条件 */}
<Card className={styles.searchCard}> <Card className={styles.searchCard}>
<Form {this.renderForm()}
ref={(ref) => this.formRef = ref}
onFinish={this.handleSearch}
layout="vertical"
>
<Row gutter={12}>
<Col span={8}>
<Form.Item
name="name"
label="姓名"
>
<Input
placeholder="请输入姓名"
// prefix={<UserOutlined />}
/>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="phone"
label="电话"
>
<Input
placeholder="请输入电话"
// prefix={<PhoneOutlined />}
/>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="idCard"
label="身份证号"
>
<Input
placeholder="请输入身份证号"
// prefix={<IdcardOutlined />}
/>
</Form.Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={8}>
<Form.Item
name="department"
label="部门"
>
<Select placeholder="请选择部门">
<Option value="技术部">技术部</Option>
<Option value="产品部">产品部</Option>
<Option value="运营部">运营部</Option>
<Option value="财务部">财务部</Option>
<Option value="人事部">人事部</Option>
</Select>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="position"
label="岗位"
>
<Select placeholder="请选择岗位">
<Option value="高级工程师">高级工程师</Option>
<Option value="产品经理">产品经理</Option>
<Option value="运营专员">运营专员</Option>
<Option value="会计">会计</Option>
<Option value="HR专员">HR专员</Option>
</Select>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item label=" " colon={false}>
<Space size="middle">
<Button
type="primary"
htmlType="submit"
icon={<SearchOutlined />}
size="large"
className={styles.searchButton}
>
查询
</Button>
<Button
onClick={this.handleReset}
icon={<ClearOutlined />}
size="large"
className={styles.resetButton}
>
重置
</Button>
</Space>
</Form.Item>
</Col>
</Row>
</Form>
</Card> </Card>
{/* 操作按钮和统计 */} {/* 操作按钮和统计 */}
@ -615,12 +512,13 @@ class StaffInfo extends PureComponent {
{/* 人员表格 */} {/* 人员表格 */}
<Card className={styles.tableCard}> <Card className={styles.tableCard}>
<Table <StandardTable
columns={this.columns} columns={this.defaultColumns}
dataSource={tableData} dataSource={tableData}
pagination={false} pagination={false}
// scroll={{ x: 1200 }} scroll={{ x: 1000,y: 600 }}
size="small" size="small"
selectedRows={[]}
/> />
{/* 分页 */} {/* 分页 */}
@ -656,4 +554,4 @@ class StaffInfo extends PureComponent {
} }
} }
export default StaffInfo export default StaffInfo;

@ -71,7 +71,9 @@
align-items: center; align-items: center;
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
} .treeContainer { }
.treeContainer {
height: 520px; height: 520px;
overflow-y: auto; overflow-y: auto;
@ -193,7 +195,9 @@
.anticon { .anticon {
color: #95a5a6 !important; color: #95a5a6 !important;
} /* 搜索按钮样式 */ }
/* 搜索按钮样式 */
.searchButton { .searchButton {
background: linear-gradient(135deg, #2d5cf6 0%, #4c7bff 100%); background: linear-gradient(135deg, #2d5cf6 0%, #4c7bff 100%);
border: none; border: none;
@ -249,6 +253,9 @@
} }
.actionBar { .actionBar {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
@ -260,7 +267,6 @@
font-weight: 500; font-weight: 500;
} }
/* 导出按钮样式 */
.exportButton { .exportButton {
background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%); background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
border: none; border: none;
@ -292,7 +298,7 @@
} }
} }
/* 新增按钮样式 */
.addButton { .addButton {
background: linear-gradient(135deg, #fa8c16 0%, #ffa940 100%); background: linear-gradient(135deg, #fa8c16 0%, #ffa940 100%);
border: none; border: none;
@ -392,6 +398,82 @@
} }
} }
} }
.tableCard {
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
padding-bottom: 10px;
.ant-table-wrapper {
max-height: 600px;
overflow-y: auto;
/* 自定义滚动条样式 */
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-track {
background: #f5f5f5;
border-radius: 4px;
}
&::-webkit-scrollbar-thumb {
background: #d9d9d9;
border-radius: 4px;
&:hover {
background: #bfbfbf;
}
}
.ant-table-thead>tr>th {
background-color: #fafafa;
font-weight: 600;
color: #333;
border-bottom: 1px solid #e8e8e8;
position: sticky;
top: 0;
z-index: 1;
}
.ant-table-tbody>tr {
&:hover>td {
background-color: #f5f5f5 !important;
}
>td {
border-bottom: 1px solid #f0f0f0;
}
}
}
.paginationWrapper {
margin-top: 20px;
text-align: right;
.ant-pagination {
.ant-pagination-total-text {
color: #666;
}
.ant-pagination-item {
border-radius: 4px;
&.ant-pagination-item-active {
background-color: #fff;
border-color: #2d5cf6;
}
}
.ant-pagination-prev,
.ant-pagination-next {
border-radius: 4px;
}
}
}
}
} }
} }
@ -562,79 +644,7 @@
} }
} }
.tableCard {
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
padding-bottom: 10px;
.ant-table-wrapper {
max-height: 600px;
overflow-y: auto;
/* 自定义滚动条样式 */
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-track {
background: #f5f5f5;
border-radius: 4px;
}
&::-webkit-scrollbar-thumb {
background: #d9d9d9;
border-radius: 4px;
&:hover {
background: #bfbfbf;
}
}
.ant-table-thead>tr>th {
background-color: #fafafa;
font-weight: 600;
color: #333;
border-bottom: 1px solid #e8e8e8;
position: sticky;
top: 0;
z-index: 1;
}
.ant-table-tbody>tr {
&:hover>td {
background-color: #f5f5f5 !important;
}
>td {
border-bottom: 1px solid #f0f0f0;
}
}
}
.paginationWrapper {
margin-top: 20px;
text-align: right;
.ant-pagination {
.ant-pagination-total-text {
color: #666;
}
.ant-pagination-item {
border-radius: 4px;
&.ant-pagination-item-active {
background-color: #2d5cf6;
border-color: #2d5cf6;
}
}
.ant-pagination-prev,
.ant-pagination-next {
border-radius: 4px;
}
}
}
}
:global { :global {
.ant-card-body { .ant-card-body {

@ -0,0 +1,141 @@
import React, { useState } from 'react';
import { Button, Col, Form, Input, Row, message,Select, Space } from 'antd';
import { ClearOutlined,SearchOutlined } from '@ant-design/icons';
import styles from "../StaffInfo.less";
const FormItem = Form.Item;
const StaffInfoRenderSimpleForm = (props) => {
const [form] = Form.useForm();
const [startDateOpen, setStartDateOpen] = useState(false);
const [endDateOpen, setEndDateOpen] = useState(false);
const { submitButtons, handleSearch, handleFormReset, toggleForm, params } = props;
React.useEffect(() => {
form.setFieldsValue({
opername: params?.opername,
opertype: params?.opertype,
});
}, [params]);
const onFinish = values => {
const params = {
...values,
startDate: values.startDate ? values.startDate.format('YYYY-MM-DD') : undefined,
endDate: values.endDate ? values.endDate.format('YYYY-MM-DD') : undefined,
};
handleSearch(params);
};
const myhandleFormReset = () => {
form.resetFields();
handleFormReset();
};
const onEndDateChange = (value) => {
const startDate = form.getFieldValue("startDate");
if (startDate && value && value.isBefore(startDate, "day")) {
message.error("结束日期不能小于开始日期!");
// 清空
form.setFieldsValue({ endDate: undefined });
}
}
return (
<div >
<Form
// ref={(ref) => this.formRef = ref}
// onFinish={this.handleSearch}
layout="vertical"
>
<Row gutter={12}>
<Col span={8}>
<Form.Item
name="name"
label="姓名"
>
<Input
placeholder="请输入姓名"
/>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="phone"
label="电话"
>
<Input
placeholder="请输入电话"
// prefix={<PhoneOutlined />}
/>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="idCard"
label="身份证号"
>
<Input
placeholder="请输入身份证号"
// prefix={<IdcardOutlined />}
/>
</Form.Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={8}>
<Form.Item
name="department"
label="部门"
>
<Select placeholder="请选择部门">
<Option value="技术部">技术部</Option>
<Option value="产品部">产品部</Option>
<Option value="运营部">运营部</Option>
<Option value="财务部">财务部</Option>
<Option value="人事部">人事部</Option>
</Select>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="position"
label="岗位"
>
<Select placeholder="请选择岗位">
<Option value="高级工程师">高级工程师</Option>
<Option value="产品经理">产品经理</Option>
<Option value="运营专员">运营专员</Option>
<Option value="会计">会计</Option>
<Option value="HR专员">HR专员</Option>
</Select>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item label=" " colon={false}>
<Space size="middle">
<Button
type="primary"
htmlType="submit"
icon={<SearchOutlined />}
size="large"
className={styles.searchButton}
>
查询
</Button>
<Button
// onClick={this.handleReset}
icon={<ClearOutlined />}
size="large"
className={styles.resetButton}
>
重置
</Button>
</Space>
</Form.Item>
</Col>
</Row>
</Form>
</div>
);
};
export default StaffInfoRenderSimpleForm;
Loading…
Cancel
Save