Commit a40aa728 authored by 皮倩雯's avatar 皮倩雯

fix: '数据库连接配置mysql新增可配置端口'

parent 0084e07f
Pipeline #49484 skipped with stages
/* eslint-disable no-else-return */
/* eslint-disable prefer-promise-reject-errors */
/* eslint-disable camelcase */
import React, { useState, useEffect } from 'react';
import { Form, Input, Select, Tooltip, Button, notification, Drawer, Space } from 'antd';
......@@ -13,7 +15,16 @@ import ChangeAdd from './changeAdd';
const { Option } = Select;
const { TextArea } = Input;
const BookConfig = props => {
const { callBackSubmit, type, formObj, visible, tableData, onCancel, maxLength } = props;
const {
callBackSubmit,
type,
formObj,
visible,
tableData,
onCancel,
maxLength,
keepTableData,
} = props;
const [standingTable, setStandingTable] = useState([]);
const [isVisible, setIsVisible] = useState(false); // 弹窗
const [pickItem, setPickItem] = useState(''); // 选择的字段
......@@ -36,6 +47,14 @@ const BookConfig = props => {
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
// let aa = form.getFieldsValue().Name;
// if (keepTableData.find(i => i.name == aa) && aa != formObj.name) {
// notification.warning({
// message: '提示',
// duration: 3,
// description: '台账名称已存在',
// });
// } else {
let obj =
type === 'add'
? { ...validate, Order: maxLength }
......@@ -65,6 +84,7 @@ const BookConfig = props => {
description: '网络异常请稍后再试',
});
});
// }
}
});
};
......@@ -211,6 +231,7 @@ const BookConfig = props => {
form.setFieldsValue({ Type: value });
}
};
return (
<Drawer
title={`${type === 'add' ? '台账配置' : '台账编辑'}`}
......@@ -250,7 +271,26 @@ const BookConfig = props => {
<Option value="设备">设备</Option>
</Select>
</Item>
<Item label="台账名称" name="Name" rules={[{ required: true, message: '请输入台账名称' }]}>
<Item
label="台账名称"
name="Name"
rules={[
{
required: true,
validator: (rule, value) => {
if (
keepTableData.find(i => i.name == form.getFieldsValue().Name) &&
form.getFieldsValue().Name != formObj.name
) {
return Promise.reject('台账名称已存在');
} else if (form.getFieldsValue().Name == '') {
return Promise.reject('台账名称不能为空');
}
return Promise.resolve();
},
},
]}
>
<Input placeholder="台账名称不可重复" allowClear />
</Item>
<Item label="台账表" name="TableName" rules={[{ required: true, message: '请选择台账表' }]}>
......
......@@ -43,6 +43,7 @@ const StandingBook = props => {
const [searchWord, setSearchWord] = useState(''); // 关键字
const [searchData, setSearchData] = useState([]);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [keepTableData, setKeepTableData] = useState([]);
const { Item } = Form;
const { Search } = Input;
......@@ -170,6 +171,7 @@ const StandingBook = props => {
setTreeLoading(false);
if (res.msg === 'Ok' && res.data.root) {
console.log(res.data.root);
setKeepTableData(res.data.root);
setMaxLength(res.data.root.length + 1);
let arr = formateArrDataA(res.data.root, 'type');
let newArr = [];
......@@ -468,6 +470,7 @@ const StandingBook = props => {
callBackSubmit={onSubmit}
onCancel={() => setIsVisible(false)}
tableData={tableData}
keepTableData={keepTableData}
/>
</div>
</PageContainer>
......
......@@ -169,17 +169,45 @@ const WebDic = () => {
dataIndex: 'nodeName',
key: 'nodeName',
className: 'column',
onCell: () => ({
style: {
maxWidth: 200,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
},
{
title: () => <span className={styles.font}></span>,
dataIndex: 'nodeValue',
key: 'nodeValue',
// width: 400,
className: 'column',
onCell: () => ({
style: {
maxWidth: 300,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
render: record => {
if (!record) {
return '-';
}
return record;
return (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
);
},
},
{
......
......@@ -76,15 +76,22 @@ const AddModal = props => {
};
const onFinish = value => {};
useEffect(() => {
switch (type) {
case 'add':
form.resetFields();
break;
case 'edit':
form.setFieldsValue({ ...formObj });
break;
default:
break;
if (visible) {
switch (type) {
case 'add':
form.setFieldsValue({ port: 3306 });
break;
case 'edit':
form.setFieldsValue({ ...formObj });
if (!formObj.port) {
form.setFieldsValue({ port: 3306 });
}
break;
default:
break;
}
} else {
form.resetFields();
}
}, [visible]);
const layout = {
......@@ -118,6 +125,9 @@ const AddModal = props => {
<Item label="IP" name="ip" rules={[{ required: true, message: '请输入IP' }]}>
<Input placeholder="请输入IP" allowClear />
</Item>
<Item label="端口" name="port" rules={[{ required: true, message: '请输入端口' }]}>
<Input placeholder="请输入端口号" allowClear />
</Item>
<Item
label="数据库名"
name="dbName"
......
......@@ -62,7 +62,7 @@ const videoManager = () => {
title: '名称',
dataIndex: 'Name',
key: 'Name',
width: 200,
// width: 200,
align: 'center',
onCell: () => ({
style: {
......@@ -90,7 +90,7 @@ const videoManager = () => {
title: '登录名',
dataIndex: 'LoginName',
key: 'LoginName',
width: 350,
// width: 350,
align: 'center',
render: item => searchStyle(item),
},
......@@ -113,7 +113,7 @@ const videoManager = () => {
title: '通道ID',
dataIndex: 'PassageId',
key: 'PassageId',
width: 150,
// width: 150,
align: 'center',
onCell: () => ({
style: {
......@@ -155,7 +155,7 @@ const videoManager = () => {
// title: '录入时间',
dataIndex: 'CreateTime',
key: 'CreateTime',
width: 150,
// width: 150,
align: 'center',
title: (
<div>
......
.videoManagerContainer{
.ant-table-pagination.ant-pagination {
margin: 2px 0;
}
.head{
padding: 10px;
background: white;
margin-bottom: 2px;
min-width: 1030px;
}
.ant-card-body {
padding: 0px 24px 24px 17px;
}
.sel{
width: 200px;
}
.icon{
margin-top: -5px !important;
vertical-align: text-bottom;
}
.redText{
color: red;
}
.videoManagerContainer {
.ant-table-pagination.ant-pagination {
margin: 2px 0;
}
.ant-input[disabled] {
color: rgba(0, 0, 0, 0.5);
.head {
padding: 10px;
background: white;
margin-bottom: 2px;
width: 100%;
}
.ant-card-body {
padding: 0px 24px 24px 17px;
}
.sel {
width: 200px;
}
.icon {
margin-top: -5px !important;
vertical-align: text-bottom;
}
.redText {
color: red;
}
}
.ant-input[disabled] {
color: rgba(0, 0, 0, 0.5);
}
.ant-select-disabled.ant-select:not(.ant-select-customize-input) .ant-select-selector {
color: rgba(0, 0, 0, 0.5);
color: rgba(0, 0, 0, 0.5);
}
......@@ -85,7 +85,7 @@ const MiniMenu = props => {
return {
title: (
<div className={styles.title}>
<div>{obj.text}</div>
<div className={styles.titleText}>{obj.text}</div>
<div className={styles.tip}>
{obj.menuType === 'Web4MenuGroup' && (
<Tooltip title="导入导出菜单组" className={styles.fs}>
......@@ -490,6 +490,7 @@ const MiniMenu = props => {
};
// 树的拖动
const handleDrop = infos => {
debugger;
const dropKey = infos.node.key;
const dragKey = infos.dragNode.key;
const dropPos = infos.node.pos.split('-');
......
......@@ -58,6 +58,12 @@
align-items: center;
width: 100%;
}
.titleText {
width: 20rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.tip {
display: none;
}
......
......@@ -79,6 +79,7 @@
display: flex;
align-items: center;
margin-right: -8px;
margin-left: 5px;
// color:#1890FF;
.ant-tree-switcher-line-icon {
// margin-left: 5px;
......
......@@ -428,7 +428,7 @@ const UserManage = () => {
setHoverItemIndex('');
}}
>
<Tooltip title="" className={styles.fs1}>
<Tooltip title="添加用户" className={styles.fs1}>
<UserAddOutlined
style={{ marginLeft: 20, lineHeight: '24px' }}
onClick={e => {
......
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