import React, { Fragment, PureComponent } from 'react';
import {
    DeleteOutlined,
    EditOutlined,
    PlusOutlined,
    SearchOutlined,
    RedoOutlined,
    DownOutlined,
    ExclamationCircleFilled,
    UpOutlined,
} from '@ant-design/icons';
import { connect, history } from '@umijs/max';
import { Button, Input, Card, Divider, Dropdown, message, Modal, Popconfirm, Space, Switch, Tag, Row, Col, Table } from 'antd';
import StandardTable from '@/components/StandardTable';

import { MyIcon } from "@/components/Icon"
import style from "@/global.less";
import TimeSheetCreateForm from './form/TimeSheetCreateForm'; //新增表单
import TimeSheetUpdateForm from './form/TimeSheetUpdateForm'; //修改表单
import TimeSheetViewForm from './form/TimeSheetViewForm'; //查看表单
import TimeSheetRenderSimpleForm from './form/TimeSheetRenderSimpleForm'; //简单查询表单
import TimeSheetRenderAdvancedForm from './form/TimeSheetRenderAdvancedForm'; //高级查询表单
import styles from './TimeSheetList.less';
import datadictionary from "@/utils/dataDictionary";
import { formatDate } from "@/utils/formatUtils";
import { formatDictText, checkButtonAuthority } from "@/utils/globalCommon";

const { confirm } = Modal;

//预约类型
const sex_type = datadictionary.sex
const user_status = datadictionary.user_status
const sys_user_post = datadictionary.sys_user_post

const mockData = {
    list: [
        {
            ygh: "A00001",
            xm: "员工1",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心内科",
            kqsc: 8,
            zysc: 7,
            kxsc: 1,
        },
        {
            ygh: "A00002",
            xm: "员工2",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心外科",
            kqsc: 8,
            zysc: 6,
            kxsc: 2,
        },
        {
            ygh: "A00003",
            xm: "员工3",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "康复科",
            kqsc: 8,
            zysc: 8,
            kxsc: 0,
        },
        {
            ygh: "A00004",
            xm: "员工4",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心内科",
            kqsc: 8,
            zysc: 7,
            kxsc: 1,
        },
        {
            ygh: "A00005",
            xm: "员工5",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心外科",
            kqsc: 8,
            zysc: 6,
            kxsc: 2,
        },
        {
            ygh: "A00006",
            xm: "员工6",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "康复科",
            kqsc: 8,
            zysc: 8,
            kxsc: 0,
        },
        {
            ygh: "A00007",
            xm: "员工7",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心内科",
            kqsc: 8,
            zysc: 7,
            kxsc: 1,
        },
        {
            ygh: "A00008",
            xm: "员工8",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心外科",
            kqsc: 8,
            zysc: 6,
            kxsc: 2,
        },
        {
            ygh: "A00009",
            xm: "员工9",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "康复科",
            kqsc: 8,
            zysc: 8,
            kxsc: 0,
        },
        {
            ygh: "A000010",
            xm: "员工10",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心内科",
            kqsc: 8,
            zysc: 7,
            kxsc: 1,
        },
        {
            ygh: "A000011",
            xm: "员工11",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心外科",
            kqsc: 8,
            zysc: 6,
            kxsc: 2,
        },
        {
            ygh: "A000012",
            xm: "员工12",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "康复科",
            kqsc: 8,
            zysc: 8,
            kxsc: 0,
        },
        {
            ygh: "A000013",
            xm: "员工13",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心内科",
            kqsc: 8,
            zysc: 7,
            kxsc: 1,
        },
        {
            ygh: "A000014",
            xm: "员工14",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心外科",
            kqsc: 8,
            zysc: 6,
            kxsc: 2,
        },
        {
            ygh: "A000015",
            xm: "员工15",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "康复科",
            kqsc: 8,
            zysc: 8,
            kxsc: 0,
        },
        {
            ygh: "A000016",
            xm: "员工16",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心内科",
            kqsc: 8,
            zysc: 7,
            kxsc: 1,
        },
        {
            ygh: "A000017",
            xm: "员工17",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心外科",
            kqsc: 8,
            zysc: 6,
            kxsc: 2,
        },
        {
            ygh: "A000018",
            xm: "员工18",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "康复科",
            kqsc: 8,
            zysc: 8,
            kxsc: 0,
        },
        {
            ygh: "A000019",
            xm: "员工19",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心内科",
            kqsc: 8,
            zysc: 7,
            kxsc: 1,
        },
        {
            ygh: "A000020",
            xm: "员工20",
            rq: "2025/6/10",
            dw: "清河中医院",
            bm: "心外科",
            kqsc: 8,
            zysc: 6,
            kxsc: 2,
        }
    ],
    pagination: {},
}
@connect(({ dataSet, loading }) => ({
    dataSet,
    loading: loading.models.dataSet,
}))

class TimeSheetList extends PureComponent {
    state = {
        modalVisible: false,
        updateModalVisible: false,
        viewModalVisible: false,
        expandForm: false,
        selectedRows: [],
        formValues: {},
        updateFormValues: {},
        viewFormValues: {},
        toggleExpand: false,
        selectedFile: null,
        fileName: '',
        viewKnowledgeModalVisible: false,
        currentKnowledgeId: null,
    }

    columns = [
        {
            title: '序号',
            dataIndex: 'index',
            key: 'index',
            width: 50,
            fixed: 'left',
            render: (_, record, index) => index + 1,
        },
        {
            title: '员工号',
            dataIndex: 'ygh',
            key: 'ygh',
            width: 100,
            fixed: 'left',
        }, {
            title: '姓名',
            dataIndex: 'xm',
            key: 'xm',
            width: 100,
            fixed: 'left',
        }, {
            title: '日期',
            dataIndex: 'rq',
            key: 'rq',
            width: 100,
        }, {
            title: '单位',
            dataIndex: 'dw',
            key: 'dw',
            width: 150,
        }, {
            title: '部门',
            dataIndex: 'bm',
            key: 'bm',
            width: 150,
        }, {
            title: '考勤时长',
            dataIndex: 'kqsc',
            key: 'kqsc',
            width: 100,
        }, {
            title: '作业时长',
            dataIndex: 'zysc',
            key: 'zysc',
            width: 100,
        },
        {
            title: '空闲时长',
            dataIndex: 'kxsc',
            key: 'kxsc',
            width: 100,
        },
        {
            title: '比例图',
            dataIndex: 'blt',
            key: 'blt',
            width: 150,
            render: (text, record) => {
                let workRatio = record.zysc / (record.zysc + record.kxsc) * 100
                return (
                    <Fragment>
                        <div style={{ display: 'flex' }}>
                            <div style={{ height: 30, width: workRatio + '%', background: "#8ddd15" }}></div>
                            <div style={{ height: 30, width: 100 - workRatio + '%', background: "#cccccc" }}></div>
                        </div>
                    </Fragment>
                )
            },
        },
    ]

    componentDidMount() {
        // const { dispatch, timesheet: { params } } = this.props

        // dispatch({
        //     type: 'timesheet/query_page_for_prouser',
        // })

        // this.setState({
        //     expandForm: params?.expandForm || false,
        // })
    }

    handleStandardTableChange = (pagination, sorter) => {
        const { dispatch } = this.props
        const { formValues } = this.state

        const params = {
            currentPage: pagination.current,
            pageSize: pagination.pageSize,
            ...formValues
        }

        sorter.field && (params.sorter = `${sorter.field}_${sorter.order}`)

        // dispatch({
        //     type: 'prouser/query_page_for_prouser',
        //     payload: params
        // })
    }

    handleFormReset = () => {
        const { dispatch } = this.props
        this.setState({
            formValues: {}
        })

        // dispatch({
        //     type: 'prouser/query_page_for_prouser',
        //     payload: {
        //         resetFlag: true
        //     }
        // })
    }

    toggleForm = () => {
        const { expandForm } = this.state
        this.setState({
            expandForm: !expandForm
        })
    }

    handleSelectRows = rows => {
        this.setState({
            selectedRows: rows
        })
    }

    handleSearch = values => {
        const { dispatch } = this.props
        const { expandForm } = this.state

        this.setState({
            formValues: values
        })

        // dispatch({
        //     type: 'prouser/query_page_for_prouser',
        //     payload: {
        //         ...values,
        //         resetFlag: true,
        //         expandForm
        //     }
        // })
    }

    handleModalVisible = flag => {
        this.setState({
            modalVisible: !!flag
        })
    }

    handleUpdateModalVisible = (flag, record) => {
        this.setState({
            updateModalVisible: !!flag,
            updateFormValues: record || {}
        })
    }

    handleViewModalVisible = (flag, record) => {
        this.setState({
            viewModalVisible: !!flag,
            viewFormValues: record || {}
        })
    }

    handleAdd = fields => {
        const { dispatch } = this.props

        dispatch({
            type: 'prouser/insert_for_prouser',
            payload: {
                user_id: fields.user_id,
                user_name: fields.user_name,
                user_name_cn: fields.user_name_cn,
                user_name_en: fields.user_name_en,
                password: fields.password,
                email: fields.email,
                phone: fields.phone,
                landline: fields.landline,
                sex: fields.sex,
                avatar: fields.avatar,
                sign: fields.sign,
                tags: fields.tags,
                id_card: fields.id_card,
                birthday: fields.birthday,
                job_status: fields.job_status,
                hiredate: fields.hiredate,
                departure_time: fields.departure_time,
                user_type: fields.user_type,
                emp_no: fields.emp_no,
                access_card_no: fields.access_card_no,
                country: fields.country,
                province: fields.province,
                city: fields.city,
                address: fields.address,
                work_addr: fields.work_addr,
                floor: fields.floor,
                inprovince: fields.inprovince,
                // dept_code: fields.dept_code,
                // dept_name: fields.dept_name,
                inner_dept_code: fields.inner_dept_code,
                org_code: fields.org_code,
                org_name: fields.org_name,
                inner_org_code: fields.inner_org_code,
                posts: fields.posts,
                wx_openid: fields.wx_openid,
                wx_mpopenid: fields.wx_mpopenid,
                wx_miniopenid: fields.wx_miniopenid,
                wx_unionid: fields.wx_unionid,
                mobile_imei: fields.mobile_imei,
                device_num: fields.device_num,
                al_taobao: fields.al_taobao,
                al_alipay: fields.al_alipay,
                al_dingding: fields.al_dingding,
                is_system_user: fields.is_system_user,
                mgr_type: fields.mgr_type,
                pwd_security_level: fields.pwd_security_level,
                pwd_update_date: fields.pwd_update_date,
                last_login_ip: fields.last_login_ip,
                last_login_date: fields.last_login_date,
                freeze_date: fields.freeze_date,
                freeze_cause: fields.freeze_cause,
                zindex: fields.zindex,
                wx_msg: fields.wx_msg,
                email_msg: fields.email_msg,
                system_msg: fields.system_msg,
                remarks: fields.remarks,
                status: fields.status,
                creator: fields.creator,
                create_date: fields.create_date,
                updater: fields.updater,
                update_date: fields.update_date
            },
            callback: (res) => {
                if (res.success == true) {
                    message.success('添加成功')
                    this.handleModalVisible()
                }
            }
        })
    }

    handleDeleteRecord = record => {
        const { dispatch } = this.props

        dispatch({
            type: 'prouser/delete_by_primarykey_for_prouser',
            payload: {
                recordid: record.user_id
            },
            callback: res => {
                if (res.success) {
                    message.success('删除成功')

                    this.setState({
                        selectedRows: []
                    })
                }
            }
        })
    }

    handleUpdate = fields => {
        const { dispatch } = this.props

        dispatch({
            type: 'prouser/update_for_prouser',
            payload: {
                user_id: fields.user_id,
                user_name: fields.user_name,
                user_name_cn: fields.user_name_cn,
                user_name_en: fields.user_name_en,
                password: fields.password,
                email: fields.email,
                phone: fields.phone,
                landline: fields.landline,
                sex: fields.sex,
                avatar: fields.avatar,
                sign: fields.sign,
                tags: fields.tags,
                id_card: fields.id_card,
                birthday: fields.birthday,
                job_status: fields.job_status,
                hiredate: fields.hiredate,
                departure_time: fields.departure_time,
                user_type: fields.user_type,
                emp_no: fields.emp_no,
                access_card_no: fields.access_card_no,
                country: fields.country,
                province: fields.province,
                city: fields.city,
                address: fields.address,
                work_addr: fields.work_addr,
                floor: fields.floor,
                inprovince: fields.inprovince,
                // dept_code: fields.dept_code,
                // dept_name: fields.dept_name,
                inner_dept_code: fields.inner_dept_code,
                org_code: fields.org_code,
                org_name: fields.org_name,
                inner_org_code: fields.inner_org_code,
                posts: fields.posts,
                wx_openid: fields.wx_openid,
                wx_mpopenid: fields.wx_mpopenid,
                wx_miniopenid: fields.wx_miniopenid,
                wx_unionid: fields.wx_unionid,
                mobile_imei: fields.mobile_imei,
                device_num: fields.device_num,
                al_taobao: fields.al_taobao,
                al_alipay: fields.al_alipay,
                al_dingding: fields.al_dingding,
                is_system_user: fields.is_system_user,
                mgr_type: fields.mgr_type,
                pwd_security_level: fields.pwd_security_level,
                pwd_update_date: fields.pwd_update_date,
                last_login_ip: fields.last_login_ip,
                last_login_date: fields.last_login_date,
                freeze_date: fields.freeze_date,
                freeze_cause: fields.freeze_cause,
                zindex: fields.zindex,
                wx_msg: fields.wx_msg,
                email_msg: fields.email_msg,
                system_msg: fields.system_msg,
                remarks: fields.remarks,
                status: fields.status,
                creator: fields.creator,
                create_date: fields.create_date,
                updater: fields.updater,
                update_date: fields.update_date
            },
            callback: (res) => {
                if (res.success === true) {
                    message.success('修改成功')
                    this.handleUpdateModalVisible()
                }
            }
        })
    }

    // 修改用户状态
    handleUpdateUserStatus = (fields, status, msg) => {
        const { dispatch } = this.props

        confirm({
            title: `确定要 ${msg} 当前用户的吗?`,
            icon: <ExclamationCircleFilled />,
            onOk() {
                dispatch({
                    type: 'prouser/update_for_prouser',
                    payload: {
                        user_id: fields.user_id,
                        status: status,
                    },
                    callback: (res) => {
                        if (res.success === true) {
                            message.success('修改成功')
                        }
                    }
                })
            }
        })
    }

    // 修改用户密码
    handleUpdateUserPassword = fields => {
        const { dispatch } = this.props
        confirm({
            title: '确定要重置当前用户的密码吗?',
            icon: <ExclamationCircleFilled />,
            onOk() {
                dispatch({
                    type: 'prouser/resetpwd_for_prouser',
                    payload: {
                        user_id: fields.user_id
                    },
                    callback: (res) => {
                        if (res.success === true) {
                            message.success('重置成功')
                        }
                    }
                })
            }
        })
    }

    renderSimpleForm() {
        const { dataSet: { params } } = this.props
        const parentMethods = {
            handleSearch: this.handleSearch,
            handleFormReset: this.handleFormReset,
            toggleForm: this.toggleForm,
            params
        }

        return <TimeSheetRenderSimpleForm {...parentMethods} />
    }

    renderAdvancedForm() {
        const { dispatch, prouser: { selectDeptTree, selectOrganTree, params } } = this.props
        const parentMethods = {
            handleSearch: this.handleSearch,
            handleFormReset: this.handleFormReset,
            toggleForm: this.toggleForm,
            dispatch: dispatch,
            selectDeptTree: selectDeptTree,
            selectOrganTree: selectOrganTree,
            params
        }

        return <TimeSheetRenderAdvancedForm {...parentMethods} />
    }

    renderForm() {
        const { expandForm } = this.state
        return expandForm ? this.renderAdvancedForm() : this.renderSimpleForm()
    }

    handleCollapse = () => {
        const { toggleExpand } = this.state
        this.setState({
            toggleExpand: !toggleExpand
        })
    }

    // 处理文件选择
    handleFileSelect = (e) => {
        const file = e.target.files[0];
        if (file) {
            this.setState({
                selectedFile: file,
                fileName: file.name
            }, () => {
                // 自动上传文件
                this.uploadFile();
            });
        }
    }

    // 点击按钮触发文件选择
    triggerFileSelect = () => {
        this.fileInputRef.current.click();
    }

    // 文件上传
    uploadFile = async () => {
        const { selectedFile } = this.state;
        if (!selectedFile) return;

        try {
            const formData = new FormData();
            formData.append('file', selectedFile);

            message.loading('文件上传中...');
            
            // 调用上传接口
            const response = await fetch('http://192.168.13.131:8080/api/upload/word', {
                method: 'POST',
                body: formData,
            });

            if (response.ok) {
                const data = await response.json();
                message.success('文件上传成功！');
                console.log('上传成功，返回数据:', data);
                // 可以在这里处理上传成功后的逻辑
            } else {
                throw new Error('上传失败');
            }
        } catch (error) {
            message.error('文件上传失败：' + error.message);
            console.error('上传错误:', error);
        }
    }

    // 处理查看知识条目
    handleViewKnowledge = (id) => {
        console.log('查看知识条目:', id);
        // 设置当前选中的知识ID并打开模态框
        this.setState({ 
            viewKnowledgeModalVisible: true, 
            currentKnowledgeId: id 
        });
    }

    // 创建一个文件输入框的引用
    fileInputRef = React.createRef();

    render() {
        const {
            dataSet: {
                data,
                selectDeptTree,
                selectOrganTree
            },
            loading,
            dispatch
        } = this.props
        const {
            selectedRows,
            modalVisible,
            updateModalVisible,
            viewModalVisible,
            updateFormValues,
            viewFormValues,
            toggleExpand,
            fileName
        } = this.state

        const parentMethods = {
            handleAdd: this.handleAdd,
            handleModalVisible: this.handleModalVisible,
            dispatch: dispatch,
            loading,
            selectDeptTree: selectDeptTree,
            selectOrganTree: selectOrganTree
        }

        const updateMethods = {
            handleUpdateModalVisible: this.handleUpdateModalVisible,
            handleUpdate: this.handleUpdate,
            dispatch: dispatch,
            loading,
            selectDeptTree: selectDeptTree,
            selectOrganTree: selectOrganTree
        }

        const viewMethods = {
            handleViewModalVisible: this.handleViewModalVisible
        }

        return (
            <>
                <Card bordered={false}>
                    <div style={{ marginBottom: '15px', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
                        <div>
                            <h2 style={{ fontWeight: 600 }}>知识库管理</h2>
                        </div>

                        <div style={{ gap: '10px' }}>
                            <Input placeholder='搜索知识条目' style={{ width: 200, marginRight: '10px' }} />

                            <Button type='primary' htmlType='submit' style={{ marginRight: '10px', background: '#4CAF50' }}>
                                新增知识
                            </Button>
                        </div>
                    </div>
                    <Table
                        columns={[
                            {
                                title: '序号',
                                dataIndex: 'id',
                                key: 'id',
                                width: 60,
                                align: 'center',
                            },
                            {
                                title: '标题',
                                dataIndex: 'title',
                                key: 'title',
                                width: 200,
                            },
                            {
                                title: '预览',
                                dataIndex: 'preview',
                                key: 'preview',
                                render: (text) => (
                                    <div style={{ maxWidth: 400, wordBreak: 'break-all' }}>{text}</div>
                                ),
                            },
                            {
                                title: '元数据',
                                dataIndex: 'metadata',
                                key: 'metadata',
                                width: 200,
                            },
                            {
                                title: '操作',
                                key: 'action',
                                width: 80,
                                render: (_, record) => (
                                    <Button type="link" onClick={() => this.handleViewKnowledge(record.id)}>
                                        查看
                                    </Button>
                                ),
                            },
                        ]}
                        dataSource={[
                            {
                                id: 1,
                                title: '文档格式规范',
                                preview: '所有提交的文档应遵循以下格式规范：1. 使用统一字体和字号；2. 标题层级清晰；3. 段落间距一致；4. 图表编号规范。',
                                metadata: '2025-04-01 | 1 个文件',
                                key: '1',
                            },
                            {
                                id: 2,
                                title: '审阅标准说明',
                                preview: '文档审阅时应重点关注以下几个方面：1. 内容完整性；2. 逻辑一致性；3. 语言表达准确性；4. 格式规范性。',
                                metadata: '2025-04-02 | 2 个文件',
                                key: '2',
                            },
                            {
                                id: 3,
                                title: 'AI审阅流程指南',
                                preview: 'AI审阅流程包括文档上传、自动分析、问题标记、人工复核和最终确认五个步骤。每个步骤都有详细的操作说明和注意事项。',
                                metadata: '2025-04-03 | 1 个文件',
                                key: '3',
                            },
                            {
                                id: 4,
                                title: '常见问题解答',
                                preview: 'Q: AI审阅准确率如何？A: 在标准测试集中准确率达到92.5%。Q: 支持哪些文档格式？A: 目前支持docx, pdf, txt格式。',
                                metadata: '2025-04-04 | 1 个文件',
                                key: '4',
                            },
                            {
                                id: 5,
                                title: '术语表',
                                preview: '关键术语解释：1. 文档一致性：指文档内容在逻辑和格式上的统一性；2. 语义分析：AI对文档内容深层含义的理解过程。',
                                metadata: '2025-04-05 | 2 个文件',
                                key: '5',
                            },
                            {
                                id: 6,
                                title: '版本更新日志',
                                preview: 'v2.1.0: 增加了对PDF格式的支持；v2.0.5: 优化了审阅算法，提升了准确率；v2.0.0: 全新AI引擎上线。',
                                metadata: '2025-04-06 | 1 个文件',
                                key: '6',
                            },
                            {
                                id: 7,
                                title: '用户权限管理',
                                preview: '系统包含三种用户角色：管理员、审阅员和作者。管理员拥有全部权限，审阅员可查看和修改文档，作者仅能上传文档。',
                                metadata: '2025-04-07 | 2 个文件',
                                key: '7',
                            },
                            {
                                id: 8,
                                title: '系统性能指标',
                                preview: '平均审阅速度：50页/分钟；并发处理能力：100个文档；内存占用：2GB；推荐配置：8核CPU，16GB内存。',
                                metadata: '2025-04-08 | 1 个文件',
                                key: '8',
                            },
                            {
                                id: 9,
                                title: '安全与隐私保护',
                                preview: '所有文档在传输和存储过程中均采用AES-256加密。系统符合GDPR和中国网络安全法要求，确保用户数据安全。',
                                metadata: '2025-04-09 | 2 个文件',
                                key: '9',
                            },
                            {
                                id: 10,
                                title: 'API接口文档',
                                preview: '提供RESTful API接口，支持文档上传、状态查询、结果获取等功能。详细接口说明和调用示例请参考技术文档。',
                                metadata: '2025-04-10 | 2 个文件',
                                key: '10',
                            },
                        ]}
                        pagination={false}
                        style={{ marginTop: '20px' }}
                    />

                    {/* 知识条目查看模态框 */}
                    <Modal
                        title="文档格式规范"
                        open={this.state.viewKnowledgeModalVisible}
                        onCancel={() => this.setState({ viewKnowledgeModalVisible: false })}
                        footer={[
                            <Button key="close" onClick={() => this.setState({ viewKnowledgeModalVisible: false })}>
                                关闭
                            </Button>
                        ]}
                        width={600}
                    >
                        <div style={{ marginBottom: '20px' }}>
                            <h3 style={{ marginBottom: '10px', color: '#1890ff' }}>知识摘要</h3>
                            <p>所有提交的文档应遵循以下格式规范：1. 使用统一字体和字号；2. 标题层级清晰；3. 段落间距一致；4. 图表编号规范。</p>
                        </div>
                        
                        <div style={{ marginBottom: '20px' }}>
                            <h3 style={{ marginBottom: '10px', color: '#1890ff' }}>相关文件</h3>
                            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                                <span>format_guide.docx</span>
                                <Button type="link" onClick={() => {
                                    // 这里可以实现文件下载的逻辑
                                    message.info('文件下载中...');
                                }}>
                                    下载
                                </Button>
                            </div>
                        </div>
                        
                        <div>
                            <h3 style={{ marginBottom: '10px', color: '#1890ff' }}>相关标签</h3>
                            <div style={{ display: 'flex', gap: '10px' }}>
                                <Tag color="blue">规范</Tag>
                                <Tag color="green">文档</Tag>
                            </div>
                        </div>
                    </Modal>

                    {/* <div className={styles.proUsertableList}>
                        <div className={styles.proUsertableListForm}>{this.renderForm()}</div>
                        <div style={{ fontWeight: 500 }}>汇总信息</div>
                        <Divider style={{ borderColor: '#cccccc', margin: 0 }}>
                            <div className={styles.summaryButton} onClick={() => this.handleCollapse()}>
                                {toggleExpand ? <><UpOutlined /> 收起</> : <><DownOutlined /> 展开</>}
                            </div>
                        </Divider>
                        <div style={{ display: toggleExpand ? 'block' : 'none' }}>
                            <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.summaryContent}>
                                <Col md={5} sm={24}>
                                    <div>
                                        <span>单位: </span>
                                        <span>清河中医院</span>
                                    </div>
                                </Col>

                                <Col md={5} sm={24}>
                                    <span>部门: </span>
                                    <span>心内科</span>
                                </Col>

                                <Col md={5} sm={24}>
                                    <div>
                                        <span>总人数: </span>
                                        <span>300</span>
                                    </div>
                                </Col>
                            </Row>
                            <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.summaryContent}>
                                <Col md={5} sm={24}>
                                    <span>总作业数量: </span>
                                    <span>600</span>
                                </Col>

                                <Col md={5} sm={24}>
                                    <span>总考勤工时: </span>
                                    <span>2300</span>
                                </Col>

                                <Col md={5} sm={24}>
                                    <span>总作业工时: </span>
                                    <span>2000</span>
                                </Col>
                                <Col md={5} sm={24}>
                                    <span>总空闲工时: </span>
                                    <span>200</span>
                                </Col>
                            </Row>
                            <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.summaryContent}>
                                <Col md={5} sm={24}>
                                    <span>直接作业占比: </span>
                                    <span>86.96%</span>
                                </Col>

                                <Col md={5} sm={24}>
                                    <span>空闲工时占比: </span>
                                    <span>13.04%</span>
                                </Col>
                            </Row>
                        </div>
                        <div style={{ display: 'flex', justifyContent: "space-between" }}>
                            <div>共20项</div>
                            <div style={{ marginRight: 30 }}>
                                图例：
                                <div style={{ display: 'inline-block', width: 65, height: 20, textAlign: 'center', background: '#8ddd15' }}>作业时长</div>
                                <div style={{ display: 'inline-block', width: 65, height: 20, textAlign: 'center', background: '#cccccc', }}>空闲时长</div>
                            </div>
                        </div>
                        <StandardTable
                            rowKey={'user_id'}
                            selectedRows={selectedRows}
                            loading={loading}
                            data={mockData}
                            columns={this.columns}
                            onSelectRow={this.handleSelectRows}
                            onChange={this.handleStandardTableChange}
                            scroll={{ x: 1000, y: 600 }}
                            showTotal={(total, range) => total}
                        />
                    </div> */}
                </Card>

                {modalVisible && <TimeSheetCreateForm {...parentMethods} modalVisible={modalVisible} />}

                {updateFormValues && Object.keys(updateFormValues).length ? (
                    <TimeSheetUpdateForm
                        {...updateMethods}
                        updateModalVisible={updateModalVisible}
                        values={updateFormValues}
                    />
                ) : null}

                {viewFormValues && Object.keys(viewFormValues).length ? (
                    <TimeSheetViewForm
                        {...viewMethods}
                        viewModalVisible={viewModalVisible}
                        values={viewFormValues}
                    />
                ) : null}
            </>
        )
    }
}

export default TimeSheetList
