Commit f676faf4 authored by Bill's avatar Bill

feat: 按钮权限

parent 813dd3b7
......@@ -14,6 +14,7 @@ import {
postProductMaterialProcessUpdateStatus
} from '@/services/ProductV2Api';
import { Link } from 'umi';
import AuthButton from '@/components/AuthButton';
/**
* 物料审核流程规则配置
......@@ -82,19 +83,24 @@ const MaterialAuditProcessConfig = () => {
}
return (
<Space>
<Link to={`/memberCenter/commodityAbility/material/materialAuditProcessConfig/edit?id=${record.processId}`}>
修改
<AuthButton btnCode='material.rules.toEdit'>
<Link to={`/memberCenter/commodityAbility/material/materialAuditProcessConfig/edit?id=${record.processId}`}>
修改
</Link>
</AuthButton>
{
record.status !== 1 && (
<Popconfirm
title="确认删除?"
onConfirm={() => handleDelete(record)}
okText="是"
cancelText="否"
>
<a >删除</a>
</Popconfirm>
<AuthButton btnCode="material.rules.remove">
<Popconfirm
title="确认删除?"
onConfirm={() => handleDelete(record)}
okText="是"
cancelText="否"
>
<a >删除</a>
</Popconfirm>
</AuthButton>
)
}
</Space>
......@@ -106,13 +112,15 @@ const MaterialAuditProcessConfig = () => {
const controllerBtns = () => {
return (
<Space>
<Link to={CREATE_URL}>
<Button
type="primary"
>
新增
</Button>
</Link>
<AuthButton btnCode='material.rules.add'>
<Link to={CREATE_URL}>
<Button
type="primary"
>
新增
</Button>
</Link>
</AuthButton>
</Space>
)
}
......@@ -140,7 +148,7 @@ const MaterialAuditProcessConfig = () => {
<Card>
<StandardTable
tableProps={{
rowKey: 'id',
rowKey: 'processId',
}}
columns={columns}
currentRef={ref}
......
......@@ -14,6 +14,7 @@ import {
} from '@/services/ProductV2Api';
import FormilyTreeSelect from '../components/formilyTreeSelect';
import { useIntl } from 'umi';
import AuthButton from '@/components/AuthButton';
const formActions = createAsyncFormActions();
......@@ -160,11 +161,13 @@ const MaterialGroup = () => {
title={intl.formatMessage({ id: 'material.group.list', defaultMessage: '列表'})}
extra={
treeData.length === 0 && (
<Button
onClick={handleCreate}
>
{intl.formatMessage({ id: 'material.group.create', defaultMessage: '新建物料组'})}
</Button>
<AuthButton btnCode="material.group.add">
<Button
onClick={handleCreate}
>
{intl.formatMessage({ id: 'material.group.create', defaultMessage: '新建物料组'})}
</Button>
</AuthButton>
) || null
}
>
......@@ -190,25 +193,29 @@ const MaterialGroup = () => {
actions={formActions}
>
<FormButtonGroup>
<Button
htmlType='submit'
type="primary"
loading={loading}
>
{intl.formatMessage({ id: 'material.group.save', defaultMessage: '保存'})}
</Button>
<AuthButton btnCode="material.group.update">
<Button
htmlType='submit'
type="primary"
loading={loading}
>
{intl.formatMessage({ id: 'material.group.save', defaultMessage: '保存'})}
</Button>
</AuthButton>
{
info.status === 'edit' && (
<Popconfirm
title={intl.formatMessage({ id: 'material.group.delete.tips', defaultMessage: '确定要删除吗?'})}
okText={intl.formatMessage({ id: 'material.group.delete.confirm', defaultMessage: '是' })}
cancelText={intl.formatMessage({ id: 'material.group.delete.cancel', defaultMessage: '否' })}
onConfirm={handleDelete}
>
<Button >
{intl.formatMessage({ id: 'material.group.delete', defaultMessage: '删除'})}
</Button>
</Popconfirm>
<AuthButton btnCode="material.group.delete">
<Popconfirm
title={intl.formatMessage({ id: 'material.group.delete.tips', defaultMessage: '确定要删除吗?'})}
okText={intl.formatMessage({ id: 'material.group.delete.confirm', defaultMessage: '是' })}
cancelText={intl.formatMessage({ id: 'material.group.delete.cancel', defaultMessage: '否' })}
onConfirm={handleDelete}
>
<Button >
{intl.formatMessage({ id: 'material.group.delete', defaultMessage: '删除'})}
</Button>
</Popconfirm>
</AuthButton>
) || null
}
</FormButtonGroup>
......
......@@ -17,6 +17,7 @@ import { Link, history } from 'umi';
import TableModal from '@/pages/member/components/TableModal';
import { purchaseSchema } from './schema/purchase';
import { useIntl } from 'umi';
import AuthButton from '@/components/AuthButton';
/**
* 物料查询
......@@ -106,24 +107,31 @@ const MaterialQuery = () => {
const isDeleting = deleteLoading.includes(record.id)
return (
<Space>
<Link to={`/memberCenter/commodityAbility/material/pendingAdd/edit?id=${record.id}`}>
{ intl.formatMessage({ id: 'material.pendingAdd.list.edit', defaultMessage: '修改' })}
</Link>
<Popconfirm
title={intl.formatMessage({ id: 'material.group.delete.tips', defaultMessage: '确定要删除吗?' })}
onConfirm={() => handleDelete(record)}
okText={intl.formatMessage({ id: 'material.group.delete.confirm', defaultMessage: '是' })}
cancelText={intl.formatMessage({ id: 'material.group.delete.cancel', defaultMessage: '否' })}
>
<Spin spinning={isDeleting}>
<a>{intl.formatMessage({ id: 'material.group.delete', defaultMessage: '删除' })}</a>
<AuthButton btnCode='material.goods.edit'>
<Link to={`/memberCenter/commodityAbility/material/pendingAdd/edit?id=${record.id}`}>
{ intl.formatMessage({ id: 'material.pendingAdd.list.edit', defaultMessage: '修改' })}
</Link>
</AuthButton>
<AuthButton btnCode='material.goods.del'>
<Popconfirm
title={intl.formatMessage({ id: 'material.group.delete.tips', defaultMessage: '确定要删除吗?' })}
onConfirm={() => handleDelete(record)}
okText={intl.formatMessage({ id: 'material.group.delete.confirm', defaultMessage: '是' })}
cancelText={intl.formatMessage({ id: 'material.group.delete.cancel', defaultMessage: '否' })}
>
<Spin spinning={isDeleting}>
<a>{intl.formatMessage({ id: 'material.group.delete', defaultMessage: '删除' })}</a>
</Spin>
</Popconfirm>
</AuthButton>
<AuthButton btnCode='material.goods.submit'>
<Spin spinning={isSubmitting}>
<a onClick={() => handleSubmit(record)}>
{intl.formatMessage({ id: 'material.submit', defaultMessage: '提交'})}
</a>
</Spin>
</Popconfirm>
<Spin spinning={isSubmitting}>
<a onClick={() => handleSubmit(record)}>
{intl.formatMessage({ id: 'material.submit', defaultMessage: '提交'})}
</a>
</Spin>
</AuthButton>
</Space>
)
}
......@@ -167,22 +175,28 @@ const MaterialQuery = () => {
const controllerBtns = () => {
return (
<Space>
<Link to={CREATE_URL}>
<AuthButton btnCode='material.goods.add'>
<Link to={CREATE_URL}>
<Button
type="primary"
>
{ intl.formatMessage({ id: 'material.pendingAdd.add', defaultMessage: '新增' }) }
</Button>
</Link>
</AuthButton>
<AuthButton btnCode='material.goods.del.batch'>
<Button
type="primary"
loading={loading}
onClick={handleBatchDelete}
>
{ intl.formatMessage({ id: 'material.pendingAdd.add', defaultMessage: '新增' }) }
{ intl.formatMessage({ id: 'material.pendingAdd.batchDelete', defaultMessage: '批量删除'})}
</Button>
</Link>
<Button
loading={loading}
onClick={handleBatchDelete}
>
{ intl.formatMessage({ id: 'material.pendingAdd.batchDelete', defaultMessage: '批量删除'})}
</Button>
<Button onClick={handleOpenModal}>
{ intl.formatMessage({ id: 'material.pendingAdd.purchaseSelection', defaultMessage: '采购选品'})}
</Button>
</AuthButton>
<AuthButton btnCode='material.select.good'>
<Button onClick={handleOpenModal}>
{ intl.formatMessage({ id: 'material.pendingAdd.purchaseSelection', defaultMessage: '采购选品'})}
</Button>
</AuthButton>
</Space>
)
}
......
......@@ -14,6 +14,7 @@ import { getProductGoodsGoodsExamineChangeList1, postProductGoodsGoodsExamineCha
import { Link } from 'umi';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { useIntl } from 'umi';
import AuthButton from '@/components/AuthButton';
/**
* 物料查询
......@@ -37,9 +38,11 @@ const MaterialQuery = () => {
render: (text, record) => {
return (
<Space>
<Link to={`/memberCenter/commodityAbility/material/pendingExamChangeI/detail?id=${record.id}`}>
{intl.formatMessage({ id: 'material.exam.button', defaultMessage: '审核'})}
</Link>
<AuthButton btnCode='material.examI.change.toExam'>
<Link to={`/memberCenter/commodityAbility/material/pendingExamChangeI/detail?id=${record.id}`}>
{intl.formatMessage({ id: 'material.exam.button', defaultMessage: '审核'})}
</Link>
</AuthButton>
</Space>
)
}
......@@ -50,13 +53,15 @@ const MaterialQuery = () => {
const controllerBtns = () => {
return (
<Space>
<Button
type="primary"
onClick={handleBatchSuccess}
loading={loading}
>
{intl.formatMessage({ id: 'material.exam.batch.success', defaultMessage: '批量审核通过'})}
</Button>
<AuthButton btnCode='material.examI.change.batch'>
<Button
type="primary"
onClick={handleBatchSuccess}
loading={loading}
>
{intl.formatMessage({ id: 'material.exam.batch.success', defaultMessage: '批量审核通过'})}
</Button>
</AuthButton>
</Space>
)
}
......
......@@ -13,6 +13,7 @@ import { EMPTY, fetchBrand, fetchCategoryData, fetchTreeData, useAsyncCascader }
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { getProductGoodsGoodsExamineChangeList2, postProductGoodsGoodsExamineChangeBatch2 } from '@/services/ProductV2Api';
import { Link, useIntl } from 'umi';
import AuthButton from '@/components/AuthButton';
/**
......@@ -39,9 +40,12 @@ const MaterialQuery = () => {
render: (text, record) => {
return (
<Space>
<Link to={`/memberCenter/commodityAbility/material/pendingExamChangeII/detail?id=${record.id}`}>
{intl.formatMessage({ id: 'material.exam.button', defaultMessage: '审核'})}
</Link>
<AuthButton btnCode='material.examII.change.toExam'>
<Link to={`/memberCenter/commodityAbility/material/pendingExamChangeII/detail?id=${record.id}`}>
{intl.formatMessage({ id: 'material.exam.button', defaultMessage: '审核'})}
</Link>
</AuthButton>
</Space>
)
}
......@@ -52,13 +56,15 @@ const MaterialQuery = () => {
const controllerBtns = () => {
return (
<Space>
<Button
type="primary"
onClick={handleBatchSuccess}
loading={loading}
>
{intl.formatMessage({ id: 'material.exam.batch.success', defaultMessage: '批量审核通过'})}
</Button>
<AuthButton btnCode='material.examII.change.batch'>
<Button
type="primary"
onClick={handleBatchSuccess}
loading={loading}
>
{intl.formatMessage({ id: 'material.exam.batch.success', defaultMessage: '批量审核通过'})}
</Button>
</AuthButton>
</Space>
)
}
......
......@@ -13,6 +13,7 @@ import { Link, useIntl } from 'umi';
import { getProductGoodsGoodsExamineList1, postProductGoodsGoodsExamineBatch1 } from '@/services/ProductV2Api';
import { EMPTY, fetchBrand, fetchCategoryData, fetchTreeData, useAsyncCascader } from '../common/useGetTableSearchData';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import AuthButton from '@/components/AuthButton';
/**
......@@ -37,9 +38,12 @@ const MaterialQuery = () => {
render: (text, record) => {
return (
<Space>
<Link to={`/memberCenter/commodityAbility/material/pendingExamI/detail?id=${record.id}`}>
{intl.formatMessage({ id: 'material.exam.button', defaultMessage: '审核'})}
</Link>
<AuthButton btnCode='material.examI.toExam'>
<Link to={`/memberCenter/commodityAbility/material/pendingExamI/detail?id=${record.id}`}>
{intl.formatMessage({ id: 'material.exam.button', defaultMessage: '审核'})}
</Link>
</AuthButton>
</Space>
)
}
......@@ -50,13 +54,15 @@ const MaterialQuery = () => {
const controllerBtns = () => {
return (
<Space>
<Button
type="primary"
onClick={handleBatchSuccess}
loading={loading}
>
{intl.formatMessage({ id: 'material.exam.batch.success', defaultMessage: '批量审核通过'})}
</Button>
<AuthButton btnCode='material.examI.batch'>
<Button
type="primary"
onClick={handleBatchSuccess}
loading={loading}
>
{intl.formatMessage({ id: 'material.exam.batch.success', defaultMessage: '批量审核通过'})}
</Button>
</AuthButton>
</Space>
)
}
......
......@@ -13,6 +13,7 @@ import { Link, useIntl } from 'umi';
import { getProductGoodsGoodsExamineList2, postProductGoodsGoodsExamineBatch2 } from '@/services/ProductV2Api';
import { EMPTY, fetchBrand, fetchCategoryData, fetchTreeData, useAsyncCascader } from '../common/useGetTableSearchData';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import AuthButton from '@/components/AuthButton';
/**
* 物料查询
......@@ -36,9 +37,11 @@ const MaterialQuery = () => {
render: (text, record) => {
return (
<Space>
<Link to={`/memberCenter/commodityAbility/material/pendingExamII/detail?id=${record.id}`}>
{intl.formatMessage({ id: 'material.exam.button', defaultMessage: '审核'})}
</Link>
<AuthButton btnCode='material.examII.toExam'>
<Link to={`/memberCenter/commodityAbility/material/pendingExamII/detail?id=${record.id}`}>
{intl.formatMessage({ id: 'material.exam.button', defaultMessage: '审核'})}
</Link>
</AuthButton>
</Space>
)
}
......@@ -49,13 +52,15 @@ const MaterialQuery = () => {
const controllerBtns = () => {
return (
<Space>
<Button
type="primary"
onClick={handleBatchSuccess}
loading={loading}
>
{intl.formatMessage({ id: 'material.exam.batch.success', defaultMessage: '批量审核通过'})}
</Button>
<AuthButton btnCode='material.examII.batch'>
<Button
type="primary"
onClick={handleBatchSuccess}
loading={loading}
>
{intl.formatMessage({ id: 'material.exam.batch.success', defaultMessage: '批量审核通过'})}
</Button>
</AuthButton>
</Space>
)
}
......
......@@ -17,6 +17,7 @@ import { DownOutlined } from '@ant-design/icons';
import FrozonMadal from '../components/frozonMadal';
import { FROZEN, HAS_CONFIRM } from '@/constants/material';
import { useIntl } from 'umi';
import AuthButton from '@/components/AuthButton';
/**
* 物料查询
......@@ -78,36 +79,47 @@ const MaterialQuery = () => {
{
(record.interiorState === FROZEN || record.interiorState === HAS_CONFIRM )
&& (
<Menu.Item
onClick={() => handleFrozonOrEnable({ interiorState: record.interiorState, id: record.id })}
>
{
record.interiorState === HAS_CONFIRM
? intl.formatMessage({ id: 'material.frozon', defaultMessage: '冻结'})
: intl.formatMessage({ id: 'material.enable', defaultMessage: '启用'})
}
</Menu.Item>
<AuthButton btnCode='material.enableOrFrozen'>
<Menu.Item
onClick={() => handleFrozonOrEnable({ interiorState: record.interiorState, id: record.id })}
>
{
record.interiorState === HAS_CONFIRM
? intl.formatMessage({ id: 'material.frozon', defaultMessage: '冻结'})
: intl.formatMessage({ id: 'material.enable', defaultMessage: '启用'})
}
</Menu.Item>
</AuthButton>
)
}
{
record.interiorState === HAS_CONFIRM && (
<Menu.Item>
<Link to={`${URL_PREFIX}/pendingAdd/edit?id=${record.id}`}>
{intl.formatMessage({ id: 'material.change', defaultMessage: '变更'})}
</Link>
</Menu.Item>
<AuthButton btnCode='material.toChange'>
<Menu.Item>
<Link to={`${URL_PREFIX}/pendingAdd/edit?id=${record.id}`}>
{intl.formatMessage({ id: 'material.change', defaultMessage: '变更'})}
</Link>
</Menu.Item>
</AuthButton>
)
}
<Menu.Item>
<Link to={`/memberCenter/commodityAbility/priceManage/priceLibrary?code=${record.code}`}>
{intl.formatMessage({ id: 'material.priceLibrary', defaultMessage: '价格库' })}
</Link>
</Menu.Item>
<AuthButton btnCode='material.toPriceLibrary'>
<Menu.Item>
<Link to={`/memberCenter/commodityAbility/priceManage/priceLibrary?code=${record.code}`}>
{intl.formatMessage({ id: 'material.priceLibrary', defaultMessage: '价格库' })}
</Link>
</Menu.Item>
</AuthButton>
</Menu>
)
return (
<Space>
<Link to={{pathname: `${URL_PREFIX}/query/sourceList`, query: { id: record.id }, state: { name: record.name }}}>货源清单</Link>
<AuthButton btnCode='material.sourceList'>
<Link to={{pathname: `${URL_PREFIX}/query/sourceList`, query: { id: record.id }, state: { name: record.name }}}>货源清单</Link>
</AuthButton>
<Dropdown overlay={menu}>
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
{intl.formatMessage({ id: 'material.more', defaultMessage: '更多' })} <DownOutlined />
......@@ -138,19 +150,23 @@ const MaterialQuery = () => {
const controllerBtns = () => {
return (
<Space>
<Button
type="primary"
loading={loading}
onClick={handleBatchForFrozen}
>
{intl.formatMessage({ id: 'material.frozon.batch', defaultMessage: '批量冻结' })}
</Button>
<Button
onClick={() => handleBatchFrozen(1)}
loading={enableLoading}
>
{intl.formatMessage({ id: 'material.enable.batch', defaultMessage: '批量启用' })}
</Button>
<AuthButton btnCode='material.batchFrozon'>
<Button
type="primary"
loading={loading}
onClick={handleBatchForFrozen}
>
{intl.formatMessage({ id: 'material.frozon.batch', defaultMessage: '批量冻结' })}
</Button>
</AuthButton>
<AuthButton btnCode='material.batchEnable'>
<Button
onClick={() => handleBatchFrozen(1)}
loading={enableLoading}
>
{intl.formatMessage({ id: 'material.enable.batch', defaultMessage: '批量启用' })}
</Button>
</AuthButton>
</Space>
)
}
......
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