Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
795314ca
提交
795314ca
authored
8月 26, 2019
作者:
zhenxianyimeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
规格页面,列表
上级
37d85b37
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
216 行增加
和
10 行删除
+216
-10
router.config.js
admin-web/config/router.config.js
+5
-0
menu.js
admin-web/src/locales/zh-CN/menu.js
+2
-0
productAttrList.js
admin-web/src/models/product/productAttrList.js
+26
-2
ProductAttrList.js
admin-web/src/pages/Product/ProductAttrList.js
+158
-0
ProductAttrList.less
admin-web/src/pages/Product/ProductAttrList.less
+11
-0
product.js
admin-web/src/services/product.js
+9
-3
ProductAttrServiceImpl.java
.../iocoder/mall/product/service/ProductAttrServiceImpl.java
+1
-1
AdminController.java
.../admin/application/controller/admins/AdminController.java
+1
-1
DeptmentController.java
...min/application/controller/admins/DeptmentController.java
+3
-3
没有找到文件。
admin-web/config/router.config.js
浏览文件 @
795314ca
...
...
@@ -125,6 +125,11 @@ export default [
name
:
'product-brand-list'
,
component
:
'./Product/ProductBrandList'
,
},
{
path
:
'/product/product-attr-list'
,
name
:
'product-attr-list'
,
component
:
'./Product/ProductAttrList'
,
},
],
},
// promotion
...
...
admin-web/src/locales/zh-CN/menu.js
浏览文件 @
795314ca
...
...
@@ -52,6 +52,8 @@ export default {
'menu.product.product-spu-update'
:
'商品编辑'
,
'menu.product.product-category-list'
:
'商品分类'
,
'menu.product.product-brand-list'
:
'商品品牌'
,
'menu.product.product-attr-list'
:
'规格管理'
,
// 订单
'menu.order'
:
'订单管理'
,
'menu.order.order-list'
:
'订单管理'
,
...
...
admin-web/src/models/product/productAttrList.js
浏览文件 @
795314ca
import
{
message
}
from
'antd'
;
import
{
productAttrTree
,
productAttrValueAdd
}
from
'../../services/product'
;
import
{
productAttrTree
,
productAttrValueAdd
,
productAttrPage
}
from
'../../services/product'
;
import
PaginationHelper
from
'../../../helpers/PaginationHelper'
;
export
default
{
namespace
:
'productAttrList'
,
state
:
{
list
:
[],
attrData
:
[],
pagination
:
PaginationHelper
.
defaultPaginationConfig
,
},
effects
:
{
...
...
@@ -51,6 +54,21 @@ export default {
// });
// },
*
page
({
payload
},
{
call
,
put
})
{
const
result
=
yield
call
(
productAttrPage
,
payload
);
let
attrData
=
{};
if
(
result
.
code
===
0
)
{
attrData
=
result
.
data
;
}
yield
put
({
type
:
'save'
,
payload
:
{
attrData
,
pagination
:
PaginationHelper
.
formatPagination
(
attrData
,
payload
),
},
});
},
*
tree
({
payload
},
{
call
,
put
})
{
const
{
queryParams
}
=
payload
;
const
response
=
yield
call
(
productAttrTree
,
queryParams
);
...
...
@@ -84,10 +102,16 @@ export default {
callback
(
response
.
data
);
}
}
}
}
,
},
reducers
:
{
save
(
state
,
action
)
{
return
{
...
state
,
...
action
.
payload
,
};
},
treeSuccess
(
state
,
{
payload
})
{
return
{
...
state
,
...
...
admin-web/src/pages/Product/ProductAttrList.js
0 → 100644
浏览文件 @
795314ca
import
React
,
{
PureComponent
,
Fragment
,
Component
}
from
'react'
;
import
{
Form
,
Card
,
Table
,
Button
,
Divider
,
Modal
,
Input
}
from
'antd'
;
import
moment
from
'moment'
;
import
{
connect
}
from
'dva'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
PaginationHelper
from
'../../../helpers/PaginationHelper'
;
import
styles
from
'./ProductAttrList.less'
;
const
FormItem
=
Form
.
Item
;
const
CreateForm
=
Form
.
create
()(
props
=>
{
const
{
modalVisible
,
form
,
handleAdd
,
handleModalVisible
,
modalType
,
initValues
}
=
props
;
const
okHandle
=
()
=>
{
form
.
validateFields
((
err
,
fieldsValue
)
=>
{
if
(
err
)
return
;
let
pid
=
fieldsValue
.
pid
;
if
(
fieldsValue
.
pid
)
{
pid
=
pid
.
split
(
'-'
)[
1
];
fieldsValue
.
pid
=
pid
;
}
form
.
resetFields
();
handleAdd
({
fields
:
fieldsValue
,
modalType
,
initValues
,
});
});
};
const
selectStyle
=
{
width
:
200
,
};
function
onTypeChange
(
event
)
{
initValues
.
type
=
parseInt
(
event
.
target
.
value
);
}
const
title
=
modalType
===
'add'
?
'添加规格'
:
'编辑规格'
;
const
okText
=
modalType
===
'add'
?
'添加'
:
'编辑'
;
return
(
<
Modal
destroyOnClose
title
=
{
title
}
visible
=
{
modalVisible
}
onOk
=
{
okHandle
}
okText
=
{
okText
}
onCancel
=
{()
=>
handleModalVisible
()}
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"规格名称"
>
{
form
.
getFieldDecorator
(
'name'
,
{
initialValue
:
initValues
?
initValues
.
name
:
null
,
rules
:
[{
required
:
true
,
message
:
'请输入规格名称!'
,
min
:
2
}],
})(
<
Input
placeholder
=
"规格名称"
/>
)}
<
/FormItem
>
<
/Modal
>
);
});
@
connect
(({
productAttrList
,
loading
})
=>
({
productAttrList
,
attrData
:
productAttrList
.
attrData
,
loading
:
loading
.
models
.
productAttrList
,
}))
@
Form
.
create
()
export
default
class
ProductAttrList
extends
PureComponent
{
state
=
{
modalVisible
:
false
,
modalType
:
'add'
,
//add or update
initValues
:
{},
};
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'productAttrList/page'
,
payload
:
{
...
PaginationHelper
.
defaultPayload
,
},
});
}
handleModalVisible
=
(
flag
,
modalType
,
initValues
)
=>
{
this
.
setState
({
modalVisible
:
!!
flag
,
initValues
:
initValues
||
{},
modalType
:
modalType
||
'add'
,
});
};
render
()
{
const
{
attrData
,
productAttrList
,
loading
,
pagination
}
=
this
.
props
;
const
columns
=
[
{
title
:
'规格名称'
,
dataIndex
:
'name'
,
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
render
:
val
=>
<
span
>
{
val
===
1
?
'开启'
:
'禁用'
}
<
/span>
,
},
{
title
:
'创建时间'
,
dataIndex
:
'createTime'
,
sorter
:
true
,
render
:
val
=>
<
span
>
{
moment
(
val
).
format
(
'YYYY-MM-DD'
)}
<
/span>
,
},
{
title
:
'操作'
,
render
:
(
text
,
record
)
=>
(
<
Fragment
>
<
a
onClick
=
{()
=>
this
.
handleModalVisible
(
true
,
'update'
,
record
)}
>
编辑
<
/a
>
<
Divider
type
=
"vertical"
/>
<
a
className
=
{
styles
.
tableDelete
}
onClick
=
{()
=>
this
.
handleDelete
(
record
)}
>
删除
<
/a
>
<
/Fragment
>
),
},
];
const
{
modalVisible
,
modalType
,
initValues
}
=
this
.
state
;
const
parentMethods
=
{
handleAdd
:
this
.
handleAdd
,
handleModalVisible
:
this
.
handleModalVisible
,
modalType
,
initValues
,
};
return
(
<
PageHeaderWrapper
>
<
Card
>
<
div
className
=
{
styles
.
tableList
}
>
<
div
className
=
{
styles
.
tableListOperator
}
>
<
Button
icon
=
"plus"
type
=
"primary"
onClick
=
{()
=>
this
.
handleModalVisible
(
true
,
'add'
,
{})}
>
新建规格
<
/Button
>
<
/div
>
<
/div
>
<
Table
defaultExpandAllRows
=
{
true
}
columns
=
{
columns
}
dataSource
=
{
attrData
.
attrs
?
attrData
.
attrs
:
[]}
rowKey
=
"id"
loading
=
{
loading
}
pagination
=
{
pagination
}
/
>
<
/Card
>
{
modalVisible
?
<
CreateForm
{...
parentMethods
}
modalVisible
=
{
modalVisible
}
/> : null
}
<
/PageHeaderWrapper
>
);
}
}
admin-web/src/pages/Product/ProductAttrList.less
0 → 100644
浏览文件 @
795314ca
@import '~antd/lib/style/themes/default.less';
@import '~@/utils/utils.less';
.tableList {
.tableListOperator {
margin-bottom: 16px;
button {
margin-right: 8px;
}
}
}
admin-web/src/services/product.js
浏览文件 @
795314ca
...
...
@@ -85,6 +85,12 @@ export async function productSpuInfo(params) {
// product attr + attr value
export
async
function
productAttrPage
(
params
)
{
return
request
(
`/product-api/admins/attr/page?
${
stringify
(
params
)}
`
,
{
method
:
'GET'
,
});
}
export
async
function
productAttrTree
(
params
)
{
return
request
(
`/product-api/admins/attr/tree?
${
stringify
(
params
)}
`
,
{
method
:
'GET'
,
...
...
@@ -98,7 +104,7 @@ export async function productAttrValueAdd(params) {
});
}
// product brand 2019-05-31
// product brand 2019-05-31
export
async
function
productBrandAdd
(
params
)
{
return
request
(
`/product-api/admins/brand/add?
${
stringify
(
params
)}
`
,
{
...
...
@@ -116,12 +122,12 @@ export async function productBrandUpdate(params) {
export
async
function
productBrandGet
(
params
)
{
return
request
(
`/product-api/admins/brand/get?
${
stringify
(
params
)}
`
,
{
method
:
'GET'
method
:
'GET'
,
});
}
export
async
function
productBrandPage
(
params
)
{
return
request
(
`/product-api/admins/brand/page?
${
stringify
(
params
)}
`
,
{
method
:
'GET'
method
:
'GET'
,
});
}
product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java
浏览文件 @
795314ca
...
...
@@ -72,7 +72,7 @@ public class ProductAttrServiceImpl implements ProductAttrService {
public
ProductAttrPageBO
getProductAttrPage
(
ProductAttrPageDTO
productAttrPageDTO
)
{
ProductAttrPageBO
productAttrPageBO
=
new
ProductAttrPageBO
();
// 查询分页数据
int
offset
=
productAttrPageDTO
.
getPageNo
(
)
*
productAttrPageDTO
.
getPageSize
();
int
offset
=
(
productAttrPageDTO
.
getPageNo
()-
1
)
*
productAttrPageDTO
.
getPageSize
();
productAttrPageBO
.
setAttrs
(
ProductAttrConvert
.
INSTANCE
.
convert
(
productAttrMapper
.
selectListByNameLike
(
productAttrPageDTO
.
getName
(),
offset
,
productAttrPageDTO
.
getPageSize
())));
// 查询分页总数
...
...
system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/AdminController.java
浏览文件 @
795314ca
...
...
@@ -91,7 +91,7 @@ public class AdminController {
}
// =========== 管理员管理 API ===========
//TODO 目前需要增加搜索所有子部门的用户
@GetMapping
(
"/page"
)
@RequiresPermissions
(
"system.admin.page"
)
@ApiOperation
(
value
=
"管理员分页"
)
...
...
system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/DeptmentController.java
浏览文件 @
795314ca
...
...
@@ -49,7 +49,7 @@ public class DeptmentController {
public
CommonResult
<
List
<
DeptmentVO
>>
treeAll
(){
List
<
DeptmentBO
>
list
=
deptmentService
.
getAllDeptments
();
List
<
DeptmentVO
>
voList
=
DeptmentConvert
.
INSTANCE
.
convert
(
list
);
Map
<
Integer
,
DeptmentVO
>
nodeMap
=
cal
a
NodeMap
(
voList
);
Map
<
Integer
,
DeptmentVO
>
nodeMap
=
cal
c
NodeMap
(
voList
);
// 获得到所有的根节点
List
<
DeptmentVO
>
rootNodes
=
nodeMap
.
values
().
stream
()
.
filter
(
node
->
node
.
getPid
().
equals
(
ResourceConstants
.
PID_ROOT
))
...
...
@@ -64,7 +64,7 @@ public class DeptmentController {
PageResult
<
DeptmentVO
>
voPageResult
=
DeptmentConvert
.
INSTANCE
.
convert
(
pageResult
);
List
<
DeptmentBO
>
list
=
deptmentService
.
getAllDeptments
();
List
<
DeptmentVO
>
voList
=
DeptmentConvert
.
INSTANCE
.
convert
(
list
);
Map
<
Integer
,
DeptmentVO
>
nodeMap
=
cal
a
NodeMap
(
voList
);
Map
<
Integer
,
DeptmentVO
>
nodeMap
=
cal
c
NodeMap
(
voList
);
voPageResult
.
getList
().
forEach
(
d
->{
d
.
setChildren
(
nodeMap
.
get
(
d
.
getId
()).
getChildren
());
});
...
...
@@ -97,7 +97,7 @@ public class DeptmentController {
));
}
private
Map
<
Integer
,
DeptmentVO
>
cal
a
NodeMap
(
List
<
DeptmentVO
>
voList
){
private
Map
<
Integer
,
DeptmentVO
>
cal
c
NodeMap
(
List
<
DeptmentVO
>
voList
){
Map
<
Integer
,
DeptmentVO
>
nodeMap
=
voList
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getId
(),
e
->
e
));
nodeMap
.
values
().
stream
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论