李志伟 3 лет назад
Родитель
Сommit
88f7f7f290
3 измененных файлов: 164 добавлений и 2 удалений
  1. 7
    2
      config/routes.js
  2. 142
    0
      src/pages/Feedback/index.jsx
  3. 15
    0
      src/services/feedback.js

+ 7
- 2
config/routes.js Просмотреть файл

@@ -164,7 +164,6 @@ export default [
164 164
       },
165 165
     ],
166 166
   },
167
-
168 167
   {
169 168
     path: '/Finance',
170 169
     name: '财务管理',
@@ -208,6 +207,13 @@ export default [
208 207
       },
209 208
     ],
210 209
   },
210
+  {
211
+    path: '/Feedback',
212
+    name: '意见反馈',
213
+    icon: 'MessageOutlined',
214
+    component: './Feedback',
215
+    access: 'feedback',
216
+  },
211 217
   {
212 218
     path: '/SystemManagement',
213 219
     name: '系统管理',
@@ -220,7 +226,6 @@ export default [
220 226
         name: '区域设置',
221 227
         access: 'region',
222 228
         component: './SystemManagement/Region',
223
-        // hideInMenu: true
224 229
       },
225 230
       {
226 231
         path: '/SystemManagement/Cooperative',

+ 142
- 0
src/pages/Feedback/index.jsx Просмотреть файл

@@ -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
+}

+ 15
- 0
src/services/feedback.js Просмотреть файл

@@ -0,0 +1,15 @@
1
+import request from '@/utils/request';
2
+
3
+/**
4
+ * 处理反馈
5
+ * @param {*} data
6
+ * @returns
7
+ */
8
+export const update = (id, data) => request(`/feedback/${id}`, { method: 'put', data });
9
+
10
+/**
11
+ * 查询反馈列表
12
+ * @param {*} params
13
+ * @returns
14
+ */
15
+export const getList = (params) => request('/feedback', { params });