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

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

parent ecad602f
Pipeline #39323 skipped with stages
...@@ -29,9 +29,7 @@ const Fieldselection = props => { ...@@ -29,9 +29,7 @@ const Fieldselection = props => {
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
setCheckList(fieldList); setCheckList(fieldList);
let newArr = filedData.map(item => { let newArr = filedData.map(item => ({ name: item }));
return { name: item };
});
setSelectList(newArr); setSelectList(newArr);
} else { } else {
setSelectList([]); setSelectList([]);
......
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react';
import { Card, Form, Switch, message, Divider, Row, Col, Spin } from 'antd' import { Card, Form, Switch, message, Divider, Row, Col, Spin } from 'antd';
import styles from './gateWay.less' import styles from './gateWay.less';
import { GetGateWay, UpdateGeteWay } from '@/services/platform/hostmanager' import { GetGateWay, UpdateGeteWay } from '@/services/platform/hostmanager';
import configuration from '../../../../assets/images/icons/消息.svg' import configuration from '../../../../assets/images/icons/消息.svg';
const GateConfig = () => { const GateConfig = () => {
const [loading, setLoading] = useState(false); // 加载 const [loading, setLoading] = useState(false); // 加载
const [form] = Form.useForm(); const [form] = Form.useForm();
const [flag, setFlag] = useState(1) const [flag, setFlag] = useState(1);
const [currentConfig, setCurrentConfig] = useState() const [currentConfig, setCurrentConfig] = useState();
const OperateNginx = (checked) => { const OperateNginx = checked => {
console.log(checked) console.log(checked);
UpdateGeteWay({isUsed: checked}).then(res=>{ UpdateGeteWay({ isUsed: checked }).then(res => {
if(res.code === 0){ if (res.code === 0) {
setFlag(flag + 1) setFlag(flag + 1);
message.success("设置成功") message.success('设置成功');
}else{ } else {
message.error("设置失败") message.error('设置失败');
} }
}) });
};
useEffect(() => {
if (currentConfig) {
localStorage.setItem('panda-publish', 'getway');
} else {
localStorage.setItem('panda-publish', '');
} }
}, [currentConfig]);
useEffect(() => { useEffect(() => {
GetGateWay().then(res=>{ GetGateWay().then(res => {
if(res.code === 0){ if (res.code === 0) {
setCurrentConfig(res.data) setCurrentConfig(res.data);
console.log(res.data) console.log(res.data);
console.log(currentConfig) console.log(currentConfig);
} }
}) });
}, [flag]) }, [flag]);
return ( return (
<div className={styles.gateWay_container}> <div className={styles.gateWay_container}>
<Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}> <Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}>
<Spin spinning={loading} tip="loading"> <Spin spinning={loading} tip="loading">
<div
<div style={{ display: 'flex', alignItems: 'center', marginTop: '40px' }}> style={{ display: 'flex', alignItems: 'center', marginTop: '40px' }}
<img src={configuration} style={{ height: '16px' }} /><span style={{ marginLeft: '10px', fontWeight: 'bold' }}>服务管理</span> >
<img src={configuration} style={{ height: '16px' }} alt="" />
<span style={{ marginLeft: '10px', fontWeight: 'bold' }}>
服务管理
</span>
</div> </div>
<Divider /> <Divider />
<div className={styles.operate_container}> <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}> <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>
<Col span={22}> <Col span={22}>
{console.log(currentConfig)} {console.log(currentConfig)}
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={currentConfig} onChange={OperateNginx} style={{marginLeft:'30px'}}/> <Switch
checkedChildren="开启"
unCheckedChildren="关闭"
checked={currentConfig}
onChange={OperateNginx}
style={{ marginLeft: '30px' }}
/>
</Col> </Col>
</Row> </Row>
</div> </div>
</Spin> </Spin>
</Card> </Card>
</div> </div>
) );
} };
export default GateConfig; export default GateConfig;
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Tabs } from 'antd'; import { Tabs } from 'antd';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import BaseConfig from './baseConfig/BaseConfig' import BaseConfig from './baseConfig/BaseConfig';
import IotConfig from './IotConfig/IotConfig' import IotConfig from './IotConfig/IotConfig';
import MessageConfig from './messageConfig/messageConfig' import MessageConfig from './messageConfig/messageConfig';
import ProxyConfig from './proxyConfig/ProxyConfig' import ProxyConfig from './proxyConfig/ProxyConfig';
import GateConfig from './gateWay/gateWay' import GateConfig from './gateWay/gateWay';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const HostManager = () => { const HostManager = () => {
const callback = () => {};
const callback = () => {
}
return ( return (
<PageContainer> <PageContainer>
<Tabs onChange={callback} type="card"> <Tabs onChange={callback} type="card">
<TabPane tab="基础配置" key="1"> <TabPane tab="基础配置" key="1">
<BaseConfig/> <BaseConfig />
</TabPane> </TabPane>
<TabPane tab="物联配置" key="2"> <TabPane tab="物联配置" key="2">
<IotConfig/> <IotConfig />
</TabPane> </TabPane>
<TabPane tab="消息配置" key="3"> <TabPane tab="消息配置" key="3">
<MessageConfig/> <MessageConfig />
</TabPane> </TabPane>
<TabPane tab="代理配置" key="4"> <TabPane tab="代理配置" key="4">
<ProxyConfig/> <ProxyConfig />
</TabPane> </TabPane>
<TabPane tab="网关配置" key="5"> <TabPane tab="网关配置" key="5">
<GateConfig/> <GateConfig />
</TabPane> </TabPane>
</Tabs> </Tabs>
</PageContainer> </PageContainer>
) );
};
}
export default HostManager; export default HostManager;
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Tabs } from 'antd'; import { Tabs } from 'antd';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import TemplateManage from '../messageManage/templateManage/TemplateManage' import TemplateManage from './templateManage/TemplateManage';
import ProjectManage from '../messageManage/projectManage/ProjectManage' import ProjectManage from './projectManage/ProjectManage';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const HostManager = () => { const HostManager = () => {
const callback = () => {};
const callback = () => {
}
return ( return (
<PageContainer> <PageContainer>
<Tabs onChange={callback} type="card"> <Tabs onChange={callback} type="card">
<TabPane tab="推送方案配置" key="2"> <TabPane tab="推送方案配置" key="2">
<ProjectManage/> <ProjectManage />
</TabPane> </TabPane>
<TabPane tab="推送模板配置" key="1"> <TabPane tab="推送模板配置" key="1">
<TemplateManage/> <TemplateManage />
</TabPane> </TabPane>
</Tabs> </Tabs>
</PageContainer> </PageContainer>
) );
};
}
export default HostManager; export default HostManager;
...@@ -24,6 +24,7 @@ import { ...@@ -24,6 +24,7 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import EditModal from './components/EditModal'; import EditModal from './components/EditModal';
import PushTest from './components/PushTest/PushTest';
import VisibleRoleModal from './components/RolseSelect/VisibleRoleModal'; import VisibleRoleModal from './components/RolseSelect/VisibleRoleModal';
import { import {
GetMessageConfigList, GetMessageConfigList,
...@@ -42,6 +43,7 @@ const ProjectManage = () => { ...@@ -42,6 +43,7 @@ const ProjectManage = () => {
delVisible: false, // 删除弹窗 delVisible: false, // 删除弹窗
editVisible: false, // 修改弹窗 editVisible: false, // 修改弹窗
spinLoading: false, // 加载弹窗 spinLoading: false, // 加载弹窗
pushTestVisible: false, // 推送测试弹窗
btnLoading: false, btnLoading: false,
loading: false, loading: false,
checkBoxLoading: false, checkBoxLoading: false,
...@@ -57,6 +59,7 @@ const ProjectManage = () => { ...@@ -57,6 +59,7 @@ const ProjectManage = () => {
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式 const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const [pushTestMsg, setPushTestMsg] = useState('');
const columns = [ const columns = [
{ {
title: '方案名称', title: '方案名称',
...@@ -181,20 +184,8 @@ const ProjectManage = () => { ...@@ -181,20 +184,8 @@ const ProjectManage = () => {
// handleShowModal("editVisible", true) // handleShowModal("editVisible", true)
}; };
const TestDesc = record => { const TestDesc = record => {
if (record.ThemeName) setPushTestMsg(record);
TestPush({ handleShowModal('pushTestVisible', true);
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);
}
});
}; };
const DeleteProject = record => { const DeleteProject = record => {
let agen = record.item.AgentConfig; let agen = record.item.AgentConfig;
...@@ -246,6 +237,10 @@ const ProjectManage = () => { ...@@ -246,6 +237,10 @@ const ProjectManage = () => {
handleShowModal('addVisbile', false); handleShowModal('addVisbile', false);
setFlag(flag + 1); setFlag(flag + 1);
}; };
const pushTestModal = () => {
handleShowModal('pushTestVisible', false);
setFlag(flag + 1);
};
const onAddClick = () => { const onAddClick = () => {
setCurrentTempalte({}); setCurrentTempalte({});
// handleShowModal("addVisible", true) // handleShowModal("addVisible", true)
...@@ -412,6 +407,12 @@ const ProjectManage = () => { ...@@ -412,6 +407,12 @@ const ProjectManage = () => {
onCancel={() => handleShowModal('addVisible', false)} onCancel={() => handleShowModal('addVisible', false)}
confirmModal={bddModal} confirmModal={bddModal}
/> />
<PushTest
visible={visibleParams.pushTestVisible}
onCancel={() => handleShowModal('pushTestVisible', false)}
confirmModal={pushTestModal}
pushTestMsg={pushTestMsg}
/>
</Spin> </Spin>
</div> </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 SiteModal from '@/components/Modal/SiteModa';
import { Checkbox, Input, Button, Modal } from 'antd' import { Checkbox, Input, Button, Modal } from 'antd';
//import { data } from '../Mock' // import { data } from '../Mock'
import _ from 'lodash'; import _ from 'lodash';
import classnames from 'classnames'; import classnames from 'classnames';
import styles from './VisibleRoleModal.less'
import { ManOutlined } from '@ant-design/icons'; import { ManOutlined } from '@ant-design/icons';
import { RoleGroupList } from '@/services/platform/messagemanage' import { RoleGroupList } from '@/services/platform/messagemanage';
import { useTheme } from 'bizcharts'; import { useTheme } from 'bizcharts';
import styles from './VisibleRoleModal.less';
const checkIsGroup = node => node.children?.length > 0;
const checkIsGroup = node => const getId = item => item.userID || item.roleID || item.stationID || item.id;
node.children?.length > 0;
const getId = item =>
item.userID || item.roleID || item.stationID || item.id;
const VisibleRoleModal = props => { const VisibleRoleModal = props => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [previewVisible, setPreviewVisible] = useState(false) const [previewVisible, setPreviewVisible] = useState(false);
const [selectRole, setSelectRole] = useState([]) const [selectRole, setSelectRole] = useState([]);
const [dataTree, setDataTree] = useState([]) const [dataTree, setDataTree] = useState([]);
const [dataLeafs, setDataLeafs] = useState([]) const [dataLeafs, setDataLeafs] = useState([]);
const [selectValues, setSelectValues] = useState([]) const [selectValues, setSelectValues] = useState([]);
const { onSubmit, title, operate, initValues, selectValue } = props const { onSubmit, title, operate, initValues, selectValue } = props;
const [isUnmount, setIsUnmount] = useState(true) const [isUnmount, setIsUnmount] = useState(true);
const GetRoleGroupList = () => { const GetRoleGroupList = () => {};
}
useEffect(() => { useEffect(() => {
let isUnmount = false // eslint-disable-next-line no-shadow
let isUnmount = false;
console.log('selectValue', selectValue); console.log('selectValue', selectValue);
if (selectValue) { if (selectValue) {
setSelectRole(selectValue) setSelectRole(selectValue);
} }
RoleGroupList().then(async res => { RoleGroupList().then(async res => {
let tree = [] let tree = [];
let leafs = [] let leafs = [];
res.data && res.data.roleList.map((item, index) => { // eslint-disable-next-line no-unused-expressions
res.data &&
res.data.roleList.map((item, index) => {
tree.push({ tree.push({
name: item.visibleTitle, name: item.visibleTitle,
id: index, id: index,
children: item.roleList.map((roleItem) => { children: item.roleList.map(roleItem => {
leafs.push({ leafs.push({
name: roleItem.roleName, name: roleItem.roleName,
id: roleItem.roleID, id: roleItem.roleID,
}) });
const leafNode = { const leafNode = {
name: roleItem.roleName, name: roleItem.roleName,
id: roleItem.roleID, id: roleItem.roleID,
children: [] children: [],
} };
return leafNode return leafNode;
}),
}) });
}) });
})
if (!isUnmount) { if (!isUnmount) {
setDataTree(tree) setDataTree(tree);
setDataLeafs(leafs) setDataLeafs(leafs);
return () => isUnmount = true; // eslint-disable-next-line no-return-assign
} return () => (isUnmount = true);
} }
) });
}, [selectValue]);
}, [selectValue])
const handleCancel = () => { const handleCancel = () => {
setPreviewVisible(false) setPreviewVisible(false);
};
}
const handleOk = () => { const handleOk = () => {
setPreviewVisible(false) setPreviewVisible(false);
onSubmit && onSubmit(selectValues) // eslint-disable-next-line no-unused-expressions
} onSubmit && onSubmit(selectValues);
};
const handleClick = () => { const handleClick = () => {
setPreviewVisible(true) setPreviewVisible(true);
} };
const onChange2 = (value) => { const onChange2 = value => {
console.log(value) console.log(value);
const strArr = [] const strArr = [];
// eslint-disable-next-line no-restricted-syntax
for (const item of value) { for (const item of value) {
strArr.push(item.name) strArr.push(item.name);
}
setSelectRole(strArr.toString())
setSelectValues(value)
} }
setSelectRole(strArr.toString());
setSelectValues(value);
};
return ( return (
<div className={styles.role_container}> <div className={styles.role_container}>
{ {operate ? (
operate ? ( <div onClick={handleClick}>{operate}</div>
<div onClick={handleClick}>
{
operate
}
</div>
) : ( ) : (
<div style={{ display: "flex", flexDirection: "row", width: "100%" }}> <div style={{ display: 'flex', flexDirection: 'row', width: '100%' }}>
<Input disabled={true} value={selectRole} /> <Input disabled value={selectRole} />
<div className={styles.select_btn} onClick={handleClick}>{title ? title : "选择角色"}</div> <div className={styles.select_btn} onClick={handleClick}>
{title || '选择角色'}
</div> </div>
) </div>
} )}
<SiteModal <SiteModal
{...props} {...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' }} bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 200, borderRadius: '20px' }} style={{ top: 200, borderRadius: '20px' }}
width="800px" width="800px"
...@@ -123,15 +115,20 @@ const VisibleRoleModal = props => { ...@@ -123,15 +115,20 @@ const VisibleRoleModal = props => {
confirmLoading={loading} confirmLoading={loading}
visible={previewVisible} visible={previewVisible}
onCancel={handleCancel} onCancel={handleCancel}
> >
<div className={styles.list_card}> <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> </div>
</SiteModal> </SiteModal>
</div> </div>
) );
} };
const checkChildrenByCondition = ( const checkChildrenByCondition = (
item, item,
fn, fn,
...@@ -147,9 +144,7 @@ const checkChildrenByCondition = ( ...@@ -147,9 +144,7 @@ const checkChildrenByCondition = (
return withGroup ? [fn(item), ...childrenResults] : [...childrenResults]; return withGroup ? [fn(item), ...childrenResults] : [...childrenResults];
}; };
const ListCard = props => { const ListCard = props => {
const { onChange, onChange2, data, dataLeafs, initValues } = props;
const { onChange, onChange2, data, dataLeafs, initValues } = props
const [changedItem, setChangedItem] = useState({ item: {} }); const [changedItem, setChangedItem] = useState({ item: {} });
const [valueList, setValueList] = useState([]); const [valueList, setValueList] = useState([]);
...@@ -158,19 +153,24 @@ const ListCard = props => { ...@@ -158,19 +153,24 @@ const ListCard = props => {
const result = data.map(item => getAllID(item)).flat(Infinity); const result = data.map(item => getAllID(item)).flat(Infinity);
setValueList(result); setValueList(result);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
const fliterResult = filterChildren(result) const fliterResult = filterChildren(result);
const strArr = [] const strArr = [];
// eslint-disable-next-line no-restricted-syntax
for (const item of fliterResult) { for (const item of fliterResult) {
strArr.push(item.name) strArr.push(item.name);
} }
onChange && onChange(strArr.toString()) // eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult) onChange && onChange(strArr.toString());
// eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult);
} else { } else {
setValueList([]); setValueList([]);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
const fliterResult = filterChildren(result) const fliterResult = filterChildren(result);
onChange && onChange(fliterResult) // eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult) onChange && onChange(fliterResult);
// eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult);
} }
}; };
...@@ -186,19 +186,18 @@ const ListCard = props => { ...@@ -186,19 +186,18 @@ const ListCard = props => {
} }
return result; return result;
}; };
const filterChildren = (select) => { const filterChildren = select => {
let selectLeafs = [] let selectLeafs = [];
for (const leaf of dataLeafs) { for (const leaf of dataLeafs) {
for (const id of select) { for (const id of select) {
if (id == leaf.id) { if (id == leaf.id) {
selectLeafs.push(leaf) selectLeafs.push(leaf);
} }
} }
} }
return selectLeafs return selectLeafs;
};
}
const updateValueList = (checkedKeys, childrenKeys, sourceItem) => { const updateValueList = (checkedKeys, childrenKeys, sourceItem) => {
const removekeys = _.difference(childrenKeys, checkedKeys); const removekeys = _.difference(childrenKeys, checkedKeys);
...@@ -208,27 +207,29 @@ const ListCard = props => { ...@@ -208,27 +207,29 @@ const ListCard = props => {
if (sourceItem) setChangedItem(sourceItem); if (sourceItem) setChangedItem(sourceItem);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
// onChange && onChange(result); // onChange && onChange(result);
// onChange2 && onChange2(result); // onChange2 && onChange2(result);
const fliterResult = filterChildren(result) const fliterResult = filterChildren(result);
const strArr = [] const strArr = [];
// eslint-disable-next-line no-restricted-syntax
for (const item of fliterResult) { 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);
};
useEffect(() => { useEffect(() => {
initValues && setValueList(initValues) // eslint-disable-next-line no-unused-expressions
}, []) initValues && setValueList(initValues);
}, []);
return ( return (
<div> <div>
<Checkbox onChange={checkAll}>全选/全不选</Checkbox> <Checkbox onChange={checkAll}>全选/全不选</Checkbox>
{ {data.map((item, i) => (
data.map((item, i) => { <ListCardItem
return <ListCardItem
key={i} key={i}
item={item} item={item}
updateValueList={updateValueList} updateValueList={updateValueList}
...@@ -236,21 +237,13 @@ const ListCard = props => { ...@@ -236,21 +237,13 @@ const ListCard = props => {
changedItem={changedItem} changedItem={changedItem}
{...props} {...props}
/> />
}) ))}
}
</div> </div>
) );
} };
const ListCardItem = props => { const ListCardItem = props => {
const { const { item, valueList, updateValueList, changedItem } = props;
item, const { id } = item;
valueList,
updateValueList,
changedItem
} = props;
const id = item.id;
// 当前组件是否是分组id // 当前组件是否是分组id
const isGroup = item.children && item.children.length > 0; const isGroup = item.children && item.children.length > 0;
const [indeterminate, setIndeterminate] = useState(!isGroup); const [indeterminate, setIndeterminate] = useState(!isGroup);
...@@ -259,9 +252,7 @@ const ListCardItem = props => { ...@@ -259,9 +252,7 @@ const ListCardItem = props => {
useEffect(() => { useEffect(() => {
if (isGroup) { if (isGroup) {
const keys = item.children const keys = item.children
.map(child => .map(child => checkChildrenByCondition(child, c => c.id, true, 'map'))
checkChildrenByCondition(child, c => c.id, true, 'map'),
)
.flat(Infinity); .flat(Infinity);
setChildrenKeys(keys); setChildrenKeys(keys);
} else { } else {
...@@ -295,7 +286,6 @@ const ListCardItem = props => { ...@@ -295,7 +286,6 @@ const ListCardItem = props => {
} }
}, [changedItem.item, changedItem.value]); }, [changedItem.item, changedItem.value]);
const handleChecked = e => { const handleChecked = e => {
const { checked: v } = e.target; const { checked: v } = e.target;
if (isGroup) { if (isGroup) {
...@@ -305,7 +295,7 @@ const ListCardItem = props => { ...@@ -305,7 +295,7 @@ const ListCardItem = props => {
} else { } else {
updateValueList(v ? [id] : [], [id], { item, value: v }); updateValueList(v ? [id] : [], [id], { item, value: v });
} }
} };
const renderChild = () => const renderChild = () =>
item.children && item.children &&
item.children.map((c, i) => ( item.children.map((c, i) => (
...@@ -318,26 +308,25 @@ const ListCardItem = props => { ...@@ -318,26 +308,25 @@ const ListCardItem = props => {
/> />
)); ));
return ( return (
<div className={classnames({ <div
className={classnames({
[styles.divBox]: isGroup, [styles.divBox]: isGroup,
[styles.divSingle]: !isGroup, [styles.divSingle]: !isGroup,
})}> })}
>
<div className={styles.topCheckbox}> <div className={styles.topCheckbox}>
<Checkbox <Checkbox
indeterminate={isGroup ? indeterminate : false} indeterminate={isGroup ? indeterminate : false}
checked={valueList.includes(id)} checked={valueList.includes(id)}
onChange={handleChecked} > onChange={handleChecked}
>
{item.name} {item.name}
</Checkbox> </Checkbox>
<div style={{ width: '100%' }} className={styles.checkdiv}> <div style={{ width: '100%' }} className={styles.checkdiv}>
{ {renderChild()}
renderChild()
}
</div> </div>
</div> </div>
</div> </div>
) );
} };
export default VisibleRoleModal export default VisibleRoleModal;
\ No newline at end of file
...@@ -188,11 +188,41 @@ const EditModal = props => { ...@@ -188,11 +188,41 @@ const EditModal = props => {
aa = fv.enterprise_template.toString(); aa = fv.enterprise_template.toString();
} }
console.log(fv); console.log(fv);
let push_mode =
(currentTrench.isAPPShow || currentTrench.isWEBShow ? '平台弹框' : '') + let push_mode = [];
(currentTrench.isWXShow ? ',公众号推送' : '') + Object.keys(currentTrench).forEach(key => {
(currentTrench.isMessageShow ? ',短信推送' : '') + console.log(key, 'key');
(currentTrench.isEnterpriseWXShow ? ',企业微信推送' : ''); 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) { if (template.ThemeName) {
let a = { let a = {
ID: template.ID, ID: template.ID,
...@@ -212,7 +242,7 @@ const EditModal = props => { ...@@ -212,7 +242,7 @@ const EditModal = props => {
IsDelete: template.IsDelete, IsDelete: template.IsDelete,
InputTime: moment().format('YYYY-MM-DD HH:mm:ss'), InputTime: moment().format('YYYY-MM-DD HH:mm:ss'),
Pusher: template.Pusher, Pusher: template.Pusher,
PushMode: push_mode, PushMode: push_mode.join(','),
PushPath: template.PushPath, PushPath: template.PushPath,
IsStarted: isUse, IsStarted: isUse,
MsgTemplateID: fv.message_template, MsgTemplateID: fv.message_template,
......
...@@ -78,7 +78,7 @@ const AddModal = props => { ...@@ -78,7 +78,7 @@ const AddModal = props => {
let data = let data =
type == 'add' type == 'add'
? { ...obj, ...inputValue, Order: maxLength } ? { ...obj, ...inputValue, Order: maxLength }
: { ...obj, ...inputValue, Order, ID: formObj.ID }; : { ...obj, Order, ID: formObj.ID };
GetCMLedger_OperateLedger(data) GetCMLedger_OperateLedger(data)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
...@@ -241,6 +241,8 @@ const AddModal = props => { ...@@ -241,6 +241,8 @@ const AddModal = props => {
setInputVaule(inputText); setInputVaule(inputText);
}; };
const inputType = e => { const inputType = e => {
e.persist();
console.log(e.target.value, 'value');
setType(e.target.value); setType(e.target.value);
form.setFieldsValue({ Type: e.target.value }); form.setFieldsValue({ Type: e.target.value });
}; };
...@@ -271,7 +273,7 @@ const AddModal = props => { ...@@ -271,7 +273,7 @@ const AddModal = props => {
<div> <div>
<Input <Input
className="ue-editable-select-input" className="ue-editable-select-input"
onChange={inputType} onChange={e => inputType(e)}
value={Type} value={Type}
/> />
<Dropdown <Dropdown
......
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
} }
.ant-checkbox-group .ant-checkbox-group-item { .ant-checkbox-group .ant-checkbox-group-item {
margin-right: 0px !important; margin-right: 0px !important;
min-width: 200px !important; // min-width: 200px !important;
} }
.ant-tree-list-holder { .ant-tree-list-holder {
overflow: auto; overflow: auto;
......
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react';
import { import {
// Tree, // Tree,
Table, Table,
...@@ -17,10 +17,10 @@ import { ...@@ -17,10 +17,10 @@ import {
Col, Col,
Empty, Empty,
Pagination, Pagination,
Checkbox Checkbox,
} from 'antd'; } from 'antd';
import classnames from 'classnames' import classnames from 'classnames';
import { import {
UserOutlined, UserOutlined,
PlusSquareOutlined, PlusSquareOutlined,
...@@ -32,7 +32,7 @@ import { ...@@ -32,7 +32,7 @@ import {
DoubleRightOutlined, DoubleRightOutlined,
DownOutlined, DownOutlined,
PlusOutlined, PlusOutlined,
ApartmentOutlined ApartmentOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
...@@ -40,6 +40,7 @@ import Tree from '@/components/ExpendableTree'; ...@@ -40,6 +40,7 @@ import Tree from '@/components/ExpendableTree';
import voca from 'voca'; import voca from 'voca';
import zhCN from 'antd/es/locale/zh_CN'; import zhCN from 'antd/es/locale/zh_CN';
import qs from 'qs'; import qs from 'qs';
import lodash, { clone } from 'lodash';
import styles from './siteManage.less'; import styles from './siteManage.less';
import { import {
...@@ -51,9 +52,8 @@ import { ...@@ -51,9 +52,8 @@ import {
groupUserPagingList, groupUserPagingList,
addChildSiteNode, addChildSiteNode,
getSiteTree, getSiteTree,
getStationUsers getStationUsers,
} from '@/services/userCenter/siteManage/api'; } from '@/services/userCenter/siteManage/api';
import lodash, { clone } from 'lodash';
import AddModal from '../siteManage/AddModal'; import AddModal from '../siteManage/AddModal';
import DelModal from '../siteManage/DelModal'; import DelModal from '../siteManage/DelModal';
import EditModal from '../siteManage/EditModal'; import EditModal from '../siteManage/EditModal';
...@@ -61,9 +61,6 @@ import AddChildModal from '../siteManage/AddChildModal'; ...@@ -61,9 +61,6 @@ import AddChildModal from '../siteManage/AddChildModal';
const { Search } = Input; const { Search } = Input;
const placeholder = '请输入机构名称'; const placeholder = '请输入机构名称';
const SiteManageV2 = () => { const SiteManageV2 = () => {
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式 const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [treeVisible, setTreeVisible] = useState(true); // 树是否可见 const [treeVisible, setTreeVisible] = useState(true); // 树是否可见
const [treeData, setTreeData] = useState([]); // 用户站点树 const [treeData, setTreeData] = useState([]); // 用户站点树
...@@ -71,10 +68,10 @@ const SiteManageV2 = () => { ...@@ -71,10 +68,10 @@ const SiteManageV2 = () => {
const [treeState, setTreeState] = useState(true); // 树第一次加载 const [treeState, setTreeState] = useState(true); // 树第一次加载
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [currentStation, setCurrentStation] = useState(''); // 当前选中站点 const [currentStation, setCurrentStation] = useState(''); // 当前选中站点
const [currentStationMsg, setCurrentStationMsg] = useState({}); //当前编辑节点信息 const [currentStationMsg, setCurrentStationMsg] = useState({}); // 当前编辑节点信息
const [currentStationOperate, setCurrentStationOperate] = useState(false) const [currentStationOperate, setCurrentStationOperate] = useState(false);
const [flag, setFlag] = useState(1);//操作标致触发界面刷新 const [flag, setFlag] = useState(1); // 操作标致触发界面刷新
const [dataList, setdataList] = useState([]);//当前站点对应的分页用户列表 const [dataList, setdataList] = useState([]); // 当前站点对应的分页用户列表
const [visibleParams, setvisibleParams] = useState({ const [visibleParams, setvisibleParams] = useState({
modalVisible: false, // 新增弹窗 modalVisible: false, // 新增弹窗
delVisible: false, // 删除弹窗 delVisible: false, // 删除弹窗
...@@ -87,14 +84,14 @@ const SiteManageV2 = () => { ...@@ -87,14 +84,14 @@ const SiteManageV2 = () => {
const [total, setTotal] = useState(0); // 分页总数 const [total, setTotal] = useState(0); // 分页总数
const [page, setPage] = useState({ pageNum: 1, pageSize: 10 }); const [page, setPage] = useState({ pageNum: 1, pageSize: 10 });
const [selectList, setSelectList] = useState([]); // 选择列表数据 const [selectList, setSelectList] = useState([]); // 选择列表数据
const [updatePageUser, setUpdatePageUser] = useState(1);// const [updatePageUser, setUpdatePageUser] = useState(1); //
const [updateCheck, setUpdateCheck] = useState(1); const [updateCheck, setUpdateCheck] = useState(1);
const [name, setName] = useState(''); const [name, setName] = useState('');
const [des, setDes] = useState('') const [des, setDes] = useState('');
const [data, setData] = useState('') const [data, setData] = useState('');
const [ch, setCh] = useState('') const [ch, setCh] = useState('');
let a = [] let a = [];
// 渲染机构树 // 渲染机构树
const mapTree = org => { const mapTree = org => {
...@@ -105,13 +102,22 @@ const SiteManageV2 = () => { ...@@ -105,13 +102,22 @@ const SiteManageV2 = () => {
<div className={styles.titleText}>{org.text}</div> <div className={styles.titleText}>{org.text}</div>
<div className={styles.tip}> <div className={styles.tip}>
<Tooltip title="添加下级站点" className={styles.fs}> <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>
<Tooltip title="编辑当前站点" className={styles.fs}> <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>
<Tooltip title="删除当前站点" className={styles.fs}> <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> </Tooltip>
</div> </div>
</div> </div>
...@@ -122,20 +128,19 @@ const SiteManageV2 = () => { ...@@ -122,20 +128,19 @@ const SiteManageV2 = () => {
children: haveChildren ? org.children.map(i => mapTree(i)) : [], children: haveChildren ? org.children.map(i => mapTree(i)) : [],
}; };
}; };
//添加下级站点 // 添加下级站点
const addSite = (e, recode) => { const addSite = (e, recode) => {
e.stopPropagation(); e.stopPropagation();
setCurrentStation(recode.id); setCurrentStation(recode.id);
handleShowModal('addChildVisible', true); handleShowModal('addChildVisible', true);
} };
//删除当前站点 // 删除当前站点
const delSite = (e, recode) => { const delSite = (e, recode) => {
e.stopPropagation(); e.stopPropagation();
setCurrentStation(recode.id); setCurrentStation(recode.id);
handleShowModal('delVisible', true); handleShowModal('delVisible', true);
};
} // 编辑当前站点
//编辑当前站点
const editorSite = (e, recode) => { const editorSite = (e, recode) => {
e.stopPropagation(); e.stopPropagation();
// console.log(recode); // console.log(recode);
...@@ -143,19 +148,18 @@ const SiteManageV2 = () => { ...@@ -143,19 +148,18 @@ const SiteManageV2 = () => {
setCurrentStationMsg(recode); setCurrentStationMsg(recode);
// setCurrentStation(recode.id); // setCurrentStation(recode.id);
handleShowModal('editVisible', true); handleShowModal('editVisible', true);
} };
// 重新渲染树 // 重新渲染树
const updateTrees = () => { const updateTrees = () => {
setTreeLoading(true); setTreeLoading(true);
getSiteTree({ selectNode: -1 }).then( getSiteTree({ selectNode: -1 }).then(res => {
res => {
if (res.data.length > 0) { if (res.data.length > 0) {
setTreeLoading(false); setTreeLoading(false);
setTreeData(res.data); setTreeData(res.data);
setTreeDataCopy(res.data); setTreeDataCopy(res.data);
// 第一次加载,默认选择第一个组织 // 第一次加载,默认选择第一个组织
if (treeState) { if (treeState) {
onSelect([res.data[0].id], false);//待会儿要改 onSelect([res.data[0].id], false); // 待会儿要改
setTreeState(false); setTreeState(false);
} }
} else { } else {
...@@ -165,9 +169,7 @@ const SiteManageV2 = () => { ...@@ -165,9 +169,7 @@ const SiteManageV2 = () => {
description: res.message, description: res.message,
}); });
} }
} });
)
}; };
// 获取用户机构树 // 获取用户机构树
...@@ -176,23 +178,23 @@ const SiteManageV2 = () => { ...@@ -176,23 +178,23 @@ const SiteManageV2 = () => {
}, [flag]); }, [flag]);
useEffect(() => { useEffect(() => {
getValue() getValue();
}, []) }, []);
//切换站点,点击分页按钮,提交 // 切换站点,点击分页按钮,提交
useEffect(() => { useEffect(() => {
if (!currentStation) return; if (!currentStation) return;
getList(); getList();
setShowSearchStyle(false); setShowSearchStyle(false);
}, [updatePageUser, name]); }, [updatePageUser, name]);
//切换站点,提交时触发已勾选列表更新 // 切换站点,提交时触发已勾选列表更新
useEffect(() => { useEffect(() => {
if (!currentStation) return; if (!currentStation) return;
//getAllcheckList(); // getAllcheckList();
getAllCheckListNew() getAllCheckListNew();
}, [currentStation, updateCheck]); }, [currentStation, updateCheck]);
//获取当前站点可编辑用户(已勾选和未勾选)分页展示 // 获取当前站点可编辑用户(已勾选和未勾选)分页展示
const getList = () => { const getList = () => {
let params = { let params = {
id: +currentStation || '', id: +currentStation || '',
...@@ -231,8 +233,8 @@ const SiteManageV2 = () => { ...@@ -231,8 +233,8 @@ const SiteManageV2 = () => {
setdataList(lodash.cloneDeep([])); setdataList(lodash.cloneDeep([]));
} }
}); });
} };
//获取当前站点所有已经勾选的用户 // 获取当前站点所有已经勾选的用户
const getAllcheckList = async () => { const getAllcheckList = async () => {
let res = await getUserByStation({ let res = await getUserByStation({
stationID: currentStation, stationID: currentStation,
...@@ -264,19 +266,17 @@ const SiteManageV2 = () => { ...@@ -264,19 +266,17 @@ const SiteManageV2 = () => {
} }
}); });
setSelectList(lodash.cloneDeep(list)); setSelectList(lodash.cloneDeep(list));
setUpdatePageUser(updatePageUser + 1) setUpdatePageUser(updatePageUser + 1);
}
} }
};
//获取当前站点所有已经勾选的用户新接口 // 获取当前站点所有已经勾选的用户新接口
const getAllCheckListNew = () => { const getAllCheckListNew = () => {
getStationUsers({ getStationUsers({
stationId: currentStation stationId: currentStation,
}).then( }).then(res => {
res => { let list = [];
let list = []
if (res.data.length > 0) { if (res.data.length > 0) {
res.data.map((item, index) => { res.data.map((item, index) => {
list.push({ list.push({
GroupId: +item.OUID, GroupId: +item.OUID,
...@@ -284,55 +284,49 @@ const SiteManageV2 = () => { ...@@ -284,55 +284,49 @@ const SiteManageV2 = () => {
userName: item.userName, userName: item.userName,
userID: item.userID, userID: item.userID,
}); });
}) });
} }
setSelectList(lodash.cloneDeep(list)); setSelectList(lodash.cloneDeep(list));
setUpdatePageUser(updatePageUser + 1) setUpdatePageUser(updatePageUser + 1);
} });
) };
} // 选中某个站点
//选中某个站点
const onSelect = (props, e) => { const onSelect = (props, e) => {
console.log('props[0]', props[0]); console.log('props[0]', props[0]);
setCh(props[0]) setCh(props[0]);
if (!props[0]) { if (!props[0]) {
setCurrentStation(currentStation);
setCurrentStation(currentStation)
} else { } else {
setCurrentStation(props[0]); setCurrentStation(props[0]);
} }
setPage({ pageNum: 1, pageSize: 10 }); setPage({ pageNum: 1, pageSize: 10 });
console.log(data) console.log(data);
data.map((item, index) => { data.map((item, index) => {
if (item.id == props[0]) { if (item.id == props[0]) {
console.log(item.id) console.log(item.id);
console.log(item.describe) console.log(item.describe);
setDes(item.describe) setDes(item.describe);
}
})
} }
});
};
const getValue = () => { const getValue = () => {
getSiteTree({ selectNode: -1 }).then( getSiteTree({ selectNode: -1 }).then(res => {
res => { console.log(res.data);
console.log(res.data) getData1(res.data);
getData1(res.data) });
} };
)
}
const getData1 = e => { const getData1 = e => {
console.log(e) console.log(e);
e.map((i, j) => { e.map((i, j) => {
a.push(i) a.push(i);
if (i.children.length > 0) { if (i.children.length > 0) {
getData1(i.children) getData1(i.children);
}
})
console.log(a)
setData(a)
} }
});
console.log(a);
setData(a);
};
// 弹出模态框 // 弹出模态框
const handleShowModal = (key, value) => { const handleShowModal = (key, value) => {
...@@ -358,7 +352,7 @@ const SiteManageV2 = () => { ...@@ -358,7 +352,7 @@ const SiteManageV2 = () => {
const addChildModal = () => { const addChildModal = () => {
handleShowModal('addChildVisible', false); handleShowModal('addChildVisible', false);
setFlag(flag + 1); setFlag(flag + 1);
} };
const handleChangeCollpase = (groupId, isShow) => { const handleChangeCollpase = (groupId, isShow) => {
let index = dataList.findIndex(item => item.GroupId === groupId); let index = dataList.findIndex(item => item.GroupId === groupId);
...@@ -367,15 +361,13 @@ const SiteManageV2 = () => { ...@@ -367,15 +361,13 @@ const SiteManageV2 = () => {
return; return;
} }
handleShowModal('loading', true); handleShowModal('loading', true);
getStationUserList({ stationID: currentStation, groupId }).then( getStationUserList({ stationID: currentStation, groupId }).then(res => {
res => {
if (res.code === 0 && res.data) { if (res.code === 0 && res.data) {
handleShowModal('loading', false); handleShowModal('loading', false);
dataList[index].children = res.data; dataList[index].children = res.data;
setdataList(lodash.cloneDeep(dataList)); setdataList(lodash.cloneDeep(dataList));
} }
}, });
);
}; };
// 每组全选全不选 // 每组全选全不选
const handleChangeAll = (e, index) => { const handleChangeAll = (e, index) => {
...@@ -467,12 +459,10 @@ const SiteManageV2 = () => { ...@@ -467,12 +459,10 @@ const SiteManageV2 = () => {
message: '提示', message: '提示',
description: '请至少选择选择一个用户!', description: '请至少选择选择一个用户!',
}); });
chooseUserToStation( chooseUserToStation({
{
userList: String(result.flat()), userList: String(result.flat()),
stationID: currentStation, stationID: currentStation,
} })
)
.then(res => { .then(res => {
handleShowModal('btnLoading', false); handleShowModal('btnLoading', false);
...@@ -506,12 +496,12 @@ const SiteManageV2 = () => { ...@@ -506,12 +496,12 @@ const SiteManageV2 = () => {
// 机构操作 // 机构操作
const addTopStation = () => { const addTopStation = () => {
handleShowModal('modalVisible', true); handleShowModal('modalVisible', true);
} };
// 模糊查询匹配的样式 // 模糊查询匹配的样式
const searchStyle = val => { const searchStyle = val => {
console.log(showSearchStyle) console.log(showSearchStyle);
console.log(name) console.log(name);
let n; let n;
if (showSearchStyle) { if (showSearchStyle) {
n = val.replace( n = val.replace(
...@@ -521,7 +511,7 @@ const SiteManageV2 = () => { ...@@ -521,7 +511,7 @@ const SiteManageV2 = () => {
} else { } else {
n = val; n = val;
} }
console.log(n) console.log(n);
return <div dangerouslySetInnerHTML={{ __html: n }} />; return <div dangerouslySetInnerHTML={{ __html: n }} />;
}; };
...@@ -529,7 +519,6 @@ const SiteManageV2 = () => { ...@@ -529,7 +519,6 @@ const SiteManageV2 = () => {
let { index, GroupId, GroupName, Users, isChecked, isShow, color } = props; let { index, GroupId, GroupName, Users, isChecked, isShow, color } = props;
return ( return (
<div className={styles.sitePanel} key={GroupId} id={`siteId${GroupId}`}> <div className={styles.sitePanel} key={GroupId} id={`siteId${GroupId}`}>
{/* onClick={() => props.handleChangeCollpase(GroupId, isShow)} */} {/* onClick={() => props.handleChangeCollpase(GroupId, isShow)} */}
<div className={styles.sitePanelHead}> <div className={styles.sitePanelHead}>
{/* {isShow ? ( {/* {isShow ? (
...@@ -550,7 +539,6 @@ const SiteManageV2 = () => { ...@@ -550,7 +539,6 @@ const SiteManageV2 = () => {
</Checkbox> </Checkbox>
</div> </div>
<div className={styles.sitePanelCon}> <div className={styles.sitePanelCon}>
{Users.length > 0 && {Users.length > 0 &&
Users.map((v, vIndex) => ( Users.map((v, vIndex) => (
<CheckBoxRow <CheckBoxRow
...@@ -594,7 +582,11 @@ const SiteManageV2 = () => { ...@@ -594,7 +582,11 @@ const SiteManageV2 = () => {
autoExpandParent autoExpandParent
selectedKeys={[currentStation]} selectedKeys={[currentStation]}
onSelect={onSelect} 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))} treeData={treeData.map(t => mapTree(t))}
/> />
)} )}
...@@ -666,7 +658,6 @@ const SiteManageV2 = () => { ...@@ -666,7 +658,6 @@ const SiteManageV2 = () => {
/> />
</Col> </Col>
<Col span={3} /> <Col span={3} />
</Row> </Row>
</Card> </Card>
<div style={{ background: '#fff' }}> <div style={{ background: '#fff' }}>
...@@ -680,7 +671,6 @@ const SiteManageV2 = () => { ...@@ -680,7 +671,6 @@ const SiteManageV2 = () => {
{dataList.length > 0 && !visibleParams.loading ? ( {dataList.length > 0 && !visibleParams.loading ? (
<> <>
<p className={styles.siteline}>已选择列表:</p> <p className={styles.siteline}>已选择列表:</p>
<div className={styles.siteSelectList}> <div className={styles.siteSelectList}>
<ul className={styles.siteSelectUl}> <ul className={styles.siteSelectUl}>
...@@ -698,7 +688,7 @@ const SiteManageV2 = () => { ...@@ -698,7 +688,7 @@ const SiteManageV2 = () => {
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)} )}
<Spin spinning={visibleParams.loading} > <Spin spinning={visibleParams.loading}>
{dataList.map((item, index) => ( {dataList.map((item, index) => (
<Panels <Panels
{...item} {...item}
...@@ -721,8 +711,10 @@ const SiteManageV2 = () => { ...@@ -721,8 +711,10 @@ const SiteManageV2 = () => {
onChange={handleChangePage} onChange={handleChangePage}
pageSizeOptions={['10']} pageSizeOptions={['10']}
/> />
</div>) : '' </div>
} ) : (
''
)}
<div className={styles.siteBtn}> <div className={styles.siteBtn}>
<Button <Button
type="primary" type="primary"
...@@ -734,15 +726,11 @@ const SiteManageV2 = () => { ...@@ -734,15 +726,11 @@ const SiteManageV2 = () => {
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</PageContainer> </PageContainer>
) );
} };
const CheckBoxRow = React.memo(props => { const CheckBoxRow = React.memo(props => {
let { vIndex, index, isChecked, userName } = props; let { vIndex, index, isChecked, userName } = props;
......
import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index'; import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index';
//模板管理接口 // 模板管理接口
export const GetMessageTemplate = param => export const GetMessageTemplate = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetMessageTemplate`, param); get(`${PUBLISH_SERVICE}/MessageConfig/GetMessageTemplate`, param);
export const InsertMessageTemplate = param => export const InsertMessageTemplate = param =>
...@@ -11,7 +11,7 @@ export const DeleteMessageTemplate = param => ...@@ -11,7 +11,7 @@ export const DeleteMessageTemplate = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/DeleteMessageTemplate`, param); get(`${PUBLISH_SERVICE}/MessageConfig/DeleteMessageTemplate`, param);
export const GetThirdpartyTemplates = param => export const GetThirdpartyTemplates = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetThirdpartyTemplates`, param); get(`${PUBLISH_SERVICE}/MessageConfig/GetThirdpartyTemplates`, param);
//方案管理接口 // 方案管理接口
export const GetMessageConfigList = param => export const GetMessageConfigList = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetMessageConfigList`, param); get(`${PUBLISH_SERVICE}/MessageConfig/GetMessageConfigList`, param);
export const InsertMessageConfig = param => export const InsertMessageConfig = param =>
...@@ -25,14 +25,16 @@ export const GetMessageVersion = param => ...@@ -25,14 +25,16 @@ export const GetMessageVersion = param =>
export const GetMsgTypeList = param => export const GetMsgTypeList = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetMsgTypeList`, param); get(`${PUBLISH_SERVICE}/MessageConfig/GetMsgTypeList`, param);
export const TestPush = param => export const TestPush = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/TestPush`, param); post(`${PUBLISH_SERVICE}/MessageConfig/TestPush`, param);
export const AddIISAgentConfig = param => export const AddIISAgentConfig = param =>
post(`${PUBLISH_SERVICE}/MessageConfig/AddIISAgentConfig`, param); post(`${PUBLISH_SERVICE}/MessageConfig/AddIISAgentConfig`, param);
export const DeleteIISAgentConfig = param => export const DeleteIISAgentConfig = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/DeleteIISAgentConfig`, param); get(`${PUBLISH_SERVICE}/MessageConfig/DeleteIISAgentConfig`, param);
export const GetIISAgentConfig = param => export const GetIISAgentConfig = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetIISAgentConfig`, param); get(`${PUBLISH_SERVICE}/MessageConfig/GetIISAgentConfig`, param);
//组件接口 // 组件接口
export const RoleGroupList = param => export const RoleGroupList = param =>
get(`${PUBLISH_SERVICE}/UserCenter/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