diff --git a/src/pages/goods/goodsInfo/index.jsx b/src/pages/goods/goodsInfo/index.jsx index 04e449f..047a9f0 100644 --- a/src/pages/goods/goodsInfo/index.jsx +++ b/src/pages/goods/goodsInfo/index.jsx @@ -499,8 +499,13 @@ const Advanced = (props) => { arr.forEach((element) => { element.text = element.goodsType_Name; }); + if(arr.length==0){ + setGoodsTypes([{id:'-1',goodsType_Name:'默认分类'}]); + }else{ + setGoodsTypes(arr); + } - setGoodsTypes(arr); + }); } function initGoodsBigType() { @@ -509,15 +514,24 @@ const Advanced = (props) => { arr.forEach((element) => { element.text = element.name; }); - + if(arr.length==0){ + setGoodsBigTypes([{id:'-1',name:'默认分类'}]); + }else{ setGoodsBigTypes(arr); + } }); } function initGoodsUnit() { unitList('{"current":1,"pageSize":200}').then((r) => { var arr = r.data.data; - - setGoodsUnit(arr); + if(arr.length==0){ + setGoodsUnit([{ + id:"-1", + name:"默认单位" + }]); + }else{ + setGoodsUnit(arr); + } }); } getbomtypepage({ current: 1, pagesize: 1000,status:"0" }).then((r) => {