From 6d91b70263822a96f1acd95f39223a09cc38c17f Mon Sep 17 00:00:00 2001 From: wangzeyan <258785420@qq.com> Date: Mon, 21 Oct 2024 21:52:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(=E6=96=B0=E5=A2=9E=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=88=97=E8=A1=A8):=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86mock.js=E3=80=82=E9=80=9A=E8=BF=87=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E6=9D=A5=E6=8E=A7=E5=88=B6=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=90=AF=E7=94=A8roleVO=E6=A0=B9=E6=8D=AEboot=E6=9A=82?= =?UTF-8?q?=E6=97=B6=E5=AE=9A=E4=B9=89=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env/.env.development | 2 + package.json | 3 +- src/pages.json | 9 +- src/pages/role/index.vue | 187 ++++++++++++++++++++++++++++++++++++ src/service/role/RoleApi.ts | 53 ++++++++++ 5 files changed, 252 insertions(+), 2 deletions(-) create mode 100644 src/pages/role/index.vue create mode 100644 src/service/role/RoleApi.ts diff --git a/env/.env.development b/env/.env.development index 04fa2739..58ff52ea 100644 --- a/env/.env.development +++ b/env/.env.development @@ -4,3 +4,5 @@ NODE_ENV = 'development' VITE_DELETE_CONSOLE = false # 是否开启sourcemap VITE_SHOW_SOURCEMAP = true +# 是否开启mock数据 +VITE_USE_MOCK = true diff --git a/package.json b/package.json index 095645cd..a96b088f 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,8 @@ "qs": "6.5.3", "vue": "3.4.21", "wot-design-uni": "^1.3.10", - "z-paging": "^2.7.10" + "z-paging": "^2.7.10", + "mockjs": "^1.1.0" }, "devDependencies": { "@commitlint/cli": "^18.6.1", diff --git a/src/pages.json b/src/pages.json index a55fb466..0044f3f8 100644 --- a/src/pages.json +++ b/src/pages.json @@ -134,7 +134,14 @@ "style": { "navigationBarTitleText": "用户信息" } + }, + { + "path": "pages/role/index", + "type": "page", + "style": { + "navigationBarTitleText": "角色管理" + } } ], "subPackages": [] -} \ No newline at end of file +} diff --git a/src/pages/role/index.vue b/src/pages/role/index.vue new file mode 100644 index 00000000..7cd90a0c --- /dev/null +++ b/src/pages/role/index.vue @@ -0,0 +1,187 @@ + + + + + diff --git a/src/service/role/RoleApi.ts b/src/service/role/RoleApi.ts new file mode 100644 index 00000000..e36e0cde --- /dev/null +++ b/src/service/role/RoleApi.ts @@ -0,0 +1,53 @@ +import { httpGet, httpPost } from '@/utils/http' +import Mock from 'mockjs' +export interface RoleVO { + id: number + name: string + code: string + sort: number + data_scope: string + data_scope_dept_ids: string + status: number + type: number + remark: string + createTime: string +} +const useMock = import.meta.env.VITE_USE_MOCK === 'true' +export const getList = (query: object) => { + if (useMock) { + return new Promise((resolve) => { + const data = Mock.mock({ + 'data|10': [ + { + 'id|+1': 1, + name: '@name', + code: '@word', + 'sort|1-100': 1, + data_scope: '@word', + data_scope_dept_ids: '@word', + 'status|1-2': 1, + 'type|1-2': '@word', + remark: '@sentence', + createTime: '@datetime' + } + ] + }) + resolve({ data: data.data }) + }) + } else { + return httpGet('/system/role/page', query) + } +} +export const getInfo = (id: number): Promise => { + return httpGet('/system/role/get?id=' + id) +} + +export const createRole = (data: object) => { + return httpPost('/system/role/create', data) +} +export const updateRole = (data: object) => { + return httpPost('/system/role/update', data) +} +export const deleteRole = (id: number) => { + return httpPost('/system/role/delete' + { id }) +} -- Gitee From 33816efcf4fd557c52c8880844db06e34811fba1 Mon Sep 17 00:00:00 2001 From: wangzeyan <258785420@qq.com> Date: Mon, 21 Oct 2024 21:57:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(=E4=BF=AE=E6=94=B9=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=9C=AA=E5=9C=A8src/pages/work/index.vue?= =?UTF-8?q?=E4=B8=AD=E5=AE=9A=E4=B9=89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/work/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/work/index.vue b/src/pages/work/index.vue index 9ec4f989..ac664e6c 100644 --- a/src/pages/work/index.vue +++ b/src/pages/work/index.vue @@ -25,7 +25,7 @@ 系统管理 - + -- Gitee