xujing 5 vuotta sitten
vanhempi
commit
3480de0205

+ 41
- 15
src/pages/carouselFigure/SelectActivity.jsx Näytä tiedosto

@@ -1,8 +1,9 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
2
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5 5
 const getActivities = fetch(apis.activity.listSelected)
6
+const { Search } = Input;
6 7
 
7 8
 export default (props) => {
8 9
   const {
@@ -13,7 +14,7 @@ export default (props) => {
13 14
 
14 15
   const [list, setList] = useState([]);
15 16
   const [visible, setVisible] = useState(false);
16
-  const [ activity, setActivity ] = useState({ dynamicId: undefined, title: '请选择活动' })
17
+  const [activity, setActivity] = useState({ dynamicId: undefined, title: '请选择活动' })
17 18
   const getActTitle = val => ((list.filter(x => x.dynamicId === val)[0]) || {}).title || '请选择活动'
18 19
   const setAct = val => setActivity({ dynamicId: val, title: getActTitle(val) })
19 20
 
@@ -39,12 +40,29 @@ export default (props) => {
39 40
   if (value !== activity.dynamicId) {
40 41
     setAct(value);
41 42
   }
43
+  const searchActivity =(e)=>{
44
+    getActivities({
45
+      params: {
46
+        buildingId,
47
+        pageNum: 1,
48
+        pageSize: 999,
49
+        activityStatus: 2,
50
+        name:e
51
+      }
52
+    }).then((data) => {
53
+      setList(data.list || [])
54
+
55
+      console.log('----', buildingId, value)
56
+
57
+      // setAct(buildingId ? undefined : value);
58
+    })
59
+  }
42 60
 
43 61
   let chooseVal = value
44 62
 
45 63
   const handleChange = val => chooseVal = val
46 64
 
47
-  const setData=val=>{
65
+  const setData = val => {
48 66
     setAct(val)
49 67
     onChange(val)
50 68
     setVisible(false)
@@ -55,35 +73,43 @@ export default (props) => {
55 73
       title: '标题',
56 74
       dataIndex: 'title',
57 75
       key: 'dynamicId',
58
-      align:'center',
59
-      ellipsis:true,
76
+      align: 'center',
77
+      ellipsis: true,
60 78
       render: text => <a>{text}</a>,
61 79
     },
62 80
     {
63 81
       title: '操作',
64 82
       dataIndex: 'name',
65
-      align:'center',
66
-      width:'20%',
83
+      align: 'center',
84
+      width: '20%',
67 85
       render: (text, record) => (
68 86
         <span>
69
-          <a onClick={() => setData(record.dynamicId)} style={{color:'blue'}}>选择</a>
87
+          <a onClick={() => setData(record.dynamicId)} style={{ color: 'blue' }}>选择</a>
70 88
         </span>
71 89
       ),
72 90
     },
73 91
   ];
74 92
 
75 93
   return (
76
-  <div>
77
-    <div onClick={() => setVisible(true)}>{activity.title}</div>
94
+
95
+    <div>
96
+      <div onClick={() => setVisible(true)}>{activity.title}</div>
78 97
       <Modal
79
-        title="请选择H5"
98
+        title="请选择"
80 99
         visible={visible}
81
-         onCancel={() => setVisible(false)}
82
-         footer={[]}
100
+        onCancel={() => setVisible(false)}
101
+        footer={[]}
83 102
       >
84
-       <Table rowKey={list => list.dynamicId} columns={columns} dataSource={list} />
103
+        <Search
104
+          placeholder="输入h5名称"
105
+          enterButton="搜索"
106
+          size="large"
107
+          onSearch={value => searchActivity(value)}
108
+          style={{ marginBottom: '16px' }}
109
+        />
110
+        <Table rowKey={list => list.dynamicId} columns={columns} dataSource={list} />
85 111
       </Modal>
86
-  </div>
112
+    </div>
87 113
 
88 114
   );
89 115
 }

+ 39
- 15
src/pages/carouselFigure/SelectGroup.jsx Näytä tiedosto

@@ -1,7 +1,9 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
2
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5
+const { Search } = Input;
6
+
5 7
 const getGroupList = fetch(apis.groupActivity.EffectiveList)
6 8
 
7 9
 export default props => {
@@ -35,16 +37,31 @@ export default props => {
35 37
       updateGroup(buildingId ? undefined : value);
36 38
     })
37 39
   }, [buildingId]);
40
+  const searchGroup = (e) => {
41
+    getGroupList({
42
+      params: {
43
+        buildingId,
44
+        pageNum: 1,
45
+        pageSize: 999,
46
+        status: 1,
47
+        name: e
48
+      }
49
+    }).then((data) => {
50
+      setList(data.records || [])
38 51
 
52
+      updateGroup(buildingId ? undefined : value);
53
+      // setAct(buildingId ? undefined : value);
54
+    })
55
+  }
39 56
   if (value !== group.groupId) {
40 57
     updateGroup(value);
41 58
   }
42 59
 
43 60
   const handleChange = val => {
44
-      onChange(val)
61
+    onChange(val)
45 62
   }
46 63
 
47
-  const setData=val=>{
64
+  const setData = val => {
48 65
     updateGroup(val)
49 66
     onChange(val)
50 67
     setVisible(false)
@@ -55,33 +72,40 @@ export default props => {
55 72
       title: '标题',
56 73
       dataIndex: 'activityName',
57 74
       key: 'groupActivityId',
58
-      align:'center',
59
-      ellipsis:true,
75
+      align: 'center',
76
+      ellipsis: true,
60 77
       render: text => <a>{text}</a>,
61 78
     },
62 79
     {
63 80
       title: '操作',
64
-      align:'center',
65
-      width:'20%',
81
+      align: 'center',
82
+      width: '20%',
66 83
       render: (text, record) => (
67 84
         <span>
68
-          <a onClick={() => setData(record.groupActivityId)} style={{color:'blue'}}>选择</a>
85
+          <a onClick={() => setData(record.groupActivityId)} style={{ color: 'blue' }}>选择</a>
69 86
         </span>
70 87
       ),
71 88
     },
72 89
   ];
73 90
 
74 91
   return (
75
-  <div>
76
-    <div onClick={() => setVisible(true)}>{group.groupName}</div>
92
+    <div>
93
+      <div onClick={() => setVisible(true)}>{group.groupName}</div>
77 94
       <Modal
78
-        title="请选择H5"
95
+        title="请选择"
79 96
         visible={visible}
80
-         onCancel={() => setVisible(false)}
81
-         footer={[]}
97
+        onCancel={() => setVisible(false)}
98
+        footer={[]}
82 99
       >
83
-       <Table rowKey={list => list.groupActivityId} columns={columns} dataSource={list} />
100
+        <Search
101
+          placeholder="输入h5名称"
102
+          enterButton="搜索"
103
+          size="large"
104
+          onSearch={value => searchGroup(value)}
105
+          style={{ marginBottom: '16px' }}
106
+        />
107
+        <Table rowKey={list => list.groupActivityId} columns={columns} dataSource={list} />
84 108
       </Modal>
85
-  </div>
109
+    </div>
86 110
   );
87 111
 }

+ 42
- 19
src/pages/carouselFigure/SelectH5.1.jsx Näytä tiedosto

@@ -1,8 +1,9 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Select, Modal, Button } from 'antd';
2
+import { Select, Modal, Button, Input } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5 5
 const getH5List = fetch(apis.h5Activity.EffectiveList)
6
+const { Search } = Input;
6 7
 
7 8
 export default props => {
8 9
   const {
@@ -13,9 +14,9 @@ export default props => {
13 14
 
14 15
   const [list, setList] = useState([]);
15 16
   const [visible, setVisible] = useState(false);
16
-  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择H5' })
17
+  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择' })
17 18
   const getGroupTitle = val => {
18
-    return (list.filter(x => x.drainageId == val)[0] || {}).name || '请选择H5'
19
+    return (list.filter(x => x.drainageId == val)[0] || {}).name || '请选择'
19 20
   }
20 21
   const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
21 22
 
@@ -33,16 +34,31 @@ export default props => {
33 34
       updateGroup(value ? undefined : value);
34 35
     })
35 36
   }, []);
37
+  const searchH5 = (e) => {
38
+    getH5List({
39
+      params: {
40
+        buildingId,
41
+        pageNum: 1,
42
+        pageSize: 999,
43
+        activityStatus: 2,
44
+        name: e
45
+      }
46
+    }).then((data) => {
47
+      setList(data.records || [])
48
+
49
+      updateGroup(value ? undefined : value);
50
+    })
51
+  }
36 52
 
37 53
   if (value !== group.groupId) {
38 54
     updateGroup(value);
39 55
   }
40 56
 
41 57
   const handleChange = val => {
42
-      onChange(val)
58
+    onChange(val)
43 59
   }
44 60
 
45
-  const setData=val=>{
61
+  const setData = val => {
46 62
     updateGroup('')
47 63
     onChange('')
48 64
   }
@@ -51,25 +67,32 @@ export default props => {
51 67
     <div>
52 68
       <div onClick={() => setVisible(true)}>{group.groupName}</div>
53 69
       <Modal
54
-        title="请选择H5"
70
+        title="请选择"
55 71
         visible={visible}
56
-         onCancel={() => setVisible(false)}
57
-         footer={[
58
-            <Button key="back" onClick={() => setVisible(false)}>
59
-              取消
72
+        onCancel={() => setVisible(false)}
73
+        footer={[
74
+          <Button key="back" onClick={() => setVisible(false)}>
75
+            取消
60 76
             </Button>,
61
-            <Button key="cancel" onClick={() => setData(value)}>
62
-              清空
77
+          <Button key="cancel" onClick={() => setData(value)}>
78
+            清空
63 79
             </Button>,
64
-            <Button key="submit" type="primary" onClick={() => {
65
-              updateGroup(value)
66
-              onChange(value)
67
-              setVisible(false)
68
-            }}>
69
-              提交
80
+          <Button key="submit" type="primary" onClick={() => {
81
+            updateGroup(value)
82
+            onChange(value)
83
+            setVisible(false)
84
+          }}>
85
+            提交
70 86
             </Button>
71
-          ]}
87
+        ]}
72 88
       >
89
+        <Search
90
+          placeholder="输入h5名称"
91
+          enterButton="搜索"
92
+          size="large"
93
+          onSearch={value => searchH5(value)}
94
+          style={{ marginBottom: '16px' }}
95
+        />
73 96
         <Select
74 97
           showSearch
75 98
           value={value ? parseInt(value) : undefined}

+ 42
- 20
src/pages/carouselFigure/SelectH5.jsx Näytä tiedosto

@@ -1,10 +1,10 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
2
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5 5
 const { Column, ColumnGroup } = Table;
6 6
 const getH5List = fetch(apis.h5Activity.EffectiveList)
7
-
7
+const { Search } = Input;
8 8
 export default props => {
9 9
   const {
10 10
     value,
@@ -14,9 +14,9 @@ export default props => {
14 14
 
15 15
   const [list, setList] = useState([]);
16 16
   const [visible, setVisible] = useState(false);
17
-  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择H5' })
17
+  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择' })
18 18
   const getGroupTitle = val => {
19
-    return (list.filter(x => x.drainageId == val)[0] || {}).name || '请选择H5'
19
+    return (list.filter(x => x.drainageId == val)[0] || {}).name || '请选择'
20 20
   }
21 21
   const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
22 22
 
@@ -34,16 +34,31 @@ export default props => {
34 34
       updateGroup(value ? undefined : value);
35 35
     })
36 36
   }, []);
37
+  const searchH5 = (e) => {
38
+    getH5List({
39
+      params: {
40
+        pageNum: 1,
41
+        pageSize: 999,
42
+        isMiniapp: 1,
43
+        status: 1,
44
+        name: e
45
+      },
46
+    }).then(data => {
47
+      setList(data.records || [])
48
+
49
+      updateGroup(value ? undefined : value);
50
+    })
51
+  }
37 52
 
38 53
   if (value !== group.groupId) {
39 54
     updateGroup(value);
40 55
   }
41 56
 
42 57
   const handleChange = val => {
43
-      onChange(val)
58
+    onChange(val)
44 59
   }
45 60
 
46
-  const setData=val=>{
61
+  const setData = val => {
47 62
     updateGroup(val)
48 63
     onChange(val)
49 64
     setVisible(false)
@@ -54,33 +69,40 @@ export default props => {
54 69
       title: '标题',
55 70
       dataIndex: 'name',
56 71
       key: 'drainageId',
57
-      align:'center',
58
-      ellipsis:true,
72
+      align: 'center',
73
+      ellipsis: true,
59 74
       render: text => <a>{text}</a>,
60 75
     },
61 76
     {
62 77
       title: '操作',
63
-      align:'center',
64
-      width:'20%',
78
+      align: 'center',
79
+      width: '20%',
65 80
       render: (text, record) => (
66 81
         <span>
67
-          <a onClick={() => setData(record.drainageId)} style={{color:'blue'}}>选择</a>
82
+          <a onClick={() => setData(record.drainageId)} style={{ color: 'blue' }}>选择</a>
68 83
         </span>
69 84
       ),
70 85
     },
71 86
   ];
72 87
 
73
-  return(
88
+  return (
74 89
     <div>
75 90
       <div onClick={() => setVisible(true)}>{group.groupName}</div>
76
-        <Modal
77
-          title="请选择H5"
78
-          visible={visible}
79
-           onCancel={() => setVisible(false)}
80
-           footer={[]}
81
-        >
82
-         <Table rowKey={list => list.drainageId} columns={columns} dataSource={list} />
83
-        </Modal>
91
+      <Modal
92
+        title="请选择"
93
+        visible={visible}
94
+        onCancel={() => setVisible(false)}
95
+        footer={[]}
96
+      >
97
+        <Search
98
+          placeholder="输入h5名称"
99
+          enterButton="搜索"
100
+          size="large"
101
+          onSearch={value => searchH5(value)}
102
+          style={{ marginBottom: '16px' }}
103
+        />
104
+        <Table rowKey={list => list.drainageId} columns={columns} dataSource={list} />
105
+      </Modal>
84 106
     </div>
85 107
   )
86 108
 }

+ 37
- 15
src/pages/carouselFigure/SelectHelp.jsx Näytä tiedosto

@@ -1,7 +1,8 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 
3
-import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
3
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
4 4
 import { apis, fetch } from '../../utils/request';
5
+const { Search } = Input;
5 6
 
6 7
 const getHelpList = fetch(apis.helpActivity.effectiveList)
7 8
 
@@ -37,7 +38,21 @@ export default props => {
37 38
       updateHelp(value ? undefined : value);
38 39
     })
39 40
   }, [buildingId]);
41
+  const searchHelp = (e) => {
42
+    getHelpList({
43
+      params: {
44
+        buildingId,
45
+        pageNum: 1,
46
+        pageSize: 999,
47
+        status: 1,
48
+        name: e
49
+      },
50
+    }).then(data => {
51
+      setList(data.records || [])
40 52
 
53
+      updateHelp(value ? undefined : value);
54
+    })
55
+  }
41 56
   if (value !== help.helpId) {
42 57
     updateHelp(value);
43 58
   }
@@ -46,7 +61,7 @@ export default props => {
46 61
     onChange(val)
47 62
   }
48 63
 
49
-  const setData=val=>{
64
+  const setData = val => {
50 65
     updateHelp(val)
51 66
     onChange(val)
52 67
     setVisible(false)
@@ -57,17 +72,17 @@ export default props => {
57 72
       title: '标题',
58 73
       dataIndex: 'title',
59 74
       key: 'helpActivityId',
60
-      align:'center',
61
-      ellipsis:true,
75
+      align: 'center',
76
+      ellipsis: true,
62 77
       render: text => <a>{text}</a>,
63 78
     },
64 79
     {
65 80
       title: '操作',
66
-      align:'center',
67
-      width:'20%',
81
+      align: 'center',
82
+      width: '20%',
68 83
       render: (text, record) => (
69 84
         <span>
70
-          <a onClick={() => setData(record.helpActivityId)} style={{color:'blue'}}>选择</a>
85
+          <a onClick={() => setData(record.helpActivityId)} style={{ color: 'blue' }}>选择</a>
71 86
         </span>
72 87
       ),
73 88
     },
@@ -76,14 +91,21 @@ export default props => {
76 91
   return (
77 92
     <div>
78 93
       <div onClick={() => setVisible(true)}>{help.helpName}</div>
79
-        <Modal
80
-          title="请选择H5"
81
-          visible={visible}
82
-           onCancel={() => setVisible(false)}
83
-           footer={[]}
84
-        >
85
-         <Table rowKey={list => list.helpActivityId} columns={columns} dataSource={list} />
86
-        </Modal>
94
+      <Modal
95
+        title="请选择"
96
+        visible={visible}
97
+        onCancel={() => setVisible(false)}
98
+        footer={[]}
99
+      >
100
+        <Search
101
+          placeholder="输入h5名称"
102
+          enterButton="搜索"
103
+          size="large"
104
+          onSearch={value => searchHelp(value)}
105
+          style={{ marginBottom: '16px' }}
106
+        />
107
+        <Table rowKey={list => list.helpActivityId} columns={columns} dataSource={list} />
108
+      </Modal>
87 109
     </div>
88 110
   );
89 111
 }

+ 37
- 15
src/pages/carouselFigure/SelectNews.jsx Näytä tiedosto

@@ -1,8 +1,9 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
2
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5 5
 const getNewsList = fetch(apis.news.getList)
6
+const { Search } = Input;
6 7
 
7 8
 export default props => {
8 9
   const {
@@ -33,7 +34,21 @@ export default props => {
33 34
       updateNews(buildingId ? undefined : value);
34 35
     })
35 36
   }, [buildingId]);
37
+  const searchActivity = (e) => {
38
+    getNewsList({
39
+      params: {
40
+        buildingId,
41
+        pageNum: 1,
42
+        pageSize: 999,
43
+        newsStatus: 0,
44
+        name: e
45
+      },
46
+    }).then(data => {
47
+      setList(data.records || [])
36 48
 
49
+      updateNews(buildingId ? undefined : value);
50
+    })
51
+  }
37 52
   if (value !== news.newsId) {
38 53
     updateNews(value);
39 54
   }
@@ -42,7 +57,7 @@ export default props => {
42 57
     onChange(val)
43 58
   }
44 59
 
45
-  const setData=val=>{
60
+  const setData = val => {
46 61
     updateNews(val)
47 62
     onChange(val)
48 63
     setVisible(false)
@@ -53,17 +68,17 @@ export default props => {
53 68
       title: '标题',
54 69
       dataIndex: 'newsName',
55 70
       key: 'newsId',
56
-      align:'center',
57
-      ellipsis:true,
71
+      align: 'center',
72
+      ellipsis: true,
58 73
       render: text => <a>{text}</a>,
59 74
     },
60 75
     {
61 76
       title: '操作',
62
-      align:'center',
63
-      width:'20%',
77
+      align: 'center',
78
+      width: '20%',
64 79
       render: (text, record) => (
65 80
         <span>
66
-          <a onClick={() => setData(record.newsId)} style={{color:'blue'}}>选择</a>
81
+          <a onClick={() => setData(record.newsId)} style={{ color: 'blue' }}>选择</a>
67 82
         </span>
68 83
       ),
69 84
     },
@@ -72,14 +87,21 @@ export default props => {
72 87
   return (
73 88
     <div>
74 89
       <div onClick={() => setVisible(true)}>{news.newsName}</div>
75
-        <Modal
76
-          title="请选择H5"
77
-          visible={visible}
78
-           onCancel={() => setVisible(false)}
79
-           footer={[]}
80
-        >
81
-         <Table rowKey={list => list.newsId} columns={columns} dataSource={list} />
82
-        </Modal>
90
+      <Modal
91
+        title="请选择"
92
+        visible={visible}
93
+        onCancel={() => setVisible(false)}
94
+        footer={[]}
95
+      >
96
+        <Search
97
+          placeholder="输入h5名称"
98
+          enterButton="搜索"
99
+          size="large"
100
+          onSearch={value => searchActivity(value)}
101
+          style={{ marginBottom: '16px' }}
102
+        />
103
+        <Table rowKey={list => list.newsId} columns={columns} dataSource={list} />
104
+      </Modal>
83 105
     </div>
84 106
   );
85 107
 }