Przeglądaj źródła

商品数据下发

tmp
zhaoy 8 miesięcy temu
rodzic
commit
1ee72a4b89
2 zmienionych plików z 29 dodań i 6 usunięć
  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 Wyświetl plik

@@ -1,5 +1,5 @@
import React, { useState, useEffect,useRef } from 'react'; 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 ProTable from '@ant-design/pro-table';
import { import {
GetDeviceList, GetDeviceList,
@@ -11,11 +11,13 @@ const PushFrom = (props) => {
const [selectedRowsState, setSelectedRows] = useState([]); const [selectedRowsState, setSelectedRows] = useState([]);
const [dataSource,setdataSource]= useState([]); const [dataSource,setdataSource]= useState([]);
const [treeData, setTreeData] = useState(); const [treeData, setTreeData] = useState();
const [DeviceIds, setDeviceIds] = useState([]);
const [DeviceIds, setDeviceIds] = useState();
const [DeviceInfo, setDeviceInfo] = useState([]);
const actionRef = useRef(); const actionRef = useRef();
useEffect(() => { useEffect(() => {
console.log(props.values) console.log(props.values)
GetDeviceList().then((r)=>{ GetDeviceList().then((r)=>{
setDeviceInfo(r.data)
var data=r.data.map(x=>{ var data=r.data.map(x=>{
return {value:x.id,label:x.name} return {value:x.id,label:x.name}
}) })
@@ -69,7 +71,16 @@ const PushFrom = (props) => {
onOk={() => { onOk={() => {
console.log(selectedRowsState) console.log(selectedRowsState)
console.log(DeviceIds) 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={() => { onCancel={() => {
props.onCancel(); props.onCancel();
}} }}
@@ -79,7 +90,7 @@ const PushFrom = (props) => {
<Col lg={24} md={24} sm={24}> <Col lg={24} md={24} sm={24}>
选择设备: 选择设备:
<Select <Select
mode="multiple"
allowClear allowClear
style={{width: '60%'}} style={{width: '60%'}}
placeholder="请选择要下发设备" placeholder="请选择要下发设备"


+ 14
- 2
src/pages/push/goodspush/index.jsx Wyświetl plik

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


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


@@ -95,7 +96,7 @@ const goodspush = () => {
}, },
{ {
title: '下发时间', title: '下发时间',
dataIndex: 'ceateAt',
dataIndex: 'createAt',
hideInSearch: true, 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 ( return (
<PageContainer host header={{ <PageContainer host header={{
title: '', title: '',
@@ -221,6 +232,7 @@ const goodspush = () => {
setCurrentRow(undefined); setCurrentRow(undefined);
}} }}
createModalVisible={createModalVisible} createModalVisible={createModalVisible}
HandleOk={HandleOk}
values={currentRow || {}} values={currentRow || {}}
/> />




Ładowanie…
Anuluj
Zapisz