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
XieZhiXiong
jinfa-platform
Commits
5aebd008
Commit
5aebd008
authored
Dec 23, 2021
by
xiexiuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:价格策略按钮权限控制
parent
5009f32c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
126 additions
and
24 deletions
+126
-24
AuthUrl.ts
src/components/AuthButton/AuthUrl.ts
+30
-0
index.tsx
src/components/AuthButton/index.tsx
+53
-0
按钮状态.mad
src/components/AuthButton/按钮状态.mad
+8
-0
index.tsx
src/pages/priceManage/priceStrategy/index.tsx
+26
-15
setStrategy.tsx
src/pages/priceManage/priceStrategy/setStrategy.tsx
+9
-9
No files found.
src/components/AuthButton/AuthUrl.ts
0 → 100644
View file @
5aebd008
// 这里是处理比较特殊的url 跳转的
export
const
AuthUrl
=
(
menuCode
:
string
,
urlCode
:
string
,
btnCode
?:
string
)
=>
{
const
userBtn
=
require
(
'../../../config/router.config.json'
)
const
AuthRoutes
=
userBtn
.
filter
((
item
:
any
)
=>
item
.
relationParentCode
===
urlCode
);
const
AuthButton
=
AuthRoutes
[
0
]?.
routes
;
const
AuthCode
:
any
=
[];
for
(
let
i
=
0
;
i
<
AuthButton
.
length
;
i
++
)
{
if
(
AuthButton
[
i
].
btns
.
length
!=
0
)
{
for
(
let
j
=
0
;
j
<
AuthButton
[
i
].
btns
.
length
;
j
++
)
{
if
(
AuthButton
[
i
].
btns
[
j
].
buttonCode
===
menuCode
)
{
AuthCode
.
push
(
AuthButton
[
i
].
btns
[
j
]);
break
;
}
}
}
}
if
(
btnCode
===
'DevTest'
)
return
true
for
(
let
i
=
0
;
i
<
AuthCode
.
length
;
i
++
)
{
if
(
menuCode
)
{
// 是否有页面标识
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
if
(
AuthCode
[
i
].
buttonCode
===
menuCode
)
{
return
true
}
}
continue
}
return
false
}
\ No newline at end of file
src/components/AuthButton/index.tsx
0 → 100644
View file @
5aebd008
export
interface
AuthButtonProps
{
btnCode
?:
string
menuCode
:
string
children
:
any
,
urlCode
:
string
,
}
/**
* 按钮权限
* @param {String} menuCode 页面标识
* @param {String} btnCode 按钮标识
*/
const
AuthButton
=
(
props
:
AuthButtonProps
)
=>
{
const
{
children
,
btnCode
,
// 按钮标识
menuCode
,
// 按钮页面标识
urlCode
,
// 父级别菜单
}
=
props
const
userBtn
=
require
(
'../../../config/router.config.json'
)
const
AuthRoutes
=
userBtn
.
filter
((
item
:
any
)
=>
item
.
relationParentCode
===
urlCode
);
const
AuthButton
=
AuthRoutes
[
0
]?.
routes
;
const
AuthCode
:
any
=
[];
for
(
let
i
=
0
;
i
<
AuthButton
.
length
;
i
++
)
{
if
(
AuthButton
[
i
].
btns
.
length
!=
0
)
{
for
(
let
j
=
0
;
j
<
AuthButton
[
i
].
btns
.
length
;
j
++
)
{
if
(
AuthButton
[
i
].
btns
[
j
].
buttonCode
===
menuCode
)
{
AuthCode
.
push
(
AuthButton
[
i
].
btns
[
j
]);
break
;
}
}
}
}
// console.log(AuthCode, 'AuthCode');
const
_authorityBtn
=
()
=>
{
// 本地开发时传的特殊标识,直接开放权限
if
(
btnCode
===
'DevTest'
)
return
true
for
(
let
i
=
0
;
i
<
AuthCode
.
length
;
i
++
)
{
if
(
menuCode
)
{
// 是否有页面标识
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
if
(
AuthCode
[
i
].
buttonCode
===
menuCode
)
{
return
true
}
}
continue
}
return
false
}
return
_authorityBtn
()
?
children
:
null
}
export
default
AuthButton
;
src/components/AuthButton/按钮状态.mad
0 → 100644
View file @
5aebd008
priceManage.add" 价格策略列表新曾
priceManage.del 价格策略列表删除
priceManage.edit 价格策略编辑
priceManage.state 价格策略设置是否有效按钮
priceManage.see 价格策略查看详情
\ No newline at end of file
src/pages/priceManage/priceStrategy/index.tsx
View file @
5aebd008
...
...
@@ -14,6 +14,8 @@ import { history, useIntl } from 'umi'
import
StatusSwitch
from
'@/components/StatusSwitch'
import
{
PlusOutlined
}
from
'@ant-design/icons'
import
{
getProductCommodityGetUnitPriceStrategyList
,
postProductCommodityDeleteUnitPriceStrategy
,
postProductCommodityUpdateUnitPriceStrategyStatus
}
from
'@/services/ProductV2Api'
import
AuthButton
from
'@/components/AuthButton'
import
{
AuthUrl
}
from
'@/components/AuthButton/AuthUrl'
const
formActions
=
createFormActions
();
...
...
@@ -32,11 +34,14 @@ const PriceManage: React.FC<{}> = () => {
dataIndex
:
'name'
,
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/detail?id=${record.id}&preview=1`
}
>
{
text
}
</
EyePreview
>
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/detail?id=${record.id}&preview=1`
}
type=
{
AuthUrl
(
'priceManage.see'
,
'jiageguanl'
)
?
'link'
:
'button'
}
>
{
text
}
</
EyePreview
>
},
// {
// title: '商品ID',
...
...
@@ -133,10 +138,14 @@ const PriceManage: React.FC<{}> = () => {
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
<
Button
type=
'link'
className=
"padLeft0"
onClick=
{
()
=>
handleModify
(
record
)
}
>
{
intl
.
formatMessage
({
id
:
'dealAbility.xiugai'
})
}
</
Button
>
<
Popconfirm
title=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.title'
})
}
okText=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.okText'
})
}
cancelText=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.cancelText'
})
}
onConfirm=
{
()
=>
handleDelete
(
record
)
}
>
<
Button
type=
'link'
className=
"padLeft0"
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.link'
})
}
</
Button
>
</
Popconfirm
>
<
AuthButton
menuCode=
'priceManage.edit'
urlCode=
'jiageguanl'
>
<
Button
type=
'link'
className=
"padLeft0"
onClick=
{
()
=>
handleModify
(
record
)
}
>
{
intl
.
formatMessage
({
id
:
'dealAbility.xiugai'
})
}
</
Button
>
</
AuthButton
>
<
AuthButton
menuCode=
'priceManage.del'
urlCode=
'jiageguanl'
>
<
Popconfirm
title=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.title'
})
}
okText=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.okText'
})
}
cancelText=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.cancelText'
})
}
onConfirm=
{
()
=>
handleDelete
(
record
)
}
>
<
Button
type=
'link'
className=
"padLeft0"
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.link'
})
}
</
Button
>
</
Popconfirm
>
</
AuthButton
>
</>
)
}
...
...
@@ -178,12 +187,14 @@ const PriceManage: React.FC<{}> = () => {
const
controllerBtns
=
(
<
Space
>
<
Button
type=
'primary'
onClick=
{
()
=>
history
.
push
(
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add'
)
}
>
<
PlusOutlined
/>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.controllerBtns'
})
}
</
Button
>
<
AuthButton
menuCode=
'priceManage.add'
urlCode=
'jiageguanl'
>
<
Button
type=
'primary'
onClick=
{
()
=>
history
.
push
(
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add'
)
}
>
<
PlusOutlined
/>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.controllerBtns'
})
}
</
Button
>
</
AuthButton
>
</
Space
>
)
...
...
src/pages/priceManage/priceStrategy/setStrategy.tsx
View file @
5aebd008
...
...
@@ -54,15 +54,15 @@ const SetStrategy: React.FC<{}> = () => {
backIcon=
{
<
ReutrnEle
description=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.description'
})
}
/>
}
className=
"setStrategy"
title=
{
pageStatus
===
PageStatus
.
PREVIEW
?
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.title1'
})
:
(
pageStatus
===
PageStatus
.
ADD
?
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.title2'
})
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.title3'
}))
}
extra=
{
(
pageStatus
!==
PageStatus
.
PREVIEW
?
(
<
Button
key=
"1"
loading=
{
btnLoading
}
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.extra'
})
}
</
Button
>
)
:
null
)
}
//
extra={(
//
pageStatus !== PageStatus.PREVIEW
//
? (
//
<Button key="1" loading={btnLoading} onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
//
{intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.extra' })}
//
</Button>
//
)
//
: null
//
)}
>
<
Card
>
<
PriceSetting
addSchemaAction=
{
addSchemaAction
}
schema=
{
setPriceSchema
}
formSubmit=
{
formSubmit
}
/>
...
...
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