Commit d18f2d51 authored by 涂伟's avatar 涂伟

Merge branch 'master' of https://g.civnet.cn:8443/ReactWeb5/maintenance

# Conflicts: # src/pages/bsmanager/workOrder/workflowEdit/workFlowComponents/FlowChartRt.jsx
parents 79f350de 5953834c
Pipeline #72050 passed with stages
...@@ -78,17 +78,17 @@ const FlowChart = props => { ...@@ -78,17 +78,17 @@ const FlowChart = props => {
} }
}, [treeVisible]); }, [treeVisible]);
// 监听删除,给删除数组里添加删除id // // 监听删除,给删除数组里添加删除id
useEffect(() => { // useEffect(() => {
if (deleteLine) { // if (deleteLine) {
setDeleteLines([...DeleteLines, deleteLine]); // setDeleteLines([...DeleteLines, deleteLine]);
} // }
}, [deleteLine]); // }, [deleteLine]);
useEffect(() => { // useEffect(() => {
if (deleteNode) { // if (deleteNode) {
setDeleteNodes([...DeleteNodes, deleteNode]); // setDeleteNodes([...DeleteNodes, deleteNode]);
} // }
}, [deleteNode]); // }, [deleteNode]);
// 初始化 // 初始化
useEffect(() => { useEffect(() => {
// 初始化流程图 // 初始化流程图
...@@ -96,52 +96,66 @@ const FlowChart = props => { ...@@ -96,52 +96,66 @@ const FlowChart = props => {
initPalette(); initPalette();
myOverview = objGo(go.Overview, 'myOverviewDiv', { observed: diagram }); myOverview = objGo(go.Overview, 'myOverviewDiv', { observed: diagram });
// 监听节点或线的删除事件 // 监听节点或线的删除事件
diagram.addDiagramListener('SelectionDeleted', e => { // diagram.addDiagramListener('SelectionDeleted', e => {
let delNodes = []; // let delNodes = [];
let delLinks = []; // let delLinks = [];
e.subject.each(n => { // e.subject.each(n => {
if (n.data.LineId) { // if (n.data.LineId) {
delLinks.push(n.data.LineId); // delLinks.push(n.data.LineId);
} // }
if (n.data.ActivityId) { // if (n.data.ActivityId) {
delNodes.push(n.data.ActivityId); // delNodes.push(n.data.ActivityId);
} // }
// 如果删除得节点不是新增得就给id放入到删除节点数组中 // // 如果删除得节点不是新增得就给id放入到删除节点数组中
if (n.data.NodeId && !AddNodes.some(item => item === n.data.NodeId)) { // if (n.data.NodeId && !AddNodes.some(item => item === n.data.NodeId)) {
setTimeout(() => { // setTimeout(() => {
setDeleteNode(n.data.NodeId); // setDeleteNode(n.data.NodeId);
}, 0); // }, 0);
} // }
if (n.data.LineKey) { // if (n.data.LineKey) {
setTimeout(() => { // setTimeout(() => {
setDeleteLine(n.data.LineId); // setDeleteLine(n.data.LineId);
}, 0); // }, 0);
// }
// });
// if (delNodes.length === 0) {
// return;
// }
// DeleteFlowNodes({ ActivityIds: delNodes, LineIds: delLinks }).then(res => {
// if (res.code === 0) {
// message.success('删除成功');
// } else {
// // message.error(res.msg);
// message.error({
// content: <div style={{ whiteSpace: 'pre-line', textAlign: 'justify' }}>{res.msg}</div>,
// });
// }
// });
// console.log(delNodes, delLinks, 'fffff');
// });
// 监听节点或线的删除前事件
diagram.commandHandler.canDeleteSelection = () => {
let delNodes = new Set();
let delNodeIds = new Set();
let delLinks = new Set();
diagram.selection.toArray().forEach(item => {
if (item.data.ActivityId) {
delNodes.add(item.data.ActivityId);
delNodeIds.add(item.data.NodeId);
item.findLinksConnected().each(link => {
if (link.data.LineId) {
delLinks.add(link.data.LineId);
} }
}); });
if (delNodes.length === 0) {
return;
} }
DeleteFlowNodes({ ActivityIds: delNodes, LineIds: delLinks }).then(res => { if (item.data.LineId) {
if (res.code === 0) { delLinks.add(item.data.LineId);
message.success('删除成功');
} else {
// message.error(res.msg);
message.error({
content: <div style={{ whiteSpace: 'pre-line', textAlign: 'justify' }}>{res.msg}</div>,
});
} }
}); });
console.log(delNodes, delLinks, 'fffff'); showDeleteConfirm([...delNodeIds], [...delNodes], [...delLinks]);
});
// 监听节点或线的删除前事件
diagram.commandHandler.canDeleteSelection = () =>
// 用例获取选中的节点或线
diagram.selection.all(e => {
// 判断是否存在不允许删除的节点或线
showDeleteConfirm(e.data);
return false; return false;
}); };
// 监听线,连接线的时候加上text属性 // 监听线,连接线的时候加上text属性
diagram.addDiagramListener('LinkDrawn', e => { diagram.addDiagramListener('LinkDrawn', e => {
// e.subject.data.text = ''; // e.subject.data.text = '';
...@@ -309,7 +323,7 @@ const FlowChart = props => { ...@@ -309,7 +323,7 @@ const FlowChart = props => {
}; };
}, [currentFlowData]); }, [currentFlowData]);
// 删除提醒 // 删除提醒
const showDeleteConfirm = val => { const showDeleteConfirm = (delNodeIds, delNodes, delLinks) => {
confirm({ confirm({
title: '确定要删除所选中的节点吗?', title: '确定要删除所选中的节点吗?',
icon: <ExclamationCircleOutlined />, icon: <ExclamationCircleOutlined />,
...@@ -318,29 +332,31 @@ const FlowChart = props => { ...@@ -318,29 +332,31 @@ const FlowChart = props => {
okType: 'danger', okType: 'danger',
cancelText: '否', cancelText: '否',
onOk() { onOk() {
delNode(val); delNode(delNodeIds, delNodes, delLinks);
}, },
onCancel() {}, onCancel() {},
}); });
}; };
// 删除节点 // 删除节点
const delNode = val => { const delNode = (delNodeIds, delNodes, delLinks) => {
setShowLeaveTip(true); setShowLeaveTip(true);
// leaveCallBack(true); if (delNodes.length === 0) {
diagram.commandHandler.deleteSelection(); diagram.commandHandler.deleteSelection();
// if (val.LineId) { return;
// diagram.commandHandler.deleteSelection(); }
// return; DeleteFlowNodes({ ActivityIds: delNodes, LineIds: delLinks }).then(res => {
// } if (res.code === 0) {
diagram.commandHandler.deleteSelection();
// DeleteFlowNode({ activityId: val.ActivityId }).then(res => { setDeleteNodes([...DeleteNodes, ...delNodeIds]);
// if (res.code === 0) { setDeleteLines([...DeleteLines, ...delLinks]);
// message.success('删除成功'); message.success('删除成功');
// diagram.commandHandler.deleteSelection(); } else {
// } else {
// message.error(res.msg); // message.error(res.msg);
// } message.error({
// }); content: <div style={{ whiteSpace: 'pre-line', textAlign: 'justify' }}>{res.msg}</div>,
});
}
});
}; };
const animateFadeDown = e => { const animateFadeDown = e => {
...@@ -1108,8 +1124,13 @@ const FlowChart = props => { ...@@ -1108,8 +1124,13 @@ const FlowChart = props => {
// return; // return;
// } // }
let list = new Set([]); let list = new Set([]);
let errorList = new Set();
diagramObj.nodeDataArray.forEach(item => { diagramObj.nodeDataArray.forEach(item => {
if (item.NodeType === '1' || item.NodeType === '0' || item.NodeType === '1') {
if (!item.TableName || !item.Fields) {
errorList.add(item.NodeName);
}
}
if ((item.NodeType === '20' || item.NodeType === '21') && item.RuleList) { if ((item.NodeType === '20' || item.NodeType === '21') && item.RuleList) {
item.RuleList.forEach(ele => { item.RuleList.forEach(ele => {
if (!ele.RuleName) { if (!ele.RuleName) {
...@@ -1134,6 +1155,12 @@ const FlowChart = props => { ...@@ -1134,6 +1155,12 @@ const FlowChart = props => {
} }
item.CarbonCopyPeopleList = item.CarbonCopyPeopleList.map(ele => Number(ele.value)); item.CarbonCopyPeopleList = item.CarbonCopyPeopleList.map(ele => Number(ele.value));
}); });
if ([...errorList].length > 0) {
errorList.forEach(item => {
message.error(`请检查${item}节点存在未配置项`);
});
return;
}
if ([...list].length > 0) { if ([...list].length > 0) {
list.forEach(item => { list.forEach(item => {
message.error(`请检查${item}规则配置`); message.error(`请检查${item}规则配置`);
......
...@@ -13,14 +13,14 @@ import { Modal, notification } from 'antd'; ...@@ -13,14 +13,14 @@ import { Modal, notification } from 'antd';
import Sortable from 'sortablejs'; import Sortable from 'sortablejs';
import styles from './SortModal.less'; import styles from './SortModal.less';
import DragTable from '@/components/DragTable/DragTable'; import DragTable from '@/components/DragTable/DragTable';
import { SortScheme } from '@/services/webConfig/api'; import { SortScheme, SortSchemePost } from '@/services/webConfig/api';
const SortModal = props => { const SortModal = props => {
const { callBackSubmit = () => {}, title, visible, onCancel, sortData } = props; const { callBackSubmit = () => {}, title, visible, onCancel, sortData } = props;
const [orderTable, setOrderTable] = useState([]); const [orderTable, setOrderTable] = useState([]);
const [flowIDs, setFlowIDs] = useState([]); const [flowIDs, setFlowIDs] = useState([]);
const onSumbit = () => { const onSumbit = () => {
SortScheme({ sortName: flowIDs.toString() }).then(res => { SortSchemePost({ sortNames: flowIDs }).then(res => {
if (res.code === '0') { if (res.code === '0') {
callBackSubmit(); callBackSubmit();
onCancel(); onCancel();
......
...@@ -28,8 +28,7 @@ const AddModal = props => { ...@@ -28,8 +28,7 @@ const AddModal = props => {
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
if (type === 'edit') { if (type === 'edit') {
let data = ['CityServer', 'IOT', 'CivData', 'GIS']; if (pickItem.remark) {
if (data.indexOf(pickItem.key) != -1) {
setHidden(true); setHidden(true);
} }
let aa = pickItem.methods.replace(/\s/g, ''); let aa = pickItem.methods.replace(/\s/g, '');
...@@ -80,7 +79,7 @@ const AddModal = props => { ...@@ -80,7 +79,7 @@ const AddModal = props => {
setCurrent(true); setCurrent(true);
} }
} else { } else {
form.setFieldsValue({ IsAuthentication: true }); form.setFieldsValue({ IsAuthentication: true, Priority: 1, Methods: ['GET', 'POST'] });
} }
} else { } else {
setHidden(false); setHidden(false);
...@@ -95,11 +94,8 @@ const AddModal = props => { ...@@ -95,11 +94,8 @@ const AddModal = props => {
if (validate) { if (validate) {
setLoading(true); setLoading(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
console.log(obj.IsAuthentication);
console.log(obj.Priority);
let aa = obj.Methods.toString(); let aa = obj.Methods.toString();
obj.Methods = aa.replace(/\s/g, ''); obj.Methods = aa.replace(/\s/g, '');
console.log(obj.Methods);
let data = { let data = {
UpstreamPathTemplate: obj.UpstreamPathTemplate || null, UpstreamPathTemplate: obj.UpstreamPathTemplate || null,
DownstreamPathTemplate: obj.DownstreamPathTemplate || null, DownstreamPathTemplate: obj.DownstreamPathTemplate || null,
...@@ -125,8 +121,7 @@ const AddModal = props => { ...@@ -125,8 +121,7 @@ const AddModal = props => {
ReRouteIsCaseSensitive: obj.ReRouteIsCaseSensitive || null, ReRouteIsCaseSensitive: obj.ReRouteIsCaseSensitive || null,
DownstreamHttpMethod: obj.DownstreamHttpMethod || null, DownstreamHttpMethod: obj.DownstreamHttpMethod || null,
}; };
console.log(data); let str = type === 'add' ? '新增' : '编辑';
if (type === 'add') {
SaveRoutes([ SaveRoutes([
{ {
...data, ...data,
...@@ -141,49 +136,19 @@ const AddModal = props => { ...@@ -141,49 +136,19 @@ const AddModal = props => {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '新增成功', description: res.msg || `${str}成功`,
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '新增失败', description: res.msg || `${str}失败`,
}); });
} }
}) })
.catch(err => { .catch(err => {
setLoading(false); 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);
});
}
} }
}); });
}; };
...@@ -274,7 +239,7 @@ const AddModal = props => { ...@@ -274,7 +239,7 @@ const AddModal = props => {
}, },
]} ]}
> >
<Input allowClear placeholder="示例:/{url}" disabled={hidden} /> <Input allowClear placeholder="示例:/{url}" />
</Item> </Item>
<Item <Item
label="上游请求方式" label="上游请求方式"
...@@ -286,7 +251,7 @@ const AddModal = props => { ...@@ -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>
<Item <Item
label="下游服务地址" label="下游服务地址"
...@@ -302,12 +267,8 @@ const AddModal = props => { ...@@ -302,12 +267,8 @@ const AddModal = props => {
</Item> </Item>
<Item label="身份认证" name="IsAuthentication"> <Item label="身份认证" name="IsAuthentication">
<Radio.Group> <Radio.Group>
<Radio value={true} disabled={hidden}> <Radio value={true}>开启</Radio>
开启 <Radio value={false}>关闭</Radio>
</Radio>
<Radio value={false} disabled={hidden}>
关闭
</Radio>
</Radio.Group> </Radio.Group>
</Item> </Item>
<Item <Item
...@@ -360,7 +321,12 @@ const AddModal = props => { ...@@ -360,7 +321,12 @@ const AddModal = props => {
name="Priority" name="Priority"
labelCol={{ span: 12 }} labelCol={{ span: 12 }}
> >
<InputNumber min={0} max={10} defaultValue={0} disabled={hidden} /> <InputNumber
min={0}
max={10}
defaultValue={0}
disabled={pickItem.remark === '万能模板'}
/>
</Item> </Item>
</Col> </Col>
<Col span={16}> <Col span={16}>
......
/* eslint-disable indent */
/* eslint-disable no-unused-expressions */ /* eslint-disable no-unused-expressions */
/* eslint-disable no-else-return */ /* eslint-disable no-else-return */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
...@@ -28,12 +29,15 @@ import { ...@@ -28,12 +29,15 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import styles from './gateWay.less'; import styles from './gateWay.less';
import axios from 'axios';
import { import {
GetGateWay, GetGateWay,
UpdateGeteWay, UpdateGeteWay,
GetReRoutes, GetReRoutes,
GetReRoutesFirst, GetReRoutesFirst,
DelRoutes, DelRoutes,
DelRouteByUpUrl,
GetWayHealthCheck,
} from '@/services/hostmanager/hostmanager'; } from '@/services/hostmanager/hostmanager';
import { get, PUBLISH_SERVICE } from '@/services/index'; import { get, PUBLISH_SERVICE } from '@/services/index';
import configuration from '../../../../assets/images/icons/消息.svg'; import configuration from '../../../../assets/images/icons/消息.svg';
...@@ -43,6 +47,7 @@ import CheckModal from './CheckModal'; ...@@ -43,6 +47,7 @@ import CheckModal from './CheckModal';
const GateConfig = () => { const GateConfig = () => {
const [loading, setLoading] = useState(false); // 加载 const [loading, setLoading] = useState(false); // 加载
const [allLoading, setAllLoading] = useState(false); // 加载
const [form] = Form.useForm(); const [form] = Form.useForm();
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
...@@ -63,6 +68,17 @@ const GateConfig = () => { ...@@ -63,6 +68,17 @@ const GateConfig = () => {
localStorage.setItem('panda-publish', ''); localStorage.setItem('panda-publish', '');
console.log(checked); console.log(checked);
if (checked) { if (checked) {
setAllLoading(true);
// axios({
// method: 'get',
// url: `${tableData[0].url}/PandaOMS/OMS/health/get`,
// }).then(res => {
// console.log(res);
// debugger;
// });
GetWayHealthCheck().then(resData => {
setAllLoading(false);
if (resData.code === 0) {
UpdateGeteWay({ isUsed: checked }).then(res => { UpdateGeteWay({ isUsed: checked }).then(res => {
if (res.code === 0) { if (res.code === 0) {
console.log(localStorage.getItem('token')); console.log(localStorage.getItem('token'));
...@@ -127,6 +143,20 @@ const GateConfig = () => { ...@@ -127,6 +143,20 @@ const GateConfig = () => {
} }
}); });
}, 0); }, 0);
} else {
message.warning({
content: (
<>
万能模板下游服务 [<span style={{ color: '#1890ff' }}>{tableData[0].url}</span>]
检测不通过,请修复后再开启!
</>
),
style: {
marginTop: '10vh',
},
});
}
});
} else { } else {
UpdateGeteWay({ isUsed: checked }).then(res => { UpdateGeteWay({ isUsed: checked }).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -213,46 +243,13 @@ const GateConfig = () => { ...@@ -213,46 +243,13 @@ const GateConfig = () => {
align: 'center', align: 'center',
width: 150, width: 150,
render: (text, record) => { render: (text, record) => {
if (record.key === 'CityServer') { if (record.remark) {
return ( return (
<Tooltip placement="top" title={text}> <Tooltip placement="top" title={text}>
<span> <span>
{searchStyle1(text)}{' '} {searchStyle1(text)}{' '}
<Tag color="cyan" style={{ marginRight: '0px' }}> <Tag color="cyan" style={{ marginRight: '0px' }}>
万能模板 {record.remark}
</Tag>
</span>
</Tooltip>
);
} else if (record.key === 'IOT') {
return (
<Tooltip placement="top" title={text}>
<span>
{searchStyle1(text)}{' '}
<Tag color="purple" style={{ marginRight: '0px' }}>
物联
</Tag>
</span>
</Tooltip>
);
} else if (record.key === 'CivData') {
return (
<Tooltip placement="top" title={text}>
<span>
{searchStyle1(text)}{' '}
<Tag color="green" style={{ marginRight: '0px' }}>
中台
</Tag>
</span>
</Tooltip>
);
} else if (record.key === 'GIS') {
return (
<Tooltip placement="top" title={text}>
<span>
{searchStyle1(text)}{' '}
<Tag color="volcano" style={{ marginRight: '0px' }}>
GIS
</Tag> </Tag>
</span> </span>
</Tooltip> </Tooltip>
...@@ -273,13 +270,24 @@ const GateConfig = () => { ...@@ -273,13 +270,24 @@ const GateConfig = () => {
dataIndex: 'upstreamPathTemplate', dataIndex: 'upstreamPathTemplate',
key: 'upstreamPathTemplate', key: 'upstreamPathTemplate',
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => {
let str = window.location.origin + `/PandaCore/GateWay${text}`;
let list = str.split(':');
list[0] = record.downstreamScheme;
let data = record.downstreamScheme;
list.forEach((i, j) => {
if (j > 0) {
data = data + ':' + i;
}
});
return (
<span> <span>
<Tooltip placement="top" title={`上游路由模板:${text}`}> <Tooltip placement="top" title={`上游路由模板:${text}`}>
{window.location.origin + `/PandaCore/GateWay${text}`} {data}
</Tooltip> </Tooltip>
</span> </span>
), );
},
}, },
// { // {
// title: '上游路由模板', // title: '上游路由模板',
...@@ -377,13 +385,13 @@ const GateConfig = () => { ...@@ -377,13 +385,13 @@ const GateConfig = () => {
align: 'center', align: 'center',
fixed: 'right', fixed: 'right',
render: record => { render: record => {
if (record.key != 'CityServer') { // if (record.key != 'CityServer') {
return ( return (
<Space size="middle"> <Space size="middle">
<Tooltip title="编辑"> <Tooltip title="编辑">
<EditTwoTone onClick={() => edit(record)} style={{ fontSize: '16px' }} /> <EditTwoTone onClick={() => edit(record)} style={{ fontSize: '16px' }} />
</Tooltip> </Tooltip>
{record.key != 'IOT' && record.key != 'CivData' && record.key != 'GIS' && ( {!record.remark && (
<Tooltip title="删除"> <Tooltip title="删除">
<Popconfirm <Popconfirm
placement="bottomRight" placement="bottomRight"
...@@ -403,15 +411,15 @@ const GateConfig = () => { ...@@ -403,15 +411,15 @@ const GateConfig = () => {
)} )}
</Space> </Space>
); );
} else { // } else {
return ( // return (
<Space size="middle"> // <Space size="middle">
<Tooltip title="查看"> // <Tooltip title="查看">
<SearchOutlined onClick={() => look(record)} style={{ fontSize: '16px' }} /> // <SearchOutlined onClick={() => look(record)} style={{ fontSize: '16px' }} />
</Tooltip> // </Tooltip>
</Space> // </Space>
); // );
} // }
}, },
}, },
]; ];
...@@ -508,8 +516,8 @@ const GateConfig = () => { ...@@ -508,8 +516,8 @@ const GateConfig = () => {
description: '默认数据无法删除', description: '默认数据无法删除',
}); });
} else { } else {
DelRoutes({ DelRouteByUpUrl({
Ids: e.id, upTemplate: e.upstreamPathTemplate,
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
GetReRoutes({ GetReRoutes({
...@@ -549,6 +557,7 @@ const GateConfig = () => { ...@@ -549,6 +557,7 @@ const GateConfig = () => {
return ( return (
<div className={styles.gateWay_container}> <div className={styles.gateWay_container}>
<Spin spinning={allLoading} tip="loading">
<Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}> <Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}>
<div style={{ display: 'flex', alignItems: 'center', marginTop: '10px' }}> <div style={{ display: 'flex', alignItems: 'center', marginTop: '10px' }}>
<img src={configuration} style={{ height: '16px' }} alt="" /> <img src={configuration} style={{ height: '16px' }} alt="" />
...@@ -633,13 +642,12 @@ const GateConfig = () => { ...@@ -633,13 +642,12 @@ const GateConfig = () => {
scroll={{ y: 'calc(100vh - 380px)', x: 'max-content' }} scroll={{ y: 'calc(100vh - 380px)', x: 'max-content' }}
onRow={record => ({ onRow={record => ({
onDoubleClick: event => { onDoubleClick: event => {
console.log(record);
event.stopPropagation(); event.stopPropagation();
if (record.key == 'CityServer') { // if (record.key == 'CityServer') {
look(record); // look(record);
} else { // } else {
edit(record); edit(record);
} // }
}, // 双击 }, // 双击
})} })}
pagination={{ pagination={{
...@@ -667,6 +675,7 @@ const GateConfig = () => { ...@@ -667,6 +675,7 @@ const GateConfig = () => {
onCancel={() => setCheckVisible(false)} onCancel={() => setCheckVisible(false)}
/> />
</Card> </Card>
</Spin>
</div> </div>
); );
}; };
......
...@@ -42,13 +42,17 @@ const HomeConfigModal = props => { ...@@ -42,13 +42,17 @@ const HomeConfigModal = props => {
let obj = { homePage: form.getFieldsValue().homePage, productType: '' }; let obj = { homePage: form.getFieldsValue().homePage, productType: '' };
let arrUrl = obj.homePage.split('/'); // 用const声明常量 let arrUrl = obj.homePage.split('/'); // 用const声明常量
const product = allProductList.find(item => item.PackageName.includes(arrUrl[0])); let allProList = JSON.parse(JSON.stringify(allProductList));
allProList.push({ PackageName: 'civ_base' });
const product = allProList.find(item => item.PackageName.includes(arrUrl[0]));
if (!product) { if (!product) {
// arrUrl.shift(); // arrUrl.shift();
obj.homePage = `civweb4/${obj.homePage}`; obj.homePage = `civweb4/${obj.homePage}`;
} }
obj.productType = product?.PackageName || 'civweb4'; obj.productType = product?.PackageName || 'civweb4';
if (!productList.some(item => item.PackageName === obj.productType)) { let proList = JSON.parse(JSON.stringify(productList));
proList.push({ PackageName: 'civ_base' });
if (!proList.some(item => item.PackageName === obj.productType)) {
message.error(`${obj.productType}未授权,不能使用该功能当主页`); message.error(`${obj.productType}未授权,不能使用该功能当主页`);
return; return;
} }
......
...@@ -272,15 +272,18 @@ export default props => { ...@@ -272,15 +272,18 @@ export default props => {
console.log(validate); console.log(validate);
if (validate.homePage) { if (validate.homePage) {
let arr = validate.homePage.split('/'); // 用const声明常量 let arr = validate.homePage.split('/'); // 用const声明常量
let allProList = JSON.parse(JSON.stringify(allProductList));
const product = allProductList.find(item => item.PackageName.includes(arr[0])); allProList.push({ PackageName: 'civ_base' });
const product = allProList.find(item => item.PackageName.includes(arr[0]));
if (product) { if (product) {
arr.shift(); arr.shift();
validate.homePage = arr.join('/'); validate.homePage = arr.join('/');
} }
console.log(product, 'product'); console.log(product, 'product');
validate.productType = product?.PackageName || 'civweb4'; validate.productType = product?.PackageName || 'civweb4';
if (!productList.some(item => item.PackageName === validate.productType)) { let proList = JSON.parse(JSON.stringify(productList));
proList.push({ PackageName: 'civ_base' });
if (!proList.some(item => item.PackageName === validate.productType)) {
message.error(`${validate.productType}未授权,不能使用该功能当主页`); message.error(`${validate.productType}未授权,不能使用该功能当主页`);
return; return;
} }
......
import React, { useState } from 'react'; import React, { useState } from 'react';
import { getConfigContent } from '@/services/webConfig/api';
import { Form, Input, Button, Select, Radio, message } from 'antd'; import { Form, Input, Button, Select, Radio, message } from 'antd';
import styles from './addForm.less'; import styles from './addForm.less';
import PicturesWall from '@/components/Upload/index'; import PicturesWall from '@/components/Upload/index';
...@@ -20,6 +21,7 @@ const AddForm = props => { ...@@ -20,6 +21,7 @@ const AddForm = props => {
const [curretnMenu, setCurrentMenu] = useState({}); // 当前选中菜单数据 const [curretnMenu, setCurrentMenu] = useState({}); // 当前选中菜单数据
const [form] = Form.useForm(); const [form] = Form.useForm();
const [otherForm] = Form.useForm(); const [otherForm] = Form.useForm();
const [configContent, setConfigContent] = useState(''); // 配置文件内容
const layout = { const layout = {
layout: 'horizontal', layout: 'horizontal',
labelCol: { span: 4, offset: 1 }, labelCol: { span: 4, offset: 1 },
...@@ -29,19 +31,31 @@ const AddForm = props => { ...@@ -29,19 +31,31 @@ const AddForm = props => {
if (addType === 1) { if (addType === 1) {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
let arr = obj.pageUrl.split('/'); // 用const声明常量 let arr = obj.pageUrl.split('/'); // 用const声明常量
const product = allProductList.find(item => item.PackageName.includes(arr[0])); if (!arr[0]) {
arr.shift();
}
let allProList = JSON.parse(JSON.stringify(allProductList));
allProList.push({ PackageName: 'civ_base' });
const product = allProList.find(item => item.PackageName.includes(arr[0]));
if (product) { if (product) {
if (arr.length > 1) {
arr.shift(); arr.shift();
}
obj.pageUrl = arr.join('/'); obj.pageUrl = arr.join('/');
} }
console.log(product, 'product'); console.log(product, 'product');
obj.product = product?.PackageName || 'civweb4'; obj.product = product?.PackageName || 'civweb4';
if (!productList.some(item => item.PackageName === obj.product)) { let proList = JSON.parse(JSON.stringify(productList));
proList.push({ PackageName: 'civ_base' });
if (!proList.some(item => item.PackageName === obj.product)) {
message.error(`${obj.product}未授权,不能使用该功能`); message.error(`${obj.product}未授权,不能使用该功能`);
return; return;
} }
obj.codeParam = JSON.stringify(curretnMenu.param); obj.codeParam = JSON.stringify(curretnMenu.param);
obj.code = curretnMenu.code; obj.code = curretnMenu.code;
obj.configContent = configContent;
console.log(obj, 'obj');
submitCallback(obj, nodeObj); submitCallback(obj, nodeObj);
} }
if (addType === 2) { if (addType === 2) {
...@@ -62,7 +76,24 @@ const AddForm = props => { ...@@ -62,7 +76,24 @@ const AddForm = props => {
menuName: val?.function, menuName: val?.function,
shortName: val?.shortName, shortName: val?.shortName,
imageUrl: val?.icon, imageUrl: val?.icon,
config: val?.configName, configName: val?.configName,
});
setConfigContent(val.configContent);
};
const wrapperFinish = val => {
setConfigContent(val);
};
// 选择配置文件获取到配置文件内容
const selectConfig = val => {
console.log(val);
getConfigContent(val)
.then(res => {
if (res.code === 0) {
setConfigContent(res.data);
}
})
.catch(e => {
console.error(e);
}); });
}; };
return ( return (
...@@ -133,11 +164,12 @@ const AddForm = props => { ...@@ -133,11 +164,12 @@ const AddForm = props => {
{/* <Input placeholder="请输入功能路径" /> */} {/* <Input placeholder="请输入功能路径" /> */}
<TreeSelect menuChange={val => menuChange(val)} /> <TreeSelect menuChange={val => menuChange(val)} />
</Item> </Item>
<Item label="配置文件" name="config"> <Item label="配置文件" name="configName">
<EditeConfigWrapper> <EditeConfigWrapper onFinish={wrapperFinish} configContent={configContent}>
<Select <Select
allowClear allowClear
showSearch showSearch
onSelect={selectConfig}
filterOption={(input, option) => filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
} }
......
import React, { useState, useRef, useContext, useEffect } from 'react'; import React, { useState, useRef, useContext, useEffect } from 'react';
import { Modal, Form, Table, Input, Button, message } from 'antd'; import { Modal, Form, Table, Input, Button, message, Select } from 'antd';
import { DeleteOutlined } from '@ant-design/icons'; import { DeleteOutlined } from '@ant-design/icons';
import styles from './ParmarsModal.less'; import styles from './ParmarsModal.less';
const EditableContext = React.createContext(null); const EditableContext = React.createContext(null);
...@@ -67,6 +67,37 @@ const EditableCell = ({ ...@@ -67,6 +67,37 @@ const EditableCell = ({
}, },
]; ];
let rules = dataIndex === 'field' ? keyNameRule : []; let rules = dataIndex === 'field' ? keyNameRule : [];
const rendeFrom = () => {
if (dataIndex === 'defaultValue' && record.type === '选择型') {
let options = record.valueDesc
.split(';')
.map(item => ({ label: item.split(':')[1], value: item.split(':')[0] }));
return (
<Select
// showSearch
placeholder="选择值"
optionFilterProp="children"
optionLabelProp="value"
// filterOption={(input, option) =>
// (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
// }
options={options}
ref={inputRef}
onPressEnter={save}
onBlur={save}
/>
);
}
return (
<Input
readOnly={record.releaseDate && dataIndex !== 'defaultValue'}
ref={inputRef}
onPressEnter={save}
onBlur={save}
/>
);
};
if (editable) { if (editable) {
childNode = editing ? ( childNode = editing ? (
<Form.Item <Form.Item
...@@ -76,12 +107,7 @@ const EditableCell = ({ ...@@ -76,12 +107,7 @@ const EditableCell = ({
name={dataIndex} name={dataIndex}
rules={rules} rules={rules}
> >
<Input {rendeFrom()}
readOnly={record.name && dataIndex !== 'defaultValue'}
ref={inputRef}
onPressEnter={save}
onBlur={save}
/>
</Form.Item> </Form.Item>
) : ( ) : (
<div className="editable-cell-value-wrap" onClick={toggleEdit}> <div className="editable-cell-value-wrap" onClick={toggleEdit}>
...@@ -173,7 +199,7 @@ const ParmarsModal = props => { ...@@ -173,7 +199,7 @@ const ParmarsModal = props => {
field: item.field, field: item.field,
defaultValue: item.defaultValue, defaultValue: item.defaultValue,
paramDesc: item.paramDesc, paramDesc: item.paramDesc,
valueDesc: item.valueDesc, name: item.name,
})); }));
if (parma) { if (parma) {
parmarCallBack(`${pageUrl.split('|')[0]}|${parma}`, parmas); parmarCallBack(`${pageUrl.split('|')[0]}|${parma}`, parmas);
...@@ -195,30 +221,32 @@ const ParmarsModal = props => { ...@@ -195,30 +221,32 @@ const ParmarsModal = props => {
width: 50, width: 50,
render: (text, record, index) => <span>{index + 1}</span>, render: (text, record, index) => <span>{index + 1}</span>,
}, },
{
title: '配置项',
dataIndex: 'name',
width: 250,
editable: true,
},
{ {
title: '参数名', title: '参数名',
dataIndex: 'field', dataIndex: 'field',
width: 150, width: 150,
editable: true, editable: true,
}, },
{ {
title: '参数值', title: '参数值',
dataIndex: 'defaultValue', dataIndex: 'defaultValue',
width: 150, width: 150,
editable: true, editable: true,
}, },
{ {
title: '参数名描述', title: '参数配置说明',
dataIndex: 'paramDesc', dataIndex: 'paramDesc',
width: 250, width: 250,
editable: true, editable: true,
}, },
{
title: '参数值描述',
dataIndex: 'valueDesc',
width: 250,
editable: true,
},
{ {
title: '操作', title: '操作',
...@@ -246,7 +274,7 @@ const ParmarsModal = props => { ...@@ -246,7 +274,7 @@ const ParmarsModal = props => {
field: '', field: '',
defaultValue: '', defaultValue: '',
paramDesc: '', paramDesc: '',
valueDesc: '', name: '',
}; };
console.log(newData, 'newData'); console.log(newData, 'newData');
setDataSource([...dataSource, newData]); setDataSource([...dataSource, newData]);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
// width: 180px; // width: 180px;
padding: 0 5px; padding: 0 5px;
background-color: #ff4d4f; background-color: #ff4d4f;
top: 40px; top: -45px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
border-radius: 5px; border-radius: 5px;
......
...@@ -2,7 +2,7 @@ import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'rea ...@@ -2,7 +2,7 @@ import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'rea
import { GetWebMenuInfo } from '@/services/webConfig/api'; import { GetWebMenuInfo } from '@/services/webConfig/api';
import { message, Input, Tree, Empty, Tooltip } from 'antd'; import { message, Input, Tree, Empty, Tooltip } from 'antd';
import lodash from 'lodash'; import lodash from 'lodash';
import { FolderFilled, FileOutlined, InfoCircleOutlined } from '@ant-design/icons'; import { FolderFilled, FileOutlined, InfoCircleOutlined, HomeOutlined } from '@ant-design/icons';
import styles from './TreeSelect.less'; import styles from './TreeSelect.less';
const TreeSelect = (props, ref) => { const TreeSelect = (props, ref) => {
const { value, onChange, menuChange, code, initCurrentMenu } = props; const { value, onChange, menuChange, code, initCurrentMenu } = props;
...@@ -25,7 +25,7 @@ const TreeSelect = (props, ref) => { ...@@ -25,7 +25,7 @@ const TreeSelect = (props, ref) => {
setTreeList(tree); setTreeList(tree);
setMenuWebList( setMenuWebList(
res.data.map(item => { res.data.map(item => {
let obj = { ...item, path: `${item.packName}/${item.path}` }; let obj = { ...item, path: `${item.path}` };
if (item.code === code) { if (item.code === code) {
setCurrentMenuParmar(obj); setCurrentMenuParmar(obj);
initCurrentMenu(obj); initCurrentMenu(obj);
...@@ -97,7 +97,7 @@ const TreeSelect = (props, ref) => { ...@@ -97,7 +97,7 @@ const TreeSelect = (props, ref) => {
</Tooltip> </Tooltip>
</div> </div>
), ),
icon: <FileOutlined />, icon: item.isHomePage ? <HomeOutlined /> : <FileOutlined />,
})), })),
})), })),
}); });
......
...@@ -7,7 +7,7 @@ import 'ace-builds/src-noconflict/mode-json'; ...@@ -7,7 +7,7 @@ import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/theme-solarized_light'; import 'ace-builds/src-noconflict/theme-solarized_light';
const ConfigWrapper = props => { const ConfigWrapper = props => {
const { value, children, onChange, id, ...rest } = props; const { value, children, onChange, id, onFinish, configContent, ...rest } = props;
const [text, setText] = useState(''); const [text, setText] = useState('');
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
...@@ -19,15 +19,16 @@ const ConfigWrapper = props => { ...@@ -19,15 +19,16 @@ const ConfigWrapper = props => {
}); });
return; return;
} }
getConfigContent(value) setText(configContent);
.then(res => { // getConfigContent(value)
if (res.code === 0) { // .then(res => {
setText(res.data); // if (res.code === 0) {
} // setText(res.data);
}) // }
.catch(e => { // })
console.error(e); // .catch(e => {
}); // console.error(e);
// });
setVisible(true); setVisible(true);
}; };
...@@ -44,20 +45,22 @@ const ConfigWrapper = props => { ...@@ -44,20 +45,22 @@ const ConfigWrapper = props => {
err = true; err = true;
} }
if (!err) { if (!err) {
saveConfigContent(value, JSON.stringify(JSON.parse(text), null, 4), id) // saveConfigContent(value, JSON.stringify(JSON.parse(text), null, 4), id)
.then(res => { // .then(res => {
if (res.code === 0) { // if (res.code === 0) {
notification.success({ // notification.success({
message: '保存成功', // message: '保存成功',
duration: 3, // duration: 3,
}); // });
// setVisible(false);
// }
// })
// .catch(error => {
// console.error(error);
// });
onFinish(JSON.stringify(JSON.parse(text), null, 4));
setVisible(false); setVisible(false);
} }
})
.catch(error => {
console.error(error);
});
}
}; };
const handleChange = v => { const handleChange = v => {
......
...@@ -22,7 +22,8 @@ import { ...@@ -22,7 +22,8 @@ import {
FolderFilled, FolderFilled,
FileOutlined, FileOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { GetWebMenuInfo } from '@/services/webConfig/api'; import { GetWebMenuInfo, getConfigContent } from '@/services/webConfig/api';
import classnames from 'classnames'; import classnames from 'classnames';
import styles from './addForm.less'; import styles from './addForm.less';
import PicturesWall from '@/components/Upload/index'; import PicturesWall from '@/components/Upload/index';
...@@ -59,6 +60,7 @@ const EditForm = props => { ...@@ -59,6 +60,7 @@ const EditForm = props => {
const [menuParmar, setMenuParmar] = useState([]); const [menuParmar, setMenuParmar] = useState([]);
const [codeParmar, setCodeParmar] = useState([]); const [codeParmar, setCodeParmar] = useState([]);
const [curretnMenu, setCurrentMenu] = useState({}); // 当前选中菜单数据 const [curretnMenu, setCurrentMenu] = useState({}); // 当前选中菜单数据
const [configContent, setConfigContent] = useState(''); // 配置文件内容
const treeSelectRef = useRef(); const treeSelectRef = useRef();
const layout = { const layout = {
layout: 'horizontal', layout: 'horizontal',
...@@ -74,6 +76,7 @@ const EditForm = props => { ...@@ -74,6 +76,7 @@ const EditForm = props => {
setMenuParmar([]); setMenuParmar([]);
} }
setCodeParmar(infoAll.codeParam ? JSON.parse(infoAll.codeParam) : []); setCodeParmar(infoAll.codeParam ? JSON.parse(infoAll.codeParam) : []);
setConfigContent(infoAll.configContent);
setCurrentMenu({}); setCurrentMenu({});
form.resetFields(); form.resetFields();
otherForm.resetFields(); otherForm.resetFields();
...@@ -150,22 +153,31 @@ const EditForm = props => { ...@@ -150,22 +153,31 @@ const EditForm = props => {
} }
let arr = obj.pageUrl.split('/'); // 用const声明常量 let arr = obj.pageUrl.split('/'); // 用const声明常量
if (!arr[0]) {
const product = allProductList.find(item => item.PackageName.includes(arr[0])); arr.shift();
}
let allProList = JSON.parse(JSON.stringify(allProductList));
allProList.push({ PackageName: 'civ_base' });
const product = allProList.find(item => item.PackageName.includes(arr[0]));
console.log(product, 'product');
if (product) { if (product) {
arr.shift(); arr.shift();
obj.pageUrl = arr.join('/'); obj.pageUrl = arr.join('/');
} }
obj.product = product?.PackageName || 'civweb4'; obj.product = product?.PackageName || 'civweb4';
if (!productList.some(item => item.PackageName === obj.product)) { console.log(productList, 'productList');
let proList = JSON.parse(JSON.stringify(productList));
proList.push({ PackageName: 'civ_base' });
if (!proList.some(item => item.PackageName === obj.product)) {
message.error(`${obj.product}未授权,不能使用该功能`); message.error(`${obj.product}未授权,不能使用该功能`);
return; return;
} }
} }
obj.codeParam = JSON.stringify(curretnMenu.param); obj.codeParam = JSON.stringify(curretnMenu.param);
obj.code = curretnMenu.code; obj.code = curretnMenu.code;
obj.configContent = configContent;
submitCallback(obj); submitCallback(obj);
}; };
...@@ -332,14 +344,30 @@ const EditForm = props => { ...@@ -332,14 +344,30 @@ const EditForm = props => {
menuName: val?.function, menuName: val?.function,
shortName: val?.shortName, shortName: val?.shortName,
imageUrl: val?.icon, imageUrl: val?.icon,
config: val?.configName, configName: val?.configName,
pageUrl: val?.pageUrl, pageUrl: val?.pageUrl,
}); });
setConfigContent(val.configContent);
setCurrentMenu(val); setCurrentMenu(val);
setMenuParmar(val?.param); setMenuParmar(val?.param);
}; };
// 编辑完配置文件后回调
console.log(curretnMenu?.param, 'curretnMenu.param'); const wrapperFinish = val => {
setConfigContent(val);
};
// 选择配置文件获取到配置文件内容
const selectConfig = val => {
console.log(val);
getConfigContent(val)
.then(res => {
if (res.code === 0) {
setConfigContent(res.data);
}
})
.catch(e => {
console.error(e);
});
};
return ( return (
<div style={{ marginTop: '10px' }}> <div style={{ marginTop: '10px' }}>
{nodeType === 1 && ( {nodeType === 1 && (
...@@ -426,11 +454,16 @@ const EditForm = props => { ...@@ -426,11 +454,16 @@ const EditForm = props => {
<Button onClick={addParama}>参数管理</Button> <Button onClick={addParama}>参数管理</Button>
</div> </div>
</Item> </Item>
<Item label="配置文件" name="config" style={{ marginLeft: '11px' }}> <Item label="配置文件" name="configName" style={{ marginLeft: '11px' }}>
<EditeConfigWrapper id={infoAll.menuID}> <EditeConfigWrapper
id={infoAll.menuID}
configContent={configContent}
onFinish={wrapperFinish}
>
<Select <Select
allowClear allowClear
showSearch showSearch
onSelect={selectConfig}
filterOption={(input, option) => filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
} }
......
...@@ -80,9 +80,14 @@ export const GetGateWay = param => get(`${PUBLISH_SERVICE}/HostManager/GetGateWa ...@@ -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 UpdateGeteWay = param => get(`${PUBLISH_SERVICE}/HostManager/UpdateGeteWay`, param);
// 网关配置 // 网关配置
// export const GetReRoutesFirst = param => get(`/OcelotSettings/GetReRoutes`, 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 GetReRoutes = param => get(`/PandaCore/GateWay/OcelotSettings/GetReRoutes`, param);
export const SaveRoutes = param => post(`/PandaCore/GateWay/OcelotSettings/SaveRoutes`, param); export const SaveRoutes = param => post(`/PandaCore/GateWay/OcelotSettings/SaveRoutes`, param);
export const DelRoutes = param => get(`/PandaCore/GateWay/OcelotSettings/DelRoutes`, 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 => export const GetNginxConfigInfoOLD = param =>
......
...@@ -337,3 +337,5 @@ export const GetRoleGroups = param => get(`${PUBLISH_SERVICE}/UserCenter/GetRole ...@@ -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 GetWebMenuInfo = param => get(`${PUBLISH_SERVICE}/WebSite/GetWebMenuInfo`, param);
export const SortScheme = param => get(`${PANDA_GIS}/MapLayer/SortScheme`, 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