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
/**
 * 柯礼钦<kelq@hugeinfo.com.cn>
 * 2018年9月4日 16:00
 *
 */
 
import React from "react";
import { 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";
import { domain } from "../fetch/_fetch";
const { TextArea } = Input;
const replyAdmin = {
  display: 'block',
  float: 'left',
  color: 'green',
}
 
const replyUser = {
  display: 'block',
  float: 'left',
  color: '#1790ff'
}
 
const timeUser = {
  display: 'block',
  color: '#1790ff'
}
 
const timeAdmin = {
  display: 'block',
  color: 'green'
}
 
export default class BusDetail extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      savedate: {},
      detail: {},
      data: {}
    };
  }
 
  componentDidMount() {
    const { id } = this.props.match.params;
    Fetch.getTipoffDetail(id).then(data => {
      console.log('data', data);
      this.setState({
        detail: data,
        savedate: {
          id: id
        }
      })
    })
  }
 
  goBack = () => {
    this.props.history.goBack();
  };
 
 
  onInputChange = ({ target: { value, name } }) => {
    this.setState(({ savedate }) => ({
      savedate: {
        ...savedate,
        [name]: value
      }
    }))
  }
 
  submitAudit = () => {
 
    const { savedate } = this.state;
    console.log(savedate);
    if (!savedate.result) {
      message.warning("请填写回复内容");
      return;
    }
 
    Fetch.tipoffReply(savedate).then(res => {
      if (res.code === 0) {
        message.success("回复成功", 2, () => {
          this.props.history.goBack();
        });
      } else {
        message.error("回复失败,请联系管理员", 2);
      }
    });
  };
 
  render() {
 
    // 居中样式
    const center = {
      display: "flex",
      alignItems: "center",
      justifyContent: "center"
    };
    const { detail, data } = this.state;
    const { flag } = this.props.match.params;
    console.log(data)
    return (
      <div className="app-page">
        <HeadView history={this.props.history} />
        <Breadcrumb style={{ padding: '20px' }}>
          <Breadcrumb.Item><a href="index.html#/noInspectionReportList">未检举报</a></Breadcrumb.Item>
          <Breadcrumb.Item>未检举报详情</Breadcrumb.Item>
        </Breadcrumb>
        <BusDetailView>
          <div>
            <LineView title="举报信息" style="14vh" lineHeight="34px">
              <table>
                <tbody>
                  <tr>
                    <td className="table-vaule1">举报对象</td>
                    <td className="table-vaule2">{detail.tipoffObject}</td>
                    <td className="table-vaule1">发生地</td>
                    <td className="table-vaule2">{detail.tipoffAddress}</td>
                  </tr>
                  <tr>
                    <td className="table-vaule3">举报类型</td>
                    <td className="table-vaule4">{businessType(detail.businessType)}</td>
                  </tr>
 
                  <tr>
                    <td className="table-vaule1">具体事项</td>
                    <td className="table-vaule2">{detail.tipoffContent}</td>
                  </tr>
                </tbody>
              </table>
            </LineView>
 
            <LineView title="举报人信息" style="14vh" lineHeight="34px">
              <table>
                <tbody>
                  <tr>
                    <td className="table-vaule1">姓名</td>
                    <td className="table-vaule2">{detail.createrName}</td>
                    <td className="table-vaule3">手机号码</td>
                    <td className="table-vaule4">{detail.createrMobile}</td>
                  </tr>
                  <tr>
                    <td className="table-vaule1">联系地址</td>
                    <td className="table-vaule2">{detail.createrAddress}</td>
                  </tr>
                </tbody>
              </table>
            </LineView>
 
          </div>
          <LineView title="相关材料" style="14vh">
            <div className="apply-img-div">
              {detail.attachmentList
                ? detail.attachmentList.map((data, key) => (
                  (
                    data.type != 21 ?
                      < div style={{ marginRight: "10px" }} key={key}>
                        <a href={domain + 'api/v1/attachment/image/' + data.id} target='_black'> <img src={domain + 'api/v1/attachment/image/' + data.id} width='70' height='70' /></a>
                      </div>
                      : < div style={{ marginRight: "10px" }} key={key}>
                        <a href={domain + 'api/v1/attachment/image/' + data.id} target='_black'><video src={domain + 'api/v1/attachment/image/' + data.id} width='70' height='70'></video></a>
                      </div>
                  )
                ))
                : null}
            </div>
          </LineView>
          {
            detail.tipoffResult ?
              <LineView title="回复记录" style="15vh">
                <table>
                  <tbody>
                    <tr>
                      <td className="table-vaule1">回复人</td>
                      <td className="table-vaule2">{detail.handlerName}</td>
                      <td className="table-vaule3">回复时间</td>
                      <td className="table-vaule4">{moment(detail.handleTime).format('YYYY/MM/DD HH:mm:ss')}</td>
                    </tr>
                    <tr>
                      <td className="table-vaule1">回复内容</td>
                      <td className="table-vaule2">{detail.tipoffResult}</td>
                    </tr>
                  </tbody>
                </table>
              </LineView>
              : null}
          {
            flag == "do" ?
              (detail.status == 1 ? (
                <LineView title="回复" lineHeight="50px">
                  <table>
                    <tbody>
                      <tr>
                        <td>回复内容</td>
                        <td>
                          <TextArea
                            placeholder="请输入回复内容"
                            autosize={{ minRows: 2, maxRows: 6 }}
                            onChange={({ target: { value } }) => this.onInputChange({ target: { name: 'result', value } })}
                          />
                        </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>
              ) : <div style={{ textAlign: 'center' }}><Button className="app-btn" onClick={this.goBack}>返回</Button></div>}
        </BusDetailView>
      </div>
    );
  }
}
 
function renderStatus(status) {
  switch (status) {
    case 1:
      return <Badge count={'待处理'} style={{ background: '#f50' }} />
    case 2:
      return <Badge count={'已完成'} style={{ background: '#87d068' }} />
    default:
      return '暂无'
  }
}
 
//业务类型,1:未检举报,2:知识产权举报,3:
function businessType(type) {
  switch (type) {
    case 1:
      return '未检举报';
    case 2:
      return '知识产权举报';
    case 3:
      return '暂无';
  }
}