index.vue
4.18 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<template>
<div class="app-container authorize">
<el-card class="box-card" style="width: 30vw">
<div slot="header" class="clearfix">
<span>{{ $t("systemPermission.authorizationInformation") }}</span>
</div>
<el-descriptions :column="1" border>
<el-descriptions-item
label-class-name="descriptions-label"
:label="$t('systemPermission.authorize.companySoftware')"
>{{ customName }}
</el-descriptions-item>
<el-descriptions-item
label-class-name="descriptions-label"
:label="$t('systemPermission.authorize.authorizedVersion')"
>{{ customRole }}
</el-descriptions-item>
<el-descriptions-item
label-class-name="descriptions-label"
:label="$t('systemPermission.authorize.expirationDate')"
>{{ expireTime }}
</el-descriptions-item>
<el-descriptions-item
label-class-name="descriptions-label"
:label="$t('systemPermission.authorize.permit')"
><el-tag :type="isValid ? 'success' : 'danger'">{{
isValid ? $t("systemPermission.authorize.effective") : $t("systemPermission.authorize.invalid")
}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label-class-name="descriptions-label" label=""
><el-button type="primary" size="mini" @click="btnOpenAuthorize"
>{{ $t("systemPermission.authorize.updateAuthorization") }}</el-button
>
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card
v-show="isShow"
class="box-card"
style="width: 30vw; margin-top: 10px"
>
<div slot="header" class="clearfix">
<span>{{ $t("systemPermission.authorize.importAuthorization") }}</span>
</div>
<el-descriptions :column="1" border>
<el-descriptions-item
label-class-name="descriptions-label"
:label="$t('systemPermission.authorize.enterAuthorization')"
><el-input type="textarea" v-model="authorize"></el-input>
</el-descriptions-item>
<el-descriptions-item label-class-name="descriptions-label" label=""
><el-button type="primary" size="mini" @click="btnUpdAuthorize"
>{{ $t("systemPermission.authorize.update") }}</el-button
><el-button type="primary" size="mini" plain @click="btnCancel"
>{{ $t("systemPermission.authorize.cancel") }}</el-button
>
</el-descriptions-item>
</el-descriptions>
</el-card>
</div>
</template>
<script>
import { getLicense, importLicense } from "@/api/user";
import { formatTime, showMsg } from "@/utils/index.js";
export default {
data() {
return {
customName: "",
customRole: "",
expireTime: "",
isValid: false,
authorize: "",
isShow: false,
};
},
mounted() {
this.loadLicense();
},
methods: {
loadLicense() {
getLicense().then((response) => {
this.customName = response.data.customName;
this.customRole = response.data.customRole;
this.expireTime = formatTime(
new Date(response.data.expireTime),
"{y}-{m}-{d} {h}:{i}:{s}"
);
this.isValid = response.code === "Success";
});
},
btnOpenAuthorize() {
this.isShow = true;
},
btnUpdAuthorize() {
if (this.authorize.trim() == "") {
showMsg(this.$t("systemPermission.msg.authEmpty"), false);
return;
}
importLicense(this.authorize).then((response) => {
if (response.code === "Success") {
showMsg(this.$t("systemPermission.msg.authSuccess"));
this.authorize = "";
this.isShow = false;
} else {
showMsg(this.$t("systemPermission.msg.authFailed"));
}
});
},
btnCancel() {
this.authorize = "";
this.isShow = false;
},
},
};
</script>
<style scoped>
.grid-content {
padding-top: 40px;
color: #333333;
}
.el-col {
line-height: 36px;
}
.el-tag {
font-size: 14px;
}
</style>
<style>
.authorize {
.descriptions-label {
text-align: right !important;
/* color:black !important; */
}
.el-textarea__inner {
min-height: 200px !important;
}
}
</style>