1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
| <template>
| <span v-if="isShow" :class="className">
| <slot></slot>
| {{textValve}}
| </span>
| </template>
|
| <script>
| export default {
| name: 'fTemplate',
| props: {
| className: {
| type: String,
| default: ''
| },
| textValve: {
| type: String,
| default: ''
| },
| authority: {
| type: String,
| default: 'authority'
| }
| },
| data() {
| return {
| // isAdmin: sessionStorage.getItem('isAdmin') === 'true',
| buttonAuthority: sessionStorage.getItem('buttonAuthoritys') || []
| }
| },
| computed: {
| isAdmin() {
| if (
| sessionStorage.getItem('userInfo') &&
| sessionStorage.getItem('userInfo') !== ''
| ) {
| let loginName = JSON.parse(sessionStorage.getItem('userInfo')).username
| return (
| loginName === 'superadmin' || loginName === 'basic'
| )
| }
| return false
| },
| isShow() {
| if (this.isAdmin) {
| return true
| } else if (
| this.buttonAuthority.indexOf(',' + this.authority + ',') > -1
| ) {
| return true
| } else {
| return false
| }
| }
| }
| }
| </script>
|
|