Commit 45228df7 authored by Bill's avatar Bill

fix: 修改品类导航页bug

parent 2c2e20cb
......@@ -37,6 +37,7 @@ export function useFilterSameOption() {
return {};
}
const result = {};
result['tab'] = []
tabChildren.forEach((_nodeKey) => {
if (!pageConfig[_nodeKey]) {
return;
......@@ -47,6 +48,7 @@ export function useFilterSameOption() {
if (typeof result[`${parentType}_${id}`] === 'undefined') {
result[`${parentType}_${id}`] = [];
}
result['tab'].push(id);
result[`${parentType}_${id}`].push(id);
const tabItemChild = pageConfig[_nodeKey].childNodes;
......
......@@ -9,7 +9,6 @@ function useGetLayout() {
const [info, setInfo] = useState<any>(null);
/** isSelf 判断自有商城 */
const { id, isSelf } = usePageStatus();
console.log(isSelf);
const [dataSourceFromRequest, setDataSourceFromRequest] = useState<any>(null);
useEffect(() => {
......
......@@ -53,6 +53,7 @@ const CommoditySchema: ISchema = {
style: { width: '174px' },
searchValue: null,
dataoption: [],
allowClear: true,
},
},
categoryId: {
......
import React, { useContext, useEffect, useMemo, useState } from 'react';
import { changeProps, clearSelectedStatus, PageConfigType, SelectedInfoType, StateType, STATE_PROPS, } from '@lingxi-disign/core';
import { changeProps, clearSelectedStatus, PageConfigType, SelectedInfoType, StateType, STATE_PROPS, } from '@lingxi-disign/react';
import { useSelector } from '@lingxi-disign/react';
import cs from 'classnames';
import { usePrevious, useToggle } from '@umijs/hooks';
......@@ -61,11 +61,12 @@ const EditPanel = () => {
* 当每次点击selectInfo 时,都把selectInfo.props 映射到formily 的value 上
* 但当一级类型没有被选择的时候,那么必须选择一级导航类型
*/
console.log()
useEffect(() => {
if (activeKey === null && previousActiveKey !== activeKey) {
if(activeKey === null) {
if (activeKey === null && selectedInfo !== null) {
// if(activeKey === null) {
message.info("请先选择一级导航类型");
}
// }
const primaryTabProps = pageConfig[domKey!].props;
setFormValue({
primary: primaryTabProps?.id,
......@@ -224,10 +225,11 @@ const EditPanel = () => {
if(componentType.includes('suggestProduct') && type === 0) {
setType(values.type);
}
console.log(values);
changeProps({
treeKey: key,
props: currentProps,
title: values?.title || values?.name || values?.rankProduct?.name || values.productName || values?.brand?.name || values?.blockTitle,
title: values?.title || values?.name || values?.rankProduct?.name || values?.brand?.name || values?.blockTitle || values?.product?.productName,
});
setVisible(false);
handleOnClose();
......@@ -259,10 +261,10 @@ const EditPanel = () => {
*/
useEffect(() => {
const sameKeyStateKeys = Object.keys(sameKeyState);
if (!activeKey || sameKeyStateKeys.length === 0) {
if (sameKeyStateKeys.length === 0) {
return;
}
const hasSelectedTabKeys = Object.keys(sameKeyState).filter((_item) => /tabItem_\d+$/.test(_item));
const hasSelectedTabKeys = sameKeyState['tab'];
formActions.setFieldState('layout.primary', (state) => {
const tempData = state.originAsyncData || [];
FormPath.setIn(state, 'props.enum', tempData.map((_item) => {
......@@ -270,7 +272,7 @@ const EditPanel = () => {
// ..._item,
label: _item.name,
value: _item.id,
disabled: hasSelectedTabKeys.includes(`tabItem_${_item.id}`),
disabled: hasSelectedTabKeys.includes(_item.id),
};
}));
});
......
......@@ -99,7 +99,11 @@ export const blockSchema: ISchema = {
{
required: true,
message: '请填写标题'
}
},
{
limitByte: true, // 自定义校验规则
maxByte: 32,
},
]
},
}
......@@ -158,7 +162,11 @@ export const saleRankSchema: ISchema = {
{
required: true,
message: '请填写销量',
}
},
{
limitByte: true, // 自定义校验规则
maxByte: 16,
},
]
}
......
......@@ -15,9 +15,10 @@ export const searchBrandOptionEffect = (
name: state.props['x-component-props'].searchValue,
...serachParams,
}).then(res => {
console.log("123io1u23io1u23iou12 3o",res);
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data?.data?.map(item => {
return { label: item.name, value: item.id };
return { name: item.name, id: item.id };
}) || [];
});
});
......
......@@ -48,7 +48,6 @@ const FormilyCommodity: React.FC<Iprops> & { isFieldComponent: boolean } = (prop
const sameKeyState = useFilterSameOption();
const componentProps = props.props?.['x-component-props'] || {} as ComponentTypeProps;
const disabledSaleRankingKeys = useMemo(() => sameKeyState[`tabItem_${activeKey}_${componentProps.commodityKey}`], [sameKeyState, activeKey]);
console.log(sameKeyState, disabledSaleRankingKeys );
const { state: productVisible, toggle: setProductVisible } = useToggle();
const productProps = useMemo(() => ({
......@@ -77,11 +76,11 @@ const FormilyCommodity: React.FC<Iprops> & { isFieldComponent: boolean } = (prop
const formatSearchParams = (params) => {
const idInList = typeof params.id !== 'undefined' && params.id ? { idInList: [params.id] } : {}
const { id, ...rest } = params;
const { id, categoryId, ...rest } = params;
const idNotInList = Array.from(new Set([productProps?.id].concat(disabledSaleRankingKeys).filter(Boolean)));
const common = {
shopId: fixtureContext?.shopId.toString(),
customerCategoryId: activeKey,
customerCategoryId: categoryId || activeKey,
memberId: userAuth.memberId,
memberRoleId: userAuth.memberRoleId,
idNotInList: idNotInList,
......
......@@ -110,10 +110,10 @@ const CategoryNavigation = () => {
...rest,
children: childNodes.map((_son) => {
const sonData = pageConfig[_son];
return keyFunc[type]?.(sonData.props);
})
if (sonData && sonData.props) {
return keyFunc[type]?.(sonData.props);
}
}).filter(Boolean)
};
});
tabProps['children'] = tabItemData;
......
import React, { useEffect, useRef, useState } from 'react';
import StatusTag from '@/components/StatusTag';
import { CloseOutlined, PlusOutlined, DeleteOutlined, EditOutlined } from '@ant-design/icons';
import { Input, Tag, Space } from 'antd';
import { Input, Tag, Space, message } from 'antd';
// eslint-disable-next-line @typescript-eslint/camelcase
import { unstable_batchedUpdates } from 'react-dom';
import { priceFormat } from '@/utils/numberFomat';
......@@ -54,6 +54,11 @@ const Product: React.FC<Iprops> = (props: Iprops) => {
}, [isWithLabels, label]);
const handleInputChange = (e) => {
const inputLabel = e.target.value.replace(/[\u4E00-\u9FA5]/g, "AA");
if (inputLabel.length > 32) {
message.error("输入字符长度不能大于32个字符或16个汉字");
return
}
setInputValue(e.target.value);
};
......
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