|
@@ -59,9 +59,8 @@
|
|
|
>
|
|
|
<a-upload
|
|
|
accept=".lic"
|
|
|
- :action="uploadAction"
|
|
|
+ :customRequest="customRequest"
|
|
|
:showUploadList="false"
|
|
|
- @change="uploadChange"
|
|
|
>
|
|
|
<a-button type="primary">选择文件</a-button>
|
|
|
</a-upload>
|
|
@@ -69,16 +68,28 @@
|
|
|
<a-form-item v-if="authForm.authType == 'OFFLINE'" label="硬件信息">
|
|
|
<a-button type="primary" @click="exportFile">导出硬件信息</a-button>
|
|
|
</a-form-item>
|
|
|
- <a-button v-else type="primary" @click="submitForm">保存</a-button>
|
|
|
+ <a-form-item v-else>
|
|
|
+ <a-button
|
|
|
+ style="margin-left: 150px"
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm"
|
|
|
+ >保存</a-button
|
|
|
+ >
|
|
|
+ </a-form-item>
|
|
|
</a-form>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { getAuthInfo, onlineAuth } from "../../api/authManagementPage";
|
|
|
+import {
|
|
|
+ getAuthInfo,
|
|
|
+ offlineAuth,
|
|
|
+ onlineAuth,
|
|
|
+} from "../../api/authManagementPage";
|
|
|
import { message } from "ant-design-vue";
|
|
|
-import { onMounted, reactive, ref } from "vue";
|
|
|
+import { onMounted, reactive } from "vue";
|
|
|
+import { downloadFileURL } from "@/utils/utils";
|
|
|
|
|
|
interface InfoType {
|
|
|
activation: string;
|
|
@@ -107,7 +118,6 @@ let authForm: AuthFormType = reactive({
|
|
|
accessKey: "",
|
|
|
accessSecret: "",
|
|
|
});
|
|
|
-let uploadAction = ref("/api/ess/system/auth/offline");
|
|
|
|
|
|
onMounted(async () => {
|
|
|
await fetchData();
|
|
@@ -115,7 +125,23 @@ onMounted(async () => {
|
|
|
|
|
|
async function fetchData() {
|
|
|
const res = await getAuthInfo();
|
|
|
- info = res.data;
|
|
|
+ if (res.data.auth == true) {
|
|
|
+ info.activation = "已授权";
|
|
|
+ if (info.activation == "已授权" && !res.data.expireTime) {
|
|
|
+ info.expire = "不限制";
|
|
|
+ } else {
|
|
|
+ info.expire = res.data.expireTime;
|
|
|
+ }
|
|
|
+ if (info.activation == "已授权" && !res.data.maxOnlineUserCount) {
|
|
|
+ info.maxCount = "不限制";
|
|
|
+ } else {
|
|
|
+ info.maxCount = res.data.maxOnlineUserCount;
|
|
|
+ }
|
|
|
+ info.onlineCount = res.data.onlineUserCount;
|
|
|
+ info.type = res.data.type == "ONLINE" ? "在线激活" : "离线激活";
|
|
|
+ } else {
|
|
|
+ info.activation = "未授权";
|
|
|
+ }
|
|
|
}
|
|
|
async function submitForm() {
|
|
|
await onlineAuth(authForm);
|
|
@@ -123,29 +149,15 @@ async function submitForm() {
|
|
|
}
|
|
|
|
|
|
// offline-auth
|
|
|
-interface FileItem {
|
|
|
- uid: string;
|
|
|
- name?: string;
|
|
|
- status?: string;
|
|
|
- response?: string;
|
|
|
- url?: string;
|
|
|
-}
|
|
|
-interface FileInfo {
|
|
|
- file: FileItem;
|
|
|
- fileList: FileItem[];
|
|
|
+async function customRequest(data: { file: File }) {
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append("file", data.file);
|
|
|
+ await offlineAuth(formData);
|
|
|
+ void message.success("上传成功!");
|
|
|
+ await fetchData();
|
|
|
}
|
|
|
-const uploadChange = (info: FileInfo) => {
|
|
|
- // if (info.file.status !== "uploading") {
|
|
|
- // console.log(info.file, info.fileList);
|
|
|
- // }
|
|
|
- if (info.file.status === "done") {
|
|
|
- void message.success(`${info.file.name} 上传成功`);
|
|
|
- } else if (info.file.status === "error") {
|
|
|
- void message.error(`${info.file.name} 上传失败`);
|
|
|
- }
|
|
|
-};
|
|
|
|
|
|
-function exportFile() {
|
|
|
- window.open("/api/ess/system/auth/info");
|
|
|
+async function exportFile() {
|
|
|
+ await downloadFileURL("/api/ess/system/auth/device/info");
|
|
|
}
|
|
|
</script>
|