/** * 数据来源半成品 */ import React, { Component, useState, useRef, useEffect } from "react"; import { ShowDataDiction } from "./component/ShowDataDiction"; import { ShowApiSource } from './component/ShowApiSource' import { Select, Button } from '@alifd/next'; import './component/index.less' interface DataSourceSelectType { [key: number]: string } interface DataSourceType { selectList?: number[] } const handleSelectOption = (): any[] => { let result: DataSourceSelectType = { 1: "数据字典", 2: "开放服务", 3: "联动报表", }; let arr = [1, 2]; return arr.map((key: number) => { return { value: key * 1, label: result[key], }; }); }; /** * widgetDataTypeList[] 报表选择项 */ const DataSource = (props: any) => { const { field, onChange } = props const propData = field.getValue() console.log('props设置器', props) const onRef = useRef(null) const [selectValue, setSelectValue] = useState(0); useEffect(() => { if (propData && propData['dataSelectValue']) { setSelectValue(propData['dataSelectValue']) onRef.current?.parentData(propData) } }) function childrenOnChange(v: any) { let objData = { name: field.name, dataSelectValue: selectValue, dataSourceAll: v } console.log('字模块改变', objData) onChange(objData) } function showSelectData() { if (selectValue === 1) { onRef.current.showDatamapLayer(); } else if (selectValue === 2) { onRef.current.showApiLayer(); } } return (