weiximei 5 年之前
父節點
當前提交
370bc18c0b
共有 3 個檔案被更改,包括 28 行新增11 行删除
  1. 1
    1
      package.json
  2. 18
    9
      src/components/SelectButton/BuildSelect.jsx
  3. 9
    1
      src/pages/building/list/add/components/buildingImage.jsx

+ 1
- 1
package.json 查看文件

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

+ 18
- 9
src/components/SelectButton/BuildSelect.jsx 查看文件

@@ -19,9 +19,10 @@ function usePrevious(props) {
19 19
  * @param {*} props
20 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 26
   // const preProps = usePrevious(props)
26 27
 
27 28
   // if ((!preProps) && props.value != value) {
@@ -34,10 +35,11 @@ const BuildingSelect = (props) => {
34 35
 
35 36
   useEffect(() => {
36 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 43
         setData(data.records)
42 44
         // 默认选中第一个
43 45
         if (props.checkFirst) {
@@ -47,7 +49,13 @@ const BuildingSelect = (props) => {
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 59
     setValue(e)
52 60
     props.onChange(e)
53 61
   }
@@ -56,9 +64,10 @@ const BuildingSelect = (props) => {
56 64
       <Select
57 65
       showSearch
58 66
       value={value}
59
-      style={{ width: '180px' }} 
60
-      placeholder="请选择项目" 
67
+      style={{ width: '180px' }}
68
+      placeholder="请选择项目"
61 69
       onChange={handleChange}
70
+      disabled={disabled}
62 71
       filterOption={(input, option) =>
63 72
         option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
64 73
       }>

+ 9
- 1
src/pages/building/list/add/components/buildingImage.jsx 查看文件

@@ -1,14 +1,22 @@
1
-import React from 'react';
1
+import React, { useState } from 'react';
2 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 5
 const { Header, Footer, Sider, Content } = Layout;
5 6
 
6 7
 function BuildingImageModel() {
8
+  const [imageList, setImageList] = useState([])
9
+
10
+  function onImageChange(e) {
11
+    setImageList(e)
12
+  }
13
+
7 14
   return (
8 15
     <>
9 16
       <span>效果图(10)</span>
10 17
       <Button type="link" style={{ color: 'blue' }}>重命名</Button>
11 18
       <Button type="link" style={{ color: 'blue' }}>删除相册</Button>
19
+      <ImageListUpload value={imageList} onChange={onImageChange}/>
12 20
     </>
13 21
   )
14 22
 }