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 { PlusOutlined } from '@ant-design/icons';
import { ModalForm, ProForm } from '@ant-design/pro-components'; import { ModalForm, ProForm } from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import type { InputRef } from 'antd'; import type { InputRef } from 'antd';
import { Flex, Form, Input, Tag, Tooltip } from 'antd'; import { Flex, Form, Input, Tag, Tooltip } from 'antd';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { proFormSmallModelWidth } from '../../../../../config/defaultForm'; import { proFormSmallModelWidth } from '../../../config/defaultForm';
type IndustryUpdateProps = { type CategorizeUpdateProps = {
industryOpen: boolean; visible: boolean;
handleModal: () => void; values: Record<string, any>;
apiSource: () => any;
handleModal: (arg1: any) => void;
modalFormProps: Record<string, any>; // {categorizeFormProps , categorizeModelProps}
}; };
const tagInputStyle: React.CSSProperties = { const tagInputStyle: React.CSSProperties = {
@ -19,8 +33,7 @@ const tagInputStyle: React.CSSProperties = {
}; };
// TODO 整体样式需要按UI图调整 交互在确认时要把tags赋值给form // TODO 整体样式需要按UI图调整 交互在确认时要把tags赋值给form
const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => { const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
const intl = useIntl();
const [form] = Form.useForm<Record<string, any>>(); const [form] = Form.useForm<Record<string, any>>();
const [tags, setTags] = useState<string[]>([]); const [tags, setTags] = useState<string[]>([]);
const [inputVisible, setInputVisible] = useState(false); const [inputVisible, setInputVisible] = useState(false);
@ -31,7 +44,7 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
const editInputRef = useRef<InputRef>(null); const editInputRef = useRef<InputRef>(null);
async function loadData() { async function loadData() {
const { data } = await getDictIndustry(); const { data } = await props.apiSource();
const finalList = []; const finalList = [];
data?.results?.forEach((v: Record<string, any>) => { data?.results?.forEach((v: Record<string, any>) => {
finalList.push(v.name); finalList.push(v.name);
@ -50,10 +63,10 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
}, [editInputValue]); }, [editInputValue]);
useEffect(() => { useEffect(() => {
if (props.industryOpen) { if (props.visible) {
loadData(); loadData();
} }
}, [props.industryOpen]); }, [props.visible]);
const handleClose = (removedTag: string) => { const handleClose = (removedTag: string) => {
const newTags = tags.filter((tag) => tag !== removedTag); const newTags = tags.filter((tag) => tag !== removedTag);
@ -99,39 +112,24 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
return ( return (
<ModalForm<Record<string, any>> <ModalForm<Record<string, any>>
className="gn_form mi_industry_update" className="gn_form"
width={proFormSmallModelWidth} width={proFormSmallModelWidth}
title={intl.formatMessage({ {...props?.modalFormProps?.categorizeModelProps}
id: 'model_index.table.list.setIndustry', open={props.visible}
defaultMessage: '新建',
})}
open={props.industryOpen}
form={form} form={form}
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
onCancel: () => props.handleModal(), onCancel: () => props.handleModal(),
}} }}
initialValues={{ industry: [{ name: '', value: '' }] }} initialValues={props.values}
submitTimeout={2000} submitTimeout={2000}
onFinish={async (values) => { onFinish={async (values) => {
console.log(values, 'add_finish_values'); console.log(values, 'add_finish_values');
// TODO 对接新增接口 props.handleModal(form.getFieldsValue());
// postModelCategoryCreateModelCategory(values)
// .then(() => {
// message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
// props.reload();
// })
// .catch(() => {
// message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
// });
props.handleModal();
return true; return true;
}} }}
> >
<ProForm.Item <ProForm.Item {...props?.modalFormProps?.categorizeFormProps}>
label={<FormattedMessage id="model_index.create.form.industry" defaultMessage="行业分类" />}
name="industry"
>
<Flex gap="8px 0" wrap="wrap"> <Flex gap="8px 0" wrap="wrap">
{tags.map<React.ReactNode>((tag, index) => { {tags.map<React.ReactNode>((tag, index) => {
if (editInputIndex === index) { if (editInputIndex === index) {
@ -190,7 +188,7 @@ const IndustryUpdate: React.FC<IndustryUpdateProps> = (props) => {
/> />
) : ( ) : (
<Tag style={tagPlusStyle} icon={<PlusOutlined />} onClick={showInput}> <Tag style={tagPlusStyle} icon={<PlusOutlined />} onClick={showInput}>
New Tag
</Tag> </Tag>
)} )}
</Flex> </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 * @Author: zhoux zhouxia@supervision.ltd
* @Date: 2023-11-01 13:56:33 * @Date: 2023-11-01 13:56:33
* @LastEditors: donghao donghao@supervision.ltd * @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 * @FilePath: \general-ai-platform-web\src\locales\zh-CN\device.ts
* @Description: * @Description:
*/ */
@ -20,7 +20,6 @@ export const device_group: { [key: string]: string } = {
'device_group.tree_node.remark': '简介', 'device_group.tree_node.remark': '简介',
'device_group.tree_node.createForm.add': '新建节点', 'device_group.tree_node.createForm.add': '新建节点',
// 未启用 // 未启用
'device_group.table.list.id': 'ID', 'device_group.table.list.id': 'ID',
'device_group.table.list.name': '分组名称', 'device_group.table.list.name': '分组名称',
'device_group.table.list.code': '分组代码', 'device_group.table.list.code': '分组代码',
@ -47,13 +46,20 @@ export const device_group: { [key: string]: string } = {
export const device_group_list: { [key: string]: string } = { export const device_group_list: { [key: string]: string } = {
'device_group_list.table.list.name': '设备名称', '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.isEnable': '模型部署',
'device_group_list.table.list.deployed.isEnable': '已部署', 'device_group_list.table.list.deployed.isEnable': '已部署',
'device_group_list.table.list.undeployed.isEnable': '未部署', 'device_group_list.table.list.undeployed.isEnable': '未部署',
'device_group_list.table.list.action.setModel': '基础模型配置', 'device_group_list.table.list.action.setModel': '基础模型配置',
'device_group_list.table.list.action.new': '新建设备', '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': '设备代码', '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.spec': '设备规格',
'device_group_list.table.list.categoryFkId': '设备类别', 'device_group_list.table.list.categoryFkId': '设备类别',
'device_group_list.table.list.groupFkId': '设备分组', 'device_group_list.table.list.groupFkId': '设备分组',
'device_group_list.table.list.remark': '备注',
'device_group_list.table.list.createTime': '创建时间', 'device_group_list.table.list.createTime': '创建时间',
'device_group_list.table.list.updateTime': '更新时间', 'device_group_list.table.list.updateTime': '更新时间',
'device_group_list.table.rule.required.name': '设备名称为必填项', 'device_group_list.table.rule.required.name': '设备名称为必填项',
'device_group_list.table.rule.required.code': '设备代码为必填项', 'device_group_list.table.rule.required.code': '设备代码为必填项',
'device_group_list.table.list.add': '新建设备',
'device_group_list.table.list.update': '更新设备', 'device_group_list.table.list.update': '更新设备',
}; };
export const device_category: { [key: string]: string } = { 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 { getDictDeviceType } from '@/services/testApi/dict';
import { ModalForm, ProForm, ProFormText, ProFormTextArea } from '@ant-design/pro-components'; import {
ModalForm,
ProForm,
ProFormSelect,
ProFormText,
ProFormTextArea,
} from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max'; import { FormattedMessage, useIntl } from '@umijs/max';
import { Form } from 'antd'; import { Form } from 'antd';
import React from 'react'; import React from 'react';
@ -24,7 +30,7 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
className="gn_modal_form gn_form" className="gn_modal_form gn_form"
width={proFormSmallModelWidth} width={proFormSmallModelWidth}
title={intl.formatMessage({ title={intl.formatMessage({
id: 'device_group.tree_node.CreateDeviceForm.add', id: 'device_group_list.table.list.add',
defaultMessage: '新建', defaultMessage: '新建',
})} })}
open={props.createModalOpen} open={props.createModalOpen}
@ -54,12 +60,14 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
<ProFormText <ProFormText
width={proFormSmallItemStyleProps.column2Width} width={proFormSmallItemStyleProps.column2Width}
name="name" name="name"
label={<FormattedMessage id="device_group.tree_node.name" defaultMessage="名称" />} label={
<FormattedMessage id="device_group_list.table.list.name" defaultMessage="设备名称" />
}
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
})}${intl.formatMessage({ })}${intl.formatMessage({
id: 'device_group.tree_node.name', id: 'device_group_list.table.list.name',
defaultMessage: '$$$', defaultMessage: '$$$',
})}`} })}`}
required={true} required={true}
@ -68,7 +76,7 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
required: true, required: true,
message: ( message: (
<FormattedMessage <FormattedMessage
id="device_group.tree_node.rule.required.name" id="device_group_list.table.list.rule.required.name"
defaultMessage="名称必填" defaultMessage="名称必填"
/> />
), ),
@ -77,94 +85,94 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
/> />
<ProFormText <ProFormText
width={proFormSmallItemStyleProps.column2Width} width={proFormSmallItemStyleProps.column2Width}
name="fatherName" name="deviceSite"
label={ label={
<FormattedMessage id="device_group.tree_node.fatherName" defaultMessage="上级节点" /> <FormattedMessage
id="device_group_list.table.list.deviceSite"
defaultMessage="设备位置"
/>
} }
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
})}${intl.formatMessage({ })}${intl.formatMessage({
id: 'device_group.tree_node.fatherName', id: 'device_group_list.table.list.deviceSite',
defaultMessage: '$$$',
})}`}
disabled
/>
<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',
defaultMessage: '$$$', 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: '$$$',
})}`}
/>
<ProFormText
width={proFormSmallItemStyleProps.column2Width} width={proFormSmallItemStyleProps.column2Width}
name="lat" name="deviceType"
label={<FormattedMessage id="device_group.tree_node.lat" defaultMessage="纬度" />} label={
<FormattedMessage
id="device_group_list.table.list.deviceType"
defaultMessage="设备分类"
/>
}
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_select',
defaultMessage: '$$$', defaultMessage: '$$$',
})}${intl.formatMessage({ })}${intl.formatMessage({
id: 'device_group.tree_node.lat', id: 'device_group_list.table.list.deviceType',
defaultMessage: '$$$', 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 <ProFormText
width={proFormSmallItemStyleProps.column2Width} width={proFormSmallItemStyleProps.column2Width}
name="managerName" name="deviceModel"
label={ label={
<FormattedMessage id="device_group.tree_node.managerName" defaultMessage="负责人" /> <FormattedMessage
id="device_group_list.table.list.deviceModel"
defaultMessage="设备型号"
/>
} }
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
})}${intl.formatMessage({ })}${intl.formatMessage({
id: 'device_group.tree_node.managerName', id: 'device_group_list.table.list.deviceModel',
defaultMessage: '$$$', defaultMessage: '$$$',
})}`} })}`}
/> />
<ProFormText <ProFormText
width={proFormSmallItemStyleProps.column2Width} width={proFormSmallItemStyleProps.width}
name="managerPhone" name="deviceParams"
label={ label={
<FormattedMessage id="device_group.tree_node.managerPhone" defaultMessage="联系方式" /> <FormattedMessage
id="device_group_list.table.list.deviceParams"
defaultMessage="设备参数"
/>
} }
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
})}${intl.formatMessage({ })}${intl.formatMessage({
id: 'device_group.tree_node.managerPhone', id: 'device_group_list.table.list.deviceParams',
defaultMessage: '$$$', defaultMessage: '$$$',
})}`} })}`}
/> />
<ProFormTextArea <ProFormTextArea
width={proFormSmallItemStyleProps.width} width={proFormSmallItemStyleProps.width}
name="remark" name="remark"
label={<FormattedMessage id="device_group.tree_node.remark" defaultMessage="简介" />} label={
<FormattedMessage id="device_group_list.table.list.remark" defaultMessage="备注" />
}
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
})}${intl.formatMessage({ })}${intl.formatMessage({
id: 'device_group.tree_node.remark', id: 'device_group_list.table.list.remark',
defaultMessage: '$$$', 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 TableActionCard from '@/components/TableActionCard';
import { getDeviceListByGroup } from '@/services/testApi/device'; import { getDeviceListByGroup } from '@/services/testApi/device';
import { ProTable } from '@ant-design/pro-components'; 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 { Button } from 'antd';
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
import { proTablePaginationOptions } from '../../../../../config/defaultTable'; import { proTablePaginationOptions } from '../../../../../config/defaultTable';
import CategorizeUpdate from '@/components/CategorizeUpdate';
import IsDelete from '@/components/TableActionCard/isDelete'; import IsDelete from '@/components/TableActionCard/isDelete';
import CreateDeviceForm from './createDeviceForm'; import CreateDeviceForm from './createDeviceForm';
@ -16,14 +31,21 @@ type DeviceListProps = {
const DeviceList: React.FC<DeviceListProps> = () => { const DeviceList: React.FC<DeviceListProps> = () => {
const access = useAccess(); const access = useAccess();
// const intl = useIntl(); // eslint-disable-next-line react-hooks/rules-of-hooks
const intl = useIntl();
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const [createModalOpen, setCreateModalOpen] = useState<boolean>(false); const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
// const [categoryFkIdIds, setCategoryFkIdIds] = useState([]); // const [categoryFkIdIds, setCategoryFkIdIds] = useState([]);
// 动态设置每页数量 // 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState<number>(10); const [currentPageSize, setCurrentPageSize] = useState<number>(10);
// 设置分类
const [deviceTypeOpen, setDeviceTypeOpen] = useState<boolean>(false);
// 设置行业分类
const handleSetDeviceType = () => {
setDeviceTypeOpen(!deviceTypeOpen);
};
/**新增 编辑 删除 */ /**新增 编辑 删除 */
// 新增 // 新增
const handleCreateModal = () => { const handleCreateModal = () => {
@ -180,13 +202,13 @@ const DeviceList: React.FC<DeviceListProps> = () => {
/> />
</Button> </Button>
<Button <Button
key="modelType" key="deviceType"
onClick={() => { onClick={() => {
setCreateModalOpen(true); handleSetDeviceType();
}} }}
> >
<FormattedMessage <FormattedMessage
id="device_group_list.table.list.action.modelType" id="device_group_list.table.list.action.deviceType"
defaultMessage="设备分类" defaultMessage="设备分类"
/> />
</Button> </Button>
@ -239,6 +261,29 @@ const DeviceList: React.FC<DeviceListProps> = () => {
handleModal={handleCreateModal} handleModal={handleCreateModal}
reload={reloadList} 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> </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 * @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-22 15:23:36 * @Date: 2024-04-22 15:23:36
* @LastEditors: donghao donghao@supervision.ltd * @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 * @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\index.tsx
* @Description: deviceGroupdg * @Description: deviceGroupdg
* @ * @
@ -18,9 +18,11 @@ import { getDeviceGroupList } from '@/services/testApi/deviceGroup';
import { ProCard } from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
import { Button, Tabs } from 'antd'; import { Button, Tabs } from 'antd';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import AlarmSetForm from './components/alarmSetForm';
import BaseInfo from './components/baseInfo'; import BaseInfo from './components/baseInfo';
import CreateForm from './components/createForm'; import CreateForm from './components/createForm';
import DeviceList from './components/deviceList'; import DeviceList from './components/deviceList';
import ModelSetting from './components/modelSetting';
import './index.less'; import './index.less';
@ -117,6 +119,26 @@ const DeviceGroup: React.FC = () => {
}} }}
></Tabs> ></Tabs>
{tabKey === '1' && <DeviceList info={nodeInfo}></DeviceList>} {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> </div>
</ProCard> </ProCard>
</div> </div>

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd * @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00 * @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd * @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 * @FilePath: \general-ai-manage\src\pages\ModelIndex\ModelIndex.tsx
* @Description: * @Description:
* @ * @
@ -13,29 +13,32 @@
* *
*/ */
import { CommButton } from '@/components/Button'; import { CommButton } from '@/components/Button';
import { getDictIndustry } from '@/services/testApi/dict';
import { ReactComponent as ResetIcon } from '/public/home/reset_icon.svg'; import { ReactComponent as ResetIcon } from '/public/home/reset_icon.svg';
import { ReactComponent as SearchIcon } from '/public/home/search_icon.svg'; import { ReactComponent as SearchIcon } from '/public/home/search_icon.svg';
import CategorizeUpdate from '@/components/CategorizeUpdate';
import TableActionCard from '@/components/TableActionCard'; import TableActionCard from '@/components/TableActionCard';
import IsDelete from '@/components/TableActionCard/isDelete'; import IsDelete from '@/components/TableActionCard/isDelete';
import { getModelList } from '@/services/testApi/model'; import { getModelList } from '@/services/testApi/model';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components'; import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProCard, ProForm, ProFormText, ProTable } 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 { Button } from 'antd';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { proTableCommonOptions, proTablePaginationOptions } from '../../../../config/defaultTable'; import { proTableCommonOptions, proTablePaginationOptions } from '../../../../config/defaultTable';
import CreateForm from './components/createForm'; import CreateForm from './components/createForm';
import IndustryUpdate from './components/industryUpdate';
import './index.less'; import './index.less';
const ModelIndex: React.FC = () => { const ModelIndex: React.FC = () => {
const access = useAccess(); const access = useAccess();
// const intl = useIntl(); // eslint-disable-next-line react-hooks/rules-of-hooks
const intl = useIntl();
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const [querysData, setQuerysData] = useState<Record<string, any>>({}); // 列表查询参数 const [querysData, setQuerysData] = useState<Record<string, any>>({}); // 列表查询参数
const [createModalOpen, setCreateModalOpen] = useState<boolean>(false); const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
// 设置分类
const [industryOpen, setIndustryOpen] = useState<boolean>(false); const [industryOpen, setIndustryOpen] = useState<boolean>(false);
// const [categoryFkIdIds, setCategoryFkIdIds] = useState([]); // const [categoryFkIdIds, setCategoryFkIdIds] = useState([]);
@ -54,11 +57,7 @@ const ModelIndex: React.FC = () => {
}; };
// 设置行业分类 // 设置行业分类
const handleSetIndustry = () => { const handleSetIndustry = () => {
if (industryOpen) { setIndustryOpen(!industryOpen);
setIndustryOpen(false);
} else {
setIndustryOpen(true);
}
}; };
/** /**
* @en-US The pop-up window of the distribution update window * @en-US The pop-up window of the distribution update window
@ -327,7 +326,26 @@ const ModelIndex: React.FC = () => {
handleModal={handleCreateModal} handleModal={handleCreateModal}
reload={reloadList} 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> </div>
); );
}; };

Loading…
Cancel
Save