import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';

export const searchFormSchema: FormSchema[] = [
  {
    field: 'code',
    label: '编号',
    defaultValue: undefined,
    component: 'Input',
  },
  {
    field: 'name',
    label: '名称',
    defaultValue: undefined,
    component: 'Input',
  },
];

export const columns: BasicColumn[] = [
  {
    resizable: true,
    dataIndex: 'code',
    title: '编号',
    componentType: 'auto-code',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'name',
    title: '名称',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'note',
    title: '备注',
    componentType: 'textarea',

    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: '1a2696deffa44bc08208686bb5e77715',
      field: '',
      label: '',
      type: 'grid',
      colProps: { span: 24 },
      component: 'Grid',
      children: [
        {
          span: 8,
          list: [
            {
              key: '536715321b4c49df8b63b2fcb7cc14ab',
              field: 'code',
              label: '编号',
              type: 'auto-code',
              component: 'AutoCodeRule',
              colProps: { span: 24 },
              componentProps: {
                width: '100%',
                span: 7,
                placeholder: '自动生成',
                prefix: '',
                suffix: '',
                addonBefore: '',
                addonAfter: '',
                showLabel: true,
                autoCodeRule: 'GYBH',
                required: false,
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '8d9ef135306242729fb4673b9e2dd918',
              field: 'name',
              label: '名称',
              type: 'input',
              component: 'Input',
              colProps: { span: 24 },
              defaultValue: '',
              componentProps: {
                width: '100%',
                span: 7,
                defaultValue: '',
                placeholder: '请输入名称',
                prefix: '',
                suffix: '',
                addonBefore: '',
                addonAfter: '',
                disabled: false,
                allowClear: false,
                showLabel: true,
                required: true,
                rules: [],
                events: {},
                listStyle: '',
                isSave: false,
                isShow: true,
                scan: false,
                bordered: true,
                isShowAi: false,
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '6636f959cd3a4c239aeb3ab43505a27b',
              field: 'active',
              label: '有效的',
              type: 'switch',
              component: 'Switch',
              colProps: { span: 24 },
              defaultValue: 1,
              componentProps: {
                span: 7,
                defaultValue: 1,
                checkedChildren: '',
                unCheckedChildren: '',
                checkedColor: '#433653',
                unCheckedColor: '#bbbdbf',
                showLabel: true,
                disabled: false,
                events: {},
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                style: {},
              },
            },
          ],
        },
      ],
      componentProps: {
        gutter: 16,
        justify: 'start',
        align: 'top',
        isShow: true,
        showBorder: false,
        bordercolor: '#d9d9d9',
        bordershowtype: [true, true, true, true],
        borderwidth: 1,
        padding: '10px',
        margin: '10px',
      },
    },
    {
      key: 'b7ea8bb6e83b42129ec31ca2cb3716e4',
      field: '',
      label: '',
      type: 'grid',
      colProps: { span: 24 },
      component: 'Grid',
      children: [
        {
          span: 24,
          list: [
            {
              key: '08fea1146775468ba1b3ba1193710e09',
              field: 'note',
              label: '备注',
              type: 'textarea',
              component: 'InputTextArea',
              colProps: { span: 24 },
              defaultValue: '',
              componentProps: {
                width: '100%',
                span: 2,
                defaultValue: '',
                placeholder: '请输入备注备注备注',
                rows: 3,
                autoSize: false,
                showCount: false,
                disabled: false,
                showLabel: true,
                allowClear: false,
                required: false,
                isShow: true,
                isShowAi: false,
                rules: [],
                events: {},
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
      ],
      componentProps: {
        gutter: 16,
        justify: 'start',
        align: 'top',
        isShow: true,
        showBorder: false,
        bordercolor: '#d9d9d9',
        bordershowtype: [true, true, true, true],
        borderwidth: 1,
        padding: '10px',
        margin: '10px',
      },
    },
    {
      key: 'e64fff4326284f16aa6d86acb8678b89',
      field: '',
      label: '',
      type: 'grid',
      colProps: { span: 24 },
      component: 'Grid',
      children: [
        {
          span: 24,
          list: [
            {
              key: '4646ad154e7d404e9dae94f1022a5788',
              field: '',
              label: '',
              type: 'tab',
              colProps: { span: 24 },
              component: 'Tab',
              children: [
                {
                  span: 24,
                  name: '工艺明细',
                  prefix: '',
                  suffix: '',
                  activeColor: '#1c8dff',
                  folderId: '',
                  imageUrl: '',
                  conFolderId: '',
                  conImageUrl: '',
                  list: [
                    {
                      key: 'e75eeef314c4485c922588bb979d0b04',
                      label: '',
                      field: 'rokeRoutingProcessList',
                      type: 'form',
                      component: 'SubForm',
                      required: true,
                      colProps: { span: 24 },
                      componentProps: {
                        mainKey: 'rokeRoutingProcessList',
                        columns: [
                          {
                            key: 'bffa8112410f4112b3e5fcd32ac28f0e',
                            title: '名称',
                            dataIndex: 'processName',
                            componentType: 'Input',
                            defaultValue: '',
                            componentProps: {
                              width: '100%',
                              span: '',
                              defaultValue: '',
                              placeholder: '',
                              maxlength: null,
                              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: '提示文本' },
                              prestrainField: 'name',
                            },
                          },
                          {
                            key: '8f0c524797e64b40bc4124837d406cdb',
                            title: '编码',
                            dataIndex: 'code',
                            componentType: 'Input',
                            defaultValue: '',
                            componentProps: {
                              width: '100%',
                              span: '',
                              defaultValue: '',
                              placeholder: '',
                              prefix: '',
                              suffix: '',
                              addonBefore: '',
                              addonAfter: '',
                              disabled: true,
                              allowClear: false,
                              showLabel: true,
                              required: false,
                              rules: [],
                              events: {},
                              listStyle: '',
                              isSave: false,
                              isShow: true,
                              scan: false,
                              bordered: true,
                              isShowAi: false,
                              tooltipConfig: { visible: false, title: '提示文本' },
                              prestrainField: 'code',
                            },
                          },
                          {
                            key: 'bfdf4979bec74654ae607c3339e56ef2',
                            title: '采集方案',
                            dataIndex: 'collectionSchemeId',
                            componentType: 'XjrSelect',
                            componentProps: {
                              width: '100%',
                              span: '',
                              placeholder: '',
                              showLabel: true,
                              showSearch: false,
                              isMultiple: false,
                              clearable: false,
                              disabled: false,
                              staticOptions: [
                                { key: 1, label: 'Option 1', value: 'Option 1' },
                                { key: 2, label: 'Option 2', value: 'Option 2' },
                                { key: 3, label: 'Option 3', value: 'Option 3' },
                              ],
                              defaultSelect: '',
                              datasourceType: 'api',
                              labelField: 'label',
                              valueField: 'value',
                              apiConfig: {
                                path: '/jcxx/getCollectionSchemeList',
                                method: 'GET',
                                apiId: 'copy1767064303024d70507',
                                apiParams: [
                                  { key: '1', title: 'Query Params', tableInfo: [] },
                                  { key: '2', title: 'Header', tableInfo: [] },
                                  { key: '3', title: 'Body' },
                                ],
                                script:
                                  'var sql="select id as value,name as label from mes_collection_scheme where delete_mark = 0";\r\nreturn db.select(sql);',
                              },
                              dicOptions: [],
                              required: false,
                              rules: [],
                              events: {},
                              isShow: false,
                              tooltipConfig: { visible: false, title: '提示文本' },
                              prestrainField: 'collection_scheme_id',
                              listStyle: "return 'border: 0'",
                            },
                          },
                          {
                            key: 'a56d6b8d54aa4d7c8246feb647f8da8b',
                            title: '工序类别',
                            dataIndex: 'categoryId',
                            componentType: 'XjrSelect',
                            componentProps: {
                              width: '100%',
                              span: '',
                              placeholder: '',
                              showLabel: true,
                              showSearch: false,
                              isMultiple: false,
                              clearable: false,
                              disabled: true,
                              staticOptions: [
                                { key: 1, label: 'Option 1', value: 'Option 1' },
                                { key: 2, label: 'Option 2', value: 'Option 2' },
                                { key: 3, label: 'Option 3', value: 'Option 3' },
                              ],
                              datasourceType: 'dic',
                              params: { itemId: '2005547790246666242' },
                              labelField: 'name',
                              valueField: 'value',
                              apiConfig: {
                                path: '/jcxx/getCollectionSchemeList',
                                method: 'GET',
                                apiId: 'copy1767064303024d70507',
                                apiParams: [
                                  { key: '1', title: 'Query Params', tableInfo: [] },
                                  { key: '2', title: 'Header', tableInfo: [] },
                                  { key: '3', title: 'Body' },
                                ],
                                script:
                                  'var sql="select id as value,name as label from mes_collection_scheme where delete_mark = 0";\r\nreturn db.select(sql);',
                              },
                              dicOptions: [],
                              required: false,
                              rules: [],
                              events: {},
                              isShow: true,
                              tooltipConfig: { visible: false, title: '提示文本' },
                              itemId: '2005547790246666242',
                              prestrainField: 'category_id',
                              listStyle: "return 'border: 0'",
                            },
                          },
                          {
                            key: 'd7f88b9a824042b8b717ba4ffc0aa729',
                            title: '额定工时',
                            dataIndex: 'ratedWorkingHours',
                            componentType: 'InputNumber',
                            defaultValue: '',
                            componentProps: {
                              width: '100%',
                              span: '',
                              defaultValue: '',
                              step: 0.01,
                              disabled: true,
                              showLabel: true,
                              controls: true,
                              required: false,
                              subTotal: false,
                              isShow: true,
                              rules: [],
                              events: {},
                              tooltipConfig: { visible: false, title: '提示文本' },
                              prestrainField: 'rated_working_hours',
                              listStyle: "return 'width:100%'",
                            },
                          },
                          {
                            key: '750b63c0c1804f27abd10e748d7d15f3',
                            title: '排序',
                            dataIndex: 'px',
                            componentType: 'InputNumber',
                            defaultValue: '',
                            componentProps: {
                              width: '100%',
                              span: '',
                              defaultValue: '',
                              min: 0,
                              step: 1,
                              disabled: false,
                              showLabel: true,
                              controls: true,
                              required: true,
                              subTotal: false,
                              isShow: true,
                              rules: [],
                              events: {},
                              placeholder: '请输入排序',
                              tooltipConfig: { visible: false, title: '提示文本' },
                              listStyle: "return 'width:100%'",
                            },
                          },
                          {
                            key: '8534d25739fe413788dea3fc99ac7580',
                            title: '工序ID',
                            dataIndex: 'processId',
                            componentType: 'Input',
                            defaultValue: '',
                            componentProps: {
                              width: '100%',
                              span: '',
                              defaultValue: '',
                              placeholder: '',
                              maxlength: null,
                              prefix: '',
                              suffix: '',
                              addonBefore: '',
                              addonAfter: '',
                              disabled: false,
                              allowClear: false,
                              showLabel: true,
                              required: false,
                              rules: [],
                              events: {},
                              listStyle: '',
                              isSave: false,
                              isShow: false,
                              scan: false,
                              bordered: true,
                              isShowAi: false,
                              tooltipConfig: { visible: false, title: '提示文本' },
                              prestrainField: 'id',
                            },
                          },
                          { title: '操作', key: 'action', fixed: 'right', width: '50px' },
                        ],
                        span: 7,
                        preloadType: 'api',
                        apiConfig: {
                          path: '/jcxx/gxlb',
                          method: 'GET',
                          apiId: '8a735bb14d5f4a709efb65b34691acd3',
                          apiParams: [
                            { key: '1', title: 'Query Params', tableInfo: [] },
                            { key: '2', title: 'Header', tableInfo: [] },
                            { key: '3', title: 'Body' },
                          ],
                          script:
                            'var sql="select *,id as value,name as label from roke_process where delete_mark = 0";\r\nreturn db.select(sql);',
                          outputParams: [
                            { name: 'code', tableTitle: '编码' },
                            { name: 'name', tableTitle: '名称' },
                            { name: 'category_id', tableTitle: '工序类别' },
                            { name: 'id', tableTitle: 'ID' },
                            { tableTitle: '采集方案ID', name: 'collection_scheme_id' },
                            { name: 'rated_working_hours', tableTitle: '额工时定' },
                          ],
                        },
                        itemId: '',
                        dicOptions: [],
                        useSelectButton: true,
                        buttonName: '新增',
                        showLabel: true,
                        showComponentBorder: true,
                        showBorder: false,
                        bordercolor: '#f0f0f0',
                        bordershowtype: [true, true, true, true],
                        borderwidth: 10,
                        showIndex: true,
                        isShow: true,
                        multipleHeads: [],
                        buttonList: [],
                        topButtonList: [],
                        isExport: false,
                        isImport: false,
                        isDeleteSelected: true,
                        isListView: false,
                        viewList: [
                          {
                            key: '9e9467d976174786a67851ccb34bb8f7',
                            label: '名称',
                            field: 'process_id',
                            componentType: 'associate-popup',
                            checked: true,
                          },
                          {
                            key: '8f0c524797e64b40bc4124837d406cdb',
                            label: '编码',
                            field: 'code',
                            componentType: 'input',
                            checked: true,
                          },
                          {
                            key: 'a56d6b8d54aa4d7c8246feb647f8da8b',
                            label: '工序类别',
                            field: 'category_id',
                            componentType: 'select',
                            checked: true,
                          },
                          {
                            key: 'bfdf4979bec74654ae607c3339e56ef2',
                            label: '采集方案',
                            field: 'collection_scheme_id',
                            componentType: 'select',
                            checked: true,
                          },
                          {
                            key: 'd7f88b9a824042b8b717ba4ffc0aa729',
                            label: '额定工时',
                            field: 'rated_working_hours',
                            componentType: 'number',
                            checked: true,
                          },
                        ],
                        isShowAdd: false,
                        isShowDelete: true,
                        hasCheckedCol: true,
                        events: {},
                        showPagenation: true,
                        rowResize: false,
                        showColunmSet: false,
                        widths: [
                          {
                            key: '9e9467d976174786a67851ccb34bb8f7',
                            name: '名称',
                            bindField: 'process_id',
                            resizable: false,
                            isEdit: true,
                          },
                          {
                            key: '8f0c524797e64b40bc4124837d406cdb',
                            name: '编码',
                            bindField: 'code',
                            resizable: false,
                            isEdit: true,
                          },
                          {
                            key: 'a56d6b8d54aa4d7c8246feb647f8da8b',
                            name: '工序类别',
                            bindField: 'category_id',
                            resizable: false,
                            isEdit: false,
                          },
                          {
                            key: 'bfdf4979bec74654ae607c3339e56ef2',
                            name: '采集方案',
                            bindField: 'collection_scheme_id',
                            resizable: false,
                            isEdit: true,
                          },
                          {
                            key: 'd7f88b9a824042b8b717ba4ffc0aa729',
                            name: '额定工时',
                            bindField: 'rated_working_hours',
                            resizable: false,
                            isEdit: true,
                          },
                        ],
                        type: 1,
                        event: [],
                      },
                    },
                  ],
                },
              ],
              componentProps: { tabPosition: 'top', size: 'default', type: 'line', isShow: true },
            },
          ],
        },
      ],
      componentProps: {
        gutter: 16,
        justify: 'start',
        align: 'top',
        isShow: true,
        showBorder: false,
        bordercolor: '#d9d9d9',
        bordershowtype: [true, true, true, true],
        borderwidth: 1,
        padding: '10px',
        margin: '10px',
      },
    },
  ],
  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,
  },
];
