From 09240bbbfa20cc7d86a971a05a32bb264c01356e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B4=E8=90=BD=28YangLei=29?= Date: Mon, 28 Jun 2021 14:39:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=BB=E5=8A=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/action_button/index.vue | 55 +++++++++++++++++++ src/components/table/index.vue | 28 ++++++++-- src/pages/frame/store/accountModule.js | 16 ++---- src/pages/system/view/menu/MenuManagement.vue | 1 - src/pages/system/view/role/RoleManagement.vue | 4 +- src/pages/system/view/task/index.vue | 13 +++++ src/router/config.js | 5 ++ 7 files changed, 103 insertions(+), 19 deletions(-) create mode 100644 src/components/action_button/index.vue create mode 100644 src/pages/system/view/task/index.vue diff --git a/src/components/action_button/index.vue b/src/components/action_button/index.vue new file mode 100644 index 0000000..378a568 --- /dev/null +++ b/src/components/action_button/index.vue @@ -0,0 +1,55 @@ + + + diff --git a/src/components/table/index.vue b/src/components/table/index.vue index b6a78af..3092465 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -7,7 +7,7 @@
- 重置 + 重置 查询
@@ -39,7 +39,7 @@ :closable="false" :drawerStyle="drawerStyle" :bodyStyle="bodyStyle" - :width="addBtn.width" + :width="addBtn.width || 600" destroyOnClose >
@@ -73,9 +73,15 @@ export default { noPage: Boolean, }, data() { + this.initQuery = { + pageNum: 1, + pageSize: 10, + }; return { data: [], - queryForm: {}, + queryForm: { + ...this.initQuery, + }, loading: false, addVisible: false, submitLoading: false, @@ -106,14 +112,24 @@ export default { async getData() { this.loading = true; try { - const res = await request(this.url, METHOD.GET); - if (this.formatData) this.data = this.formatData(res); - else this.data = res; + this.noPage ? await this.getDataNoPage() : await this.getDataWithPage(); } catch (error) { // todo } this.loading = false; }, + async getDataNoPage() { + const res = await request(this.url, METHOD.GET); + if (this.formatData) this.data = this.formatData(res); + else this.data = res; + }, + + async getDataWithPage() { + const res = await request(this.url, METHOD.GET, this.queryForm); + if (this.formatData) this.data = this.formatData(res); + else this.data = res.records; + }, + add() { this.addVisible = true; }, diff --git a/src/pages/frame/store/accountModule.js b/src/pages/frame/store/accountModule.js index 32f9da4..1533042 100644 --- a/src/pages/frame/store/accountModule.js +++ b/src/pages/frame/store/accountModule.js @@ -8,7 +8,7 @@ export default { }, //大量共享的方法 getters: { - user: (state) => { + user: state => { if (!state.user) { try { const user = localStorage.getItem(process.env.VUE_APP_USER_KEY); @@ -19,31 +19,27 @@ export default { } return state.user; }, - permissions: (state) => { + permissions: state => { if (!state.permissions) { try { - const permissions = localStorage.getItem(process.env.VUE_APP_PERMISSIONS_KEY); - state.permissions = JSON.parse(permissions); - state.permissions = state.permissions ? state.permissions : []; + state.permissions = []; } catch (e) { console.error(e.message); } } return state.permissions; }, - roles: (state) => { + roles: state => { if (!state.roles) { try { - const roles = localStorage.getItem(process.env.VUE_APP_ROLES_KEY); - state.roles = JSON.parse(roles); - state.roles = state.roles ? state.roles : []; + state.roles = []; } catch (e) { console.error(e.message); } } return state.roles; }, - routesConfig: (state) => { + routesConfig: state => { if (!state.routesConfig) { try { const routesConfig = localStorage.getItem(process.env.VUE_APP_ROUTES_KEY); diff --git a/src/pages/system/view/menu/MenuManagement.vue b/src/pages/system/view/menu/MenuManagement.vue index e123280..f7a269a 100644 --- a/src/pages/system/view/menu/MenuManagement.vue +++ b/src/pages/system/view/menu/MenuManagement.vue @@ -37,7 +37,6 @@ export default { addBtn: { text: '新建', title: '菜单配置', - width: 400, onOk() { return vm.$refs['addForm']?.submit(); }, diff --git a/src/pages/system/view/role/RoleManagement.vue b/src/pages/system/view/role/RoleManagement.vue index 3c011c7..e00d6eb 100644 --- a/src/pages/system/view/role/RoleManagement.vue +++ b/src/pages/system/view/role/RoleManagement.vue @@ -1,5 +1,5 @@