Commit 9341edc9 authored by 邓超's avatar 邓超

fix: 修改产品配置应用开关切换失败

parent 6bb60036
Pipeline #44749 skipped with stages
...@@ -28,11 +28,8 @@ const EditForm = props => { ...@@ -28,11 +28,8 @@ const EditForm = props => {
}, },
]; ];
useEffect(() => { useEffect(() => {
console.log(8888);
console.log(productObj, 'productObj');
console.log(userProductsList);
form.setFieldsValue({ ...productObj });
console.log(productObj.IsUsed, 'productObj.IsUsed'); console.log(productObj.IsUsed, 'productObj.IsUsed');
form.setFieldsValue({ ...productObj });
if (!productObj.IsUsed) { if (!productObj.IsUsed) {
setBut(true); setBut(true);
} else { } else {
......
...@@ -9,7 +9,7 @@ const ProductConfig = props => { ...@@ -9,7 +9,7 @@ const ProductConfig = props => {
const [addVisible, setAddVisible] = useState(false); const [addVisible, setAddVisible] = useState(false);
const [productList, setProductList] = useState([]); const [productList, setProductList] = useState([]);
const [userProductsList, setUserProductsList] = useState([]); const [userProductsList, setUserProductsList] = useState([]);
const [productObj, setProductObt] = useState(''); const [productObj, setProductObj] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [list, setList] = useState(new Set()); const [list, setList] = useState(new Set());
...@@ -25,7 +25,7 @@ const ProductConfig = props => { ...@@ -25,7 +25,7 @@ const ProductConfig = props => {
} = res; } = res;
// setProductList(AllProducts); // setProductList(AllProducts);
setUserProductsList(UserProducts); setUserProductsList(UserProducts);
setProductObt(AllProducts[0]); setProductObj(AllProducts[0]);
AllProducts.map(i => { AllProducts.map(i => {
list.add(i.ProductType); list.add(i.ProductType);
}); });
...@@ -43,8 +43,6 @@ const ProductConfig = props => { ...@@ -43,8 +43,6 @@ const ProductConfig = props => {
}); });
aa.push(ad); aa.push(ad);
}); });
console.log(aa);
// console.log(...aa);
setProductList(aa); setProductList(aa);
} }
}) })
...@@ -65,7 +63,7 @@ const ProductConfig = props => { ...@@ -65,7 +63,7 @@ const ProductConfig = props => {
// setProductList(AllProducts); // setProductList(AllProducts);
setUserProductsList(UserProducts); setUserProductsList(UserProducts);
// if (!productObj && data.length > 0) { // if (!productObj && data.length > 0) {
// setProductObt(data[0]); // setProductObj(data[0]);
// } // }
// setProductList(data); // setProductList(data);
AllProducts.map(i => { AllProducts.map(i => {
...@@ -85,7 +83,6 @@ const ProductConfig = props => { ...@@ -85,7 +83,6 @@ const ProductConfig = props => {
}); });
aa.push(ad); aa.push(ad);
}); });
console.log(aa);
setProductList(aa); setProductList(aa);
} }
}) })
...@@ -109,7 +106,7 @@ const ProductConfig = props => { ...@@ -109,7 +106,7 @@ const ProductConfig = props => {
setLoading(false); setLoading(false);
if (res.code === 0) { if (res.code === 0) {
item.IsUsed = false; item.IsUsed = false;
setProductObt(item); setProductObj(item);
notification.success({ notification.success({
message: '提示', message: '提示',
description: '关闭成功', description: '关闭成功',
...@@ -174,7 +171,8 @@ const ProductConfig = props => { ...@@ -174,7 +171,8 @@ const ProductConfig = props => {
}); });
item.IsUsed = true; item.IsUsed = true;
console.log(item, 'item'); console.log(item, 'item');
setProductObt(item); console.log(productObj, 'productObj33333');
setProductObj({ ...item });
setFlag(flag + 1); setFlag(flag + 1);
} else { } else {
notification.error({ notification.error({
...@@ -199,13 +197,13 @@ const ProductConfig = props => { ...@@ -199,13 +197,13 @@ const ProductConfig = props => {
// console.log(value); // console.log(value);
// let obj = productList.find(i => i.PackageName === value.PackageName); // let obj = productList.find(i => i.PackageName === value.PackageName);
setProductObt(value); setProductObj({ ...value });
// if (userProductsList.length > 0) { // if (userProductsList.length > 0) {
// let obj = userProductsList.find(i => i.PackageName === value.PackageName); // let obj = userProductsList.find(i => i.PackageName === value.PackageName);
// console.log(value); // console.log(value);
// console.log(obj); // console.log(obj);
// if (obj) { // if (obj) {
// setProductObt(obj); // setProductObj(obj);
// } else { // } else {
// message.warning({ // message.warning({
// content: '请先启用产品', // content: '请先启用产品',
...@@ -221,7 +219,7 @@ const ProductConfig = props => { ...@@ -221,7 +219,7 @@ const ProductConfig = props => {
}; };
// const changeBut = value => { // const changeBut = value => {
// let obj = userProductsList.find(i => i.PackageName === value.PackageName); // let obj = userProductsList.find(i => i.PackageName === value.PackageName);
// setProductObt(obj); // setProductObj(obj);
// }; // };
const renderListItem = arr => ( const renderListItem = arr => (
<div style={{ marginBottom: '25px' }}> <div style={{ marginBottom: '25px' }}>
...@@ -267,10 +265,7 @@ const ProductConfig = props => { ...@@ -267,10 +265,7 @@ const ProductConfig = props => {
删除 删除
</Button> */} </Button> */}
</div> </div>
{console.log(productList, 'productList')}
{productList && productList.length > 0 ? ( {productList && productList.length > 0 ? (
// <List>{renderListItem(productList)}</List>
// <div style={}></div>
productList.map(item => renderListItem(item)) productList.map(item => renderListItem(item))
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment