import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '应急事件名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '事件类型',
    align: "center",
    dataIndex: 'tp_dictText'
  },
  {
    title: '事件等级',
    align: "center",
    dataIndex: 'level_dictText'
  },
  {
    title: '牵头处置部门',
    align: "center",
    dataIndex: 'handleDepart'
  },
  {
    title: '参与部门',
    align: "center",
    dataIndex: 'supportDepart'
  },
  {
    title: '事件发生时间',
    align: "center",
    sorter: true,
    dataIndex: 'sttime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '结束时间',
    align: "center",
    dataIndex: 'endtime',
    customRender:({text}) =>{
      return !text?"":(text.length>19?text.substr(0,19):text);
    },
  },
  /**
  {
    title: '处置结果',
    align: "center",
    dataIndex: 'ret'
  },
  */
  {
    title: '状态',
    align: "center",
    dataIndex: 'eventSta_dictText'
  },
  {
    title: '影响的分支机构数(省级)',
    align: "center",
    dataIndex: 'affectedBranchCount'
  },
  {
    title: '当前中断时长（分钟）',
    align: "center",
    dataIndex: 'outageDuration'
  },
  {
    title: '说明',
    align: "center",
    ifShow:false,
    dataIndex: 'des'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "应急事件名称",
    field: 'name',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "事件类型",
    field: 'tp',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
  {
    label: "事件等级",
    field: 'level',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
  {
    label: "牵头处置部门",
    field: 'handleDepart',
    component: 'Input',
    colProps: {span: 6},
  },
  /** 
  {
    label: "事件发生时间",
    field: 'sttime',
    component: 'DatePicker',
    colProps: {span: 6},
  },
  */
 {
  label: '事件发生时间',
  field: 'rangeIssuedTime',
  component: 'RangePicker',
  componentProps: {
    valueType: 'Date'
  },
  colProps: { span: 8 },
 },
  {
    label: "状态",
    field: 'eventSta',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '应急事件名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '事件类型',
    field: 'tp',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "event_tp",
      stringToNumber: true,
    },
  },
  {
    label: '事件等级',
    field: 'level',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "level",
      stringToNumber: true,
    },
  },
  {
    label: '牵头处置部门',
    field: 'handleDepart',
    component: 'Input',
  },
  {
    label: '参与部门',
    field: 'supportDepart',
    component: 'Input',
  },
  {
    label: '事件发生时间',
    field: 'sttime',
    component: 'DatePicker',
  },
  {
    label: '结束时间',
    field: 'endtime',
    component: 'DatePicker',
  },
  {
    label: '处置结果',
    field: 'ret',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'eventSta',
    component: 'InputNumber',
  },
  {
    label: '说明',
    field: 'des',
    component: 'Input',
  },
  {
    label: '影响的分支机构数(省级)',
    field: 'affectedBranchCount',
    component: 'InputNumber',
  },
  {
    label: '当前中断时长（分钟）',
    field: 'outageDuration',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
