feat: 完善选择分类组件

develop2
donghao 11 months ago
parent dccd69ba04
commit 128663d284

Binary file not shown.

@ -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-05-28 10:51:37 * @LastEditTime: 2024-07-25 11:46:29
* @FilePath: \general-ai-manage\src\components\CategorizeUpdate\index.tsx * @FilePath: \general-ai-manage\src\components\CategorizeUpdate\index.tsx
* @Description: * @Description:
* @ * @
@ -23,6 +23,7 @@ type CategorizeUpdateProps = {
values: Record<string, any>; values: Record<string, any>;
beforeCloseRequest: (arg1: any, arg2: () => void) => void; beforeCloseRequest: (arg1: any, arg2: () => void) => void;
beforeAddRequest: (arg1: any, arg2: () => void) => void; beforeAddRequest: (arg1: any, arg2: () => void) => void;
beforeEditRequest: (arg1: any, arg2: () => void) => void;
apiRequest: () => any; apiRequest: () => any;
handleModal: (arg1: any) => void; handleModal: (arg1: any) => void;
modalFormProps: Record<string, any>; // {categorizeFormProps , categorizeModelProps} modalFormProps: Record<string, any>; // {categorizeFormProps , categorizeModelProps}
@ -93,6 +94,7 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
const handleInputConfirm = () => { const handleInputConfirm = () => {
if (inputValue && inputValue.trim() && !tags.includes(inputValue)) { if (inputValue && inputValue.trim() && !tags.includes(inputValue)) {
// 有值填充
props.beforeAddRequest(inputValue, (resp) => { props.beforeAddRequest(inputValue, (resp) => {
console.log(resp, 'beforeAddRequest_resp'); console.log(resp, 'beforeAddRequest_resp');
// 接口调用成功,同步添加 // 接口调用成功,同步添加
@ -118,10 +120,15 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
const handleEditInputConfirm = () => { const handleEditInputConfirm = () => {
const newTags = [...tags]; const newTags = [...tags];
newTags[editInputIndex] = editInputValue; console.log(editInputIndex, 'handleEditInputConfirm_resp');
setTags(newTags); props.beforeEditRequest({ ...fullData[editInputIndex], editInputValue }, (resp) => {
setEditInputIndex(-1); console.log(resp, 'beforeEditRequest_resp');
setEditInputValue(''); // 接口调用成功,同步删除
newTags[editInputIndex] = editInputValue;
setTags(newTags);
setEditInputIndex(-1);
setEditInputValue('');
});
}; };
const tagPlusStyle: React.CSSProperties = { const tagPlusStyle: React.CSSProperties = {
@ -172,13 +179,14 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
const tagElem = ( const tagElem = (
<Tag <Tag
key={tag} key={tag}
closable={true} closable={fullData[index]?.used !== '1'}
style={{ userSelect: 'none' }} style={{ userSelect: 'none' }}
onClose={() => handleClose(tag, index)} onClose={() => handleClose(tag, index)}
> >
<span <span
onDoubleClick={(e) => { onDoubleClick={(e) => {
if (index !== 0) { if (fullData[index]?.used !== '1') {
// 不可操作项,需要禁用
setEditInputIndex(index); setEditInputIndex(index);
setEditInputValue(tag); setEditInputValue(tag);
e.preventDefault(); e.preventDefault();

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd * @Author: donghao donghao@supervision.ltd
* @Date: 2024-03-27 16:03:20 * @Date: 2024-03-27 16:03:20
* @LastEditors: donghao donghao@supervision.ltd * @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-07-16 10:51:55 * @LastEditTime: 2024-07-24 14:14:45
* @FilePath: \general-ai-manage\src\components\Header\index.tsx * @FilePath: \general-ai-manage\src\components\Header\index.tsx
* @Description: layout * @Description: layout
*/ */
@ -159,7 +159,7 @@ const MenuBar: React.FC<MenuBarProps> = ({ menuData, changeMenu }) => {
</Menu> */} </Menu> */}
</div> </div>
<div <div
className="flex items-center justify-center footer_back mb-[24px]" className="flex items-center justify-center footer_back mb-[24px] cursor-pointer"
onClick={() => { onClick={() => {
history.replace('/'); history.replace('/');
}} }}

@ -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-06-19 11:42:02 * @LastEditTime: 2024-07-25 10:58:41
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\deviceList.tsx * @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\deviceList.tsx
* @Description: deviceGroupdg * @Description: deviceGroupdg
* @ * @
@ -18,6 +18,7 @@ import {
apiDeviceClassification, apiDeviceClassification,
apiDeviceClassificationAdd, apiDeviceClassificationAdd,
apiDeviceClassificationDelete, apiDeviceClassificationDelete,
apiDeviceClassificationEdit,
} from '@/services/business/device'; } from '@/services/business/device';
import { import {
apiEntityNodesDeviceDelete, apiEntityNodesDeviceDelete,
@ -370,6 +371,15 @@ const DeviceList: React.FC<DeviceListProps> = (props) => {
message.error(resp.meta.message); message.error(resp.meta.message);
} }
}} }}
beforeEditRequest={async (params, successRes) => {
let resp = await apiDeviceClassificationEdit({
id: params.id,
name: params.editInputValue,
});
if (isSuccessApi(resp)) {
successRes(resp);
}
}}
modalFormProps={{ modalFormProps={{
categorizeFormProps: { categorizeFormProps: {
label: ( label: (

@ -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-06-25 14:31:24 * @LastEditTime: 2024-07-25 10:47:10
* @FilePath: \general-ai-manage\src\pages\ModelIndex\ModelIndex.tsx * @FilePath: \general-ai-manage\src\pages\ModelIndex\ModelIndex.tsx
* @Description: * @Description:
* @ * @
@ -19,6 +19,7 @@ import IsDelete from '@/components/TableActionCard/isDelete';
import { import {
apiModelClassificationAdd, apiModelClassificationAdd,
apiModelClassificationDelete, apiModelClassificationDelete,
apiModelClassificationEdit,
apiModelClassificationList, apiModelClassificationList,
apiModelDelete, apiModelDelete,
apiModelInfo, apiModelInfo,
@ -397,6 +398,15 @@ const ModelIndex: React.FC = () => {
successRes(resp); successRes(resp);
} }
}} }}
beforeEditRequest={async (params, successRes) => {
let resp = await apiModelClassificationEdit({
id: params.id,
name: params.editInputValue,
});
if (isSuccessApi(resp)) {
successRes(resp);
}
}}
modalFormProps={{ modalFormProps={{
categorizeFormProps: { categorizeFormProps: {
label: ( label: (

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd * @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-24 17:57:19 * @Date: 2024-05-24 17:57:19
* @LastEditors: donghao donghao@supervision.ltd * @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-06-18 13:50:25 * @LastEditTime: 2024-07-25 10:58:53
* @FilePath: \general-ai-platform-web\src\services\business\device.ts * @FilePath: \general-ai-platform-web\src\services\business\device.ts
* @Description: * @Description:
*/ */
@ -26,6 +26,21 @@ export async function apiDeviceClassificationAdd(body: any, options?: { [key: st
}, },
); );
} }
// 编辑设备分类
export async function apiDeviceClassificationEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/device/classification/edit`,
{
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 }) { export async function apiDeviceClassification(body: any, options?: { [key: string]: any }) {

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd * @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-24 17:57:19 * @Date: 2024-05-24 17:57:19
* @LastEditors: donghao donghao@supervision.ltd * @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-07-18 11:13:02 * @LastEditTime: 2024-07-25 10:46:36
* @FilePath: \general-ai-platform-web\src\services\business\model.ts * @FilePath: \general-ai-platform-web\src\services\business\model.ts
* @Description: api * @Description: api
*/ */
@ -122,6 +122,22 @@ export async function apiModelClassificationAdd(body: any, options?: { [key: str
}, },
); );
} }
// 编辑模型分类
export async function apiModelClassificationEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/classification/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型分类列表 // 模型分类列表
export async function apiModelClassificationList(body: any, options?: { [key: string]: any }) { export async function apiModelClassificationList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>( return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(

Loading…
Cancel
Save