소스 검색

导出数据 推荐客户

魏熙美 5 년 전
부모
커밋
a451b33925

+ 2
- 6
src/components/SelectButton/BuildSelect.jsx 파일 보기

1
 import React, { useState, useEffect, useRef } from 'react';
1
 import React, { useState, useEffect, useRef } from 'react';
2
 import { Select } from 'antd';
2
 import { Select } from 'antd';
3
-
3
+import apis from '../../services/apis';
4
 import request from '../../utils/request'
4
 import request from '../../utils/request'
5
 
5
 
6
 const { Option } = Select;
6
 const { Option } = Select;
33
   },[])
33
   },[])
34
 
34
 
35
   const getCityList = (e) => {
35
   const getCityList = (e) => {
36
-    request({
37
-        url: '/api/admin/buildinglist/select',
38
-        method: 'GET',
39
-        params: {pageNum: 1,pageSize: 999},
40
-    }).then((data) => {
36
+    request({ ...apis.building.buildingSelect, params: {pageNum: 1,pageSize: 999}, }).then((data) => {
41
         setData(data.records)
37
         setData(data.records)
42
     })
38
     })
43
   }
39
   }

+ 1
- 0
src/components/SelectButton/CitySelect.jsx 파일 보기

23
         url: '/api/admin/tdCity',
23
         url: '/api/admin/tdCity',
24
         method: 'GET',
24
         method: 'GET',
25
         params: {leveltype: 2, pageNum: 1,pageSize: 999},
25
         params: {leveltype: 2, pageNum: 1,pageSize: 999},
26
+        action: 'select',
26
     }).then((data) => {
27
     }).then((data) => {
27
         setData(data)
28
         setData(data)
28
     })
29
     })

+ 1
- 0
src/components/SelectButton/NewTypeSelect.jsx 파일 보기

23
         url: '/api/admin/taNewsType',
23
         url: '/api/admin/taNewsType',
24
         method: 'GET',
24
         method: 'GET',
25
         params: {pageNum: 1,pageSize: 999},
25
         params: {pageNum: 1,pageSize: 999},
26
+        action: 'select',
26
     }).then((data) => {
27
     }).then((data) => {
27
         setData(data.records)
28
         setData(data.records)
28
     })
29
     })

+ 14
- 17
src/pages/news/list/NewsList.jsx 파일 보기

97
         okText: '确认',
97
         okText: '确认',
98
         cancelText: '取消',
98
         cancelText: '取消',
99
         onOk() {
99
         onOk() {
100
-          request({
101
-            url: '/api/admin/taNews/' + newsId,
102
-            method: 'DELETE',
103
-            // data: { ...row },
104
-          }).then((data) => {
100
+          request({ ...apis.news.delete, urlData: { id: newsId },}).then((data) => {
105
             message.info('操作成功!')
101
             message.info('操作成功!')
106
             getList({ pageNum: 1, pageSize: 10 });
102
             getList({ pageNum: 1, pageSize: 10 });
103
+          }).catch((err) => {
104
+            console.log(err)
105
+            message.info(err.msg || err.message)
107
           })
106
           })
108
         }
107
         }
109
       });
108
       });
127
           okText: '确认',
126
           okText: '确认',
128
           cancelText: '取消',
127
           cancelText: '取消',
129
           onOk() {
128
           onOk() {
130
-            request({
131
-              url: '/api/admin/taNews/' + newsId,
132
-              method: 'PUT',
133
-              data: { "newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId },
134
-            }).then((data) => {
129
+            request({ ...apis.news.cancel, data:{"newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId}, urlData: { id: newsId },}).then((data) => {
135
               message.info('操作成功!')
130
               message.info('操作成功!')
136
               getList({ pageNum: 1, pageSize: 10 });
131
               getList({ pageNum: 1, pageSize: 10 });
132
+            }).catch((err) => {
133
+              console.log(err)
134
+              message.info(err.msg || err.message)
137
             })
135
             })
138
           },
136
           },
139
           onCancel() {
137
           onCancel() {
146
           okText: '确认',
144
           okText: '确认',
147
           cancelText: '取消',
145
           cancelText: '取消',
148
           onOk() {
146
           onOk() {
149
-            request({
150
-              url: '/api/admin/taNews/' + newsId,
151
-              method: 'PUT',
152
-              data: { "newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId },
153
-            }).then((data) => {
147
+            request({ ...apis.news.cancel, data:{"newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId}, urlData: { id: newsId },}).then((data) => {
154
               message.info('操作成功!')
148
               message.info('操作成功!')
155
               getList({ pageNum: 1, pageSize: 10 });
149
               getList({ pageNum: 1, pageSize: 10 });
150
+            }).catch((err) => {
151
+              console.log(err)
152
+              message.info(err.msg || err.message)
156
             })
153
             })
157
           },
154
           },
158
           onCancel() {
155
           onCancel() {
175
                   <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
172
                   <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
176
           </span>
173
           </span>
177
           {data.newsStatus === 0 ?
174
           {data.newsStatus === 0 ?
178
-            <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
175
+            <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48',zIndex:1 }} onClick={cancelRelease.bind(this, data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
179
               取消发布
176
               取消发布
180
                 <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
177
                 <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
181
             </span> :
178
             </span> :
182
-            <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
179
+            <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48',zIndex:1 }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
183
               发布
180
               发布
184
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
181
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
185
             </span>
182
             </span>

+ 16
- 11
src/pages/news/type/NewsType.jsx 파일 보기

5
 import router from 'umi/router';
5
 import router from 'umi/router';
6
 import BuildSelect from '../../../components/SelectButton/BuildSelect';
6
 import BuildSelect from '../../../components/SelectButton/BuildSelect';
7
 import AuthButton from '@/components/AuthButton';
7
 import AuthButton from '@/components/AuthButton';
8
-
8
+import apis from '../../../services/apis';
9
 import request from '../../../utils/request'
9
 import request from '../../../utils/request'
10
 
10
 
11
 const { Option } = Select;
11
 const { Option } = Select;
21
 
21
 
22
   // 查询列表
22
   // 查询列表
23
   const getList = (params) => {
23
   const getList = (params) => {
24
-    request({
25
-        url: '/api/admin/taNewsType',
26
-        method: 'GET',
27
-        params: { ...params },
28
-    }).then((data) => {
24
+    request({ ...apis.newsType.list, params: { ...params } }).then((data) => {
29
         console.log(data)
25
         console.log(data)
30
         setData(data)
26
         setData(data)
31
     })
27
     })
32
   }
28
   }
29
+
33
   
30
   
34
   // 提交事件
31
   // 提交事件
35
   const handleSubmit = (e, props) => {
32
   const handleSubmit = (e, props) => {
63
       okText: '确认',
60
       okText: '确认',
64
       cancelText: '取消',
61
       cancelText: '取消',
65
       onOk() {
62
       onOk() {
66
-        request({
67
-          url: '/api/admin/taNewsType/' + newsId,
68
-          method: 'DELETE',
69
-          data: { ...row },
70
-        }).then((data) => {
63
+        request({ ...apis.newsType.delete, urlData: { id: newsId },}).then((data) => {
71
           message.info('操作成功!')
64
           message.info('操作成功!')
72
           getList({ pageNum: 1, pageSize: 10 });
65
           getList({ pageNum: 1, pageSize: 10 });
66
+        }).catch((err) => {
67
+          console.log(err)
68
+          message.info(err.msg || err.message)
73
         })
69
         })
70
+
71
+        // request({
72
+        //   url: '/api/admin/taNewsType/' + newsId,
73
+        //   method: 'DELETE',
74
+        //   data: { ...row },
75
+        // }).then((data) => {
76
+        //   message.info('操作成功!')
77
+        //   getList({ pageNum: 1, pageSize: 10 });
78
+        // })
74
       }
79
       }
75
     });
80
     });
76
   }
81
   }

+ 0
- 53
src/pages/staff/list/addRole.jsx 파일 보기

41
     buttonList({ pageNum: 1, pageSize: 100 })
41
     buttonList({ pageNum: 1, pageSize: 100 })
42
   }, [])
42
   }, [])
43
   // 当前所有的菜单
43
   // 当前所有的菜单
44
-  // function menuList(params) {
45
-  //   request({
46
-  //     url: '/api/admin/menuList',
47
-  //     method: 'GET',
48
-  //     params: { ...params },
49
-  //     // eslint-disable-next-line no-shadow
50
-  //   }).then(data => {
51
-  //     setData(data)
52
-  //   })
53
-  // }
54
   function menuList(params) {
44
   function menuList(params) {
55
     request({ ...apis.role.menuList, params: { ...params } }).then((data) => {
45
     request({ ...apis.role.menuList, params: { ...params } }).then((data) => {
56
       setData(data)
46
       setData(data)
61
   }
51
   }
62
 
52
 
63
   // 所有按钮
53
   // 所有按钮
64
-  // function buttonList(params) {
65
-  //   request({
66
-  //     url: '/api/admin/buttonList',
67
-  //     method: 'GET',
68
-  //     params: { ...params },
69
-  //     // eslint-disable-next-line no-shadow
70
-  //   }).then(data => {
71
-  //     console.log(data)
72
-  //     setBuutonDate(data)
73
-  //   })
74
-  // }
75
-
76
   function buttonList(params) {
54
   function buttonList(params) {
77
     request({ ...apis.role.buttonList, params: { ...params } }).then((data) => {
55
     request({ ...apis.role.buttonList, params: { ...params } }).then((data) => {
78
       setBuutonDate(data)
56
       setBuutonDate(data)
83
 
61
 
84
 
62
 
85
   // 根据角色id查询当前的菜单及其按钮
63
   // 根据角色id查询当前的菜单及其按钮
86
-  // function buttonAndMenuList(params, id) {
87
-  //   console.log('id: ', id)
88
-  //   request({
89
-  //     url: `/api/admin/taRole/details/${id}`,
90
-  //     method: 'GET',
91
-  //     params: { ...params },
92
-  //     // eslint-disable-next-line no-shadow
93
-  //   }).then(data => {
94
-  //     console.log('data.roleName: ', data)
95
-  //     props.form.setFieldsValue({ roleName: data.roleName })
96
-  //     console.log(data)
97
-  //     setData(data)
98
-
99
-  //     // 获取所有的权限Id
100
-  //     if (data.sysMenuList) {
101
-  //       setDataMenuId(data.sysMenuList.map(item => item.menuId))
102
-  //       setDataButtonId((data.sysMenuList.map(item => item.sysButtonInMenu && item.sysButtonInMenu.map(btn => btn.btnId).join(',')).filter(f => f !== '').join(',').split(',')).map(a => parseInt(a)))
103
-  //     }
104
-  //   })
105
-  // }
106
-
107
   function buttonAndMenuList(params, ids) {
64
   function buttonAndMenuList(params, ids) {
108
     request({ ...apis.role.buttonAndMenuList, urlData: { id: ids }, params: { ...params } }).then(data => {
65
     request({ ...apis.role.buttonAndMenuList, urlData: { id: ids }, params: { ...params } }).then(data => {
109
       props.form.setFieldsValue({ roleName: data.roleName })
66
       props.form.setFieldsValue({ roleName: data.roleName })
168
       pathname: '/staff/RoleList',
125
       pathname: '/staff/RoleList',
169
     });
126
     });
170
   }
127
   }
171
-  // function updateAuthMenu(params) {
172
-  //   request({
173
-  //     url: '/api/admin/updateAuthMenu',
174
-  //     method: 'POST',
175
-  //     data: { ...params },
176
-  //     // eslint-disable-next-line no-shadow
177
-  //   }).then(data => {
178
-  //     toRoleList()
179
-  //   })
180
-  // }
181
 
128
 
182
   function updateAuthMenu(data) {
129
   function updateAuthMenu(data) {
183
     request({ ...apis.role.updateAuthMenu, data: { ...data } }).then((data) => {
130
     request({ ...apis.role.updateAuthMenu, data: { ...data } }).then((data) => {

+ 25
- 0
src/pages/staff/list/editStaff.jsx 파일 보기

26
   const userId = props.location.query.userId
26
   const userId = props.location.query.userId
27
   const [userData, setUserData] = useState({})
27
   const [userData, setUserData] = useState({})
28
   const [tagData, setTagData] = useState([])
28
   const [tagData, setTagData] = useState([])
29
+  const [roleData, setRoleData] = useState([])
29
 
30
 
30
   const getTagList = () => {
31
   const getTagList = () => {
31
     request({ ...apis.staff.taTags, params: {pageNum:1,pageSize:999} }).then((data) => {
32
     request({ ...apis.staff.taTags, params: {pageNum:1,pageSize:999} }).then((data) => {
33
     })
34
     })
34
   }
35
   }
35
 
36
 
37
+  const getRoleList = () => {
38
+    request({ ...apis.role.getRoleList, params: {pageNum:1,pageSize:999} }).then((data) => {
39
+      console.log(data)
40
+      setRoleData(data.records)
41
+    })
42
+  }
43
+
36
   // 查询列表
44
   // 查询列表
37
   const getUserData = (userId) => {
45
   const getUserData = (userId) => {
38
     request({ ...apis.staff.getTaUser, urlData: {id:userId} }).then((data) => {
46
     request({ ...apis.staff.getTaUser, urlData: {id:userId} }).then((data) => {
43
 
51
 
44
   useEffect(() => {
52
   useEffect(() => {
45
     getTagList();
53
     getTagList();
54
+    getRoleList();
46
     if (userId) {
55
     if (userId) {
47
       getUserData(userId);
56
       getUserData(userId);
48
     }
57
     }
103
       placeholder: '请输入电话号码',
112
       placeholder: '请输入电话号码',
104
       value: userData.phone,
113
       value: userData.phone,
105
     },
114
     },
115
+    {
116
+      label: '角色',
117
+      name: 'roleIds',
118
+      render: <Select
119
+                mode="multiple"
120
+                style={{ width: '100%' }}
121
+                placeholder="请选择标签"
122
+                onChange={tagsChange} >
123
+                  {roleData.map(item => (
124
+                    <Select.Option key={item.roleId} value={item.roleId}>
125
+                      {item.roleName}
126
+                    </Select.Option>
127
+                  ))}
128
+              </Select>,
129
+      value: userData.roleIds,
130
+    },
106
     {
131
     {
107
       label: '标签',
132
       label: '标签',
108
       name: 'taTags',
133
       name: 'taTags',

+ 30
- 0
src/services/apis.js 파일 보기

5
     uploadForAnt: {
5
     uploadForAnt: {
6
       url: `${prefix}/antd/image`,
6
       url: `${prefix}/antd/image`,
7
       method: 'POST',
7
       method: 'POST',
8
+      action: 'upload',
8
     },
9
     },
9
     upload: {
10
     upload: {
10
       url: `${prefix}/image`,
11
       url: `${prefix}/image`,
11
       method: 'POST',
12
       method: 'POST',
13
+      action: 'upload',
12
     },
14
     },
13
   },
15
   },
14
   user: {
16
   user: {
27
       method: 'POST',
29
       method: 'POST',
28
       url: `${prefix}/taUser/signout`,
30
       url: `${prefix}/taUser/signout`,
29
       logout: true,
31
       logout: true,
32
+      action: 'signout',
30
     },
33
     },
31
   },
34
   },
32
   building: {
35
   building: {
85
       url: `${prefix}/apartment/deleted/id`,
88
       url: `${prefix}/apartment/deleted/id`,
86
       action: 'admin.apartment.deleted.id.delete',
89
       action: 'admin.apartment.deleted.id.delete',
87
     },
90
     },
91
+    buildingSelect: {
92
+      url: `${prefix}/buildinglist/select`,
93
+      method: 'GET',
94
+      action: 'select',
95
+    }
88
   },
96
   },
89
   buildingType: {
97
   buildingType: {
90
     getList: {
98
     getList: {
119
       url: `${prefix}/taNews`,
127
       url: `${prefix}/taNews`,
120
       action: 'admin.taNews.get',
128
       action: 'admin.taNews.get',
121
     },
129
     },
130
+    delete: {
131
+        method: 'DELETE',
132
+        url: `${prefix}/taNews/:id`,
133
+        action: 'admin.taNews.id.delete',
134
+    },
135
+    cancel: {
136
+        method: 'PUT',
137
+        url: `${prefix}/taNews/:id`,
138
+        action: 'admin.taNews.id.put',
139
+    },
140
+  },
141
+  newsType: {
142
+    list: {
143
+        method: 'GET',
144
+        url: `${prefix}/taNewsType`,
145
+        action: 'admin.taNewsType.get',
146
+      },
147
+    delete: {
148
+        method: 'DELETE',
149
+        url: `${prefix}/taNewsType/:id`,
150
+        action: 'admin.taNewsType.id.delete',
151
+    },
122
   },
152
   },
123
   customer: {
153
   customer: {
124
     drift: {
154
     drift: {