import React from "react"; import { ApiLayer } from "./ApiLayer"; import { Form, Input, Select } from "@alifd/next"; import request from '../../../_server/index.js' class ShowApiSource extends React.Component { constructor(props: any) { super(props); console.log("开放服务11", props); this.state = { showApi: false, application: 0, // 暂时都使用一个 restParamsOut: [], record: { } }; } parentData(propsData: any) { console.log('数据字段', propsData) if (propsData && propsData['dataSelectValue'] !== undefined && propsData['dataSelectValue'] === 2) { this.setState({ record: propsData['dataSourceAll'] || {} }) if (propsData['dataSourceAll']['id'] !== undefined) { this.getApiDetail(propsData['dataSourceAll']['id']); } } } setApiDetail = (obj: any) => { console.log("选中内容", obj); obj.fieldKeyData={ apiPidField:'', apiIdField:'', apiNameField:'', } this.setState({ record:obj, showApi: false, }); this.props.onChange(obj) this.getApiDetail(obj.id) }; showApiLayer = () => { this.setState({ showApi: true, }); }; closeApiLayer = () => { this.setState({ showApi: false, }); }; getApiDetail = (id: any) => { request .postUrl("/a/rest/getApiDetail", { id, }) .then((res: any) => { if (res.code === 0) { this.setState({ restParamsOut: res.data.restParamsOut, apiId: res.data.id, }); return; } }); }; changeValue = (value: any, name: string) => { let record=this.state.record console.log('record',record, record.fieldKeyData,name,value) record['fieldKeyData'][name]=value this.setState({ record }) this.props.onChange(record) } render() { return (
{( )} { this.state.record && this.state.record.id && ( <> ) }
); } } export { ShowApiSource };