Bladeren bron

商品数据下发

tmp
zhaoy 9 maanden geleden
bovenliggende
commit
1ee72a4b89
2 gewijzigde bestanden met toevoegingen van 29 en 6 verwijderingen
  1. +15
    -4
      src/pages/push/goodspush/components/PushFrom.jsx
  2. +14
    -2
      src/pages/push/goodspush/index.jsx

+ 15
- 4
src/pages/push/goodspush/components/PushFrom.jsx Bestand weergeven

@@ -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) => {
<Col lg={24} md={24} sm={24}>
选择设备:
<Select
mode="multiple"
allowClear
style={{width: '60%'}}
placeholder="请选择要下发设备"


+ 14
- 2
src/pages/push/goodspush/index.jsx Bestand weergeven

@@ -8,6 +8,7 @@ import PushFrom from './components/PushFrom';

import {
GetDevicePushRecodePage,
DevicePushRecodeAdd,
DevicePushRecodeDelete
} from './services';

@@ -95,7 +96,7 @@ const goodspush = () => {
},
{
title: '下发时间',
dataIndex: 'ceateAt',
dataIndex: 'createAt',
hideInSearch: true,
},
{
@@ -135,7 +136,17 @@ const goodspush = () => {
],
},
];

const HandleOk= async(values)=>{
await DevicePushRecodeAdd(values).then((res)=>{
if(res.data){
message.success('操作成功');
handleModalVisible(false);
actionRef.current.reload();
}else{
message.error('操作失败');
}
})
}
return (
<PageContainer host header={{
title: '',
@@ -221,6 +232,7 @@ const goodspush = () => {
setCurrentRow(undefined);
}}
createModalVisible={createModalVisible}
HandleOk={HandleOk}
values={currentRow || {}}
/>



Laden…
Annuleren
Opslaan