Ver código fonte

导出数据 推荐客户

魏熙美 5 anos atrás
pai
commit
a451b33925

+ 2
- 6
src/components/SelectButton/BuildSelect.jsx Ver arquivo

@@ -1,6 +1,6 @@
1 1
 import React, { useState, useEffect, useRef } from 'react';
2 2
 import { Select } from 'antd';
3
-
3
+import apis from '../../services/apis';
4 4
 import request from '../../utils/request'
5 5
 
6 6
 const { Option } = Select;
@@ -33,11 +33,7 @@ const BuildingSelect = (props) => {
33 33
   },[])
34 34
 
35 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 37
         setData(data.records)
42 38
     })
43 39
   }

+ 1
- 0
src/components/SelectButton/CitySelect.jsx Ver arquivo

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

+ 1
- 0
src/components/SelectButton/NewTypeSelect.jsx Ver arquivo

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

+ 14
- 17
src/pages/news/list/NewsList.jsx Ver arquivo

@@ -97,13 +97,12 @@ function body(props) {
97 97
         okText: '确认',
98 98
         cancelText: '取消',
99 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 101
             message.info('操作成功!')
106 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,13 +126,12 @@ function body(props) {
127 126
           okText: '确认',
128 127
           cancelText: '取消',
129 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 130
               message.info('操作成功!')
136 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 137
           onCancel() {
@@ -146,13 +144,12 @@ function body(props) {
146 144
           okText: '确认',
147 145
           cancelText: '取消',
148 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 148
               message.info('操作成功!')
155 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 155
           onCancel() {
@@ -175,11 +172,11 @@ function body(props) {
175 172
                   <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
176 173
           </span>
177 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 177
                 <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
181 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 181
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
185 182
             </span>

+ 16
- 11
src/pages/news/type/NewsType.jsx Ver arquivo

@@ -5,7 +5,7 @@ import styles from '../../style/GoodsList.less';
5 5
 import router from 'umi/router';
6 6
 import BuildSelect from '../../../components/SelectButton/BuildSelect';
7 7
 import AuthButton from '@/components/AuthButton';
8
-
8
+import apis from '../../../services/apis';
9 9
 import request from '../../../utils/request'
10 10
 
11 11
 const { Option } = Select;
@@ -21,15 +21,12 @@ function header(props) {
21 21
 
22 22
   // 查询列表
23 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 25
         console.log(data)
30 26
         setData(data)
31 27
     })
32 28
   }
29
+
33 30
   
34 31
   // 提交事件
35 32
   const handleSubmit = (e, props) => {
@@ -63,14 +60,22 @@ function header(props) {
63 60
       okText: '确认',
64 61
       cancelText: '取消',
65 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 64
           message.info('操作成功!')
72 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 Ver arquivo

@@ -41,16 +41,6 @@ const Poster = props => {
41 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 44
   function menuList(params) {
55 45
     request({ ...apis.role.menuList, params: { ...params } }).then((data) => {
56 46
       setData(data)
@@ -61,18 +51,6 @@ const Poster = props => {
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 54
   function buttonList(params) {
77 55
     request({ ...apis.role.buttonList, params: { ...params } }).then((data) => {
78 56
       setBuutonDate(data)
@@ -83,27 +61,6 @@ const Poster = props => {
83 61
 
84 62
 
85 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 64
   function buttonAndMenuList(params, ids) {
108 65
     request({ ...apis.role.buttonAndMenuList, urlData: { id: ids }, params: { ...params } }).then(data => {
109 66
       props.form.setFieldsValue({ roleName: data.roleName })
@@ -168,16 +125,6 @@ const Poster = props => {
168 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 129
   function updateAuthMenu(data) {
183 130
     request({ ...apis.role.updateAuthMenu, data: { ...data } }).then((data) => {

+ 25
- 0
src/pages/staff/list/editStaff.jsx Ver arquivo

@@ -26,6 +26,7 @@ const Edit = (props) => {
26 26
   const userId = props.location.query.userId
27 27
   const [userData, setUserData] = useState({})
28 28
   const [tagData, setTagData] = useState([])
29
+  const [roleData, setRoleData] = useState([])
29 30
 
30 31
   const getTagList = () => {
31 32
     request({ ...apis.staff.taTags, params: {pageNum:1,pageSize:999} }).then((data) => {
@@ -33,6 +34,13 @@ const Edit = (props) => {
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 45
   const getUserData = (userId) => {
38 46
     request({ ...apis.staff.getTaUser, urlData: {id:userId} }).then((data) => {
@@ -43,6 +51,7 @@ const Edit = (props) => {
43 51
 
44 52
   useEffect(() => {
45 53
     getTagList();
54
+    getRoleList();
46 55
     if (userId) {
47 56
       getUserData(userId);
48 57
     }
@@ -103,6 +112,22 @@ const Edit = (props) => {
103 112
       placeholder: '请输入电话号码',
104 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 132
       label: '标签',
108 133
       name: 'taTags',

+ 30
- 0
src/services/apis.js Ver arquivo

@@ -5,10 +5,12 @@ export default {
5 5
     uploadForAnt: {
6 6
       url: `${prefix}/antd/image`,
7 7
       method: 'POST',
8
+      action: 'upload',
8 9
     },
9 10
     upload: {
10 11
       url: `${prefix}/image`,
11 12
       method: 'POST',
13
+      action: 'upload',
12 14
     },
13 15
   },
14 16
   user: {
@@ -27,6 +29,7 @@ export default {
27 29
       method: 'POST',
28 30
       url: `${prefix}/taUser/signout`,
29 31
       logout: true,
32
+      action: 'signout',
30 33
     },
31 34
   },
32 35
   building: {
@@ -85,6 +88,11 @@ export default {
85 88
       url: `${prefix}/apartment/deleted/id`,
86 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 97
   buildingType: {
90 98
     getList: {
@@ -119,6 +127,28 @@ export default {
119 127
       url: `${prefix}/taNews`,
120 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 153
   customer: {
124 154
     drift: {