傅行帆 4 lat temu
rodzic
commit
b16ab3a4e7

+ 41
- 41
config/routes.js Wyświetl plik

454
             },
454
             },
455
             ],
455
             ],
456
           },
456
           },
457
-          {
458
-            path: '/staff',
459
-            name: '员工管理',
460
-            component: '../layouts/BlankLayout',
461
-            routes: [
462
-              {
463
-                path: '/staff/StaffList',
464
-                name: '员工列表',
465
-                component: './staff/list/StaffList',
466
-              },
467
-              {
468
-                path: '/staff/editStaff',
469
-                name: '编辑员工',
470
-                hideInMenu: true,
471
-                component: './staff/list/editStaff',
472
-              },
457
+          // {
458
+          //   path: '/staff',
459
+          //   name: '员工管理',
460
+          //   component: '../layouts/BlankLayout',
461
+          //   routes: [
462
+          //     {
463
+          //       path: '/staff/StaffList',
464
+          //       name: '员工列表',
465
+          //       component: './staff/list/StaffList',
466
+          //     },
467
+          //     {
468
+          //       path: '/staff/editStaff',
469
+          //       name: '编辑员工',
470
+          //       hideInMenu: true,
471
+          //       component: './staff/list/editStaff',
472
+          //     },
473
 
473
 
474
-              {
475
-                path: '/staff/RoleList',
476
-                name: '角色管理',
477
-                component: './staff/list/RoleList',
478
-              },
479
-              {
480
-                path: '/staff/editRole',
481
-                name: '编辑角色',
482
-                hideInMenu: true,
483
-                component: './staff/list/editRole',
484
-              },
485
-              {
486
-                path: '/staff/list/addRole',
487
-                name: '添加角色',
488
-                hideInMenu: true,
489
-                component: './staff/list/addRole',
490
-              },
491
-              {
492
-                path: '/staff/list/distribution',
493
-                name: '分配归属',
494
-                hideInMenu: true,
495
-                component: './staff/list/distribution',
496
-              },
497
-            ],
498
-          },
474
+          //     {
475
+          //       path: '/staff/RoleList',
476
+          //       name: '角色管理',
477
+          //       component: './staff/list/RoleList',
478
+          //     },
479
+          //     {
480
+          //       path: '/staff/editRole',
481
+          //       name: '编辑角色',
482
+          //       hideInMenu: true,
483
+          //       component: './staff/list/editRole',
484
+          //     },
485
+          //     {
486
+          //       path: '/staff/list/addRole',
487
+          //       name: '添加角色',
488
+          //       hideInMenu: true,
489
+          //       component: './staff/list/addRole',
490
+          //     },
491
+          //     {
492
+          //       path: '/staff/list/distribution',
493
+          //       name: '分配归属',
494
+          //       hideInMenu: true,
495
+          //       component: './staff/list/distribution',
496
+          //     },
497
+          //   ],
498
+          // },
499
           {
499
           {
500
             path: '/carouselFigure',
500
             path: '/carouselFigure',
501
             name: '资源位管理',
501
             name: '资源位管理',

+ 77
- 0
src/components/SelectButton/ActivityType.jsx Wyświetl plik

1
+import React, { useState, useEffect, useRef } from 'react';
2
+import { Select } from 'antd';
3
+import apis from '../../services/apis';
4
+import request from '../../utils/request'
5
+
6
+const { Option } = Select;
7
+
8
+function usePrevious(props) {
9
+  const ref = useRef();
10
+  useEffect(() => {
11
+    ref.current = props;
12
+  });
13
+  return ref.current;
14
+}
15
+
16
+/**
17
+ *
18
+ *
19
+ * @param {*} props
20
+ * @returns
21
+ */
22
+const ActivityType = props => {
23
+  const [data, setData] = useState([])
24
+  const [value, setValue] = useState([])
25
+  console.log('props', props);
26
+  useEffect(() => {
27
+    getBuildList();
28
+  }, [props.dynamicTypeId])
29
+
30
+
31
+  const getBuildList = e => {
32
+    request({ ...apis.dynamicType.list, params: { pageNum: 1, pageSize: 999 } }).then(data => {
33
+      setData(data.records)
34
+      checkValue(data.records)
35
+      // 默认选中第一个
36
+    })
37
+  }
38
+
39
+
40
+  const checkValue = (data) => {
41
+    if (props.value) {
42
+      const tempData = data.filter(f => f.dynamicTypeId == props.value)
43
+      const va = (tempData.length > 0) ? props.value : '项目已下线,请重新选择项目'
44
+      props.onChange(va)
45
+
46
+    }
47
+  }
48
+
49
+  const onChange = (dynamicTypeId) => {
50
+    const type = data.filter(x => dynamicTypeId === x.dynamicTypeId)[0]
51
+
52
+    props.onChange(dynamicTypeId, type)
53
+    // if (props.value) {
54
+    //   const tempData = data.filter(f => f.buildingId == props.value)
55
+    //   const va = (tempData.length > 0) ? props.value : '项目已下线,请重新选择项目'
56
+    //   props.onChange(va)
57
+
58
+    // }={props.onChange}building.buildingId
59
+  }
60
+
61
+  return (
62
+    <Select
63
+      showSearch
64
+      value={props.value}
65
+      style={{ width: '300px' }}
66
+      placeholder="请选择项目"
67
+      onChange={ onChange}
68
+      filterOption={(input, option) =>
69
+        option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
70
+      }>
71
+      {data.map(type => (
72
+        <Option key={type.dynamicTypeId} value={type.dynamicTypeId}>{type.dynamicTypeName}</Option>
73
+      ))}
74
+    </Select>
75
+  )
76
+}
77
+export default ActivityType

+ 3
- 3
src/pages/activity/ActivityList.jsx Wyświetl plik

188
 
188
 
189
         <EditIcon type={row.home === 1 ? 'cancel' : 'top'} text={row.home === 1 ? '取消推首页' : '推荐首页'} onClick={homeDynamic(row)} />,
189
         <EditIcon type={row.home === 1 ? 'cancel' : 'top'} text={row.home === 1 ? '取消推首页' : '推荐首页'} onClick={homeDynamic(row)} />,
190
 
190
 
191
-        <AuthButton name="admin.buildingDynamic.dataRecord" noRight={null}>
192
-          <EditIcon type="record" text="数据记录" onClick={toDataReacord(row.dynamicId)} />
193
-        </AuthButton>,
191
+        // <AuthButton name="admin.buildingDynamic.dataRecord" noRight={null}>
192
+        //   <EditIcon type="record" text="数据记录" onClick={toDataReacord(row.dynamicId)} />
193
+        // </AuthButton>,
194
 
194
 
195
         (row.activityStatus === 0 || row.activityStatus === 1) ?
195
         (row.activityStatus === 0 || row.activityStatus === 1) ?
196
           <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
196
           <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>

+ 4
- 4
src/pages/activity/detailActivity.jsx Wyświetl plik

5
 import apis from '../../services/apis';
5
 import apis from '../../services/apis';
6
 import moment from 'moment';
6
 import moment from 'moment';
7
 import router from 'umi/router';
7
 import router from 'umi/router';
8
-import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+import ActivityType from '../../components/SelectButton/ActivityType'
9
 import XForm, { FieldTypes } from '../../components/XForm';
9
 import XForm, { FieldTypes } from '../../components/XForm';
10
 import Wangedit from '../../components/Wangedit/Wangedit'
10
 import Wangedit from '../../components/Wangedit/Wangedit'
11
 import request from '../../utils/request'
11
 import request from '../../utils/request'
112
     <>
112
     <>
113
       <Form {...formItemLayout} onSubmit={handleSubmit}>
113
       <Form {...formItemLayout} onSubmit={handleSubmit}>
114
         <Form.Item label="活动类型">
114
         <Form.Item label="活动类型">
115
-          {getFieldDecorator('buildingId', {
116
-            initialValue: detailData.buildingId,
115
+          {getFieldDecorator('dynamicTypeId', {
116
+            initialValue: detailData.dynamicTypeId,
117
             rules: [
117
             rules: [
118
               {
118
               {
119
                 required: true,
119
                 required: true,
120
                 message: '请选择活动类型',
120
                 message: '请选择活动类型',
121
               },
121
               },
122
             ],
122
             ],
123
-          })(<BuildSelect disabled />)}
123
+          })(<ActivityType disabled />)}
124
         </Form.Item>
124
         </Form.Item>
125
         <Form.Item label="活动封面图1">
125
         <Form.Item label="活动封面图1">
126
           <img src={detailData.listImgUrl} height="210px" width="375px" />
126
           <img src={detailData.listImgUrl} height="210px" width="375px" />

+ 4
- 4
src/pages/activity/editActivity.jsx Wyświetl plik

6
 import styles from '../style/GoodsList.less';
6
 import styles from '../style/GoodsList.less';
7
 import apis from '../../services/apis';
7
 import apis from '../../services/apis';
8
 import moment from 'moment';
8
 import moment from 'moment';
9
-import BuildSelect from '../../components/SelectButton/BuildSelect2'
9
+import ActivityType from '../../components/SelectButton/ActivityType'
10
 import XForm, { FieldTypes } from '../../components/XForm';
10
 import XForm, { FieldTypes } from '../../components/XForm';
11
 import Wangedit from '../../components/Wangedit/Wangedit'
11
 import Wangedit from '../../components/Wangedit/Wangedit'
12
 import request from '../../utils/request'
12
 import request from '../../utils/request'
168
     <>
168
     <>
169
       <Form {...formItemLayout} onSubmit={handleSubmit}>
169
       <Form {...formItemLayout} onSubmit={handleSubmit}>
170
         <Form.Item label="活动类型">
170
         <Form.Item label="活动类型">
171
-          {getFieldDecorator('buildingId', {
171
+          {getFieldDecorator('dynamicTypeId', {
172
             rules: [
172
             rules: [
173
               {
173
               {
174
                 required: true,
174
                 required: true,
175
-                message: '请选择所属项目',
175
+                message: '请选择活动类型',
176
               },
176
               },
177
             ],
177
             ],
178
-          })(<BuildSelect disabled={disable} />)}
178
+          })(<ActivityType disabled={disable} />)}
179
         </Form.Item>
179
         </Form.Item>
180
         <Form.Item label="活动封面图1" help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表">
180
         <Form.Item label="活动封面图1" help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表">
181
           {getFieldDecorator('listImgUrl', {
181
           {getFieldDecorator('listImgUrl', {