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;
}
}
import React, { useEffect, useState } from 'react'
/* eslint-disable no-restricted-syntax */
import React, { useEffect, useState } from 'react';
import SiteModal from '@/components/Modal/SiteModa';
import { Checkbox, Input, Button, Modal } from 'antd'
//import { data } from '../Mock'
import { Checkbox, Input, Button, Modal } from 'antd';
// import { data } from '../Mock'
import _ from 'lodash';
import classnames from 'classnames';
import styles from './VisibleRoleModal.less'
import { ManOutlined } from '@ant-design/icons';
import { RoleGroupList } from '@/services/platform/messagemanage'
import { RoleGroupList } from '@/services/platform/messagemanage';
import { useTheme } from 'bizcharts';
import styles from './VisibleRoleModal.less';
const checkIsGroup = node =>
node.children?.length > 0;
const getId = item =>
item.userID || item.roleID || item.stationID || item.id;
const checkIsGroup = node => node.children?.length > 0;
const getId = item => item.userID || item.roleID || item.stationID || item.id;
const VisibleRoleModal = props => {
const [loading, setLoading] = useState(false);
const [previewVisible, setPreviewVisible] = useState(false)
const [selectRole, setSelectRole] = useState([])
const [dataTree, setDataTree] = useState([])
const [dataLeafs, setDataLeafs] = useState([])
const [selectValues, setSelectValues] = useState([])
const { onSubmit, title, operate, initValues, selectValue } = props
const [isUnmount, setIsUnmount] = useState(true)
const [previewVisible, setPreviewVisible] = useState(false);
const [selectRole, setSelectRole] = useState([]);
const [dataTree, setDataTree] = useState([]);
const [dataLeafs, setDataLeafs] = useState([]);
const [selectValues, setSelectValues] = useState([]);
const { onSubmit, title, operate, initValues, selectValue } = props;
const [isUnmount, setIsUnmount] = useState(true);
const GetRoleGroupList = () => {
}
const GetRoleGroupList = () => {};
useEffect(() => {
let isUnmount = false
// eslint-disable-next-line no-shadow
let isUnmount = false;
console.log('selectValue', selectValue);
if (selectValue) {
setSelectRole(selectValue)
setSelectRole(selectValue);
}
RoleGroupList().then(async res => {
let tree = []
let leafs = []
res.data && res.data.roleList.map((item, index) => {
let tree = [];
let leafs = [];
// eslint-disable-next-line no-unused-expressions
res.data &&
res.data.roleList.map((item, index) => {
tree.push({
name: item.visibleTitle,
id: index,
children: item.roleList.map((roleItem) => {
children: item.roleList.map(roleItem => {
leafs.push({
name: roleItem.roleName,
id: roleItem.roleID,
})
});
const leafNode = {
name: roleItem.roleName,
id: roleItem.roleID,
children: []
}
return leafNode
})
})
})
children: [],
};
return leafNode;
}),
});
});
if (!isUnmount) {
setDataTree(tree)
setDataLeafs(leafs)
return () => isUnmount = true;
}
setDataTree(tree);
setDataLeafs(leafs);
// eslint-disable-next-line no-return-assign
return () => (isUnmount = true);
}
)
}, [selectValue])
});
}, [selectValue]);
const handleCancel = () => {
setPreviewVisible(false)
}
setPreviewVisible(false);
};
const handleOk = () => {
setPreviewVisible(false)
onSubmit && onSubmit(selectValues)
}
setPreviewVisible(false);
// eslint-disable-next-line no-unused-expressions
onSubmit && onSubmit(selectValues);
};
const handleClick = () => {
setPreviewVisible(true)
}
const onChange2 = (value) => {
console.log(value)
const strArr = []
setPreviewVisible(true);
};
const onChange2 = value => {
console.log(value);
const strArr = [];
// eslint-disable-next-line no-restricted-syntax
for (const item of value) {
strArr.push(item.name)
}
setSelectRole(strArr.toString())
setSelectValues(value)
strArr.push(item.name);
}
setSelectRole(strArr.toString());
setSelectValues(value);
};
return (
<div className={styles.role_container}>
{
operate ? (
<div onClick={handleClick}>
{
operate
}
</div>
{operate ? (
<div onClick={handleClick}>{operate}</div>
) : (
<div style={{ display: "flex", flexDirection: "row", width: "100%" }}>
<Input disabled={true} value={selectRole} />
<div className={styles.select_btn} onClick={handleClick}>{title ? title : "选择角色"}</div>
<div style={{ display: 'flex', flexDirection: 'row', width: '100%' }}>
<Input disabled value={selectRole} />
<div className={styles.select_btn} onClick={handleClick}>
{title || '选择角色'}
</div>
)
}
</div>
)}
<SiteModal
{...props}
title={title && Object.prototype.toString.call(title) !== '[object Object]' ? `选择${title}` : "关联角色"}
title={
title && Object.prototype.toString.call(title) !== '[object Object]'
? `选择${title}`
: '关联角色'
}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 200, borderRadius: '20px' }}
width="800px"
......@@ -123,15 +115,20 @@ const VisibleRoleModal = props => {
confirmLoading={loading}
visible={previewVisible}
onCancel={handleCancel}
>
<div className={styles.list_card}>
<ListCard {...props} onChange2={onChange2} data={dataTree} dataLeafs={dataLeafs} initValues={initValues} />
<ListCard
{...props}
onChange2={onChange2}
data={dataTree}
dataLeafs={dataLeafs}
initValues={initValues}
/>
</div>
</SiteModal>
</div>
)
}
);
};
const checkChildrenByCondition = (
item,
fn,
......@@ -147,9 +144,7 @@ const checkChildrenByCondition = (
return withGroup ? [fn(item), ...childrenResults] : [...childrenResults];
};
const ListCard = props => {
const { onChange, onChange2, data, dataLeafs, initValues } = props
const { onChange, onChange2, data, dataLeafs, initValues } = props;
const [changedItem, setChangedItem] = useState({ item: {} });
const [valueList, setValueList] = useState([]);
......@@ -158,19 +153,24 @@ const ListCard = props => {
const result = data.map(item => getAllID(item)).flat(Infinity);
setValueList(result);
// eslint-disable-next-line no-unused-expressions
const fliterResult = filterChildren(result)
const strArr = []
const fliterResult = filterChildren(result);
const strArr = [];
// eslint-disable-next-line no-restricted-syntax
for (const item of fliterResult) {
strArr.push(item.name)
strArr.push(item.name);
}
onChange && onChange(strArr.toString())
onChange2 && onChange2(fliterResult)
// eslint-disable-next-line no-unused-expressions
onChange && onChange(strArr.toString());
// eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult);
} else {
setValueList([]);
// eslint-disable-next-line no-unused-expressions
const fliterResult = filterChildren(result)
onChange && onChange(fliterResult)
onChange2 && onChange2(fliterResult)
const fliterResult = filterChildren(result);
// eslint-disable-next-line no-unused-expressions
onChange && onChange(fliterResult);
// eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult);
}
};
......@@ -186,19 +186,18 @@ const ListCard = props => {
}
return result;
};
const filterChildren = (select) => {
let selectLeafs = []
const filterChildren = select => {
let selectLeafs = [];
for (const leaf of dataLeafs) {
for (const id of select) {
if (id == leaf.id) {
selectLeafs.push(leaf)
selectLeafs.push(leaf);
}
}
}
return selectLeafs
}
return selectLeafs;
};
const updateValueList = (checkedKeys, childrenKeys, sourceItem) => {
const removekeys = _.difference(childrenKeys, checkedKeys);
......@@ -208,27 +207,29 @@ const ListCard = props => {
if (sourceItem) setChangedItem(sourceItem);
// eslint-disable-next-line no-unused-expressions
// onChange && onChange(result);
// onChange2 && onChange2(result);
const fliterResult = filterChildren(result)
const strArr = []
const fliterResult = filterChildren(result);
const strArr = [];
// eslint-disable-next-line no-restricted-syntax
for (const item of fliterResult) {
strArr.push(item.name)
}
onChange && onChange(strArr.toString())
onChange2 && onChange2(fliterResult)
strArr.push(item.name);
}
// eslint-disable-next-line no-unused-expressions
onChange && onChange(strArr.toString());
// eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult);
};
useEffect(() => {
initValues && setValueList(initValues)
}, [])
// eslint-disable-next-line no-unused-expressions
initValues && setValueList(initValues);
}, []);
return (
<div>
<Checkbox onChange={checkAll}>全选/全不选</Checkbox>
{
data.map((item, i) => {
return <ListCardItem
{data.map((item, i) => (
<ListCardItem
key={i}
item={item}
updateValueList={updateValueList}
......@@ -236,21 +237,13 @@ const ListCard = props => {
changedItem={changedItem}
{...props}
/>
})
}
))}
</div>
)
}
);
};
const ListCardItem = props => {
const {
item,
valueList,
updateValueList,
changedItem
} = props;
const id = item.id;
const { item, valueList, updateValueList, changedItem } = props;
const { id } = item;
// 当前组件是否是分组id
const isGroup = item.children && item.children.length > 0;
const [indeterminate, setIndeterminate] = useState(!isGroup);
......@@ -259,9 +252,7 @@ const ListCardItem = props => {
useEffect(() => {
if (isGroup) {
const keys = item.children
.map(child =>
checkChildrenByCondition(child, c => c.id, true, 'map'),
)
.map(child => checkChildrenByCondition(child, c => c.id, true, 'map'))
.flat(Infinity);
setChildrenKeys(keys);
} else {
......@@ -295,7 +286,6 @@ const ListCardItem = props => {
}
}, [changedItem.item, changedItem.value]);
const handleChecked = e => {
const { checked: v } = e.target;
if (isGroup) {
......@@ -305,7 +295,7 @@ const ListCardItem = props => {
} else {
updateValueList(v ? [id] : [], [id], { item, value: v });
}
}
};
const renderChild = () =>
item.children &&
item.children.map((c, i) => (
......@@ -318,26 +308,25 @@ const ListCardItem = props => {
/>
));
return (
<div className={classnames({
<div
className={classnames({
[styles.divBox]: isGroup,
[styles.divSingle]: !isGroup,
})}>
})}
>
<div className={styles.topCheckbox}>
<Checkbox
indeterminate={isGroup ? indeterminate : false}
checked={valueList.includes(id)}
onChange={handleChecked} >
onChange={handleChecked}
>
{item.name}
</Checkbox>
<div style={{ width: '100%' }} className={styles.checkdiv}>
{
renderChild()
}
{renderChild()}
</div>
</div>
</div>
)
}
export default VisibleRoleModal
\ No newline at end of file
);
};
export default VisibleRoleModal;
......@@ -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 React, { useEffect, useState } from 'react'
import React, { useEffect, useState } from 'react';
import {
// Tree,
Table,
......@@ -17,10 +17,10 @@ import {
Col,
Empty,
Pagination,
Checkbox
Checkbox,
} from 'antd';
import classnames from 'classnames'
import classnames from 'classnames';
import {
UserOutlined,
PlusSquareOutlined,
......@@ -32,7 +32,7 @@ import {
DoubleRightOutlined,
DownOutlined,
PlusOutlined,
ApartmentOutlined
ApartmentOutlined,
} from '@ant-design/icons';
import PageContainer from '@/components/BasePageContainer';
......@@ -40,6 +40,7 @@ import Tree from '@/components/ExpendableTree';
import voca from 'voca';
import zhCN from 'antd/es/locale/zh_CN';
import qs from 'qs';
import lodash, { clone } from 'lodash';
import styles from './siteManage.less';
import {
......@@ -51,9 +52,8 @@ import {
groupUserPagingList,
addChildSiteNode,
getSiteTree,
getStationUsers
getStationUsers,
} from '@/services/userCenter/siteManage/api';
import lodash, { clone } from 'lodash';
import AddModal from '../siteManage/AddModal';
import DelModal from '../siteManage/DelModal';
import EditModal from '../siteManage/EditModal';
......@@ -61,9 +61,6 @@ import AddChildModal from '../siteManage/AddChildModal';
const { Search } = Input;
const placeholder = '请输入机构名称';
const SiteManageV2 = () => {
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [treeVisible, setTreeVisible] = useState(true); // 树是否可见
const [treeData, setTreeData] = useState([]); // 用户站点树
......@@ -71,10 +68,10 @@ const SiteManageV2 = () => {
const [treeState, setTreeState] = useState(true); // 树第一次加载
const [treeLoading, setTreeLoading] = useState(false);
const [currentStation, setCurrentStation] = useState(''); // 当前选中站点
const [currentStationMsg, setCurrentStationMsg] = useState({}); //当前编辑节点信息
const [currentStationOperate, setCurrentStationOperate] = useState(false)
const [flag, setFlag] = useState(1);//操作标致触发界面刷新
const [dataList, setdataList] = useState([]);//当前站点对应的分页用户列表
const [currentStationMsg, setCurrentStationMsg] = useState({}); // 当前编辑节点信息
const [currentStationOperate, setCurrentStationOperate] = useState(false);
const [flag, setFlag] = useState(1); // 操作标致触发界面刷新
const [dataList, setdataList] = useState([]); // 当前站点对应的分页用户列表
const [visibleParams, setvisibleParams] = useState({
modalVisible: false, // 新增弹窗
delVisible: false, // 删除弹窗
......@@ -87,14 +84,14 @@ const SiteManageV2 = () => {
const [total, setTotal] = useState(0); // 分页总数
const [page, setPage] = useState({ pageNum: 1, pageSize: 10 });
const [selectList, setSelectList] = useState([]); // 选择列表数据
const [updatePageUser, setUpdatePageUser] = useState(1);//
const [updatePageUser, setUpdatePageUser] = useState(1); //
const [updateCheck, setUpdateCheck] = useState(1);
const [name, setName] = useState('');
const [des, setDes] = useState('')
const [data, setData] = useState('')
const [ch, setCh] = useState('')
const [des, setDes] = useState('');
const [data, setData] = useState('');
const [ch, setCh] = useState('');
let a = []
let a = [];
// 渲染机构树
const mapTree = org => {
......@@ -105,13 +102,22 @@ const SiteManageV2 = () => {
<div className={styles.titleText}>{org.text}</div>
<div className={styles.tip}>
<Tooltip title="添加下级站点" className={styles.fs}>
<PlusSquareOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e => addSite(e, org)} />
<PlusSquareOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => addSite(e, org)}
/>
</Tooltip>
<Tooltip title="编辑当前站点" className={styles.fs}>
<FormOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e => editorSite(e, org)} />
<FormOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => editorSite(e, org)}
/>
</Tooltip>
<Tooltip title="删除当前站点" className={styles.fs}>
<DeleteOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e => delSite(e, org)} />
<DeleteOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => delSite(e, org)}
/>
</Tooltip>
</div>
</div>
......@@ -122,20 +128,19 @@ const SiteManageV2 = () => {
children: haveChildren ? org.children.map(i => mapTree(i)) : [],
};
};
//添加下级站点
// 添加下级站点
const addSite = (e, recode) => {
e.stopPropagation();
setCurrentStation(recode.id);
handleShowModal('addChildVisible', true);
}
//删除当前站点
};
// 删除当前站点
const delSite = (e, recode) => {
e.stopPropagation();
setCurrentStation(recode.id);
handleShowModal('delVisible', true);
}
//编辑当前站点
};
// 编辑当前站点
const editorSite = (e, recode) => {
e.stopPropagation();
// console.log(recode);
......@@ -143,19 +148,18 @@ const SiteManageV2 = () => {
setCurrentStationMsg(recode);
// setCurrentStation(recode.id);
handleShowModal('editVisible', true);
}
};
// 重新渲染树
const updateTrees = () => {
setTreeLoading(true);
getSiteTree({ selectNode: -1 }).then(
res => {
getSiteTree({ selectNode: -1 }).then(res => {
if (res.data.length > 0) {
setTreeLoading(false);
setTreeData(res.data);
setTreeDataCopy(res.data);
// 第一次加载,默认选择第一个组织
if (treeState) {
onSelect([res.data[0].id], false);//待会儿要改
onSelect([res.data[0].id], false); // 待会儿要改
setTreeState(false);
}
} else {
......@@ -165,9 +169,7 @@ const SiteManageV2 = () => {
description: res.message,
});
}
}
)
});
};
// 获取用户机构树
......@@ -176,23 +178,23 @@ const SiteManageV2 = () => {
}, [flag]);
useEffect(() => {
getValue()
}, [])
getValue();
}, []);
//切换站点,点击分页按钮,提交
// 切换站点,点击分页按钮,提交
useEffect(() => {
if (!currentStation) return;
getList();
setShowSearchStyle(false);
}, [updatePageUser, name]);
//切换站点,提交时触发已勾选列表更新
// 切换站点,提交时触发已勾选列表更新
useEffect(() => {
if (!currentStation) return;
//getAllcheckList();
getAllCheckListNew()
// getAllcheckList();
getAllCheckListNew();
}, [currentStation, updateCheck]);
//获取当前站点可编辑用户(已勾选和未勾选)分页展示
// 获取当前站点可编辑用户(已勾选和未勾选)分页展示
const getList = () => {
let params = {
id: +currentStation || '',
......@@ -231,8 +233,8 @@ const SiteManageV2 = () => {
setdataList(lodash.cloneDeep([]));
}
});
}
//获取当前站点所有已经勾选的用户
};
// 获取当前站点所有已经勾选的用户
const getAllcheckList = async () => {
let res = await getUserByStation({
stationID: currentStation,
......@@ -264,19 +266,17 @@ const SiteManageV2 = () => {
}
});
setSelectList(lodash.cloneDeep(list));
setUpdatePageUser(updatePageUser + 1)
}
setUpdatePageUser(updatePageUser + 1);
}
};
//获取当前站点所有已经勾选的用户新接口
// 获取当前站点所有已经勾选的用户新接口
const getAllCheckListNew = () => {
getStationUsers({
stationId: currentStation
}).then(
res => {
let list = []
stationId: currentStation,
}).then(res => {
let list = [];
if (res.data.length > 0) {
res.data.map((item, index) => {
list.push({
GroupId: +item.OUID,
......@@ -284,55 +284,49 @@ const SiteManageV2 = () => {
userName: item.userName,
userID: item.userID,
});
})
});
}
setSelectList(lodash.cloneDeep(list));
setUpdatePageUser(updatePageUser + 1)
}
)
}
//选中某个站点
setUpdatePageUser(updatePageUser + 1);
});
};
// 选中某个站点
const onSelect = (props, e) => {
console.log('props[0]', props[0]);
setCh(props[0])
setCh(props[0]);
if (!props[0]) {
setCurrentStation(currentStation)
setCurrentStation(currentStation);
} else {
setCurrentStation(props[0]);
}
setPage({ pageNum: 1, pageSize: 10 });
console.log(data)
console.log(data);
data.map((item, index) => {
if (item.id == props[0]) {
console.log(item.id)
console.log(item.describe)
setDes(item.describe)
}
})
console.log(item.id);
console.log(item.describe);
setDes(item.describe);
}
});
};
const getValue = () => {
getSiteTree({ selectNode: -1 }).then(
res => {
console.log(res.data)
getData1(res.data)
}
)
}
getSiteTree({ selectNode: -1 }).then(res => {
console.log(res.data);
getData1(res.data);
});
};
const getData1 = e => {
console.log(e)
console.log(e);
e.map((i, j) => {
a.push(i)
a.push(i);
if (i.children.length > 0) {
getData1(i.children)
}
})
console.log(a)
setData(a)
getData1(i.children);
}
});
console.log(a);
setData(a);
};
// 弹出模态框
const handleShowModal = (key, value) => {
......@@ -358,7 +352,7 @@ const SiteManageV2 = () => {
const addChildModal = () => {
handleShowModal('addChildVisible', false);
setFlag(flag + 1);
}
};
const handleChangeCollpase = (groupId, isShow) => {
let index = dataList.findIndex(item => item.GroupId === groupId);
......@@ -367,15 +361,13 @@ const SiteManageV2 = () => {
return;
}
handleShowModal('loading', true);
getStationUserList({ stationID: currentStation, groupId }).then(
res => {
getStationUserList({ stationID: currentStation, groupId }).then(res => {
if (res.code === 0 && res.data) {
handleShowModal('loading', false);
dataList[index].children = res.data;
setdataList(lodash.cloneDeep(dataList));
}
},
);
});
};
// 每组全选全不选
const handleChangeAll = (e, index) => {
......@@ -467,12 +459,10 @@ const SiteManageV2 = () => {
message: '提示',
description: '请至少选择选择一个用户!',
});
chooseUserToStation(
{
chooseUserToStation({
userList: String(result.flat()),
stationID: currentStation,
}
)
})
.then(res => {
handleShowModal('btnLoading', false);
......@@ -506,12 +496,12 @@ const SiteManageV2 = () => {
// 机构操作
const addTopStation = () => {
handleShowModal('modalVisible', true);
}
};
// 模糊查询匹配的样式
const searchStyle = val => {
console.log(showSearchStyle)
console.log(name)
console.log(showSearchStyle);
console.log(name);
let n;
if (showSearchStyle) {
n = val.replace(
......@@ -521,7 +511,7 @@ const SiteManageV2 = () => {
} else {
n = val;
}
console.log(n)
console.log(n);
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
......@@ -529,7 +519,6 @@ const SiteManageV2 = () => {
let { index, GroupId, GroupName, Users, isChecked, isShow, color } = props;
return (
<div className={styles.sitePanel} key={GroupId} id={`siteId${GroupId}`}>
{/* onClick={() => props.handleChangeCollpase(GroupId, isShow)} */}
<div className={styles.sitePanelHead}>
{/* {isShow ? (
......@@ -550,7 +539,6 @@ const SiteManageV2 = () => {
</Checkbox>
</div>
<div className={styles.sitePanelCon}>
{Users.length > 0 &&
Users.map((v, vIndex) => (
<CheckBoxRow
......@@ -594,7 +582,11 @@ const SiteManageV2 = () => {
autoExpandParent
selectedKeys={[currentStation]}
onSelect={onSelect}
height={treeData.length && treeData.length > 30 ? treeData.length * 14 : 780}
height={
treeData.length && treeData.length > 30
? treeData.length * 14
: 780
}
treeData={treeData.map(t => mapTree(t))}
/>
)}
......@@ -666,7 +658,6 @@ const SiteManageV2 = () => {
/>
</Col>
<Col span={3} />
</Row>
</Card>
<div style={{ background: '#fff' }}>
......@@ -680,7 +671,6 @@ const SiteManageV2 = () => {
{dataList.length > 0 && !visibleParams.loading ? (
<>
<p className={styles.siteline}>已选择列表:</p>
<div className={styles.siteSelectList}>
<ul className={styles.siteSelectUl}>
......@@ -698,7 +688,7 @@ const SiteManageV2 = () => {
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
<Spin spinning={visibleParams.loading} >
<Spin spinning={visibleParams.loading}>
{dataList.map((item, index) => (
<Panels
{...item}
......@@ -721,8 +711,10 @@ const SiteManageV2 = () => {
onChange={handleChangePage}
pageSizeOptions={['10']}
/>
</div>) : ''
}
</div>
) : (
''
)}
<div className={styles.siteBtn}>
<Button
type="primary"
......@@ -734,15 +726,11 @@ const SiteManageV2 = () => {
</div>
</div>
</div>
</div>
</div>
</PageContainer>
)
}
);
};
const CheckBoxRow = React.memo(props => {
let { vIndex, index, isChecked, userName } = props;
......
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