feat: 分类模块联调初始化

develop2
donghao 11 months ago
parent e74a0739ac
commit c825f53982

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-21 15:22:05
* @LastEditTime: 2024-05-28 10:51:37
* @FilePath: \general-ai-manage\src\components\CategorizeUpdate\index.tsx
* @Description:
* @
@ -14,13 +14,16 @@
import { PlusOutlined } from '@ant-design/icons';
import { ModalForm, ProForm } from '@ant-design/pro-components';
import type { InputRef } from 'antd';
import { Flex, Form, Input, Tag, Tooltip } from 'antd';
import { Flex, Form, Input, Tag, Tooltip, message } from 'antd';
import React, { useEffect, useRef, useState } from 'react';
import { proFormSmallModelWidth } from '../../../config/defaultForm';
type CategorizeUpdateProps = {
visible: boolean;
values: Record<string, any>;
apiSource: () => any;
beforeCloseRequest: (arg1: any, arg2: () => void) => void;
beforeAddRequest: (arg1: any, arg2: () => void) => void;
apiRequest: () => any;
handleModal: (arg1: any) => void;
modalFormProps: Record<string, any>; // {categorizeFormProps , categorizeModelProps}
};
@ -36,6 +39,8 @@ const tagInputStyle: React.CSSProperties = {
const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
const [form] = Form.useForm<Record<string, any>>();
const [tags, setTags] = useState<string[]>([]);
const [fullData, setFullData] = useState<Record<string, any>[]>([]);
const [inputVisible, setInputVisible] = useState(false);
const [inputValue, setInputValue] = useState('');
const [editInputIndex, setEditInputIndex] = useState(-1);
@ -44,8 +49,9 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
const editInputRef = useRef<InputRef>(null);
async function loadData() {
const { data } = await props.apiSource();
const { data } = await props.apiRequest();
const finalList = [];
setFullData(data?.data);
data?.data?.forEach((v: Record<string, any>) => {
finalList.push(v.name);
});
@ -68,10 +74,14 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
}
}, [props.visible]);
const handleClose = (removedTag: string) => {
const newTags = tags.filter((tag) => tag !== removedTag);
console.log(newTags);
setTags(newTags);
const handleClose = (removedTag: string, removedIndex: number) => {
props.beforeCloseRequest(fullData[removedIndex], (resp) => {
console.log(resp, 'beforeCloseRequest_resp');
// 接口调用成功,同步删除
const newTags = tags.filter((tag) => tag !== removedTag);
console.log(newTags);
setTags(newTags);
});
};
const showInput = () => {
@ -83,11 +93,24 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
};
const handleInputConfirm = () => {
if (inputValue && !tags.includes(inputValue)) {
setTags([...tags, inputValue]);
if (inputValue && inputValue.trim() && !tags.includes(inputValue)) {
props.beforeAddRequest(inputValue, (resp) => {
console.log(resp, 'beforeAddRequest_resp');
// 接口调用成功,同步添加
setTags([...tags, inputValue]);
setFullData([
...fullData,
{
name: inputValue,
...resp.data,
},
]);
setInputVisible(false);
setInputValue('');
});
} else {
message.warning('名称为空或者已存在');
}
setInputVisible(false);
setInputValue('');
};
const handleEditInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
@ -152,7 +175,7 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
key={tag}
closable={true}
style={{ userSelect: 'none' }}
onClose={() => handleClose(tag)}
onClose={() => handleClose(tag, index)}
>
<span
onDoubleClick={(e) => {

@ -2,22 +2,31 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-22 15:23:36
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-21 15:24:53
* @LastEditTime: 2024-05-28 11:45:44
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\deviceList.tsx
* @Description: deviceGroupdg
* @
* 3
* 4
* 5122
* 1
* 2
* 3
* 4
*
*
*/
import InnerPageBack from '@/components/Back/innerPageBack';
import { getDictDeviceType } from '@/services/testApi/dict';
import { isSuccessApi } from '@/utils/forApi';
import {
apiDeviceClassification,
apiDeviceClassificationAdd,
apiDeviceClassificationDelete,
} from '@/services/business/device';
import TableActionCard from '@/components/TableActionCard';
import { getDeviceListByGroup } from '@/services/testApi/device';
import { ProTable } from '@ant-design/pro-components';
import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max';
import { Button } from 'antd';
import { Button, message } from 'antd';
import { useRef, useState } from 'react';
import { proTablePaginationOptions } from '../../../../../config/defaultTable';
@ -183,6 +192,7 @@ const DeviceList: React.FC<DeviceListProps> = () => {
},
];
/**设备分类 */
return (
<div className="dg_deviceList_wrap">
<ProTable
@ -291,7 +301,28 @@ const DeviceList: React.FC<DeviceListProps> = () => {
visible={deviceTypeOpen}
handleModal={handleSetDeviceType}
values={{ deviceType: [{ name: '', value: '' }] }}
apiSource={getDictDeviceType}
apiRequest={async () => {
let resp = await apiDeviceClassification();
return {
data: resp.data,
};
}}
beforeCloseRequest={async (params, successRes) => {
let resp = await apiDeviceClassificationDelete({ id: params.id });
if (isSuccessApi(resp)) {
successRes(resp);
} else {
message.error(resp.meta.message);
}
}}
beforeAddRequest={async (params, successRes) => {
let resp = await apiDeviceClassificationAdd({ name: params });
if (isSuccessApi(resp)) {
successRes(resp);
} else {
message.error(resp.meta.message);
}
}}
modalFormProps={{
categorizeFormProps: {
label: (

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-22 15:23:36
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-15 11:44:01
* @LastEditTime: 2024-05-27 13:47:38
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\index.tsx
* @Description: deviceGroupdg
* @
@ -14,6 +14,8 @@
*/
import { DeviceGroupTree } from '@/components/Tree';
import { deviceGroupEnums } from '@/enums/device';
import { isSuccessApi } from '@/utils/forApi';
import { getDeviceGroupList } from '@/services/testApi/deviceGroup';
import { ProCard } from '@ant-design/pro-components';
import { Button, Tabs } from 'antd';
@ -47,8 +49,10 @@ const DeviceGroup: React.FC = () => {
async function loadDeviceTree() {
const resp = await getDeviceGroupList({ pageNo: 1, pageSize: 100 });
console.log(resp.data, 'loadDeviceTree');
setDeviceTreeList(resp?.data.data);
setNodeInfo(resp?.data.data[0]);
if (isSuccessApi(resp)) {
setDeviceTreeList(resp?.data.data);
setNodeInfo(resp?.data.data[0]);
}
}
// 新增

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-23 16:10:47
* @LastEditTime: 2024-05-28 11:10:35
* @FilePath: \general-ai-manage\src\pages\ModelIndex\ModelIndex.tsx
* @Description:
* @
@ -13,14 +13,19 @@
*
*/
import { CommButton } from '@/components/Button';
import { getDictIndustry } from '@/services/testApi/dict';
import { ReactComponent as ResetIcon } from '/public/home/reset_icon.svg';
import { ReactComponent as SearchIcon } from '/public/home/search_icon.svg';
import CategorizeUpdate from '@/components/CategorizeUpdate';
import TableActionCard from '@/components/TableActionCard';
import IsDelete from '@/components/TableActionCard/isDelete';
import { getModelList } from '@/services/testApi/model';
import {
apiBasemodelClassificationAdd,
apiBasemodelClassificationDelete,
apiBasemodelClassificationList,
apiBasemodelList,
} from '@/services/business/basemodel';
import { isSuccessApi } from '@/utils/forApi';
import { ReactComponent as ResetIcon } from '/public/home/reset_icon.svg';
import { ReactComponent as SearchIcon } from '/public/home/search_icon.svg';
import { SearchOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProCard, ProForm, ProFormText, ProTable } from '@ant-design/pro-components';
@ -310,7 +315,7 @@ const ModelIndex: React.FC = () => {
let sort_select = sort[reqParams.orderKey];
reqParams.desc = sort_select === 'descend';
}
let resp = await getModelList({ ...reqParams, ...querysData });
let resp = await apiBasemodelList({ ...reqParams, ...querysData });
return {
data: resp.data.data,
success: resp.success,
@ -331,7 +336,24 @@ const ModelIndex: React.FC = () => {
visible={industryOpen}
handleModal={handleSetIndustry}
values={{ industry: [{ name: '', value: '' }] }}
apiSource={getDictIndustry}
apiRequest={async () => {
let resp = await apiBasemodelClassificationList();
return {
data: resp.data,
};
}}
beforeCloseRequest={async (params, successRes) => {
let resp = await apiBasemodelClassificationDelete({ id: params.id });
if (isSuccessApi(resp)) {
successRes(resp);
}
}}
beforeAddRequest={async (params, successRes) => {
let resp = await apiBasemodelClassificationAdd({ name: params });
if (isSuccessApi(resp)) {
successRes(resp);
}
}}
modalFormProps={{
categorizeFormProps: {
label: (

@ -2,22 +2,28 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-23 17:46:47
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-24 16:46:44
* @LastEditTime: 2024-05-27 13:39:11
* @FilePath: \general-ai-platform-web\src\pages\Project\BusinessInfo\components\accountPsw.tsx
* @Description:
*/
import { ProForm, ProFormText } from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import React from 'react';
import React, { useEffect } from 'react';
type AccountPswProps = {
info: Record<string, any>;
};
const AccountPsw: React.FC<AccountPswProps> = () => {
// TODO 企业账号未获取到
const AccountPsw: React.FC<AccountPswProps> = (props) => {
const [form] = ProForm.useForm(); // form 对象
const intl = useIntl();
useEffect(() => {
if (props.info) {
form.setFieldsValue(props.info);
}
}, [props.info]);
return (
<ProForm
className="gn_form"
@ -46,7 +52,7 @@ const AccountPsw: React.FC<AccountPswProps> = () => {
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'business.list.table.form.name',
id: 'business_info.list.table.form.name',
defaultMessage: '$$$',
})}`}
required={true}

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-23 17:00:00
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-14 10:20:13
* @LastEditTime: 2024-05-27 13:33:14
* @FilePath: \general-ai-platform-web\src\pages\Project\BusinessInfo\components\baseInfo.tsx
* @Description:
*
@ -14,23 +14,23 @@ import { FormattedMessage } from '@umijs/max';
type BaseInfoProps = {
info: Record<string, any>;
};
// TODO 行业信息、服务有效期未从接口获取到
const BaseInfo: React.FC<BaseInfoProps> = ({ info }) => {
// 模型基本信息
const ModelDetailColumns = [
{
title: <FormattedMessage id="business.list.table.form.industry" defaultMessage="所属行业" />,
dataIndex: 'industryName',
dataIndex: 'industry',
},
{
title: <FormattedMessage id="business.list.table.form.contacts" defaultMessage="联系人" />,
dataIndex: 'contacts',
dataIndex: 'contact',
},
{
title: (
<FormattedMessage id="business.list.table.form.contactWay" defaultMessage="联系方式" />
),
dataIndex: 'contactWay',
dataIndex: 'phone',
},
{
title: (
@ -45,13 +45,13 @@ const BaseInfo: React.FC<BaseInfoProps> = ({ info }) => {
title: <FormattedMessage id="business.list.table.form.address" defaultMessage="公司地址" />,
dataIndex: 'address',
render: (_, record) => {
return record?.province + record?.city + record.address;
return record?.province + record?.city + record.addr;
},
span: 4,
},
{
title: <FormattedMessage id="business.list.table.form.remark" defaultMessage="公司简介" />,
dataIndex: 'remark',
dataIndex: 'summary',
span: 4,
},
];

@ -9,7 +9,9 @@
import { useBusinessInfo } from '@/hooks/useBusinessInfo';
import { useMoment } from '@/hooks/useMoment';
import { getBusinessAlgorithmList, getBusinessDetail } from '@/services/testApi/businessProject';
import { apiEntityInfo, apiEntityPwdcheck } from '@/services/business/entity';
import { getBusinessAlgorithmList } from '@/services/testApi/businessProject';
import { isSuccessApi } from '@/utils/forApi';
import { ProCard, ProList } from '@ant-design/pro-components';
import { Button } from 'antd';
@ -31,16 +33,10 @@ const { formatTimeByDateType } = useMoment();
const BusinessInfo: React.FC = () => {
//state
const [detailInfo, setDetailInfo] = useState<Record<string, any>>({});
const [pwdInfo, setPwdInfo] = useState<Record<string, any>>({});
const { getStoreBusinessInfo } = useBusinessInfo();
const [updateModalOpen, setUpdateModalOpen] = useState<boolean>(false);
// 未启用
/**
* @en-US International configuration
* @zh-CN
* */
// const access = useAccess();
// const intl = useIntl();
// const actionRef = useRef<ActionType>();
// 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState<number>(10);
const [currentPage, setCurrentPage] = useState<number>(1);
@ -73,12 +69,21 @@ const BusinessInfo: React.FC = () => {
// 初始化加载
async function loadDetailData() {
const { id } = getStoreBusinessInfo();
const resp = await getBusinessDetail({ id });
const resp = await apiEntityInfo({ id });
if (isSuccessApi(resp)) {
setDetailInfo(resp?.data);
}
}
// 登录密码信息
async function loadPwdInfo() {
const { id } = getStoreBusinessInfo();
const resp = await apiEntityPwdcheck({ id });
if (isSuccessApi(resp)) {
setPwdInfo(resp?.data);
}
}
// 算法列表
async function initList(tabId: string) {
const reqParams = {
@ -89,10 +94,12 @@ const BusinessInfo: React.FC = () => {
// ...rest,
};
const resp = await getBusinessAlgorithmList({ ...reqParams });
// console.log(resp,'resp');
// setCurrentPageSize(resp?.data?.count)
setTotal(resp?.data?.count);
loadList(resp?.data?.data);
if (isSuccessApi(resp)) {
// console.log(resp,'resp');
// setCurrentPageSize(resp?.data?.count)
setTotal(resp?.data?.count);
loadList(resp?.data?.data);
}
}
useEffect(() => {
@ -101,6 +108,7 @@ const BusinessInfo: React.FC = () => {
useEffect(() => {
loadDetailData();
loadPwdInfo();
}, []);
return (
<div className="businessInfo_page pb-[1px]">
@ -137,7 +145,7 @@ const BusinessInfo: React.FC = () => {
<div className="gn_head_card mb-[20px]">
<ProCard className="gn_card_wrap" title={<span className="head3"></span>}>
<AccountPsw></AccountPsw>
<AccountPsw info={pwdInfo}></AccountPsw>
</ProCard>
</div>

@ -0,0 +1,199 @@
/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-24 17:57:19
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-28 11:03:42
* @FilePath: \general-ai-platform-web\src\services\business\basemodel.ts
* @Description:
*/
// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';
/** 基础模型管理 */
// 添加模型分类
export async function apiBasemodelClassificationAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/classification/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型分类列表
export async function apiBasemodelClassificationList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/classification/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型分类
export async function apiBasemodelClassificationDelete(
body: any,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/classification/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 添加模型
export async function apiBasemodelAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型列表
export async function apiBasemodelList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型
export async function apiBasemodelDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 编辑模型
export async function apiBasemodelEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型信息
export async function apiBasemodelInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 添加模型版本
export async function apiBasemodelVersionAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型版本列表
export async function apiBasemodelVersionList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型版本
export async function apiBasemodelVersionDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型版本信息
export async function apiBasemodelVersionInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}

@ -0,0 +1,60 @@
/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-24 17:57:19
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-27 14:54:19
* @FilePath: \general-ai-platform-web\src\services\business\device.ts
* @Description:
*/
// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';
/** 企业设备 */
// 添加设备分类
export async function apiDeviceClassificationAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/device/classification/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 设备分类列表
export async function apiDeviceClassification(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/device/classification`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除设备分类
export async function apiDeviceClassificationDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/device/classification/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-23 13:50:50
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-24 16:19:57
* @LastEditTime: 2024-05-28 10:09:31
* @FilePath: \general-ai-platform-web\src\services\Business\entity.ts
* @Description: api
*/
@ -10,9 +10,9 @@
/* eslint-disable */
import { request } from '@umijs/max';
/** 首页企业管理 /entity/index */
/** 首页企业管理 & 企业详情 */
// 首页企业列表
export async function apiEntityIndex(body: API.Login, options?: { [key: string]: any }) {
export async function apiEntityIndex(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/index`,
{
@ -44,7 +44,7 @@ export async function apiEntityBaseCount(body: any, options?: { [key: string]: a
}
// 新建企业
export async function apiEntityAdd(body: API.Login, options?: { [key: string]: any }) {
export async function apiEntityAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/add`,
{
@ -60,7 +60,7 @@ export async function apiEntityAdd(body: API.Login, options?: { [key: string]: a
}
// 企业信息
export async function apiEntityInfo(body: API.Login, options?: { [key: string]: any }) {
export async function apiEntityInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/info`,
{
@ -76,7 +76,7 @@ export async function apiEntityInfo(body: API.Login, options?: { [key: string]:
}
// 编辑企业信息
export async function apiEntityEdit(body: API.Login, options?: { [key: string]: any }) {
export async function apiEntityEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/edit`,
{
@ -91,8 +91,8 @@ export async function apiEntityEdit(body: API.Login, options?: { [key: string]:
);
}
// 编辑企业信息
export async function apiEntityDelete(body: API.Login, options?: { [key: string]: any }) {
// 删除企业信息
export async function apiEntityDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/delete`,
{
@ -106,3 +106,99 @@ export async function apiEntityDelete(body: API.Login, options?: { [key: string]
},
);
}
// 企业登录密码信息
export async function apiEntityPwdcheck(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/pwdcheck`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
/** 企业节点设置 */
// 添加企业节点
export async function apiEntityNodesAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/nodes/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 修改企业节点
export async function apiEntityNodesEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/nodes/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 企业节点树
export async function apiEntityNodes(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/nodes`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除企业节点树
export async function apiEntityNodesDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/nodes/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 企业节点信息
export async function apiEntityNodesInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/nodes/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-24 10:11:48
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-24 10:17:21
* @LastEditTime: 2024-05-27 14:00:45
* @FilePath: \general-ai-platform-web\src\utils\forApi.ts
* @Description:
*/
@ -13,9 +13,11 @@
* @returns boolean
*/
export function isSuccessApi(result: API.API_COMMON_DATA): boolean {
const { meta } = result;
if (meta.code < 300 && meta.code >= 200) {
return true;
if (result && result?.meta) {
const { meta } = result;
if (meta.code < 300 && meta.code >= 200) {
return true;
}
}
return false;
}

Loading…
Cancel
Save