zlisen 3 年前
父节点
当前提交
4e03dc4f6f
共有 3 个文件被更改,包括 10 次插入7 次删除
  1. 4
    2
      src/pages/building/Edit/Basic/index.jsx
  2. 3
    3
      src/pages/building/Edit/Channel.jsx
  3. 3
    2
      src/pages/building/Edit/index.jsx

+ 4
- 2
src/pages/building/Edit/Basic/index.jsx 查看文件

@@ -26,7 +26,7 @@ const fullWidth= { width: '100%' }
26 26
 const Item = Form.Item
27 27
 
28 28
 const BuildingBasic = React.forwardRef((props, ref) => {
29
-  const { form, history, setMarketingCode, user } = props;
29
+  const { form, history, setMarketingCode,institutionIdChange, user } = props;
30 30
   const { getFieldDecorator, getFieldValue, setFieldsValue } = form;
31 31
   const { query } = history.location;
32 32
   const { id } = query;
@@ -55,6 +55,7 @@ const BuildingBasic = React.forwardRef((props, ref) => {
55 55
     initForm(form, res)
56 56
     setMarketingCode(res.marketingCode)
57 57
     setCityId(res.cityId)
58
+    institutionIdChange(res.institutionId)
58 59
   })
59 60
   
60 61
   // 视频文件上传前 回调
@@ -130,7 +131,7 @@ const BuildingBasic = React.forwardRef((props, ref) => {
130 131
         }).then((res) => {
131 132
           updateFormLoading(false)
132 133
           notification.success({ message: '保存项目基础信息成功' })
133
-
134
+          institutionIdChange(res.institutionId)
134 135
           if (!id) {
135 136
             router.replace(`/building/add?id=${res.buildingId}`)
136 137
           }
@@ -138,6 +139,7 @@ const BuildingBasic = React.forwardRef((props, ref) => {
138 139
           console.error(err)
139 140
           updateFormLoading(false)
140 141
           notification.error({ message: err.message || err })
142
+          institutionIdChange(res.institutionId)
141 143
         })
142 144
       }
143 145
     });

+ 3
- 3
src/pages/building/Edit/Channel.jsx 查看文件

@@ -12,7 +12,7 @@ const updateChannel = fetch(apis.building.channel.update)
12 12
 const getChannelDict = fetch(apis.channelList.getList)
13 13
 
14 14
 const ChannelForm = React.forwardRef((props, ref) => {
15
-  const { form, history, user } = props
15
+  const { form, history, user,institutionId } = props
16 16
   const { getFieldDecorator, setFieldsValue, validateFields } = form
17 17
   const { query } = history.location;
18 18
   const { id } = query;
@@ -41,13 +41,13 @@ const ChannelForm = React.forwardRef((props, ref) => {
41 41
   }
42 42
 
43 43
   useEffect(() => {
44
-    getChannelDict({ params: { pageSize: 500, institutionId: user.institutionId }}).then((res) => {
44
+    getChannelDict({ params: { pageSize: 500, institutionId:institutionId }}).then((res) => {
45 45
       const { records } = res || {}
46 46
       if (records?.length) {
47 47
         setDict(records)
48 48
       }
49 49
     })
50
-  }, [])
50
+  }, [institutionId])
51 51
 
52 52
   useEffect(() => {
53 53
     if (id) {

+ 3
- 2
src/pages/building/Edit/index.jsx 查看文件

@@ -18,6 +18,7 @@ export default (props) => {
18 18
   const { history } = props
19 19
   const { query } = history.location
20 20
   const { id } = query
21
+  const [institutionId,setInstitutionId] = useState()
21 22
   const [marketingCode,setMarketingCode] = useState('')
22 23
   const target = { id, type: 'building' }
23 24
 
@@ -26,7 +27,7 @@ export default (props) => {
26 27
       <Tabs defaultActiveKey="1">
27 28
         <TabPane tab="基础信息" key="1">
28 29
           <div className={styles['tab-wrapper']} style={{maxWidth: 1000}}>
29
-            <Basic {...props}  setMarketingCode={(e)=>setMarketingCode(e)}/>
30
+            <Basic {...props}  setMarketingCode={(e)=>setMarketingCode(e)} institutionIdChange={(e)=>setInstitutionId(e)}/>
30 31
           </div>
31 32
         </TabPane>
32 33
         <TabPane tab="户型设置" key="2">
@@ -56,7 +57,7 @@ export default (props) => {
56 57
         </TabPane>
57 58
         <TabPane tab="渠道设置" key="7">
58 59
           <div className={styles['tab-wrapper']} style={{maxWidth: '800px'}}>
59
-            <Channel {...props} />
60
+            <Channel {...props} institutionId={institutionId} />
60 61
           </div>
61 62
         </TabPane>
62 63
         <TabPane tab="驻场设置" key="10">