peng.peng 2 years ago
parent
commit
8463a6b3ad
  1. 26
      web/client/src/sections/metadataManagement/components/metadataDatabModal.js
  2. 9
      web/client/src/sections/metadataManagement/containers/latestMetadata.js
  3. 1
      web/client/src/sections/metadataManagement/containers/metadataTab.js
  4. 1
      web/client/src/sections/metadataManagement/routes.js

26
web/client/src/sections/metadataManagement/components/metadataDatabModal.js

@ -19,15 +19,15 @@ const MetadataDatabaseModal = (props) => {
} }
return Promise.resolve(); return Promise.resolve();
} }
const renderModel = () => { const renderModelItems = () => {
const items = metadataModels.map(m => { const items = metadataModels.map(m => {
if (m.control === '文本框') { if (m.control === '文本框') {
const rules = [{ required: m.nullable, message: '' }, const rules = [{ required: !m.nullable, message: '' }]
{ max: m.length, message: `${m.attributeName}不超过${m.length}个字符` }] if (!m.nullable) {
if (m.nullable) {
rules.push(({ getFieldValue, validateFields }) => ({ rules.push(({ getFieldValue, validateFields }) => ({
validator(_, value) { return validatorNull(_, value, getFieldValue, validateFields, m.attributeName) } validator(_, value) { return validatorNull(_, value, getFieldValue, validateFields, m.attributeName) }
})) }))
rules.push({ max: m.length, message: `${m.attributeName}不超过${m.length}个字符` })
} }
return <Form.Item return <Form.Item
label={m.attributeName} label={m.attributeName}
@ -36,17 +36,25 @@ const MetadataDatabaseModal = (props) => {
<Input style={{ width: '90%' }} placeholder={`请输入${m.attributeName}`} /> <Input style={{ width: '90%' }} placeholder={`请输入${m.attributeName}`} />
</Form.Item> </Form.Item>
} else if (m.control === '数字输入框') { } else if (m.control === '数字输入框') {
const rules = [{ required: !m.nullable, message: `${m.attributeName}不可空` }]
let maxValue = '';
if (m.length) {
while (m.length > 0) {
maxValue += '9'
m.length--;
}
}
return <Form.Item return <Form.Item
label={m.attributeName} label={m.attributeName}
name={m.attributeCode} name={m.attributeCode}
rules={[{ required: m.nullable, message: '' }, { max: m.length || 0 }]}> rules={rules}>
<InputNumber style={{ width: '90%' }} placeholder={`请输入${m.attributeName}`} /> <InputNumber min={0} max={maxValue ? parseInt(maxValue) : 0} style={{ width: '90%' }} placeholder={`请输入${m.attributeName}`} />
</Form.Item> </Form.Item>
} else { } else {
return <Form.Item return <Form.Item
label={m.attributeName} label={m.attributeName}
name={m.attributeCode} name={m.attributeCode}
rules={[{ required: m.nullable, message: '' }]}> rules={[{ required: !m.nullable, message: `${m.attributeName}不可空` }]}>
<Select <Select
placeholder={`请选择${m.attributeName}`} placeholder={`请选择${m.attributeName}`}
style={{ width: '90%' }} style={{ width: '90%' }}
@ -109,7 +117,7 @@ const MetadataDatabaseModal = (props) => {
name='path' name='path'
rules={[{ required: true }]} rules={[{ required: true }]}
> >
<Input disabled style={{ width: '90%' }} /> <TextArea disabled rows={1} style={{ width: '90%' }} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='详情' label='详情'
@ -117,7 +125,7 @@ const MetadataDatabaseModal = (props) => {
rules={[{ max: 255, message: `描述不超过255个字符` }]}> rules={[{ max: 255, message: `描述不超过255个字符` }]}>
<TextArea rows={4} style={{ width: '90%' }} placeholder={`请输入描述`} /> <TextArea rows={4} style={{ width: '90%' }} placeholder={`请输入描述`} />
</Form.Item> </Form.Item>
{renderModel()} {renderModelItems()}
</Form> </Form>
</Modal> </Modal>
) )

9
web/client/src/sections/metadataManagement/containers/latestMetadata.js

@ -29,6 +29,7 @@ const LatestMetadata = (props) => {
dispatch(metadataManagement.getResourceCatalog()).then(res => { dispatch(metadataManagement.getResourceCatalog()).then(res => {
const { data } = res.payload; const { data } = res.payload;
if (res.success) { if (res.success) {
allTreeNodeKeys = []
const resourceCatalogData = getTreeNodeData(data, null, 'rc'); const resourceCatalogData = getTreeNodeData(data, null, 'rc');
setResourceCatalogData(resourceCatalogData); setResourceCatalogData(resourceCatalogData);
if (data.length) { if (data.length) {
@ -39,7 +40,6 @@ const LatestMetadata = (props) => {
setSelectedKeys(expandedKeysData); setSelectedKeys(expandedKeysData);
setExpandedKeys(expandedKeys); setExpandedKeys(expandedKeys);
expandedKeysData = []; expandedKeysData = [];
allTreeNodeKeys = [];
} }
} else { } else {
setExpandedKeys([]); setExpandedKeys([]);
@ -81,16 +81,16 @@ const LatestMetadata = (props) => {
const setTreeNodeTitle = (name) => { const setTreeNodeTitle = (name) => {
let content = <span>{name}</span> let content = <span>{name}</span>
if (name.length > 10) { if (name.length > 6) {
content = <Tooltip title={name}> content = <Tooltip title={name}>
{name.substring(0, 10) + '...'} {name.substring(0, 6) + '...'}
</Tooltip> </Tooltip>
} }
return content; return content;
} }
const renderTreeNode = (ds, dataSource) => { const renderTreeNode = (ds, dataSource) => {
return <div className={theStyle.icon}> return <div className={theStyle.icon} style={{ width: 180 }}>
{setTreeNodeTitle(ds.name)} {setTreeNodeTitle(ds.name)}
<EditOutlined title='修改' style={{ marginLeft: 10 }} className={theStyle.tip} onClick={() => { <EditOutlined title='修改' style={{ marginLeft: 10 }} className={theStyle.tip} onClick={() => {
let record = JSON.parse(JSON.stringify(ds)); let record = JSON.parse(JSON.stringify(ds));
@ -164,7 +164,6 @@ const LatestMetadata = (props) => {
resourceCatalogKey={resourceCatalogKey} resourceCatalogKey={resourceCatalogKey}
resourceCatalogPath={resourceCatalogPath} history={history} /> resourceCatalogPath={resourceCatalogPath} history={history} />
} }
{/* {props.children} */}
</Col> </Col>
</Row> </Row>
{ {

1
web/client/src/sections/metadataManagement/containers/metadataTab.js

@ -4,7 +4,6 @@ import { Tabs } from 'antd';
import DatabaseTable from './databasesTable'; import DatabaseTable from './databasesTable';
import FilesTable from './filesTable'; import FilesTable from './filesTable';
import RestapisTable from './restapisTable'; import RestapisTable from './restapisTable';
import { push } from 'react-router-redux';
const MetadataTab = (props) => { const MetadataTab = (props) => {
const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch, history } = props; const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch, history } = props;

1
web/client/src/sections/metadataManagement/routes.js

@ -22,6 +22,7 @@ export default [{
{ {
path: '/detail/:id', path: '/detail/:id',
key: 'metadataDetail', key: 'metadataDetail',
// component: MetadataDetails,
component: LatestMetadata, component: LatestMetadata,
breadcrumb: '元数据详情' breadcrumb: '元数据详情'
} }

Loading…
Cancel
Save