import { BasicColumn, FormSchema } from '@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { getPosGroupList } from '@/api/demo/system';

export const columns: BasicColumn[] = [
  {
    title: '文件名称',
    dataIndex: 'name',
    align: 'left',
    width: 200,
  },
  {
    title: '创建时间',
    dataIndex: 'createtime',
    align: 'left',
    width: 150,
  },
  {
    title: '大小',
    dataIndex: 'size',
    align: 'left',
    width: 75,
  },
  {
    title: '标签',
    dataIndex: 'label',
    align: 'left',
    width: 200,
  },
  {
    title: '设备名称',
    dataIndex: 'equipmentName',
    align: 'left',
    width: 200,
  },
  {
    title: '操作',
    dataIndex: 'action',
    align: 'left',
    width: 120,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'label',
    label: '标签',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      mode: 'multiple',
      options: [  
        { label: '标签1', value: '标签1' },
        { label: '标签2', value: '标签2' },
        { label: '标签3', value: '标签3' },
      ],
    },
  },
  {
    field: 'equipmentName',
    label: '设备名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: '[startTime, endTime]',
    label: '时间选择',
    component: 'RangePicker',
    colProps: { span: 6},
  },
  {
    field: 'name',
    label: '文件名称',
    component: 'Input',
    colProps: { span: 6 },
  },
];
export const formGroupSchema: FormSchema[] = [
  {
    field: 'posGroupId',
    component: 'ApiSelect',
    label: '职级组',
    required: true,
    componentProps: ({ formActionType, formModel }) => {
      return {
        api: getPosGroupList, // 接口
        // 接口参数
        resultField: 'result',
        labelField: 'name',
        valueField: 'id',
      };
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: '部门id',
    component: 'Input',
    ifShow: true,
  },
  {
    field: 'name',
    label: '部门名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'parentId',
    label: '上级部门',
    component: 'TreeSelect',
    componentProps: {
      fieldNames: {
        label: 'name',
        key: 'id',
        value: 'id',
      },
      onChange:(value)=>{
        console.log(value)
      },
      getPopupContainer: () => document.body,
    },
    // required: true,
  },
  // {
  //   field: 'orderNo',
  //   label: '排序',
  //   component: 'InputNumber',
  //   required: true,
  // },
  {
    field: 'status',
    label: '状态',
    component: 'RadioButtonGroup',
    defaultValue: 0,
    componentProps: {
      options: [
        { label: '启用', value: 0 },
        { label: '停用', value: 1 },
      ],
    },
    required: true,
  },
  // {
  //   label: '备注',
  //   field: 'remark',
  //   component: 'InputTextArea',
  // },
];

// 新建文件夹
export const addFolderSchema: FormSchema[] = [
  {
    field: 'name',
    component: 'Input',
    label: '上级目录',
    required: false,
    defaultValue: '/',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'newName',
    component: 'Input',
    label: '新文件夹名称',
    required: true,
  },
];

// 压缩
export const compressFileSchema: FormSchema[] = [
  {
    field: 'compressName',
    component: 'Input',
    label: '压缩文件名称',
    required: true,
    defaultValue: '压缩文件',
  }
];

// 重命名
export const renameSchema: FormSchema[] = [
  {
    field: 'name',
    component: 'Input',
    label: '新名称',
    required: true,
  }
];