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

export const searchFormSchema: FormSchema[] = [
  {
    field: 'djh',
    label: '单据号',
    defaultValue: undefined,
    component: 'Input',
  },
  {
    field: 'ck',
    label: '仓库',
    defaultValue: undefined,
    component: 'XjrSelect',
    componentProps: {
      datasourceType: 'dic',
      params: { itemId: '2010539474382962690' },
      labelField: 'name',
      valueField: 'value',
      mode: 'multiple',
      showSearch: true,
      getPopupContainer: () => document.body,
    },
  },
  {
    field: 'gys',
    label: '供应商',
    defaultValue: undefined,
    component: 'XjrSelect',
    componentProps: {
      datasourceType: 'api',
      apiConfig: {
        path: '/jcxx/gysInfoList',
        method: 'GET',
        apiId: '9099e750be50417299aa85ac4f27608b',
        apiParams: [
          {
            key: '1',
            title: 'Query Params',
            tableInfo: [
              {
                name: 'keyword',
                value: null,
                description: null,
                required: false,
                dataType: null,
                type: null,
                defaultValue: null,
                validateType: null,
                error: null,
                expression: null,
                children: null,
                bindType: '',
              },
            ],
          },
          { key: '2', title: 'Header', tableInfo: [] },
          { key: '3', title: 'Body' },
        ],
        script:
          'var sql ="select *,id as value,name as label from roke_partner where delete_mark = 0 and customer=\'2\'"+\r\n\' ?{keyword, AND name LIKE CONCAT("%", #{keyword}, "%")}\';\r\nreturn db.select(sql);',
        outputParams: [
          { name: 'label', tableTitle: '名称', bindField: '', show: true, width: 150 },
          { name: 'code', tableTitle: '编号', bindField: '', show: true, width: 150 },
          { name: 'contacts', tableTitle: '联系人', bindField: '', show: true, width: 150 },
          { name: 'address', tableTitle: '地址', bindField: '', show: true, width: 150 },
        ],
      },
      labelField: 'label',
      valueField: 'value',
      mode: 'multiple',
      showSearch: true,
      getPopupContainer: () => document.body,
    },
  },
  {
    field: 'zdr',
    label: '制单人',
    defaultValue: undefined,
    component: 'User',
    componentProps: {
      suffix: 'ant-design:setting-outlined',
      placeholder: '请选择',
    },
  },

  {
    field: 'ywzz',
    label: '业务组织',
    defaultValue: undefined,
    component: 'XjrSelect',
    componentProps: {
      datasourceType: 'dic',
      params: { itemId: '2015724355955159041' },
      labelField: 'name',
      valueField: 'value',
      mode: 'multiple',
      showSearch: true,
      getPopupContainer: () => document.body,
    },
  },
  {
    field: 'cspc',
    label: '厂商批次',
    defaultValue: undefined,
    component: 'Input',
  },
  {
    field: 'pch',
    label: '批次号',
    defaultValue: undefined,
    component: 'Input',
  },
];

export const columns: BasicColumn[] = [
  {
    resizable: true,
    dataIndex: 'djh',
    title: '单据号',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'djrq',
    title: '单据日期',
    componentType: 'date',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'gys',
    title: '供应商',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'crklx',
    title: '出入库类型',
    componentType: 'select',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'zsl',
    title: '总数量',
    componentType: 'number',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'ck',
    title: '仓库',
    componentType: 'select',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'ywzz',
    title: '业务组织',
    componentType: 'select',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

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

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'cspc',
    title: '厂商批次',
    componentType: 'input',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: '',
  },

  {
    resizable: true,
    dataIndex: 'pch',
    title: '批次号',
    componentType: 'auto-code',

    fixed: false,
    sorter: true,

    styleConfig: undefined,
    listStyle: undefined,
  },

  {
    resizable: true,
    dataIndex: 'zdr',
    title: '制单人',
    componentType: 'user',

    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: {},
  labelAlign: 'right',
  layout: 'horizontal',
  size: 'default',
  schemas: [
    {
      key: 'af3bef52ccbb47378d216f4386fb730c',
      field: '',
      label: '',
      type: 'grid',
      colProps: { span: 24 },
      component: 'Grid',
      children: [
        {
          span: 8,
          list: [
            {
              key: '8e8adb239db44a4ba19cd28a3d661f16',
              field: 'djh',
              label: '单据号',
              type: 'auto-code',
              component: 'AutoCodeRule',
              colProps: { span: 24 },
              componentProps: {
                width: '100%',
                span: 7,
                placeholder: '请输入单据号',
                prefix: '',
                suffix: '',
                addonBefore: '',
                addonAfter: '',
                showLabel: true,
                autoCodeRule: 'cgdhbh',
                required: false,
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: 'd30ddf6f2a4c44799cdf61184f930cdf',
              field: 'djrq',
              label: '单据日期',
              type: 'date',
              component: 'DatePicker',
              colProps: { span: 24 },
              defaultValue: '',
              componentProps: {
                span: 7,
                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%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: 'cf825b8df185417fa8fa904fa8313dba',
              field: 'crklx',
              label: '出入库类型',
              type: 'select',
              component: 'XjrSelect',
              colProps: { span: 24 },
              componentProps: {
                width: '100%',
                span: 7,
                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: '2010533622867509249' },
                labelField: 'name',
                valueField: 'value',
                apiConfig: {
                  path: 'CodeGeneration/selection',
                  method: 'GET',
                  apiId: '93d735dcb7364a0f8102188ec4d77ac7',
                },
                dicOptions: [],
                required: false,
                rules: [],
                events: {},
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                itemId: '2010533622867509249',
                defaultSelect: '入库',
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '62df26a243614a71a1a42be4425bff71',
              field: 'ck',
              label: '仓库',
              type: 'select',
              component: 'XjrSelect',
              colProps: { span: 24 },
              componentProps: {
                width: '100%',
                span: 7,
                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' },
                ],
                datasourceType: 'dic',
                params: { itemId: '2010539474382962690' },
                labelField: 'name',
                valueField: 'value',
                apiConfig: {
                  path: 'CodeGeneration/selection',
                  method: 'GET',
                  apiId: '93d735dcb7364a0f8102188ec4d77ac7',
                },
                dicOptions: [],
                required: false,
                rules: [],
                events: {},
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                itemId: '2010539474382962690',
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '67205496b1c94fea99508f8b16520473',
              field: 'gys',
              label: '供应商',
              type: 'associate-popup',
              component: 'MultiplePopup',
              colProps: { span: 24 },
              componentProps: {
                popupType: 'associate',
                width: '100%',
                span: 7,
                placeholder: '请选择供应商',
                showLabel: true,
                disabled: false,
                datasourceType: 'api',
                labelField: 'label',
                valueField: 'value',
                pageSize: 10,
                assoTitle: '供应商信息',
                apiConfig: {
                  path: '/jcxx/gysInfoList',
                  method: 'GET',
                  apiId: '9099e750be50417299aa85ac4f27608b',
                  apiParams: [
                    {
                      key: '1',
                      title: 'Query Params',
                      tableInfo: [
                        {
                          name: 'keyword',
                          value: null,
                          description: null,
                          required: false,
                          dataType: null,
                          type: null,
                          defaultValue: null,
                          validateType: null,
                          error: null,
                          expression: null,
                          children: null,
                          bindType: '',
                        },
                      ],
                    },
                    { key: '2', title: 'Header', tableInfo: [] },
                    { key: '3', title: 'Body' },
                  ],
                  script:
                    'var sql ="select *,id as value,name as label from roke_partner where delete_mark = 0 and customer=\'2\'"+\r\n\' ?{keyword, AND name LIKE CONCAT("%", #{keyword}, "%")}\';\r\nreturn db.select(sql);',
                  outputParams: [
                    { name: 'label', tableTitle: '名称', show: true, width: 150 },
                    { name: 'code', tableTitle: '编号', show: true, width: 150 },
                    { name: 'contacts', tableTitle: '联系人', show: true, width: 150 },
                    { name: 'address', tableTitle: '地址', show: true, width: 150 },
                  ],
                },
                dicOptions: [],
                required: false,
                rules: [],
                events: {},
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: 'c8bee15be90449d58c6bb61b45013906',
              field: 'zdr',
              label: '制单人',
              type: 'user',
              component: 'User',
              colProps: { span: 24 },
              defaultValue: '',
              componentProps: {
                span: 7,
                width: '100%',
                defaultValue: '',
                placeholder: '请选择人员',
                userType: 0,
                prefix: '',
                suffix: 'ant-design:setting-outlined',
                showLabel: true,
                disabled: false,
                required: false,
                multiple: true,
                isShow: true,
                events: {},
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '7a4182b8b8ee4a16b9e1ccda3dc71e4c',
              field: 'ywzz',
              label: '业务组织',
              type: 'select',
              component: 'XjrSelect',
              colProps: { span: 24 },
              componentProps: {
                width: '100%',
                span: 7,
                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' },
                ],
                datasourceType: 'dic',
                params: { itemId: '2015724355955159041' },
                labelField: 'name',
                valueField: 'value',
                apiConfig: {
                  path: 'CodeGeneration/selection',
                  method: 'GET',
                  apiId: '93d735dcb7364a0f8102188ec4d77ac7',
                },
                dicOptions: [],
                required: true,
                rules: [],
                events: {},
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                itemId: '2015724355955159041',
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: 'ac1495dbcbde4305b9e30167b92fcc7b',
              field: 'cspc',
              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: false,
                rules: [],
                events: {},
                listStyle: '',
                isSave: false,
                isShow: true,
                scan: false,
                bordered: true,
                isShowAi: false,
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '139048460226487596074dfbbaedba0c',
              field: 'id',
              label: 'Id',
              type: 'input',
              component: 'Input',
              colProps: { span: 24 },
              defaultValue: '',
              componentProps: {
                width: '100%',
                span: 7,
                defaultValue: '',
                placeholder: '请输入Id',
                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: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '7bfde045cd3e4401b4283ac394218c5d',
              field: 'pch',
              label: '批次号',
              type: 'auto-code',
              component: 'AutoCodeRule',
              colProps: { span: 24 },
              componentProps: {
                width: '100%',
                span: 7,
                placeholder: '请输入批次号',
                prefix: '',
                suffix: '',
                addonBefore: '',
                addonAfter: '',
                showLabel: true,
                autoCodeRule: 'pcbm',
                required: false,
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '7bfde045cd3e4401b4283ac394218c5d',
              field: 'zsl',
              label: '总数量',
              type: 'Input',
              component: 'Input',
              colProps: { span: 24 },
              componentProps: {
                width: '100%',
                span: 7,
                placeholder: '',
                prefix: '',
                suffix: '',
                addonBefore: '',
                addonAfter: '',
                showLabel: true,
                autoCodeRule: 'pcbm',
                required: false,
                isShow: true,
                tooltipConfig: { visible: false, title: '提示文本' },
                style: { width: '100%' },
              },
            },
          ],
        },
        {
          span: 24,
          list: [
            {
              key: '2adde8c1d7e24327874bec1411479ec8',
              field: 'bz',
              label: '备注',
              type: 'textarea',
              component: 'InputTextArea',
              colProps: { span: 24 },
              defaultValue: '',
              componentProps: {
                width: '100%',
                span: 2,
                defaultValue: '',
                placeholder: '请输入备注',
                rows: 4,
                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%' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '94f59d97b377411fb1097853bd9479b0',
              field: 'fj',
              label: '上传附件',
              type: 'upload',
              component: 'Upload',
              colProps: { span: 24 },
              componentProps: {
                api: uploadApi,
                span: 7,
                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: '提示文本' },
              },
            },
          ],
        },
        {
          span: 8,
          list: [
            {
              key: '4ca80a2d3a8244bc8d3380b6b0457c25',
              field: 'zsl',
              label: '总数量',
              type: 'number',
              component: 'InputNumber',
              colProps: { span: 24 },
              defaultValue: 0,
              componentProps: {
                width: '100%',
                span: 7,
                defaultValue: 0,
                min: 0,
                step: 1,
                disabled: false,
                showLabel: true,
                controls: true,
                required: false,
                subTotal: false,
                isShow: 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: 'b83f5fe60aff4037af22a97f4db50c63',
      label: '物料明细',
      field: 'mesWarehouseArrivedInfoList',
      type: 'form',
      component: 'SubForm',
      required: true,
      colProps: { span: 24 },
      componentProps: {
        mainKey: 'mesWarehouseArrivedInfoList',
        columns: [
          {
            key: 'd9b1947e596646a9882a13d7e8107675',
            title: 'id',
            dataIndex: 'id',
            componentType: 'Input',
            defaultValue: '',
            componentProps: {
              width: '100%',
              span: '',
              defaultValue: '',
              placeholder: '请输入id',
              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',
            },
          },
          {
            key: '75216f13cd444df0a6ae1b338c8de5f3',
            title: '来源单号ID',
            dataIndex: 'lydhid',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'lyddid',
            },
          },
          {
            key: 'c793430b933d4d6db6c492bdec4597b1',
            title: '物料编码',
            dataIndex: 'wlid',
            componentType: 'MultiplePopup',
            componentProps: {
              popupType: 'associate',
              width: '100%',
              span: '',
              placeholder: '请选择物料编码',
              showLabel: true,
              disabled: false,
              datasourceType: 'api',
              labelField: 'label',
              valueField: 'value',
              pageSize: 10,
              assoTitle: '物料编码',
              apiConfig: {
                path: '/jcxx/wlInfoList',
                method: 'GET',
                apiId: '58a1e5be580f4cc991e444e95142bbe7',
                apiParams: [
                  {
                    key: '1',
                    title: 'Query Params',
                    tableInfo: [
                      {
                        name: 'keyword',
                        value: null,
                        description: null,
                        required: false,
                        dataType: 'String',
                        type: null,
                        defaultValue: null,
                        validateType: null,
                        error: null,
                        expression: null,
                        children: null,
                        bindType: '',
                      },
                    ],
                  },
                  { key: '2', title: 'Header', tableInfo: [] },
                  { key: '3', title: 'Body' },
                ],
                script:
                  'var sql ="select *,id as value,cpbh as label from mes_base_product_info where delete_mark = 0"+\r\n\' ?{keyword, AND cpmc LIKE CONCAT("%", #{keyword}, "%")}\';\r\nreturn db.select(sql);',
                outputParams: [
                  {
                    name: 'label',
                    tableTitle: '物料编码',
                    bindField: 'wlbm',
                    show: true,
                    width: 150,
                    component: 'd156328500cb4894ad6856524fb85d98',
                    bindTable: 'mes_warehouse_arrived_info',
                  },
                  {
                    name: 'cpmc',
                    tableTitle: '物料名称',
                    bindField: 'wlmc',
                    show: true,
                    width: 150,
                    component: 'e8b50d775cf34c278af462df13a9c865',
                    bindTable: 'mes_warehouse_arrived_info',
                  },
                  {
                    name: 'gg',
                    tableTitle: '规格',
                    bindField: 'gg',
                    show: true,
                    width: 150,
                    component: '0e6903d4d9014dcfae6b1cb666d448b7',
                    bindTable: 'mes_warehouse_arrived_info',
                  },
                  {
                    name: 'xh',
                    tableTitle: '型号',
                    bindField: 'xh',
                    show: true,
                    width: 150,
                    component: '63ed4d83c8bc4858872435c676ca8eb7',
                    bindTable: 'mes_warehouse_arrived_info',
                  },
                ],
              },
              dicOptions: [],
              required: false,
              rules: [],
              events: {},
              isShow: true,
              tooltipConfig: { visible: false, title: '提示文本' },
            },
          },
          {
            key: 'd156328500cb4894ad6856524fb85d98',
            title: '物料编码',
            dataIndex: 'wlbm',
            componentType: 'Input',
            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: false,
              scan: false,
              bordered: true,
              isShowAi: false,
              tooltipConfig: { visible: false, title: '提示文本' },
              prestrainField: 'wlbm',
            },
          },
          {
            key: 'e8b50d775cf34c278af462df13a9c865',
            title: '物料名称',
            dataIndex: 'wlmc',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'wlmc',
            },
          },
          {
            key: '0e6903d4d9014dcfae6b1cb666d448b7',
            title: '规格',
            dataIndex: 'gg',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'ggxh',
            },
          },
          {
            key: '63ed4d83c8bc4858872435c676ca8eb7',
            title: '型号',
            dataIndex: 'xh',
            componentType: 'Input',
            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: '提示文本' },
            },
          },
          {
            key: '4301478a5ef2448abdfdeee629297fbf',
            title: '单位',
            dataIndex: 'dw',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'dw',
            },
          },
          {
            key: '36635cbf40d14baf96358f8fa129ce0f',
            title: '实收数量',
            dataIndex: 'sssl',
            componentType: 'Input',
            defaultValue: 0,
            componentProps: {
              span: '',
              width: '100%',
              defaultValue: 0,
              placeholder: '请输入实收数量',
              addonBefore: '',
              addonAfter: '',
              prefix: '',
              maxlength: null,
              showLabel: true,
              disabled: false,
              subTotal: false,
              computationalConfig: [],
              computationalConfigValue: '== 请填写计算式配置 ==',
              beAdoptedComponent: ['4be31cc0258a426bb3ed21612076b687'],
              decimals: 0,
              required: false,
              isShow: true,
              rules: [],
              events: {},
              tooltipConfig: { visible: false, title: '提示文本' },
            },
          },
          {
            key: '5e4377f941cd450ba40bbc1f9d26ff27',
            title: '应收数量',
            dataIndex: 'yssl',
            componentType: 'Input',
            defaultValue: 0,
            componentProps: {
              span: '',
              width: '100%',
              defaultValue: 0,
              placeholder: '请输入应收数量',
              addonBefore: '',
              addonAfter: '',
              prefix: '',
              maxlength: null,
              showLabel: true,
              disabled: false,
              subTotal: false,
              computationalConfig: [],
              computationalConfigValue: '== 请填写计算式配置 ==',
              beAdoptedComponent: ['4be31cc0258a426bb3ed21612076b687'],
              decimals: 0,
              required: false,
              isShow: true,
              rules: [],
              events: {},
              tooltipConfig: { visible: false, title: '提示文本' },
            },
          },
          {
            key: '4be31cc0258a426bb3ed21612076b687',
            title: '剩余数量',
            dataIndex: 'sysl',
            componentType: 'Computation',
            defaultValue: 0,
            componentProps: {
              span: '',
              width: '100%',
              defaultValue: 0,
              placeholder: '请输入剩余数量',
              addonBefore: '',
              addonAfter: '',
              prefix: '',
              maxlength: null,
              showLabel: true,
              disabled: false,
              subTotal: false,
              computationalConfig: [
                {
                  $index: 145,
                  label: '应收数量',
                  type: 'computational',
                  key: '5e4377f941cd450ba40bbc1f9d26ff27',
                  bindTable: 'mesWarehouseArrivedInfo',
                  bindField: 'yssl',
                  isMainForm: false,
                },
                { $index: 841, label: '-', type: 'operation', key: 2 },
                {
                  $index: 830,
                  label: '实收数量',
                  type: 'computational',
                  key: '36635cbf40d14baf96358f8fa129ce0f',
                  bindTable: 'mesWarehouseArrivedInfo',
                  bindField: 'sssl',
                  isMainForm: false,
                },
              ],
              computationalConfigValue: '应收数量-实收数量',
              beAdoptedComponent: [],
              decimals: 0,
              required: false,
              isShow: true,
              rules: [],
              events: {},
              tooltipConfig: { visible: false, title: '提示文本' },
            },
          },
          {
            key: '9a27b6bf1d2445e796c474269ee23514',
            title: '需求部门',
            dataIndex: 'xqbm',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'xqbm',
            },
          },
          {
            key: 'd5ad3321ea444ead9034b6acb9e376a8',
            title: '厂商批次',
            dataIndex: 'cspc',
            componentType: 'Input',
            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: '提示文本' },
            },
          },
          {
            key: '3582e53475224ea18082fbddb678e7ec',
            title: '批次号',
            dataIndex: 'pch',
            componentType: 'Input',
            defaultValue: '',
            componentProps: {
              width: '100%',
              span: '',
              defaultValue: '',
              placeholder: '请输入批次号',
              prefix: '',
              suffix: '',
              addonBefore: '',
              addonAfter: '',
              disabled: false,
              allowClear: false,
              showLabel: true,
              required: false,
              rules: [],
              events: {
                click:
                  "const pch = formModel['pch'];\nconst length =formModel['mesWarehouseArrivedInfoList'].length;\nformModel.mesWarehouseArrivedInfoList[length-1].pch=pch; ",
              },
              listStyle: '',
              isSave: false,
              isShow: true,
              scan: false,
              bordered: true,
              isShowAi: false,
              tooltipConfig: { visible: false, title: '提示文本' },
            },
          },
          {
            key: 'd2d0c0c885684a99a792beb3dc3415ba',
            title: '是否赠品',
            dataIndex: 'sfzp',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'sfzp',
            },
          },
          {
            key: 'f25594957e6543e5a4d109a576c0a557',
            title: '是否质检',
            dataIndex: 'sfzj',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'zfzj',
            },
          },
          {
            key: '18a8a0253ac34f5eae913f671b763505',
            title: '货位号',
            dataIndex: 'hwh',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'hwh',
            },
          },
          {
            key: '261352c5876c4c438f0c8d0973454d8a',
            title: '备注',
            dataIndex: 'bz',
            componentType: 'Input',
            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: '提示文本' },
              prestrainField: 'bz',
            },
          },
        ],
        span: '24',
        preloadType: 'api',
        apiConfig: {
          path: '/getArrivedInfo',
          method: 'GET',
          apiId: '1ac03783f66c4a1d9770567cd3de1fca',
          apiParams: [
            {
              key: '1',
              title: 'Query Params',
              tableInfo: [
                {
                  name: 'dhdid',
                  value: '{"bindField":"id","fieldKey":"139048460226487596074dfbbaedba0c"}',
                  required: true,
                  dataType: 'String',
                  defaultValue: '0',
                  bindType: 'data',
                },
              ],
            },
            { key: '2', title: 'Header', tableInfo: [] },
            { key: '3', title: 'Body' },
          ],
          script:
            'var sql="select * from mes_warehouse_arrived_info where dhdid = #{dhdid}";\r\nreturn db.select(sql);',
        },
        itemId: '',
        dicOptions: [],
        useSelectButton: false,
        buttonName: '选择数据',
        showLabel: true,
        showComponentBorder: true,
        showBorder: false,
        bordercolor: '#f0f0f0',
        bordershowtype: [true, true, true, true],
        borderwidth: 1,
        showIndex: true,
        isShow: true,
        multipleHeads: [],
        buttonList: [],
        topButtonList: [
          {
            key: 'button1767921063540',
            label: '批量报检',
            icon: 'ant-design:alert-outlined',
            style: 'primary',
            event: [
              {
                key: '1',
                type: 2,
                operateType: 2,
                operateConfig: {
                  js: "if (formActionType.selectedRowsData && formActionType.selectedRowsData.length === 0) { formActionType.showMessage('请先勾选物料明细数据'); } else { const ids = formActionType.selectedRowsData.map(item => item.id); console.log('Extracted ids:', ids); formActionType.httpRequest({ requestUrl: '/ckgl/cgdh/quailty', requestType: 'put', params: ids, errorMessageMode: 'message' }).then(response => { console.log('Quality check response:', response); if (formActionType.showSuccessMessage) { formActionType.showSuccessMessage('报检处理成功！'); } else if (formActionType.message) { formActionType.message.success('报检处理成功！'); } else { formActionType.showMessage('报检处理成功！'); } if (formActionType.clearSelection) { formActionType.clearSelection(); } }).catch(error => { console.error('Quality check error:', error); formActionType.showMessage('批量报检失败，请重试！'); }); }",
                },
              },
            ],
            type: 1,
          },
        ],
        isExport: false,
        isImport: false,
        isDeleteSelected: false,
        isListView: false,
        viewList: [],
        isShowAdd: true,
        isShowDelete: false,
        hasCheckedCol: true,
        events: {},
        showPagenation: true,
      },
    },
  ],
  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,
  // },
];
