Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
admin-ci-test
Commits
19dc54e9
提交
19dc54e9
authored
7月 26, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:商品分类,商品新增(未调完)
上级
95fca4a3
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
974 行增加
和
188 行删除
+974
-188
categoryManage.ts
src/api/interface/categoryManage.ts
+55
-0
goodsType.ts
src/api/interface/goodsType.ts
+39
-0
categoryManage.ts
src/api/modules/categoryManage.ts
+28
-0
goodsAPI.ts
src/api/modules/goodsAPI.ts
+5
-1
index.tsx
src/components/EditableCell/index.tsx
+6
-2
index.tsx
.../categoryList/components/addOrEditCategoryModal/index.tsx
+122
-0
index.scss
src/pages/categoryManage/categoryList/index.scss
+7
-0
index.tsx
src/pages/categoryManage/categoryList/index.tsx
+0
-0
index.tsx
...oods/goodsAddOrEditOrDetail/components/baseInfo/index.tsx
+187
-20
index.tsx
...sAddOrEditOrDetail/components/skuAddOrEditModal/index.tsx
+207
-25
index.tsx
...Goods/goodsAddOrEditOrDetail/components/skuInfo/index.tsx
+48
-4
index.tsx
...ges/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
+108
-21
index.tsx
src/pages/systemManage/companyManage/companyDetail/index.tsx
+13
-0
index.tsx
...age/companyManage/companyList/comp/addEditModal/index.tsx
+0
-0
index.tsx
src/pages/systemManage/companyManage/companyList/index.tsx
+15
-8
index.ts
src/router/index.ts
+25
-29
privateRouter.tsx
src/router/privateRouter.tsx
+16
-10
router.tsx
src/router/router.tsx
+93
-68
没有找到文件。
src/api/interface/categoryManage.ts
浏览文件 @
19dc54e9
...
@@ -72,3 +72,58 @@ export type categoryDetailsType = InterFunction<
...
@@ -72,3 +72,58 @@ export type categoryDetailsType = InterFunction<
>
;
>
;
//分类-关联列表
//分类-关联列表
export
type
categoryRelevantType
=
InterFunction
<
{
id
:
number
;
type
:
number
},
any
>
;
export
type
categoryRelevantType
=
InterFunction
<
{
id
:
number
;
type
:
number
},
any
>
;
//分类管理-分类列表(新)
type
categoryItemType
=
{
id
:
number
;
name
:
string
;
createTime
:
string
;
icon
:
string
;
description
:
string
;
subDTOList
:
(
Omit
<
categoryItemType
,
'createTime'
|
'icon'
|
'subDTOList'
>
&
{
categoryPrimaryId
:
number
;
})[];
};
export
type
categoryListRespType
=
InterItemFunction
<
{
id
?:
number
},
categoryItemType
[]
>
;
//分类管理-1级分类新增(新)
export
type
addPrimaryCategoryType
=
InterFunction
<
{
description
:
string
;
icon
:
string
;
name
:
string
;
},
any
>
;
//分类管理-1级分类编辑(新)
export
type
updatePrimaryCategoryType
=
InterFunction
<
{
description
:
string
;
icon
:
string
;
name
:
string
;
id
?:
number
;
},
any
>
;
//分类管理-1级分类删除(新)
export
type
deletePrimaryCategoryType
=
InterFunction
<
{
id
:
number
},
any
>
;
//分类管理-2级分类新增(新)
export
type
addSubCategoryType
=
InterFunction
<
{
categoryPrimaryId
:
number
;
description
:
string
;
name
:
string
;
},
any
>
;
//分类管理-2级分类编辑(新)
export
type
updateSubCategoryType
=
InterFunction
<
{
categoryPrimaryId
:
number
;
description
:
string
;
name
:
string
;
id
?:
number
;
},
any
>
;
//分类管理-2级分类删除(新)
export
type
deleteSubCategoryType
=
InterFunction
<
{
id
:
number
},
any
>
;
src/api/interface/goodsType.ts
浏览文件 @
19dc54e9
...
@@ -103,3 +103,42 @@ export type batchOnShelfOrTakeDownType = InterFunction<{ goodsIds: number[]; sta
...
@@ -103,3 +103,42 @@ export type batchOnShelfOrTakeDownType = InterFunction<{ goodsIds: number[]; sta
export
type
batchRemoveWareInfoType
=
InterFunction
<
number
[],
any
>
;
export
type
batchRemoveWareInfoType
=
InterFunction
<
number
[],
any
>
;
//商品-上下移动
//商品-上下移动
export
type
exchangeGoodsInfoType
=
InterFunction
<
{
firstId
:
number
;
secondId
:
number
},
any
>
;
export
type
exchangeGoodsInfoType
=
InterFunction
<
{
firstId
:
number
;
secondId
:
number
},
any
>
;
//商品-新增(新)
export
type
addMallGoodsType
=
InterFunction
<
{
categoryPrimaryId
:
number
;
categorySubId
:
number
;
description
:
string
;
goodsDetails
:
string
;
goodsLabel
:
string
;
goodsSpecList
:
{
chooseType
:
number
;
goodsSpecValuesList
:
{
channelPrice
?:
number
;
id
:
number
;
partNo
:
string
;
salePrice
:
number
;
showPrice
:
number
;
specValueImage
:
string
;
specValueName
:
string
;
stock
?:
number
;
}[];
id
:
number
;
mallGoodsId
:
number
;
must
:
number
;
skuUnitId
:
number
;
specName
:
string
;
}[];
id
:
number
;
labelShow
:
number
;
resourcesList
:
{
id
:
number
;
type
:
number
;
url
:
string
;
}[];
shelfStatus
:
number
;
tradeName
:
string
;
},
any
>
;
src/api/modules/categoryManage.ts
浏览文件 @
19dc54e9
import
axios
from
'../request'
;
import
axios
from
'../request'
;
import
{
import
{
addPrimaryCategoryType
,
addSubCategoryType
,
categoryDetailsType
,
categoryDetailsType
,
categoryListRespType
,
categoryListType
,
categoryListType
,
categoryRelevantType
,
categoryRelevantType
,
deletePrimaryCategoryType
,
directoryListType
,
directoryListType
,
directoryPageListType
,
directoryPageListType
,
updatePrimaryCategoryType
,
updateSubCategoryType
,
}
from
'~/api/interface/categoryManage'
;
}
from
'~/api/interface/categoryManage'
;
export
class
CategoryManageAPI
{
export
class
CategoryManageAPI
{
...
@@ -97,4 +103,26 @@ export class CategoryManageAPI {
...
@@ -97,4 +103,26 @@ export class CategoryManageAPI {
static
getRelevantBusiness
:
categoryRelevantType
=
(
params
)
=>
{
static
getRelevantBusiness
:
categoryRelevantType
=
(
params
)
=>
{
return
axios
.
get
(
'/pms/classify/queryRelevantBusiness'
,
{
params
});
return
axios
.
get
(
'/pms/classify/queryRelevantBusiness'
,
{
params
});
};
};
// 分类管理-分类列表(新)
static
getCategoryRespList
:
categoryListRespType
=
(
data
)
=>
axios
.
post
(
'/pms/category/categoryList'
,
data
);
// 分类管理-1级分类新增(新)
static
addPrimaryCategory
:
addPrimaryCategoryType
=
(
data
)
=>
axios
.
post
(
'/pms/category/addPrimaryCategory'
,
data
);
// 分类管理-1级分类编辑(新)
static
updatePrimaryCategory
:
updatePrimaryCategoryType
=
(
data
)
=>
axios
.
post
(
'/pms/category/updatePrimaryCategory'
,
data
);
// 分类管理-1级分类删除(新)
static
deletePrimaryCategory
:
deletePrimaryCategoryType
=
(
params
)
=>
axios
.
get
(
'/pms/category/deletePrimaryCategory'
,
{
params
});
// 分类管理-2级分类新增(新)
static
addSubCategory
:
addSubCategoryType
=
(
data
)
=>
axios
.
post
(
'/pms/category/addSubCategory'
,
data
);
// 分类管理-2级分类编辑(新)
static
updateSubCategory
:
updateSubCategoryType
=
(
data
)
=>
axios
.
post
(
'/pms/category/updateSubCategory'
,
data
);
// 分类管理-2级分类删除(新)
static
deleteSubCategory
:
deletePrimaryCategoryType
=
(
params
)
=>
axios
.
get
(
'/pms/category/deleteSubCategory'
,
{
params
});
}
}
src/api/modules/goodsAPI.ts
浏览文件 @
19dc54e9
import
{
import
{
addGoodsType
,
addGoodsType
,
addMallGoodsType
,
batchOnShelfOrTakeDownType
,
batchOnShelfOrTakeDownType
,
batchRemoveWareInfoType
,
batchRemoveWareInfoType
,
detailGoodsType
,
detailGoodsType
,
...
@@ -30,7 +31,7 @@ class GoodsAPI {
...
@@ -30,7 +31,7 @@ class GoodsAPI {
};
};
// 商品-单位
// 商品-单位
static
getSkuUnit
:
skuUnitType
=
()
=>
{
static
getSkuUnit
:
skuUnitType
=
()
=>
{
return
axios
.
get
(
'/pms/goods/getSkuUnit'
);
return
axios
.
get
(
'/pms/
mall/
goods/getSkuUnit'
);
};
};
// 商品-其它服务列表
// 商品-其它服务列表
static
getOtherServiceList
:
otherServiceType
=
()
=>
{
static
getOtherServiceList
:
otherServiceType
=
()
=>
{
...
@@ -48,5 +49,8 @@ class GoodsAPI {
...
@@ -48,5 +49,8 @@ class GoodsAPI {
static
exchangeGoodsInfo
:
exchangeGoodsInfoType
=
(
params
)
=>
{
static
exchangeGoodsInfo
:
exchangeGoodsInfoType
=
(
params
)
=>
{
return
axios
.
get
(
'/pms/goods/exchangeGoodsInfo'
,
{
params
});
return
axios
.
get
(
'/pms/goods/exchangeGoodsInfo'
,
{
params
});
};
};
// 商品-新增(新)
static
addMallGoods
:
addMallGoodsType
=
(
data
)
=>
axios
.
post
(
'/pms/mall/goods/addMallGoods'
,
data
);
}
}
export
default
GoodsAPI
;
export
default
GoodsAPI
;
src/components/EditableCell/index.tsx
浏览文件 @
19dc54e9
...
@@ -8,7 +8,7 @@ export interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
...
@@ -8,7 +8,7 @@ export interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
editing
:
boolean
;
editing
:
boolean
;
dataIndex
:
string
;
dataIndex
:
string
;
title
:
any
;
title
:
any
;
inputType
:
'number'
|
'text'
|
'select'
|
'uploader'
|
'radio'
;
inputType
:
'number'
|
'text'
|
'select'
|
'uploader'
|
'radio'
|
'textArea'
;
record
:
any
;
record
:
any
;
index
:
number
;
index
:
number
;
children
:
React
.
ReactNode
;
children
:
React
.
ReactNode
;
...
@@ -19,6 +19,7 @@ const EditableCell: React.FC<
...
@@ -19,6 +19,7 @@ const EditableCell: React.FC<
radioOption
?:
{
name
:
string
;
id
:
number
}[];
radioOption
?:
{
name
:
string
;
id
:
number
}[];
uploadSuccess
?:
(
record
:
any
,
result
:
any
)
=>
void
;
uploadSuccess
?:
(
record
:
any
,
result
:
any
)
=>
void
;
rules
?:
any
;
rules
?:
any
;
maxLength
?:
number
;
}
}
>
=
({
>
=
({
editing
,
editing
,
...
@@ -32,6 +33,7 @@ const EditableCell: React.FC<
...
@@ -32,6 +33,7 @@ const EditableCell: React.FC<
uploadSuccess
,
uploadSuccess
,
children
,
children
,
rules
,
rules
,
maxLength
,
...
restProps
...
restProps
})
=>
{
})
=>
{
const
inputNode
=
()
=>
{
const
inputNode
=
()
=>
{
...
@@ -70,8 +72,10 @@ const EditableCell: React.FC<
...
@@ -70,8 +72,10 @@ const EditableCell: React.FC<
))
}
))
}
</
Radio
.
Group
>
</
Radio
.
Group
>
);
);
case
'textArea'
:
return
<
Input
.
TextArea
placeholder=
{
`请输入${title}`
}
maxLength=
{
maxLength
}
showCount
/>;
default
:
default
:
return
<
Input
placeholder=
{
`请输入${title}`
}
/>;
return
<
Input
placeholder=
{
`请输入${title}`
}
maxLength=
{
maxLength
}
/>;
}
}
};
};
return
(
return
(
...
...
src/pages/categoryManage/categoryList/components/addOrEditCategoryModal/index.tsx
0 → 100644
浏览文件 @
19dc54e9
import
{
Form
,
Input
,
message
,
Modal
,
ModalProps
}
from
'antd'
;
import
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
Uploader
}
from
'~/components/uploader'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
InterDataType
,
InterReqType
}
from
'~/api/interface'
;
import
{
addPrimaryCategoryType
,
categoryListRespType
}
from
'~/api/interface/categoryManage'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
//分类列表返回类型
type
categoryType
=
InterDataType
<
categoryListRespType
>
[
'list'
];
//新增分类请求参数类型
type
addPrimaryCategoryParameter
=
InterReqType
<
addPrimaryCategoryType
>
;
interface
selfProps
{
onCancel
:
()
=>
void
;
onOK
:
()
=>
void
;
currentCategory
:
categoryType
[
0
]
|
undefined
;
}
const
AddOrEditCategoryModal
:
FC
<
ModalProps
&
selfProps
>
=
({
open
,
onCancel
,
onOK
,
currentCategory
,
})
=>
{
const
[
form
]
=
Form
.
useForm
<
addPrimaryCategoryParameter
>
();
const
[
fileList
,
setFileList
]
=
useState
<
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[]
>
([]);
//上传成功
const
uploadSuccess
=
(
value
:
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[],
)
=>
{
form
.
setFieldValue
(
'icon'
,
value
[
0
].
url
);
setFileList
([...
value
]);
};
//提交
const
handleOk
=
()
=>
{
form
.
validateFields
().
then
((
values
:
any
)
=>
{
CategoryManageAPI
[
currentCategory
?
'updatePrimaryCategory'
:
'addPrimaryCategory'
]({
...
values
,
id
:
currentCategory
?
currentCategory
.
id
:
undefined
,
}).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'新增成功'
);
form
.
resetFields
();
setFileList
([]);
onOK
();
}
});
});
};
const
handleCancel
=
()
=>
{
form
.
resetFields
();
setFileList
([]);
onCancel
();
};
useEffect
(()
=>
{
if
(
currentCategory
)
{
form
.
setFieldsValue
({
name
:
currentCategory
.
name
,
icon
:
currentCategory
.
icon
,
description
:
currentCategory
.
description
||
undefined
,
});
setFileList
([
{
name
:
'categoryImg'
,
id
:
Math
.
random
(),
uid
:
Math
.
random
(),
url
:
currentCategory
.
icon
,
},
]);
}
},
[
currentCategory
]);
return
(
<
Modal
open=
{
open
}
title=
{
currentCategory
?
'编辑分类'
:
'新增分类'
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
>
<
Form
wrapperCol=
{
{
span
:
16
}
}
labelCol=
{
{
span
:
4
}
}
form=
{
form
}
>
<
Form
.
Item
label=
'分类名称'
name=
'name'
rules=
{
[{
required
:
true
,
message
:
'请输入分类名称'
}]
}
>
<
Input
placeholder=
'请输入分类名称'
maxLength=
{
15
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'分类图标'
name=
'icon'
rules=
{
[{
required
:
true
,
message
:
'请上传分类图标'
}]
}
>
<
Uploader
fileUpload
listType=
'picture-card'
onChange=
{
uploadSuccess
}
fileLength=
{
1
}
fileSize=
{
5
}
defaultFileList=
{
fileList
}
>
<
UploadOutlined
/>
</
Uploader
>
</
Form
.
Item
>
<
Form
.
Item
label=
'分类描述'
name=
'description'
>
<
Input
.
TextArea
placeholder=
'请输入分类描述'
rows=
{
4
}
maxLength=
{
70
}
showCount
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
};
export
default
AddOrEditCategoryModal
;
src/pages/categoryManage/categoryList/index.scss
0 → 100644
浏览文件 @
19dc54e9
.category-list
{
&
-row-bg
{
td
{
background-color
:
rgba
(
$color
:
#000000
,
$alpha
:
0
.1
)
!
important
;
}
}
}
src/pages/categoryManage/categoryList/index.tsx
0 → 100644
浏览文件 @
19dc54e9
差异被折叠。
点击展开。
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/baseInfo/index.tsx
浏览文件 @
19dc54e9
import
{
Button
,
Cascader
,
Form
,
Input
,
Radio
,
Select
}
from
'antd'
;
import
{
Button
,
Cascader
,
Form
,
Input
,
Radio
,
Select
}
from
'antd'
;
import
{
Uploader
}
from
'~/components/uploader'
;
import
{
Uploader
}
from
'~/components/uploader'
;
import
type
{
RadioChangeEvent
}
from
'antd'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
categoryListRespType
}
from
'~/api/interface/categoryManage'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
//分类返回类型
type
categoryType
=
InterDataType
<
categoryListRespType
>
[
'list'
];
interface
selfProps
{
ref
:
any
;
}
//基本信息表单类型
export
type
baseInfoType
=
{
tradeName
:
string
;
description
:
string
;
mainImgList
:
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[];
subImgList
:
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[];
videoList
:
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[];
categoryId
:
number
[];
shelfStatus
:
number
;
labelShow
:
number
;
goodsLabel
:
string
;
};
const
BaseInfo
=
forwardRef
<
any
,
selfProps
>
((
_props
,
ref
)
=>
{
const
[
baseInfoForm
]
=
Form
.
useForm
<
baseInfoType
>
();
const
[
labelShow
,
setLabelShow
]
=
useState
<
boolean
>
(
false
);
//分类列表
const
[
categoryList
,
setCategoryList
]
=
useState
<
categoryType
>
([]);
//主图
const
[
mainFileList
,
setMainFileList
]
=
useState
<
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[]
>
([]);
//副图
const
[
subFileList
,
setSubFileList
]
=
useState
<
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[]
>
([]);
//视频
const
[
videoFileList
,
setVideoFileList
]
=
useState
<
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[]
>
([]);
useImperativeHandle
(
ref
,
()
=>
({
getForm
:
()
=>
baseInfoForm
,
}));
//标签选中监听
const
labelRadioChange
=
(
e
:
RadioChangeEvent
)
=>
{
setLabelShow
(
!!
e
.
target
.
value
);
};
//上传结果
const
uploadSuccess
=
(
fileList
:
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[],
type
:
string
,
)
=>
{
switch
(
type
)
{
case
'mainImgList'
:
setMainFileList
(
fileList
);
baseInfoForm
.
setFieldValue
(
'mainImgList'
,
fileList
);
break
;
case
'subImgList'
:
setSubFileList
(
fileList
);
baseInfoForm
.
setFieldValue
(
'subImgList'
,
fileList
);
break
;
case
'videoList'
:
setVideoFileList
(
fileList
);
baseInfoForm
.
setFieldValue
(
'videoList'
,
fileList
);
break
;
default
:
break
;
}
};
//分类列表
const
getCategoryList
=
()
=>
{
CategoryManageAPI
.
getCategoryRespList
({
pageNo
:
1
,
pageSize
:
99999
}).
then
(({
result
})
=>
{
setCategoryList
(
result
.
list
||
[]);
});
};
useEffect
(()
=>
{
getCategoryList
();
},
[]);
const
BaseInfo
=
()
=>
{
const
[
baseInfoForm
]
=
Form
.
useForm
();
return
(
return
(
<
div
className=
'base-info'
>
<
div
className=
'base-info'
>
<
Form
labelCol=
{
{
span
:
1
}
}
wrapperCol=
{
{
span
:
8
}
}
form=
{
baseInfoForm
}
>
<
Form
<
Form
.
Item
label=
'商品名称'
>
labelCol=
{
{
span
:
2
}
}
wrapperCol=
{
{
span
:
8
}
}
form=
{
baseInfoForm
}
initialValues=
{
{
labelShow
:
0
,
shelfStatus
:
1
}
}
>
<
Form
.
Item
label=
'商品名称'
name=
'tradeName'
rules=
{
[{
required
:
true
,
message
:
'请输入商品名称'
}]
}
>
<
Input
placeholder=
'请输入商品名称'
/>
<
Input
placeholder=
'请输入商品名称'
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
'商品描述'
>
<
Form
.
Item
label=
'商品描述'
name=
'description'
>
<
Input
.
TextArea
rows=
{
4
}
placeholder=
'请输入商品描述'
/>
<
Input
.
TextArea
rows=
{
4
}
placeholder=
'请输入商品描述'
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
'商品主图'
>
<
Form
.
Item
<
Uploader
fileUpload
listType=
'picture-card'
>
label=
'商品主图'
name=
'mainImgList'
rules=
{
[{
required
:
true
,
message
:
'请上传商品主图'
}]
}
>
<
Uploader
fileUpload
listType=
'picture-card'
onChange=
{
(
fileList
)
=>
uploadSuccess
(
fileList
,
'mainImgList'
)
}
defaultFileList=
{
mainFileList
}
>
<
UploadOutlined
/>
<
UploadOutlined
/>
</
Uploader
>
</
Uploader
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
'商品副图'
>
<
Form
.
Item
label=
'商品副图'
name=
'subImgList'
>
<
Uploader
fileUpload
listType=
'picture-card'
>
<
Uploader
fileUpload
listType=
'picture-card'
onChange=
{
(
fileList
)
=>
uploadSuccess
(
fileList
,
'subImgList'
)
}
defaultFileList=
{
subFileList
}
>
<
UploadOutlined
/>
<
UploadOutlined
/>
</
Uploader
>
</
Uploader
>
</
Form
.
Item
>
{
' '
}
</
Form
.
Item
>
<
Form
.
Item
label=
'商品视频'
>
<
Form
.
Item
label=
'商品视频'
name=
'videoList'
>
<
Uploader
fileUpload
listType=
'text'
>
<
Uploader
fileUpload
listType=
'text'
onChange=
{
(
fileList
)
=>
uploadSuccess
(
fileList
,
'videoList'
)
}
defaultFileList=
{
videoFileList
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
上传视频
</
Button
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
上传视频
</
Button
>
</
Uploader
>
</
Uploader
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
'商品分类'
>
<
Form
.
Item
<
Cascader
placeholder=
'请选择商品分类'
/>
label=
'商品分类'
name=
'categoryId'
rules=
{
[{
required
:
true
,
message
:
'请选择商品分类'
}]
}
>
<
Cascader
placeholder=
'请选择商品分类'
options=
{
categoryList
}
fieldNames=
{
{
label
:
'name'
,
value
:
'id'
,
children
:
'subDTOList'
}
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
'商品状态'
>
<
Form
.
Item
label=
'商品状态'
name=
'shelfStatus'
rules=
{
[{
required
:
true
,
message
:
'请选择商品状态'
}]
}
>
<
Select
placeholder=
'请选择商品状态'
>
<
Select
placeholder=
'请选择商品状态'
>
<
Select
.
Option
>
上架
</
Select
.
Option
>
<
Select
.
Option
value=
{
1
}
>
上架
</
Select
.
Option
>
<
Select
.
Option
>
下架
</
Select
.
Option
>
<
Select
.
Option
value=
{
0
}
>
下架
</
Select
.
Option
>
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
'
商品标签
'
>
<
Form
.
Item
label=
'
显示标签'
name=
'labelShow
'
>
<
Radio
.
Group
>
<
Radio
.
Group
onChange=
{
labelRadioChange
}
>
<
Radio
value=
{
1
}
>
显示
</
Radio
>
<
Radio
value=
{
1
}
>
显示
</
Radio
>
<
Radio
value=
{
0
}
>
不显示
</
Radio
>
<
Radio
value=
{
0
}
>
不显示
</
Radio
>
</
Radio
.
Group
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
.
Item
>
{
labelShow
?
(
<
Form
.
Item
label=
'商品标签'
name=
'goodsLabel'
rules=
{
[{
required
:
true
,
message
:
'请输入商品标签'
}]
}
>
<
Input
placeholder=
'请输入商品标签'
/>
</
Form
.
Item
>
)
:
(
''
)
}
</
Form
>
</
Form
>
</
div
>
</
div
>
);
);
};
}
)
;
export
default
BaseInfo
;
export
default
BaseInfo
;
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/skuAddOrEditModal/index.tsx
浏览文件 @
19dc54e9
差异被折叠。
点击展开。
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/skuInfo/index.tsx
浏览文件 @
19dc54e9
import
{
Button
,
Table
}
from
'antd'
;
import
{
Button
,
Popconfirm
,
Table
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
FC
}
from
'react'
;
import
{
FC
}
from
'react'
;
import
{
InterDataType
,
InterReqType
}
from
'~/api/interface'
;
import
{
addMallGoodsType
,
skuUnitType
}
from
'~/api/interface/goodsType'
;
//商品sku规格类型
type
goodsSpecType
=
InterReqType
<
addMallGoodsType
>
[
'goodsSpecList'
][
0
];
//单位返回类型
type
unitType
=
InterDataType
<
skuUnitType
>
;
interface
selfProps
{
interface
selfProps
{
addOrEditSkuClick
:
()
=>
void
;
addOrEditSkuClick
:
()
=>
void
;
skuTableData
:
goodsSpecType
[];
skuUnitList
:
unitType
;
deleteSkuClick
:
(
record
:
goodsSpecType
)
=>
void
;
editSkuClick
:
(
record
:
goodsSpecType
)
=>
void
;
}
}
const
SkuInfo
:
FC
<
selfProps
>
=
({
addOrEditSkuClick
})
=>
{
const
SkuInfo
:
FC
<
selfProps
>
=
({
const
TableColumns
:
ColumnsType
<
any
>
=
[
addOrEditSkuClick
,
skuTableData
,
skuUnitList
,
deleteSkuClick
,
editSkuClick
,
})
=>
{
const
tableColumns
:
ColumnsType
<
goodsSpecType
>
=
[
{
{
title
:
'序号'
,
title
:
'序号'
,
align
:
'center'
,
align
:
'center'
,
render
:
(
_text
:
string
,
_record
,
index
:
number
)
=>
index
+
1
,
},
},
{
{
title
:
'规格名称'
,
title
:
'规格名称'
,
align
:
'center'
,
align
:
'center'
,
dataIndex
:
'specName'
,
},
},
{
{
title
:
'选择方式'
,
title
:
'选择方式'
,
align
:
'center'
,
align
:
'center'
,
dataIndex
:
'chooseType'
,
render
:
(
text
:
number
)
=>
(
text
?
'多选'
:
'单选'
),
},
},
{
{
title
:
'是否必选'
,
title
:
'是否必选'
,
align
:
'center'
,
align
:
'center'
,
dataIndex
:
'must'
,
render
:
(
text
:
number
)
=>
(
text
?
'必选'
:
'非必选'
),
},
},
{
{
title
:
'规格单位'
,
title
:
'规格单位'
,
align
:
'center'
,
align
:
'center'
,
dataIndex
:
'skuUnitId'
,
render
:
(
text
:
number
)
=>
skuUnitList
.
find
((
v
)
=>
v
.
id
===
text
)?.
unitName
||
''
,
},
},
{
{
title
:
'操作'
,
title
:
'操作'
,
align
:
'center'
,
align
:
'center'
,
render
:
(
_text
:
string
,
record
)
=>
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
editSkuClick
(
record
)
}
>
编辑
</
Button
>
<
Popconfirm
placement=
'topLeft'
title=
{
'删除规格'
}
description=
{
'确认删除该规格吗?'
}
onConfirm=
{
()
=>
deleteSkuClick
(
record
)
}
okText=
'确定'
cancelText=
'取消'
>
<
Button
type=
'link'
danger
>
删除
</
Button
>
</
Popconfirm
>
</>
),
},
},
];
];
return
(
return
(
<
div
className=
'sku-info'
>
<
div
className=
'sku-info'
>
<
div
className=
'sku-info-operate'
style=
{
{
margin
:
' 20px 0 '
}
}
>
<
div
className=
'sku-info-operate'
style=
{
{
margin
:
' 20px 0 '
}
}
>
...
@@ -45,7 +89,7 @@ const SkuInfo: FC<selfProps> = ({ addOrEditSkuClick }) => {
...
@@ -45,7 +89,7 @@ const SkuInfo: FC<selfProps> = ({ addOrEditSkuClick }) => {
添加规格
添加规格
</
Button
>
</
Button
>
</
div
>
</
div
>
<
Table
bordered
columns=
{
TableColumns
}
/>
<
Table
bordered
columns=
{
tableColumns
}
dataSource=
{
skuTableData
}
rowKey=
'id'
/>
</
div
>
</
div
>
);
);
};
};
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
浏览文件 @
19dc54e9
import
{
Button
,
Tabs
,
TabsProps
}
from
'antd'
;
import
{
Button
,
message
,
Tabs
,
TabsProps
}
from
'antd'
;
import
{
useState
}
from
'react'
;
import
{
use
Effect
,
useRef
,
use
State
}
from
'react'
;
import
BaseInfo
from
'./components/baseInfo'
;
import
BaseInfo
from
'./components/baseInfo'
;
import
SkuInfo
from
'./components/skuInfo'
;
import
SkuInfo
from
'./components/skuInfo'
;
import
IntroduceInfo
from
'./components/introduceInfo'
;
import
IntroduceInfo
from
'./components/introduceInfo'
;
import
SkuAddOrEditModal
from
'./components/skuAddOrEditModal'
;
import
SkuAddOrEditModal
from
'./components/skuAddOrEditModal'
;
import
'./index.scss'
;
import
'./index.scss'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
baseInfoType
}
from
'./components/baseInfo'
;
import
{
InterDataType
,
InterReqType
}
from
'~/api/interface'
;
import
{
addMallGoodsType
,
skuUnitType
}
from
'~/api/interface/goodsType'
;
import
GoodsAPI
from
'~/api/modules/goodsAPI'
;
//商品sku规格类型
type
goodsSpecType
=
InterReqType
<
addMallGoodsType
>
[
'goodsSpecList'
][
0
];
//单位返回类型
type
unitType
=
InterDataType
<
skuUnitType
>
;
const
GoodsAddOrEditOrDetail
=
()
=>
{
const
GoodsAddOrEditOrDetail
=
()
=>
{
const
baseInfoRef
=
useRef
<
any
>
();
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
//单位列表
const
[
skuUnitList
,
setSkuUnitList
]
=
useState
<
unitType
>
([]);
const
[
tabSelectKeys
,
setTabSelectKeys
]
=
useState
<
string
>
(
'1'
);
const
[
tabSelectKeys
,
setTabSelectKeys
]
=
useState
<
string
>
(
'1'
);
//新增、编辑sku弹窗
//新增、编辑sku弹窗
const
[
addOrEditSkuModalShow
,
setAddOrEditSkuModalShow
]
=
useState
<
boolean
>
(
false
);
const
[
addOrEditSkuModalShow
,
setAddOrEditSkuModalShow
]
=
useState
<
boolean
>
(
false
);
//当前编辑sku
const
[
currentSku
,
setCurrentSku
]
=
useState
<
goodsSpecType
>
();
//基本信息暂存
const
[
baseInfo
,
setBaseInfo
]
=
useState
<
baseInfoType
>
();
//skuTable数据
const
[
skuTable
,
setSkuTable
]
=
useState
<
goodsSpecType
[]
>
([]);
//新增、编辑sku弹窗显示
//新增、编辑sku弹窗显示
const
addOrEditSkuClick
=
()
=>
{
const
addOrEditSkuClick
=
(
record
?:
goodsSpecType
)
=>
{
setCurrentSku
(
record
?
{
...
record
}
:
undefined
);
setAddOrEditSkuModalShow
(
true
);
setAddOrEditSkuModalShow
(
true
);
};
};
const
addOrEditSkuModalCancel
=
()
=>
{
const
addOrEditSkuModalCancel
=
()
=>
{
setAddOrEditSkuModalShow
(
false
);
setAddOrEditSkuModalShow
(
false
);
};
};
//tab 切换
const
addOrEditSkuModalOk
=
(
values
:
goodsSpecType
)
=>
{
const
tabSelectChange
=
(
key
:
string
)
=>
{
setAddOrEditSkuModalShow
(
false
);
setTabSelectKeys
(
key
);
const
skuTableIndex
:
number
=
skuTable
.
findIndex
((
v
)
=>
v
.
id
===
values
.
id
);
};
if
(
skuTableIndex
!==
-
1
)
{
//下一步
skuTable
.
splice
(
skuTableIndex
,
1
,
values
);
const
toNextStep
=
()
=>
{
setSkuTable
([...
skuTable
]);
setTabSelectKeys
((
Number
(
tabSelectKeys
)
+
1
).
toString
());
}
else
{
};
setSkuTable
([...
skuTable
,
{
...
values
}]);
//上一步
}
const
toBackStep
=
()
=>
{
setTabSelectKeys
((
Number
(
tabSelectKeys
)
-
1
).
toString
());
};
};
const
backRoute
=
()
=>
{
//sku删除
navigate
(
-
1
);
const
deleteSkuClick
=
(
record
:
goodsSpecType
)
=>
{
const
skuIndex
:
number
=
skuTable
.
findIndex
((
v
)
=>
v
.
id
===
record
.
id
);
skuTable
.
splice
(
skuIndex
,
1
);
setSkuTable
([...
skuTable
]);
};
};
const
TabItems
:
TabsProps
[
'items'
]
=
[
const
tabItems
:
TabsProps
[
'items'
]
=
[
{
{
key
:
'1'
,
key
:
'1'
,
label
:
`基础信息`
,
label
:
`基础信息`
,
children
:
<
BaseInfo
/>,
children
:
<
BaseInfo
ref=
{
baseInfoRef
}
/>,
},
},
{
{
key
:
'2'
,
key
:
'2'
,
label
:
`商品规格`
,
label
:
`商品规格`
,
children
:
<
SkuInfo
addOrEditSkuClick=
{
addOrEditSkuClick
}
/>,
children
:
(
<
SkuInfo
addOrEditSkuClick=
{
addOrEditSkuClick
}
skuTableData=
{
skuTable
}
skuUnitList=
{
skuUnitList
}
deleteSkuClick=
{
deleteSkuClick
}
editSkuClick=
{
addOrEditSkuClick
}
/>
),
},
},
{
{
key
:
'3'
,
key
:
'3'
,
...
@@ -52,9 +82,60 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -52,9 +82,60 @@ const GoodsAddOrEditOrDetail = () => {
children
:
<
IntroduceInfo
/>,
children
:
<
IntroduceInfo
/>,
},
},
];
];
//tab 切换
const
tabSelectChange
=
(
key
:
string
)
=>
{
setTabSelectKeys
(
key
);
};
//下一步
const
toNextStep
=
()
=>
{
switch
(
tabSelectKeys
)
{
case
'1'
:
baseInfoRef
.
current
.
getForm
()
.
validateFields
()
.
then
((
value
:
baseInfoType
)
=>
{
setBaseInfo
(
value
);
setTabSelectKeys
((
Number
(
tabSelectKeys
)
+
1
).
toString
());
})
.
catch
((
error
:
any
)
=>
{
message
.
error
(
error
.
errorFields
[
0
].
errors
[
0
]);
});
break
;
case
'2'
:
if
(
skuTable
.
length
)
{
setTabSelectKeys
((
Number
(
tabSelectKeys
)
+
1
).
toString
());
}
else
{
message
.
warning
(
'请添加规格'
);
}
break
;
case
'3'
:
break
;
default
:
break
;
}
};
//上一步
const
toBackStep
=
()
=>
{
setTabSelectKeys
((
Number
(
tabSelectKeys
)
-
1
).
toString
());
};
const
backRoute
=
()
=>
{
navigate
(
-
1
);
};
//单位列表
const
getSkuUnit
=
()
=>
{
GoodsAPI
.
getSkuUnit
().
then
(({
result
})
=>
{
setSkuUnitList
(
result
||
[]);
});
};
useEffect
(()
=>
{
getSkuUnit
();
},
[]);
return
(
return
(
<
div
className=
'goods-operate-wrap'
>
<
div
className=
'goods-operate-wrap'
>
<
Tabs
items=
{
T
abItems
}
activeKey=
{
tabSelectKeys
}
onChange=
{
tabSelectChange
}
></
Tabs
>
<
Tabs
items=
{
t
abItems
}
activeKey=
{
tabSelectKeys
}
onChange=
{
tabSelectChange
}
></
Tabs
>
<
div
className=
'next-step'
>
<
div
className=
'next-step'
>
{
tabSelectKeys
!==
'1'
?
<
Button
onClick=
{
toBackStep
}
>
上一步
</
Button
>
:
''
}
{
tabSelectKeys
!==
'1'
?
<
Button
onClick=
{
toBackStep
}
>
上一步
</
Button
>
:
''
}
{
tabSelectKeys
!==
'3'
?
(
{
tabSelectKeys
!==
'3'
?
(
...
@@ -71,7 +152,13 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -71,7 +152,13 @@ const GoodsAddOrEditOrDetail = () => {
</
Button
>
</
Button
>
</
div
>
</
div
>
{
/*新增、编辑sku弹窗*/
}
{
/*新增、编辑sku弹窗*/
}
<
SkuAddOrEditModal
open=
{
addOrEditSkuModalShow
}
onCancel=
{
addOrEditSkuModalCancel
}
/>
<
SkuAddOrEditModal
open=
{
addOrEditSkuModalShow
}
onCancel=
{
addOrEditSkuModalCancel
}
onOk=
{
addOrEditSkuModalOk
}
skuUnitList=
{
skuUnitList
}
currentSku=
{
currentSku
}
/>
</
div
>
</
div
>
);
);
};
};
...
...
src/pages/systemManage/companyManage/companyDetail/index.tsx
0 → 100644
浏览文件 @
19dc54e9
import
{
useSearchParams
}
from
'react-router-dom'
;
import
{
useEffect
,
useState
}
from
'react'
;
const
CompanyDetail
=
()
=>
{
const
[
searchParams
]
=
useSearchParams
();
const
[
companyId
,
setCompanyId
]
=
useState
<
number
>
(
-
1
);
useEffect
(()
=>
{
setCompanyId
(
Number
(
searchParams
.
get
(
'id'
)));
},
[]);
return
<
div
className=
'company-detail'
>
单位详情
</
div
>;
};
export
default
CompanyDetail
;
src/pages/systemManage/companyManage/comp/addEditModal/index.tsx
→
src/pages/systemManage/companyManage/comp
anyList/comp
/addEditModal/index.tsx
浏览文件 @
19dc54e9
File moved
src/pages/systemManage/companyManage/index.tsx
→
src/pages/systemManage/companyManage/
companyList/
index.tsx
浏览文件 @
19dc54e9
...
@@ -6,6 +6,7 @@ import { InterListType, InterReqType } from '~/api/interface';
...
@@ -6,6 +6,7 @@ import { InterListType, InterReqType } from '~/api/interface';
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
SystemManageAPI
}
from
'~/api'
;
import
{
SystemManageAPI
}
from
'~/api'
;
import
{
listCompanyPage
}
from
'~/api/interface/systemManageType'
;
import
{
listCompanyPage
}
from
'~/api/interface/systemManageType'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
AddEditModal
from
'./comp/addEditModal'
;
import
AddEditModal
from
'./comp/addEditModal'
;
// 列表的数据类型
// 列表的数据类型
...
@@ -16,6 +17,7 @@ type ReqType = InterReqType<listCompanyPage>;
...
@@ -16,6 +17,7 @@ type ReqType = InterReqType<listCompanyPage>;
let
query
:
ReqType
=
{};
let
query
:
ReqType
=
{};
const
CompanyManageView
=
()
=>
{
const
CompanyManageView
=
()
=>
{
const
navigate
=
useNavigate
();
const
{
confirm
}
=
Modal
;
const
{
confirm
}
=
Modal
;
// 新增编辑弹窗是否开启
// 新增编辑弹窗是否开启
const
[
addEditModalVisible
,
setAddEditModalVisible
]
=
useState
(
false
);
const
[
addEditModalVisible
,
setAddEditModalVisible
]
=
useState
(
false
);
...
@@ -77,6 +79,14 @@ const CompanyManageView = () => {
...
@@ -77,6 +79,14 @@ const CompanyManageView = () => {
},
},
});
});
};
};
//跳转单位详情
const
toCompanyDetail
=
(
record
:
TableType
[
0
])
=>
{
navigate
({
pathname
:
'/systemManage/companyDetail'
,
search
:
`id=
${
record
.
id
}
`
,
});
};
// componentDidMount
// componentDidMount
useEffect
(()
=>
{
useEffect
(()
=>
{
query
=
{};
query
=
{};
...
@@ -88,17 +98,11 @@ const CompanyManageView = () => {
...
@@ -88,17 +98,11 @@ const CompanyManageView = () => {
title
:
'单位名称'
,
title
:
'单位名称'
,
dataIndex
:
'companyName'
,
dataIndex
:
'companyName'
,
align
:
'center'
,
align
:
'center'
,
width
:
'
150px
'
,
width
:
'
20%
'
,
fixed
:
'left'
,
fixed
:
'left'
,
ellipsis
:
true
,
ellipsis
:
true
,
},
},
{
{
title
:
'行政区划'
,
dataIndex
:
'province'
,
align
:
'center'
,
render
:
(
_value
,
record
)
=>
`
${
record
.
province
}
/
${
record
.
city
}
/
${
record
.
district
}
`
,
},
{
title
:
'详细地址'
,
title
:
'详细地址'
,
dataIndex
:
'address'
,
dataIndex
:
'address'
,
align
:
'center'
,
align
:
'center'
,
...
@@ -117,7 +121,7 @@ const CompanyManageView = () => {
...
@@ -117,7 +121,7 @@ const CompanyManageView = () => {
},
},
{
{
title
:
'操作'
,
title
:
'操作'
,
width
:
'
100px
'
,
width
:
'
20%
'
,
fixed
:
'right'
,
fixed
:
'right'
,
align
:
'center'
,
align
:
'center'
,
render
:
(
_text
,
record
)
=>
(
render
:
(
_text
,
record
)
=>
(
...
@@ -131,6 +135,9 @@ const CompanyManageView = () => {
...
@@ -131,6 +135,9 @@ const CompanyManageView = () => {
>
>
变更
变更
</
Button
>
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
toCompanyDetail
(
record
)
}
>
详情
</
Button
>
<
Button
<
Button
type=
'link'
type=
'link'
danger
danger
...
...
src/router/index.ts
浏览文件 @
19dc54e9
...
@@ -3,7 +3,6 @@ import { RouteObjectType, routerList } from '~/router/router';
...
@@ -3,7 +3,6 @@ import { RouteObjectType, routerList } from '~/router/router';
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
listMenuInfoType
}
from
'~/api/interface/systemManageType'
;
import
{
listMenuInfoType
}
from
'~/api/interface/systemManageType'
;
import
{
SystemManageAPI
}
from
'~/api'
;
import
{
SystemManageAPI
}
from
'~/api'
;
import
Cookies
from
'js-cookie'
;
//菜单类型
//菜单类型
type
menuType
=
InterDataType
<
listMenuInfoType
>
;
type
menuType
=
InterDataType
<
listMenuInfoType
>
;
...
@@ -11,36 +10,33 @@ type menuType = InterDataType<listMenuInfoType>;
...
@@ -11,36 +10,33 @@ type menuType = InterDataType<listMenuInfoType>;
let
routerListStore
:
any
[]
=
[];
let
routerListStore
:
any
[]
=
[];
// 获取用户权限路由列表
// 获取用户权限路由列表
export
const
authRouterList
=
async
()
=>
{
export
const
authRouterList
=
async
()
=>
{
if
(
localStorage
.
getItem
(
'roleId'
)
&&
Cookies
.
get
(
'SHAREFLY-TOKEN'
))
{
// 如果缓存中没有数据
// 如果缓存中没有数据
if
(
routerListStore
.
length
===
0
)
{
if
(
routerListStore
.
length
===
0
)
{
// 加载路由数据
// 加载路由数据
const
{
result
}
=
await
SystemManageAPI
.
getListRoleMenuInfo
({
const
{
result
}
=
await
SystemManageAPI
.
getListRoleMenuInfo
({
roleId
:
Number
(
localStorage
.
getItem
(
'roleId'
)),
roleId
:
Number
(
localStorage
.
getItem
(
'roleId'
)),
});
});
const
ids
:
number
[]
=
getAllKeys
([
result
]);
const
ids
:
number
[]
=
getAllKeys
([
result
]);
const
getRouteList
=
(
data
:
RouteObjectType
[])
=>
{
const
getRouteList
=
(
data
:
RouteObjectType
[])
=>
{
return
data
.
reduce
((
pre
:
RouteObjectType
[],
cur
)
=>
{
return
data
.
reduce
((
pre
:
RouteObjectType
[],
cur
)
=>
{
const
Obj
:
RouteObjectType
=
{
...
cur
};
const
Obj
:
RouteObjectType
=
{
...
cur
};
if
(
ids
.
includes
(
Obj
.
meta
.
id
)
||
Obj
.
meta
.
hidden
)
{
if
(
ids
.
includes
(
Obj
.
meta
.
id
)
||
Obj
.
meta
.
hidden
)
{
if
(
Obj
.
children
)
{
if
(
Obj
.
children
)
{
Obj
.
children
=
[...
getRouteList
(
Obj
.
children
)];
Obj
.
children
=
[...
getRouteList
(
Obj
.
children
)];
}
pre
.
push
(
Obj
);
}
}
return
pre
;
pre
.
push
(
Obj
);
},
[]);
}
};
return
pre
;
const
arr
=
[...
getRouteList
(
routerList
)];
},
[]);
// 将路由数据存到store中
};
routerListStore
=
arr
;
const
arr
=
[...
getRouteList
(
routerList
)];
// 完成后返回路由数据
// 将路由数据存到store中
return
Promise
.
resolve
(
arr
);
routerListStore
=
arr
;
}
else
{
// 完成后返回路由数据
return
Promise
.
resolve
(
routerListStore
);
return
Promise
.
resolve
(
arr
);
}
}
else
{
return
Promise
.
resolve
(
routerListStore
);
}
}
return
Promise
.
resolve
([]);
};
};
//获取全部节点
//获取全部节点
const
getAllKeys
=
(
data
:
menuType
[])
=>
{
const
getAllKeys
=
(
data
:
menuType
[])
=>
{
...
...
src/router/privateRouter.tsx
浏览文件 @
19dc54e9
...
@@ -14,23 +14,29 @@ function PrivateRouter() {
...
@@ -14,23 +14,29 @@ function PrivateRouter() {
// TODO: 判断是否登录 (需要改为实时获取地址栏的路由)
// TODO: 判断是否登录 (需要改为实时获取地址栏的路由)
const
path
=
location
.
pathname
;
const
path
=
location
.
pathname
;
const
token
=
Cookies
.
get
(
'SHAREFLY-TOKEN'
);
const
token
=
Cookies
.
get
(
'SHAREFLY-TOKEN'
);
const
roleId
=
localStorage
.
getItem
(
'roleId'
);
if
(
!
token
&&
path
!==
'/login'
)
{
if
(
!
token
&&
path
!==
'/login'
)
{
navigate
(
'/login'
,
{
replace
:
true
});
navigate
(
'/login'
,
{
replace
:
true
});
return
;
return
;
}
}
if
(
roleId
&&
token
)
{
// 整合路由数据
authRouterList
().
then
((
value
)
=>
{
if
(
value
.
length
)
{
const
routes
=
[...
value
,
...
whiteRouterList
];
setRouter
(
routes
);
if
(
path
===
'/'
)
{
navigate
({
pathname
:
value
[
0
].
children
.
find
((
v
:
any
)
=>
!
v
.
meta
.
hidden
)?.
path
});
}
}
else
{
message
.
warning
(
'该账号暂无权限'
);
navigate
(
'/login'
,
{
replace
:
true
});
}
});
}
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
beforeEach
();
beforeEach
();
// 整合路由数据
authRouterList
().
then
((
value
)
=>
{
if
(
value
.
length
)
{
const
routes
=
[...
value
,
...
whiteRouterList
];
setRouter
(
routes
);
//不同账号登录时,重新更新路由(有瑕疵)
}
else
if
(
localStorage
.
getItem
(
'roleId'
))
{
message
.
warning
(
'该账号暂无权限'
);
navigate
(
'/login'
,
{
replace
:
true
});
}
});
},
[
location
.
pathname
]);
},
[
location
.
pathname
]);
return
useRoutes
(
router
);
return
useRoutes
(
router
);
...
...
src/router/router.tsx
浏览文件 @
19dc54e9
...
@@ -98,6 +98,7 @@ const ProduceDetailView = React.lazy(
...
@@ -98,6 +98,7 @@ const ProduceDetailView = React.lazy(
);
//产品详情
);
//产品详情
const
MakeListView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/makeManage/makeList'
));
const
MakeListView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/makeManage/makeList'
));
// 分类管理
// 分类管理
const
CategoryListView
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/categoryList'
));
const
CategoryManage
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/category'
));
const
CategoryManage
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/category'
));
const
CategoryDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/category/detail'
));
const
CategoryDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/category/detail'
));
// 目录管理
// 目录管理
...
@@ -119,7 +120,10 @@ import TenderManageDetail from '~/pages/resourceManage/tenderManage/detail';
...
@@ -119,7 +120,10 @@ import TenderManageDetail from '~/pages/resourceManage/tenderManage/detail';
import
TenderManageFeedback
from
'~/pages/resourceManage/tenderManage/feedback'
;
import
TenderManageFeedback
from
'~/pages/resourceManage/tenderManage/feedback'
;
import
BusinessCaseManage
from
'~/pages/resourceManage/businessCaseManage'
;
import
BusinessCaseManage
from
'~/pages/resourceManage/businessCaseManage'
;
import
CustomIdentityView
from
'~/pages/customManage/customIdentity'
;
import
CustomIdentityView
from
'~/pages/customManage/customIdentity'
;
import
CompanyManageView
from
'~/pages/systemManage/companyManage'
;
import
CompanyListView
from
'~/pages/systemManage/companyManage/companyList'
;
//单位列表
const
CompanyDetailView
=
React
.
lazy
(
()
=>
import
(
'~/pages/systemManage/companyManage/companyDetail'
),
);
import
AccountLimit
from
'~/pages/systemManage/limitManage/roleList'
;
//账号权限
import
AccountLimit
from
'~/pages/systemManage/limitManage/roleList'
;
//账号权限
import
LimitInfo
from
'~/pages/systemManage/limitManage/limitInfo'
;
import
LimitInfo
from
'~/pages/systemManage/limitManage/limitInfo'
;
import
CustomListDetail
from
'~/pages/customManage/customList/detail'
;
//权限信息
import
CustomListDetail
from
'~/pages/customManage/customList/detail'
;
//权限信息
...
@@ -647,76 +651,86 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -647,76 +651,86 @@ export const routerList: Array<RouteObjectType> = [
},
},
children
:
[
children
:
[
{
{
path
:
'/categoryManage/
jobServicesCategory/1
'
,
path
:
'/categoryManage/
categoryList
'
,
element
:
withLoadingComponent
(<
Category
Manage
/>),
element
:
withLoadingComponent
(<
Category
ListView
/>),
errorElement
:
<
ErrorPage
/>,
errorElement
:
<
ErrorPage
/>,
meta
:
{
meta
:
{
id
:
1210
,
id
:
1210
,
title
:
'
作业服务分类
'
,
title
:
'
分类列表
'
,
icon
:
<
SendOutlined
/>,
icon
:
<
SendOutlined
/>,
},
},
},
},
{
// {
path
:
'/categoryManage/jobServicesCategory/2'
,
// path: '/categoryManage/jobServicesCategory/1',
element
:
withLoadingComponent
(<
CategoryManage
/>),
// element: withLoadingComponent(<CategoryManage />),
errorElement
:
<
ErrorPage
/>,
// errorElement: <ErrorPage />,
meta
:
{
// meta: {
id
:
1220
,
// id: 1210,
title
:
'设备租赁分类'
,
// title: '作业服务分类',
icon
:
<
RocketOutlined
/>,
// icon: <SendOutlined />,
},
// },
},
// },
{
// {
path
:
'/categoryManage/jobServicesCategory/3'
,
// path: '/categoryManage/jobServicesCategory/2',
element
:
withLoadingComponent
(<
CategoryManage
/>),
// element: withLoadingComponent(<CategoryManage />),
errorElement
:
<
ErrorPage
/>,
// errorElement: <ErrorPage />,
meta
:
{
// meta: {
id
:
1230
,
// id: 1220,
title
:
'飞手培训分类'
,
// title: '设备租赁分类',
icon
:
<
AppstoreAddOutlined
/>,
// icon: <RocketOutlined />,
},
// },
},
// },
{
// {
path
:
'/categoryManage/jobServicesCategory/4'
,
// path: '/categoryManage/jobServicesCategory/3',
element
:
withLoadingComponent
(<
CategoryManage
/>),
// element: withLoadingComponent(<CategoryManage />),
errorElement
:
<
ErrorPage
/>,
// errorElement: <ErrorPage />,
meta
:
{
// meta: {
id
:
1240
,
// id: 1230,
title
:
'产品商城分类'
,
// title: '飞手培训分类',
icon
:
<
AppstoreOutlined
/>,
// icon: <AppstoreAddOutlined />,
},
// },
},
// },
{
// {
path
:
'/categoryManage/jobServicesCategory/0'
,
// path: '/categoryManage/jobServicesCategory/4',
element
:
withLoadingComponent
(<
CategoryManage
/>),
// element: withLoadingComponent(<CategoryManage />),
errorElement
:
<
ErrorPage
/>,
// errorElement: <ErrorPage />,
meta
:
{
// meta: {
id
:
1250
,
// id: 1240,
title
:
'通用分类'
,
// title: '产品商城分类',
icon
:
<
CoffeeOutlined
/>,
// icon: <AppstoreOutlined />,
},
// },
},
// },
{
// {
path
:
'/categoryManage/detail/:id'
,
// path: '/categoryManage/jobServicesCategory/0',
element
:
withLoadingComponent
(<
CategoryDetail
/>),
// element: withLoadingComponent(<CategoryManage />),
errorElement
:
<
ErrorPage
/>,
// errorElement: <ErrorPage />,
meta
:
{
// meta: {
id
:
18600
,
// id: 1250,
title
:
'分类详情'
,
// title: '通用分类',
icon
:
''
,
// icon: <CoffeeOutlined />,
hidden
:
true
,
// },
},
// },
},
// {
{
// path: '/categoryManage/detail/:id',
path
:
'/categoryManage/DirectoryManage'
,
// element: withLoadingComponent(<CategoryDetail />),
element
:
withLoadingComponent
(<
DirectoryManage
/>),
// errorElement: <ErrorPage />,
errorElement
:
<
ErrorPage
/>,
// meta: {
meta
:
{
// id: 18600,
id
:
1260
,
// title: '分类详情',
title
:
'目录管理'
,
// icon: '',
icon
:
<
UnorderedListOutlined
/>,
// hidden: true,
},
// },
},
// },
// {
// path: '/categoryManage/DirectoryManage',
// element: withLoadingComponent(<DirectoryManage />),
// errorElement: <ErrorPage />,
// meta: {
// id: 1260,
// title: '目录管理',
// icon: <UnorderedListOutlined />,
// },
// },
],
],
},
},
// {
// {
...
@@ -982,13 +996,24 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -982,13 +996,24 @@ export const routerList: Array<RouteObjectType> = [
},
},
},
},
{
{
path
:
'/systemManage/company
Manage
'
,
path
:
'/systemManage/company
List
'
,
element
:
withLoadingComponent
(<
Company
Manage
View
/>),
element
:
withLoadingComponent
(<
Company
List
View
/>),
errorElement
:
<
ErrorPage
/>,
errorElement
:
<
ErrorPage
/>,
meta
:
{
meta
:
{
id
:
1430
,
id
:
1430
,
title
:
'单位管理'
,
title
:
'单位列表'
,
icon
:
<
BankOutlined
/>,
},
},
{
path
:
'/systemManage/companyDetail'
,
element
:
withLoadingComponent
(<
CompanyDetailView
/>),
errorElement
:
<
ErrorPage
/>,
meta
:
{
id
:
1440
,
title
:
'单位详情'
,
icon
:
<
BankOutlined
/>,
icon
:
<
BankOutlined
/>,
hidden
:
true
,
},
},
},
},
],
],
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论