feat: menu

This commit is contained in:
2025-09-17 10:41:00 +08:00
parent 9d5a289929
commit aada97ed22
27 changed files with 973 additions and 527 deletions

View File

@@ -0,0 +1,223 @@
import { type TenantVO, deleteTenant } from "@/services/system/tenant/list";
import { ProColumns } from "@ant-design/pro-components";
import { DatePicker, Modal, Popconfirm } from "antd";
import { FormInstance } from "antd/lib";
import dayjs from "dayjs";
export const baseTenantColumns: ProColumns<TenantVO>[] = [
{
title: "租户编号",
dataIndex: "id",
tip: "租户编号",
width: 100,
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: "租户名",
dataIndex: "name",
tip: "租户名", // 提示信息
},
{
title: "租户套餐",
dataIndex: "packageId",
valueType: "select",
request: async () => {
return [
{
label: "默认套餐",
value: 1,
},
];
},
// valueEnum: {
// all: { text: "全部", status: "Default" },
// open: { text: "未解决", status: "Error" },
// closed: { text: "已解决", status: "Success" },
// },
},
{
title: "联系人",
dataIndex: "contactName",
},
{
title: "联系手机",
dataIndex: "contactMobile",
},
{
title: "账号额度",
dataIndex: "accountCount",
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: "过期时间",
dataIndex: "expireTime",
valueType: "dateTime",
hideInSearch: true, // 在搜索表单中隐藏
},
{ title: "绑定域名", dataIndex: "website", width: 100 },
{
title: "租户状态",
dataIndex: "status",
valueType: "select",
valueEnum: {
all: { text: "全部", status: "Default" },
open: { text: "未解决", status: "Error" },
closed: { text: "已解决", status: "Success" },
},
},
{
title: "创建时间",
dataIndex: "createTime",
valueType: "dateRange",
search: {
transform: (value) => {
return [`${value[0]} 00:00:00`, `${value[1]} 00:00:00`];
},
},
render: (_, record: TenantVO) =>
dayjs(record.createTime).format("YYYY-MM-DD HH:mm:ss"),
},
];
export const formColumns: any = [
{
title: "租户名",
dataIndex: "name",
tip: "租户名", // 提示信息
formItemProps: {
rules: [
{
required: true,
message: "请输入用户名",
},
// {
// min: 2,
// max: 20,
// message: "用户名长度为2-20个字符",
// },
],
},
},
{
title: "租户套餐",
dataIndex: "packageId",
valueType: "select",
formItemProps: {
rules: [
{
required: true,
message: "请选择租户套餐",
},
],
},
fieldProps: {
placeholder: "请选择套餐类型",
options: [
{
label: "普通套餐",
value: 111,
},
],
},
},
{
title: "联系人",
dataIndex: "contactName",
},
{
title: "联系手机",
dataIndex: "contactMobile",
formItemProps: {
rules: [
{
required: true,
message: "请输入联系手机",
},
],
},
},
{
title: "用户名称",
dataIndex: "username",
hideInForm: true,
formItemProps: {
rules: [
{
required: true,
message: "请输入用户名称",
},
{
pattern: /^[a-zA-Z0-9]+$/,
message: "用户账号由 0-9、a-z、A-Z 组成",
},
// 用户账号由 数字、字母组成
],
},
},
{
title: "用户密码",
dataIndex: "password",
valueType: "password",
hideInForm: true,
fieldProps: {
placeholder: "请输入用户密码",
autoComplete: "new-password",
},
formItemProps: {
rules: [
{
required: true,
message: "请输入用户密码",
},
{
min: 4,
max: 16,
message: "密码长度为4-16个字符",
},
],
},
},
{
title: "账号额度",
dataIndex: "accountCount",
valueType: "digit",
},
{
title: "过期时间",
dataIndex: "expireTime",
valueType: "date",
fieldProps: {
placeholder: "请选择过期时间",
format: "YYYY-MM-DD",
},
},
{ title: "绑定域名", dataIndex: "website" },
{
title: "租户状态",
dataIndex: "status",
valueType: "radio",
formItemProps: {
rules: [
{
required: true,
message: "请选择租户状态",
},
],
},
fieldProps: {
placeholder: "请选择套餐类型",
options: [
{
label: "启用",
value: 1,
},
{
label: "禁用",
value: 0,
},
],
},
},
];