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

class ColumnFilterShowPage extends PageConfigShowBaseComponent {
  constructor(props) {
    super(props);
    this.state = {
      data: {},
      paginationIndex:1,
      paginationTotalCount: 0,
      rowData:{},
      visible:false,
      visibleConfirm:false
    };
  };

  onGetTableConfig(){
    const tableConfig={
      sort: 'CREATE_TIME',
      order: 1,
      api:'PF/ColumnFilter/OrderPaged',
      columns: [

        {field:'FIELD_NAME',label:'字段',isRequire:true},
        {field:'OPERATION',label:'条件操作符',data:{enumName:'PFOperateEnum'}},
        {field:'VALUE',label:'值'},
      ],
      deleteApi:'PF/ColumnFilter/Delete',
      editConfig:{
        data: {
          'ORG_ID': this.props.orgId,
          'COLUMN_ID': this.props.columnId,
          'OPERATION': '1'
        },
        columns:[
          {controlType:1,field:'FIELD_NAME',label:'字段',isRequire:true},
          {controlType:3,field:'OPERATION',label:'条件操作符',data:{enumName:'PFOperateEnum'}},
          {controlType:1,field:'VALUE',label:'值'},
        ],
        getApi:'PF/ColumnFilter/Get',
        saveApi:'PF/ColumnFilter/Update',
        promptInfo:'说明：值可以通过@user取到当前用户的信息，例子：用户ID设置为@user.ID 注意@user大小写;部门,班组@team;@head取到当前表头的信息， 注意@head大小写;@record取到当前表头的信息， 注意@record大小写'
      },
      rule:{
        rules:[
          {field:'COLUMN_ID',operator:1,value:this.props.columnId},
        ]
      },
      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 }))(ColumnFilterShowPage);
