feat: 系统管理
Some checks failed
coverage CI / build (push) Has been cancelled

This commit is contained in:
2025-09-23 16:00:15 +08:00
parent 6d1db25c05
commit 9363dc0d6e
29 changed files with 3227 additions and 123 deletions

View File

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