feat: 分类更新统一添加,节点设置外层交互完成

develop2
donghao 1 year ago
parent 49bfe975bc
commit 1eb526d45d

@ -1,14 +1,28 @@
import { getDictIndustry } from '@/services/testApi/dict';
/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-30 14:57:45
* @FilePath: \general-ai-manage\src\components\CategorizeUpdate\index.tsx
* @Description:
* @
* 1.
* 2.
*
*/
import { PlusOutlined } from '@ant-design/icons';
import { ModalForm, ProForm } from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import type { InputRef } from 'antd';
import { Flex, Form, Input, Tag, Tooltip } from 'antd';
import React, { useEffect, useRef, useState } from 'react';
import { proFormSmallModelWidth } from '../../../../../config/defaultForm';
type IndustryUpdateProps = {
industryOpen: boolean;
handleModal: () => void;
import { proFormSmallModelWidth } from '../../../config/defaultForm';
type CategorizeUpdateProps = {
visible: boolean;
values: Record<string, any>;
apiSource: () => any;
handleModal: (arg1: any) => void;
modalFormProps: Record<string, any>; // {categorizeFormProps , categorizeModelProps}
};
const tagInputStyle: React.CSSProperties = {
@ -19,8 +33,7 @@ const tagInputStyle: React.CSSProperties = {
};
// TODO 整体样式需要按UI图调整 交互在确认时要把tags赋值给form
const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
const intl = useIntl();
const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
const [form] = Form.useForm<Record<string, any>>();
const [tags, setTags] = useState<string[]>([]);
const [inputVisible, setInputVisible] = useState(false);
@ -31,7 +44,7 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
const editInputRef = useRef<InputRef>(null);
async function loadData() {
const { data } = await getDictIndustry();
const { data } = await props.apiSource();
const finalList = [];
data?.results?.forEach((v: Record<string, any>) => {
finalList.push(v.name);
@ -50,10 +63,10 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
}, [editInputValue]);
useEffect(() => {
if (props.industryOpen) {
if (props.visible) {
loadData();
}
}, [props.industryOpen]);
}, [props.visible]);
const handleClose = (removedTag: string) => {
const newTags = tags.filter((tag) => tag !== removedTag);
@ -99,39 +112,24 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
return (
<ModalForm<Record<string, any>>
className="gn_form mi_industry_update"
className="gn_form"
width={proFormSmallModelWidth}
title={intl.formatMessage({
id: 'model_index.table.list.setIndustry',
defaultMessage: '新建',
})}
open={props.industryOpen}
{...props?.modalFormProps?.categorizeModelProps}
open={props.visible}
form={form}
modalProps={{
destroyOnClose: true,
onCancel: () => props.handleModal(),
}}
initialValues={{ industry: [{ name: '', value: '' }] }}
initialValues={props.values}
submitTimeout={2000}
onFinish={async (values) => {
console.log(values, 'add_finish_values');
// TODO 对接新增接口
// postModelCategoryCreateModelCategory(values)
// .then(() => {
// message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
// props.reload();
// })
// .catch(() => {
// message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
// });
props.handleModal();
props.handleModal(form.getFieldsValue());
return true;
}}
>
<ProForm.Item
label={<FormattedMessage id="model_index.create.form.industry" defaultMessage="行业分类" />}
name="industry"
>
<ProForm.Item {...props?.modalFormProps?.categorizeFormProps}>
<Flex gap="8px 0" wrap="wrap">
{tags.map<React.ReactNode>((tag, index) => {
if (editInputIndex === index) {
@ -190,7 +188,7 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
/>
) : (
<Tag style={tagPlusStyle} icon={<PlusOutlined />} onClick={showInput}>
New Tag
</Tag>
)}
</Flex>
@ -199,4 +197,4 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
);
};
export default IndustryUpdate;
export default CategorizeUpdate;

@ -2,7 +2,7 @@
* @Author: zhoux zhouxia@supervision.ltd
* @Date: 2023-11-01 13:56:33
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-29 17:37:55
* @LastEditTime: 2024-04-30 14:50:56
* @FilePath: \general-ai-platform-web\src\locales\zh-CN\device.ts
* @Description:
*/
@ -20,7 +20,6 @@ export const device_group: { [key: string]: string } = {
'device_group.tree_node.remark': '简介',
'device_group.tree_node.createForm.add': '新建节点',
// 未启用
'device_group.table.list.id': 'ID',
'device_group.table.list.name': '分组名称',
'device_group.table.list.code': '分组代码',
@ -47,13 +46,20 @@ export const device_group: { [key: string]: string } = {
export const device_group_list: { [key: string]: string } = {
'device_group_list.table.list.name': '设备名称',
'device_group_list.table.list.deviceType': '设备类型',
'device_group_list.table.list.rule.required.name': '请填写设备名称',
'device_group_list.table.list.deviceSite': '设备位置',
'device_group_list.table.list.deviceType': '设备分类',
'device_group_list.table.list.deviceModel': '设备型号',
'device_group_list.table.list.deviceParams': '设备参数',
'device_group_list.table.list.remark': '备注',
'device_group_list.table.list.isEnable': '模型部署',
'device_group_list.table.list.deployed.isEnable': '已部署',
'device_group_list.table.list.undeployed.isEnable': '未部署',
'device_group_list.table.list.action.setModel': '基础模型配置',
'device_group_list.table.list.action.new': '新建设备',
'device_group_list.table.list.action.modelType': '设备分类',
'device_group_list.table.list.action.deviceType': '设备分类',
'device_group_list.table.list.add': '新建设备',
'device_group_list.table.list.action.setDeviceType': '新建设备分类',
// 未启用
'device_group_list.table.list.code': '设备代码',
@ -62,12 +68,10 @@ export const device_group_list: { [key: string]: string } = {
'device_group_list.table.list.spec': '设备规格',
'device_group_list.table.list.categoryFkId': '设备类别',
'device_group_list.table.list.groupFkId': '设备分组',
'device_group_list.table.list.remark': '备注',
'device_group_list.table.list.createTime': '创建时间',
'device_group_list.table.list.updateTime': '更新时间',
'device_group_list.table.rule.required.name': '设备名称为必填项',
'device_group_list.table.rule.required.code': '设备代码为必填项',
'device_group_list.table.list.add': '新建设备',
'device_group_list.table.list.update': '更新设备',
};
export const device_category: { [key: string]: string } = {

@ -0,0 +1,159 @@
/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-30 10:02:29
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-30 10:37:48
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\alarmSetForm.tsx
* @Description:
* @
* 1
* 2
*/
import {
ProForm,
ProFormCheckbox,
ProFormDependency,
ProFormGroup,
ProFormList,
ProFormRadio,
ProFormSelect,
} from '@ant-design/pro-components';
import { Form } from 'antd';
import { useEffect } from 'react';
type AlarmSetFormProps = {
currentRow: Record<string, any>;
};
const AlarmSetForm: React.FC<AlarmSetFormProps> = (props) => {
const [form] = Form.useForm<API.DeviceCategory>();
// const [initialValues, setInitialValues] = useState<Record<string, any>>({});
function fetchInitialValues() {
// setInitialValues({
// type: '2',
// ways: [
// {
// label: '短信',
// value: [],
// isChecked: [],
// },
// {
// label: '邮件',
// value: [],
// isChecked: [],
// },
// ]
// });
}
useEffect(() => {
fetchInitialValues();
}, []);
return (
<ProForm
style={{ paddingBottom: 70 }}
submitter={{
searchConfig: {
submitText: '保存', // 在这里设置提交按钮文案
},
}}
form={form}
initialValues={props.currentRow}
onFinish={async (values) => {
// TODO 提交告警设置调用api
console.log('onFinish_values', values);
// postProjectCreateProject(values)
// .then(() => {
// message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
// props.reload();
// })
// .catch(() => {
// message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
// });
// props.reload();
return true;
}}
>
<ProFormGroup>
<ProFormGroup title="通知方式" titleStyle={{ margin: '0 0 8px' }}>
<ProFormList
className="innerFormList_box"
name={['ways']}
creatorButtonProps={false}
copyIconProps={false}
deleteIconProps={false}
style={{ padding: 0, margin: 0 }}
>
{(f, index, action) => {
console.log('isChecked_value', f, index, action);
return (
<div className="form_checkBox_wrap">
<ProFormGroup key="group">
<ProFormCheckbox.Group
name="isChecked"
options={[
{
label: form.getFieldValue('ways')[index].label,
value: '1',
},
]}
></ProFormCheckbox.Group>
<ProFormDependency name={['isChecked']}>
{({ isChecked }) => {
console.log(isChecked, 'isChecked');
return (
<ProFormSelect
width={'lg'}
mode="multiple"
name="value"
debounceTime={1000}
disabled={!isChecked?.length}
request={async () => {
// const resp = await postCurrentIP();
const resp = ['test001', 'test002', 'test003'];
return resp?.map((v: any) => {
return {
label: v,
value: v,
};
});
}}
/>
);
}}
</ProFormDependency>
</ProFormGroup>
</div>
);
}}
</ProFormList>
</ProFormGroup>
</ProFormGroup>
<ProFormGroup title="通知频次" titleStyle={{ margin: '0 0 8px' }}>
<ProFormRadio.Group
name="type"
initialValue={props.values?.type || '0'}
options={[
{
label: '每次',
value: '0',
},
{
label: '每天',
value: '1',
},
{
label: '每周',
value: '2',
},
{
label: '每月',
value: '3',
},
]}
></ProFormRadio.Group>
</ProFormGroup>
</ProForm>
);
};
export default AlarmSetForm;

@ -1,5 +1,11 @@
// import { postModelCategoryCreateModelCategory } from '@/services/resource/ModelCategory';
import { ModalForm, ProForm, ProFormText, ProFormTextArea } from '@ant-design/pro-components';
import { getDictDeviceType } from '@/services/testApi/dict';
import {
ModalForm,
ProForm,
ProFormSelect,
ProFormText,
ProFormTextArea,
} from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Form } from 'antd';
import React from 'react';
@ -24,7 +30,7 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
className="gn_modal_form gn_form"
width={proFormSmallModelWidth}
title={intl.formatMessage({
id: 'device_group.tree_node.CreateDeviceForm.add',
id: 'device_group_list.table.list.add',
defaultMessage: '新建',
})}
open={props.createModalOpen}
@ -54,12 +60,14 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
<ProFormText
width={proFormSmallItemStyleProps.column2Width}
name="name"
label={<FormattedMessage id="device_group.tree_node.name" defaultMessage="名称" />}
label={
<FormattedMessage id="device_group_list.table.list.name" defaultMessage="设备名称" />
}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'device_group.tree_node.name',
id: 'device_group_list.table.list.name',
defaultMessage: '$$$',
})}`}
required={true}
@ -68,7 +76,7 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
required: true,
message: (
<FormattedMessage
id="device_group.tree_node.rule.required.name"
id="device_group_list.table.list.rule.required.name"
defaultMessage="名称必填"
/>
),
@ -77,94 +85,94 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
/>
<ProFormText
width={proFormSmallItemStyleProps.column2Width}
name="fatherName"
name="deviceSite"
label={
<FormattedMessage id="device_group.tree_node.fatherName" defaultMessage="上级节点" />
}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'device_group.tree_node.fatherName',
defaultMessage: '$$$',
})}`}
disabled
<FormattedMessage
id="device_group_list.table.list.deviceSite"
defaultMessage="设备位置"
/>
<ProFormText
width={proFormSmallItemStyleProps.width}
name="address"
label={<FormattedMessage id="device_group.tree_node.address" defaultMessage="地址" />}
}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'device_group.tree_node.address',
id: 'device_group_list.table.list.deviceSite',
defaultMessage: '$$$',
})}`}
/>
<ProFormText
<ProFormSelect
width={proFormSmallItemStyleProps.column2Width}
name="lon"
label={<FormattedMessage id="device_group.tree_node.lon" defaultMessage="经度" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'device_group.tree_node.lon',
defaultMessage: '$$$',
})}`}
name="deviceType"
label={
<FormattedMessage
id="device_group_list.table.list.deviceType"
defaultMessage="设备分类"
/>
<ProFormText
width={proFormSmallItemStyleProps.column2Width}
name="lat"
label={<FormattedMessage id="device_group.tree_node.lat" defaultMessage="纬度" />}
}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
id: 'common.please_select',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'device_group.tree_node.lat',
id: 'device_group_list.table.list.deviceType',
defaultMessage: '$$$',
})}`}
showSearch
debounceTime={500}
request={async () => {
const { data } = await getDictDeviceType();
return data?.results?.map((v: Record<string, any>) => {
return { ...v, label: v.name, value: v.id };
});
}}
/>
<ProFormText
width={proFormSmallItemStyleProps.column2Width}
name="managerName"
name="deviceModel"
label={
<FormattedMessage id="device_group.tree_node.managerName" defaultMessage="负责人" />
<FormattedMessage
id="device_group_list.table.list.deviceModel"
defaultMessage="设备型号"
/>
}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'device_group.tree_node.managerName',
id: 'device_group_list.table.list.deviceModel',
defaultMessage: '$$$',
})}`}
/>
<ProFormText
width={proFormSmallItemStyleProps.column2Width}
name="managerPhone"
width={proFormSmallItemStyleProps.width}
name="deviceParams"
label={
<FormattedMessage id="device_group.tree_node.managerPhone" defaultMessage="联系方式" />
<FormattedMessage
id="device_group_list.table.list.deviceParams"
defaultMessage="设备参数"
/>
}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'device_group.tree_node.managerPhone',
id: 'device_group_list.table.list.deviceParams',
defaultMessage: '$$$',
})}`}
/>
<ProFormTextArea
width={proFormSmallItemStyleProps.width}
name="remark"
label={<FormattedMessage id="device_group.tree_node.remark" defaultMessage="简介" />}
label={
<FormattedMessage id="device_group_list.table.list.remark" defaultMessage="备注" />
}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'device_group.tree_node.remark',
id: 'device_group_list.table.list.remark',
defaultMessage: '$$$',
})}`}
/>

@ -1,12 +1,27 @@
/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-22 15:23:36
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-30 15:00:07
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\deviceList.tsx
* @Description: deviceGroupdg
* @
* 3
* 4
* 5122
*/
import { getDictDeviceType } from '@/services/testApi/dict';
import TableActionCard from '@/components/TableActionCard';
import { getDeviceListByGroup } from '@/services/testApi/device';
import { ProTable } from '@ant-design/pro-components';
import { Access, FormattedMessage, history, useAccess } from '@umijs/max';
import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max';
import { Button } from 'antd';
import { useRef, useState } from 'react';
import { proTablePaginationOptions } from '../../../../../config/defaultTable';
import CategorizeUpdate from '@/components/CategorizeUpdate';
import IsDelete from '@/components/TableActionCard/isDelete';
import CreateDeviceForm from './createDeviceForm';
@ -16,14 +31,21 @@ type DeviceListProps = {
const DeviceList: React.FC<DeviceListProps> = () => {
const access = useAccess();
// const intl = useIntl();
// eslint-disable-next-line react-hooks/rules-of-hooks
const intl = useIntl();
const actionRef = useRef<ActionType>();
const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
// const [categoryFkIdIds, setCategoryFkIdIds] = useState([]);
// 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState<number>(10);
// 设置分类
const [deviceTypeOpen, setDeviceTypeOpen] = useState<boolean>(false);
// 设置行业分类
const handleSetDeviceType = () => {
setDeviceTypeOpen(!deviceTypeOpen);
};
/**新增 编辑 删除 */
// 新增
const handleCreateModal = () => {
@ -180,13 +202,13 @@ const DeviceList: React.FC<DeviceListProps> = () => {
/>
</Button>
<Button
key="modelType"
key="deviceType"
onClick={() => {
setCreateModalOpen(true);
handleSetDeviceType();
}}
>
<FormattedMessage
id="device_group_list.table.list.action.modelType"
id="device_group_list.table.list.action.deviceType"
defaultMessage="设备分类"
/>
</Button>
@ -239,6 +261,29 @@ const DeviceList: React.FC<DeviceListProps> = () => {
handleModal={handleCreateModal}
reload={reloadList}
/>
<CategorizeUpdate
visible={deviceTypeOpen}
handleModal={handleSetDeviceType}
values={{ deviceType: [{ name: '', value: '' }] }}
apiSource={getDictDeviceType}
modalFormProps={{
categorizeFormProps: {
label: (
<FormattedMessage
id="device_group_list.table.list.action.deviceType"
defaultMessage="设备分类"
/>
),
name: 'deviceType',
},
categorizeModelProps: {
title: intl.formatMessage({
id: 'device_group_list.table.list.action.setDeviceType',
defaultMessage: '新建',
}),
},
}}
/>
</div>
);
};

@ -0,0 +1,158 @@
/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-30 10:02:29
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-30 17:01:59
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\modelSetting.tsx
* @Description:
* @
* 1
* 2
*/
import TableActionCard from '@/components/TableActionCard';
import { getBusinessModelList } from '@/services/testApi/businessModel';
import { ExclamationCircleFilled } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import { FormattedMessage } from '@umijs/max';
import { Button } from 'antd';
import { useRef, useState } from 'react';
import {
proTableCommonOptions,
proTablePaginationOptions,
} from '../../../../../config/defaultTable';
// import CreateForm from './components/createForm';
const ModelSetting: React.FC = () => {
// const intl = useIntl();
const actionRef = useRef<ActionType>();
// const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
// const [categoryFkIdIds, setCategoryFkIdIds] = useState([]);
// 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState<number>(10);
// const [currentRow, setCurrentRow] = useState<Record<string, any>>({});
/**配置参数 */
// function reloadList() {
// actionRef.current?.reload();
// }
// 业务模型列表信息
const columns: ProColumns<Record<string, any>>[] = [
{
title: <FormattedMessage id="business_model.table.list.name" defaultMessage="业务模型名称" />,
dataIndex: 'name',
hideInSearch: true,
key: 'fixedName',
fixed: 'left',
},
{
title: <FormattedMessage id="business_model.table.list.status" defaultMessage="部署状态" />,
dataIndex: 'status',
hideInSearch: true,
},
{
title: (
<FormattedMessage id="business_model.table.list.createTime" defaultMessage="创建时间" />
),
dataIndex: 'createTime',
hideInSearch: true,
valueType: 'dateTime',
},
{
title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
key: 'option',
render: () => [
<TableActionCard
key="TableActionCardRef"
renderActions={[
{
key: 'updateDetail',
renderDom: (
<Button
key="updateDetail"
type="link"
size="small"
onClick={() => {
// TODO 编辑在新增联调后实现
// setCurrentRow(record);
}}
>
<FormattedMessage id="pages.searchTable.updateDetail" defaultMessage="配置参数" />
</Button>
),
},
]}
></TableActionCard>,
],
},
];
return (
<div className="modelSetting_page">
<div
className="pb-[12px]"
style={{
color: '#FAAD14',
}}
>
<ExclamationCircleFilled />
<span className="pl-[8px]"></span>
</div>
<ProTable
className="gn_pro_table"
cardProps={{
bodyStyle: { padding: 0 },
}}
// 标题栏
search={false}
scroll={{ y: proTableCommonOptions.commscrollY }}
options={{ fullScreen: false, setting: false, density: false, reload: false }}
actionRef={actionRef}
rowKey="key"
onDataSourceChange={(data) => {
console.log(data, 'onDataSourceChange_data');
// let CategoryFkIdIds: any = data.map((v) => {
// return v.categoryFkId;
// });
// setCategoryFkIdIds(CategoryFkIdIds);
}}
pagination={{
...proTablePaginationOptions,
pageSize: currentPageSize,
onChange: (page, pageSize) => setCurrentPageSize(pageSize),
}}
columnsState={{
persistenceKey: 'algorithm_model_list',
persistenceType: 'localStorage',
}}
request={async (params = {}) => {
const { current, ...rest } = params;
const reqParams = {
page: current,
...rest,
};
let resp = await getBusinessModelList({ ...reqParams });
console.log(resp, 'getModelVersionList_resp');
return {
data: resp.data?.results.map((v: Record<string, any>) => {
return { ...v, key: v.id };
}),
success: resp.success,
total: resp.data.count,
current: current,
pageSize: currentPageSize,
};
}}
columns={columns}
/>
</div>
);
};
export default ModelSetting;

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-22 15:23:36
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-29 16:50:22
* @LastEditTime: 2024-04-30 14:01:32
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\index.tsx
* @Description: deviceGroupdg
* @
@ -18,9 +18,11 @@ import { getDeviceGroupList } from '@/services/testApi/deviceGroup';
import { ProCard } from '@ant-design/pro-components';
import { Button, Tabs } from 'antd';
import { useEffect, useState } from 'react';
import AlarmSetForm from './components/alarmSetForm';
import BaseInfo from './components/baseInfo';
import CreateForm from './components/createForm';
import DeviceList from './components/deviceList';
import ModelSetting from './components/modelSetting';
import './index.less';
@ -117,6 +119,26 @@ const DeviceGroup: React.FC = () => {
}}
></Tabs>
{tabKey === '1' && <DeviceList info={nodeInfo}></DeviceList>}
{tabKey === '2' && <ModelSetting info={nodeInfo}></ModelSetting>}
{tabKey === '3' && (
<AlarmSetForm
currentRow={{
type: '2',
ways: [
{
label: '短信',
value: [],
isChecked: [],
},
{
label: '邮件',
value: [],
isChecked: [],
},
],
}}
></AlarmSetForm>
)}
</div>
</ProCard>
</div>

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-18 10:09:20
* @LastEditTime: 2024-04-30 15:01:14
* @FilePath: \general-ai-manage\src\pages\ModelIndex\ModelIndex.tsx
* @Description:
* @
@ -13,29 +13,32 @@
*
*/
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 { SearchOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProCard, ProForm, ProFormText, ProTable } from '@ant-design/pro-components';
import { Access, FormattedMessage, history, useAccess } from '@umijs/max';
import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max';
import { Button } from 'antd';
import React, { useEffect, useRef, useState } from 'react';
import { proTableCommonOptions, proTablePaginationOptions } from '../../../../config/defaultTable';
import CreateForm from './components/createForm';
import IndustryUpdate from './components/industryUpdate';
import './index.less';
const ModelIndex: React.FC = () => {
const access = useAccess();
// const intl = useIntl();
// eslint-disable-next-line react-hooks/rules-of-hooks
const intl = useIntl();
const actionRef = useRef<ActionType>();
const [querysData, setQuerysData] = useState<Record<string, any>>({}); // 列表查询参数
const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
// 设置分类
const [industryOpen, setIndustryOpen] = useState<boolean>(false);
// const [categoryFkIdIds, setCategoryFkIdIds] = useState([]);
@ -54,11 +57,7 @@ const ModelIndex: React.FC = () => {
};
// 设置行业分类
const handleSetIndustry = () => {
if (industryOpen) {
setIndustryOpen(false);
} else {
setIndustryOpen(true);
}
setIndustryOpen(!industryOpen);
};
/**
* @en-US The pop-up window of the distribution update window
@ -327,7 +326,26 @@ const ModelIndex: React.FC = () => {
handleModal={handleCreateModal}
reload={reloadList}
/>
<IndustryUpdate industryOpen={industryOpen} handleModal={handleSetIndustry} />
<CategorizeUpdate
visible={industryOpen}
handleModal={handleSetIndustry}
values={{ industry: [{ name: '', value: '' }] }}
apiSource={getDictIndustry}
modalFormProps={{
categorizeFormProps: {
label: (
<FormattedMessage id="model_index.create.form.industry" defaultMessage="行业分类" />
),
name: 'industry',
},
categorizeModelProps: {
title: intl.formatMessage({
id: 'model_index.table.list.setIndustry',
defaultMessage: '新建',
}),
},
}}
/>
</div>
);
};

Loading…
Cancel
Save