Commit 726aab0f authored by 皮倩雯's avatar 皮倩雯

fix: '宿主管理优化'

parent 3c09a493
Pipeline #71888 passed with stages
......@@ -13,14 +13,14 @@ import { Modal, notification } from 'antd';
import Sortable from 'sortablejs';
import styles from './SortModal.less';
import DragTable from '@/components/DragTable/DragTable';
import { SortScheme } from '@/services/webConfig/api';
import { SortScheme, SortSchemePost } from '@/services/webConfig/api';
const SortModal = props => {
const { callBackSubmit = () => {}, title, visible, onCancel, sortData } = props;
const [orderTable, setOrderTable] = useState([]);
const [flowIDs, setFlowIDs] = useState([]);
const onSumbit = () => {
SortScheme({ sortName: flowIDs.toString() }).then(res => {
SortSchemePost({ sortNames: flowIDs }).then(res => {
if (res.code === '0') {
callBackSubmit();
onCancel();
......
......@@ -28,8 +28,7 @@ const AddModal = props => {
useEffect(() => {
if (visible) {
if (type === 'edit') {
let data = ['CityServer', 'IOT', 'CivData', 'GIS'];
if (data.indexOf(pickItem.key) != -1) {
if (pickItem.remark) {
setHidden(true);
}
let aa = pickItem.methods.replace(/\s/g, '');
......@@ -80,7 +79,7 @@ const AddModal = props => {
setCurrent(true);
}
} else {
form.setFieldsValue({ IsAuthentication: true });
form.setFieldsValue({ IsAuthentication: true, Priority: 1, Methods: ['GET', 'POST'] });
}
} else {
setHidden(false);
......@@ -95,11 +94,8 @@ const AddModal = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
console.log(obj.IsAuthentication);
console.log(obj.Priority);
let aa = obj.Methods.toString();
obj.Methods = aa.replace(/\s/g, '');
console.log(obj.Methods);
let data = {
UpstreamPathTemplate: obj.UpstreamPathTemplate || null,
DownstreamPathTemplate: obj.DownstreamPathTemplate || null,
......@@ -125,65 +121,34 @@ const AddModal = props => {
ReRouteIsCaseSensitive: obj.ReRouteIsCaseSensitive || null,
DownstreamHttpMethod: obj.DownstreamHttpMethod || null,
};
console.log(data);
if (type === 'add') {
SaveRoutes([
{
...data,
IsEnable: 1,
},
])
.then(res => {
setLoading(false);
if (res.code === 0) {
onCancel();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: res.msg || '新增成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg || '新增失败',
});
}
})
.catch(err => {
setLoading(false);
});
} else {
SaveRoutes([
{
id: pickItem.id,
...data,
IsEnable: 1,
},
])
.then(res => {
setLoading(false);
if (res.code === 0) {
onCancel();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: res.msg || '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg || '编辑失败',
});
}
})
.catch(err => {
setLoading(false);
});
}
let str = type === 'add' ? '新增' : '编辑';
SaveRoutes([
{
...data,
IsEnable: 1,
},
])
.then(res => {
setLoading(false);
if (res.code === 0) {
onCancel();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: res.msg || `${str}成功`,
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg || `${str}失败`,
});
}
})
.catch(err => {
setLoading(false);
});
}
});
};
......@@ -274,7 +239,7 @@ const AddModal = props => {
},
]}
>
<Input allowClear placeholder="示例:/{url}" disabled={hidden} />
<Input allowClear placeholder="示例:/{url}" />
</Item>
<Item
label="上游请求方式"
......@@ -286,7 +251,7 @@ const AddModal = props => {
},
]}
>
<Checkbox.Group options={plainOptions} style={{ display: 'flex' }} disabled={hidden} />
<Checkbox.Group options={plainOptions} style={{ display: 'flex' }} />
</Item>
<Item
label="下游服务地址"
......@@ -302,12 +267,8 @@ const AddModal = props => {
</Item>
<Item label="身份认证" name="IsAuthentication">
<Radio.Group>
<Radio value={true} disabled={hidden}>
开启
</Radio>
<Radio value={false} disabled={hidden}>
关闭
</Radio>
<Radio value={true}>开启</Radio>
<Radio value={false}>关闭</Radio>
</Radio.Group>
</Item>
<Item
......@@ -360,7 +321,12 @@ const AddModal = props => {
name="Priority"
labelCol={{ span: 12 }}
>
<InputNumber min={0} max={10} defaultValue={0} disabled={hidden} />
<InputNumber
min={0}
max={10}
defaultValue={0}
disabled={pickItem.remark === '万能模板'}
/>
</Item>
</Col>
<Col span={16}>
......
......@@ -80,9 +80,14 @@ export const GetGateWay = param => get(`${PUBLISH_SERVICE}/HostManager/GetGateWa
export const UpdateGeteWay = param => get(`${PUBLISH_SERVICE}/HostManager/UpdateGeteWay`, param);
// 网关配置
// export const GetReRoutesFirst = param => get(`/OcelotSettings/GetReRoutes`, param);
export const GetWayHealthCheck = param =>
get(`/PandaCore/GateWay/OcelotSettings/HealthCheck`, param);
export const GetReRoutes = param => get(`/PandaCore/GateWay/OcelotSettings/GetReRoutes`, param);
export const SaveRoutes = param => post(`/PandaCore/GateWay/OcelotSettings/SaveRoutes`, param);
export const DelRoutes = param => get(`/PandaCore/GateWay/OcelotSettings/DelRoutes`, param);
export const DelRouteByUpUrl = param =>
get(`/PandaCore/GateWay/OcelotSettings/DelRouteByUpUrl`, param);
// 代理服务老接口
export const GetNginxConfigInfoOLD = param =>
......
......@@ -337,3 +337,5 @@ export const GetRoleGroups = param => get(`${PUBLISH_SERVICE}/UserCenter/GetRole
export const GetWebMenuInfo = param => get(`${PUBLISH_SERVICE}/WebSite/GetWebMenuInfo`, param);
export const SortScheme = param => get(`${PANDA_GIS}/MapLayer/SortScheme`, param);
export const SortSchemePost = param => post(`${PANDA_GIS}/MapLayer/SortSchemePost`, param);
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