weiximei 5 years ago
parent
commit
370bc18c0b

+ 1
- 1
package.json View File

43
   "dependencies": {
43
   "dependencies": {
44
     "@ant-design/pro-layout": "^4.5.9",
44
     "@ant-design/pro-layout": "^4.5.9",
45
     "@antv/data-set": "^0.10.2",
45
     "@antv/data-set": "^0.10.2",
46
-    "antd": "^3.20.0",
46
+    "antd": "^3.25.0",
47
     "classnames": "^2.2.6",
47
     "classnames": "^2.2.6",
48
     "dayjs": "^1.8.16",
48
     "dayjs": "^1.8.16",
49
     "dva": "^2.4.1",
49
     "dva": "^2.4.1",

+ 18
- 9
src/components/SelectButton/BuildSelect.jsx View File

19
  * @param {*} props
19
  * @param {*} props
20
  * @returns
20
  * @returns
21
  */
21
  */
22
-const BuildingSelect = (props) => {
23
-  const [ data, setData ] = useState([])
24
-  const [ value, setValue ] = useState('')
22
+const BuildingSelect = props => {
23
+  const [data, setData] = useState([])
24
+  const [value, setValue] = useState('')
25
+  const [disabled, setDisabled] = useState(false)
25
   // const preProps = usePrevious(props)
26
   // const preProps = usePrevious(props)
26
 
27
 
27
   // if ((!preProps) && props.value != value) {
28
   // if ((!preProps) && props.value != value) {
34
 
35
 
35
   useEffect(() => {
36
   useEffect(() => {
36
     getCityList();
37
     getCityList();
37
-  },[])
38
+    setDisabledValue();
39
+  }, [])
38
 
40
 
39
-  const getCityList = (e) => {
40
-    request({ ...apis.building.getList, params: {pageNum: 1,pageSize: 999}, }).then((data) => {
41
+  const getCityList = e => {
42
+    request({ ...apis.building.getList, params: { pageNum: 1, pageSize: 999 } }).then(data => {
41
         setData(data.records)
43
         setData(data.records)
42
         // 默认选中第一个
44
         // 默认选中第一个
43
         if (props.checkFirst) {
45
         if (props.checkFirst) {
47
     })
49
     })
48
   }
50
   }
49
 
51
 
50
-  const handleChange = (e) => {
52
+  const setDisabledValue = () => {
53
+    if (props.disabled) {
54
+      setDisabled(props.disabled === true)
55
+    }
56
+  }
57
+
58
+  const handleChange = e => {
51
     setValue(e)
59
     setValue(e)
52
     props.onChange(e)
60
     props.onChange(e)
53
   }
61
   }
56
       <Select
64
       <Select
57
       showSearch
65
       showSearch
58
       value={value}
66
       value={value}
59
-      style={{ width: '180px' }} 
60
-      placeholder="请选择项目" 
67
+      style={{ width: '180px' }}
68
+      placeholder="请选择项目"
61
       onChange={handleChange}
69
       onChange={handleChange}
70
+      disabled={disabled}
62
       filterOption={(input, option) =>
71
       filterOption={(input, option) =>
63
         option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
72
         option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
64
       }>
73
       }>

+ 9
- 1
src/pages/building/list/add/components/buildingImage.jsx View File

1
-import React from 'react';
1
+import React, { useState } from 'react';
2
 import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, Table, notification, Modal, Layout } from 'antd';
2
 import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, Table, notification, Modal, Layout } from 'antd';
3
+import ImageListUpload from '../../../../../components/XForm/ImageListUpload';
3
 
4
 
4
 const { Header, Footer, Sider, Content } = Layout;
5
 const { Header, Footer, Sider, Content } = Layout;
5
 
6
 
6
 function BuildingImageModel() {
7
 function BuildingImageModel() {
8
+  const [imageList, setImageList] = useState([])
9
+
10
+  function onImageChange(e) {
11
+    setImageList(e)
12
+  }
13
+
7
   return (
14
   return (
8
     <>
15
     <>
9
       <span>效果图(10)</span>
16
       <span>效果图(10)</span>
10
       <Button type="link" style={{ color: 'blue' }}>重命名</Button>
17
       <Button type="link" style={{ color: 'blue' }}>重命名</Button>
11
       <Button type="link" style={{ color: 'blue' }}>删除相册</Button>
18
       <Button type="link" style={{ color: 'blue' }}>删除相册</Button>
19
+      <ImageListUpload value={imageList} onChange={onImageChange}/>
12
     </>
20
     </>
13
   )
21
   )
14
 }
22
 }