import React, { useEffect, useState } from 'react';
import { Tabs } from 'antd';
import First from './components/first';
import Detailed from './components/detailed';
import { getURLInformation } from '@/utils/CommonUtils'
import { getBizInfo } from './service'


const Config: React.FC<{}> = () => {
  const { TabPane } = Tabs;
  //控制展示页
  const callback = (key: any) => {

  }
  const [method, methodSet] = useState<any>(false)//评分办法 true 综合评估法（有详审） false 最低价（无）
  const [proType, proTypeSet] = useState<any>(false)//采购方式 
  useEffect(() => {
    let bizId = ''
    let commonId: any = "";
    if (getURLInformation("id") != null) {
      commonId = getURLInformation("id")
    }
    let nodeId: any = '';
    if (getURLInformation("nodeId") != null) {
      nodeId = getURLInformation("nodeId");
      bizId = nodeId;
    }
    //查评分办法和采购方式
    getBizInfo(bizId).then((res) => {
      console.log(res);
      let methodT = false;
      if (res.code == 200) {
        const data = res.data;
        data.evalMethodDict === 'eval_method_2' ? methodT = true : null
      }
      methodSet(methodT);
    });

  }, [])
  return (
    <div style={{ backgroundColor: 'white', padding: '10px' }}>
      <Tabs defaultActiveKey="1" onChange={callback} size={"large"} >
        <TabPane tab="初审设置" key="1">
          <First />
        </TabPane>
        {method ?
          <TabPane tab="详审设置" key="2">
            <Detailed />
          </TabPane>
          : null
        }
      </Tabs>
    </div>
  )
}
export default Config;