Browse Source

权限到按钮模拟

noToken
安虹睿 1 year ago
parent
commit
173c32ead1
  1. 9
      PC/InterFace.Dash/src/components/currenButton/index.vue
  2. 8
      PC/InterFace.Dash/src/components/currenButton/innerButton.vue
  3. 36
      PC/InterFace.Dash/src/components/tablePagination/index.vue
  4. 4
      PC/InterFace.Dash/src/layout/components/Navbar.vue
  5. 5
      PC/InterFace.Dash/src/store/modules/user.js
  6. 9
      PC/UI.WinIn.FasterZ.Job/src/components/currenButton/index.vue
  7. 8
      PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue
  8. 36
      PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue
  9. 5
      PC/UI.WinIn.FasterZ.Job/src/store/modules/user.js
  10. 9
      PC/UI.WinIn.FasterZ.Store/src/components/currenButton/index.vue
  11. 8
      PC/UI.WinIn.FasterZ.Store/src/components/currenButton/innerButton.vue
  12. 36
      PC/UI.WinIn.FasterZ.Store/src/components/tablePagination/index.vue
  13. 5
      PC/UI.WinIn.FasterZ.Store/src/store/modules/user.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 :isRoutePermission="isRoutePermission" :Butttondata="buttonsLeft" @tableButtonClick="tableButtonClick"></innerButton> <innerButton :Butttondata="buttonsLeft" @tableButtonClick="tableButtonClick"></innerButton>
</div> </div>
<div class="tableNavRightBtns"> <div class="tableNavRightBtns">
<!-- 快速搜索 --> <!-- 快速搜索 -->
@ -14,7 +14,7 @@
@searchNormalClear="quicklySearchClear" @searchNormalClear="quicklySearchClear"
></searchNormal> ></searchNormal>
<!-- 右侧按钮 --> <!-- 右侧按钮 -->
<innerButton :isRoutePermission="isRoutePermission" :Butttondata="buttonsRight" @tableButtonClick="tableButtonClick"></innerButton> <innerButton :Butttondata="buttonsRight" @tableButtonClick="tableButtonClick"></innerButton>
</div> </div>
<slot></slot> <slot></slot>
</div> </div>
@ -30,11 +30,6 @@ export default {
searchNormal searchNormal
}, },
props: { props: {
//
isRoutePermission:{
type: Boolean,
default: false,
},
Butttondata: { Butttondata: {
type: Array, type: Array,
default: () => { default: () => {

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

@ -16,8 +16,8 @@
}" }"
: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>
<!-- v-permission="item.permission" -->
</div> </div>
</template> </template>
<script> <script>
@ -31,14 +31,8 @@ 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)

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

@ -3,9 +3,9 @@
<!-- 头部按钮 --> <!-- 头部按钮 -->
<div class="table-nav"> <div class="table-nav">
<curren-Button <curren-Button
:isRoutePermission="isRoutePermission" v-if="headerButttondata"
ref="tablePagination_topNav" ref="tablePagination_topNav"
:Butttondata="currenButtonData" :Butttondata="headerButttondata"
@tableButtonClick="topbutton" @tableButtonClick="topbutton"
@quicklySearchClick="quicklySearchClick" @quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear" @quicklySearchClear="quicklySearchClear"
@ -93,6 +93,13 @@ export default {
rowDrop rowDrop
}, },
props: { props: {
// 使
noUsePermissionBtn:{
type: Array,
default: () => {
return ['refresh','field']
}
},
rowMaxHeight:{ rowMaxHeight:{
type:String, type:String,
default:'calc(90vh - 280px)' default:'calc(90vh - 280px)'
@ -117,11 +124,6 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
// //
quicklySearchOption:{ quicklySearchOption:{
type: Object, type: Object,
@ -234,6 +236,7 @@ export default {
}, },
data () { data () {
return { return {
headerButttondata:null,
// //
rowDropVisible: false, rowDropVisible: false,
// table key // table key
@ -282,6 +285,7 @@ export default {
this.uTableTopHeight = this.appRemoveHeight this.uTableTopHeight = this.appRemoveHeight
this.uTableOuterHeight = this.$refs.tablePaginationTableRef.getTableHeight() this.uTableOuterHeight = this.$refs.tablePaginationTableRef.getTableHeight()
this.uTableOuterHeight_init = Number(JSON.stringify(this.uTableOuterHeight)) this.uTableOuterHeight_init = Number(JSON.stringify(this.uTableOuterHeight))
this.initButttondata()
// //
document.addEventListener('click',(e)=>{ document.addEventListener('click',(e)=>{
@ -296,6 +300,22 @@ export default {
}) })
}, },
methods: { methods: {
initButttondata(){
let _list = []
this.currenButtonData.forEach(item=>{
if(item.permission){
_list.push(item)
}else{
if(this.noUsePermissionBtn.indexOf(item.name) < 0){
item.permission = [this.$route.name+'.'+item.name]
}else{
item.permission = []
}
_list.push(item)
}
})
this.headerButttondata = _list
},
// //
doFreshTableLayout(){ doFreshTableLayout(){
if(this.$refs.tablePaginationTableRef && this.$refs.tablePaginationTableRef.doFreshLayout){ if(this.$refs.tablePaginationTableRef && this.$refs.tablePaginationTableRef.doFreshLayout){
@ -410,7 +430,7 @@ export default {
// //
overallSearchFormClick(options){ overallSearchFormClick(options){
// //
options.vm_quickly = this.$refs.tablePagination_topNav.getQuicklySearchDom() if(this.$refs.tablePagination_topNav)options.vm_quickly = this.$refs.tablePagination_topNav.getQuicklySearchDom()
this.$emit("overallSearchFormClick", options) this.$emit("overallSearchFormClick", options)
}, },
// //

4
PC/InterFace.Dash/src/layout/components/Navbar.vue

@ -16,9 +16,9 @@
<!-- <screenfull id="screenfull" class="right-menu-item hover-effect" /> --> <!-- <screenfull id="screenfull" class="right-menu-item hover-effect" /> -->
<!-- <el-tooltip content="Global Size" effect="dark" placement="bottom"> <el-tooltip content="Global Size" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> --> </el-tooltip>
</template> </template>
<el-dropdown <el-dropdown

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

@ -30,9 +30,10 @@ const mutations = {
// 设置权限(v-permission) // 设置权限(v-permission)
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
let _roles = [ let _roles = [
'IncomingData', 'IncomingDataHistory.filter',
'IncomingData.filter',
'IncomingData.export', 'IncomingData.export',
'MesProductL7PartsNote.filter',
'MesProductL7PartsNote.export'
] ]
state.roles = _roles state.roles = _roles
}, },

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

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

@ -16,8 +16,8 @@
}" }"
: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>
<!-- v-permission="item.permission" -->
</div> </div>
</template> </template>
<script> <script>
@ -31,14 +31,8 @@
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)

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

@ -3,9 +3,9 @@
<!-- 头部按钮 --> <!-- 头部按钮 -->
<div class="table-nav"> <div class="table-nav">
<curren-Button <curren-Button
:isRoutePermission="isRoutePermission" v-if="headerButttondata"
ref="tablePagination_topNav" ref="tablePagination_topNav"
:Butttondata="currenButtonData" :Butttondata="headerButttondata"
@tableButtonClick="topbutton" @tableButtonClick="topbutton"
@quicklySearchClick="quicklySearchClick" @quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear" @quicklySearchClear="quicklySearchClear"
@ -93,6 +93,13 @@ export default {
rowDrop rowDrop
}, },
props: { props: {
// 使
noUsePermissionBtn:{
type: Array,
default: () => {
return ['refresh','field']
}
},
rowMaxHeight:{ rowMaxHeight:{
type:String, type:String,
default:'calc(90vh - 280px)' default:'calc(90vh - 280px)'
@ -117,11 +124,6 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
// //
quicklySearchOption:{ quicklySearchOption:{
type: Object, type: Object,
@ -234,6 +236,7 @@ export default {
}, },
data () { data () {
return { return {
headerButttondata:null,
// //
rowDropVisible: false, rowDropVisible: false,
// table key // table key
@ -282,6 +285,7 @@ export default {
this.uTableTopHeight = this.appRemoveHeight this.uTableTopHeight = this.appRemoveHeight
this.uTableOuterHeight = this.$refs.tablePaginationTableRef.getTableHeight() this.uTableOuterHeight = this.$refs.tablePaginationTableRef.getTableHeight()
this.uTableOuterHeight_init = Number(JSON.stringify(this.uTableOuterHeight)) this.uTableOuterHeight_init = Number(JSON.stringify(this.uTableOuterHeight))
this.initButttondata()
// //
document.addEventListener('click',(e)=>{ document.addEventListener('click',(e)=>{
@ -296,6 +300,22 @@ export default {
}) })
}, },
methods: { methods: {
initButttondata(){
let _list = []
this.currenButtonData.forEach(item=>{
if(item.permission){
_list.push(item)
}else{
if(this.noUsePermissionBtn.indexOf(item.name) < 0){
item.permission = [this.$route.name+'.'+item.name]
}else{
item.permission = []
}
_list.push(item)
}
})
this.headerButttondata = _list
},
// //
doFreshTableLayout(){ doFreshTableLayout(){
if(this.$refs.tablePaginationTableRef && this.$refs.tablePaginationTableRef.doFreshLayout){ if(this.$refs.tablePaginationTableRef && this.$refs.tablePaginationTableRef.doFreshLayout){
@ -410,7 +430,7 @@ export default {
// //
overallSearchFormClick(options){ overallSearchFormClick(options){
// //
options.vm_quickly = this.$refs.tablePagination_topNav.getQuicklySearchDom() if(this.$refs.tablePagination_topNav)options.vm_quickly = this.$refs.tablePagination_topNav.getQuicklySearchDom()
this.$emit("overallSearchFormClick", options) this.$emit("overallSearchFormClick", options)
}, },
// //

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

@ -30,9 +30,10 @@ const mutations = {
// 设置权限(v-permission) // 设置权限(v-permission)
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
let _roles = [ let _roles = [
'IncomingData', 'IncomingDataHistory.filter',
'IncomingData.filter',
'IncomingData.export', 'IncomingData.export',
'MesProductL7PartsNote.filter',
'MesProductL7PartsNote.export'
] ]
state.roles = _roles state.roles = _roles
}, },

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

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

@ -16,8 +16,8 @@
}" }"
: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>
<!-- v-permission="item.permission" -->
</div> </div>
</template> </template>
<script> <script>
@ -31,14 +31,8 @@
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)

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

@ -3,9 +3,9 @@
<!-- 头部按钮 --> <!-- 头部按钮 -->
<div class="table-nav"> <div class="table-nav">
<curren-Button <curren-Button
:isRoutePermission="isRoutePermission" v-if="headerButttondata"
ref="tablePagination_topNav" ref="tablePagination_topNav"
:Butttondata="currenButtonData" :Butttondata="headerButttondata"
@tableButtonClick="topbutton" @tableButtonClick="topbutton"
@quicklySearchClick="quicklySearchClick" @quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear" @quicklySearchClear="quicklySearchClear"
@ -93,6 +93,13 @@ export default {
rowDrop rowDrop
}, },
props: { props: {
// 使
noUsePermissionBtn:{
type: Array,
default: () => {
return ['refresh','field']
}
},
rowMaxHeight:{ rowMaxHeight:{
type:String, type:String,
default:'calc(90vh - 280px)' default:'calc(90vh - 280px)'
@ -117,11 +124,6 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
isRoutePermission:{
type: Boolean,
default: false,
},
// //
quicklySearchOption:{ quicklySearchOption:{
type: Object, type: Object,
@ -234,6 +236,7 @@ export default {
}, },
data () { data () {
return { return {
headerButttondata:null,
// //
rowDropVisible: false, rowDropVisible: false,
// table key // table key
@ -282,6 +285,7 @@ export default {
this.uTableTopHeight = this.appRemoveHeight this.uTableTopHeight = this.appRemoveHeight
this.uTableOuterHeight = this.$refs.tablePaginationTableRef.getTableHeight() this.uTableOuterHeight = this.$refs.tablePaginationTableRef.getTableHeight()
this.uTableOuterHeight_init = Number(JSON.stringify(this.uTableOuterHeight)) this.uTableOuterHeight_init = Number(JSON.stringify(this.uTableOuterHeight))
this.initButttondata()
// //
document.addEventListener('click',(e)=>{ document.addEventListener('click',(e)=>{
@ -296,6 +300,22 @@ export default {
}) })
}, },
methods: { methods: {
initButttondata(){
let _list = []
this.currenButtonData.forEach(item=>{
if(item.permission){
_list.push(item)
}else{
if(this.noUsePermissionBtn.indexOf(item.name) < 0){
item.permission = [this.$route.name+'.'+item.name]
}else{
item.permission = []
}
_list.push(item)
}
})
this.headerButttondata = _list
},
// //
doFreshTableLayout(){ doFreshTableLayout(){
if(this.$refs.tablePaginationTableRef && this.$refs.tablePaginationTableRef.doFreshLayout){ if(this.$refs.tablePaginationTableRef && this.$refs.tablePaginationTableRef.doFreshLayout){
@ -410,7 +430,7 @@ export default {
// //
overallSearchFormClick(options){ overallSearchFormClick(options){
// //
options.vm_quickly = this.$refs.tablePagination_topNav.getQuicklySearchDom() if(this.$refs.tablePagination_topNav)options.vm_quickly = this.$refs.tablePagination_topNav.getQuicklySearchDom()
this.$emit("overallSearchFormClick", options) this.$emit("overallSearchFormClick", options)
}, },
// //

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

@ -30,9 +30,10 @@ const mutations = {
// 设置权限(v-permission) // 设置权限(v-permission)
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
let _roles = [ let _roles = [
'IncomingData', 'IncomingDataHistory.filter',
'IncomingData.filter',
'IncomingData.export', 'IncomingData.export',
'MesProductL7PartsNote.filter',
'MesProductL7PartsNote.export'
] ]
state.roles = _roles state.roles = _roles
}, },

Loading…
Cancel
Save