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

fix: '表字段形态优化,数据库升级功能优化可支持选择'

parent 51c90761
Pipeline #61426 passed with stages
...@@ -10,7 +10,7 @@ const VerifyModal = props => { ...@@ -10,7 +10,7 @@ const VerifyModal = props => {
{ lable: '身份证号(identity)', value: 'identity' }, { lable: '身份证号(identity)', value: 'identity' },
{ lable: '手机号(mobile)', value: 'mobile' }, { lable: '手机号(mobile)', value: 'mobile' },
{ lable: '银行卡号(bankAccount)', value: 'bankAccount' }, { lable: '银行卡号(bankAccount)', value: 'bankAccount' },
{ lable: '时间控制(timeControl)', value: 'timeControl' }, // { lable: '时间控制(timeControl)', value: 'timeControl' },
]); // 单选框数据 ]); // 单选框数据
const [checkDefaultValue, setCheckDefaultValue] = useState([]); // 复选框选择的数据 const [checkDefaultValue, setCheckDefaultValue] = useState([]); // 复选框选择的数据
const [maxLengthVlaue, setMaxLengthVlaue] = useState(''); // 最大字节长度值 const [maxLengthVlaue, setMaxLengthVlaue] = useState(''); // 最大字节长度值
...@@ -106,11 +106,15 @@ const VerifyModal = props => { ...@@ -106,11 +106,15 @@ const VerifyModal = props => {
onChange={CheckboxOnChange} onChange={CheckboxOnChange}
defaultValue={checkDefaultValue} defaultValue={checkDefaultValue}
> >
<Checkbox value="required">必填(required)</Checkbox> <Checkbox value="required" style={{ marginBottom: '10px' }}>
<Checkbox value="emphasis">强调(emphasis)</Checkbox> 必填(required)
<Checkbox value="sensitive" style={{ marginBottom: '10px' }}> </Checkbox>
敏感(sensitive) <Checkbox value="emphasis" style={{ marginBottom: '10px' }}>
强调(emphasis)
</Checkbox> </Checkbox>
{/* <Checkbox value="sensitive" style={{ marginBottom: '10px' }}>
敏感(sensitive)
</Checkbox> */}
<br /> <br />
<Input.Group size="small"> <Input.Group size="small">
......
...@@ -18,6 +18,7 @@ import styles from './ManagementDataBase.less'; ...@@ -18,6 +18,7 @@ import styles from './ManagementDataBase.less';
import { import {
tableCheck, tableCheck,
tableCheckNew, tableCheckNew,
newUpdateDateBase,
updateDateBase, updateDateBase,
databaseStandardGetLog, databaseStandardGetLog,
databaseStandardGetLogNew, databaseStandardGetLogNew,
...@@ -42,6 +43,8 @@ const ManagementDataBase = () => { ...@@ -42,6 +43,8 @@ const ManagementDataBase = () => {
const [repairTypeList, setRepairTypeList] = useState([]); const [repairTypeList, setRepairTypeList] = useState([]);
const [keepValue, setKeepValue] = useState([]); const [keepValue, setKeepValue] = useState([]);
const [list, setlist] = useState(['表', '字段', '主外键', '主键', '索引', '复合索引']); const [list, setlist] = useState(['表', '字段', '主外键', '主键', '索引', '复合索引']);
const [selectedRowKeys, setSelectedRowKeys] = useState([]); // 保存已选自动升级表键值
const [keepCheckList, setKeepChecklist] = useState([]); // 保存已选自动升级表值
// 检查数据库表 // 检查数据库表
useEffect(() => { useEffect(() => {
setCheckLoading(true); setCheckLoading(true);
...@@ -99,6 +102,16 @@ const ManagementDataBase = () => { ...@@ -99,6 +102,16 @@ const ManagementDataBase = () => {
} }
}); });
console.log(data); console.log(data);
console.log(arr);
let datalist = [];
if (arr.length > 0) {
arr.map(i => {
datalist.push(i.key);
});
}
console.log(datalist);
setSelectedRowKeys(datalist);
setKeepChecklist(arr);
setKeepValue(res.RepairTypeList); setKeepValue(res.RepairTypeList);
setRepairTypeList(data); setRepairTypeList(data);
setAutoCheck(arr); setAutoCheck(arr);
...@@ -157,10 +170,12 @@ const ManagementDataBase = () => { ...@@ -157,10 +170,12 @@ const ManagementDataBase = () => {
}; };
// 升级功能 // 升级功能
const handleUpdate = () => { const handleUpdate = () => {
console.log(keepCheckList);
console.log(selectedRowKeys);
if (repairTypeList.length > 0) { if (repairTypeList.length > 0) {
if (keepValue.length > 0) { if (keepValue.length > 0 && keepCheckList.length > 0) {
setCheckLoading(true); setCheckLoading(true);
updateDateBase({ checkeRepairTypes: keepValue.toString() }) newUpdateDateBase(keepCheckList)
.then(res => { .then(res => {
setCheckLoading(false); setCheckLoading(false);
setCheckFlag(checkFlag + 1); setCheckFlag(checkFlag + 1);
...@@ -409,47 +424,116 @@ const ManagementDataBase = () => { ...@@ -409,47 +424,116 @@ const ManagementDataBase = () => {
}; };
const check = e => { const check = e => {
console.log(e);
setCheckSql(e); setCheckSql(e);
}; };
const onChange = e => { const onChange = e => {
console.log(e);
console.log(autoCheckList);
let aa = [...autoCheck]; let aa = [...autoCheck];
let data = []; let data = [];
let name = [];
aa.map(i => { aa.map(i => {
if (e.indexOf(i.Type) != -1) { if (e.indexOf(i.Type) != -1) {
data.push(i); data.push(i);
} }
}); });
console.log(data);
setAutoCheckList(data); setAutoCheckList(data);
let a = [...keepCheckList];
let b = [...selectedRowKeys];
if (e.length > keepValue.length) {
e.map(k => {
if (keepValue.indexOf(k) == -1) {
aa.map(j => {
if (j.Type == k) {
a.push(j);
b.push(j.key);
}
});
}
});
setKeepChecklist(a);
setSelectedRowKeys(b);
} else {
let listaa = [];
let listbb = [];
a.map(i => {
if (data.indexOf(i) != -1) {
listaa.push(i);
listbb.push(i.key);
}
});
setKeepChecklist(listaa);
setSelectedRowKeys(listbb);
}
setKeepValue(e); setKeepValue(e);
}; };
// 复选框
const rowSelection = {
selectedRowKeys,
onChange: (RowKeys, Rows) => {
console.log(RowKeys);
console.log(Rows);
setSelectedRowKeys(RowKeys);
setKeepChecklist(Rows);
let aa = [];
Rows.map(i => {
aa.push(i.Type);
});
let data = [...new Set(aa)];
// setKeepValue(data);
},
};
return ( return (
<> <>
<PageContainer> <PageContainer>
<Card> <Card>
<div className={styles.tableTitle}> <div className={styles.tableTitle}>
<div style={{ display: 'inline-block' }}>
<span style={{ marginRight: '100px' }}>升级详情</span> <span style={{ marginRight: '100px' }}>升级详情</span>
{repairTypeList.length > 0 && ( {repairTypeList.length > 0 && (
<> <>
<span>升级类型</span> <span>类型筛选</span>
<div style={{ display: 'inline-block' }}> <div style={{ display: 'inline-block' }}>
<Checkbox.Group options={repairTypeList} value={keepValue} onChange={onChange} /> <Checkbox.Group
options={repairTypeList}
value={keepValue}
onChange={onChange}
/>
</div> </div>
</> </>
)} )}
</div> </div>
<div style={{ display: 'inline-block' }}>
<strong>
(已选
<span style={{ color: 'rgb(24, 144, 255)' }}>{keepCheckList.length}</span>/共
{autoCheckList.length}条)
</strong>
</div>
</div>
<Spin tip="loading..." spinning={checkLoading}> <Spin tip="loading..." spinning={checkLoading}>
<Table <Table
rowSelection={{
type: 'checkbox',
...rowSelection,
}}
className={styles.mgTop20} className={styles.mgTop20}
columns={autoCheckColumns} columns={autoCheckColumns}
dataSource={autoCheckList} dataSource={autoCheckList}
bordered bordered
size="small" size="small"
scroll={{
y: '390px',
}}
pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20],
defaultPageSize: 10,
showQuickJumper: true,
showSizeChanger: true,
}}
/> />
<div className={styles.btnBox}> <div className={styles.btnBox}>
<Space> <Space>
...@@ -458,7 +542,7 @@ const ManagementDataBase = () => { ...@@ -458,7 +542,7 @@ const ManagementDataBase = () => {
</Button> </Button>
<Popconfirm <Popconfirm
title=" title="
是否根据已选类型,升级当前连接数据库?" 是否根据已选数据,升级当前连接数据库?"
okText="确认" okText="确认"
cancelText="取消" cancelText="取消"
onConfirm={() => { onConfirm={() => {
......
.tableTitle{ .tableTitle{
font-size: 16px; font-size: 16px;
display: flex;
justify-content: space-between;
} }
.mgTop20{ .mgTop20{
margin-top: 20px !important; margin-top: 20px !important;
......
...@@ -56,6 +56,7 @@ const VectorData = props => { ...@@ -56,6 +56,7 @@ const VectorData = props => {
{ {
title: '编辑', title: '编辑',
align: 'center', align: 'center',
width: 260,
render: (text, record, index) => ( render: (text, record, index) => (
<Space> <Space>
<Button type="primary" size="small" onClick={() => metadata(record)}> <Button type="primary" size="small" onClick={() => metadata(record)}>
......
...@@ -98,6 +98,10 @@ export const databaseStandardGetLogNew = params => ...@@ -98,6 +98,10 @@ export const databaseStandardGetLogNew = params =>
// 更新 // 更新
export const updateDateBase = params => get(`${PUBLISH_SERVICE}/DBManager/UpdateDataBase`, params); export const updateDateBase = params => get(`${PUBLISH_SERVICE}/DBManager/UpdateDataBase`, params);
// 更新
export const newUpdateDateBase = params =>
post(`${PUBLISH_SERVICE}/DBManager/UpdateDataBase`, params);
/** /**
* @数据库连接配置 * @数据库连接配置
*/ */
......
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