Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
admin-ci-test
Commits
db0faf09
提交
db0faf09
authored
6月 01, 2023
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:类型封装
上级
77ed35eb
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
101 行增加
和
17 行删除
+101
-17
interface.ts
src/api/interface.ts
+28
-12
index.scss
src/components/search-box/index.scss
+1
-1
index.tsx
src/pages/orderManage/productOrder/index.tsx
+70
-2
router.tsx
src/router/router.tsx
+2
-2
没有找到文件。
src/api/interface.ts
浏览文件 @
db0faf09
...
@@ -37,18 +37,6 @@ export interface ResponseType<D> {
...
@@ -37,18 +37,6 @@ export interface ResponseType<D> {
result
:
D
;
result
:
D
;
}
}
// 通用接口封装(分页) 不推荐
export
interface
InterListType
<
D
,
T
>
{
req
:
D
&
PaginationProps
;
res
:
Promise
<
ResponseListType
<
T
>>
;
}
// 通用接口封装(不分页) 不推荐
export
interface
InterType
<
D
,
T
>
{
req
:
D
;
res
:
Promise
<
ResponseType
<
T
>>
;
}
// 通用接口封装函数(分页) 建议用这个
// 通用接口封装函数(分页) 建议用这个
export
interface
InterListFunction
<
D
extends
object
,
T
>
{
export
interface
InterListFunction
<
D
extends
object
,
T
>
{
(
req
:
D
&
PaginationProps
):
Promise
<
ResponseListType
<
T
>>
;
(
req
:
D
&
PaginationProps
):
Promise
<
ResponseListType
<
T
>>
;
...
@@ -63,3 +51,31 @@ export interface InterFunction<D extends object, T> {
...
@@ -63,3 +51,31 @@ export interface InterFunction<D extends object, T> {
export
interface
InterItemFunction
<
D
extends
object
,
T
>
{
export
interface
InterItemFunction
<
D
extends
object
,
T
>
{
(
req
:
D
&
PaginationProps
):
Promise
<
ResponseItemType
<
T
>>
;
(
req
:
D
&
PaginationProps
):
Promise
<
ResponseItemType
<
T
>>
;
}
}
// 返回类型封装
// eslint-disable-next-line no-unused-vars
export
type
InterDataType
<
T
extends
(...
args
:
any
)
=>
any
>
=
(
ReturnType
<
T
>
extends
Promise
<
infer
U
>
?
U
:
never
)
extends
{
result
:
infer
V
}
?
V
:
never
;
// 返回列表类型封装
// eslint-disable-next-line no-unused-vars
export
type
InterListType
<
T
extends
(...
args
:
any
)
=>
any
>
=
(
ReturnType
<
T
>
extends
Promise
<
infer
U
>
?
U
:
never
)
extends
{
result
:
{
list
:
infer
V
}
}
?
V
:
never
;
// 返回类型封装(分页了,但又没有分页)
// eslint-disable-next-line no-unused-vars
export
type
InterItemType
<
T
extends
(...
args
:
any
)
=>
any
>
=
(
ReturnType
<
T
>
extends
Promise
<
infer
U
>
?
U
:
never
)
extends
{
result
:
infer
V
}
?
V
:
never
;
// 获取参数类型封装
// eslint-disable-next-line no-unused-vars
export
type
InterReqType
<
T
extends
(...
args
:
any
)
=>
any
>
=
Parameters
<
T
>
[
0
];
src/components/search-box/index.scss
浏览文件 @
db0faf09
.header
{
.header
{
padding
:
15px
20px
5px
2
0px
;
padding
:
5px
10px
5px
1
0px
;
background-color
:
#fff
;
background-color
:
#fff
;
margin
:
0
0
10px
0
;
margin
:
0
0
10px
0
;
border-radius
:
10px
;
border-radius
:
10px
;
...
...
src/pages/orderManage/productOrder/index.tsx
浏览文件 @
db0faf09
import
React
from
'react'
;
import
{
useState
}
from
'react'
;
import
SearchBox
from
'~/components/search-box'
;
import
{
Button
}
from
'antd'
;
// 订单状态搜索列表
const
statusCodeButtonList
=
[
{
value
:
-
1
,
label
:
'全部订单'
},
{
value
:
0
,
label
:
'沟通意向'
},
{
value
:
1
,
label
:
'签约付款'
},
{
value
:
2
,
label
:
'待发货'
},
{
value
:
3
,
label
:
'待收货'
},
{
value
:
4
,
label
:
'已完成'
},
{
value
:
5
,
label
:
'已关闭'
},
];
function
ProductOrderView
()
{
function
ProductOrderView
()
{
return
<
div
>
ProductOrderView
</
div
>;
// 当前选择的是第几个按钮
const
[
statusCodeButtonIndex
,
setStatusCodeButtonIndex
]
=
useState
<
number
>
(
0
);
// 订单状态筛选
const
statusChangeEvent
=
(
index
:
number
)
=>
{
setStatusCodeButtonIndex
(
index
);
};
return
(
<>
<
SearchBox
search=
{
[
{
label
:
'订单编号'
,
name
:
'keyword'
,
type
:
'input'
,
placeholder
:
'请输入订单编号'
,
},
{
label
:
'买家账号'
,
name
:
'keyword2'
,
type
:
'input'
,
placeholder
:
'请输入用户账号'
,
},
{
label
:
'相关销售'
,
name
:
'saleId'
,
type
:
'Select'
,
placeholder
:
'请选择相关销售'
,
options
:
[],
},
{
label
:
'时间'
,
name
:
'time'
,
type
:
'rangePicker'
,
placeholder
:
'请选择创建时间'
,
},
]
}
searchData=
{
(
e
:
any
)
=>
console
.
log
(
'提交数据 --->'
,
e
)
}
sufFixBtn=
{
<>
{
statusCodeButtonList
?.
map
((
i
,
j
)
=>
{
return
(
<
Button
key=
{
j
}
type=
{
j
===
statusCodeButtonIndex
?
'primary'
:
'default'
}
onClick=
{
()
=>
statusChangeEvent
(
j
)
}
style=
{
{
marginTop
:
'5px'
}
}
>
{
i
.
label
}
</
Button
>
);
})
}
</>
}
/>
</>
);
}
}
export
default
ProductOrderView
;
export
default
ProductOrderView
;
src/router/router.tsx
浏览文件 @
db0faf09
...
@@ -62,7 +62,7 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -62,7 +62,7 @@ export const routerList: Array<RouteObjectType> = [
element
:
withLoadingComponent
(<
ProductOrderView
/>),
element
:
withLoadingComponent
(<
ProductOrderView
/>),
meta
:
{
meta
:
{
id
:
10010
,
id
:
10010
,
title
:
'
销售
订单'
,
title
:
'
商城
订单'
,
icon
:
<
MacCommandOutlined
/>,
icon
:
<
MacCommandOutlined
/>,
},
},
},
},
...
@@ -71,7 +71,7 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -71,7 +71,7 @@ export const routerList: Array<RouteObjectType> = [
element
:
withLoadingComponent
(<
EquipmentOrderView
/>),
element
:
withLoadingComponent
(<
EquipmentOrderView
/>),
meta
:
{
meta
:
{
id
:
10020
,
id
:
10020
,
title
:
'
设备
订单'
,
title
:
'
租赁
订单'
,
icon
:
<
MacCommandOutlined
/>,
icon
:
<
MacCommandOutlined
/>,
},
},
},
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论