import UserAPI from "@/api/product/index";

import type { IModalConfig } from "@/components/CURD/types";
import { DeviceEnum } from "@/enums/DeviceEnum";
import { useAppStore } from "@/store";

const modalConfig: IModalConfig<UserForm> = {
  pageName: "sys:user",
  // component: "drawer",
  dialog: {
    title: "编辑单位",
    width: 800,
    draggable: true,
  },

  pk: "id",

  formAction: function (data) {
    return UserAPI.update(data);
  },
  beforeSubmit(data) {
    console.log("提交之前处理", data);
  },
  formItems: [
    {
      label: "单位名称",
      prop: "name",
      rules: [{ required: true, message: "单位名称不能为空", trigger: "blur" }],
      type: "input",
      attrs: {
        placeholder: "请输入单位名称",
      },
    },


  ],
};
/** 用户表单类型 */
interface UserForm {
  /** 用户头像 */
  avatar?: string;
  /** 部门ID */
  deptId?: number;
  /** 邮箱 */
  email?: string;
  /** 性别 */
  gender?: number;
  /** 用户ID */
  id?: number;
  /** 手机号 */
  mobile?: string;
  /** 昵称 */
  nickname?: string;
  /** 角色ID集合 */
  roleIds?: number[];
  /** 用户状态(1:正常;0:禁用) */
  status?: number;
  /** 用户名 */
  username?: string;
}

export default reactive(modalConfig);
