Commit 51684410 authored by wuting's avatar wuting

Merge branch 'v2-220618' of…

Merge branch 'v2-220618' of https://gitlab.shushangyun.com/linkseeks-design/pro-admin into jinfa-0618
parents f0102b20 b0af6ab1
......@@ -74,4 +74,4 @@ const mountRouter = [
const router = isDev ? localRouter : mountRouter
export { router ,isDev};
export { router, isDev};
......@@ -10,7 +10,7 @@ import {
import OuterSider from './OuterSide'
import styles from '../styles/MenuSlider.less'
import { getRouters } from '@/utils/auth';
import { isDev } from '@/constants';
// import { isDev } from '../../../config/routes'
import menuIcon from '../../asserts/menuIcon/logo.png'
const { Sider } = Layout
const { SubMenu } = Menu;
......@@ -29,7 +29,6 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
const { menuData, pathname, currentSelectKey = [], openKeys = [], changeOpenKeys } = props
const [innerCollapsed, setInnerCollapsed] = useState(false)
let menuItemsCache = null
const getMenuRouter = (routes: any, pathname: any) => {
const list = routes.filter((item: any) => pathname.indexOf(item.key) > -1)
return list[0]
......@@ -39,7 +38,7 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
if (!!menuArray && menuArray.length > 0) {
return menuArray.map((item: any) => {
// 不存在路由表内或者 需要隐藏
if (item.hideInMenu || (!getRouters().includes(item.path) && !isDev)) {
if (item.hideInMenu) {
return null
}
......
......@@ -3,7 +3,7 @@ import { Layout, Menu, Avatar, Image } from 'antd'
import { Link } from 'umi'
import styles from '../styles/MenuSlider.less'
import { getRouters } from '@/utils/auth'
import { isDev } from '@/constants'
// import { isDev } from '../../../config/routes'
import { observer, inject } from 'mobx-react';
import CustomIcon from './CustomIcon';
import Icon from '@ant-design/icons';
......@@ -22,25 +22,23 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
const { menuData, pathname = "/", currentRouter } = props
const authRouters = getRouters()
let defaultSelectedKeys = ""
const isAuthPath = (path) => {
if (isDev) {
// if (isDev) {
return true
} else {
return authRouters.includes(path)
}
// } else {
// return authRouters.includes(path)
// }
}
const getSubMenu = () => {
const subHeadMenus: Array<any> = []
menuData.forEach(item => {
// 为适配pass菜单自由组合变更, 使用code进行高亮显示
const code = currentRouter.relationParentCode
const code = currentRouter?.relationParentCode
// console.log(code, item.relationParentCode)
if (code && code === item.relationParentCode) {
defaultSelectedKeys = item.relationParentCode
}
!item.hideInMenu && isAuthPath(item.path) && subHeadMenus.push({
path: item.path,
title: item.name,
......
......@@ -143,7 +143,7 @@ const BasicLayout: React.FC<any> = (props) => {
minWidth: '1280px',
}
: {}
return currentRouter.noLayout ? props.children : (
return currentRouter?.noLayout ? props.children : (
<ProLayout
pageTitleRender={() => currentRouter ? currentRouter.name : window.location.href}
// contentStyle={{minWidth: '1280px'}}
......
......@@ -61,7 +61,8 @@ const ListWrap: React.FC<ListType> = (props) => {
currentListData.length && currentListData.forEach(item => {
let obj = {}
item.map(val => {
return obj[val.fieldName] = val.fieldValue
obj[val.fieldName] = val.fieldValue
obj.key = val.fieldOrder
})
sumData.push(obj)
})
......@@ -71,7 +72,7 @@ const ListWrap: React.FC<ListType> = (props) => {
}, [currentListData])
return (
<Table columns={tableCoumns} pagination={false} dataSource={tableData} style={{width: '95%'}} />
<Table rowKey='key' columns={tableCoumns} pagination={false} dataSource={tableData} style={{width: '95%'}} />
)
}
......
......@@ -10,7 +10,7 @@ import { history, Prompt } from 'umi';
import { Button, Card, Spin, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { createFormActions, FormEffectHooks, FormPath, IFormExtendsEffectSelector, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { Radio, Checkbox, ArrayTable } from '@formily/antd-components';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
......@@ -85,9 +85,10 @@ const MemberForm: React.FC<MemberFormProps> = ({
...rest
}: any = infoRes.data;
// 注册资料处理
const detail = {}, list = []
const detail = {}
for (let i = 0; i < groups.length; i++) {
const item = groups[i];
const item = groups[i]
if (item.elements) {
for (let j = 0; j < item.elements.length; j++) {
const ele = item.elements[j];
......@@ -95,14 +96,13 @@ const MemberForm: React.FC<MemberFormProps> = ({
detail[ele.fieldName] = ele.fieldValue;
}
if (ele.fieldType === 'list') {
ele.registers && ele.registers.forEach(element => {
let obj = {}
element.map(val => {
detail[ele.fieldName] = ele.registers?.map(element => {
let obj = {};
element.forEach(val => {
obj[val.fieldName] = val.fieldValue;
})
list.push(obj)
})
detail[ele.fieldName] = list
});
return obj;
});
}
}
}
......@@ -211,21 +211,21 @@ const MemberForm: React.FC<MemberFormProps> = ({
const res = await getMemberMaintenanceAddpageitems();
if (res.code === 1000) {
const { data = {} }: any = res;
const { data } = res;
const {
memberTypes = [],
countryCodes = [],
memberTypes,
countryCodes,
} = data;
return {
memberTypeId: memberTypes.map(item => ({ label: item.memberTypeName, value: item.memberTypeId })),
countryCodeId: countryCodes.map(item => ({ label: item.text, value: item.id })),
memberTypeId: memberTypes?.map(item => ({ label: item.memberTypeName, value: item.memberTypeId })),
countryCodeId: countryCodes?.map(item => ({ label: item.text, value: item.id, phoneLength: item.phoneLength })),
};
}
return {};
};
const useBusinessEffects = () => {
const useBusinessEffects = ($: IFormExtendsEffectSelector<any, ISchemaFormActions | ISchemaFormAsyncActions>) => {
const linkage = useLinkageUtils();
// 间接触发根据会员类型
......@@ -316,6 +316,47 @@ const MemberForm: React.FC<MemberFormProps> = ({
}, 0);
});
// 国家区号改变,触发电话号码校验
onFieldInputChange$('countryCodeId').subscribe(() => {
const phoneValue = formActions.getFieldValue('phone');
if (phoneValue) {
formActions.setFieldState('phone', (state) => {
state.value = '';
});
}
});
// 国家区号改变,触发电话号码校验
onFieldValueChange$('countryCodeId').subscribe((fieldState) => {
const current = fieldState.props.enum?.find((item) => item.value === fieldState.value);
if (current && current.phoneLength) {
formActions.setFieldState('phone', (state) => {
state.rules = [
{
required: true,
message: '请输入你的手机号码',
},
{
validator: (value) => {
return value?.length > current.phoneLength ? `注册手机号超出${current.phoneLength}位数` : '';
},
},
];
});
}
});
// 订阅 countryCodeId 选项初始化
$('requestAsyncSelect').subscribe(({ name: names, payload }) => {
const countryCodeIdValue = formActions.getFieldValue('countryCodeId');
if (
names.includes('countryCodeId')
&& payload.countryCodeId?.length
&& countryCodeIdValue
) {
formActions.setFieldValue('countryCodeId', countryCodeIdValue);
}
});
}
return (
......@@ -353,7 +394,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
getPageitemsBasic,
);
useBusinessEffects();
useBusinessEffects($);
onFormInputChange$().subscribe(() => {
if (!unsaved) {
......
......@@ -82,18 +82,16 @@ export const initDetailSchema = (props: GroupItem[]) => {
},
phone: {
type: 'string',
required: true,
'x-mega-props': {
span: 2,
},
'x-component-props': {
placeholder: '请输入你的手机号码',
maxLength: 11,
},
'x-rules': [
{
pattern: PATTERN_MAPS.phone,
message: '请输入正确格式的手机号',
required: true,
message: '请输入你的手机号码',
},
],
},
......
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