forked from nsjcy/frontEnd/nsjcy

xuxj
2020-04-08 4a76c06e7f754e232338ce7e075c08924cffe209
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
/**
 * 柯礼钦<kelq@hugeinfo.com.cn>
 * 2018年9月4日 16:00
 *
 */
 
import React from "react";
// import { Modal } from 'antd-mobile';
import { Radio, Input, Button, message, Breadcrumb } from "antd";
import moment from "moment";
import BusDetailView from "../view/BusDetailView";
import LineView from "../view/LineView";
import HeadView from "../view/HeadView";
import Fetch from "../fetch";
 
const RadioGroup = Radio.Group;
const { TextArea } = Input;
function typeOfName(type) {
  switch (type) {
    case '0':
      return "普通用户";
    case '1':
      return "律师";
    case '2':
      return "人大代表";
    case '3':
      return "政协委员";
    case '4':
      return "人民监督员";
    case '5':
      return "特约监察员";
    default:
      return "其他";
  }
}
 
function sexOfName(sexOfName) {
  switch (sexOfName) {
    case '0':
      return "未知"
    case '1':
      return '男'
    case '2':
      return '女'
  }
}
 
function sexOfStatus(status) {
  switch (status) {
    case 2:
      return "审核通过"
    case 3:
      return '审核不通过'
    case 4:
      return '待补充材料'
  }
}
export default class BusDetail extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      inputValue: '',
      userinfo: [],
      auditList: [],
      otherAttList: [],
      formdata: {}
    };
  }
 
  componentDidMount() {
    const { id } = this.props.match.params;
    console.log(id)
    Fetch.getUserDetail(id).then(data => {
      this.setState({
        userinfo: data.user,
        auditList: data.auditList,
        otherAttList: data.otherAttList
      });
    });
    document.title = "用户详情";
  }
 
  goBack = () => {
    this.props.history.goBack();
  };
 
  onInputChange = e => {
    this.setState({
      inputValue: e.target.value
    });
  };
 
  onChange = (name, value) => {
 
    const formdata = {
      ...this.state.formdata,
      [name]: value
    };
    this.setState({ formdata });
 
  };
  submitAudit = () => {
    const { id } = this.props.match.params;
    const { inputValue, formdata } = this.state;
    const value = formdata.radio;
    if (!value) {
      message.warning("请选择审批结论!");
      return;
    }
    const businessType = 15;
    const busId = id;
    Fetch.userAudit({ inputValue, value, businessType, busId }).then(res => {
      if (res.code === 0) {
        message.success("审批成功!", 2, () => {
          this.props.history.goBack();
        });
      } else {
        message.error("审批失败!", 2);
      }
    });
  };
 
  render() {
    const { userinfo, auditList, otherAttList } = this.state;
    const { flag } = this.props.match.params;
    return (
      <div className="app-page">
        <HeadView history={this.props.history} />
        <Breadcrumb style={{ padding: '20px' }}>
          <Breadcrumb.Item><a href="">后台中心</a></Breadcrumb.Item>
          <Breadcrumb.Item>用户审核</Breadcrumb.Item>
        </Breadcrumb>
        <BusDetailView type="用户信息">
          <LineView
            title='用户信息'
            style="35vh"
            lineHeight="34px"
          >
            <table>
              <tbody>
                <tr>
                  <td className="table-vaule1">姓名</td>
                  <td className="table-vaule2">
                    {userinfo.userName || "无"}
                  </td>
                  <td className="table-vaule3">手机号码</td>
                  <td className="table-vaule4">{userinfo.mobile || "无"}</td>
                </tr>
                <tr>
                  <td className="table-vaule1">身份证号</td>
                  <td className="table-vaule2">
                    {userinfo.idcard || "无"}
                  </td>
                  <td className="table-vaule3">性别</td>
                  <td className="table-vaule4">
                    {sexOfName(userinfo.wxSex) || "无"}
                  </td>
                </tr>
                <tr>
                  <td className="table-vaule1">出生日期</td>
                  <td className="table-vaule2">
                    {userinfo.birthday || "无"}
                  </td>
                  <td className="table-vaule3">现居住地</td>
                  <td className="table-vaule4">
                    {userinfo.address || "无 "}
                  </td>
                </tr>
                <tr>
                  <td className="table-vaule1">户籍所在地</td>
                  <td className="table-vaule2">
                    {userinfo.bornAddress || "无"}
                  </td>
                  <td className="table-vaule3">职业</td>
                  <td className="table-vaule4">
                    {userinfo.profession || "无"}
                  </td>
                </tr>
                <tr>
                  <td className="table-vaule1">民族</td>
                  <td className="table-vaule2">
                    {userinfo.nation || "无"}
                  </td>
                  <td className="table-vaule1">工作单位</td>
                  <td className="table-vaule2">
                    {userinfo.workPlace || "无"}
                  </td>
                </tr>
                <tr>
                  <td className="table-vaule1">用户类型</td>
                  <td className="table-vaule2">
                    {typeOfName(userinfo.userType) || "无"}
                  </td>
                  <td className="table-vaule1">电子邮箱</td>
                  <td className="table-vaule2">
                    {userinfo.email || "无"}
                  </td>
                </tr>
                {
                  userinfo.userType == 1 ?
                    <tr>
                      <td className="table-vaule1">律师事务所名称</td>
                      <td className="table-vaule2">
                        {userinfo.lawyerOffice || "无"}
                      </td>
                      <td className="table-vaule1">律师编号</td>
                      <td className="table-vaule2">
                        {userinfo.lawyerNo || "无"}
                      </td>
                    </tr>
                    : null}
                {
                  userinfo.userType > 1 ?
                    <tr>
                      <td className="table-vaule1">监督员编号</td>
                      <td className="table-vaule2">
                        {userinfo.userTypeId || "无"}
                      </td>
                    </tr>
                    : null
                }
 
                <tr>
                  <td className="table-vaule1">身份证照片</td>
                </tr>
              </tbody>
            </table>
            <div className="apply-img-div">
              {userinfo.attachments
                ? userinfo.attachments.map((data, key) => (
                  <div style={{ marginRight: "10px" }} key={key}>
                    <a href={data.path} target='_black'> <img
                      src={data.path}
                      width='70px'
                      height='70px'
                    /></a>
                  </div>
                ))
                : null}
            </div>
          </LineView>
          {
            otherAttList.length > 0 ?
              (
                <LineView title="其他材料" style="15vh">
                  <div className="apply-img-div">
                    {otherAttList
                      ? otherAttList.map((data, key) => (
                        <div style={{ marginRight: "10px" }} key={key}>
                          <a href={data.path} target='_black'> <img
                            src={data.path}
                            width='70px'
                            height='70px'
                          /></a>
                        </div>
                      ))
                      : null}
                  </div>
                </LineView>
              ) : null}
          {
            auditList.length > 0 ?
              (
                <LineView title="审核记录" style="15vh">
                  <colgroup span="4" />
                  {auditList
                    ? auditList.map((data, key) => (
                      <table>
                        <tbody>
                          <tr>
                            <td>审批状态:</td>
                            <td>{sexOfStatus(data.approvalStatus)}</td>
                            <td>审批结论:</td>
                            <td>{data.opinion}</td>
                          </tr>
                          <tr>
                            <td>审核人:</td>
                            <td>{data.approverName}</td>
                            <td>审核时间:</td>
                            <td>{moment(data.createTime).format(
                              "YYYY-MM-DD HH:mm"
                            )}</td>
                          </tr>
                        </tbody>
                      </table>
                    ))
                    : null}
                </LineView>
              ) : null}
 
          {/* 业务的审批操作 */}
          {flag === "do" ? (
            <LineView title="申诉审批" lineHeight="50px">
              <table>
                <tbody>
                  <tr>
                    <td>审批结论</td>
                    <td>
                      <RadioGroup
                        onChange={e => {
                          this.onChange("radio", e.target.value);
                        }}
                        value={this.state.formdata.radio}
                      >
                        <Radio value={2}>审批通过</Radio>
                        <Radio value={3}>审核不通过</Radio>
                        <Radio value={4}>补充相关证件</Radio>
                      </RadioGroup>
                    </td>
                  </tr>
                  <tr>
                    <td>审批结论</td>
                    <td>
                      <TextArea
                        placeholder="请输入审批意见及理由"
                        autosize={{ minRows: 2, maxRows: 6 }}
                        onChange={this.onInputChange}
                      />
                    </td>
                  </tr>
                </tbody>
              </table>
              <div>
                <Button
                  type="primary"
                  className="app-btn"
                  onClick={this.submitAudit}
                >
                  提交审核
                  </Button>
                <Button className="app-btn" onClick={this.goBack}>
                  返回
                  </Button>
              </div>
            </LineView>
          ) : <div style={{ textAlign: 'center' }}><Button  className="app-btn" onClick={this.goBack}>返回</Button></div>}
        </BusDetailView>
      </div>
    );
  }
}