import { rules, userGroupProps } from "./configs";
import { ModalConfig } from "/@/components/PageModal/src/types";

const modalConfig: ModalConfig = {
  title: "用户组",
  colLayout: { span: 24 },
  divider: true,
  formGroup: [
    {
      title: "数据源",
      formItems: [
        {
          field: userGroupProps.menu,
          type: "select",
          label: "共享的数据菜单",
          labelWidth: "120px",
          rules: rules[userGroupProps.menu],
          placeholder: "请选择共享的数据菜单"
        },
        {
          field: userGroupProps.source_user,
          type: "select",
          label: "数据源用户",
          labelWidth: "120px",
          rules: rules[userGroupProps.source_user],
          placeholder: "请选择数据源用户"
        },
        {
          field: userGroupProps.source_group,
          type: "select",
          label: "数据源用户组",
          labelWidth: "120px",
          rules: rules[userGroupProps.source_group],
          placeholder: "请选择数据源用户组"
        }
      ]
    },
    {
      title: "数据共享",
      formItems: [
        {
          field: userGroupProps.data_user,
          type: "select",
          label: "数据共享用户",
          labelWidth: "120px",
          rules: rules[userGroupProps.data_user],
          placeholder: "请选择数据共享用户"
        },
        {
          field: userGroupProps.data_group,
          type: "select",
          label: "数据共享用户组",
          labelWidth: "120px",
          rules: rules[userGroupProps.data_group],
          placeholder: "请选择数据共享用户组"
        },
        {
          field: userGroupProps.share,
          type: "radio",
          label: "共享的数据权限",
          labelWidth: "120px",
          placeholder: "请选择共享的数据权限",
          options: [
            {
              value: "0",
              label: "只读"
            },
            {
              value: "1",
              label: "读写"
            }
          ],
          rules: rules[userGroupProps.source_user]
        }
      ]
    }
  ]
};

export default modalConfig;
