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


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

  onGetTableConfig(){
    const tableConfig={
      sort: 'CREATE_TIME',
      order: 1,
      api:'PF/PageChartParam/OrderPaged',
      columns: [
        {label: '字段名', field: 'FIELD_NAME',},
        {label: '操作符', field: 'OPERATION', data: {enumName:'PFOperateEnum'}},
        {label: '值', field: 'VALUE',},
        {label: '自定义字段', field: 'IS_CUSTOM', isBool: true},
        {label: '系统参数', field: 'IS_SYS_PARAM', isBool: true},
      ],
      deleteApi:'PF/PageChartParam/Delete',
      editConfig:{
        data: {
          ORG_ID: this.props.orgId,
          PAGE_CHART_ID: this.props.pageChartId,
        },
        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/PageChartParam/Get',
        saveApi:'PF/PageChartParam/Update',
        promptInfo:'说明：值可以通过@user取到当前用户的信息，例子：用户ID设置为@user.ID 注意@user大小写;部门@department;班组@team '
      },
      rule:{
        rules:[
          {field:'PAGE_CHART_ID',operator:1,value:this.props.pageChartId},
        ]
      },
      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 }))(ChartParamShowPage);
