Browse Source

v-permission准备暂存

noToken
安虹睿 1 year ago
parent
commit
bfa6fe1356
  1. 9
      PC/InterFace.Dash/src/components/currenButton/index.vue
  2. 7
      PC/InterFace.Dash/src/components/currenButton/innerButton.vue
  3. 6
      PC/InterFace.Dash/src/components/tablePagination/index.vue
  4. 10
      PC/InterFace.Dash/src/store/modules/user.js
  5. 1
      PC/InterFace.Dash/src/utils/defaultButtons.js
  6. 9
      PC/UI.WinIn.FasterZ.Job/src/components/currenButton/index.vue
  7. 27
      PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue
  8. 6
      PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue
  9. 10
      PC/UI.WinIn.FasterZ.Job/src/store/modules/user.js
  10. 1
      PC/UI.WinIn.FasterZ.Job/src/utils/defaultButtons.js
  11. 9
      PC/UI.WinIn.FasterZ.Store/src/components/currenButton/index.vue
  12. 27
      PC/UI.WinIn.FasterZ.Store/src/components/currenButton/innerButton.vue
  13. 6
      PC/UI.WinIn.FasterZ.Store/src/components/tablePagination/index.vue
  14. 10
      PC/UI.WinIn.FasterZ.Store/src/store/modules/user.js
  15. 3
      PC/UI.WinIn.FasterZ.Store/src/utils/defaultButtons.js

9
PC/InterFace.Dash/src/components/currenButton/index.vue

@ -2,7 +2,7 @@
<div class="tableNavBtnsContent"> <div class="tableNavBtnsContent">
<div class="tableNavLeftBtns"> <div class="tableNavLeftBtns">
<!-- 左侧按钮 --> <!-- 左侧按钮 -->
<innerButton :Butttondata="buttonsLeft" @tableButtonClick="tableButtonClick"></innerButton> <innerButton :isRoutePermission="isRoutePermission" :Butttondata="buttonsLeft" @tableButtonClick="tableButtonClick"></innerButton>
</div> </div>
<div class="tableNavRightBtns"> <div class="tableNavRightBtns">
<!-- 快速搜索 --> <!-- 快速搜索 -->
@ -14,7 +14,7 @@
@searchNormalClear="quicklySearchClear" @searchNormalClear="quicklySearchClear"
></searchNormal> ></searchNormal>
<!-- 右侧按钮 --> <!-- 右侧按钮 -->
<innerButton :Butttondata="buttonsRight" @tableButtonClick="tableButtonClick"></innerButton> <innerButton :isRoutePermission="isRoutePermission" :Butttondata="buttonsRight" @tableButtonClick="tableButtonClick"></innerButton>
</div> </div>
<slot></slot> <slot></slot>
</div> </div>
@ -30,6 +30,11 @@ export default {
searchNormal searchNormal
}, },
props: { props: {
//
isRoutePermission:{
type: Boolean,
default: false,
},
Butttondata: { Butttondata: {
type: Array, type: Array,
default: () => { default: () => {

7
PC/InterFace.Dash/src/components/currenButton/innerButton.vue

@ -16,6 +16,7 @@
}" }"
:class="item.class" :class="item.class"
@click="tableButtonClick(item.name,item)" @click="tableButtonClick(item.name,item)"
v-permission="isRoutePermission ? [$route.name+'.'+item.name] : item.permission"
>{{ item.label }}</el-button> >{{ item.label }}</el-button>
</div> </div>
</template> </template>
@ -30,8 +31,14 @@ export default {
return [] return []
} }
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
}, },
mounted(){ mounted(){
console.log(36,this.$route,this.$store.getters)
window.addEventListener('setItemEvent', (item) => { window.addEventListener('setItemEvent', (item) => {
if (item.key.indexOf('tableColumns') > -1) { if (item.key.indexOf('tableColumns') > -1) {
this.initButtonType(item) this.initButtonType(item)

6
PC/InterFace.Dash/src/components/tablePagination/index.vue

@ -3,6 +3,7 @@
<!-- 头部按钮 --> <!-- 头部按钮 -->
<div class="table-nav"> <div class="table-nav">
<curren-Button <curren-Button
:isRoutePermission="isRoutePermission"
ref="tablePagination_topNav" ref="tablePagination_topNav"
:Butttondata="currenButtonData" :Butttondata="currenButtonData"
@tableButtonClick="topbutton" @tableButtonClick="topbutton"
@ -116,6 +117,11 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
// //
quicklySearchOption:{ quicklySearchOption:{
type: Object, type: Object,

10
PC/InterFace.Dash/src/store/modules/user.js

@ -27,9 +27,14 @@ const mutations = {
SET_INTRODUCTION: (state, introduction) => { SET_INTRODUCTION: (state, introduction) => {
state.introduction = introduction state.introduction = introduction
}, },
// 设置权限(v-permissin) // 设置权限(v-permission)
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles let _roles = [
'IncomingData',
'IncomingData.filter',
'IncomingData.export',
]
state.roles = _roles
}, },
SET_USERINFO: (state, data) => { SET_USERINFO: (state, data) => {
state.userInfo = data state.userInfo = data
@ -129,6 +134,7 @@ const actions = {
getUsersByUserName(username).then(res=>{ getUsersByUserName(username).then(res=>{
if(res && JSON.stringify(res).length > 0){ if(res && JSON.stringify(res).length > 0){
localStorage.setItem('isLoginName',username) localStorage.setItem('isLoginName',username)
// commit('SET_ROLES', res)
commit('SET_USERINFO', res) commit('SET_USERINFO', res)
resolve(res) resolve(res)
}else{ }else{

1
PC/InterFace.Dash/src/utils/defaultButtons.js

@ -122,5 +122,6 @@ function __defaultBtnOption(option,specific){
class:option && option.class ? option.class : specific.class, class:option && option.class ? option.class : specific.class,
isDetailExport:option && option.isDetailExport ? option.isDetailExport : false, isDetailExport:option && option.isDetailExport ? option.isDetailExport : false,
isRedundance:option && option.isRedundance ? option.isRedundance : false, isRedundance:option && option.isRedundance ? option.isRedundance : false,
permission:option && option.permission ? option.permission : null,
} }
} }

9
PC/UI.WinIn.FasterZ.Job/src/components/currenButton/index.vue

@ -2,7 +2,7 @@
<div class="tableNavBtnsContent"> <div class="tableNavBtnsContent">
<div class="tableNavLeftBtns"> <div class="tableNavLeftBtns">
<!-- 左侧按钮 --> <!-- 左侧按钮 -->
<innerButton :Butttondata="buttonsLeft" @tableButtonClick="tableButtonClick"></innerButton> <innerButton :isRoutePermission="isRoutePermission" :Butttondata="buttonsLeft" @tableButtonClick="tableButtonClick"></innerButton>
</div> </div>
<div class="tableNavRightBtns"> <div class="tableNavRightBtns">
<!-- 快速搜索 --> <!-- 快速搜索 -->
@ -14,7 +14,7 @@
@searchNormalClear="quicklySearchClear" @searchNormalClear="quicklySearchClear"
></searchNormal> ></searchNormal>
<!-- 右侧按钮 --> <!-- 右侧按钮 -->
<innerButton :Butttondata="buttonsRight" @tableButtonClick="tableButtonClick"></innerButton> <innerButton :isRoutePermission="isRoutePermission" :Butttondata="buttonsRight" @tableButtonClick="tableButtonClick"></innerButton>
</div> </div>
<slot></slot> <slot></slot>
</div> </div>
@ -30,6 +30,11 @@ export default {
searchNormal searchNormal
}, },
props: { props: {
//
isRoutePermission:{
type: Boolean,
default: false,
},
Butttondata: { Butttondata: {
type: Array, type: Array,
default: () => { default: () => {

27
PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue

@ -16,12 +16,13 @@
}" }"
:class="item.class" :class="item.class"
@click="tableButtonClick(item.name,item)" @click="tableButtonClick(item.name,item)"
v-permission="isRoutePermission ? [$route.name+'.'+item.name] : item.permission"
>{{ item.label }}</el-button> >{{ item.label }}</el-button>
</div> </div>
</template> </template>
<script> <script>
import permission from "@/directive/permission/index" import permission from "@/directive/permission/index"
export default { export default {
directives: { permission }, directives: { permission },
props: { props: {
Butttondata: { Butttondata: {
@ -30,8 +31,14 @@ export default {
return [] return []
} }
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
}, },
mounted(){ mounted(){
console.log(36,this.$route,this.$store.getters)
window.addEventListener('setItemEvent', (item) => { window.addEventListener('setItemEvent', (item) => {
if (item.key.indexOf('tableColumns') > -1) { if (item.key.indexOf('tableColumns') > -1) {
this.initButtonType(item) this.initButtonType(item)
@ -56,10 +63,10 @@ export default {
this.$emit('tableButtonClick', val,item) this.$emit('tableButtonClick', val,item)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.el-button{ .el-button{
margin-left: 10px; margin-left: 10px;
} }
</style> </style>

6
PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue

@ -3,6 +3,7 @@
<!-- 头部按钮 --> <!-- 头部按钮 -->
<div class="table-nav"> <div class="table-nav">
<curren-Button <curren-Button
:isRoutePermission="isRoutePermission"
ref="tablePagination_topNav" ref="tablePagination_topNav"
:Butttondata="currenButtonData" :Butttondata="currenButtonData"
@tableButtonClick="topbutton" @tableButtonClick="topbutton"
@ -116,6 +117,11 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
// //
quicklySearchOption:{ quicklySearchOption:{
type: Object, type: Object,

10
PC/UI.WinIn.FasterZ.Job/src/store/modules/user.js

@ -27,9 +27,14 @@ const mutations = {
SET_INTRODUCTION: (state, introduction) => { SET_INTRODUCTION: (state, introduction) => {
state.introduction = introduction state.introduction = introduction
}, },
// 设置权限(v-permissin) // 设置权限(v-permission)
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles let _roles = [
'IncomingData',
'IncomingData.filter',
'IncomingData.export',
]
state.roles = _roles
}, },
SET_USERINFO: (state, data) => { SET_USERINFO: (state, data) => {
state.userInfo = data state.userInfo = data
@ -129,6 +134,7 @@ const actions = {
getUsersByUserName(username).then(res=>{ getUsersByUserName(username).then(res=>{
if(res && JSON.stringify(res).length > 0){ if(res && JSON.stringify(res).length > 0){
localStorage.setItem('isLoginName',username) localStorage.setItem('isLoginName',username)
// commit('SET_ROLES', res)
commit('SET_USERINFO', res) commit('SET_USERINFO', res)
resolve(res) resolve(res)
}else{ }else{

1
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, class:option && option.class ? option.class : specific.class,
isDetailExport:option && option.isDetailExport ? option.isDetailExport : false, isDetailExport:option && option.isDetailExport ? option.isDetailExport : false,
isRedundance:option && option.isRedundance ? option.isRedundance : false, isRedundance:option && option.isRedundance ? option.isRedundance : false,
permission:option && option.permission ? option.permission : null,
} }
} }

9
PC/UI.WinIn.FasterZ.Store/src/components/currenButton/index.vue

@ -2,7 +2,7 @@
<div class="tableNavBtnsContent"> <div class="tableNavBtnsContent">
<div class="tableNavLeftBtns"> <div class="tableNavLeftBtns">
<!-- 左侧按钮 --> <!-- 左侧按钮 -->
<innerButton :Butttondata="buttonsLeft" @tableButtonClick="tableButtonClick"></innerButton> <innerButton :isRoutePermission="isRoutePermission" :Butttondata="buttonsLeft" @tableButtonClick="tableButtonClick"></innerButton>
</div> </div>
<div class="tableNavRightBtns"> <div class="tableNavRightBtns">
<!-- 快速搜索 --> <!-- 快速搜索 -->
@ -14,7 +14,7 @@
@searchNormalClear="quicklySearchClear" @searchNormalClear="quicklySearchClear"
></searchNormal> ></searchNormal>
<!-- 右侧按钮 --> <!-- 右侧按钮 -->
<innerButton :Butttondata="buttonsRight" @tableButtonClick="tableButtonClick"></innerButton> <innerButton :isRoutePermission="isRoutePermission" :Butttondata="buttonsRight" @tableButtonClick="tableButtonClick"></innerButton>
</div> </div>
<slot></slot> <slot></slot>
</div> </div>
@ -30,6 +30,11 @@ export default {
searchNormal searchNormal
}, },
props: { props: {
//
isRoutePermission:{
type: Boolean,
default: false,
},
Butttondata: { Butttondata: {
type: Array, type: Array,
default: () => { default: () => {

27
PC/UI.WinIn.FasterZ.Store/src/components/currenButton/innerButton.vue

@ -16,12 +16,13 @@
}" }"
:class="item.class" :class="item.class"
@click="tableButtonClick(item.name,item)" @click="tableButtonClick(item.name,item)"
v-permission="isRoutePermission ? [$route.name+'.'+item.name] : item.permission"
>{{ item.label }}</el-button> >{{ item.label }}</el-button>
</div> </div>
</template> </template>
<script> <script>
import permission from "@/directive/permission/index" import permission from "@/directive/permission/index"
export default { export default {
directives: { permission }, directives: { permission },
props: { props: {
Butttondata: { Butttondata: {
@ -30,8 +31,14 @@ export default {
return [] return []
} }
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
}, },
mounted(){ mounted(){
console.log(36,this.$route,this.$store.getters)
window.addEventListener('setItemEvent', (item) => { window.addEventListener('setItemEvent', (item) => {
if (item.key.indexOf('tableColumns') > -1) { if (item.key.indexOf('tableColumns') > -1) {
this.initButtonType(item) this.initButtonType(item)
@ -56,10 +63,10 @@ export default {
this.$emit('tableButtonClick', val,item) this.$emit('tableButtonClick', val,item)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.el-button{ .el-button{
margin-left: 10px; margin-left: 10px;
} }
</style> </style>

6
PC/UI.WinIn.FasterZ.Store/src/components/tablePagination/index.vue

@ -3,6 +3,7 @@
<!-- 头部按钮 --> <!-- 头部按钮 -->
<div class="table-nav"> <div class="table-nav">
<curren-Button <curren-Button
:isRoutePermission="isRoutePermission"
ref="tablePagination_topNav" ref="tablePagination_topNav"
:Butttondata="currenButtonData" :Butttondata="currenButtonData"
@tableButtonClick="topbutton" @tableButtonClick="topbutton"
@ -116,6 +117,11 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
// //
quicklySearchOption:{ quicklySearchOption:{
type: Object, type: Object,

10
PC/UI.WinIn.FasterZ.Store/src/store/modules/user.js

@ -27,9 +27,14 @@ const mutations = {
SET_INTRODUCTION: (state, introduction) => { SET_INTRODUCTION: (state, introduction) => {
state.introduction = introduction state.introduction = introduction
}, },
// 设置权限(v-permissin) // 设置权限(v-permission)
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles let _roles = [
'IncomingData',
'IncomingData.filter',
'IncomingData.export',
]
state.roles = _roles
}, },
SET_USERINFO: (state, data) => { SET_USERINFO: (state, data) => {
state.userInfo = data state.userInfo = data
@ -129,6 +134,7 @@ const actions = {
getUsersByUserName(username).then(res=>{ getUsersByUserName(username).then(res=>{
if(res && JSON.stringify(res).length > 0){ if(res && JSON.stringify(res).length > 0){
localStorage.setItem('isLoginName',username) localStorage.setItem('isLoginName',username)
// commit('SET_ROLES', res)
commit('SET_USERINFO', res) commit('SET_USERINFO', res)
resolve(res) resolve(res)
}else{ }else{

3
PC/UI.WinIn.FasterZ.Store/src/utils/defaultButtons.js

@ -103,7 +103,7 @@ export function defaultFilterForDetailBtn(option) {
label: i18n.t('btns.DetailedQuery'), label: i18n.t('btns.DetailedQuery'),
name: "filterForDetail", name: "filterForDetail",
size: "mini", size: "mini",
float: 'left' float: 'left',
}) })
} }
@ -122,5 +122,6 @@ function __defaultBtnOption(option,specific){
class:option && option.class ? option.class : specific.class, class:option && option.class ? option.class : specific.class,
isDetailExport:option && option.isDetailExport ? option.isDetailExport : false, isDetailExport:option && option.isDetailExport ? option.isDetailExport : false,
isRedundance:option && option.isRedundance ? option.isRedundance : false, isRedundance:option && option.isRedundance ? option.isRedundance : false,
permission:option && option.permission ? option.permission : null,
} }
} }
Loading…
Cancel
Save