|
@@ -1,6 +1,6 @@
|
|
|
import React, { useState, useEffect, useRef } from 'react';
|
|
|
import { useSelector, useDispatch } from 'react-redux';
|
|
|
-import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message } from 'antd';
|
|
|
+import { Form, Input, Button, Table, Row, Col, Select, Modal, Spin, Space, message } from 'antd';
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
import '@common/common.less';
|
|
|
import apiObj from '@api/index';
|
|
@@ -18,6 +18,7 @@ function FieldRules() {
|
|
|
const [visible, setVisible] = useState(false);
|
|
|
const [size, setSize] = useState(15);
|
|
|
const [current, setCurrent] = useState(1);
|
|
|
+ const [loading, setLoading] = useState(false);
|
|
|
const [regularList, setRegularList] = useState([]);//正则式数据
|
|
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
|
const [tableList, setTableList] = useState([]);//表名称
|
|
@@ -43,20 +44,28 @@ function FieldRules() {
|
|
|
return state.userInfo;
|
|
|
});
|
|
|
useEffect(() => {
|
|
|
+ setCurrent(1)
|
|
|
+ setParams(data)
|
|
|
form.resetFields();
|
|
|
getRegular()
|
|
|
getTableName()
|
|
|
getColumnName('', '', '', '')
|
|
|
- getColumnVerifyPage();
|
|
|
+ getColumnVerifyPage(data);
|
|
|
+ setSelectedRowKeys([])
|
|
|
+ setDisable(true)
|
|
|
}, [rulerNum]);
|
|
|
//表格数据
|
|
|
function getColumnVerifyPage(param) {
|
|
|
+ const hide = message.loading('加载中...', 0);
|
|
|
post(api.getColumnVerifyPage, param || params).then((res) => {
|
|
|
+ hide()
|
|
|
if (res.data.code === 200) {
|
|
|
const data = res.data.data;
|
|
|
setLogList(data.records);
|
|
|
setTotal(data.total)
|
|
|
}
|
|
|
+ }).catch((err) => {
|
|
|
+ hide()
|
|
|
})
|
|
|
}
|
|
|
//获取正则式名称
|
|
@@ -233,7 +242,9 @@ function FieldRules() {
|
|
|
getColumnName('', '', value, '')
|
|
|
if (value) {
|
|
|
form.setFieldsValue({
|
|
|
- tableEname: option.val
|
|
|
+ tableEname: option.val,
|
|
|
+ columnCname: undefined,
|
|
|
+ columnEname: undefined,
|
|
|
});
|
|
|
setDisable(false)
|
|
|
} else {
|
|
@@ -252,7 +263,9 @@ function FieldRules() {
|
|
|
getColumnName('', '', '', value)
|
|
|
if (value) {
|
|
|
form.setFieldsValue({
|
|
|
- tableCname: option.val
|
|
|
+ tableCname: option.val,
|
|
|
+ columnCname: undefined,
|
|
|
+ columnEname: undefined,
|
|
|
});
|
|
|
setDisable(false)
|
|
|
} else {
|
|
@@ -321,7 +334,6 @@ function FieldRules() {
|
|
|
getColumnVerifyPage(data);
|
|
|
setSelectedRowKeys([])
|
|
|
setDisable(true)
|
|
|
-
|
|
|
};
|
|
|
const columns = [
|
|
|
{ title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1, width: 60 },
|
|
@@ -466,7 +478,6 @@ function FieldRules() {
|
|
|
</Space>
|
|
|
|
|
|
</div>
|
|
|
-
|
|
|
<Table
|
|
|
columns={columns}
|
|
|
rowSelection={rowSelection}
|
|
@@ -484,6 +495,7 @@ function FieldRules() {
|
|
|
onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
|
|
|
total: total
|
|
|
}} />
|
|
|
+
|
|
|
</div>
|
|
|
<Modal
|
|
|
title="删除字段校验规则"
|