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: 'msg_title',
  },
  {
    title: '内容',
    dataIndex: 'msg_content',
  },
  {
    title: '编辑人',
    dataIndex: 'createusername',
  },
  {
    title: '创建时间',
    dataIndex: 'createtime',
  },
  // {
  //   title: '操作',
  //   dataIndex: 'operate',
  // },
  // {
  //   title: '备注',
  //   dataIndex: 'remark',
  // },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'key',
    label: '关键字段',
    component: 'Input',
    colProps: { span: 6 },
  },{
    field: 'msg_type',
    component: 'Select',
    label: '通知类型',
    colProps: {
      span: 6,
    },
    componentProps: {
      options: [
        {
          label: '政策法规',
          value: '0',
          key: '0',
        },{
          label: '消息通知',
          value: '1',
          key: '1',
        }
      ],
    },
  }
];
export interface UserListParams{
  key:string;
  page:number;
  limit:number;
}
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: '名称',
    component: 'Input',
    ifShow:false
  },
  {
    field: 'msg_title',
    label: '通知标题',
    component: 'Input',
    required: true,
  },
  {
    field: 'msg_content',
    label: '通知内容',
    component: 'InputTextArea',
    required: true,
  },
  {
    field: 'msg_type',
    label: '通知类型',
    component: 'RadioButtonGroup',
    defaultValue: 0,
    componentProps: {
      options: [
        { label: '政策法规', value: 0 },
        { label: '消息通知', value: 1 },
      ],
    },
    required: true,
  },{
    field: 'is_all',
    label: '是否全选',
    component: 'RadioButtonGroup',
    defaultValue: 0,
    componentProps: {
      options: [
        { label: '否', value: 0 },
        { label: '是', value: 1 },
      ],
    },
    required: true,
  },{
    field: 'is_all',
    label: '是否全选',
    component: 'RadioButtonGroup',
    defaultValue: 0,
    componentProps: {
      options: [
        { label: '否', value: 0 },
        { label: '是', value: 1 },
      ],
    },
    required: true,
  },
  {
    field: 'roles',
    component: 'Select',
    label: '选择角色',
    colProps: {
      span: 24,
    },
    componentProps: {
      mode:"multiple",
      fieldNames: {
        label: 'name',
        value: 'id',
      },
      options: [], // defalut []
      placeholder: '请选择角色',
    },
  },
  {
    field: 'recipientUserId',
    component: 'Select',
    label: '选择用户',
    colProps: {
      span: 24,
    },
    componentProps: {
      mode:"multiple",
      fieldNames: {
        label: 'name',
        value: 'id',
      },
      options: [], // defalut []
      placeholder: '请选择用户',
    },
  },
  {
    field: 'orgs',
    label: '选择部门',
    component: 'TreeSelect',
    componentProps: {
      treeCheckable:true,
      fieldNames: {
        label: 'name',
        value: 'id',
      },
      onChange:(value)=>{
        console.log(value)
      },
      getPopupContainer: () => document.body,
    },
    // required: true,
  },
  
 
];
