import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Form';
import { radioBoolean } from '/@/utils/filters';
import { listDictModel } from '/@/api/common';

export const dataFormSchema: FormSchema[] = [
  {
    field: 'PlainTitle',
    component: 'PlainTitle',
    defaultValue: '检测时间',
    colProps: {
      span: 24,
    },
  },
  {
    field: 'PlainText1111',
    component: 'RadioDescGroup',
    label: '1、干体重在过去3～6个月总的变化',
    componentProps: {
      options: [
        { label: '干体重没有减少或体重丢失 <0.5kg (0分)', value: 0 },
        { label: '体重丢失 ≥0.5kg，但 ＜1kg (1分)', value: 1 },
      ],
    },
    colProps: {
      span: 24,
    },
    defaultValue: 1,
  },
  {
    field: 'configName',
    label: '参数名称',
    labelColor: '#818694',
    component: 'Input',
    componentProps: {
      placeholder: '请输入参数名称',
      extra: '123123',
    },
  },
  {
    field: 'configName1',
    label: '参数名称',
    labelColor: '#818694',
    component: 'Input',
    componentProps: {
      placeholder: '请输入参数名称',
      extra: '123123',
    },
  },
  {
    field: 'configName22',
    label: '参数名称',
    labelColor: '#818694',
    component: 'Input',
    componentProps: {
      placeholder: '请输入参数名称',
      extra: '123123',
    },
  },
  {
    field: 'configName333',
    label: '有无异常',
    component: 'ApiComplex',
    componentProps: ({ formModel }) => {
      return {
        placeholder: '请输入异常内容',
        api: listDictModel,
        params: {
          dictCode: 'sys_dict_type',
        },
        onChange: e => {
          console.log('🚀 ~ file: data.ts:81 ~ e:', e);
          return (formModel['configName333'] = e);
        },
      };
    },
  },
  {
    field: 'configKey',
    label: '参数键名',
    labelColor: '#818694',
    subLabel: '测试',
    subLabelColor: '#FF5D39',
    component: 'Input',
    required: true,
    componentProps: {
      placeholder: '请输入参数键名',
      // style: { width: '200px' },
    },
  },
  {
    field: 'configValue',
    label: '参数键值',
    component: 'InputNumberGroup',
    componentProps: ({ formModel }) => {
      return {
        options: [
          { min: 0, max: 200, placeholder: '最小值 0', field: 'min' },
          { min: 0, max: 200, placeholder: '最大值 200', field: 'max' },
        ],
        onChange: e => {
          return (formModel['configValue'] = e);
        },
      };
    },
  },
  {
    field: 'idCard',
    label: '证件号码',
    component: 'ApiInputDict',
    componentProps: ({ formModel }) => {
      return {
        placeholder: '请输入异常内容',
        api: listDictModel,
        params: {
          dictCode: 'sys_dict_type',
          dictSort: true,
        },
        onChange: e => {
          console.log('🚀 ~ file: data.ts:81 ~ e:', e);
          return (formModel['idCard'] = e);
        },
      };
    },
  },
  {
    field: 'sort',
    label: '排序',
    component: 'InputNumber',
    required: true,
    defaultValue: '1',
    componentProps: {
      placeholder: '请输入排序',
      min: 1,
    },
  },
  {
    field: 'sysInner',
    label: '系统内置',
    component: 'RadioGroup',
    componentProps: {
      options: radioBoolean,
      disabled: true,
    },
    defaultValue: '1',
  },
  {
    field: 'apiCheck',
    label: '系统内置',
    component: 'ApiCheckboxGroup',
    componentProps: {
      api: listDictModel,
      params: {
        dictCode: 'bm_pump',
      },
    },
    // defaultValue: ['pump_single'],
  },
  // {
  //   field: 'disable',
  //   label: '状态',
  //   component: 'RadioGroup',
  //   required: true,
  //   componentProps: {
  //     options: radioSwitch,
  //   },
  //   defaultValue: '0',
  // },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入备注',
    },
  },
];
export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 100,
    edit: true,
    editable: true,
    editComponent: 'Input',
  },
  {
    title: '类型',
    dataIndex: 'type',
    width: 150,
  },
  {
    title: '联系人',
    dataIndex: 'contractUser',
    width: 150,
  },
  {
    title: '联系人电话',
    dataIndex: 'contactMobile',
    width: 150,
  },
  {
    title: '名称',
    dataIndex: 'name',
    width: 100,
  },
  {
    title: '类型',
    dataIndex: 'type',
    width: 150,
  },
  {
    title: '联系人',
    dataIndex: 'contractUser',
    width: 150,
  },
  {
    title: '联系人电话',
    dataIndex: 'contactMobile',
    width: 150,
  },
  {
    title: '管理账号',
    dataIndex: 'username',
    width: 150,
  },
  {
    title: '套餐名称',
    dataIndex: 'packageName',
    width: 150,
  },
  {
    title: '联系人',
    dataIndex: 'contractUser',
    width: 150,
  },
  {
    title: '联系人电话',
    dataIndex: 'contactMobile',
    width: 150,
  },
  {
    title: '管理账号',
    dataIndex: 'username',
    width: 150,
  },
  {
    title: '套餐名称',
    dataIndex: 'packageName',
    width: 150,
    fixed: 'right',
  },
  {
    title: '状态',
    dataIndex: 'disable',
    fixed: 'right',
  },
];
