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

class EditColumnFilterShowPage 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/EditColumnFilter/OrderPaged',
      columns: [

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