zlisen 3 years ago
parent
commit
9d5d227f52

+ 43
- 0
src/components/ImgPreview/index.jsx View File

@@ -0,0 +1,43 @@
1
+import React, { useState, useEffect } from 'react';
2
+import Carousel, { Modal, ModalGateway } from 'react-images';
3
+
4
+const Lightbox = (props) => {
5
+  const { images = [], open, onClose } = props;
6
+  const [modalIsOpen, setModalIsOpen] = useState(open)
7
+  useEffect(() => {
8
+    setModalIsOpen(open)
9
+  }, [images, open])
10
+
11
+  const toggleModal = () => {
12
+    setModalIsOpen(!modalIsOpen)
13
+    if (typeof onClose === 'function') {
14
+      onClose()
15
+    }
16
+
17
+  }
18
+  const styleInit = {
19
+    header: (base, state) => ({ //头部样式
20
+      position: 'absolute',
21
+      top: 90,
22
+      right: 90,
23
+      zIndex: 9999,
24
+    }),
25
+    view: (base, state) => ({
26
+      textAlign: 'center',
27
+      height: state.isFullscreen?'100%':600  //当点击全屏的时候图片样式
28
+    })
29
+  }
30
+  return (
31
+    <ModalGateway >
32
+      {modalIsOpen ? (
33
+        <Modal onClose={toggleModal} >
34
+          <Carousel views={images} styles={styleInit}/>
35
+        </Modal>
36
+      ) : null}
37
+    </ModalGateway>
38
+  );
39
+
40
+}
41
+
42
+
43
+export default Lightbox

+ 2
- 2
src/components/Poster/Form.jsx View File

@@ -20,7 +20,7 @@ const saveData = fetch(apis.activity.addPoster)
20 20
 const updateData = fetch(apis.activity.updatePoster)
21 21
 
22 22
 const PosterForm = (props) => {
23
-  const { form, targetId, targetType, rights } = props
23
+  const { form, targetId, targetType, rights,submitBtn=true } = props
24 24
   const { getFieldDecorator, resetFields, setFieldsValue, validateFields } = form
25 25
 
26 26
   const [formData, setFormData] = useState()
@@ -95,7 +95,7 @@ const PosterForm = (props) => {
95 95
       </Form.Item>*/}
96 96
       <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
97 97
         <AuthButton name={rights}>
98
-          <Button loading={loading} style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
98
+          {submitBtn&&<Button loading={loading} style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>}
99 99
         </AuthButton>
100 100
         {/* <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>  */}
101 101
       </Form.Item>

+ 2
- 1
src/components/Poster/index.jsx View File

@@ -7,7 +7,7 @@ import Styles from './style.less'
7 7
 const noop = x => x;
8 8
 
9 9
 export default (props) => {
10
-  const { target, rights, onCancel = noop } = props
10
+  const { target, rights, onCancel = noop,submitBtn=true } = props
11 11
   const { id: targetId, type: targetType } = target
12 12
 
13 13
   const [posterImg, setPosterImg] = useState()
@@ -24,6 +24,7 @@ export default (props) => {
24 24
           rights={rights}
25 25
           onImageChange={setPosterImg}
26 26
           onCancel={onCancel}
27
+          submitBtn={submitBtn}
27 28
         />
28 29
       </div>
29 30
     </div>

+ 4
- 4
src/components/Share/index.jsx View File

@@ -19,7 +19,7 @@ const saveData = fetch(apis.activity.addShareContent)
19 19
 const updateData = fetch(apis.activity.updateShareContent)
20 20
 
21 21
 const ShareForm = (props) => {
22
-  const { target, form, rights } = props
22
+  const { target, form, rights,submitBtn=true } = props
23 23
   const { id: targetId, type: targetType } = target
24 24
   const { getFieldDecorator, resetFields, setFieldsValue, validateFields } = form
25 25
 
@@ -94,10 +94,10 @@ const ShareForm = (props) => {
94 94
       })(<ImageUpload />)}
95 95
       </Form.Item>
96 96
       <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
97
-        <AuthButton name={rights}>
98
-          <Button loading={loading} style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
97
+      {submitBtn&&<><AuthButton name={rights}>
98
+         <Button loading={loading} style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
99 99
         </AuthButton>
100
-        <Button style={{marginLeft: '2em'}} onClick={onCancel}>清空</Button>
100
+        <Button style={{marginLeft: '2em'}} onClick={onCancel}>清空</Button></>}
101 101
       </Form.Item>
102 102
     </Form>
103 103
   )

+ 2
- 1
src/components/XForm/ImageListUpload.jsx View File

@@ -102,12 +102,13 @@ class ImageListUpload extends React.Component {
102 102
           fileList={fileList}
103 103
           onPreview={this.handlePreview}
104 104
           onChange={this.handleChange}
105
+          disabled={this.props.disabled}
105 106
           {...uploaderProps}
106 107
           onSuccess={this.handleUploadSucess}
107 108
         >
108 109
           {/* unlimited 表示上传无限制数量 */}
109 110
           {(this.props.unlimited && uploadButton) ||
110
-            ((fileList || images).length >= 8 ? null : uploadButton)}
111
+            ((fileList || images).length >= 100 ? null : uploadButton)}
111 112
         </Upload>
112 113
         <Modal id={'ImageListUpload-preview'} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
113 114
           <img alt="example" style={{ width: '100%' }} src={getImgURL(previewImage)} />

+ 5
- 5
src/pages/building/Edit/AlbumList/List.jsx View File

@@ -6,7 +6,7 @@ import AuthButton from '@/components/AuthButton'
6 6
 const { Panel } = Collapse;
7 7
 
8 8
 const ImageList = props => {
9
-  const { data,updateImg } = props;
9
+  const { data,updateImg ,isPublish} = props;
10 10
   const [imageList, setImageList] = useState([]);
11 11
 
12 12
   function getImgUrl() {
@@ -28,11 +28,11 @@ const ImageList = props => {
28 28
     setImageList(getImgUrl());
29 29
   }, [data]);
30 30
 
31
-  return <ImageListUpload value={imageList} disabled onChange={onImageChange} unlimited={false} />;
31
+  return <ImageListUpload value={imageList} disabled={isPublish} onChange={onImageChange} unlimited={false} />;
32 32
 };
33 33
 
34 34
 export default props => {
35
-  const { dataList = [] } = props;
35
+  const { dataList = [] ,isPublish} = props;
36 36
 
37 37
   const Extra = item => (
38 38
     <>
@@ -58,8 +58,8 @@ export default props => {
58 58
     <Collapse defaultActiveKey={['0']} expandIconPosition="right" style={{ marginTop: '2em' }}>
59 59
       {dataList.map((row, index) => {
60 60
         return (
61
-          <Panel header={row.apartmentName} key={index} extra={Extra(row)}>
62
-            <ImageList data={row} updateImg={props.updateImg}></ImageList>
61
+          <Panel header={row.apartmentName} key={index} extra={!isPublish&&Extra(row)}>
62
+            <ImageList data={row} updateImg={props.updateImg} isPublish={isPublish}></ImageList>
63 63
           </Panel>
64 64
         );
65 65
       })}

+ 7
- 26
src/pages/building/Edit/AlbumList/index.jsx View File

@@ -6,9 +6,10 @@ import Form from './Form';
6 6
 import List from './List';
7 7
 import ModalForm from '../components/ModalForm';
8 8
 
9
+
9 10
 export default props => {
10 11
   const [visible, setVisible] = useState(false);
11
-  const { history } = props;
12
+  const { history,isPublish } = props;
12 13
   const { query } = history.location;
13 14
   const { id } = query;
14 15
 
@@ -19,6 +20,8 @@ export default props => {
19 20
   const [confirmLoading, setConfirmLoading] = useState(false);
20 21
   const albumRef = useRef();
21 22
 
23
+
24
+
22 25
   const getList = () => {
23 26
     // const urlData = { id };
24 27
     // const params = { apartmentType: 'apart' };
@@ -66,34 +69,11 @@ export default props => {
66 69
   }
67 70
 
68 71
   const updateApartment = data => {
69
-  // const values= {}
70
-
71
-    // setLoading(true);
72
-
73 72
     return request({
74 73
       ...apis.building.buildingApartmentUpdate,
75
-      // urlData: { id: data.apartmentId },
76 74
       data
77 75
 
78 76
     })
79
-    //   .then(() => {
80
-    //     console.log('删除成功');
81
-    //     message.success('删除成功');
82
-    //     getList();
83
-    //   })
84
-    //   .catch(err => {
85
-    //     console.log('删除失败');
86
-    //   });
87
-    // deleteData({ urlData })
88
-    //   .then(() => {
89
-    //     getList();
90
-    //     message.success('删除成功');
91
-    //     setLoading(false);
92
-    //   })
93
-    //   .catch(err => {
94
-    //     console.error(err.message || err);
95
-    //     setLoading(false);
96
-    //   });
97 77
   };
98 78
 
99 79
   const handleSuccess = () => {
@@ -137,9 +117,9 @@ export default props => {
137 117
     <div>
138 118
       <div>
139 119
         <AuthButton name="building.photo.add">
140
-          <Button type="primary" onClick={() => setVisible(true)}>
120
+          {!isPublish&&<Button type="primary" onClick={() => setVisible(true)}>
141 121
             新增相册
142
-          </Button>
122
+          </Button>}
143 123
         </AuthButton>
144 124
       </div>
145 125
       <Form
@@ -155,6 +135,7 @@ export default props => {
155 135
         onRename={onRename}
156 136
         onDelete={handleDelete}
157 137
         updateImg={updateApartment}
138
+        isPublish={isPublish}
158 139
       />
159 140
       <Modal
160 141
         title="相册名称"

+ 67
- 35
src/pages/building/Edit/Apartment/List.jsx View File

@@ -1,8 +1,9 @@
1
-import React from 'react'
2
-import { Button, Table, Popconfirm } from 'antd'
3
-import AuthButton from '@/components/AuthButton'
4
-import moment from 'moment'
5
-import { getImgURL } from '@/utils/image'
1
+import React, { useState } from 'react';
2
+import { Button, Table, Popconfirm, Modal } from 'antd';
3
+import AuthButton from '@/components/AuthButton';
4
+import moment from 'moment';
5
+import { getImgURL } from '@/utils/image';
6
+import ZmageImg from '@/components/ZmageImg/ZmageImg';
6 7
 // import ImgPreview from '@/components/ImgPreview'
7 8
 
8 9
 const saleType = [
@@ -22,7 +23,7 @@ const saleType = [
22 23
     id: 4,
23 24
     name: '在租',
24 25
   },
25
-]
26
+];
26 27
 
27 28
 const houseType = [
28 29
   {
@@ -45,9 +46,12 @@ const houseType = [
45 46
     id: 5,
46 47
     name: '5室及以上',
47 48
   },
48
-]
49
+];
50
+
51
+export default props => {
52
+  const {isPublish} =props
53
+  const [visible, setVisible] = useState(false);
49 54
 
50
-export default (props) => {
51 55
   const columns = [
52 56
     {
53 57
       title: '户型名称',
@@ -58,27 +62,42 @@ export default (props) => {
58 62
       title: '销售状态',
59 63
       dataIndex: 'marketStatus',
60 64
       key: 'marketStatus',
61
-      render: (_, record) => <span>{(saleType.filter(x => x.id == record.marketStatus)[0] || {}).name}</span>,
65
+      render: (_, record) => (
66
+        <span>{(saleType.filter(x => x.id == record.marketStatus)[0] || {}).name}</span>
67
+      ),
62 68
     },
63 69
     {
64 70
       title: '户型',
65 71
       dataIndex: 'houseType',
66 72
       key: 'houseType',
67
-      render: (_, record) => <span>{(houseType.filter(x => x.id == record.houseType)[0] || {}).name}</span>,
73
+      render: (_, record) => (
74
+        <span>{(houseType.filter(x => x.id == record.houseType)[0] || {}).name}</span>
75
+      ),
68 76
     },
69 77
     {
70 78
       title: '面积',
71 79
       dataIndex: 'buildingArea',
72 80
       key: 'buildingArea',
73
-      render: (buildingArea, _) => <span>{`${buildingArea === 0 || buildingArea === null ? "-" : buildingArea + "m²"}`}</span>,
81
+      render: (buildingArea, _) => (
82
+        <span>{`${buildingArea === 0 || buildingArea === null ? '-' : buildingArea + 'm²'}`}</span>
83
+      ),
74 84
     },
75
-    // {
76
-    //   title: '户型图',
77
-    //   dataIndex: 'buildingImgList',
78
-    //   key: 'buildingImgList',
79
-    //   render: (buildingImgList, _) =>  <ImgPreview images={[{ src:getImgURL(buildingImgList[0].url) }]}></ImgPreview>  ,
80
-    // },
81
-    // <Zmage src={getImgURL(buildingImgList[0].url)}   />
85
+    {
86
+      title: '户型图',
87
+      dataIndex: 'buildingImgList',
88
+      key: 'buildingImgList',
89
+      render: (buildingImgList, _) => (
90
+        <img
91
+          src={getImgURL(buildingImgList[0].url)}
92
+          onClick={() => setVisible(buildingImgList[0].url)}
93
+          width={128}
94
+          height={72}
95
+          style={{ borderRadius: '4px' }}
96
+          alt=""
97
+        />
98
+      ),
99
+    },
100
+
82 101
     {
83 102
       title: '创建时间',
84 103
       dataIndex: 'createDate',
@@ -90,30 +109,43 @@ export default (props) => {
90 109
       dataIndex: 'apartmentId',
91 110
       key: 'apartmentId',
92 111
       render: (_, record) => (
93
-        <>
112
+       !isPublish && <>
94 113
           <AuthButton name="building.houseType.edit">
95
-            <Button type="link" onClick={() => props.onEdit(record)}>编辑</Button>
114
+            <Button type="link" onClick={() => props.onEdit(record)}>
115
+              编辑
116
+            </Button>
96 117
           </AuthButton>
97 118
           <AuthButton name="building.houseType.delete">
98
-            <Popconfirm
99
-              title="确定要进行删除操作 ?"
100
-              onConfirm={() => props.onDelete(record)}
101
-            >
102
-              <Button type="link" style={{ color: 'red' }}>删除</Button>
119
+            <Popconfirm title="确定要进行删除操作 ?" onConfirm={() => props.onDelete(record)}>
120
+              <Button type="link" style={{ color: 'red' }}>
121
+                删除
122
+              </Button>
103 123
             </Popconfirm>
104 124
           </AuthButton>
105 125
         </>
106 126
       ),
107 127
     },
108
-  ]
128
+  ];
109 129
 
110 130
   return (
111
-    <Table
112
-      loading={props.loading}
113
-      dataSource={props.dataSource}
114
-      columns={columns}
115
-      style={{marginTop: '1em', width: '100%'}}
116
-      rowKey="apartmentId"
117
-    />
118
-  )
119
-}
131
+    <>
132
+      <Table
133
+        loading={props.loading}
134
+        dataSource={props.dataSource}
135
+        columns={columns}
136
+        style={{ marginTop: '1em', width: '100%' }}
137
+        rowKey="apartmentId"
138
+      />
139
+      <Modal
140
+        visible={visible}
141
+        // onOk={handleOk}
142
+        onCancel={() => setVisible(false)}
143
+        footer={null}
144
+        bodyStyle={{ padding: '0' }}
145
+        destroyOnClose
146
+      >
147
+        <img src={getImgURL(visible)} width="100%" alt=""></img>
148
+      </Modal>
149
+    </>
150
+  );
151
+};

+ 5
- 4
src/pages/building/Edit/Apartment/index.jsx View File

@@ -5,11 +5,12 @@ import AuthButton from '@/components/AuthButton'
5 5
 import Form from './Form'
6 6
 import List from './List'
7 7
 
8
+
8 9
 const fetchList = fetch(apis.building.buildingApartment)
9 10
 const deleteData = fetch(apis.building.buildingApartmentDelete)
10 11
 
11 12
 export default (props) => {
12
-  const { history } = props;
13
+  const { history,isPublish } = props;
13 14
   const { query } = history.location;
14 15
   const { id } = query;
15 16
 
@@ -63,12 +64,12 @@ export default (props) => {
63 64
   return (
64 65
     <div>
65 66
       <div>
66
-        <AuthButton name="building.houseType.add">
67
+        {!isPublish&&<AuthButton name="building.houseType.add">
67 68
           <Button type="primary" onClick={() => handleEdit()}>新增户型</Button>
68
-        </AuthButton>
69
+        </AuthButton>}
69 70
       </div>
70 71
       <Form buildingId={id} visible={visible} onCancel={() => setVisible(false)} formData={apartmentRef.current} onSuccess={handleSuccess} />
71
-      <List loading={loading} dataSource={list} onEdit={handleEdit} onDelete={handleDelete} />
72
+      <List loading={loading} dataSource={list} onEdit={handleEdit} onDelete={handleDelete} isPublish={isPublish}/>
72 73
     </div>
73 74
   )
74 75
 }

+ 8
- 3
src/pages/building/Edit/Basic/index.jsx View File

@@ -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,institutionIdChange, user } = props;
29
+  const { form, history, setMarketingCode,institutionIdChange, user ,isPublish,setIsPublish} = props;
30 30
   const { getFieldDecorator, getFieldValue, setFieldsValue } = form;
31 31
   const { query } = history.location;
32 32
   const { id } = query;
@@ -45,17 +45,22 @@ const BuildingBasic = React.forwardRef((props, ref) => {
45 45
     initPois,
46 46
     deletePoi,
47 47
   ] = usePois()
48
+  // const [isPublish,initPublish] = useIsPublish()
48 49
 
49 50
   const updateLoading = (key) => (state) => setLoading({ ...loading, [key]: state })
50 51
   const updateFormLoading = updateLoading('form')
51 52
 
52 53
   useQuery(id, updateFormLoading, (res) => {
54
+
53 55
     initPois(res.mapJson)
54 56
     initArrounds(res)
55 57
     initForm(form, res)
56 58
     setMarketingCode(res.marketingCode)
57 59
     setCityId(res.cityId)
58 60
     institutionIdChange(res.institutionId)
61
+  
62
+
63
+    setIsPublish(res.status=== 1)
59 64
   })
60 65
   
61 66
   // 视频文件上传前 回调
@@ -479,9 +484,9 @@ const BuildingBasic = React.forwardRef((props, ref) => {
479 484
 
480 485
         <Form.Item label=" " colon={false}>
481 486
           <AuthButton name="building.detail.save">
482
-            <Button style={{marginLeft: '6em'}} type="primary" htmlType="submit">
487
+            {!isPublish&&<Button style={{marginLeft: '6em'}} type="primary" htmlType="submit">
483 488
                 确定
484
-            </Button>
489
+            </Button>}
485 490
           </AuthButton>
486 491
           <Button style={{marginLeft: '2em'}} onClick={() => router.go(-1)}>
487 492
               取消

+ 3
- 3
src/pages/building/Edit/Channel.jsx View File

@@ -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,institutionId } = props
15
+  const { form, history, user,institutionId,isPublish } = props
16 16
   const { getFieldDecorator, setFieldsValue, validateFields } = form
17 17
   const { query } = history.location;
18 18
   const { id } = query;
@@ -81,9 +81,9 @@ const ChannelForm = React.forwardRef((props, ref) => {
81 81
       {getFieldDecorator('remark', {})(<Input.TextArea row={4} />)}
82 82
       </Form.Item>
83 83
       <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
84
-        <AuthButton name="building.channel.save">
84
+       {!isPublish&& <AuthButton name="building.channel.save">
85 85
           <Button style={{marginLeft: '4em'}} loading={loading} type="primary" htmlType="submit">保存</Button>
86
-        </AuthButton>
86
+        </AuthButton>}
87 87
         {/* <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button> */}
88 88
       </Form.Item>
89 89
     </Form>

+ 2
- 2
src/pages/building/Edit/News/List.jsx View File

@@ -4,7 +4,7 @@ import AuthButton from '@/components/AuthButton'
4 4
 import moment from 'moment'
5 5
 
6 6
 export default props => {
7
-  const { data = {}, onChangePageNum,loading } = props;
7
+  const { data = {}, onChangePageNum,loading,isPublish } = props;
8 8
   const { records=[], total, current,size } = data;
9 9
 
10 10
   const columns = [
@@ -29,7 +29,7 @@ export default props => {
29 29
       dataIndex: 'apartmentId',
30 30
       key: 'apartmentId',
31 31
       render: (_, record) => (
32
-        <>
32
+       !isPublish&& <>
33 33
           <AuthButton name="building.dynamic.edit">
34 34
             <Button type="link" onClick={() => props.onEdit(record)}>
35 35
               编辑

+ 4
- 4
src/pages/building/Edit/News/index.jsx View File

@@ -8,7 +8,7 @@ import request from '@/utils/request';
8 8
 import apis from '@/services/apis';
9 9
 
10 10
 export default props => {
11
-  const { history } = props;
11
+  const { history,isPublish } = props;
12 12
   const { query } = history.location;
13 13
   const { id } = query;
14 14
 
@@ -72,14 +72,14 @@ export default props => {
72 72
   return (
73 73
     <div>
74 74
       <div>
75
-        <AuthButton name="building.dynamic.add">
75
+        {!isPublish&&<AuthButton name="building.dynamic.add">
76 76
           <Button type="primary" onClick={() => setVisible({visible:true})}>
77 77
             新增动态
78 78
           </Button>
79
-        </AuthButton>
79
+        </AuthButton>}
80 80
       </div>
81 81
       <Form visibleData={visible} buildingId={id} onCancel={() => setVisible({visible:false})} onSuccess={onSuccess} />
82
-      <List data={data} buildingId={id} loading={loading} onChangePageNum={onChangePageNum} onDelete={onDelete} onEdit={onEdit}/>
82
+      <List data={data} buildingId={id} loading={loading} onChangePageNum={onChangePageNum} onDelete={onDelete} onEdit={onEdit} isPublish={isPublish}/>
83 83
     </div>
84 84
   );
85 85
 };

+ 3
- 3
src/pages/building/Edit/OnSiteService.jsx View File

@@ -9,7 +9,7 @@ import Styles from './style.less';
9 9
 const { Text } = Typography;
10 10
 
11 11
 export default props => {
12
-  const { history,marketingCode } = props;
12
+  const { history,marketingCode,isPublish } = props;
13 13
   const { query } = history.location;
14 14
   const { id } = query;
15 15
 
@@ -97,11 +97,11 @@ export default props => {
97 97
       key: 'action',
98 98
       render: (_, row) => (
99 99
         <AuthButton name="building.marketing.delete">
100
-          <Popconfirm title="确认执行取消操作?" onConfirm={() => handleCancel(row)}>
100
+         {!isPublish&& <Popconfirm title="确认执行取消操作?" onConfirm={() => handleCancel(row)}>
101 101
             <a href="#" style={{ color: 'red' }}>
102 102
               取消绑定
103 103
             </a>
104
-          </Popconfirm>
104
+          </Popconfirm>}
105 105
         </AuthButton>
106 106
       ),
107 107
     },

+ 3
- 3
src/pages/building/Edit/Panorama/List.jsx View File

@@ -6,7 +6,7 @@ import { getImgURL } from '@/utils/image';
6 6
 import AuthButton from '@/components/AuthButton'
7 7
 
8 8
 export default props => {
9
-  const { data,loading } = props;
9
+  const { data,loading,isPublish } = props;
10 10
 
11 11
   const columns = [
12 12
     {
@@ -43,11 +43,11 @@ export default props => {
43 43
       key: 'apartmentId',
44 44
       render: (_, record) => (
45 45
         <AuthButton name="building.panorama.delete">
46
-          <Popconfirm title="确定要进行删除操作 ?" onConfirm={() => props.onDelete(record)}>
46
+          {!isPublish&&<Popconfirm title="确定要进行删除操作 ?" onConfirm={() => props.onDelete(record)}>
47 47
             <Button type="link" style={{ color: 'red' }}>
48 48
               删除
49 49
             </Button>
50
-          </Popconfirm>
50
+          </Popconfirm>}
51 51
         </AuthButton>
52 52
       ),
53 53
     },

+ 4
- 4
src/pages/building/Edit/Panorama/index.jsx View File

@@ -7,7 +7,7 @@ import Form from './Form';
7 7
 import List from './List';
8 8
 
9 9
 export default props => {
10
-  const { history } = props;
10
+  const { history ,isPublish} = props;
11 11
   const { query } = history.location;
12 12
   const { id } = query;
13 13
   const [loading, setLoading] = useState(false);
@@ -73,11 +73,11 @@ export default props => {
73 73
   return (
74 74
     <div>
75 75
       <div>
76
-        <AuthButton name="building.panorama.add">
76
+       {!isPublish&& <AuthButton name="building.panorama.add">
77 77
           <Button type="primary" onClick={() => setVisible(true)}>
78 78
             新增全景
79 79
           </Button>
80
-        </AuthButton>
80
+        </AuthButton>}
81 81
       </div>
82 82
       <Form
83 83
         visible={visible}
@@ -86,7 +86,7 @@ export default props => {
86 86
         onCancel={() => setVisible(false)}
87 87
         onSuccess={onSuccess}
88 88
       />
89
-      <List data={data} loading={loading} onDelete={onDelete} />
89
+      <List data={data} loading={loading} onDelete={onDelete} isPublish={isPublish} />
90 90
     </div>
91 91
   );
92 92
 };

+ 21
- 3
src/pages/building/Edit/SpecialRoom/List.jsx View File

@@ -7,7 +7,7 @@ import moment from 'moment';
7 7
 import AuthButton from '@/components/AuthButton'
8 8
 
9 9
 export default (props) => {
10
-  const { data = {}, onChangePageNum,loading } = props;
10
+  const { data = {}, onChangePageNum,loading,isPublish } = props;
11 11
   const { records=[], total, current,size } = data;
12 12
   
13 13
   const columns = [
@@ -39,12 +39,30 @@ export default (props) => {
39 39
       key: 'endTime',
40 40
       render: (_, record) => <span>{moment(record.endTime).format('YYYY-MM-DD')}</span>,
41 41
     },
42
+    {
43
+      title: '原始价',
44
+      dataIndex: 'originalPrice',
45
+      key: 'originalPrice',
46
+      render: (t) => <span>{`${t || ' -- '} 元`}</span>,
47
+    },
48
+    {
49
+      title: '现价',
50
+      dataIndex: 'currentPrice',
51
+      key: 'currentPrice',
52
+      render: (t) => <span>{`${t || ' -- '} 元`}</span>,
53
+    },
54
+    {
55
+      title: '节省价',
56
+      dataIndex: 'thriftPrice',
57
+      key: 'thriftPrice',
58
+      render: (t) => <span>{`${t || ' -- '} 元`}</span>,
59
+    },
42 60
     {
43 61
       title: '操作',
44 62
       dataIndex: 'apartmentId',
45 63
       key: 'apartmentId',
46 64
       render: (_, record) => (
47
-        <>
65
+        !isPublish&& <>
48 66
           <AuthButton name="building.special.edit">
49 67
             <Button type="link" onClick={() => props.onEdit(record)}>编辑</Button>
50 68
           </AuthButton>
@@ -61,7 +79,7 @@ export default (props) => {
61 79
     },
62 80
   ]
63 81
 
64
-  return (
82
+  return ( 
65 83
     <Table
66 84
     columns={columns}
67 85
     dataSource={records}

+ 4
- 4
src/pages/building/Edit/SpecialRoom/index.jsx View File

@@ -8,7 +8,7 @@ import List from './List'
8 8
 
9 9
 export default (props) => {
10 10
 
11
-  const { history } = props;
11
+  const { history,isPublish } = props;
12 12
   const { query } = history.location;
13 13
   const { id } = query;
14 14
 
@@ -70,12 +70,12 @@ export default (props) => {
70 70
   return (
71 71
     <div>
72 72
       <div>
73
-        <AuthButton name="building.special.add">
73
+        {!isPublish&&<AuthButton name="building.special.add">
74 74
           <Button type="primary" onClick={() => setVisible({visible:true})}>新增特价房</Button>
75
-        </AuthButton>
75
+        </AuthButton>}
76 76
       </div>
77 77
       <Form visibleData={visible} buildingId={id} onCancel={() => setVisible({visible:false})} onSuccess={onSuccess}  />
78
-      <List data={data} buildingId={id} loading={loading} onChangePageNum={onChangePageNum} onDelete={onDelete} onEdit={onEdit}/>
78
+      <List data={data} buildingId={id} loading={loading} onChangePageNum={onChangePageNum} onDelete={onDelete} onEdit={onEdit} isPublish={isPublish}/>
79 79
     </div>
80 80
   )
81 81
 }

+ 11
- 10
src/pages/building/Edit/index.jsx View File

@@ -20,6 +20,7 @@ export default (props) => {
20 20
   const { id } = query
21 21
   const [institutionId,setInstitutionId] = useState()
22 22
   const [marketingCode,setMarketingCode] = useState('')
23
+  const [isPublish,setIsPublish] = useState(false)
23 24
   const target = { id, type: 'building' }
24 25
 
25 26
   return (
@@ -27,50 +28,50 @@ export default (props) => {
27 28
       <Tabs defaultActiveKey="1">
28 29
         <TabPane tab="基础信息" key="1">
29 30
           <div className={styles['tab-wrapper']} style={{maxWidth: 1000}}>
30
-            <Basic {...props}  setMarketingCode={(e)=>setMarketingCode(e)} institutionIdChange={(e)=>setInstitutionId(e)}/>
31
+            <Basic {...props}  setMarketingCode={(e)=>setMarketingCode(e)} institutionIdChange={(e)=>setInstitutionId(e)} isPublish={isPublish} setIsPublish={(e)=>setIsPublish(e)}/>
31 32
           </div>
32 33
         </TabPane>
33 34
         <TabPane tab="户型设置" key="2">
34 35
           <div className={styles['tab-wrapper']}>
35
-            <Apartment {...props} />
36
+            <Apartment {...props} isPublish={isPublish}/>
36 37
           </div>
37 38
         </TabPane>
38 39
         <TabPane tab="项目相册" key="3">
39 40
           <div className={styles['tab-wrapper']}>
40
-            <AlbumList {...props} />
41
+            <AlbumList {...props} isPublish={isPublish}/>
41 42
           </div>
42 43
         </TabPane>
43 44
         <TabPane tab="全景照片" key="4">
44 45
           <div className={styles['tab-wrapper']}>
45
-            <Panorama {...props} />
46
+            <Panorama {...props} isPublish={isPublish} />
46 47
           </div>
47 48
         </TabPane>
48 49
         <TabPane tab="项目动态" key="8">
49 50
           <div className={styles['tab-wrapper']}>
50
-            <News {...props} />
51
+            <News {...props} isPublish={isPublish}/>
51 52
           </div>
52 53
         </TabPane>
53 54
         <TabPane tab="特价房源" key="9">
54 55
           <div className={styles['tab-wrapper']}>
55
-            <SpecialRoom {...props} />
56
+            <SpecialRoom {...props} isPublish={isPublish}/>
56 57
           </div>
57 58
         </TabPane>
58 59
         <TabPane tab="渠道设置" key="7">
59 60
           <div className={styles['tab-wrapper']} style={{maxWidth: '800px'}}>
60
-            <Channel {...props} institutionId={institutionId} />
61
+            <Channel {...props} institutionId={institutionId} isPublish={isPublish}/>
61 62
           </div>
62 63
         </TabPane>
63 64
         <TabPane tab="驻场设置" key="10">
64 65
           <div className={styles['tab-wrapper']} style={{maxWidth: '1200px'}}>
65
-            <OnSiteService {...props} marketingCode={marketingCode}/>
66
+            <OnSiteService {...props} marketingCode={marketingCode} isPublish={isPublish}/>
66 67
           </div>
67 68
         </TabPane>
68 69
         <TabPane tab="海报图片" key="5">
69
-          <Poster target={target} rights="building.poster.save" {...props} />
70
+          <Poster target={target} rights="building.poster.save" {...props} submitBtn={!isPublish}  />
70 71
         </TabPane>
71 72
         <TabPane tab="分享设置" key="6">
72 73
           <div className={styles['tab-wrapper']} style={{maxWidth: '800px'}}>
73
-            <Share target={target} rights="building.share.save" {...props} />
74
+            <Share target={target} rights="building.share.save" {...props} submitBtn={!isPublish} />
74 75
           </div>
75 76
         </TabPane>
76 77
       </Tabs>