Browse Source

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

许静 5 years ago
parent
commit
f6969a4e20

+ 5
- 5
config/config.js View File

@@ -23,11 +23,11 @@ const plugins = [
23 23
         // default true, when it is true, will use `navigator.language` overwrite default
24 24
         baseNavigator: true,
25 25
       },
26
-      // dynamicImport: {
27
-      //   loadingComponent: './components/PageLoading/index',
28
-      //   webpackChunkName: true,
29
-      //   level: 3,
30
-      // },
26
+      dynamicImport: {
27
+        loadingComponent: './components/PageLoading/index',
28
+        webpackChunkName: true,
29
+        level: 3,
30
+      },
31 31
       pwa: pwa
32 32
         ? {
33 33
           workboxPluginMode: 'InjectManifest',

+ 7
- 1
src/components/SelectButton/BuildSelect.jsx View File

@@ -13,6 +13,7 @@ const { Option } = Select;
13 13
  */
14 14
 const BuildingSelect = (props) => {
15 15
   const [ data, setData ] = useState([])
16
+  const [ value, setValue ] = useState(props.value)
16 17
 
17 18
   useEffect(() => {
18 19
     getCityList();
@@ -28,8 +29,13 @@ const BuildingSelect = (props) => {
28 29
     })
29 30
   }
30 31
 
32
+  const handleChange = (e) => {
33
+    setValue(e)
34
+    props.onChange(e)
35
+  }
36
+
31 37
   return (
32
-      <Select value={props.value} style={{ width: '180px' }} placeholder="请选择项目" onChange={props.onChange}>
38
+      <Select value={value} style={{ width: '180px' }} placeholder="请选择项目" onChange={handleChange}>
33 39
           {data.map(building => (
34 40
             <Option key={building.buildingId}>{building.buildingName}</Option>
35 41
           ))}

+ 2
- 0
src/layouts/SecurityLayout.jsx View File

@@ -25,6 +25,8 @@ class SecurityLayout extends React.Component {
25 25
     const { isReady } = this.state;
26 26
     const { children, loading, currentUser } = this.props;
27 27
 
28
+    console.log('------------>', loading, currentUser)
29
+
28 30
     if ((!currentUser.userId && loading) || !isReady) {
29 31
       return <PageLoading />;
30 32
     }

+ 1
- 2
src/models/login.js View File

@@ -36,7 +36,6 @@ const Model = {
36 36
       }
37 37
 
38 38
       yield put(routerRedux.replace(redirect || '/'));
39
-      
40 39
     },
41 40
 
42 41
     *getCaptcha({ payload }, { call }) {
@@ -60,7 +59,7 @@ const Model = {
60 59
   },
61 60
   reducers: {
62 61
     changeLoginStatus(state, { payload }) {
63
-      setAuthority('admin');
62
+      setAuthority((payload.user.roles || []).map(x => x.roleId));
64 63
       return { ...state, status: 'ok', type: payload.type };
65 64
     },
66 65
   },

+ 35
- 8
src/pages/system/intention.jsx View File

@@ -19,8 +19,10 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19 19
  */
20 20
  const Edit = (props) => {
21 21
   const [ data, setData ] = useState([])
22
+  const [ buildingIdValue, setBuildingIdData ] = useState('')
22 23
 
23 24
   const changBuilding = (buildingId) => {
25
+    setBuildingIdData(buildingId)
24 26
     request({
25 27
       url: '/api/admin/tdBizEventIntention',
26 28
       method: 'GET',
@@ -31,6 +33,32 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
31 33
     })
32 34
   }
33 35
 
36
+  const changeBox = (x) => (e) => {
37
+    setData(data.map((item) => {
38
+      return x.eventId === item.eventId ? {...item, checkbox: e.target.checked} : item
39
+    }))
40
+  }
41
+
42
+  const changeInput = (x) => (e) => {
43
+    setData(data.map((item) => {
44
+      return x.eventId === item.eventId ? {...item, intention: e.target.value} : item
45
+    }))
46
+  }
47
+
48
+  const submitValue = () => {
49
+    console.log(buildingIdValue)
50
+    if(buildingIdValue === ''){
51
+      return
52
+    }
53
+    request({
54
+      url: '/api/admin/taBuildingIntentionAddOrUpdate/' + buildingIdValue,
55
+      method: 'POST',
56
+      data
57
+    }).then((data) => {
58
+      message.info("保存成功")
59
+    })
60
+  }
61
+
34 62
   return (
35 63
     <>
36 64
     <Row>
@@ -39,26 +67,25 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
39 67
       </Col>
40 68
     </Row>
41 69
     <Row>
42
-      <Col span={6} offset={6}>
70
+      <Col span={3} offset={3}>
43 71
         用户操作
44 72
       </Col>
45
-      <Col span={6} offset={6}>
73
+      <Col span={3} offset={3}>
46 74
         意向值
47 75
       </Col>
48 76
     </Row>
49 77
     {data.map((x) => {
50
-      console.log(x)
51 78
       return <Row>
52
-                <Col span={6} offset={6}>
53
-                {x.eventName}
79
+                <Col span={3} offset={3}>
80
+                  <Checkbox checked={x.checkbox} onChange={changeBox(x)}>{x.eventName}</Checkbox>
54 81
                 </Col>
55
-                <Col span={6} offset={6}>
56
-                  {x.intention}
82
+                <Col span={3} offset={3}>
83
+                  <Input value={x.intention} onChange={changeInput(x)}/>
57 84
                 </Col>
58 85
               </Row>
59 86
     })}
60 87
     <Row>
61
-      <Button type="primary" className={styles.searchBtn} >确定</Button>
88
+      <Button type="primary" className={styles.searchBtn} onClick={submitValue}>确定</Button>
62 89
     </Row>
63 90
     </>
64 91
   );

+ 4
- 2
src/pages/system/report.jsx View File

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message,Checkbox } from 'antd';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message,Checkbox,Row, Col  } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import moment from 'moment';
@@ -62,7 +62,9 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
62 62
 
63 63
   return (
64 64
     <>
65
-      <Checkbox.Group options={data} value={checkData} onChange={onChange} />
65
+      <Row>
66
+        <Checkbox.Group options={data} value={checkData} onChange={onChange} />
67
+      </Row>
66 68
       <Button type="primary" className={styles.searchBtn} onClick={saveCheckedReport}>提交</Button>
67 69
     </>
68 70
   );

+ 8
- 1
src/utils/request.js View File

@@ -4,6 +4,8 @@
4 4
  */
5 5
 import request from 'umi-request';
6 6
 import { notification } from 'antd';
7
+import apis from '../services/apis';
8
+
7 9
 const codeMessage = {
8 10
   200: '服务器成功返回请求的数据。',
9 11
   201: '新建或修改数据成功。',
@@ -25,7 +27,7 @@ const codeMessage = {
25 27
 const replaceURLParams = (url, params = {}) => {
26 28
   return Object.keys(params).reduce((acc, k) => { // 此方法对每个元素进行处理
27 29
     const re = new RegExp(`:${k}(?!w)`, 'i')
28
-    return acc.replace(re, args[k])
30
+    return acc.replace(re, params[k])
29 31
   }, url)
30 32
 }
31 33
 
@@ -92,6 +94,9 @@ request.interceptors.response.use(async (response, options) => {
92 94
   }
93 95
 });
94 96
 
97
+
98
+const fetch = api => options => request(api.url, {...api, ...options || {}})
99
+
95 100
 export default config => {
96 101
   if (typeof config === 'string') {
97 102
     return request(config);
@@ -100,3 +105,5 @@ export default config => {
100 105
     return request(url, options);
101 106
   }
102 107
 };
108
+
109
+export { fetch, apis }