This commit is contained in:
@@ -15,7 +15,8 @@ export default {
|
||||
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
|
||||
'/admin-api/': {
|
||||
// 要代理的地址
|
||||
target: 'http://114.132.60.20:48080',
|
||||
// target: 'http://114.132.60.20:48080',
|
||||
target: 'http://192.168.1.231:48080',
|
||||
// 配置了这个可以从 http 代理到 https
|
||||
// 依赖 origin 的功能可能需要这个,比如 cookie
|
||||
changeOrigin: true,
|
||||
|
||||
@@ -58,10 +58,11 @@ const DictTag: React.FC<DictTagProps> = ({
|
||||
.filter((dict: DictDataType) => valueArr.includes(String(dict.value)))
|
||||
.map((dict: DictDataType) => {
|
||||
// 处理 tag 类型
|
||||
let colorType: TagProps['color'];
|
||||
if (dict.colorType !== 'primary' && dict.colorType !== 'default') {
|
||||
colorType = dict.colorType || undefined;
|
||||
}
|
||||
const colorType: TagProps['color'] = dict.colorType || undefined;
|
||||
|
||||
// if (dict.colorType !== "primary" && dict.colorType !== "default") {
|
||||
// colorType = dict.colorType || undefined;
|
||||
// }
|
||||
|
||||
// 处理自定义颜色
|
||||
const customColor =
|
||||
@@ -69,6 +70,9 @@ const DictTag: React.FC<DictTagProps> = ({
|
||||
? dict?.cssClass
|
||||
: undefined;
|
||||
|
||||
console.log(customColor, 'customColor');
|
||||
console.log(colorType, 'colorType');
|
||||
|
||||
return (
|
||||
<Tag
|
||||
key={`${dict.value}-${dict.label}`}
|
||||
|
||||
@@ -34,3 +34,10 @@ export const systemDataScopetStatus = [
|
||||
{ label: '部门及以下数据权限', value: 4 },
|
||||
{ label: '仅本人数据权限', value: 5 },
|
||||
];
|
||||
|
||||
// ========== COMMON 模块 ==========
|
||||
// 全局通用状态枚举
|
||||
export const CommonStatusEnum = {
|
||||
ENABLE: 0, // 开启
|
||||
DISABLE: 1, // 禁用
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ActionType } from '@ant-design/pro-components';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import React, { useRef } from 'react';
|
||||
import EnhancedProTable from '@/components/EnhancedProTable';
|
||||
import type { ToolbarAction } from '@/components/EnhancedProTable/types';
|
||||
import UploadCard from '@/components/Upload/UploadCard';
|
||||
|
||||
@@ -19,6 +19,9 @@ export const baseDictDataColumns: ProColumns<DictDataVO>[] = [
|
||||
title: '字典标签',
|
||||
dataIndex: 'label',
|
||||
width: 120,
|
||||
render: (_, record) => (
|
||||
<Tag color={record.cssClass || record.colorType}>{record.label}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '字典键值',
|
||||
@@ -44,6 +47,9 @@ export const baseDictDataColumns: ProColumns<DictDataVO>[] = [
|
||||
title: '颜色类型',
|
||||
dataIndex: 'colorType',
|
||||
width: 80,
|
||||
render: (_, record) => (
|
||||
<Tag color={record.colorType}>{record.colorType}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'CSS Class',
|
||||
@@ -157,23 +163,23 @@ export const formColumns = (_type: string): ProFormColumnsType[] => [
|
||||
fieldProps: {
|
||||
options: [
|
||||
{
|
||||
label: '默认(waiting)',
|
||||
value: 'waiting',
|
||||
label: <Tag color="default">默认(default)</Tag>,
|
||||
value: 'default',
|
||||
},
|
||||
{
|
||||
label: '成功(success)',
|
||||
label: <Tag color="success">成功(success)</Tag>,
|
||||
value: 'success',
|
||||
},
|
||||
{
|
||||
label: '信息(processing)',
|
||||
label: <Tag color="processing">信息(processing)</Tag>,
|
||||
value: 'processing',
|
||||
},
|
||||
{
|
||||
label: '失败(error)',
|
||||
label: <Tag color="error">失败(error)</Tag>,
|
||||
value: 'error',
|
||||
},
|
||||
{
|
||||
label: '警告(warning)',
|
||||
label: <Tag color="warning">警告(warning)</Tag>,
|
||||
value: 'warning',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -6,9 +6,23 @@ import {
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Switch } from 'antd';
|
||||
import { getSimpleMenusList, type MenuVO } from '@/services/system/menu';
|
||||
import { CommonStatusEnum } from '@/constants';
|
||||
import { useMessage } from '@/hooks/antd/useMessage';
|
||||
import {
|
||||
getSimpleMenusList,
|
||||
type MenuVO,
|
||||
updateMenu,
|
||||
} from '@/services/system/menu';
|
||||
import { handleTree } from '@/utils/tree';
|
||||
|
||||
const handleStatus = async (record: MenuVO) => {
|
||||
const message = useMessage(); // 消息弹窗
|
||||
const text = record.status === CommonStatusEnum.ENABLE ? '停用' : '启用';
|
||||
await message.confirm(`确认要"${text}""${record.name}"菜单吗?`);
|
||||
const status = record.status === 0 ? 1 : 0;
|
||||
await updateMenu({ ...record, status });
|
||||
};
|
||||
|
||||
export const baseMenuColumns: ProColumns<MenuVO>[] = [
|
||||
{
|
||||
title: '菜单名称',
|
||||
@@ -54,10 +68,13 @@ export const baseMenuColumns: ProColumns<MenuVO>[] = [
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
width: 80,
|
||||
render: (_, record: MenuVO) => (
|
||||
render: (_dom, record: MenuVO, _: any, action: any) => (
|
||||
<Switch
|
||||
checked={record.status === 1}
|
||||
disabled={true} // 可后续改为可编辑
|
||||
onClick={async () => {
|
||||
await handleStatus(record);
|
||||
action?.reload();
|
||||
}}
|
||||
checked={record.status === 0}
|
||||
/>
|
||||
),
|
||||
},
|
||||
@@ -204,6 +221,7 @@ export const formColumns = (_type: string): ProFormColumnsType[] => [
|
||||
renderFormItem: (_schema, _config, form) => {
|
||||
const type = form.getFieldValue('type');
|
||||
if (type !== 2) return null;
|
||||
|
||||
return (
|
||||
<ProFormText
|
||||
formItemProps={{
|
||||
@@ -264,8 +282,8 @@ export const formColumns = (_type: string): ProFormColumnsType[] => [
|
||||
valueType: 'radio',
|
||||
fieldProps: {
|
||||
options: [
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 },
|
||||
{ label: '启用', value: 0 },
|
||||
{ label: '禁用', value: 1 },
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user