import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目名称',
    align:"left",
    dataIndex: 'projectName',
    width:250
   },
   {
    title: '项目类型',
    align:"left",
    dataIndex: 'projectType',
    customRender:({text}) =>{
      return render.renderDict(text, 'projecttype')
    },
    width:100
   },
   {
    title: '执行部门',
    align:"left",
    dataIndex: 'execDepName',
    width:100
   },
   {
    title: '负责人',
    align:"center",
    dataIndex: 'headName',
    width:100
   },
   {
    title: '开始日期',
    align:"center",
    dataIndex: 'planStartDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
    width:100
   },
   {
    title: '预计结束日期',
    align:"center",
    dataIndex: 'planEndDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
    width:100
   },
   {
    title: '实施阶段',
    align:"left",
    dataIndex: 'execLevel',
    customRender: ({ text }) => {
      const color = text == '实施完成' ? 'green' : 'red' ;
      return render.renderTag(text, color);
    },
    width:150
   }
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
  },
  {
    label: '项目类型',
    field: 'projectType',
    component: 'JSearchSelect',
    componentProps:{
      dict: "projectType"
    },
  },
  {
    label: '执行部门',
    field: 'execDepCode',
    component: 'JSelectDept',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目检查ID',
    field: 'projectCheckId',
    component: 'InputNumber',
  },
  {
    label: '检查状态',
    field: 'checkType',
    component: 'Input',
  },
  {
    label: '现状描述',
    field: 'execContent',
    component: 'InputTextArea',
  },
  {
    label: '确认部门',
    field: 'confirmDepCode',
    component: 'Input',
  },
  {
    label: '确认人',
    field: 'confirmUser',
    component: 'Input',
  },
  {
    label: '分配状态',
    field: 'allocateStatus',
    component: 'Input',
  },
  {
    label: '是否属实',
    field: 'trueStatus',
    component: 'Input',
  },
  {
    label: '补充说明',
    field: 'execContentDes',
    component: 'InputTextArea',
  },
  {
    label: '补充材料',
    field: 'fileUploadPath',
    component: 'Input',
  },
  {
    label: '确认状态',
    field: 'confirmStatus',
    component: 'Input',
  },
  {
    label: '建议状态',
    field: 'adviceStatus',
    component: 'Input',
  },
  {
    label: '问题严重程度',
    field: 'severity',
    component: 'Input',
  },
  {
    label: '整改优先级',
    field: 'adviceLevel',
    component: 'Input',
  },
  {
    label: '整改建议',
    field: 'adviceAdvice',
    component: 'InputTextArea',
  },
  {
    label: '实施阶段',
    field: 'execLevel',
    component: 'Input',
  },
  {
    label: '风险等级',
    field: 'damageLevel',
    component: 'Input',
  },
  {
    label: '风险评分',
    field: 'damageScore',
    component: 'Input',
  },
  {
    label: '创建人',
    field: 'createdUser',
    component: 'Input',
  },
  {
    label: '创建时间',
    field: 'createdTime',
    component: 'DatePicker',
  },
  {
    label: '更新人',
    field: 'updatedUser',
    component: 'Input',
  },
  {
    label: '更新时间',
    field: 'updatedTime',
    component: 'DatePicker',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}