Commit dd0b6d1e authored by XieZhiXiong's avatar XieZhiXiong

feat: 调整会员 接口

parent cbae8fcf
/*
* @Author: LeeJiancong
* @Date: 2020-07-22 09:54:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 19:28:23
*/
/**
* 正则表达式集合
*/
export const PATTERN_MAPS = {
// 8-20位, 大小写字幕 + 数字组合
password: /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,20}$/,
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
smsCode: /^\d{6}$/,
money:/^\d*(?:\.\d{0,2})?$/,
weight:/^\d*(?:\.\d{0,3})?$/,
idCard: /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
/*
* @Author: LeeJiancong
* @Date: 2020-07-22 09:54:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 19:28:23
*/
/**
* 正则表达式集合
*/
export const PATTERN_MAPS = {
// 8-20位, 大小写字幕 + 数字组合
password: /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,20}$/,
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
phoneAndEmail: /^(1[3|4|5|6|7|8|9][0-9]{9})|([\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+)$/,
tel: /^((0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/,//座机
smsCode: /^\d{6}$/,
money:/^\d*(?:\.\d{0,2})?$/,
weight:/^\d*(?:\.\d{0,3})?$/,
quantity: /^[1-9]+[0-9]*$/, // 数量,大于等于1的正整数
identity: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, // 数量,大于等于1的正整数
}
\ No newline at end of file
import React, { useState } from 'react';
import {
Row,
Col,
Descriptions,
import {
Row,
Col,
Descriptions,
} from 'antd';
import MellowCard from '@/components/MellowCard';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants';
import PicWrap from '../PicWrap';
import FlowRecords, { InnerHistoryItem, OuterHistoryItem } from '../FlowRecords';
......@@ -15,24 +15,84 @@ import styles from './index.less';
interface BasicInfoProps {
basic?: {
account?: string,
phone?: string,
email?: string,
created?: string,
account?: string,
phone?: string,
email?: string,
created?: string,
};
channel?: {
memberType?: number,
level?: string,
type?: string,
areas?: string[],
desc?: string,
memberType?: number,
level?: string,
type?: string,
areas?: string[],
desc?: string,
};
extra?: {
groupName: string,
groupName: string,
elements: {
fieldCNName?: string,
fieldType?: string,
/**
* 注册资料id
*/
id?: number,
/**
* 字段名称
*/
fieldName?: string,
/**
* 中文名称
*/
fieldLocalName?: string,
/**
* 字段类型
*/
fieldType?: string,
/**
* 字段类型附加属性(该参数为map)
*/
attr?: { [key: string]: any },
/**
* 字段长度
*/
fieldLength?: number,
/**
* 是否可为空0-不能为空1-可以为空
*/
fieldEmpty?: number,
/**
* 字段顺序
*/
fieldOrder?: number,
/**
* 帮助信息
*/
fieldRemark?: string,
/**
* 枚举标签列表
*/
fieldEnum?: {
value?: number,
label?: string,
}[],
/**
* 字段校验规则枚举:0-无校验规则,1-邮箱规则,2-手机号码规则,3-身份证规则,4-电话号码规则
*/
ruleEnum?: number,
/**
* 校验规则的正则表达式
*/
pattern?: string,
/**
* 校验错误的提示语
*/
msg?: string,
/**
* 值
*/
fieldValue?: any,
/**
* 是否禁用
*/
disabled?: boolean,
}[],
}[];
outerHistory?: OuterHistoryItem[];
......@@ -40,13 +100,13 @@ interface BasicInfoProps {
channelRender?: React.ReactNode; // 自定义渲染渠道信息
}
const BasicInfo: React.FC<BasicInfoProps> = ({
basic = {},
channel = {},
extra = [],
outerHistory = [],
innerHistory = [],
channelRender,
const BasicInfo: React.FC<BasicInfoProps> = ({
basic = {},
channel = {},
extra = [],
outerHistory = [],
innerHistory = [],
channelRender,
}) => {
return (
......@@ -64,10 +124,10 @@ const BasicInfo: React.FC<BasicInfoProps> = ({
</Descriptions>
</MellowCard>
</Col>
{
(
channel.memberType === MEMBER_TYPE_CHANNEL_CORPORATE ||
channel.memberType === MEMBER_TYPE_CHANNEL_CORPORATE ||
channel.memberType === MEMBER_TYPE_CHANNEL_INDIVIDUAL
) && (
<Col span={24}>
......@@ -81,17 +141,17 @@ const BasicInfo: React.FC<BasicInfoProps> = ({
<Descriptions.Item label="代理地市">
<Row gutter={[16, 16]} style={{ flex: 1 }}>
{
channel.areas ?
channel.areas ?
channel.areas.map(item => (
<Col key={item} span={12}>{item}</Col>
)) :
)) :
null
}
</Row>
</Descriptions.Item>
<Descriptions.Item label="渠道描述">{channel.desc}</Descriptions.Item>
</Descriptions>
): channelRender}
) : channelRender}
</MellowCard>
</Col>
)
......@@ -106,13 +166,13 @@ const BasicInfo: React.FC<BasicInfoProps> = ({
<Col span={12}>
<Descriptions column={1} className={styles.descriptions}>
{item.elements.map((ele, index) => (index + 1) % 2 !== 0 ? (
<Descriptions.Item key={index} label={ele.fieldCNName}>
<Descriptions.Item key={index} label={ele.fieldLocalName}>
{
ele.fieldType !== 'upload' ?
ele.fieldValue :
ele.fieldType !== 'upload' ?
ele.fieldValue :
(
<PicWrap
pics={[ele.fieldValue]}
<PicWrap
pics={[ele.fieldValue]}
/>
)
}
......@@ -123,13 +183,13 @@ const BasicInfo: React.FC<BasicInfoProps> = ({
<Col span={12}>
<Descriptions column={1} className={styles.descriptions}>
{item.elements.map((ele, index) => (index + 1) % 2 === 0 ? (
<Descriptions.Item key={index} label={ele.fieldCNName}>
<Descriptions.Item key={index} label={ele.fieldLocalName}>
{
ele.fieldType !== 'upload' ?
ele.fieldValue :
ele.fieldType !== 'upload' ?
ele.fieldValue :
(
<PicWrap
pics={[ele.fieldValue]}
<PicWrap
pics={[ele.fieldValue]}
/>
)
}
......@@ -143,8 +203,8 @@ const BasicInfo: React.FC<BasicInfoProps> = ({
))}
<Col span={24}>
<FlowRecords
outerHistory={outerHistory}
<FlowRecords
outerHistory={outerHistory}
innerHistory={innerHistory}
/>
</Col>
......
import React from 'react';
import {
Tabs,
Badge,
} from 'antd';
import { STATUS_COLOR_MAP, STATUS_COLOR_TXT } from '../../constant';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
import MellowCard from '@/components/MellowCard';
import {
MEMBER_STATUS_TAG_MAP,
MEMBER_INNER_STATUS_BADGE_COLOR,
MEMBER_OUTER_STATUS_BADGE_COLOR,
MEMBER_OUTER_STATUS_TYPE,
} from '../../constant';
import styles from './index.less';
export interface InnerHistoryItem {
createTime?: string,
id?: number;
operator?: string;
org?: string;
jobTitle?: string;
operation?: string;
operateTime?: string;
innerStatus?: number;
innerStatusName?: string;
reason?: string;
};
export interface OuterHistoryItem {
id?: number;
roleName?: string;
status?: number;
statusName?: string;
operation?: string;
operateTime?: string;
reason?: string;
};
interface FlowRecordsProps {
outerHistory?: OuterHistoryItem[];
innerHistory?: InnerHistoryItem[];
};
const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHistory = [] }) => {
const outerColumns: EditableColumns[] = [
{
title: '序号',
dataIndex: 'index',
align: 'center',
render: (text, record, index) => index + 1,
},
{
title: '操作角色',
dataIndex: 'roleName',
align: 'center',
},
{
title: '状态',
dataIndex: 'statusName',
align: 'center',
render: (text, record) => (
<Badge color={MEMBER_OUTER_STATUS_BADGE_COLOR[record.status] || '#909399'} text={text} />
),
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
},
{
title: '操作时间',
dataIndex: 'operateTime',
align: 'center',
ellipsis: true,
},
{
title: '审核意见',
dataIndex: 'reason',
align: 'center',
ellipsis: true,
},
];
const innerColumns: EditableColumns[] = [
{
title: '序号',
dataIndex: 'index',
align: 'center',
render: (text, record, index) => index + 1,
},
{
title: '操作人',
dataIndex: 'operator',
align: 'center',
},
{
title: '部门',
dataIndex: 'org',
align: 'center',
},
{
title: '职位',
dataIndex: 'jobTitle',
align: 'center',
},
{
title: '状态',
dataIndex: 'innerStatusName',
align: 'center',
render: (text, record) => (
<Badge color={MEMBER_INNER_STATUS_BADGE_COLOR[record.innerStatus] || '#909399'} text={text} />
),
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
},
{
title: '操作时间',
dataIndex: 'operateTime',
align: 'center',
ellipsis: true,
},
{
title: '审核意见',
dataIndex: 'reason',
align: 'center',
ellipsis: true,
},
];
return (
<MellowCard>
<Tabs onChange={() => { }}>
<Tabs.TabPane tab="流转记录" key="1">
<PolymericTable
dataSource={outerHistory}
columns={outerColumns}
loading={false}
pagination={null}
/>
</Tabs.TabPane>
<Tabs.TabPane tab="内部单据流转记录" key="2">
<PolymericTable
dataSource={innerHistory}
columns={innerColumns}
loading={false}
pagination={null}
/>
</Tabs.TabPane>
</Tabs>
</MellowCard>
);
};
import React from 'react';
import {
Tabs,
Badge,
} from 'antd';
import { STATUS_COLOR_MAP, STATUS_COLOR_TXT } from '../../constant';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
import MellowCard from '@/components/MellowCard';
import {
MEMBER_STATUS_TAG_MAP,
MEMBER_INNER_STATUS_BADGE_COLOR,
MEMBER_OUTER_STATUS_BADGE_COLOR,
MEMBER_OUTER_STATUS_TYPE,
} from '../../constant';
import styles from './index.less';
export interface InnerHistoryItem {
createTime?: string,
id?: number;
operator?: string;
org?: string;
jobTitle?: string;
operation?: string;
operateTime?: string;
innerStatus?: number;
innerStatusName?: string;
reason?: string;
};
export interface OuterHistoryItem {
id?: number;
roleName?: string;
status?: number;
statusName?: string;
operation?: string;
operateTime?: string;
reason?: string;
};
interface FlowRecordsProps {
outerHistory?: OuterHistoryItem[];
innerHistory?: InnerHistoryItem[];
};
const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHistory = [] }) => {
const outerColumns: EditableColumns[] = [
{
title: '序号',
dataIndex: 'index',
align: 'center',
render: (text, record, index) => index + 1,
},
{
title: '操作角色',
dataIndex: 'roleName',
align: 'center',
},
{
title: '状态',
dataIndex: 'statusName',
align: 'center',
render: (text, record) => (
<Badge color={MEMBER_OUTER_STATUS_BADGE_COLOR[record.status] || '#909399'} text={text} />
),
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
},
{
title: '操作时间',
dataIndex: 'operateTime',
align: 'center',
ellipsis: true,
},
{
title: '审核意见',
dataIndex: 'reason',
align: 'center',
ellipsis: true,
},
];
const innerColumns: EditableColumns[] = [
{
title: '序号',
dataIndex: 'index',
align: 'center',
render: (text, record, index) => index + 1,
},
{
title: '操作人',
dataIndex: 'operator',
align: 'center',
},
{
title: '部门',
dataIndex: 'org',
align: 'center',
},
{
title: '职位',
dataIndex: 'jobTitle',
align: 'center',
},
{
title: '状态',
dataIndex: 'innerStatusName',
align: 'center',
render: (text, record) => (
<Badge color={MEMBER_INNER_STATUS_BADGE_COLOR[record.innerStatus] || '#909399'} text={text} />
),
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
},
{
title: '操作时间',
dataIndex: 'operateTime',
align: 'center',
ellipsis: true,
},
{
title: '审核意见',
dataIndex: 'reason',
align: 'center',
ellipsis: true,
},
];
return (
<MellowCard>
<Tabs onChange={() => { }}>
<Tabs.TabPane tab="流转记录" key="1">
<PolymericTable
dataSource={outerHistory}
columns={outerColumns}
loading={false}
pagination={undefined}
/>
</Tabs.TabPane>
<Tabs.TabPane tab="内部单据流转记录" key="2">
<PolymericTable
dataSource={innerHistory}
columns={innerColumns}
loading={false}
pagination={undefined}
/>
</Tabs.TabPane>
</Tabs>
</MellowCard>
);
};
export default FlowRecords;
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-26 15:45:24
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-04-19 16:50:18
* @LastEditTime: 2021-06-07 19:51:51
* @Description:
*/
import React, { useState, useEffect } from 'react';
......@@ -213,7 +213,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
return {};
};
const useAsyncLinkageEffect = () => {
const useBusinessEffects = () => {
const linkage = useLinkageUtils();
// 间接触发根据会员类型
......@@ -329,7 +329,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
getPageitemsBasic,
);
useAsyncLinkageEffect();
useBusinessEffects();
onFormInputChange$().subscribe(() => {
if (!unsaved) {
......
......@@ -2,235 +2,9 @@ import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { UPLOAD_TYPE } from '@/constants';
import { PATTERN_MAPS } from '@/constants/regExp';
import { createMemberSchema, GroupItem } from '../../../../utils';
export const importSchema: ISchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
tip: '输入 会员名称 进行搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
colStyle: {
marginLeft: 20,
},
},
properties: {
memberTypeId: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '会员类型(全部)',
allowClear: true,
style: {
width: 160,
},
},
},
roleId: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '会员角色(全部)',
allowClear: true,
style: {
width: 160,
},
},
},
level: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '会员等级(全部)',
allowClear: true,
style: {
width: 160,
},
},
},
source: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '申请来源(全部)',
allowClear: true,
style: {
width: 160,
},
},
},
innerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '内部状态(全部)',
allowClear: true,
style: {
width: 160,
},
},
},
outerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '外部状态(全部)',
allowClear: true,
style: {
width: 160,
},
},
},
status: {
type: 'string',
enum: [],
default: undefined,
'x-component-props': {
placeholder: '会员状态(全部)',
allowClear: true,
style: {
width: 160,
},
},
},
'[startDate, endDate]': {
type: 'string',
default: '',
'x-component': 'dateSelect',
'x-component-props': {
placeholder: '时间范围(全部)',
allowClear: true,
style: {
width: 160,
},
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
export const auditModalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
reason: {
type: 'string',
title: '会员解冻原因',
'x-component': 'textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
rows: 5,
},
'x-rules': [
{
required: true,
message: '请填写原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 120,
}
],
},
},
},
},
};
const FIELD_TYPE_MAP = {
'string': 'string',
'long': 'string',
'upload': 'customUpload',
};
const getXComponentProps = (type, item) => {
const MAP = {
'string': {
placeholder: item.fieldRemark,
},
'upload': {
listType: 'card',
action: '/api/file/file/upload',
data: { fileType: UPLOAD_TYPE },
fileList: [],
onChange: file => console.log(file),
},
};
return MAP[type];
};
const getCompnentValue = (elements: any) => {
const components = {};
for (let item of elements) {
// 先判断是否存在 type,防止不存在的 type 报错
const realType = FIELD_TYPE_MAP[item.fieldType];
if (realType) {
components[item.fieldName] = {
type: FIELD_TYPE_MAP[item.fieldType],
required: item.fieldEmpty === 0,
title: item.fieldCNName,
'x-component-props': getXComponentProps(realType, item),
};
}
}
return components;
};
export const initDetailSchema = (props: any) => {
export const initDetailSchema = (props: GroupItem[]) => {
let tabSchema: ISchema = {
properties: {
'tab-1': {
......@@ -363,7 +137,7 @@ export const initDetailSchema = (props: any) => {
wrapperCol: 8,
labelAlign: 'left',
},
properties: getCompnentValue(item.elements),
properties: createMemberSchema(item.elements),
},
},
};
......
.nameCell {
text-align: left;
.nameCellTitle {
color : @main-color;
cursor: pointer;
}
.levelIcon1 {
width : 100%;
height : 16px;
background : url("/static/imgs/level1@2x.png") no-repeat;
background-size: 54px 16px;
margin-top : 8px;
}
.levelIcon2 {
width : 100%;
height : 16px;
background : url("/static/imgs/level2@2x.png") no-repeat;
background-size: 54px 16px;
margin-top : 8px;
}
.levelIcon3 {
width : 100%;
height : 16px;
background : url("/static/imgs/level3@2x.png") no-repeat;
background-size: 54px 16px;
margin-top : 8px;
}
}
.col {
margin-bottom: 16px;
&:nth-last-of-type(1) {
text-align: right;
}
}
.headerTop {
display : flex;
align-items: center;
font-size : 20px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
&-prefix {
width : 48px;
height : 48px;
line-height : 48px;
border-radius : 4px;
border : 1px solid #DFE1E6;
color : #fff;
text-align : center;
background-color: #8777D9;
}
&-name {
color : #303133;
margin: 0 8px 0 12px;
}
}
.mainCol {
background-color: #fff;
margin-bottom : 24px;
padding : 0 24px;
box-sizing : border-box;
&-title {
font-size : 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color : #303133;
padding : 20px 0;
}
&:nth-last-of-type(1) {
margin: 0;
}
&-row {
display : flex;
flex-wrap : wrap;
padding-bottom: 16px;
&-col {
display: flex;
width : calc(100% / 2);
padding: 16px 0;
&-option {
flex : 1;
font-size : 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color : #909399;
&:nth-last-of-type(1) {
flex : 3;
padding-right: 20px;
box-sizing : border-box;
color : #303133;
}
}
}
}
&-rows {
display : flex;
padding-bottom: 16px;
&-cols {
flex: 1;
.cols-main {
display: flex;
padding: 16px 0;
&:nth-last-of-type(1) {
padding-bottom: 0;
}
&-options {
flex : 1;
font-size : 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color : #909399;
&:nth-last-of-type(1) {
flex : 3;
padding-right: 20px;
box-sizing : border-box;
color : #303133;
}
}
}
}
}
&-chart {
display : flex;
padding-bottom: 28px;
&-main {
width: 30%;
&:nth-last-of-type(1) {
width: 70%;
}
&-card1 {
width : 338px;
height : 190px;
box-shadow : 0px 1px 2px 0px rgba(23, 43, 77, 0.12);
border-radius: 8px;
box-sizing : border-box;
padding : 32px 24px 16px;
background : url("/static/imgs/card1@2x.png") center center no-repeat;
h2 {
color : #A47268;
letter-spacing: 2px;
margin-bottom : 38px;
}
.progress {
width: 218px;
&-score {
display : flex;
justify-content: space-between;
}
}
}
&-card2 {
width : 338px;
height : 190px;
box-shadow : 0px 1px 2px 0px rgba(23, 43, 77, 0.12);
border-radius: 8px;
box-sizing : border-box;
padding : 32px 24px 16px;
background : url("/static/imgs/card2@2x.png") center center no-repeat;
h2 {
color : #5B6F92;
letter-spacing: 2px;
margin-bottom : 38px;
}
.progress {
width: 218px;
&-score {
display : flex;
justify-content: space-between;
}
}
}
&-card3 {
width : 338px;
height : 190px;
box-shadow : 0px 1px 2px 0px rgba(23, 43, 77, 0.12);
border-radius: 8px;
box-sizing : border-box;
padding : 32px 24px 16px;
background : url("/static/imgs/card3@2x.png") center center no-repeat;
h2 {
color : #987326;
letter-spacing: 2px;
margin-bottom : 38px;
}
.progress {
width: 218px;
&-score {
display : flex;
justify-content: space-between;
}
}
}
&-card4 {
width : 338px;
height : 190px;
box-shadow : 0px 1px 2px 0px rgba(23, 43, 77, 0.12);
border-radius: 8px;
box-sizing : border-box;
padding : 32px 24px 16px;
background : url("/static/imgs/card4@2x.png") center center no-repeat;
h2 {
color : #595B71;
letter-spacing: 2px;
margin-bottom : 38px;
}
.progress {
width: 218px;
&-score {
display : flex;
justify-content: space-between;
}
}
}
&-line {}
}
}
}
.authCol {
padding : 24px;
background-color: #fff;
}
.subRow {
width: 100%;
.subCol {
width : 100%;
text-align: right;
.select {
width : 160px;
margin : 0 0 16px 16px;
text-align: left;
&:nth-of-type(1) {
margin-left: 0;
}
}
}
}
.select {
width : 160px;
margin: 0 16px 16px 0;
&:nth-last-of-type(1) {
margin-right: 0;
}
}
.headerTop {
display : flex;
align-items: center;
span {
font-size : 14px;
font-weight: 400;
&:nth-last-of-type(1) {
font-size : 20px;
font-weight: 500;
color : #303133;
margin-left: 16px;
}
}
}
.saveBtn {
color : #fff;
background: @main-color
}
.required {
display : inline-block;
margin-right: 4px;
color : #ff4d4f;
font-size : 14px;
font-family : SimSun, sans-serif;
line-height : 1;
}
\ No newline at end of file
export function coverColFiltersItem(
data: Array<{[key: string]: any}>,
dataIndex: string,
item: {[key: string]: any}
) {
const index = data.findIndex(i => i.dataIndex === dataIndex);
if (index !== -1) {
data.splice(index, 1, {
...data[index],
filters: item,
});
}
};
// 初始化内部流转记录
export function normalizeInnerHistory(source: {[key: string]: any}[]) {
const ret: any[] = [];
if (!Array.isArray(source)) {
return ret;
}
source.forEach(item => {
const atom = {
id: item.id,
operator: item.operatorName,
org: item.operatorOrgName,
jobTitle: item.operatorJobTitle,
innerStatusName: item.innerStatusName,
innerStatus: item.innerStatus,
operation: item.operation,
operateTime: item.createTime,
reason: item.remark,
};
ret.push(atom);
});
return ret;
};
// 初始化内部流转记录
export function normalizeOuterHistory(source: {[key: string]: any}[]) {
const ret: any[] = [];
if (!Array.isArray(source)) {
return ret;
}
source.forEach(item => {
const atom = {
id: item.id,
roleName: item.operatorRoleName,
status: item.status,
statusName: item.statusDescription,
operation: item.operation,
operateTime: item.createTime,
reason: item.remark,
};
ret.push(atom);
});
return ret;
import { PATTERN_MAPS } from '@/constants/regExp';
export function coverColFiltersItem(
data: Array<{[key: string]: any}>,
dataIndex: string,
item: {[key: string]: any}
) {
const index = data.findIndex(i => i.dataIndex === dataIndex);
if (index !== -1) {
data.splice(index, 1, {
...data[index],
filters: item,
});
}
};
// 初始化内部流转记录
export function normalizeInnerHistory(source: {[key: string]: any}[]) {
const ret: any[] = [];
if (!Array.isArray(source)) {
return ret;
}
source.forEach(item => {
const atom = {
id: item.id,
operator: item.operatorName,
org: item.operatorOrgName,
jobTitle: item.operatorJobTitle,
innerStatusName: item.innerStatusName,
innerStatus: item.innerStatus,
operation: item.operation,
operateTime: item.createTime,
reason: item.remark,
};
ret.push(atom);
});
return ret;
};
// 初始化内部流转记录
export function normalizeOuterHistory(source: {[key: string]: any}[]) {
const ret: any[] = [];
if (!Array.isArray(source)) {
return ret;
}
source.forEach(item => {
const atom = {
id: item.id,
roleName: item.operatorRoleName,
status: item.outerStatus,
statusName: item.outerStatusName,
operation: item.operation,
operateTime: item.createTime,
reason: item.remark,
};
ret.push(atom);
});
return ret;
};
export type ElementType = {
/**
* 注册资料id
*/
id?: number,
/**
* 字段名称
*/
fieldName?: string,
/**
* 中文名称
*/
fieldLocalName?: string,
/**
* 字段类型
*/
fieldType?: string,
/**
* 字段类型附加属性(该参数为map)
*/
attr?: { [key: string]: any },
/**
* 字段长度
*/
fieldLength?: number,
/**
* 是否可为空0-不能为空1-可以为空
*/
fieldEmpty?: number,
/**
* 字段顺序
*/
fieldOrder?: number,
/**
* 帮助信息
*/
fieldRemark?: string,
/**
* 枚举标签列表
*/
fieldEnum?: {
value?: number,
label?: string,
}[],
/**
* 字段校验规则枚举:0-无校验规则,1-邮箱规则,2-手机号码规则,3-身份证规则,4-电话号码规则
*/
ruleEnum?: number,
/**
* 校验规则的正则表达式
*/
pattern?: string,
/**
* 校验错误的提示语
*/
msg?: string,
/**
* 值
*/
fieldValue?: any,
/**
* 是否禁用
*/
disabled?: boolean,
}
export type GroupItem = {
/**
* 组名
*/
groupName: string,
/**
* 元素
*/
elements: ElementType[],
};
type FieldType = 'string' | 'long' | 'upload' | 'radio' | 'select' | 'checkbox' | 'areas';
// 字段校验规则枚举:0-无校验规则,1-邮箱规则,2-手机号码规则,3-身份证规则,4-电话号码规则
const RULE_REG_MAP = {
1: PATTERN_MAPS.email,
2: PATTERN_MAPS.phone,
3: PATTERN_MAPS.identity,
4: PATTERN_MAPS.tel,
};
const getFieldType = (field: ElementType) => {
// 默认是 输入框
let description: { [key: string]: any } = {
'x-component-props': {
placeholder: field.fieldRemark,
disabled: field.disabled,
},
};
// 公共的属性
const common = {
type: 'string',
required: field.fieldEmpty === 0,
title: field.fieldLocalName,
default: field.fieldValue,
'x-rules': [
(
field.ruleEnum
? {
pattern: RULE_REG_MAP[field.ruleEnum],
message: field.msg,
}
: null
),
(
field.pattern
? {
pattern: field.pattern,
message: field.msg,
}
: null
),
].filter(Boolean),
};
switch (field.fieldType as FieldType) {
case 'upload': {
description = {
'x-component': 'CustomUpload',
'x-component-props': {
showDesc: false,
disabled: field.disabled,
},
};
break;
}
case 'radio': {
description = {
'x-component': 'RadioGroup',
enum: field.fieldEnum,
'x-component-props': {
showDesc: false,
disabled: field.disabled,
},
};
break;
}
case 'select': {
description = {
enum: field.fieldEnum,
};
break;
}
case 'checkbox': {
description = {
'x-component': 'CheckboxGroup',
enum: field.fieldEnum,
};
break;
}
default:
break;
}
return Object.assign({}, description, common);
};
// 根据后台生成注册资料 schema
export function createMemberSchema(elements: ElementType[]) {
const components = {};
if (!Array.isArray(elements)) {
return components;
}
for (let item of elements) {
components[item.fieldName as string] = getFieldType(item);
}
return components;
};
\ No newline at end of file
......@@ -15,8 +15,8 @@ const tokenList = [
{ name: 'Purchase', token: '425043481f605f76064951c72d26c412e5ba1baf2d70158300f560ef58358f41', categoryIds: [0]}, //采购服务
{ name: 'enhance', token: '594a7e7ff17f6f40fb9fb726c1da9a3f282a926a8d386eb6cbfd668a3f75f251', categoryIds: [0] }, // 加工服务
{ name: 'AfterService', token: 'bac1c7ca2c63869ec87085b0b33e830fea19f707dea5763f1bf8f2dc5996bde8', categoryIds: [0] }, // 售后服务
{ name: 'Platform', token: 'cadc3b13452c3ec67b5ef0c57063f12142e857a9eaa64669e80165adf42f5861', categoryIds: [0] } // 平台后台v2
{ name: 'Platform', token: 'cadc3b13452c3ec67b5ef0c57063f12142e857a9eaa64669e80165adf42f5861', categoryIds: [0] }, // 平台后台v2
{ name: 'MemberV2', token: '87f86a297246fbf1c0dff7d34f13729cb194935a95db077a5009ac4ea48cea6f', categoryIds: [0] } //会员服务 V2
]
const getConfigMap = (tokens) => tokens.map(v => ({
......
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