Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
4de334d3
Commit
4de334d3
authored
Dec 23, 2021
by
xiexiuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:商品货品按钮权限控制
parent
26b0f7ae
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
12 deletions
+33
-12
AuthUrl.ts
src/components/AuthButton/AuthUrl.ts
+1
-1
按钮状态.mad
src/components/AuthButton/按钮状态.mad
+6
-1
index.tsx
src/components/TableOperation/index.tsx
+12
-4
index.tsx
src/pages/commodity/products/index.tsx
+14
-6
No files found.
src/components/AuthButton/AuthUrl.ts
View file @
4de334d3
...
...
@@ -22,7 +22,7 @@ export const AuthUrl = (btnCode: string, menuCode: string) => {
}
}
}
//
console.log(AuthCode, 'AuthCode')
console
.
log
(
AuthCode
,
'AuthCode'
)
// 本地开发时传的特殊标识,直接开放权限
if
(
btnCode
===
'DevTest'
)
return
true
for
(
let
i
=
0
;
i
<
AuthCode
.
length
;
i
++
)
{
...
...
src/components/AuthButton/按钮状态.mad
View file @
4de334d3
// 价格
策略
// 价格
策略
...
...
@@ -10,3 +10,7 @@ goods.batch :'货品列表批量'
goods.see :'货品列表查看'
goods.del :'货品列表删除'
goods.edit :'货品列表修改'
// 商品
products.add :'商品新曾'
products.batch:'商品批量操作'
products.copy:'商品拷贝'
\ No newline at end of file
src/components/TableOperation/index.tsx
View file @
4de334d3
...
...
@@ -2,6 +2,8 @@ import React from 'react'
import
{
Button
,
Dropdown
,
Menu
}
from
'antd'
import
{
CaretDownOutlined
}
from
'@ant-design/icons'
import
{
getIntl
}
from
'umi'
;
import
AuthButton
from
'@/components/AuthButton'
import
{
AuthUrl
}
from
'@/components/AuthButton/AuthUrl'
const
intl
=
getIntl
();
/**
* 表格行操作
...
...
@@ -18,34 +20,40 @@ export interface TableOperationProps {
operationHandler
:
IOperationHandler
,
}
const
TableOperation
:
React
.
FC
<
TableOperationProps
>
=
(
props
)
=>
{
const
TableOperation
:
React
.
FC
<
TableOperationProps
>
=
(
props
)
=>
{
const
{
buttonTextFieldMap
,
operationHandler
}
=
props
// btnCode: 'products.add'
const
keyNames
=
Object
.
keys
(
buttonTextFieldMap
)
console
.
log
(
keyNames
,
'operationHandler'
,
operationHandler
)
return
(<>
{
Object
.
values
(
buttonTextFieldMap
).
filter
(
Boolean
).
length
>
2
?
<>
<
AuthButton
btnCode=
'products.copy'
menuCode=
'commodityAbility'
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
keyNames
[
0
]]
}
>
{
keyNames
[
0
]
}
</
Button
>
</
AuthButton
>
<
Dropdown
overlay=
{
<
Menu
>
{
keyNames
.
slice
(
1
,
keyNames
.
length
).
map
((
item
,
i
)
=>
buttonTextFieldMap
[
item
]
?
(
<
Menu
.
Item
key=
{
`menuItem${i}`
}
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
item
]
}
>
{
item
}
</
Button
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
item
]
}
>
{
item
}
</
Button
>
</
Menu
.
Item
>
)
:
null
)
}
</
Menu
>
}
>
<
a
className=
"ant-dropdown-link"
onClick=
{
e
=>
e
.
preventDefault
()
}
>
{
intl
.
formatMessage
({
id
:
'components.gengduo'
})
}
<
CaretDownOutlined
/>
{
intl
.
formatMessage
({
id
:
'components.gengduo'
})
}
<
CaretDownOutlined
/>
</
a
>
</
Dropdown
>
</>
:
keyNames
.
map
((
item
,
i
)
=>
(
buttonTextFieldMap
[
item
]
?
<
Button
key=
{
`btnItem${i}`
}
type=
'link'
onClick=
{
operationHandler
[
item
]
}
>
{
item
}
</
Button
>
:
null
))
keyNames
.
map
((
item
,
i
)
=>
(
buttonTextFieldMap
[
item
]
?
<
Button
key=
{
`btnItem${i}`
}
type=
'link'
onClick=
{
operationHandler
[
item
]
}
>
{
item
}
</
Button
>
:
null
))
}
</>)
}
...
...
src/pages/commodity/products/index.tsx
View file @
4de334d3
...
...
@@ -34,6 +34,8 @@ import { getProductCommodityGetCommodityList, getProductCommodityGetShop, GetPro
import
{
getTemplateWebMemberShopWebFindCurrMemberShop
}
from
'@/services/TemplateV2Api'
import
PutawayGuide
from
'./components/putawayGuide'
import
{
useRowSelectionTable
,
useRowSelectionTableCtl
}
from
'@/hooks/useRowSelectionTable'
import
AuthButton
from
'@/components/AuthButton'
import
{
AuthUrl
}
from
'@/components/AuthButton/AuthUrl'
const
{
confirm
}
=
Modal
;
...
...
@@ -501,7 +503,7 @@ const Products: React.FC<{}> = () => {
const
handleMenuClick
=
(
e
)
=>
{
const
selectedRowKeys
=
currentRefRow
.
current
.
map
(
item
=>
item
.
id
)
// 1 批量删除;2 删除导入批次 0 导入上游;3 批量上架;4 批量下架 5导出商品二维码
if
(
e
.
key
===
'1'
)
{
if
(
e
.
key
===
'1'
)
{
handleBatchDelete
(
selectedRowKeys
,
true
)
}
else
if
(
e
.
key
===
'2'
)
{
console
.
log
(
'删除导入批次'
)
...
...
@@ -510,8 +512,8 @@ const Products: React.FC<{}> = () => {
handleUpperCommodity
()
}
else
if
(
e
.
key
===
'3'
||
e
.
key
===
'4'
)
{
handleBatch
(
e
.
key
)
}
else
if
(
e
.
key
===
'5'
)
{
if
(
!
currentRefRow
.
current
.
every
(
item
=>
item
.
status
===
5
))
{
}
else
if
(
e
.
key
===
'5'
)
{
if
(
!
currentRefRow
.
current
.
every
(
item
=>
item
.
status
===
5
))
{
currentCtrlRef
.
current
.
setSelectedRowKeys
([])
currentCtrlRef
.
current
.
setSelectRow
([])
return
message
.
error
(
intl
.
formatMessage
({
id
:
'commodity.products.schema.fastSchema.qingxuanzeshangjiashangpin'
}))
...
...
@@ -526,13 +528,13 @@ const Products: React.FC<{}> = () => {
a
.
style
=
"display: none"
setExportLoading
(
true
)
const
selectedRowKeys
=
currentRefRow
.
current
.
map
(
item
=>
item
.
id
)
if
(
selectedRowKeys
.
length
>
1000
)
{
if
(
selectedRowKeys
.
length
>
1000
)
{
return
message
.
error
(
intl
.
formatMessage
({
id
:
'commodity.products.schema.fastSchema.zuiduodaochuyiqiange'
}))
}
postProductCommodityExportCommodityQrCode
({
idList
:
selectedRowKeys
},
{
responseType
:
'blob'
,
getResponse
:
true
}).
then
((
res
:
any
)
=>
{
postProductCommodityExportCommodityQrCode
({
idList
:
selectedRowKeys
},
{
responseType
:
'blob'
,
getResponse
:
true
}).
then
((
res
:
any
)
=>
{
const
{
data
,
response
}
=
res
const
filename
=
response
.
headers
.
get
(
'content-disposition'
).
split
(
'='
)[
1
]
let
blob
=
new
Blob
([
data
],
{
type
:
"application/x-zip-compressed"
})
let
blob
=
new
Blob
([
data
],
{
type
:
"application/x-zip-compressed"
})
const
url
=
window
.
URL
.
createObjectURL
(
blob
);
a
.
href
=
url
;
a
.
download
=
filename
;
...
...
@@ -620,18 +622,24 @@ const Products: React.FC<{}> = () => {
const
controllerBtns
=
(
<
Space
>
<
AuthButton
btnCode=
'products.add'
menuCode=
'commodityAbility'
>
<
Button
type=
'primary'
onClick=
{
()
=>
history
.
push
(
'/memberCenter/commodityAbility/commodity/products/add'
)
}
>
<
PlusOutlined
/>
{
intl
.
formatMessage
({
id
:
'commodity.products.controllerBtns.button.1'
})
}
</
Button
>
</
AuthButton
>
{
/* <Button style={{margin:'0 16px'}} onClick={()=>setImportModal(true)}>导入数据</Button> */
}
<
AuthButton
btnCode=
'products.batch'
menuCode=
'commodityAbility'
>
<
Dropdown
overlay=
{
menuMore
}
trigger=
{
[
'click'
]
}
>
<
Button
>
{
intl
.
formatMessage
({
id
:
'commodity.products.controllerBtns.button.2'
})
}
<
DownOutlined
/>
</
Button
>
</
Dropdown
>
</
AuthButton
>
</
Space
>
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment