Commit 917d8621 by zhaochengxiang

bug fix

parent c5dd845d
...@@ -358,6 +358,89 @@ const BasicForm = React.forwardRef(function ({ type, task }, ref) { ...@@ -358,6 +358,89 @@ const BasicForm = React.forwardRef(function ({ type, task }, ref) {
) )
}) })
const MetadataRangeItem = ({ value, onChange }) => {
const [loading, setLoading] = React.useState(false)
const [treeData, setTreeData] = React.useState()
React.useEffect(() => {
getSystems()
}, [])
const getSystems = () => {
setLoading(true)
dispatch({
type: 'assetmanage.getDatasources',
payload: {
//zcx todo
catalog: 1
},
callback: (data) => {
setLoading(false)
const newTreeData = produce(data??[], draft => {
for (let item of draft??[]) {
item.key = item.catalogId
item.title = item.catalogName
item.id = item.catalogId
item.idStr = `${item.catalogId}`
item.value = item.catalogId
item.children = []
for (let child of item.scopes??[]) {
child.key = `${item.catalogId}-${child.scopeId}`
child.title = child.scopeName
child.id = item.scopeId
child.idStr = `${child.scopeId}`
child.value = `${item.catalogId}-${child.scopeId}`
item.children.push(child)
}
}
})
setTreeData(newTreeData)
},
erorr: () => {
setLoading(false)
}
})
}
const onLoadData = (node) => {
console.log('node', node)
new Promise(resolve => {
if (node?.children) {
resolve()
return
}
// setTimeout(() => {
// setTreeData(origin =>
// updateTreeData(origin, key, [
// { title: 'Child Node', key: `${key}-0` },
// { title: 'Child Node', key: `${key}-1` },
// ]),
// );
// resolve();
// }, 1000);
});
}
console.log('tree data', treeData)
return (
<div>
<TreeSelect
loading={loading}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={treeData}
loadData={onLoadData}
placeholder="请选择元数据范围"
/>
</div>
)
}
const Range = React.forwardRef(function ({ type, task }, ref) { const Range = React.forwardRef(function ({ type, task }, ref) {
const [ranges, setRanges] = React.useState() const [ranges, setRanges] = React.useState()
const [isAdding, setAdding] = React.useState(false) const [isAdding, setAdding] = React.useState(false)
...@@ -465,6 +548,15 @@ const Range = React.forwardRef(function ({ type, task }, ref) { ...@@ -465,6 +548,15 @@ const Range = React.forwardRef(function ({ type, task }, ref) {
/> />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}>
<Form.Item
label="数据元数据范围"
name="modelCatalogId"
rules={[{ required: true, message: '请选择元数据范围!' }]}
>
<MetadataRangeItem />
</Form.Item>
</Col>
</Row> </Row>
</Form> </Form>
} }
......
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