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 [form] = Form.useForm();
const [loading, setLoading] = useState(false); // 加载 const [flag, setFlag] = useState(1);
const [form] = Form.useForm(); const [currentConfig, setCurrentConfig] = useState();
const [flag, setFlag] = useState(1)
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> >
</div> <img src={configuration} style={{ height: '16px' }} alt="" />
<Divider /> <span style={{ marginLeft: '10px', fontWeight: 'bold' }}>
<div className={styles.operate_container}> 服务管理
<Row gutter={[20, 25]} style={{display:'flex', alignItems:'center'}}> </span>
<Col span={2}> </div>
<div style={{display:'flex', justifyContent:'flex-end', marginRight:'-10px'}}>服务运行</div> <Divider />
</Col> <div className={styles.operate_container}>
<Col span={22}> <Row
{console.log(currentConfig)} gutter={[20, 25]}
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={currentConfig} onChange={OperateNginx} style={{marginLeft:'30px'}}/> style={{ display: 'flex', alignItems: 'center' }}
</Col> >
</Row> <Col span={2}>
<div
style={{
display: 'flex',
justifyContent: 'flex-end',
marginRight: '-10px',
}}
>
服务运行
</div> </div>
</Spin> </Col>
</Card> <Col span={22}>
</div> {console.log(currentConfig)}
) <Switch
} checkedChildren="开启"
export default GateConfig; unCheckedChildren="关闭"
\ No newline at end of file checked={currentConfig}
onChange={OperateNginx}
style={{ marginLeft: '30px' }}
/>
</Col>
</Row>
</div>
</Spin>
</Card>
</div>
);
};
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 (
<PageContainer>
} <Tabs onChange={callback} type="card">
<TabPane tab="基础配置" key="1">
return ( <BaseConfig />
<PageContainer> </TabPane>
<Tabs onChange={callback} type="card"> <TabPane tab="物联配置" key="2">
<TabPane tab="基础配置" key="1"> <IotConfig />
<BaseConfig/> </TabPane>
</TabPane> <TabPane tab="消息配置" key="3">
<TabPane tab="物联配置" key="2"> <MessageConfig />
<IotConfig/> </TabPane>
</TabPane> <TabPane tab="代理配置" key="4">
<TabPane tab="消息配置" key="3"> <ProxyConfig />
<MessageConfig/> </TabPane>
</TabPane> <TabPane tab="网关配置" key="5">
<TabPane tab="代理配置" key="4"> <GateConfig />
<ProxyConfig/> </TabPane>
</TabPane> </Tabs>
<TabPane tab="网关配置" key="5"> </PageContainer>
<GateConfig/> );
</TabPane> };
</Tabs> export default HostManager;
</PageContainer>
)
}
export default HostManager;
\ No newline at end of file
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 (
} <PageContainer>
<Tabs onChange={callback} type="card">
return ( <TabPane tab="推送方案配置" key="2">
<PageContainer> <ProjectManage />
<Tabs onChange={callback} type="card"> </TabPane>
<TabPane tab="推送方案配置" key="2"> <TabPane tab="推送模板配置" key="1">
<ProjectManage/> <TemplateManage />
</TabPane> </TabPane>
<TabPane tab="推送模板配置" key="1"> </Tabs>
<TemplateManage/> </PageContainer>
</TabPane> );
</Tabs> };
</PageContainer> export default HostManager;
)
}
export default HostManager;
\ No newline at end of file
...@@ -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 [previewVisible, setPreviewVisible] = useState(false);
const [loading, setLoading] = useState(false); const [selectRole, setSelectRole] = useState([]);
const [previewVisible, setPreviewVisible] = useState(false) const [dataTree, setDataTree] = useState([]);
const [selectRole, setSelectRole] = useState([]) const [dataLeafs, setDataLeafs] = useState([]);
const [dataTree, setDataTree] = useState([]) const [selectValues, setSelectValues] = useState([]);
const [dataLeafs, setDataLeafs] = useState([]) const { onSubmit, title, operate, initValues, selectValue } = props;
const [selectValues, setSelectValues] = useState([]) const [isUnmount, setIsUnmount] = useState(true);
const { onSubmit, title, operate, initValues, selectValue } = props
const [isUnmount, setIsUnmount] = useState(true) const GetRoleGroupList = () => {};
const GetRoleGroupList = () => { useEffect(() => {
// eslint-disable-next-line no-shadow
let isUnmount = false;
} console.log('selectValue', selectValue);
if (selectValue) {
useEffect(() => { setSelectRole(selectValue);
let isUnmount = false
console.log('selectValue', selectValue);
if (selectValue) {
setSelectRole(selectValue)
}
RoleGroupList().then(async res => {
let tree = []
let leafs = []
res.data && res.data.roleList.map((item, index) => {
tree.push({
name: item.visibleTitle,
id: index,
children: item.roleList.map((roleItem) => {
leafs.push({
name: roleItem.roleName,
id: roleItem.roleID,
})
const leafNode = {
name: roleItem.roleName,
id: roleItem.roleID,
children: []
}
return leafNode
})
})
})
if (!isUnmount) {
setDataTree(tree)
setDataLeafs(leafs)
return () => isUnmount = true;
}
}
)
}, [selectValue])
const handleCancel = () => {
setPreviewVisible(false)
} }
const handleOk = () => { RoleGroupList().then(async res => {
setPreviewVisible(false) let tree = [];
onSubmit && onSubmit(selectValues) 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 => {
leafs.push({
name: roleItem.roleName,
id: roleItem.roleID,
});
const leafNode = {
name: roleItem.roleName,
id: roleItem.roleID,
children: [],
};
return leafNode;
}),
});
});
if (!isUnmount) {
setDataTree(tree);
setDataLeafs(leafs);
// eslint-disable-next-line no-return-assign
return () => (isUnmount = true);
}
});
}, [selectValue]);
const handleCancel = () => {
setPreviewVisible(false);
};
const handleOk = () => {
setPreviewVisible(false);
// eslint-disable-next-line no-unused-expressions
onSubmit && onSubmit(selectValues);
};
const handleClick = () => {
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);
} }
const handleClick = () => { setSelectRole(strArr.toString());
setPreviewVisible(true) setSelectValues(value);
} };
const onChange2 = (value) => { return (
console.log(value) <div className={styles.role_container}>
const strArr = [] {operate ? (
for (const item of value) { <div onClick={handleClick}>{operate}</div>
strArr.push(item.name) ) : (
<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}`
: '关联角色'
} }
setSelectRole(strArr.toString()) bodyStyle={{ width: '100%', minHeight: '100px' }}
setSelectValues(value) style={{ top: 200, borderRadius: '20px' }}
} width="800px"
return ( destroyOnClose
cancelText="取消"
<div className={styles.role_container}> okText="确认"
{ onOk={() => handleOk()}
operate ? ( confirmLoading={loading}
<div onClick={handleClick}> visible={previewVisible}
{ onCancel={handleCancel}
operate >
} <div className={styles.list_card}>
</div> <ListCard
) : ( {...props}
<div style={{ display: "flex", flexDirection: "row", width: "100%" }}> onChange2={onChange2}
<Input disabled={true} value={selectRole} /> data={dataTree}
<div className={styles.select_btn} onClick={handleClick}>{title ? title : "选择角色"}</div> dataLeafs={dataLeafs}
</div> initValues={initValues}
) />
}
<SiteModal
{...props}
title={title && Object.prototype.toString.call(title) !== '[object Object]' ? `选择${title}` : "关联角色"}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 200, borderRadius: '20px' }}
width="800px"
destroyOnClose
cancelText="取消"
okText="确认"
onOk={() => handleOk()}
confirmLoading={loading}
visible={previewVisible}
onCancel={handleCancel}
>
<div className={styles.list_card}>
<ListCard {...props} onChange2={onChange2} data={dataTree} dataLeafs={dataLeafs} initValues={initValues} />
</div>
</SiteModal>
</div> </div>
) </SiteModal>
} </div>
);
};
const checkChildrenByCondition = ( const checkChildrenByCondition = (
item, item,
fn, fn,
withGroup = true, withGroup = true,
method = 'every', method = 'every',
) => { ) => {
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
return fn(item); return fn(item);
} }
const childrenResults = item.children[method](t => const childrenResults = item.children[method](t =>
checkChildrenByCondition(t, fn, withGroup, method), checkChildrenByCondition(t, fn, withGroup, method),
); );
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 [valueList, setValueList] = useState([]);
const [changedItem, setChangedItem] = useState({ item: {} }); const checkAll = e => {
const [valueList, setValueList] = useState([]); if (e.target.checked) {
const checkAll = e => { const result = data.map(item => getAllID(item)).flat(Infinity);
if (e.target.checked) { setValueList(result);
const result = data.map(item => getAllID(item)).flat(Infinity); // eslint-disable-next-line no-unused-expressions
setValueList(result); const fliterResult = filterChildren(result);
// eslint-disable-next-line no-unused-expressions const strArr = [];
const fliterResult = filterChildren(result) // eslint-disable-next-line no-restricted-syntax
const strArr = [] for (const item of fliterResult) {
for (const item of fliterResult) { strArr.push(item.name);
strArr.push(item.name) }
} // eslint-disable-next-line no-unused-expressions
onChange && onChange(strArr.toString()) onChange && onChange(strArr.toString());
onChange2 && onChange2(fliterResult) // eslint-disable-next-line no-unused-expressions
} else { onChange2 && onChange2(fliterResult);
setValueList([]); } else {
// eslint-disable-next-line no-unused-expressions setValueList([]);
const fliterResult = filterChildren(result) // eslint-disable-next-line no-unused-expressions
onChange && onChange(fliterResult) const fliterResult = filterChildren(result);
onChange2 && onChange2(fliterResult) // eslint-disable-next-line no-unused-expressions
} onChange && onChange(fliterResult);
}; // eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult);
const getAllID = item => {
let result = [];
const haveChildren =
Array.isArray(item.children) && item.children.length > 0;
// 统一使用 getId
result.push(getId(item));
if (haveChildren) {
// 每次递归result被置空,所以要另外保存
result = [...item.children.map(i => getAllID(i)), ...result];
}
return result;
};
const filterChildren = (select) => {
let selectLeafs = []
for (const leaf of dataLeafs) {
for (const id of select) {
if (id == leaf.id) {
selectLeafs.push(leaf)
}
}
}
return selectLeafs
} }
};
const updateValueList = (checkedKeys, childrenKeys, sourceItem) => {
const removekeys = _.difference(childrenKeys, checkedKeys); const getAllID = item => {
let result = _.uniq(_.union(checkedKeys, valueList)); let result = [];
_.remove(result, v => removekeys.includes(v)); const haveChildren =
setValueList(result); Array.isArray(item.children) && item.children.length > 0;
if (sourceItem) setChangedItem(sourceItem); // 统一使用 getId
// eslint-disable-next-line no-unused-expressions result.push(getId(item));
if (haveChildren) {
// 每次递归result被置空,所以要另外保存
// onChange && onChange(result); result = [...item.children.map(i => getAllID(i)), ...result];
// onChange2 && onChange2(result); }
const fliterResult = filterChildren(result) return result;
const strArr = [] };
for (const item of fliterResult) { const filterChildren = select => {
strArr.push(item.name) let selectLeafs = [];
for (const leaf of dataLeafs) {
for (const id of select) {
if (id == leaf.id) {
selectLeafs.push(leaf);
} }
onChange && onChange(strArr.toString()) }
onChange2 && onChange2(fliterResult)
} }
return selectLeafs;
useEffect(() => { };
initValues && setValueList(initValues)
}, []) const updateValueList = (checkedKeys, childrenKeys, sourceItem) => {
return ( const removekeys = _.difference(childrenKeys, checkedKeys);
<div> let result = _.uniq(_.union(checkedKeys, valueList));
<Checkbox onChange={checkAll}>全选/全不选</Checkbox> _.remove(result, v => removekeys.includes(v));
{ setValueList(result);
data.map((item, i) => { if (sourceItem) setChangedItem(sourceItem);
return <ListCardItem // eslint-disable-next-line no-unused-expressions
key={i}
item={item} // onChange && onChange(result);
updateValueList={updateValueList} // onChange2 && onChange2(result);
valueList={valueList} const fliterResult = filterChildren(result);
changedItem={changedItem} const strArr = [];
{...props} // eslint-disable-next-line no-restricted-syntax
/> for (const item of fliterResult) {
}) strArr.push(item.name);
} }
// eslint-disable-next-line no-unused-expressions
onChange && onChange(strArr.toString());
</div> // eslint-disable-next-line no-unused-expressions
) onChange2 && onChange2(fliterResult);
} };
useEffect(() => {
// eslint-disable-next-line no-unused-expressions
initValues && setValueList(initValues);
}, []);
return (
<div>
<Checkbox onChange={checkAll}>全选/全不选</Checkbox>
{data.map((item, i) => (
<ListCardItem
key={i}
item={item}
updateValueList={updateValueList}
valueList={valueList}
changedItem={changedItem}
{...props}
/>
))}
</div>
);
};
const ListCardItem = props => { const ListCardItem = props => {
const { const { item, valueList, updateValueList, changedItem } = props;
item, const { id } = item;
valueList, // 当前组件是否是分组id
updateValueList, const isGroup = item.children && item.children.length > 0;
changedItem const [indeterminate, setIndeterminate] = useState(!isGroup);
} = props; const [childrenKeys, setChildrenKeys] = useState([]);
const id = item.id;
// 当前组件是否是分组id useEffect(() => {
const isGroup = item.children && item.children.length > 0; if (isGroup) {
const [indeterminate, setIndeterminate] = useState(!isGroup); const keys = item.children
const [childrenKeys, setChildrenKeys] = useState([]); .map(child => checkChildrenByCondition(child, c => c.id, true, 'map'))
.flat(Infinity);
useEffect(() => { setChildrenKeys(keys);
if (isGroup) { } else {
const keys = item.children //
.map(child =>
checkChildrenByCondition(child, c => c.id, true, 'map'),
)
.flat(Infinity);
setChildrenKeys(keys);
} else {
//
}
}, [item]);
useEffect(() => {
// 子节点勾选状态变化时
if (
isGroup &&
changedItem.item !== item &&
!checkIsGroup(changedItem.item) &&
childrenKeys.includes(getId(changedItem.item))
) {
if (changedItem.value && childrenKeys.every(c => valueList.includes(c))) {
// 全选
updateValueList([id], [id]);
setIndeterminate(false);
} else if (childrenKeys.some(c => valueList.includes(c))) {
// 半选
// eslint-disable-next-line no-unused-expressions
valueList.includes(id) && updateValueList([], [id]);
setIndeterminate(true);
} else {
// 零选
// eslint-disable-next-line no-unused-expressions
valueList.includes(id) && updateValueList([], [id]);
setIndeterminate(false);
}
}
}, [changedItem.item, changedItem.value]);
const handleChecked = e => {
const { checked: v } = e.target;
if (isGroup) {
const result = [...childrenKeys, id];
updateValueList(v ? result : [], result, { item, value: v });
setIndeterminate(false);
} else {
updateValueList(v ? [id] : [], [id], { item, value: v });
}
} }
const renderChild = () => }, [item]);
item.children &&
item.children.map((c, i) => ( useEffect(() => {
<ListCardItem // 子节点勾选状态变化时
item={c} if (
key={`item${i}key`} isGroup &&
updateValueList={updateValueList} changedItem.item !== item &&
valueList={valueList} !checkIsGroup(changedItem.item) &&
changedItem={changedItem} childrenKeys.includes(getId(changedItem.item))
/> ) {
)); if (changedItem.value && childrenKeys.every(c => valueList.includes(c))) {
return ( // 全选
<div className={classnames({ updateValueList([id], [id]);
[styles.divBox]: isGroup, setIndeterminate(false);
[styles.divSingle]: !isGroup, } else if (childrenKeys.some(c => valueList.includes(c))) {
})}> // 半选
<div className={styles.topCheckbox}> // eslint-disable-next-line no-unused-expressions
<Checkbox valueList.includes(id) && updateValueList([], [id]);
indeterminate={isGroup ? indeterminate : false} setIndeterminate(true);
checked={valueList.includes(id)} } else {
onChange={handleChecked} > // 零选
{item.name} // eslint-disable-next-line no-unused-expressions
</Checkbox> valueList.includes(id) && updateValueList([], [id]);
<div style={{ width: '100%' }} className={styles.checkdiv}> setIndeterminate(false);
{ }
renderChild() }
} }, [changedItem.item, changedItem.value]);
</div>
const handleChecked = e => {
</div> const { checked: v } = e.target;
if (isGroup) {
const result = [...childrenKeys, id];
updateValueList(v ? result : [], result, { item, value: v });
setIndeterminate(false);
} else {
updateValueList(v ? [id] : [], [id], { item, value: v });
}
};
const renderChild = () =>
item.children &&
item.children.map((c, i) => (
<ListCardItem
item={c}
key={`item${i}key`}
updateValueList={updateValueList}
valueList={valueList}
changedItem={changedItem}
/>
));
return (
<div
className={classnames({
[styles.divBox]: isGroup,
[styles.divSingle]: !isGroup,
})}
>
<div className={styles.topCheckbox}>
<Checkbox
indeterminate={isGroup ? indeterminate : false}
checked={valueList.includes(id)}
onChange={handleChecked}
>
{item.name}
</Checkbox>
<div style={{ width: '100%' }} className={styles.checkdiv}>
{renderChild()}
</div> </div>
) </div>
} </div>
export default VisibleRoleModal );
\ No newline at end of file };
export default VisibleRoleModal;
...@@ -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,
Space, Space,
message, message,
Modal, Modal,
Input, Input,
notification, notification,
Tooltip, Tooltip,
Card, Card,
Button, Button,
Spin, Spin,
Dropdown, Dropdown,
Menu, Menu,
Row, Row,
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,
UsergroupAddOutlined, UsergroupAddOutlined,
EditOutlined, EditOutlined,
FormOutlined, FormOutlined,
DeleteOutlined, DeleteOutlined,
DoubleLeftOutlined, DoubleLeftOutlined,
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,20 +40,20 @@ import Tree from '@/components/ExpendableTree'; ...@@ -40,20 +40,20 @@ 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 {
getWebModuleTree, getWebModuleTree,
chooseUserToStation, chooseUserToStation,
getAllGroup, getAllGroup,
getUserByStation, getUserByStation,
getStationUserList, getStationUserList,
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,699 +61,687 @@ import AddChildModal from '../siteManage/AddChildModal'; ...@@ -61,699 +61,687 @@ 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 [treeVisible, setTreeVisible] = useState(true); // 树是否可见
const [treeData, setTreeData] = useState([]); // 用户站点树
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式 const [treeDataCopy, setTreeDataCopy] = useState([]); // 机构树数据备份,用于更改机构
const [treeVisible, setTreeVisible] = useState(true); // 树是否可见 const [treeState, setTreeState] = useState(true); // 树第一次加载
const [treeData, setTreeData] = useState([]); // 用户站点树 const [treeLoading, setTreeLoading] = useState(false);
const [treeDataCopy, setTreeDataCopy] = useState([]); // 机构树数据备份,用于更改机构 const [currentStation, setCurrentStation] = useState(''); // 当前选中站点
const [treeState, setTreeState] = useState(true); // 树第一次加载 const [currentStationMsg, setCurrentStationMsg] = useState({}); // 当前编辑节点信息
const [treeLoading, setTreeLoading] = useState(false); const [currentStationOperate, setCurrentStationOperate] = useState(false);
const [currentStation, setCurrentStation] = useState(''); // 当前选中站点 const [flag, setFlag] = useState(1); // 操作标致触发界面刷新
const [currentStationMsg, setCurrentStationMsg] = useState({}); //当前编辑节点信息 const [dataList, setdataList] = useState([]); // 当前站点对应的分页用户列表
const [currentStationOperate, setCurrentStationOperate] = useState(false) const [visibleParams, setvisibleParams] = useState({
const [flag, setFlag] = useState(1);//操作标致触发界面刷新 modalVisible: false, // 新增弹窗
const [dataList, setdataList] = useState([]);//当前站点对应的分页用户列表 delVisible: false, // 删除弹窗
const [visibleParams, setvisibleParams] = useState({ editVisible: false, // 修改弹窗
modalVisible: false, // 新增弹窗 spinLoading: false, // 加载弹窗
delVisible: false, // 删除弹窗 btnLoading: false,
editVisible: false, // 修改弹窗 loading: false,
spinLoading: false, // 加载弹窗 checkBoxLoading: false,
btnLoading: false, });
loading: false, const [total, setTotal] = useState(0); // 分页总数
checkBoxLoading: false, const [page, setPage] = useState({ pageNum: 1, pageSize: 10 });
}); const [selectList, setSelectList] = useState([]); // 选择列表数据
const [total, setTotal] = useState(0); // 分页总数 const [updatePageUser, setUpdatePageUser] = useState(1); //
const [page, setPage] = useState({ pageNum: 1, pageSize: 10 }); const [updateCheck, setUpdateCheck] = useState(1);
const [selectList, setSelectList] = useState([]); // 选择列表数据 const [name, setName] = useState('');
const [updatePageUser, setUpdatePageUser] = useState(1);// const [des, setDes] = useState('');
const [updateCheck, setUpdateCheck] = useState(1); const [data, setData] = useState('');
const [name, setName] = useState(''); const [ch, setCh] = useState('');
const [des, setDes] = useState('')
const [data, setData] = useState('') let a = [];
const [ch, setCh] = useState('')
// 渲染机构树
let a = [] const mapTree = org => {
const haveChildren = Array.isArray(org.children) && org.children.length > 0;
// 渲染机构树 return {
const mapTree = org => { title: (
const haveChildren = Array.isArray(org.children) && org.children.length > 0; <div className={styles.title}>
return { <div className={styles.titleText}>{org.text}</div>
title: ( <div className={styles.tip}>
<div className={styles.title}> <Tooltip title="添加下级站点" className={styles.fs}>
<div className={styles.titleText}>{org.text}</div> <PlusSquareOutlined
<div className={styles.tip}> style={{ fontSize: '16px', color: '#1890FF' }}
<Tooltip title="添加下级站点" className={styles.fs}> 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
</Tooltip> style={{ fontSize: '16px', color: '#1890FF' }}
<Tooltip title="删除当前站点" className={styles.fs}> onClick={e => editorSite(e, org)}
<DeleteOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e => delSite(e, org)} /> />
</Tooltip> </Tooltip>
</div> <Tooltip title="删除当前站点" className={styles.fs}>
</div> <DeleteOutlined
), style={{ fontSize: '16px', color: '#1890FF' }}
key: org.id, onClick={e => delSite(e, org)}
// icon: <UserOutlined style={{ display: 'inline' }} />, />
// 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作 </Tooltip>
children: haveChildren ? org.children.map(i => mapTree(i)) : [], </div>
}; </div>
}; ),
//添加下级站点 key: org.id,
const addSite = (e, recode) => { // icon: <UserOutlined style={{ display: 'inline' }} />,
e.stopPropagation(); // 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
setCurrentStation(recode.id); children: haveChildren ? org.children.map(i => mapTree(i)) : [],
handleShowModal('addChildVisible', true);
}
//删除当前站点
const delSite = (e, recode) => {
e.stopPropagation();
setCurrentStation(recode.id);
handleShowModal('delVisible', true);
}
//编辑当前站点
const editorSite = (e, recode) => {
e.stopPropagation();
// console.log(recode);
// 保存编辑回显信息
setCurrentStationMsg(recode);
// setCurrentStation(recode.id);
handleShowModal('editVisible', true);
}
// 重新渲染树
const updateTrees = () => {
setTreeLoading(true);
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);//待会儿要改
setTreeState(false);
}
} else {
setTreeLoading(false);
notification.error({
message: '获取失败',
description: res.message,
});
}
}
)
}; };
};
// 获取用户机构树 // 添加下级站点
useEffect(() => { const addSite = (e, recode) => {
updateTrees(); e.stopPropagation();
}, [flag]); setCurrentStation(recode.id);
handleShowModal('addChildVisible', true);
useEffect(() => { };
getValue() // 删除当前站点
}, []) const delSite = (e, recode) => {
e.stopPropagation();
//切换站点,点击分页按钮,提交 setCurrentStation(recode.id);
useEffect(() => { handleShowModal('delVisible', true);
if (!currentStation) return; };
getList(); // 编辑当前站点
setShowSearchStyle(false); const editorSite = (e, recode) => {
}, [updatePageUser, name]); e.stopPropagation();
//切换站点,提交时触发已勾选列表更新 // console.log(recode);
useEffect(() => { // 保存编辑回显信息
if (!currentStation) return; setCurrentStationMsg(recode);
//getAllcheckList(); // setCurrentStation(recode.id);
getAllCheckListNew() handleShowModal('editVisible', true);
}, [currentStation, updateCheck]); };
// 重新渲染树
//获取当前站点可编辑用户(已勾选和未勾选)分页展示 const updateTrees = () => {
const getList = () => { setTreeLoading(true);
let params = { getSiteTree({ selectNode: -1 }).then(res => {
id: +currentStation || '', if (res.data.length > 0) {
PageIndex: +page.pageNum, setTreeLoading(false);
PageSize: +page.pageSize, setTreeData(res.data);
}; setTreeDataCopy(res.data);
if (name) params = { ...params, name }; // 第一次加载,默认选择第一个组织
groupUserPagingList(params).then(res => { if (treeState) {
if (res.code === 0 && res.data) { onSelect([res.data[0].id], false); // 待会儿要改
setShowSearchStyle(true); setTreeState(false);
let { list } = res.data; }
// 还原选择的数据 } else {
if (selectList.length > 0) { setTreeLoading(false);
selectList.forEach(item => { notification.error({
list.forEach((value, index) => { message: '获取失败',
if (item.GroupId === value.GroupId) { description: res.message,
list[index].Users.forEach((user, userIndex) => {
if (user.userID === item.userID) {
list[index].Users[userIndex].isChecked = true;
}
});
let checkedLen = list[index].Users.filter(v => v.isChecked)
.length;
if (checkedLen === list[index].Users.length) {
list[index].isChecked = true;
}
}
});
});
}
handleShowModal('loading', false);
setdataList(lodash.cloneDeep(list));
setTotal(res.data.TotalCount);
} else {
handleShowModal('loading', false);
setdataList(lodash.cloneDeep([]));
}
});
}
//获取当前站点所有已经勾选的用户
const getAllcheckList = async () => {
let res = await getUserByStation({
stationID: currentStation,
_version: 9999,
_dc: new Date().getTime(),
}); });
if (res.length > 0) { }
// 还原从后台返回的数据 选中的列表 });
let list = []; };
// console.log(res);
res.forEach(item => { // 获取用户机构树
if (item.userList.length > 0) { useEffect(() => {
item.userList.forEach(value => { updateTrees();
// console.log(value); }, [flag]);
if (
value.isChecked && useEffect(() => {
list.findIndex( getValue();
v => +v.GroupId === +item.OUID && +v.userID === +value.userID, }, []);
) === -1
) { // 切换站点,点击分页按钮,提交
list.push({ useEffect(() => {
GroupId: +item.OUID, if (!currentStation) return;
GroupName: item.OUName, getList();
userName: value.userName, setShowSearchStyle(false);
userID: value.userID, }, [updatePageUser, name]);
}); // 切换站点,提交时触发已勾选列表更新
} useEffect(() => {
}); if (!currentStation) return;
// getAllcheckList();
getAllCheckListNew();
}, [currentStation, updateCheck]);
// 获取当前站点可编辑用户(已勾选和未勾选)分页展示
const getList = () => {
let params = {
id: +currentStation || '',
PageIndex: +page.pageNum,
PageSize: +page.pageSize,
};
if (name) params = { ...params, name };
groupUserPagingList(params).then(res => {
if (res.code === 0 && res.data) {
setShowSearchStyle(true);
let { list } = res.data;
// 还原选择的数据
if (selectList.length > 0) {
selectList.forEach(item => {
list.forEach((value, index) => {
if (item.GroupId === value.GroupId) {
list[index].Users.forEach((user, userIndex) => {
if (user.userID === item.userID) {
list[index].Users[userIndex].isChecked = true;
}
});
let checkedLen = list[index].Users.filter(v => v.isChecked)
.length;
if (checkedLen === list[index].Users.length) {
list[index].isChecked = true;
} }
}
}); });
setSelectList(lodash.cloneDeep(list)); });
setUpdatePageUser(updatePageUser + 1)
} }
} handleShowModal('loading', false);
setdataList(lodash.cloneDeep(list));
//获取当前站点所有已经勾选的用户新接口 setTotal(res.data.TotalCount);
const getAllCheckListNew = () => { } else {
getStationUsers({ handleShowModal('loading', false);
stationId: currentStation setdataList(lodash.cloneDeep([]));
}).then( }
res => { });
let list = [] };
if (res.data.length > 0) { // 获取当前站点所有已经勾选的用户
const getAllcheckList = async () => {
res.data.map((item, index) => { let res = await getUserByStation({
list.push({ stationID: currentStation,
GroupId: +item.OUID, _version: 9999,
GroupName: item.OUName, _dc: new Date().getTime(),
userName: item.userName, });
userID: item.userID, if (res.length > 0) {
}); // 还原从后台返回的数据 选中的列表
}) let list = [];
// console.log(res);
} res.forEach(item => {
setSelectList(lodash.cloneDeep(list)); if (item.userList.length > 0) {
setUpdatePageUser(updatePageUser + 1) item.userList.forEach(value => {
// console.log(value);
if (
value.isChecked &&
list.findIndex(
v => +v.GroupId === +item.OUID && +v.userID === +value.userID,
) === -1
) {
list.push({
GroupId: +item.OUID,
GroupName: item.OUName,
userName: value.userName,
userID: value.userID,
});
} }
) });
}
//选中某个站点
const onSelect = (props, e) => {
console.log('props[0]', props[0]);
setCh(props[0])
if (!props[0]) {
setCurrentStation(currentStation)
} else {
setCurrentStation(props[0]);
} }
setPage({ pageNum: 1, pageSize: 10 }); });
console.log(data) setSelectList(lodash.cloneDeep(list));
data.map((item, index) => { setUpdatePageUser(updatePageUser + 1);
if (item.id == props[0]) {
console.log(item.id)
console.log(item.describe)
setDes(item.describe)
}
})
} }
};
const getValue = () => {
getSiteTree({ selectNode: -1 }).then( // 获取当前站点所有已经勾选的用户新接口
res => { const getAllCheckListNew = () => {
console.log(res.data) getStationUsers({
getData1(res.data) stationId: currentStation,
} }).then(res => {
) let list = [];
} if (res.data.length > 0) {
const getData1 = e => { res.data.map((item, index) => {
console.log(e) list.push({
e.map((i, j) => { GroupId: +item.OUID,
a.push(i) GroupName: item.OUName,
if (i.children.length > 0) { userName: item.userName,
getData1(i.children) userID: item.userID,
} });
}) });
console.log(a) }
setData(a) setSelectList(lodash.cloneDeep(list));
setUpdatePageUser(updatePageUser + 1);
});
};
// 选中某个站点
const onSelect = (props, e) => {
console.log('props[0]', props[0]);
setCh(props[0]);
if (!props[0]) {
setCurrentStation(currentStation);
} else {
setCurrentStation(props[0]);
} }
setPage({ pageNum: 1, pageSize: 10 });
console.log(data);
data.map((item, index) => {
if (item.id == props[0]) {
console.log(item.id);
console.log(item.describe);
setDes(item.describe);
}
});
};
// 弹出模态框 const getValue = () => {
const handleShowModal = (key, value) => { getSiteTree({ selectNode: -1 }).then(res => {
setvisibleParams({ ...visibleParams, [key]: value }); console.log(res.data);
}; getData1(res.data);
// 获取搜索框的值 });
const handleSearch = value => { };
setName(value); const getData1 = e => {
getList(value); console.log(e);
}; e.map((i, j) => {
const confirmModal = e => { a.push(i);
handleShowModal('modalVisible', false); if (i.children.length > 0) {
setFlag(flag + 1); getData1(i.children);
}; }
const delModal = () => { });
handleShowModal('delVisible', false); console.log(a);
setFlag(flag + 1); setData(a);
}; };
const editModal = () => {
handleShowModal('editVisible', false); // 弹出模态框
setFlag(flag + 1); const handleShowModal = (key, value) => {
}; setvisibleParams({ ...visibleParams, [key]: value });
const addChildModal = () => { };
handleShowModal('addChildVisible', false); // 获取搜索框的值
setFlag(flag + 1); const handleSearch = value => {
setName(value);
getList(value);
};
const confirmModal = e => {
handleShowModal('modalVisible', false);
setFlag(flag + 1);
};
const delModal = () => {
handleShowModal('delVisible', false);
setFlag(flag + 1);
};
const editModal = () => {
handleShowModal('editVisible', false);
setFlag(flag + 1);
};
const addChildModal = () => {
handleShowModal('addChildVisible', false);
setFlag(flag + 1);
};
const handleChangeCollpase = (groupId, isShow) => {
let index = dataList.findIndex(item => item.GroupId === groupId);
if (dataList[index].children && dataList[index].children.length > 0) {
setdataList(lodash.cloneDeep(dataList));
return;
} }
handleShowModal('loading', true);
const handleChangeCollpase = (groupId, isShow) => { getStationUserList({ stationID: currentStation, groupId }).then(res => {
let index = dataList.findIndex(item => item.GroupId === groupId); if (res.code === 0 && res.data) {
if (dataList[index].children && dataList[index].children.length > 0) { handleShowModal('loading', false);
setdataList(lodash.cloneDeep(dataList)); dataList[index].children = res.data;
return;
}
handleShowModal('loading', true);
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) => {
dataList[index].isChecked = e.target.checked;
dataList[index].Users.forEach(item => {
item.isChecked = e.target.checked;
let delIndex = selectList.findIndex(
v => v.GroupId === dataList[index].GroupId && v.userID === item.userID,
);
if (e.target.checked) {
if (delIndex === -1) {
selectList.push({
GroupId: dataList[index].GroupId,
GroupName: dataList[index].GroupName,
userName: item.userName,
userID: item.userID,
});
}
}
if (!e.target.checked) {
selectList.splice(delIndex, 1);
}
});
setSelectList(lodash.cloneDeep(selectList));
setdataList(lodash.cloneDeep(dataList)); setdataList(lodash.cloneDeep(dataList));
}; }
// 单个选择checkbox });
const handleChangeSignel = (e, index, vIndex) => { };
dataList[index].Users[vIndex].isChecked = e.target.checked; // 每组全选全不选
let checked = isAllChecked(index); const handleChangeAll = (e, index) => {
let hasIndex = selectList.findIndex( dataList[index].isChecked = e.target.checked;
item => dataList[index].Users.forEach(item => {
item.userID === dataList[index].Users[vIndex].userID && item.isChecked = e.target.checked;
item.GroupId === dataList[index].GroupId, let delIndex = selectList.findIndex(
); v => v.GroupId === dataList[index].GroupId && v.userID === item.userID,
dataList[index].isChecked = checked; );
if (e.target.checked && hasIndex === -1) { if (e.target.checked) {
selectList.push({ if (delIndex === -1) {
GroupId: dataList[index].GroupId, selectList.push({
GroupName: dataList[index].GroupName, GroupId: dataList[index].GroupId,
userName: dataList[index].Users[vIndex].userName, GroupName: dataList[index].GroupName,
userID: dataList[index].Users[vIndex].userID, userName: item.userName,
}); userID: item.userID,
} else { });
selectList.splice(hasIndex, 1);
}
setdataList(lodash.cloneDeep(dataList));
};
const isAllChecked = index =>
dataList[index].Users.filter(item => item.isChecked).length ===
dataList[index].Users.length;
// 删除已选列表
const handleDel = index => {
let { GroupId, userID } = selectList[index];
let outerIndex = dataList.findIndex(item => item.GroupId === GroupId);
if (outerIndex > -1) {
let innerIndex = dataList[outerIndex].Users.findIndex(
item => item.userID === userID,
);
dataList[outerIndex].Users[innerIndex].isChecked = false;
dataList[outerIndex].isChecked = isAllChecked(outerIndex);
} }
selectList.splice(index, 1); }
setSelectList(lodash.cloneDeep(selectList)); if (!e.target.checked) {
setdataList(lodash.cloneDeep(dataList)); selectList.splice(delIndex, 1);
}; }
// 提交 });
const handleCommitBtn = () => {
handleShowModal('btnLoading', true);
let result = [];
let obj = {};
selectList.forEach(item => {
if (obj[item.GroupId]) {
obj[item.GroupId].push(item.userID);
} else {
obj[item.GroupId] = [item.userID];
}
});
// dataList.forEach(item => {
// if (obj[item.GroupId] && item.Users.length === obj[item.GroupId].length) {
// obj[item.GroupId].push(item.GroupId);
// }
// });
result = Object.values(obj);
// 数据处理成后台需要的格式
if (result.length === 0)
return notification.warning({
message: '提示',
description: '请至少选择选择一个用户!',
});
chooseUserToStation(
{
userList: String(result.flat()),
stationID: currentStation,
}
)
.then(res => {
handleShowModal('btnLoading', false);
if (res.code === 0) { setSelectList(lodash.cloneDeep(selectList));
setSelectList([]); setdataList(lodash.cloneDeep(dataList));
setUpdateCheck(updateCheck + 1); };
notification.success({ // 单个选择checkbox
message: '提示', const handleChangeSignel = (e, index, vIndex) => {
duration: 3, dataList[index].Users[vIndex].isChecked = e.target.checked;
description: '设置成功', let checked = isAllChecked(index);
}); let hasIndex = selectList.findIndex(
} else { item =>
notification.error({ item.userID === dataList[index].Users[vIndex].userID &&
message: '提示', item.GroupId === dataList[index].GroupId,
duration: 15, );
description: res.message, dataList[index].isChecked = checked;
}); if (e.target.checked && hasIndex === -1) {
} selectList.push({
}) GroupId: dataList[index].GroupId,
.catch(err => { GroupName: dataList[index].GroupName,
handleShowModal('btnLoading', false); userName: dataList[index].Users[vIndex].userName,
console.log(err); userID: dataList[index].Users[vIndex].userID,
}); });
}; } else {
// 分页 selectList.splice(hasIndex, 1);
const handleChangePage = (pageNum, pageSize) => {
setPage({ pageNum, pageSize });
setUpdatePageUser(updatePageUser + 1);
};
/** ***操作按钮**** */
// 机构操作
const addTopStation = () => {
handleShowModal('modalVisible', true);
} }
setdataList(lodash.cloneDeep(dataList));
// 模糊查询匹配的样式 };
const searchStyle = val => { const isAllChecked = index =>
console.log(showSearchStyle) dataList[index].Users.filter(item => item.isChecked).length ===
console.log(name) dataList[index].Users.length;
let n; // 删除已选列表
if (showSearchStyle) { const handleDel = index => {
n = val.replace( let { GroupId, userID } = selectList[index];
new RegExp(name, 'g'), let outerIndex = dataList.findIndex(item => item.GroupId === GroupId);
`<span style='color:red'>${name}</span>`, if (outerIndex > -1) {
); let innerIndex = dataList[outerIndex].Users.findIndex(
item => item.userID === userID,
);
dataList[outerIndex].Users[innerIndex].isChecked = false;
dataList[outerIndex].isChecked = isAllChecked(outerIndex);
}
selectList.splice(index, 1);
setSelectList(lodash.cloneDeep(selectList));
setdataList(lodash.cloneDeep(dataList));
};
// 提交
const handleCommitBtn = () => {
handleShowModal('btnLoading', true);
let result = [];
let obj = {};
selectList.forEach(item => {
if (obj[item.GroupId]) {
obj[item.GroupId].push(item.userID);
} else {
obj[item.GroupId] = [item.userID];
}
});
// dataList.forEach(item => {
// if (obj[item.GroupId] && item.Users.length === obj[item.GroupId].length) {
// obj[item.GroupId].push(item.GroupId);
// }
// });
result = Object.values(obj);
// 数据处理成后台需要的格式
if (result.length === 0)
return notification.warning({
message: '提示',
description: '请至少选择选择一个用户!',
});
chooseUserToStation({
userList: String(result.flat()),
stationID: currentStation,
})
.then(res => {
handleShowModal('btnLoading', false);
if (res.code === 0) {
setSelectList([]);
setUpdateCheck(updateCheck + 1);
notification.success({
message: '提示',
duration: 3,
description: '设置成功',
});
} else { } else {
n = val; notification.error({
message: '提示',
duration: 15,
description: res.message,
});
} }
console.log(n) })
return <div dangerouslySetInnerHTML={{ __html: n }} />; .catch(err => {
}; handleShowModal('btnLoading', false);
console.log(err);
});
};
// 分页
const handleChangePage = (pageNum, pageSize) => {
setPage({ pageNum, pageSize });
setUpdatePageUser(updatePageUser + 1);
};
/** ***操作按钮**** */
// 机构操作
const addTopStation = () => {
handleShowModal('modalVisible', true);
};
// 模糊查询匹配的样式
const searchStyle = val => {
console.log(showSearchStyle);
console.log(name);
let n;
if (showSearchStyle) {
n = val.replace(
new RegExp(name, 'g'),
`<span style='color:red'>${name}</span>`,
);
} else {
n = val;
}
console.log(n);
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
const Panels = React.memo(props => { const Panels = React.memo(props => {
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 ? (
<UpOutlined className={styles.siteIcon} /> <UpOutlined className={styles.siteIcon} />
) : ( ) : (
<DownOutlined className={styles.siteIcon} /> <DownOutlined className={styles.siteIcon} />
)} */} )} */}
{/* <UpOutlined className={styles.siteIcon} /> */} {/* <UpOutlined className={styles.siteIcon} /> */}
<ApartmentOutlined className={styles.siteIcon} /> <ApartmentOutlined className={styles.siteIcon} />
{searchStyle(GroupName)} {searchStyle(GroupName)}
<Checkbox <Checkbox
key="0" key="0"
className={styles.siteListTitle} className={styles.siteListTitle}
checked={isChecked} checked={isChecked}
onClick={e => props.handleChangeAll(e, index)} onClick={e => props.handleChangeAll(e, index)}
> >
全选 全选
</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 {...v}
{...v} index={index}
index={index} vIndex={vIndex}
vIndex={vIndex} key={v.userID}
key={v.userID} handleChangeSignel={props.handleChangeSignel}
handleChangeSignel={props.handleChangeSignel} />
/> ))}
</div>
</div>
);
});
return (
<PageContainer className={styles.siteManageContainer}>
<div className={styles.contentContainer}>
<Card
className={classnames({
[styles.orgContainer]: true,
[styles.orgContainerHide]: !treeVisible,
})}
>
<span style={{ margin: '0 180px 0 10px' }}>站点列表</span>
<Tooltip title="添加顶级站点">
<PlusOutlined
onClick={() => addTopStation()}
style={{
color: '#1890FF',
fontSize: '18px',
verticalAlign: '0.04em',
}}
/>
</Tooltip>
{treeData.length > 0 && (
<Tree
showIcon="true"
showLine={{ showLeafIcon: false }}
blockNode
autoExpandParent
selectedKeys={[currentStation]}
onSelect={onSelect}
height={
treeData.length && treeData.length > 30
? treeData.length * 14
: 780
}
treeData={treeData.map(t => mapTree(t))}
/>
)}
<div className={styles.switcher}>
{treeVisible && (
<Tooltip title="隐藏站点列表">
<DoubleLeftOutlined onClick={() => setTreeVisible(false)} />
</Tooltip>
)}
{!treeVisible && (
<Tooltip title="显示站点列表">
<DoubleRightOutlined onClick={() => setTreeVisible(true)} />
</Tooltip>
)}
</div>
</Card>
{/* 右侧用户表 */}
<div
className={classnames({
[styles.userContainer]: true,
[styles.userContainerHide]: !treeVisible,
})}
>
<AddModal
visible={visibleParams.modalVisible}
onCancel={() => handleShowModal('modalVisible', false)}
confirmModal={confirmModal}
/>
<AddChildModal
visible={visibleParams.addChildVisible}
pid={currentStation}
onCancel={() => handleShowModal('addChildVisible', false)}
confirmModal={addChildModal}
/>
<DelModal
visible={visibleParams.delVisible}
stationId={currentStation}
onCancel={() => handleShowModal('delVisible', false)}
confirmModal={delModal}
/>
<EditModal
visible={visibleParams.editVisible}
stationObj={currentStationMsg}
des={des}
onCancel={() => handleShowModal('editVisible', false)}
confirmModal={editModal}
/>
<div
className={classnames({
[styles.boxR]: true,
[styles.boxH]: treeVisible,
})}
>
<Card
className={classnames({
[styles.cardBoxTop]: true,
[styles.boxH]: treeVisible,
})}
>
<Row align="middle">
<Col span={1}>搜索</Col>
<Col span={8}>
<Search
allowClear
placeholder={placeholder}
onSearch={handleSearch}
// onChange={handleChange}
enterButton
/>
</Col>
<Col span={3} />
</Row>
</Card>
<div style={{ background: '#fff' }}>
<Card
className={classnames({
[styles.boxH]: treeVisible,
[styles.cardBoxR]: true,
})}
>
{/* <Checkbox className={styles.siteAll}>全选/反选</Checkbox> */}
{dataList.length > 0 && !visibleParams.loading ? (
<>
<p className={styles.siteline}>已选择列表:</p>
<div className={styles.siteSelectList}>
<ul className={styles.siteSelectUl}>
{selectList.map((item, index) => (
<li
key={`${item.userName}${item.GroupId}${index}`}
onClick={() => handleDel(index)}
>
{`${item.userName}(${item.GroupName})`}
</li>
))} ))}
</div> </ul>
</div>
);
});
return (
<PageContainer className={styles.siteManageContainer}>
<div className={styles.contentContainer}>
<Card
className={classnames({
[styles.orgContainer]: true,
[styles.orgContainerHide]: !treeVisible,
})}
>
<span style={{ margin: '0 180px 0 10px' }}>站点列表</span>
<Tooltip title="添加顶级站点">
<PlusOutlined
onClick={() => addTopStation()}
style={{
color: '#1890FF',
fontSize: '18px',
verticalAlign: '0.04em',
}}
/>
</Tooltip>
{treeData.length > 0 && (
<Tree
showIcon="true"
showLine={{ showLeafIcon: false }}
blockNode
autoExpandParent
selectedKeys={[currentStation]}
onSelect={onSelect}
height={treeData.length && treeData.length > 30 ? treeData.length * 14 : 780}
treeData={treeData.map(t => mapTree(t))}
/>
)}
<div className={styles.switcher}>
{treeVisible && (
<Tooltip title="隐藏站点列表">
<DoubleLeftOutlined onClick={() => setTreeVisible(false)} />
</Tooltip>
)}
{!treeVisible && (
<Tooltip title="显示站点列表">
<DoubleRightOutlined onClick={() => setTreeVisible(true)} />
</Tooltip>
)}
</div> </div>
</Card> </>
{/* 右侧用户表 */} ) : (
<div <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
className={classnames({ )}
[styles.userContainer]: true, <Spin spinning={visibleParams.loading}>
[styles.userContainerHide]: !treeVisible, {dataList.map((item, index) => (
})} <Panels
> {...item}
<AddModal index={index}
visible={visibleParams.modalVisible} key={item.GroupId}
onCancel={() => handleShowModal('modalVisible', false)} handleChangeCollpase={handleChangeCollpase}
confirmModal={confirmModal} handleChangeAll={handleChangeAll}
/> handleChangeSignel={handleChangeSignel}
<AddChildModal
visible={visibleParams.addChildVisible}
pid={currentStation}
onCancel={() => handleShowModal('addChildVisible', false)}
confirmModal={addChildModal}
/>
<DelModal
visible={visibleParams.delVisible}
stationId={currentStation}
onCancel={() => handleShowModal('delVisible', false)}
confirmModal={delModal}
/>
<EditModal
visible={visibleParams.editVisible}
stationObj={currentStationMsg}
des={des}
onCancel={() => handleShowModal('editVisible', false)}
confirmModal={editModal}
/> />
<div ))}
className={classnames({ </Spin>
[styles.boxR]: true, </Card>
[styles.boxH]: treeVisible, {dataList.length > 0 && !visibleParams.loading ? (
})} <div style={{ textAlign: 'right' }}>
> <Pagination
<Card size="small"
className={classnames({ total={total}
[styles.cardBoxTop]: true, current={page.pageNum}
[styles.boxH]: treeVisible, defaultPageSize="10"
})} onChange={handleChangePage}
> pageSizeOptions={['10']}
<Row align="middle"> />
<Col span={1}>搜索</Col>
<Col span={8}>
<Search
allowClear
placeholder={placeholder}
onSearch={handleSearch}
// onChange={handleChange}
enterButton
/>
</Col>
<Col span={3} />
</Row>
</Card>
<div style={{ background: '#fff' }}>
<Card
className={classnames({
[styles.boxH]: treeVisible,
[styles.cardBoxR]: true,
})}
>
{/* <Checkbox className={styles.siteAll}>全选/反选</Checkbox> */}
{dataList.length > 0 && !visibleParams.loading ? (
<>
<p className={styles.siteline}>已选择列表:</p>
<div className={styles.siteSelectList}>
<ul className={styles.siteSelectUl}>
{selectList.map((item, index) => (
<li
key={`${item.userName}${item.GroupId}${index}`}
onClick={() => handleDel(index)}
>
{`${item.userName}(${item.GroupName})`}
</li>
))}
</ul>
</div>
</>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
<Spin spinning={visibleParams.loading} >
{dataList.map((item, index) => (
<Panels
{...item}
index={index}
key={item.GroupId}
handleChangeCollpase={handleChangeCollpase}
handleChangeAll={handleChangeAll}
handleChangeSignel={handleChangeSignel}
/>
))}
</Spin>
</Card>
{dataList.length > 0 && !visibleParams.loading ? (
<div style={{ textAlign: 'right' }}>
<Pagination
size="small"
total={total}
current={page.pageNum}
defaultPageSize="10"
onChange={handleChangePage}
pageSizeOptions={['10']}
/>
</div>) : ''
}
<div className={styles.siteBtn}>
<Button
type="primary"
className={styles.siteCommit}
onClick={handleCommitBtn}
>
提交
</Button>
</div>
</div>
</div>
</div> </div>
) : (
''
)}
<div className={styles.siteBtn}>
<Button
type="primary"
className={styles.siteCommit}
onClick={handleCommitBtn}
>
提交
</Button>
</div>
</div> </div>
</PageContainer> </div>
) </div>
} </div>
</PageContainer>
);
};
const CheckBoxRow = React.memo(props => { const CheckBoxRow = React.memo(props => {
let { vIndex, index, isChecked, userName } = props; let { vIndex, index, isChecked, userName } = props;
return ( return (
<Checkbox <Checkbox
className={styles.siteList} className={styles.siteList}
checked={isChecked} checked={isChecked}
onClick={e => props.handleChangeSignel(e, index, vIndex)} onClick={e => props.handleChangeSignel(e, index, vIndex)}
> >
{userName} {userName}
</Checkbox> </Checkbox>
); );
}); });
export default SiteManageV2; export default SiteManageV2;
\ No newline at end of file
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 =>
post(`${PUBLISH_SERVICE}/MessageConfig/InsertMessageTemplate`, param); post(`${PUBLISH_SERVICE}/MessageConfig/InsertMessageTemplate`, param);
export const UpdateMessageTemplate = param => export const UpdateMessageTemplate = param =>
post(`${PUBLISH_SERVICE}/MessageConfig/UpdateMessageTemplate`, param); post(`${PUBLISH_SERVICE}/MessageConfig/UpdateMessageTemplate`, param);
export const DeleteMessageTemplate = param => 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 =>
post(`${PUBLISH_SERVICE}/MessageConfig/InsertMessageConfig`, param); post(`${PUBLISH_SERVICE}/MessageConfig/InsertMessageConfig`, param);
export const UpdateMessageConfig = param => export const UpdateMessageConfig = param =>
post(`${PUBLISH_SERVICE}/MessageConfig/UpdateMessageConfig`, param); post(`${PUBLISH_SERVICE}/MessageConfig/UpdateMessageConfig`, param);
export const DeleteMessageConfig = param => export const DeleteMessageConfig = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/DeleteMessageConfig`, param); get(`${PUBLISH_SERVICE}/MessageConfig/DeleteMessageConfig`, param);
export const GetMessageVersion = param => export const GetMessageVersion = param =>
get(`${PUBLISH_SERVICE}/MessageConfig/GetMessageVersion`, param); get(`${PUBLISH_SERVICE}/MessageConfig/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