|
@@ -0,0 +1,142 @@
|
|
1
|
+import { useState, useRef } from 'react';
|
|
2
|
+import { Button, Popconfirm, Modal, Form, Input, message, Tree, Row, Col, Divider } from 'antd';
|
|
3
|
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
4
|
+import PageTable from '@/components/PageTable';
|
|
5
|
+import moment from 'moment';
|
|
6
|
+import { getList, update } from '@/services/feedback'
|
|
7
|
+
|
|
8
|
+const formatterTime = (val) => {
|
|
9
|
+ return val && val !== '-' ? moment(val).format('YYYY-MM-DD') : '-';
|
|
10
|
+};
|
|
11
|
+const FormItem = Form.Item;
|
|
12
|
+const { TextArea } = Input;
|
|
13
|
+
|
|
14
|
+export default () => {
|
|
15
|
+ const actionRef = useRef();
|
|
16
|
+ const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
|
|
17
|
+ const [current, setCurrent] = useState()
|
|
18
|
+ const [show, setShow] = useState(false)
|
|
19
|
+ const [loading, setLoading] = useState(false)
|
|
20
|
+ const showModel = (val) => {
|
|
21
|
+ setShow(true)
|
|
22
|
+ setCurrent(val)
|
|
23
|
+ }
|
|
24
|
+ const onchange = (e) => {
|
|
25
|
+ setCurrent({ ...current, result: e.target.value })
|
|
26
|
+ }
|
|
27
|
+ const onCancel = () => {
|
|
28
|
+ setShow(false)
|
|
29
|
+ setCurrent()
|
|
30
|
+ }
|
|
31
|
+ const Submit = () => {
|
|
32
|
+ if (!current.result) {
|
|
33
|
+ message.info(`请输入处理结果`);
|
|
34
|
+ return
|
|
35
|
+ }
|
|
36
|
+ setLoading(true)
|
|
37
|
+ update(current.feedbackId, { ...current, status: 1 }).then(() => {
|
|
38
|
+ message.success('处理成功')
|
|
39
|
+ onCancel()
|
|
40
|
+ setLoading(false)
|
|
41
|
+ actionRef.current.reload();
|
|
42
|
+ }).catch((err) => {
|
|
43
|
+ setLoading(false);
|
|
44
|
+ message.error(err.message || err);
|
|
45
|
+ });
|
|
46
|
+ }
|
|
47
|
+
|
|
48
|
+ const columns = [
|
|
49
|
+ {
|
|
50
|
+ title: '反馈人',
|
|
51
|
+ dataIndex: 'nickName',
|
|
52
|
+ key: 'nickName',
|
|
53
|
+ },
|
|
54
|
+ {
|
|
55
|
+ title: '电话',
|
|
56
|
+ dataIndex: 'phone',
|
|
57
|
+ key: 'phone',
|
|
58
|
+ },
|
|
59
|
+ {
|
|
60
|
+ title: '反馈内容',
|
|
61
|
+ dataIndex: 'content',
|
|
62
|
+ key: 'content',
|
|
63
|
+ },
|
|
64
|
+ {
|
|
65
|
+ title: '创建时间',
|
|
66
|
+ dataIndex: 'createDate',
|
|
67
|
+ key: 'createDate',
|
|
68
|
+ render: formatterTime,
|
|
69
|
+ width: 160,
|
|
70
|
+ },
|
|
71
|
+ {
|
|
72
|
+ title: '状态',
|
|
73
|
+ dataIndex: 'status',
|
|
74
|
+ key: 'status',
|
|
75
|
+ width: 100,
|
|
76
|
+ render: (_, record) => {
|
|
77
|
+ return record.status === 1 ? '已处理' : '未处理';
|
|
78
|
+ },
|
|
79
|
+ },
|
|
80
|
+ {
|
|
81
|
+ title: '操作',
|
|
82
|
+ valueType: 'option',
|
|
83
|
+ width: 160,
|
|
84
|
+ render: (_, record) => [
|
|
85
|
+ <Button key={1} style={{ padding: 0 }} type="link" onClick={() => showModel(record)}>
|
|
86
|
+ 处理
|
|
87
|
+ </Button>,
|
|
88
|
+ ],
|
|
89
|
+ },
|
|
90
|
+ ];
|
|
91
|
+ return (
|
|
92
|
+ <PageHeaderWrapper>
|
|
93
|
+ <PageTable
|
|
94
|
+ request={getList}
|
|
95
|
+ columns={columns}
|
|
96
|
+ actionRef={actionRef}
|
|
97
|
+ rowKey="feedbackId"
|
|
98
|
+ options={false}
|
|
99
|
+ search={false}
|
|
100
|
+ scroll={{ x: 1000 }}
|
|
101
|
+ />
|
|
102
|
+ <Modal
|
|
103
|
+ forceRender
|
|
104
|
+ title='意见反馈'
|
|
105
|
+ visible={show}
|
|
106
|
+ onCancel={onCancel}
|
|
107
|
+ keyboard={false}
|
|
108
|
+ maskClosable={false}
|
|
109
|
+ destroyOnClose={true}
|
|
110
|
+ footer={null}
|
|
111
|
+ >
|
|
112
|
+ <Form {...formItemLayout} >
|
|
113
|
+ <FormItem label="角色名" >
|
|
114
|
+ {current?.nickName}
|
|
115
|
+ </FormItem>
|
|
116
|
+ <FormItem label="电话" >
|
|
117
|
+ {current?.phone}
|
|
118
|
+ </FormItem>
|
|
119
|
+ <FormItem label="反馈内容" >
|
|
120
|
+ {current?.content}
|
|
121
|
+ </FormItem>
|
|
122
|
+ <FormItem label="处理结果" >
|
|
123
|
+ <TextArea placeholder="请输入" value={current?.result} onInput={onchange} />
|
|
124
|
+ </FormItem>
|
|
125
|
+ <FormItem label=" " colon={false}>
|
|
126
|
+ <Button type="default" onClick={onCancel}>
|
|
127
|
+ 取消
|
|
128
|
+ </Button>
|
|
129
|
+ <Button
|
|
130
|
+ type="primary"
|
|
131
|
+ loading={loading}
|
|
132
|
+ style={{ marginLeft: '4em' }}
|
|
133
|
+ onClick={Submit}
|
|
134
|
+ >
|
|
135
|
+ 确认
|
|
136
|
+ </Button>
|
|
137
|
+ </FormItem>
|
|
138
|
+ </Form>
|
|
139
|
+ </Modal>
|
|
140
|
+ </PageHeaderWrapper>
|
|
141
|
+ )
|
|
142
|
+}
|