diff --git a/dist.zip b/dist.zip deleted file mode 100644 index c4410eb..0000000 Binary files a/dist.zip and /dev/null differ diff --git a/src/components/CategorizeUpdate/index.tsx b/src/components/CategorizeUpdate/index.tsx index 172e55b..2f9197c 100644 --- a/src/components/CategorizeUpdate/index.tsx +++ b/src/components/CategorizeUpdate/index.tsx @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-07 14:02:00 * @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 * @Description: 分类更新弹窗 * @交互说明 @@ -23,6 +23,7 @@ type CategorizeUpdateProps = { values: Record; beforeCloseRequest: (arg1: any, arg2: () => void) => void; beforeAddRequest: (arg1: any, arg2: () => void) => void; + beforeEditRequest: (arg1: any, arg2: () => void) => void; apiRequest: () => any; handleModal: (arg1: any) => void; modalFormProps: Record; // {categorizeFormProps , categorizeModelProps} @@ -93,6 +94,7 @@ const CategorizeUpdate: React.FC = (props) => { const handleInputConfirm = () => { if (inputValue && inputValue.trim() && !tags.includes(inputValue)) { + // 有值填充 props.beforeAddRequest(inputValue, (resp) => { console.log(resp, 'beforeAddRequest_resp'); // 接口调用成功,同步添加 @@ -118,10 +120,15 @@ const CategorizeUpdate: React.FC = (props) => { const handleEditInputConfirm = () => { const newTags = [...tags]; - newTags[editInputIndex] = editInputValue; - setTags(newTags); - setEditInputIndex(-1); - setEditInputValue(''); + console.log(editInputIndex, 'handleEditInputConfirm_resp'); + props.beforeEditRequest({ ...fullData[editInputIndex], editInputValue }, (resp) => { + console.log(resp, 'beforeEditRequest_resp'); + // 接口调用成功,同步删除 + newTags[editInputIndex] = editInputValue; + setTags(newTags); + setEditInputIndex(-1); + setEditInputValue(''); + }); }; const tagPlusStyle: React.CSSProperties = { @@ -172,13 +179,14 @@ const CategorizeUpdate: React.FC = (props) => { const tagElem = ( handleClose(tag, index)} > { - if (index !== 0) { + if (fullData[index]?.used !== '1') { + // 不可操作项,需要禁用 setEditInputIndex(index); setEditInputValue(tag); e.preventDefault(); diff --git a/src/components/MenuBar/index.tsx b/src/components/MenuBar/index.tsx index fed06f7..406288f 100644 --- a/src/components/MenuBar/index.tsx +++ b/src/components/MenuBar/index.tsx @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-03-27 16:03:20 * @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 * @Description: 内层layout菜单配置 */ @@ -159,7 +159,7 @@ const MenuBar: React.FC = ({ menuData, changeMenu }) => { */}
{ history.replace('/'); }} diff --git a/src/pages/Business/DeviceGroup/components/deviceList.tsx b/src/pages/Business/DeviceGroup/components/deviceList.tsx index 9beee73..57b929e 100644 --- a/src/pages/Business/DeviceGroup/components/deviceList.tsx +++ b/src/pages/Business/DeviceGroup/components/deviceList.tsx @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-22 15:23:36 * @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 * @Description: 设备节点设置 关键词 deviceGroup(dg) * @交互说明 @@ -18,6 +18,7 @@ import { apiDeviceClassification, apiDeviceClassificationAdd, apiDeviceClassificationDelete, + apiDeviceClassificationEdit, } from '@/services/business/device'; import { apiEntityNodesDeviceDelete, @@ -370,6 +371,15 @@ const DeviceList: React.FC = (props) => { 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={{ categorizeFormProps: { label: ( diff --git a/src/pages/Model/ModelIndex/index.tsx b/src/pages/Model/ModelIndex/index.tsx index 183f63f..330f5d3 100644 --- a/src/pages/Model/ModelIndex/index.tsx +++ b/src/pages/Model/ModelIndex/index.tsx @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-07 14:02:00 * @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 * @Description: 模型列表首页 * @交互说明 @@ -19,6 +19,7 @@ import IsDelete from '@/components/TableActionCard/isDelete'; import { apiModelClassificationAdd, apiModelClassificationDelete, + apiModelClassificationEdit, apiModelClassificationList, apiModelDelete, apiModelInfo, @@ -397,6 +398,15 @@ const ModelIndex: React.FC = () => { successRes(resp); } }} + beforeEditRequest={async (params, successRes) => { + let resp = await apiModelClassificationEdit({ + id: params.id, + name: params.editInputValue, + }); + if (isSuccessApi(resp)) { + successRes(resp); + } + }} modalFormProps={{ categorizeFormProps: { label: ( diff --git a/src/services/business/device.ts b/src/services/business/device.ts index c296868..6c74d1f 100644 --- a/src/services/business/device.ts +++ b/src/services/business/device.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-05-24 17:57:19 * @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 * @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/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 }) { diff --git a/src/services/business/model.ts b/src/services/business/model.ts index 19434d7..298e1e4 100644 --- a/src/services/business/model.ts +++ b/src/services/business/model.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-05-24 17:57:19 * @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 * @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/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 }) { return request(