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

import type { IModalConfig } from "@/components/CURD/types";

const modalConfig: IModalConfig<UserForm> = {
  pageName: "sys:user",
  dialog: {
    title: "新增分类",
    width: 800,
    draggable: true,
  },
  form: {
    labelWidth: 120,
  },
  formAction: UserAPI.addunit,
  beforeSubmit(data) {
    console.log("提交之前处理", data);
  },
  formItems: [
    {
      label: "分类名称",
      prop: "name",
      rules: [{ required: true, message: "分类名称不能为空", trigger: "blur" }],
      type: "input",
      attrs: {
        placeholder: "请输入分类名称",
      },
    },
    {
      label: "分类图片",
      prop: "pic",
      type: "UpImage",
    },
    {
      label: '退菜是否退库存',
      prop: 'refundMode',
      type: 'radio',
      options: [
        { label: "退菜退库存", value: 1 },
        { label: "仅退菜不退库存", value: 2 },
        { label: "每次询问-退菜后弹窗提示，可手动选择", value: 3 },
      ],
      initialValue: 1,
    },
    {
      label: "排序",
      prop: "sort",
      type: "input-number",
      attrs: {
        placeholder: "请输入排序",
      },
      initialValue: 1,
    },
    {
      label: "开关",
      prop: "status",
      type: "switch",
      options: [
        { label: "启用", value: 1 },
        { label: "禁用", value: 0 },
      ],
      attrs: {
        activeValue: 1,
        inactiveValue: 0,
      },
      initialValue: 1,
    }
  ],
};
export interface UserForm { }
// 如果有异步数据会修改配置的，推荐用reactive包裹，而纯静态配置的可以直接导出
export default reactive(modalConfig);
