feat: 完善选择分类组件

develop2
donghao 11 months ago
parent dccd69ba04
commit 128663d284

Binary file not shown.

@ -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<string, any>;
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<string, any>; // {categorizeFormProps , categorizeModelProps}
@ -93,6 +94,7 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (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<CategorizeUpdateProps> = (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<CategorizeUpdateProps> = (props) => {
const tagElem = (
<Tag
key={tag}
closable={true}
closable={fullData[index]?.used !== '1'}
style={{ userSelect: 'none' }}
onClose={() => handleClose(tag, index)}
>
<span
onDoubleClick={(e) => {
if (index !== 0) {
if (fullData[index]?.used !== '1') {
// 不可操作项,需要禁用
setEditInputIndex(index);
setEditInputValue(tag);
e.preventDefault();

@ -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<MenuBarProps> = ({ menuData, changeMenu }) => {
</Menu> */}
</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={() => {
history.replace('/');
}}

@ -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: deviceGroupdg
* @
@ -18,6 +18,7 @@ import {
apiDeviceClassification,
apiDeviceClassificationAdd,
apiDeviceClassificationDelete,
apiDeviceClassificationEdit,
} from '@/services/business/device';
import {
apiEntityNodesDeviceDelete,
@ -370,6 +371,15 @@ const DeviceList: React.FC<DeviceListProps> = (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: (

@ -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: (

@ -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.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 }) {

@ -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.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 }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(

Loading…
Cancel
Save