import React from 'react';
import { connect } from 'dva';
import PageConfigShowBaseComponent from "../Lib/PageConfigShowBaseComponent";
import {guid} from "../../../utils/common";


class EditPanelShowPage extends PageConfigShowBaseComponent {
  constructor(props) {
    super(props);
    this.state = {
      data: {},
      paginationIndex:1,
      paginationTotalCount: 0,
      rowData:{},
      visible:false,
      selectedRowKeys: []
    };
  };
  componentDidMount() {
    super.componentDidMount();
  };


  onGetTableConfig(){
    const tableConfig={
      sort: 'NUM',
      order: 0,
      api:'PF/PageEditPanel/OrderPaged',
      columns: [
        {label: '显示名称', field: 'LABEL',},
        {label: '是否默认展开', field: 'IS_DEFAULT_EXPAND', isBool: true},
        {label: '是否显示', field: 'IS_DISPLAY', isBool: true},
        {label: '顺序索引', field: 'NUM',},
      ],
      deleteApi:'PF/PageEditPanel/Delete',
      editConfig:{
        data: {
          ORG_ID: this.props.orgId,
          PAGE_EDIT_ID: this.props.pageTableId,
          NUM: 0,
          IS_DISPLAY: true,
        },
        columns:[
          {controlType:1,field:'LABEL',label:'显示名称',isRequire:true},
          {controlType:4,field:'IS_DISPLAY',label:'是否显示',},
          {controlType:4,field:'IS_DEFAULT_EXPAND',label:'是否默认展开',},
          {controlType:1,field:'NUM',label:'顺序索引',},
        ],
        getApi:'PF/PageEditPanel/Get',
        saveApi:'PF/PageEditPanel/Update',
      },
      rule:{
        rules:[
          {field:'PAGE_EDIT_ID',operator:1,value:this.props.pageTableId}
        ]
      },
      rowBtns:[
        {id:guid(),btnType:7,code:'edit'},
        {id:guid(),btnType:4,code:'delete'},
      ]
    };
    return [tableConfig];
  }
}


export default  connect(({ login, app,loading,custom }) => ({ login,app, loading,custom }))(EditPanelShowPage);
