Commit adba7530 by zhaochengxiang

来源模型名称调用接口

parent 304bfc55
......@@ -17,6 +17,10 @@ export function* listElementsAndFillValue(payload) {
return yield call(service.listElementsAndFillValue, payload)
}
export function* listSupportSourceModels() {
return yield call(service.listSupportSourceModels)
}
export function* listUserElements() {
return yield call(service.listUserElements);
}
......
......@@ -240,6 +240,10 @@ export function fillElementValueBeforeCreate(payload) {
return PostJSON("/dataassetmanager/eleAndAttrApi/fillElementValueBeforeCreate", payload);
}
export function listSupportSourceModels() {
return GetJSON("/dataassetmanager/eleAndAttrApi/listSupportSourceModels");
}
export function countResourceState(payload) {
return GetJSON("/dataassetmanager/countApi/countResourceState", payload);
}
......
......@@ -102,7 +102,7 @@ const MetaModelSelect = ({ value = {}, metaModelTreeData = [], onChange, ...rest
}
const AttributeRelationWithSourceModel = (props) => {
const { elements, sourceModel, metadataModelTreeData, activeKey, onChange } = props;
const { elements, sourceModel, supportSourceModelsName, metadataModelTreeData, activeKey, onChange } = props;
const [ loading, setLoading ] = useState(false)
const [ confirmLoading, setConfirmLoading ] = useState(false);
......@@ -238,7 +238,19 @@ const AttributeRelationWithSourceModel = (props) => {
name='sourceModel'
rules={[{ required: true, message: '请输入来源名称'}]}
>
<Input placeholder='请输入来源模型名称' disabled={sourceModel} />
<Select
allowClear
placeholder='请选择来源模型名称'
disabled={sourceModel}
>
{
supportSourceModelsName?.map((name, index) => {
return <Select.Option key={index} value={name}>
{ name }
</Select.Option>
})
}
</Select>
</Form.Item>
{
(elements||[]).map((element, index) => {
......@@ -263,6 +275,7 @@ const AttributeRelationWithSourceModel = (props) => {
const AttributeRelationModal = (props) => {
const { visible, onCancel } = props;
const [ supportSourceModelsName, setSupportSourceModelsName ] = useState()
const [ loadingSourceModels, setLoadingSourceModels] = useState(false)
const [ sourceModels, setSourceModels ] = useState()
const [ metadataModelTreeData, setMetadataModelTreeData ] = useState([]);
......@@ -273,6 +286,7 @@ const AttributeRelationModal = (props) => {
useEffect(() => {
if (visible) {
getSupportSourceModelsName();
getSourceModels();
loadElementWithoutCustom();
getMetadataModelTree();
......@@ -284,6 +298,16 @@ const AttributeRelationModal = (props) => {
return [...sourceModels||[], AddSourceModelName]
}, [sourceModels])
const getSupportSourceModelsName = () => {
dispatch({
type: 'assetmanage.listSupportSourceModels',
callback: (data) => {
console.log('data', data)
setSupportSourceModelsName(data||[])
},
})
}
const getSourceModels = () => {
setLoadingSourceModels(true)
dispatch({
......@@ -381,6 +405,7 @@ const AttributeRelationModal = (props) => {
return <Tabs.TabPane tab={item} key={item}>
<AttributeRelationWithSourceModel
elements={elements}
supportSourceModelsName={supportSourceModelsName}
metadataModelTreeData={metadataModelTreeData}
sourceModel={item === AddSourceModelName ? undefined: item}
activeKey={activeKey}
......
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