浏览代码

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager

张延森 5 年前
父节点
当前提交
299f92dedc

+ 6
- 1
config/config.js 查看文件

346
                   hideInMenu: true,
346
                   hideInMenu: true,
347
                   component: './staff/list/editRole',
347
                   component: './staff/list/editRole',
348
                 },
348
                 },
349
-
349
+                {
350
+                  path: '/staff/list/addRole',
351
+                  name: '添加角色',
352
+                  hideInMenu: true,
353
+                  component: './staff/list/addRole',
354
+                },  
350
               ],
355
               ],
351
             },
356
             },
352
             {
357
             {

+ 2
- 0
package.json 查看文件

45
     "@antv/data-set": "^0.10.2",
45
     "@antv/data-set": "^0.10.2",
46
     "antd": "^3.20.0",
46
     "antd": "^3.20.0",
47
     "classnames": "^2.2.6",
47
     "classnames": "^2.2.6",
48
+    "dayjs": "^1.8.16",
48
     "dva": "^2.4.1",
49
     "dva": "^2.4.1",
49
     "echarts": "^4.3.0",
50
     "echarts": "^4.3.0",
50
     "lodash": "^4.17.11",
51
     "lodash": "^4.17.11",
68
     "@ant-design/colors": "^3.1.0",
69
     "@ant-design/colors": "^3.1.0",
69
     "@ant-design/pro-cli": "^1.0.0",
70
     "@ant-design/pro-cli": "^1.0.0",
70
     "@types/classnames": "^2.2.7",
71
     "@types/classnames": "^2.2.7",
72
+    "@types/echarts": "^4.1.14",
71
     "@types/express": "^4.17.0",
73
     "@types/express": "^4.17.0",
72
     "@types/history": "^4.7.2",
74
     "@types/history": "^4.7.2",
73
     "@types/jest": "^24.0.13",
75
     "@types/jest": "^24.0.13",

+ 16
- 10
src/components/EchartsTest/EChart.jsx 查看文件

3
 // 引入 ECharts 主模块
3
 // 引入 ECharts 主模块
4
 import echarts from 'echarts/lib/echarts';
4
 import echarts from 'echarts/lib/echarts';
5
 // 引入柱状图
5
 // 引入柱状图
6
-import  'echarts/lib/chart/bar';
6
+import 'echarts/lib/chart/bar';
7
+import 'echarts/lib/chart/pie';
7
 // 引入提示框和标题组件
8
 // 引入提示框和标题组件
8
 import 'echarts/lib/component/tooltip';
9
 import 'echarts/lib/component/tooltip';
10
+import 'echarts/lib/component/legend';
9
 import 'echarts/lib/component/title';
11
 import 'echarts/lib/component/title';
10
 
12
 
13
+
11
 class EchartsTest extends Component {
14
 class EchartsTest extends Component {
12
-    chartRef = undefined
15
+    chartRef = React.createRef();
13
     chart = undefined
16
     chart = undefined
14
     defaultChartOption = {}
17
     defaultChartOption = {}
15
 
18
 
16
-    componentDidMount() {
19
+    componentDidMount () {
17
         this.chart = echarts.init(this.chartRef.current)
20
         this.chart = echarts.init(this.chartRef.current)
18
 
21
 
19
         // 绘制图表
22
         // 绘制图表
23
         });
26
         });
24
     }
27
     }
25
 
28
 
26
-    componentDidUpdate(preProps) {
29
+    componentDidUpdate (preProps) {
27
         if (preProps.options != this.props.options) {
30
         if (preProps.options != this.props.options) {
28
-            this.chart.setOption({
31
+            const options = {
29
                 ...this.defaultChartOption,
32
                 ...this.defaultChartOption,
30
                 ...this.props.options || {},
33
                 ...this.props.options || {},
31
-            });
34
+            }
35
+
36
+            console.log(options)
37
+
38
+            this.chart.setOption(options);
32
         }
39
         }
33
     }
40
     }
34
 
41
 
35
-    handleDom = ref => this.chartRef = ref
36
-
37
-    render() {
42
+    render () {
38
         const style = {
43
         const style = {
39
             width: '600px',
44
             width: '600px',
45
+            height: '400px',
40
             ...this.props.style || {}
46
             ...this.props.style || {}
41
         }
47
         }
42
 
48
 
43
         return (
49
         return (
44
-            <div ref={this.handleDom} style={style}></div>
50
+            <div ref={this.chartRef} style={style}></div>
45
         );
51
         );
46
     }
52
     }
47
 }
53
 }

+ 5
- 1
src/global.less 查看文件

23
   text-rendering: optimizeLegibility;
23
   text-rendering: optimizeLegibility;
24
   -webkit-font-smoothing: antialiased;
24
   -webkit-font-smoothing: antialiased;
25
   -moz-osx-font-smoothing: grayscale;
25
   -moz-osx-font-smoothing: grayscale;
26
+  font-size: 16px;
26
 }
27
 }
27
 
28
 
28
 ul,
29
 ul,
92
   .ant-menu-inline > .ant-menu-item{
93
   .ant-menu-inline > .ant-menu-item{
93
     height: 45px;
94
     height: 45px;
94
     line-height: 45px;
95
     line-height: 45px;
95
-    font-size: 16px;
96
+    
96
     margin: 0;
97
     margin: 0;
98
+    .ant-menu-submenu-title{
99
+      font-size: 16px!important;
100
+    }
97
   }
101
   }
98
   .ant-menu.ant-pro-sider-menu{
102
   .ant-menu.ant-pro-sider-menu{
99
     padding: 0!important;
103
     padding: 0!important;

+ 103
- 16
src/pages/activity/editActivity.jsx 查看文件

148
           method: 'PUT',
148
           method: 'PUT',
149
           data: submitValue,
149
           data: submitValue,
150
         }).then((data) => {
150
         }).then((data) => {
151
+          message.info("保存成功")
151
           cancelPage()
152
           cancelPage()
152
         }).catch((err) => {
153
         }).catch((err) => {
153
           message.info(err.msg || err.message)
154
           message.info(err.msg || err.message)
158
           method: 'POST',
159
           method: 'POST',
159
           data: submitValue,
160
           data: submitValue,
160
         }).then((data) => {
161
         }).then((data) => {
162
+          message.info("保存成功")
161
           cancelPage()
163
           cancelPage()
162
         }).catch((err) => {
164
         }).catch((err) => {
163
           message.info(err.msg || err.message)
165
           message.info(err.msg || err.message)
172
     const [inputValue, changeInput] = useState('')
174
     const [inputValue, changeInput] = useState('')
173
     const [textAreaValue, changeTextArea] = useState('')
175
     const [textAreaValue, changeTextArea] = useState('')
174
     const [imgValue, changeImg] = useState('')
176
     const [imgValue, changeImg] = useState('')
177
+    const [posterId, setPosterId] = useState('')
178
+
179
+    if(dynamicId){
180
+      useEffect(() => {
181
+        request({
182
+          url: '/api/admin/poster',
183
+          method: 'GET',
184
+          params: {targetId: dynamicId,targetType: 'activity'},
185
+        }).then((data) => {
186
+          console.log(data,"2222")
187
+          if(data.length > 0){
188
+            setPosterId(data[0].posterId)
189
+            changeImg(data[0].posterImg)
190
+            changeTextArea(data[0].posterDescription)
191
+            changeInput(data[0].posterTitle)
192
+          }
193
+        }).catch((err) => {
194
+          message.info(err.msg || err.message)
195
+        })
196
+      }, [])
197
+    }
175
 
198
 
176
     const submitPoster  = () => {
199
     const submitPoster  = () => {
177
-      console.log(inputValue)
178
-      console.log(textAreaValue)
179
-      console.log(imgValue)
180
-      console.log(dynamicId)
200
+       if(dynamicId){
201
+        if(posterId){
202
+          request({
203
+            url: '/api/admin/poster/'+posterId,
204
+            method: 'PUT',
205
+            data: {targetId: dynamicId,targetType: 'activity',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},
206
+          }).then((data) => {
207
+            message.info("保存成功")
208
+          }).catch((err) => {
209
+            message.info(err.msg || err.message)
210
+          })
211
+         }else{
212
+          request({
213
+            url: '/api/admin/poster',
214
+            method: 'POST',
215
+            data: {targetId: dynamicId,targetType: 'activity',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},
216
+          }).then((data) => {
217
+            setPosterId(data.posterId)
218
+            message.info("保存成功")
219
+          }).catch((err) => {
220
+            message.info(err.msg || err.message)
221
+          })
222
+         }
223
+       }else{
224
+        message.warn("请先保存基本信息数据")
225
+       }
181
     }
226
     }
182
 
227
 
183
     return <div>
228
     return <div>
217
         <div >
262
         <div >
218
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
263
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
219
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
264
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
220
-            <ImageUploader onChange={e => changeImg(e)} />
265
+            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
221
           </div>
266
           </div>
222
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
267
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
223
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
268
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
224
-            <Input style={{ width: '20vw' }} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
269
+            <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
225
           </div>
270
           </div>
226
           <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
271
           <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
227
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
272
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
228
-            <TextArea rows={5} onChange={e => changeTextArea(e.target.value)} />
273
+            <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
229
           </div>
274
           </div>
230
 
275
 
231
         </div>
276
         </div>
241
   const Share = (props) => {
286
   const Share = (props) => {
242
     const [inputValue, changeInput] = useState('')
287
     const [inputValue, changeInput] = useState('')
243
     const [imgValue, changeImg] = useState('')
288
     const [imgValue, changeImg] = useState('')
244
-    // const changeInputValue = e => {
245
-    //   changeInput(e.target.value)
246
-    // }
247
-
248
-    // const handleSubmit = (values) => {
289
+    const [shareContentId, setShareContentId] = useState('')
290
+    
291
+    if(dynamicId){
292
+      useEffect(() => {
293
+        request({
294
+          url: '/api/admin/shareContent',
295
+          method: 'GET',
296
+          params: {targetId: dynamicId,targetType: 'activity'},
297
+        }).then((data) => {
298
+          console.log(data,"2222")
299
+          if(data.length > 0){
300
+            setShareContentId(data[0].shareContentId)
301
+            changeImg(data[0].shareContentImg)
302
+            changeInput(data[0].shareContentTitle)
303
+          }
304
+        }).catch((err) => {
305
+          message.info(err.msg || err.message)
306
+        })
307
+      }, [])
308
+    }
249
 
309
 
250
-    // }
310
+    const submitShare = () => {
311
+      if(dynamicId){
312
+        if(shareContentId){
313
+          request({
314
+            url: '/api/admin/shareContent/'+shareContentId,
315
+            method: 'PUT',
316
+            data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},
317
+          }).then((data) => {
318
+            message.info("保存成功")
319
+          }).catch((err) => {
320
+            message.info(err.msg || err.message)
321
+          })
322
+         }else{
323
+          request({
324
+            url: '/api/admin/shareContent',
325
+            method: 'POST',
326
+            data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},
327
+          }).then((data) => {
328
+            setShareContentId(data.shareContentId)
329
+            message.info("保存成功")
330
+          }).catch((err) => {
331
+            message.info(err.msg || err.message)
332
+          })
333
+         }
334
+       }else{
335
+        message.warn("请先保存基本信息数据")
336
+       }
337
+    }
251
 
338
 
252
     return <div style={{ padding: '20px' }}>
339
     return <div style={{ padding: '20px' }}>
253
       <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
340
       <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
260
       </div>
347
       </div>
261
       <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
348
       <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
262
         <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
349
         <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
263
-        <Input placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
350
+        <Input placeholder="请输入海报标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
264
       </div>
351
       </div>
265
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
352
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
266
         <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
353
         <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
267
-        <ImageUploader onChange={e => changeImg(e)} />
354
+        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
268
       </div>
355
       </div>
269
-      <Button type="primary" htmlType="submit" style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
356
+      <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
270
       <Button onClick={() => router.go(-1)}>取消</Button>
357
       <Button onClick={() => router.go(-1)}>取消</Button>
271
     </div>
358
     </div>
272
   }
359
   }

+ 180
- 0
src/pages/indexEcharts/components/UserSource.jsx 查看文件

1
+import React, { Component, useState, useEffect } from 'react';
2
+
3
+import EChart from '../../../components/EchartsTest/EChart';
4
+import request from '../../../utils/request';
5
+import apis from '../../../services/apis';
6
+import dayjs from 'dayjs';
7
+import router from 'umi/router';
8
+import {Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
+// import UserSource from './mmm';
10
+
11
+
12
+const UserSource = (props) => {
13
+
14
+  const [data, setData] = useState({ records: [] })
15
+  //柱图
16
+
17
+  useEffect(() => {
18
+    userResource()
19
+  }, [])
20
+
21
+  function userResource () {
22
+    request({
23
+      ...apis.indexEcharts.userResource,
24
+      params: { pageNum: 1, pageSize: 9999 }
25
+    }).then((data) => {
26
+      // console.log(data , '3333')
27
+      setData(data)
28
+    })
29
+  }
30
+
31
+  function toEdit () {
32
+    router.push({
33
+      pathname: '/indexEcharts/userSource',
34
+      // query: {
35
+      //   a: 'b',
36
+      // },
37
+    });
38
+  }
39
+
40
+  const dataset = data || {};
41
+  const source = dataset.columnar || [];
42
+
43
+  // const source = this.dataset.columnar || [];
44
+  const subtitle = '最近7天';
45
+  const baroptions = {
46
+    color: ['#286DD0', '#8565CE', '#6A96F8', '#F5749E', '#8B7FE2'],
47
+    xAxis: { type: 'category' },
48
+    legend: {
49
+      left: '20%',
50
+      data: ['所有用户', '注册用户'],
51
+    },
52
+
53
+    tooltip: {},
54
+
55
+    yAxis: {},
56
+    series: [
57
+      { type: 'bar', name: '所有用户', datasetIndex: 0 },
58
+      { type: 'bar', name: '注册用户' },
59
+    ],
60
+    dataset: {
61
+      id: 'bar',
62
+      dimensions: ['fromName', 'userCount', 'registered'],
63
+      source: source,
64
+    },
65
+
66
+  }
67
+  const { person_estate_agent = 0, person_null = 0, person_realty_consultant = 0 } = dataset.pie || {};
68
+  const pieoptions = {
69
+    // xAxis: {},
70
+    color: ['#286DD0', '#8565CE', '#6A96F8', '#F5749E', '#8B7FE2'],
71
+    legend: {
72
+      // left: '70%',
73
+      data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
74
+    },
75
+    tooltip: {},
76
+    // yAxis: {},
77
+
78
+    series: [
79
+      {
80
+        type: 'pie',
81
+        // datasetIndex: 1,
82
+        center: ['50%', '50%'],
83
+        radius: [0, '50%'],
84
+      },
85
+    ],
86
+    dataset: {
87
+      id: 'pie',
88
+      source: [
89
+        { form: '来源置业顾问', value: person_realty_consultant },
90
+        { form: '来源全民经纪人', value: person_estate_agent },
91
+        { form: '自主进入', value: person_null },
92
+      ]
93
+    },
94
+
95
+
96
+
97
+
98
+
99
+  }
100
+  function handleSelectChange (e) {
101
+    // eslint-disable-next-line no-console
102
+    console.log(e)
103
+  }
104
+
105
+  //表格
106
+  const dataSource = [
107
+    {
108
+      name: '置业顾问',
109
+      status: '1',//显示停用
110
+    },
111
+    {
112
+      name: '置业经理',
113
+      status: '1',//停用
114
+    },
115
+  ];
116
+
117
+  const columns = [
118
+    // {
119
+    //   title: '商品图片',
120
+    //   dataIndex: 'img',
121
+    //   key: 'img',
122
+    //   align: 'center',
123
+  
124
+    //   render: (text, record) => <img src={record.img} className={channels.touxiang} />,
125
+    // },
126
+    {
127
+      title: '角色名称',
128
+      dataIndex: 'name',
129
+      key: 'name',
130
+      align: 'center',
131
+      render: text => <a>{text}</a>,
132
+    },
133
+  
134
+    {
135
+      title: '操作  ',
136
+      dataIndex: 'status',
137
+      key: 'status',
138
+      align: 'center',
139
+  
140
+      render: () => <>11</>
141
+       
142
+    },
143
+  ];
144
+
145
+  const style = {
146
+    width: '100%',
147
+    height: '400px',
148
+
149
+  }
150
+  const styles = {
151
+    width: '100%',
152
+    height: '400px',
153
+
154
+  }
155
+
156
+
157
+  return (
158
+    <>
159
+      <div>
160
+        <h3>用户来源 <small>{subtitle}</small></h3>
161
+        <Row>
162
+          <Col span={16}>
163
+            <EChart options={baroptions} style={style} /></Col>
164
+          <Col span={8}>
165
+            <EChart options={pieoptions} style={styles} /></Col>
166
+        </Row>
167
+      </div>
168
+      <Select style={{ width: '180px' }} placeholder="所有用户" onChange={handleSelectChange}>
169
+        <Option value={0}>所有用户</Option>
170
+        <Option value={1}>注册用户</Option>
171
+      </Select>
172
+
173
+
174
+      <Table dataSource={dataSource} columns={columns} />
175
+
176
+    </>
177
+  )
178
+}
179
+
180
+export default UserSource;

+ 27
- 0
src/pages/indexEcharts/index.jsx 查看文件

1
+
2
+import React, { useState, useEffect }  from 'react';
3
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Row, Col, Tag, Pagination, Modal, DatePicker } from 'antd';
4
+
5
+// import styles from '../../style/GoodsList.less';
6
+import router from 'umi/router';
7
+
8
+import request from '../../utils/request'
9
+import apis from '../../services/apis';
10
+// import Styles from './style.less';/
11
+import UserSource from './components/UserSource.jsx';
12
+
13
+
14
+const header = (props) => {
15
+
16
+
17
+  return (
18
+
19
+    <>
20
+    {/* <div>2222</div> */}
21
+     <UserSource  ></UserSource>
22
+    </>
23
+  )
24
+}
25
+
26
+
27
+export default  header

+ 77
- 0
src/pages/indexEcharts/userSource.jsx 查看文件

1
+import dayjs from 'dayjs';
2
+import React from 'react';
3
+import {Radio, DatePicker,  Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
4
+
5
+import UserSource from './components/UserSource.jsx';
6
+// import XForm, { FieldTypes } from '../../components/XForm';
7
+import moment from 'moment';
8
+
9
+
10
+const header = props => {
11
+  const { RangePicker } = DatePicker;
12
+  function onChange(dates, dateStrings) {
13
+    console.log('From: ', dates[0], ', to: ', dates[1]);
14
+    console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
15
+  }
16
+
17
+
18
+  const handleSubmit = (e, props) => {
19
+    e.preventDefault();
20
+    // props.form.validateFields((err, values) => {
21
+    //   if (!err) {
22
+    //     getList({ pageNum: 1, pageSize: 10, ...values })
23
+    //   }
24
+    // });
25
+  }
26
+
27
+
28
+  function getDataOf(days){      
29
+    // const endDate = new Date()
30
+    // const startDate = dayjs().subtract(days, 'day').toDate()
31
+
32
+    // this.$refs.chart.getData({ startDate, endDate })
33
+  }
34
+
35
+  function onChange(e) {
36
+    console.log(`radio checked:${e.target.value}`);
37
+  }
38
+
39
+  return (<>
40
+  {/* <el-button type="text" @click="() => getDataOf(7)">最近7天</el-button>
41
+      <el-button type="text" @click="() => getDataOf(30)">最近1月</el-button>
42
+      <el-date-picker
43
+        v-model="dateRange"
44
+        type="daterange"
45
+        start-placeholder="开始日期"
46
+        end-placeholder="结束日期"
47
+        style="margin-left: 16px">
48
+      </el-date-picker>
49
+      <el-button type="primary" icon="el-icon-search" style="margin-left: 32px" @click="search">查询</el-button>
50
+    </div>
51
+    <user-source ref="chart" mode="all"></user-source> */}
52
+  <Radio.Group onChange={onChange} defaultValue="a">
53
+        <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
54
+        <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
55
+      </Radio.Group>
56
+      <RangePicker
57
+      ranges={{
58
+        Today: [moment(), moment()],
59
+        'This Month': [moment().startOf('month'), moment().endOf('month')],
60
+      }}
61
+      showTime
62
+      format="YYYY/MM/DD HH:mm:ss"
63
+      // onChange={onChange}
64
+    />
65
+     <Button type="primary" htmlType="submit" >
66
+            查询
67
+          </Button>
68
+  <div>
69
+    
70
+
71
+    <UserSource ></UserSource>
72
+  </div>
73
+  </>
74
+  )
75
+}
76
+
77
+export default header

+ 1
- 1
src/pages/staff/list/RoleList.jsx 查看文件

25
 }
25
 }
26
 function toEditRole() {
26
 function toEditRole() {
27
   router.push({
27
   router.push({
28
-    pathname: '/staff/editRole',
28
+    pathname: '/staff/list/addRole',
29
     query: {
29
     query: {
30
       a: 'b',
30
       a: 'b',
31
     },
31
     },

+ 1
- 1
src/pages/staff/list/StaffList.jsx 查看文件

146
             data.labels.map((item, index) => {
146
             data.labels.map((item, index) => {
147
               const color = colors[item];
147
               const color = colors[item];
148
               console.log(color, '------');
148
               console.log(color, '------');
149
-              return <Tag className={Styles.cardTag}  color = {color}>{item}</Tag>
149
+              return <Tag className={Styles.cardTag} color={color}>{item}</Tag>
150
             })
150
             })
151
           }
151
           }
152
         </span>
152
         </span>

+ 162
- 0
src/pages/staff/list/addRole.jsx 查看文件

1
+import React, { useState, useEffect } from 'react';
2
+import { Checkbox, Input, Card } from 'antd';
3
+import { connect } from 'dva';
4
+import XForm, { FieldTypes } from '../../../components/XForm';
5
+import request from '../../../utils/request';
6
+import channels from './channelList.less';
7
+
8
+const { TextArea } = Input;
9
+
10
+
11
+/**
12
+ *
13
+ *
14
+ * @param {*} props
15
+ * @returns
16
+ */
17
+const Edit = props => {
18
+  console.log('props,props', props.user.currentUser)
19
+  const userMenus = props.user.currentUser.menus;
20
+  const userBtns = props.user.currentUser.buttons;
21
+
22
+
23
+  const [data, setData] = useState({ data: [] })
24
+ // 获取当前所有菜单
25
+  useEffect(() => {
26
+    localStorage.removeItem('value');
27
+    menuList({ pageNum: 1, pageSize: 100 })
28
+  }, [])
29
+
30
+  function menuList(params) {
31
+    request({
32
+      url: '/api/admin/menuList',
33
+      method: 'GET',
34
+      params: { ...params },
35
+  // eslint-disable-next-line no-shadow
36
+  }).then(data => {
37
+      console.log(data)
38
+      setData(data)
39
+  })
40
+  }
41
+
42
+  // function SuBmenu(params) {
43
+  //  return Array.from(userMenus).map(Item =>
44
+  //  <Checkbox value={ Item.menuId }> { Item.name }</Checkbox>)
45
+  // }
46
+  // const [tab, changeTab] = useState('basic')
47
+
48
+  const Permission = [
49
+    '项目管理',
50
+    '员工管理',
51
+    '客户管理',
52
+    '系统管理',
53
+    '渠道管理',
54
+    '轮播图管理',
55
+    '资讯管理',
56
+    '活动管理',
57
+    '积分商城',
58
+    '首页数据',
59
+  ]
60
+
61
+  const Poster = props => {
62
+    const dataSource = [
63
+      {
64
+        name: '员工管理',
65
+        per: [
66
+          '111111',
67
+          '22222',
68
+          '33333',
69
+        ],
70
+      },
71
+      {
72
+        name: '角色管理',
73
+        per: [
74
+          '444',
75
+          '555',
76
+          '666',
77
+        ],
78
+      },
79
+    ];
80
+
81
+
82
+    const gridStyle1 = {
83
+      width: '20%',
84
+      textAlign: 'left',
85
+    };
86
+    const gridStyle2 = {
87
+      width: '80%',
88
+      textAlign: 'left',
89
+      height: '69px',
90
+    };
91
+
92
+    return (
93
+    <>
94
+      <div style={{}}>
95
+        {userMenus.map(item => (
96
+          <Card title={<Checkbox>{item.name}</Checkbox>} bordered style={{ width: '100%' }}>
97
+              {
98
+                   userMenus.map(menu => (
99
+
100
+                    (item.menuId === menu.menuRoot && item.menuId !== menu.menuId) &&
101
+                    <>
102
+                      <Card.Grid style={gridStyle1} >
103
+                          <Checkbox>{menu.name}</Checkbox>
104
+                      </Card.Grid>
105
+                      <Card.Grid style={gridStyle2}>
106
+                        {userBtns.map(btn => (
107
+                          <>
108
+                            {
109
+                              btn.menuId === menu.menuId &&
110
+                              <Checkbox>{btn.name}</Checkbox>
111
+                            }
112
+                          </>
113
+                        ))}
114
+                      </Card.Grid>
115
+                   </>
116
+                   ))
117
+              }
118
+          </Card>
119
+        ))}
120
+      </div>
121
+    </>
122
+    )
123
+  }
124
+
125
+  const fields = [
126
+    {
127
+      label: '角色名称',
128
+      name: 'roleName',
129
+      type: FieldTypes.Text,
130
+      // placeholder: '名称',
131
+      value: ''
132
+    },
133
+    {
134
+      label: '简介',
135
+      name: 'roleIntroduction',
136
+      render: <TextArea className={channels.inpuitTxt} ></TextArea>,
137
+      value: ''
138
+
139
+    },
140
+
141
+    {
142
+      label: '菜单权限',
143
+      name: 'rolePermission',
144
+      render:
145
+        <>
146
+          <div>
147
+
148
+            <Poster />
149
+          </div>
150
+        </>,
151
+    },
152
+
153
+  ]
154
+
155
+  const handleSubmit = val => {
156
+    window.console.log('submit data --->', val)
157
+  }
158
+  return <XForm onSubmit={handleSubmit} fields={fields}></XForm>
159
+}
160
+
161
+
162
+export default connect(({ user }) => ({ user }))(Edit);

+ 8
- 8
src/pages/staff/list/editRole.jsx 查看文件

146
       textAlign: 'left',
146
       textAlign: 'left',
147
     };
147
     };
148
 
148
 
149
-{/* <Checkbox>{Permission[index]}</Checkbox> */}
149
+    {/* <Checkbox>{Permission[index]}</Checkbox> */ }
150
     return <>
150
     return <>
151
       <div style={{}}>
151
       <div style={{}}>
152
       {Array.from(data).map(Item =>
152
       {Array.from(data).map(Item =>
157
             
157
             
158
               {dataSource.map((items, indexs) => (
158
               {dataSource.map((items, indexs) => (
159
               <>
159
               <>
160
-                <Card.Grid style={gridStyle1}><Checkbox>{items.name}</Checkbox></Card.Grid>
161
-                
160
+                <Card.Grid style={gridStyle1}><Checkbox value=''>{items.name}</Checkbox></Card.Grid>
161
+
162
                 <Card.Grid style={gridStyle2}>
162
                 <Card.Grid style={gridStyle2}>
163
-                {items.per.map((itemss,indexss) =>(
164
-                  <Checkbox>{items.per[indexss]}</Checkbox>
165
-                ))}
163
+                  {items.per.map((itemss, indexss) => (
164
+                    <Checkbox value=''>{items.per[indexss]}</Checkbox>
165
+                  ))}
166
                 </Card.Grid>
166
                 </Card.Grid>
167
-                </>
167
+              </>
168
             ))}
168
             ))}
169
-            
169
+
170
           </Card>
170
           </Card>
171
 
171
 
172
 
172
 

+ 51
- 0
src/services/apis.js 查看文件

145
       url: `${prefix}/customer/recommend/get/id`,
145
       url: `${prefix}/customer/recommend/get/id`,
146
     },
146
     },
147
   },
147
   },
148
+  indexEcharts: {
149
+    userResource: {
150
+      method: 'GET',
151
+      url: `${prefix}/selectUserResource`
152
+    },
153
+
154
+  }
155
+  // indexEcharts:{
156
+  //   list:{
157
+  //     method:'get',
158
+  //     url: `${commPrefix}/indexStatistical`
159
+  //   },
160
+  //   userResource: {
161
+  //       method:'get',
162
+  //       url: `${commPrefix}/selectUserResource`
163
+  //   },
164
+  //   userConversion: {
165
+  //     method:'get',
166
+  //     url: `${commPrefix}/selectConversion`
167
+  //   },
168
+  //   userActive: {
169
+  //     method:'get',
170
+  //     url: `${commPrefix}/selectActiveUserCount`
171
+  //   },
172
+  //   newUser: {
173
+  //     method:'get',
174
+  //     url: `${commPrefix}/selectNewsUserCount`
175
+  //   },
176
+  //   userBehavior: {
177
+  //     summary: {
178
+  //       method:'get',
179
+  //       url: `${commPrefix}/selectUserBehavior`
180
+  //     },
181
+  //     profile: {
182
+  //       method:'get',
183
+  //       url: `${commPrefix}/selectEventAll`
184
+  //     },
185
+  //   },
186
+  //   intentionUsers: {
187
+  //     method:'get',
188
+  //     url: `${commPrefix}/selectIntentionUser`
189
+  //   },
190
+  //   userSex: {
191
+  //     method:'get',
192
+  //     url: `${commPrefix}/selectSexUser`
193
+  //   },
194
+  //   userCity: {
195
+  //     method:'get',
196
+  //     url: `${commPrefix}/selectCityUser`
197
+  //   },
198
+  // },
148
 }
199
 }