Commit 0e5f7bb5 authored by 皮倩雯's avatar 皮倩雯

fix: '修复产品授权接口调用三次bug,web配置,moblie配置覆盖导入强提醒'

parent 2fbb33e6
Pipeline #82825 failed with stages
...@@ -105,6 +105,10 @@ iframe { ...@@ -105,6 +105,10 @@ iframe {
} }
} }
.ant-popover-message {
display: flex;
}
.ant-table-cell { .ant-table-cell {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
......
...@@ -3,6 +3,8 @@ import { Modal, Upload, Button, Form, Input, message, Popconfirm } from 'antd'; ...@@ -3,6 +3,8 @@ import { Modal, Upload, Button, Form, Input, message, Popconfirm } from 'antd';
import { UploadOutlined, DownloadOutlined } from '@ant-design/icons'; import { UploadOutlined, DownloadOutlined } from '@ant-design/icons';
import { UpLoadWebModuleTree, DownLoadWebModuleTree } from '@/services/webConfig/api'; import { UpLoadWebModuleTree, DownLoadWebModuleTree } from '@/services/webConfig/api';
import icon from '@/assets/images/common/警告.png';
import styles from './ImportOrExport.less';
const ImportOrExport = props => { const ImportOrExport = props => {
const { visible, onFinish, onCancel, nodeObj, subSystemValue } = props; const { visible, onFinish, onCancel, nodeObj, subSystemValue } = props;
...@@ -101,13 +103,23 @@ const ImportOrExport = props => { ...@@ -101,13 +103,23 @@ const ImportOrExport = props => {
增量导入 增量导入
</Button> </Button>
<Popconfirm <Popconfirm
overlayClassName={styles.ImportOrExport}
title={ title={
<span> <span style={{ color: 'red' }}>
导入操作会覆盖所有菜单配置并且使 导入操作会覆盖所有菜单配置并且使
<br /> <br />
角色菜单权限失效是否继续导入? 角色菜单权限失效是否继续导入?
</span> </span>
} }
icon={
<img
src={icon}
alt=""
width="18px"
height="18px"
style={{ marginTop: '3px' }}
/>
}
onConfirm={() => handleUpload(1)} onConfirm={() => handleUpload(1)}
onVisibleChange={() => console.log('visible change')} onVisibleChange={() => console.log('visible change')}
> >
...@@ -116,6 +128,8 @@ const ImportOrExport = props => { ...@@ -116,6 +128,8 @@ const ImportOrExport = props => {
style={{ style={{
marginLeft: '10px', marginLeft: '10px',
display: nodeObj ? 'none' : 'block', display: nodeObj ? 'none' : 'block',
backgroundColor: '#ff8f18',
borderColor: '#ff8f18',
}} }}
> >
覆盖导入 覆盖导入
......
.ImportOrExport {
.ant-popover-message-title {
padding-left: 12px;
}
}
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Select, Input, Button, Popconfirm, Spin } from 'antd'; import { Form, Select, Input, Button } from 'antd';
import { modifyProduct, getProductList } from '@/services/webConfig/api';
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const { TextArea } = Input; const { TextArea } = Input;
const EditForm = props => { const EditForm = props => {
const { productObj, editCallback, handleDel, userProductsList } = props; const { productObj, editCallback, handleDel, userProductsList } = props;
const [config, setConfig] = useState(''); // 网站配置信息
const [loading, setLoading] = useState(false);
const [but, setBut] = useState(false); const [but, setBut] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
const layout = { const layout = {
...@@ -28,56 +25,24 @@ const EditForm = props => { ...@@ -28,56 +25,24 @@ const EditForm = props => {
}, },
]; ];
useEffect(() => { useEffect(() => {
getProductList().then(res => { if (productObj) {
const { code } = res; let aa = userProductsList.find(i => i.ProductName == productObj.ProductName);
if (code === 0) { getData(aa);
const { }
data: { AllProducts, UserProducts },
} = res;
console.log(UserProducts);
console.log(productObj);
let aa = UserProducts.find(i => i.ProductName == productObj.ProductName);
getData(aa);
}
});
}, [productObj]); }, [productObj]);
const getData = aa => { const getData = aa => {
if (!productObj.IsUsed) { if (!productObj.IsUsed) {
console.log(12);
setBut(true); setBut(true);
form.setFieldsValue({ ...productObj });
if (aa) {
form.setFieldsValue({ DefaultSetting: aa.DefaultSetting, RouteUrl: aa.RouteUrl });
}
} else { } else {
console.log(34);
setBut(false); setBut(false);
form.setFieldsValue({ ...productObj }); }
if (aa) { form.setFieldsValue({ ...productObj });
form.setFieldsValue({ DefaultSetting: aa.DefaultSetting, RouteUrl: aa.RouteUrl }); if (aa) {
} form.setFieldsValue({ DefaultSetting: aa.DefaultSetting, RouteUrl: aa.RouteUrl });
} }
}; };
// useEffect(() => {
// if (!productObj.IsUsed) {
// console.log(12);
// setBut(true);
// form.setFieldsValue({ ...productObj });
// // if (aa) {
// // form.setFieldsValue({ DefaultSetting: aa.DefaultSetting });
// // }
// } else {
// console.log(34);
// setBut(false);
// form.setFieldsValue({ ...productObj });
// // if (aa) {
// // form.setFieldsValue({ DefaultSetting: aa.DefaultSetting });
// // }
// }
// }, [productObj]);
// 提交选择
const submit = value => {};
// 提交 // 提交
const finished = value => { const finished = value => {
let params = { let params = {
...@@ -87,127 +52,71 @@ const EditForm = props => { ...@@ -87,127 +52,71 @@ const EditForm = props => {
editCallback(params); editCallback(params);
}; };
return ( return (
<Spin spinning={loading} tip="loading..."> <div style={{ minHeight: 'calc(100vh - 252px)', marginTop: '35px' }}>
{/* <div style={{ marginLeft: '5%', marginTop: '-5px' }}>配置详情</div> */} <Form form={form} name="formEdit" {...layout} onFinish={finished}>
<div style={{ minHeight: 'calc(100vh - 252px)', marginTop: '35px' }}> <Item label="产品包名:" name="PackageName">
<Form form={form} name="formEdit" {...layout} onFinish={finished}> <Input placeholder="请输入产品包名" allowClear disabled />
<Item </Item>
label="产品包名:" <Item label="产品名称:" name="ProductName">
name="PackageName" <Input placeholder="请输入产品名称" allowClear disabled />
// rules={[ </Item>
// { <Item label="产品说明:" name="Description">
// required: true, <Input placeholder="请输入产品说明" disabled />
// pattern: new RegExp(/^[a-z0-9A-Z]+$/), </Item>
// message: '产品包名必须是英文或者数字', <Item label="发布状态:" name="PublishState">
// }, <Select placeholder="请选择发布状态" disabled>
// ]} {environmentList &&
> environmentList.map(item => (
<Input placeholder="请输入产品包名" allowClear disabled /> <Option value={item.value} key={item.key}>
</Item> {item.label}
<Item </Option>
label="产品名称:" ))}
name="ProductName" </Select>
// rules={[ </Item>
// { {but ? (
// required: true, <></>
// pattern: new RegExp(/^[a-z0-9A-Z]+$/), ) : (
// message: '产品名称必须是英文或者数字', <>
// }, <Item
// ]} label="访问路由"
> name="RouteUrl"
<Input placeholder="请输入产品名称" allowClear disabled /> rules={[
</Item> {
<Item required: true,
label="产品说明:" message: '请输入访问路由,ip加端口号,示例//localhost:3001',
name="Description" },
// rules={[ ]}
// { >
// required: true, <Input placeholder="请输入访问路由,ip加端口号,示例//localhost:3001" allowClear />
// pattern: new RegExp(/^[a-z0-9A-Z]+$/), </Item>
// message: '产品名称必须是英文或者数字',
// },
// ]}
>
<Input placeholder="请输入产品说明" disabled />
</Item>
<Item
label="发布状态:"
name="PublishState"
// rules={[
// {
// required: true,
// message: '请选择发布状态',
// },
// ]}
>
<Select placeholder="请选择发布状态" disabled>
{environmentList &&
environmentList.map(item => (
<Option value={item.value} key={item.key}>
{item.label}
</Option>
))}
</Select>
</Item>
{but ? (
<></>
) : (
<>
<Item
label="访问路由"
name="RouteUrl"
rules={[
{
required: true,
message: '请输入访问路由,ip加端口号,示例//localhost:3001',
},
]}
>
{/* <Input addonBefore="//" placeholder="请输入访问路由" allowClear /> */}
<Input placeholder="请输入访问路由,ip加端口号,示例//localhost:3001" allowClear />
</Item>
<Item
label="默认配置"
name="DefaultSetting"
rules={[
{
required: false,
message: '请输入默认配置',
},
]}
>
<TextArea
placeholder='请输入json对象,示例{"name":"张三","age":"18"}'
autoSize={{ minRows: 3, maxRows: 5 }}
/>
</Item>
</>
)}
<div style={{ display: 'flex', marginLeft: '35%' }}> <Item
<Item wrapperCol={{ span: 8, offset: 8 }} style={{ marginRight: '30px' }}> label="默认配置"
<Button type="primary" htmlType="submit" disabled={but}> name="DefaultSetting"
提交 rules={[
</Button> {
required: false,
message: '请输入默认配置',
},
]}
>
<TextArea
placeholder='请输入json对象,示例{"name":"张三","age":"18"}'
autoSize={{ minRows: 3, maxRows: 5 }}
/>
</Item> </Item>
{/* <Item wrapperCol={{ span: 8, offset: 8 }}> </>
<Popconfirm )}
title="确实删除产品"
placement="right" <div style={{ display: 'flex', marginLeft: '35%' }}>
okText="确认" <Item wrapperCol={{ span: 8, offset: 8 }} style={{ marginRight: '30px' }}>
cancelText="取消" <Button type="primary" htmlType="submit" disabled={but}>
onConfirm={handleDel} 提交
> </Button>
<Button type="primary" danger> </Item>
删除 </div>
</Button> </Form>
</Popconfirm> </div>
</Item> */}
</div>
</Form>
</div>
</Spin>
); );
}; };
export default EditForm; export default EditForm;
...@@ -19,43 +19,6 @@ const ProductConfig = props => { ...@@ -19,43 +19,6 @@ const ProductConfig = props => {
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [list, setList] = useState(new Set()); const [list, setList] = useState(new Set());
const [keepData, setKeepData] = useState(false); const [keepData, setKeepData] = useState(false);
// 默认展示第一项
// useEffect(() => {
// setLoading(true);
// getProductList()
// .then(res => {
// const { code } = res;
// if (code === 0) {
// const {
// data: { AllProducts, UserProducts },
// } = res;
// // setProductList(AllProducts);
// setUserProductsList(UserProducts);
// setProductObj(AllProducts[0]);
// AllProducts.map(i => {
// list.add(i.ProductType);
// });
// let a = [];
// list.map(i => {
// a.push(i);
// });
// let aa = [];
// a.map((i, j) => {
// let ad = [];
// AllProducts.map(k => {
// if (k.ProductType == i) {
// ad.push(k);
// }
// });
// aa.push(ad);
// });
// setProductList(aa);
// }
// })
// .finally(() => {
// setLoading(false);
// });
// }, []);
useEffect(() => { useEffect(() => {
setLoading(true); setLoading(true);
......
...@@ -52,4 +52,4 @@ ...@@ -52,4 +52,4 @@
.selected { .selected {
font-weight: bold; font-weight: bold;
background-color: #bae7ff !important; background-color: #bae7ff !important;
} }
\ No newline at end of file
...@@ -3,6 +3,8 @@ import { Modal, Upload, Button, Form, Input, message, Popconfirm } from 'antd'; ...@@ -3,6 +3,8 @@ import { Modal, Upload, Button, Form, Input, message, Popconfirm } from 'antd';
import { UploadOutlined, DownloadOutlined } from '@ant-design/icons'; import { UploadOutlined, DownloadOutlined } from '@ant-design/icons';
import { UpLoadWebModuleTree, DownLoadWebModuleTree } from '@/services/webConfig/api'; import { UpLoadWebModuleTree, DownLoadWebModuleTree } from '@/services/webConfig/api';
import icon from '@/assets/images/common/警告.png';
import styles from './ImportOrExport.less';
const ImportOrExport = props => { const ImportOrExport = props => {
const { visible, onFinish, onCancel, nodeObj, subSystemValue } = props; const { visible, onFinish, onCancel, nodeObj, subSystemValue } = props;
...@@ -100,13 +102,23 @@ const ImportOrExport = props => { ...@@ -100,13 +102,23 @@ const ImportOrExport = props => {
增量导入 增量导入
</Button> </Button>
<Popconfirm <Popconfirm
overlayClassName={styles.ImportOrExport}
title={ title={
<span> <span style={{ color: 'red' }}>
导入操作会覆盖所有菜单配置并且使 覆盖导入操作会覆盖所有菜单配置并使
<br /> <br />
角色菜单权限失效是否继续导入? 角色菜单权限失效!!!是否继续导入?
</span> </span>
} }
icon={
<img
src={icon}
alt=""
width="18px"
height="18px"
style={{ marginTop: '3px' }}
/>
}
onConfirm={() => handleUpload(1)} onConfirm={() => handleUpload(1)}
onVisibleChange={() => console.log('visible change')} onVisibleChange={() => console.log('visible change')}
> >
...@@ -115,6 +127,8 @@ const ImportOrExport = props => { ...@@ -115,6 +127,8 @@ const ImportOrExport = props => {
style={{ style={{
marginLeft: '10px', marginLeft: '10px',
display: nodeObj ? 'none' : 'block', display: nodeObj ? 'none' : 'block',
backgroundColor: '#ff8f18',
borderColor: '#ff8f18',
}} }}
> >
覆盖导入 覆盖导入
......
.ImportOrExport {
.ant-popover-message-title {
padding-left: 12px;
}
}
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