Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
23f61049
提交
23f61049
authored
6月 08, 2023
作者:
翁进城
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
分类管理开发
上级
185fd540
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
508 行增加
和
216 行删除
+508
-216
categoryManage.ts
src/api/interface/categoryManage.ts
+14
-9
categoryManage.ts
src/api/modules/categoryManage.ts
+22
-12
request.ts
src/api/request.ts
+3
-3
index.tsx
...categoryManage/category/components/EditableCell/index.tsx
+0
-0
index.scss
...ategoryManage/category/components/addCgyDailog/index.scss
+0
-0
index.tsx
...categoryManage/category/components/addCgyDailog/index.tsx
+4
-4
index.tsx
...oryManage/category/components/addOrEditDec copy/index.tsx
+1
-1
index.tsx
...egoryManage/category/components/deleteCgyDailog/index.tsx
+1
-1
index.scss
src/pages/categoryManage/category/detail/index.scss
+0
-0
index.tsx
src/pages/categoryManage/category/detail/index.tsx
+22
-17
index.scss
src/pages/categoryManage/category/index.scss
+0
-0
index.tsx
src/pages/categoryManage/category/index.tsx
+0
-0
index.tsx
src/pages/categoryManage/components/addOrEditDec/index.tsx
+0
-146
index.tsx
...yManage/directoryManage/components/addOrEditDec/index.tsx
+149
-0
index.tsx
src/pages/categoryManage/directoryManage/index.tsx
+227
-0
router.tsx
src/router/router.tsx
+65
-23
没有找到文件。
src/api/interface/categoryManage.ts
浏览文件 @
23f61049
...
@@ -9,20 +9,25 @@ export interface GoodsInfo {
...
@@ -9,20 +9,25 @@ export interface GoodsInfo {
// 分类列表
// 分类列表
export
interface
categoryEntity
{
export
interface
categoryEntity
{
goodsMasterType
:
string
;
id
:
number
;
directoryId
:
number
;
classifyName
:
string
;
pid
:
number
;
description
?:
any
;
icon
:
string
;
icon
:
string
;
remark
:
string
;
remark
?:
any
;
desc
:
string
;
type
:
number
;
createTime
:
string
;
createTime
:
string
;
goodsMasterTypeId
:
number
|
string
;
children
:
any
[];
goodsSlaveTypeDTO
:
Partial
<
categoryEntity
>
[];
pid
:
number
|
string
;
isADD
?:
boolean
;
isADD
?:
boolean
;
level
?:
number
;
}
}
// 分类目录
// 分类目录
export
interface
categoryDec
{
export
interface
categoryDec
{
defaultType
:
number
;
"id"
:
number
,
id
:
number
;
"directoryName"
:
string
,
sortName
:
string
;
"pid"
:
null
,
"type"
:
number
,
directoryType
:
string
}
}
src/api/modules/categoryManage.ts
浏览文件 @
23f61049
...
@@ -4,28 +4,38 @@ import { PaginationEntity } from '~/common/interface/PaginationEntity';
...
@@ -4,28 +4,38 @@ import { PaginationEntity } from '~/common/interface/PaginationEntity';
export
class
CategoryManageAPI
{
export
class
CategoryManageAPI
{
// 分类管理
// 分类管理
// 分类目录
// 分类目录
static
directoryList
=
()
=>
{
static
directoryList
=
(
params
)
=>
{
return
axios
.
get
(
'uavgoods/directory/directoryList'
);
return
axios
.
get
(
"pms/classify/directoryList"
,
{
params
});
};
};
//目录列表不含分页
static
getDirectoryList
=
(
params
)
=>
{
return
axios
.
get
(
"pms/classify/getDirectoryList"
,
{
params
});
};
// 新增或编辑目录
// 新增或编辑目录
static
addOrEditDirectory
=
(
data
:
{
id
?:
number
;
directoryName
:
string
}[])
=>
{
static
addOrEditDirectory
=
(
data
:
{
id
?:
number
;
directoryName
:
string
,
type
:
number
,
relevance
:
number
}[])
=>
{
return
axios
.
post
(
'
uavgoods/director
y/addOrEditDirectory'
,
data
);
return
axios
.
post
(
'
/pms/classif
y/addOrEditDirectory'
,
data
);
};
};
// 删除目录
// 删除目录
static
removeDirectory
=
(
id
:
number
)
=>
{
static
removeDirectory
=
(
id
:
number
)
=>
{
return
axios
.
get
(
'
uavgoods/director
y/removeDirectory'
,
{
params
:
{
id
}
});
return
axios
.
get
(
'
/pms/classif
y/removeDirectory'
,
{
params
:
{
id
}
});
};
};
// 分类新增
// 分类新增
static
addClassification
=
(
data
:
object
):
any
=>
{
static
addClassification
=
(
data
:
object
):
any
=>
{
return
axios
.
post
(
'
uavgoods/mgoods
/addClassification'
,
data
);
return
axios
.
post
(
'
/pms/classify
/addClassification'
,
data
);
};
};
// 分类列表
// 分类列表
static
get
ListGoodsTypeList
=
(
type
:
number
):
any
=>
{
static
get
ClassificationList
=
(
data
:
object
):
any
=>
{
return
axios
.
get
(
`uavgoods/mgoods/getGoodsTypeInfoList/
${
type
}
`
);
return
axios
.
post
(
`/pms/classify/getClassificationList`
,
data
);
};
};
// PC端-根据分类信息新增自定义规格-下拉选项 (只查产品类型)
// PC端-根据分类信息新增自定义规格-下拉选项 (只查产品类型)
...
@@ -40,7 +50,7 @@ export class CategoryManageAPI {
...
@@ -40,7 +50,7 @@ export class CategoryManageAPI {
// 分类修改
// 分类修改
static
updateClassification
=
(
data
:
object
):
any
=>
{
static
updateClassification
=
(
data
:
object
):
any
=>
{
return
axios
.
post
(
'
uavgoods/mgoods
/updateClassification'
,
data
);
return
axios
.
post
(
'
/pms/classify
/updateClassification'
,
data
);
};
};
// 删除分类
// 删除分类
...
@@ -65,14 +75,14 @@ export class CategoryManageAPI {
...
@@ -65,14 +75,14 @@ export class CategoryManageAPI {
// 分类上下移动
// 分类上下移动
static
exchangeSortType
=
(
params
:
object
):
any
=>
{
static
exchangeSortType
=
(
params
:
object
):
any
=>
{
return
axios
.
get
(
'
uavgoods/mgoods
/exchangeSortType'
,
{
params
});
return
axios
.
get
(
'
/pms/classify
/exchangeSortType'
,
{
params
});
};
};
// 分类详情
// 分类详情
static
getGoodsTypeDetail
=
(
static
getGoodsTypeDetail
=
(
obj
:
{
id
:
number
}
&
Pick
<
PaginationEntity
,
'pageNo'
|
'pageSize'
>
,
obj
:
{
id
:
number
},
)
=>
{
)
=>
{
return
axios
.
get
(
'
uavgoods/mgoods/getGoodsTypeDetail
'
,
{
params
:
obj
});
return
axios
.
get
(
'
/pms/classify/getClassifyDetails
'
,
{
params
:
obj
});
};
};
// 分类详情-安全编码开发修改
// 分类详情-安全编码开发修改
...
...
src/api/request.ts
浏览文件 @
23f61049
...
@@ -4,9 +4,9 @@ import Cookies from 'js-cookie';
...
@@ -4,9 +4,9 @@ import Cookies from 'js-cookie';
import
{
Base64
}
from
'js-base64'
;
import
{
Base64
}
from
'js-base64'
;
const
{
VITE_REQUEST_BASE_URL
}
=
import
.
meta
.
env
;
const
{
VITE_REQUEST_BASE_URL
}
=
import
.
meta
.
env
;
export
const
uploadImgURL
=
`
${
VITE_REQUEST_BASE_URL
}
ossservlet/upload/imgOs
s`
;
export
const
uploadImgURL
=
`
${
VITE_REQUEST_BASE_URL
}
/pms/upload/imgOsse
s`
;
export
const
uploadVideoURL
=
`
${
VITE_REQUEST_BASE_URL
}
ossservlet/upload/videoOss`
;
export
const
uploadVideoURL
=
`
${
VITE_REQUEST_BASE_URL
}
/
ossservlet/upload/videoOss`
;
export
const
uploadFileURL
=
`
${
VITE_REQUEST_BASE_URL
}
ossservlet/upload/oss`
;
export
const
uploadFileURL
=
`
${
VITE_REQUEST_BASE_URL
}
/
ossservlet/upload/oss`
;
const
service
=
axios
.
create
({
const
service
=
axios
.
create
({
baseURL
:
VITE_REQUEST_BASE_URL
,
baseURL
:
VITE_REQUEST_BASE_URL
,
timeout
:
6000
,
timeout
:
6000
,
...
...
src/pages/categoryManage/components/EditableCell/index.tsx
→
src/pages/categoryManage/c
ategory/c
omponents/EditableCell/index.tsx
浏览文件 @
23f61049
File moved
src/pages/categoryManage/components/addCgyDailog/index.scss
→
src/pages/categoryManage/c
ategory/c
omponents/addCgyDailog/index.scss
浏览文件 @
23f61049
File moved
src/pages/categoryManage/components/addCgyDailog/index.tsx
→
src/pages/categoryManage/c
ategory/c
omponents/addCgyDailog/index.tsx
浏览文件 @
23f61049
...
@@ -62,9 +62,9 @@ function Index(props: any) {
...
@@ -62,9 +62,9 @@ function Index(props: any) {
setFileList
([]);
setFileList
([]);
form
.
setFieldsValue
({
icon
:
''
});
form
.
setFieldsValue
({
icon
:
''
});
}
else
if
(
val
.
file
.
status
===
'done'
)
{
}
else
if
(
val
.
file
.
status
===
'done'
)
{
setImageUrl
(
val
.
file
.
response
.
result
[
0
]
);
setImageUrl
(
val
.
file
.
response
.
result
?.
filePath
);
setFileList
(
val
.
fileList
);
setFileList
(
val
.
fileList
);
form
.
setFieldsValue
({
icon
:
val
.
file
.
response
.
result
[
0
]
});
form
.
setFieldsValue
({
icon
:
val
.
file
.
response
.
result
?.
filePath
});
}
else
{
}
else
{
setFileList
(
val
.
fileList
);
setFileList
(
val
.
fileList
);
}
}
...
@@ -85,7 +85,7 @@ function Index(props: any) {
...
@@ -85,7 +85,7 @@ function Index(props: any) {
return
(
return
(
<
Modal
<
Modal
title=
{
props
.
title
}
title=
{
props
.
title
}
visible
=
{
props
.
isVisable
}
open
=
{
props
.
isVisable
}
onOk=
{
()
=>
props
.
handleOk
()
}
onOk=
{
()
=>
props
.
handleOk
()
}
onCancel=
{
()
=>
props
.
handleCancel
()
}
onCancel=
{
()
=>
props
.
handleCancel
()
}
>
>
...
@@ -101,7 +101,7 @@ function Index(props: any) {
...
@@ -101,7 +101,7 @@ function Index(props: any) {
>
>
<
Form
.
Item
<
Form
.
Item
label=
'分类名称'
label=
'分类名称'
name=
'
group
Name'
name=
'
classify
Name'
rules=
{
[{
required
:
true
,
message
:
'请输入分类名称'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入分类名称'
}]
}
>
>
<
Input
placeholder=
'请输入分类名称'
maxLength=
{
15
}
allowClear
/>
<
Input
placeholder=
'请输入分类名称'
maxLength=
{
15
}
allowClear
/>
...
...
src/pages/categoryManage/components/addOrEditDec copy/index.tsx
→
src/pages/categoryManage/c
ategory/c
omponents/addOrEditDec copy/index.tsx
浏览文件 @
23f61049
...
@@ -106,7 +106,7 @@ const AddOrEditDec: React.FC<PropsType & selfPropsType> = ({
...
@@ -106,7 +106,7 @@ const AddOrEditDec: React.FC<PropsType & selfPropsType> = ({
return
(
return
(
<
Modal
<
Modal
title=
'目录管理'
title=
'目录管理'
visible
=
{
isModalVisible
}
open
=
{
isModalVisible
}
onOk=
{
directorySureEvent
}
onOk=
{
directorySureEvent
}
onCancel=
{
directoryCancel
}
onCancel=
{
directoryCancel
}
>
>
...
...
src/pages/categoryManage/components/deleteCgyDailog/index.tsx
→
src/pages/categoryManage/c
ategory/c
omponents/deleteCgyDailog/index.tsx
浏览文件 @
23f61049
...
@@ -4,7 +4,7 @@ function Index(props: any) {
...
@@ -4,7 +4,7 @@ function Index(props: any) {
return
(
return
(
<
Modal
<
Modal
title=
'分类删除'
title=
'分类删除'
visible
=
{
props
.
isDeleteVisable
}
open
=
{
props
.
isDeleteVisable
}
onOk=
{
()
=>
props
.
deleteHandleOk
()
}
onOk=
{
()
=>
props
.
deleteHandleOk
()
}
onCancel=
{
()
=>
props
.
deleteHandleCancel
()
}
onCancel=
{
()
=>
props
.
deleteHandleCancel
()
}
>
>
...
...
src/pages/categoryManage/detail/index.scss
→
src/pages/categoryManage/
category/
detail/index.scss
浏览文件 @
23f61049
File moved
src/pages/categoryManage/detail/index.tsx
→
src/pages/categoryManage/
category/
detail/index.tsx
浏览文件 @
23f61049
...
@@ -21,6 +21,7 @@ import { categoryDetailEntity, GoodsInfo } from '~/api/modules/goods';
...
@@ -21,6 +21,7 @@ import { categoryDetailEntity, GoodsInfo } from '~/api/modules/goods';
import
{
CategoryManageAPI
}
from
'~/api'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
import
useOption
from
'~/common/hook/optionHook'
;
import
useOption
from
'~/common/hook/optionHook'
;
import
'./index.scss'
;
import
'./index.scss'
;
import
{
useLocation
,
useParams
,
useNavigate
}
from
'react-router-dom'
;
const
CategoryDetail
:
FC
=
(
props
:
any
)
=>
{
const
CategoryDetail
:
FC
=
(
props
:
any
)
=>
{
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
...
@@ -32,7 +33,7 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -32,7 +33,7 @@ const CategoryDetail: FC = (props: any) => {
const
[
categoryId
,
setCategoryId
]
=
useState
<
number
>
(
0
);
const
[
categoryId
,
setCategoryId
]
=
useState
<
number
>
(
0
);
const
[
isEdit
,
setIsEdit
]
=
useState
<
boolean
>
(
false
);
const
[
isEdit
,
setIsEdit
]
=
useState
<
boolean
>
(
false
);
const
[
detailForm
]
=
const
[
detailForm
]
=
Form
.
useForm
<
Pick
<
categoryDetailEntity
,
'description'
|
'
group
Name'
|
'icon'
>>
();
Form
.
useForm
<
Pick
<
categoryDetailEntity
,
'description'
|
'
classify
Name'
|
'icon'
>>
();
const
[
fileList
,
setFileList
]
=
useState
<
any
>
([]);
const
[
fileList
,
setFileList
]
=
useState
<
any
>
([]);
const
[
goodsInfo
,
setGoodsInfo
]
=
useState
<
GoodsInfo
[]
>
([]);
const
[
goodsInfo
,
setGoodsInfo
]
=
useState
<
GoodsInfo
[]
>
([]);
const
[
viewerVisible
,
setViewerVisible
]
=
useState
<
boolean
>
(
false
);
const
[
viewerVisible
,
setViewerVisible
]
=
useState
<
boolean
>
(
false
);
...
@@ -45,6 +46,12 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -45,6 +46,12 @@ const CategoryDetail: FC = (props: any) => {
const
[
currentImgList
,
setcurrentImgList
]:
any
=
useState
([]);
const
[
currentImgList
,
setcurrentImgList
]:
any
=
useState
([]);
const
[
sortTypeId
,
setSortTypeId
]
=
useState
<
number
>
(
-
1
);
const
[
sortTypeId
,
setSortTypeId
]
=
useState
<
number
>
(
-
1
);
const
[
pid
,
setPid
]
=
useState
<
number
>
(
-
1
);
const
[
pid
,
setPid
]
=
useState
<
number
>
(
-
1
);
const
{
id
}
=
useParams
();
const
_id
=
Number
(
id
);
const
location
=
useLocation
();
const
searchParams
:
any
=
new
URLSearchParams
(
location
.
search
);
const
navigate
=
useNavigate
();
const
columns
:
ColumnsType
<
GoodsInfo
>
=
[
const
columns
:
ColumnsType
<
GoodsInfo
>
=
[
{
{
title
:
'序号'
,
title
:
'序号'
,
...
@@ -111,19 +118,19 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -111,19 +118,19 @@ const CategoryDetail: FC = (props: any) => {
const
btnCode
=
useOption
(
22111
);
const
btnCode
=
useOption
(
22111
);
useEffect
(()
=>
{
useEffect
(()
=>
{
// 分页数据
// 分页数据
getGoodsTypeDetail
(
props
.
match
.
params
.
id
);
getGoodsTypeDetail
(
_
id
);
},
[
pagination
]);
},
[
pagination
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
// 全部数据
// 全部数据
getAllGoodsTypeDetail
(
props
.
match
.
params
.
id
);
getAllGoodsTypeDetail
(
_
id
);
setSortTypeId
(
Number
(
qs
.
parse
(
props
.
location
.
search
).
sortType
Id
));
setSortTypeId
(
Number
(
searchParams
.
directory
Id
));
setPid
(
Number
(
qs
.
parse
(
props
.
location
.
search
)
.
pid
));
setPid
(
Number
(
searchParams
.
pid
));
setCategoryId
(
props
.
match
.
params
.
id
);
setCategoryId
(
_
id
);
},
[]);
},
[]);
const
backRoute
=
()
=>
{
const
backRoute
=
()
=>
{
props
.
history
.
go
(
-
1
);
navigate
(
-
1
);
};
};
// 关联商品新增
// 关联商品新增
const
addModalShowEvent
=
()
=>
{
const
addModalShowEvent
=
()
=>
{
...
@@ -139,7 +146,7 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -139,7 +146,7 @@ const CategoryDetail: FC = (props: any) => {
const
getGoodsTypeDetail
=
async
(
id
:
number
)
=>
{
const
getGoodsTypeDetail
=
async
(
id
:
number
)
=>
{
const
res
:
any
=
await
CategoryManageAPI
.
getGoodsTypeDetail
({
id
,
...
pagination
});
const
res
:
any
=
await
CategoryManageAPI
.
getGoodsTypeDetail
({
id
,
...
pagination
});
detailForm
.
setFieldsValue
({
detailForm
.
setFieldsValue
({
groupName
:
res
.
result
.
groupName
?
res
.
result
.
group
Name
:
undefined
,
classifyName
:
res
.
result
.
classifyName
?
res
.
result
.
classify
Name
:
undefined
,
description
:
res
.
result
.
description
?
res
.
result
.
description
:
undefined
,
description
:
res
.
result
.
description
?
res
.
result
.
description
:
undefined
,
icon
:
res
.
result
.
icon
?
res
.
result
.
icon
:
''
,
icon
:
res
.
result
.
icon
?
res
.
result
.
icon
:
''
,
});
});
...
@@ -160,10 +167,8 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -160,10 +167,8 @@ const CategoryDetail: FC = (props: any) => {
const
getAllGoodsTypeDetail
=
async
(
id
:
number
)
=>
{
const
getAllGoodsTypeDetail
=
async
(
id
:
number
)
=>
{
const
res
:
any
=
await
CategoryManageAPI
.
getGoodsTypeDetail
({
const
res
:
any
=
await
CategoryManageAPI
.
getGoodsTypeDetail
({
id
,
id
,
pageNo
:
1
,
pageSize
:
99999
,
});
});
setAllGoodsInfo
(
res
.
result
.
goodsInfo
||
[]);
setAllGoodsInfo
(
res
.
result
||
[]);
};
};
// 自定义上传
// 自定义上传
const
selfUploadRequest
=
async
(
val
:
any
)
=>
{
const
selfUploadRequest
=
async
(
val
:
any
)
=>
{
...
@@ -232,7 +237,7 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -232,7 +237,7 @@ const CategoryDetail: FC = (props: any) => {
});
});
if
(
res
.
code
===
'200'
)
{
if
(
res
.
code
===
'200'
)
{
message
.
success
(
'修改成功'
);
message
.
success
(
'修改成功'
);
getGoodsTypeDetail
(
props
.
match
.
params
.
id
);
getGoodsTypeDetail
(
_
id
);
}
}
};
};
...
@@ -246,11 +251,11 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -246,11 +251,11 @@ const CategoryDetail: FC = (props: any) => {
const
sureChangeDetailInfo
=
()
=>
{
const
sureChangeDetailInfo
=
()
=>
{
detailForm
detailForm
.
validateFields
()
.
validateFields
()
.
then
(
async
(
value
:
Pick
<
categoryDetailEntity
,
'description'
|
'
group
Name'
|
'icon'
>
)
=>
{
.
then
(
async
(
value
:
Pick
<
categoryDetailEntity
,
'description'
|
'
classify
Name'
|
'icon'
>
)
=>
{
// console.log("数据--->", value);
// console.log("数据--->", value);
const
res
=
await
CategoryManageAPI
.
updateClassification
({
const
res
=
await
CategoryManageAPI
.
updateClassification
({
// description:value.description,
// description:value.description,
//
groupName:value.group
Name,
//
classifyName:value.classify
Name,
// icon:fileList.length?fileList[0].url:'',
// icon:fileList.length?fileList[0].url:'',
...
value
,
...
value
,
sortTypeId
,
sortTypeId
,
...
@@ -378,13 +383,13 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -378,13 +383,13 @@ const CategoryDetail: FC = (props: any) => {
<
Form
form=
{
detailForm
}
labelCol=
{
{
span
:
2
}
}
wrapperCol=
{
{
span
:
5
}
}
>
<
Form
form=
{
detailForm
}
labelCol=
{
{
span
:
2
}
}
wrapperCol=
{
{
span
:
5
}
}
>
<
Form
.
Item
<
Form
.
Item
label=
'行业名称'
label=
'行业名称'
name=
'
group
Name'
name=
'
classify
Name'
rules=
{
[{
required
:
true
,
message
:
'请输入行业名称'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入行业名称'
}]
}
>
>
{
isEdit
?
(
{
isEdit
?
(
<
Input
placeholder=
'请输入行业名称'
disabled=
{
!
isEdit
}
maxLength=
{
15
}
/>
<
Input
placeholder=
'请输入行业名称'
disabled=
{
!
isEdit
}
maxLength=
{
15
}
/>
)
:
(
)
:
(
<
span
>
{
detailData
?.
group
Name
}
</
span
>
<
span
>
{
detailData
?.
classify
Name
}
</
span
>
)
}
)
}
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
'分类描述'
name=
'description'
>
<
Form
.
Item
label=
'分类描述'
name=
'description'
>
...
@@ -452,7 +457,7 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -452,7 +457,7 @@ const CategoryDetail: FC = (props: any) => {
<
Table
<
Table
size=
'small'
size=
'small'
columns=
{
columns=
{
Number
(
qs
.
parse
(
props
.
location
.
search
).
sortType
Id
)
===
1
Number
(
searchParams
.
directory
Id
)
===
1
?
columns
.
filter
((
item
:
ColumnType
<
GoodsInfo
>
)
=>
item
.
title
!=
'安全编码开关'
)
?
columns
.
filter
((
item
:
ColumnType
<
GoodsInfo
>
)
=>
item
.
title
!=
'安全编码开关'
)
:
columns
:
columns
}
}
...
...
src/pages/categoryManage/index.scss
→
src/pages/categoryManage/
category/
index.scss
浏览文件 @
23f61049
File moved
src/pages/categoryManage/index.tsx
→
src/pages/categoryManage/
category/
index.tsx
浏览文件 @
23f61049
差异被折叠。
点击展开。
src/pages/categoryManage/components/addOrEditDec/index.tsx
deleted
100644 → 0
浏览文件 @
185fd540
import
{
Modal
,
Form
,
Input
,
Button
,
Row
,
Col
,
message
}
from
'antd'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
PlusOutlined
,
MinusOutlined
}
from
'@ant-design/icons'
;
import
{
PropsType
}
from
'~/common/interface/modal'
;
import
{
categoryDec
}
from
'~/api/modules/goods'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
interface
selfPropsType
{
directoryList
:
categoryDec
[];
refreshDec
:
Function
;
}
const
AddOrEditDec
:
React
.
FC
<
PropsType
&
selfPropsType
>
=
({
isModalVisible
,
handleOk
,
handleCancel
,
directoryList
,
refreshDec
,
})
=>
{
const
[
form
]
=
Form
.
useForm
<
any
>
();
// 表单目录标题列表
const
[
addOrEditDirectoryList
,
setAddOrEditDirectoryList
]
=
useState
<
categoryDec
[]
>
([]);
// 是否点击删除按钮
const
[
isClickDle
,
setIsClickDle
]
=
useState
<
boolean
>
(
false
);
useEffect
(()
=>
{
if
(
directoryList
.
length
!=
0
&&
!
isClickDle
)
{
setAddOrEditDirectoryList
(
directoryList
);
const
defaultFormValue
=
directoryList
.
reduce
((
pre
:
any
,
cur
:
categoryDec
)
=>
{
Object
.
keys
(
cur
).
map
((
item
:
string
)
=>
{
if
(
item
===
'id'
)
{
pre
[
cur
[
item
]]
=
cur
.
sortName
;
}
});
return
pre
;
},
{});
form
.
setFieldsValue
(
defaultFormValue
);
}
},
[
directoryList
]);
// 新增或修改目录
const
addDirectoryTitle
=
()
=>
{
const
decList
:
categoryDec
[]
=
[...
addOrEditDirectoryList
].
sort
(
(
a
:
categoryDec
,
b
:
categoryDec
)
=>
a
.
id
-
b
.
id
,
);
setAddOrEditDirectoryList
([
...
addOrEditDirectoryList
,
{
id
:
decList
[
decList
.
length
-
1
].
id
+
1
,
defaultType
:
1
,
sortName
:
''
,
},
]);
};
// 删除目录
const
deleteDirectory
=
async
(
id
:
number
)
=>
{
const
bol
:
boolean
=
directoryList
.
some
((
item
:
categoryDec
)
=>
item
.
id
===
id
);
const
index
=
addOrEditDirectoryList
.
findIndex
((
item
:
categoryDec
)
=>
item
.
id
===
id
);
if
(
bol
)
{
const
res
:
any
=
await
CategoryManageAPI
.
removeDirectory
(
id
);
if
(
res
.
code
===
'200'
)
{
message
.
success
(
'删除成功'
);
setIsClickDle
(
true
);
refreshDec
(
id
);
}
else
{
return
message
.
warning
(
res
.
message
);
}
}
const
obj
:
any
=
{};
obj
[
id
]
=
undefined
;
form
.
setFieldsValue
(
obj
);
addOrEditDirectoryList
.
splice
(
index
,
1
);
setAddOrEditDirectoryList
([...
addOrEditDirectoryList
]);
};
const
directorySureEvent
=
()
=>
{
form
.
validateFields
().
then
(
async
(
value
:
any
)
=>
{
const
requestList
=
Object
.
keys
(
value
).
reduce
((
pre
:
any
,
cur
:
string
)
=>
{
const
bol
:
boolean
=
directoryList
.
some
((
item
:
any
)
=>
item
.
id
===
Number
(
cur
));
if
(
bol
)
{
pre
.
push
({
id
:
Number
(
cur
),
directoryName
:
value
[
cur
],
});
}
else
{
pre
.
push
({
directoryName
:
value
[
cur
],
});
}
return
pre
;
},
[]);
const
res
:
any
=
await
CategoryManageAPI
.
addOrEditDirectory
(
requestList
);
if
(
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
form
.
resetFields
();
setIsClickDle
(
false
);
handleOk
();
}
else
{
message
.
warning
(
res
.
message
);
}
});
};
const
directoryCancel
=
()
=>
{
form
.
resetFields
();
setIsClickDle
(
false
);
handleCancel
();
};
return
(
<
Modal
title=
'目录管理'
visible=
{
isModalVisible
}
onOk=
{
directorySureEvent
}
onCancel=
{
directoryCancel
}
>
<
Form
form=
{
form
}
labelCol=
{
{
span
:
6
}
}
wrapperCol=
{
{
span
:
16
}
}
>
<
Form
.
Item
label=
'添加目录'
labelCol=
{
{
span
:
4
}
}
wrapperCol=
{
{
span
:
16
}
}
>
<
Button
icon=
{
<
PlusOutlined
/>
}
onClick=
{
addDirectoryTitle
}
/>
</
Form
.
Item
>
{
addOrEditDirectoryList
.
map
((
item
:
categoryDec
)
=>
(
<
Row
key=
{
item
.
id
}
gutter=
{
{
xs
:
8
,
sm
:
16
,
md
:
24
}
}
>
<
Col
span=
{
16
}
>
<
Form
.
Item
label=
'目录名称'
name=
{
item
.
id
}
rules=
{
[{
required
:
true
,
message
:
'请输入目录名称'
}]
}
>
<
Input
placeholder=
'请输入目录名称'
maxLength=
{
30
}
/>
</
Form
.
Item
>
</
Col
>
<
Col
>
{
item
.
defaultType
?
(
<
Button
icon=
{
<
MinusOutlined
/>
}
type=
'primary'
onClick=
{
()
=>
deleteDirectory
(
item
.
id
)
}
/>
)
:
(
''
)
}
</
Col
>
</
Row
>
))
}
</
Form
>
</
Modal
>
);
};
export
default
AddOrEditDec
;
src/pages/categoryManage/directoryManage/components/addOrEditDec/index.tsx
0 → 100644
浏览文件 @
23f61049
import
{
Modal
,
Form
,
Input
,
Button
,
Row
,
Col
,
message
,
Select
,
RadioChangeEvent
,
Radio
,
Space
,
}
from
'antd'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
PropsType
}
from
'~/common/interface/modal'
;
import
{
categoryDec
}
from
'~/api/modules/goods'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
const
typeOptions
=
[
{
value
:
0
,
label
:
'通用分类'
,
},
{
value
:
1
,
label
:
'作业服务分类'
,
},
{
value
:
2
,
label
:
'设备分类'
,
},
{
value
:
3
,
label
:
'飞手分类'
,
},
{
value
:
4
,
label
:
'商城分类'
,
},
];
interface
selfPropsType
{
isModalVisible
:
boolean
;
handleOk
?:
()
=>
void
;
handleCancel
?:
()
=>
void
;
editData
?:
categoryDec
;
//编辑数据
}
const
AddOrEditDec
:
React
.
FC
<
PropsType
&
selfPropsType
>
=
({
isModalVisible
,
handleOk
,
handleCancel
,
editData
,
})
=>
{
const
[
form
]
=
Form
.
useForm
<
any
>
();
const
[
hasPid
,
setHasPid
]
=
useState
(
false
);
//是否有上级目录
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
//提交按钮的loading
const
[
directoryOptions
,
setDirectoryOptions
]
=
useState
([]);
//目录options
const
id
=
editData
?.
id
;
useEffect
(()
=>
{
if
(
isModalVisible
)
{
form
.
setFieldValue
(
'type'
,
editData
.
type
);
form
.
setFieldValue
(
'pid'
,
editData
.
pid
);
form
.
setFieldValue
(
'directoryName'
,
editData
.
directoryName
);
onChangeType
(
editData
.
type
);
if
(
editData
.
pid
)
{
setHasPid
(
true
);
}
else
{
setHasPid
(
false
);
}
}
},
[
isModalVisible
]);
const
onChangeType
=
(
value
)
=>
{
console
.
log
(
'value'
,
value
);
form
.
resetFields
([
'pid'
]);
CategoryManageAPI
.
directoryList
({
pageNo
:
1
,
pageSize
:
999
,
type
:
value
}).
then
((
res
)
=>
{
setDirectoryOptions
(
res
.
result
?.
list
||
[]);
});
};
//提交
const
onFinish
=
async
()
=>
{
const
values
=
await
form
.
validateFields
();
console
.
log
(
'values'
,
values
);
setSubmitLoading
(
true
);
try
{
const
res
=
await
CategoryManageAPI
.
addOrEditDirectory
({
...
values
,
id
,
pid
:
hasPid
?
values
.
pid
:
null
,
});
res
.
code
==
'200'
&&
message
.
success
(
'新增成功'
);
handleOk
();
setTimeout
(()
=>
{
form
.
resetFields
();
},
500
);
}
catch
(
e
)
{}
setSubmitLoading
(
false
);
};
return
(
<
Modal
title=
'新增目录'
open=
{
isModalVisible
}
onOk=
{
onFinish
}
onCancel=
{
()
=>
{
form
.
resetFields
();
handleCancel
();
}
}
okButtonProps=
{
{
loading
:
submitLoading
}
}
>
<
Form
form=
{
form
}
labelCol=
{
{
span
:
6
}
}
wrapperCol=
{
{
span
:
16
}
}
style=
{
{
marginBottom
:
40
}
}
>
<
Form
.
Item
label=
'分类模块'
name=
'type'
rules=
{
[{
required
:
true
}]
}
>
<
Select
options=
{
typeOptions
}
allowClear=
{
true
}
onChange=
{
onChangeType
}
></
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
'目录类型'
>
<
Radio
.
Group
onChange=
{
(
e
:
RadioChangeEvent
)
=>
setHasPid
(
e
.
target
.
value
)
}
value=
{
hasPid
}
>
<
Radio
value=
{
false
}
>
无关联目录
</
Radio
>
<
Radio
value=
{
true
}
>
有关联目录
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
{
hasPid
&&
(
<
Form
.
Item
label=
'上级目录'
name=
'pid'
rules=
{
[{
required
:
true
}]
}
>
<
Select
options=
{
directoryOptions
}
fieldNames=
{
{
label
:
'directoryName'
,
value
:
'id'
}
}
allowClear=
{
true
}
></
Select
>
</
Form
.
Item
>
)
}
<
Form
.
Item
label=
'目录名称'
name=
'directoryName'
rules=
{
[{
required
:
true
}]
}
>
<
Input
placeholder=
'请输入目录名称'
allowClear=
{
true
}
></
Input
>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
};
export
default
AddOrEditDec
;
src/pages/categoryManage/directoryManage/index.tsx
0 → 100644
浏览文件 @
23f61049
import
{
DeleteOutlined
,
EditOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
Tag
,
Space
,
Button
,
Table
,
Pagination
,
message
,
Modal
}
from
'antd'
;
import
{
ColumnsType
,
TablePaginationConfig
}
from
'antd/es/table'
;
import
type
{
FilterValue
,
SorterResult
}
from
'antd/es/table/interface'
;
import
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
import
{
categoryEntity
,
categoryDec
}
from
'~/api/interface/categoryManage'
;
import
AddOrEditDec
from
'./components/addOrEditDec'
;
interface
DataType
{
title
:
string
;
dataIndex
:
string
;
key
:
string
;
align
:
string
;
}
const
typeOptions
=
[
{
value
:
0
,
label
:
'通用分类'
,
},
{
value
:
1
,
label
:
'作业服务分类'
,
},
{
value
:
2
,
label
:
'设备分类'
,
},
{
value
:
3
,
label
:
'飞手分类'
,
},
{
value
:
4
,
label
:
'商城分类'
,
},
];
const
DirectoryManage
:
FC
=
(
props
:
any
)
=>
{
const
[
data
,
setData
]
=
useState
<
categoryDec
[]
>
();
//table数据
const
[
loading
,
setLoading
]
=
useState
(
false
);
//table获取数据的loading
const
[
pagination
,
setPagination
]
=
useState
<
TablePaginationConfig
>
({
current
:
1
,
pageSize
:
10
,
total
:
0
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
showTotal
:
(
total
,
range
)
=>
`当前
${
range
[
0
]}
-
${
range
[
1
]}
条记录 / 共
${
total
}
条数据`
,
});
//目录modal
const
[
isAddOrEditDecModal
,
setIsAddOrEditDecModal
]
=
useState
<
boolean
>
(
false
);
const
[
reload
,
setReload
]
=
useState
(
false
);
const
[
editData
,
setEditData
]
=
useState
<
categoryDec
|
null
>
(
null
);
const
columns
:
ColumnsType
<
DataType
>
=
[
{
title
:
'目录名称'
,
dataIndex
:
'directoryName'
,
key
:
'directoryName'
,
align
:
'center'
,
},
{
title
:
'分类模块'
,
dataIndex
:
'type'
,
key
:
'type'
,
align
:
'center'
,
render
:
(
value
)
=>
{
let
find
=
typeOptions
.
find
((
item
)
=>
{
return
item
.
value
==
value
;
});
return
<
div
>
{
find
?.
label
}
</
div
>;
},
},
{
title
:
'目录类型'
,
dataIndex
:
'directoryType'
,
key
:
'directoryType'
,
align
:
'center'
,
},
{
title
:
'上级目录'
,
dataIndex
:
'relevanceName'
,
key
:
'relevanceName'
,
align
:
'center'
,
},
{
title
:
'操作'
,
key
:
'action'
,
render
:
(
_
,
record
)
=>
(
<
Space
size=
'middle'
>
<
Button
type=
'link'
icon=
{
<
EditOutlined
/>
}
onClick=
{
()
=>
{
console
.
log
(
'record'
,
record
);
setEditData
(
record
);
setIsAddOrEditDecModal
(
true
);
}
}
>
编辑
</
Button
>
<
Button
type=
'link'
danger
icon=
{
<
DeleteOutlined
/>
}
onClick=
{
()
=>
onDel
(
record
.
id
)
}
>
删除
</
Button
>
</
Space
>
),
align
:
'center'
,
},
];
// 目录弹窗
const
showDecModal
=
()
=>
{
setEditData
(
null
);
setIsAddOrEditDecModal
(
true
);
};
const
addOrEditDecHandleOk
=
()
=>
{
getDirectoryList
();
setIsAddOrEditDecModal
(
false
);
};
const
addOrEditDecHandleCancel
=
()
=>
{
setIsAddOrEditDecModal
(
false
);
};
//获取所有目录列表
const
getDirectoryList
=
()
=>
{
setLoading
(
true
);
CategoryManageAPI
.
directoryList
({
pageNo
:
pagination
!
.
current
!
,
pageSize
:
pagination
!
.
pageSize
!
,
})
.
then
((
res
)
=>
{
setData
(
res
.
result
?.
list
.
map
((
item
:
categoryDec
)
=>
{
if
(
item
.
pid
)
{
item
.
directoryType
=
'有关联用户'
;
}
else
{
item
.
directoryType
=
'无关联用户'
;
}
return
item
;
})
||
[],
);
setLoading
(
false
);
setPagination
({
...
pagination
,
current
:
res
.
result
.
pageNo
,
pageSize
:
res
.
result
.
pageSize
,
total
:
res
.
result
.
totalCount
,
});
})
.
catch
((
err
)
=>
{
setData
([]);
setLoading
(
false
);
});
};
// 删除
const
onDel
=
(
id
:
number
)
=>
{
Modal
.
confirm
({
title
:
'目录删除'
,
content
:
'确认删除该目录?'
,
onOk
()
{
CategoryManageAPI
.
removeDirectory
(
id
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
message
.
success
(
'删除成功'
);
setReload
(
!
reload
);
}
else
{
message
.
error
(
res
.
message
);
}
});
},
});
};
useEffect
(()
=>
{
getDirectoryList
();
},
[
JSON
.
stringify
(
pagination
),
reload
]);
const
handleTableChange
=
(
pagination
:
TablePaginationConfig
,
filters
:
Record
<
string
,
FilterValue
>
,
sorter
:
SorterResult
<
DataType
>
,
)
=>
{
setPagination
(
pagination
);
// `dataSource` is useless since `pageSize` changed
if
(
pagination
.
pageSize
!==
pagination
?.
pageSize
)
{
setData
([]);
}
};
return
(
<>
<
div
>
<
Button
type=
'primary'
onClick=
{
()
=>
showDecModal
()
}
icon=
{
<
PlusOutlined
/>
}
style=
{
{
margin
:
'10px 0 15px 10px'
,
}
}
>
新增目录
</
Button
>
<
Table
rowKey=
'id'
columns=
{
columns
}
dataSource=
{
data
}
bordered
onChange=
{
handleTableChange
}
pagination=
{
pagination
}
loading=
{
loading
}
/>
;
</
div
>
{
/* 目录管理 */
}
<
AddOrEditDec
isModalVisible=
{
isAddOrEditDecModal
}
handleOk=
{
addOrEditDecHandleOk
}
handleCancel=
{
addOrEditDecHandleCancel
}
editData=
{
editData
}
/>
</>
);
};
export
default
DirectoryManage
;
src/router/router.tsx
浏览文件 @
23f61049
...
@@ -19,6 +19,12 @@ import {
...
@@ -19,6 +19,12 @@ import {
SettingOutlined
,
SettingOutlined
,
UserOutlined
,
UserOutlined
,
SisternodeOutlined
,
SisternodeOutlined
,
SendOutlined
,
RocketOutlined
,
AppstoreAddOutlined
,
AppstoreOutlined
,
CoffeeOutlined
,
UnorderedListOutlined
,
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-ignore
...
@@ -85,8 +91,10 @@ const SplitCouponOperate = React.lazy(
...
@@ -85,8 +91,10 @@ const SplitCouponOperate = React.lazy(
const
CouponDetailed
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/couponDetailed'
));
//优惠券明细
const
CouponDetailed
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/couponDetailed'
));
//优惠券明细
// 分类管理
// 分类管理
const
CategoryList
=
React
.
lazy
(()
=>
import
(
'src/pages/categoryManage/index'
));
const
CategoryManage
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/category'
));
// 路由列表类型
const
CategoryDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/category/detail'
));
// 目录管理
const
DirectoryManage
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/directoryManage'
));
export
interface
RouteObjectType
{
export
interface
RouteObjectType
{
path
:
AgnosticIndexRouteObject
[
'path'
];
path
:
AgnosticIndexRouteObject
[
'path'
];
element
:
any
;
element
:
any
;
...
@@ -542,33 +550,67 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -542,33 +550,67 @@ export const routerList: Array<RouteObjectType> = [
},
},
children
:
[
children
:
[
{
{
path
:
'/categoryManage/
categoryList
'
,
path
:
'/categoryManage/
jobServicesCategory/1
'
,
element
:
withLoadingComponent
(<
Category
List
/>),
element
:
withLoadingComponent
(<
Category
Manage
/>),
meta
:
{
meta
:
{
id
:
18100
,
id
:
18100
,
title
:
'分类列表'
,
title
:
'作业服务分类'
,
icon
:
<
SisternodeOutlined
/>,
icon
:
<
SendOutlined
/>,
},
},
{
path
:
'/categoryManage/jobServicesCategory/2'
,
element
:
withLoadingComponent
(<
CategoryManage
/>),
meta
:
{
id
:
18200
,
title
:
'设备租赁分类'
,
icon
:
<
RocketOutlined
/>,
},
},
{
path
:
'/categoryManage/jobServicesCategory/3'
,
element
:
withLoadingComponent
(<
CategoryManage
/>),
meta
:
{
id
:
18300
,
title
:
'飞手培训分类'
,
icon
:
<
AppstoreAddOutlined
/>,
},
},
{
path
:
'/categoryManage/jobServicesCategory/4'
,
element
:
withLoadingComponent
(<
CategoryManage
/>),
meta
:
{
id
:
18400
,
title
:
'产品商城分类'
,
icon
:
<
AppstoreOutlined
/>,
},
},
{
path
:
'/categoryManage/jobServicesCategory/0'
,
element
:
withLoadingComponent
(<
CategoryManage
/>),
meta
:
{
id
:
18500
,
title
:
'通用分类'
,
icon
:
<
CoffeeOutlined
/>,
},
},
{
path
:
'/categoryManage/detail/:id'
,
element
:
withLoadingComponent
(<
CategoryDetail
/>),
meta
:
{
id
:
18600
,
title
:
'分类详情'
,
icon
:
''
,
hidden
:
true
,
},
},
},
},
],
},
{
path
:
'/systemManage'
,
element
:
<
LayoutView
/>,
errorElement
:
<
ErrorPage
/>,
meta
:
{
id
:
28000
,
icon
:
<
SettingOutlined
/>,
title
:
'系统管理'
,
},
children
:
[
{
{
path
:
'/
systemManage/account
Manage'
,
path
:
'/
categoryManage/Directory
Manage'
,
element
:
withLoadingComponent
(<
AccountManageView
/>),
element
:
withLoadingComponent
(<
DirectoryManage
/>),
meta
:
{
meta
:
{
id
:
281
00
,
id
:
187
00
,
title
:
'
账号
管理'
,
title
:
'
目录
管理'
,
icon
:
<
U
ser
Outlined
/>,
icon
:
<
U
norderedList
Outlined
/>,
},
},
},
},
],
],
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论