forked from gzzfw/frontEnd/gzDyh

zhangyongtian
2024-09-07 3a2cd57a3ab0aee051da9dab313ab5a3706fc74d
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
160
161
162
163
164
import React, { Fragment, useState } from 'react';
import { register, downO, up, link } from '@/assets/images';
import { Row, Col, Space } from 'antd';
 
export default function ApplyInfo(props) {
  const [list, setList] = useState([
    {
      appType: '上报申请',
      time: '2024-7-12 10:00',
      addr: '白云区新市街汇桥北社区委员会 ',
      people: '李晓明',
      status: 1,
      statusName: '审核通过',
      id: 1,
      fileInfo: '上报至白云区综治中心的说明材料.pdf',
    },
    {
      appType: '结案申请',
      time: '2024-7-12 10:00',
      addr: '白云区新市街汇桥北社区委员会 ',
      people: '李晓明',
      status: 2,
      statusName: '审核中',
      id: 2,
    },
    {
      appType: '回退申请',
      time: '2024-7-12 10:00',
      addr: '白云区新市街汇桥北社区委员会 ',
      people: '李晓明',
      status: 3,
      statusName: '审核不通过',
      id: 3,
    }
  ]);
 
  const map = {
    '上报申请': [
      [{
        value: 'subTitle',
        label: '申请信息',
      },
      {
        value: 'bumen',
        label: '上报至',
      },
      {
        value: 'opinion',
        label: '上报意见',
      },
      {
        value: 'fileInfo',
        label: '附件材料',
      },
      {
        value: 'shijian',
        label: '申请时间',
      },
      {
        value: 'people',
        label: '申请人',
      },
    ],
      [
        {
          value: 'subTitle',
          label: '审核信息',
        },
        {
          value: 'statusName',
          label: '审核结果',
          color: '#00B42A'
        },
        {
          value: 'people',
          label: '理由说明',
        },
        {
          value: 'fileInfo',
          label: '附件材料',
        },
        {
          value: 'shijian',
          label: '审核时间',
        },
        {
          value: 'people',
          label: '审核人',
        },
      ]
    ]
  }
 
  const toggleView = (id) => {
    setList(list.map(record => {
      if (record.id === id) {
        return {
          ...record,
          showView: !record.showView,
        };
      }
      return record;
    }));
  };
 
  const handleDom = (data, item) => {
    console.log(data);
    if (data.value === 'subTitle') {
      return <Col span={24} key={data.value}>
        <Space size='small'>
          <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>{data.label}</h5>
        </Space>
      </Col>
    } else if (data.label === '附件材料') {
      return <Col span={24} key={data.value}>
        <div><div className="title-text">{data.label}</div></div>
        <div style={{ color: '#1A6FB8' }}><img src={link} alt="" className="title-file" />{item[data.value] || '-'}</div>
      </Col>
    } else {
      return <Col span={24} key={data.value}>
        <div><div className="title-text">{data.label}</div></div>
        <div style={{ color: data.color }}>{item[data.value] || '-'}</div>
      </Col>
    }
  }
 
  return (
    <div style={{ margin: '0 16px' }}>
      <div>
        {list?.map(item => {
          return <div className='applyInfoClass' style={{ background: item.showView ? '#eff8ff' : '#fff' }} key={item.id}>
            <div className='applyInfoClass-img' onClick={() => { toggleView(item.id) }}>
              <img src={item.showView ? up : downO} alt="" className="title-downUp" />
            </div>
            <div className='applyInfoClass-title'>
              <div className='applyInfoClass-title-txt'>{item.appType}</div>
              <div className={`applyInfoClass-title-tag-${item.status}`} >{item.statusName}</div>
            </div>
            {item.showView ? <div>
              {
                map[item.appType]?.map((res, index) => {
                  return <Row gutter={[16, 16]} key={index}>
                    {res.map(data => {
                      return handleDom(data, item)
                    })}
                  </Row>
                })
              }
            </div> : <div>
              <span style={{ marginRight: '32px' }}>
                <span style={{ color: '#86909C' }}>申请时间:</span><span>{item.time}</span>
              </span>
              <span style={{ marginRight: '8px' }}>
                <span style={{ color: '#86909C' }}>申请人:</span><span>{item.addr}</span>
              </span>
              <span><span>{item.people}<img src={register} alt="" className="title-register" /></span></span>
            </div>}
 
          </div>
        })}
      </div>
    </div>
  )
}