import * as React from 'react'; import './index.scss'; import DataSource from '&/components/pageBuilder/PropsCollection/StatisticSetting/dataSource' import {getApiUrl,taker} from '&/helper' interface Prop{ update:Function, data:any } interface State{ apps:Array, options:Array, components:Array } export default class OceanSetting extends React.Component{ constructor(p:Prop){ super(p) this.state = { apps:[], options:[], components:[] } this.optionChange = this.optionChange.bind(this); this.componentChange = this.componentChange.bind(this); this.appChange = this.appChange.bind(this); } originApp :Array =[]; originComponents: Array = []; originOpts:Array = []; appIndex: number; componentIndex: number; optionIndex: number; componentWillMount(){ //请求apps-请求组件-限制条件 const url = getApiUrl(`proxy/GetUPaaSCoreGateway?metaname=PageBuilderManagement&funname=GetTenantAvailableApplicationList`) taker(url).then((res:any)=>{ this.originApp = res.OperationObject; let tempApps:Array = []; res.OperationObject.map((app:any,k:number)=>{ tempApps.push(app.Title); }) // this.appChange(0) this.setState({apps:tempApps}) }) } async appChange (val:number){ //请求对应app的components const { update } = this.props; this.appIndex = val; this.componentIndex = 0; const url = getApiUrl(`proxy/GetUPaaSCoreGateway?metaname=PageBuilderManagement&funname=GetOceanList&applicationName=${this.originApp[val].Name}`); taker(url).then((res:any)=>{ let tempComs:Array = []; this.originComponents = res.OperationObject; res.OperationObject.map((com:any,k:number)=>{ tempComs.push(com.PluginTitle) }) this.setState({components:tempComs}); tempComs.length ? this.componentChange(0) : this.setState({options:[]}) }) update({ appIndex:val, componentIndex:0, optionIndex:-1 }) } componentChange=(val:number)=>{ const { update } = this.props; this.componentIndex = val; const url = getApiUrl(`proxy/GetUPaaSCoreGateway?metaname=PageBuilderManagement&funname=GetOceanFilterList&applicationName=${this.originApp[this.appIndex].Name}&componentId=${this.originComponents[val].ID}`) taker(url).then((res:any)=>{ this.originOpts = res.OperationObject; let tempOpts:Array = [] res.OperationObject.map((d:any,k:number)=>{ tempOpts.push(d.Name) }) this.setState({options:tempOpts}); tempOpts.length && this.optionChange(-1) }); update({ appIndex:this.appIndex, componentIndex:val, optionIndex:-1, optId:'', comId:this.originComponents[val].ID, }) } optionChange=(val:number) => { //传输app-组件-属性设置 if(val < 0) return; const { update } = this.props; update({ appIndex:this.appIndex, componentIndex:this.componentIndex, optionIndex:val, optId:this.originOpts[val].Id, comId:this.originComponents[this.componentIndex].ID, }) } render(){ const { data } = this.props; const { apps, options, components } = this.state; return
} }