1.新增系统管理-文件中心”列表页面
2.菜单、角色的所属应用列表默认选中 3.修复“我的信息”提交出错时,失败和成功的消息同时弹出 4.修复“搜索管理-用户搜索”搜索框缺失“全文搜索”
This commit is contained in:
@@ -38,6 +38,15 @@
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/files',
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
path: '/files/files.html',
|
||||||
|
component: './files/File',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/search',
|
path: '/search',
|
||||||
routes: [
|
routes: [
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
@import (reference) '~antd/es/style/themes/index';
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
import { deleteFile, file } from '@/services/files/api';
|
||||||
|
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||||
|
import {
|
||||||
|
ProFormSelect,
|
||||||
|
PageContainer,
|
||||||
|
ProFormText,
|
||||||
|
ProTable,
|
||||||
|
QueryFilter,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { Typography, message, Popconfirm } from 'antd';
|
||||||
|
import React, { useRef, useState } from 'react';
|
||||||
|
|
||||||
|
const { Link } = Typography;
|
||||||
|
|
||||||
|
const handleDelete = async (file: FILES.File) => {
|
||||||
|
const hide = message.loading('正在删除');
|
||||||
|
try {
|
||||||
|
const result = await deleteFile(file.id);
|
||||||
|
hide();
|
||||||
|
if (result.resp_code === 0) {
|
||||||
|
message.success('删除File成功');
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
message.error(result.resp_msg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除File失败');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const TableList: React.FC = () => {
|
||||||
|
const actionRef = useRef<ActionType>();
|
||||||
|
const [params, setParams] = useState<Record<string, string | number>>({ tenantId: 'webApp' });
|
||||||
|
const columns: ProColumns<FILES.File>[] = [
|
||||||
|
{
|
||||||
|
dataIndex: 'index',
|
||||||
|
valueType: 'indexBorder',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '流媒体名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '文件大小(B)',
|
||||||
|
dataIndex: 'size',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '媒体类型',
|
||||||
|
dataIndex: 'contentType',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '文件系统',
|
||||||
|
dataIndex: 'grantType',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
valueType: 'dateTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '内容',
|
||||||
|
dataIndex: 'accountType',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
render: (_, entity) => <Popconfirm
|
||||||
|
title={`确认删除File?`}
|
||||||
|
onConfirm={async () => {
|
||||||
|
const success = await handleDelete(entity);
|
||||||
|
if (success) {
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Link>删除</Link>
|
||||||
|
</Popconfirm>,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContainer header={{ subTitle: '管理文件' }}>
|
||||||
|
<QueryFilter
|
||||||
|
defaultCollapsed
|
||||||
|
split
|
||||||
|
span={6}
|
||||||
|
className="query-filter"
|
||||||
|
initialValues={params}
|
||||||
|
onFinish={async (values) => setParams(values)}
|
||||||
|
onReset={() => setParams({})}
|
||||||
|
>
|
||||||
|
<ProFormText name="name" label="搜索" placeholder="输入关键字" />
|
||||||
|
</QueryFilter>
|
||||||
|
<ProTable<FILES.File>
|
||||||
|
rowKey="id"
|
||||||
|
headerTitle="文件管理"
|
||||||
|
request={file}
|
||||||
|
actionRef={actionRef}
|
||||||
|
columns={columns}
|
||||||
|
search={false}
|
||||||
|
params={params}
|
||||||
|
pagination={{
|
||||||
|
showSizeChanger: true,
|
||||||
|
showQuickJumper: true,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</PageContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TableList;
|
||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const TableList: React.FC = () => {
|
const TableList: React.FC = () => {
|
||||||
const [params, setParams] = useState<Record<string, string | number>>({});
|
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||||
|
|
||||||
const columns: ProColumns<SYSTEM.User>[] = [
|
const columns: ProColumns<SYSTEM.User>[] = [
|
||||||
{
|
{
|
||||||
@@ -55,16 +55,32 @@ const TableList: React.FC = () => {
|
|||||||
defaultCollapsed
|
defaultCollapsed
|
||||||
split
|
split
|
||||||
className="query-filter"
|
className="query-filter"
|
||||||
onFinish={async (values) => setParams(values)}
|
initialValues={{searchKey:"none"}}
|
||||||
|
// onFinish={async (values) => setParams(values)}
|
||||||
|
onFinish={async (values) => {
|
||||||
|
let queryStr = '';
|
||||||
|
const { searchKey, searchValue } = values;
|
||||||
|
if (searchKey && searchValue) {
|
||||||
|
if (searchKey === 'none') {
|
||||||
|
queryStr = searchValue;
|
||||||
|
} else {
|
||||||
|
queryStr = `${searchKey}:${searchValue}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setParams({ ...params, queryStr });
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<ProFormSelect
|
<ProFormSelect
|
||||||
name="searchKey"
|
name="searchKey"
|
||||||
label="搜索"
|
label="搜索"
|
||||||
valueEnum={{
|
valueEnum={{
|
||||||
user_id: 'ID',
|
none: '全文搜索',
|
||||||
|
id: 'ID',
|
||||||
username: '账号',
|
username: '账号',
|
||||||
nick_name: '用户名',
|
nickname: '用户名',
|
||||||
mobile: '手机号',
|
mobile: '手机号',
|
||||||
|
sex: '性别',
|
||||||
|
type: '用户类别',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ProFormText name="searchValue" />
|
<ProFormText name="searchValue" />
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { app, deleteApp } from '@/services/system/api';
|
import { app, deleteApp } from '@/services/system/api';
|
||||||
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||||
import { PageContainer, ProFormText, ProTable, QueryFilter } from '@ant-design/pro-components';
|
import { PageContainer, ProFormText, ProTable, QueryFilter } from '@ant-design/pro-components';
|
||||||
import { Typography, message, Popconfirm } from 'antd';
|
import { Typography, message, Popconfirm, Button } from 'antd';
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
|
|
||||||
const { Link } = Typography;
|
const { Link } = Typography;
|
||||||
@@ -127,6 +128,18 @@ const TableList: React.FC = () => {
|
|||||||
showSizeChanger: true,
|
showSizeChanger: true,
|
||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
}}
|
}}
|
||||||
|
toolBarRender={() => [
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
handleModalVisible(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<PlusOutlined /> 添加
|
||||||
|
</Button>
|
||||||
|
</>,
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const handleDelete = async (sysUser: SYSTEM.Menu) => {
|
|||||||
};
|
};
|
||||||
const Generator: React.FC = () => {
|
const Generator: React.FC = () => {
|
||||||
|
|
||||||
const [params, setParams] = useState<Record<string, string | number>>({});
|
const [params, setParams] = useState<Record<string, string | number>>({ tenantId: 'webApp' });
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
|
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
|
||||||
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
||||||
@@ -198,6 +198,7 @@ const Generator: React.FC = () => {
|
|||||||
defaultCollapsed
|
defaultCollapsed
|
||||||
split
|
split
|
||||||
span={6}
|
span={6}
|
||||||
|
initialValues={params}
|
||||||
className="query-filter"
|
className="query-filter"
|
||||||
onFinish={async (values) => query(values)}
|
onFinish={async (values) => query(values)}
|
||||||
// onReset={() => setParams({})}
|
// onReset={() => setParams({})}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ const handleDelete = async (data: SYSTEM.Role) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const TableList: React.FC = () => {
|
const TableList: React.FC = () => {
|
||||||
const [params, setParams] = useState<Record<string, string | number>>({});
|
const [params, setParams] = useState<Record<string, string | number>>({tenantId: 'webApp'});
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
|
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
|
||||||
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
||||||
@@ -157,8 +157,10 @@ const TableList: React.FC = () => {
|
|||||||
defaultCollapsed
|
defaultCollapsed
|
||||||
split
|
split
|
||||||
span={6}
|
span={6}
|
||||||
|
initialValues={params}
|
||||||
className="query-filter"
|
className="query-filter"
|
||||||
onFinish={async (values) => setParams(values)}
|
onFinish={async (values) => setParams(values)}
|
||||||
|
onReset={async() => setParams({tenantId: 'webApp'})}
|
||||||
>
|
>
|
||||||
<ProFormSelect
|
<ProFormSelect
|
||||||
name="tenantId"
|
name="tenantId"
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ const TableList: React.FC = () => {
|
|||||||
className="query-filter"
|
className="query-filter"
|
||||||
initialValues={params}
|
initialValues={params}
|
||||||
onFinish={async (values) => setParams(values)}
|
onFinish={async (values) => setParams(values)}
|
||||||
// onReset={() => setParams({})}
|
onReset={async() => setParams({tenantId: "webApp"})}
|
||||||
>
|
>
|
||||||
<ProFormSelect
|
<ProFormSelect
|
||||||
name="tenantId"
|
name="tenantId"
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const AvatarUpload = ({ avatar, setImage }: { avatar: string, setImage: (headImg
|
|||||||
showUploadList={false}
|
showUploadList={false}
|
||||||
beforeUpload={async (file) => {
|
beforeUpload={async (file) => {
|
||||||
const result = await handleImport(file);
|
const result = await handleImport(file);
|
||||||
if(result && result.url) {
|
if (result && result.url) {
|
||||||
setImage(result.url);
|
setImage(result.url);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -75,13 +75,14 @@ const UserInfo: React.FC = () => {
|
|||||||
const formRef = useRef<ProFormInstance<SYSTEM.User>>();
|
const formRef = useRef<ProFormInstance<SYSTEM.User>>();
|
||||||
const { initialState } = useModel('@@initialState');
|
const { initialState } = useModel('@@initialState');
|
||||||
const { currentUser } = initialState ?? {};
|
const { currentUser } = initialState ?? {};
|
||||||
const [user, setUser] = useState<SYSTEM.User>({...currentUser});
|
const [user, setUser] = useState<SYSTEM.User>({ ...currentUser });
|
||||||
const setImage = (headImgUrl: string) => {
|
const setImage = (headImgUrl: string) => {
|
||||||
setUser({...user, headImgUrl});
|
setUser({ ...user, headImgUrl });
|
||||||
}
|
}
|
||||||
if (!initialState || !currentUser) {
|
if (!initialState || !currentUser) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// debugger
|
||||||
formRef.current?.setFieldsValue(user);
|
formRef.current?.setFieldsValue(user);
|
||||||
return (
|
return (
|
||||||
<PageContainer header={{ subTitle: '更新个人信息' }}>
|
<PageContainer header={{ subTitle: '更新个人信息' }}>
|
||||||
@@ -90,10 +91,12 @@ const UserInfo: React.FC = () => {
|
|||||||
<ProForm<SYSTEM.User>
|
<ProForm<SYSTEM.User>
|
||||||
formRef={formRef}
|
formRef={formRef}
|
||||||
//layout="horizontal"
|
//layout="horizontal"
|
||||||
|
initialValues={user}
|
||||||
onFinish={async (values) => {
|
onFinish={async (values) => {
|
||||||
const saveUser = { ...user, ...values };
|
const saveUser = { ...user, ...values };
|
||||||
await handleEdit(saveUser);
|
await handleEdit(saveUser);
|
||||||
message.success('修改个人信息成功');
|
setUser({ ...user });
|
||||||
|
|
||||||
}}
|
}}
|
||||||
// labelCol={{ span: 8 }}
|
// labelCol={{ span: 8 }}
|
||||||
// wrapperCol={{ span: 16 }}
|
// wrapperCol={{ span: 16 }}
|
||||||
@@ -141,7 +144,7 @@ const UserInfo: React.FC = () => {
|
|||||||
</ProForm>
|
</ProForm>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.right}>
|
<div className={styles.right}>
|
||||||
{user.headImgUrl && <AvatarUpload avatar={user.headImgUrl} setImage={setImage}/>}
|
{user.headImgUrl && <AvatarUpload avatar={user.headImgUrl} setImage={setImage} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// @ts-ignore
|
||||||
|
/* eslint-disable */
|
||||||
|
import { request } from 'umi';
|
||||||
|
|
||||||
|
export async function file(params?: { [key: string]: string | number }) {
|
||||||
|
const { current, pageSize, ...rest } = params ?? {};
|
||||||
|
const result = await request<SYSTEM.Page<FILES.File>>('/api-file/files', {
|
||||||
|
method: 'GET',
|
||||||
|
params: { page: current, limit: pageSize, ...rest },
|
||||||
|
});
|
||||||
|
return { data: result.data, total: result.count };
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteFile(id: string) {
|
||||||
|
const url = `/api-file/files/${id}`;
|
||||||
|
const result = await request<API.Result<void>>(url, {
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// @ts-ignore
|
||||||
|
/* eslint-disable */
|
||||||
|
// API 更新时间:
|
||||||
|
// API 唯一标识:
|
||||||
|
import * as api from './api';
|
||||||
|
export default {
|
||||||
|
api,
|
||||||
|
};
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// @ts-ignore
|
||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
declare namespace FILES {
|
||||||
|
|
||||||
|
type File = {
|
||||||
|
id: string;
|
||||||
|
name?: string;
|
||||||
|
isImg: boolean;
|
||||||
|
url?: string;
|
||||||
|
contentType?: string;
|
||||||
|
size?: number;
|
||||||
|
path?: string;
|
||||||
|
source?: string;
|
||||||
|
createTime?: string;
|
||||||
|
tenantId?: string;
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -90,7 +90,7 @@ declare namespace SYSTEM {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type FileInfo = {
|
type FileInfo = {
|
||||||
id: number;
|
id: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
isImg: boolean;
|
isImg: boolean;
|
||||||
url?: string;
|
url?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user