Commit 86c83dd6 authored by XieZhiXiong's avatar XieZhiXiong

chore: 添加 catch

parent 7ab72ca4
......@@ -45,9 +45,9 @@ const AreaSelect = (props) => {
const [cityLoading, setCityLoading] = useState(false);
const [districtLoading, setDistrictLoading] = useState(false);
const [provinceValue, setProvinceValue] = useState('');
const [cityValue, setCityValue] = useState('');
const [districtValue, setDistrictValue] = useState('');
const [provinceValue, setProvinceValue] = useState<string | undefined>('');
const [cityValue, setCityValue] = useState<string | undefined>('');
const [districtValue, setDistrictValue] = useState<string | undefined>('');
const getProvinceList = async () => {
setProvinceLoading(true);
......@@ -58,7 +58,7 @@ const AreaSelect = (props) => {
setProvinceLoading(false);
};
const getCityList = async (code: string) => {
const getCityList = async (code?: string) => {
if (!code) {
return;
}
......@@ -70,7 +70,7 @@ const AreaSelect = (props) => {
setCityLoading(false);
};
const getDistrictList = async (code: string) => {
const getDistrictList = async (code?: string) => {
if (!code) {
return;
}
......
import React, { useState, useRef } from 'react';
import { Row, Col, Modal } from 'antd';
import { useTreeTabs, FormState } from '@/hooks/useTreeTabs';
import MellowCard from '@/components/MellowCard';
import TabTree, { createTreeActions } from '@/components/TabTree';
import CheckboxTree from '@/components/CheckBoxTree';
import styles from './index.less';
const treeActions = createTreeActions();
const PowerInfo: React.FC<{}> = () => {
const [powerLoading, setPowerLoading] = useState(false);
const [buttonInfos, setButtonInfos] = useState<any>([]);
const actionRef = useRef<any>({});
// 获取左侧已选择的项
const getMenuSelectData = async () => {
setPowerLoading(true);
const res = await PublicApi.getMemberValidateTreeCheckids({
memberId: id,
validateId: validateId,
});
setPowerLoading(false);
if (res.code === 1000) {
const { checkIds } = res.data;
return { data: { ids: checkIds } };
}
return {
data: {
ids: [],
},
};
};
// 获取左边菜单
const fetchMenuData = async () => {
const res = await PublicApi.getMemberValidateTree({
memberId: id,
validateId: validateId,
});
return res;
};
// 点击左侧菜单获取右侧按钮菜单、及已勾选的信息
const handleFindDetail = menuId => {
PublicApi.getMemberValidateCommitGetbutton({
menuId: menuId,
memberId: id,
validateId: validateId,
}).then(res => {
const { data } = res;
let buttons = data.buttons.map(v => ({ id: v.id, buttonName: v.name }));
setButtonInfos(buttons || []);
if (actionRef.current.setSelected) {
actionRef.current.setSelected(data.checkIds);
}
});
};
const customSelect = (selectKey?, node?) => {
// 首次新增菜单的时候没有节点信息
if (!node) {
setNodeRecord(null);
setTreeStatus(FormState.ADD);
return;
}
// key相等时 不刷新右侧表单
if (nodeRecord && nodeRecord.key === selectKey) {
setNodeRecord(node);
setTreeStatus(FormState.EDIT);
} else {
if (isEditForm) {
// 有填写过表单
return new Promise((resolve, reject) => {
Modal.confirm({
content: '确认要离开当前页面吗,您提交的数据尚未保存',
onOk() {
// 确认离开当前页, 需改变node state
setNodeRecord(node);
setTreeStatus(FormState.EDIT);
// 点击菜单,请求数据重置
handleFindDetail(selectKey);
setIsEditForm(false);
resolve();
},
onCancel() {
reject();
},
});
});
} else {
// 编辑页, 需回显
handleFindDetail(selectKey);
setNodeRecord(node);
setTreeStatus(FormState.EDIT);
}
}
};
const {
treeData,
handleSelect,
nodeRecord,
setNodeRecord,
setTreeStatus,
setIsEditForm,
isEditForm,
} = useTreeTabs({
fetchMenuData,
selectCallback: customSelect,
});
// 更新右侧按钮
const handleSubmitAuth = async () => {
const buttonIds = [...actionRef.current.selected];
if (!nodeRecord) {
return;
}
if (isEditForm) {
// 更新右侧按钮
await PublicApi.postMemberValidateCommitUpdatebutton({
memberId: id,
validateId,
menuId: nodeRecord.id,
buttonIds: buttonIds,
});
}
setIsEditForm(false);
};
return (
<Row>
<Col span={15}>
<MellowCard>
<TabTree
title="菜单列表"
getMenuSelectData={getMenuSelectData}
customKey="id"
actions={treeActions}
treeData={treeData}
handleSelect={handleSelect}
disabled={true}
checkStrictly
checkable
/>
</MellowCard>
</Col>
<Col span={8} offset={1}>
<MellowCard>
<CheckboxTree
actions={actionRef}
disabled={true}
handleChange={e => setIsEditForm(true)}
checkedNodes={buttonInfos}
title="菜单按钮访问权限"
handleSubmit={handleSubmitAuth}
showSave
/>
</MellowCard>
</Col>
</Row>
);
};
export default PowerInfo
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PageHeader, Tag, Descriptions, Button } from 'antd';
import { FormOutlined, StopOutlined } from '@ant-design/icons';
import { STATUS_COLOR_MAP, STATUS_COLOR_TXT } from '../constant';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import MellowCard from '@/components/MellowCard';
import HeadInfo from '../components/HeadInfo';
import AuditProcess from '../components/AuditProcess';
import BasicInfo from '../components/BasicInfo';
import styles from './index.less';
const auditPrComfirm: React.FC<{}> = () => {
const { pageStatus, id, validateId } = usePageStatus();
const [detailed, setDetailed] = useState<any>({});
useEffect(() => {
}, []);
return (
<PageHeaderWrapper
title={
<>
<PageHeader
style={{ padding: '0' }}
onBack={() => history.goBack()}
title={
<HeadInfo
info={{
name: '广州市极致皮具有限公司',
level: 1,
}}
/>
}
extra={(
<>
<Button
icon={<StopOutlined />}
onClick={() => {}}
>
审核不通过
</Button>
<Button
type="primary"
icon={<FormOutlined />}
onClick={() => {}}
>
审核通过
</Button>
</>
)}
>
<Descriptions
size="small"
column={3}
style={{
padding: '0 32px',
}}
>
<Descriptions.Item label="会员类型">{123}</Descriptions.Item>
<Descriptions.Item label="会员角色" span={2}>{123}</Descriptions.Item>
<Descriptions.Item label="会员状态">
<Tag color={STATUS_COLOR_MAP[1]}>{STATUS_COLOR_TXT[1]}</Tag>
</Descriptions.Item>
<Descriptions.Item label="外部状态">
<Tag color={STATUS_COLOR_MAP[2]}>{STATUS_COLOR_TXT[2]}</Tag>
</Descriptions.Item>
</Descriptions>
</PageHeader>
</>
}
>
<div
style={{
marginBottom: 24,
}}
>
<AuditProcess />
</div>
<BasicInfo />
</PageHeaderWrapper>
);
};
export default auditPrComfirm;
import React from 'react';
import AuditList from '../components/auditList';
const memberPrConfirm = () => {
return <AuditList pageType="4" />;
};
export default memberPrConfirm;
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const auditSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
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: '搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
memberType: {
type: 'string',
default: 0,
enum: [],
'x-component-props': {},
},
roleId: {
type: 'string',
default: 0,
enum: [],
'x-component-props': {},
},
level: {
type: 'string',
default: 0,
enum: [],
'x-component-props': {},
},
source: {
type: 'string',
default: 0,
enum: [],
'x-component-props': {},
},
timeRange: {
type: 'string',
default: 0,
enum: [
{ label: '时间范围(全部)', value: 0 },
{ label: '今天', value: 1 },
{ label: '一周内', value: 2 },
{ label: '一个月内', value: 3 },
{ label: '三个月内', value: 4 },
{ label: '六个月内', value: 5 },
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7 },
],
'x-component-props': {},
},
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: {
agree: {
type: 'string',
default: 1,
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
'x-component': 'radio',
'x-component-props': {},
},
reason: {
type: 'string',
title: '审核不通过原因',
'x-component': 'textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
},
'x-rules': [
{
required: true,
message: '请填写审核不通过原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 120,
}
],
},
},
},
},
};
......@@ -43,7 +43,7 @@ const addEquity: React.FC<DetailInfoProps> = ({
id,
isEdit = false,
}) => {
const [levelInfo, setLevelInfo] = useState<GetMemberManageLevelGetResponse>(null);
const [levelInfo, setLevelInfo] = useState<GetMemberManageLevelGetResponse>();
const [thresholdValue, setThresholdValue] = useState(100);
const [infoLoading, setInfoLoading] = useState(true);
const [submitLoading, setSubmitLoading] = useState(false);
......@@ -68,6 +68,8 @@ const addEquity: React.FC<DetailInfoProps> = ({
setLevelInfo(res.data);
setThresholdValue(point);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -22,7 +22,7 @@ const fetchData = async (params: any) => {
if (res.code === 1000) {
return res.data;
}
return {};
return { data: [], totalCount: 0 };
};
const MemberLevel: React.FC<[]> = () => {
......
......@@ -230,6 +230,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
const options = data.map(item => ({ label: item.roleName, value: item.roleId }));
linkage.enum('roleId', options);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
linkage.loaded('roleId');
});
......@@ -258,6 +260,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
const { data = [] } = res;
setMemberItems(data);
}
}).catch((err) => {
console.warn(err);
});
});
......@@ -290,6 +294,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
const options = data.map(item => ({ label: item.levelTag, value: item.level }));
linkage.enum('level', options);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
linkage.loaded('level');
});
......
......@@ -20,6 +20,8 @@ const EquityInfo: React.FC<{}> = () => {
return;
}
setEquityInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -5,7 +5,7 @@ import { PageHeader, Descriptions, Badge, Spin } from 'antd';
import { observer, inject } from 'mobx-react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberMaintenanceDetailBasicResponse } from '@/services/MemberApi';
import { GetMemberMaintenanceDetailBasicResponse } from '@/services/MemberV2Api';
import { IMemberModule } from '@/module/memberModule';
import {
MEMBER_STATUS_TAG_MAP,
......@@ -46,6 +46,8 @@ const MemberMaintainDetailed: React.FC<QueryProps> = props => {
}
setBasicInfo(res.data);
MemberStore.setmemberMaintainInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -24,6 +24,8 @@ const LevelInfo: React.FC<{}> = () => {
}
setLevelInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -47,7 +47,10 @@ const PowerInfo: React.FC<{}> = () => {
memberId: id,
validateId: validateId,
});
return res;
if (res.code === 1000) {
return res;
}
return [];
};
// 点击左侧菜单获取右侧按钮菜单、及已勾选的信息
......@@ -93,7 +96,7 @@ const PowerInfo: React.FC<{}> = () => {
} else {
if (isEditForm) {
// 有填写过表单
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
Modal.confirm({
content: '确认要离开当前页面吗,您提交的数据尚未保存',
onOk() {
......
......@@ -52,6 +52,8 @@ const SincerityInfo: React.FC<{}> = () => {
pieData,
items: configs,
});
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......@@ -72,6 +74,8 @@ const SincerityInfo: React.FC<{}> = () => {
setSalesEstimateSum({
dataSource: rows,
});
}).catch((err) => {
console.warn(err);
}).finally(() => {
setSalesEstimateSumLoading(false);
});
......@@ -92,6 +96,8 @@ const SincerityInfo: React.FC<{}> = () => {
setAfterEstimateSum({
dataSource: rows,
});
}).catch((err) => {
console.warn(err);
}).finally(() => {
setAfterEstimateSumLoading(false);
});
......@@ -110,6 +116,8 @@ const SincerityInfo: React.FC<{}> = () => {
setComplainSum({
dataSource: res.data,
});
}).catch((err) => {
console.warn(err);
}).finally(() => {
setComplainSumLoading(false);
});
......
......@@ -6,7 +6,7 @@ import { SettingOutlined, StopOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberMaintenanceDetailBasicResponse } from '@/services/MemberApi';
import { GetMemberMaintenanceDetailBasicResponse } from '@/services/MemberV2Api';
import {
MEMBER_STATUS_NORMAL,
MEMBER_STATUS_FROZEN,
......@@ -42,9 +42,10 @@ const Frozen: React.FC<{}> = () => {
validateId,
}).then(res => {
if (res.code === 1000) {
const { outerHistory = [], innerHistory = [] } = res.data;
setBasicInfo(res.data);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoaading(false);
});
......
......@@ -63,7 +63,7 @@ const memberMaintain: React.FC<[]> = () => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const handleDelete = (memberId: number, validateId: number) => {
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-26 16:49:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-26 16:49:58
* @LastEditTime: 2021-07-30 15:00:53
* @Description:
*/
import React, { useState, useEffect, useRef } from 'react';
......@@ -20,7 +20,7 @@ import {
} from 'antd';
import { FormOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import { GetMemberValidateCommitDetailResponse } from '@/services/MemberApi';
import { GetMemberValidateStep1DetailResponse } from '@/services/MemberApi';
import TabTree, { createTreeActions } from '@/components/TabTree';
import CheckboxTree from '@/components/CheckBoxTree';
import MellowCard from '@/components/MellowCard';
......@@ -65,7 +65,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
isEdit = false,
}) => {
const [tabKey, setTabKey] = useState('basicInfo');
const [basicInfo, setBasicInfo] = useState<GetMemberValidateCommitDetailResponse>();
const [basicInfo, setBasicInfo] = useState<GetMemberValidateStep1DetailResponse>();
const [modalVisible, setModalVisible] = useState(false);
const [buttonInfos, setButtonInfos] = useState<any>([]);
const [infoLoading, setInfoLoading] = useState(false);
......@@ -84,7 +84,9 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (res.code !== 1000) {
return;
}
setBasicInfo(res.data);
setBasicInfo(res.data as any);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......@@ -136,7 +138,10 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
memberId: id as string,
validateId: validateId as string,
});
return res;
if (res.code === 1000) {
return res;
}
return [];
};
// 点击左侧菜单获取右侧按钮菜单、及已勾选的信息
......@@ -152,6 +157,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (actionRef.current.setSelected) {
actionRef.current.setSelected(data.checkIds);
}
}).catch((err) => {
console.warn(err);
});
};
......
......@@ -141,7 +141,10 @@ const MemberPr1: React.FC<{}> = props => {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
let res = await PublicApi.getMemberValidateStep1Page(payload);
return res.data;
if (res.code === 1000) {
return res.data;
}
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -20,7 +20,7 @@ import {
} from 'antd';
import { FormOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import { GetMemberValidateCommitDetailResponse } from '@/services/MemberApi';
import { GetMemberValidateStep2DetailResponse } from '@/services/MemberApi';
import TabTree, { createTreeActions } from '@/components/TabTree';
import CheckboxTree from '@/components/CheckBoxTree';
import MellowCard from '@/components/MellowCard';
......@@ -66,7 +66,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
isEdit = false,
}) => {
const [tabKey, setTabKey] = useState('basicInfo');
const [basicInfo, setBasicInfo] = useState<GetMemberValidateCommitDetailResponse>();
const [basicInfo, setBasicInfo] = useState<GetMemberValidateStep2DetailResponse>();
const [modalVisible, setModalVisible] = useState(false);
const [buttonInfos, setButtonInfos] = useState<any>([]);
const [infoLoading, setInfoLoading] = useState(false);
......@@ -85,7 +85,9 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (res.code !== 1000) {
return;
}
setBasicInfo(res.data);
setBasicInfo(res.data as any);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......@@ -137,7 +139,10 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
memberId: id as string,
validateId: validateId as string,
});
return res;
if (res.code === 1000) {
return res;
}
return [];
};
// 点击左侧菜单获取右侧按钮菜单、及已勾选的信息
......@@ -153,6 +158,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (actionRef.current.setSelected) {
actionRef.current.setSelected(data.checkIds);
}
}).catch((err) => {
console.warn(err);
});
};
......
......@@ -141,7 +141,10 @@ const MemberPr2: React.FC<{}> = props => {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
let res = await PublicApi.getMemberValidateStep2Page(payload);
return res.data;
if (res.code === 1000) {
return res.data;
}
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -139,7 +139,10 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
memberId: id as string,
validateId: validateId as string,
});
return res;
if (res.code === 1000) {
return res;
}
return [];
};
// 点击左侧菜单获取右侧按钮菜单、及已勾选的信息
......@@ -155,6 +158,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (actionRef.current.setSelected) {
actionRef.current.setSelected(data.checkIds);
}
}).catch((err) => {
console.warn(err);
});
};
......
......@@ -149,7 +149,10 @@ const MemberPrConfirm: React.FC<{}> = props => {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
let res = await PublicApi.getMemberValidateConfirmPage(payload);
return res.data;
if (res.code === 1000) {
return res.data;
}
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-26 16:36:30
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-21 10:19:07
* @LastEditTime: 2021-07-30 15:10:08
* @Description: 待提交审核详情信息
*/
import React, { useState, useEffect, useRef } from 'react';
......@@ -88,7 +88,9 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (res.code !== 1000) {
return;
}
setBasicInfo(res.data);
setBasicInfo(res.data as any);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......@@ -140,7 +142,10 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
memberId: id,
validateId: validateId,
});
return res;
if (res.code === 1000) {
return res;
}
return [];
};
// 点击左侧菜单获取右侧按钮菜单、及已勾选的信息
......@@ -156,6 +161,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (actionRef.current.setSelected) {
actionRef.current.setSelected(data.checkIds);
}
}).catch((err) => {
console.warn(err);
});
};
......
......@@ -140,7 +140,10 @@ const MemberPrSubmit: React.FC<{}> = props => {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
let res = await PublicApi.getMemberValidateCommitPage(payload);
return res.data;
if (res.code === 1000) {
return res.data;
}
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
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