diff --git a/config/proxy.ts b/config/proxy.ts index e1a47c0..8a70bb6 100644 --- a/config/proxy.ts +++ b/config/proxy.ts @@ -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, diff --git a/src/components/XTag/index.tsx b/src/components/XTag/index.tsx index 12a6bfd..b86e189 100644 --- a/src/components/XTag/index.tsx +++ b/src/components/XTag/index.tsx @@ -58,10 +58,11 @@ const DictTag: React.FC = ({ .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 = ({ ? dict?.cssClass : undefined; + console.log(customColor, 'customColor'); + console.log(colorType, 'colorType'); + return ( [] = [ title: '字典标签', dataIndex: 'label', width: 120, + render: (_, record) => ( + {record.label} + ), }, { title: '字典键值', @@ -44,6 +47,9 @@ export const baseDictDataColumns: ProColumns[] = [ title: '颜色类型', dataIndex: 'colorType', width: 80, + render: (_, record) => ( + {record.colorType} + ), }, { title: 'CSS Class', @@ -157,23 +163,23 @@ export const formColumns = (_type: string): ProFormColumnsType[] => [ fieldProps: { options: [ { - label: '默认(waiting)', - value: 'waiting', + label: 默认(default), + value: 'default', }, { - label: '成功(success)', + label: 成功(success), value: 'success', }, { - label: '信息(processing)', + label: 信息(processing), value: 'processing', }, { - label: '失败(error)', + label: 失败(error), value: 'error', }, { - label: '警告(warning)', + label: 警告(warning), value: 'warning', }, ], diff --git a/src/pages/system/menu/config.tsx b/src/pages/system/menu/config.tsx index a1d591b..9ec61f1 100644 --- a/src/pages/system/menu/config.tsx +++ b/src/pages/system/menu/config.tsx @@ -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[] = [ { title: '菜单名称', @@ -54,10 +68,13 @@ export const baseMenuColumns: ProColumns[] = [ title: '状态', dataIndex: 'status', width: 80, - render: (_, record: MenuVO) => ( + render: (_dom, record: MenuVO, _: any, action: any) => ( { + 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 ( [ valueType: 'radio', fieldProps: { options: [ - { label: '启用', value: 1 }, - { label: '禁用', value: 0 }, + { label: '启用', value: 0 }, + { label: '禁用', value: 1 }, ], }, },