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

7
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 }}</el-button>
</div>
</template>
@ -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)

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

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

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

@ -27,9 +27,14 @@ const mutations = {
SET_INTRODUCTION: (state, introduction) => {
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{

1
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,
}
}

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

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

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

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

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

@ -27,9 +27,14 @@ const mutations = {
SET_INTRODUCTION: (state, introduction) => {
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{

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

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

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

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

@ -27,9 +27,14 @@ const mutations = {
SET_INTRODUCTION: (state, introduction) => {
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{

3
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,
}
}
Loading…
Cancel
Save