import { FormSchema } from '@/components/Form';
import { BasicColumn } from '@/components/Table';
import { useUserStore } from '@/store/modules/user';
import { useDictStore } from '@/store/modules/dict';
const dictStore = useDictStore();

const userStore = useUserStore();
const approvalRsesults: Array<Object> = dictStore.selectDictArray("approvalResult")


export const approveStartProcessColumns: BasicColumn[] = [

  {
    title: '节点名称',
    dataIndex: 'taskName',
    width: 120,
  },
  {
    title: '处理人',
    dataIndex: 'operator',
    width: 100,
  },
  {
    title: '处理时间',
    dataIndex: 'operateDate',
    width: 100,
  },
  {
    title: '审批状态',
    dataIndex: 'approvalStatue',
    width: 100,
    format: 'dict|approvalResult',
    filters: 'dict|approvalResult',
  },
  {
    title: '审批意见',
    dataIndex: 'comment',
    width: 400,
  }
];
export const columns: BasicColumn[] = [

  {
    title: '节点名称',
    width: 150,
    dataIndex: 'taskName',
  },
  {
    title: '节点id',
    dataIndex: 'taskId',
    width: 150,
  },
  {
    title: '项目名称',
    dataIndex: 'projectName',
    width: 150,
  },
  {
    title: '项目编号',
    dataIndex: 'projectId',
    width: 100,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 100,
  },

];

export const searchFormSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
    //colProps: { span: 6 },
  },
  {
    label: '项目编号',
    field: 'projectId',
    component: 'Input',
    //colProps: { span: 6 },
  },
  {
    label: '流程id',
    field: 'projectId',
    component: 'Input',
    //colProps: { span: 6 },
  }

];
export const approvalformSchemas: FormSchema[] = [
  {
    label: '审批人',
    field: 'user',
    component: 'Select',
    required: true,
    dynamicDisabled: true,
    componentProps: {
      options: [
        { value: userStore.getUserInfo.id, label: userStore.getUserInfo.nickname }
      ],
    },
    defaultValue: userStore.getUserInfo.id,
    colProps: { span: 12 },

  },
  {
    label: '审批结果',
    field: 'flag',
    component: 'Select',
    required: true,
    componentProps: {
      options: approvalRsesults
    },
    colProps: { span: 12 },
  },
  {
    label: '修改次数',
    field: 'modifyNum',
    component: 'InputNumber',
    required: true,
    ifShow:false,
    componentProps: {
      min:0,
    },
    colProps: { span: 12 },
  },
  {
    label: '审批意见',
    field: 'comment',
    component: 'InputTextArea',
    required: true,
    colProps: { span: 24 },
  },

];
export const ProcessColumns: BasicColumn[] = [

  {
    title: '节点名称',
    dataIndex: 'taskName',
  },
  {
    title: '处理人',
    dataIndex: 'operator',
    width: 150,
  },
  {
    title: '处理时间',
    dataIndex: 'operateDate',
    width: 150,
  },
  {
    title: '审批状态',
    dataIndex: 'approvalStatue',
    width: 100,
  },
  {
    title: '审批意见',
    dataIndex: 'workplace',
    width: 100,
  }
];