Commit 9658e275 authored by 邓超's avatar 邓超

fix: 添加发送消息测试功能,修改网关配置开关功能

parent ecad602f
Pipeline #39323 skipped with stages
......@@ -29,9 +29,7 @@ const Fieldselection = props => {
useEffect(() => {
if (visible) {
setCheckList(fieldList);
let newArr = filedData.map(item => {
return { name: item };
});
let newArr = filedData.map(item => ({ name: item }));
setSelectList(newArr);
} else {
setSelectList([]);
......
import React, { useEffect, useState } from 'react'
import { Card, Form, Switch, message, Divider, Row, Col, Spin } from 'antd'
import styles from './gateWay.less'
import { GetGateWay, UpdateGeteWay } from '@/services/platform/hostmanager'
import configuration from '../../../../assets/images/icons/消息.svg'
import React, { useEffect, useState } from 'react';
import { Card, Form, Switch, message, Divider, Row, Col, Spin } from 'antd';
import styles from './gateWay.less';
import { GetGateWay, UpdateGeteWay } from '@/services/platform/hostmanager';
import configuration from '../../../../assets/images/icons/消息.svg';
const GateConfig = () => {
const [loading, setLoading] = useState(false); // 加载
const [form] = Form.useForm();
const [flag, setFlag] = useState(1)
const [currentConfig, setCurrentConfig] = useState()
const [flag, setFlag] = useState(1);
const [currentConfig, setCurrentConfig] = useState();
const OperateNginx = (checked) => {
console.log(checked)
UpdateGeteWay({isUsed: checked}).then(res=>{
if(res.code === 0){
setFlag(flag + 1)
message.success("设置成功")
}else{
message.error("设置失败")
const OperateNginx = checked => {
console.log(checked);
UpdateGeteWay({ isUsed: checked }).then(res => {
if (res.code === 0) {
setFlag(flag + 1);
message.success('设置成功');
} else {
message.error('设置失败');
}
})
});
};
useEffect(() => {
if (currentConfig) {
localStorage.setItem('panda-publish', 'getway');
} else {
localStorage.setItem('panda-publish', '');
}
}, [currentConfig]);
useEffect(() => {
GetGateWay().then(res=>{
if(res.code === 0){
setCurrentConfig(res.data)
console.log(res.data)
console.log(currentConfig)
GetGateWay().then(res => {
if (res.code === 0) {
setCurrentConfig(res.data);
console.log(res.data);
console.log(currentConfig);
}
})
}, [flag])
});
}, [flag]);
return (
<div className={styles.gateWay_container}>
<Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}>
<Spin spinning={loading} tip="loading">
<div style={{ display: 'flex', alignItems: 'center', marginTop: '40px' }}>
<img src={configuration} style={{ height: '16px' }} /><span style={{ marginLeft: '10px', fontWeight: 'bold' }}>服务管理</span>
<div
style={{ display: 'flex', alignItems: 'center', marginTop: '40px' }}
>
<img src={configuration} style={{ height: '16px' }} alt="" />
<span style={{ marginLeft: '10px', fontWeight: 'bold' }}>
服务管理
</span>
</div>
<Divider />
<div className={styles.operate_container}>
<Row gutter={[20, 25]} style={{display:'flex', alignItems:'center'}}>
<Row
gutter={[20, 25]}
style={{ display: 'flex', alignItems: 'center' }}
>
<Col span={2}>
<div style={{display:'flex', justifyContent:'flex-end', marginRight:'-10px'}}>服务运行</div>
<div
style={{
display: 'flex',
justifyContent: 'flex-end',
marginRight: '-10px',
}}
>
服务运行
</div>
</Col>
<Col span={22}>
{console.log(currentConfig)}
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={currentConfig} onChange={OperateNginx} style={{marginLeft:'30px'}}/>
<Switch
checkedChildren="开启"
unCheckedChildren="关闭"
checked={currentConfig}
onChange={OperateNginx}
style={{ marginLeft: '30px' }}
/>
</Col>
</Row>
</div>
</Spin>
</Card>
</div>
)
}
);
};
export default GateConfig;
import React, { useState, useEffect } from 'react';
import { Tabs } from 'antd';
import PageContainer from '@/components/BasePageContainer';
import BaseConfig from './baseConfig/BaseConfig'
import IotConfig from './IotConfig/IotConfig'
import MessageConfig from './messageConfig/messageConfig'
import ProxyConfig from './proxyConfig/ProxyConfig'
import GateConfig from './gateWay/gateWay'
import BaseConfig from './baseConfig/BaseConfig';
import IotConfig from './IotConfig/IotConfig';
import MessageConfig from './messageConfig/messageConfig';
import ProxyConfig from './proxyConfig/ProxyConfig';
import GateConfig from './gateWay/gateWay';
const { TabPane } = Tabs;
const HostManager = () => {
const callback = () => {
}
const callback = () => {};
return (
<PageContainer>
<Tabs onChange={callback} type="card">
<TabPane tab="基础配置" key="1">
<BaseConfig/>
<BaseConfig />
</TabPane>
<TabPane tab="物联配置" key="2">
<IotConfig/>
<IotConfig />
</TabPane>
<TabPane tab="消息配置" key="3">
<MessageConfig/>
<MessageConfig />
</TabPane>
<TabPane tab="代理配置" key="4">
<ProxyConfig/>
<ProxyConfig />
</TabPane>
<TabPane tab="网关配置" key="5">
<GateConfig/>
<GateConfig />
</TabPane>
</Tabs>
</PageContainer>
)
}
);
};
export default HostManager;
import React, { useState, useEffect } from 'react';
import { Tabs } from 'antd';
import PageContainer from '@/components/BasePageContainer';
import TemplateManage from '../messageManage/templateManage/TemplateManage'
import ProjectManage from '../messageManage/projectManage/ProjectManage'
import TemplateManage from './templateManage/TemplateManage';
import ProjectManage from './projectManage/ProjectManage';
const { TabPane } = Tabs;
const HostManager = () => {
const callback = () => {
}
const callback = () => {};
return (
<PageContainer>
<Tabs onChange={callback} type="card">
<TabPane tab="推送方案配置" key="2">
<ProjectManage/>
<ProjectManage />
</TabPane>
<TabPane tab="推送模板配置" key="1">
<TemplateManage/>
<TemplateManage />
</TabPane>
</Tabs>
</PageContainer>
)
}
);
};
export default HostManager;
......@@ -24,6 +24,7 @@ import {
} from '@ant-design/icons';
import { useHistory } from 'react-router-dom';
import EditModal from './components/EditModal';
import PushTest from './components/PushTest/PushTest';
import VisibleRoleModal from './components/RolseSelect/VisibleRoleModal';
import {
GetMessageConfigList,
......@@ -42,6 +43,7 @@ const ProjectManage = () => {
delVisible: false, // 删除弹窗
editVisible: false, // 修改弹窗
spinLoading: false, // 加载弹窗
pushTestVisible: false, // 推送测试弹窗
btnLoading: false,
loading: false,
checkBoxLoading: false,
......@@ -57,6 +59,7 @@ const ProjectManage = () => {
const [treeLoading, setTreeLoading] = useState(false);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [value, setValue] = useState('');
const [pushTestMsg, setPushTestMsg] = useState('');
const columns = [
{
title: '方案名称',
......@@ -181,20 +184,8 @@ const ProjectManage = () => {
// handleShowModal("editVisible", true)
};
const TestDesc = record => {
if (record.ThemeName)
TestPush({
theme: record.ThemeName,
msgType: record.MsgType,
tousers: record.PushGroup,
pushPath: record.item.AgentConfig ? record.item.AgentConfig.Url : '',
msgTypeId: record.ID,
}).then(res => {
if (res.code === 0) {
message.success('测试推送成功');
} else {
message.error(res.msg);
}
});
setPushTestMsg(record);
handleShowModal('pushTestVisible', true);
};
const DeleteProject = record => {
let agen = record.item.AgentConfig;
......@@ -246,6 +237,10 @@ const ProjectManage = () => {
handleShowModal('addVisbile', false);
setFlag(flag + 1);
};
const pushTestModal = () => {
handleShowModal('pushTestVisible', false);
setFlag(flag + 1);
};
const onAddClick = () => {
setCurrentTempalte({});
// handleShowModal("addVisible", true)
......@@ -412,6 +407,12 @@ const ProjectManage = () => {
onCancel={() => handleShowModal('addVisible', false)}
confirmModal={bddModal}
/>
<PushTest
visible={visibleParams.pushTestVisible}
onCancel={() => handleShowModal('pushTestVisible', false)}
confirmModal={pushTestModal}
pushTestMsg={pushTestMsg}
/>
</Spin>
</div>
);
......
import React, { useState, useEffect } from 'react';
import { Checkbox } from 'antd';
import styles from './PushTest.less';
const CheckboxGroup = Checkbox.Group;
const CardCheck = props => {
const { cardMsg, cardIndex, callback } = props;
const [checkedList, setCheckedList] = useState();
const [indeterminate, setIndeterminate] = useState(false);
const [checkAll, setCheckAll] = useState(false);
const [plainOptions, setPlainOptions] = useState([]);
useEffect(() => {
setPlainOptions(cardMsg.plainOptions);
}, []);
useEffect(() => {
callback(checkedList, cardIndex);
}, [checkedList]);
const onChange = list => {
console.log(list);
setCheckedList(list);
setIndeterminate(!!list.length && list.length < plainOptions.length);
setCheckAll(list.length === plainOptions.length);
};
const onCheckAllChange = e => {
setCheckedList(
e.target.checked ? plainOptions.map(item => item.value) : [],
);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
return (
<div className={styles.divBox}>
<div className={styles.topCheckbox}>
<Checkbox
indeterminate={indeterminate}
onChange={e => onCheckAllChange(e)}
checked={checkAll}
>
{cardMsg.groupName}
</Checkbox>
</div>
<div className={styles.bottomCheckbox} style={{ marginTop: '10px' }}>
<CheckboxGroup
options={plainOptions}
value={checkedList}
onChange={list => onChange(list)}
/>
</div>
</div>
);
};
export default CardCheck;
import React, { useState, useEffect, useCallback } from 'react';
import { Modal, Form, Input, Button, message, Spin, Pagination } from 'antd';
import { GetGroupUserTree, TestPush } from '@/services/platform/messagemanage';
import styles from './PushTest.less';
import CardCheck from './CardCheck';
let checkList = [];
console.log(checkList, 'checkList');
const PushTest = props => {
const [form] = Form.useForm();
const { confirmModal, onCancel, visible, pushTestMsg } = props;
const [allList, setAllist] = useState([]);
const [loading, setLoading] = useState(false);
useEffect(() => {
if (visible) {
getData();
} else {
checkList = [];
setAllist([]);
}
}, [visible]);
const checkCallBack = useCallback((val, index) => {
if (val) {
checkList[index].checkedList = val;
}
});
const onFinish = () => {
let newArr = checkList.reduce(
(total, currentValue) => [...total, ...currentValue.checkedList],
[],
);
if (pushTestMsg.ThemeName)
TestPush({
theme: pushTestMsg.ThemeName,
msgType: pushTestMsg.MsgType,
tousers: newArr,
pushPath: pushTestMsg.item.AgentConfig
? pushTestMsg.item.AgentConfig.Url
: '',
msgTypeId: pushTestMsg.ID.toString(),
}).then(res => {
if (res.code === 0) {
confirmModal();
message.success('测试推送成功');
} else {
message.error(res.msg);
}
});
console.log(newArr, 'newArr');
};
const onSearch = () => {
getData({ key: form.getFieldsValue().username });
};
const getData = value => {
let obj = value ? value : {};
setLoading(true);
GetGroupUserTree(obj).then(res => {
console.log(res);
let list = res.data.map(item => {
let options = item.users.map(val => ({
label: val.userName,
value: val.userId,
}));
return {
groupName: item.groupName,
groupId: item.groupId,
indeterminate: false,
checkAll: false,
plainOptions: options,
checkedList: [],
};
});
checkList = list;
setAllist(list);
setTimeout(() => {
setLoading(false);
}, 0);
});
};
return (
<>
<Modal
title="选择推送人"
visible={visible}
onOk={onFinish}
width="700px"
onCancel={onCancel}
maskClosable={false}
destroyOnClose
centered
>
<div className="searchHeader">
<Form form={form} layout="inline">
<Form.Item name="username">
<Input placeholder="请输入用户名称" />
</Form.Item>
<Form.Item>
<Button
type="primary"
htmlType="submit"
onClick={onSearch}
style={{ marginRight: '10px' }}
>
搜索
</Button>
<Button
type="primary"
htmlType="submit"
onClick={() => {
getData();
form.setFieldsValue({ username: '' });
}}
>
重置
</Button>
</Form.Item>
</Form>
</div>
<Spin spinning={loading}>
<div
className="checkContainer"
style={{ height: '500px', overflowY: 'scroll', margin: '20px 0' }}
>
{allList.map((item, index) => (
<div
className={styles.checkBoxContent}
key={item.groupId}
style={{
display: item.plainOptions.length > 0 ? 'block' : 'none',
}}
>
<CardCheck
cardMsg={item}
cardIndex={index}
callback={(val, i) => checkCallBack(val, i)}
/>
</div>
))}
</div>
</Spin>
</Modal>
</>
);
};
export default PushTest;
.divBox {
display: flex;
width: 100%;
flex-direction: column;
border: 1px solid #c2cdfd;
border-radius: 5px;
margin-top: 20px;
min-height: 50px;
padding: 0 10px 10px 20px;
.ant-checkbox-wrapper {
background-color: #fff;
}
.topCheckbox {
height: 20px;
margin: -10px 0 0 0px;
line-height: 20px;
}
.topCheckbox > label :hover {
font-weight: 600;
}
.bottomCheckbox {
.ant-checkbox-group-item {
min-width: 150px !important;
}
.ant-checkbox-wrapper {
min-width: 150px !important;
}
}
.checkdiv {
display: flex;
flex-wrap: wrap;
// margin-left: 20px;
// justify-content: space-between;
}
}
......@@ -188,11 +188,41 @@ const EditModal = props => {
aa = fv.enterprise_template.toString();
}
console.log(fv);
let push_mode =
(currentTrench.isAPPShow || currentTrench.isWEBShow ? '平台弹框' : '') +
(currentTrench.isWXShow ? ',公众号推送' : '') +
(currentTrench.isMessageShow ? ',短信推送' : '') +
(currentTrench.isEnterpriseWXShow ? ',企业微信推送' : '');
let push_mode = [];
Object.keys(currentTrench).forEach(key => {
console.log(key, 'key');
switch (key) {
case 'isAPPShow':
if (currentTrench[key]) {
push_mode.push('平台弹框');
}
break;
case 'isWEBShow':
if (currentTrench[key]) {
push_mode.push('平台弹框');
}
break;
case 'isWXShow':
if (currentTrench[key]) {
push_mode.push('公众号推送');
}
break;
case 'isMessageShow':
if (currentTrench[key]) {
push_mode.push('短信推送');
}
break;
case 'isEnterpriseWXShow':
if (currentTrench[key]) {
push_mode.push('企业微信推送');
}
break;
default:
break;
}
});
if (template.ThemeName) {
let a = {
ID: template.ID,
......@@ -212,7 +242,7 @@ const EditModal = props => {
IsDelete: template.IsDelete,
InputTime: moment().format('YYYY-MM-DD HH:mm:ss'),
Pusher: template.Pusher,
PushMode: push_mode,
PushMode: push_mode.join(','),
PushPath: template.PushPath,
IsStarted: isUse,
MsgTemplateID: fv.message_template,
......
......@@ -78,7 +78,7 @@ const AddModal = props => {
let data =
type == 'add'
? { ...obj, ...inputValue, Order: maxLength }
: { ...obj, ...inputValue, Order, ID: formObj.ID };
: { ...obj, Order, ID: formObj.ID };
GetCMLedger_OperateLedger(data)
.then(res => {
setLoading(false);
......@@ -241,6 +241,8 @@ const AddModal = props => {
setInputVaule(inputText);
};
const inputType = e => {
e.persist();
console.log(e.target.value, 'value');
setType(e.target.value);
form.setFieldsValue({ Type: e.target.value });
};
......@@ -271,7 +273,7 @@ const AddModal = props => {
<div>
<Input
className="ue-editable-select-input"
onChange={inputType}
onChange={e => inputType(e)}
value={Type}
/>
<Dropdown
......
......@@ -205,7 +205,7 @@
}
.ant-checkbox-group .ant-checkbox-group-item {
margin-right: 0px !important;
min-width: 200px !important;
// min-width: 200px !important;
}
.ant-tree-list-holder {
overflow: auto;
......
import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index';
//模板管理接口
// 模板管理接口
export const GetMessageTemplate = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetMessageTemplate`, param);
export const InsertMessageTemplate = param =>
......@@ -11,7 +11,7 @@ export const DeleteMessageTemplate = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/DeleteMessageTemplate`, param);
export const GetThirdpartyTemplates = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetThirdpartyTemplates`, param);
//方案管理接口
// 方案管理接口
export const GetMessageConfigList = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetMessageConfigList`, param);
export const InsertMessageConfig = param =>
......@@ -25,14 +25,16 @@ export const GetMessageVersion = param =>
export const GetMsgTypeList = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetMsgTypeList`, param);
export const TestPush = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/TestPush`, param);
post(`${PUBLISH_SERVICE}/MessageConfig/TestPush`, param);
export const AddIISAgentConfig = param =>
post(`${PUBLISH_SERVICE}/MessageConfig/AddIISAgentConfig`, param);
export const DeleteIISAgentConfig = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/DeleteIISAgentConfig`, param);
export const GetIISAgentConfig = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetIISAgentConfig`, param);
//组件接口
// 组件接口
export const RoleGroupList = param =>
get(`${PUBLISH_SERVICE}/UserCenter/RoleGroupList`, param);
export const GetGroupUserTree = param =>
get(`${PUBLISH_SERVICE}/UserCenter/GetGroupUserTree`, 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