Commit e241aaaf authored by xiexiuxing's avatar xiexiuxing

fix:恢复合并的按钮

parent 2daabe40
// 这里是处理比较特殊的url 跳转的
import { getAuth } from "@/utils/auth";
export const AuthUrl = (btnCode: string, munuCode: string) => {
export const AuthUrl = (btnCode: string, munuCode?: string) => {
const { auth } = getAuth()
const { pathname } = new URL(window.location.href);
const RoutesAuth = auth.filter((item: any) => item?.u === pathname)
......
......@@ -24,6 +24,8 @@ import ModalTable from '@/components/ModalTable'
import { clearModalParams } from '@/utils'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { getProductCustomerGetCustomerAttributeList, getProductPlatformGetAttributeList, postProductCustomerDeleteCustomerAttribute, postProductCustomerSyncAttribute, postProductCustomerUpdateCustomerAttributeStatus } from '@/services/ProductV2Api'
import { AuthUrl } from '@/components/AuthButton/AuthUrl'
import AuthButton from '@/components/AuthButton'
// import styles from './index.less'
const formActions = createFormActions();
......@@ -141,19 +143,22 @@ const Attribute: React.FC<{}> = () => {
dataIndex: 'isEnable',
key: 'isEnable',
render: (text: any, record: any) => (
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.title' })}
onConfirm={() => confirm(record)}
onCancel={cancel}
okText={intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.cancelText' })}
>
<Button
type="link"
style={record.isEnable ? { color: '#00B37A' } : { color: 'red' }}>
{record.isEnable ? <>{intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.link.1' })} <PlayCircleOutlined /></> : <>{intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.link.2' })} <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
<AuthButton btnCode='attribute.state' >
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.title' })}
onConfirm={() => confirm(record)}
onCancel={cancel}
okText={intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.cancelText' })}
>
<Button
type="link"
style={record.isEnable ? { color: '#00B37A' } : { color: 'red' }}>
{record.isEnable ? <>{intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.link.1' })} <PlayCircleOutlined /></> : <>{intl.formatMessage({ id: 'classAndProperty.attribute.columns.isEnable.link.2' })} <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
</AuthButton>
)
},
{
......@@ -161,26 +166,33 @@ const Attribute: React.FC<{}> = () => {
dataIndex: 'option',
render: (text: any, record: any) => record.isEnable ? '' : <>
<Button type='link' onClick={() => handleEdit(record)}>{intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.linke.1' })}</Button>
<AuthButton btnCode='attribute.edit' >
<Button type='link' onClick={() => handleEdit(record)}>{intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.linke.1' })}</Button>
</AuthButton>
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.title' })}
onConfirm={() => clickDelete(record)}
onCancel={cancel}
okText={intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.cancelText' })}
>
<Button type='link'>{intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.linke.2' })}</Button>
</Popconfirm>
<AuthButton btnCode='attribute.del' >
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.title' })}
onConfirm={() => clickDelete(record)}
onCancel={cancel}
okText={intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.cancelText' })}
>
<Button type='link'>{intl.formatMessage({ id: 'classAndProperty.attribute.columns.option.linke.2' })}</Button>
</Popconfirm>
</AuthButton>
</>
}
];
const handleSee = (record: any) => {
history.push(`/memberCenter/commodityAbility/classAndProperty/attribute/detail?id=${record.id}&isSee=true`)
if (AuthUrl('attribute.see')) {
history.push(`/memberCenter/commodityAbility/classAndProperty/attribute/detail?id=${record.id}&isSee=true`)
}
}
const confirm = (record: any) => {
......@@ -241,13 +253,18 @@ const Attribute: React.FC<{}> = () => {
const Actions = (
<Space>
<Button type="primary" icon={<PlusOutlined />} onClick={() => { history.push('/memberCenter/commodityAbility/classAndProperty/attribute/add') }}>
{intl.formatMessage({ id: 'classAndProperty.attribute.actions.button.1' })}
</Button>
<AuthButton btnCode='attribute.add' >
<Button type="primary" icon={<PlusOutlined />} onClick={() => { history.push('/memberCenter/commodityAbility/classAndProperty/attribute/add') }}>
{intl.formatMessage({ id: 'classAndProperty.attribute.actions.button.1' })}
</Button>
</AuthButton>
<span>
<Tooltip title={intl.formatMessage({ id: 'classAndProperty.attribute.actions.tooltip' })}>
<Button type="default" style={{ marginLeft: 16 }} onClick={syncAttribute}>{intl.formatMessage({ id: 'classAndProperty.attribute.actions.button.2' })}</Button>
</Tooltip>
<AuthButton btnCode='attribute.synchronization' >
<Tooltip title={intl.formatMessage({ id: 'classAndProperty.attribute.actions.tooltip' })}>
<Button type="default" style={{ marginLeft: 16 }} onClick={syncAttribute}>{intl.formatMessage({ id: 'classAndProperty.attribute.actions.button.2' })}</Button>
</Tooltip>
</AuthButton>
</span>
</Space>
);
......
......@@ -19,6 +19,8 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import Submit from '@/components/NiceForm/components/Submit'
import { getProductCustomerGetCustomerCategoryAttributeList, getProductCustomerGetCustomerCategoryTree, postProductCustomerDeleteCustomerCategoryAttribute, postProductCustomerSaveCustomerCategoryAttribute } from '@/services/ProductV2Api';
import { ISchema } from '@formily/antd';
import AuthButton from '@/components/AuthButton';
import { AuthUrl } from '@/components/AuthButton/AuthUrl';
const fetchCategoryTreeData = async (params?) => {
const res = await getProductCustomerGetCustomerCategoryTree()
......@@ -110,7 +112,7 @@ const CategoryAttributes: React.FC<{}> = () => {
useEffect(() => {
if (selectKey && flag.current) {
ref.current.reload()
} else if(!selectKey) {
} else if (!selectKey) {
flag.current = false
} else {
flag.current = true
......@@ -148,7 +150,10 @@ const CategoryAttributes: React.FC<{}> = () => {
}
const handleSee = (record: any) => {
history.push(`/memberCenter/commodityAbility/classAndProperty/categoryAttributes/viewAttributes?id=${record.id}`)
if (AuthUrl('categoryAttributes.see')) {
history.push(`/memberCenter/commodityAbility/classAndProperty/categoryAttributes/viewAttributes?id=${record.id}`)
}
}
const handleSelectOk = () => {
......@@ -218,14 +223,17 @@ const CategoryAttributes: React.FC<{}> = () => {
render: (text: any, record: any) => {
return (
<>
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.categoryAttributes.columns.popconfirm' })}
onConfirm={() => clickRelief(record.id)}
okText={intl.formatMessage({ id: 'classAndProperty.categoryAttributes.columns.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.categoryAttributes.columns.cancelText' })}
>
<Button type='link'>{intl.formatMessage({ id: 'classAndProperty.categoryAttributes.columns.button' })}</Button>
</Popconfirm>
<AuthButton btnCode='propertyValue.edit' >
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.categoryAttributes.columns.popconfirm' })}
onConfirm={() => clickRelief(record.id)}
okText={intl.formatMessage({ id: 'classAndProperty.categoryAttributes.columns.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.categoryAttributes.columns.cancelText' })}
>
<Button type='link'>{intl.formatMessage({ id: 'classAndProperty.categoryAttributes.columns.button' })}</Button>
</Popconfirm>
</AuthButton>
</>
)
}
......@@ -361,9 +369,12 @@ const CategoryAttributes: React.FC<{}> = () => {
},
children: (
<>
<Button type="primary" icon={<PlusOutlined />} onClick={handleNewLink}>
{intl.formatMessage({ id: 'classAndProperty.categoryAttributes.formilyChilds.button' })}
</Button>
<AuthButton btnCode='categoryAttributes.add' >
<Button type="primary" icon={<PlusOutlined />} onClick={handleNewLink}>
{intl.formatMessage({ id: 'classAndProperty.categoryAttributes.formilyChilds.button' })}
</Button>
</AuthButton>
</>
)
}}
......
......@@ -14,6 +14,7 @@ import { useTreeTabs } from '@/hooks/useTreeTabs';
import NiceForm from '@/components/NiceForm';
import { getProductCustomerGetCustomerCategory, getProductCustomerGetCustomerCategoryTree, getProductPlatformGetCategoryTree, postProductCustomerDeleteCustomerCategory, postProductCustomerSaveOrUpdateCustomerCategory, postProductCustomerSyncCategory } from '@/services/ProductV2Api';
import { help } from '@/pages/transaction/common';
import AuthButton from '@/components/AuthButton';
const { ON_FORM_INPUT_CHANGE } = LifeCycleTypes
......@@ -213,7 +214,10 @@ const ClassProperty: React.FC<{}> = () => {
// customExpandkeys={['8']}
/>
:
<Button block type='primary' onClick={() => handleSelect()}>{intl.formatMessage({ id: 'classAndProperty.class.h3.none' })}</Button>
<AuthButton btnCode='class.synchronization' menuCode='memberAbility'>
<Button block type='primary' onClick={() => handleSelect()}>{intl.formatMessage({ id: 'classAndProperty.class.h3.none' })}</Button>
</AuthButton>
}
</Card>
</Col>
......@@ -254,14 +258,20 @@ const ClassProperty: React.FC<{}> = () => {
>
<FormButtonGroup>
<Button loading={finshLoading} htmlType='submit' type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
{intl.formatMessage({ id: 'classAndProperty.class.h3.formButtonGroup.button.1' })}
</Button>
<AuthButton btnCode='class.add' menuCode='memberAbility'>
<Button loading={finshLoading} htmlType='submit' type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
{intl.formatMessage({ id: 'classAndProperty.class.h3.formButtonGroup.button.1' })}
</Button>
</AuthButton>
<Popconfirm title={intl.formatMessage({ id: 'classAndProperty.class.h3.formButtonGroup.popconfirm' })} okText={intl.formatMessage({ id: 'classAndProperty.class.h3.formButtonGroup.okText' })} cancelText={intl.formatMessage({ id: 'classAndProperty.class.h3.formButtonGroup.cancelText' })} onConfirm={handleDeleteMenu}>
{
treeStatus !== FormState.ADD && <Button style={{ marginTop: 32, marginBottom: 16 }}>
{intl.formatMessage({ id: 'classAndProperty.class.h3.formButtonGroup.button.2' })}
</Button>
treeStatus !== FormState.ADD &&
<AuthButton btnCode='class.del' menuCode='memberAbility'>
<Button style={{ marginTop: 32, marginBottom: 16 }}>
{intl.formatMessage({ id: 'classAndProperty.class.h3.formButtonGroup.button.2' })}
</Button>
</AuthButton>
}
</Popconfirm>
</FormButtonGroup>
......
......@@ -22,6 +22,8 @@ import { ISchema } from '@formily/antd';
import { clearModalParams } from '@/utils';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { getProductCustomerGetCustomerAttributeTree, getProductCustomerGetCustomerAttributeValueList, getProductPlatformGetSyncAttributeValueList, postProductCustomerDeleteCustomerAttributeValue, postProductCustomerSyncAttributeValue, postProductCustomerUpdateCustomerAttributeValueStatus } from '@/services/ProductV2Api';
import AuthButton from '@/components/AuthButton';
import { AuthUrl } from '@/components/AuthButton/AuthUrl';
const treeActions = createTreeActions()
......@@ -121,7 +123,7 @@ const PropertyValue: React.FC<{}> = () => {
useEffect(() => {
if (selectKey && flag.current) {
ref.current.reload({ current: 1, pageSize: 10, name: '', customerAttributeId: selectKey })
} else if(!selectKey) {
} else if (!selectKey) {
flag.current = false
} else {
flag.current = true
......@@ -166,7 +168,9 @@ const PropertyValue: React.FC<{}> = () => {
}
const handleSee = (record: any) => {
history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/detail?attrId=${selectKey}&attrName=${record.customerAttribute.name}&attrValueId=${record.id}&isSee=true&type=${record.type}`)
if (AuthUrl('propertyValue.see')) {
history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/detail?attrId=${selectKey}&attrName=${record.customerAttribute.name}&attrValueId=${record.id}&isSee=true&type=${record.type}`)
}
}
const columns: ColumnType<any>[] = [
......@@ -191,19 +195,22 @@ const PropertyValue: React.FC<{}> = () => {
render: (text: any, record: any) => {
let component: ReactNode = null
component = (
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.title' })}
onConfirm={() => confirm(record)}
onCancel={cancel}
okText={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.cancelText' })}
>
<Button
type="link"
style={record.isEnable ? { color: '#00B37A' } : { color: 'red' }}>
{record.isEnable ? <>{intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.button.1' })} <PlayCircleOutlined /></> : <>{intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.button.2' })} <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
<AuthButton btnCode='propertyValue.state' >
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.title' })}
onConfirm={() => confirm(record)}
onCancel={cancel}
okText={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.cancelText' })}
>
<Button
type="link"
style={record.isEnable ? { color: '#00B37A' } : { color: 'red' }}>
{record.isEnable ? <>{intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.button.1' })} <PlayCircleOutlined /></> : <>{intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.popconfirm.button.2' })} <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
</AuthButton>
)
return component
}
......@@ -217,21 +224,27 @@ const PropertyValue: React.FC<{}> = () => {
<>
{
record.isEnable ? '' : <>
<Button
type='link'
onClick={() => history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/edit?attrId=${selectKey}&attrName=${record.customerAttribute.name}&attrValueId=${record.id}`)}
>
{intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.1' })}
</Button>
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.2.popconfirm.title' })}
onConfirm={() => clickDelete(record)}
onCancel={cancel}
okText={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.2.popconfirm.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.2.popconfirm.cancelText' })}
>
<Button type='link'>{intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.2' })}</Button>
</Popconfirm>
<AuthButton btnCode='propertyValue.edit' >
<Button
type='link'
onClick={() => history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/edit?attrId=${selectKey}&attrName=${record.customerAttribute.name}&attrValueId=${record.id}`)}
>
{intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.1' })}
</Button>
</AuthButton>
<AuthButton btnCode='propertyValue.del' >
<Popconfirm
title={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.2.popconfirm.title' })}
onConfirm={() => clickDelete(record)}
onCancel={cancel}
okText={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.2.popconfirm.okText' })}
cancelText={intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.2.popconfirm.cancelText' })}
>
<Button type='link'>{intl.formatMessage({ id: 'classAndProperty.propertyValue.columns.button.2' })}</Button>
</Popconfirm>
</AuthButton>
</>
}
</>
......@@ -391,15 +404,18 @@ const PropertyValue: React.FC<{}> = () => {
},
children: (
<>
<Button
type="primary"
icon={<PlusOutlined />}
onClick={() => {
history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/add?attrId=${selectKey || history.location.query.attrId}&attrName=${selectNode?._title || history.location.query.attrName}&type=${selectNode?.type || history.location.query.type}`)
}}
>
{intl.formatMessage({ id: 'classAndProperty.propertyValue.standardTable.formilyChilds.button' })}
</Button>
<AuthButton btnCode='attribute.add' >
<Button
type="primary"
icon={<PlusOutlined />}
onClick={() => {
history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/add?attrId=${selectKey || history.location.query.attrId}&attrName=${selectNode?._title || history.location.query.attrName}&type=${selectNode?.type || history.location.query.type}`)
}}
>
{intl.formatMessage({ id: 'classAndProperty.propertyValue.standardTable.formilyChilds.button' })}
</Button>
</AuthButton>
</>
)
}}
......
......@@ -161,7 +161,7 @@ const MemberMaintain: React.FC<[]> = () => {
{record.showUpdate && (
<>
<AuthButton btnCode='memberImport.commit' menuCode='memberAbility'>
<AuthButton btnCode='memberImport.edit' menuCode='memberAbility'>
<Button
type="link"
onClick={() =>
......@@ -258,7 +258,7 @@ const MemberMaintain: React.FC<[]> = () => {
</Space>
)} */}
<Space>
<AuthButton btnCode='memberImport.del' menuCode='memberAbility'>
<AuthButton btnCode='memberImport.add' menuCode='memberAbility'>
<Button
type="primary"
onClick={() =>
......
......@@ -488,7 +488,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
<Form.Item
label={<RequireItem label="" />}
>
<AuthButton btnCode='hopAbility.Submit' menuCode='shopAbility'>
<AuthButton btnCode='shopAbility.Submit' menuCode='shopAbility'>
<Button loading={confirmLoading} type="primary" style={{ marginRight: 16 }} onClick={handleSave}>{intl.formatMessage({ id: 'common.button.save' })}</Button>
</AuthButton>
......
......@@ -72,7 +72,7 @@ const ShopSeoAdded = () => {
backIcon={<ReutrnEle description={intl.formatMessage({ id: 'common.button.back' })} />}
extra={
link !== 'detail' &&
<AuthButton menuCode='shopAbility' btnCode={id ? 'hopSeodetail.edit' : 'shopSeodetail.add'} >
<AuthButton btnCode={id ? 'shopSeodetail.edit' : 'shopSeodetail.add'} >
<Button type="primary" loading={confirmLoading} onClick={handleSave}>{intl.formatMessage({ id: 'common.button.save' })}</Button>
</AuthButton>
......
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