@@ -4,7 +4,8 @@ import ProTable from '@ant-design/pro-table'; | |||
import { | |||
GetDeviceList, | |||
GetBatchingPage, | |||
GetProductTopicslist | |||
GetProductTopicslist, | |||
DevicePushRecodeAdd | |||
} from '../services'; | |||
const PushFrom = (props) => { | |||
const [deviceData, setdeviceData] = useState([]); | |||
@@ -32,7 +33,18 @@ const PushFrom = (props) => { | |||
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=[ | |||
{ | |||
title: '编码', | |||
@@ -64,16 +76,17 @@ const PushFrom = (props) => { | |||
message.error('请选择物料数据'); | |||
}else{ | |||
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) | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
} | |||
} | |||
}} | |||
onCancel={() => { | |||
props.onCancel(); | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
}} | |||
destroyOnClose | |||
> | |||
@@ -150,15 +150,8 @@ const goodspush = () => { | |||
}, | |||
]; | |||
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 ( | |||
@@ -5,7 +5,8 @@ import { | |||
GetDeviceList, | |||
GetGoodsPage, | |||
GetGoodsTypeTree, | |||
GetProductTopicslist | |||
GetProductTopicslist, | |||
DevicePushRecodeAdd | |||
} from '../services'; | |||
const PushFrom = (props) => { | |||
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=[ | |||
{ | |||
title: '编码', | |||
@@ -90,18 +103,19 @@ const PushFrom = (props) => { | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
okText="确定" | |||
cancelText="取消" | |||
maskClosable={false} | |||
onOk={() => { | |||
if(!DeviceIds){ | |||
message.error('请选择设备'); | |||
}else{ | |||
var de=DeviceInfo.find(x=>x.id==DeviceIds); | |||
var data={goodsinfo:[]}; | |||
var data=[]; | |||
// if(isGlogy){ | |||
// data.goodstechnology=[] | |||
// } | |||
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} | |||
data.goodsinfo.push(pa); | |||
data.push(pa); | |||
// if(isGlogy){ | |||
// //data.goodstechnology=[] | |||
// if(x.goodstechnology.length>0){ | |||
@@ -109,19 +123,21 @@ const PushFrom = (props) => { | |||
// } | |||
// } | |||
}) | |||
if(data.goodsinfo.length==0){ | |||
if(data.length==0){ | |||
message.error('请先选择商品'); | |||
}else{ | |||
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) | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
// setSelectedRows([]) | |||
// setDeviceIds() | |||
} | |||
} | |||
}} | |||
onCancel={() => { | |||
props.onCancel(); | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
}} | |||
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 ( | |||
<PageContainer host header={{ | |||
@@ -5,7 +5,8 @@ import { | |||
GetDeviceList, | |||
GetGoodsPage, | |||
GetGoodsTypeTree, | |||
GetProductTopicslist | |||
GetProductTopicslist, | |||
DevicePushRecodeAdd | |||
} from '../services'; | |||
const PushFrom = (props) => { | |||
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=[ | |||
{ | |||
title: '编码', | |||
@@ -101,29 +114,33 @@ const PushFrom = (props) => { | |||
message.error('请选择设备'); | |||
}else{ | |||
var de=DeviceInfo.find(x=>x.id==DeviceIds); | |||
var data={goodstechnology:[]}; | |||
var data=[]; | |||
console.log("de",de) | |||
selectedRowsState.map(x=>{ | |||
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('选择的商品还没有工艺'); | |||
}else{ | |||
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) | |||
props.HandleOk(parm) | |||
HandleOk(parm) | |||
console.log(de) | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
} | |||
} | |||
}} | |||
onCancel={() => { | |||
props.onCancel(); | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
}} | |||
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 ( | |||
<PageContainer host header={{ | |||