From 2e535d7b5f0a2622a9cce2d53f019eee7e601860 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Wed, 17 Jan 2024 18:12:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/device/productmanage/index.jsx | 33 +++++++++++------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/pages/device/productmanage/index.jsx b/src/pages/device/productmanage/index.jsx index 4c9a33b..7aed6dd 100644 --- a/src/pages/device/productmanage/index.jsx +++ b/src/pages/device/productmanage/index.jsx @@ -457,7 +457,6 @@ const handleRemove = async (ids) => { basis: ( { ]} dataSource={datafunctionSource} //数据绑定 - // request={async (params) => { - // var data = []; - // var total = 0; - // params.deviceTypeKey=props.location.query.values.id + request={async (params) => { + var data = []; + var total = 0; + params.deviceTypeKey=props.location.query.values.id - // await getGoodstechnologypage(params).then((r) => { - // data = r.data.data; - // data.forEach((x) => { - // x.status = x.status.toString(); - // }); - // total = r.data.total; - // }); - // return { - // data: data, - // success: true, - // total: total, - // }; - // }} + await getGoodstechnologypage(params).then((r) => { + data = r.data.data; + setdatafunctionSource( r.data.data) + total = r.data.total; + }); + return { + data: data, + success: true, + total: total, + }; + }} // 每行选择点击事件 rowSelection={{ onChange: (_, selectedRows) => { From 8a8c5d4b26c9a5d6bee769d2a4ad8fa2cde07ede Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Thu, 18 Jan 2024 18:35:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=B7=A5=E8=89=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/goodsInfo/components/EditFrom.jsx | 2 +- .../components/goodstechnologymaken.jsx | 72 ++++++++++--------- src/pages/database/goods/goodsInfo/index.jsx | 17 +++-- src/pages/database/goods/goodsInfo/service.js | 4 +- 4 files changed, 53 insertions(+), 42 deletions(-) diff --git a/src/pages/database/goods/goodsInfo/components/EditFrom.jsx b/src/pages/database/goods/goodsInfo/components/EditFrom.jsx index 5b4dbd4..c63f000 100644 --- a/src/pages/database/goods/goodsInfo/components/EditFrom.jsx +++ b/src/pages/database/goods/goodsInfo/components/EditFrom.jsx @@ -80,7 +80,7 @@ const EditFrom = (props) => { const onHandleChange = (value, option, index) => { console.log(fromdata) console.log(index) - var sd = props.technologyattralldata.filter(x => x.goodstechnologyId == value); + var sd = props.technologyattralldata.filter(x => x.productFunctionId == value); var newdata = fromdata.map(x => { if (x.index == index) { diff --git a/src/pages/database/goods/goodsInfo/components/goodstechnologymaken.jsx b/src/pages/database/goods/goodsInfo/components/goodstechnologymaken.jsx index 1e58b88..5c8180e 100644 --- a/src/pages/database/goods/goodsInfo/components/goodstechnologymaken.jsx +++ b/src/pages/database/goods/goodsInfo/components/goodstechnologymaken.jsx @@ -45,39 +45,43 @@ const goodstechnologymaken = (props) => { interdata() }, []) const interdata = () => { - getbyidgoods(props.goodsid).then((res) => { - if (res.succeeded) { - - if (res.data.goodsAttributeList.length == 0) { - setdisplay("none") - }else{ - res.data.goodsAttributeList.forEach(item=>{ - item.defalutvalue=[]; - item.goodsAttributeValueList.forEach(x=>{ - if(item.attributeName=="默认属性"){ - x.check=true; - setAttrvalue(x.attributeValue) - item.defalutvalue.push(x.goodsAttributeValuId) - }else{ - x.check=false; - } + console.log("props.goodsid",props.goodsid) + if(props.goodsid!=undefined){ + getbyidgoods(props.goodsid).then((res) => { + if (res.succeeded) { + + if (res.data.goodsAttributeList.length == 0) { + setdisplay("none") + }else{ + res.data.goodsAttributeList.forEach(item=>{ + item.defalutvalue=[]; + item.goodsAttributeValueList.forEach(x=>{ + if(item.attributeName=="默认属性"){ + x.check=true; + setAttrvalue(x.attributeValue) + item.defalutvalue.push(x.goodsAttributeValuId) + }else{ + x.check=false; + } + }) }) - }) + } + console.log("商品属性",res.data) + setGoodsinfo(res.data) + var it = [ + // {key:'1',label:'',children:(
)}, + { key: '1', label: '商品名称', children: res.data.name }, + { key: '2', label: '商品价格', children: res.data.price }, + { key: '3', label: '商品类型', children: res.data.goodsTypeName }, + { key: '4', label: '商品单位', children: res.data.goodsUintName }, + ] + setItems(it) + } else { + message.error("查询商品信息失败"); } - console.log("商品属性",res.data) - setGoodsinfo(res.data) - var it = [ - // {key:'1',label:'',children:(
)}, - { key: '1', label: '商品名称', children: res.data.name }, - { key: '2', label: '商品价格', children: res.data.price }, - { key: '3', label: '商品类型', children: res.data.goodsTypeName }, - { key: '4', label: '商品单位', children: res.data.goodsUintName }, - ] - setItems(it) - } else { - message.error("查询商品信息失败"); - } - }); + }); + } + // GetGoodsTechnology().then((r) => { // var data = r.data; // var sd = [] @@ -157,7 +161,7 @@ const goodstechnologymaken = (props) => { item.data.forEach(item => { const obj = {}; let propsdatanew = []; - let propsdata = technologyattralldata.filter(x => x.goodstechnologyId == item.chnologyId) + let propsdata = technologyattralldata.filter(x => x.productFunctionId == item.chnologyId) obj.stepName = item.stepName; obj.id = item.id; obj.chnologyId = item.chnologyId; @@ -170,7 +174,7 @@ const goodstechnologymaken = (props) => { actionName: x.actionName, actionType: x.actionType, actionValue: x.actionValue, - goodstechnologyId: x.goodstechnologyId, + goodstechnologyId: x.productFunctionId, isBatch: x.isBatch, sort: x.sort, goddteid: item.id @@ -245,7 +249,7 @@ const goodstechnologymaken = (props) => { if (sd) { if (sd.goodsTechnologyInfo.length > 0) { godata = sd.goodsTechnologyInfo.map(x => { - return { value: x.goodsTechnologyId, label: x.name } + return { value: x.deviceTechnologyId, label: x.name } }) setgoodstechnologydata(godata) diff --git a/src/pages/database/goods/goodsInfo/index.jsx b/src/pages/database/goods/goodsInfo/index.jsx index b176454..2fa0eb8 100644 --- a/src/pages/database/goods/goodsInfo/index.jsx +++ b/src/pages/database/goods/goodsInfo/index.jsx @@ -134,11 +134,18 @@ const Advanced = (props) => { tabActiveKey: props.location.query.tabStatus ? props.location.query.tabStatus : 'basis', }); useEffect(() => { - SetCurrTabKey(tabStatus.tabActiveKey); - initGoodsUnit(); - initGoodsType(); - initGetbomType(); - intBatching(); + if(!props.location.query.values.id){ + history.push({ + pathname: '/database/goods/newgoods', + }); + }else{ + SetCurrTabKey(tabStatus.tabActiveKey); + initGoodsUnit(); + initGoodsType(); + initGetbomType(); + intBatching(); + } + }, [tabStatus]) const onTabChange = (key) => { if (currentGoodsProp === 1) { diff --git a/src/pages/database/goods/goodsInfo/service.js b/src/pages/database/goods/goodsInfo/service.js index 725b74c..d7bf1ac 100644 --- a/src/pages/database/goods/goodsInfo/service.js +++ b/src/pages/database/goods/goodsInfo/service.js @@ -118,12 +118,12 @@ export async function GetGoodsTechnology(data) { }); } export async function GetTechnologyactionList(data) { - return request(`/saasbase/api/goodstechnology/gettechnologyactionList?GoodstechnologyId=`+data, { + return request(`/saasbase/api/productfunction/getproductfunctionaction?productFunctionId=`+data, { method: 'Get', }); } export async function GetTechnologyActionListAll() { - return request(`/saasbase/api/devicetechnology/gettechnologyactionlist`, { + return request(`/saasbase/api/productfunction/getproductfunctionactionlist`, { method: 'Get', }); }