Commit 97f01955 authored by 邓超's avatar 邓超

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

# Conflicts: # src/pages/userCenter/userManage/AddUserModal.jsx
parents 26e56baa a355b655
Pipeline #45358 passed with stages
in 7 minutes 36 seconds
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import SiteModal from '@/components/Modal/SiteModa'; import SiteModal from '@/components/Modal/SiteModa';
import { Input, Cascader, Button } from 'antd'; import { Input, Cascader, Button } from 'antd';
import { import { gcj_decrypt, exetent2AmapPoint, lngLat2WebMercator } from '@/utils/transformUtil';
gcj_decrypt,
exetent2AmapPoint,
lngLat2WebMercator,
} from '@/utils/transformUtil';
import { GetAllConfig, GetMetaData } from '@/services/gis/gis'; import { GetAllConfig, GetMetaData } from '@/services/gis/gis';
const { Search } = Input; const { Search } = Input;
import styles from './index.less'; import styles from './index.less';
...@@ -54,10 +50,7 @@ const MapScope = props => { ...@@ -54,10 +50,7 @@ const MapScope = props => {
const layers = res2.layers || []; const layers = res2.layers || [];
const workspace = res2.mapName.split('_')[0]; const workspace = res2.mapName.split('_')[0];
const subLayers = layers const subLayers = layers
.filter( .filter(layer => layer.subLayerIds && layer.subLayerIds.length === 0)
layer =>
layer.subLayerIds && layer.subLayerIds.length === 0,
)
.map(layer => layer.name); .map(layer => layer.name);
const paramLayers = `${workspace}:${subLayers.join(',')}`; const paramLayers = `${workspace}:${subLayers.join(',')}`;
const params = { const params = {
...@@ -68,9 +61,7 @@ const MapScope = props => { ...@@ -68,9 +61,7 @@ const MapScope = props => {
console.log('params', params); console.log('params', params);
const wmsOption = { const wmsOption = {
tileSize: 512, tileSize: 512,
url: `${ url: `${location.origin}/Cityinterface/rest/services/MapServer.svc/${
location.origin
}/Cityinterface/rest/services/MapServer.svc/${
pipenetCofig.servicename pipenetCofig.servicename
}/GeoServerProxy/wms`, }/GeoServerProxy/wms`,
blend: false, blend: false,
...@@ -200,17 +191,16 @@ const MapScope = props => { ...@@ -200,17 +191,16 @@ const MapScope = props => {
}); });
}; };
const filter = (inputValue, path) => { const filter = (inputValue, path) => {
return path.some( return path.some(option => option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
option =>
option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1,
);
}; };
return ( return (
<SiteModal <SiteModal
{...props} {...props}
title={ title={
<span> <span>
<span style={{ marginRight: '20px' }}>{title}的范围选择</span> <span style={{ marginRight: '20px' }}>
<span style={{ fontWeight: 'blod', color: 'red' }}>{title}</span>的范围选择
</span>
<span style={{ color: 'red' }}>提示:必须框选范围</span> <span style={{ color: 'red' }}>提示:必须框选范围</span>
</span> </span>
} }
...@@ -224,10 +214,7 @@ const MapScope = props => { ...@@ -224,10 +214,7 @@ const MapScope = props => {
okText="确认" okText="确认"
onOk={() => onSubmit()} onOk={() => onSubmit()}
> >
<div <div style={{ width: '750px', height: '500px' }} className={styles.indexContainer}>
style={{ width: '750px', height: '500px' }}
className={styles.indexContainer}
>
<div style={{ width: '750px', height: '500px', position: 'absolute' }}> <div style={{ width: '750px', height: '500px', position: 'absolute' }}>
<div id={mapId} style={{ width: '750px', height: '500px' }} /> <div id={mapId} style={{ width: '750px', height: '500px' }} />
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
padding: 10px 24px 0px 24px; padding: 10px 24px 0px 24px;
} }
.ant-modal-footer { .ant-modal-footer {
padding: 0px 48px 10px 40px; padding: 10px 48px 10px 40px;
} }
.ant-table-pagination.ant-pagination { .ant-table-pagination.ant-pagination {
margin: 5px 0; margin: 5px 0;
......
...@@ -117,6 +117,8 @@ const MobileConfigPage = props => { ...@@ -117,6 +117,8 @@ const MobileConfigPage = props => {
}; };
// 删除 // 删除
const delMini = (val, closeModal) => { const delMini = (val, closeModal) => {
console.log(clientName);
console.log(val);
setLoading(true); setLoading(true);
closeModal(); closeModal();
console.log(val); console.log(val);
...@@ -128,7 +130,9 @@ const MobileConfigPage = props => { ...@@ -128,7 +130,9 @@ const MobileConfigPage = props => {
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.code === 0) { if (res.code === 0) {
setMiniTitle(''); if (clientName === val) {
setMiniTitle(singleList[0].text);
}
setTimeout(() => { setTimeout(() => {
setFlag(flag + 1); setFlag(flag + 1);
}, 500); }, 500);
......
...@@ -11,6 +11,7 @@ const AddForm = props => { ...@@ -11,6 +11,7 @@ const AddForm = props => {
submitCallback, submitCallback,
nodeType, nodeType,
nodeObj, nodeObj,
keepType,
addType, addType,
submitLoading, submitLoading,
valueCallback, valueCallback,
...@@ -27,11 +28,11 @@ const AddForm = props => { ...@@ -27,11 +28,11 @@ const AddForm = props => {
const submit = () => { const submit = () => {
if (addType === 1 || addType === 2) { if (addType === 1 || addType === 2) {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
submitCallback(obj, nodeObj); submitCallback(obj, nodeObj, keepType);
} }
if (addType === 3 || addType === 4) { if (addType === 3 || addType === 4) {
let obj = otherForm.getFieldsValue(); let obj = otherForm.getFieldsValue();
submitCallback(obj, nodeObj); submitCallback(obj, nodeObj, keepType);
} }
}; };
const finish = () => { const finish = () => {
......
...@@ -32,7 +32,7 @@ const MiniMenu = props => { ...@@ -32,7 +32,7 @@ const MiniMenu = props => {
const [treeData, setTreeData] = useState([]); // 树的数据 const [treeData, setTreeData] = useState([]); // 树的数据
const [loading, setLoading] = useState(false); // 加载 const [loading, setLoading] = useState(false); // 加载
const [menuID, setMenuID] = useState(''); // 选中的树ID const [menuID, setMenuID] = useState(''); // 选中的树ID
const [saveID, setSaveID] = useState(''); // 保存选择的树id // const [saveID, setSaveID] = useState(''); // 保存选择的树id
const [nodeType, setNodeType] = useState(''); // 选中的节点类型 const [nodeType, setNodeType] = useState(''); // 选中的节点类型
const [info, setInfo] = useState({}); const [info, setInfo] = useState({});
const [addVisible, setAddVisible] = useState(false); // 新增弹窗 const [addVisible, setAddVisible] = useState(false); // 新增弹窗
...@@ -47,6 +47,9 @@ const MiniMenu = props => { ...@@ -47,6 +47,9 @@ const MiniMenu = props => {
const [addList, setAddList] = useState([]); const [addList, setAddList] = useState([]);
const [newTreeList, setNewTreeList] = useState([]); const [newTreeList, setNewTreeList] = useState([]);
const [expendKey, setExpendKey] = useState(''); // 保存默认展开项 const [expendKey, setExpendKey] = useState(''); // 保存默认展开项
const [keepId, setKeepId] = useState('');
const [mapDataList, setMapDataList] = useState(new Set());
const [keepType, setKeepType] = useState('');
// 获取菜单树 // 获取菜单树
useEffect(() => { useEffect(() => {
...@@ -68,14 +71,14 @@ const MiniMenu = props => { ...@@ -68,14 +71,14 @@ const MiniMenu = props => {
// 获取菜单信息 // 获取菜单信息
useEffect(() => { useEffect(() => {
console.log(flag, 'flag'); console.log(flag, 'flag');
if (flag === 2) { if (flag === 1) {
setExpendKey(menuID); setExpendKey(menuID);
} }
getInfo(); getInfo();
}, [menuID]); }, [menuID]);
// 更新树 // 更新树
const updateTrees = () => { const updateTrees = (e, h) => {
getMiniAppModuleTree({ getMiniAppModuleTree({
userMode: userMode || 'super', userMode: userMode || 'super',
}) })
...@@ -92,17 +95,45 @@ const MiniMenu = props => { ...@@ -92,17 +95,45 @@ const MiniMenu = props => {
console.log(result, 'result'); console.log(result, 'result');
setTreeData(result); setTreeData(result);
if (result.length > 0) { if (result.length > 0) {
setFlag(flag + 1); if (e) {
result.map(item => mapData(item, e));
let aa = [...mapDataList].find(i => i.text === e && i.menuType === h);
console.log(aa);
console.log(h);
setMenuID(aa.menuID);
setExpendKey(aa.menuID);
switch (aa.menuType) {
case 'MiniAppMenuGroup':
setNodeType(1);
setAddType(1);
break;
case 'MiniAppMenuGroupTwo':
setNodeType(2);
setAddType(2);
break;
case 'MiniAppMenu':
setNodeType(3);
setAddType(3);
break;
case 'MiniAppMenuThree':
setNodeType(4);
setAddType(4);
break;
default:
break;
}
}
if (flag === 1) { if (flag === 1) {
setMenuID(result[0].menuID); setMenuID(result[0].menuID);
switch (result[0].menuType) { switch (result[0].menuType) {
case 'MiniAppMenuGroup': case 'MiniAppMenuGroup':
setNodeType(1); setNodeType(1);
setAddType(2); setAddType(1);
break; break;
case 'MiniAppMenuGroupTwo': case 'MiniAppMenuGroupTwo':
setNodeType(2); setNodeType(2);
setAddType(4); setAddType(2);
break; break;
case 'MiniAppMenu': case 'MiniAppMenu':
setNodeType(3); setNodeType(3);
...@@ -115,9 +146,11 @@ const MiniMenu = props => { ...@@ -115,9 +146,11 @@ const MiniMenu = props => {
default: default:
break; break;
} }
setFlag(flag + 1);
} }
} }
setLoading(false); setLoading(false);
setKeepId(result[0]);
// 第一次加载,默认选择第一个组织 // 第一次加载,默认选择第一个组织
// if (treeFlag) { // if (treeFlag) {
// handleSelect([result[0].menuID], false); // handleSelect([result[0].menuID], false);
...@@ -147,17 +180,17 @@ const MiniMenu = props => { ...@@ -147,17 +180,17 @@ const MiniMenu = props => {
<div className={styles.tip}> <div className={styles.tip}>
{obj.menuType === 'MiniAppMenuGroup' && ( {obj.menuType === 'MiniAppMenuGroup' && (
<Tooltip title="新增菜单组" className={styles.fsize}> <Tooltip title="新增菜单组" className={styles.fsize}>
<FolderAddTwoTone onClick={() => addMenuGroupTip(obj)} /> <FolderAddTwoTone onClick={e => addMenuGroupTip(obj, e)} />
</Tooltip> </Tooltip>
)} )}
{obj.menuType === 'MiniAppMenuGroupTwo' && ( {obj.menuType === 'MiniAppMenuGroupTwo' && (
<Tooltip title="新增功能菜单" className={styles.fsize}> <Tooltip title="新增功能菜单" className={styles.fsize}>
<FileAddTwoTone onClick={() => addMenuTip(obj)} /> <FileAddTwoTone onClick={e => addMenuTip(obj, e)} />
</Tooltip> </Tooltip>
)} )}
<Tooltip title="删除菜单" className={styles.fsize}> <Tooltip title="删除菜单" className={styles.fsize}>
<DeleteTwoTone onClick={() => deleteMenuTip(obj)} /> <DeleteTwoTone onClick={e => deleteMenuTip(obj, e)} />
</Tooltip> </Tooltip>
</div> </div>
</div> </div>
...@@ -174,6 +207,15 @@ const MiniMenu = props => { ...@@ -174,6 +207,15 @@ const MiniMenu = props => {
children: hasChild ? obj.children.map(i => mapTree(i)) : [], children: hasChild ? obj.children.map(i => mapTree(i)) : [],
}; };
}; };
const mapData = (val, e) => {
const obj = { ...val };
const hasChild = obj.children.length > 0;
if (hasChild) {
obj.children.map(i => mapData(i));
}
mapDataList.add(obj);
};
// 树的点击事件 // 树的点击事件
const handleSelect = (prop, treeNode) => { const handleSelect = (prop, treeNode) => {
console.log(prop, treeNode); console.log(prop, treeNode);
...@@ -184,18 +226,22 @@ const MiniMenu = props => { ...@@ -184,18 +226,22 @@ const MiniMenu = props => {
} = treeNode; } = treeNode;
console.log(menuType); console.log(menuType);
switch (menuType) { switch (menuType) {
// 最上级菜单组
case 'MiniAppMenuGroup': case 'MiniAppMenuGroup':
setNodeType(1); setNodeType(1);
setAddType(2); setAddType(1);
break; break;
// 第二级菜单组
case 'MiniAppMenuGroupTwo': case 'MiniAppMenuGroupTwo':
setNodeType(2); setNodeType(2);
setAddType(4); setAddType(2);
break; break;
// 最上级菜单
case 'MiniAppMenu': case 'MiniAppMenu':
setNodeType(3); setNodeType(3);
setAddType(3); setAddType(3);
break; break;
// 第三季功能菜单
case 'MiniAppMenuThree': case 'MiniAppMenuThree':
setNodeType(4); setNodeType(4);
setAddType(4); setAddType(4);
...@@ -206,12 +252,14 @@ const MiniMenu = props => { ...@@ -206,12 +252,14 @@ const MiniMenu = props => {
} }
if (prop[0]) { if (prop[0]) {
setMenuID(prop[0]); setMenuID(prop[0]);
setSaveID(prop[0]); // setSaveID(prop[0]);
} else {
setMenuID(saveID);
} }
}; };
const handleExpand = (keys, { expanded, node }) => {
console.log(keys);
};
const getInfo = id => { const getInfo = id => {
if (!menuID) { if (!menuID) {
return; return;
...@@ -228,7 +276,7 @@ const MiniMenu = props => { ...@@ -228,7 +276,7 @@ const MiniMenu = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 10, duration: 10,
description: res.message || '获取失败', description: res.msg || '获取失败',
}); });
} }
console.log(res, 'resss'); console.log(res, 'resss');
...@@ -239,7 +287,8 @@ const MiniMenu = props => { ...@@ -239,7 +287,8 @@ const MiniMenu = props => {
}); });
}; };
// 删除的回调 // 删除的回调
const deleteMenuTip = val => { const deleteMenuTip = (val, e) => {
e.stopPropagation();
console.log(val, 'val'); console.log(val, 'val');
setModalTitle(val.text); setModalTitle(val.text);
setNodeObj(val); setNodeObj(val);
...@@ -257,9 +306,14 @@ const MiniMenu = props => { ...@@ -257,9 +306,14 @@ const MiniMenu = props => {
if (res.code === 0) { if (res.code === 0) {
setDelVisible(false); setDelVisible(false);
setFlag(flag + 1); setFlag(flag + 1);
updateTrees(); if (nodeObj.menuID == menuID) {
setNodeType(''); updateTrees();
setNodeObj(''); setMenuID(keepId.menuID);
setNodeType(1);
setNodeObj(keepId);
} else {
updateTrees();
}
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -269,7 +323,7 @@ const MiniMenu = props => { ...@@ -269,7 +323,7 @@ const MiniMenu = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 10, duration: 10,
description: res.message || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) })
...@@ -279,11 +333,14 @@ const MiniMenu = props => { ...@@ -279,11 +333,14 @@ const MiniMenu = props => {
}); });
}; };
// 新增菜单组 // 新增菜单组
const addMenuGroupTip = val => { const addMenuGroupTip = (val, e) => {
e.stopPropagation();
console.log(val, 'addgroup'); console.log(val, 'addgroup');
setModalTitle(`在${val.text}下新增菜单组`); setModalTitle(`在${val.text}下新增菜单组`);
setNodeObj(val); setNodeObj(val);
setAddType(2);
setAddVisible(true); setAddVisible(true);
setKeepType('MiniAppMenuGroupTwo');
}; };
const rootAddGroup = () => { const rootAddGroup = () => {
setNodeObj(''); setNodeObj('');
...@@ -291,13 +348,17 @@ const MiniMenu = props => { ...@@ -291,13 +348,17 @@ const MiniMenu = props => {
setModalTitle('新增最上级菜单组'); setModalTitle('新增最上级菜单组');
setAddType(1); setAddType(1);
setAddVisible(true); setAddVisible(true);
setKeepType('MiniAppMenuGroup');
}; };
// 新增功能菜单 // 新增功能菜单
const addMenuTip = val => { const addMenuTip = (val, e) => {
e.stopPropagation();
console.log(val, 'add'); console.log(val, 'add');
setNodeObj(val); setNodeObj(val);
setModalTitle(`在${val.text}下新增功能菜单`); setModalTitle(`在${val.text}下新增功能菜单`);
setAddType(4);
setAddTwoVisible(true); setAddTwoVisible(true);
setKeepType('MiniAppMenuThree');
}; };
const rootAdd = () => { const rootAdd = () => {
setModalTitle('新增最上级功能菜单'); setModalTitle('新增最上级功能菜单');
...@@ -305,15 +366,17 @@ const MiniMenu = props => { ...@@ -305,15 +366,17 @@ const MiniMenu = props => {
// setNodeType(3); // setNodeType(3);
setAddType(3); setAddType(3);
setAddTwoVisible(true); setAddTwoVisible(true);
setKeepType('MiniAppMenu');
}; };
// 新增提交的回调 // 新增提交的回调
const submitCallback = (prop, item) => { const submitCallback = (prop, item, e) => {
setSubmitLoading(true); setSubmitLoading(true);
let obj = { ...prop }; let obj = { ...prop };
// if (addType === 3 || addType === 4) { // if (addType === 3 || addType === 4) {
// obj.relatedRoleList = String(roleList) || ''; // obj.relatedRoleList = String(roleList) || '';
// } // }
console.log(obj); console.log(obj);
console.log(e);
const parentID = item.menuID ? item.menuID : '-1'; const parentID = item.menuID ? item.menuID : '-1';
addMenu({ addMenu({
_dc: Date.now(), _dc: Date.now(),
...@@ -328,7 +391,9 @@ const MiniMenu = props => { ...@@ -328,7 +391,9 @@ const MiniMenu = props => {
setAddVisible(false); setAddVisible(false);
setAddTwoVisible(false); setAddTwoVisible(false);
setFlag(flag + 1); setFlag(flag + 1);
updateTrees(); console.log(prop);
console.log(item);
updateTrees(prop.menuName, e);
notification.success({ notification.success({
message: '提示', message: '提示',
description: '新增成功', description: '新增成功',
...@@ -337,7 +402,7 @@ const MiniMenu = props => { ...@@ -337,7 +402,7 @@ const MiniMenu = props => {
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
description: res.message || '新增失败', description: res.msg || '新增失败',
duration: 10, duration: 10,
}); });
} }
...@@ -377,7 +442,7 @@ const MiniMenu = props => { ...@@ -377,7 +442,7 @@ const MiniMenu = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '编辑失败', description: res.msg || '编辑失败',
}); });
} }
console.log(res, 'resres'); console.log(res, 'resres');
...@@ -531,7 +596,7 @@ const MiniMenu = props => { ...@@ -531,7 +596,7 @@ const MiniMenu = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '操作失败', description: res.msg || '操作失败',
}); });
} }
}); });
...@@ -602,7 +667,7 @@ const MiniMenu = props => { ...@@ -602,7 +667,7 @@ const MiniMenu = props => {
draggable draggable
autoExpandParent autoExpandParent
onDrop={handleDrop} onDrop={handleDrop}
// onDragEnter={handleDragEnter} onExpand={handleExpand}
selectedKeys={[menuID]} selectedKeys={[menuID]}
expandedKeys={expendKey} expandedKeys={expendKey}
/> />
...@@ -627,6 +692,7 @@ const MiniMenu = props => { ...@@ -627,6 +692,7 @@ const MiniMenu = props => {
<AddForm <AddForm
nodeType={nodeType} nodeType={nodeType}
nodeObj={nodeObj} nodeObj={nodeObj}
keepType={keepType}
addType={addType} addType={addType}
submitCallback={submitCallback} submitCallback={submitCallback}
submitLoading={submitLoading} submitLoading={submitLoading}
...@@ -656,6 +722,7 @@ const MiniMenu = props => { ...@@ -656,6 +722,7 @@ const MiniMenu = props => {
submitLoading={submitLoading} submitLoading={submitLoading}
nodeType={nodeType} nodeType={nodeType}
nodeObj={nodeObj} nodeObj={nodeObj}
keepType={keepType}
addType={addType} addType={addType}
addList={addList} addList={addList}
submitCallback={submitCallback} submitCallback={submitCallback}
......
...@@ -28,12 +28,17 @@ const EditForm = props => { ...@@ -28,12 +28,17 @@ const EditForm = props => {
}, },
]; ];
useEffect(() => { useEffect(() => {
console.log(productObj.ProductName);
console.log(productObj.IsUsed, 'productObj.IsUsed'); console.log(productObj.IsUsed, 'productObj.IsUsed');
form.setFieldsValue({ ...productObj }); let aa = userProductsList.find(i => i.ProductName == productObj.ProductName);
console.log(aa);
if (!productObj.IsUsed) { if (!productObj.IsUsed) {
setBut(true); setBut(true);
form.setFieldsValue({ ...productObj });
} else { } else {
setBut(false); setBut(false);
form.setFieldsValue({ ...aa });
} }
}, [productObj]); }, [productObj]);
// 提交选择 // 提交选择
...@@ -109,35 +114,42 @@ const EditForm = props => { ...@@ -109,35 +114,42 @@ const EditForm = props => {
))} ))}
</Select> </Select>
</Item> </Item>
<Item {but ? (
label="访问路由" <></>
name="RouteUrl" ) : (
rules={[ <>
{ <Item
required: true, label="访问路由"
message: '请输入访问路由,ip加端口号,示例//localhost:3001', name="RouteUrl"
}, rules={[
]} {
> required: true,
{/* <Input addonBefore="//" placeholder="请输入访问路由" allowClear /> */} message: '请输入访问路由,ip加端口号,示例//localhost:3001',
<Input placeholder="请输入访问路由,ip加端口号,示例//localhost:3001" allowClear /> },
</Item> ]}
>
{/* <Input addonBefore="//" placeholder="请输入访问路由" allowClear /> */}
<Input placeholder="请输入访问路由,ip加端口号,示例//localhost:3001" allowClear />
</Item>
<Item
label="默认配置"
name="DefaultSetting"
rules={[
{
required: false,
message: '请输入默认配置',
},
]}
>
<TextArea
placeholder='请输入json对象,示例{"name":"张三","age":"18"}'
autoSize={{ minRows: 3, maxRows: 5 }}
/>
</Item>
</>
)}
<Item
label="默认配置"
name="DefaultSetting"
rules={[
{
required: false,
message: '请输入默认配置',
},
]}
>
<TextArea
placeholder='请输入json对象,示例{"name":"张三","age":"18"}'
autoSize={{ minRows: 3, maxRows: 5 }}
/>
</Item>
<div style={{ display: 'flex', marginLeft: '35%' }}> <div style={{ display: 'flex', marginLeft: '35%' }}>
<Item wrapperCol={{ span: 8, offset: 8 }} style={{ marginRight: '30px' }}> <Item wrapperCol={{ span: 8, offset: 8 }} style={{ marginRight: '30px' }}>
<Button type="primary" htmlType="submit" disabled={but}> <Button type="primary" htmlType="submit" disabled={but}>
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Card, List, Drawer, Button, Empty, Spin, notification, Switch, message } from 'antd'; import { Card, List, Empty, Spin, notification, Switch } from 'antd';
import { modifyProduct, getProductList, delProductList } from '@/services/webConfig/api'; import { modifyProduct, getProductList, delProductList } from '@/services/webConfig/api';
import classnames from 'classnames'; import classnames from 'classnames';
import EditForm from './components/editForm'; import EditForm from './components/editForm';
import styles from './productConfig.less'; import styles from './productConfig.less';
const ProductConfig = props => { const ProductConfig = props => {
const [addVisible, setAddVisible] = useState(false);
const [productList, setProductList] = useState([]); const [productList, setProductList] = useState([]);
const [userProductsList, setUserProductsList] = useState([]); const [userProductsList, setUserProductsList] = useState([]);
const [productObj, setProductObj] = useState(''); const [productObj, setProductObj] = useState('');
...@@ -14,42 +13,42 @@ const ProductConfig = props => { ...@@ -14,42 +13,42 @@ const ProductConfig = props => {
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [list, setList] = useState(new Set()); const [list, setList] = useState(new Set());
// 默认展示第一项 // 默认展示第一项
useEffect(() => { // useEffect(() => {
setLoading(true); // setLoading(true);
getProductList() // getProductList()
.then(res => { // .then(res => {
const { code } = res; // const { code } = res;
if (code === 0) { // if (code === 0) {
const { // const {
data: { AllProducts, UserProducts }, // data: { AllProducts, UserProducts },
} = res; // } = res;
// setProductList(AllProducts); // // setProductList(AllProducts);
setUserProductsList(UserProducts); // setUserProductsList(UserProducts);
setProductObj(AllProducts[0]); // setProductObj(AllProducts[0]);
AllProducts.map(i => { // AllProducts.map(i => {
list.add(i.ProductType); // list.add(i.ProductType);
}); // });
let a = []; // let a = [];
list.map(i => { // list.map(i => {
a.push(i); // a.push(i);
}); // });
let aa = []; // let aa = [];
a.map((i, j) => { // a.map((i, j) => {
let ad = []; // let ad = [];
AllProducts.map(k => { // AllProducts.map(k => {
if (k.ProductType == i) { // if (k.ProductType == i) {
ad.push(k); // ad.push(k);
} // }
}); // });
aa.push(ad); // aa.push(ad);
}); // });
setProductList(aa); // setProductList(aa);
} // }
}) // })
.finally(() => { // .finally(() => {
setLoading(false); // setLoading(false);
}); // });
}, []); // }, []);
useEffect(() => { useEffect(() => {
setLoading(true); setLoading(true);
...@@ -62,9 +61,9 @@ const ProductConfig = props => { ...@@ -62,9 +61,9 @@ const ProductConfig = props => {
} = res; } = res;
// setProductList(AllProducts); // setProductList(AllProducts);
setUserProductsList(UserProducts); setUserProductsList(UserProducts);
// if (!productObj && data.length > 0) { if (!productObj && AllProducts.length > 0) {
// setProductObj(data[0]); setProductObj(AllProducts[0]);
// } }
// setProductList(data); // setProductList(data);
AllProducts.map(i => { AllProducts.map(i => {
list.add(i.ProductType); list.add(i.ProductType);
...@@ -91,10 +90,6 @@ const ProductConfig = props => { ...@@ -91,10 +90,6 @@ const ProductConfig = props => {
}); });
}, [flag]); }, [flag]);
// 展示新增抽屉
const handleAdd = () => {
setAddVisible(true);
};
// 删除 // 删除
const handleDel = item => { const handleDel = item => {
setLoading(true); setLoading(true);
...@@ -123,11 +118,7 @@ const ProductConfig = props => { ...@@ -123,11 +118,7 @@ const ProductConfig = props => {
console.error(err); console.error(err);
}); });
}; };
// 新增提交回调
const addCallback = val => {
setAddVisible(false);
setFlag(flag + 1);
};
// 编辑的回调 // 编辑的回调
const editCallback = val => { const editCallback = val => {
setLoading(true); setLoading(true);
...@@ -167,8 +158,6 @@ const ProductConfig = props => { ...@@ -167,8 +158,6 @@ const ProductConfig = props => {
duration: 3, duration: 3,
}); });
item.IsUsed = true; item.IsUsed = true;
console.log(item, 'item');
console.log(productObj, 'productObj33333');
setProductObj({ ...item }); setProductObj({ ...item });
setFlag(flag + 1); setFlag(flag + 1);
} else { } else {
...@@ -190,34 +179,8 @@ const ProductConfig = props => { ...@@ -190,34 +179,8 @@ const ProductConfig = props => {
} }
}; };
const handleClickItem = value => { const handleClickItem = value => {
// console.log(productList);
// console.log(value);
// let obj = productList.find(i => i.PackageName === value.PackageName);
setProductObj({ ...value }); setProductObj({ ...value });
// if (userProductsList.length > 0) {
// let obj = userProductsList.find(i => i.PackageName === value.PackageName);
// console.log(value);
// console.log(obj);
// if (obj) {
// setProductObj(obj);
// } else {
// message.warning({
// content: '请先启用产品',
// duration: 3,
// });
// }
// } else {
// message.warning({
// content: '请先启用产品',
// duration: 3,
// });
// }
}; };
// const changeBut = value => {
// let obj = userProductsList.find(i => i.PackageName === value.PackageName);
// setProductObj(obj);
// };
const renderListItem = arr => ( const renderListItem = arr => (
<div style={{ marginBottom: '25px', borderBottom: '1px solid #ccc', paddingBottom: '25px' }}> <div style={{ marginBottom: '25px', borderBottom: '1px solid #ccc', paddingBottom: '25px' }}>
{arr.map(item => ( {arr.map(item => (
...@@ -231,20 +194,14 @@ const ProductConfig = props => { ...@@ -231,20 +194,14 @@ const ProductConfig = props => {
> >
<div onClick={e => e.stopPropagation()}> <div onClick={e => e.stopPropagation()}>
<Switch <Switch
// size="small"
// defaultChecked={item.IsUsed}
checked={item.IsUsed} checked={item.IsUsed}
checkedChildren="启用" checkedChildren="启用"
unCheckedChildren="关闭" unCheckedChildren="关闭"
onClick={e => { onClick={e => {
handleSwitchClick(e, item, userProductsList); handleSwitchClick(e, item, userProductsList);
}} }}
// onChange={changeBut(item)}
/> />
</div> </div>
{/* <span className={classnames({ [styles.itemspan]: true })}>{`${item.ProductName}【${
item.ProductType
}】`}</span> */}
<span className={classnames({ [styles.itemspan]: true })}> <span className={classnames({ [styles.itemspan]: true })}>
{item.ProductType ? `${item.ProductName}【${item.ProductType}】` : item.ProductName} {item.ProductType ? `${item.ProductName}【${item.ProductType}】` : item.ProductName}
</span> </span>
...@@ -256,15 +213,7 @@ const ProductConfig = props => { ...@@ -256,15 +213,7 @@ const ProductConfig = props => {
<Spin spinning={loading} tip="loading..."> <Spin spinning={loading} tip="loading...">
<div className={styles.box}> <div className={styles.box}>
<Card className={classnames(`${styles.leftList}`)}> <Card className={classnames(`${styles.leftList}`)}>
<div className={styles.listTop}> <div className={styles.listTop}>产品选择:</div>
产品选择:
{/* <Button type="primary" onClick={handleAdd}>
新增
</Button> */}
{/* <Button type="primary" danger onClick={handleDel}>
删除
</Button> */}
</div>
{productList && productList.length > 0 ? ( {productList && productList.length > 0 ? (
productList.map(item => renderListItem(item)) productList.map(item => renderListItem(item))
) : ( ) : (
...@@ -278,33 +227,6 @@ const ProductConfig = props => { ...@@ -278,33 +227,6 @@ const ProductConfig = props => {
handleDel={handleDel} handleDel={handleDel}
userProductsList={userProductsList} userProductsList={userProductsList}
/> />
{/* {productList && productList.length > 0 && productObj ? (
<EditForm
productObj={productObj}
editCallback={editCallback}
handleDel={handleDel}
userProductsList={userProductsList}
/>
) : (
<Empty
style={{ marginTop: '60px' }}
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="当前未选中产品类型"
/>
)} */}
{/* <Drawer
title="新增产品"
destroyOnClose
maskClosable={false}
width={600}
onClose={() => {
setAddVisible(false);
}}
visible={addVisible}
>
<AddForm addCallback={addCallback} />
</Drawer> */}
</Card> </Card>
</div> </div>
</Spin> </Spin>
......
...@@ -82,6 +82,7 @@ const WebConfigPage = props => { ...@@ -82,6 +82,7 @@ const WebConfigPage = props => {
const updateModuleTree = (userModePrama, canceled = { cancel: false }) => { const updateModuleTree = (userModePrama, canceled = { cancel: false }) => {
setLoading(true); setLoading(true);
console.log(userModePrama);
return getWebModuleTree(userModePrama) return getWebModuleTree(userModePrama)
.then(res => { .then(res => {
const websArr = [ const websArr = [
...@@ -151,7 +152,9 @@ const WebConfigPage = props => { ...@@ -151,7 +152,9 @@ const WebConfigPage = props => {
duration: 3, duration: 3,
}); });
// updateModuleTree(userMode || 'super'); // updateModuleTree(userMode || 'super');
if (webToOperate.id === curWeb.id) {
setCurWeb(webs[0].id);
}
setTimeout(() => { setTimeout(() => {
updateModuleTree(userMode || 'super'); updateModuleTree(userMode || 'super');
}, 500); }, 500);
......
/* eslint-disable array-callback-return */ /* eslint-disable array-callback-return */
/* eslint-disable no-plusplus */ /* eslint-disable no-plusplus */
/* eslint-disable consistent-return */ /* eslint-disable consistent-return */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { notification, Tooltip, Modal, Spin, Empty } from 'antd'; import { notification, Tooltip, Modal, Spin, Empty } from 'antd';
import Tree from '@/components/ExpendableTree'; import Tree from '@/components/ExpendableTree';
import { import {
...@@ -52,9 +52,11 @@ const MiniMenu = props => { ...@@ -52,9 +52,11 @@ const MiniMenu = props => {
const [expendKey, setExpendKey] = useState(''); // 保存默认展开项 const [expendKey, setExpendKey] = useState(''); // 保存默认展开项
const [menuList, setMenuList] = useState([]); // 菜单树 const [menuList, setMenuList] = useState([]); // 菜单树
const [keepId, setKeepId] = useState(''); const [keepId, setKeepId] = useState('');
const [mapDataList, setMapDataList] = useState(new Set());
/* ***************************************************** */ /* ***************************************************** */
const [curMenuType, setCurMenuType] = useState(''); const [curMenuType, setCurMenuType] = useState('');
const parentRef = useRef();
// 获取菜单信息 // 获取菜单信息
useEffect(() => { useEffect(() => {
...@@ -62,6 +64,7 @@ const MiniMenu = props => { ...@@ -62,6 +64,7 @@ const MiniMenu = props => {
if (flag === 1) { if (flag === 1) {
setExpendKey(menuID); setExpendKey(menuID);
} }
console.log(expendKey);
getInfo(); getInfo();
}, [menuID, webid]); }, [menuID, webid]);
useEffect(() => { useEffect(() => {
...@@ -114,14 +117,23 @@ const MiniMenu = props => { ...@@ -114,14 +117,23 @@ const MiniMenu = props => {
children: hasChild ? obj.children.map(i => mapTree(i)) : [], children: hasChild ? obj.children.map(i => mapTree(i)) : [],
}; };
}; };
const mapData = (val, e) => {
const obj = { ...val };
const hasChild = obj.children.length > 0;
if (hasChild) {
obj.children.map(i => mapData(i));
}
mapDataList.add(obj);
};
// 树的点击事件 // 树的点击事件
const handleSelect = (prop, treeNode) => { const handleSelect = (prop, treeNode) => {
console.log(prop);
console.log(treeNode);
if (treeNode) { if (treeNode) {
const { const {
node: { menuType }, node: { menuType },
} = treeNode; } = treeNode;
console.log(menuType); console.log(menuType);
setCurMenuType(menuType);
switch (menuType) { switch (menuType) {
case 'Web4MenuGroup': case 'Web4MenuGroup':
setNodeType(2); setNodeType(2);
...@@ -174,7 +186,7 @@ const MiniMenu = props => { ...@@ -174,7 +186,7 @@ const MiniMenu = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 10, duration: 10,
description: res.message || '获取失败', description: res.msg || '获取失败',
}); });
} }
}) })
...@@ -220,7 +232,7 @@ const MiniMenu = props => { ...@@ -220,7 +232,7 @@ const MiniMenu = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 10, duration: 10,
description: res.message || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) })
...@@ -291,10 +303,12 @@ const MiniMenu = props => { ...@@ -291,10 +303,12 @@ const MiniMenu = props => {
.then(res => { .then(res => {
setSubmitLoading(false); setSubmitLoading(false);
if (res.code === 0) { if (res.code === 0) {
console.log(res.data);
setAddVisible(false); setAddVisible(false);
setAddTwoVisible(false); setAddTwoVisible(false);
// setFlag(flag + 1); // setFlag(flag + 1);
getTree(); console.log(prop);
getTree(res.data);
// updateMenuTree('add', item); // updateMenuTree('add', item);
notification.success({ notification.success({
message: '提示', message: '提示',
...@@ -304,7 +318,7 @@ const MiniMenu = props => { ...@@ -304,7 +318,7 @@ const MiniMenu = props => {
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
description: res.message || '新增失败', description: res.msg || '新增失败',
duration: 10, duration: 10,
}); });
} }
...@@ -314,6 +328,11 @@ const MiniMenu = props => { ...@@ -314,6 +328,11 @@ const MiniMenu = props => {
console.error(err); console.error(err);
}); });
}; };
const treeCallback = value => {
if (value) {
console.log(value);
}
};
// 编辑的回调 // 编辑的回调
const editSubmitCallback = prop => { const editSubmitCallback = prop => {
setLoading(true); setLoading(true);
...@@ -343,7 +362,7 @@ const MiniMenu = props => { ...@@ -343,7 +362,7 @@ const MiniMenu = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '编辑失败', description: res.mes || '编辑失败',
}); });
} }
}) })
...@@ -411,7 +430,7 @@ const MiniMenu = props => { ...@@ -411,7 +430,7 @@ const MiniMenu = props => {
} }
} }
}; };
const getTree = () => { const getTree = e => {
getWebModuleTree(userMode || 'super') getWebModuleTree(userMode || 'super')
.then(res => { .then(res => {
setLoading(false); setLoading(false);
...@@ -422,14 +441,32 @@ const MiniMenu = props => { ...@@ -422,14 +441,32 @@ const MiniMenu = props => {
.map(r => r.children.filter(i => i.id === webid)) .map(r => r.children.filter(i => i.id === webid))
.flat(2); .flat(2);
let arr2 = arr[0].children.find(item => item.text === '菜单管理').children || []; let arr2 = arr[0].children.find(item => item.text === '菜单管理').children || [];
console.log(arr2[0]);
setKeepId(arr2[0]);
setMenuList(arr2 || []); setMenuList(arr2 || []);
if (e) {
arr2.map(item => mapData(item, e));
console.log([...mapDataList]);
let aa = [...mapDataList].find(i => i.menuID == e);
console.log(aa);
setMenuID(aa.menuID);
setExpendKey(aa.menuID);
console.log(expendKey);
switch (aa.menuType) {
case 'Web4MenuGroup':
setNodeType(2);
setAddType(2);
break;
default:
setNodeType(1);
setAddType(1);
break;
}
}
setKeepId(arr2[0]);
// 进页面后默认展示第一条数据 // 进页面后默认展示第一条数据
if (arr2.length > 0) { if (arr2.length > 0) {
if (flag === 1) { if (flag === 1) {
setMenuID(arr2[0].menuID); setMenuID(arr2[0].menuID);
setCurMenuType(arr2[0].menuType);
switch (arr2[0].menuType) { switch (arr2[0].menuType) {
case 'Web4MenuGroup': case 'Web4MenuGroup':
setNodeType(2); setNodeType(2);
...@@ -524,14 +561,13 @@ const MiniMenu = props => { ...@@ -524,14 +561,13 @@ const MiniMenu = props => {
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
// updateMenuTree(); // updateMenuTree();
console.log(11111111);
getTree(); getTree();
// setFlag(flag + 1); // setFlag(flag + 1);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '操作失败', description: res.msg || '操作失败',
}); });
} }
}); });
......
...@@ -60,6 +60,7 @@ const SiteManage = () => { ...@@ -60,6 +60,7 @@ const SiteManage = () => {
const [saveTreeId, setSaveTreeId] = useState(''); // 保存点击回调的roleid const [saveTreeId, setSaveTreeId] = useState(''); // 保存点击回调的roleid
const [modalVisible, setModalVisible] = useState(false); // 新增弹窗 const [modalVisible, setModalVisible] = useState(false); // 新增弹窗
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [flagSearch, setFlagSearch] = useState(0);
const [itemObj, setItemObj] = useState(''); // 选择的角色item const [itemObj, setItemObj] = useState(''); // 选择的角色item
const [delVisible, setDelVisible] = useState(false); // 删除弹窗 const [delVisible, setDelVisible] = useState(false); // 删除弹窗
const [editVisible, setEditVisible] = useState(false); // 修改弹窗 const [editVisible, setEditVisible] = useState(false); // 修改弹窗
...@@ -77,21 +78,35 @@ const SiteManage = () => { ...@@ -77,21 +78,35 @@ const SiteManage = () => {
const [mulu, setMulu] = useState(true); // 展示目录 const [mulu, setMulu] = useState(true); // 展示目录
const [siteList, setSiteList] = useState([]); const [siteList, setSiteList] = useState([]);
const [disFlag, setDisFlag] = useState(false); const [disFlag, setDisFlag] = useState(false);
const [chileID, setChildID] = useState([]);
const [descrip, setDescrip] = useState('当前未选中角色');
// const [childData, setChildData] = useState({visibleValue:''}) // const [childData, setChildData] = useState({visibleValue:''})
// 点击树的回调 // 点击树的回调
const handleTreeSelect = (e, treenode) => { const handleTreeSelect = (e, treenode) => {
console.log(e);
console.log(treenode);
if (treenode) { if (treenode) {
const { node } = treenode; const { node } = treenode;
const { roleID: id } = node; const { roleID: id } = node;
setItemObj(node); setItemObj(node);
let aa = chileID.find(i => i.roleID === id);
if (id) { if (id) {
setSaveTreeId(id); setSaveTreeId(id);
setRoleID(id);
setValueList([...valueList]); setValueList([...valueList]);
if (aa) {
setRoleID('');
setDescrip('系统分组下的角色不可配置菜单权限也不能被关联');
setFlagSearch(0);
} else {
setRoleID(id);
setFlagSearch(1);
}
} else { } else {
// setRoleID(saveTreeId); // setRoleID(saveTreeId);
setRoleID(''); setRoleID('');
setDescrip('当前未选中角色');
setFlagSearch(0);
} }
} }
...@@ -147,10 +162,27 @@ const SiteManage = () => { ...@@ -147,10 +162,27 @@ const SiteManage = () => {
} }
} }
}); });
console.log(res.data.roleList);
const { roleList } = res.data; const { roleList } = res.data;
let arr = transTree(roleList); let arr = transTree(roleList);
setTreeData(arr); setTreeData(arr);
console.log(arr);
let dataA = [];
arr.map(i => {
console.log(i.child);
dataA.push(i.child.find(j => j.visibleTitle === '系统分组'));
// if (i.child.find(j => j.visibleTitle === '系统分组')) {
// data.push(j);
// }
});
console.log(dataA);
let Arr = [];
dataA.map(i => {
i.children.map(j => {
Arr.push(j);
});
});
console.log(Arr);
setChildID(Arr);
} }
}); });
}; };
...@@ -795,13 +827,17 @@ const SiteManage = () => { ...@@ -795,13 +827,17 @@ const SiteManage = () => {
> >
<Row align="middle"> <Row align="middle">
<Col span={8}> <Col span={8}>
<Search {flagSearch == 1 ? (
allowClear <Search
placeholder={placeholder} allowClear
// onSearch={handleSearch} placeholder={placeholder}
onChange={handleChange} // onSearch={handleSearch}
enterButton onChange={handleChange}
/> enterButton
/>
) : (
<span />
)}
</Col> </Col>
<Col span={3} /> <Col span={3} />
</Row> </Row>
...@@ -823,7 +859,7 @@ const SiteManage = () => { ...@@ -823,7 +859,7 @@ const SiteManage = () => {
hasData={hasData} hasData={hasData}
/> />
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前未选中角色" /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={descrip} />
)} )}
</Card> </Card>
</div> </div>
......
...@@ -3,17 +3,17 @@ import { Modal, Form, Input, notification, message } from 'antd'; ...@@ -3,17 +3,17 @@ import { Modal, Form, Input, notification, message } from 'antd';
import { addOrg } from '@/services/userManage/api'; import { addOrg } from '@/services/userManage/api';
const AddUserModal = props => { const AddUserModal = props => {
const { title, visible, orgID, onCancel, updateTrees, onSelect } = props; const { visible, orgID, onCancel, updateTrees, onSelect, orgTitle1 } = props;
const [addOrgForm] = Form.useForm(); // 添加用户 const [addOrgForm] = Form.useForm(); // 添加用户
useEffect(() => { useEffect(() => {
console.log(orgID) console.log(orgID);
addOrgForm.resetFields(); addOrgForm.resetFields();
}, [orgID]); }, [orgID]);
// 提交-添加下级机构 // 提交-添加下级机构
const submitAddOrg = () => { const submitAddOrg = () => {
if(orgID == -1){ if (orgID == -1) {
addOrg( addOrg(
orgID, orgID,
addOrgForm.getFieldValue('OUName'), addOrgForm.getFieldValue('OUName'),
...@@ -21,7 +21,7 @@ const AddUserModal = props => { ...@@ -21,7 +21,7 @@ const AddUserModal = props => {
'', '',
) )
.then(res => { .then(res => {
if (res.msg==="Ok") { if (res.msg === 'Ok') {
onCancel(); onCancel();
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
...@@ -40,8 +40,7 @@ const AddUserModal = props => { ...@@ -40,8 +40,7 @@ const AddUserModal = props => {
.catch(err => { .catch(err => {
message.error(err); message.error(err);
}); });
} else {
}else{
addOrg( addOrg(
orgID.id, orgID.id,
addOrgForm.getFieldValue('OUName'), addOrgForm.getFieldValue('OUName'),
...@@ -49,7 +48,7 @@ const AddUserModal = props => { ...@@ -49,7 +48,7 @@ const AddUserModal = props => {
'', '',
) )
.then(res => { .then(res => {
if (res.msg==="Ok") { if (res.msg === 'Ok') {
onCancel(); onCancel();
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
...@@ -70,9 +69,14 @@ const AddUserModal = props => { ...@@ -70,9 +69,14 @@ const AddUserModal = props => {
}); });
} }
}; };
const title = (
<span>
<span style={{ fontWeight: 'bold', color: 'red' }}>{orgTitle1}</span>下添加机构
</span>
);
return ( return (
<Modal <Modal
title={title} title={orgID === '-1' ? '添加顶级机构' : title}
visible={visible} visible={visible}
onCancel={onCancel} onCancel={onCancel}
onOk={submitAddOrg} onOk={submitAddOrg}
...@@ -80,11 +84,7 @@ const AddUserModal = props => { ...@@ -80,11 +84,7 @@ const AddUserModal = props => {
cancelText="取消" cancelText="取消"
> >
<Form form={addOrgForm} labelCol={{ span: 4 }}> <Form form={addOrgForm} labelCol={{ span: 4 }}>
<Form.Item <Form.Item name="OUName" label="机构名称" rules={[{ required: true, message: '不能为空' }]}>
name="OUName"
label="机构名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入机构名称" /> <Input placeholder="请输入机构名称" />
</Form.Item> </Form.Item>
<Form.Item name="description" label="描述"> <Form.Item name="description" label="描述">
......
...@@ -4,7 +4,7 @@ import { addUser } from '@/services/userManage/api'; ...@@ -4,7 +4,7 @@ import { addUser } from '@/services/userManage/api';
import { ok } from '../../../assets/images/icons/ok.svg'; import { ok } from '../../../assets/images/icons/ok.svg';
const AddUserModal = props => { const AddUserModal = props => {
const { title, visible, orgID, onCancel, onSelect } = props; const { visible, orgID, onCancel, onSelect, orgTitle1 } = props;
const [addUserForm] = Form.useForm(); // 添加用户 const [addUserForm] = Form.useForm(); // 添加用户
/** ***正则验证**** */ /** ***正则验证**** */
const noChinese = new RegExp(/^[^\u4e00-\u9fa5]+$/); // 不能包含中文 const noChinese = new RegExp(/^[^\u4e00-\u9fa5]+$/); // 不能包含中文
...@@ -93,6 +93,12 @@ const AddUserModal = props => { ...@@ -93,6 +93,12 @@ const AddUserModal = props => {
}); });
} }
}; };
const title = (
<span>
<span style={{ fontWeight: 'bold', color: 'red' }}>{orgTitle1}</span>下添加用户
</span>
);
return ( return (
<Modal <Modal
title={title} title={title}
......
/*
* @Description:
* @Author: leizhe
* @Date: 2022-01-13 17:26:14
* @LastEditTime: 2022-03-07 18:50:03
* @LastEditors: leizhe
*/
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Modal, Form, Input, notification, message } from 'antd'; import { Modal, Form, Input, notification, message } from 'antd';
import { editOrgInfo } from '@/services/userManage/api'; import { editOrgInfo } from '@/services/userManage/api';
const EditOrgModal = props => { const EditOrgModal = props => {
const { const {
title,
visible, visible,
orgID, orgID,
orgTitle, orgTitle,
...@@ -12,6 +18,7 @@ const EditOrgModal = props => { ...@@ -12,6 +18,7 @@ const EditOrgModal = props => {
onCancel, onCancel,
updateTrees, updateTrees,
onSelect, onSelect,
orgTitle1,
} = props; } = props;
const [editOrgForm] = Form.useForm(); // 添加用户 const [editOrgForm] = Form.useForm(); // 添加用户
...@@ -51,6 +58,11 @@ const EditOrgModal = props => { ...@@ -51,6 +58,11 @@ const EditOrgModal = props => {
.catch(err => { .catch(err => {
message.error(err); message.error(err);
}); });
const title = (
<span>
编辑<span style={{ fontWeight: 'bold', color: 'red' }}>{orgTitle1}</span>
</span>
);
return ( return (
<Modal <Modal
title={title} title={title}
...@@ -61,11 +73,7 @@ const EditOrgModal = props => { ...@@ -61,11 +73,7 @@ const EditOrgModal = props => {
cancelText="取消" cancelText="取消"
> >
<Form form={editOrgForm} labelCol={{ span: 4 }}> <Form form={editOrgForm} labelCol={{ span: 4 }}>
<Form.Item <Form.Item name="OUName" label="机构名称" rules={[{ required: true, message: '不能为空' }]}>
name="OUName"
label="机构名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入机构名称" /> <Input placeholder="请输入机构名称" />
</Form.Item> </Form.Item>
<Form.Item name="description" label="描述"> <Form.Item name="description" label="描述">
......
import React, { useState, useCallback, useEffect } from 'react'; import React, { useState, useCallback, useEffect } from 'react';
import { Modal, Spin, Tabs, notification, message, Checkbox, Divider } from 'antd'; import { Modal, Spin, Tabs, notification, message, Checkbox, Divider } from 'antd';
import { import { SetUserRelationList, setUserRelation, setUserRelations } from '@/services/userManage/api';
SetUserRelationList,
setUserRelation,
setUserRelations,
} from '@/services/userManage/api';
import ListCardItem from './components/listCardItem'; import ListCardItem from './components/listCardItem';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
...@@ -45,6 +41,7 @@ const RelateRoleModal = props => { ...@@ -45,6 +41,7 @@ const RelateRoleModal = props => {
}, []); }, []);
useEffect(() => { useEffect(() => {
console.log(currentUser);
console.log(multiRoleList); console.log(multiRoleList);
console.log(multistationList); console.log(multistationList);
}, [visible]); }, [visible]);
...@@ -129,7 +126,9 @@ const RelateRoleModal = props => { ...@@ -129,7 +126,9 @@ const RelateRoleModal = props => {
); );
const title1 = ( const title1 = (
<span> <span>
<span>关联角色{currentUser.loginName}</span> <span>
关联角色<span style={{ fontWeight: 'bold', color: 'red' }}>{currentUser.userName}</span>
</span>
</span> </span>
); );
if (mult == 'Yes') { if (mult == 'Yes') {
......
...@@ -151,6 +151,7 @@ const UserManage = () => { ...@@ -151,6 +151,7 @@ const UserManage = () => {
const [keep1, setKeep1] = useState([4]); // 存储树选择 const [keep1, setKeep1] = useState([4]); // 存储树选择
const [id, setId] = useState(''); const [id, setId] = useState('');
const { Search } = Input; const { Search } = Input;
const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引
const setRowClassName = record => const setRowClassName = record =>
record.userID === selectColor.userID ? styles.clickRowStyle : ''; record.userID === selectColor.userID ? styles.clickRowStyle : '';
// 用户表列名 // 用户表列名
...@@ -389,7 +390,18 @@ const UserManage = () => { ...@@ -389,7 +390,18 @@ const UserManage = () => {
title: ( title: (
<div className={styles.title1}> <div className={styles.title1}>
<span className={styles.titleText}>{org.text}</span> <span className={styles.titleText}>{org.text}</span>
<span className={styles.tip1}> <span
className={classnames({
[styles.tip1]: true,
[styles.listHover]: org === hoverItemIndex,
})}
onMouseEnter={() => {
setHoverItemIndex(org);
}}
onMouseLeave={() => {
setHoverItemIndex('');
}}
>
<Tooltip title="" className={styles.fs1}> <Tooltip title="" className={styles.fs1}>
<Dropdown overlay={orgButtonMenu}> <Dropdown overlay={orgButtonMenu}>
<PlusOutlined <PlusOutlined
...@@ -403,7 +415,6 @@ const UserManage = () => { ...@@ -403,7 +415,6 @@ const UserManage = () => {
/> />
</Dropdown> </Dropdown>
</Tooltip> </Tooltip>
<Dropdown overlay={orgButtonMenu1}> <Dropdown overlay={orgButtonMenu1}>
<EllipsisOutlined <EllipsisOutlined
style={{ marginLeft: 10, fontSize: '20px' }} style={{ marginLeft: 10, fontSize: '20px' }}
...@@ -1316,6 +1327,7 @@ const UserManage = () => { ...@@ -1316,6 +1327,7 @@ const UserManage = () => {
const addChange = e => { const addChange = e => {
e.domEvent.stopPropagation(); e.domEvent.stopPropagation();
}; };
/** ***操作按钮**** */ /** ***操作按钮**** */
// 机构操作 // 机构操作
const orgButtonMenu = ( const orgButtonMenu = (
...@@ -1487,16 +1499,16 @@ const UserManage = () => { ...@@ -1487,16 +1499,16 @@ const UserManage = () => {
{/* Modal弹框 */} {/* Modal弹框 */}
{/* 添加用户 */} {/* 添加用户 */}
<AddUserModal <AddUserModal
title={`在${orgTitle1}下添加用户`}
visible={userVisible} visible={userVisible}
orgID={orgID} orgID={orgID}
orgTitle1={orgTitle1}
onCancel={kee} onCancel={kee}
onSelect={() => onSelect([orgID])} onSelect={() => onSelect([orgID])}
/> />
{/* 添加下级机构 */} {/* 添加下级机构 */}
<AddSubOrgModal <AddSubOrgModal
title={orgID === '-1' ? '添加顶级机构' : `在${orgTitle1}下添加机构`}
visible={addOrgVisible} visible={addOrgVisible}
orgTitle1={orgTitle1}
orgID={orgID} orgID={orgID}
onCancel={() => setAddOrgVisible(false)} onCancel={() => setAddOrgVisible(false)}
// onSelect={onSelect} // onSelect={onSelect}
...@@ -1504,10 +1516,9 @@ const UserManage = () => { ...@@ -1504,10 +1516,9 @@ const UserManage = () => {
/> />
{/* 编辑机构 */} {/* 编辑机构 */}
<EditOrgModal <EditOrgModal
title={`编辑${orgTitle1}`}
visible={editOrgVisible} visible={editOrgVisible}
orgID={orgID} orgID={orgID}
orgTitle={orgTitle1} orgTitle1={orgTitle1}
description={description} description={description}
onCancel={() => setEditOrgVisible(false)} onCancel={() => setEditOrgVisible(false)}
// onSelect={onSelect} // onSelect={onSelect}
......
...@@ -196,6 +196,12 @@ ...@@ -196,6 +196,12 @@
font-size: 18px; font-size: 18px;
margin-left: 10px; margin-left: 10px;
} }
.listHover {
display: flex;
align-items: center;
justify-content: flex-end;
width: 100%;
}
.title1:hover { .title1:hover {
.tip1 { .tip1 {
display: flex; display: flex;
......
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