From bfa6fe1356f6941e895cb71fb63e90bad64a6d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Thu, 24 Aug 2023 17:27:39 +0800 Subject: [PATCH] =?UTF-8?q?v-permission=E5=87=86=E5=A4=87=E6=9A=82?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/currenButton/index.vue | 9 +- .../components/currenButton/innerButton.vue | 7 + .../src/components/tablePagination/index.vue | 6 + PC/InterFace.Dash/src/store/modules/user.js | 10 +- PC/InterFace.Dash/src/utils/defaultButtons.js | 1 + .../src/components/currenButton/index.vue | 9 +- .../components/currenButton/innerButton.vue | 135 +++++++++--------- .../src/components/tablePagination/index.vue | 6 + .../src/store/modules/user.js | 10 +- .../src/utils/defaultButtons.js | 1 + .../src/components/currenButton/index.vue | 9 +- .../components/currenButton/innerButton.vue | 135 +++++++++--------- .../src/components/tablePagination/index.vue | 6 + .../src/store/modules/user.js | 10 +- .../src/utils/defaultButtons.js | 3 +- 15 files changed, 216 insertions(+), 141 deletions(-) diff --git a/PC/InterFace.Dash/src/components/currenButton/index.vue b/PC/InterFace.Dash/src/components/currenButton/index.vue index 40e53c9..7ef7dd2 100644 --- a/PC/InterFace.Dash/src/components/currenButton/index.vue +++ b/PC/InterFace.Dash/src/components/currenButton/index.vue @@ -2,7 +2,7 @@
- +
@@ -14,7 +14,7 @@ @searchNormalClear="quicklySearchClear" > - +
@@ -30,6 +30,11 @@ export default { searchNormal }, props: { + // 是否按路由配置按钮权限 + isRoutePermission:{ + type: Boolean, + default: false, + }, Butttondata: { type: Array, default: () => { diff --git a/PC/InterFace.Dash/src/components/currenButton/innerButton.vue b/PC/InterFace.Dash/src/components/currenButton/innerButton.vue index 9dab791..38f5bb8 100644 --- a/PC/InterFace.Dash/src/components/currenButton/innerButton.vue +++ b/PC/InterFace.Dash/src/components/currenButton/innerButton.vue @@ -16,6 +16,7 @@ }" :class="item.class" @click="tableButtonClick(item.name,item)" + v-permission="isRoutePermission ? [$route.name+'.'+item.name] : item.permission" >{{ item.label }} @@ -30,8 +31,14 @@ export default { return [] } }, + // 是否按路由配置按钮权限 + isRoutePermission:{ + type: Boolean, + default: false, + }, }, mounted(){ + console.log(36,this.$route,this.$store.getters) window.addEventListener('setItemEvent', (item) => { if (item.key.indexOf('tableColumns') > -1) { this.initButtonType(item) diff --git a/PC/InterFace.Dash/src/components/tablePagination/index.vue b/PC/InterFace.Dash/src/components/tablePagination/index.vue index da65c71..3fb8e82 100644 --- a/PC/InterFace.Dash/src/components/tablePagination/index.vue +++ b/PC/InterFace.Dash/src/components/tablePagination/index.vue @@ -3,6 +3,7 @@
{ state.introduction = introduction }, - // 设置权限(v-permissin) + // 设置权限(v-permission) SET_ROLES: (state, roles) => { - state.roles = roles + let _roles = [ + 'IncomingData', + 'IncomingData.filter', + 'IncomingData.export', + ] + state.roles = _roles }, SET_USERINFO: (state, data) => { state.userInfo = data @@ -129,6 +134,7 @@ const actions = { getUsersByUserName(username).then(res=>{ if(res && JSON.stringify(res).length > 0){ localStorage.setItem('isLoginName',username) + // commit('SET_ROLES', res) commit('SET_USERINFO', res) resolve(res) }else{ diff --git a/PC/InterFace.Dash/src/utils/defaultButtons.js b/PC/InterFace.Dash/src/utils/defaultButtons.js index dc9a1fc..bbe5032 100644 --- a/PC/InterFace.Dash/src/utils/defaultButtons.js +++ b/PC/InterFace.Dash/src/utils/defaultButtons.js @@ -122,5 +122,6 @@ function __defaultBtnOption(option,specific){ class:option && option.class ? option.class : specific.class, isDetailExport:option && option.isDetailExport ? option.isDetailExport : false, isRedundance:option && option.isRedundance ? option.isRedundance : false, + permission:option && option.permission ? option.permission : null, } } \ No newline at end of file diff --git a/PC/UI.WinIn.FasterZ.Job/src/components/currenButton/index.vue b/PC/UI.WinIn.FasterZ.Job/src/components/currenButton/index.vue index 40e53c9..7ef7dd2 100644 --- a/PC/UI.WinIn.FasterZ.Job/src/components/currenButton/index.vue +++ b/PC/UI.WinIn.FasterZ.Job/src/components/currenButton/index.vue @@ -2,7 +2,7 @@
- +
@@ -14,7 +14,7 @@ @searchNormalClear="quicklySearchClear" > - +
@@ -30,6 +30,11 @@ export default { searchNormal }, props: { + // 是否按路由配置按钮权限 + isRoutePermission:{ + type: Boolean, + default: false, + }, Butttondata: { type: Array, default: () => { diff --git a/PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue b/PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue index 9dab791..020a183 100644 --- a/PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue +++ b/PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue @@ -1,65 +1,72 @@ - - \ No newline at end of file +
+ {{ item.label }} +
+ + + \ No newline at end of file diff --git a/PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue b/PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue index da65c71..3fb8e82 100644 --- a/PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue +++ b/PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue @@ -3,6 +3,7 @@
{ state.introduction = introduction }, - // 设置权限(v-permissin) + // 设置权限(v-permission) SET_ROLES: (state, roles) => { - state.roles = roles + let _roles = [ + 'IncomingData', + 'IncomingData.filter', + 'IncomingData.export', + ] + state.roles = _roles }, SET_USERINFO: (state, data) => { state.userInfo = data @@ -129,6 +134,7 @@ const actions = { getUsersByUserName(username).then(res=>{ if(res && JSON.stringify(res).length > 0){ localStorage.setItem('isLoginName',username) + // commit('SET_ROLES', res) commit('SET_USERINFO', res) resolve(res) }else{ diff --git a/PC/UI.WinIn.FasterZ.Job/src/utils/defaultButtons.js b/PC/UI.WinIn.FasterZ.Job/src/utils/defaultButtons.js index dc9a1fc..bbe5032 100644 --- a/PC/UI.WinIn.FasterZ.Job/src/utils/defaultButtons.js +++ b/PC/UI.WinIn.FasterZ.Job/src/utils/defaultButtons.js @@ -122,5 +122,6 @@ function __defaultBtnOption(option,specific){ class:option && option.class ? option.class : specific.class, isDetailExport:option && option.isDetailExport ? option.isDetailExport : false, isRedundance:option && option.isRedundance ? option.isRedundance : false, + permission:option && option.permission ? option.permission : null, } } \ No newline at end of file diff --git a/PC/UI.WinIn.FasterZ.Store/src/components/currenButton/index.vue b/PC/UI.WinIn.FasterZ.Store/src/components/currenButton/index.vue index 40e53c9..7ef7dd2 100644 --- a/PC/UI.WinIn.FasterZ.Store/src/components/currenButton/index.vue +++ b/PC/UI.WinIn.FasterZ.Store/src/components/currenButton/index.vue @@ -2,7 +2,7 @@
- +
@@ -14,7 +14,7 @@ @searchNormalClear="quicklySearchClear" > - +
@@ -30,6 +30,11 @@ export default { searchNormal }, props: { + // 是否按路由配置按钮权限 + isRoutePermission:{ + type: Boolean, + default: false, + }, Butttondata: { type: Array, default: () => { diff --git a/PC/UI.WinIn.FasterZ.Store/src/components/currenButton/innerButton.vue b/PC/UI.WinIn.FasterZ.Store/src/components/currenButton/innerButton.vue index 9dab791..020a183 100644 --- a/PC/UI.WinIn.FasterZ.Store/src/components/currenButton/innerButton.vue +++ b/PC/UI.WinIn.FasterZ.Store/src/components/currenButton/innerButton.vue @@ -1,65 +1,72 @@ - - \ No newline at end of file +
+ {{ item.label }} +
+ + + \ No newline at end of file diff --git a/PC/UI.WinIn.FasterZ.Store/src/components/tablePagination/index.vue b/PC/UI.WinIn.FasterZ.Store/src/components/tablePagination/index.vue index da65c71..3fb8e82 100644 --- a/PC/UI.WinIn.FasterZ.Store/src/components/tablePagination/index.vue +++ b/PC/UI.WinIn.FasterZ.Store/src/components/tablePagination/index.vue @@ -3,6 +3,7 @@
{ state.introduction = introduction }, - // 设置权限(v-permissin) + // 设置权限(v-permission) SET_ROLES: (state, roles) => { - state.roles = roles + let _roles = [ + 'IncomingData', + 'IncomingData.filter', + 'IncomingData.export', + ] + state.roles = _roles }, SET_USERINFO: (state, data) => { state.userInfo = data @@ -129,6 +134,7 @@ const actions = { getUsersByUserName(username).then(res=>{ if(res && JSON.stringify(res).length > 0){ localStorage.setItem('isLoginName',username) + // commit('SET_ROLES', res) commit('SET_USERINFO', res) resolve(res) }else{ diff --git a/PC/UI.WinIn.FasterZ.Store/src/utils/defaultButtons.js b/PC/UI.WinIn.FasterZ.Store/src/utils/defaultButtons.js index 536fda2..bbe5032 100644 --- a/PC/UI.WinIn.FasterZ.Store/src/utils/defaultButtons.js +++ b/PC/UI.WinIn.FasterZ.Store/src/utils/defaultButtons.js @@ -103,7 +103,7 @@ export function defaultFilterForDetailBtn(option) { label: i18n.t('btns.DetailedQuery'), name: "filterForDetail", size: "mini", - float: 'left' + float: 'left', }) } @@ -122,5 +122,6 @@ function __defaultBtnOption(option,specific){ class:option && option.class ? option.class : specific.class, isDetailExport:option && option.isDetailExport ? option.isDetailExport : false, isRedundance:option && option.isRedundance ? option.isRedundance : false, + permission:option && option.permission ? option.permission : null, } } \ No newline at end of file