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


class TreeColumnShowPage extends PageConfigShowBaseComponent{
  constructor(props) {
    super(props);
    this.state = {
      data: {},
      paginationIndex:1,
      paginationTotalCount: 0,
      rowData:{},
      visible:false,
      selectedRowKeys: []
    };
  };
  onGetTableConfig(){
    const tableConfig={
      sort: 'NUM',
      order: 0,
      api:'PF/TreeColumn/OrderPaged',
      columns: [

        {controlType:1,field:'FIELD_NAME',label:'字段名称',isRequire:true},
        {controlType:1,field:'QUERY_FORMAT',label:'查询格式化'},
        {controlType:1,field:'FORMAT',label:'格式化函数'},
        {controlType:1,field:'ENUM',label:'枚举名称'},
        {controlType:1,field:'NUM',label:'顺序索引'},
      ],
      deleteApi:'PF/TreeColumn/Delete',
      editConfig:{
        data: {
          'ORG_ID': this.props.orgId,
          'PAGE_TREE_ID': this.props.pageTableId,
          NUM: 0,
        },
        columns:[
          {controlType:1,field:'FIELD_NAME',label:'字段名称',isRequire:true},
          {controlType:1,field:'QUERY_FORMAT',label:'查询格式化'},
          {controlType:1,field:'FORMAT',label:'格式化函数'},
          {controlType:1,field:'ENUM',label:'枚举名称'},
          {controlType:1,field:'NUM',label:'顺序索引'},
        ],
        getApi:'PF/TreeColumn/Get',
        saveApi:'PF/TreeColumn/Update',
      },
      rule:{
        rules:[
          {field:'PAGE_TREE_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 }))(TreeColumnShowPage);
