Commit 1c055509 authored by 皮倩雯's avatar 皮倩雯

fix: '优化'

parent 6571e2d7
Pipeline #82834 passed with stages
......@@ -277,7 +277,6 @@ const BookConfigNew = props => {
Ledger_ParentLedgers(params).then(res => {
if (res.code === 0) {
setParentData(res.data);
console.log(res, 'ressssssssssssssssss');
} else {
setParentData([]);
}
......@@ -684,13 +683,7 @@ const BookConfigNew = props => {
name="PreName"
// rules={[{ required: true, message: '请选择分组' }]}
>
<Select
showSearch
filterOption={false}
// onSearch={onSearch}
placeholder="请选择父级台账"
allowClear
>
<Select showSearch placeholder="请选择父级台账" allowClear>
{parentData.map((item, index) => (
<Option value={item.name} key={index}>
{item.name}
......@@ -706,13 +699,7 @@ const BookConfigNew = props => {
rules={[{ required: true, message: '请选择分组' }]}
{...itemLayout}
>
<Select
showSearch
filterOption={false}
onSearch={onSearch}
placeholder="请输入分组名称"
allowClear
>
<Select showSearch onSearch={onSearch} placeholder="请输入分组名称" allowClear>
{data.map((item, index) => (
<Option value={item} key={index}>
{item}
......
......@@ -21,19 +21,12 @@
}
.InitDataBaseContainer {
width: 100%;
height: 100%;
.ant-card-body {
padding-bottom: 0px !important;
}
.cardTop {
height: 350px;
width: 100%;
}
.cardBottom {
.mgTop20 {
margin-top: 20px;
height: calc(100% - 350px);
}
......
import React, { useEffect } from 'react';
import { Card, notification } from 'antd';
import React, { useState, useEffect } from 'react';
import { Card, Tabs, Form, Input, Button, notification } from 'antd';
import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
import { SaveMainServer, GetMainServer, DeleteMainServer } from '@/services/database/api';
import PageContainer from '@/components/BasePageContainer';
import SQLServerTable from './sqlServer/SQLServerTable';
import DmTable from './dm/DmTable';
import OracleTable from './oracle/OracleTable';
import MongDBTable from './mongDB/MongDBTable';
import MySQLTable from './mysqltable/MySQLTable';
import MasterTable from './master/MasterTable';
const { TabPane } = Tabs;
const dataArr = [
{
title: 'SQLServer数据库连接',
key: '0',
component: <SQLServerTable />,
},
{
title: 'Oracle数据库连接',
key: '1',
component: <OracleTable />,
},
{
title: 'MongoDB数据库连接',
key: '2',
component: <MongDBTable />,
},
{
title: 'MySQL数据库连接',
key: '3',
component: <MySQLTable />,
},
];
const Hr = () => <hr style={{ width: 'calc( 100% - 40px)' }} />;
const DatabaseConnectConfig = props => {
const [form] = Form.useForm();
const [flag, setFlag] = useState(false);
const [active, setActive] = useState('0');
const [isLink, setIsLink] = useState(false); //主站配置是否连接
useEffect(() => {
getData();
}, []);
const handleChange = e => {
setActive(e);
};
const getData = () => {
GetMainServer().then(res => {
if (res.code === 0) {
form.setFieldsValue({ url: res.data });
// if (res.data) {
// setIsLink(true);
// form.setFieldsValue({ url: res.data });
// } else {
// setIsLink(false);
// form.setFieldsValue({ url: window.location.origin });
// }
}
});
};
const deleteConfig = () => {
DeleteMainServer().then(res => {
if (res.code === 0) {
notification.success({ message: '提示', duration: 3, description: '删除成功' });
getData();
} else {
notification.error({ message: '提示', duration: 3, description: res.msg });
}
});
};
// 提交主站配置
const onFinish = values => {
console.log('Success:', values);
SaveMainServer(values).then(res => {
if (res.code === 0) {
notification.success({
message: '提示',
duration: 3,
description: '保存成功',
});
getData();
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
return (
<PageContainer>
<div style={{ width: '100%', height: '100%', overflowY: 'scroll' }}>
<Card>
{/* <Tabs activeKey={active} onChange={e => handleChange(e)}>
{dataArr.map(item => (
<TabPane tab={item.title} key={item.key}>
{active === item.key && item.component}
</TabPane>
))}
</Tabs> */}
<div style={{ marginBottom: '15px' }}>
<SQLServerTable />
</div>
<div style={{ marginBottom: '15px' }}>
<DmTable />
</div>
<div style={{ marginBottom: '15px' }}>
<OracleTable />
</div>
......
......@@ -42,15 +42,11 @@ const AddModal = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
if (type === 'add') {
AddConnString({
type: 'mysql',
...obj,
password: pwd,
password: Encrypt(obj.password),
})
.then(res => {
setLoading(false);
......@@ -82,15 +78,11 @@ const AddModal = props => {
};
const handleEdit = () => {
let obj = form.getFieldsValue();
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
EditConnString({
type: 'mysql',
...obj,
oldName: formObj.name,
password: pwd,
password: Encrypt(obj.password),
})
.then(res => {
setLoading(false);
......@@ -120,7 +112,7 @@ const AddModal = props => {
form.setFieldsValue({ port: 3306 });
break;
case 'edit':
form.setFieldsValue({ ...formObj, password: formObj.password });
form.setFieldsValue({ ...formObj, password: Decrypt(formObj.password) });
if (!formObj.port) {
form.setFieldsValue({ port: 3306 });
}
......
......@@ -42,15 +42,11 @@ const AddModal = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
if (type === 'add') {
AddConnString({
...obj,
type: 'oracle',
password: pwd,
password: Encrypt(obj.password),
})
.then(res => {
setLoading(false);
......@@ -82,15 +78,11 @@ const AddModal = props => {
};
const handleEdit = () => {
let obj = form.getFieldsValue();
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
EditConnString({
type: 'oracle',
...obj,
oldName: formObj.name,
password: pwd,
password: Encrypt(obj.password),
})
.then(res => {
setLoading(false);
......@@ -119,7 +111,7 @@ const AddModal = props => {
form.resetFields();
break;
case 'edit':
form.setFieldsValue({ ...formObj, password: formObj.password });
form.setFieldsValue({ ...formObj, password: Decrypt(formObj.password) });
break;
default:
break;
......
......@@ -42,15 +42,11 @@ const AddModal = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
if (type === 'add') {
AddConnString({
...obj,
type: 'sqlserver',
password: pwd,
password: Encrypt(obj.password),
})
.then(res => {
setLoading(false);
......@@ -82,15 +78,11 @@ const AddModal = props => {
};
const handleEdit = () => {
let obj = form.getFieldsValue();
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
EditConnString({
...obj,
oldName: formObj.name,
type: 'sqlserver',
password: pwd,
password: Encrypt(obj.password),
})
.then(res => {
setLoading(false);
......@@ -119,7 +111,7 @@ const AddModal = props => {
form.resetFields();
break;
case 'edit':
form.setFieldsValue({ ...formObj, password: formObj.password });
form.setFieldsValue({ ...formObj, password: Decrypt(formObj.password) });
break;
default:
break;
......
......@@ -35,7 +35,6 @@ import {
import AddModal from './components/AddModal';
import LookModal from './components/LookModal';
import PushTest from './components/PushTest/PushTest';
import logWorker from './components/logWorker';
const { Option } = Select;
let timer = null;
......@@ -55,7 +54,6 @@ const ScheduledTasks = () => {
const listRef = useRef();
const [logList, setLogList] = useState([]);
const keepLength = useRef(0);
const [loadingLog, setLoadingLog] = useState(false);
const columns = [
{
......@@ -185,50 +183,14 @@ const ScheduledTasks = () => {
getTableList();
setColumnsData(columns);
getIISAgentLog();
updateInfo();
return () => {
clearInterval(timer);
timer = null;
};
}, []);
const updateInfo = () => {
let worker = new Worker('logWorker');
debugger;
worker.onmessage = m => {
debugger;
console.log(m);
};
debugger;
worker.postMessage('123');
};
// updateInfo(payload={}){
// debugger
// this._updateInfo(payload);
// let worker = new Worker(worker, {name: 'myWorker'});
// const {pressions} = payload;
// worker.onmessage = (event) =>{
// debugger
// const { routeMap={}, codeMap = {}} = event.data;
// console.log(routeMap, "routeMap", event.data);
// this.updateRouteMap(routeMap);
// this.updateCodeMap(codeMap);
// worker.terminate();
// }
// if(pressions&&pressions.length>0){
// debugger
// worker.postMessage(pressions);
// }
// }
const getIISAgentLog = () => {
if (loadingLog) {
return;
}
setLoadingLog(true);
GetIISAgentLog().then(res => {
setLoadingLog(false);
if (res.code === 0) {
let arr = [];
let list = res.data
......
......@@ -539,6 +539,7 @@ const UserManage = () => {
useEffect(() => {
setExpendKey(menuID);
console.log(expendKey);
}, [menuID]);
// 获取用户机构树
useEffect(() => {
......@@ -642,6 +643,8 @@ const UserManage = () => {
const rowSelection = {
selectedRowKeys,
onChange: (RowKeys, Rows) => {
console.log(RowKeys);
console.log(Rows);
setSelectedRowKeys(RowKeys);
getCheckList(RowKeys);
setUserIDs(RowKeys.toString()); // 数组转字符串,逗号连接
......@@ -1034,6 +1037,8 @@ const UserManage = () => {
// 删除机构
const deleteOrg = () => {
setDeleteOrgVisible(true);
console.log(orgID);
console.log(keep1);
if (orgID.id == keep1) {
setTreeState(true);
} else {
......@@ -1077,6 +1082,7 @@ const UserManage = () => {
const relateRole = record => {
// getEmptyRoleList(record.userId);
setMult('No');
console.log(record);
getRoleList(record);
setRoleVisible(true);
setCurrentUser(record);
......@@ -1104,10 +1110,12 @@ const UserManage = () => {
};
// 冻结用户
const freezeUser = record => {
console.log(currentUser);
// setFreezeUserVisible(true);
setCurrentUser(record);
setSelectColor(record);
let state = '';
console.log(record);
if (record.state === '0' || record.state === null) {
state = '1';
} else {
......@@ -1137,6 +1145,7 @@ const UserManage = () => {
};
// 删除用户
const deleteUser = record => {
console.log(record.userName);
setCurrentUser(record.userName);
setSelectColor(record);
DeleteUserNew({
......@@ -1213,73 +1222,30 @@ const UserManage = () => {
}
setTableLoading(true);
let data = searchWord != '' ? { key: searchWord } : '';
// GetUserByKeyNew(data)
// .then(res => {
// setSearchFlag(1);
// setTableLoading(false);
// if (res.code === 0) {
// setTotalSearch(res.data.length);
// setSelectedRowKeys([]); // 重置选中用户数
// setCurrentOrgOperate(true); // 禁止当前机构操作
// setMultiOperate(true); // 禁用批量操作
// setOrgTitle('全部机构搜索结果'); // 设置表头
// setCurrentSelectOrg('-1'); // 清空选中机构
// setShowSearchStyle(true);
// setTableData(res.data);
// setTableLength(res.data.length);
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.msg,
// });
// }
// })
// .catch(err => {
// message.error(err);
// });
getOneOUUserListNew(0, pageSize, 1, searchWord)
GetUserByKeyNew(data)
.then(res => {
setSearchFlag(1);
setTableLoading(false);
if (res.code === 0) {
setTotal(res.data.count);
setTotalSearch(res.data.length);
setSelectedRowKeys([]); // 重置选中用户数
setCurrentOrgOperate(true); // 禁止当前机构操作
setMultiOperate(true); // 禁用批量操作
setOrgTitle('全部机构搜索结果'); // 设置表头
setCurrentSelectOrg('-1'); // 清空选中机构
console.log(res.data);
setShowSearchStyle(true);
// 返回用户表数据结构处理,扁平化
let temp = res.data.data;
// 设置过滤字段
let arr = temp.map(item => item.groupName);
arr = arr.filter((value, index) => arr.indexOf(value) === index);
setOrgFilters(arr.map(item => ({ text: item, value: item })));
setTableLength(temp.length);
let datalist = [];
const table = temp.map((item, index) => {
if (item.loginName == 'panda' || item.loginName == 'admin') {
datalist.push(item.userId);
}
item.key = index;
return item;
});
setKeepDataList(datalist);
setTableData(table);
setTableData(res.data);
setTableLength(res.data.length);
} else {
setTableLoading(false);
notification.error({
message: '获取失败',
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(err => {
setTableLoading(false);
message.error(err);
});
};
......@@ -1290,12 +1256,16 @@ const UserManage = () => {
setLoading(true);
GetUserRelationListNew({ userId: e.userId })
.then(res => {
console.log(111);
if (res.code === 0) {
const { roleList, stationList } = res.data;
console.log(roleList);
setRolelist(roleList);
setStationlist(stationList);
setLoading(false);
} else {
console.log(res);
setLoading(false);
}
})
......@@ -1310,12 +1280,14 @@ const UserManage = () => {
setLoading(true);
GetUserRelationListNew({ userId: 0 })
.then(res => {
console.log(222);
if (res.code === 0) {
const { roleList, stationList } = res.data;
setRolelist(roleList);
setStationlist(stationList);
setLoading(false);
} else {
console.log(res.msg);
setLoading(false);
}
})
......@@ -1327,6 +1299,7 @@ const UserManage = () => {
};
const getCheckList = e => {
console.log(e);
let aa = [];
let bb = [];
loadAllUserRole(e).then(res => {
......@@ -1343,6 +1316,8 @@ const UserManage = () => {
bb.push(item1);
});
}
console.log(aa);
console.log(bb);
setMultiRoleList(aa);
setMultiStationList(bb);
}
......@@ -1371,6 +1346,7 @@ const UserManage = () => {
// .catch(err => {
// message.error(err);
// });
console.log(currentUser);
JumpToAnotherOUNew({
userId: currentUser.userId,
oldOUID: currentUser.groupId,
......@@ -1512,10 +1488,12 @@ const UserManage = () => {
keepDataList.length > 0 &&
keepDataList.map(i => {
let aa = userIDs.split(',').indexOf(i);
console.log(aa);
if (aa !== -1) {
data.push(aa);
}
});
console.log(data);
if (data.length > 0) {
notification.error({
message: '操作失败',
......@@ -1579,6 +1557,10 @@ const UserManage = () => {
// 更改机构范围
const submitExtent = (extent, areaName, flags) => {
setTreeLoading(true);
console.log(extent);
console.log(areaName);
console.log(flags);
console.log(currentSelectOrg1);
if (flags === 0) {
setTreeLoading(false);
notification.warn({
......@@ -1617,12 +1599,15 @@ const UserManage = () => {
};
// 树的拖拽
const handleDrop = infos => {
console.log(infos);
const dropKey = infos.node.key;
const dragKey = infos.dragNode.key;
const dropPos = infos.node.pos.split('-');
const dropPosition = infos.dropPosition - Number(dropPos[dropPos.length - 1]);
const datas = JSON.parse(JSON.stringify(treeData));
console.log(dropKey, 'dropKey');
console.log(dragKey, 'dragKey');
// 找到拖拽的元素
let dragObj;
let dropObj;
......@@ -1639,6 +1624,7 @@ const UserManage = () => {
});
// 将节点插入到正确的位置
if (!infos.dropToGap) {
console.log('33333333333');
dropObj.children = dropObj.children || [];
// 在哪里插入,示例添加到头部,可以是随意位置
dropObj.children.unshift(dragObj);
......@@ -1912,6 +1898,7 @@ const UserManage = () => {
marginRight: '5px',
}}
>
{searchFlag === 0 && (
<Pagination
total={total}
showTotal={(totals, range) => `第${range[0]}-${range[1]} 条/共 ${totals} 条`}
......@@ -1925,6 +1912,7 @@ const UserManage = () => {
size="small"
showQuickJumper
/>
)}
</div>
</div>
......
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