From 37c4e654ee77a4a87bd18c6194033bd4cddd9e35 Mon Sep 17 00:00:00 2001 From: xiongqian <2167232911@qq.com> Date: Sat, 28 Jan 2023 21:56:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device/category.ts | 25 ++ src/components/AIcon/index.tsx | 3 +- src/router/menu.ts | 6 + .../Category/components/modifyModal/index.vue | 203 ++++++++++++++++ src/views/device/Category/index.vue | 221 ++++++++++++++++++ src/views/device/Category/typings.d.ts | 10 + src/views/init-home/index.vue | 11 +- 7 files changed, 474 insertions(+), 5 deletions(-) create mode 100644 src/api/device/category.ts create mode 100644 src/views/device/Category/components/modifyModal/index.vue create mode 100644 src/views/device/Category/index.vue create mode 100644 src/views/device/Category/typings.d.ts diff --git a/src/api/device/category.ts b/src/api/device/category.ts new file mode 100644 index 00000000..d18e3587 --- /dev/null +++ b/src/api/device/category.ts @@ -0,0 +1,25 @@ +// 产品分类 +import server from '@/utils/request' +import { CategoryItem } from '@/views/device/Category/typings' +/** + * 查询产品分类树形数据 + */ + +export const queryTree = (params?: Record) => server.post('/device/category/_tree', params) + +/** + * 保存树形数据 + */ + export const saveTree = (data: any) =>server.post('/device/category', data) + + + /** + * 根据Id修改 + */ + export const updateTree = (data: any, id:string) => server.put(`/device/category/${id}`, data) + + /** + * 根据Id删除数据 + */ + + export const deleteTree = (id:string) => server.remove(`/device/category/${id}`) \ No newline at end of file diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx index 02e6d8a2..a3b1554e 100644 --- a/src/components/AIcon/index.tsx +++ b/src/components/AIcon/index.tsx @@ -26,7 +26,8 @@ const iconKeys = [ 'ExportOutlined', 'SyncOutlined', 'ExclamationCircleOutlined', - 'UploadOutlined' + 'UploadOutlined', + 'PlusCircleOutlined' ] const Icon = (props: {type: string}) => { diff --git a/src/router/menu.ts b/src/router/menu.ts index 27d4f961..ac9429e6 100644 --- a/src/router/menu.ts +++ b/src/router/menu.ts @@ -128,4 +128,10 @@ export default [ path: '/northbound/AliCloud', component: () => import('@/views/northbound/AliCloud/index.vue') }, + + // 产品分类 + { + path: '/iot/device/Category', + component: () => import('@/views/device/Category/index.vue') + } ] \ No newline at end of file diff --git a/src/views/device/Category/components/modifyModal/index.vue b/src/views/device/Category/components/modifyModal/index.vue new file mode 100644 index 00000000..ea420fa9 --- /dev/null +++ b/src/views/device/Category/components/modifyModal/index.vue @@ -0,0 +1,203 @@ + + + + diff --git a/src/views/device/Category/index.vue b/src/views/device/Category/index.vue new file mode 100644 index 00000000..f97ba614 --- /dev/null +++ b/src/views/device/Category/index.vue @@ -0,0 +1,221 @@ + + + + diff --git a/src/views/device/Category/typings.d.ts b/src/views/device/Category/typings.d.ts new file mode 100644 index 00000000..36656078 --- /dev/null +++ b/src/views/device/Category/typings.d.ts @@ -0,0 +1,10 @@ +export type CategoryItem = { + id: string; + name: string; + level: number; + key: string; + parentId: string; + path: string; + sortIndex: number; + children?: Category[]; +}; diff --git a/src/views/init-home/index.vue b/src/views/init-home/index.vue index e0dc84b5..20585ac9 100644 --- a/src/views/init-home/index.vue +++ b/src/views/init-home/index.vue @@ -117,7 +117,7 @@