Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
6356e843
提交
6356e843
authored
12月 16, 2023
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化:通知管理列表
上级
950ea64d
流水线
#7628
已通过 于阶段
in 1 分 9 秒
变更
5
流水线
1
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
278 行增加
和
0 行删除
+278
-0
resourceManageType.ts
src/api/interface/resourceManageType.ts
+26
-0
resourceManageAPI.ts
src/api/modules/resourceManageAPI.ts
+15
-0
index.tsx
...s/resourceManage/noticeManage/comp/addEditModal/index.tsx
+72
-0
index.tsx
src/pages/resourceManage/noticeManage/index.tsx
+153
-0
router.tsx
src/router/router.tsx
+12
-0
没有找到文件。
src/api/interface/resourceManageType.ts
浏览文件 @
6356e843
...
...
@@ -220,3 +220,29 @@ export type industryCaseUpdateCase = InterFunction<
>
;
// 删除业务案例
export
type
industryCaseDeleteDetails
=
InterFunction
<
{
id
:
number
},
NonNullable
<
unknown
>>
;
//后台——系统消息列表
export
type
selectAllSystemMessage
=
InterListFunction
<
{
id
?:
number
},
{
id
:
number
;
subject
:
string
;
content
:
string
;
createTime
:
string
;
read
:
boolean
;
}
>
;
// 后台发布消息——新增系统消息
export
type
insertSystemMessage
=
InterFunction
<
{
content
:
string
;
subject
:
string
;
},
NonNullable
<
unknown
>
>
;
// 后台——删除消息
export
type
removeMessage
=
InterFunction
<
{
id
:
number
;
},
NonNullable
<
unknown
>
>
;
src/api/modules/resourceManageAPI.ts
浏览文件 @
6356e843
...
...
@@ -19,6 +19,9 @@ import {
deleteIndustryNewsType
,
deleteRequirementsType
,
backDetailPublishType
,
selectAllSystemMessage
,
insertSystemMessage
,
removeMessage
,
}
from
'~/api/interface/resourceManageType'
;
import
axios
from
'../request'
;
...
...
@@ -94,4 +97,16 @@ export class ResourceManageAPI {
// 删除业务案例
static industryCaseDeleteDetails: industryCaseDeleteDetails = (params) =>
axios.get('/release/industry-case/deleteDetails', { params });
// 后台——系统消息列表
static selectAllSystemMessage: selectAllSystemMessage = (params) =>
axios.post('/userapp/message/selectAllSystemMessage', params);
// 后台发布消息——新增系统消息
static insertSystemMessage: insertSystemMessage = (params) =>
axios.post('/userapp/message/insertSystemMessage', params);
// 后台——删除消息
static removeMessage: removeMessage = (params) =>
axios.get('/userapp/message/removeMessage', { params });
}
src/pages/resourceManage/noticeManage/comp/addEditModal/index.tsx
0 → 100644
浏览文件 @
6356e843
import
React
from
'react'
;
import
{
Form
,
Input
,
message
,
Modal
,
ModalProps
}
from
'antd'
;
import
{
InterReqType
}
from
'~/api/interface'
;
import
{
insertSystemMessage
}
from
'~/api/interface/resourceManageType'
;
import
RichText
from
'~/components/richText'
;
import
{
ResourceManageAPI
}
from
'~/api'
;
// 请求的表单类型
type
ReqType
=
InterReqType
<
insertSystemMessage
>
;
const
AddEditModalView
:
React
.
FC
<
ModalProps
&
{
data
?:
any
;
onCancel
:
()
=>
void
}
>
=
(
props
)
=>
{
// 表单钩子
const
[
form
]
=
Form
.
useForm
<
ReqType
>
();
// 点击确认
const
handleOk
=
async
()
=>
{
form
.
validateFields
()
.
then
(
async
(
values
)
=>
{
// console.log('确认事件 --->', values);
await
handleSubmit
(
values
);
})
.
catch
((
err
)
=>
{
message
.
warning
({
content
:
err
.
errorFields
[
0
].
errors
[
0
],
})
.
then
();
});
};
// 提交数据
const
handleSubmit
=
async
(
values
:
ReqType
)
=>
{
const
res
=
await
ResourceManageAPI
.
insertSystemMessage
(
values
);
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
handleClose
();
}
};
// 关闭弹窗
const
handleClose
=
()
=>
{
form
.
resetFields
();
props
.
onCancel
?.();
};
return
(
<
Modal
{
...
props
}
width=
{
680
}
onOk=
{
handleOk
}
onCancel=
{
handleClose
}
>
<
Form
name=
'Form'
form=
{
form
}
labelAlign=
'right'
labelCol=
{
{
span
:
2
}
}
wrapperCol=
{
{
span
:
10
}
}
>
<
Form
.
Item
label=
'标题'
name=
'subject'
rules=
{
[{
required
:
true
,
message
:
'请输入标题'
}]
}
>
<
Input
placeholder=
{
'请输入标题'
}
maxLength=
{
20
}
allowClear
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'内容'
name=
'content'
rules=
{
[{
required
:
false
,
message
:
'请输入内容'
}]
}
wrapperCol=
{
{
span
:
22
}
}
>
<
RichText
richTextContent=
{
form
.
getFieldValue
(
'content'
)
||
''
}
onChange=
{
(
e
)
=>
form
.
setFieldValue
(
'content'
,
e
)
}
height=
{
250
}
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
};
export
default
AddEditModalView
;
src/pages/resourceManage/noticeManage/index.tsx
0 → 100644
浏览文件 @
6356e843
import
{
useEffect
,
useState
}
from
'react'
;
import
SearchBox
from
'~/components/search-box'
;
import
{
Button
,
message
,
Modal
,
Table
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
InterListType
,
PaginationProps
}
from
'~/api/interface'
;
import
{
selectAllSystemMessage
}
from
'~/api/interface/resourceManageType'
;
import
{
ResourceManageAPI
}
from
'~/api'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
AddEditModalView
from
'./comp/addEditModal'
;
// 列表类型
type
ListType
=
InterListType
<
selectAllSystemMessage
>
;
const
NoticeManageView
=
()
=>
{
// 新增弹窗是否开启
const
[
addEditModalVisible
,
setAddEditModalVisible
]
=
useState
(
false
);
// 表格数据
const
[
tableData
,
setTableData
]
=
useState
<
ListType
>
([]);
// 翻页数据
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
}
>
({
pageNo
:
1
,
pageSize
:
10
,
totalCount
:
0
,
});
// 加载列表
const
getTableList
=
async
(
value
=
{})
=>
{
// 只需要修改这个地方的接口即可
const
res
=
await
ResourceManageAPI
.
selectAllSystemMessage
({
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
...
value
,
});
if
(
res
&&
res
.
code
===
'200'
)
{
const
{
list
,
pageNo
,
totalCount
,
pageSize
}
=
res
.
result
;
// 解构
setPagination
({
totalCount
,
pageNo
,
pageSize
,
});
setTableData
(
list
);
}
};
// 翻页
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
getTableList
({
pageNo
,
pageSize
}).
then
();
};
// 删除事件
const
handleDelete
=
(
record
:
ListType
[
0
])
=>
{
Modal
.
confirm
({
title
:
'提示'
,
content
:
'确定删除该通知吗?'
,
onOk
:
async
()
=>
{
const
res
=
await
ResourceManageAPI
.
removeMessage
({
id
:
record
?.
id
,
});
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
paginationChange
(
pagination
.
pageNo
,
pagination
.
pageSize
);
}
},
});
};
// 组件挂载
useEffect
(()
=>
{
getTableList
().
then
();
},
[]);
// 表格列表
const
columns
:
ColumnsType
<
ListType
[
0
]
>
=
[
{
title
:
'序号'
,
dataIndex
:
'accountNo'
,
align
:
'center'
,
render
:
(
_text
,
_record
,
index
)
=>
(
pagination
.
pageNo
-
1
)
*
pagination
.
pageSize
+
index
+
1
,
},
{
title
:
'标题'
,
dataIndex
:
'subject'
,
align
:
'center'
,
},
{
title
:
'内容'
,
dataIndex
:
'content'
,
align
:
'center'
,
render
:
(
text
)
=>
text
?.
replace
(
/<
[^
>
]
*>/g
,
''
),
ellipsis
:
true
,
// render: (text) => <div dangerouslySetInnerHTML={{ __html: text }} />,
},
{
title
:
'发布时间'
,
dataIndex
:
'createTime'
,
align
:
'center'
,
width
:
'200px'
,
},
{
title
:
'操作'
,
dataIndex
:
'action'
,
align
:
'center'
,
width
:
'200px'
,
render
:
(
_text
,
record
)
=>
(
<>
<
Button
type=
{
'link'
}
disabled
>
编辑
</
Button
>
<
Button
type=
{
'link'
}
danger
onClick=
{
()
=>
handleDelete
(
record
)
}
>
删除
</
Button
>
</>
),
},
];
return
(
<>
<
SearchBox
preFixBtn=
{
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
{
'primary'
}
onClick=
{
()
=>
setAddEditModalVisible
(
true
)
}
>
新增通知
</
Button
>
}
/>
<
Table
size=
'small'
dataSource=
{
tableData
}
columns=
{
columns
}
rowKey=
'id'
// scroll={{ x: 1500 }}
bordered
pagination=
{
{
total
:
pagination
.
totalCount
,
pageSize
:
pagination
.
pageSize
,
current
:
pagination
.
pageNo
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
/>
<
AddEditModalView
title=
{
'新增通知'
}
open=
{
addEditModalVisible
}
onCancel=
{
()
=>
{
setAddEditModalVisible
(
false
);
paginationChange
(
pagination
.
pageNo
,
pagination
.
pageSize
);
}
}
/>
</>
);
};
export
default
NoticeManageView
;
src/router/router.tsx
浏览文件 @
6356e843
...
...
@@ -36,6 +36,7 @@ import {
WechatOutlined
,
UsergroupAddOutlined
,
ContactsOutlined
,
CommentOutlined
,
}
from
'@ant-design/icons'
;
import
{
Spin
}
from
'antd'
;
...
...
@@ -170,6 +171,7 @@ import ActivityListDetailView from '~/pages/activityManage/activityList/detail';
import
FlyerTeamView
from
'~/pages/flyerManage/flyerTeam'
;
import
CompanyMemberView
from
'~/pages/systemManage/companyManage/companyMember'
;
import
CourseCategoryView
from
'~/pages/pilotTraining/courseCategory'
;
import
NoticeManageView
from
'~/pages/resourceManage/noticeManage'
;
const
AddressManageView
=
React
.
lazy
(()
=>
import
(
'~/pages/systemManage/addressManage'
));
// const IndustryListView = React.lazy(() => import('~/pages/mallManage/industryManage/industryList')); //行业列表
...
...
@@ -971,6 +973,16 @@ export const routerList: Array<RouteObjectType> = [
icon
:
<
AliwangwangOutlined
/>,
},
},
{
path
:
'/resourceManage/noticeManage'
,
element
:
withLoadingComponent
(<
NoticeManageView
/>),
errorElement
:
<
ErrorPage
/>,
meta
:
{
id
:
870
,
title
:
'通知管理'
,
icon
:
<
CommentOutlined
/>,
},
},
],
},
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论