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. 135
      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. 135
      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: () => {

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

@ -1,65 +1,72 @@
<template> <template>
<div class="currenButton clearfix"> <div class="currenButton clearfix">
<el-button <el-button
v-for="(item, index) in Butttondata" :key="index" v-for="(item, index) in Butttondata" :key="index"
v-show="typeof item.hide == 'function' ? !item.hide() : !item.hide" v-show="typeof item.hide == 'function' ? !item.hide() : !item.hide"
:type="item.type" :type="item.type"
:icon="item.icon" :icon="item.icon"
:plain="item.plain" :plain="item.plain"
:round="item.round" :round="item.round"
:circle="item.circle" :circle="item.circle"
:size="item.size" :size="item.size"
:style="{ :style="{
float:item.float, float:item.float,
background:item.background, background:item.background,
borderColor:item.background, borderColor:item.background,
}" }"
:class="item.class" :class="item.class"
@click="tableButtonClick(item.name,item)" @click="tableButtonClick(item.name,item)"
>{{ item.label }}</el-button> v-permission="isRoutePermission ? [$route.name+'.'+item.name] : item.permission"
</div> >{{ item.label }}</el-button>
</template> </div>
<script> </template>
import permission from "@/directive/permission/index" <script>
export default { import permission from "@/directive/permission/index"
directives: { permission }, export default {
props: { directives: { permission },
Butttondata: { props: {
type: Array, Butttondata: {
default: () => { type: Array,
return [] default: () => {
} return []
}, }
}, },
mounted(){ //
window.addEventListener('setItemEvent', (item) => { isRoutePermission:{
if (item.key.indexOf('tableColumns') > -1) { type: Boolean,
this.initButtonType(item) default: false,
} },
}) },
}, mounted(){
methods:{ console.log(36,this.$route,this.$store.getters)
initButtonType(changeItem){ window.addEventListener('setItemEvent', (item) => {
let _num = 0 if (item.key.indexOf('tableColumns') > -1) {
let _new = JSON.parse(changeItem.newValue) this.initButtonType(item)
_new.forEach((item) => { }
if(item.istrue)_num ++ })
}) },
this.Butttondata.forEach(item=>{ methods:{
// type initButtonType(changeItem){
if(item.name == 'field'){ let _num = 0
return item.type = (_num >= _new.length) ? '' : 'warning'; let _new = JSON.parse(changeItem.newValue)
} _new.forEach((item) => {
}) if(item.istrue)_num ++
}, })
tableButtonClick (val,item) { this.Butttondata.forEach(item=>{
this.$emit('tableButtonClick', val,item) // type
} if(item.name == 'field'){
} return item.type = (_num >= _new.length) ? '' : 'warning';
} }
</script> })
<style lang="scss" scoped> },
.el-button{ tableButtonClick (val,item) {
margin-left: 10px; this.$emit('tableButtonClick', val,item)
} }
</style> }
}
</script>
<style lang="scss" scoped>
.el-button{
margin-left: 10px;
}
</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: () => {

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

@ -1,65 +1,72 @@
<template> <template>
<div class="currenButton clearfix"> <div class="currenButton clearfix">
<el-button <el-button
v-for="(item, index) in Butttondata" :key="index" v-for="(item, index) in Butttondata" :key="index"
v-show="typeof item.hide == 'function' ? !item.hide() : !item.hide" v-show="typeof item.hide == 'function' ? !item.hide() : !item.hide"
:type="item.type" :type="item.type"
:icon="item.icon" :icon="item.icon"
:plain="item.plain" :plain="item.plain"
:round="item.round" :round="item.round"
:circle="item.circle" :circle="item.circle"
:size="item.size" :size="item.size"
:style="{ :style="{
float:item.float, float:item.float,
background:item.background, background:item.background,
borderColor:item.background, borderColor:item.background,
}" }"
:class="item.class" :class="item.class"
@click="tableButtonClick(item.name,item)" @click="tableButtonClick(item.name,item)"
>{{ item.label }}</el-button> v-permission="isRoutePermission ? [$route.name+'.'+item.name] : item.permission"
</div> >{{ item.label }}</el-button>
</template> </div>
<script> </template>
import permission from "@/directive/permission/index" <script>
export default { import permission from "@/directive/permission/index"
directives: { permission }, export default {
props: { directives: { permission },
Butttondata: { props: {
type: Array, Butttondata: {
default: () => { type: Array,
return [] default: () => {
} return []
}, }
}, },
mounted(){ //
window.addEventListener('setItemEvent', (item) => { isRoutePermission:{
if (item.key.indexOf('tableColumns') > -1) { type: Boolean,
this.initButtonType(item) default: false,
} },
}) },
}, mounted(){
methods:{ console.log(36,this.$route,this.$store.getters)
initButtonType(changeItem){ window.addEventListener('setItemEvent', (item) => {
let _num = 0 if (item.key.indexOf('tableColumns') > -1) {
let _new = JSON.parse(changeItem.newValue) this.initButtonType(item)
_new.forEach((item) => { }
if(item.istrue)_num ++ })
}) },
this.Butttondata.forEach(item=>{ methods:{
// type initButtonType(changeItem){
if(item.name == 'field'){ let _num = 0
return item.type = (_num >= _new.length) ? '' : 'warning'; let _new = JSON.parse(changeItem.newValue)
} _new.forEach((item) => {
}) if(item.istrue)_num ++
}, })
tableButtonClick (val,item) { this.Butttondata.forEach(item=>{
this.$emit('tableButtonClick', val,item) // type
} if(item.name == 'field'){
} return item.type = (_num >= _new.length) ? '' : 'warning';
} }
</script> })
<style lang="scss" scoped> },
.el-button{ tableButtonClick (val,item) {
margin-left: 10px; this.$emit('tableButtonClick', val,item)
} }
</style> }
}
</script>
<style lang="scss" scoped>
.el-button{
margin-left: 10px;
}
</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