8 Commits

Author SHA1 Message Date
caozehui
2e377bcca2 Merge remote-tracking branch 'origin/master' 2025-10-15 09:59:26 +08:00
caozehui
2a8757c9f1 微调 2025-10-15 09:59:10 +08:00
sjl
35f21b7140 去除日志,表格宽度 2025-10-15 08:49:11 +08:00
贾同学
b0ca84c8fd UPDATE: 优化 2025-10-15 08:45:37 +08:00
sjl
045acfa061 计划默认不勾选闪变 2025-10-14 20:54:35 +08:00
贾同学
55ff45f9a9 ADD: 模块激活流程 2025-10-14 19:00:47 +08:00
sjl
7afccb58fd 正式检测重复初始化 2025-10-14 18:41:36 +08:00
sjl
11c6704f11 闪变 2025-10-14 11:40:39 +08:00
53 changed files with 1206 additions and 977 deletions

View File

@@ -1,36 +0,0 @@
'use strict';
const { Controller } = require('ee-core');
const Log = require('ee-core/log');
const Services = require('ee-core/services');
/**
* example
* @class
*/
class ExampleController extends Controller {
constructor(ctx) {
super(ctx);
}
/**
* 所有方法接收两个参数
* @param args 前端传的参数
* @param event - ipc通信时才有值。详情见控制器文档
*/
/**
* test
*/
async test () {
const result = await Services.get('example').test('electron');
Log.info('service result:', result);
return 'hello electron-egg';
}
}
ExampleController.toString = () => '[class ExampleController]';
module.exports = ExampleController;

View File

@@ -1,29 +0,0 @@
'use strict';
const { Service } = require('ee-core');
/**
* 示例服务service层为单例
* @class
*/
class ExampleService extends Service {
constructor(ctx) {
super(ctx);
}
/**
* test
*/
async test(args) {
let obj = {
status:'ok',
params: args
}
return obj;
}
}
ExampleService.toString = () => '[class ExampleService]';
module.exports = ExampleService;

View File

@@ -23,3 +23,5 @@ VITE_API_URL=/api
VITE_PROXY=[["/api","http://192.168.1.124:18092/"]]
#VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
# 开启激活验证
VITE_ACTIVATE_OPEN=true

View File

@@ -24,3 +24,5 @@ VITE_PWA=true
# 线上环境接口地址
#VITE_API_URL="/api" # 打包时用
VITE_API_URL="http://192.168.1.125:18092/"
# 开启激活验证
VITE_ACTIVATE_OPEN=true

View File

@@ -0,0 +1,14 @@
import http from '@/api'
import type { Activate } from '@/api/activate/interface'
export const generateApplicationCode = (params: Activate.ApplicationCodePlaintext) => {
return http.post(`/activate/generateApplicationCode`, params)
}
export const verifyActivationCode = (activationCode: string) => {
return http.post(`/activate/verifyActivationCode`, { activationCode })
}
export const getLicense = () => {
return http.post(`/activate/getLicense`)
}

View File

@@ -0,0 +1,55 @@
//激活模块
export namespace Activate {
export interface ApplicationModule {
/**
* 是否申请 1是 0否
*/
apply: number;
}
export interface ActivateModule extends ApplicationModule {
/**
* 是否永久 1是 0否
*/
permanently: number;
}
export interface ApplicationCodePlaintext {
/**
* 模拟式模块
*/
simulate: ApplicationModule;
/**
* 数字式模块
*/
digital: ApplicationModule;
/**
* 比对式模块
*/
contrast: ApplicationModule;
}
export interface ActivationCodePlaintext {
/**
* 模拟式模块
*/
simulate: ActivateModule;
/**
* 数字式模块
*/
digital: ActivateModule;
/**
* 比对式模块
*/
contrast: ActivateModule;
}
}

View File

@@ -93,7 +93,7 @@ class RequestHttp {
}
// 登陆失效
if (data.code === ResultEnum.OVERDUE) {
console.log('登陆失效')
//console.log('登陆失效')
userStore.setAccessToken('')
userStore.setRefreshToken('')
userStore.setIsRefreshToken(false)
@@ -142,7 +142,7 @@ class RequestHttp {
async (error: AxiosError) => {
const { response } = error
tryHideFullScreenLoading()
console.log('error', error.message)
//console.log('error', error.message)
// 请求超时 && 网络错误单独判断,没有 response
if (error.message.indexOf('timeout') !== -1) ElMessage.error('请求超时!请您稍后重试')
if (error.message.indexOf('Network Error') !== -1) ElMessage.error('网络错误!请您稍后重试')
@@ -228,7 +228,7 @@ class RequestHttp {
// 设置默认的Authorization头部
eventSource.addEventListener('open', function () {
console.log('SSE连接已建立')
//console.log('SSE连接已建立')
})
// 添加错误处理
eventSource.addEventListener('error', function (err) {

View File

@@ -112,7 +112,7 @@ const uploadExcel = async (param: UploadRequestOptions) => {
}
async function handleImportResponse(res: any) {
console.log(res)
if (res.type === 'application/json') {
const fileReader = new FileReader()
@@ -129,7 +129,7 @@ async function handleImportResponse(res: any) {
}
emit('result', jsonData.data)
} catch (err) {
console.log(err)
//console.log(err)
}
}
fileReader.readAsText(res)

View File

@@ -210,7 +210,7 @@ const closeEventSource = () => {
if (eventSource.value) {
eventSource.value.close()
eventSource.value = null
console.log('SSE连接已关闭')
// console.log('SSE连接已关闭')
}
}
// 监听 dialogVisible 的变化,确保在对话框关闭时清理资源

View File

@@ -16,7 +16,7 @@ const auth: Directive = {
} else {
currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
}
console.log('currentPageRoles', currentPageRoles)
//console.log('currentPageRoles', currentPageRoles)
if (value instanceof Array && value.length) {
const hasPermission = value.every(item => currentPageRoles.includes(item))
if (!hasPermission) el.remove()

View File

@@ -1,24 +1,21 @@
<template>
<div class="footer flx-align-center pl10">
<el-dropdown>
<!-- <span class="el-dropdown-link">
{{ title }}
<el-icon class="el-icon--right">
<arrow-down />
</el-icon>
</span> -->
<!-- <el-button dictType="primary"> -->
<div class="change_mode">
{{ title }}
<el-icon class="el-icon--right change_mode_down"><arrow-down /></el-icon>
<el-icon class="el-icon--right change_mode_up"><arrow-up /></el-icon>
</div>
<!-- </el-button> -->
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="handelOpen('模拟式')">模拟式模块</el-dropdown-item>
<el-dropdown-item @click="handelOpen('数字式')">数字式模块</el-dropdown-item>
<el-dropdown-item @click="handelOpen('比对式')">比对式模块</el-dropdown-item>
<el-dropdown-item
v-for="item in modeList"
:key="item.key"
:disabled="!item.activated"
@click="handelOpen(item.code, item.key)"
>
{{ item.name }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
@@ -31,26 +28,52 @@
import { computed } from 'vue'
import { useAuthStore } from '@/stores/modules/auth'
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { useRouter } from 'vue-router'
const router = useRouter()
const authStore = useAuthStore()
const modeStore = useModeStore()
const title = computed(() => {
return modeStore.currentMode === '' ? '模拟式模块' : modeStore.currentMode + '模块'
return modeStore.currentMode === '' ? '选择模块' : modeStore.currentMode + '模块'
})
const handelOpen = async (item: string) => {
const activateInfo = authStore.activateInfo
const isActivateOpen = import.meta.env.VITE_ACTIVATE_OPEN
const modeList = [
{
name: '模拟式模块',
code: '模拟式',
key: 'simulate',
activated:
isActivateOpen === 'true'
? activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1
: true
},
{
name: '数字式模块',
code: '数字式',
key: 'digital',
activated:
isActivateOpen === 'true'
? activateInfo.digital.apply === 1 && activateInfo.digital.permanently === 1
: true
},
{
name: '比对式模块',
code: '比对式',
key: 'contrast',
activated:
isActivateOpen === 'true'
? activateInfo.contrast.apply === 1 && activateInfo.contrast.permanently === 1
: true
}
]
const handelOpen = async (item: string, key: string) => {
if (isActivateOpen === 'true' && (activateInfo[key].apply !== 1 || activateInfo[key].permanently !== 1)) {
ElMessage.warning(`${item}模块未激活`)
return
}
await authStore.setShowMenu()
modeStore.setCurrentMode(item) // 将模式code存入 store
//if (router.currentRoute.value.path === '/home/index') {
// 强制刷新页面
window.location.reload()
//} else {
// router.push({ path: '/home/index' });
//}
}
</script>
<style scoped lang="scss">

View File

@@ -1,218 +1,212 @@
<template>
<!-- <div class="userInfo">-->
<!-- <div class="icon">-->
<!-- <Avatar/>-->
<!-- </div>-->
<!-- <div class="username">-->
<!-- {{ username }}-->
<!-- </div>-->
<!-- </div>-->
<el-dropdown trigger="click">
<div class="userInfo">
<div class="icon">
<Avatar />
</div>
<div class="username">
{{ username }}
</div>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="openDialog('themeRef')">
<el-icon><Sunny /></el-icon>{{ t("header.changeTheme") }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('infoRef')">
<el-icon><User /></el-icon>{{ t("header.personalData") }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('passwordRef')">
<el-icon><Edit /></el-icon>{{ t("header.changePassword") }}
</el-dropdown-item>
<el-dropdown-item @click="changeMode">
<el-icon><Switch /></el-icon>{{ t("header.changeMode") }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('versionRegisterRef')">
<el-icon><SetUp /></el-icon>{{ t("header.versionRegister") }}
</el-dropdown-item>
<el-dropdown trigger="hover" placement="left-start" v-if="userStore.userInfo.loginName == 'root'">
<div class="custom-dropdown-trigger">
<el-icon><Tools /></el-icon>
<span>{{ t("header.changeScene") }}</span>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-for="item in dictStore.getDictData('app_scene')"
:key="item.value"
:class="{
'custom-dropdown-item': true,
active: item.value === appSceneStore.currentScene
}"
@click="changeScene(item.value?? '')"
:disabled = "item.value === appSceneStore.currentScene"
>
{{ item.name }}
</el-dropdown-item>
<!-- <div class="userInfo">-->
<!-- <div class="icon">-->
<!-- <Avatar/>-->
<!-- </div>-->
<!-- <div class="username">-->
<!-- {{ username }}-->
<!-- </div>-->
<!-- </div>-->
<el-dropdown trigger="click">
<div class="userInfo">
<div class="icon">
<Avatar />
</div>
<div class="username">
{{ username }}
</div>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="openDialog('themeRef')">
<el-icon><Sunny /></el-icon>
{{ t('header.changeTheme') }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('infoRef')">
<el-icon><User /></el-icon>
{{ t('header.personalData') }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('passwordRef')">
<el-icon><Edit /></el-icon>
{{ t('header.changePassword') }}
</el-dropdown-item>
<el-dropdown-item @click="changeMode" v-if="authStore.showMenuFlag">
<el-icon><Switch /></el-icon>
{{ t('header.changeMode') }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('versionRegisterRef')">
<el-icon><SetUp /></el-icon>
{{ t('header.versionRegister') }}
</el-dropdown-item>
<el-dropdown trigger="hover" placement="left-start" v-if="userStore.userInfo.loginName == 'root'">
<div class="custom-dropdown-trigger">
<el-icon><Tools /></el-icon>
<span>{{ t('header.changeScene') }}</span>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-for="item in dictStore.getDictData('app_scene')"
:key="item.value"
:class="{
'custom-dropdown-item': true,
active: item.value === appSceneStore.currentScene
}"
@click="changeScene(item.value ?? '')"
:disabled="item.value === appSceneStore.currentScene"
>
{{ item.name }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-dropdown-menu>
</template>
</el-dropdown>
<div class="avatar">
<img src="@/assets/icons/out_login.svg" alt="avatar" @click="logout" />
</div>
<!-- infoDialog -->
<InfoDialog ref="infoRef"></InfoDialog>
<!-- passwordDialog -->
<PasswordDialog ref="passwordRef"></PasswordDialog>
<!-- versionRegisterDialog -->
<VersionDialog ref="versionRegisterRef"></VersionDialog>
</template>
</el-dropdown>
<div class="avatar">
<img src="@/assets/icons/out_login.svg" alt="avatar" @click="logout" />
</div>
<!-- infoDialog -->
<InfoDialog ref="infoRef"></InfoDialog>
<!-- passwordDialog -->
<PasswordDialog ref="passwordRef"></PasswordDialog>
<!-- versionRegisterDialog -->
<VersionDialog ref="versionRegisterRef"></VersionDialog>
<!-- ThemeDialog -->
<ThemeDialog ref="themeRef"></ThemeDialog>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { LOGIN_URL } from "@/config";
import { useRouter } from "vue-router";
import { logoutApi } from "@/api/user/login";
import { useUserStore } from "@/stores/modules/user";
import { ElMessageBox, ElMessage, CHANGE_EVENT } from "element-plus";
import InfoDialog from "./InfoDialog.vue";
import PasswordDialog from "./PasswordDialog.vue";
import ThemeDialog from "./ThemeDialog.vue";
import VersionDialog from "@/views/system/versionRegister/index.vue";
import { computed } from "vue";
import { ArrowLeft, Avatar, Delete, Document, Sunny, Switch ,Tools} from "@element-plus/icons-vue";
import AssemblySize from "./components/AssemblySize.vue";
import Language from "./components/Language.vue";
import SearchMenu from "./components/SearchMenu.vue";
import ThemeSetting from "./components/ThemeSetting.vue";
import Message from "./components/Message.vue";
import Fullscreen from "./components/Fullscreen.vue";
import { useAuthStore } from "@/stores/modules/auth";
import {useDictStore} from "@/stores/modules/dict";
import { useModeStore,useAppSceneStore } from "@/stores/modules/mode";
const userStore = useUserStore();
const dictStore = useDictStore();
const username = computed(() => userStore.userInfo.name);
import { computed, ref } from 'vue'
import { LOGIN_URL } from '@/config'
import { useRouter } from 'vue-router'
import { logoutApi } from '@/api/user/login'
import { useUserStore } from '@/stores/modules/user'
import { ElMessage, ElMessageBox } from 'element-plus'
import InfoDialog from './InfoDialog.vue'
import PasswordDialog from './PasswordDialog.vue'
import ThemeDialog from './ThemeDialog.vue'
import VersionDialog from '@/views/system/versionRegister/index.vue'
import { Avatar, Sunny, Switch, Tools } from '@element-plus/icons-vue'
import { useAuthStore } from '@/stores/modules/auth'
import { useDictStore } from '@/stores/modules/dict'
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'
import { useTheme } from '@/hooks/useTheme'
import { useI18n } from 'vue-i18n'
import { updateScene } from '@/api/system/base/index'
const router = useRouter();
const authStore = useAuthStore();
const modeStore = useModeStore();
const AppSceneStore = useAppSceneStore();
import { useTheme } from "@/hooks/useTheme";
import { useI18n } from "vue-i18n";
import {updateScene} from '@/api/system/base/index'
const userStore = useUserStore()
const dictStore = useDictStore()
const username = computed(() => userStore.userInfo.name)
const router = useRouter()
const authStore = useAuthStore()
const modeStore = useModeStore()
const AppSceneStore = useAppSceneStore()
const { changePrimary} = useTheme();
const { changePrimary } = useTheme()
// 初始化 i18n
const { t } = useI18n(); // 使用 t 方法替代 $t
const { t } = useI18n() // 使用 t 方法替代 $t
// 退出登录
const logout = () => {
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(async () => {
// 1.执行退出登录接口
await logoutApi();
// 2.清除 Token
userStore.setAccessToken("");
userStore.setRefreshToken("");
userStore.setExp(0)
userStore.setUserInfo({id: "", name: ""});
userStore.setIsRefreshToken(false)
dictStore.setDictData([]);
modeStore.setCurrentMode('');
AppSceneStore.setCurrentMode('');
// 3.重定向到登陆页
router.replace(LOGIN_URL);
ElMessage.success("退出登录成功!");
//重置菜单/导航栏权限
authStore.resetAuthStore();
});
};
ElMessageBox.confirm('您是否确认退出登录?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
// 1.执行退出登录接口
await logoutApi()
// 2.清除 Token
userStore.setAccessToken('')
userStore.setRefreshToken('')
userStore.setExp(0)
userStore.setUserInfo({ id: '', name: '' })
userStore.setIsRefreshToken(false)
dictStore.setDictData([])
modeStore.setCurrentMode('')
AppSceneStore.setCurrentMode('')
// 3.重定向到登陆页
ElMessage.success('退出登录成功!')
//重置菜单/导航栏权限
await authStore.resetAuthStore()
await router.push(LOGIN_URL)
})
}
// 打开修改密码和个人信息弹窗
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
const themeRef = ref<InstanceType<typeof ThemeDialog> | null>(null);
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null)
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null)
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null)
const themeRef = ref<InstanceType<typeof ThemeDialog> | null>(null)
const openDialog = (ref: string) => {
if (ref == "infoRef") infoRef.value?.openDialog();
if (ref == "passwordRef") passwordRef.value?.openDialog();
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
if (ref == "themeRef") themeRef.value?.openDialog();
};
if (ref == 'infoRef') infoRef.value?.openDialog()
if (ref == 'passwordRef') passwordRef.value?.openDialog()
if (ref == 'versionRegisterRef') versionRegisterRef.value?.openDialog()
if (ref == 'themeRef') themeRef.value?.openDialog()
}
const appSceneStore = useAppSceneStore();
const appSceneStore = useAppSceneStore()
const changeScene = async (value: string) => {
appSceneStore.setCurrentMode(value);
await updateScene({scene :dictStore.getDictData('app_scene').find(item => item.value == value)?.id});
// 强制刷新页面
window.location.reload();
};
appSceneStore.setCurrentMode(value)
await updateScene({ scene: dictStore.getDictData('app_scene').find(item => item.value == value)?.id })
// 强制刷新页面
window.location.reload()
}
//模式切换
const changeMode = () => {
authStore.changeModel();
};
authStore.changeModel()
}
</script>
<style scoped lang="scss">
.userInfo {
min-width: 80px;
display: flex;
justify-content: flex-start;
align-items: center;
cursor: pointer;
.icon {
width: 18px;
height: 18px;
color: #fff !important;
}
.username {
color: #fff;
font-size: 16px;
margin-left: 10px;
}
min-width: 80px;
display: flex;
justify-content: flex-start;
align-items: center;
cursor: pointer;
.icon {
width: 18px;
height: 18px;
color: #fff !important;
}
.username {
color: #fff;
font-size: 16px;
margin-left: 10px;
}
}
.avatar {
width: 40px;
height: 40px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: flex-end;
cursor: pointer;
// border-radius: 50%;
img {
// width: 100%;
// height: 100%;
}
width: 40px;
height: 40px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: flex-end;
cursor: pointer;
// border-radius: 50%;
img {
// width: 100%;
// height: 100%;
}
}
.custom-dropdown-trigger {
padding: 8px 15px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
padding: 8px 15px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
}
:deep(.el-dropdown-menu__item.custom-dropdown-item.active),
:deep(.el-dropdown-menu__item.custom-dropdown-item.active:hover) {
background-color: var(--el-color-primary-light-9) !important;
color: var(--el-color-primary)
background-color: var(--el-color-primary-light-9) !important;
color: var(--el-color-primary);
}
</style>

View File

@@ -3,14 +3,14 @@ import { useUserStore } from '@/stores/modules/user'
import { useAuthStore } from '@/stores/modules/auth'
import { LOGIN_URL, ROUTER_WHITE_LIST } from '@/config'
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
import { staticRouter, errorRouter } from '@/routers/modules/staticRouter'
import { staticRouter } from '@/routers/modules/staticRouter'
import NProgress from '@/config/nprogress'
const mode = import.meta.env.VITE_ROUTER_MODE
const routerMode = {
hash: () => createWebHashHistory(),
history: () => createWebHistory(),
hash: () => createWebHashHistory(),
history: () => createWebHistory()
}
/**
@@ -30,76 +30,80 @@ const routerMode = {
* @param meta.isKeepAlive ==> 当前路由是否缓存
* */
const router = createRouter({
history: routerMode[mode](),
routes: [...staticRouter],
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
strict: false,
// 页面刷新时,滚动条位置还原
scrollBehavior: () => ({ left: 0, top: 0 }),
history: routerMode[mode](),
routes: [...staticRouter],
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
strict: false,
// 页面刷新时,滚动条位置还原
scrollBehavior: () => ({ left: 0, top: 0 })
})
/**
* @description 路由拦截 beforeEach
* */
router.beforeEach(async (to, from, next) => {
const userStore = useUserStore()
const authStore = useAuthStore()
// 1.NProgress 开始
NProgress.start()
// 2.动态设置标题
const title = import.meta.env.VITE_GLOB_APP_TITLE
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
const userStore = useUserStore()
const authStore = useAuthStore()
// 1.NProgress 开始
NProgress.start()
// 2.动态设置标题
const title = import.meta.env.VITE_GLOB_APP_TITLE
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
if (userStore.accessToken) return next(from.fullPath)
resetRouter()
return next()
}
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
if (userStore.accessToken) return next(from.fullPath)
resetRouter()
return next()
}
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
// 5.判断是否有 Token没有重定向到 login 页面
if (!userStore.accessToken) return next({ path: LOGIN_URL, replace: true })
// 5.判断是否有 Token没有重定向到 login 页面
if (!userStore.accessToken) return next({ path: LOGIN_URL, replace: true })
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
if (!authStore.authMenuListGet.length) {
await initDynamicRouter()
return next({ ...to, replace: true })
}
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
if (!authStore.authMenuListGet.length) {
await initDynamicRouter()
return next({ ...to, replace: true })
}
// 7.存储 routerName 做按钮权限筛选
authStore.setRouteName(to.name as string)
// 8.正常访问页面
next()
// 7.存储 routerName 做按钮权限筛选
await authStore.setRouteName(to.name as string)
// 8. 当前页面是否有激活信息,没有就刷新
const activateInfo = authStore.activateInfo
if (!Object.keys(activateInfo).length) {
await authStore.setActivateInfo()
}
// 9.正常访问页面
next()
})
/**
* @description 重置路由
* */
export const resetRouter = () => {
const authStore = useAuthStore()
authStore.flatMenuListGet.forEach(route => {
const { name } = route
if (name && router.hasRoute(name)) router.removeRoute(name)
})
const authStore = useAuthStore()
authStore.flatMenuListGet.forEach(route => {
const { name } = route
if (name && router.hasRoute(name)) router.removeRoute(name)
})
}
/**
* @description 路由跳转错误
* */
router.onError(error => {
NProgress.done()
//console.warn('路由错误', error.message)
NProgress.done()
//console.warn('路由错误', error.message)
})
/**
* @description 路由跳转结束
* */
router.afterEach(() => {
NProgress.done()
NProgress.done()
})
export default router

View File

@@ -1,5 +1,6 @@
import { RouteRecordRaw } from 'vue-router'
import { type RouteRecordRaw } from 'vue-router'
import { HOME_URL, LOGIN_URL } from '@/config'
export const Layout = () => import('@/layouts/index.vue')
/**
* staticRouter (静态路由)

View File

@@ -1,89 +1,89 @@
import { defineStore } from "pinia";
import { AuthState } from "@/stores/interface";
import { getAuthButtonListApi, getAuthMenuListApi } from "@/api/user/login";
import {
getFlatMenuList,
getShowMenuList,
getAllBreadcrumbList,
} from "@/utils";
import { useRouter } from "vue-router";
import { AUTH_STORE_KEY } from "@/stores/constant";
import {useModeStore} from '@/stores/modules/mode'
import { defineStore } from 'pinia'
import { AuthState } from '@/stores/interface'
import { getAuthButtonListApi, getAuthMenuListApi } from '@/api/user/login'
import { getAllBreadcrumbList, getFlatMenuList, getShowMenuList } from '@/utils'
import { useRouter } from 'vue-router'
import { AUTH_STORE_KEY } from '@/stores/constant'
import { useModeStore } from '@/stores/modules/mode'
import { getLicense } from '@/api/activate'
import type { Activate } from '@/api/activate/interface'
export const useAuthStore = defineStore({
id: AUTH_STORE_KEY,
state: (): AuthState => ({
// 按钮权限列表
authButtonList: {},
// 菜单权限列表
authMenuList: [],
// 当前页面的 router name用来做按钮权限筛选
routeName: "",
//登录不显示菜单栏和导航栏,点击进入测试的时候显示
showMenuFlag: JSON.parse(localStorage.getItem("showMenuFlag")),
router: useRouter(),
}),
getters: {
// 按钮权限列表
authButtonListGet: (state) => state.authButtonList,
// 菜单权限列表 ==> 这里的菜单没有经过任何处理
authMenuListGet: (state) => state.authMenuList,
// 菜单权限列表 ==> 左侧菜单栏渲染,需要剔除 isHide == true
showMenuListGet: (state) => getShowMenuList(state.authMenuList),
// 菜单权限列表 ==> 扁平化之后的一维数组菜单,主要用来添加动态路由
flatMenuListGet: (state) => getFlatMenuList(state.authMenuList),
// 递归处理后的所有面包屑导航列表
breadcrumbListGet: (state) => getAllBreadcrumbList(state.authMenuList),
//是否显示菜单和导航栏
showMenuFlagGet: (state) => state.showMenuFlag,
},
actions: {
// Get AuthButtonList
async getAuthButtonList() {
const { data } = await getAuthButtonListApi();
this.authButtonList = data;
id: AUTH_STORE_KEY,
state: (): AuthState => ({
// 按钮权限列表
authButtonList: {},
// 菜单权限列表
authMenuList: [],
// 当前页面的 router name用来做按钮权限筛选
routeName: '',
//登录不显示菜单栏和导航栏,点击进入测试的时候显示
showMenuFlag: JSON.parse(localStorage.getItem('showMenuFlag') as string),
router: useRouter(),
activateInfo: {}
}),
getters: {
// 按钮权限列表
authButtonListGet: state => state.authButtonList,
// 菜单权限列表 ==> 这里的菜单没有经过任何处理
authMenuListGet: state => state.authMenuList,
// 菜单权限列表 ==> 左侧菜单栏渲染,需要剔除 isHide == true
showMenuListGet: state => getShowMenuList(state.authMenuList),
// 菜单权限列表 ==> 扁平化之后的一维数组菜单,主要用来添加动态路由
flatMenuListGet: state => getFlatMenuList(state.authMenuList),
// 递归处理后的所有面包屑导航列表
breadcrumbListGet: state => getAllBreadcrumbList(state.authMenuList),
//是否显示菜单和导航栏
showMenuFlagGet: state => state.showMenuFlag,
// 获取激活信息
activateInfoGet: state => state.activateInfo
},
// Get AuthMenuList
async getAuthMenuList() {
const modeStore = useModeStore()
const { data: menuData } = await getAuthMenuListApi();
// 根据不同模式过滤菜单
const filteredMenu = modeStore.currentMode === '比对式'
? filterMenuByExcludedNames(menuData, ['testSource', 'testScript', 'controlSource'])
: filterMenuByExcludedNames(menuData, ['standardDevice']);
this.authMenuList = filteredMenu;
},
// Set RouteName
async setRouteName(name: string) {
this.routeName = name;
},
//重置权限
async resetAuthStore() {
this.showMenuFlag = false;
localStorage.removeItem("showMenuFlag");
},
//修改判断菜单栏/导航栏显示条件
async setShowMenu() {
this.showMenuFlag = true;
localStorage.setItem("showMenuFlag", true);
},
//更改模式
async changeModel() {
this.showMenuFlag = !this.showMenuFlag;
if (this.showMenuFlag) {
localStorage.setItem("showMenuFlag", true);
} else {
localStorage.removeItem("showMenuFlag");
}
this.router.push({ path: "/home/index" });
},
},
});
actions: {
// Get AuthButtonList
async getAuthButtonList() {
const { data } = await getAuthButtonListApi()
this.authButtonList = data
},
// Get AuthMenuList
async getAuthMenuList() {
const modeStore = useModeStore()
const { data: menuData } = await getAuthMenuListApi()
// 根据不同模式过滤菜单
const filteredMenu =
modeStore.currentMode === '比对式'
? filterMenuByExcludedNames(menuData, ['testSource', 'testScript', 'controlSource'])
: filterMenuByExcludedNames(menuData, ['standardDevice'])
this.authMenuList = filteredMenu
},
// Set RouteName
async setRouteName(name: string) {
this.routeName = name
},
//重置权限
async resetAuthStore() {
this.showMenuFlag = false
localStorage.removeItem('showMenuFlag')
},
//修改判断菜单栏/导航栏显示条件
async setShowMenu() {
this.showMenuFlag = true
localStorage.setItem('showMenuFlag', 'true')
},
//更改模式
async changeModel() {
this.showMenuFlag = false
localStorage.removeItem('showMenuFlag')
this.router.push({ path: '/home/index' })
},
async setActivateInfo() {
const license_result = await getLicense()
const licenseData = license_result.data as unknown as Activate.ActivationCodePlaintext
this.activateInfo = licenseData
}
}
})
/**
* 通用菜单过滤函数
@@ -92,12 +92,12 @@ export const useAuthStore = defineStore({
* @returns 过滤后的菜单列表
*/
function filterMenuByExcludedNames(menuList: any[], excludedNames: string[]): any[] {
return menuList.filter(menu => {
// 如果当前项有 children递归处理子项
if (menu.children && menu.children.length > 0) {
menu.children = filterMenuByExcludedNames(menu.children, excludedNames);
}
// 过滤掉在排除列表中的菜单项
return !excludedNames.includes(menu.name);
});
return menuList.filter(menu => {
// 如果当前项有 children递归处理子项
if (menu.children && menu.children.length > 0) {
menu.children = filterMenuByExcludedNames(menu.children, excludedNames)
}
// 过滤掉在排除列表中的菜单项
return !excludedNames.includes(menu.name)
})
}

View File

@@ -1,5 +1,10 @@
const Renderer =
(window.require && window.require('electron')) || window.electron || {}
declare global {
interface Window {
electron?: any;
}
}
const Renderer = (window.require && window.require('electron')) || window.electron || {};
/**
* ipc
@@ -21,11 +26,14 @@ const Renderer =
/**
* ipc
*/
const ipc = Renderer.ipcRenderer || undefined
const ipc = Renderer.ipcRenderer || undefined;
/**
* 是否为EE环境
*/
const isEE = ipc ? true : false
const isEE = ipc ? true : false;
export {
Renderer, ipc, isEE
};
export { Renderer, ipc, isEE }

View File

@@ -190,8 +190,8 @@ export default class SocketService {
* WebSocket连接配置
*/
private config: SocketConfig = {
// url: 'ws://127.0.0.1:7777/hello',
url: 'ws://192.168.1.124:7777/hello',
url: 'ws://127.0.0.1:7777/hello',
// url: 'ws://192.168.1.124:7777/hello',
heartbeatInterval: 9000, // 9秒心跳间隔
reconnectDelay: 5000, // 5秒重连延迟
maxReconnectAttempts: 5, // 最多重连5次
@@ -246,13 +246,13 @@ export default class SocketService {
public connect(): Promise<void> | void {
// 检查浏览器支持
if (!window.WebSocket) {
console.log('您的浏览器不支持WebSocket');
// console.log('您的浏览器不支持WebSocket');
return;
}
// 防止重复连接
if (this.connectionStatus === ConnectionStatus.CONNECTING || this.connected) {
console.warn('WebSocket已连接或正在连接中');
// console.warn('WebSocket已连接或正在连接中');
return;
}
@@ -263,7 +263,7 @@ export default class SocketService {
this.setupEventHandlersLegacy();
} catch (error) {
this.connectionStatus = ConnectionStatus.ERROR;
console.error('WebSocket连接失败:', error);
//console.error('WebSocket连接失败:', error);
}
}
@@ -276,14 +276,14 @@ export default class SocketService {
// 检查浏览器支持
if (!window.WebSocket) {
const error = '您的浏览器不支持WebSocket';
console.error(error);
//console.error(error);
reject(new Error(error));
return;
}
// 防止重复连接
if (this.connectionStatus === ConnectionStatus.CONNECTING || this.connected) {
console.warn('WebSocket已连接或正在连接中');
//console.warn('WebSocket已连接或正在连接中');
resolve();
return;
}
@@ -307,11 +307,11 @@ export default class SocketService {
*/
public registerCallBack<T = any>(messageType: string, callback: CallbackFunction<T>): void {
if (!messageType || typeof callback !== 'function') {
console.error('注册回调函数参数无效');
//console.error('注册回调函数参数无效');
return;
}
this.callBackMapping[messageType] = callback;
console.log(`注册消息处理器: ${messageType}`);
// console.log(`注册消息处理器: ${messageType}`);
}
/**
@@ -321,7 +321,7 @@ export default class SocketService {
public unRegisterCallBack(messageType: string): void {
if (this.callBackMapping[messageType]) {
delete this.callBackMapping[messageType];
console.log(`注销消息处理器: ${messageType}`);
//console.log(`注销消息处理器: ${messageType}`);
}
}
@@ -354,10 +354,10 @@ export default class SocketService {
const message = typeof data === 'string' ? data : JSON.stringify(data);
this.ws.send(message);
console.log('发送消息:', message);
//console.log('发送消息:', message);
resolve();
} catch (error) {
console.error('发送消息失败:', error);
//console.error('发送消息失败:', error);
reject(error);
}
});
@@ -367,7 +367,7 @@ export default class SocketService {
* 关闭WebSocket连接
*/
public closeWs(): void {
console.log('正在关闭WebSocket连接...');
//console.log('正在关闭WebSocket连接...');
// 清理心跳
this.clearHeartbeat();
@@ -383,7 +383,7 @@ export default class SocketService {
this.connectRetryCount = 0;
this.sendRetryCount = 0;
console.log('WebSocket连接已关闭');
//console.log('WebSocket连接已关闭');
}
/**
@@ -447,7 +447,7 @@ export default class SocketService {
// 连接成功事件
this.ws.onopen = () => {
ElMessage.success("WebSocket连接服务端成功");
console.log('WebSocket连接成功');
// console.log('WebSocket连接成功');
this.connectionStatus = ConnectionStatus.CONNECTED;
this.connectRetryCount = 0;
this.startHeartbeat();
@@ -456,7 +456,7 @@ export default class SocketService {
// 连接关闭事件
this.ws.onclose = (event: CloseEvent) => {
console.log('WebSocket连接关闭', event.code, event.reason);
//console.log('WebSocket连接关闭', event.code, event.reason);
this.connectionStatus = ConnectionStatus.DISCONNECTED;
this.clearHeartbeat();
@@ -489,7 +489,7 @@ export default class SocketService {
// 连接成功事件
this.ws.onopen = () => {
ElMessage.success("webSocket连接服务端成功了");
console.log('连接服务端成功了');
// console.log('连接服务端成功了');
this.connectionStatus = ConnectionStatus.CONNECTED;
this.connectRetryCount = 0;
this.startHeartbeat();
@@ -497,7 +497,7 @@ export default class SocketService {
// 连接关闭事件
this.ws.onclose = (event: CloseEvent) => {
console.log('连接webSocket服务端关闭');
// console.log('连接webSocket服务端关闭');
this.connectionStatus = ConnectionStatus.DISCONNECTED;
this.clearHeartbeat();
@@ -530,7 +530,7 @@ export default class SocketService {
// 心跳响应处理
if (event.data === 'over') {
console.log(`${new Date().toLocaleTimeString()} - 收到心跳响应`);
// console.log(`${new Date().toLocaleTimeString()} - 收到心跳响应`);
this.lastResponseHeartTime = Date.now();
return;
}
@@ -553,7 +553,7 @@ export default class SocketService {
}
} else {
// 非JSON格式的消息作为普通文本处理
console.log('收到非JSON格式消息:', event.data);
// console.log('收到非JSON格式消息:', event.data);
// 可以添加文本消息的处理逻辑
if (this.callBackMapping['text']) {
this.callBackMapping['text']({
@@ -587,7 +587,7 @@ export default class SocketService {
const delay = this.config.reconnectDelay! * this.connectRetryCount;
console.log(`尝试第${this.connectRetryCount}次重连,${delay}ms后开始...`);
// console.log(`尝试第${this.connectRetryCount}次重连,${delay}ms后开始...`);
setTimeout(() => {
try {
@@ -674,7 +674,7 @@ export default class SocketService {
*/
private sendHeartbeat(): void {
if (this.connected && this.ws) {
console.log(`${new Date().toLocaleTimeString()} - 发送心跳消息`);
// console.log(`${new Date().toLocaleTimeString()} - 发送心跳消息`);
this.ws.send('alive');
}
}

View File

@@ -158,7 +158,6 @@ const handleConnectEnd = (params: any) => {
}
const handleConnect = (params: any) => {
console.log('连接信息:', params)
const sourceNode = nodes.value.find(node => node.id === params.source)
const targetNode = nodes.value.find(node => node.id === params.target)
@@ -207,7 +206,6 @@ const devIds = ref<string[]>()
const standardDevIds = ref<string[]>()
const open = async () => {
console.log('开始打开通道配对')
edges.value = []
devIds.value = prop.devIdList.map(d => d.id)
standardDevIds.value = prop.pqStandardDevList.map(d => d.id)

View File

@@ -485,7 +485,7 @@ const getResults = async (code: any) => {
// 判断是否为录波数据请求
const isWaveDataRequest = code === 'wave_data' || isWaveData.value
console.log('isWaveDataRequest:', rowList.value.scriptType)
getContrastResult({
planId: checkStore.plan.id,
scriptType: rowList.value.scriptType,

View File

@@ -304,7 +304,7 @@ watch(
setLogList('error', newValue.data)
break
case 25003:
ElMessageBox.alert('录波对齐失败!', {
ElMessageBox.alert('录波数据异常!', {
confirmButtonText: '确定',
type: 'error'
})
@@ -353,7 +353,70 @@ watch(
}
}
break
case 'flicker_data_check':
switch (newValue.code) {
case 25002:
setLogList('error', newValue.data)
break
case 25003:
ElMessageBox.alert('闪变收集失败!', {
confirmButtonText: '确定',
type: 'error'
})
stopTimeCount()
break
case 25001: {
// 当录波校验完成时,更新录波项目的按钮状态
setLogList('info', '闪变校验完成!')
// 解析返回的数据
const waveData = JSON.parse(newValue.data)
// 找到录波项目并更新其状态
const waveResultItem = checkResult.find(item => item.scriptName === '闪变')
if (waveResultItem) {
// 根据返回的chnResult更新各个设备的通道状态
waveResultItem.devices.forEach(device => {
const deviceData = waveData.find((d: any) => d.deviceId === device.deviceId)
if (deviceData) {
// 根据实际返回的chnResult更新状态
deviceData.chnResult.forEach((result: number, index: number) => {
// 创建数字到枚举的映射
const resultMap: { [key: number]: CheckData.ChnCheckResultEnum } = {
1: CheckData.ChnCheckResultEnum.SUCCESS,
2: CheckData.ChnCheckResultEnum.FAIL,
3: CheckData.ChnCheckResultEnum.TIMEOUT,
4: CheckData.ChnCheckResultEnum.ERRORDATA,
5: CheckData.ChnCheckResultEnum.NOT_PART_IN_ERROR
}
// 使用映射关系设置状态如果没有对应的映射则设为UNKNOWN
device.chnResult[index] = resultMap[result] || CheckData.ChnCheckResultEnum.UNKNOWN
})
}
})
}
// 触发响应式更新
checkResult.splice(0, 0)
stopTimeCount()
updatePercentage()
break
}
}
break
case 'QUIT_FUNEND$01':{
ElMessageBox.alert(newValue.data, '检测失败', {
confirmButtonText: '确定',
type: 'error'
})
// 设置闪变项目为Unkonown 状态
const flickerResultItem = checkResult.find(item => item.code === 'F')
if (flickerResultItem) {
flickerResultItem.devices.forEach(device => {
device.chnResult.fill(CheckData.ChnCheckResultEnum.UNKNOWN)
})
}
stopTimeCount()
break
}
case 'connect':
switch (newValue.operateCode) {
case 'Contrast_Dev':
@@ -407,12 +470,14 @@ watch(
}
break;
case 'yjc_sbtxjy' :
ElMessageBox.alert('重复的初始化操作!', '检测失败', {
confirmButtonText: '确定',
type: 'error',
})
setLogList('error', '重复的初始化操作!')
stopTimeCount()
if (newValue.code == 10552) {
ElMessageBox.alert('重复的初始化操作!', '检测失败', {
confirmButtonText: '确定',
type: 'error',
})
setLogList('error', '重复的初始化操作!')
stopTimeCount()
}
break;
}
if (checkStore.selectTestItems.preTest == false && newValue.requestId != 'formal_real') {
@@ -480,9 +545,10 @@ watch(
}
if (newValue.code == 25007) {
// 设置闪变项目为LOADING状态
const flickerResultItem = checkResult.find(item => item.code === 'flicker_data')
const flickerResultItem = checkResult.find(item => item.code === 'F')
if (flickerResultItem) {
flickerResultItem.devices.forEach(device => {
device.chnResult.fill(CheckData.ChnCheckResultEnum.LOADING)
@@ -497,7 +563,7 @@ watch(
scriptName: item.scriptName,
devices: []
}
// 特殊处理录波项目 - 如果是25005消息且当前项目是录波项目则使用已设置的状态
if ((newValue.code == 25005 || newValue.code == 25006) && item.code === 'wave_data') {
@@ -506,13 +572,16 @@ watch(
temp.devices = [...existingWaveItem.devices] // 保留已设置的devices
}
} // 特殊处理闪变项目 - 如果是25007消息且当前项目是闪变项目则使用已设置的状态
else if (newValue.code == 25007 && item.code === 'PST') {
const existingFlickerItem = checkResult.find(checkItem => checkItem.scriptType === 'PST')
else if (newValue.code == 25007 && item.code === 'F') {
const existingFlickerItem = checkResult.find(checkItem => checkItem.scriptName === '闪变')
if (existingFlickerItem) {
temp.devices = [...existingFlickerItem.devices] // 保留已设置的devices
}
}
else {
// 找到message中所有scriptName与当前item.code匹配的项
const matchedDevices = message
.filter((msg: any) => msg.scriptName === item.code)
@@ -526,7 +595,7 @@ watch(
temp.devices.push(...matchedDevices)
// 对于未匹配到的设备,也要添加占位符(特别是录波项目)
if (item.code === 'wave_data' || item.code === 'PST') {
if (item.code === 'wave_data' || item.code === 'F') {
deviceList.forEach(device => {
const isDeviceExist = matchedDevices.some((matchedDevice: any) => matchedDevice.deviceId === device.deviceId)
if (!isDeviceExist) {
@@ -535,7 +604,7 @@ watch(
deviceId: device.deviceId,
deviceName: device.deviceName,
chnResult: new Array(checkStore.chnNumList.length).fill(
item.code === 'wave_data' ?
item.code === 'wave_data' || item.code === 'F' ?
CheckData.ChnCheckResultEnum.UNKNOWN :
CheckData.ChnCheckResultEnum.UNKNOWN
)
@@ -686,7 +755,7 @@ const initScriptData = async () => {
// 保存脚本数据并设置总数
scriptData.push(...temp)
checkTotal = scriptData.length
console.log('shul',checkTotal)
}
// 初始化设备列表
const initDeviceList = () => {
@@ -696,7 +765,6 @@ const initDeviceList = () => {
// 初始化检测结果 (详细到通道)
const initCheckResult = (defaultValue: CheckData.ChnCheckResultEnum) => {
let result: CheckData.ScriptChnItem[] = []
scriptData.forEach(item => {
let temp: CheckData.ScriptChnItem = {
scriptType: item.id,
@@ -709,7 +777,7 @@ const initCheckResult = (defaultValue: CheckData.ChnCheckResultEnum) => {
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
for (let j = 0; j < checkStore.chnNumList.length; j++) {
// 录波项目初始化为UNKNOWN状态其他项目使用传入的默认值
if ((item.code === 'wave_data' || item.code === 'PST')&& checkTotal > 1) {
if ((item.code === 'wave_data' || item.code === 'F')&& checkTotal > 1) {
tempChnResult.push(CheckData.ChnCheckResultEnum.UNKNOWN)
} else {
tempChnResult.push(defaultValue)

View File

@@ -374,7 +374,7 @@ const handleSubmitFast = async () => {
})
preTestStatus.value = 'start'
if (checkStore.selectTestItems.test) {
console.log(111111)
testRef.value.initializeParameters()
testRef.value.showTestLog()
@@ -413,12 +413,12 @@ const emit = defineEmits<{
}>()
watch(preTestStatus, function (newValue, oldValue) {
console.log('预检测状态', newValue, oldValue)
ActiveStatue.value = newValue
})
watch(TestStatus, function (newValue, oldValue) {
console.log('正式检测状态', newValue, oldValue)
ActiveStatue.value = newValue
})
@@ -431,13 +431,11 @@ watch(stepsActiveIndex, function (newValue, oldValue) {
testRef.value.startTimeCount()
}, 500)
}
console.log('步骤索引', newValue, oldValue)
})
watch(ActiveStatue, function (newValue, oldValue) {
console.log('当前步骤状态-----', newValue)
console.log('stepsActiveIndex-----', stepsActiveIndex.value)
console.log('stepsTotalNum----', stepsTotalNum.value)
if (newValue === 'error') {
stepsActiveIndex.value = stepsTotalNum.value + 1
nextStepText.value = '检测失败'
@@ -466,7 +464,7 @@ watch(ActiveStatue, function (newValue, oldValue) {
})
const handleQuit = () => {
console.log('handleQuit', ActiveStatue.value)
if (
ActiveStatue.value !== 'success' &&
ActiveStatue.value !== 'waiting' &&
@@ -486,13 +484,13 @@ const handlePause = () => {
testRef.value?.handlePause()
}
const sendPause = () => {
console.log('发起暂停请求')
TestStatus.value = 'paused_ing'
pauseTest()
}
const sendResume = () => {
console.log('发起继续检测请求')
resumeTest({
userPageId: JwtUtil.getLoginName(),
@@ -509,7 +507,7 @@ const sendResume = () => {
}
const sendReCheck = () => {
console.log('发送重新检测指令')
startPreTest({
userPageId: JwtUtil.getLoginName(),
devIds: checkStore.devices.map(item => item.deviceId),
@@ -524,7 +522,7 @@ const sendReCheck = () => {
checkStore.selectTestItems.test
]
}).then(res => {
console.log(res)
if (res.code === 'A001014') {
ElMessageBox.alert('装置配置异常', '初始化失败', {
confirmButtonText: '确定',
@@ -558,17 +556,17 @@ const nextStep = () => {
stepsActiveIndex.value++
for (let selectTestItemsKey in checkStore.selectTestItems) {
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
console.log('selectTestItemsKey1')
stepsActiveView.value = idx
stepsActive.value = idx
return
}
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
console.log('selectTestItemsKey2')
tempStep--
}
console.log('selectTestItemsKey3', idx)
idx++
}
}

View File

@@ -258,7 +258,7 @@ const handleNodeClick = async (data: any) => {
currentDesc.value = data.sourceDesc
scriptType = data.scriptType ?? scriptType
console.log('点击左侧树节点触发事件handleNodeClick', checkIndex.value)
if (checkIndex.value !== '') {
await updateTableData()
activeTab.value = 'resultTab'
@@ -267,7 +267,7 @@ const handleNodeClick = async (data: any) => {
}
const handleErrorSysChange = async () => {
console.log('切换误差体系', formContent.errorSysId)
changeErrorSystem({
planId: checkStore.plan.id,
scriptId: checkStore.plan.scriptId,
@@ -303,7 +303,7 @@ watch(
)
const handleChnNumChange = async () => {
console.log('通道号', formContent.chnNum)
// 发起请求,查询该测试项的检测结果
const { data: resTreeDataTemp }: { data: CheckData.TreeItem[] } = await getTreeData({
scriptId: checkStore.plan.scriptId,
@@ -330,7 +330,7 @@ watch(currentCheckItem, (newVal, oldVal) => {
if (newVal.length == 2) {
key += '_' + newVal[1]
}
console.log('当前检测项', key)
doCurrentCheckItemUpdate(key)
} else {
activeTab.value = 'resultTab'
@@ -618,7 +618,7 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
})
}
Object.assign(checkResultData, result)
console.log('检测结果', checkResultData)
}
const exportRawDataHandler = () => {
@@ -661,7 +661,7 @@ const setRawData = (data: CheckData.RawDataItem[]) => {
})
rawTableData.length = 0
Object.assign(rawTableData, data)
console.log('原始数据', rawTableData)
}
const dataToShow = (num: number): string => {
if (num == null || num == undefined) {

View File

@@ -155,7 +155,7 @@ const handleConnectEnd = (params: any) => {
}
const handleConnect = (params: any) => {
console.log('连接信息:', params)
const sourceNode = nodes.value.find(node => node.id === params.source)
const targetNode = nodes.value.find(node => node.id === params.target)

View File

@@ -233,8 +233,7 @@ watch(testStatus, function (newValue, oldValue) {
* 3. 表格数据的实时更新
*/
watch(webMsgSend, function (newValue, oldValue) {
console.log('webMsgSend---code', newValue.code)
console.log('webMsgSend---requestId', newValue.requestId)
// 只有在非等待状态下才处理WebSocket消息
if (testStatus.value !== 'waiting') {
@@ -325,8 +324,7 @@ watch(webMsgSend, function (newValue, oldValue) {
TableInit();
} else {
// ==================== 特定业务消息处理 ====================
console.log('显示东西code', newValue.code)
console.log('显示东西requestId', newValue.requestId)
switch (newValue.requestId) {
// 处理源通讯校验相关消息
case 'yjc_ytxjy':
@@ -443,7 +441,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
// ★★★ 处理系数校准核心业务消息 ★★★
case 'Coefficient_Check':
console.log("Coefficient_Checkactive", active.value);
// ==================== 第1阶段大电压/电流系数下装 ====================
switch (newValue.operateCode) {
@@ -523,7 +521,7 @@ watch(webMsgSend, function (newValue, oldValue) {
switch (newValue.operateCode) {
case 'DATA_CHNFACTOR$02':
// 接收并更新表格中的系数校准数据
console.log('表格', name.value)
// 遍历所有设备,找到匹配的表格项并更新数据
for (let i = 0; i < name.value.length; i++) {
@@ -594,17 +592,16 @@ watch(webMsgSend, function (newValue, oldValue) {
firstCoefficientVO.aI = newValue.data.aI;
firstCoefficientVO.bI = newValue.data.bI;
firstCoefficientVO.cI = newValue.data.cI;
console.log(newValue.data.devName + '对象:', firstCoefficientVO);
activeIndex.value++; // 更新活跃索引
} else {
console.log('未找到匹配的' + newValue.data.devName + '对象');
//console.log('未找到匹配的' + newValue.data.devName + '对象');
}
} else {
console.log(newValue.data.devName + '数组为空');
//console.log(newValue.data.devName + '数组为空');
}
} else {
console.log('未找到' + newValue.data.devName + '对应的数组');
//console.log('未找到' + newValue.data.devName + '对应的数组');
}
}
break;
@@ -655,7 +652,7 @@ watch(webMsgSend, function (newValue, oldValue) {
* 通知父组件检测失败,重置相关状态
*/
const TableInit = () => {
console.log("出错系数检测",active.value);
// 通知父组件系数校准失败
emit('update:testStatus', 'error')
}
@@ -667,7 +664,7 @@ const TableInit = () => {
* @param desc 描述:'系数下装' | '系数校准'
*/
const tableLoading = (type: string, desc: string) => {
console.log('转动',channel.value)
// 遍历所有设备
for (let i = 0; i < channel.value.length; i++) {
@@ -688,7 +685,7 @@ const tableLoading = (type: string, desc: string) => {
}
}
} else {
console.log('不转了')
//console.log('不转了')
}
}
}
@@ -868,7 +865,7 @@ const handleSubmit = async () => {
isButtonDisabled.value = true; // 禁用按钮,防止重复提交
tableLoading('big', '系数下装') // 开启大幅值系数下装的加载动画
active.value++; // 步骤进度+1进入第一个校准阶段
console.log('开始检测active.value', active.value)
};
/**

View File

@@ -389,7 +389,7 @@ watch(webMsgSend, function (newValue, oldValue) {
ts.value = 'success'
}
activeIndex.value = 5
console.log("@@@@", ts.value)
break
}
break;

View File

@@ -86,7 +86,7 @@ const resultData = ref([
])
const handleClick = (row: any) => {
console.log(111)
DataCheckDialogVisible.value = true
}

View File

@@ -468,14 +468,14 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{
prop: 'recheckNum',
label: '检测次数',
minWidth: 100,
minWidth: 110,
sortable: true,
isShow: modeStore.currentMode != '比对式'
},
{
prop: 'checkState',
label: '检测状态',
minWidth: 100,
minWidth: 110,
sortable: true,
isShow: checkStateShow,
render: scope => {
@@ -485,7 +485,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{
prop: 'checkResult',
label: '检测结果',
minWidth: 100,
minWidth: 110,
sortable: true,
render: scope => {
if (scope.row.checkResult === 0) {
@@ -501,7 +501,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{
prop: 'reportState',
label: '报告状态',
minWidth: 100,
minWidth: 110,
sortable: true,
render: scope => {
if (scope.row.reportState === 0) {
@@ -519,7 +519,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{
prop: 'factorCheckResult',
label: '系数校准结果',
minWidth: 100,
minWidth: 140,
sortable: true,
isShow: factorCheckShow.value && appSceneStore.currentScene === '1',
render: scope => {
@@ -595,7 +595,7 @@ const handleRefresh = () => {
// 表格排序
const sortTable = ({ newIndex, oldIndex }: { newIndex?: number; oldIndex?: number }) => {
console.log(newIndex, oldIndex) // 避免未使用参数警告
ElMessage.success('修改列表排序成功')
}

View File

@@ -16,7 +16,7 @@ interface User {
address: string
}
const handleClick = (row:any) => {
console.log(111)
};
const tableRowClassName = ({
row,

View File

@@ -303,7 +303,7 @@ let count = 0
// 监听WebSocket消息变化处理各种检测状态和错误
watch(webMsgSend, function(newValue, oldValue) {
console.log('webMsgSend', newValue)
// 只在非等待状态下处理消息
if (testStatus.value !== 'waiting') {
// 步骤4正式检测阶段的消息处理
@@ -637,7 +637,7 @@ watch(webMsgSend, function(newValue, oldValue) {
break
// 检测结束
case 'Quit':
console.log('检测结束')
break
}
}
@@ -1113,7 +1113,7 @@ const pauseSuccessCallback = () => {
log: `${new Date().toLocaleString()}:暂停检测`,
})
stopTimeCount()
console.log('暂停中')
}
@@ -1123,7 +1123,7 @@ const handleResumeTest = () => {
startData.value = new Date()
testLogList.push({ type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!` })
resumeTimeCount()
console.log('开始继续检测')
}
// ========== 测试项索引管理函数 ==========

View File

@@ -325,7 +325,7 @@ const handleSubmitFast = () => {
return
}
console.log('handleSubmit', stepsActive.value, TestStatus.value)
// 根据当前激活的步骤执行对应的检测逻辑
switch (stepsActive.value) {
@@ -442,28 +442,28 @@ const emit = defineEmits<{
// ====================== 状态监听器 ======================
// 监听各个检测步骤的状态变化,并同步到总体状态
watch(preTestStatus, function (newValue, oldValue) {
console.log('预检测状态变化:', newValue, oldValue)
ActiveStatue.value = newValue // 同步到总体状态
})
watch(timeTestStatus, function (newValue, oldValue) {
console.log('守时检测状态变化:', newValue, oldValue)
ActiveStatue.value = newValue // 同步到总体状态
})
watch(channelsTestStatus, function (newValue, oldValue) {
console.log('系数校准状态变化:', newValue, oldValue)
ActiveStatue.value = newValue // 同步到总体状态
})
watch(TestStatus, function (newValue, oldValue) {
console.log('正式检测状态变化:', newValue, oldValue)
ActiveStatue.value = newValue // 同步到总体状态
})
// 监听总体状态变化,处理步骤切换和错误状态
watch(ActiveStatue, function (newValue, oldValue) {
console.log('总体状态变化:', newValue, oldValue)
// 处理错误状态
if (newValue === 'error') {
@@ -474,21 +474,21 @@ watch(ActiveStatue, function (newValue, oldValue) {
// 处理成功完成状态(已到达最后一个检测步骤)
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
stepsActiveIndex.value += 2 // 跳到完成状态
console.log('success')
nextStepText.value = '检测完成'
}
// 处理连接超时状态
if (newValue === 'connect_timeout') {
stepsActiveIndex.value += 2 // 跳过当前步骤
console.log('connect_timeout')
nextStepText.value = '连接超时'
}
// 处理暂停超时状态
if (newValue === 'pause_timeout') {
stepsActiveIndex.value += 2 // 跳过当前步骤
console.log('pause_timeout')
nextStepText.value = '暂停超时'
}
@@ -504,7 +504,7 @@ watch(ActiveStatue, function (newValue, oldValue) {
* 处理退出检测
*/
const handleQuit = () => {
console.log('handleQuit', ActiveStatue.value)
// 可以直接关闭的安全状态:未检测、检测完成、检测失败或异常情况
const safeExitStates = [
@@ -543,7 +543,7 @@ const handlePause = () => {
* 发送暂停指令
*/
const sendPause = () => {
console.log('发起暂停请求')
TestStatus.value = 'paused_ing' // 设置为暂停中状态
pauseTest() // 调用暂停API
@@ -553,7 +553,7 @@ const sendPause = () => {
* 发送继续检测指令
*/
const sendResume = () => {
console.log('发起继续检测请求')
// 调用继续检测API
resumeTest({
userPageId: JwtUtil.getLoginName(),

View File

@@ -268,7 +268,7 @@ function addMillisecondsToDate(dateString: string, millisecondsToAdd: number): D
watch(activeIndex, function (newValue, oldValue) {
console.log(activeIndex.value,111,stepsIndex.value,222)
if (activeIndex.value === 1) {
startTime.value = formatDateTime(new Date());

View File

@@ -1,96 +1,21 @@
<template>
<!-- style=" height: calc(100vh - 120px) !important;" -->
<div class="homeView">
<model v-if="!authStore.showMenuFlag"></model>
<dashboard v-if="authStore.showMenuFlag"></dashboard>
</div>
<!-- <div class="main">
<div class="main_container">
<div class="mode" v-for="(item, index) in modeList" :key="index">
<div class="mode_top">
<div class="mode_name">
<p>
{{ item.name }}
</p>
</div>
<div class="test_button">
<el-button
size="small"
dictType="primary"
@click="handelOpen(item.isActive)"
>进入检测</el-button
>
</div>
</div>
<div class="mode_img">
<img :src="item.img" />
</div>
</div>
<div class="homeView">
<model v-if="!authStore.showMenuFlag"></model>
<dashboard v-if="authStore.showMenuFlag"></dashboard>
</div>
</div> -->
</template>
<script lang="ts" setup>
import { useRouter } from "vue-router";
import { ElMessage } from "element-plus";
import { useAuthStore } from "@/stores/modules/auth";
import { useAuthStore } from '@/stores/modules/auth'
import model from "./tabs/model.vue";
import dashboard from "./tabs/dashboard.vue";
import { onMounted, ref } from "vue";
// defineOptions({
// name: 'home'
// })
const authStore = useAuthStore();
import model from './tabs/model.vue'
import dashboard from './tabs/dashboard.vue'
const activeIndex = ref("1-1");
const router = useRouter();
const modeList = [
{
name: "模拟式模式",
code:"模拟式",
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
isActive: true,
},
{
name: "数字式模式",
code:"数字式",
subName: "启用数字检测计划",
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
isActive: false,
},
{
name: "比对式模式",
code:"比对式",
subName: "启用比对式检测计划",
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
isActive: false,
},
];
const handelOpen = async (isActive: any) => {
await authStore.setShowMenu();
return;
// if (isActive) {
// router.push({ path: "/static" });
// } else {
// ElMessage({
// message: "当前模式未配置",
// type: "warning",
// });
// }
};
const handleSelect = (key: string, keyPath: string[]) => {
//console.log(key, keyPath);
};
onMounted(() => {
//console.log(111);
});
const authStore = useAuthStore()
</script>
<style lang="scss" scoped>
.homeView{
width: 100%;
// height: calc(100vh - 120px);
height: 100%;
.homeView {
width: 100%;
// height: calc(100vh - 120px);
height: 100%;
}
</style>

View File

@@ -1,288 +1,264 @@
<!-- 模式切换页面 -->
<template>
<div class="main_container box">
<!-- :style="{
height: authStore?.showMenuFlag
? 'calc(100vh - 165px)'
: 'calc(100vh - 125px)',
}" -->
<div class="main_container box">
<el-carousel :interval="5000" type="card" style="width: 60%; margin-left: 20%; height: 70%">
<el-carousel-item
class="mode"
:class="{ modeBG: index != 0 }"
v-for="(item, index) in modeList"
:key="index"
>
<div class="mode_top">
<div class="mode_name">
{{ item.name }}
</div>
</div>
<el-carousel :interval="5000" type="card" style="width: 60%;margin-left: 20%;height: 70%;">
<el-carousel-item class="mode" :class="{ modeBG: index != 0 }" v-for="(item, index) in modeList" :key="index">
<div class="mode_top">
<div class="mode_name">
{{ item.name }}
</div>
</div>
<div class="mode_img">
<img :src="item.img" />
</div>
<div class="test_button">
<el-button size="large" type="primary" @click="handelOpen(item)"
:disabled="item.isActive == false">进入检测</el-button>
</div>
</el-carousel-item>
</el-carousel>
<!-- <div class="mode" :class="{ modeBG: index != 0 }" v-for="(item, index) in modeList" :key="index">
<div class="mode_top">
<div class="mode_name">
<p>
{{ item.name }}
</p>
</div>
<div class="test_button">
<el-button size="small" type="primary" @click="handelOpen(item)"
:disabled="item.isActive == false">进入检测</el-button>
</div>
</div>
<div class="mode_img">
<img :src="item.img" />
</div>
</div> -->
</div>
<div class="mode_img">
<img :src="item.img" />
</div>
<div class="test_button">
<el-button size="large" type="primary" @click="handelOpen(item)" :disabled="!item.activated">
进入检测
</el-button>
</div>
</el-carousel-item>
</el-carousel>
</div>
</template>
<script lang="ts" setup>
import { useRouter } from "vue-router";
import { ElMessage } from "element-plus";
import { useAuthStore } from "@/stores/modules/auth";
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
import { ref } from "vue";
import {getCurrentScene} from "@/api/user/login";
import { useAuthStore } from '@/stores/modules/auth'
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { getCurrentScene } from '@/api/user/login'
const authStore = useAuthStore()
const modeStore = useModeStore() // 使用模式 store
const AppSceneStore = useAppSceneStore()
const activateInfo = authStore.activateInfo
const isActivateOpen = import.meta.env.VITE_ACTIVATE_OPEN
const authStore = useAuthStore();
const modeStore = useModeStore(); // 使用模式 store
const AppSceneStore = useAppSceneStore();
const activeIndex = ref("1-1");
const router = useRouter();
const modeList = [
{
name: "模拟式模块",
code: "模拟式",
subName: "未启用模拟式检测计划",
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
isActive: true,
},
{
name: "数字式模块",
code: "数字式",
subName: "启用数字检测计划",
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
isActive: true,
},
{
name: "比对式模块",
code: "比对式",
subName: "启用比对式检测计划",
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
isActive: true,
},
];
{
name: '模拟式模块',
code: '模拟式',
subName: '未启用模拟式检测计划',
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
activated:
isActivateOpen === 'true'
? activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1
: true
},
{
name: '数字式模块',
code: '数字式',
subName: '启用数字检测计划',
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
activated:
isActivateOpen === 'true'
? activateInfo.digital.apply === 1 && activateInfo.digital.permanently === 1
: true
},
{
name: '比对式模块',
code: '比对式',
subName: '启用比对式检测计划',
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
activated:
isActivateOpen === 'true'
? activateInfo.contrast.apply === 1 && activateInfo.contrast.permanently === 1
: true
}
]
const handelOpen = async (item: any) => {
modeStore.setCurrentMode(item.code); // 将模式code存入 store
const {data:scene} = await getCurrentScene(); // 获取当前场景
// AppSceneStore.setCurrentMode(scene+'');//0省级平台1设备出厂2研发自测
AppSceneStore.setCurrentMode(scene+'');//0省级平台1设备出厂2研发自测
await authStore.setShowMenu();
await authStore.getAuthMenuList();
return;
// if (isActive) {
// router.push({ path: "/static" });
// } else {
// ElMessage({
// message: "当前模式未配置",
// type: "warning",
// });
// }
};
if (!item.activated) {
ElMessage.warning(`${item.name}未激活`)
return
}
modeStore.setCurrentMode(item.code) // 将模式code存入 store
const { data: scene } = await getCurrentScene() // 获取当前场景
AppSceneStore.setCurrentMode(scene + '') //0省级平台1设备出厂2研发自测
await authStore.setShowMenu()
await authStore.getAuthMenuList()
return
}
const handleSelect = (key: string, keyPath: string[]) => {
console.log(key, keyPath);
};
}
onMounted(() => {
console.log();
});
})
</script>
<style lang="scss" scoped>
.box {
background: #ededed;
// background-image: url("/src/assets/images/dashboard/DT.jpg");
// /* 背景图垂直、水平均居中 */
// // background-position: center center;
// /* 背景图不平铺 */
// background-repeat: no-repeat;
// /* 当内容高度大于图片高度时背景图像的位置相对于viewport固定 */
// background-attachment: fixed;
// /* 让背景图基于容器大小伸缩 */
// background-size: cover;
background: #ededed;
// background-image: url("/src/assets/images/dashboard/DT.jpg");
// /* 背景图垂直、水平均居中 */
// // background-position: center center;
// /* 背景图不平铺 */
// background-repeat: no-repeat;
// /* 当内容高度大于图片高度时背景图像的位置相对于viewport固定 */
// background-attachment: fixed;
// /* 让背景图基于容器大小伸缩 */
// background-size: cover;
}
.main_container {
width: 100%;
// height: calc(100vh - 165px);
height: 100%;
// overflow-y: auto;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
width: 100%;
// height: calc(100vh - 165px);
height: 100%;
// overflow-y: auto;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
.mode {
height: 99.5% !important;
border: 1px solid #eee;
border-radius: 6px;
background: linear-gradient(
180deg,
rgba(0, 153, 255, 1) 0%,
rgba(0, 153, 255, 1) 0%,
rgba(0, 102, 255, 1) 65%,
rgba(0, 51, 255, 1) 100%,
rgba(0, 51, 255, 1) 100%
);
.mode {
position: absolute;
height: 99.5% !important;
border: 1px solid #eee;
border-radius: 6px;
background: linear-gradient(180deg,
rgba(0, 153, 255, 1) 0%,
rgba(0, 153, 255, 1) 0%,
rgba(0, 102, 255, 1) 65%,
rgba(0, 51, 255, 1) 100%,
rgba(0, 51, 255, 1) 100%);
// padding: 40px 0;
.mode_top {
width: 100%;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
background: #008aff;
border-radius: 6px 6px 0 0;
position: absolute;
.mode_name {
width: 100%;
height: 40px;
font-family: '微软雅黑 Bold', '微软雅黑', '微软雅黑', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 20px;
color: #ffffff;
text-align: center;
line-height: 40px;
padding-left: 10px;
// margin-top: 20px;
.mode_subName {
font-family: '微软雅黑', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 12px;
color: #ffffff;
line-height: 40px;
text-align: center;
padding: 5px 0 0 10px;
// margin-top: 10px;
}
}
// padding: 40px 0;
.mode_top {
width: 100%;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
background: #008aff;
border-radius: 6px 6px 0 0;
.test_button {
display: flex;
text-align: center;
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 5px;
}
}
.mode_name {
width: 100%;
height: 40px;
font-family: "微软雅黑 Bold", "微软雅黑", "微软雅黑", sans-serif;
font-weight: 700;
.mode_img {
width: 100%;
height: auto;
display: flex;
align-items: center;
justify-content: center;
// padding: 30px 0 50px;
margin-top: 100px;
// margin-bottom: 100px;
img:nth-child(1) {
width: 60%;
height: auto;
display: block;
}
img:nth-child(2) {
width: 70%;
height: auto;
display: block;
}
img:nth-child(3) {
width: 60%;
height: auto;
display: block;
}
}
.mode_test {
width: 100%;
height: 40px;
display: flex;
justify-content: center;
margin-bottom: 20px;
.test_button:hover {
background: rgba(0, 0, 0, 0.2);
}
}
}
.test_button {
position: absolute;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
border-radius: 5px;
font-family: '微软雅黑', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 20px;
color: #ffffff;
color: #fff;
text-align: center;
line-height: 40px;
padding-left: 10px;
// margin-top: 20px;
cursor: pointer;
}
.mode_subName {
font-family: "微软雅黑", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 12px;
color: #ffffff;
line-height: 40px;
text-align: center;
padding: 5px 0 0 10px;
// margin-top: 10px;
.mode:nth-child(3n + 3) {
background: linear-gradient(
180deg,
rgba(0, 153, 255, 1) 0%,
rgba(0, 153, 255, 1) 0%,
rgba(0, 102, 255, 1) 39%,
rgba(102, 51, 204, 1) 100%,
rgba(102, 51, 204, 1) 100%
);
}
.mode_off {
.mode_name,
.mode_subName,
.test_button {
color: #fff !important;
}
}
.test_button {
display: flex;
text-align: center;
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 5px;
}
.test_button:hover {
// background: rgba(0, 0, 0, 0.2) !important;
cursor: pointer;
}
}
.mode_img {
width: 100%;
height: auto;
display: flex;
align-items: center;
justify-content: center;
// padding: 30px 0 50px;
margin-top: 100px;
// margin-bottom: 100px;
img:nth-child(1) {
width: 60%;
height: auto;
display: block;
}
img:nth-child(2) {
width: 70%;
height: auto;
display: block;
}
img:nth-child(3) {
width: 60%;
height: auto;
display: block;
}
}
.mode_test {
width: 100%;
height: 40px;
display: flex;
justify-content: center;
margin-bottom: 20px;
.test_button:hover {
background: rgba(0, 0, 0, 0.2);
}
}
}
.test_button {
position: absolute;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
border-radius: 5px;
font-family: "微软雅黑", sans-serif;
font-weight: 400;
font-style: normal;
color: #fff;
text-align: center;
line-height: 40px;
cursor: pointer;
}
.mode:nth-child(3n + 3) {
background: linear-gradient(180deg,
rgba(0, 153, 255, 1) 0%,
rgba(0, 153, 255, 1) 0%,
rgba(0, 102, 255, 1) 39%,
rgba(102, 51, 204, 1) 100%,
rgba(102, 51, 204, 1) 100%);
}
.mode_off {
.mode_name,
.mode_subName,
.test_button {
color: #fff !important;
}
.test_button:hover {
// background: rgba(0, 0, 0, 0.2) !important;
cursor: pointer;
}
}
}
:deep(.el-sub-menu__title) {
border-bottom: 0 !important;
outline: none !important;
border-bottom: 0 !important;
outline: none !important;
}
// .modeBG {
@@ -297,13 +273,12 @@ onMounted(() => {
// ;
// }
// }
:deep(.el-carousel__container) {
height: 100%;
height: 100%;
}
:deep(.el-carousel__item) {
position: relative;
position: relative;
}
</style>

View File

@@ -96,12 +96,20 @@ const login = (formEl: FormInstance | undefined) => {
username: forge.util.encode64(loginForm.username),
password: encryptPassword(loginForm.password)
})
ElNotification({
title: getTimeState(),
message: '登录成功',
type: 'success',
duration: 3000
})
userStore.setAccessToken(data.accessToken)
userStore.setRefreshToken(data.refreshToken)
userStore.setUserInfo(data.userInfo)
if (loginForm.checked) {
userStore.setExp(Date.now() + 1000 * 60 * 60 * 24 * 30)
}
// 设置激活信息
await authStore.setActivateInfo()
const response = await getDictList()
const dictData = response.data as unknown as Dict[]
await dictStore.initDictData(dictData)
@@ -109,19 +117,12 @@ const login = (formEl: FormInstance | undefined) => {
await initDynamicRouter()
// 3.清空 tabs、keepAlive 数据
tabsStore.setTabs([])
keepAliveStore.setKeepAliveName([])
// 4.跳转到首页
router.push(HOME_URL)
// 5.登录默认不显示菜单和导航栏
authStore.resetAuthStore()
ElNotification({
title: getTimeState(),
message: '登录成功',
type: 'success',
duration: 3000
})
await tabsStore.setTabs([])
await keepAliveStore.setKeepAliveName([])
// 登录默认不显示菜单和导航栏
await authStore.resetAuthStore()
// 跳转到首页
await router.push(HOME_URL)
} finally {
loading.value = false
}

View File

@@ -299,7 +299,7 @@ watch(
if (props.formControl.scriptId != '') {
nextTick(async () => {
await getTree()
console.log('props.formControl.scriptId')
treeRef.value.checkTree()
})
}

View File

@@ -129,11 +129,9 @@ function findFirstLeafNode(node: any): any {
}
const checkTree = () => {
console.log('checkTree11')
console.log('checkTree22',props.treeData.length)
console.log('checkTree33',treeRef.value)
if (props.treeData.length > 0 && treeRef.value) {
console.log('checkTree44')
const firstNode = props.treeData[0];
const firstLeafNode = findFirstLeafNode(firstNode);
const firstLeafNodeId = firstLeafNode.id;
@@ -143,7 +141,7 @@ const checkTree = () => {
// 确保在组件挂载后也执行一次
onMounted(() => {
console.log('onMounted',props.treeData);
nextTick(() => {
checkTree()
});

View File

@@ -184,7 +184,7 @@ onMounted(async () => {
})
watch(webMsgSend, function (newValue, oldValue) {
console.log('webMsgSend:', newValue)
if (newValue.requestId.includes('formal_real&&') && newValue.operateCode === 'OPER_GATHER') {
if (newValue.code === 10200) {
ElMessage.success('启动成功!')
@@ -195,7 +195,7 @@ watch(webMsgSend, function (newValue, oldValue) {
ElMessage.error('启动失败!')
startDisabeld.value = false
pauseDisabled.value = true
console.log('错误信息:',webMsgSend)
}
}
if (newValue.requestId.includes('close_source') && newValue.operateCode === 'CLOSE_GATHER') {
@@ -211,7 +211,7 @@ watch(webMsgSend, function (newValue, oldValue) {
ElMessage.error('停止失败!')
startDisabeld.value = true
pauseDisabled.value = false
console.log('错误信息:',webMsgSend)
}
}
switch (newValue.requestId) {

View File

@@ -138,7 +138,7 @@ const columns = reactive<ColumnProps<Monitor.ResPqMon>[]>([
const emit = defineEmits(['get-parameter'])
const getParameter = (data: Monitor.ResPqMon) => {
console.log('data', data)
if (title_Type.value === 'edit') {
// 编辑:替换已有的数据
const index = tableData.value.findIndex(item => item.id === data.id)

View File

@@ -85,7 +85,7 @@ const handleInputRetainTime = value => {
props.childForm[0].dipData.retainTime = 300
emit('setRetainTime', 300 )
}else{
console.log(props);
emit('setRetainTime', value )
}

View File

@@ -37,7 +37,7 @@ const defaultProps = {
const activeName = ref('')
const childActiveName = ref('')
const handleNodeClick = (data, node) => {
console.log('handleNodeClick', data, node)
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
const parents = getParentNodes(node, [])
parents.pop()

View File

@@ -53,7 +53,7 @@
const proTable = ref<ProTableInstance>()
const getTableList = (params: any) => {
console.log("getTableList",params)
let newParams = JSON.parse(JSON.stringify(params))
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
newParams.pattern = patternId

View File

@@ -128,7 +128,7 @@ const router = useRouter()
const value1 = ref('')
const value2 = ref('')
const tableHeight = ref(0)
console.log(window.innerHeight, '+++++++++')
tableHeight.value = window.innerHeight - 630
//下拉框数据
@@ -443,8 +443,7 @@ const handleRefresh = () => {
}
// 表格拖拽排序
const sortTable = ({ newIndex, oldIndex }: { newIndex?: number; oldIndex?: number }) => {
console.log(newIndex, oldIndex)
console.log(proTable.value?.tableData)
ElMessage.success('修改列表排序成功')
}
@@ -493,7 +492,7 @@ const handleTest = () => {
}
}
onMounted(() => {
console.log(proTable.value?.tableData)
})
defineExpose({ changeActiveTabs })
</script>

View File

@@ -94,7 +94,7 @@ const changeSelect=()=>{
//console.log(treeRef.value.getCheckedKeys());
}
const handleNodeClick = (data) => {
console.log(data);
};
const filterNode = (value: string, data) => {
if (!value) return true;
@@ -105,7 +105,7 @@ const detail = (e: any) => {
emit("jump", e);
};
onMounted(() => {
console.log();
});
defineExpose({ getTreeData,getCurrentIndex });
</script>

View File

@@ -289,7 +289,7 @@ const preTestData = [
// 弹出数据查询页面
const handleClick = (item, index, vvs) => {
//const data = "检测脚本为:"+item.name+";被检设备为:"+item.children.value.devID+";被检通道序号为:"+ item.children.monitorIndex;
console.log(vvs, index, item.name, item.children)
PopupVisible.value = true
showDataPopup.value.open()
}
@@ -379,7 +379,7 @@ const customColors = [
]
//加载进度条
const refreshProgress = () => {
console.log(currentIndex, totalNum, percentage.value)
if (percentage.value < 100) {
percentage.value = Math.trunc((currentIndex / totalNum) * 100)
} else {
@@ -397,7 +397,7 @@ const refreshProgress = () => {
status: 0
})
console.log('检测结束')
if (testModel.value === 'preTest') ElMessage.success('预检测过程全部结束')
else if (testModel.value === 'Test')
//ElMessage.success("正式检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作")
@@ -507,7 +507,7 @@ const handleFinishTest = () => {
// 表格拖拽排序
const sortTable = ({ newIndex, oldIndex }: { newIndex?: number; oldIndex?: number }) => {
console.log(newIndex, oldIndex)
ElMessage.success('修改列表排序成功')
}

View File

@@ -465,7 +465,7 @@ const addTab = (type: string) => {
subPlanFormContent.value = planFormContent.value?.children?.find(
(child: Plan.ReqPlan) => child.id === planId.value
)
console.log('0000---', subPlanFormContent.value)
planPopup.value?.open('edit', subPlanFormContent.value, modeStore.currentMode, 2)
}
}
@@ -531,7 +531,7 @@ const removeTab = async (targetName: TabPaneName) => {
}
// 弹窗打开方法
const open = async (textTitle: string, data: Plan.ReqPlan, pattern: string) => {
console.log('open', data)
dialogVisible.value = true
title.value = textTitle
planTitle.value = data.name
@@ -579,13 +579,13 @@ const handleTabClick = (tab: any) => {
const handleTableDataUpdate = async (newData: any[]) => {
// 👇 处理新数据,例如更新 planFormContent
console.log('handleTableDataUpdate', newData)
const matchedItem = findItemById(newData, planId.value)
if (matchedItem) {
planFormContent.value = matchedItem
console.log('递归匹配成功:', planFormContent.value)
//console.log('递归匹配成功:', planFormContent.value)
} else {
console.warn('未找到匹配的 planId:', planId.value)
// console.warn('未找到匹配的 planId:', planId.value)
}
}
@@ -616,7 +616,7 @@ const handleRemove = async (row: any) => {
ElMessage.warning(`当前设备已被子计划绑定,无法删除!`)
return
}
console.log('shcn', planFormContent.value)
proTable.value?.getTableList() // 刷新当前表格
})
.catch(() => {
@@ -739,7 +739,7 @@ const initSSE = () => {
eventSource.value = http.sse('/sse/createSse')
eventSource.value.onmessage = event => {
console.log('收到消息内容是:', event.data)
const res = JSON.parse(event.data)
progressData.value.percentage = res.data
progressData.value.message = res.message
@@ -763,7 +763,7 @@ const closeEventSource = () => {
if (eventSource.value) {
eventSource.value.close()
eventSource.value = null
console.log('SSE连接已关闭')
//console.log('SSE连接已关闭')
}
}

View File

@@ -439,7 +439,7 @@ const convertToTree = (data: Device[], groupBy?: string | undefined) => {
}
const filterNode: FilterNodeMethodFunction = (value: string, data: Tree) => {
if (!value) return true
console.log('data', data)
if (data.id.toString().includes('_')) {
return false
}

View File

@@ -97,7 +97,7 @@ const filterMethod = (query: string, item: { label?: string }) => {
const open = async (data: Plan.ReqPlan) => {
dialogVisible.value = true
planData.value = data
console.log('planData.value', planData.value)
const standardDevList_Result1 = await getUnboundStandardDevList(data)
unboundStandardDevList.value = standardDevList_Result1.data as StandardDevice.ResPqStandardDevice[]

View File

@@ -678,7 +678,7 @@ const save = () => {
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
await updatePlan(formContent)
emit('update:tab')
console.log('更新子计划', formContent)
} else {
formContent.sourceIds = null
await updatePlan(formContent)
@@ -752,7 +752,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
user_Result: any
if (mode.value === '比对式') {
;[
[
PqErrSys_Result,
pqDevList_Result,
pqReportName_Result,
@@ -792,7 +792,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
}
}
} else {
;[pqSource_Result, PqScript_Result, PqErrSys_Result, pqDevList_Result, pqReportName_Result] =
[pqSource_Result, PqScript_Result, PqErrSys_Result, pqDevList_Result, pqReportName_Result] =
await Promise.all([
getTestSourceList(data),
getPqScriptList(data),
@@ -825,7 +825,10 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
formContent.errorSysId = pqErrSysList.value[0]?.id ?? ''
formContent.sourceIds = pqSourceList.value[0]?.id ?? ''
const datasourceDicts = dictStore.getDictData('Datasource')
formContent.datasourceIds = [datasourceDicts[0]?.code] ?? []
formContent.datasourceIds = datasourceDicts
.filter(item => ['real', 'wave_data'].includes(item.code))
.map(item => item.code)
} else {
//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
@@ -902,7 +905,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
}
}
} else {
;[
[
pqSource_Result,
PqScript_Result,
PqErrSys_Result,
@@ -1052,7 +1055,9 @@ const handleErrorSysChange = async (value: string) => {
})
})
}
formContent.testItems = secondLevelOptions.map(option => option.value)
formContent.testItems = secondLevelOptions
.filter(option => option.label !== '闪变')
.map(option => option.value)
} catch (error) {
formContent.testItems = []
console.error('获取检测项失败:', error)
@@ -1083,7 +1088,9 @@ const loadTestItemsForErrorSys = async (errorSysId: string) => {
label: (res.data as Record<string, string>)[key]
})
})
formContent.testItems = secondLevelOptions.map(option => option.value)
formContent.testItems = secondLevelOptions
.filter(option => option.label !== '闪变')
.map(option => option.value)
}
} catch (error) {
console.error('获取检测项失败:', error)

View File

@@ -43,6 +43,7 @@
v-auth.plan="'analysis'"
icon="DataLine"
:disabled="!scope.isSelected"
v-if=" modeStore.currentMode != '比对式'"
@click="statisticalAnalysisMore(scope.selectedListIds, scope.selectedList)"
>
统计分析
@@ -104,7 +105,7 @@
v-auth.plan="'analysis'"
link
icon="DataLine"
v-if="scope.row.testState == '2'"
v-if="scope.row.testState == '2' && modeStore.currentMode != '比对式'"
@click="statisticalAnalysis(scope.row)"
>
统计分析
@@ -206,13 +207,13 @@ onMounted(async () => {
//假分页后用data刷新
const refreshTable = async () => {
try {
console.log('表格刷新')
patternId.value = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id
const result = await getPlanList({ patternId: patternId.value })
tableData.value = buildTree(result.data as any[])
pageTotal.value = tableData.value.length
updateCurrentPageData(tableData.value)
console.log('表格刷新成功')
} catch (error) {
tableData.value = []
ElMessage.error('获取计划列表失败')
@@ -224,7 +225,7 @@ watch(
() => tableData.value,
newVal => {
if (childrenPlanView.value && newVal) {
console.log('监听 tableData 变化', newVal)
childrenPlanView.value.handleTableDataUpdate?.(newVal)
updateCurrentPageData(newVal)
}
@@ -308,7 +309,7 @@ const updateCurrentPageData = (data = tableData.value) => {
const start = (currentPage.value - 1) * pageSize.value
const end = start + pageSize.value
currentPageData.value = data.slice(start, end)
console.log('currentPageData', currentPageData.value)
}
const dataSourceType = computed(() => {

View File

@@ -57,7 +57,7 @@ const open = (list: any) => {
};
onMounted(() => {
console.log();
});
defineExpose({ open });
</script>

View File

@@ -201,10 +201,10 @@ const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
console.log('submit!')
//console.log('submit!')
close()
} else {
console.log('error submit!', fields)
//console.log('error submit!', fields)
}
})
}
@@ -220,7 +220,7 @@ const options = Array.from({ length: 10000 }).map((_, idx) => ({
label: `${idx + 1}`,
}))
onMounted(() => {
console.log();
});
const dialogVisible = ref<boolean>(false);
const dialogTitle = ref<string>("");
@@ -231,9 +231,7 @@ const open = (title: string) => {
const close=()=>{
dialogVisible.value = false;
}
onMounted(() => {
console.log();
});
defineExpose({ open });
</script>
<style lang="scss" scoped></style>

View File

@@ -391,7 +391,7 @@ const changeStatus = async (row: User.ResUserList) => {
proTable.value?.getTableList()
}
onMounted(() => {
console.log(proTable.value?.tableData)
})
</script>
<style lang="scss" scoped>

View File

@@ -1,55 +1,281 @@
<template>
<el-dialog v-model="dialogVisible" title="程序激活" v-bind="dialogSmall">
<el-form :model="formContent">
<el-form-item label="程序版本号" prop="id" :label-width="100">
<el-input v-model='formContent.id' disabled/>
</el-form-item>
<el-form-item label="模拟式模块" prop="type" :label-width="100">
<el-checkbox v-model="formContent.type" label="已激活"/>
</el-form-item>
<el-form-item label="数字式模块" prop="type" :label-width="100">
<el-checkbox v-model="formContent.type" label="未激活"/>
</el-form-item>
<el-form-item label="比对式模块" prop="type" :label-width="100">
<el-checkbox v-model="formContent.type" label="未激活"/>
</el-form-item>
<el-form-item label="序列号" prop="code" :label-width="100">
<el-input v-model='formContent.code' placeholder="请输入序列号" :rows="2" type="textarea"/>
</el-form-item>
<el-form-item label="注册码" prop="licenseKey" :label-width="100">
<el-input v-model='formContent.licenseKey' placeholder="请输入注册码" :rows="2" type="textarea"/>
</el-form-item>
<el-dialog
v-model="dialogVisible"
title="程序激活"
width="450px"
draggable
:close-on-click-modal="false"
:before-close="beforeClose"
:destroy-on-close="true"
>
<el-form :label-width="100" label-position="left">
<el-form-item label="程序版本号">
<el-text style="margin-left: 82%">{{ 'v' + versionNumber }}</el-text>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="dialogVisible = false">激活</el-button>
</span>
</template>
<el-descriptions
class="mode-descriptions"
v-if="!hadActivationCode"
title="模块激活状态"
size="small"
></el-descriptions>
<el-form
ref="applicationFormRef"
v-if="!hadActivationCode"
:model="applicationForm"
label-position="left"
:label-width="100"
>
<el-form-item
class="mode-item"
v-if="activateInfo.simulate.apply !== 1 || activateInfo.simulate.permanently !== 1"
label="模拟式模块"
prop="simulate.apply"
>
<el-tag disable-transitions type="danger">未激活</el-tag>
<el-checkbox
:false-value="0"
:true-value="1"
class="apply-checkbox"
v-model="applicationForm.simulate.apply"
label="激活"
/>
</el-form-item>
<el-form-item
class="mode-item"
v-if="activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1"
label="模拟式模块"
>
<el-tag class="activated-tag" disable-transitions type="success">已激活</el-tag>
</el-form-item>
<el-form-item
class="mode-item"
v-if="activateInfo.digital.apply !== 1 || activateInfo.digital.permanently !== 1"
label="数字式模块"
prop="digital.apply"
>
<el-tag disable-transitions type="danger">未激活</el-tag>
<el-checkbox
:false-value="0"
:true-value="1"
class="apply-checkbox"
v-model="applicationForm.digital.apply"
label="激活"
/>
</el-form-item>
<el-form-item
class="mode-item"
v-if="activateInfo.digital.apply === 1 && activateInfo.digital.permanently === 1"
label="数字式模块"
>
<el-tag class="activated-tag" disable-transitions type="success">已激活</el-tag>
</el-form-item>
<el-form-item
class="mode-item"
v-if="activateInfo.contrast.apply !== 1 || activateInfo.contrast.permanently !== 1"
label="比对式模块"
prop="contrast.apply"
>
<el-tag disable-transitions type="danger">未激活</el-tag>
<el-checkbox
:false-value="0"
:true-value="1"
class="apply-checkbox"
v-model="applicationForm.contrast.apply"
label="激活"
/>
</el-form-item>
<el-form-item
class="mode-item"
v-if="activateInfo.contrast.apply === 1 && activateInfo.contrast.permanently === 1"
label="比对式模块"
>
<el-tag class="activated-tag" disable-transitions type="success">已激活</el-tag>
</el-form-item>
</el-form>
<el-row v-if="applicationCode">
<el-descriptions class="mode-descriptions" title="设备申请码" size="small"></el-descriptions>
<el-tooltip placement="top-end" effect="light">
<el-input
v-model="applicationCode"
:rows="5"
type="textarea"
readonly
resize="none"
class="code-display"
/>
<template #content>
<el-button size="small" @click="copyCode" icon="DocumentCopy">复制</el-button>
</template>
</el-tooltip>
</el-row>
<el-row v-if="applicationCode || hadActivationCode">
<el-descriptions class="mode-descriptions" title="设备激活码" size="small"></el-descriptions>
<el-input
placeholder="请输入设备激活码"
v-model="activationCode"
:rows="5"
resize="none"
type="textarea"
class="code-input"
/>
</el-row>
<template #footer v-if="!activatedAll">
<div v-if="!applicationCode && !hadActivationCode">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="getApplicationCode">获取申请码</el-button>
<el-button type="primary" @click="hadActivationCode = true">已有激活码</el-button>
</div>
<div v-if="applicationCode || hadActivationCode">
<el-button @click="cancel">取消</el-button>
<el-button :disabled="!activationCode" type="primary" @click="submitActivation">激活</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { type VersionRegister } from "@/api/system/versionRegister/interface";
import { ref } from "vue";
import { dialogSmall } from '@/utils/elementBind'
const formContent = ref<VersionRegister.ResSys_Reg_Res>({
id: '', //版本注册表Id
type: '', //版本类型(模拟式、数字式、比对式)
code: '', //注册码
licenseKey: '', //密钥
expireDate: '', //到期时间
waveRecord: 0,
realTime: 20,
statistics: 5,
flicker: 1,
state: 1, //状态
})
const dialogVisible = ref(false);
const openDialog = () => {
dialogVisible.value = true;
};
defineExpose({ openDialog });
</script>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { version } from '../../../../package.json'
import type { Activate } from '@/api/activate/interface'
import { generateApplicationCode, verifyActivationCode } from '@/api/activate'
import { useAuthStore } from '@/stores/modules/auth'
const authStore = useAuthStore()
const activateInfo = authStore.activateInfo
const versionNumber = ref(version)
const applicationForm = reactive<Activate.ApplicationCodePlaintext>({
simulate: { apply: 0 },
digital: { apply: 0 },
contrast: { apply: 0 }
})
const activatedAll = computed(() => {
return (
activateInfo.simulate.apply === 1 &&
activateInfo.simulate.permanently === 1 &&
activateInfo.digital.apply === 1 &&
activateInfo.digital.permanently === 1 &&
activateInfo.contrast.apply === 1 &&
activateInfo.contrast.permanently === 1
)
})
const applicationFormRef = ref()
const hadActivationCode = ref(false)
const applicationCode = ref('')
const activationCode = ref('')
const dialogVisible = ref(false)
// 获取申请码
const getApplicationCode = async () => {
if (
applicationForm.simulate.apply == 0 &&
applicationForm.digital.apply == 0 &&
applicationForm.contrast.apply == 0
) {
ElMessage.warning('请选择需要激活的模块')
return
}
if (activateInfo.simulate.apply === 1) {
applicationForm.simulate.apply = 1
}
if (activateInfo.digital.apply === 1) {
applicationForm.digital.apply = 1
}
if (activateInfo.contrast.apply === 1) {
applicationForm.contrast.apply = 1
}
const res = await generateApplicationCode(applicationForm)
if (res.code == 'A0000') {
applicationCode.value = res.data as string
}
}
// 复制申请码
const copyCode = async () => {
try {
await navigator.clipboard.writeText(applicationCode.value)
ElMessage.success('已复制到剪贴板')
} catch {
ElMessage.error('复制失败,请手动选择内容')
}
}
const openDialog = () => {
hadActivationCode.value = false
activationCode.value = ''
applicationCode.value = ''
applicationForm.simulate.apply = 0
applicationForm.digital.apply = 0
applicationForm.contrast.apply = 0
dialogVisible.value = true
}
const beforeClose = (done: Function) => {
applicationFormRef.value?.resetFields()
done()
}
const cancel = () => {
applicationFormRef.value?.resetFields()
dialogVisible.value = false
}
const submitActivation = async () => {
const res = await verifyActivationCode(activationCode.value)
if (res.code == 'A0000') {
ElMessage.success('激活成功')
await authStore.setActivateInfo()
window.location.reload()
} else {
ElMessage.error(res.message)
}
}
defineExpose({ openDialog })
</script>
<style scoped>
.apply-checkbox {
margin-left: 62%;
}
.activated-tag {
margin-left: 80%;
}
.code-display,
.code-input {
font-family: consolas;
}
:deep(.el-tag) {
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
:deep(.el-divider__text) {
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.mode-descriptions {
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
margin-top: 15px;
}
:deep(.el-form-item) {
border: 1px solid #e5e7eb;
border-radius: 4px;
padding: 0 10px !important;
margin-bottom: 10px !important;
margin-right: 0 !important;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
:deep(.el-divider--horizontal) {
margin: 10px 0 !important;
margin-top: 20px !important;
}
.mode-item {
transition: background-color 0.2s ease;
}
.mode-item:hover {
background-color: #f9fafb;
}
</style>