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

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

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