Ver código fonte

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

张延森 5 anos atrás
pai
commit
c7e6126992

+ 7
- 1
src/components/SelectButton/BuildSelect.jsx Ver arquivo

13
  */
13
  */
14
 const BuildingSelect = (props) => {
14
 const BuildingSelect = (props) => {
15
   const [ data, setData ] = useState([])
15
   const [ data, setData ] = useState([])
16
+  const [ value, setValue ] = useState(props.value)
16
 
17
 
17
   useEffect(() => {
18
   useEffect(() => {
18
     getCityList();
19
     getCityList();
28
     })
29
     })
29
   }
30
   }
30
 
31
 
32
+  const handleChange = (e) => {
33
+    setValue(e)
34
+    props.onChange(e)
35
+  }
36
+
31
   return (
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
           {data.map(building => (
39
           {data.map(building => (
34
             <Option key={building.buildingId}>{building.buildingName}</Option>
40
             <Option key={building.buildingId}>{building.buildingName}</Option>
35
           ))}
41
           ))}

+ 35
- 8
src/pages/system/intention.jsx Ver arquivo

19
  */
19
  */
20
  const Edit = (props) => {
20
  const Edit = (props) => {
21
   const [ data, setData ] = useState([])
21
   const [ data, setData ] = useState([])
22
+  const [ buildingIdValue, setBuildingIdData ] = useState('')
22
 
23
 
23
   const changBuilding = (buildingId) => {
24
   const changBuilding = (buildingId) => {
25
+    setBuildingIdData(buildingId)
24
     request({
26
     request({
25
       url: '/api/admin/tdBizEventIntention',
27
       url: '/api/admin/tdBizEventIntention',
26
       method: 'GET',
28
       method: 'GET',
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
   return (
62
   return (
35
     <>
63
     <>
36
     <Row>
64
     <Row>
39
       </Col>
67
       </Col>
40
     </Row>
68
     </Row>
41
     <Row>
69
     <Row>
42
-      <Col span={6} offset={6}>
70
+      <Col span={3} offset={3}>
43
         用户操作
71
         用户操作
44
       </Col>
72
       </Col>
45
-      <Col span={6} offset={6}>
73
+      <Col span={3} offset={3}>
46
         意向值
74
         意向值
47
       </Col>
75
       </Col>
48
     </Row>
76
     </Row>
49
     {data.map((x) => {
77
     {data.map((x) => {
50
-      console.log(x)
51
       return <Row>
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
                 </Col>
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
                 </Col>
84
                 </Col>
58
               </Row>
85
               </Row>
59
     })}
86
     })}
60
     <Row>
87
     <Row>
61
-      <Button type="primary" className={styles.searchBtn} >确定</Button>
88
+      <Button type="primary" className={styles.searchBtn} onClick={submitValue}>确定</Button>
62
     </Row>
89
     </Row>
63
     </>
90
     </>
64
   );
91
   );

+ 4
- 2
src/pages/system/report.jsx Ver arquivo

1
 import React, { useState, useEffect } from 'react';
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
 import { FormattedMessage } from 'umi-plugin-react/locale';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
 import styles from '../style/GoodsList.less';
4
 import styles from '../style/GoodsList.less';
5
 import moment from 'moment';
5
 import moment from 'moment';
62
 
62
 
63
   return (
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
       <Button type="primary" className={styles.searchBtn} onClick={saveCheckedReport}>提交</Button>
68
       <Button type="primary" className={styles.searchBtn} onClick={saveCheckedReport}>提交</Button>
67
     </>
69
     </>
68
   );
70
   );