@@ -4,7 +4,8 @@ import ProTable from '@ant-design/pro-table'; | |||||
import { | import { | ||||
GetDeviceList, | GetDeviceList, | ||||
GetBatchingPage, | GetBatchingPage, | ||||
GetProductTopicslist | |||||
GetProductTopicslist, | |||||
DevicePushRecodeAdd | |||||
} from '../services'; | } from '../services'; | ||||
const PushFrom = (props) => { | const PushFrom = (props) => { | ||||
const [deviceData, setdeviceData] = useState([]); | const [deviceData, setdeviceData] = useState([]); | ||||
@@ -32,7 +33,18 @@ const PushFrom = (props) => { | |||||
setTopicsData(r.data) | setTopicsData(r.data) | ||||
}) | }) | ||||
} | } | ||||
const HandleOk= async(values)=>{ | |||||
await DevicePushRecodeAdd(values).then((res)=>{ | |||||
if(res.data){ | |||||
message.success('操作成功'); | |||||
setSelectedRows([]); | |||||
setDeviceIds(); | |||||
}else{ | |||||
message.error(res.errors); | |||||
} | |||||
props.HandleOk(res.data) | |||||
}) | |||||
} | |||||
const columns=[ | const columns=[ | ||||
{ | { | ||||
title: '编码', | title: '编码', | ||||
@@ -64,16 +76,17 @@ const PushFrom = (props) => { | |||||
message.error('请选择物料数据'); | message.error('请选择物料数据'); | ||||
}else{ | }else{ | ||||
var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:2,data:selectedRowsState,productVersion:de.vesion,productKey:de.prductKey,topicsData:TopicsData} | var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:2,data:selectedRowsState,productVersion:de.vesion,productKey:de.prductKey,topicsData:TopicsData} | ||||
props.HandleOk(parm) | |||||
HandleOk(parm) | |||||
console.log(de) | console.log(de) | ||||
setSelectedRows([]) | |||||
setDeviceIds() | |||||
} | } | ||||
} | } | ||||
}} | }} | ||||
onCancel={() => { | onCancel={() => { | ||||
props.onCancel(); | props.onCancel(); | ||||
setSelectedRows([]) | |||||
setDeviceIds() | |||||
}} | }} | ||||
destroyOnClose | destroyOnClose | ||||
> | > | ||||
@@ -150,15 +150,8 @@ const goodspush = () => { | |||||
}, | }, | ||||
]; | ]; | ||||
const HandleOk= async(values)=>{ | const HandleOk= async(values)=>{ | ||||
await DevicePushRecodeAdd(values).then((res)=>{ | |||||
if(res.data){ | |||||
message.success('操作成功'); | |||||
handleModalVisible(false); | |||||
actionRef.current.reload(); | |||||
}else{ | |||||
message.error(res.errors); | |||||
} | |||||
}) | |||||
handleModalVisible(!values); | |||||
actionRef.current.reload(); | |||||
} | } | ||||
return ( | return ( | ||||
@@ -5,7 +5,8 @@ import { | |||||
GetDeviceList, | GetDeviceList, | ||||
GetGoodsPage, | GetGoodsPage, | ||||
GetGoodsTypeTree, | GetGoodsTypeTree, | ||||
GetProductTopicslist | |||||
GetProductTopicslist, | |||||
DevicePushRecodeAdd | |||||
} from '../services'; | } from '../services'; | ||||
const PushFrom = (props) => { | const PushFrom = (props) => { | ||||
const [deviceData, setdeviceData] = useState([]); | const [deviceData, setdeviceData] = useState([]); | ||||
@@ -58,6 +59,18 @@ const PushFrom = (props) => { | |||||
} | } | ||||
} | } | ||||
const HandleOk= async(values)=>{ | |||||
await DevicePushRecodeAdd(values).then((res)=>{ | |||||
if(res.data){ | |||||
message.success('操作成功'); | |||||
setSelectedRows([]) | |||||
setDeviceIds() | |||||
}else{ | |||||
message.error(res.errors); | |||||
} | |||||
props.HandleOk(res.data) | |||||
}) | |||||
} | |||||
const columns=[ | const columns=[ | ||||
{ | { | ||||
title: '编码', | title: '编码', | ||||
@@ -90,18 +103,19 @@ const PushFrom = (props) => { | |||||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | bodyStyle={{ padding: '32px 40px 1px 48px' }} | ||||
okText="确定" | okText="确定" | ||||
cancelText="取消" | cancelText="取消" | ||||
maskClosable={false} | |||||
onOk={() => { | onOk={() => { | ||||
if(!DeviceIds){ | if(!DeviceIds){ | ||||
message.error('请选择设备'); | message.error('请选择设备'); | ||||
}else{ | }else{ | ||||
var de=DeviceInfo.find(x=>x.id==DeviceIds); | var de=DeviceInfo.find(x=>x.id==DeviceIds); | ||||
var data={goodsinfo:[]}; | |||||
var data=[]; | |||||
// if(isGlogy){ | // if(isGlogy){ | ||||
// data.goodstechnology=[] | // data.goodstechnology=[] | ||||
// } | // } | ||||
selectedRowsState.map(x=>{ | selectedRowsState.map(x=>{ | ||||
var pa={id:x.id,code:x.code,goodsTypeId:x.goodsTypeId,goodsTypeName:x.goodsTypeName,goodsUintId:x.goodsUintId,imgUrl:x.imgUrl,isAttrubute:x.isAttrubute,name:x.name,price:x.price,design:x.design,remark:x.remark} | var pa={id:x.id,code:x.code,goodsTypeId:x.goodsTypeId,goodsTypeName:x.goodsTypeName,goodsUintId:x.goodsUintId,imgUrl:x.imgUrl,isAttrubute:x.isAttrubute,name:x.name,price:x.price,design:x.design,remark:x.remark} | ||||
data.goodsinfo.push(pa); | |||||
data.push(pa); | |||||
// if(isGlogy){ | // if(isGlogy){ | ||||
// //data.goodstechnology=[] | // //data.goodstechnology=[] | ||||
// if(x.goodstechnology.length>0){ | // if(x.goodstechnology.length>0){ | ||||
@@ -109,19 +123,21 @@ const PushFrom = (props) => { | |||||
// } | // } | ||||
// } | // } | ||||
}) | }) | ||||
if(data.goodsinfo.length==0){ | |||||
if(data.length==0){ | |||||
message.error('请先选择商品'); | message.error('请先选择商品'); | ||||
}else{ | }else{ | ||||
var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:1,data:data,productVersion:de.vesion,productKey:de.prductKey,topicsData:TopicsData} | var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:1,data:data,productVersion:de.vesion,productKey:de.prductKey,topicsData:TopicsData} | ||||
props.HandleOk(parm) | |||||
HandleOk(parm) | |||||
console.log(de) | console.log(de) | ||||
setSelectedRows([]) | |||||
setDeviceIds() | |||||
// setSelectedRows([]) | |||||
// setDeviceIds() | |||||
} | } | ||||
} | } | ||||
}} | }} | ||||
onCancel={() => { | onCancel={() => { | ||||
props.onCancel(); | props.onCancel(); | ||||
setSelectedRows([]) | |||||
setDeviceIds() | |||||
}} | }} | ||||
destroyOnClose | destroyOnClose | ||||
> | > | ||||
@@ -149,16 +149,9 @@ const goodspush = () => { | |||||
], | ], | ||||
}, | }, | ||||
]; | ]; | ||||
const HandleOk= async(values)=>{ | |||||
await DevicePushRecodeAdd(values).then((res)=>{ | |||||
if(res.data){ | |||||
message.success('操作成功'); | |||||
handleModalVisible(false); | |||||
actionRef.current.reload(); | |||||
}else{ | |||||
message.error('操作失败'); | |||||
} | |||||
}) | |||||
const HandleOk= async(data)=>{ | |||||
handleModalVisible(!data); | |||||
actionRef.current.reload(); | |||||
} | } | ||||
return ( | return ( | ||||
<PageContainer host header={{ | <PageContainer host header={{ | ||||
@@ -5,7 +5,8 @@ import { | |||||
GetDeviceList, | GetDeviceList, | ||||
GetGoodsPage, | GetGoodsPage, | ||||
GetGoodsTypeTree, | GetGoodsTypeTree, | ||||
GetProductTopicslist | |||||
GetProductTopicslist, | |||||
DevicePushRecodeAdd | |||||
} from '../services'; | } from '../services'; | ||||
const PushFrom = (props) => { | const PushFrom = (props) => { | ||||
const [deviceData, setdeviceData] = useState([]); | const [deviceData, setdeviceData] = useState([]); | ||||
@@ -64,6 +65,18 @@ const PushFrom = (props) => { | |||||
} | } | ||||
} | } | ||||
const HandleOk= async(values)=>{ | |||||
await DevicePushRecodeAdd(values).then((res)=>{ | |||||
if(res.data){ | |||||
message.success('操作成功'); | |||||
setSelectedRows([]) | |||||
setDeviceIds() | |||||
}else{ | |||||
message.error(res.errors); | |||||
} | |||||
props.HandleOk(res.data) | |||||
}) | |||||
} | |||||
const columns=[ | const columns=[ | ||||
{ | { | ||||
title: '编码', | title: '编码', | ||||
@@ -101,29 +114,33 @@ const PushFrom = (props) => { | |||||
message.error('请选择设备'); | message.error('请选择设备'); | ||||
}else{ | }else{ | ||||
var de=DeviceInfo.find(x=>x.id==DeviceIds); | var de=DeviceInfo.find(x=>x.id==DeviceIds); | ||||
var data={goodstechnology:[]}; | |||||
var data=[]; | |||||
console.log("de",de) | console.log("de",de) | ||||
selectedRowsState.map(x=>{ | selectedRowsState.map(x=>{ | ||||
if(x.goodstechnology.length>0){ | if(x.goodstechnology.length>0){ | ||||
data.goodstechnology.push(x.goodstechnology) | |||||
x.goodstechnology.map(y=>{ | |||||
data.push(y) | |||||
}) | |||||
} | } | ||||
// } | // } | ||||
}) | }) | ||||
if(data.goodstechnology.length==0){ | |||||
if(data.length==0){ | |||||
message.error('选择的商品还没有工艺'); | message.error('选择的商品还没有工艺'); | ||||
}else{ | }else{ | ||||
var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:4,data:data,productVersion:de.vesion,productKey:de.prductKey,topicsData:TopicsData} | var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:4,data:data,productVersion:de.vesion,productKey:de.prductKey,topicsData:TopicsData} | ||||
console.log("parm",parm) | console.log("parm",parm) | ||||
props.HandleOk(parm) | |||||
HandleOk(parm) | |||||
console.log(de) | console.log(de) | ||||
setSelectedRows([]) | |||||
setDeviceIds() | |||||
} | } | ||||
} | } | ||||
}} | }} | ||||
onCancel={() => { | onCancel={() => { | ||||
props.onCancel(); | props.onCancel(); | ||||
setSelectedRows([]) | |||||
setDeviceIds() | |||||
}} | }} | ||||
destroyOnClose | destroyOnClose | ||||
> | > | ||||
@@ -149,16 +149,9 @@ const goodspush = () => { | |||||
], | ], | ||||
}, | }, | ||||
]; | ]; | ||||
const HandleOk= async(values)=>{ | |||||
await DevicePushRecodeAdd(values).then((res)=>{ | |||||
if(res.data){ | |||||
message.success('操作成功'); | |||||
handleModalVisible(false); | |||||
actionRef.current.reload(); | |||||
}else{ | |||||
message.error('操作失败'); | |||||
} | |||||
}) | |||||
const HandleOk= async(data)=>{ | |||||
handleModalVisible(!data); | |||||
actionRef.current.reload(); | |||||
} | } | ||||
return ( | return ( | ||||
<PageContainer host header={{ | <PageContainer host header={{ | ||||