import { Pagination, Dialog, Input, Button, Table, Select } from "@alifd/next"; import request from '../../../_server/index.js' import React from "react"; import "./index.less"; import { systemOptions } from "./systemOptions"; const columns = [ { title: "id", dataIndex: "id", width: 100, }, { title: "api名称", dataIndex: "apiName", width: 300, }, { title: "api地址", dataIndex: "apiPath", width: 400, }, { title: "system", dataIndex: "system", render: (key: any) => { console.log("key", key); return getSystemData(key) }, }, ]; function getSystemData(key: any) { let data = systemOptions.find((v: any) => { return v.value == key; }) if (data) { return data.label } return key } class ApiLayer extends React.Component{ constructor(props: any) { super(props); this.state = { result: [], pageNum: 1, systemList: [], typeList: [] } this.getApi() } componentDidMount() { this.onSubmit() } getApi = () => { let { apiName, system, pageNum, apiPath, apiType } = this.state; request .postUrl("/a/rest/getApiInfoByParam", { apiName, system, apiPath, apiType, pageSize: 10, pageNum, application: this.props.ApiModelProperty, //isBoomApi: 0, }) .then((res: any) => { if (res.code === 0) { this.setState({ result: res.data.result, total: res.data.total, }); return; } }); }; getApiDetail = (id: any) => { request .postUrl("/a/rest/getApiDetail", { id, }) .then((res: any) => { if (res.code === 0) { this.props.setApiDetail({ restParamsOut: res.data.restParamsOut, apiId: res.data.id, apiName: res.data.apiName, }); return; } }); }; handleOk = () => { console.log('出发数据', this.state) this.props.setApiDetail(this.state.record); } closeDialog = () => { console.log('关闭') this.props.closeApiLayer(); } onSubmit = () => { console.log('提交', this.state) this.getApi() }; onChangeSelect = (e: any, name: string) => { this.setState({ [name]: e, }); } onChange = (e: any) => { console.log('选中数据', e) if (e && e.target) { this.setState({ [e.target.name]: e.target.value, }); } } render() { let _this = this return (
平台
API类型
API名称
API地址
{ this.setState({ pageNum: current }) this.onSubmit() }} >
); } } export { ApiLayer };