Commit 5b5a1ff1 authored by Bill's avatar Bill

Merge branch 'fix418' into 'v2-220418'

处理请购单转采购订单按钮权限问题 See merge request linkseeks-design/pro-platform!334
parents 81c6e17c 5aa25604
......@@ -27,8 +27,8 @@ export interface TableOperationProps {
menuCode?: string,
}
const TableOperation: React.FC<TableOperationProps> = (props) => {
const TableOperation: React.FC<TableOperationProps> = (props) =>
{
const { buttonTextFieldMap, operationHandler, buttonPermissionsMap = null, menuCode = null } = props
const keyNames = Object.keys(buttonTextFieldMap)
......@@ -38,7 +38,7 @@ const TableOperation: React.FC<TableOperationProps> = (props) => {
Object.values(buttonTextFieldMap).filter(Boolean).length > 2
?
<>
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[keyNames[0]]) || 'DevTest'}>
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[keyNames[0]]) || ''}>
<Button type='link' onClick={operationHandler[keyNames[0]]}>{keyNames[0]}</Button>
</AuthButton>
......@@ -49,7 +49,7 @@ const TableOperation: React.FC<TableOperationProps> = (props) => {
keyNames.slice(1, keyNames.length).map((item, i) => buttonTextFieldMap[item] ? (
<Menu.Item key={`menuItem${i}`}>
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[item]) || 'DevTest'}>
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[item]) || ''}>
<Button type='link' onClick={operationHandler[item]}>{item}</Button>
</AuthButton>
</Menu.Item>
......@@ -65,7 +65,7 @@ const TableOperation: React.FC<TableOperationProps> = (props) => {
:
keyNames.map((item, i) => (buttonTextFieldMap[item] ?
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[item]) || 'DevTest'} key={`btnItem${i}`}>
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[item]) || ''} key={`btnItem${i}`}>
<Button type='link' onClick={operationHandler[item]}>{item}</Button>
</AuthButton>
: null))
......
......@@ -8,6 +8,7 @@ import BillDetailWrapper from '../../components/billDetailWrapper';
import BillDetailSection from '../../components/billDetailSection';
import { Button } from 'antd';
import { usePageStatus } from '@/hooks/usePageStatus';
import AuthButton from '@/components/AuthButton';
const RequisitionOrderDetail: React.FC = () => {
const { formContext } = useBillDetail({type: 'transformBill'})
......@@ -29,9 +30,9 @@ const RequisitionOrderDetail: React.FC = () => {
formContext={formContext}
anchorList={anchorTitleList}
extraRight={
action && <Button type='primary' onClick={handleClick}>
action && <AuthButton btnCode="requisitionOrderDetail.zhuandan"><Button type='primary' onClick={handleClick}>
{intl.formatMessage({ id: 'purchaseRequisition.zhuancaigoudan', defaultMessage: '转采购单' })}
</Button>
</Button></AuthButton>
}
/>
<BillDetailWrapper>
......
......@@ -3,7 +3,6 @@ import { baseOrderListColumns } from '../../constant'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { history, useIntl } from 'umi'
import TableOperation from '@/components/TableOperation'
import AuthButton from '@/components/AuthButton'
// 请购单转订单 Hook
export const useSelfTable = () => {
......@@ -23,13 +22,16 @@ export const useSelfTable = () => {
[intl.formatMessage({ id: 'purchaseRequisition.zhuancaigoudingdan', defaultMessage: '转采购订单' })]: () => handleSubmit(record.id),
}
const buttonPermissionsMap = {
[intl.formatMessage({ id: 'purchaseRequisition.zhuancaigoudingdan', defaultMessage: '转采购订单' })]: 'readyRequisitionOrder.submit',
}
return (
<AuthButton btnCode='readyRequisitionOrder.submit' >
<TableOperation
buttonTextFieldMap={buttonGroup}
operationHandler={operationHandler}
/>
</AuthButton>
<TableOperation
buttonTextFieldMap={buttonGroup}
operationHandler={operationHandler}
buttonPermissionsMap={buttonPermissionsMap}
/>
)
}
......
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