diff --git a/src/components/action_button/index.vue b/src/components/action_button/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..378a5684fe8522877aea8dde7826a5fc978f17b1 --- /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 b6a78af96eebdb3515ecaff5e86dcdcd99759353..3092465fbf0df4936c8f1efb12d775eea7da446c 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 32f9da4aa9a47df624be227769665c1daa848e0c..153304221344fb7fe0d872b87cd1b02f9aab2521 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 e123280f8464e1d55907065b7975a30e90ade3e5..f7a269a082983c598a0c00e1402d2739cc5e07f5 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 3c011c7b21b132b14e3b4b1ade232382889b2a72..e00d6ebe6ee89a396935011a77e84aca2e4b5563 100644 --- a/src/pages/system/view/role/RoleManagement.vue +++ b/src/pages/system/view/role/RoleManagement.vue @@ -1,5 +1,5 @@