/*
 * Create:      柿子
 * CreateDate:  2023/11/27
 * Describe：   模块信息
 * */
import React, { Component } from 'react';
import { Button } from 'antd';
import store from 'store';
import DynamicRenderingForm from 'pages/common/DynamicRenderingForm';
import './style/index.less';

class BedChartSettingTemplateInfo extends Component {
  constructor(props) {
    super(props);
    this.state = {
      formData: [],
      selectData: {},
      rowData: {},
    };
  }

  componentDidMount() {
    this.getFormData();
  };

  // 获取表头数据
  getFormData = async () => {
    try {
      let data = {
        params: [{
          compontName: 'NSBedChartSettingTemplateInfo',
          type: 'C',
        }]
      }
      let res = await React.$asyncPost(this, '01040073', data);
      this.setState({ formData: res.result?.formData || [] });
    } catch (error) {
      console.log(error)
    }
  }

  render() {
    const { rowData, selectData, formData } = this.state;

    return (
      <div className="bed-chart-setting" style={{ height: store.getState().tableHeight.y + 136 + 'px', paddingRight: '6px' }}>
        <div style={{ height: '100%', paddingBottom: '46px', overflow: 'auto' }}>
          <DynamicRenderingForm
            rowData={rowData}
            selectData={selectData}
            formData={formData}
            onRef={ref => this.formRef = ref}
          />
        </div>
        <div className="bed-chart-setting-footer flex-center">
          <Button>恢复默认配置</Button>
          <Button style={{ marginLeft: '12px' }} type="primary">保存</Button>
        </div>
      </div>
    )
  }
};

export default BedChartSettingTemplateInfo;