【新增】与租户验证通讯是否成功
This commit is contained in:
7
src/api/authorize/index.ts
Normal file
7
src/api/authorize/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
|
||||
// 查询租户域名的连接状态
|
||||
export const getTenantStatus = (website: string) => {
|
||||
return request.get({ url: '/exam/authorize/get-ip-status/' + website })
|
||||
}
|
@@ -138,8 +138,21 @@
|
||||
width="180"
|
||||
:formatter="dateFormatter"
|
||||
/>
|
||||
<el-table-column
|
||||
label="连接状态(需点击状态刷新)"
|
||||
align="center"
|
||||
prop="websiteStatus"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" min-width="110" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openStatus(scope.row)"
|
||||
>
|
||||
状态
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@@ -171,12 +184,14 @@
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<TenantForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import {dateFormatter} from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as TenantApi from '@/api/system/tenant'
|
||||
import * as TenantPackageApi from '@/api/system/tenantPackage'
|
||||
import * as AuthorizeApi from '@/api/authorize'
|
||||
import TenantForm from './TenantForm.vue'
|
||||
|
||||
defineOptions({ name: 'SystemTenant' })
|
||||
@@ -229,6 +244,32 @@ const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
/** 连接状态 */
|
||||
const openStatus = (row: any) => {
|
||||
AuthorizeApi.getTenantStatus(row.website).then(response => {
|
||||
console.log(response)
|
||||
if (response === "强") {
|
||||
message.notifySuccess(response)
|
||||
row.websiteStatus = response + " " + getTimeWithAmPm()
|
||||
} else if (response === "弱") {
|
||||
message.notifyWarning(response)
|
||||
row.websiteStatus = response + " " + getTimeWithAmPm()
|
||||
} else {
|
||||
message.notifyError(response)
|
||||
row.websiteStatus = response + " " + getTimeWithAmPm()
|
||||
}
|
||||
})
|
||||
}
|
||||
/** 获取时分秒 */
|
||||
const getTimeWithAmPm = (): string => {
|
||||
const now = new Date()
|
||||
let hours = now.getHours()
|
||||
const minutes = now.getMinutes().toString().padStart(2, '0')
|
||||
const seconds = now.getSeconds().toString().padStart(2, '0')
|
||||
const ampm = hours >= 12 ? 'PM' : 'AM'
|
||||
hours = hours % 12 || 12
|
||||
return `${hours.toString().padStart(2, '0')}:${minutes}:${seconds} ${ampm}`
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
|
Reference in New Issue
Block a user