Commit c698c607 by zhaochengxiang

去掉警告

parent e45643b1
...@@ -2,7 +2,6 @@ import React, { useState, useEffect, useContext } from "react"; ...@@ -2,7 +2,6 @@ import React, { useState, useEffect, useContext } from "react";
import { Modal, Space, Button, Form } from "antd"; import { Modal, Space, Button, Form } from "antd";
import ImportAction from "./ImportAction"; import ImportAction from "./ImportAction";
import { inheritanceHistoricalType, inheritanceZipperType } from "./ImportActionInherited";
import { EditInheritedModelContext } from "./ContextManage"; import { EditInheritedModelContext } from "./ContextManage";
const FC = (props) => { const FC = (props) => {
...@@ -19,6 +18,7 @@ const FC = (props) => { ...@@ -19,6 +18,7 @@ const FC = (props) => {
} else { } else {
setModelerData(undefined); setModelerData(undefined);
} }
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible]) }, [visible])
const onChange = (newModelerData) => { const onChange = (newModelerData) => {
......
...@@ -5,7 +5,7 @@ import { DownOutlined, UpOutlined } from "@ant-design/icons"; ...@@ -5,7 +5,7 @@ import { DownOutlined, UpOutlined } from "@ant-design/icons";
import Preview from './InheritedPreview'; import Preview from './InheritedPreview';
import { EditInheritedModelContext } from "./ContextManage"; import { EditInheritedModelContext } from "./ContextManage";
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
import { Action, CatalogId, ModelerId, Hints, ModelerData, PermitCheckOut, Editable, StateId, Holder, DDL, DataModelerRoleReader, ReadOnly } from '../../../../util/constant'; import { Action, ModelerId, PermitCheckOut, Editable, StateId, Holder, ReadOnly } from '../../../../util/constant';
export const inheritanceHistoricalType = 'historical'; export const inheritanceHistoricalType = 'historical';
export const inheritanceZipperType = 'zipper'; export const inheritanceZipperType = 'zipper';
...@@ -48,6 +48,7 @@ const FC = (props) => { ...@@ -48,6 +48,7 @@ const FC = (props) => {
} }
} }
} }
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [editable, modelerData]) }, [editable, modelerData])
const getInheriteDataModel = (type) => { const getInheriteDataModel = (type) => {
...@@ -124,7 +125,7 @@ const FC = (props) => { ...@@ -124,7 +125,7 @@ const FC = (props) => {
} }
key={inheritanceHistoricalType} key={inheritanceHistoricalType}
> >
{ !collapse && <Preview modelerData={modelerData} type={inheritanceHistoricalType} /> } { !collapse && <Preview modelerData={historicalModelerData} type={inheritanceHistoricalType} /> }
</Tabs.TabPane> </Tabs.TabPane>
<Tabs.TabPane <Tabs.TabPane
tab={ tab={
...@@ -140,7 +141,7 @@ const FC = (props) => { ...@@ -140,7 +141,7 @@ const FC = (props) => {
} }
key={inheritanceZipperType} key={inheritanceZipperType}
> >
{ !collapse && <Preview modelerData={modelerData} type={inheritanceZipperType} /> } { !collapse && <Preview modelerData={zipperModelerData} type={inheritanceZipperType} /> }
</Tabs.TabPane> </Tabs.TabPane>
</Tabs> : <div className='flex' style={{ alignItems: 'center' }}> </Tabs> : <div className='flex' style={{ alignItems: 'center' }}>
<h2 className='mr-3' style={{ marginBottom: 0 }}>历史存储形式</h2> <h2 className='mr-3' style={{ marginBottom: 0 }}>历史存储形式</h2>
......
...@@ -1012,7 +1012,11 @@ export const ImportActionTable = (props) => { ...@@ -1012,7 +1012,11 @@ export const ImportActionTable = (props) => {
icon={<DeleteOutlined style={{ color: 'red' }} />} icon={<DeleteOutlined style={{ color: 'red' }} />}
onClick={(event) => { onClick={(event) => {
event.stopPropagation(); event.stopPropagation();
remove(record); if (record.inherited || record.provided) {
showMessage('warn', '衍生表中自动生成的字段不允许删除');
} else {
remove(record);
}
}} }}
/> />
</React.Fragment> </React.Fragment>
...@@ -1300,8 +1304,8 @@ export const ImportActionTable = (props) => { ...@@ -1300,8 +1304,8 @@ export const ImportActionTable = (props) => {
if (record?.partOfPrimaryKeyLogically) { if (record?.partOfPrimaryKeyLogically) {
return 'editable-row primary-row'; return 'editable-row primary-row';
} }
if (record?.modelingTemplateTag?.id) { if (record?.provided || record?.inherited || record?.modelingTemplateTag?.id) {
return 'editable-row template-highlight-row'; return 'editable-row gray-row';
} }
} }
...@@ -1324,7 +1328,11 @@ export const ImportActionTable = (props) => { ...@@ -1324,7 +1328,11 @@ export const ImportActionTable = (props) => {
if (!isEditing(record)) { if (!isEditing(record)) {
rowParams = {...rowParams, onClick: (event) => { rowParams = {...rowParams, onClick: (event) => {
event.stopPropagation(); event.stopPropagation();
edit(record); if (record.inherited || record.provided) {
showMessage('warn', '衍生表中自动生成的字段不允许编辑');
} else {
edit(record);
}
} }
} }
......
...@@ -11,21 +11,16 @@ ...@@ -11,21 +11,16 @@
} }
} }
.template-highlight-row {
.yy-table-cell {
background-color: #f7f7f7 !important;
}
}
.attention-row { .primary-row {
.yy-table-cell { .yy-table-cell {
background-color: #fff9ed !important; background-color: #d3ebff !important;
} }
} }
.primary-row { .gray-row {
.yy-table-cell { .yy-table-cell {
background-color: #d3ebff !important; background-color: #f7f7f7 !important;
} }
} }
} }
\ No newline at end of file
import React, { useEffect, useState, useMemo } from "react"; import React, { useState, useMemo } from "react";
import { Row, Col, Tooltip, Typography, Space, Button } from "antd"; import { Row, Col, Tooltip, Typography, Button } from "antd";
import DataGrid from '../../VirtualTable'; import DataGrid from '../../VirtualTable';
import EditInherited from './EditInherited'; import EditInherited from './EditInherited';
import { inheritanceHistoricalType, inheritanceZipperType } from "./ImportActionInherited";
import './InheritedPreview.less';
const FC = (props) => { const FC = (props) => {
const { modelerData, type } = props; const { modelerData, type } = props;
...@@ -192,12 +193,19 @@ const Table = ({ data }) => { ...@@ -192,12 +193,19 @@ const Table = ({ data }) => {
return ( return (
<DataGrid <DataGrid
className='inherited-preview'
style={{ blockSize: 146 }} style={{ blockSize: 146 }}
columns={cols} columns={cols}
rows={data||[]} rows={data||[]}
headerHeight={30} headerHeight={30}
rowHeight={36} rowHeight={36}
rowClassName={(row) => { rowClassName={(row) => {
if (row?.partOfPrimaryKeyLogically) {
return 'primary-row';
}
if (row?.provided || row?.inherited || row?.modelingTemplateTag?.id) {
return 'gray-row';
}
return '' return ''
}} }}
/> />
......
.inherited-preview {
.primary-row {
background-color: #d3ebff !important;
}
.gray-row {
background-color: #f7f7f7 !important;
}
}
\ No newline at end of file
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