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: 300,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    align: 'center',
    width: 150,
  },
  {
    title: '大小',
    dataIndex: 'size',
    align: 'center',
    width: 75,
  },
  {
    title: '标签',
    dataIndex: 'fileTags',
    align: 'center',
    width: 200,
  },
  {
    title: '设备名称',
    dataIndex: 'equipmentName',
    align: 'center',
    width: 200,
  },
  {
    title: '操作',
    dataIndex: 'action',
    align: 'center',
    width: 120,
  },
];

export const searchFormSchema: FormSchema[] = [
  // {
  //   field: 'device',
  //   label: '标签',
  //   component: 'Select',
  //   colProps: { span: 6 },
  //   componentProps: {
  //     mode: 'multiple',
  //     options: [  
  //       { label: '标签1', value: '标签1' },
  //       { label: '标签2', value: '标签2' },
  //       { label: '标签3', value: '标签3' },
  //     ],
  //   },
  // },
  // {
  //   field: 'device',
  //   label: '飞行器枚举',
  //   component: 'Select',
  //   colProps: { span: 6 },
  //   componentProps: {
  //     mode: 'multiple',
  //     options: [  
  //       { label: '0-100-1', value: '0-100-1' },
  //     ],
  //   },
  // },
  // {
  //   field: 'picname',
  //   label: '设备名称',
  //   component: 'Input',
  //   colProps: { span: 6 },
  // },
  {
    field: 'picname',
    label: '文件名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: '[startTime, endTime]',
    label: '时间选择',
    component: 'RangePicker',
    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,
  }
];

export const svg_showOnMap_1 = `<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 24 24"
width="16"
height="16"
>
<path
  d="M19 5v11.17l2 2V5c0-1.1-.9-2-2-2H5.83l2 2H19zM2.81 2.81L1.39 4.22L3 5.83V19c0 1.1.9 2 2 2h13.17l1.61 1.61l1.41-1.41L2.81 2.81zM5 19V7.83l7.07 7.07l-.82 1.1L9 13l-3 4h8.17l2 2H5z"
  fill="#000000"
></path>
</svg>`;

export const svg_showOnMap_0 = `<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 24 24"
width="16"
height="16"
>
<path
  d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14L6 17h12l-3.86-5.14z"
  fill="#000000"
></path>
</svg>`;