forked from gzzfw/frontEnd/gzDyh

zhangyongtian
2024-09-13 6a4f69b2fb9efa845fdd43c76713067716c3dd8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import React, { useState, useEffect, useRef, Fragment } from 'react';
import { Row, Col, Space } from 'antd';
import { Select, DatePicker, Form, Button, Menu } from '@arco-design/web-react';
import * as $$ from '@/utils/utility';
 
const FormItem = Form.Item;
const MenuItem = Menu.Item;
const SubMenu = Menu.SubMenu;
const appUrl = $$.appUrl;
const formItemLayout = {
    labelCol: {
        span: 8,
    },
    wrapperCol: {
        span: 16,
    },
};
 
 
const NewFileCheck = (props) => {
    const formRef = useRef();
    const [fileUrl, setFileUrl] = useState('')
    const [itemData, setItemData] = useState(null)
 
    const peopleTypeMap = {
        1: '工作人员',
        2: '当事人'
    }
 
    useEffect(() => {
        console.log(props.menuList, props.sourceType);
    }, [])
 
    //点击菜单
    const clickItem = (data) => {
        console.log(data);
        setItemData(data)
        setFileUrl(`${appUrl.fileUrl}/${appUrl.sys}${data.showUrl}`)
    }
 
    return (
        <nav className="filesCheck-nav" style={{ borderRight: '1px solid transparent' }}>
            <Form
                ref={formRef}
                layout='horizontal'
                style={{ marginTop: '24px', marginBottom: '20px' }}
                scrollToFirstError={true}
                {...formItemLayout}
            >
                <Row gutter={24} style={{ marginRight: '0px' }}>
                    <Col span={7}>
                        <FormItem label='材料类型:' field='type'>
                            <Select
                                placeholder='请选择'
                                allowClear
                                options={[
                                    {
                                        label: '全部',
                                        value: '',
                                    },
                                    {
                                        label: '申请材料',
                                        value: '22_00018-101',
                                    },
                                    {
                                        label: '证据材料',
                                        value: '22_00018-102',
                                    },
                                ]}
                            />
                        </FormItem>
                    </Col>
                    <Col span={7}>
                        <FormItem
                            label='上传时间:'
                            field='time'
                        >
                            <DatePicker.RangePicker
                                separator='~'
                                style={{ width: '100%' }}
                            />
                        </FormItem>
                    </Col>
                    <Col span={7}>
                        <FormItem
                            label='上传人类型:'
                            field='name'
                            onChange={(e) => console.log(e.target.value, 'vvv')}
                        >
                            <Select
                                allowClear
                                style={{ width: '100%' }}
                                options={[
                                    {
                                        label: '工作人员',
                                        value: 1
                                    },
                                    {
                                        label: '当事人',
                                        value: 2
                                    }
                                ]}
                            />
                        </FormItem>
                    </Col>
                    <Col span={3}>
                        <Space>
                            <Button size="middle " type='primary'>查询</Button>
                            <Button size="middle ">重置</Button>
                        </Space>
                    </Col>
                </Row>
 
            </Form>
            <div style={{ display: 'flex', height: '550px' }}>
                <div style={{ width: '256px' }}>
                    <Menu
                        style={{ width: '100%', height: '100%' }}
                    >
                        {props.menuList?.map(item => {
                            return <SubMenu
                                key={item.id}
                                title={item.ownerTypeName + `(${item.fileList && item.fileList.length || 0})`}
                            >
                                {item.fileList?.map(res => {
                                    return <MenuItem key={res.id} onClick={() => { clickItem(res) }}>{res.trueName}</MenuItem>
                                })}
                            </SubMenu>
                        })}
                    </Menu>
                </div>
                <div style={{ flex: 1 }}>
                    {
                        itemData ? <Fragment>
                            <div style={{ background: '#e8f3ff', color: '#1A6FB8', padding: '5px 10px', marginBottom: '16px' }}>
                                <span>材料名称:{itemData.trueName}</span>&nbsp;&nbsp;|&nbsp;&nbsp;
                                <span>上传时间:{itemData.updateTime}</span>&nbsp;&nbsp;|&nbsp;&nbsp;
                                <span>上传人:{itemData.uploaderName} {itemData.uploaderType && <span>({peopleTypeMap[itemData.uploaderType]})</span>}</span>
                            </div>
                            <div style={{ width: '100%', height: '470px' }}>
                                {
                                    itemData.suffix === 'pdf' ?
                                        <embed src={fileUrl} type="application/pdf" width="100%" height="100%"></embed>
                                        :
                                        <img src={fileUrl} alt="" style={{ width: '100%', height: '100%' }} />
                                }
 
                            </div>
                        </Fragment> : <Fragment>
                            <div style={{ padding: '100px 0' }}>{$$.MyEmpty()}</div>
                        </Fragment>
                    }
                </div>
            </div>
        </nav>
    );
};
 
export default NewFileCheck;