diff --git a/src/pages/push/goodspush/components/PushFrom.jsx b/src/pages/push/goodspush/components/PushFrom.jsx index 3065322..7ea0d79 100644 --- a/src/pages/push/goodspush/components/PushFrom.jsx +++ b/src/pages/push/goodspush/components/PushFrom.jsx @@ -1,5 +1,5 @@ import React, { useState, useEffect,useRef } from 'react'; -import { Modal, Row, Col, Checkbox, Select} from 'antd'; +import { Modal, Row, Col, Checkbox, Select,message} from 'antd'; import ProTable from '@ant-design/pro-table'; import { GetDeviceList, @@ -11,11 +11,13 @@ const PushFrom = (props) => { const [selectedRowsState, setSelectedRows] = useState([]); const [dataSource,setdataSource]= useState([]); const [treeData, setTreeData] = useState(); - const [DeviceIds, setDeviceIds] = useState([]); + const [DeviceIds, setDeviceIds] = useState(); + const [DeviceInfo, setDeviceInfo] = useState([]); const actionRef = useRef(); useEffect(() => { console.log(props.values) GetDeviceList().then((r)=>{ + setDeviceInfo(r.data) var data=r.data.map(x=>{ return {value:x.id,label:x.name} }) @@ -69,7 +71,16 @@ const PushFrom = (props) => { onOk={() => { console.log(selectedRowsState) console.log(DeviceIds) - }} + console.log(DeviceInfo) + if(!DeviceIds){ + message.error('请选择设备'); + }else{ + var de=DeviceInfo.find(x=>x.id==DeviceIds); + var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:1,goodsInfo:selectedRowsState} + props.HandleOk(parm) + console.log(de) + } + }} onCancel={() => { props.onCancel(); }} @@ -79,7 +90,7 @@ const PushFrom = (props) => { 选择设备: