feat(basic-data): 新增档口管理功能并优化瓜农列表
- 移除箱产品列表中的农夫箱类型选项 - 新增 MelonStallList 组件用于档口信息管理 - 重构 MelonFarmerList 组件国际化前缀及参数传递逻辑 - 导出 MelonStallList 组件便于页面引用 - 在基础数据索引文件中添加档口列表导出 - 更新采购订单列表组件支持自定义查询参数 - 添加产地采购和市场采购订单页面 - 完善档口相关国际化文案配置 - 调整供应商类型枚举值及采购订单类型字段 - 优化左侧菜单匹配逻辑以支持子菜单展开显示 - 修改部分接口字段类型定义提升数据准确性
This commit is contained in:
parent
3e24b86326
commit
da1200716a
@ -244,12 +244,6 @@ export default function BoxProductList(props: IBoxProductListProps) {
|
||||
id: intlPrefix + '.type.thirdPartyBox',
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: 'FARMER_BOX',
|
||||
tab: intl.formatMessage({
|
||||
id: intlPrefix + '.type.farmerBox',
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
}}
|
||||
|
||||
@ -5,8 +5,10 @@ import {
|
||||
ModeType,
|
||||
} from '@/components';
|
||||
import { business } from '@/services';
|
||||
import { formatBankCard, formatIdCard, formatPhone } from '@/utils/format';
|
||||
import { formatParam } from '@/utils/formatParam';
|
||||
import { useIntl } from '@@/exports';
|
||||
import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons';
|
||||
import {
|
||||
ActionType,
|
||||
ProColumns,
|
||||
@ -15,8 +17,6 @@ import {
|
||||
import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
||||
import { ProFormUploadMaterial } from '@chageable/components';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons';
|
||||
import { formatBankCard, formatIdCard, formatPhone } from '@/utils/format';
|
||||
|
||||
interface IMelonFarmerListProps {
|
||||
ghost?: boolean;
|
||||
@ -37,7 +37,7 @@ export default function MelonFarmerList(props: IMelonFarmerListProps) {
|
||||
onValueChange,
|
||||
} = props;
|
||||
const intl = useIntl();
|
||||
const intlPrefix = 'supplier';
|
||||
const intlPrefix = 'melonFarmer';
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
||||
const [showIdCard, setShowIdCard] = useState<Record<string, boolean>>({});
|
||||
@ -142,6 +142,8 @@ export default function MelonFarmerList(props: IMelonFarmerListProps) {
|
||||
];
|
||||
|
||||
const formContext = [
|
||||
<ProFormText key={'type'} name={'type'} hidden={true} />,
|
||||
<ProFormText key={'payeeName'} name={'payeeName'} hidden={true} />,
|
||||
<ProFormText
|
||||
key={'name'}
|
||||
name={'name'}
|
||||
@ -150,6 +152,12 @@ export default function MelonFarmerList(props: IMelonFarmerListProps) {
|
||||
placeholder={intl.formatMessage({
|
||||
id: intlPrefix + '.form.name.placeholder',
|
||||
})}
|
||||
transform={(value) => {
|
||||
return {
|
||||
name: value,
|
||||
payeeName: value,
|
||||
};
|
||||
}}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
@ -289,6 +297,9 @@ export default function MelonFarmerList(props: IMelonFarmerListProps) {
|
||||
ghost,
|
||||
//@ts-ignore
|
||||
search,
|
||||
params: {
|
||||
type: 'FARMER',
|
||||
},
|
||||
},
|
||||
columns,
|
||||
}}
|
||||
@ -297,6 +308,7 @@ export default function MelonFarmerList(props: IMelonFarmerListProps) {
|
||||
formContext,
|
||||
initValues: {
|
||||
status: true,
|
||||
type: 'FARMER',
|
||||
},
|
||||
}}
|
||||
update={{
|
||||
|
||||
@ -0,0 +1,253 @@
|
||||
import {
|
||||
BizContainer,
|
||||
BizValueType,
|
||||
MaterialList,
|
||||
ModeType,
|
||||
} from '@/components';
|
||||
import { business } from '@/services';
|
||||
import { formatBankCard } from '@/utils/format';
|
||||
import { formatParam } from '@/utils/formatParam';
|
||||
import { useIntl } from '@@/exports';
|
||||
import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons';
|
||||
import {
|
||||
ActionType,
|
||||
ProColumns,
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
||||
import { ProFormUploadMaterial } from '@chageable/components';
|
||||
import React, { useRef, useState } from 'react';
|
||||
|
||||
interface IMelonStallListProps {
|
||||
ghost?: boolean;
|
||||
supplierId?: BusinessAPI.SupplierVO['supplierId'];
|
||||
search?: boolean;
|
||||
onValueChange?: () => void;
|
||||
mode?: ModeType;
|
||||
trigger?: () => React.ReactNode;
|
||||
}
|
||||
|
||||
export default function MelonStallList(props: IMelonStallListProps) {
|
||||
const {
|
||||
ghost = false,
|
||||
supplierId,
|
||||
search = true,
|
||||
mode = 'page',
|
||||
trigger,
|
||||
onValueChange,
|
||||
} = props;
|
||||
const intl = useIntl();
|
||||
const intlPrefix = 'melonStall';
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
||||
const [showBankCard, setShowBankCard] = useState<Record<string, boolean>>({});
|
||||
|
||||
const columns: ProColumns<BusinessAPI.SupplierVO, BizValueType>[] = [
|
||||
{
|
||||
title: intl.formatMessage({ id: intlPrefix + '.column.name' }),
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
renderText: (text: string) => <span className="font-medium">{text}</span>,
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: intlPrefix + '.column.payeeName' }),
|
||||
dataIndex: 'payeeName',
|
||||
key: 'payeeName',
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: intlPrefix + '.column.bankCard' }),
|
||||
dataIndex: 'bankCard',
|
||||
key: 'bankCard',
|
||||
render: (_, record) => (
|
||||
<div className="flex items-center">
|
||||
<span>
|
||||
{formatBankCard(record.bankCard, showBankCard[record.supplierId])}
|
||||
</span>
|
||||
<span
|
||||
className="ml-2 cursor-pointer"
|
||||
onClick={() => {
|
||||
setShowBankCard((prev) => ({
|
||||
...prev,
|
||||
[record.supplierId]: !prev[record.supplierId],
|
||||
}));
|
||||
}}
|
||||
>
|
||||
{showBankCard[record.supplierId] ? (
|
||||
<EyeTwoTone />
|
||||
) : (
|
||||
<EyeInvisibleOutlined />
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: intlPrefix + '.column.wechatQr' }),
|
||||
dataIndex: 'wechatQr',
|
||||
valueType: 'image',
|
||||
key: 'wechatQr',
|
||||
search: false,
|
||||
},
|
||||
];
|
||||
|
||||
const formContext = [
|
||||
<ProFormText key={'type'} name={'type'} hidden={true} />,
|
||||
<ProFormText key={'payeeName'} name={'payeeName'} hidden={true} />,
|
||||
<ProFormText
|
||||
key={'name'}
|
||||
name={'name'}
|
||||
label={intl.formatMessage({ id: intlPrefix + '.form.name.label' })}
|
||||
required={true}
|
||||
placeholder={intl.formatMessage({
|
||||
id: intlPrefix + '.form.name.placeholder',
|
||||
})}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: intl.formatMessage({
|
||||
id: intlPrefix + '.form.name.required',
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
<ProFormText
|
||||
key={'payeeName'}
|
||||
name={'payeeName'}
|
||||
label={intl.formatMessage({ id: intlPrefix + '.form.payeeName.label' })}
|
||||
required={true}
|
||||
placeholder={intl.formatMessage({
|
||||
id: intlPrefix + '.form.payeeName.placeholder',
|
||||
})}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: intl.formatMessage({
|
||||
id: intlPrefix + '.form.payeeName.required',
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
<ProFormText
|
||||
key={'bankCard'}
|
||||
name={'bankCard'}
|
||||
label={intl.formatMessage({ id: intlPrefix + '.form.bankCard.label' })}
|
||||
required={true}
|
||||
placeholder={intl.formatMessage({
|
||||
id: intlPrefix + '.form.bankCard.placeholder',
|
||||
})}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: intl.formatMessage({
|
||||
id: intlPrefix + '.form.bankCard.required',
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
<ProFormUploadMaterial
|
||||
key={'wechatQr'}
|
||||
label={intl.formatMessage({
|
||||
id: intlPrefix + '.form.wechatQr.label',
|
||||
})}
|
||||
name={'wechatQrList'}
|
||||
transform={(value) => {
|
||||
return {
|
||||
wechatQrList: value,
|
||||
wechatQr: value[0],
|
||||
};
|
||||
}}
|
||||
fieldProps={{
|
||||
maxCount: 1,
|
||||
actionRef: actionRef,
|
||||
toolBarRender: () => [
|
||||
<MaterialList
|
||||
key={'create'}
|
||||
ghost={true}
|
||||
mode={'create'}
|
||||
search={false}
|
||||
onValueChange={() => actionRef.current?.reload()}
|
||||
/>,
|
||||
],
|
||||
request: async (params, sorter, filter) => {
|
||||
const { data, success, totalCount } =
|
||||
await business.material.pageMaterial({
|
||||
materialPageQry: formatParam<typeof params>(
|
||||
params,
|
||||
sorter,
|
||||
filter,
|
||||
),
|
||||
});
|
||||
|
||||
return {
|
||||
data: data || [],
|
||||
total: totalCount,
|
||||
success,
|
||||
};
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
];
|
||||
|
||||
const detailColumns: ProDescriptionsItemProps<
|
||||
BusinessAPI.SupplierVO,
|
||||
BizValueType
|
||||
>[] = columns as ProDescriptionsItemProps<
|
||||
BusinessAPI.SupplierVO,
|
||||
BizValueType
|
||||
>[];
|
||||
|
||||
return (
|
||||
<BizContainer<
|
||||
typeof business.supplier,
|
||||
BusinessAPI.SupplierVO,
|
||||
BusinessAPI.SupplierPageQry,
|
||||
BusinessAPI.SupplierCreateCmd,
|
||||
BusinessAPI.SupplierUpdateCmd
|
||||
>
|
||||
rowKey={'supplierId'}
|
||||
permission={'operation-supplier'}
|
||||
func={business.supplier}
|
||||
method={'supplier'}
|
||||
methodUpper={'Supplier'}
|
||||
intlPrefix={intlPrefix}
|
||||
modeType={mode}
|
||||
onValueChange={onValueChange}
|
||||
container={{}}
|
||||
remark={{
|
||||
mode: 'editor',
|
||||
}}
|
||||
status
|
||||
page={{
|
||||
fieldProps: {
|
||||
bordered: true,
|
||||
ghost,
|
||||
//@ts-ignore
|
||||
search,
|
||||
params: {
|
||||
type: 'STALL',
|
||||
},
|
||||
},
|
||||
columns,
|
||||
}}
|
||||
create={{
|
||||
formType: 'drawer',
|
||||
formContext,
|
||||
initValues: {
|
||||
status: true,
|
||||
type: 'STALL',
|
||||
},
|
||||
}}
|
||||
update={{
|
||||
formType: 'drawer',
|
||||
formContext,
|
||||
}}
|
||||
destroy={{}}
|
||||
detail={{
|
||||
rowId: supplierId,
|
||||
formType: 'drawer',
|
||||
columns: detailColumns,
|
||||
trigger,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
export { default as MelonFarmerList } from './MelonFarmerList';
|
||||
export { default as MelonStallList } from './MelonStallList';
|
||||
export { default as BoxProductList } from './BoxProductList'
|
||||
export { default as BoxBrandList } from './BoxBrandList';
|
||||
export { default as CostList } from './CostList';
|
||||
|
||||
@ -13,6 +13,7 @@ interface IPurchaseOrderListProps {
|
||||
onValueChange?: () => void;
|
||||
mode?: ModeType;
|
||||
trigger?: () => React.ReactNode;
|
||||
params?: BusinessAPI.PurchaseOrderPageQry;
|
||||
}
|
||||
|
||||
export default function PurchaseOrderList(props: IPurchaseOrderListProps) {
|
||||
@ -23,6 +24,7 @@ export default function PurchaseOrderList(props: IPurchaseOrderListProps) {
|
||||
mode = 'page',
|
||||
trigger,
|
||||
onValueChange,
|
||||
params,
|
||||
} = props;
|
||||
const intl = useIntl();
|
||||
const intlPrefix = 'purchaseOrder';
|
||||
@ -154,6 +156,7 @@ export default function PurchaseOrderList(props: IPurchaseOrderListProps) {
|
||||
...(activeKey !== 'ALL' && {
|
||||
state: activeKey! as BusinessAPI.PurchaseOrderVO['state'],
|
||||
}),
|
||||
...params,
|
||||
},
|
||||
toolbar: {
|
||||
menu: {
|
||||
|
||||
@ -1117,9 +1117,9 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
supplier: {
|
||||
melonFarmer: {
|
||||
column: {
|
||||
name: '姓名',
|
||||
name: '瓜农姓名',
|
||||
idCard: '身份证号',
|
||||
phone: '手机号',
|
||||
bankCard: '银行卡号',
|
||||
@ -1207,6 +1207,90 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
melonStall: {
|
||||
column: {
|
||||
name: '档口名称',
|
||||
payeeName: '收款人姓名',
|
||||
bankCard: '银行卡号',
|
||||
wechatQr: '微信收款码',
|
||||
remark: '备注',
|
||||
status: '状态',
|
||||
'status.enum.enabled': '正常',
|
||||
'status.enum.disabled': '禁用',
|
||||
'status.placeholder': '请选择状态',
|
||||
createdAt: '创建时间',
|
||||
option: '操作',
|
||||
},
|
||||
form: {
|
||||
name: {
|
||||
label: '档口名称',
|
||||
placeholder: '请输入档口名称',
|
||||
required: '档口名称为必填项',
|
||||
},
|
||||
payeeName: {
|
||||
label: '收款人姓名',
|
||||
placeholder: '请输收款人姓名',
|
||||
required: '收款人姓名为必填项',
|
||||
},
|
||||
bankCard: {
|
||||
label: '银行卡号',
|
||||
placeholder: '请输入银行卡号',
|
||||
required: '银行卡号为必填项',
|
||||
},
|
||||
wechatQr: {
|
||||
label: '微信收款码',
|
||||
placeholder: '请输入微信收款码',
|
||||
required: '微信收款码为必填项',
|
||||
},
|
||||
remark: {
|
||||
label: '备注',
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
status: {
|
||||
label: '状态',
|
||||
placeholder: '请选择状态',
|
||||
required: '状态为必填项',
|
||||
enum: {
|
||||
enabled: '正常',
|
||||
disabled: '禁用',
|
||||
},
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
create: {
|
||||
title: '新增档口',
|
||||
button: '新增档口',
|
||||
success: '新增档口成功',
|
||||
},
|
||||
update: {
|
||||
title: '更新档口',
|
||||
button: '编辑',
|
||||
success: '更新档口成功',
|
||||
status: {
|
||||
success: '修改状态成功',
|
||||
},
|
||||
},
|
||||
delete: {
|
||||
success: '删除档口成功',
|
||||
button: '删除',
|
||||
confirm: {
|
||||
title: '确认删除',
|
||||
content: '您确定要删除该档口吗?',
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
},
|
||||
},
|
||||
import: {
|
||||
title: '导入档口',
|
||||
button: '导入',
|
||||
success: '导入档口成功',
|
||||
},
|
||||
view: {
|
||||
title: '查看档口',
|
||||
button: '查看',
|
||||
},
|
||||
},
|
||||
},
|
||||
boxSpec: {
|
||||
column: {
|
||||
name: '规格名称',
|
||||
@ -1357,8 +1441,7 @@ export default {
|
||||
type: {
|
||||
all: '全部',
|
||||
ourBox: '自产箱',
|
||||
farmerBox: '农夫箱',
|
||||
thirdPartyBox: '第三方箱',
|
||||
thirdPartyBox: '无利润箱',
|
||||
giftBox: '礼盒',
|
||||
},
|
||||
column: {
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
import { PurchaseOrderList } from '@/components';
|
||||
|
||||
export default function Page() {
|
||||
return <PurchaseOrderList />;
|
||||
return (
|
||||
<PurchaseOrderList
|
||||
params={{
|
||||
type: 'PRODUCTION_PURCHASE',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
11
packages/app-operation/src/pages/MarketPurchaseOrder.tsx
Normal file
11
packages/app-operation/src/pages/MarketPurchaseOrder.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import { PurchaseOrderList } from '@/components';
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<PurchaseOrderList
|
||||
params={{
|
||||
type: 'MARKET_PURCHASE',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
5
packages/app-operation/src/pages/MelonStall.tsx
Normal file
5
packages/app-operation/src/pages/MelonStall.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import { MelonStallList } from '@/components';
|
||||
|
||||
export default function Page() {
|
||||
return <MelonStallList />;
|
||||
}
|
||||
@ -1218,6 +1218,8 @@ declare namespace BusinessAPI {
|
||||
strawMatCostFlag?: boolean;
|
||||
/** 发货单合计金额是否含包装费 */
|
||||
includePackingFlag?: boolean;
|
||||
/** 发货单合计金额是否含包运费 */
|
||||
includeFreightFlag?: boolean;
|
||||
/** 应收金额 */
|
||||
receivable?: number;
|
||||
/** 备注 */
|
||||
@ -1540,6 +1542,8 @@ declare namespace BusinessAPI {
|
||||
strawMatCostFlag?: boolean;
|
||||
/** 发货单合计金额是否含包装费 */
|
||||
includePackingFlag?: boolean;
|
||||
/** 发货单合计金额是否含包运费 */
|
||||
includeFreightFlag?: boolean;
|
||||
/** 应收金额 */
|
||||
receivable?: number;
|
||||
/** 备注 */
|
||||
@ -1976,7 +1980,7 @@ declare namespace BusinessAPI {
|
||||
/** 车次号 */
|
||||
vehicleNo?: string;
|
||||
/** 计提金额 */
|
||||
provisionAmount: string;
|
||||
provisionAmount: number;
|
||||
/** 采购单ID */
|
||||
orderId?: string;
|
||||
};
|
||||
@ -2971,6 +2975,8 @@ declare namespace BusinessAPI {
|
||||
strawMatCostFlag?: boolean;
|
||||
/** 发货单合计金额是否含包装费 */
|
||||
includePackingFlag?: boolean;
|
||||
/** 发货单合计金额是否含包运费 */
|
||||
includeFreightFlag?: boolean;
|
||||
/** 是否开启计提税金 */
|
||||
enableAccrualTax?: boolean;
|
||||
/** 计提税金比例 */
|
||||
@ -3399,6 +3405,8 @@ declare namespace BusinessAPI {
|
||||
phone: string;
|
||||
/** 微信二维码 */
|
||||
wechatQr?: string;
|
||||
/** 供应商类型:1_瓜农;2_档口; */
|
||||
type: 'FARMER' | 'STALL';
|
||||
/** 是否最后一家 */
|
||||
isLast: boolean;
|
||||
/** 空磅是否包含纸箱 */
|
||||
@ -3551,6 +3559,8 @@ declare namespace BusinessAPI {
|
||||
phone: string;
|
||||
/** 微信二维码 */
|
||||
wechatQr: string;
|
||||
/** 供应商类型:1_瓜农;2_档口; */
|
||||
type: 'FARMER' | 'STALL';
|
||||
/** 是否最后一家 */
|
||||
isLast: boolean;
|
||||
/** 空磅是否包含纸箱 */
|
||||
@ -4383,6 +4393,8 @@ declare namespace BusinessAPI {
|
||||
| 'BOSS_APPROVED'
|
||||
| 'QUOTE_REJECTED'
|
||||
| 'BOSS_REJECTED';
|
||||
/** 采购类型:1_产地采购;2_市场采购; */
|
||||
type?: 'PRODUCTION_PURCHASE' | 'MARKET_PURCHASE';
|
||||
};
|
||||
|
||||
type PurchaseOrderCreateCmd = {
|
||||
@ -4458,6 +4470,8 @@ declare namespace BusinessAPI {
|
||||
| 'BOSS_APPROVED'
|
||||
| 'QUOTE_REJECTED'
|
||||
| 'BOSS_REJECTED';
|
||||
/** 采购类型:1_产地采购;2_市场采购; */
|
||||
type?: 'PRODUCTION_PURCHASE' | 'MARKET_PURCHASE';
|
||||
/** 供应商名称 */
|
||||
supplierName?: string;
|
||||
/** 经销商ID */
|
||||
@ -4578,6 +4592,8 @@ declare namespace BusinessAPI {
|
||||
| 'BOSS_APPROVED'
|
||||
| 'QUOTE_REJECTED'
|
||||
| 'BOSS_REJECTED';
|
||||
/** 采购类型:1_产地采购;2_市场采购; */
|
||||
type?: 'PRODUCTION_PURCHASE' | 'MARKET_PURCHASE';
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 创建人ID */
|
||||
@ -5254,6 +5270,8 @@ declare namespace BusinessAPI {
|
||||
supplierId?: string;
|
||||
/** 供应商名称 */
|
||||
name?: string;
|
||||
/** 供应商类型:1_瓜农;2_档口; */
|
||||
type?: 'FARMER' | 'STALL';
|
||||
};
|
||||
|
||||
type SupplierPackageUsage = {
|
||||
@ -5288,6 +5306,8 @@ declare namespace BusinessAPI {
|
||||
phone?: string;
|
||||
/** 银行卡号 */
|
||||
bankCard?: string;
|
||||
/** 供应商类型:1_瓜农;2_档口; */
|
||||
type?: 'FARMER' | 'STALL';
|
||||
offset?: number;
|
||||
};
|
||||
|
||||
@ -5330,6 +5350,8 @@ declare namespace BusinessAPI {
|
||||
bankCard: string;
|
||||
/** 微信收款码URL */
|
||||
wechatQr?: string;
|
||||
/** 供应商类型:1_瓜农;2_档口; */
|
||||
type: 'FARMER' | 'STALL';
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态:1_启用;0_禁用; */
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { MenuDataItem } from '@ant-design/pro-components';
|
||||
import { getMatchMenu } from '@umijs/route-utils';
|
||||
import { Layout, Menu } from 'antd';
|
||||
import { MenuItemType } from 'antd/es/menu/interface';
|
||||
import {MenuDataItem} from '@ant-design/pro-components';
|
||||
import {getMatchMenu} from '@umijs/route-utils';
|
||||
import {Layout, Menu} from 'antd';
|
||||
import {MenuItemType} from 'antd/es/menu/interface';
|
||||
import React from 'react';
|
||||
import useButtonStyle from './style.style';
|
||||
|
||||
@ -74,11 +74,14 @@ const LeftMenu: React.FC<ILeftMenuProps> = (props) => {
|
||||
});
|
||||
|
||||
// 通过循环 moduleMenu 判断 history.location.pathname 是否包含 key
|
||||
const activeMenu = getMatchMenu(pathname, menuData);
|
||||
const activeMenu = getMatchMenu(pathname, menuData, true);
|
||||
// pluck activeMenu key
|
||||
const activeMenuKey = activeMenu.map(
|
||||
(item: MenuDataItem) => item.key as string,
|
||||
);
|
||||
const openKeys = activeMenu.flatMap((item: MenuDataItem) => item.children).map(
|
||||
(item: any) => item?.key as string,
|
||||
);
|
||||
|
||||
let subMenu: MenuItemType[] = [];
|
||||
if (activeMenu[0]?.children) {
|
||||
@ -114,6 +117,7 @@ const LeftMenu: React.FC<ILeftMenuProps> = (props) => {
|
||||
items={subMenu}
|
||||
className={styles.subMenu}
|
||||
selectedKeys={activeMenuKey}
|
||||
openKeys={openKeys}
|
||||
mode="inline"
|
||||
inlineIndent={12}
|
||||
onClick={(item) => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user