import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
import { uploadApi } from '/@/api/sys/upload';

export const searchFormSchema: FormSchema[] = [
  {
    field: 'createUserId',
    label: '提交人',
    defaultValue: undefined,
    component: 'User',
    componentProps: {
      suffix: 'ant-design:setting-outlined',
      placeholder: '请选择',
    },
  },

  {
    field: 'createDate',
    label: '提交时间',
    defaultValue: undefined,
    component: 'RangePicker',
    componentProps: {
      format: 'YYYY-MM-DD HH:mm:ss',
      style: { width: '100%' },
      getPopupContainer: () => document.body,
    },
  },

  {
    field: 'modifyDate',
    label: '更新时间',
    defaultValue: undefined,
    component: 'RangePicker',
    componentProps: {
      format: 'YYYY-MM-DD HH:mm:ss',
      style: { width: '100%' },
      getPopupContainer: () => document.body,
    },
  },

  {
    field: 'dhrq',
    label: '到货日期',
    defaultValue: undefined,
    component: 'RangePicker',
    componentProps: {
      format: 'YYYY-MM-DD HH:mm:ss',
      style: { width: '100%' },
      getPopupContainer: () => document.body,
    },
  },

  {
    field: 'gys',
    label: '供应商',
    defaultValue: undefined,
    component: 'Input',
  },
  {
    field: 'ytgc',
    label: '源头工厂',
    defaultValue: undefined,
    component: 'Input',
  },
  {
    field: 'cph',
    label: '车牌号',
    defaultValue: undefined,
    component: 'Input',
  },
  {
    field: 'cpmc',
    label: '产品名称',
    defaultValue: undefined,
    component: 'Input',
  },
  {
    field: 'sfpsyj',
    label: '三方评审意见',
    defaultValue: undefined,
    component: 'Input',
  },
  {
    field: 'scbmyj',
    label: '生产部门意见',
    defaultValue: undefined,
    component: 'XjrSelect',
    componentProps: {
      datasourceType: 'staticData',
      staticOptions: [
        { key: 2, label: '同意', value: '1' },
        { key: 3, label: '不同意', value: '2' },
      ],
      labelField: 'label',
      valueField: 'value',
      mode: 'multiple',
      showSearch: true,
      getPopupContainer: () => document.body,
    },
  },
  {
    field: 'mybmyj',
    label: '贸易部门意见',
    defaultValue: undefined,
    component: 'XjrSelect',
    componentProps: {
      datasourceType: 'staticData',
      staticOptions: [
        { key: 1, label: '同意', value: '1' },
        { key: 3, label: '不同意', value: '2' },
      ],
      labelField: 'label',
      valueField: 'value',
      mode: 'multiple',
      showSearch: true,
      getPopupContainer: () => document.body,
    },
  },
  {
    field: 'pkyfbmyj',
    label: '品控研发部门意见',
    defaultValue: undefined,
    component: 'XjrSelect',
    componentProps: {
      datasourceType: 'staticData',
      staticOptions: [
        { key: 1, label: '同意', value: '1' },
        { key: 3, label: '不同意', value: '2' },
      ],
      labelField: 'label',
      valueField: 'value',
      mode: 'multiple',
      showSearch: true,
      getPopupContainer: () => document.body,
    },
  },
];

export const columns: BasicColumn[] = [
  {
    resizable: true,
    dataIndex: 'gys',
    title: '供应商',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'dhrq',
    title: '到货日期',
    componentType: 'date',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'ytgc',
    title: '源头工厂',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'cph',
    title: '车牌号',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'cpmc',
    title: '产品名称',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'sfpsyj',
    title: '三方评审意见',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'createUserId',
    title: '提交人',
    componentType: 'user',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'createDate',
    title: '提交时间',
    componentType: 'date',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'modifyDate',
    title: '更新时间',
    componentType: 'date',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'scbmyj',
    title: '生产部门意见',
    componentType: 'select',

    customRender: ({ record }) => {
      const staticOptions = [
        { key: 2, label: '同意', value: '1' },
        { key: 3, label: '不同意', value: '2' },
      ];

      return staticOptions.filter((x) => x.value == record.scbmyj)[0]?.label;
    },

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'mybmyj',
    title: '贸易部门意见',
    componentType: 'select',

    customRender: ({ record }) => {
      const staticOptions = [
        { key: 1, label: '同意', value: '1' },
        { key: 3, label: '不同意', value: '2' },
      ];

      return staticOptions.filter((x) => x.value == record.mybmyj)[0]?.label;
    },

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'pkyfbmyj',
    title: '品控研发部门意见',
    componentType: 'select',

    customRender: ({ record }) => {
      const staticOptions = [
        { key: 1, label: '同意', value: '1' },
        { key: 3, label: '不同意', value: '2' },
      ];

      return staticOptions.filter((x) => x.value == record.pkyfbmyj)[0]?.label;
    },

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },
];
//表头合并配置
export const headerMergingData = [];
//表单事件
export const formEventConfigs = {
  0: [
    {
      type: 'circle',
      color: '#2774ff',
      text: '开始节点',
      icon: '#icon-kaishi',
      bgcColor: '#D8E5FF',
      isUserDefined: false,
    },
    {
      color: '#F6AB01',
      icon: '#icon-chushihua',
      text: '初始化表单',
      bgcColor: '#f9f5ea',
      isUserDefined: false,
      nodeInfo: { processEvent: [] },
    },
  ],
  1: [
    {
      color: '#B36EDB',
      icon: '#icon-shujufenxi',
      text: '获取表单数据',
      detail: '(新增无此操作)',
      bgcColor: '#F8F2FC',
      isUserDefined: false,
      nodeInfo: { processEvent: [] },
    },
  ],
  2: [
    {
      color: '#F8625C',
      icon: '#icon-jiazai',
      text: '加载表单',
      bgcColor: '#FFF1F1',
      isUserDefined: false,
      nodeInfo: { processEvent: [] },
    },
  ],
  3: [
    {
      color: '#6C6AE0',
      icon: '#icon-jsontijiao',
      text: '提交表单',
      bgcColor: '#F5F4FF',
      isUserDefined: false,
      nodeInfo: { processEvent: [] },
    },
  ],
  4: [
    {
      type: 'circle',
      color: '#F8625C',
      text: '结束节点',
      icon: '#icon-jieshuzhiliao',
      bgcColor: '#FFD6D6',
      isLast: true,
      isUserDefined: false,
    },
  ],
};
export const formProps: FormProps = {
  labelCol: { span: 3, offset: 0 },
  labelAlign: 'right',
  layout: 'horizontal',
  size: 'default',
  schemas: [
    {
      key: '7d369328eb724b139a40f9554c88155e',
      field: 'createUserId',
      label: '提交人',
      type: 'user',
      component: 'User',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        span: '',
        width: '100%',
        defaultValue: '',
        placeholder: '请选择人员',
        userType: 0,
        prefix: '',
        suffix: 'ant-design:setting-outlined',
        showLabel: true,
        disabled: false,
        required: false,
        multiple: true,
        isShow: false,
        events: {},
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
    {
      key: '71899fba5afd4f318e1e58696ea6575f',
      field: 'createDate',
      label: '提交时间',
      type: 'date',
      component: 'DatePicker',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        span: '',
        defaultValue: '',
        width: '100%',
        placeholder: '请选择提交时间',
        format: 'YYYY-MM-DD HH:mm:ss',
        showLabel: true,
        allowClear: true,
        disabled: false,
        required: false,
        isShow: false,
        rules: [],
        events: {},
        isGetCurrent: false,
        tooltipConfig: { visible: false, title: '提示文本' },
        searchType: 'time',
        style: { width: '100%' },
      },
    },
    {
      key: '1729c3e4d6094b868b53e51fabf2c144',
      field: 'modifyDate',
      label: '更新时间',
      type: 'date',
      component: 'DatePicker',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        span: '',
        defaultValue: '',
        width: '100%',
        placeholder: '请选择更新时间',
        format: 'YYYY-MM-DD HH:mm:ss',
        showLabel: true,
        allowClear: true,
        disabled: false,
        required: false,
        isShow: false,
        rules: [],
        events: {},
        isGetCurrent: false,
        tooltipConfig: { visible: false, title: '提示文本' },
        searchType: 'time',
        style: { width: '100%' },
      },
    },
    {
      key: 'd765b6d3556142b4ab52ebe5e0616d1c',
      field: '',
      label: '分割线',
      colProps: { span: 24 },
      type: 'divider',
      component: 'Divider',
      componentProps: {
        dashed: false,
        orientation: 'left',
        text: '审批内容',
        isShow: true,
        style: { marginTop: '0px', marginBottom: '0px' },
      },
    },
    {
      key: 'cc5e3238167441a6af5d417f24584ac5',
      field: 'dhrq',
      label: '到货日期',
      type: 'date',
      component: 'DatePicker',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        span: '',
        defaultValue: '',
        width: '100%',
        placeholder: '请选择到货日期',
        format: 'YYYY-MM-DD HH:mm:ss',
        showLabel: true,
        allowClear: true,
        disabled: false,
        required: false,
        isShow: true,
        rules: [],
        events: {},
        isGetCurrent: false,
        tooltipConfig: { visible: false, title: '提示文本' },
        searchType: 'time',
        style: { width: '100%' },
      },
    },
    {
      key: '49fad8cba5b540eea93d130a5b54ffbc',
      field: 'gys',
      label: '供应商',
      type: 'input',
      component: 'Input',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        width: '100%',
        span: '',
        defaultValue: '',
        placeholder: '请输入供应商',
        prefix: '',
        suffix: '',
        addonBefore: '',
        addonAfter: '',
        disabled: false,
        allowClear: false,
        showLabel: true,
        required: false,
        rules: [],
        events: {},
        listStyle: '',
        isSave: false,
        isShow: true,
        scan: false,
        bordered: true,
        isShowAi: false,
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
    {
      key: '5866f1b44ca54db2bea62fbdace6a3a1',
      field: 'ytgc',
      label: '源头工厂',
      type: 'input',
      component: 'Input',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        width: '100%',
        span: '',
        defaultValue: '',
        placeholder: '请输入源头工厂',
        prefix: '',
        suffix: '',
        addonBefore: '',
        addonAfter: '',
        disabled: false,
        allowClear: false,
        showLabel: true,
        required: false,
        rules: [],
        events: {},
        listStyle: '',
        isSave: false,
        isShow: true,
        scan: false,
        bordered: true,
        isShowAi: false,
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
    {
      key: 'cef171de62dc4820954d5f7c7610503d',
      field: 'cph',
      label: '车牌号',
      type: 'input',
      component: 'Input',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        width: '100%',
        span: '',
        defaultValue: '',
        placeholder: '请输入车牌号',
        prefix: '',
        suffix: '',
        addonBefore: '',
        addonAfter: '',
        disabled: false,
        allowClear: false,
        showLabel: true,
        required: false,
        rules: [],
        events: {},
        listStyle: '',
        isSave: false,
        isShow: true,
        scan: false,
        bordered: true,
        isShowAi: false,
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
    {
      key: 'b0ffe3239af14079a7ff74ddc04244b8',
      field: 'cpmc',
      label: '产品名称',
      type: 'input',
      component: 'Input',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        width: '100%',
        span: '',
        defaultValue: '',
        placeholder: '请输入产品名称',
        prefix: '',
        suffix: '',
        addonBefore: '',
        addonAfter: '',
        disabled: false,
        allowClear: false,
        showLabel: true,
        required: false,
        rules: [],
        events: {},
        listStyle: '',
        isSave: false,
        isShow: true,
        scan: false,
        bordered: true,
        isShowAi: false,
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
    {
      key: '539245d6880846588108b1fa3000ed11',
      field: 'sfpsyj',
      label: '三方评审意见',
      type: 'input',
      component: 'Input',
      colProps: { span: 24 },
      defaultValue: '',
      componentProps: {
        width: '100%',
        span: '',
        defaultValue: '',
        placeholder: '请输入三方评审意见',
        prefix: '',
        suffix: '',
        addonBefore: '',
        addonAfter: '',
        disabled: false,
        allowClear: false,
        showLabel: true,
        required: false,
        rules: [],
        events: {},
        listStyle: '',
        isSave: false,
        isShow: true,
        scan: false,
        bordered: true,
        isShowAi: false,
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
    {
      key: 'ecd2bc2d87cf429283b87fe43a7640e8',
      field: 'images',
      label: '图片',
      type: 'upload',
      component: 'Upload',
      colProps: { span: 24 },
      componentProps: {
        api: uploadApi,
        span: '',
        defaultValue: '',
        accept: '',
        maxNumber: 5,
        maxSize: 5,
        showLabel: true,
        multiple: false,
        disabled: false,
        required: false,
        isShow: true,
        events: {},
        listType: 'text',
        sourceType: 'album,camera',
        tooltipConfig: { visible: false, title: '提示文本' },
      },
    },
    {
      key: '94ff603208e949a8992d2ce6251bfe94',
      field: '',
      label: '分割线',
      colProps: { span: 24 },
      type: 'divider',
      component: 'Divider',
      componentProps: {
        dashed: false,
        orientation: 'left',
        text: '审批意见',
        isShow: true,
        style: { marginTop: '0px', marginBottom: '0px' },
      },
    },
    {
      key: '70230001853c40149d6dc73cb37a1c03',
      field: 'scbmyj',
      label: '生产部门意见',
      type: 'select',
      component: 'XjrSelect',
      colProps: { span: 24 },
      componentProps: {
        width: '100%',
        span: '',
        placeholder: '请选择下拉选择',
        showLabel: true,
        showSearch: false,
        isMultiple: false,
        clearable: false,
        disabled: false,
        staticOptions: [
          { key: 2, label: '同意', value: '1' },
          { key: 3, label: '不同意', value: '2' },
        ],
        defaultSelect: '',
        datasourceType: 'staticData',
        labelField: 'label',
        valueField: 'value',
        apiConfig: {
          path: 'CodeGeneration/selection',
          method: 'GET',
          apiId: '93d735dcb7364a0f8102188ec4d77ac7',
        },
        dicOptions: [],
        required: false,
        rules: [],
        events: {},
        isShow: true,
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
    {
      key: '3d255e7e46574b888d81e83ae1b5fa3f',
      field: 'mybmyj',
      label: '贸易部门意见',
      type: 'select',
      component: 'XjrSelect',
      colProps: { span: 24 },
      componentProps: {
        width: '100%',
        span: '',
        placeholder: '请选择下拉选择',
        showLabel: true,
        showSearch: false,
        isMultiple: false,
        clearable: false,
        disabled: false,
        staticOptions: [
          { key: 1, label: '同意', value: '1' },
          { key: 3, label: '不同意', value: '2' },
        ],
        defaultSelect: '',
        datasourceType: 'staticData',
        labelField: 'label',
        valueField: 'value',
        apiConfig: {
          path: 'CodeGeneration/selection',
          method: 'GET',
          apiId: '93d735dcb7364a0f8102188ec4d77ac7',
        },
        dicOptions: [],
        required: false,
        rules: [],
        events: {},
        isShow: true,
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
    {
      key: '7ff2a8c3be574905879884c618cfa7db',
      field: 'pkyfbmyj',
      label: '品控研发部门意见',
      type: 'select',
      component: 'XjrSelect',
      colProps: { span: 24 },
      componentProps: {
        width: '100%',
        span: '',
        placeholder: '请选择下拉选择',
        showLabel: true,
        showSearch: false,
        isMultiple: false,
        clearable: false,
        disabled: false,
        staticOptions: [
          { key: 1, label: '同意', value: '1' },
          { key: 3, label: '不同意', value: '2' },
        ],
        defaultSelect: '',
        datasourceType: 'staticData',
        labelField: 'label',
        valueField: 'value',
        apiConfig: {
          path: 'CodeGeneration/selection',
          method: 'GET',
          apiId: '93d735dcb7364a0f8102188ec4d77ac7',
        },
        dicOptions: [],
        required: false,
        rules: [],
        events: {},
        isShow: true,
        tooltipConfig: { visible: false, title: '提示文本' },
        style: { width: '100%' },
      },
    },
  ],
  showActionButtonGroup: false,
  buttonLocation: 'center',
  actionColOptions: { span: 24 },
  showResetButton: false,
  showSubmitButton: false,
  hiddenComponent: [],
};

export const formButtons = [
  {
    key: 'confirm',
    code: 'confirm',
    name: '确定',
    style: 'primary',
    event: [],
    isShow: true,
    index: 2,
    type: 1,
  },
  {
    key: 'cancel',
    code: 'cancel',
    name: '取消',
    style: 'default',
    event: [],
    isShow: true,
    index: 1,
    type: 1,
  },
  {
    key: 'reset',
    code: 'reset',
    name: '重置',
    style: 'default',
    event: [],
    isShow: true,
    index: 0,
    type: 1,
  },
];
