@@ -4,6 +4,7 @@ import ProTable from '@ant-design/pro-table'; | |||
import { | |||
GetDeviceList, | |||
GetBatchingPage, | |||
GetProductTopicslist | |||
} from '../services'; | |||
const PushFrom = (props) => { | |||
const [deviceData, setdeviceData] = useState([]); | |||
@@ -11,6 +12,7 @@ const PushFrom = (props) => { | |||
const [dataSource,setdataSource]= useState([]); | |||
const [DeviceIds, setDeviceIds] = useState(); | |||
const [DeviceInfo, setDeviceInfo] = useState([]); | |||
const [TopicsData, setTopicsData] = useState([]); | |||
const actionRef = useRef(); | |||
useEffect(() => { | |||
console.log(props.values) | |||
@@ -21,20 +23,14 @@ const PushFrom = (props) => { | |||
}) | |||
setdeviceData(data) | |||
}) | |||
var params={current:1,pageSize:10} | |||
GetGoodsData(params) | |||
},[props.values]) | |||
const GetGoodsData=(params)=>{ | |||
GetBatchingPage(params).then((r) => { | |||
setdataSource(r.data.data); | |||
//console.log(goodsData) | |||
//total = r.data.total; | |||
}); | |||
} | |||
const handleChange=(value)=>{ | |||
setDeviceIds(value) | |||
var params={current:1,pageSize:10,deviceId:value} | |||
GetGoodsData(params) | |||
var de=DeviceInfo.find(x=>x.id==value); | |||
GetProductTopicslist({productId:de?.productId,productVesionId:de?.productVersionId,IsDefault:true}).then((r)=>{ | |||
setTopicsData(r.data) | |||
}) | |||
} | |||
const columns=[ | |||
@@ -64,9 +60,16 @@ const PushFrom = (props) => { | |||
message.error('请选择设备'); | |||
}else{ | |||
var de=DeviceInfo.find(x=>x.id==DeviceIds); | |||
var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:2,data:selectedRowsState} | |||
props.HandleOk(parm) | |||
console.log(de) | |||
if(selectedRowsState.length==0){ | |||
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) | |||
console.log(de) | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
} | |||
} | |||
}} | |||
onCancel={() => { | |||
@@ -95,12 +98,28 @@ const PushFrom = (props) => { | |||
headerTitle="" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
pagination={{ defaultPageSize: 10 }} | |||
pagination={{ defaultPageSize: 10}} | |||
search={{ | |||
labelWidth: 120, | |||
}} | |||
dataSource={dataSource} | |||
// dataSource={dataSource} | |||
columns={columns} | |||
request={async (params) => { | |||
var total = 0; | |||
var data = []; | |||
const res = await GetBatchingPage(params); | |||
if (res.statusCode == 200) { | |||
setdataSource(res.data.data); | |||
data = res.data.data; | |||
total = res.data.total; | |||
} | |||
return { | |||
data: data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => { | |||
setSelectedRows(selectedRows); | |||
@@ -42,7 +42,7 @@ const goodspush = () => { | |||
await DevicePushRecodeDelete(selectedRows.map((row) => row.id)).then((r) => { | |||
if (r.succeeded) { | |||
message.success('删除成功'); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
@@ -117,7 +117,7 @@ const goodspush = () => { | |||
DevicePushRecodeUpdate(record.id).then((r)=>{ | |||
if(r.data){ | |||
message.success('操作成功'); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error('操作失败'); | |||
} | |||
@@ -136,7 +136,7 @@ const goodspush = () => { | |||
// await DeleteGoodsType(record.id).then((r) => { | |||
// if (r.succeeded) { | |||
// message.success('删除成功'); | |||
// actionRef.current.reloadAndRest(); | |||
// actionRef.current.reload(); | |||
// } else { | |||
// message.error(r.errors); | |||
// } | |||
@@ -154,7 +154,7 @@ const HandleOk= async(values)=>{ | |||
if(res.data){ | |||
message.success('操作成功'); | |||
handleModalVisible(false); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error(res.errors); | |||
} | |||
@@ -1,6 +1,5 @@ | |||
import { request } from 'umi'; | |||
import { getDataBaseUrl,getgroupmealUrl } from '@/global_data'; | |||
export async function GetDevicePushRecodePage(data) { | |||
return request(getgroupmealUrl()+`/api/devicepushrecode/page`, { | |||
method: 'POST', | |||
@@ -15,8 +14,7 @@ export async function GetDevicePushRecodePage(data) { | |||
} | |||
export async function DevicePushRecodeUpdate(data) { | |||
return request(getgroupmealUrl()+`/api/devicepushrecode/update?id=`+data, { | |||
method: 'get', | |||
data: data, | |||
method: 'GET', | |||
}); | |||
} | |||
export async function DevicePushRecodeDelete(data) { | |||
@@ -35,5 +33,15 @@ export async function GetDevicePushRecodePage(data) { | |||
return request(getDataBaseUrl()+`/api/batching/getpage`, { | |||
method: 'Post', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function GetProductTopicslist(data) { | |||
return request(getDataBaseUrl()+`/api/producttopics/list`, { | |||
method: 'Post', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} |
@@ -4,7 +4,8 @@ import ProTable from '@ant-design/pro-table'; | |||
import { | |||
GetDeviceList, | |||
GetGoodsPage, | |||
GetGoodsTypeTree | |||
GetGoodsTypeTree, | |||
GetProductTopicslist | |||
} from '../services'; | |||
const PushFrom = (props) => { | |||
const [deviceData, setdeviceData] = useState([]); | |||
@@ -14,12 +15,13 @@ const PushFrom = (props) => { | |||
const [DeviceIds, setDeviceIds] = useState(); | |||
const [DeviceInfo, setDeviceInfo] = useState([]); | |||
const [isGlogy, setisGlogy] = useState(false); | |||
const [TopicsData, setTopicsData] = useState([]); | |||
const actionRef = useRef(); | |||
useEffect(() => { | |||
console.log(props.values) | |||
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} | |||
}) | |||
setdeviceData(data) | |||
@@ -27,8 +29,8 @@ const PushFrom = (props) => { | |||
GetGoodsTypeTree().then((r) => { | |||
setTreeData(r.data); | |||
}); | |||
var params={current:1,pageSize:10} | |||
GetGoodsData(params) | |||
// var params={current:1,pageSize:10} | |||
// GetGoodsData(params) | |||
},[props.values]) | |||
const GetGoodsData=(params)=>{ | |||
GetGoodsPage(params).then((r) => { | |||
@@ -41,6 +43,11 @@ const PushFrom = (props) => { | |||
setDeviceIds(value) | |||
var params={current:1,pageSize:10,deviceId:value} | |||
GetGoodsData(params) | |||
var de=DeviceInfo.find(x=>x.id==value); | |||
console.log("ddddd",de) | |||
GetProductTopicslist({productId:de?.productId,productVesionId:de?.productVersionId,IsDefault:true}).then((r)=>{ | |||
setTopicsData(r.data) | |||
}) | |||
} | |||
const onChange=(checked)=>{ | |||
if(!DeviceIds){ | |||
@@ -102,9 +109,15 @@ const PushFrom = (props) => { | |||
// } | |||
// } | |||
}) | |||
var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:1,data:data} | |||
props.HandleOk(parm) | |||
console.log(de) | |||
if(data.goodsinfo.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) | |||
console.log(de) | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
} | |||
} | |||
}} | |||
onCancel={() => { | |||
@@ -143,8 +156,24 @@ const PushFrom = (props) => { | |||
search={{ | |||
labelWidth: 120, | |||
}} | |||
dataSource={dataSource} | |||
// dataSource={dataSource} | |||
columns={columns} | |||
request={async (params) => { | |||
var total = 0; | |||
var data = []; | |||
const res = await GetGoodsPage(params); | |||
if (res.statusCode == 200) { | |||
setdataSource(res.data.data); | |||
data = res.data.data; | |||
total = res.data.total; | |||
} | |||
return { | |||
data: data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => { | |||
setSelectedRows(selectedRows); | |||
@@ -42,7 +42,7 @@ const goodspush = () => { | |||
await DevicePushRecodeDelete(selectedRows.map((row) => row.id)).then((r) => { | |||
if (r.succeeded) { | |||
message.success('删除成功'); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
@@ -117,7 +117,7 @@ const goodspush = () => { | |||
DevicePushRecodeUpdate(record.id).then((r)=>{ | |||
if(r.data){ | |||
message.success('操作成功'); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error('操作失败'); | |||
} | |||
@@ -136,7 +136,7 @@ const goodspush = () => { | |||
// await DeleteGoodsType(record.id).then((r) => { | |||
// if (r.succeeded) { | |||
// message.success('删除成功'); | |||
// actionRef.current.reloadAndRest(); | |||
// actionRef.current.reload(); | |||
// } else { | |||
// message.error(r.errors); | |||
// } | |||
@@ -154,7 +154,7 @@ const HandleOk= async(values)=>{ | |||
if(res.data){ | |||
message.success('操作成功'); | |||
handleModalVisible(false); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error('操作失败'); | |||
} | |||
@@ -1,6 +1,5 @@ | |||
import { request } from 'umi'; | |||
import { getDataBaseUrl,getgroupmealUrl } from '@/global_data'; | |||
export async function GetDevicePushRecodePage(data) { | |||
return request(getgroupmealUrl()+`/api/devicepushrecode/page`, { | |||
method: 'POST', | |||
@@ -15,8 +14,7 @@ export async function GetDevicePushRecodePage(data) { | |||
} | |||
export async function DevicePushRecodeUpdate(data) { | |||
return request(getgroupmealUrl()+`/api/devicepushrecode/update?id=`+data, { | |||
method: 'get', | |||
data: data, | |||
method: 'GET', | |||
}); | |||
} | |||
export async function DevicePushRecodeDelete(data) { | |||
@@ -46,3 +44,11 @@ export async function GetDevicePushRecodePage(data) { | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function GetProductTopicslist(data) { | |||
return request(getDataBaseUrl()+`/api/producttopics/list`, { | |||
method: 'Post', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} |
@@ -4,7 +4,8 @@ import ProTable from '@ant-design/pro-table'; | |||
import { | |||
GetDeviceList, | |||
GetGoodsPage, | |||
GetGoodsTypeTree | |||
GetGoodsTypeTree, | |||
GetProductTopicslist | |||
} from '../services'; | |||
const PushFrom = (props) => { | |||
const [deviceData, setdeviceData] = useState([]); | |||
@@ -13,10 +14,13 @@ const PushFrom = (props) => { | |||
const [treeData, setTreeData] = useState(); | |||
const [DeviceIds, setDeviceIds] = useState(); | |||
const [DeviceInfo, setDeviceInfo] = useState([]); | |||
const [TopicsData, setTopicsData] = useState([]); | |||
const [isGlogy, setisGlogy] = useState(false); | |||
const [total,settotal]=useState(0); | |||
const actionRef = useRef(); | |||
useEffect(() => { | |||
console.log(props.values) | |||
GetDeviceList().then((r)=>{ | |||
setDeviceInfo(r.data) | |||
if(r.data.length>0){ | |||
@@ -25,25 +29,31 @@ const PushFrom = (props) => { | |||
}) | |||
setdeviceData(data) | |||
} | |||
}) | |||
GetGoodsTypeTree().then((r) => { | |||
setTreeData(r.data); | |||
}); | |||
var params={current:1,pageSize:10} | |||
GetGoodsData(params) | |||
// var params={current:1,pageSize:10} | |||
// GetGoodsData(params) | |||
},[props.values]) | |||
const GetGoodsData=(params)=>{ | |||
GetGoodsPage(params).then((r) => { | |||
setdataSource(r.data.data); | |||
//console.log(goodsData) | |||
//total = r.data.total; | |||
settotal( r.data.total) | |||
}); | |||
} | |||
const handleChange=(value)=>{ | |||
setDeviceIds(value) | |||
var params={current:1,pageSize:10,deviceId:value} | |||
GetGoodsData(params) | |||
var de=DeviceInfo.find(x=>x.id==value); | |||
console.log("ddddd",de) | |||
GetProductTopicslist({productId:de?.productId,productVesionId:de?.productVersionId,IsDefault:true}).then((r)=>{ | |||
setTopicsData(r.data) | |||
}) | |||
} | |||
const onChange=(checked)=>{ | |||
if(!DeviceIds){ | |||
@@ -92,14 +102,8 @@ const PushFrom = (props) => { | |||
}else{ | |||
var de=DeviceInfo.find(x=>x.id==DeviceIds); | |||
var data={goodstechnology:[]}; | |||
// if(isGlogy){ | |||
// data.goodstechnology=[] | |||
// } | |||
console.log("de",de) | |||
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); | |||
// if(isGlogy){ | |||
// //data.goodstechnology=[] | |||
if(x.goodstechnology.length>0){ | |||
data.goodstechnology.push(x.goodstechnology) | |||
} | |||
@@ -108,9 +112,12 @@ const PushFrom = (props) => { | |||
if(data.goodstechnology.length==0){ | |||
message.error('选择的商品还没有工艺'); | |||
}else{ | |||
var parm={deviceId:de.id,deviceName:de.name,deviceAutoKey:de.autoKey,type:4,data:data} | |||
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) | |||
console.log(de) | |||
setSelectedRows([]) | |||
setDeviceIds() | |||
} | |||
} | |||
@@ -147,12 +154,28 @@ const PushFrom = (props) => { | |||
headerTitle="" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
pagination={{ defaultPageSize: 10 }} | |||
pagination={{ defaultPageSize: 10}} | |||
search={{ | |||
labelWidth: 120, | |||
}} | |||
dataSource={dataSource} | |||
//dataSource={dataSource} | |||
columns={columns} | |||
request={async (params) => { | |||
var total = 0; | |||
var data = []; | |||
const res = await GetGoodsPage(params); | |||
if (res.statusCode == 200) { | |||
setdataSource(res.data.data); | |||
data = res.data.data; | |||
total = res.data.total; | |||
} | |||
return { | |||
data: data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => { | |||
setSelectedRows(selectedRows); | |||
@@ -42,7 +42,7 @@ const goodspush = () => { | |||
await DevicePushRecodeDelete(selectedRows.map((row) => row.id)).then((r) => { | |||
if (r.succeeded) { | |||
message.success('删除成功'); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
@@ -117,7 +117,7 @@ const goodspush = () => { | |||
DevicePushRecodeUpdate(record.id).then((r)=>{ | |||
if(r.data){ | |||
message.success('操作成功'); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error('操作失败'); | |||
} | |||
@@ -136,7 +136,7 @@ const goodspush = () => { | |||
// await DeleteGoodsType(record.id).then((r) => { | |||
// if (r.succeeded) { | |||
// message.success('删除成功'); | |||
// actionRef.current.reloadAndRest(); | |||
// actionRef.current.reload(); | |||
// } else { | |||
// message.error(r.errors); | |||
// } | |||
@@ -154,7 +154,7 @@ const HandleOk= async(values)=>{ | |||
if(res.data){ | |||
message.success('操作成功'); | |||
handleModalVisible(false); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error('操作失败'); | |||
} | |||
@@ -1,6 +1,5 @@ | |||
import { request } from 'umi'; | |||
import { getDataBaseUrl,getgroupmealUrl } from '@/global_data'; | |||
export async function GetDevicePushRecodePage(data) { | |||
return request(getgroupmealUrl()+`/api/devicepushrecode/page`, { | |||
method: 'POST', | |||
@@ -15,7 +14,7 @@ export async function GetDevicePushRecodePage(data) { | |||
} | |||
export async function DevicePushRecodeUpdate(data) { | |||
return request(getgroupmealUrl()+`/api/devicepushrecode/update?id=`+data, { | |||
method: 'get', | |||
method: 'GET', | |||
}); | |||
} | |||
export async function DevicePushRecodeDelete(data) { | |||
@@ -45,3 +44,11 @@ export async function GetDevicePushRecodePage(data) { | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function GetProductTopicslist(data) { | |||
return request(getDataBaseUrl()+`/api/producttopics/list`, { | |||
method: 'Post', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} |