Commit 46e67adf authored by xiexiuxing's avatar xiexiuxing

feat:仓位页面权限按钮控制

parent 5d7abf4e
btnCode 是pass 平台配置唯一表示
btnCode 是pass 平台配置唯一表示
btnCode 是pass 平台配置唯一表示
menuCode 是 pass平台菜单属性relationParentCode":"commodityAbility",
注意点 如果与后台按钮不匹配 则是没有权限按钮
// 价格策略
priceManage.add" 价格策略列表新曾
priceManage.del 价格策略列表删除
......@@ -31,4 +32,8 @@ directChannel.state:渠道直采商品上架下架
//品牌管理
//仓位 pass 已经加上去 等待页面处理
\ No newline at end of file
//仓位 pass
repositories.add :'仓位新曾按钮'
repositories.batchadd :'仓位批量新曾按钮'
repositories.batchedit:仓位批量修改按钮
repositories.edit:仓位库存调拨按钮
\ No newline at end of file
......@@ -18,6 +18,8 @@ import ModalForm from '@/components/ModalForm';
import { useHttpRequest } from '@/hooks/useHttpRequest';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { getProductFreightSpaceList, postProductFreightSpaceStopStart, postProductFreightSpaceUpdateBatch } from '@/services/ProductV2Api';
import AuthButton from '@/components/AuthButton'
import { AuthUrl } from '@/components/AuthButton/AuthUrl'
const formActions = createFormActions();
const modalSchemaAction = createFormActions()
......@@ -58,6 +60,7 @@ const Repositories: React.FC<{}> = () => {
key: 'name',
render: (text: any, record: any) => (
<EyePreview
type={AuthUrl('repositories.see', 'commodityAbility') ? 'link' : "button"}
url={`/memberCenter/commodityAbility/repositories/detail?id=${record.id}&preview=1`}
>
{text}
......@@ -123,9 +126,12 @@ const Repositories: React.FC<{}> = () => {
return (
<>
{record.state === 1 ? (
<AuthButton btnCode='repositories.edit' menuCode='commodityAbility'>
<Button type="link" onClick={() => handleAdjust(record)}>
{intl.formatMessage({ id: 'repositories.columns.option.button' })}
</Button>
</AuthButton>
) : (
''
)}
......@@ -226,11 +232,13 @@ const Repositories: React.FC<{}> = () => {
const handleModify = async (record) => {
// 通过传入的params字符串判断是修改那种类型的数据
if (AuthUrl('repositories.state', 'commodityAbility')) {
await postProductFreightSpaceStopStart({
id: record.id,
state: record.state === 1 ? 0 : 1
})
ref.current.reload()
}
};
const handleAdjust = (record: any) => {
......@@ -282,6 +290,7 @@ const Repositories: React.FC<{}> = () => {
}
const controllerBtns = <Space>
<AuthButton btnCode='repositories.add' menuCode='commodityAbility'>
<Button
type="primary"
onClick={handleToAdd}
......@@ -289,8 +298,16 @@ const Repositories: React.FC<{}> = () => {
>
{intl.formatMessage({ id: 'repositories.controllerBtns.button.1' })}
</Button>
</AuthButton>
<AuthButton btnCode='repositories.batchadd' menuCode='commodityAbility'>
<Button onClick={handleBatchAdd}>{intl.formatMessage({ id: 'repositories.controllerBtns.button.2' })}</Button>
</AuthButton>
<AuthButton btnCode='repositories.batchedit' menuCode='commodityAbility'>
<Button onClick={() => modalRef.current.setVisible(true)}>{intl.formatMessage({ id: 'repositories.controllerBtns.button.3' })}</Button>
</AuthButton>
</Space>
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment