diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index d108d9a..fcfeaeb 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -7,7 +7,7 @@ import settingDrawer from './zh-CN/settingDrawer'; import settings from './zh-CN/settings'; import common from './zh-CN/common'; import app from './zh-CN/app'; -import {interface_api, dynamic_menu, api, role, user, post, department} from "@/locales/zh-CN/system"; +import {interface_api, dynamic_menu, api, role, user, post, department, operation_record} from "@/locales/zh-CN/system"; import * as analysisZh from "@/locales/zh-CN/analysis"; import * as errorTypesZh from "@/locales/zh-CN/errorTypes"; import * as deviceZh from "@/locales/zh-CN/device"; @@ -30,7 +30,7 @@ export default { ...pwa, ...common, ...component, - ...interface_api, ...dynamic_menu, ...api, ...role, ...user, ...post, ...department, + ...interface_api, ...dynamic_menu, ...api, ...role, ...user, ...post, ...department, ...operation_record, ...app, ...Object.assign({}, ...Object.values(analysisZh)), diff --git a/src/locales/zh-CN/system.ts b/src/locales/zh-CN/system.ts index e07e1fa..04be3ed 100644 --- a/src/locales/zh-CN/system.ts +++ b/src/locales/zh-CN/system.ts @@ -116,3 +116,23 @@ export const department: { [key: string]: string } = { 'system.department.table.rule.required.name': '部门名称为必填项', 'system.department.table.rule.required.code': '部门代码为必填项', } +export const operation_record: { [key: string]: string } = { + 'system.operation.table.list.id': 'ID', + 'system.operation.table.list.status': '请求状态', + 'system.operation.table.list.ip': '请求IP', + 'system.operation.table.list.path': '接口路径', + 'system.operation.table.list.method': '请求方法', + 'system.operation.table.list.latency': '延迟', + 'system.operation.table.list.agent': '代理', + 'system.operation.table.list.error_message': '错误信息', + 'system.operation.table.list.body': '请求Body', + 'system.operation.table.list.resp': '响应Body', + 'system.operation.table.list.user_id': '用户ID', + 'system.operation.table.list.sort': '排序', + 'system.operation.table.list.remark': '备注', + 'system.operation.table.list.createTime': '创建时间', + 'system.operation.table.list.updateTime': '更新时间', + + 'system.operation.table.rule.list.ip': '请填写IP', + 'system.operation.table.rule.list.path': '请填写接口路径', +} diff --git a/src/pages/System/ApiList/components/CreateForm.tsx b/src/pages/System/ApiList/components/CreateForm.tsx index 5c4479e..d06e763 100644 --- a/src/pages/System/ApiList/components/CreateForm.tsx +++ b/src/pages/System/ApiList/components/CreateForm.tsx @@ -5,6 +5,8 @@ import {FormattedMessage, useIntl} from '@umijs/max'; import React from 'react'; import {postApiCreateApi} from "@/services/system/Api"; import {Form, message} from 'antd'; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type CreateFormProps = { createModalOpen: boolean; @@ -19,6 +21,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { return ( <ModalForm<API.Api> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -44,7 +47,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="path" + <ProFormText width={proFormItemStyleProps.column2Width} name="path" label={<FormattedMessage id="system.api.table.list.path" defaultMessage="$$$"/>} placeholder="请输入接口路径" required={true} rules={[ @@ -59,7 +62,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormSelect width="md" name="method" + <ProFormSelect width={proFormItemStyleProps.column2Width} name="method" label={<FormattedMessage id="system.api.table.list.method" defaultMessage="$$$"/>} placeholder="请输入请求方式" required={false} initialValue="GET" valueEnum={{ 'GET': intl.formatMessage({id: 'system.api.enum.GET', defaultMessage: '$$$',}), @@ -68,10 +71,10 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { 'PUT': intl.formatMessage({id: 'system.api.enum.PUT', defaultMessage: '$$$',}), 'PATCH': intl.formatMessage({id: 'system.api.enum.PATCH', defaultMessage: '$$$',}) }}/> - <ProFormText width="md" name="apiGroup" + <ProFormText width={proFormItemStyleProps.column2Width} name="apiGroup" label={<FormattedMessage id="system.api.table.list.apiGroup" defaultMessage="$$$"/>} placeholder="请输入接口分组" required={false}/> - <ProFormText width="md" name="description" + <ProFormText width={proFormItemStyleProps.column2Width} name="description" label={<FormattedMessage id="system.api.table.list.description" defaultMessage="$$$"/>} placeholder="请输入接口描述" required={false}/> </ProForm.Group> diff --git a/src/pages/System/ApiList/components/UpdateForm.tsx b/src/pages/System/ApiList/components/UpdateForm.tsx index 312dea5..f14bfa5 100644 --- a/src/pages/System/ApiList/components/UpdateForm.tsx +++ b/src/pages/System/ApiList/components/UpdateForm.tsx @@ -5,6 +5,8 @@ import {FormattedMessage, useIntl} from '@umijs/max'; import React from 'react'; import {Form, message} from 'antd'; import {putApiUpdateApi} from "@/services/system/Api"; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type UpdateFormProps = { updateModalOpen: boolean; @@ -19,6 +21,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { return ( <ModalForm<API.Api> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.update.title', defaultMessage: '$$$', @@ -45,8 +48,8 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="id" label="id" disabled={true} initialValue={props.values.id}/> - <ProFormText width="md" name="path" + <ProFormText width={proFormItemStyleProps.column2Width} name="id" label="id" disabled={true} initialValue={props.values.id}/> + <ProFormText width={proFormItemStyleProps.column2Width} name="path" label={<FormattedMessage id="system.api.table.list.path" defaultMessage="$$$"/>} placeholder="请输入接口路径" required={true} initialValue={props.values.path} disabled={false} rules={[ @@ -61,7 +64,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormSelect width="md" name="method" + <ProFormSelect width={proFormItemStyleProps.column2Width} name="method" label={<FormattedMessage id="system.api.table.list.method" defaultMessage="$$$"/>} placeholder="请输入请求方式" required={false} initialValue={props.values.method} valueEnum={{ 'GET': intl.formatMessage({id: 'system.api.enum.GET', defaultMessage: '$$$',}), @@ -70,11 +73,11 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { 'PUT': intl.formatMessage({id: 'system.api.enum.PUT', defaultMessage: '$$$',}), 'PATCH': intl.formatMessage({id: 'system.api.enum.PATCH', defaultMessage: '$$$',}) }} disabled={false}/> - <ProFormText width="md" name="apiGroup" + <ProFormText width={proFormItemStyleProps.column2Width} name="apiGroup" label={<FormattedMessage id="system.api.table.list.apiGroup" defaultMessage="$$$"/>} placeholder="请输入接口分组" required={false} initialValue={props.values.apiGroup} disabled={false}/> - <ProFormText width="md" name="description" + <ProFormText width={proFormItemStyleProps.column2Width} name="description" label={<FormattedMessage id="system.api.table.list.description" defaultMessage="$$$"/>} placeholder="请输入接口描述" required={false} initialValue={props.values.description} disabled={false}/> diff --git a/src/pages/System/ApiList/index.tsx b/src/pages/System/ApiList/index.tsx index 1527e83..3ab22e7 100644 --- a/src/pages/System/ApiList/index.tsx +++ b/src/pages/System/ApiList/index.tsx @@ -6,7 +6,7 @@ import { ProTable, } from '@ant-design/pro-components'; import {FormattedMessage, useIntl, useAccess, Access, history} from '@umijs/max'; -import {Button, message} from 'antd'; +import {Button, Popconfirm, message} from 'antd'; import React, {useRef, useState} from 'react'; import UpdateForm from './components/UpdateForm'; import CreateForm from "./components/CreateForm"; @@ -152,7 +152,24 @@ const ApiList: React.FC = () => { > <FormattedMessage id="pages.searchTable.update" defaultMessage="Update"/> </a> - <a + <Popconfirm + placement="topLeft" + title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })} + description={intl.formatMessage({ + id: 'common.modal.table.delete.content', + defaultMessage: '$$$', + })} + okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} + cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} + onConfirm={() => { + handleDestroy(record).then(() => {}); + }} + > + <Button key="destroy" type="link" size="small" danger> + <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> + </Button> + </Popconfirm> + {/* <a key="destroy" onClick={() => { handleDestroy(record).then(() => { @@ -162,7 +179,7 @@ const ApiList: React.FC = () => { id="pages.searchTable.destroy" defaultMessage="Destroy" /> - </a> + </a> */} </Access> ], },]; @@ -176,8 +193,9 @@ const ApiList: React.FC = () => { options={{fullScreen: true, setting: true, density: true, reload: true}} actionRef={actionRef} rowKey="key" + // 查询区 search={{ - labelWidth: 120, + labelWidth: 'auto', }} pagination={{ showSizeChanger: true, diff --git a/src/pages/System/DepartmentList/components/CreateForm.tsx b/src/pages/System/DepartmentList/components/CreateForm.tsx index 52ef42e..fc7b57f 100644 --- a/src/pages/System/DepartmentList/components/CreateForm.tsx +++ b/src/pages/System/DepartmentList/components/CreateForm.tsx @@ -7,6 +7,8 @@ import {postDepartmentCreateDepartment} from "@/services/system/Department"; // import {systemDepartmentGetDepartmentPkIdSelectList} from "@/services/system/system"; import React, {useEffect, useState} from 'react'; import {App, Button, Form, Modal, message} from 'antd'; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type FormValueType = { target?: string; @@ -42,6 +44,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { return ( <ModalForm<API.Department> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -68,7 +71,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > <ProForm.Group> - <ProFormSelect width="md" name="parentId" + <ProFormSelect width={proFormItemStyleProps.column2Width} name="parentId" disabled={true} initialValue={parentId} options={parentSelectOptions} @@ -78,7 +81,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { /> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="name" + <ProFormText width={proFormItemStyleProps.column2Width} name="name" label={<FormattedMessage id="system.department.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.name', defaultMessage: '$$$'})}`} required={true} @@ -94,35 +97,35 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="code" + <ProFormText width={proFormItemStyleProps.column2Width} name="code" label={<FormattedMessage id="system.department.table.list.code" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.code', defaultMessage: '$$$'})}`} /> </ProForm.Group> <ProForm.Group> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" label={<FormattedMessage id="system.department.table.list.sort" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.sort', defaultMessage: '$$$'})}`} initialValue={1} /> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="phone" + <ProFormText width={proFormItemStyleProps.column2Width} name="phone" label={<FormattedMessage id="system.department.table.list.phone" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.phone', defaultMessage: '$$$'})}`} required={false}/> - <ProFormText width="md" name="email" + <ProFormText width={proFormItemStyleProps.column2Width} name="email" label={<FormattedMessage id="system.department.table.list.email" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.email', defaultMessage: '$$$'})}`} required={false}/> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" label={<FormattedMessage id="system.department.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> - <ProFormSwitch width="md" name="status" initialValue={true} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="status" initialValue={true} label={<FormattedMessage id="system.department.table.list.status" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/DepartmentList/components/UpdateForm.tsx b/src/pages/System/DepartmentList/components/UpdateForm.tsx index e0081d0..c8b7f81 100644 --- a/src/pages/System/DepartmentList/components/UpdateForm.tsx +++ b/src/pages/System/DepartmentList/components/UpdateForm.tsx @@ -6,6 +6,8 @@ import {FormattedMessage, useIntl} from '@umijs/max'; import React, {useEffect, useState} from 'react'; import {App, Button, Form, message, Modal} from 'antd'; import {putDepartmentUpdateDepartment} from "@/services/system/Department"; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type FormValueType = { target?: string; template?: string; @@ -30,6 +32,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { return ( <ModalForm<API.Department> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -56,8 +59,8 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="id" label="id" disabled={true} initialValue={props.values.id}/> - <ProFormSelect width="md" name="parentId" + <ProFormText width={proFormItemStyleProps.column2Width} name="id" label="id" disabled={true} initialValue={props.values.id}/> + <ProFormSelect width={proFormItemStyleProps.column2Width} name="parentId" disabled={true} initialValue={parentId} request={async () => parentSelectOptions} @@ -67,7 +70,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="name" + <ProFormText width={proFormItemStyleProps.column2Width} name="name" label={<FormattedMessage id="system.department.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.name', defaultMessage: '$$$'})}`} required={true} @@ -84,7 +87,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="code" + <ProFormText width={proFormItemStyleProps.column2Width} name="code" initialValue={props.values.code} label={<FormattedMessage id="system.department.table.list.code" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.code', defaultMessage: '$$$'})}`} @@ -92,31 +95,31 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { </ProForm.Group> <ProForm.Group> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" initialValue={props.values.sort} label={<FormattedMessage id="system.department.table.list.sort" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.sort', defaultMessage: '$$$'})}`} /> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="phone" + <ProFormText width={proFormItemStyleProps.column2Width} name="phone" initialValue={props.values.phone} label={<FormattedMessage id="system.department.table.list.phone" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.phone', defaultMessage: '$$$'})}`} required={false}/> - <ProFormText width="md" name="email" + <ProFormText width={proFormItemStyleProps.column2Width} name="email" initialValue={props.values.email} label={<FormattedMessage id="system.department.table.list.email" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.email', defaultMessage: '$$$'})}`} required={false}/> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" initialValue={props.values.remark} label={<FormattedMessage id="system.department.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.department.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> - <ProFormSwitch width="md" name="status" initialValue={props.values.status} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="status" initialValue={props.values.status} label={<FormattedMessage id="system.department.table.list.status" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/DepartmentList/index.tsx b/src/pages/System/DepartmentList/index.tsx index 3cce034..3fd5b24 100644 --- a/src/pages/System/DepartmentList/index.tsx +++ b/src/pages/System/DepartmentList/index.tsx @@ -7,7 +7,7 @@ import { ProTable, } from '@ant-design/pro-components'; import { FormattedMessage, useIntl, useAccess, Access, history } from '@umijs/max'; -import {Button, message} from 'antd'; +import {Button, Popconfirm, message} from 'antd'; import React, { useRef, useState } from 'react'; import UpdateForm from '@/pages/System/DepartmentList/components/UpdateForm' import CreateForm from '@/pages/System/DepartmentList/components/CreateForm' @@ -220,7 +220,24 @@ const DepartmentList: React.FC = () => { > <FormattedMessage id="pages.searchTable.update" defaultMessage="Update" /> </a> - <a + <Popconfirm + placement="topLeft" + title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })} + description={intl.formatMessage({ + id: 'common.modal.table.delete.content', + defaultMessage: '$$$', + })} + okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} + cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} + onConfirm={() => { + handleDestroy(record).then(() => {}); + }} + > + <Button key="destroy" type="link" size="small" danger> + <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> + </Button> + </Popconfirm> + {/* <a key="destroy" onClick={() => { handleDestroy(record).then(()=>{}) @@ -229,7 +246,7 @@ const DepartmentList: React.FC = () => { id="pages.searchTable.destroy" defaultMessage="Destroy" /> - </a> + </a> */} </Access> ], },]; @@ -244,7 +261,7 @@ const DepartmentList: React.FC = () => { actionRef={actionRef} rowKey="key" search={{ - labelWidth: 120, + labelWidth: 'auto', }} pagination={{ showSizeChanger: true, @@ -283,7 +300,7 @@ const DepartmentList: React.FC = () => { } let resp = await postDepartmentGetDepartmentList({...reqParams}) return { - data: resp.data?.list.map((v: API.Department)=>{ return {...v, key: v.id}}) || [], + data: resp.data?.list?.map((v: API.Department)=>{ return {...v, key: v.id}}) || [], success: resp.success, total: resp.data.total, current: resp.data.page, diff --git a/src/pages/System/MenuList/component/CreateForm.tsx b/src/pages/System/MenuList/component/CreateForm.tsx index 638aa6d..7ddec13 100644 --- a/src/pages/System/MenuList/component/CreateForm.tsx +++ b/src/pages/System/MenuList/component/CreateForm.tsx @@ -9,6 +9,8 @@ import React, {useEffect, useState} from 'react'; import {App, Button, Form, Modal, message} from 'antd'; import IconSelector from "@/components/IconSelector"; import {createIcon} from '@/utils/IconUtil'; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type FormValueType = { target?: string; @@ -45,6 +47,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { return ( <ModalForm<API.Menu> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -71,7 +74,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > <ProForm.Group> - <ProFormSelect width="md" name="parentId" + <ProFormSelect width={proFormItemStyleProps.column2Width} name="parentId" disabled={true} initialValue={parentId} request={async () => parentSelectOptions} @@ -80,7 +83,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { /> </ProForm.Group> <ProForm.Group> - <ProFormRadio.Group width="md" name="type" + <ProFormRadio.Group width={proFormItemStyleProps.column2Width} name="type" required={true} label={<FormattedMessage id="system.menu.table.list.type" defaultMessage="$$$"/>} initialValue={'M'} @@ -106,7 +109,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { </ProFormRadio.Group> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="title" + <ProFormText width={proFormItemStyleProps.column2Width} name="title" label={<FormattedMessage id="system.menu.table.list.title" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.title', defaultMessage: '$$$'})}`} required={true} @@ -122,7 +125,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" label={<FormattedMessage id="system.menu.table.list.sort" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.sort', defaultMessage: '$$$'})}`} initialValue={1} @@ -135,7 +138,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { if (isShow) { return ( <ProForm.Group> - <ProFormText width="md" name="name" + <ProFormText width={proFormItemStyleProps.column2Width} name="name" label={<FormattedMessage id="system.menu.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.name', defaultMessage: '$$$'})}`} required={true} @@ -151,7 +154,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="path" + <ProFormText width={proFormItemStyleProps.column2Width} name="path" label={<FormattedMessage id="system.menu.table.list.path" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.path', defaultMessage: '$$$'})}`} required={true} @@ -167,7 +170,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="component" + <ProFormText width={proFormItemStyleProps.column2Width} name="component" label={<FormattedMessage id="system.menu.table.list.component" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.component', defaultMessage: '$$$'})}`} required={true} @@ -176,6 +179,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { /> <ProFormSelect + width={proFormItemStyleProps.column2Width} name="icon" label={intl.formatMessage({ id: 'system.menu.table.list.icon', @@ -209,7 +213,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { { (record) => { return ( - <ProFormText width="md" name="permission" + <ProFormText width={proFormItemStyleProps.column2Width} name="permission" label={<FormattedMessage id="system.menu.table.list.permission" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.permission', defaultMessage: '$$$'})}`} disabled={record.type === 'M'} @@ -221,11 +225,11 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { </ProFormDependency> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" label={<FormattedMessage id="system.menu.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> - <ProFormSwitch width="md" name="hidden" initialValue={false} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="hidden" initialValue={false} label={<FormattedMessage id="system.menu.table.list.hidden" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/MenuList/component/UpdateForm.tsx b/src/pages/System/MenuList/component/UpdateForm.tsx index f191004..678d052 100644 --- a/src/pages/System/MenuList/component/UpdateForm.tsx +++ b/src/pages/System/MenuList/component/UpdateForm.tsx @@ -8,6 +8,8 @@ import {App, Button, Form, message, Modal} from 'antd'; import {putMenuUpdateMenu} from "@/services/system/Menu"; import {createIcon} from "@/utils/IconUtil"; import IconSelector from "@/components/IconSelector"; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type FormValueType = { target?: string; template?: string; @@ -37,6 +39,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { return ( <ModalForm<API.Menu> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -63,8 +66,8 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="id" label="id" disabled={true} initialValue={props.values.id}/> - <ProFormSelect width="md" name="parentId" + <ProFormText width={proFormItemStyleProps.column2Width} name="id" label="id" disabled={true} initialValue={props.values.id}/> + <ProFormSelect width={proFormItemStyleProps.column2Width} name="parentId" disabled={true} initialValue={parentId} request={async () => parentSelectOptions} @@ -73,7 +76,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { /> </ProForm.Group> <ProForm.Group> - <ProFormRadio.Group width="md" name="type" + <ProFormRadio.Group width={proFormItemStyleProps.column2Width} name="type" required={true} label={<FormattedMessage id="system.menu.table.list.type" defaultMessage="$$$"/>} initialValue={props.values.type} @@ -100,7 +103,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { </ProFormRadio.Group> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="title" + <ProFormText width={proFormItemStyleProps.column2Width} name="title" label={<FormattedMessage id="system.menu.table.list.title" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.title', defaultMessage: '$$$'})}`} required={true} @@ -117,7 +120,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" label={<FormattedMessage id="system.menu.table.list.sort" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.sort', defaultMessage: '$$$'})}`} initialValue={props.values.sort} @@ -130,7 +133,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { if (isShow) { return ( <ProForm.Group> - <ProFormText width="md" name="name" + <ProFormText width={proFormItemStyleProps.column2Width} name="name" label={<FormattedMessage id="system.menu.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.name', defaultMessage: '$$$'})}`} required={true} @@ -147,7 +150,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="path" + <ProFormText width={proFormItemStyleProps.column2Width} name="path" label={<FormattedMessage id="system.menu.table.list.path" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.path', defaultMessage: '$$$'})}`} required={true} @@ -164,7 +167,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="component" + <ProFormText width={proFormItemStyleProps.column2Width} name="component" label={<FormattedMessage id="system.menu.table.list.component" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.component', defaultMessage: '$$$'})}`} required={true} @@ -174,6 +177,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { /> <ProFormSelect + width={proFormItemStyleProps.column2Width} name="icon" label={intl.formatMessage({ id: 'system.menu.table.list.icon', @@ -208,7 +212,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { { (record) => { return ( - <ProFormText width="md" name="permission" + <ProFormText width={proFormItemStyleProps.column2Width} name="permission" initialValue={props.values.permission} label={<FormattedMessage id="system.menu.table.list.permission" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.permission', defaultMessage: '$$$'})}`} @@ -221,12 +225,12 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { </ProFormDependency> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" initialValue={props.values.remark} label={<FormattedMessage id="system.menu.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.menu.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> - <ProFormSwitch width="md" name="hidden" initialValue={props.values.hidden} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="hidden" initialValue={props.values.hidden} label={<FormattedMessage id="system.menu.table.list.hidden" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/MenuList/index.tsx b/src/pages/System/MenuList/index.tsx index 65f343f..d2da2ee 100644 --- a/src/pages/System/MenuList/index.tsx +++ b/src/pages/System/MenuList/index.tsx @@ -7,7 +7,7 @@ import { ProTable, } from '@ant-design/pro-components'; import { FormattedMessage, useIntl, useAccess, Access, history } from '@umijs/max'; -import {App, Button, message} from 'antd'; +import {App, Button, Popconfirm, message} from 'antd'; import React, { useRef, useState } from 'react'; import UpdateForm from './component/UpdateForm' import CreateForm from './component/CreateForm' @@ -212,7 +212,24 @@ const MenuList: React.FC = () => { > <FormattedMessage id="pages.searchTable.update" defaultMessage="Update" /> </a> - <a + <Popconfirm + placement="topLeft" + title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })} + description={intl.formatMessage({ + id: 'common.modal.table.delete.content', + defaultMessage: '$$$', + })} + okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} + cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} + onConfirm={() => { + handleDestroy(record).then(() => {}); + }} + > + <Button key="destroy" type="link" size="small" danger> + <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> + </Button> + </Popconfirm> + {/* <a key="destroy" onClick={() => { handleDestroy(record).then(()=>{}) @@ -221,7 +238,7 @@ const MenuList: React.FC = () => { id="pages.searchTable.destroy" defaultMessage="Destroy" /> - </a> + </a> */} </Access> ], },]; @@ -236,7 +253,7 @@ const MenuList: React.FC = () => { actionRef={actionRef} rowKey="key" search={{ - labelWidth: 120, + labelWidth: 'auto', }} pagination={{ showSizeChanger: true, diff --git a/src/pages/System/OperationRecordList/components/CreateForm.tsx b/src/pages/System/OperationRecordList/components/CreateForm.tsx index c6149ce..54222da 100644 --- a/src/pages/System/OperationRecordList/components/CreateForm.tsx +++ b/src/pages/System/OperationRecordList/components/CreateForm.tsx @@ -5,6 +5,8 @@ import {FormattedMessage, useIntl} from '@umijs/max'; import React from 'react'; import {postSysOperationRecordCreateOperationRecord} from "@/services/system/OperationRecord"; import {Form, message} from 'antd'; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type CreateFormProps = { createModalOpen: boolean; @@ -19,6 +21,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { return ( <ModalForm<API.OperationRecord> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -44,51 +47,51 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="name" - label={<FormattedMessage id="system.operation_record.table.list.name" defaultMessage="$$$"/>} - placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.operation_record.table.list.name', defaultMessage: '$$$'})}`} + <ProFormText width={proFormItemStyleProps.column2Width} name="ip" + label={<FormattedMessage id="system.operation.table.list.ip" defaultMessage="$$$"/>} + placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.operation.table.list.ip', defaultMessage: '$$$'})}`} required={true} rules={[ { required: true, message: ( <FormattedMessage - id="system.operation_record.table.rule.required.name" - defaultMessage="name is required" + id="system.operation.table.rule.list.ip" + defaultMessage="ip is required" /> ), }, ]} /> - <ProFormText width="md" name="code" - label={<FormattedMessage id="system.operation_record.table.list.code" defaultMessage="$$$"/>} - placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.operation_record.table.list.code', defaultMessage: '$$$'})}`} + <ProFormText width={proFormItemStyleProps.column2Width} name="path" + label={<FormattedMessage id="system.operation.table.list.path" defaultMessage="$$$"/>} + placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.operation.table.list.path', defaultMessage: '$$$'})}`} required={true} rules={[ { required: true, message: ( <FormattedMessage - id="system.operation_record.table.rule.required.code" - defaultMessage="code is required" + id="system.operation.table.rule.list.path" + defaultMessage="path is required" /> ), }, ]} /> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" - label={<FormattedMessage id="system.operation_record.table.list.sort" defaultMessage="$$$"/>} - placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.operation_record.table.list.sort', defaultMessage: '$$$'})}`} + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" + label={<FormattedMessage id="system.operation.table.list.sort" defaultMessage="$$$"/>} + placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.operation.table.list.sort', defaultMessage: '$$$'})}`} initialValue={1} /> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" - label={<FormattedMessage id="system.operation_record.table.list.remark" defaultMessage="$$$"/>} - placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.operation_record.table.list.remark', defaultMessage: '$$$'})}`} + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" + label={<FormattedMessage id="system.operation.table.list.remark" defaultMessage="$$$"/>} + placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.operation.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> - <ProFormSwitch width="md" name="status" initialValue={true} - label={<FormattedMessage id="system.operation_record.table.list.status" defaultMessage="$$$"/>} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="status" initialValue={true} + label={<FormattedMessage id="system.operation.table.list.status" defaultMessage="$$$"/>} required={false}> </ProFormSwitch> diff --git a/src/pages/System/OperationRecordList/index.tsx b/src/pages/System/OperationRecordList/index.tsx index a0efed4..d3640ba 100644 --- a/src/pages/System/OperationRecordList/index.tsx +++ b/src/pages/System/OperationRecordList/index.tsx @@ -6,11 +6,12 @@ import { ProTable, } from '@ant-design/pro-components'; import {FormattedMessage, useIntl, useAccess, Access, history} from '@umijs/max'; -import {Button, message} from 'antd'; +import {Button, Popconfirm, message} from 'antd'; import React, {useRef, useState} from 'react'; import CreateForm from "./components/CreateForm"; import {ColumnDrawer} from "./components/ColumnDrawer"; import {getSysOperationRecordGetOperationRecordList} from "@/services/system/OperationRecord"; +// import UpdateForm from './components/UpdateForm'; const OperationRecordList: React.FC = () => { /** @@ -71,11 +72,12 @@ const OperationRecordList: React.FC = () => { { title: (<FormattedMessage - id="system.operation_record.table.list.id" + id="system.operation.table.list.id" defaultMessage="id"/>), dataIndex: "id", sorter: true, valueType: "digit", + filters: true, onFilter: true, render: (dom, entity) => { return ( @@ -94,30 +96,38 @@ const OperationRecordList: React.FC = () => { { sorter: true, title: (<FormattedMessage - id="system.operation_record.table.list.name" + id="system.operation.table.list.ip" defaultMessage="$$$"/>), - dataIndex: "name", + dataIndex: "ip", hideInSearch: true, }, { title: (<FormattedMessage - id="system.operation_record.table.list.code" + id="system.operation.table.list.path" defaultMessage="$$$"/>), - dataIndex: "code", + dataIndex: "path", hideInSearch: true, }, { title: (<FormattedMessage - id="system.operation_record.table.list.sort" + id="system.operation.table.list.method" defaultMessage="$$$"/>), - dataIndex: "sort", - hideInSearch: true, + dataIndex: "method", + valueEnum: { + 'GET': intl.formatMessage({id: 'system.api.enum.GET', defaultMessage: '$$$',}), + 'POST': intl.formatMessage({id: 'system.api.enum.POST', defaultMessage: '$$$',}), + 'DELETE': intl.formatMessage({id: 'system.api.enum.DELETE', defaultMessage: '$$$',}), + 'PUT': intl.formatMessage({id: 'system.api.enum.PUT', defaultMessage: '$$$',}), + 'PATCH': intl.formatMessage({id: 'system.api.enum.PATCH', defaultMessage: '$$$',}) + }, + filters: true, onFilter: true, + // hideInSearch: true, }, { title: (<FormattedMessage - id="system.operation_record.table.list.status" + id="system.operation.table.list.status" defaultMessage="$$$"/>), dataIndex: "status", valueEnum: { @@ -135,6 +145,80 @@ const OperationRecordList: React.FC = () => { } }, filters: true, onFilter: true, + hideInSearch: true, + }, + + { + title: (<FormattedMessage + id="system.operation.table.list.latency" + defaultMessage="$$$"/>), + dataIndex: "latency", + valueType: 'time', + hideInSearch: true, + }, + + { + title: (<FormattedMessage + id="system.operation.table.list.agent" + defaultMessage="$$$"/>), + dataIndex: "agent", + tooltip: true, + ellipsis: true, + hideInSearch: true, + }, + + { + title: (<FormattedMessage + id="system.operation.table.list.error_message" + defaultMessage="$$$"/>), + dataIndex: "error_message", + hideInSearch: true, + }, + + { + title: (<FormattedMessage + id="system.operation.table.list.body" + defaultMessage="$$$"/>), + dataIndex: "body", + tooltip: true, + ellipsis: true, + hideInSearch: true, + }, + + { + title: (<FormattedMessage + id="system.operation.table.list.resp" + defaultMessage="$$$"/>), + dataIndex: "resp", + tooltip: true, + ellipsis: true, + hideInSearch: true, + }, + + { + title: (<FormattedMessage + id="system.operation.table.list.user_id" + defaultMessage="$$$"/>), + dataIndex: "user_id", + hideInSearch: true, + }, + + { + title: (<FormattedMessage + id="system.operation.table.list.createTime" + defaultMessage="$$$"/>), + dataIndex: "createTime", + valueType: 'dateTime', + hideInSearch: true, + }, + + { + title: (<FormattedMessage + id="system.operation.table.list.updateTime" + defaultMessage="$$$"/>), + dataIndex: "updateTime", + valueType: 'dateTime', + hideInSearch: true, }, { @@ -144,7 +228,7 @@ const OperationRecordList: React.FC = () => { fixed: 'right', render: (_, record) => [ <Access accessible={access.canUpdate(history.location.pathname)} key={`${history.location.pathname}-add`}> - <a + {/* <a key="update" onClick={() => { setUpdateModalOpen(true); @@ -152,8 +236,25 @@ const OperationRecordList: React.FC = () => { }} > <FormattedMessage id="pages.searchTable.update" defaultMessage="Update"/> - </a> - <a + </a> */} + <Popconfirm + placement="topLeft" + title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })} + description={intl.formatMessage({ + id: 'common.modal.table.delete.content', + defaultMessage: '$$$', + })} + okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} + cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} + onConfirm={() => { + handleDestroy(record).then(() => {}); + }} + > + <Button key="destroy" type="link" size="small" danger> + <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> + </Button> + </Popconfirm> + {/* <a key="destroy" onClick={() => { handleDestroy(record).then(() => { @@ -163,7 +264,7 @@ const OperationRecordList: React.FC = () => { id="pages.searchTable.destroy" defaultMessage="Destroy" /> - </a> + </a> */} </Access> ], },]; @@ -178,7 +279,7 @@ const OperationRecordList: React.FC = () => { actionRef={actionRef} rowKey="key" search={{ - labelWidth: 120, + labelWidth: 'auto', }} pagination={{ showSizeChanger: true, @@ -263,12 +364,12 @@ const OperationRecordList: React.FC = () => { handleModal={handleCreateModal} reload={actionRef.current?.reload} /> - {/*<UpdateForm*/} - {/* updateModalOpen={updateModalOpen}*/} - {/* values={currentRow || {}}*/} - {/* handleModal={handleUpdateModal}*/} - {/* reload={actionRef.current?.reload}*/} - {/*/>*/} + {/* <UpdateForm + updateModalOpen={updateModalOpen} + values={currentRow || {}} + handleModal={handleUpdateModal} + reload={actionRef.current?.reload} + /> */} <ColumnDrawer handleDrawer={handleColumnDrawer} diff --git a/src/pages/System/PostList/components/CreateForm.tsx b/src/pages/System/PostList/components/CreateForm.tsx index 062d702..a9d6117 100644 --- a/src/pages/System/PostList/components/CreateForm.tsx +++ b/src/pages/System/PostList/components/CreateForm.tsx @@ -5,6 +5,8 @@ import {FormattedMessage, useIntl} from '@umijs/max'; import React from 'react'; import {postPostCreatePost} from "@/services/system/Post"; import {Form, message} from 'antd'; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type CreateFormProps = { createModalOpen: boolean; @@ -19,6 +21,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { return ( <ModalForm<API.Post> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -44,7 +47,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="name" + <ProFormText width={proFormItemStyleProps.column2Width} name="name" label={<FormattedMessage id="system.post.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.post.table.list.name', defaultMessage: '$$$'})}`} required={true} @@ -60,7 +63,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="code" + <ProFormText width={proFormItemStyleProps.column2Width} name="code" label={<FormattedMessage id="system.post.table.list.code" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.post.table.list.code', defaultMessage: '$$$'})}`} required={true} @@ -76,18 +79,18 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" label={<FormattedMessage id="system.post.table.list.sort" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.post.table.list.sort', defaultMessage: '$$$'})}`} initialValue={1} /> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" label={<FormattedMessage id="system.post.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.post.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> - <ProFormSwitch width="md" name="status" initialValue={true} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="status" initialValue={true} label={<FormattedMessage id="system.post.table.list.status" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/PostList/components/UpdateForm.tsx b/src/pages/System/PostList/components/UpdateForm.tsx index c37847b..7074aac 100644 --- a/src/pages/System/PostList/components/UpdateForm.tsx +++ b/src/pages/System/PostList/components/UpdateForm.tsx @@ -5,6 +5,8 @@ import {FormattedMessage, useIntl} from '@umijs/max'; import React from 'react'; import {Form, message} from 'antd'; import {putPostUpdatePost} from "@/services/system/Post"; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type UpdateFormProps = { updateModalOpen: boolean; @@ -19,6 +21,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { return ( <ModalForm<API.Post> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.update.title', defaultMessage: '$$$', @@ -45,9 +48,9 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="id" label="id" disabled={true} initialValue={props.values.id}/> + <ProFormText width={proFormItemStyleProps.column2Width} name="id" label="id" disabled={true} initialValue={props.values.id}/> - <ProFormText width="md" name="name" + <ProFormText width={proFormItemStyleProps.column2Width} name="name" label={<FormattedMessage id="system.post.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.post.table.list.name', defaultMessage: '$$$'})}`} required={true} @@ -64,7 +67,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="code" + <ProFormText width={proFormItemStyleProps.column2Width} name="code" label={<FormattedMessage id="system.post.table.list.code" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.post.table.list.code', defaultMessage: '$$$'})}`} required={true} @@ -81,20 +84,20 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" label={<FormattedMessage id="system.post.table.list.sort" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.post.table.list.sort', defaultMessage: '$$$'})}`} initialValue={props.values.sort} /> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" label={<FormattedMessage id="system.post.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.post.table.list.remark', defaultMessage: '$$$'})}`} required={false} initialValue={props.values.remark} /> - <ProFormSwitch width="md" name="status" initialValue={props.values.status} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="status" initialValue={props.values.status} label={<FormattedMessage id="system.post.table.list.status" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/PostList/index.tsx b/src/pages/System/PostList/index.tsx index a84698f..a314d31 100644 --- a/src/pages/System/PostList/index.tsx +++ b/src/pages/System/PostList/index.tsx @@ -6,7 +6,7 @@ import { ProTable, } from '@ant-design/pro-components'; import {FormattedMessage, useIntl, useAccess, Access, history} from '@umijs/max'; -import {Button, message} from 'antd'; +import {Button, Popconfirm, message} from 'antd'; import React, {useRef, useState} from 'react'; import UpdateForm from './components/UpdateForm'; import CreateForm from "./components/CreateForm"; @@ -154,7 +154,24 @@ const PostList: React.FC = () => { > <FormattedMessage id="pages.searchTable.update" defaultMessage="Update"/> </a> - <a + <Popconfirm + placement="topLeft" + title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })} + description={intl.formatMessage({ + id: 'common.modal.table.delete.content', + defaultMessage: '$$$', + })} + okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} + cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} + onConfirm={() => { + handleDestroy(record).then(() => {}); + }} + > + <Button key="destroy" type="link" size="small" danger> + <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> + </Button> + </Popconfirm> + {/* <a key="destroy" onClick={() => { handleDestroy(record).then(() => { @@ -164,7 +181,7 @@ const PostList: React.FC = () => { id="pages.searchTable.destroy" defaultMessage="Destroy" /> - </a> + </a> */} </Access> ], },]; @@ -179,7 +196,7 @@ const PostList: React.FC = () => { actionRef={actionRef} rowKey="key" search={{ - labelWidth: 120, + labelWidth: 'auto', }} pagination={{ showSizeChanger: true, diff --git a/src/pages/System/RoleList/components/CreateForm.tsx b/src/pages/System/RoleList/components/CreateForm.tsx index 4c5f46e..cea4986 100644 --- a/src/pages/System/RoleList/components/CreateForm.tsx +++ b/src/pages/System/RoleList/components/CreateForm.tsx @@ -5,6 +5,8 @@ import {FormattedMessage, useIntl} from '@umijs/max'; import React from 'react'; import {postRoleCreateRole} from "@/services/system/Role"; import {Form, message} from 'antd'; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type CreateFormProps = { createModalOpen: boolean; @@ -19,6 +21,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { return ( <ModalForm<API.Role> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -44,7 +47,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="name" + <ProFormText width={proFormItemStyleProps.column2Width} name="name" label={<FormattedMessage id="system.role.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.role.table.list.name', defaultMessage: '$$$'})}`} required={true} @@ -60,7 +63,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="code" + <ProFormText width={proFormItemStyleProps.column2Width} name="code" label={<FormattedMessage id="system.role.table.list.code" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.role.table.list.code', defaultMessage: '$$$'})}`} required={true} @@ -76,18 +79,18 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" label={<FormattedMessage id="system.role.table.list.sort" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.role.table.list.sort', defaultMessage: '$$$'})}`} initialValue={1} /> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" label={<FormattedMessage id="system.role.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.role.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> - <ProFormSwitch width="md" name="status" initialValue={true} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="status" initialValue={true} label={<FormattedMessage id="system.role.table.list.status" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/RoleList/components/UpdateForm.tsx b/src/pages/System/RoleList/components/UpdateForm.tsx index ffa31f3..973c122 100644 --- a/src/pages/System/RoleList/components/UpdateForm.tsx +++ b/src/pages/System/RoleList/components/UpdateForm.tsx @@ -5,6 +5,8 @@ import {FormattedMessage, useIntl} from '@umijs/max'; import React from 'react'; import {Form, message} from 'antd'; import {putRoleUpdateRole} from "@/services/system/Role"; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type UpdateFormProps = { updateModalOpen: boolean; @@ -19,6 +21,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { return ( <ModalForm<API.Role> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.update.title', defaultMessage: '$$$', @@ -45,9 +48,9 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="id" label="id" disabled={true} initialValue={props.values.id}/> + <ProFormText width={proFormItemStyleProps.column2Width} name="id" label="id" disabled={true} initialValue={props.values.id}/> - <ProFormText width="md" name="name" + <ProFormText width={proFormItemStyleProps.column2Width} name="name" label={<FormattedMessage id="system.role.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.role.table.list.name', defaultMessage: '$$$'})}`} required={true} @@ -64,7 +67,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="code" + <ProFormText width={proFormItemStyleProps.column2Width} name="code" label={<FormattedMessage id="system.role.table.list.code" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.role.table.list.code', defaultMessage: '$$$'})}`} required={true} @@ -81,20 +84,20 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormDigit width="md" fieldProps={{precision: 0}} name="sort" + <ProFormDigit width={proFormItemStyleProps.column2Width} fieldProps={{precision: 0}} name="sort" label={<FormattedMessage id="system.role.table.list.sort" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.role.table.list.sort', defaultMessage: '$$$'})}`} initialValue={props.values.sort} /> </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" label={<FormattedMessage id="system.role.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'system.role.table.list.remark', defaultMessage: '$$$'})}`} required={false} initialValue={props.values.remark} /> - <ProFormSwitch width="md" name="status" initialValue={props.values.status} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="status" initialValue={props.values.status} label={<FormattedMessage id="system.role.table.list.status" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/RoleList/index.tsx b/src/pages/System/RoleList/index.tsx index eb42fa6..1ff1296 100644 --- a/src/pages/System/RoleList/index.tsx +++ b/src/pages/System/RoleList/index.tsx @@ -6,7 +6,7 @@ import { ProTable, } from '@ant-design/pro-components'; import {FormattedMessage, useIntl, useAccess, Access, history} from '@umijs/max'; -import {Button, message} from 'antd'; +import {Button, Popconfirm, message} from 'antd'; import React, {useRef, useState} from 'react'; import UpdateForm from './components/UpdateForm'; import CreateForm from "./components/CreateForm"; @@ -170,7 +170,24 @@ const RoleList: React.FC = () => { setCurrentRow(record) }} ><FormattedMessage id="system.role.table.action.set_permission" defaultMessage="$$$"></FormattedMessage></a> - <a + <Popconfirm + placement="topLeft" + title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })} + description={intl.formatMessage({ + id: 'common.modal.table.delete.content', + defaultMessage: '$$$', + })} + okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} + cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} + onConfirm={() => { + handleDestroy(record).then(() => {}); + }} + > + <Button key="destroy" type="link" size="small" danger> + <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> + </Button> + </Popconfirm> + {/* <a key="destroy" onClick={() => { handleDestroy(record).then(() => { @@ -180,7 +197,7 @@ const RoleList: React.FC = () => { id="pages.searchTable.destroy" defaultMessage="Destroy" /> - </a> + </a> */} </Access> ], },]; @@ -195,7 +212,7 @@ const RoleList: React.FC = () => { actionRef={actionRef} rowKey="key" search={{ - labelWidth: 120, + labelWidth: 'auto', }} pagination={{ showSizeChanger: true, diff --git a/src/pages/System/UserList/components/CreateForm.tsx b/src/pages/System/UserList/components/CreateForm.tsx index 363f7e2..83e0f95 100644 --- a/src/pages/System/UserList/components/CreateForm.tsx +++ b/src/pages/System/UserList/components/CreateForm.tsx @@ -17,6 +17,8 @@ import {Form, message} from 'antd'; import {beforeUploadImage, handleOneFile} from "@/utils/common"; // @ts-ignore import cookie from 'react-cookies'; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; export type CreateFormProps = { createModalOpen: boolean; @@ -31,6 +33,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { return ( <ModalForm<API.Register> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.create.title', defaultMessage: '$$$', @@ -68,7 +71,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="userName" + <ProFormText width={proFormItemStyleProps.column2Width} name="userName" label={<FormattedMessage id="system.user.table.list.userName" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_input', @@ -87,7 +90,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="nickName" + <ProFormText width={proFormItemStyleProps.column2Width} name="nickName" label={<FormattedMessage id="system.user.table.list.nickName" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_input', @@ -106,7 +109,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { }, ]} /> - <ProFormText.Password width="md" name="password" + <ProFormText.Password width={proFormItemStyleProps.column2Width} name="password" label={<FormattedMessage id="system.user.table.list.password" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_input', @@ -129,7 +132,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { { (record) => { return ( - <ProFormText.Password width="md" name="password_re" + <ProFormText.Password width={proFormItemStyleProps.column2Width} name="password_re" label={<FormattedMessage id="system.user.table.list.password_re" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ @@ -168,7 +171,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { </ProForm.Group> <ProForm.Group> - <ProFormSelect width="md" name="roleIds" showSearch + <ProFormSelect width={proFormItemStyleProps.column2Width} name="roleIds" showSearch fieldProps={{ mode: 'multiple', }} @@ -192,7 +195,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > </ProFormSelect> - <ProFormSelect width="md" name="postIds" showSearch + <ProFormSelect width={proFormItemStyleProps.column2Width} name="postIds" showSearch fieldProps={{ mode: 'multiple', }} @@ -216,7 +219,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { > </ProFormSelect> - <ProFormTreeSelect width="md" name="deptId" + <ProFormTreeSelect width={proFormItemStyleProps.column2Width} name="deptId" label={<FormattedMessage id="system.user.table.list.deptId" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_select', @@ -232,7 +235,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { </ProFormTreeSelect> </ProForm.Group> <ProForm.Group> - <ProFormUploadButton width="md" max={1} + <ProFormUploadButton width={proFormItemStyleProps.column2Width} max={1} action="/api/v1/file/uploadImage" name="avatarId" label={<FormattedMessage id="system.user.table.list.avatarId" defaultMessage="$$$"/>} @@ -245,14 +248,14 @@ const CreateForm: React.FC<CreateFormProps> = (props) => { </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" label={<FormattedMessage id="system.user.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_input', defaultMessage: '$$$' })}${intl.formatMessage({id: 'system.user.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> - <ProFormSwitch width="md" name="enable" initialValue={true} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="enable" initialValue={true} label={<FormattedMessage id="system.user.table.list.enable" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/UserList/components/UpdateForm.tsx b/src/pages/System/UserList/components/UpdateForm.tsx index 399b2a4..7b72ea7 100644 --- a/src/pages/System/UserList/components/UpdateForm.tsx +++ b/src/pages/System/UserList/components/UpdateForm.tsx @@ -18,6 +18,8 @@ import cookie from 'react-cookies'; import {postRoleGetRoleFkSelect} from "@/services/system/Role"; import {postPostGetPostFkSelect} from "@/services/system/Post"; import {postDepartmentGetDepartmentFkSelect} from "@/services/system/Department"; +// 表单宽度 804 两列 +import { proFormItemStyleProps, proFormModelWidth } from '../../../../../config/defaultForm'; @@ -34,6 +36,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { return ( <ModalForm<API.User> + width={proFormModelWidth} title={intl.formatMessage({ id: 'common.modal.table.update.title', defaultMessage: '$$$', @@ -82,8 +85,8 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { > <ProForm.Group> - <ProFormText width="md" name="id" label="id" disabled={true} initialValue={props.values.id}/> - <ProFormText width="md" name="userName" + <ProFormText width={proFormItemStyleProps.column2Width} name="id" label="id" disabled={true} initialValue={props.values.id}/> + <ProFormText width={proFormItemStyleProps.column2Width} name="userName" label={<FormattedMessage id="system.user.table.list.userName" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_input', @@ -103,7 +106,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { }, ]} /> - <ProFormText width="md" name="nickName" + <ProFormText width={proFormItemStyleProps.column2Width} name="nickName" label={<FormattedMessage id="system.user.table.list.nickName" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_input', @@ -127,7 +130,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { </ProForm.Group> <ProForm.Group> - <ProFormSelect width="md" name="roleIds" showSearch + <ProFormSelect width={proFormItemStyleProps.column2Width} name="roleIds" showSearch fieldProps={{ mode: 'multiple', }} @@ -152,7 +155,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { > </ProFormSelect> - <ProFormSelect width="md" name="postIds" showSearch + <ProFormSelect width={proFormItemStyleProps.column2Width} name="postIds" showSearch fieldProps={{ mode: 'multiple', }} @@ -177,7 +180,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { > </ProFormSelect> - <ProFormTreeSelect width="md" name="deptId" + <ProFormTreeSelect width={proFormItemStyleProps.column2Width} name="deptId" label={<FormattedMessage id="system.user.table.list.deptId" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_select', @@ -194,7 +197,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { </ProFormTreeSelect> </ProForm.Group> <ProForm.Group> - <ProFormUploadButton width="md" max={1} + <ProFormUploadButton width={proFormItemStyleProps.column2Width} max={1} action="/api/v1/file/uploadImage" name="avatarId" label={<FormattedMessage id="system.user.table.list.avatarId" defaultMessage="$$$"/>} @@ -208,7 +211,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { </ProForm.Group> <ProForm.Group> - <ProFormText width="md" name="remark" + <ProFormText width={proFormItemStyleProps.column2Width} name="remark" label={<FormattedMessage id="system.user.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({ id: 'common.please_input', @@ -216,7 +219,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => { })}${intl.formatMessage({id: 'system.user.table.list.remark', defaultMessage: '$$$'})}`} initialValue={props.values.remark} required={false}/> - <ProFormSwitch width="md" name="enable" initialValue={props.values.enable} + <ProFormSwitch width={proFormItemStyleProps.column2Width} name="enable" initialValue={props.values.enable} label={<FormattedMessage id="system.user.table.list.enable" defaultMessage="$$$"/>} required={false}> diff --git a/src/pages/System/UserList/index.tsx b/src/pages/System/UserList/index.tsx index 30f39af..9517135 100644 --- a/src/pages/System/UserList/index.tsx +++ b/src/pages/System/UserList/index.tsx @@ -7,7 +7,7 @@ import { ProCard, } from '@ant-design/pro-components'; import {FormattedMessage, useIntl, useAccess, Access, history} from '@umijs/max'; -import {Button, message} from 'antd'; +import {Button, Popconfirm, message} from 'antd'; import React, {useEffect, useRef, useState} from 'react'; import UpdateForm from './components/UpdateForm'; import CreateForm from "./components/CreateForm"; @@ -181,7 +181,24 @@ const UserList: React.FC = () => { > <FormattedMessage id="pages.searchTable.update" defaultMessage="Update"/> </a> - <a + <Popconfirm + placement="topLeft" + title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })} + description={intl.formatMessage({ + id: 'common.modal.table.delete.content', + defaultMessage: '$$$', + })} + okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} + cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} + onConfirm={() => { + handleDestroy(record).then(() => {}); + }} + > + <Button key="destroy" type="link" size="small" danger> + <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> + </Button> + </Popconfirm> + {/* <a key="destroy" onClick={() => { handleDestroy(record).then(() => { @@ -191,7 +208,7 @@ const UserList: React.FC = () => { id="pages.searchTable.destroy" defaultMessage="Destroy" /> - </a> + </a> */} </Access> ], },]; @@ -224,7 +241,7 @@ const UserList: React.FC = () => { actionRef={actionRef} rowKey="id" search={{ - labelWidth: 120, + labelWidth: 'auto', }} pagination={{ showSizeChanger: true,