许静 5 年 前
コミット
41f11f6ff3
共有1 個のファイルを変更した43 個の追加38 個の削除を含む
  1. 43
    38
      src/pages/system/intention.jsx

+ 43
- 38
src/pages/system/intention.jsx ファイルの表示

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message,Checkbox,Row, Col } 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';
@@ -19,13 +19,13 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19 19
  * @param {*} props
20 20
  * @returns
21 21
  */
22
- const Edit = (props) => {
23
-  const [ data, setData ] = useState([])
24
-  const [ buildingIdValue, setBuildingIdData ] = useState('')
22
+const Edit = (props) => {
23
+  const [data, setData] = useState([])
24
+  const [buildingIdValue, setBuildingIdData] = useState('')
25 25
 
26 26
   const changBuilding = (buildingId) => {
27 27
     setBuildingIdData(buildingId)
28
-    request({ ...apis.system.tdBizEventIntention, params: {pageNum: 1, pageSize: 999,buildingId}}).then((data) => {
28
+    request({ ...apis.system.tdBizEventIntention, params: { pageNum: 1, pageSize: 999, buildingId } }).then((data) => {
29 29
       console.log(data)
30 30
       setData(data.records)
31 31
     })
@@ -33,59 +33,64 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
33 33
 
34 34
   const changeBox = (x) => (e) => {
35 35
     setData(data.map((item) => {
36
-      return x.eventId === item.eventId ? {...item, checkbox: e.target.checked} : item
36
+      return x.eventId === item.eventId ? { ...item, checkbox: e.target.checked } : item
37 37
     }))
38 38
   }
39 39
 
40 40
   const changeInput = (x) => (e) => {
41 41
     setData(data.map((item) => {
42
-      return x.eventId === item.eventId ? {...item, intention: e.target.value} : item
42
+      return x.eventId === item.eventId ? { ...item, intention: e.target.value } : item
43 43
     }))
44 44
   }
45 45
 
46 46
   const submitValue = () => {
47 47
     console.log(buildingIdValue)
48
-    if(buildingIdValue === ''){
48
+    if (buildingIdValue === '') {
49 49
       return
50 50
     }
51
-    request({ ...apis.system.taBuildingIntentionAddOrUpdate, urlData: {id: buildingIdValue}, data,}).then((data) => {
51
+    request({ ...apis.system.taBuildingIntentionAddOrUpdate, urlData: { id: buildingIdValue }, data, }).then((data) => {
52 52
       message.info("保存成功")
53 53
     })
54 54
   }
55 55
 
56 56
   return (
57 57
     <>
58
-    <Row>
59
-      <Col span={12}>
60
-        <BuildSelect onChange={changBuilding}/>
61
-      </Col>
62
-    </Row>
63
-    <Row style={{margin:'10px 0'}}>
64
-      <Col span={5} offset={2}>
65
-        用户操作
66
-      </Col>
67
-      <Col span={3} offset={3}>
68
-        意向值
69
-      </Col>
70
-    </Row>
71
-    {data.map((x) => {
72
-      return <Row>
73
-                <Col span={5} offset={2}>
74
-                  <Checkbox checked={x.checkbox} onChange={changeBox(x)}>{x.eventName}</Checkbox>
75
-                </Col>
76
-                <Col span={3} offset={3}>
77
-                  <Input value={x.intention} onChange={changeInput(x)}/>
78
-                </Col>
79
-              </Row>
80
-    })}
81
-    <Row>
82
-      <AuthButton name="admin.taBuildingIntentionAddOrUpdate.buildingId.post" noRight={null}>
83
-        <Button type="primary" className={styles.searchBtn} onClick={submitValue}>确定</Button>
84
-      </AuthButton>
85
-    </Row>
58
+      <Row>
59
+        <Col span={6}>
60
+          <BuildSelect onChange={changBuilding} />
61
+        </Col>
62
+        <Col span={5} style={{ lineHeight: '30px' }}>
63
+          用户操作
64
+        </Col>
65
+        <Col span={5} offset={2} style={{ lineHeight: '30px' }}>
66
+          意向值
67
+        </Col>
68
+        <Col span={2} offset={4}>
69
+          <AuthButton name="admin.taBuildingIntentionAddOrUpdate.buildingId.post" noRight={null}>
70
+            <Button type="primary" className={styles.searchBtn} onClick={submitValue}>确定</Button>
71
+          </AuthButton>
72
+        </Col>
73
+      </Row>
74
+      {data.map((x) => {
75
+        return <Row style={{margin:'5px 0'}}>
76
+          <Col span={6}>
77
+
78
+          </Col>
79
+          <Col span={5} >
80
+            <Checkbox checked={x.checkbox} onChange={changeBox(x)}>{x.eventName}</Checkbox>
81
+          </Col>
82
+          <Col span={5} offset={2}>
83
+            <Input value={x.intention} onChange={changeInput(x)} />
84
+          </Col>
85
+          <Col span={2} offset={4}>
86
+
87
+          </Col>
88
+
89
+        </Row>
90
+      })}
86 91
     </>
87 92
   );
88
- }
93
+}
89 94
 
90 95
 
91 96