Commit 653586e6 authored by 前端-许佳敏's avatar 前端-许佳敏

refactor: 重构authConfig目录接口

parent 4140bdd1
......@@ -11,7 +11,7 @@ import {
import {StandardTable} from 'god'
import {ColumnType} from 'antd/lib/table/interface'
import { IButtonFilter, IFormFilter } from 'god/dist/src/standard-table/TableController';
import { PublicApi } from '@/services/api';
import { getMemberRolePage, postMemberRoleDelete, postMemberRoleUpdatestatus } from '@/services/MemberV2Api';
import StatusSwitch from '@/components/StatusSwitch';
import EyePreview from '@/components/EyePreview';
import { STATUS_ENUM } from '@/constants';
......@@ -19,7 +19,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import PopConfirmControl from '@/components/PopConfirmControl';
const fetchData = async (params) => {
const { data } = await PublicApi.getMemberRolePage(params)
const { data } = await getMemberRolePage(params)
return data
}
......@@ -28,7 +28,7 @@ const MemberSystem: React.FC<{}> = () => {
const deleteItem = async (record) => {
// 删除该项
await PublicApi.postMemberRoleDelete({
await postMemberRoleDelete({
memberRoleId: record.id
})
ref.current.reload()
......@@ -39,7 +39,7 @@ const MemberSystem: React.FC<{}> = () => {
}
const handleStatus = async (record) => {
await PublicApi.postMemberRoleUpdatestatus({
await postMemberRoleUpdatestatus({
id: record.id,
status: record.status === 1 ? 0 : 1
})
......
......@@ -28,7 +28,7 @@ import TabTree, {
useTreeActions,
createTreeActions,
} from '@/components/TabTree';
import { PublicApi } from '@/services/api';
import { getMemberRoleAuthTree, getMemberOrgTree, postMemberRoleAdd, postMemberRoleUpdate, getMemberRoleGet, getMemberRoleAuthButton, getMemberRoleAuthButtonCheck, } from '@/services/MemberV2Api';
import styled from './index.less';
import CheckboxTree from '@/components/CheckBoxTree';
import { useTreeData } from '@/hooks/useTreeData';
......@@ -54,7 +54,7 @@ const TabFormErrors = props => {
};
const fetchMenuData = async () => {
const res = await PublicApi.getMemberRoleAuthTree();
const res = await getMemberRoleAuthTree();
return { data: res.data.menus };
};
......@@ -65,7 +65,7 @@ const menuActions = createFormActions();
const treeActions = createTreeActions();
const fetchOrgsTreeData = async () => {
const res = await PublicApi.getMemberOrgTree();
const res = await getMemberOrgTree();
return res;
};
......@@ -109,7 +109,7 @@ const MemberDetail: React.FC<{}> = () => {
const { treeData, handleSelect } = useTreeData({
fetchMenuData,
fetchItemDetailData: ({ id }) =>
PublicApi.getMemberRoleAuthButton({
getMemberRoleAuthButton({
menuId: id,
}),
});
......@@ -141,9 +141,9 @@ const MemberDetail: React.FC<{}> = () => {
const fetchItemDetailData = useCallback(
async node => {
const isAdd = pageStatus === PageStatus.ADD;
const fn = isAdd
? PublicApi.getMemberRoleAuthButton
: PublicApi.getMemberRoleAuthButtonCheck;
const fn: any = isAdd
? getMemberRoleAuthButton
: getMemberRoleAuthButtonCheck;
const params = isAdd ? {} : { memberRoleId: id };
const { data } = await fn({
menuId: node ? node.id : nodeRecord.id,
......@@ -203,7 +203,7 @@ const MemberDetail: React.FC<{}> = () => {
// 编辑和预览模式下需回显数据
const fetchRoleMenuDetail = async id => {
// 10秒缓存
const res = await PublicApi.getMemberRoleGet(
const res = await getMemberRoleGet(
{
memberRoleId: id,
},
......@@ -253,12 +253,12 @@ const MemberDetail: React.FC<{}> = () => {
})),
};
if (pageStatus === PageStatus.EDIT) {
await PublicApi.postMemberRoleUpdate({
await postMemberRoleUpdate({
memberRoleId: id,
...publicParams,
});
} else {
await PublicApi.postMemberRoleAdd({
await postMemberRoleAdd({
...publicParams,
});
}
......
import TabTree, { createTreeActions } from '@/components/TabTree'
import { useTreeTabs } from '@/hooks/useTreeTabs'
import { PublicApi } from '@/services/api'
import { Button, Drawer, Row } from 'antd'
import React, { useEffect, useState } from 'react'
import './orgModal.less'
......
import React, {useState, ReactText, useEffect} from 'react';
import { Row, Col, Tree, Form, Table, InputNumber, Popconfirm, Button, Input, Modal, Card } from 'antd';
import {
CarryOutOutlined,
FormOutlined,
PlusOutlined
} from '@ant-design/icons';
import TabTree, { useTreeActions, createTreeActions } from '@/components/TabTree';
import React from 'react';
import { Row, Col, Popconfirm, Button, Card } from 'antd';
import TabTree, { createTreeActions } from '@/components/TabTree';
import SchemaForm, { createFormActions, LifeCycleTypes, FormEffectHooks } from '@formily/antd';
import { menuSchema } from './schema';
import { PublicApi } from '@/services/api';
import { omit } from '@/utils';
import { useMap, useBoolean } from '@umijs/hooks';
import { getMemberOrgTree, postMemberOrgDelete, getMemberOrgGet, postMemberOrgUpdate, postMemberOrgAdd, } from '@/services/MemberV2Api';
import { useTreeTabs } from '@/hooks/useTreeTabs';
import { isObject } from '@antv/util';
// import "./index.less"
const { ON_FORM_INPUT_CHANGE } = LifeCycleTypes
const { onFieldInputChange$ } = FormEffectHooks
......@@ -28,7 +19,7 @@ const formActions = createFormActions()
const treeActions = createTreeActions()
const fetchMenuData = async (params?) => {
const res = await PublicApi.getMemberOrgTree()
const res = await getMemberOrgTree()
return res
}
......@@ -50,9 +41,9 @@ const Organ: React.FC<{}> = () => {
} = useTreeTabs({
treeActions,
formActions,
deleteMenu: PublicApi.postMemberOrgDelete,
deleteMenu: postMemberOrgDelete,
fetchMenuData: fetchMenuData,
fetchItemDetailData: PublicApi.getMemberOrgGet
fetchItemDetailData: getMemberOrgGet
})
// 当拥有节点数据并且当前状态是编辑状态时 需回显表单
......@@ -70,7 +61,7 @@ const Organ: React.FC<{}> = () => {
...value,
parentId: nodeRecord ? nodeRecord.parentId : 0,
}
const fn = editOrAdd ? PublicApi.postMemberOrgUpdate : PublicApi.postMemberOrgAdd
const fn = editOrAdd ? postMemberOrgUpdate : postMemberOrgAdd
fn(params).then(res => {
resetMenu()
setTreeStatus(FormState.FREE)
......
......@@ -10,7 +10,7 @@ import {
} from '@ant-design/icons';
import {StandardTable} from 'god'
import { IButtonFilter, IFormFilter } from 'god/dist/src/standard-table/TableController';
import { PublicApi } from '@/services/api';
import { getMemberUserPage } from '@/services/MemberV2Api';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import { STATUS_ENUM } from '@/constants';
......@@ -19,7 +19,7 @@ import useSysetemTable from './useSystemTable';
// 模拟请求
const fetchData = async (params) => {
const { data } = await PublicApi.getMemberUserPage(params)
const { data } = await getMemberUserPage(params)
return data
}
......
......@@ -3,7 +3,7 @@ import EyePreview from "@/components/EyePreview";
import StatusSwitch from '@/components/StatusSwitch';
import { Button } from 'antd';
import PopConfirmControl from '@/components/PopConfirmControl';
import { PublicApi } from '@/services/api';
import { postMemberUserDelete, postMemberUserUpdatestatus, } from '@/services/MemberV2Api';
import { history } from 'umi'
const useSysetemTable = () => {
......@@ -84,7 +84,7 @@ const useSysetemTable = () => {
const deleteItem = (record) => {
// 删除该项
PublicApi.postMemberUserDelete({
postMemberUserDelete({
userId: record.userId
}).then(() => {
tableRef.current.reload()
......@@ -96,7 +96,7 @@ const useSysetemTable = () => {
}
const handleStatus = (record) => {
PublicApi.postMemberUserUpdatestatus({
postMemberUserUpdatestatus({
userId: record.userId,
status: record.status === 1 ? 0 : 1
}).then(res => {
......
......@@ -3,7 +3,7 @@ import { Button, Modal, Card } from 'antd';
import { createFormActions, FormButtonGroup } from '@formily/antd'
import { LinkOutlined } from '@ant-design/icons';
import { ColumnType } from 'antd/lib/table/interface';
import { PublicApi } from '@/services/api';
import { getMemberOrgTree, postMemberUserUpdate, postMemberUserAdd, getMemberUserGet, getMemberRolePageByname, } from '@/services/MemberV2Api';
import { history } from 'umi';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
......@@ -28,7 +28,7 @@ const titleRender = (title) => {
}
const fetchOriginTreeData = async (params?) => { // 平台后台树
const res = await PublicApi.getMemberOrgTree({}, { ttl: 10, useCache: true })
const res = await getMemberOrgTree({}, { ttl: 10, useCache: true })
return res
}
......@@ -43,7 +43,7 @@ const AddUser: React.FC<{}> = () => {
const { id, pageStatus } = usePageStatus()
const [roleSelection, roleSelectCtl] = useRowSelectionTable()
const [originSelectNode, setOriginSelectNode] = useState<any>()
const { data, loading, err, run } = useHttpRequest(id ? PublicApi.postMemberUserUpdate : PublicApi.postMemberUserAdd)
const { data, loading, err, run } = useHttpRequest(id ? postMemberUserUpdate : postMemberUserAdd)
const {
treeData: originTreeData,
} = useTreeTabs({
......@@ -51,7 +51,7 @@ const AddUser: React.FC<{}> = () => {
})
useEffect(() => {
if (id) {
PublicApi.getMemberUserGet({
getMemberUserGet({
userId: id
}).then(async res => {
const { data } = res
......@@ -103,7 +103,7 @@ const AddUser: React.FC<{}> = () => {
// 模拟请求
const fetchUserList = async (params: any) => {
const data = await PublicApi.getMemberRolePageByname(params)
const data = await getMemberRolePageByname(params)
return data.data
}
......
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