Compare commits
50 Commits
5de539f61c
...
2025-10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7c93d03aa | ||
|
|
a4b016ef0d | ||
|
|
d329b68592 | ||
|
|
e12a1baf99 | ||
|
|
8aae184a8b | ||
|
|
7f2275bad9 | ||
|
|
aab884e524 | ||
|
|
0215dbc875 | ||
|
|
b09a2bab10 | ||
|
|
4dbcdd20df | ||
|
|
6fde670f96 | ||
|
|
ba1748830a | ||
|
|
0054f989c0 | ||
|
|
97b5262926 | ||
|
|
6ea566aad5 | ||
|
|
33d7587944 | ||
|
|
7c42ffcbdd | ||
|
|
9268cd755b | ||
|
|
a69b7a17a4 | ||
|
|
7abcec7a2e | ||
|
|
425b54bc44 | ||
|
|
9376d702f3 | ||
|
|
04be2c8a16 | ||
|
|
1c90c46806 | ||
|
|
fd2c11cf90 | ||
|
|
9fef439e59 | ||
|
|
ce5dfd6963 | ||
|
|
972555451b | ||
|
|
53079c5a1c | ||
|
|
32808ce622 | ||
|
|
f0c0288174 | ||
|
|
baccbe6f33 | ||
|
|
cedf1b6c5e | ||
|
|
5f4b647bed | ||
|
|
a1f241bbfe | ||
|
|
211b367db7 | ||
|
|
e3649a4933 | ||
|
|
f772568400 | ||
|
|
1cc2ab79cd | ||
|
|
d5a2db5cd0 | ||
|
|
5ec688a659 | ||
|
|
91b2a939b9 | ||
|
|
ac11af35df | ||
|
|
be84092cfe | ||
|
|
b2db5622bc | ||
|
|
f1b76376c6 | ||
| af84524512 | |||
|
|
cddbbf0c69 | ||
|
|
d7bd804df4 | ||
|
|
8a83bc5867 |
@@ -4,7 +4,7 @@ const path = require('path');
|
|||||||
const { logger } = require('ee-core/log');
|
const { logger } = require('ee-core/log');
|
||||||
const { getConfig } = require('ee-core/config');
|
const { getConfig } = require('ee-core/config');
|
||||||
const { getMainWindow } = require('ee-core/electron');
|
const { getMainWindow } = require('ee-core/electron');
|
||||||
const { getBaseDir } = require('ee-core/ps');
|
const ps = require('ee-core/ps');
|
||||||
const { app } = require('electron');
|
const { app } = require('electron');
|
||||||
|
|
||||||
// 动态获取 scripts 目录路径
|
// 动态获取 scripts 目录路径
|
||||||
@@ -74,7 +74,10 @@ class Lifecycle {
|
|||||||
async ready() {
|
async ready() {
|
||||||
logger.info('[lifecycle] ready');
|
logger.info('[lifecycle] ready');
|
||||||
// 延迟加载 scripts
|
// 延迟加载 scripts
|
||||||
loadScripts();
|
if (ps.isProd()) {
|
||||||
|
loadScripts();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -493,44 +496,55 @@ class Lifecycle {
|
|||||||
*/
|
*/
|
||||||
async windowReady() {
|
async windowReady() {
|
||||||
logger.info('[lifecycle] window-ready');
|
logger.info('[lifecycle] window-ready');
|
||||||
|
if (ps.isProd()) {
|
||||||
|
// 创建日志窗口
|
||||||
|
this.logWindowManager = new LogWindowManager();
|
||||||
|
this.logWindowManager.createLogWindow();
|
||||||
|
this.logWindowManager.addLog('system', '='.repeat(60));
|
||||||
|
this.logWindowManager.addLog('system', 'NPQS9100 启动中...');
|
||||||
|
this.logWindowManager.addLog('system', '='.repeat(60));
|
||||||
|
|
||||||
// 创建日志窗口
|
// 创建 Loading 窗口
|
||||||
this.logWindowManager = new LogWindowManager();
|
this.startupManager = new StartupManager();
|
||||||
this.logWindowManager.createLogWindow();
|
this.startupManager.createLoadingWindow();
|
||||||
this.logWindowManager.addLog('system', '='.repeat(60));
|
|
||||||
this.logWindowManager.addLog('system', 'NPQS9100 启动中...');
|
|
||||||
this.logWindowManager.addLog('system', '='.repeat(60));
|
|
||||||
|
|
||||||
// 创建 Loading 窗口
|
// 开始启动流程
|
||||||
this.startupManager = new StartupManager();
|
try {
|
||||||
this.startupManager.createLoadingWindow();
|
await this.startApplication();
|
||||||
|
} catch (error) {
|
||||||
|
logger.error('[lifecycle] Failed to start application:', error);
|
||||||
|
this.logWindowManager.addLog('error', `启动失败: ${error.message}`);
|
||||||
|
this.logWindowManager.addLog('system', '请检查日志窗口了解详细错误信息');
|
||||||
|
this.startupManager.showError(error.message || '启动失败,请查看日志');
|
||||||
|
|
||||||
|
// 显示错误5秒后关闭Loading窗口,但不关闭日志窗口
|
||||||
|
setTimeout(() => {
|
||||||
|
this.startupManager.closeLoadingWindow();
|
||||||
|
|
||||||
|
// 即使启动失败,也显示主窗口(但用户可能需要手动修复问题)
|
||||||
|
const win = getMainWindow();
|
||||||
|
win.show();
|
||||||
|
win.focus();
|
||||||
|
|
||||||
|
// 添加主窗口关闭事件监听
|
||||||
|
win.on('close', async () => {
|
||||||
|
logger.info('[lifecycle] Main window closing (after error), cleaning up...');
|
||||||
|
await this.cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.logWindowManager.addLog('warn', '应用已启动,但部分服务可能未正常运行');
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const win = getMainWindow();
|
||||||
|
const {windowsOption} = getConfig();
|
||||||
|
if (windowsOption.show == false) {
|
||||||
|
win.once('ready-to-show', () => {
|
||||||
|
win.show();
|
||||||
|
win.focus();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 开始启动流程
|
|
||||||
try {
|
|
||||||
await this.startApplication();
|
|
||||||
} catch (error) {
|
|
||||||
logger.error('[lifecycle] Failed to start application:', error);
|
|
||||||
this.logWindowManager.addLog('error', `启动失败: ${error.message}`);
|
|
||||||
this.logWindowManager.addLog('system', '请检查日志窗口了解详细错误信息');
|
|
||||||
this.startupManager.showError(error.message || '启动失败,请查看日志');
|
|
||||||
|
|
||||||
// 显示错误5秒后关闭Loading窗口,但不关闭日志窗口
|
|
||||||
setTimeout(() => {
|
|
||||||
this.startupManager.closeLoadingWindow();
|
|
||||||
|
|
||||||
// 即使启动失败,也显示主窗口(但用户可能需要手动修复问题)
|
|
||||||
const win = getMainWindow();
|
|
||||||
win.show();
|
|
||||||
win.focus();
|
|
||||||
|
|
||||||
// 添加主窗口关闭事件监听
|
|
||||||
win.on('close', async () => {
|
|
||||||
logger.info('[lifecycle] Main window closing (after error), cleaning up...');
|
|
||||||
await this.cleanup();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.logWindowManager.addLog('warn', '应用已启动,但部分服务可能未正常运行');
|
|
||||||
}, 5000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主窗口初始化但不显示,等待启动流程完成后再显示
|
// 主窗口初始化但不显示,等待启动流程完成后再显示
|
||||||
@@ -542,7 +556,10 @@ class Lifecycle {
|
|||||||
*/
|
*/
|
||||||
async beforeClose() {
|
async beforeClose() {
|
||||||
logger.info('[lifecycle] before-close hook triggered');
|
logger.info('[lifecycle] before-close hook triggered');
|
||||||
await this.cleanup();
|
if (ps.isProd()) {
|
||||||
|
await this.cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Lifecycle.toString = () => '[class Lifecycle]';
|
Lifecycle.toString = () => '[class Lifecycle]';
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ VITE_API_URL=/api
|
|||||||
# 开发环境跨域代理,支持配置多个
|
# 开发环境跨域代理,支持配置多个
|
||||||
|
|
||||||
#VITE_PROXY=[["/api","http://127.0.0.1:18092/"]]
|
#VITE_PROXY=[["/api","http://127.0.0.1:18092/"]]
|
||||||
VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
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.125:18092/"]]
|
||||||
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
||||||
# 开启激活验证
|
# 开启激活验证
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import type { Activate } from '@/api/activate/interface'
|
|
||||||
|
|
||||||
export const generateApplicationCode = (params: Activate.ApplicationCodePlaintext) => {
|
export const generateApplicationCode = () => {
|
||||||
return http.post(`/activate/generateApplicationCode`, params)
|
return http.post(`/activate/generateApplicationCode`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const verifyActivationCode = (activationCode: string) => {
|
export const verifyActivationCode = (activationCode: string) => {
|
||||||
|
|||||||
@@ -1,37 +1,14 @@
|
|||||||
//激活模块
|
//激活模块
|
||||||
export namespace Activate {
|
export namespace Activate {
|
||||||
|
|
||||||
export interface ApplicationModule {
|
|
||||||
/**
|
|
||||||
* 是否申请 1是 0否
|
|
||||||
*/
|
|
||||||
apply: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ActivateModule extends ApplicationModule {
|
export interface ActivateModule {
|
||||||
/**
|
/**
|
||||||
* 是否永久 1是 0否
|
* 是否永久 1是 0否
|
||||||
*/
|
*/
|
||||||
permanently: number;
|
permanently: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApplicationCodePlaintext {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模拟式模块
|
|
||||||
*/
|
|
||||||
simulate: ApplicationModule;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数字式模块
|
|
||||||
*/
|
|
||||||
digital: ApplicationModule;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 比对式模块
|
|
||||||
*/
|
|
||||||
contrast: ApplicationModule;
|
|
||||||
}
|
|
||||||
export interface ActivationCodePlaintext {
|
export interface ActivationCodePlaintext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ export namespace CheckData {
|
|||||||
id: string
|
id: string
|
||||||
code: string
|
code: string
|
||||||
scriptName: string
|
scriptName: string
|
||||||
|
resultFlag: number
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用来描述 检测数据-左侧树结构
|
// 用来描述 检测数据-左侧树结构
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ export const getBigTestItem = (params: {
|
|||||||
export const getScriptList = (params: {
|
export const getScriptList = (params: {
|
||||||
devId:string,
|
devId:string,
|
||||||
chnNum:number,
|
chnNum:number,
|
||||||
num:number
|
num:number,
|
||||||
|
planId:string
|
||||||
}) => {
|
}) => {
|
||||||
return http.post('/result/getCheckItem', params, {loading: false})
|
return http.post('/result/getCheckItem', params, {loading: false})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ export namespace Device {
|
|||||||
boundPlanName?: string | null
|
boundPlanName?: string | null
|
||||||
assign?: number ////是否分配给检测人员 0否 1是
|
assign?: number ////是否分配给检测人员 0否 1是
|
||||||
monitorList: Monitor.ResPqMon[]
|
monitorList: Monitor.ResPqMon[]
|
||||||
checked: boolean // 是否已选择
|
checked?: boolean // 是否已选择
|
||||||
disabled: boolean // 是否禁用
|
disabled?: boolean // 是否禁用
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SelectOption {
|
export interface SelectOption {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export namespace Monitor {
|
|||||||
statInterval: number; //统计间隔
|
statInterval: number; //统计间隔
|
||||||
harmSysId: string; //默认与谐波系统监测点ID相同
|
harmSysId: string; //默认与谐波系统监测点ID相同
|
||||||
checkFlag: number;//是否参与检测0否1是
|
checkFlag: number;//是否参与检测0否1是
|
||||||
|
resultType:string|null; //检测结果类型
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export const getPqErrSysList = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取指定模式下所有未绑定的设备
|
//获取指定模式下所有未绑定的设备
|
||||||
export const getUnboundPqDevList = (params: { pattern: string}) => {
|
export const getUnboundPqDevList = (params: { pattern: string }) => {
|
||||||
return http.get(`/pqDev/listUnbound?pattern=${params.pattern}`)
|
return http.get(`/pqDev/listUnbound?pattern=${params.pattern}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,22 +141,22 @@ export const importSubPlan = (params: Plan.ResPlan) => {
|
|||||||
|
|
||||||
// 导出计划检测结果数据
|
// 导出计划检测结果数据
|
||||||
export const exportPlanCheckData = (params: any) => {
|
export const exportPlanCheckData = (params: any) => {
|
||||||
return http.post(
|
return http.post(`/adPlan/exportPlanCheckData?planId=${params.id}&devIds=${params.devIds}&report=${params.report}`)
|
||||||
`/adPlan/exportPlanCheckData?planId=${params.id}&devIds=${params.devIds}&report=${params.report}`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据误差体系id获取测试项
|
//根据误差体系id获取测试项
|
||||||
export const getPqErrSysTestItemList = (params: {errorSysId : string}) => {
|
export const getPqErrSysTestItemList = (params: { errorSysId: string }) => {
|
||||||
return http.get(`/pqErrSys/getTestItems?id=${params.errorSysId}`)
|
return http.get(`/pqErrSys/getTestItems?id=${params.errorSysId}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取计划项目成员
|
// 获取计划项目成员
|
||||||
export const getMemberList = (params: {id : string}) => {
|
export const getMemberList = (params: { id: string }) => {
|
||||||
return http.get(`/adPlan/getMemberList?planId=${params.id}`)
|
return http.get(`/adPlan/getMemberList?planId=${params.id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导入并合并子检测计划检测结果数据
|
// 导入并合并子检测计划检测结果数据
|
||||||
export const importAndMergePlanCheckData = (params: Plan.ResPlan) => {
|
export const importAndMergePlanCheckData = (params: Plan.ResPlan) => {
|
||||||
return http.upload(`/adPlan/importAndMergePlanCheckData`, params)
|
return http.upload(`/adPlan/importAndMergePlanCheckData`, params, {
|
||||||
|
timeout: 60000 * 20
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@@ -41,9 +41,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="parameter.showCover" label="数据覆盖 :">
|
|
||||||
<el-switch v-model="isCover" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -52,7 +49,7 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import { Download } from '@element-plus/icons-vue'
|
import { Download } from '@element-plus/icons-vue'
|
||||||
import { ElMessage, ElNotification, UploadRawFile, UploadRequestOptions } from 'element-plus'
|
import { ElMessage, ElNotification, type UploadRawFile, type UploadRequestOptions } from 'element-plus'
|
||||||
|
|
||||||
export interface ExcelParameterProps {
|
export interface ExcelParameterProps {
|
||||||
title: string // 标题
|
title: string // 标题
|
||||||
@@ -67,7 +64,7 @@ export interface ExcelParameterProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 是否覆盖数据
|
// 是否覆盖数据
|
||||||
const isCover = ref(false)
|
const isCover = ref(0)
|
||||||
// 最大文件上传数
|
// 最大文件上传数
|
||||||
const excelLimit = ref(1)
|
const excelLimit = ref(1)
|
||||||
// dialog状态
|
// dialog状态
|
||||||
@@ -85,6 +82,7 @@ const emit = defineEmits<{
|
|||||||
const acceptParams = (params: ExcelParameterProps) => {
|
const acceptParams = (params: ExcelParameterProps) => {
|
||||||
parameter.value = { ...parameter.value, ...params }
|
parameter.value = { ...parameter.value, ...params }
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
isCover.value = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Excel 导入模板下载
|
// Excel 导入模板下载
|
||||||
@@ -92,9 +90,10 @@ const downloadTemp = () => {
|
|||||||
if (!parameter.value.tempApi) return
|
if (!parameter.value.tempApi) return
|
||||||
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, { pattern: parameter.value.patternId }, false)
|
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, { pattern: parameter.value.patternId }, false)
|
||||||
}
|
}
|
||||||
|
const currentFile = ref<UploadRequestOptions>(null)
|
||||||
// 文件上传
|
// 文件上传
|
||||||
const uploadExcel = async (param: UploadRequestOptions) => {
|
const uploadExcel = async (param: UploadRequestOptions) => {
|
||||||
|
currentFile.value = param
|
||||||
let excelFormData = new FormData()
|
let excelFormData = new FormData()
|
||||||
excelFormData.append('file', param.file)
|
excelFormData.append('file', param.file)
|
||||||
if (parameter.value.patternId) {
|
if (parameter.value.patternId) {
|
||||||
@@ -103,26 +102,43 @@ const uploadExcel = async (param: UploadRequestOptions) => {
|
|||||||
|
|
||||||
excelFormData.append('planId', parameter.value.planId)
|
excelFormData.append('planId', parameter.value.planId)
|
||||||
|
|
||||||
isCover.value && excelFormData.append('isCover', isCover.value as unknown as Blob)
|
excelFormData.append('cover', isCover.value as unknown as Blob)
|
||||||
//await parameter.value.importApi!(excelFormData);
|
//await parameter.value.importApi!(excelFormData);
|
||||||
await parameter.value.importApi!(excelFormData).then(res => handleImportResponse(res))
|
const res = await parameter.value.importApi!(excelFormData)
|
||||||
|
await handleImportResponse(res)
|
||||||
|
|
||||||
parameter.value.getTableList && parameter.value.getTableList()
|
parameter.value.getTableList && parameter.value.getTableList()
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleImportResponse(res: any) {
|
async function handleImportResponse(res: any) {
|
||||||
|
|
||||||
|
|
||||||
if (res.type === 'application/json') {
|
if (res.type === 'application/json') {
|
||||||
const fileReader = new FileReader()
|
const fileReader = new FileReader()
|
||||||
fileReader.onloadend = () => {
|
fileReader.onloadend = () => {
|
||||||
try {
|
try {
|
||||||
const jsonData = JSON.parse(fileReader.result)
|
const jsonData = JSON.parse(fileReader.result)
|
||||||
if (jsonData.code === 'A0000') {
|
if (jsonData.code === 'A0000') {
|
||||||
|
isCover.value = 0
|
||||||
ElMessage.success('导入成功')
|
ElMessage.success('导入成功')
|
||||||
} else {
|
} else {
|
||||||
|
if (jsonData.code === 'A02099') {
|
||||||
|
const dev = jsonData.data.join('<br>')
|
||||||
|
ElMessageBox.confirm(`<p>以下被检设备已存在,${jsonData.message}</p><p>${dev}</p>`, {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
title: '提示',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
isCover.value = 1
|
||||||
|
if (currentFile.value) {
|
||||||
|
uploadExcel(currentFile.value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
ElMessageBox.alert(jsonData.message, {
|
ElMessageBox.alert(jsonData.message, {
|
||||||
|
confirmButtonText: '确定',
|
||||||
title: '导入结果',
|
title: '导入结果',
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
action="#"
|
action="#"
|
||||||
class="upload"
|
class="upload"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
:http-request="uploadZip"
|
:http-request="uploadZip"
|
||||||
accept=".zip"
|
accept=".zip"
|
||||||
:auto-upload="!parameter.confirmMessage"
|
:auto-upload="!parameter.confirmMessage"
|
||||||
@@ -56,7 +57,15 @@
|
|||||||
|
|
||||||
<script setup lang="ts" name="ImportZip">
|
<script setup lang="ts" name="ImportZip">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { ElMessage, ElMessageBox, type UploadInstance, type UploadProps, type UploadRequestOptions } from 'element-plus'
|
import {
|
||||||
|
ElMessage,
|
||||||
|
ElMessageBox,
|
||||||
|
genFileId,
|
||||||
|
type UploadInstance,
|
||||||
|
type UploadProps,
|
||||||
|
type UploadRawFile,
|
||||||
|
type UploadRequestOptions
|
||||||
|
} from 'element-plus'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
|
||||||
export interface ZipParameterProps {
|
export interface ZipParameterProps {
|
||||||
@@ -170,7 +179,12 @@ const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
|||||||
message: ''
|
message: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const handleExceed: UploadProps['onExceed'] = files => {
|
||||||
|
uploadRef.value!.clearFiles()
|
||||||
|
const file = files[0] as UploadRawFile
|
||||||
|
file.uid = genFileId()
|
||||||
|
uploadRef.value!.handleStart(file)
|
||||||
|
}
|
||||||
const progressData = ref({
|
const progressData = ref({
|
||||||
percentage: 0,
|
percentage: 0,
|
||||||
status: '',
|
status: '',
|
||||||
|
|||||||
@@ -61,9 +61,12 @@ const menuList = computed(() => authStore.showMenuListGet)
|
|||||||
const showMenuFlag = computed(() => authStore.showMenuFlagGet)
|
const showMenuFlag = computed(() => authStore.showMenuFlagGet)
|
||||||
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string)
|
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string)
|
||||||
|
|
||||||
const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
const handleClickMenu = async (subItem: Menu.MenuOptions) => {
|
||||||
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, '_blank')
|
if (subItem.meta?.isLink) {
|
||||||
router.push(subItem.path)
|
window.open(subItem.meta.isLink, '_blank')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await router.push(subItem.path)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,14 @@
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useAuthStore } from '@/stores/modules/auth'
|
import { useAuthStore } from '@/stores/modules/auth'
|
||||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
|
import { useTabsStore } from '@/stores/modules/tabs'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const modeStore = useModeStore()
|
const modeStore = useModeStore()
|
||||||
|
const tabsStore = useTabsStore()
|
||||||
|
|
||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
return modeStore.currentMode === '' ? '选择模块' : modeStore.currentMode + '模块'
|
return modeStore.currentMode === '' ? '选择模块' : modeStore.currentMode + '模块'
|
||||||
@@ -41,39 +47,32 @@ const modeList = [
|
|||||||
name: '模拟式模块',
|
name: '模拟式模块',
|
||||||
code: '模拟式',
|
code: '模拟式',
|
||||||
key: 'simulate',
|
key: 'simulate',
|
||||||
activated:
|
activated: isActivateOpen === 'true' ? activateInfo.simulate.permanently === 1 : true
|
||||||
isActivateOpen === 'true'
|
|
||||||
? activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1
|
|
||||||
: true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '数字式模块',
|
name: '数字式模块',
|
||||||
code: '数字式',
|
code: '数字式',
|
||||||
key: 'digital',
|
key: 'digital',
|
||||||
activated:
|
activated: isActivateOpen === 'true' ? activateInfo.digital.permanently === 1 : true
|
||||||
isActivateOpen === 'true'
|
|
||||||
? activateInfo.digital.apply === 1 && activateInfo.digital.permanently === 1
|
|
||||||
: true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '比对式模块',
|
name: '比对式模块',
|
||||||
code: '比对式',
|
code: '比对式',
|
||||||
key: 'contrast',
|
key: 'contrast',
|
||||||
activated:
|
activated: isActivateOpen === 'true' ? activateInfo.contrast.permanently === 1 : true
|
||||||
isActivateOpen === 'true'
|
|
||||||
? activateInfo.contrast.apply === 1 && activateInfo.contrast.permanently === 1
|
|
||||||
: true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
const handelOpen = async (item: string, key: string) => {
|
const handelOpen = async (item: string, key: string) => {
|
||||||
if (isActivateOpen === 'true' && (activateInfo[key].apply !== 1 || activateInfo[key].permanently !== 1)) {
|
if (isActivateOpen === 'true' && activateInfo[key].permanently !== 1) {
|
||||||
ElMessage.warning(`${item}模块未激活`)
|
ElMessage.warning(`${item}模块未激活`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await authStore.setShowMenu()
|
await authStore.setShowMenu()
|
||||||
modeStore.setCurrentMode(item) // 将模式code存入 store
|
modeStore.setCurrentMode(item) // 将模式code存入 store
|
||||||
// 强制刷新页面
|
// 强制刷新页面
|
||||||
window.location.reload()
|
await tabsStore.closeMultipleTab()
|
||||||
|
await initDynamicRouter()
|
||||||
|
await router.push({ path: '/home/index' })
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <div class="userInfo">-->
|
|
||||||
<!-- <div class="icon">-->
|
|
||||||
<!-- <Avatar/>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="username">-->
|
|
||||||
<!-- {{ username }}-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<div class="userInfo">
|
<div class="userInfo">
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -22,10 +14,10 @@
|
|||||||
<el-icon><Sunny /></el-icon>
|
<el-icon><Sunny /></el-icon>
|
||||||
{{ t('header.changeTheme') }}
|
{{ t('header.changeTheme') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click="openDialog('infoRef')">
|
<!-- <el-dropdown-item @click="openDialog('infoRef')">
|
||||||
<el-icon><User /></el-icon>
|
<el-icon><User /></el-icon>
|
||||||
{{ t('header.personalData') }}
|
{{ t('header.personalData') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>-->
|
||||||
<el-dropdown-item @click="openDialog('passwordRef')">
|
<el-dropdown-item @click="openDialog('passwordRef')">
|
||||||
<el-icon><Edit /></el-icon>
|
<el-icon><Edit /></el-icon>
|
||||||
{{ t('header.changePassword') }}
|
{{ t('header.changePassword') }}
|
||||||
@@ -80,7 +72,6 @@
|
|||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { LOGIN_URL } from '@/config'
|
import { LOGIN_URL } from '@/config'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { logoutApi } from '@/api/user/login'
|
|
||||||
import { useUserStore } from '@/stores/modules/user'
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import InfoDialog from './InfoDialog.vue'
|
import InfoDialog from './InfoDialog.vue'
|
||||||
@@ -90,10 +81,9 @@ import VersionDialog from '@/views/system/versionRegister/index.vue'
|
|||||||
import { Avatar, Sunny, Switch, Tools } from '@element-plus/icons-vue'
|
import { Avatar, Sunny, Switch, Tools } from '@element-plus/icons-vue'
|
||||||
import { useAuthStore } from '@/stores/modules/auth'
|
import { useAuthStore } from '@/stores/modules/auth'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'
|
import { useAppSceneStore } from '@/stores/modules/mode'
|
||||||
import { useTheme } from '@/hooks/useTheme'
|
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { updateScene } from '@/api/system/base/index'
|
import { updateScene } from '@/api/system/base'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
@@ -101,10 +91,6 @@ const username = computed(() => userStore.userInfo.name)
|
|||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const modeStore = useModeStore()
|
|
||||||
const AppSceneStore = useAppSceneStore()
|
|
||||||
|
|
||||||
const { changePrimary } = useTheme()
|
|
||||||
|
|
||||||
// 初始化 i18n
|
// 初始化 i18n
|
||||||
const { t } = useI18n() // 使用 t 方法替代 $t
|
const { t } = useI18n() // 使用 t 方法替代 $t
|
||||||
@@ -116,21 +102,8 @@ const logout = () => {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(async () => {
|
}).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('退出登录成功!')
|
ElMessage.success('退出登录成功!')
|
||||||
//重置菜单/导航栏权限
|
await userStore.logout()
|
||||||
await authStore.resetAuthStore()
|
|
||||||
await router.push(LOGIN_URL)
|
await router.push(LOGIN_URL)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -157,8 +130,9 @@ const changeScene = async (value: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//模式切换
|
//模式切换
|
||||||
const changeMode = () => {
|
const changeMode = async () => {
|
||||||
authStore.changeModel()
|
authStore.changeModel()
|
||||||
|
await router.push('/home/index')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,150 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" title="修改密码" width="500px" draggable>
|
<el-dialog v-model="dialogVisible" title="修改密码" width="500px" draggable>
|
||||||
<span>This is Password</span>
|
<div>
|
||||||
<template #footer>
|
<el-form :model="formContent" ref="dialogFormRef" :rules="rules">
|
||||||
<span class="dialog-footer">
|
<el-form-item label="原密码" prop="oldPassword" :label-width="100">
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-input
|
||||||
<el-button type="primary" @click="dialogVisible = false">确认</el-button>
|
type="oldPassword"
|
||||||
</span>
|
v-model="formContent.oldPassword"
|
||||||
</template>
|
show-password
|
||||||
</el-dialog>
|
placeholder="请输入原密码"
|
||||||
|
autocomplete="off"
|
||||||
|
maxlength="32"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="新密码" prop="newPassword" :label-width="100">
|
||||||
|
<el-input
|
||||||
|
type="newPassword"
|
||||||
|
v-model="formContent.newPassword"
|
||||||
|
show-password
|
||||||
|
placeholder="请输入新密码"
|
||||||
|
autocomplete="off"
|
||||||
|
maxlength="32"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="确认密码" prop="surePassword" :label-width="100">
|
||||||
|
<el-input
|
||||||
|
type="surePassword"
|
||||||
|
v-model="formContent.surePassword"
|
||||||
|
show-password
|
||||||
|
placeholder="请再次输入确认密码"
|
||||||
|
autocomplete="off"
|
||||||
|
maxlength="32"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="close()">取消</el-button>
|
||||||
|
<el-button type="primary" @click="save()">保存</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref, type Ref } from 'vue'
|
||||||
|
import { ElMessage, type FormItemRule } from 'element-plus'
|
||||||
|
import { updatePassWord } from '@/api/user/user'
|
||||||
|
import { type User } from '@/api/user/interface/user'
|
||||||
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
|
import { LOGIN_URL } from '@/config'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const dialogVisible = ref(false);
|
const userStore = useUserStore()
|
||||||
const openDialog = () => {
|
const router = useRouter()
|
||||||
dialogVisible.value = true;
|
// 定义弹出组件元信息
|
||||||
};
|
const dialogFormRef = ref()
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const formContent = ref<User.ResPassWordUser>({
|
||||||
|
id: '', //用户ID,作为唯一标识
|
||||||
|
oldPassword: '', //密码
|
||||||
|
newPassword: '', //
|
||||||
|
surePassword: ''
|
||||||
|
})
|
||||||
|
return { dialogVisible, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({ openDialog });
|
const { dialogVisible, formContent } = useMetaInfo()
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '', //用户ID,作为唯一标识
|
||||||
|
oldPassword: '', //密码
|
||||||
|
newPassword: '', //
|
||||||
|
surePassword: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义规则
|
||||||
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
|
oldPassword: [{ required: true, message: '原密码必填!', trigger: 'blur' }],
|
||||||
|
newPassword: [
|
||||||
|
{ required: true, message: '新密码必填!', trigger: 'blur' },
|
||||||
|
{
|
||||||
|
pattern: /^(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]).{8,16}$/,
|
||||||
|
message: '密码长度为8-16,需包含特殊字符',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
surePassword: [
|
||||||
|
{ required: true, message: '确认密码必填!', trigger: 'blur' },
|
||||||
|
{
|
||||||
|
validator: (rule: FormItemRule, value: string, callback: Function) => {
|
||||||
|
if (value !== formContent.value.newPassword) {
|
||||||
|
callback(new Error('两次输入的密码不一致!'))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
if (formContent.value.id) {
|
||||||
|
await updatePassWord(formContent.value)
|
||||||
|
ElMessage.success('修改密码成功,请重新登录!')
|
||||||
|
setTimeout(async () => {
|
||||||
|
await userStore.logout()
|
||||||
|
await router.push(LOGIN_URL)
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗是编辑
|
||||||
|
const openDialog = async () => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
dialogVisible.value = true
|
||||||
|
formContent.value.id = userStore.userInfo.id
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ openDialog })
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,98 +1,97 @@
|
|||||||
<template>
|
<template>
|
||||||
<template v-for="subItem in menuList" :key="subItem.path">
|
<template v-for="subItem in menuList" :key="subItem.path">
|
||||||
<el-sub-menu v-if="subItem.children?.length" :index="subItem.path">
|
<el-sub-menu v-if="subItem.children?.length" :index="subItem.path">
|
||||||
<template #title>
|
<template #title>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<component :is="subItem.meta.icon"></component>
|
<component :is="subItem.meta.icon"></component>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="sle">{{ subItem.meta.title }}</span>
|
<span class="sle">{{ subItem.meta.title }}</span>
|
||||||
</template>
|
</template>
|
||||||
<SubMenu :menu-list="subItem.children" />
|
<SubMenu :menu-list="subItem.children" />
|
||||||
</el-sub-menu>
|
</el-sub-menu>
|
||||||
<el-menu-item v-else :index="subItem.path" @click="handleClickMenu(subItem)">
|
<el-menu-item v-else :index="subItem.path" @click="handleClickMenu(subItem)">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<component :is="subItem.meta.icon"></component>
|
<component :is="subItem.meta.icon"></component>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<template #title>
|
<template #title>
|
||||||
<span class="sle">{{ subItem.meta.title }}</span>
|
<span class="sle">{{ subItem.meta.title }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onBeforeMount } from "vue";
|
import { useRouter } from 'vue-router'
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
defineProps<{ menuList: Menu.MenuOptions[] }>();
|
|
||||||
const router = useRouter();
|
|
||||||
const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
|
||||||
//console.log('1456----------------',subItem);
|
|
||||||
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, "_blank");
|
|
||||||
router.push(subItem.path);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
defineProps<{ menuList: Menu.MenuOptions[] }>()
|
||||||
|
const router = useRouter()
|
||||||
|
const handleClickMenu = async (subItem: Menu.MenuOptions) => {
|
||||||
|
if (subItem.meta?.isLink) {
|
||||||
|
window.open(subItem.meta.isLink, '_blank')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await router.push(subItem.path)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.el-sub-menu .el-sub-menu__title:hover {
|
.el-sub-menu .el-sub-menu__title:hover {
|
||||||
// color: var(--el-menu-hover-text-color) !important;
|
// color: var(--el-menu-hover-text-color) !important;
|
||||||
// background-color: transparent !important;
|
// background-color: transparent !important;
|
||||||
color: #fff !important;//一级导航文字选中颜色
|
color: #fff !important; //一级导航文字选中颜色
|
||||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||||
|
|
||||||
background-color: var(--el-color-primary-light-3) !important;
|
|
||||||
|
|
||||||
|
background-color: var(--el-color-primary-light-3) !important;
|
||||||
}
|
}
|
||||||
.el-menu--collapse {
|
.el-menu--collapse {
|
||||||
.is-active {
|
.is-active {
|
||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
// background-color: var(--el-color-primary) !important;
|
// background-color: var(--el-color-primary) !important;
|
||||||
//background-color: #5274a5 !important;
|
//background-color: #5274a5 !important;
|
||||||
background-color: var(--el-color-primary-light-3) !important;
|
background-color: var(--el-color-primary-light-3) !important;
|
||||||
|
|
||||||
border-bottom: 0 !important;
|
border-bottom: 0 !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--el-menu-hover-text-color);
|
color: var(--el-menu-hover-text-color);
|
||||||
}
|
}
|
||||||
&.is-active {
|
&.is-active {
|
||||||
// color: var(--el-menu-active-color) !important;
|
// color: var(--el-menu-active-color) !important;
|
||||||
// background-color: var(--el-menu-active-bg-color) !important;
|
// background-color: var(--el-menu-active-bg-color) !important;
|
||||||
color: #fff !important;//一级导航文字选中颜色
|
color: #fff !important; //一级导航文字选中颜色
|
||||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||||
background-color: var(--el-color-primary-light-3) !important;
|
background-color: var(--el-color-primary-light-3) !important;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
content: "";
|
content: '';
|
||||||
background-color: var(--el-color-primary);
|
background-color: var(--el-color-primary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.vertical,
|
.vertical,
|
||||||
.classic,
|
.classic,
|
||||||
.transverse {
|
.transverse {
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
&.is-active {
|
&.is-active {
|
||||||
&::before {
|
&::before {
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.columns {
|
.columns {
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
&.is-active {
|
&.is-active {
|
||||||
&::before {
|
&::before {
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
|||||||
import { staticRouter } from '@/routers/modules/staticRouter'
|
import { staticRouter } from '@/routers/modules/staticRouter'
|
||||||
import NProgress from '@/config/nprogress'
|
import NProgress from '@/config/nprogress'
|
||||||
|
|
||||||
|
// 白名单转换为 Set 提高性能
|
||||||
|
const WHITE_LIST_SET = new Set(ROUTER_WHITE_LIST)
|
||||||
|
|
||||||
const mode = import.meta.env.VITE_ROUTER_MODE
|
const mode = import.meta.env.VITE_ROUTER_MODE
|
||||||
|
|
||||||
const routerMode = {
|
const routerMode = {
|
||||||
@@ -30,11 +33,9 @@ const routerMode = {
|
|||||||
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
||||||
* */
|
* */
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: routerMode[mode](),
|
history: routerMode[mode]?.() || createWebHashHistory(), // 默认 fallback 到 hash 模式
|
||||||
routes: [...staticRouter],
|
routes: [...staticRouter],
|
||||||
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
|
||||||
strict: false,
|
strict: false,
|
||||||
// 页面刷新时,滚动条位置还原
|
|
||||||
scrollBehavior: () => ({ left: 0, top: 0 })
|
scrollBehavior: () => ({ left: 0, top: 0 })
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -44,38 +45,52 @@ const router = createRouter({
|
|||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
// 1.NProgress 开始
|
// 1.NProgress 开始
|
||||||
NProgress.start()
|
NProgress.start()
|
||||||
|
|
||||||
// 2.动态设置标题
|
// 2.动态设置标题
|
||||||
const title = import.meta.env.VITE_GLOB_APP_TITLE
|
const title = import.meta.env.VITE_GLOB_APP_TITLE
|
||||||
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
|
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
|
||||||
|
|
||||||
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
|
// 3.判断是访问登陆页,有 Token 就留在当前页,没有 Token 重置路由到登陆页
|
||||||
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
|
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
|
||||||
if (userStore.accessToken) return next(from.fullPath)
|
if (userStore.accessToken) {
|
||||||
|
// 已登录则不再回到登录页,直接跳过
|
||||||
|
return next('/')
|
||||||
|
}
|
||||||
resetRouter()
|
resetRouter()
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
|
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
|
||||||
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
|
if (WHITE_LIST_SET.has(to.path)) return next()
|
||||||
|
|
||||||
// 5.判断是否有 Token,没有重定向到 login 页面
|
// 5.判断是否有 Token,没有重定向到 login 页面
|
||||||
if (!userStore.accessToken) return next({ path: LOGIN_URL, replace: true })
|
if (!userStore.accessToken) return next({ path: LOGIN_URL, replace: true })
|
||||||
|
|
||||||
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
||||||
if (!authStore.authMenuListGet.length) {
|
if (!authStore.authMenuListGet.length) {
|
||||||
await initDynamicRouter()
|
try {
|
||||||
return next({ ...to, replace: true })
|
await initDynamicRouter()
|
||||||
|
return next({ ...to, replace: true })
|
||||||
|
} catch (error) {
|
||||||
|
console.error('动态路由加载失败:', error)
|
||||||
|
// 清除 token 并跳转登录页
|
||||||
|
await userStore.logout()
|
||||||
|
return next({ path: LOGIN_URL, replace: true })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7.存储 routerName 做按钮权限筛选
|
// 7.存储 routerName 做按钮权限筛选
|
||||||
await authStore.setRouteName(to.name as string)
|
await authStore.setRouteName(to.name as string)
|
||||||
|
|
||||||
// 8. 当前页面是否有激活信息,没有就刷新
|
// 8. 当前页面是否有激活信息,没有就刷新
|
||||||
const activateInfo = authStore.activateInfo
|
const activateInfo = authStore.activateInfo
|
||||||
if (!Object.keys(activateInfo).length) {
|
if (!Object.keys(activateInfo).length) {
|
||||||
await authStore.setActivateInfo()
|
await authStore.setActivateInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9.正常访问页面
|
// 9.正常访问页面
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
@@ -96,7 +111,7 @@ export const resetRouter = () => {
|
|||||||
* */
|
* */
|
||||||
router.onError(error => {
|
router.onError(error => {
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
//console.warn('路由错误', error.message)
|
console.warn('路由错误', error.message)
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,60 +1,117 @@
|
|||||||
import router from "@/routers/index";
|
import router from '@/routers'
|
||||||
import { LOGIN_URL } from "@/config";
|
import { LOGIN_URL } from '@/config'
|
||||||
import { RouteRecordRaw } from "vue-router";
|
import { type RouteRecordRaw } from 'vue-router'
|
||||||
import { ElNotification } from "element-plus";
|
import { ElNotification } from 'element-plus'
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from '@/stores/modules/auth'
|
||||||
|
|
||||||
// 引入 views 文件夹下所有 vue 文件
|
// 引入 views 文件夹下所有 vue 文件
|
||||||
const modules = import.meta.glob("@/views/**/*.vue");
|
const modules = import.meta.glob('@/views/**/*.vue')
|
||||||
|
|
||||||
|
let isInitializing = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除已有的动态路由
|
||||||
|
*/
|
||||||
|
const clearDynamicRoutes = () => {
|
||||||
|
const routes = router.getRoutes()
|
||||||
|
routes.forEach(route => {
|
||||||
|
if (route.name && route.name !== 'layout' && route.name !== 'login' && route.name !== 'testScriptAdd') {
|
||||||
|
router.removeRoute(route.name)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 component 路径查找对应的模块
|
||||||
|
* @param path 组件路径
|
||||||
|
*/
|
||||||
|
const resolveComponentModule = async (path: string) => {
|
||||||
|
// 规范化路径,去除首尾斜杠
|
||||||
|
let normalizedPath = path.trim()
|
||||||
|
if (!normalizedPath.startsWith('/')) {
|
||||||
|
normalizedPath = '/' + normalizedPath
|
||||||
|
}
|
||||||
|
if (normalizedPath.endsWith('.vue')) {
|
||||||
|
normalizedPath = normalizedPath.slice(0, -4)
|
||||||
|
}
|
||||||
|
|
||||||
|
const fullPath = `/src/views${normalizedPath}.vue`
|
||||||
|
return modules[fullPath]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 初始化动态路由
|
* @description 初始化动态路由
|
||||||
*/
|
*/
|
||||||
export const initDynamicRouter = async () => {
|
export const initDynamicRouter = async () => {
|
||||||
const userStore = useUserStore();
|
if (isInitializing) return Promise.reject(new Error('Dynamic router initialization in progress'))
|
||||||
const authStore = useAuthStore();
|
|
||||||
|
|
||||||
try {
|
isInitializing = true
|
||||||
// 1.获取菜单列表 && 按钮权限列表
|
const userStore = useUserStore()
|
||||||
await authStore.getAuthMenuList();
|
const authStore = useAuthStore()
|
||||||
await authStore.getAuthButtonList();
|
|
||||||
|
|
||||||
// 2.判断当前用户有没有菜单权限
|
try {
|
||||||
if (!authStore.authMenuListGet.length) {
|
// 1. 获取菜单列表 && 按钮权限列表
|
||||||
ElNotification({
|
await authStore.getAuthMenuList()
|
||||||
title: "无权限访问",
|
await authStore.getAuthButtonList()
|
||||||
message: "当前账号无任何菜单权限,请联系系统管理员!",
|
|
||||||
type: "warning",
|
// 2. 判断当前用户有没有菜单权限
|
||||||
duration: 3000
|
if (!authStore.authMenuListGet.length) {
|
||||||
});
|
ElNotification({
|
||||||
userStore.setAccessToken("");
|
title: '无权限访问',
|
||||||
userStore.setRefreshToken("");
|
message: '当前账号无任何菜单权限,请联系系统管理员!',
|
||||||
userStore.setExp(0)
|
type: 'warning',
|
||||||
router.replace(LOGIN_URL);
|
duration: 3000
|
||||||
return Promise.reject("No permission");
|
})
|
||||||
|
userStore.setAccessToken('')
|
||||||
|
userStore.setRefreshToken('')
|
||||||
|
userStore.setExp(0)
|
||||||
|
await router.replace(LOGIN_URL)
|
||||||
|
return Promise.reject('No permission')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 清理之前的动态路由
|
||||||
|
clearDynamicRoutes()
|
||||||
|
|
||||||
|
// 4. 添加动态路由
|
||||||
|
for (const item of authStore.flatMenuListGet) {
|
||||||
|
// 删除 children 避免冗余嵌套
|
||||||
|
if (item.children) delete item.children
|
||||||
|
|
||||||
|
// 处理组件映射
|
||||||
|
if (item.component && typeof item.component === 'string') {
|
||||||
|
const moduleLoader = await resolveComponentModule(item.component)
|
||||||
|
if (moduleLoader) {
|
||||||
|
item.component = moduleLoader
|
||||||
|
} else {
|
||||||
|
console.warn(`未能找到组件: ${item.component}`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 类型守卫:确保满足 RouteRecordRaw 接口要求
|
||||||
|
if (
|
||||||
|
typeof item.path === 'string' &&
|
||||||
|
(typeof item.component === 'function' || typeof item.redirect === 'string')
|
||||||
|
) {
|
||||||
|
const routeItem = item as unknown as RouteRecordRaw
|
||||||
|
if (item.meta.isFull) {
|
||||||
|
router.addRoute(routeItem)
|
||||||
|
} else {
|
||||||
|
router.addRoute('layout', routeItem)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('Invalid route item:', item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
||||||
|
userStore.setAccessToken('')
|
||||||
|
userStore.setRefreshToken('')
|
||||||
|
userStore.setExp(0)
|
||||||
|
await router.replace(LOGIN_URL)
|
||||||
|
return Promise.reject(error)
|
||||||
|
} finally {
|
||||||
|
isInitializing = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 3.添加动态路由
|
|
||||||
authStore.flatMenuListGet.forEach(item => {
|
|
||||||
item.children && delete item.children;
|
|
||||||
|
|
||||||
if (item.component && typeof item.component == "string") {
|
|
||||||
item.component = modules["/src/views" + item.component + ".vue"];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.meta.isFull) {
|
|
||||||
router.addRoute(item as unknown as RouteRecordRaw);
|
|
||||||
} else {
|
|
||||||
router.addRoute("layout", item as unknown as RouteRecordRaw);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
|
||||||
userStore.setAccessToken("");
|
|
||||||
userStore.setRefreshToken("");
|
|
||||||
userStore.setExp(0)
|
|
||||||
router.replace(LOGIN_URL);
|
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,65 +1,69 @@
|
|||||||
export type LayoutType = 'vertical' | 'classic' | 'transverse' | 'columns';
|
import { type Activate } from '@/api/activate/interface'
|
||||||
|
|
||||||
export type AssemblySizeType = 'large' | 'default' | 'small';
|
export type LayoutType = 'vertical' | 'classic' | 'transverse' | 'columns'
|
||||||
|
|
||||||
export type LanguageType = 'zh' | 'en' | null;
|
export type AssemblySizeType = 'large' | 'default' | 'small'
|
||||||
|
|
||||||
|
export type LanguageType = 'zh' | 'en' | null
|
||||||
|
|
||||||
/* GlobalState */
|
/* GlobalState */
|
||||||
export interface GlobalState {
|
export interface GlobalState {
|
||||||
layout: LayoutType;
|
layout: LayoutType
|
||||||
assemblySize: AssemblySizeType;
|
assemblySize: AssemblySizeType
|
||||||
language: LanguageType;
|
language: LanguageType
|
||||||
maximize: boolean;
|
maximize: boolean
|
||||||
primary: string;
|
primary: string
|
||||||
isDark: boolean;
|
isDark: boolean
|
||||||
isGrey: boolean;
|
isGrey: boolean
|
||||||
isWeak: boolean;
|
isWeak: boolean
|
||||||
asideInverted: boolean;
|
asideInverted: boolean
|
||||||
headerInverted: boolean;
|
headerInverted: boolean
|
||||||
isCollapse: boolean;
|
isCollapse: boolean
|
||||||
accordion: boolean;
|
accordion: boolean
|
||||||
breadcrumb: boolean;
|
breadcrumb: boolean
|
||||||
breadcrumbIcon: boolean;
|
breadcrumbIcon: boolean
|
||||||
tabs: boolean;
|
tabs: boolean
|
||||||
tabsIcon: boolean;
|
tabsIcon: boolean
|
||||||
footer: boolean;
|
footer: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/* UserState */
|
/* UserState */
|
||||||
export interface UserState {
|
export interface UserState {
|
||||||
accessToken: string;
|
accessToken: string
|
||||||
refreshToken: string;
|
refreshToken: string
|
||||||
isRefreshToken: boolean;
|
isRefreshToken: boolean
|
||||||
userInfo: { id: string, name: string,loginName:string };
|
exp: number
|
||||||
|
userInfo: { id: string; name: string; loginName: string }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tabsMenuProps */
|
/* tabsMenuProps */
|
||||||
export interface TabsMenuProps {
|
export interface TabsMenuProps {
|
||||||
icon: string;
|
icon: string
|
||||||
title: string;
|
title: string
|
||||||
path: string;
|
path: string
|
||||||
name: string;
|
name: string
|
||||||
close: boolean;
|
close: boolean
|
||||||
isKeepAlive: boolean;
|
isKeepAlive: boolean
|
||||||
unshift?: boolean;
|
unshift?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TabsState */
|
/* TabsState */
|
||||||
export interface TabsState {
|
export interface TabsState {
|
||||||
tabsMenuList: TabsMenuProps[];
|
tabsMenuList: TabsMenuProps[]
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AuthState */
|
/* AuthState */
|
||||||
export interface AuthState {
|
export interface AuthState {
|
||||||
routeName: string;
|
routeName: string
|
||||||
authButtonList: {
|
authButtonList: {
|
||||||
[key: string]: string[];
|
[key: string]: string[]
|
||||||
};
|
}
|
||||||
authMenuList: Menu.MenuOptions[];
|
authMenuList: Menu.MenuOptions[]
|
||||||
showMenuFlag: boolean;
|
showMenuFlag: boolean
|
||||||
|
activateInfo: Activate.ActivationCodePlaintext
|
||||||
}
|
}
|
||||||
|
|
||||||
/* KeepAliveState */
|
/* KeepAliveState */
|
||||||
export interface KeepAliveState {
|
export interface KeepAliveState {
|
||||||
keepAliveName: string[];
|
keepAliveName: string[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { AuthState } from '@/stores/interface'
|
import { type AuthState } from '@/stores/interface'
|
||||||
import { getAuthButtonListApi, getAuthMenuListApi } from '@/api/user/login'
|
import { getAuthButtonListApi, getAuthMenuListApi } from '@/api/user/login'
|
||||||
import { getAllBreadcrumbList, getFlatMenuList, getShowMenuList } from '@/utils'
|
import { getAllBreadcrumbList, getFlatMenuList, getShowMenuList } from '@/utils'
|
||||||
import { useRouter } from 'vue-router'
|
|
||||||
import { AUTH_STORE_KEY } from '@/stores/constant'
|
import { AUTH_STORE_KEY } from '@/stores/constant'
|
||||||
import { useModeStore } from '@/stores/modules/mode'
|
import { useModeStore } from '@/stores/modules/mode'
|
||||||
import { getLicense } from '@/api/activate'
|
import { getLicense } from '@/api/activate'
|
||||||
import type { Activate } from '@/api/activate/interface'
|
import type { Activate } from '@/api/activate/interface'
|
||||||
|
|
||||||
export const useAuthStore = defineStore({
|
export const useAuthStore = defineStore(AUTH_STORE_KEY, {
|
||||||
id: AUTH_STORE_KEY,
|
|
||||||
state: (): AuthState => ({
|
state: (): AuthState => ({
|
||||||
// 按钮权限列表
|
// 按钮权限列表
|
||||||
authButtonList: {},
|
authButtonList: {},
|
||||||
@@ -19,8 +17,7 @@ export const useAuthStore = defineStore({
|
|||||||
routeName: '',
|
routeName: '',
|
||||||
//登录不显示菜单栏和导航栏,点击进入测试的时候显示
|
//登录不显示菜单栏和导航栏,点击进入测试的时候显示
|
||||||
showMenuFlag: JSON.parse(localStorage.getItem('showMenuFlag') as string),
|
showMenuFlag: JSON.parse(localStorage.getItem('showMenuFlag') as string),
|
||||||
router: useRouter(),
|
activateInfo: {} as Activate.ActivationCodePlaintext
|
||||||
activateInfo: {}
|
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
// 按钮权限列表
|
// 按钮权限列表
|
||||||
@@ -72,14 +69,28 @@ export const useAuthStore = defineStore({
|
|||||||
localStorage.setItem('showMenuFlag', 'true')
|
localStorage.setItem('showMenuFlag', 'true')
|
||||||
},
|
},
|
||||||
//更改模式
|
//更改模式
|
||||||
async changeModel() {
|
changeModel() {
|
||||||
this.showMenuFlag = false
|
this.showMenuFlag = false
|
||||||
localStorage.removeItem('showMenuFlag')
|
localStorage.removeItem('showMenuFlag')
|
||||||
this.router.push({ path: '/home/index' })
|
|
||||||
},
|
},
|
||||||
async setActivateInfo() {
|
async setActivateInfo() {
|
||||||
const license_result = await getLicense()
|
const license_result = await getLicense()
|
||||||
const licenseData = license_result.data as unknown as Activate.ActivationCodePlaintext
|
const licenseData = license_result.data as Activate.ActivationCodePlaintext
|
||||||
|
if (!licenseData.simulate) {
|
||||||
|
licenseData.simulate = {
|
||||||
|
permanently: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!licenseData.digital) {
|
||||||
|
licenseData.digital = {
|
||||||
|
permanently: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!licenseData.contrast) {
|
||||||
|
licenseData.contrast = {
|
||||||
|
permanently: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
this.activateInfo = licenseData
|
this.activateInfo = licenseData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,37 @@
|
|||||||
import {defineStore} from "pinia";
|
import { defineStore } from 'pinia'
|
||||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
import { CHECK_STORE_KEY } from '@/stores/constant'
|
||||||
import type {CheckData} from "@/api/check/interface";
|
import type { CheckData } from '@/api/check/interface'
|
||||||
import type {Plan} from '@/api/plan/interface'
|
import type { Plan } from '@/api/plan/interface'
|
||||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
import { useAppSceneStore } from '@/stores/modules/mode'
|
||||||
|
|
||||||
export const useCheckStore = defineStore(CHECK_STORE_KEY, {
|
export const useCheckStore = defineStore(CHECK_STORE_KEY, {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
devices: [] as CheckData.Device[],
|
devices: [] as CheckData.Device[],
|
||||||
plan: {} as Plan.ResPlan,
|
plan: {} as Plan.ResPlan,
|
||||||
selectTestItems: {preTest: true, timeTest: false, channelsTest: false, test: true} as CheckData.SelectTestItem,
|
selectTestItems: {
|
||||||
|
preTest: true,
|
||||||
|
timeTest: false,
|
||||||
|
channelsTest: false,
|
||||||
|
test: true
|
||||||
|
} as CheckData.SelectTestItem,
|
||||||
checkType: 1, // 0:手动检测 1:自动检测
|
checkType: 1, // 0:手动检测 1:自动检测
|
||||||
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||||
showDetailType: 0, // 0:数据查询 1:误差体系跟换 2:正式检测
|
showDetailType: 0, // 0:数据查询 1:误差体系跟换 2:正式检测
|
||||||
temperature: 0,
|
temperature: 0,
|
||||||
humidity: 0,
|
humidity: 0,
|
||||||
chnNumList: [],//连线数据
|
chnNumList: [] as string[], //连线数据
|
||||||
nodesConnectable: true,//设置是能可以连线
|
nodesConnectable: true //设置是能可以连线
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
addDevices(device: CheckData.Device[]) {
|
addDevices(device: CheckData.Device[]) {
|
||||||
this.devices.push(...device);
|
this.devices.push(...device)
|
||||||
},
|
},
|
||||||
setPlan(plan: Plan.ResPlan) {
|
setPlan(plan: Plan.ResPlan) {
|
||||||
this.plan = plan
|
this.plan = plan
|
||||||
},
|
},
|
||||||
clearDevices() {
|
clearDevices() {
|
||||||
this.devices = [];
|
this.devices = []
|
||||||
},
|
},
|
||||||
initSelectTestItems() {
|
initSelectTestItems() {
|
||||||
const appSceneStore = useAppSceneStore()
|
const appSceneStore = useAppSceneStore()
|
||||||
@@ -56,12 +61,11 @@ export const useCheckStore = defineStore(CHECK_STORE_KEY, {
|
|||||||
setHumidity(humidity: number) {
|
setHumidity(humidity: number) {
|
||||||
this.humidity = humidity
|
this.humidity = humidity
|
||||||
},
|
},
|
||||||
setChnNum(chnNumList: string[]) {
|
setChnNum(chnNumList: string[]) {
|
||||||
this.chnNumList = chnNumList
|
this.chnNumList = chnNumList
|
||||||
},
|
},
|
||||||
setNodesConnectable(nodesConnectable: boolean) {
|
setNodesConnectable(nodesConnectable: boolean) {
|
||||||
this.nodesConnectable = nodesConnectable
|
this.nodesConnectable = nodesConnectable
|
||||||
},
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
@@ -5,11 +5,9 @@ import { DICT_STORE_KEY } from '@/stores/constant'
|
|||||||
// 模拟数据
|
// 模拟数据
|
||||||
//import dictData from '@/api/system/dictData'
|
//import dictData from '@/api/system/dictData'
|
||||||
|
|
||||||
|
export const useDictStore = defineStore(DICT_STORE_KEY, {
|
||||||
export const useDictStore = defineStore({
|
|
||||||
id: DICT_STORE_KEY,
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
dictData: [] as Dict[],
|
dictData: [] as Dict[]
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
@@ -27,7 +25,7 @@ export const useDictStore = defineStore({
|
|||||||
// 初始化获取全部字典数据并缓存
|
// 初始化获取全部字典数据并缓存
|
||||||
async initDictData(initData: Dict[]) {
|
async initDictData(initData: Dict[]) {
|
||||||
this.dictData = initData
|
this.dictData = initData
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
persist: piniaPersistConfig(DICT_STORE_KEY),
|
persist: piniaPersistConfig(DICT_STORE_KEY)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,55 +1,53 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from 'pinia'
|
||||||
import { type GlobalState } from "@/stores/interface";
|
import { type GlobalState } from '@/stores/interface'
|
||||||
import { DEFAULT_PRIMARY} from "@/config";
|
import { DEFAULT_PRIMARY } from '@/config'
|
||||||
import piniaPersistConfig from "@/stores/helper/persist";
|
import piniaPersistConfig from '@/stores/helper/persist'
|
||||||
import {GLOBAL_STORE_KEY} from "@/stores/constant";
|
import { GLOBAL_STORE_KEY } from '@/stores/constant'
|
||||||
|
|
||||||
export const useGlobalStore = defineStore({
|
export const useGlobalStore = defineStore(GLOBAL_STORE_KEY, {
|
||||||
id: GLOBAL_STORE_KEY,
|
// 修改默认值之后,需清除 localStorage 数据
|
||||||
// 修改默认值之后,需清除 localStorage 数据
|
state: (): GlobalState => ({
|
||||||
state: (): GlobalState => ({
|
// 布局模式 (纵向:vertical | 经典:classic | 横向:transverse | 分栏:columns)
|
||||||
// 布局模式 (纵向:vertical | 经典:classic | 横向:transverse | 分栏:columns)
|
layout: 'transverse',
|
||||||
layout: "transverse",
|
// element 组件大小
|
||||||
// element 组件大小
|
assemblySize: 'default',
|
||||||
assemblySize: "default",
|
// 当前系统语言
|
||||||
// 当前系统语言
|
language: null,
|
||||||
language: null,
|
// 当前页面是否全屏
|
||||||
// 当前页面是否全屏
|
maximize: false,
|
||||||
maximize: false,
|
// 主题颜色
|
||||||
// 主题颜色
|
primary: DEFAULT_PRIMARY,
|
||||||
primary: DEFAULT_PRIMARY,
|
// 深色模式
|
||||||
// 深色模式
|
isDark: false,
|
||||||
isDark: false,
|
// 灰色模式
|
||||||
// 灰色模式
|
isGrey: false,
|
||||||
isGrey: false,
|
// 色弱模式
|
||||||
// 色弱模式
|
isWeak: false,
|
||||||
isWeak: false,
|
// 侧边栏反转
|
||||||
// 侧边栏反转
|
asideInverted: false,
|
||||||
asideInverted: false,
|
// 头部反转
|
||||||
// 头部反转
|
headerInverted: false,
|
||||||
headerInverted: false,
|
// 折叠菜单
|
||||||
// 折叠菜单
|
isCollapse: false,
|
||||||
isCollapse: false,
|
// 菜单手风琴
|
||||||
// 菜单手风琴
|
accordion: false,
|
||||||
accordion: false,
|
// 面包屑导航
|
||||||
// 面包屑导航
|
breadcrumb: true,
|
||||||
breadcrumb: true,
|
// 面包屑导航图标
|
||||||
// 面包屑导航图标
|
breadcrumbIcon: true,
|
||||||
breadcrumbIcon: true,
|
// 标签页
|
||||||
// 标签页
|
tabs: true,
|
||||||
tabs: true,
|
// 标签页图标
|
||||||
// 标签页图标
|
tabsIcon: true,
|
||||||
tabsIcon: true,
|
// 页脚
|
||||||
// 页脚
|
footer: false
|
||||||
footer: false
|
}),
|
||||||
|
getters: {},
|
||||||
}),
|
actions: {
|
||||||
getters: {},
|
// Set GlobalState
|
||||||
actions: {
|
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
||||||
// Set GlobalState
|
this.$patch({ [args[0]]: args[1] })
|
||||||
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
}
|
||||||
this.$patch({ [args[0]]: args[1] });
|
},
|
||||||
}
|
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
||||||
},
|
})
|
||||||
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,24 +1,23 @@
|
|||||||
import {defineStore} from "pinia";
|
import { defineStore } from 'pinia'
|
||||||
import {KeepAliveState} from "@/stores/interface";
|
import { type KeepAliveState } from '@/stores/interface'
|
||||||
import {KEEP_ALIVE_STORE_KEY} from '@/stores/constant'
|
import { KEEP_ALIVE_STORE_KEY } from '@/stores/constant'
|
||||||
|
|
||||||
export const useKeepAliveStore = defineStore({
|
export const useKeepAliveStore = defineStore(KEEP_ALIVE_STORE_KEY, {
|
||||||
id: KEEP_ALIVE_STORE_KEY,
|
state: (): KeepAliveState => ({
|
||||||
state: (): KeepAliveState => ({
|
keepAliveName: []
|
||||||
keepAliveName: []
|
}),
|
||||||
}),
|
actions: {
|
||||||
actions: {
|
// Add KeepAliveName
|
||||||
// Add KeepAliveName
|
async addKeepAliveName(name: string) {
|
||||||
async addKeepAliveName(name: string) {
|
!this.keepAliveName.includes(name) && this.keepAliveName.push(name)
|
||||||
!this.keepAliveName.includes(name) && this.keepAliveName.push(name);
|
},
|
||||||
},
|
// Remove KeepAliveName
|
||||||
// Remove KeepAliveName
|
async removeKeepAliveName(name: string) {
|
||||||
async removeKeepAliveName(name: string) {
|
this.keepAliveName = this.keepAliveName.filter(item => item !== name)
|
||||||
this.keepAliveName = this.keepAliveName.filter(item => item !== name);
|
},
|
||||||
},
|
// Set KeepAliveName
|
||||||
// Set KeepAliveName
|
async setKeepAliveName(keepAliveName: string[] = []) {
|
||||||
async setKeepAliveName(keepAliveName: string[] = []) {
|
this.keepAliveName = keepAliveName
|
||||||
this.keepAliveName = keepAliveName;
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,29 +1,17 @@
|
|||||||
// src/stores/modules/mode.ts
|
// src/stores/modules/mode.ts
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
// export const useModeStore = defineStore('mode', {
|
|
||||||
// state: () => ({
|
|
||||||
// currentMode: '' as string,
|
|
||||||
// }),
|
|
||||||
// actions: {
|
|
||||||
// setCurrentMode(modeName: string) {
|
|
||||||
// this.currentMode = modeName;
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
export const useModeStore = defineStore('mode', {
|
export const useModeStore = defineStore('mode', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
currentMode: localStorage.getItem('currentMode') || '' as string,
|
currentMode: localStorage.getItem('currentMode') || ('' as string)
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
setCurrentMode(modeName: string) {
|
setCurrentMode(modeName: string) {
|
||||||
this.currentMode = modeName;
|
this.currentMode = modeName
|
||||||
localStorage.setItem('currentMode', modeName); // 保存到 localStorage
|
localStorage.setItem('currentMode', modeName) // 保存到 localStorage
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
export const useAppSceneStore = defineStore('scene', {
|
export const useAppSceneStore = defineStore('scene', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
|
|||||||
@@ -1,81 +1,77 @@
|
|||||||
import router from "@/routers";
|
import router from '@/routers'
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from 'pinia'
|
||||||
import { getUrlWithParams } from "@/utils";
|
import { getUrlWithParams } from '@/utils'
|
||||||
import { useKeepAliveStore } from "./keepAlive";
|
import { useKeepAliveStore } from './keepAlive'
|
||||||
import { TabsState, TabsMenuProps } from "@/stores/interface";
|
import type { TabsMenuProps, TabsState } from '@/stores/interface'
|
||||||
import piniaPersistConfig from "@/stores/helper/persist";
|
import { TABS_STORE_KEY } from '@/stores/constant'
|
||||||
import {TABS_STORE_KEY} from "@/stores/constant";
|
|
||||||
|
|
||||||
const keepAliveStore = useKeepAliveStore();
|
const keepAliveStore = useKeepAliveStore()
|
||||||
|
|
||||||
export const useTabsStore = defineStore({
|
|
||||||
id: TABS_STORE_KEY,
|
|
||||||
state: (): TabsState => ({
|
|
||||||
tabsMenuList: []
|
|
||||||
}),
|
|
||||||
actions: {
|
|
||||||
// Add Tabs
|
|
||||||
async addTabs(tabItem: TabsMenuProps) {
|
|
||||||
|
|
||||||
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
|
||||||
if (tabItem?.unshift) {
|
|
||||||
this.tabsMenuList.unshift(tabItem);
|
|
||||||
}else{
|
|
||||||
this.tabsMenuList.push(tabItem);
|
|
||||||
|
|
||||||
|
export const useTabsStore = defineStore(TABS_STORE_KEY, {
|
||||||
|
state: (): TabsState => ({
|
||||||
|
tabsMenuList: []
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
// Add Tabs
|
||||||
|
async addTabs(tabItem: TabsMenuProps) {
|
||||||
|
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
||||||
|
if (tabItem?.unshift) {
|
||||||
|
this.tabsMenuList.unshift(tabItem)
|
||||||
|
} else {
|
||||||
|
this.tabsMenuList.push(tabItem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
||||||
|
await keepAliveStore.addKeepAliveName(tabItem.name)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Remove Tabs
|
||||||
|
async removeTabs(tabPath: string, isCurrent: boolean = true) {
|
||||||
|
if (isCurrent) {
|
||||||
|
this.tabsMenuList.forEach((item, index) => {
|
||||||
|
if (item.path !== tabPath) return
|
||||||
|
const nextTab = this.tabsMenuList[index + 1] || this.tabsMenuList[index - 1]
|
||||||
|
if (!nextTab) return
|
||||||
|
router.push(nextTab.path)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.tabsMenuList = this.tabsMenuList.filter(item => item.path !== tabPath)
|
||||||
|
// remove keepalive
|
||||||
|
const tabItem = this.tabsMenuList.find(item => item.path === tabPath)
|
||||||
|
tabItem?.isKeepAlive && (await keepAliveStore.removeKeepAliveName(tabItem.name))
|
||||||
|
},
|
||||||
|
// Close Tabs On Side
|
||||||
|
async closeTabsOnSide(path: string, type: 'left' | 'right') {
|
||||||
|
const currentIndex = this.tabsMenuList.findIndex(item => item.path === path)
|
||||||
|
if (currentIndex !== -1) {
|
||||||
|
const range = type === 'left' ? [0, currentIndex] : [currentIndex + 1, this.tabsMenuList.length]
|
||||||
|
this.tabsMenuList = this.tabsMenuList.filter((item, index) => {
|
||||||
|
return index < range[0] || index >= range[1] || !item.close
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// set keepalive
|
||||||
|
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive)
|
||||||
|
await keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.name))
|
||||||
|
},
|
||||||
|
// Close MultipleTab
|
||||||
|
async closeMultipleTab(tabsMenuValue?: string) {
|
||||||
|
this.tabsMenuList = this.tabsMenuList.filter(item => {
|
||||||
|
return item.path === tabsMenuValue || !item.close
|
||||||
|
})
|
||||||
|
// set keepalive
|
||||||
|
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive)
|
||||||
|
await keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.name))
|
||||||
|
},
|
||||||
|
// Set Tabs
|
||||||
|
async setTabs(tabsMenuList: TabsMenuProps[]) {
|
||||||
|
this.tabsMenuList = tabsMenuList
|
||||||
|
},
|
||||||
|
// Set Tabs Title
|
||||||
|
async setTabsTitle(title: string) {
|
||||||
|
this.tabsMenuList.forEach(item => {
|
||||||
|
if (item.path == getUrlWithParams()) item.title = title
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
|
||||||
keepAliveStore.addKeepAliveName(tabItem.name);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Remove Tabs
|
|
||||||
async removeTabs(tabPath: string, isCurrent: boolean = true) {
|
|
||||||
if (isCurrent) {
|
|
||||||
this.tabsMenuList.forEach((item, index) => {
|
|
||||||
if (item.path !== tabPath) return;
|
|
||||||
const nextTab = this.tabsMenuList[index + 1] || this.tabsMenuList[index - 1];
|
|
||||||
if (!nextTab) return;
|
|
||||||
router.push(nextTab.path);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.tabsMenuList = this.tabsMenuList.filter(item => item.path !== tabPath);
|
|
||||||
// remove keepalive
|
|
||||||
const tabItem = this.tabsMenuList.find(item => item.path === tabPath);
|
|
||||||
tabItem?.isKeepAlive && keepAliveStore.removeKeepAliveName(tabItem.name);
|
|
||||||
},
|
|
||||||
// Close Tabs On Side
|
|
||||||
async closeTabsOnSide(path: string, type: "left" | "right") {
|
|
||||||
const currentIndex = this.tabsMenuList.findIndex(item => item.path === path);
|
|
||||||
if (currentIndex !== -1) {
|
|
||||||
const range = type === "left" ? [0, currentIndex] : [currentIndex + 1, this.tabsMenuList.length];
|
|
||||||
this.tabsMenuList = this.tabsMenuList.filter((item, index) => {
|
|
||||||
return index < range[0] || index >= range[1] || !item.close;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// set keepalive
|
|
||||||
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive);
|
|
||||||
keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.name));
|
|
||||||
},
|
|
||||||
// Close MultipleTab
|
|
||||||
async closeMultipleTab(tabsMenuValue?: string) {
|
|
||||||
this.tabsMenuList = this.tabsMenuList.filter(item => {
|
|
||||||
return item.path === tabsMenuValue || !item.close;
|
|
||||||
});
|
|
||||||
// set keepalive
|
|
||||||
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive);
|
|
||||||
keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.name));
|
|
||||||
},
|
|
||||||
// Set Tabs
|
|
||||||
async setTabs(tabsMenuList: TabsMenuProps[]) {
|
|
||||||
this.tabsMenuList = tabsMenuList;
|
|
||||||
},
|
|
||||||
// Set Tabs Title
|
|
||||||
async setTabsTitle(title: string) {
|
|
||||||
this.tabsMenuList.forEach(item => {
|
|
||||||
if (item.path == getUrlWithParams()) item.title = title;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
// persist: piniaPersistConfig(TABS_STORE_KEY)
|
||||||
// persist: piniaPersistConfig(TABS_STORE_KEY)
|
})
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,36 +1,57 @@
|
|||||||
import {defineStore} from "pinia";
|
import { defineStore } from 'pinia'
|
||||||
import {UserState} from "@/stores/interface";
|
import { type UserState } from '@/stores/interface'
|
||||||
import piniaPersistConfig from "@/stores/helper/persist";
|
import piniaPersistConfig from '@/stores/helper/persist'
|
||||||
import {USER_STORE_KEY} from "@/stores/constant";
|
import { USER_STORE_KEY } from '@/stores/constant'
|
||||||
|
import { logoutApi } from '@/api/user/login'
|
||||||
|
import { useAuthStore } from '@/stores/modules/auth'
|
||||||
|
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
export const useUserStore = defineStore(USER_STORE_KEY, {
|
||||||
id: USER_STORE_KEY,
|
state: (): UserState => ({
|
||||||
state: (): UserState => ({
|
accessToken: '',
|
||||||
accessToken: "",
|
refreshToken: '',
|
||||||
refreshToken: "",
|
isRefreshToken: false,
|
||||||
isRefreshToken:false,
|
exp: Number(0),
|
||||||
exp: Number(0),
|
userInfo: { id: '', name: '', loginName: '' }
|
||||||
userInfo: {id:"", name: "" ,loginName:""},
|
}),
|
||||||
}),
|
getters: {},
|
||||||
getters: {},
|
actions: {
|
||||||
actions: {
|
// Set Token
|
||||||
// Set Token
|
setAccessToken(accessToken: string) {
|
||||||
setAccessToken(accessToken: string) {
|
this.accessToken = accessToken
|
||||||
this.accessToken = accessToken;
|
},
|
||||||
|
setRefreshToken(refreshToken: string) {
|
||||||
|
this.refreshToken = refreshToken
|
||||||
|
},
|
||||||
|
setIsRefreshToken(isRefreshToken: boolean) {
|
||||||
|
this.isRefreshToken = isRefreshToken
|
||||||
|
},
|
||||||
|
// Set setUserInfo
|
||||||
|
setUserInfo(userInfo: UserState['userInfo']) {
|
||||||
|
this.userInfo = userInfo
|
||||||
|
},
|
||||||
|
setExp(exp: number) {
|
||||||
|
this.exp = exp
|
||||||
|
},
|
||||||
|
async logout() {
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
const modeStore = useModeStore()
|
||||||
|
const appSceneStore = useAppSceneStore()
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// 1.执行退出登录接口
|
||||||
|
await logoutApi()
|
||||||
|
// 2.清除 Token
|
||||||
|
this.setAccessToken('')
|
||||||
|
this.setRefreshToken('')
|
||||||
|
this.setExp(0)
|
||||||
|
this.setUserInfo({ id: '', name: '', loginName: '' })
|
||||||
|
this.setIsRefreshToken(false)
|
||||||
|
dictStore.setDictData([])
|
||||||
|
modeStore.setCurrentMode('')
|
||||||
|
appSceneStore.setCurrentMode('')
|
||||||
|
await authStore.resetAuthStore()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setRefreshToken(refreshToken: string) {
|
persist: piniaPersistConfig(USER_STORE_KEY)
|
||||||
this.refreshToken = refreshToken;
|
})
|
||||||
},
|
|
||||||
setIsRefreshToken(isRefreshToken: boolean) {
|
|
||||||
this.isRefreshToken = isRefreshToken;
|
|
||||||
},
|
|
||||||
// Set setUserInfo
|
|
||||||
setUserInfo(userInfo: UserState["userInfo"]) {
|
|
||||||
this.userInfo = userInfo;
|
|
||||||
},
|
|
||||||
setExp(exp: number) {
|
|
||||||
this.exp = exp;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
persist: piniaPersistConfig(USER_STORE_KEY),
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
show-checkbox
|
show-checkbox
|
||||||
:default-checked-keys="checkedKeysRef"
|
:default-checked-keys="checkedKeysRef"
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
>
|
>
|
||||||
|
|
||||||
</el-tree>
|
</el-tree>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -209,4 +210,4 @@ const getAllIds = (functions: Function.ResFunction[]): string[] => {
|
|||||||
refreshTable: (() => Promise<void>) | undefined;
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
:prevent-scrolling="true" :fit-view="true" :min-zoom="1" :max-zoom="1"
|
:prevent-scrolling="true" :fit-view="true" :min-zoom="1" :max-zoom="1"
|
||||||
:nodesConnectable="checkStore.nodesConnectable" :elements-selectable="false" auto-connect
|
:nodesConnectable="checkStore.nodesConnectable" :elements-selectable="false" auto-connect
|
||||||
@connect="handleConnect" @connect-start="handleConnectStart" @connect-end="handleConnectEnd"
|
@connect="handleConnect" @connect-start="handleConnectStart" @connect-end="handleConnectEnd"
|
||||||
@pane-ready="onPaneReady" v-on:pane-mouse-move="false"></VueFlow>
|
@pane-ready="onPaneReady" @node-double-click="handleNodeDoubleClick" v-on:pane-mouse-move="false"></VueFlow>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 底部操作按钮 -->
|
<!-- 底部操作按钮 -->
|
||||||
@@ -35,6 +35,8 @@ import { ElMessage, stepProps } from 'element-plus'
|
|||||||
import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件
|
import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件
|
||||||
import { jwtUtil } from '@/utils/jwtUtil'
|
import { jwtUtil } from '@/utils/jwtUtil'
|
||||||
import { useCheckStore } from '@/stores/modules/check'
|
import { useCheckStore } from '@/stores/modules/check'
|
||||||
|
import { ipc } from '@/utils/ipcRenderer'
|
||||||
|
import { fa, tr } from 'element-plus/es/locale'
|
||||||
const vueFlowElement = ref(442)
|
const vueFlowElement = ref(442)
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
@@ -67,19 +69,151 @@ const prop = defineProps({
|
|||||||
const dialogHeight = ref(600)
|
const dialogHeight = ref(600)
|
||||||
|
|
||||||
// 初始化 VueFlow,注册自定义连线类型
|
// 初始化 VueFlow,注册自定义连线类型
|
||||||
const { edges, setViewport } = useVueFlow({
|
const { edges, setViewport,removeEdges } = useVueFlow({
|
||||||
edgeTypes: {
|
edgeTypes: {
|
||||||
default: CustomEdge
|
default: CustomEdge
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const handleNodeDoubleClick = (event: any) => {
|
||||||
|
const { node } = event
|
||||||
|
|
||||||
|
// 判断节点类型
|
||||||
|
if (node.type === 'input') {
|
||||||
|
// 被检通道节点,检查是否已经连接
|
||||||
|
const isConnected = edges.value.some(edge => edge.source === node.id)
|
||||||
|
|
||||||
|
if (isConnected) {
|
||||||
|
ElMessage.warning('该被检通道已经连接,不能重复连接')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 寻找未连接的标准通道节点(优先寻找未被连接的标准通道)
|
||||||
|
const targetNodes = nodes.value.filter(n => n.type === 'output')
|
||||||
|
|
||||||
|
// 首先尝试连接尚未被连接的标准通道
|
||||||
|
for (const targetNode of targetNodes) {
|
||||||
|
const isTargetConnected = edges.value.some(edge => edge.target === targetNode.id)
|
||||||
|
|
||||||
|
if (!isTargetConnected) {
|
||||||
|
// 检查是否已存在连接(虽然这里应该不会存在)
|
||||||
|
const isAlreadyConnected = edges.value.some(edge =>
|
||||||
|
edge.source === node.id && edge.target === targetNode.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!isAlreadyConnected) {
|
||||||
|
const newEdge = {
|
||||||
|
id: `edge-${node.id}-${targetNode.id}`,
|
||||||
|
source: node.id,
|
||||||
|
target: targetNode.id,
|
||||||
|
type: 'default'
|
||||||
|
}
|
||||||
|
edges.value.push(newEdge)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果所有标准通道都已被连接,尝试连接已被连接但连接的是其他被检通道的标准通道
|
||||||
|
for (const targetNode of targetNodes) {
|
||||||
|
// 检查是否已存在连接
|
||||||
|
const isAlreadyConnected = edges.value.some(edge =>
|
||||||
|
edge.source === node.id && edge.target === targetNode.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!isAlreadyConnected) {
|
||||||
|
const isTargetConnected = edges.value.some(edge => edge.target === targetNode.id)
|
||||||
|
|
||||||
|
// 如果标准通道已被连接,但不是连接到当前被检通道,则不能连接
|
||||||
|
if (isTargetConnected) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
const newEdge = {
|
||||||
|
id: `edge-${node.id}-${targetNode.id}`,
|
||||||
|
source: node.id,
|
||||||
|
target: targetNode.id,
|
||||||
|
type: 'default'
|
||||||
|
}
|
||||||
|
edges.value.push(newEdge)
|
||||||
|
ElMessage.success(`已自动连接到 ${targetNode.data.label.children[1].children[0].children[0].replace('设备名称:', '')} 的标准通道`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ElMessage.warning('没有可用的标准通道进行连接')
|
||||||
|
} else if (node.type === 'output') {
|
||||||
|
// 标准通道节点,检查是否已经连接
|
||||||
|
const isConnected = edges.value.some(edge => edge.target === node.id)
|
||||||
|
|
||||||
|
if (isConnected) {
|
||||||
|
ElMessage.warning('该标准通道已经连接,不能重复连接')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 寻找未连接的被检通道节点(优先寻找未被连接的被检通道)
|
||||||
|
const sourceNodes = nodes.value.filter(n => n.type === 'input')
|
||||||
|
|
||||||
|
// 首先尝试连接尚未被连接的被检通道
|
||||||
|
for (const sourceNode of sourceNodes) {
|
||||||
|
const isSourceConnected = edges.value.some(edge => edge.source === sourceNode.id)
|
||||||
|
|
||||||
|
if (!isSourceConnected) {
|
||||||
|
// 检查是否已存在连接(虽然这里应该不会存在)
|
||||||
|
const isAlreadyConnected = edges.value.some(edge =>
|
||||||
|
edge.source === sourceNode.id && edge.target === node.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!isAlreadyConnected) {
|
||||||
|
const newEdge = {
|
||||||
|
id: `edge-${sourceNode.id}-${node.id}`,
|
||||||
|
source: sourceNode.id,
|
||||||
|
target: node.id,
|
||||||
|
type: 'default'
|
||||||
|
}
|
||||||
|
edges.value.push(newEdge)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果所有被检通道都已被连接,尝试连接已被连接但连接的是其他标准通道的被检通道
|
||||||
|
for (const sourceNode of sourceNodes) {
|
||||||
|
// 检查是否已存在连接
|
||||||
|
const isAlreadyConnected = edges.value.some(edge =>
|
||||||
|
edge.source === sourceNode.id && edge.target === node.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!isAlreadyConnected) {
|
||||||
|
const isSourceConnected = edges.value.some(edge => edge.source === sourceNode.id)
|
||||||
|
|
||||||
|
// 如果被检通道已被连接,但不是连接到当前标准通道,则不能连接
|
||||||
|
if (isSourceConnected) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
const newEdge = {
|
||||||
|
id: `edge-${sourceNode.id}-${node.id}`,
|
||||||
|
source: sourceNode.id,
|
||||||
|
target: node.id,
|
||||||
|
type: 'default'
|
||||||
|
}
|
||||||
|
edges.value.push(newEdge)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ElMessage.warning('没有可用的被检通道进行连接')
|
||||||
|
}
|
||||||
|
}
|
||||||
// 初始化时锁定画布位置
|
// 初始化时锁定画布位置
|
||||||
const onPaneReady = () => {
|
const onPaneReady = () => {
|
||||||
setViewport({ x: 0, y: 0, zoom: 1 })
|
setViewport({ x: 0, y: 0, zoom: 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提取公共的label渲染函数
|
// 提取公共的label渲染函数
|
||||||
const createLabel = (text: string, type: string, Key: number) => {
|
const createLabel = (device:any, Key: number) => {
|
||||||
return h(
|
return h(
|
||||||
'div',
|
'div',
|
||||||
{
|
{
|
||||||
@@ -117,7 +251,13 @@ const createLabel = (text: string, type: string, Key: number) => {
|
|||||||
// filter: 'invert(35%) sepia(65%) saturate(300%) hue-rotate(210deg)'
|
// filter: 'invert(35%) sepia(65%) saturate(300%) hue-rotate(210deg)'
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
h('div', { style: { textAlign: 'left' } }, ['设备名称:' + text, h('br'), '设备类型:' + type])
|
h('div', { style: { textAlign: 'left' } }, ['设备名称:' + device.name,
|
||||||
|
h('br'),
|
||||||
|
'设备类型:' + device.deviceType,
|
||||||
|
h('br'),
|
||||||
|
'Ip地址:' + device.ip,
|
||||||
|
|
||||||
|
])
|
||||||
// h('div', null, '设备名称:' + text),
|
// h('div', null, '设备名称:' + text),
|
||||||
// h('div', null, '设备类型:' + type)
|
// h('div', null, '设备类型:' + type)
|
||||||
]
|
]
|
||||||
@@ -155,50 +295,125 @@ const createLabel3 = (text: string) => {
|
|||||||
|
|
||||||
const handleConnectStart = (params: any) => {
|
const handleConnectStart = (params: any) => {
|
||||||
onPaneReady()
|
onPaneReady()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const handleConnectEnd = (params: any) => {
|
||||||
|
// console.log('handleConnectEnd',edges.value,edges.value.length)
|
||||||
|
// onPaneReady()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const handleConnect = (params: any) => {
|
||||||
|
// const sourceNode = nodes.value.find(node => node.id === params.source)
|
||||||
|
// const targetNode = nodes.value.find(node => node.id === params.target)
|
||||||
|
// const isValidConnection = sourceNode?.type === 'input' && targetNode?.type === 'output'
|
||||||
|
// if (!isValidConnection) {
|
||||||
|
// removeEdge(params)
|
||||||
|
// ElMessage.warning('只能从被检通道连接到标准通道')
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// // 过滤掉当前连接,检查是否还有重复的
|
||||||
|
// const existingEdges = edges.value.filter(edge => edge.source === params.source || edge.target === params.target)
|
||||||
|
|
||||||
|
// // 如果同源或同目标的连接超过1个,说明有重复
|
||||||
|
// if (existingEdges.length > 1) {
|
||||||
|
// const duplicateSource = existingEdges.filter(edge => edge.source === params.source).length > 1
|
||||||
|
// const duplicateTarget = existingEdges.filter(edge => edge.target === params.target).length > 1
|
||||||
|
|
||||||
|
// if (duplicateSource) {
|
||||||
|
// removeEdge(params)
|
||||||
|
// ElMessage.warning('该被检通道已经连接,不能重复连接')
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (duplicateTarget) {
|
||||||
|
// removeEdge(params)
|
||||||
|
// ElMessage.warning('该标准通道已经连接,不能重复连接')
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 删除不合法连接
|
||||||
|
// const removeEdge = (params: any) => {
|
||||||
|
// // console.log('删除不合法连接:', params);
|
||||||
|
// // console.log('删除连接信息:', edges.value);
|
||||||
|
// // console.log('11111===', edges.value.length);
|
||||||
|
// const edgeIndex = edges.value.findIndex(edge => edge.source === params.source && edge.target === params.target)
|
||||||
|
// console.log('删除连接索引:', edgeIndex);
|
||||||
|
// if (edgeIndex !== -1) {
|
||||||
|
// edges.value.splice(edgeIndex , 1)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 添加一个响应式变量来存储需要删除的连接信息
|
||||||
|
const pendingRemoveEdge = ref<any>(null)
|
||||||
|
|
||||||
const handleConnectEnd = (params: any) => {
|
const handleConnectEnd = (params: any) => {
|
||||||
|
// 在连接结束时检查是否有待删除的连接
|
||||||
|
if (pendingRemoveEdge.value) {
|
||||||
|
removeEdge(pendingRemoveEdge.value)
|
||||||
|
pendingRemoveEdge.value = null // 清空待删除连接
|
||||||
|
}
|
||||||
|
|
||||||
onPaneReady()
|
onPaneReady()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleConnect = (params: any) => {
|
const handleConnect = (params: any) => {
|
||||||
const sourceNode = nodes.value.find(node => node.id === params.source)
|
const sourceNode = nodes.value.find(node => node.id === params.source)
|
||||||
const targetNode = nodes.value.find(node => node.id === params.target)
|
const targetNode = nodes.value.find(node => node.id === params.target)
|
||||||
|
|
||||||
// 连接规则验证
|
|
||||||
const isValidConnection = sourceNode?.type === 'input' && targetNode?.type === 'output'
|
const isValidConnection = sourceNode?.type === 'input' && targetNode?.type === 'output'
|
||||||
|
|
||||||
if (!isValidConnection) {
|
if (!isValidConnection) {
|
||||||
removeEdge(params)
|
// 设置待删除连接而不是立即删除
|
||||||
|
pendingRemoveEdge.value = params
|
||||||
ElMessage.warning('只能从被检通道连接到标准通道')
|
ElMessage.warning('只能从被检通道连接到标准通道')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过滤掉当前连接,检查是否还有重复的
|
// 检查是否已经存在完全相同的连接(精确匹配源和目标)
|
||||||
const existingEdges = edges.value.filter(edge => edge.source === params.source || edge.target === params.target)
|
const isAlreadyConnected = edges.value.some(edge =>
|
||||||
|
edge.source === params.source && edge.target === params.target
|
||||||
// 如果同源或同目标的连接超过1个,说明有重复
|
)
|
||||||
if (existingEdges.length > 1) {
|
|
||||||
const duplicateSource = existingEdges.filter(edge => edge.source === params.source).length > 1
|
if (isAlreadyConnected) {
|
||||||
const duplicateTarget = existingEdges.filter(edge => edge.target === params.target).length > 1
|
// 设置待删除连接而不是立即删除
|
||||||
|
pendingRemoveEdge.value = params
|
||||||
if (duplicateSource) {
|
ElMessage.warning('这两个通道已经连接,不能重复连接')
|
||||||
removeEdge(params)
|
return
|
||||||
ElMessage.warning('该被检通道已经连接,不能重复连接')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (duplicateTarget) {
|
|
||||||
removeEdge(params)
|
|
||||||
ElMessage.warning('该标准通道已经连接,不能重复连接')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查源节点是否已经被连接(一个被检通道只能连接一个标准通道)
|
||||||
|
const isSourceConnected = edges.value.some(edge => edge.source === params.source)
|
||||||
|
if (isSourceConnected) {
|
||||||
|
// 设置待删除连接而不是立即删除
|
||||||
|
pendingRemoveEdge.value = params
|
||||||
|
ElMessage.warning('该被检通道已经连接,不能重复连接')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查目标节点是否已经被连接(一个标准通道只能连接一个被检通道)
|
||||||
|
const isTargetConnected = edges.value.some(edge => edge.target === params.target)
|
||||||
|
if (isTargetConnected) {
|
||||||
|
// 设置待删除连接而不是立即删除
|
||||||
|
pendingRemoveEdge.value = params
|
||||||
|
ElMessage.warning('该标准通道已经连接,不能重复连接')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有问题,清空待删除连接
|
||||||
|
pendingRemoveEdge.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除不合法连接
|
// 删除不合法连接
|
||||||
const removeEdge = (params: any) => {
|
const removeEdge = (params: any) => {
|
||||||
const edgeIndex = edges.value.findIndex(edge => edge.source === params.source && edge.target === params.target)
|
const edgeIndex = edges.value.findIndex(edge => edge.source === params.source && edge.target === params.target)
|
||||||
|
|
||||||
if (edgeIndex !== -1) {
|
if (edgeIndex !== -1) {
|
||||||
edges.value.splice(edgeIndex, 1)
|
edges.value.splice(edgeIndex, 1)
|
||||||
}
|
}
|
||||||
@@ -211,10 +426,10 @@ const standardDevIds = ref<string[]>()
|
|||||||
|
|
||||||
const open = async () => {
|
const open = async () => {
|
||||||
edges.value = []
|
edges.value = []
|
||||||
|
|
||||||
devIds.value = prop.devIdList.map(d => d.id)
|
devIds.value = prop.devIdList.map(d => d.id)
|
||||||
standardDevIds.value = prop.pqStandardDevList.map(d => d.id)
|
standardDevIds.value = prop.pqStandardDevList.map(d => d.id)
|
||||||
planId.value = prop.planIdKey
|
planId.value = prop.planIdKey
|
||||||
|
|
||||||
nodes.value = createNodes(prop.devIdList, prop.pqStandardDevList, prop.deviceMonitor)
|
nodes.value = createNodes(prop.devIdList, prop.pqStandardDevList, prop.deviceMonitor)
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
onPaneReady()
|
onPaneReady()
|
||||||
@@ -342,21 +557,21 @@ const generateChannelMapping = () => {
|
|||||||
|
|
||||||
|
|
||||||
// 计算基于 dialogWidth 的位置参数 - 确保最小距离
|
// 计算基于 dialogWidth 的位置参数 - 确保最小距离
|
||||||
const deviceWidthVal = computed(() => {
|
const standardWidthVal = computed(() => {
|
||||||
return Math.max(0, 50)
|
return Math.max(0, 50)
|
||||||
})
|
})
|
||||||
|
|
||||||
const inputChannelXVal = computed(() => {
|
const inputChannelXVal = computed(() => {
|
||||||
return Math.max(300, deviceWidthVal.value + 300)
|
return Math.max(300, standardWidthVal.value + 300)
|
||||||
})
|
})
|
||||||
|
|
||||||
const outputChannelXVal = computed(() => {
|
const outputChannelXVal = computed(() => {
|
||||||
return Math.max(650, prop.dialogWidth - 470)
|
return Math.max(600, prop.dialogWidth - 500)
|
||||||
})
|
})
|
||||||
|
|
||||||
const standardWidthVal = computed(() => {
|
const deviceWidthVal = computed(() => {
|
||||||
return Math.max(800, prop.dialogWidth - 350)
|
return Math.max(800, prop.dialogWidth - 350)
|
||||||
})
|
})
|
||||||
|
|
||||||
const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[], deviceMonitor: Map<string, any[]>) => {
|
const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[], deviceMonitor: Map<string, any[]>) => {
|
||||||
const channelCounts: Record<string, number> = {}
|
const channelCounts: Record<string, number> = {}
|
||||||
@@ -368,9 +583,12 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
|||||||
id: d.id,
|
id: d.id,
|
||||||
name: d.name,
|
name: d.name,
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
deviceType: d.devType
|
deviceType: d.devType,
|
||||||
|
ip: d.ip,
|
||||||
|
monitorResults:d.monitorResults
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
const channelCounts2: Record<string, number> = {}
|
const channelCounts2: Record<string, number> = {}
|
||||||
standardDev.forEach(dev => {
|
standardDev.forEach(dev => {
|
||||||
const channelList = dev.inspectChannel ? dev.inspectChannel.split(',') : []
|
const channelList = dev.inspectChannel ? dev.inspectChannel.split(',') : []
|
||||||
@@ -381,7 +599,8 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
|||||||
id: d.id,
|
id: d.id,
|
||||||
name: d.name,
|
name: d.name,
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
deviceType: d.devType
|
deviceType: d.devType,
|
||||||
|
ip: d.ip
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const newNodes: any[] = []
|
const newNodes: any[] = []
|
||||||
@@ -392,10 +611,10 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
|||||||
// const inputChannelX = 350
|
// const inputChannelX = 350
|
||||||
// const outputChannelX = 1050
|
// const outputChannelX = 1050
|
||||||
// const standardWidth = 1170
|
// const standardWidth = 1170
|
||||||
const deviceWidth = deviceWidthVal.value
|
const standardWidth = standardWidthVal.value
|
||||||
const inputChannelX = inputChannelXVal.value
|
const outputChannelX = inputChannelXVal.value
|
||||||
const outputChannelX = outputChannelXVal.value
|
const inputChannelX = outputChannelXVal.value
|
||||||
const standardWidth = standardWidthVal.value
|
const deviceWidth = deviceWidthVal.value
|
||||||
|
|
||||||
// 添加被检通道
|
// 添加被检通道
|
||||||
// let currentYPosition = 50; // 初始Y位置
|
// let currentYPosition = 50; // 初始Y位置
|
||||||
@@ -413,6 +632,12 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
|||||||
Object.entries(channelCounts).forEach(([deviceId, count]) => {
|
Object.entries(channelCounts).forEach(([deviceId, count]) => {
|
||||||
// 从deviceMonitor中获取实际通道信息
|
// 从deviceMonitor中获取实际通道信息
|
||||||
let actualChannels = []; // 存储实际的通道号
|
let actualChannels = []; // 存储实际的通道号
|
||||||
|
let deviceMonitorResults: number[] = []; // 存储该设备的监控结果
|
||||||
|
// 获取该设备的monitorResults
|
||||||
|
const deviceInfo = inspectionDevices.find(d => d.id === deviceId);
|
||||||
|
if (deviceInfo && deviceInfo.monitorResults) {
|
||||||
|
deviceMonitorResults = deviceInfo.monitorResults;
|
||||||
|
}
|
||||||
|
|
||||||
// 如果deviceMonitor中有该设备的数据,则使用实际监测点信息
|
// 如果deviceMonitor中有该设备的数据,则使用实际监测点信息
|
||||||
if (deviceMonitor.has(deviceId)) {
|
if (deviceMonitor.has(deviceId)) {
|
||||||
@@ -429,13 +654,24 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
|||||||
// 遍历实际通道号而不是连续的数字
|
// 遍历实际通道号而不是连续的数字
|
||||||
actualChannels.forEach((channelNum, index) => {
|
actualChannels.forEach((channelNum, index) => {
|
||||||
const channelId = `被检通道-${deviceId}-${channelNum}`;
|
const channelId = `被检通道-${deviceId}-${channelNum}`;
|
||||||
|
const channelResult = deviceMonitorResults[index]
|
||||||
|
|
||||||
|
let statusText = '';
|
||||||
|
if (channelResult === 0) {
|
||||||
|
statusText = '(不符合)';
|
||||||
|
} else if (channelResult === 1) {
|
||||||
|
statusText = '(符合)';
|
||||||
|
} else if (channelResult === 2) {
|
||||||
|
statusText = '(未检)';
|
||||||
|
}
|
||||||
|
|
||||||
newNodes.push({
|
newNodes.push({
|
||||||
id: channelId,
|
id: channelId,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
data: { label: createLabel3(`被检通道${channelNum}`) },
|
data: { label: createLabel3(`被检通道${channelNum}`+ statusText) },
|
||||||
position: { x: inputChannelX, y: yPosition + index * 50 },
|
position: { x: inputChannelX, y: yPosition + index * 50 },
|
||||||
sourcePosition: 'right',
|
sourcePosition: 'left',
|
||||||
style: { width: '120px', border: 'none', boxShadow: 'none' }
|
style: { width: '160px', border: 'none', boxShadow: 'none' }
|
||||||
});
|
});
|
||||||
|
|
||||||
deviceChannelGroups.push({
|
deviceChannelGroups.push({
|
||||||
@@ -470,7 +706,7 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
|||||||
type: 'output',
|
type: 'output',
|
||||||
data: { label: createLabel3(`标准通道${i}`) },
|
data: { label: createLabel3(`标准通道${i}`) },
|
||||||
position: { x: outputChannelX, y: yPosition2 + (i - 1) * 50 },
|
position: { x: outputChannelX, y: yPosition2 + (i - 1) * 50 },
|
||||||
targetPosition: 'left',
|
targetPosition: 'right',
|
||||||
style: { width: '120px', border: 'none', boxShadow: 'none' }
|
style: { width: '120px', border: 'none', boxShadow: 'none' }
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -508,7 +744,7 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
|||||||
const deviceCenterY = deviceCurrentYPosition + (actualChannelCount * 50) / 2 - 50
|
const deviceCenterY = deviceCurrentYPosition + (actualChannelCount * 50) / 2 - 50
|
||||||
newNodes.push({
|
newNodes.push({
|
||||||
id: device.id,
|
id: device.id,
|
||||||
data: { label: createLabel(device.name, device.deviceType, 1) },
|
data: { label: createLabel(device, 1) },
|
||||||
position: { x: deviceWidth, y: deviceCenterY },
|
position: { x: deviceWidth, y: deviceCenterY },
|
||||||
class: 'no-handle-node',
|
class: 'no-handle-node',
|
||||||
style: { width: '300px', border: 'none', boxShadow: 'none' }
|
style: { width: '300px', border: 'none', boxShadow: 'none' }
|
||||||
@@ -539,7 +775,7 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
|||||||
const deviceCenterY = standardDeviceCurrentYPosition + (channelCount * 50) / 2 - 50
|
const deviceCenterY = standardDeviceCurrentYPosition + (channelCount * 50) / 2 - 50
|
||||||
newNodes.push({
|
newNodes.push({
|
||||||
id: device.id,
|
id: device.id,
|
||||||
data: { label: createLabel(device.name, device.deviceType, 2) },
|
data: { label: createLabel(device, 2) },
|
||||||
position: { x: standardWidth, y: deviceCenterY },
|
position: { x: standardWidth, y: deviceCenterY },
|
||||||
class: 'no-handle-node',
|
class: 'no-handle-node',
|
||||||
style: { width: '300px', border: 'none', boxShadow: 'none' }
|
style: { width: '300px', border: 'none', boxShadow: 'none' }
|
||||||
|
|||||||
@@ -11,13 +11,7 @@
|
|||||||
>
|
>
|
||||||
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
||||||
|
|
||||||
<el-table-column prop="dataA" :label="'被检设备'">
|
|
||||||
<el-table-column prop="timeDev" label="数据时间" width="200"/>
|
|
||||||
<el-table-column prop="uaDev" :label="'A相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.uaDev != null"/>
|
|
||||||
<el-table-column prop="ubDev" :label="setB+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ubDev != null"/>
|
|
||||||
<el-table-column prop="ucDev" :label="'C相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ucDev != null"/>
|
|
||||||
<el-table-column prop="utDev" :label="setT+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData[0]?.utDev != null"/>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="dataA" :label="'标准设备'">
|
<el-table-column prop="dataA" :label="'标准设备'">
|
||||||
<el-table-column prop="timeStdDev" label="数据时间" width="200"/>
|
<el-table-column prop="timeStdDev" label="数据时间" width="200"/>
|
||||||
<el-table-column prop="uaStdDev" :label="'A相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.uaStdDev != null"/>
|
<el-table-column prop="uaStdDev" :label="'A相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.uaStdDev != null"/>
|
||||||
@@ -25,6 +19,13 @@
|
|||||||
<el-table-column prop="ucStdDev" :label="'C相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ucStdDev != null"/>
|
<el-table-column prop="ucStdDev" :label="'C相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ucStdDev != null"/>
|
||||||
<el-table-column prop="utStdDev" :label="setT+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData[0]?.utStdDev != null"/>
|
<el-table-column prop="utStdDev" :label="setT+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData[0]?.utStdDev != null"/>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="dataA" :label="'被检设备'">
|
||||||
|
<el-table-column prop="timeDev" label="数据时间" width="200"/>
|
||||||
|
<el-table-column prop="uaDev" :label="'A相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.uaDev != null"/>
|
||||||
|
<el-table-column prop="ubDev" :label="setB+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ubDev != null"/>
|
||||||
|
<el-table-column prop="ucDev" :label="'C相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ucDev != null"/>
|
||||||
|
<el-table-column prop="utDev" :label="setT+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData[0]?.utDev != null"/>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -8,16 +8,17 @@
|
|||||||
>
|
>
|
||||||
<!-- <el-table-column type="index" label="序号" width="70" fixed="left" />-->
|
<!-- <el-table-column type="index" label="序号" width="70" fixed="left" />-->
|
||||||
<el-table-column label="A相" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataA">
|
<el-table-column label="A相" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataA">
|
||||||
<el-table-column prop="stdA" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
|
||||||
<template #default="{ row }">
|
|
||||||
{{ row.dataA.data }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="dataA" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
<el-table-column prop="dataA" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.dataA.resultData }}
|
{{ row.dataA.resultData }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="stdA" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.dataA.data }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="isDataA" label="检测结果">
|
<el-table-column prop="isDataA" label="检测结果">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
@@ -35,16 +36,17 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="setB" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataB">
|
<el-table-column :label="setB" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataB">
|
||||||
<el-table-column prop="stdB" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
|
||||||
<template #default="{ row }">
|
|
||||||
{{ row.dataB.data }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="dataB" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
<el-table-column prop="dataB" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.dataB.resultData }}
|
{{ row.dataB.resultData }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="stdB" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.dataB.data }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="isDataB" label="检测结果">
|
<el-table-column prop="isDataB" label="检测结果">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
@@ -62,16 +64,17 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="C相" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataC">
|
<el-table-column label="C相" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataC">
|
||||||
<el-table-column prop="stdC" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
|
||||||
<template #default="{ row }">
|
|
||||||
{{ row.dataC.data }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="dataC" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
<el-table-column prop="dataC" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.dataC.resultData }}
|
{{ row.dataC.resultData }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="stdC" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.dataC.data }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="isDataC" label="检测结果">
|
<el-table-column prop="isDataC" label="检测结果">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
@@ -89,15 +92,16 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="setT" v-if="prop.tableData[0].dataT">
|
<el-table-column :label="setT" v-if="prop.tableData[0].dataT">
|
||||||
<el-table-column prop="stdT" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
|
||||||
<template #default="{ row }">
|
|
||||||
{{ row.dataT.data }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="dataT" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
<el-table-column prop="dataT" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.dataT.resultData }}
|
{{ row.dataT.resultData }}
|
||||||
</template>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="stdT" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.dataT.data }}
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="isDataT" label="检测结果">
|
<el-table-column prop="isDataT" label="检测结果">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
|
|||||||
@@ -72,7 +72,17 @@
|
|||||||
node-key="id"
|
node-key="id"
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
@node-click="handleNodeClick"
|
@node-click="handleNodeClick"
|
||||||
></el-tree>
|
class="custom-tree"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<div class="custom-tree-node">
|
||||||
|
<span v-if="data.resultFlag === 1">{{ node.label }}</span>
|
||||||
|
<span v-else-if="data.resultFlag === 2" style="color: #ee6666;">{{ node.label }}</span>
|
||||||
|
<span v-else-if="data.resultFlag === 4" style="color: #fac858;">{{ node.label }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-right">
|
<div class="content-right">
|
||||||
<div class="content-right-title">
|
<div class="content-right-title">
|
||||||
@@ -90,7 +100,13 @@
|
|||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
>
|
||||||
|
<div style="display: flex; align-items: center; justify-content: space-between">
|
||||||
|
<span v-if="item.resultFlag === 1" >{{ item.label }}</span>
|
||||||
|
<span v-else-if="item.resultFlag === 2" style="color: #ee6666;">{{ item.label }}</span>
|
||||||
|
<span v-else-if="item.resultFlag === 4" style="color: #fac858;">{{ item.label }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<!-- 否则显示原来的文本 -->
|
<!-- 否则显示原来的文本 -->
|
||||||
<span v-else style="color: var(--el-color-primary)">{{ rowList.scriptName }}</span>
|
<span v-else style="color: var(--el-color-primary)">{{ rowList.scriptName }}</span>
|
||||||
@@ -122,6 +138,7 @@
|
|||||||
:label="item.replace(/\.0$/, '')"
|
:label="item.replace(/\.0$/, '')"
|
||||||
:value="item"
|
:value="item"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
@@ -200,7 +217,7 @@ const selectedScriptName = ref('')
|
|||||||
const pattern = ref('')
|
const pattern = ref('')
|
||||||
// 添加以下内容
|
// 添加以下内容
|
||||||
const isWaveData = ref(false)
|
const isWaveData = ref(false)
|
||||||
const scriptNameOptions = ref<{ label: string; value: string }[]>([])
|
const scriptNameOptions = ref<{ label: string; value: string;resultFlag:number }[]>([])
|
||||||
|
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formContent = reactive<CheckData.DataCheck>({
|
const formContent = reactive<CheckData.DataCheck>({
|
||||||
@@ -280,7 +297,8 @@ const initGetResult = async () => {
|
|||||||
// 设置录波数据相关的选项
|
// 设置录波数据相关的选项
|
||||||
scriptNameOptions.value = selectScript.value.map(item => ({
|
scriptNameOptions.value = selectScript.value.map(item => ({
|
||||||
label: item.scriptName,
|
label: item.scriptName,
|
||||||
value: item.scriptName
|
value: item.scriptName,
|
||||||
|
resultFlag: item.resultFlag?? 0
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// 默认选中第一个选项
|
// 默认选中第一个选项
|
||||||
@@ -304,14 +322,15 @@ const initScriptData = async () => {
|
|||||||
let response: any = await getScriptList({
|
let response: any = await getScriptList({
|
||||||
devId: formContent.deviceId,
|
devId: formContent.deviceId,
|
||||||
chnNum: formContent.chnNum,
|
chnNum: formContent.chnNum,
|
||||||
num: formContent.num
|
num: formContent.num,
|
||||||
|
planId: checkStore.plan.id
|
||||||
})
|
})
|
||||||
|
|
||||||
// 格式化脚本数据
|
// 格式化脚本数据
|
||||||
let temp = response.data.map((item: any) => {
|
let temp = response.data.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
scriptName: item.scriptName
|
scriptName: item.scriptName
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -327,7 +346,8 @@ const initScriptData = async () => {
|
|||||||
temp2 = luoboItem.subItems.map((item: any) => {
|
temp2 = luoboItem.subItems.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
scriptName: item.scriptName
|
scriptName: item.scriptName,
|
||||||
|
resultFlag: item.resultFlag ?? 0 // 假设默认值为 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -458,7 +478,8 @@ const handleNodeClick = (data: any) => {
|
|||||||
//.filter(item => item.code !== 'wave_data' && item.code !== 'FREQ')
|
//.filter(item => item.code !== 'wave_data' && item.code !== 'FREQ')
|
||||||
.map(item => ({
|
.map(item => ({
|
||||||
label: item.scriptName,
|
label: item.scriptName,
|
||||||
value: item.scriptName
|
value: item.scriptName,
|
||||||
|
resultFlag: item.resultFlag ?? 0
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// 每次选中录波数据时都重置为第一个选项并触发getResults
|
// 每次选中录波数据时都重置为第一个选项并触发getResults
|
||||||
@@ -573,6 +594,27 @@ defineExpose({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
.custom-tree {
|
||||||
|
:deep(.el-tree-node__content) {
|
||||||
|
.custom-tree-node {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据 resultFlag 设置不同颜色
|
||||||
|
|
||||||
|
&[data-result-flag="2"] {
|
||||||
|
color: #ee6666; // 红色 - 不符合
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-result-flag="4"] {
|
||||||
|
color: #fac858; // 橙色 - 警告
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.dialog {
|
.dialog {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -599,7 +641,7 @@ defineExpose({
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
max-height: 495px;
|
max-height: 495px;
|
||||||
|
|
||||||
padding: 10px 0.5% 0px 0.5%;
|
padding: 10px 0.5% 0px 0.5%;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
finish-status="success">
|
finish-status="success">
|
||||||
<el-step :status="step1" title="设备通讯校验"/>
|
<el-step :status="step1" title="设备通讯校验"/>
|
||||||
<el-step :status="step2" title="模型一致性校验"/>
|
<el-step :status="step2" title="模型一致性校验"/>
|
||||||
<el-step :status="step3" title="实时数据对齐验证" v-if="!props.onlyWave"/>
|
<el-step :status="step3" title="数据对齐验证" v-if="!props.onlyWave"/>
|
||||||
<el-step :status="step4" title="相序校验"/>
|
<el-step :status="step4" title="相序校验"/>
|
||||||
<!-- <el-step :status="step6" title="遥控录波功能验证"/> -->
|
<!-- <el-step :status="step6" title="遥控录波功能验证"/> -->
|
||||||
<el-step :status="step5" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
|
<el-step :status="step5" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item name="3" v-if="!props.onlyWave">
|
<el-collapse-item name="3" v-if="!props.onlyWave">
|
||||||
<template #title>
|
<template #title>
|
||||||
实时数据对齐验证
|
数据对齐验证
|
||||||
<el-icon class="title-icon" @click="openDialog" v-if="isShowDialog"><InfoFilled/></el-icon>
|
<el-icon class="title-icon" @click="openDialog" v-if="isShowDialog"><InfoFilled/></el-icon>
|
||||||
</template>
|
</template>
|
||||||
<div class="div-log">
|
<div class="div-log">
|
||||||
@@ -124,7 +124,7 @@ const activeIndex = ref(0)
|
|||||||
const activeTotalNum = computed(() => {
|
const activeTotalNum = computed(() => {
|
||||||
let count = 4; // 基础步骤数:设备通讯校验、模型一致性校验、相序校验、最终状态
|
let count = 4; // 基础步骤数:设备通讯校验、模型一致性校验、相序校验、最终状态
|
||||||
if (props.onlyWave) {
|
if (props.onlyWave) {
|
||||||
count++; // 添加实时数据对齐验证步骤
|
count++; // 添加数据对齐验证步骤
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
});
|
});
|
||||||
@@ -149,7 +149,7 @@ const detectionOptions = ref([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "实时数据对齐验证",
|
name: "数据对齐验证",
|
||||||
selected: true,
|
selected: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -282,6 +282,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
log: '录波校验时,设备连接异常!',
|
log: '录波校验时,设备连接异常!',
|
||||||
});
|
});
|
||||||
|
|
||||||
step1.value = 'error'
|
step1.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
step5.value = 'error'
|
step5.value = 'error'
|
||||||
@@ -291,10 +292,12 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data,
|
log: newValue.data,
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (newValue.code == 25003) { //最终失败
|
} else if (newValue.code == 25003) { //最终失败
|
||||||
step1.value = 'error'
|
step1.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
step5.value = 'error'
|
step5.value = 'error'
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'yjc_mxyzxjy':
|
case 'yjc_mxyzxjy':
|
||||||
@@ -354,7 +357,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
if(newValue.code == 10550){
|
if(newValue.code == 10550){
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: '实时数据对齐时,设备连接异常!',
|
log: '数据对齐时,设备连接异常!',
|
||||||
});
|
});
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
@@ -560,6 +563,7 @@ watch(ts, function (newValue, oldValue) {
|
|||||||
|
|
||||||
// 定义一个初始化参数的方法
|
// 定义一个初始化参数的方法
|
||||||
function initializeParameters() {
|
function initializeParameters() {
|
||||||
|
collapseActiveName.value = '1'
|
||||||
activeIndex.value = 0
|
activeIndex.value = 0
|
||||||
step1.value = 'wait'
|
step1.value = 'wait'
|
||||||
step2.value = 'wait'
|
step2.value = 'wait'
|
||||||
@@ -592,7 +596,7 @@ function initializeParameters() {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// 清空实时数据对齐验证的数据
|
// 清空数据对齐验证的数据
|
||||||
|
|
||||||
testDataStructure.value = {}
|
testDataStructure.value = {}
|
||||||
isShowDialog.value = false
|
isShowDialog.value = false
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ watch(testStatus, function (newValue, oldValue) {
|
|||||||
startData.value = new Date()
|
startData.value = new Date()
|
||||||
timeDifference.value = 0
|
timeDifference.value = 0
|
||||||
} else if (newValue == 'error') {
|
} else if (newValue == 'error') {
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -300,13 +300,14 @@ watch(
|
|||||||
break
|
break
|
||||||
case 25002:
|
case 25002:
|
||||||
setLogList('error', newValue.data)
|
setLogList('error', newValue.data)
|
||||||
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 25003:
|
case 25003:
|
||||||
ElMessageBox.alert('录波数据异常!', {
|
ElMessageBox.alert('录波数据异常!','检测失败',{
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 25001: {
|
case 25001: {
|
||||||
// 当录波校验完成时,更新录波项目的按钮状态
|
// 当录波校验完成时,更新录波项目的按钮状态
|
||||||
@@ -345,7 +346,7 @@ watch(
|
|||||||
}
|
}
|
||||||
// 触发响应式更新
|
// 触发响应式更新
|
||||||
checkResult.splice(0, 0)
|
checkResult.splice(0, 0)
|
||||||
stopTimeCount()
|
stopTimeCount(1)
|
||||||
updatePercentage()
|
updatePercentage()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -355,13 +356,14 @@ watch(
|
|||||||
switch (newValue.code) {
|
switch (newValue.code) {
|
||||||
case 25002:
|
case 25002:
|
||||||
setLogList('error', newValue.data)
|
setLogList('error', newValue.data)
|
||||||
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 25003:
|
case 25003:
|
||||||
ElMessageBox.alert('闪变收集失败!', {
|
ElMessageBox.alert('闪变收集失败!','检测失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 25001: {
|
case 25001: {
|
||||||
// 当录波校验完成时,更新录波项目的按钮状态
|
// 当录波校验完成时,更新录波项目的按钮状态
|
||||||
@@ -394,7 +396,7 @@ watch(
|
|||||||
}
|
}
|
||||||
// 触发响应式更新
|
// 触发响应式更新
|
||||||
checkResult.splice(0, 0)
|
checkResult.splice(0, 0)
|
||||||
stopTimeCount()
|
stopTimeCount(1)
|
||||||
updatePercentage()
|
updatePercentage()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -412,18 +414,19 @@ watch(
|
|||||||
device.chnResult.fill(CheckData.ChnCheckResultEnum.UNKNOWN)
|
device.chnResult.fill(CheckData.ChnCheckResultEnum.UNKNOWN)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'connect':
|
case 'connect':
|
||||||
switch (newValue.operateCode) {
|
switch (newValue.operateCode) {
|
||||||
case 'Contrast_Dev':
|
case 'Contrast_Dev':
|
||||||
setLogList('error', '设备服务端连接失败!')
|
setLogList('error', '设备服务端连接失败!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'unknown_operate':
|
case 'unknown_operate':
|
||||||
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 'error_flow_end':
|
case 'error_flow_end':
|
||||||
ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', {
|
ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', {
|
||||||
@@ -431,7 +434,7 @@ watch(
|
|||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
setLogList('error', '当前流程存在异常结束!')
|
setLogList('error', '当前流程存在异常结束!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 'socket_timeout':
|
case 'socket_timeout':
|
||||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||||
@@ -439,7 +442,7 @@ watch(
|
|||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
setLogList('error', '设备连接异常,请检查设备连接情况!')
|
setLogList('error', '设备连接异常,请检查设备连接情况!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 'server_error':
|
case 'server_error':
|
||||||
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
|
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
|
||||||
@@ -447,7 +450,7 @@ watch(
|
|||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
setLogList('error', '服务端主动关闭连接!')
|
setLogList('error', '服务端主动关闭连接!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 'device_error':
|
case 'device_error':
|
||||||
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
|
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
|
||||||
@@ -455,12 +458,12 @@ watch(
|
|||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
setLogList('error', '设备主动关闭连接!')
|
setLogList('error', '设备主动关闭连接!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
break
|
break
|
||||||
case 'yjc_xyjy' :
|
case 'yjc_xyjy' :
|
||||||
if(newValue.code == 10550){
|
if(newValue.code == 10550){
|
||||||
setLogList('error', '协议校验时,设备连接异常!')
|
setLogList('error', '协议校验时,设备连接异常!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
}
|
}
|
||||||
if (newValue.code == 10552) {
|
if (newValue.code == 10552) {
|
||||||
ElMessageBox.alert('重复的初始化操作!', '检测失败', {
|
ElMessageBox.alert('重复的初始化操作!', '检测失败', {
|
||||||
@@ -468,7 +471,7 @@ watch(
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
setLogList('error', '重复的初始化操作!')
|
setLogList('error', '重复的初始化操作!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'yjc_sbtxjy' :
|
case 'yjc_sbtxjy' :
|
||||||
@@ -478,7 +481,7 @@ watch(
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
setLogList('error', '重复的初始化操作!')
|
setLogList('error', '重复的初始化操作!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -509,15 +512,12 @@ watch(
|
|||||||
// 失败
|
// 失败
|
||||||
if (newValue.data != undefined) return
|
if (newValue.data != undefined) return
|
||||||
setLogList('error', str + '失败!')
|
setLogList('error', str + '失败!')
|
||||||
emit('update:testStatus', 'error')
|
stopTimeCount(0)
|
||||||
stopTimeCount()
|
|
||||||
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
|
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
|
||||||
break
|
break
|
||||||
case 10550:
|
case 10550:
|
||||||
setLogList('error', str +'时,设备连接异常!')
|
setLogList('error', str +'时,设备连接异常!')
|
||||||
|
stopTimeCount(0)
|
||||||
emit('update:testStatus', 'error')
|
|
||||||
stopTimeCount()
|
|
||||||
break
|
break
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -621,7 +621,7 @@ watch(
|
|||||||
|
|
||||||
if (newValue.code == 25001) {
|
if (newValue.code == 25001) {
|
||||||
setLogList('info', '检测完成!')
|
setLogList('info', '检测完成!')
|
||||||
stopTimeCount()
|
stopTimeCount(1)
|
||||||
updatePercentage()
|
updatePercentage()
|
||||||
}
|
}
|
||||||
if(newValue.code == 25005){
|
if(newValue.code == 25005){
|
||||||
@@ -634,12 +634,12 @@ watch(
|
|||||||
}
|
}
|
||||||
case 25003:
|
case 25003:
|
||||||
setLogList('error', '检测失败!')
|
setLogList('error', '检测失败!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
updatePercentage()
|
updatePercentage()
|
||||||
break
|
break
|
||||||
case 10550:
|
case 10550:
|
||||||
setLogList('error', '设备连接异常!')
|
setLogList('error', '设备连接异常!')
|
||||||
stopTimeCount()
|
stopTimeCount(0)
|
||||||
updatePercentage()
|
updatePercentage()
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
@@ -682,7 +682,7 @@ const updatePercentage = async () => {
|
|||||||
// planCode: checkStore.plan.code + ''
|
// planCode: checkStore.plan.code + ''
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
stopTimeCount()
|
stopTimeCount(1)
|
||||||
ElMessageBox.alert(
|
ElMessageBox.alert(
|
||||||
'检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作',
|
'检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作',
|
||||||
'检测完成',
|
'检测完成',
|
||||||
@@ -712,10 +712,14 @@ const startTimeCount = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 停止计时
|
// 停止计时
|
||||||
const stopTimeCount = () => {
|
const stopTimeCount = (type: number) => {
|
||||||
if (timer) {
|
if (timer) {
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
timer = null
|
timer = null
|
||||||
|
if(type === 0){
|
||||||
|
emit('update:testStatus', 'error')
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -977,9 +981,7 @@ defineExpose({
|
|||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
:deep(.el-button--small) {
|
:deep(.el-button--small) {
|
||||||
height: 20px !important;
|
height: 20px !important;
|
||||||
width: 20px !important;
|
width: 20px !important;
|
||||||
|
|||||||
@@ -323,7 +323,8 @@ const handleSubmitAgain = async () => {
|
|||||||
}
|
}
|
||||||
stepsTotalNum.value = count + 1
|
stepsTotalNum.value = count + 1
|
||||||
|
|
||||||
// 通知子组件清空并重新初始化
|
// 等待组件渲染完成
|
||||||
|
await nextTick()
|
||||||
if (preTestRef.value) {
|
if (preTestRef.value) {
|
||||||
preTestRef.value.initializeParameters()
|
preTestRef.value.initializeParameters()
|
||||||
}
|
}
|
||||||
@@ -342,7 +343,6 @@ const handleSubmitAgain = async () => {
|
|||||||
standardDevIds: standardDevIds.value,
|
standardDevIds: standardDevIds.value,
|
||||||
pairs: pairs.value,
|
pairs: pairs.value,
|
||||||
testItemList: [checkStore.selectTestItems.preTest, false, checkStore.selectTestItems.test],
|
testItemList: [checkStore.selectTestItems.preTest, false, checkStore.selectTestItems.test],
|
||||||
|
|
||||||
userId: userStore.userInfo.id
|
userId: userStore.userInfo.id
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ watch(ActiveStatue, function (newValue, oldValue) {
|
|||||||
nextStep() // 实现自动点击,进入下一个测试内容
|
nextStep() // 实现自动点击,进入下一个测试内容
|
||||||
//handleSubmitFast()
|
//handleSubmitFast()
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleQuit = () => {
|
const handleQuit = () => {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
:draggable="false"
|
:draggable="false"
|
||||||
width="1400px"
|
width="1400px"
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="data-check-dialog">
|
<div class="data-check-dialog">
|
||||||
<div class="data-check-head">
|
<div class="data-check-head">
|
||||||
<el-form :model="formContent" label-width="auto" class="form-three">
|
<el-form :model="formContent" label-width="auto" class="form-three">
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
class="custom-tree"
|
class="custom-tree"
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
>
|
>
|
||||||
|
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="right">
|
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="right">
|
||||||
<span
|
<span
|
||||||
@@ -137,6 +139,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
@@ -161,7 +166,7 @@ import { ResultEnum } from '@/enums/httpEnum'
|
|||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { useModeStore } from '@/stores/modules/mode'
|
import { useModeStore } from '@/stores/modules/mode'
|
||||||
|
import { CircleClose, Warning, SuccessFilled } from '@element-plus/icons-vue'
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const modeStore = useModeStore()
|
const modeStore = useModeStore()
|
||||||
|
|
||||||
@@ -183,6 +188,8 @@ watch(searchValue, val => {
|
|||||||
treeRef.value!.filter(val)
|
treeRef.value!.filter(val)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 格式化数字
|
// 格式化数字
|
||||||
const fixed = 4
|
const fixed = 4
|
||||||
|
|
||||||
@@ -816,6 +823,10 @@ defineExpose({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.dialog {
|
.dialog {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -856,11 +867,11 @@ defineExpose({
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
|
||||||
.custom-tree-node {
|
// .custom-tree-node {
|
||||||
overflow-x: hidden !important;
|
// overflow-x: hidden !important;
|
||||||
white-space: nowrap !important;
|
// white-space: nowrap !important;
|
||||||
text-overflow: ellipsis !important;
|
// text-overflow: ellipsis !important;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -904,6 +915,8 @@ defineExpose({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<!--<style lang="scss">-->
|
<!--<style lang="scss">-->
|
||||||
<!--.el-popover.popover-class {-->
|
<!--.el-popover.popover-class {-->
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ const open = async (
|
|||||||
planIsOnlyWave.value = isOnlyWave
|
planIsOnlyWave.value = isOnlyWave
|
||||||
CompareTestVisible.value = false
|
CompareTestVisible.value = false
|
||||||
devIdList.value = device
|
devIdList.value = device
|
||||||
|
devIdList.value = device
|
||||||
pqStandardDevList.value = standardDev
|
pqStandardDevList.value = standardDev
|
||||||
planIdKey.value = fatherPlanId
|
planIdKey.value = fatherPlanId
|
||||||
deviceMonitor.value = DeviceMonitoringMap
|
deviceMonitor.value = DeviceMonitoringMap
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-tabs v-if="dialogVisible" v-model="activeName" @tab-click="handleTabClick">
|
<el-tabs v-if="dialogVisible" v-model="activeName" @tab-change="handleTabChange">
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="(result, index) in resultData"
|
v-for="(result, index) in resultData"
|
||||||
:key="result.monitorId"
|
:key="result.monitorId"
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
<el-text type="info">检测结论:</el-text>
|
<el-text type="info">检测结论:</el-text>
|
||||||
</template>
|
</template>
|
||||||
<el-tag disable-transitions v-if="result.checkResult === 1" type="success">符合</el-tag>
|
<el-tag disable-transitions v-if="result.checkResult === 1" type="success">符合</el-tag>
|
||||||
<el-tag disable-transitions v-else-if="result.checkResult === 2" type="danger">不符合</el-tag>
|
<el-tag disable-transitions v-else-if="result.checkResult === 0" type="danger">不符合</el-tag>
|
||||||
<el-tag disable-transitions v-else-if="result.checkResult === 4" type="danger">无法比较</el-tag>
|
<el-tag disable-transitions v-else-if="result.checkResult === 4" type="danger">无法比较</el-tag>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label-align="right">
|
<el-descriptions-item label-align="right">
|
||||||
@@ -114,9 +114,12 @@
|
|||||||
>
|
>
|
||||||
符合
|
符合
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag disable-transitions v-if="currentWhichTimeData.checkResult === 2" type="danger">
|
<el-tag disable-transitions v-if="currentWhichTimeData.checkResult === 0" type="danger">
|
||||||
不符合
|
不符合
|
||||||
</el-tag>
|
</el-tag>
|
||||||
|
<el-tag disable-transitions v-if="currentWhichTimeData.checkResult === 4" type="danger">
|
||||||
|
无法比较
|
||||||
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-option
|
<el-option
|
||||||
@@ -128,7 +131,8 @@
|
|||||||
<div style="display: flex; align-items: center; justify-content: space-between">
|
<div style="display: flex; align-items: center; justify-content: space-between">
|
||||||
<el-text>{{ '第' + item.time + '次' }}</el-text>
|
<el-text>{{ '第' + item.time + '次' }}</el-text>
|
||||||
<el-tag v-if="item.checkResult === 1" type="success">符合</el-tag>
|
<el-tag v-if="item.checkResult === 1" type="success">符合</el-tag>
|
||||||
<el-tag v-if="item.checkResult === 2" type="danger">不符合</el-tag>
|
<el-tag v-if="item.checkResult === 0" type="danger">不符合</el-tag>
|
||||||
|
<el-tag v-if="item.checkResult === 4" type="danger">无法比较</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -146,7 +150,7 @@
|
|||||||
<el-tag disable-transitions v-if="submitSourceData.checkResult === 1" type="success">
|
<el-tag disable-transitions v-if="submitSourceData.checkResult === 1" type="success">
|
||||||
符合
|
符合
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag disable-transitions v-if="submitSourceData.checkResult === 2" type="danger">
|
<el-tag disable-transitions v-if="submitSourceData.checkResult === 0" type="danger">
|
||||||
不符合
|
不符合
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag disable-transitions v-if="submitSourceData.checkResult === 4" type="info">
|
<el-tag disable-transitions v-if="submitSourceData.checkResult === 4" type="info">
|
||||||
@@ -163,7 +167,8 @@
|
|||||||
<div style="display: flex; align-items: center; justify-content: space-between">
|
<div style="display: flex; align-items: center; justify-content: space-between">
|
||||||
<el-text>{{ item.dataSourceName }}</el-text>
|
<el-text>{{ item.dataSourceName }}</el-text>
|
||||||
<el-tag v-if="item.checkResult === 1" type="success">符合</el-tag>
|
<el-tag v-if="item.checkResult === 1" type="success">符合</el-tag>
|
||||||
<el-tag v-if="item.checkResult === 2" type="danger">不符合</el-tag>
|
<el-tag v-if="item.checkResult === 0" type="danger">不符合</el-tag>
|
||||||
|
<el-tag v-if="item.checkResult === 4" type="danger">无法比较</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -182,13 +187,17 @@ import { type MonitorResult } from '@/api/result/interface'
|
|||||||
import { generateDevReport } from '@/api/plan/plan'
|
import { generateDevReport } from '@/api/plan/plan'
|
||||||
import { useCheckStore } from '@/stores/modules/check'
|
import { useCheckStore } from '@/stores/modules/check'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogSourceVisible = ref(false)
|
const dialogSourceVisible = ref(false)
|
||||||
const devData = ref<any>()
|
const devData = ref<any>()
|
||||||
const activeName = ref<number>(0)
|
const activeName = ref<number>(0)
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
const currentWhichTimeData = ref<any>({})
|
const currentWhichTimeData = ref({
|
||||||
|
time: '',
|
||||||
|
checkResult: -1
|
||||||
|
})
|
||||||
// 定义 emit 事件
|
// 定义 emit 事件
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'reportGenerated'): void
|
(e: 'reportGenerated'): void
|
||||||
@@ -224,8 +233,8 @@ const getResultData = async () => {
|
|||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTabClick = (tab: any) => {
|
const handleTabChange = (name: any) => {
|
||||||
activeName.value = tab.name
|
activeName.value = name
|
||||||
}
|
}
|
||||||
const handleChooseClick = async () => {
|
const handleChooseClick = async () => {
|
||||||
const currentResult = resultData.value[activeName.value]
|
const currentResult = resultData.value[activeName.value]
|
||||||
@@ -241,9 +250,9 @@ const handleChooseClick = async () => {
|
|||||||
whichTimeData.value = Object.keys(resultSourceData.value).map(time => {
|
whichTimeData.value = Object.keys(resultSourceData.value).map(time => {
|
||||||
// 检测结果只要有一个合格就算合格
|
// 检测结果只要有一个合格就算合格
|
||||||
const checkResult = resultSourceData.value[time].find((item: any) => item.checkResult === 1)
|
const checkResult = resultSourceData.value[time].find((item: any) => item.checkResult === 1)
|
||||||
return { time, checkResult: checkResult ? 1 : 2 }
|
return { time, checkResult: checkResult ? 1 : 0 }
|
||||||
})
|
})
|
||||||
currentWhichTimeData.value = whichTimeData.value[currentResult.whichTime]
|
currentWhichTimeData.value = whichTimeData.value.find((item: any) => item.time == currentResult.whichTime)
|
||||||
sourceData.value = resultSourceData.value[currentResult.whichTime]
|
sourceData.value = resultSourceData.value[currentResult.whichTime]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,7 +260,7 @@ const handleChooseClick = async () => {
|
|||||||
}
|
}
|
||||||
const handleTimeChange = (value: any) => {
|
const handleTimeChange = (value: any) => {
|
||||||
sourceData.value = resultSourceData.value[value]
|
sourceData.value = resultSourceData.value[value]
|
||||||
currentWhichTimeData.value = whichTimeData.value[value]
|
currentWhichTimeData.value = whichTimeData.value.find((item: any) => item.time == value)
|
||||||
submitSourceData.resultType = ''
|
submitSourceData.resultType = ''
|
||||||
submitSourceData.checkResult = -1
|
submitSourceData.checkResult = -1
|
||||||
}
|
}
|
||||||
@@ -283,7 +292,7 @@ const handleConfirmGenerate = async () => {
|
|||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
emit('reportGenerated') // 触发事件通知父组件
|
emit('reportGenerated') // 触发事件通知父组件
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('报告生成失败')
|
// 错误已经在全局拦截器中处理并显示,这里只记录日志
|
||||||
console.error('报告生成错误:', error)
|
console.error('报告生成错误:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
<!-- 表格行操作列:根据不同模式显示不同的操作按钮 -->
|
<!-- 表格行操作列:根据不同模式显示不同的操作按钮 -->
|
||||||
<template #operation="scope">
|
<template #operation="scope">
|
||||||
<div v-if="form.activeTabs === 3"
|
<div v-if="form.activeTabs === 3"
|
||||||
style="overflow-x: auto; display: flex;justify-content: center; align-items: center"
|
style=" display: flex;justify-content: center; align-items: center"
|
||||||
>
|
>
|
||||||
<!-- 报告下载(仅在报告已生成或已上传时显示) -->
|
<!-- 报告下载(仅在报告已生成或已上传时显示) -->
|
||||||
<el-button
|
<el-button
|
||||||
@@ -845,7 +845,7 @@ const handleTest2 = async (val: string) => {
|
|||||||
|
|
||||||
// 检查数组长度是否为1且唯一元素是'wave_data'
|
// 检查数组长度是否为1且唯一元素是'wave_data'
|
||||||
const isOnlyWave = targetPlan.datasourceIds.length === 1 && targetPlan.datasourceIds[0] === 'wave_data'
|
const isOnlyWave = targetPlan.datasourceIds.length === 1 && targetPlan.datasourceIds[0] === 'wave_data'
|
||||||
|
|
||||||
deviceConnectionPopupRef.value?.open(
|
deviceConnectionPopupRef.value?.open(
|
||||||
filteredChannelsSelection,
|
filteredChannelsSelection,
|
||||||
pqStandardDevList.value,
|
pqStandardDevList.value,
|
||||||
@@ -958,7 +958,7 @@ const handleTest = async (val: string) => {
|
|||||||
checkStore.setCheckType(1)
|
checkStore.setCheckType(1)
|
||||||
checkStore.initSelectTestItems()
|
checkStore.initSelectTestItems()
|
||||||
// 一键检测
|
// 一键检测
|
||||||
if (testType === 'reTest') {
|
if (testType === 'reTest' && modeStore.currentMode != '比对式') {
|
||||||
ElMessageBox.confirm('请选择复检检测方式', '设备复检', {
|
ElMessageBox.confirm('请选择复检检测方式', '设备复检', {
|
||||||
distinguishCancelAndClose: true,
|
distinguishCancelAndClose: true,
|
||||||
confirmButtonText: '不合格项复检',
|
confirmButtonText: '不合格项复检',
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
@node-click="handleNodeClick"
|
@node-click="handleNodeClick"
|
||||||
>
|
>
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<span class="custom-tree-node" style="display: flex; align-items: center">
|
<span class="custom-tree-node" style="display: flex; align-items: center;">
|
||||||
<!-- 父节点图标 -->
|
<!-- 父节点图标 -->
|
||||||
<Platform
|
<Platform
|
||||||
v-if="!data.pid"
|
v-if="!data.pid"
|
||||||
|
|||||||
@@ -30,43 +30,36 @@
|
|||||||
import { useAuthStore } from '@/stores/modules/auth'
|
import { useAuthStore } from '@/stores/modules/auth'
|
||||||
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
import { getCurrentScene } from '@/api/user/login'
|
import { getCurrentScene } from '@/api/user/login'
|
||||||
|
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||||
|
import { useTabsStore } from '@/stores/modules/tabs'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const modeStore = useModeStore() // 使用模式 store
|
const modeStore = useModeStore() // 使用模式 store
|
||||||
const AppSceneStore = useAppSceneStore()
|
const AppSceneStore = useAppSceneStore()
|
||||||
const activateInfo = authStore.activateInfo
|
const activateInfo = authStore.activateInfo
|
||||||
const isActivateOpen = import.meta.env.VITE_ACTIVATE_OPEN
|
const isActivateOpen = import.meta.env.VITE_ACTIVATE_OPEN
|
||||||
|
const tabsStore = useTabsStore()
|
||||||
const modeList = [
|
const modeList = [
|
||||||
{
|
{
|
||||||
name: '模拟式模块',
|
name: '模拟式模块',
|
||||||
code: '模拟式',
|
code: '模拟式',
|
||||||
subName: '未启用模拟式检测计划',
|
subName: '未启用模拟式检测计划',
|
||||||
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
|
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
|
||||||
activated:
|
activated: isActivateOpen === 'true' ? activateInfo.simulate.permanently === 1 : true
|
||||||
isActivateOpen === 'true'
|
|
||||||
? activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1
|
|
||||||
: true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '数字式模块',
|
name: '数字式模块',
|
||||||
code: '数字式',
|
code: '数字式',
|
||||||
subName: '启用数字检测计划',
|
subName: '启用数字检测计划',
|
||||||
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
||||||
activated:
|
activated: isActivateOpen === 'true' ? activateInfo.digital.permanently === 1 : true
|
||||||
isActivateOpen === 'true'
|
|
||||||
? activateInfo.digital.apply === 1 && activateInfo.digital.permanently === 1
|
|
||||||
: true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '比对式模块',
|
name: '比对式模块',
|
||||||
code: '比对式',
|
code: '比对式',
|
||||||
subName: '启用比对式检测计划',
|
subName: '启用比对式检测计划',
|
||||||
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
||||||
activated:
|
activated: isActivateOpen === 'true' ? activateInfo.contrast.permanently === 1 : true
|
||||||
isActivateOpen === 'true'
|
|
||||||
? activateInfo.contrast.apply === 1 && activateInfo.contrast.permanently === 1
|
|
||||||
: true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
const handelOpen = async (item: any) => {
|
const handelOpen = async (item: any) => {
|
||||||
@@ -78,15 +71,11 @@ const handelOpen = async (item: any) => {
|
|||||||
const { data: scene } = await getCurrentScene() // 获取当前场景
|
const { data: scene } = await getCurrentScene() // 获取当前场景
|
||||||
AppSceneStore.setCurrentMode(scene + '') //0:省级平台,1:设备出厂,2:研发自测
|
AppSceneStore.setCurrentMode(scene + '') //0:省级平台,1:设备出厂,2:研发自测
|
||||||
await authStore.setShowMenu()
|
await authStore.setShowMenu()
|
||||||
await authStore.getAuthMenuList()
|
await tabsStore.closeMultipleTab()
|
||||||
|
await initDynamicRouter()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const handleSelect = (key: string, keyPath: string[]) => {
|
onMounted(() => {})
|
||||||
|
|
||||||
}
|
|
||||||
onMounted(() => {
|
|
||||||
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.box {
|
.box {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<ProTable ref="proTable" :columns="columns" :request-api="getTableList">
|
<ProTable ref="proTable" :columns="columns" :request-api="getTableList">
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader>
|
<template #tableHeader>
|
||||||
<el-button type="primary" :icon="DataAnalysis">分析</el-button>
|
<!-- <el-button type="primary" :icon="DataAnalysis">分析</el-button>-->
|
||||||
<el-button type="primary" :icon="Upload" @click="handleExport">导出csv</el-button>
|
<el-button type="primary" icon="Download" @click="handleExport">导出csv</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
// 根据实际路径调整
|
// 根据实际路径调整
|
||||||
import TimeControl from '@/components/TimeControl/index.vue'
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import { DataAnalysis, Upload } from '@element-plus/icons-vue'
|
|
||||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
import { exportCsv, getAuditLog } from '@/api/system/log'
|
import { exportCsv, getAuditLog } from '@/api/system/log'
|
||||||
|
|||||||
@@ -82,36 +82,10 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="固件版本" prop="hardwareVersion" v-if="scene === '0'">
|
<el-form-item label="固件版本" prop="hardwareVersion" v-if="scene === '0'">
|
||||||
<el-select
|
<el-input v-model="formContent.hardwareVersion" clearable placeholder="请输入固件版本" />
|
||||||
v-model="formContent.hardwareVersion"
|
|
||||||
clearable
|
|
||||||
placeholder="请选择固件版本"
|
|
||||||
filterable
|
|
||||||
allow-create
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in selectOptions['hardwareVersion']"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="软件版本" prop="softwareVersion" v-if="scene === '0'">
|
<el-form-item label="软件版本" prop="softwareVersion" v-if="scene === '0'">
|
||||||
<el-select
|
<el-input v-model="formContent.softwareVersion" clearable placeholder="请输入软件版本" />
|
||||||
v-model="formContent.softwareVersion"
|
|
||||||
clearable
|
|
||||||
placeholder="请选择软件版本"
|
|
||||||
filterable
|
|
||||||
allow-create
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in selectOptions['softwareVersion']"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="定检日期" prop="inspectDate" v-if="MonIsShow">
|
<el-form-item label="定检日期" prop="inspectDate" v-if="MonIsShow">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@@ -218,55 +192,28 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属地市" prop="cityName" v-if="MonIsShow">
|
<el-form-item label="所属地市" prop="cityName" v-if="MonIsShow">
|
||||||
<el-select
|
<el-input
|
||||||
v-model="formContent.cityName"
|
v-model="formContent.cityName"
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择所属地市"
|
placeholder="请输入所属地市"
|
||||||
:disabled="formContent.importFlag == 1"
|
:disabled="formContent.importFlag == 1"
|
||||||
filterable
|
/>
|
||||||
allow-create
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in selectOptions['cityName']"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属供电公司" prop="gdName" v-if="MonIsShow">
|
<el-form-item label="所属供电公司" prop="gdName" v-if="MonIsShow">
|
||||||
<el-select
|
<el-input
|
||||||
v-model="formContent.gdName"
|
v-model="formContent.gdName"
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择所属供电公司"
|
placeholder="请输入所属供电公司"
|
||||||
:disabled="formContent.importFlag == 1"
|
:disabled="formContent.importFlag == 1"
|
||||||
filterable
|
/>
|
||||||
allow-create
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in selectOptions['gdName']"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属电站" prop="subName" v-if="MonIsShow">
|
<el-form-item label="所属电站" prop="subName" v-if="MonIsShow">
|
||||||
<el-select
|
<el-input
|
||||||
v-model="formContent.subName"
|
v-model="formContent.subName"
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择所属电站"
|
placeholder="请输入所属电站"
|
||||||
:disabled="formContent.importFlag == 1"
|
:disabled="formContent.importFlag == 1"
|
||||||
filterable
|
/>
|
||||||
allow-create
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in selectOptions['subName']"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-auth.device="'factorFlag'"
|
v-auth.device="'factorFlag'"
|
||||||
@@ -279,6 +226,14 @@
|
|||||||
<el-radio :value="0">否</el-radio>
|
<el-radio :value="0">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="scene === '1'"
|
||||||
|
label="谐波系统设备id"
|
||||||
|
prop="harmSysId"
|
||||||
|
placeholder="请输入谐波系统设备id"
|
||||||
|
>
|
||||||
|
<el-input v-model="formContent.harmSysId" :disabled="formContent.importFlag == 1" />
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -312,7 +267,7 @@ import dayjs from 'dayjs'
|
|||||||
import MonitorTable from '@/views/machine/device/components/monitorTab.vue'
|
import MonitorTable from '@/views/machine/device/components/monitorTab.vue'
|
||||||
import { useAppSceneStore } from '@/stores/modules/mode'
|
import { useAppSceneStore } from '@/stores/modules/mode'
|
||||||
import { generateUUID } from '@/utils'
|
import { generateUUID } from '@/utils'
|
||||||
import { Monitor } from '@/api/device/interface/monitor'
|
import { type Monitor } from '@/api/device/interface/monitor'
|
||||||
|
|
||||||
const AppSceneStore = useAppSceneStore()
|
const AppSceneStore = useAppSceneStore()
|
||||||
const MonIsShow = ref(false)
|
const MonIsShow = ref(false)
|
||||||
@@ -382,6 +337,7 @@ function useMetaInfo() {
|
|||||||
gdName: '',
|
gdName: '',
|
||||||
subName: '',
|
subName: '',
|
||||||
importFlag: 0,
|
importFlag: 0,
|
||||||
|
harmSysId: '',
|
||||||
inspectChannel: [],
|
inspectChannel: [],
|
||||||
monitorList: []
|
monitorList: []
|
||||||
})
|
})
|
||||||
@@ -421,6 +377,7 @@ const resetFormContent = () => {
|
|||||||
subName: '',
|
subName: '',
|
||||||
importFlag: 0,
|
importFlag: 0,
|
||||||
inspectChannel: [],
|
inspectChannel: [],
|
||||||
|
harmSysId: '',
|
||||||
monitorList: []
|
monitorList: []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -486,8 +443,10 @@ const rules = computed(() => {
|
|||||||
}
|
}
|
||||||
if (scene.value !== '0') {
|
if (scene.value !== '0') {
|
||||||
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }]
|
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }]
|
||||||
dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必选!', trigger: 'change' }]
|
// dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必选!', trigger: 'change' }]
|
||||||
dynamicRules.softwareVersion = [{ required: true, message: '软件版本必选!', trigger: 'change' }]
|
// dynamicRules.softwareVersion = [{ required: true, message: '软件版本必选!', trigger: 'change' }]
|
||||||
|
dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必填!', trigger: 'blur' }]
|
||||||
|
dynamicRules.softwareVersion = [{ required: true, message: '软件版本必填!', trigger: 'blur' }]
|
||||||
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }]
|
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,9 +457,12 @@ const rules = computed(() => {
|
|||||||
|
|
||||||
if (mode.value === '比对式') {
|
if (mode.value === '比对式') {
|
||||||
dynamicRules.inspectDate = [{ required: true, message: '定检日期必填!', trigger: 'blur' }]
|
dynamicRules.inspectDate = [{ required: true, message: '定检日期必填!', trigger: 'blur' }]
|
||||||
dynamicRules.cityName = [{ required: true, message: '所属地市必选!', trigger: 'change' }]
|
// dynamicRules.cityName = [{ required: true, message: '所属地市必选!', trigger: 'change' }]
|
||||||
dynamicRules.gdName = [{ required: true, message: '所属供电公司必选!', trigger: 'change' }]
|
// dynamicRules.gdName = [{ required: true, message: '所属供电公司必选!', trigger: 'change' }]
|
||||||
dynamicRules.subName = [{ required: true, message: '所属电站必选!', trigger: 'change' }]
|
// dynamicRules.subName = [{ required: true, message: '所属电站必选!', trigger: 'change' }]
|
||||||
|
dynamicRules.cityName = [{ required: true, message: '所属地市必填!', trigger: 'blur' }]
|
||||||
|
dynamicRules.gdName = [{ required: true, message: '所属供电公司必填!', trigger: 'blur' }]
|
||||||
|
dynamicRules.subName = [{ required: true, message: '所属电站必填!', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
return dynamicRules
|
return dynamicRules
|
||||||
@@ -656,6 +618,7 @@ const open = async (
|
|||||||
}
|
}
|
||||||
monitor.value = data.monitorList
|
monitor.value = data.monitorList
|
||||||
} else {
|
} else {
|
||||||
|
monitor.value = []
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
//只有比对式设备ID由前端传
|
//只有比对式设备ID由前端传
|
||||||
if (currentMode === '比对式') formContent.id = generateUUID().replaceAll('-', '')
|
if (currentMode === '比对式') formContent.id = generateUUID().replaceAll('-', '')
|
||||||
|
|||||||
@@ -1,22 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" align-center>
|
<el-dialog
|
||||||
|
:model-value="dialogVisible"
|
||||||
|
:title="dialogTitle"
|
||||||
|
v-bind="dialogMiddle"
|
||||||
|
width="50%"
|
||||||
|
@close="close"
|
||||||
|
align-center
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref="dialogFormRef" :rules="rules" class="form-two">
|
<el-form :model="formContent" ref="dialogFormRef" :rules="rules" label-width="140" class="form-two">
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name">
|
||||||
<el-input v-model="formContent.name" placeholder="请输入监测点名称" />
|
<el-input clearable v-model="formContent.name" placeholder="请输入监测点名称" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="线路号" prop="num">
|
<el-form-item label="线路号" prop="num">
|
||||||
<el-select
|
<el-select v-model="formContent.num" placeholder="请选择线路号" @change="handleMonNumChange" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||||
v-model="formContent.num"
|
|
||||||
clearable
|
|
||||||
placeholder="请选择线路号"
|
|
||||||
@change="handleMonNumChange"
|
|
||||||
>
|
|
||||||
<el-option v-for="item in lineNum" :key="item.id" :label="item.name" :value="item.id" />
|
<el-option v-for="item in lineNum" :key="item.id" :label="item.name" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属母线" prop="busbar">
|
<el-form-item label="所属母线" prop="busbar">
|
||||||
|
<el-input v-model="formContent.busbar" clearable placeholder="请输入所属母线" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="所属母线" prop="busbar">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formContent.busbar"
|
v-model="formContent.busbar"
|
||||||
clearable
|
clearable
|
||||||
@@ -31,29 +36,9 @@
|
|||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="PT变比" prop="pt">
|
|
||||||
<el-select v-model="formContent.pt" clearable placeholder="请选择PT变比" filterable allow-create>
|
|
||||||
<el-option
|
|
||||||
v-for="item in selectOptions['pt']"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="CT变比" prop="ct">
|
|
||||||
<el-select v-model="formContent.ct" clearable placeholder="请选择CT变比" filterable allow-create>
|
|
||||||
<el-option
|
|
||||||
v-for="item in selectOptions['ct']"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="接线方式" prop="connection">
|
<el-form-item label="接线方式" prop="connection">
|
||||||
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式">
|
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Connect')"
|
v-for="item in dictStore.getDictData('Dev_Connect')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -62,8 +47,45 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item required>
|
||||||
|
<template #label>
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-icon style="color: var(--el-color-error)"><WarningFilled /></el-icon>
|
||||||
|
<span>PT变比</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div class="ratio-input-group">
|
||||||
|
<el-form-item prop="ptPrimary" class="ratio-form-item">
|
||||||
|
<el-input v-model="ptPrimary" placeholder="一次侧" @input="handlePtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||||
|
</el-form-item>
|
||||||
|
<div class="colon">:</div>
|
||||||
|
<el-form-item prop="ptSecondary" style="margin-left: 10px" class="ratio-form-item">
|
||||||
|
<el-input v-model="ptSecondary" placeholder="二次侧" @input="handlePtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 修改CT变比部分 -->
|
||||||
|
<el-form-item required>
|
||||||
|
<template #label>
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-icon style="color: var(--el-color-error)"><WarningFilled /></el-icon>
|
||||||
|
<span>CT变比</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div class="ratio-input-group">
|
||||||
|
<el-form-item prop="ctPrimary" class="ratio-form-item">
|
||||||
|
<el-input v-model="ctPrimary" placeholder="一次侧" @input="handleCtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||||
|
</el-form-item>
|
||||||
|
<div class="colon">:</div>
|
||||||
|
<el-form-item prop="ctSecondary" style="margin-left: 10px" class="ratio-form-item">
|
||||||
|
<el-input v-model="ctSecondary" placeholder="二次侧" @input="handleCtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="统计间隔" prop="statInterval">
|
<el-form-item label="统计间隔" prop="statInterval">
|
||||||
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔">
|
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Chns')"
|
v-for="item in dictStore.getDictData('Dev_Chns')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -73,16 +95,21 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="谐波系统检测点id" prop="harmSysId" placeholder="请输入谐波系统检测点id">
|
<el-form-item label="谐波系统检测点id" prop="harmSysId" placeholder="请输入谐波系统检测点id">
|
||||||
<el-input v-model="formContent.harmSysId" />
|
<el-input v-model="formContent.harmSysId" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否参与检测" prop="checkFlag" placeholder="请输入CT编号">
|
<el-form-item label="是否参与检测" prop="checkFlag" placeholder="请输入CT编号">
|
||||||
<el-select v-model="formContent.checkFlag" clearable placeholder="请选择是否加密">
|
<el-select v-model="formContent.checkFlag" :disabled="formContent.resultType!=null">
|
||||||
<el-option label="是" :value="1"></el-option>
|
<el-option label="是" :value="1"></el-option>
|
||||||
<el-option label="否" :value="0"></el-option>
|
<el-option label="否" :value="0"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
<el-alert
|
||||||
|
title="注意:PT和CT变比请输入正常值,不可以缩小相同的倍数!"
|
||||||
|
type="error"
|
||||||
|
:closable="false"
|
||||||
|
></el-alert>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="close()">取消</el-button>
|
<el-button @click="close()">取消</el-button>
|
||||||
@@ -93,19 +120,31 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ElMessage, type FormItemRule } from 'element-plus'
|
import { ElMessage, ElMessageBox, type FormItemRule } from 'element-plus'
|
||||||
import { computed, ref, Ref } from 'vue'
|
import { computed, ref, type Ref } from 'vue'
|
||||||
import { type Monitor } from '@/api/device/interface/monitor'
|
import { type Monitor } from '@/api/device/interface/monitor'
|
||||||
import { dialogMiddle } from '@/utils/elementBind'
|
import { dialogMiddle } from '@/utils/elementBind'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { generateUUID } from '@/utils'
|
import { generateUUID } from '@/utils'
|
||||||
import { Device } from '@/api/device/interface/device'
|
import { type Device } from '@/api/device/interface/device'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const lineNum = ref<{ id: number; name: string }[]>([])
|
const lineNum = ref<{ id: number; name: string }[]>([])
|
||||||
const originalNum = ref<number | null>(null) // 存储编辑前的 num 值
|
const originalNum = ref<number | null>(null) // 存储编辑前的 num 值
|
||||||
const monitorTable = ref<any[]>()
|
const monitorTable = ref<any[]>()
|
||||||
const selectOptions = ref<Record<string, Device.SelectOption[]>>({})
|
const selectOptions = ref<Record<string, Device.SelectOption[]>>({})
|
||||||
|
|
||||||
|
// 新增用于PT/CT变比的临时字段
|
||||||
|
const ptPrimary = ref<string>('')
|
||||||
|
const ptSecondary = ref<string>('')
|
||||||
|
const ctPrimary = ref<string>('')
|
||||||
|
const ctSecondary = ref<string>('')
|
||||||
|
|
||||||
|
// 定义 props
|
||||||
|
const props = defineProps<{
|
||||||
|
DevFormContent: Device.ResPqDev
|
||||||
|
}>()
|
||||||
|
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
@@ -143,7 +182,8 @@ const resetFormContent = () => {
|
|||||||
connection: '',
|
connection: '',
|
||||||
statInterval: 1,
|
statInterval: 1,
|
||||||
harmSysId: '',
|
harmSysId: '',
|
||||||
checkFlag: 1
|
checkFlag: 1,
|
||||||
|
resultType: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,51 +200,185 @@ const close = () => {
|
|||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
name: [{ required: true, message: '监测点名称必填!', trigger: 'blur' }],
|
name: [{ required: true, message: '监测点名称必填!', trigger: 'blur' }],
|
||||||
num: [{ required: true, message: '线路号必选', trigger: 'change' }],
|
num: [{ required: true, message: '线路号必选', trigger: 'change' }],
|
||||||
pt: [
|
|
||||||
{ required: true, message: 'PT变比必选!', trigger: 'blur' },
|
|
||||||
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'PT变比格式应为 n:n 形式,例如 1:1', trigger: 'change' }
|
|
||||||
],
|
|
||||||
ct: [
|
|
||||||
{ required: true, message: 'CT变比必选!', trigger: 'blur' },
|
|
||||||
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'CT变比格式应为 n:n 形式,例如 1:1', trigger: 'change' }
|
|
||||||
],
|
|
||||||
connection: [{ required: true, message: '接线方式必选!', trigger: 'change' }],
|
connection: [{ required: true, message: '接线方式必选!', trigger: 'change' }],
|
||||||
busbar: [{ required: true, message: '所属母线必选!', trigger: 'change' }],
|
//busbar: [{ required: true, message: '所属母线必选!', trigger: 'change' }],
|
||||||
|
busbar: [{ required: true, message: '所属母线必填!', trigger: 'blur' }],
|
||||||
// harmSysId : [{ required: true, message: '谐波系统检测点id必填!', trigger: 'blur' }],
|
// harmSysId : [{ required: true, message: '谐波系统检测点id必填!', trigger: 'blur' }],
|
||||||
checkFlag: [{ required: true, message: '是否参与检测必选!', trigger: 'change' }]
|
checkFlag: [{ required: true, message: '是否参与检测必选!', trigger: 'change' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 处理PT输入变化并更新formContent中的值
|
||||||
|
const handlePtInput = () => {
|
||||||
|
if (ptPrimary.value && ptSecondary.value) {
|
||||||
|
formContent.value.pt = `${ptPrimary.value}:${ptSecondary.value}`
|
||||||
|
} else {
|
||||||
|
formContent.value.pt = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理CT输入变化并更新formContent中的值
|
||||||
|
const handleCtInput = () => {
|
||||||
|
if (ctPrimary.value && ctSecondary.value) {
|
||||||
|
formContent.value.ct = `${ctPrimary.value}:${ctSecondary.value}`
|
||||||
|
} else {
|
||||||
|
formContent.value.ct = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加一个用于手动验证的引用
|
||||||
|
const extraFormRules = ref({
|
||||||
|
ptPrimary: [
|
||||||
|
{ required: true, message: 'PT变比一次侧必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^[1-9]\d*$/, message: '请输入正整数', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
ptSecondary: [
|
||||||
|
{ required: true, message: 'PT变比二次侧必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^\d+(\.\d+)?$/, message: '请输入数字', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
ctPrimary: [
|
||||||
|
{ required: true, message: 'CT变比一次侧必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^[1-9]\d*$/, message: '请输入正整数', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
ctSecondary: [
|
||||||
|
{ required: true, message: 'CT变比二次侧必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^[1-9]\d*$/, message: '请输入正整数', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
const save = () => {
|
const save = () => {
|
||||||
try {
|
try {
|
||||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
// 手动验证额外的字段
|
||||||
|
let extraValid = true
|
||||||
|
const fieldsToValidate = ['ptPrimary', 'ptSecondary', 'ctPrimary', 'ctSecondary']
|
||||||
|
|
||||||
|
for (const field of fieldsToValidate) {
|
||||||
|
const value = eval(field) // 获取对应字段的值
|
||||||
|
const rules = extraFormRules.value[field]
|
||||||
|
|
||||||
|
for (const rule of rules) {
|
||||||
|
if (rule.required && !value.value) {
|
||||||
|
ElMessage.error({ message: rule.message as string })
|
||||||
|
extraValid = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rule.pattern && value.value && !rule.pattern.test(value.value)) {
|
||||||
|
ElMessage.error({ message: rule.message as string })
|
||||||
|
extraValid = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!extraValid) break
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!extraValid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 校验名称是否重复
|
// 校验名称是否重复
|
||||||
const isNameDuplicate = monitorTable.value.some(
|
const isNameDuplicate = monitorTable.value?.some(
|
||||||
item => item.name === formContent.value.name && item.id !== formContent.value.id
|
item => item.name === formContent.value.name && item.id !== formContent.value.id
|
||||||
)
|
)
|
||||||
if (isNameDuplicate) {
|
if (isNameDuplicate) {
|
||||||
ElMessage.error({ message: '监测点名称已存在,请重新输入!' })
|
ElMessage.error({ message: '监测点名称已存在,请重新输入!' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 添加PT CT逻辑
|
||||||
|
// PT 逻辑
|
||||||
|
let ptPrimaryValue = ptPrimary.value
|
||||||
|
let ptSecondaryValue = ptSecondary.value
|
||||||
|
let ptErrorTips = false
|
||||||
|
let ctErrorTips = false
|
||||||
|
const ptFinalValue = ['100', '380']
|
||||||
|
const ptFinalChangeValue = ['57.74', '220']
|
||||||
|
const ctFinalValue = ['1', '5']
|
||||||
|
|
||||||
if (titleType.value != 'edit') {
|
// 若值都为 1, 则改值为 380
|
||||||
formContent.value.id = generateUUID().replaceAll('-', '')
|
if (ptPrimaryValue === '1' && ptSecondaryValue === '1') {
|
||||||
|
formContent.value.pt = `${ptFinalValue[1]}:${ptFinalValue[1]}`
|
||||||
|
} else {
|
||||||
|
// 若PT分母值不为 ['100', '380']
|
||||||
|
if (!ptFinalValue.includes(ptSecondaryValue)) {
|
||||||
|
// 若PT分母值不为 ['57.74', '220'],提示
|
||||||
|
if (ptFinalChangeValue.includes(ptSecondaryValue)) {
|
||||||
|
// 判断值为 57.74,则 57.74 => 100
|
||||||
|
if (ptSecondaryValue === ptFinalChangeValue[0]) {
|
||||||
|
ptSecondaryValue = ptFinalValue[0]
|
||||||
|
}
|
||||||
|
// 判断值为 220,则 220 => 380
|
||||||
|
if (ptSecondaryValue === ptFinalChangeValue[1]) {
|
||||||
|
ptSecondaryValue = ptFinalValue[1]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ptErrorTips = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formContent.value.pt = `${ptPrimaryValue}:${ptSecondaryValue}`
|
||||||
|
// CT 逻辑, CT 分母是否为 ['1', '5']
|
||||||
|
if (!ctFinalValue.includes(ctSecondary.value)) {
|
||||||
|
ctErrorTips = true
|
||||||
|
}
|
||||||
|
if (ptErrorTips && ctErrorTips) {
|
||||||
|
await ElMessageBox.confirm('请确认PT和CT无误!', '提示', {
|
||||||
|
confirmButtonText: '继续保存',
|
||||||
|
cancelButtonText: '取消保存'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
sendParameter()
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (ptErrorTips) {
|
||||||
|
await ElMessageBox.confirm('请确认PT无误!', '提示', {
|
||||||
|
confirmButtonText: '继续保存',
|
||||||
|
cancelButtonText: '取消保存'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
sendParameter()
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (ctErrorTips) {
|
||||||
|
await ElMessageBox.confirm('请确认CT无误!', '提示', {
|
||||||
|
confirmButtonText: '确认保存',
|
||||||
|
cancelButtonText: '取消保存'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
sendParameter()
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ptErrorTips && !ctErrorTips) {
|
||||||
|
sendParameter()
|
||||||
}
|
}
|
||||||
emit('get-parameter', formContent.value)
|
|
||||||
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
|
||||||
close()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('验证过程中出现错误', err)
|
console.error('验证过程中出现错误', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const sendParameter = () => {
|
||||||
|
if (titleType.value != 'edit') {
|
||||||
|
formContent.value.id = generateUUID().replaceAll('-', '')
|
||||||
|
}
|
||||||
|
emit('get-parameter', formContent.value)
|
||||||
|
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
close()
|
||||||
|
}
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = async (sign: string, data: Monitor.ResPqMon, device: Device.ResPqDev, table: any[], options: any) => {
|
const open = async (sign: string, data: Monitor.ResPqMon, device: Device.ResPqDev, table: any[], options: any) => {
|
||||||
// 重置表单
|
|
||||||
//dialogFormRef.value?.resetFields()
|
|
||||||
selectOptions.value = options
|
selectOptions.value = options
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
@@ -226,13 +400,40 @@ const open = async (sign: string, data: Monitor.ResPqMon, device: Device.ResPqDe
|
|||||||
name: id.toString()
|
name: id.toString()
|
||||||
}
|
}
|
||||||
}).filter(item => !usedNums.has(item.id)) // 过滤掉已被使用的线路号
|
}).filter(item => !usedNums.has(item.id)) // 过滤掉已被使用的线路号
|
||||||
|
|
||||||
if (sign == 'edit') {
|
if (sign == 'edit') {
|
||||||
formContent.value = { ...data }
|
formContent.value = { ...data }
|
||||||
originalNum.value = data.num // 记录原始线路号
|
originalNum.value = data.num // 记录原始线路号
|
||||||
|
|
||||||
|
// 解析PT变比
|
||||||
|
if (data.pt) {
|
||||||
|
const [primary, secondary] = data.pt.split(':')
|
||||||
|
ptPrimary.value = primary
|
||||||
|
ptSecondary.value = secondary
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析CT变比
|
||||||
|
if (data.ct) {
|
||||||
|
const [primary, secondary] = data.ct.split(':')
|
||||||
|
ctPrimary.value = primary
|
||||||
|
ctSecondary.value = secondary
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// 清空PT和CT的临时变量
|
||||||
|
ptPrimary.value = ''
|
||||||
|
ptSecondary.value = ''
|
||||||
|
ctPrimary.value = ''
|
||||||
|
ctSecondary.value = ''
|
||||||
|
|
||||||
|
// 重置表单内容,但保留devId
|
||||||
|
const devId = formContent.value.devId
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
|
formContent.value.devId = devId
|
||||||
originalNum.value = null
|
originalNum.value = null
|
||||||
|
|
||||||
|
// 使用nextTick确保DOM更新后再清除验证
|
||||||
|
setTimeout(() => {
|
||||||
|
dialogFormRef.value?.clearValidate()
|
||||||
|
}, 0)
|
||||||
// 设置默认选中第一个线路号
|
// 设置默认选中第一个线路号
|
||||||
if (lineNum.value.length > 0) {
|
if (lineNum.value.length > 0) {
|
||||||
formContent.value.num = lineNum.value[0].id
|
formContent.value.num = lineNum.value[0].id
|
||||||
@@ -261,4 +462,24 @@ const handleMonNumChange = (value: string) => {
|
|||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped>
|
||||||
|
.ratio-input-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ratio-form-item {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colon {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.el-alert {
|
||||||
|
--el-alert-padding: 0px 12px !important;
|
||||||
|
--el-alert-title-font-size: 12px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
:icon="CirclePlus"
|
:icon="CirclePlus"
|
||||||
@click="openDialog('add')"
|
@click="openDialog('add')"
|
||||||
:disabled="props.DevFormContent.importFlag == 1"
|
|
||||||
>
|
>
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -38,7 +37,6 @@
|
|||||||
link
|
link
|
||||||
:icon="EditPen"
|
:icon="EditPen"
|
||||||
:model-value="false"
|
:model-value="false"
|
||||||
:disabled="props.DevFormContent.importFlag == 1"
|
|
||||||
@click="openDialog('edit', scope.row)"
|
@click="openDialog('edit', scope.row)"
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
@@ -49,13 +47,14 @@
|
|||||||
link
|
link
|
||||||
:icon="Delete"
|
:icon="Delete"
|
||||||
@click="handleDelete(scope.row.id)"
|
@click="handleDelete(scope.row.id)"
|
||||||
|
:disabled="scope.row.resultType!=null"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
<MonitorPopup @getParameter="getParameter" ref="monitorPopup" />
|
<MonitorPopup @getParameter="getParameter" ref="monitorPopup" :DevFormContent="props.DevFormContent"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@@ -14,12 +14,12 @@
|
|||||||
:style="{ height: '400px', maxHeight: '400px', overflow: 'hidden' }"
|
:style="{ height: '400px', maxHeight: '400px', overflow: 'hidden' }"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="40" fixed="left" />
|
||||||
<el-table-column prop="sort" label="序号" width="60" />
|
<el-table-column prop="sort" label="序号" width="55" fixed="left" />
|
||||||
<el-table-column prop="type" label="误差类型" min-width="180">
|
<el-table-column prop="type" label="误差类型" min-width="180">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
style="min-width: 180px"
|
style="min-width: 170px"
|
||||||
:options="errorOptions"
|
:options="errorOptions"
|
||||||
v-model="row.errorType"
|
v-model="row.errorType"
|
||||||
:props="{ checkStrictly: false, emitPath: false }"
|
:props="{ checkStrictly: false, emitPath: false }"
|
||||||
@@ -28,10 +28,10 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="type" label="脚本类型" min-width="230">
|
<el-table-column prop="type" label="脚本类型" min-width="240">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
style="min-width: 230px"
|
style="min-width: 220px"
|
||||||
:options="scriptOptions"
|
:options="scriptOptions"
|
||||||
v-model="row.scriptType"
|
v-model="row.scriptType"
|
||||||
:props="{ checkStrictly: false, emitPath: false }"
|
:props="{ checkStrictly: false, emitPath: false }"
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<el-select
|
<el-select
|
||||||
v-model="row.startFlag"
|
v-model="row.startFlag"
|
||||||
placeholder="选择起始值"
|
placeholder="选择起始值"
|
||||||
style="width: 70px"
|
style="width: 60px"
|
||||||
@change="value => handleStartFlagChange(row, value)"
|
@change="value => handleStartFlagChange(row, value)"
|
||||||
>
|
>
|
||||||
<el-option label="无" :value="2"></el-option>
|
<el-option label="无" :value="2"></el-option>
|
||||||
@@ -57,7 +57,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-input
|
<el-input-number
|
||||||
|
:controls="false"
|
||||||
v-model="row.startValue"
|
v-model="row.startValue"
|
||||||
style="width: 60px"
|
style="width: 60px"
|
||||||
:disabled="isStartValueDisabled[row.sort]"
|
:disabled="isStartValueDisabled[row.sort]"
|
||||||
@@ -73,7 +74,7 @@
|
|||||||
<el-select
|
<el-select
|
||||||
v-model="row.endFlag"
|
v-model="row.endFlag"
|
||||||
placeholder="选择结束值"
|
placeholder="选择结束值"
|
||||||
style="width: 70px"
|
style="width: 60px"
|
||||||
@change="value => handleEndFlagChange(row, value)"
|
@change="value => handleEndFlagChange(row, value)"
|
||||||
>
|
>
|
||||||
<el-option label="无" :value="2"></el-option>
|
<el-option label="无" :value="2"></el-option>
|
||||||
@@ -82,7 +83,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-input
|
<el-input-number
|
||||||
|
:controls="false"
|
||||||
v-model="row.endValue"
|
v-model="row.endValue"
|
||||||
style="width: 60px"
|
style="width: 60px"
|
||||||
:disabled="isEndValueDisabled[row.sort]"
|
:disabled="isEndValueDisabled[row.sort]"
|
||||||
@@ -91,7 +93,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="单位" width="130">
|
<el-table-column label="单位" width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select v-model="row.conditionType" placeholder="选择单位">
|
<el-select v-model="row.conditionType" placeholder="选择单位">
|
||||||
<el-option
|
<el-option
|
||||||
@@ -107,7 +109,7 @@
|
|||||||
<el-table-column label="最大误差">
|
<el-table-column label="最大误差">
|
||||||
<el-table-column prop="maxErrorValue" label="最大误差值" width="100">
|
<el-table-column prop="maxErrorValue" label="最大误差值" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-input v-model="row.maxErrorValue" style="width: 70px" />
|
<el-input-number :controls="false" v-model="row.maxErrorValue" style="width: 70px" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="误差类型" width="170">
|
<el-table-column label="误差类型" width="170">
|
||||||
@@ -119,13 +121,13 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="误差单位" width="100" prop="errorUnit">
|
<el-table-column label="误差单位" width="90" prop="errorUnit">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span>{{ row.errorUnit }}</span>
|
<span>{{ row.errorUnit }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" min-width="150">
|
<el-table-column label="操作" min-width="150" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="primary" link :icon="CopyDocument" @click="copyRow(row)">复制</el-button>
|
<el-button type="primary" link :icon="CopyDocument" @click="copyRow(row)">复制</el-button>
|
||||||
<el-button type="primary" link :icon="Delete" @click="deleteRow(row)">删除</el-button>
|
<el-button type="primary" link :icon="Delete" @click="deleteRow(row)">删除</el-button>
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="100%" align-center>
|
||||||
:title="dialogTitle"
|
|
||||||
v-model="dialogVisible"
|
|
||||||
@close="close"
|
|
||||||
v-bind="dialogBig"
|
|
||||||
width="1660px"
|
|
||||||
align-center
|
|
||||||
>
|
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="基础信息">
|
<el-tab-pane label="基础信息">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
type="number"
|
type="number"
|
||||||
placeholder="含有率"
|
placeholder="含有率"
|
||||||
style="width: 80px"
|
style="width: 80px"
|
||||||
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
|
onkeypress="return (/[\d.-]/.test(String.fromCharCode(event.keyCode)))"
|
||||||
@input="validateInput('famp',1)"
|
@input="validateInput('famp',1)"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -184,10 +184,9 @@
|
|||||||
v-if="progressData.status === 'success'"
|
v-if="progressData.status === 'success'"
|
||||||
type="primary"
|
type="primary"
|
||||||
title="点击打开目录"
|
title="点击打开目录"
|
||||||
:href="progressData.message"
|
|
||||||
@click="openDownloadLocation"
|
@click="openDownloadLocation"
|
||||||
>
|
>
|
||||||
{{ progressData.message }}
|
{{ filePath }}
|
||||||
</el-link>
|
</el-link>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-progress
|
<el-progress
|
||||||
@@ -369,9 +368,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render: (scope: { row: { checkState: number } }) => {
|
render: (scope: { row: { checkState: number } }) => {
|
||||||
return scope.row.checkState === 0 ? (
|
return scope.row.checkState === 0 ? (
|
||||||
<el-tag type="primary" effect="dark">
|
<el-tag type="info">未检</el-tag>
|
||||||
未检
|
|
||||||
</el-tag>
|
|
||||||
) : scope.row.checkState === 1 ? (
|
) : scope.row.checkState === 1 ? (
|
||||||
<el-tag type="warning" effect="dark">
|
<el-tag type="warning" effect="dark">
|
||||||
检测中
|
检测中
|
||||||
@@ -531,7 +528,6 @@ const removeTab = async (targetName: TabPaneName) => {
|
|||||||
}
|
}
|
||||||
// 弹窗打开方法
|
// 弹窗打开方法
|
||||||
const open = async (textTitle: string, data: Plan.ReqPlan, pattern: string) => {
|
const open = async (textTitle: string, data: Plan.ReqPlan, pattern: string) => {
|
||||||
|
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
title.value = textTitle
|
title.value = textTitle
|
||||||
planTitle.value = data.name
|
planTitle.value = data.name
|
||||||
@@ -585,7 +581,7 @@ const handleTableDataUpdate = async (newData: any[]) => {
|
|||||||
planFormContent.value = matchedItem
|
planFormContent.value = matchedItem
|
||||||
//console.log('递归匹配成功:', planFormContent.value)
|
//console.log('递归匹配成功:', planFormContent.value)
|
||||||
} else {
|
} else {
|
||||||
// console.warn('未找到匹配的 planId:', planId.value)
|
// console.warn('未找到匹配的 planId:', planId.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,7 +612,7 @@ const handleRemove = async (row: any) => {
|
|||||||
ElMessage.warning(`当前设备已被子计划绑定,无法删除!`)
|
ElMessage.warning(`当前设备已被子计划绑定,无法删除!`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
proTable.value?.getTableList() // 刷新当前表格
|
proTable.value?.getTableList() // 刷新当前表格
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -687,16 +683,15 @@ const exportPlan = async () => {
|
|||||||
const params = {
|
const params = {
|
||||||
id: subPlanFormContent.id
|
id: subPlanFormContent.id
|
||||||
}
|
}
|
||||||
ElMessageBox.confirm(`确认导出${subPlanFormContent.name}子计划元信息?`, '温馨提示', { type: 'warning' }).then(() =>
|
ElMessageBox.confirm(`确认导出${subPlanFormContent.name}子计划元信息?`, '温馨提示', {
|
||||||
useDownload(exportSubPlan, `${subPlanFormContent.name}_子计划元信息`, params, false, '.zip')
|
type: 'warning',
|
||||||
)
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消'
|
||||||
|
}).then(() => useDownload(exportSubPlan, `${subPlanFormContent.name}_子计划元信息`, params, false, '.zip'))
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportPlanCheckResultData = async (selectedListIds: string[]) => {
|
const exportPlanCheckResultData = async (selectedListIds: string[]) => {
|
||||||
|
filePath.value = ''
|
||||||
const params = {
|
const params = {
|
||||||
id: planFormContent.value.id,
|
id: planFormContent.value.id,
|
||||||
report: downloadReport.value,
|
report: downloadReport.value,
|
||||||
@@ -743,7 +738,6 @@ const initSSE = () => {
|
|||||||
eventSource.value = http.sse('/sse/createSse')
|
eventSource.value = http.sse('/sse/createSse')
|
||||||
|
|
||||||
eventSource.value.onmessage = event => {
|
eventSource.value.onmessage = event => {
|
||||||
|
|
||||||
const res = JSON.parse(event.data)
|
const res = JSON.parse(event.data)
|
||||||
progressData.value.percentage = res.data
|
progressData.value.percentage = res.data
|
||||||
progressData.value.message = res.message
|
progressData.value.message = res.message
|
||||||
@@ -779,10 +773,6 @@ const openDownloadLocation = () => {
|
|||||||
if (filePath.value) {
|
if (filePath.value) {
|
||||||
// 打开指定文件所在的目录,并选中该文件
|
// 打开指定文件所在的目录,并选中该文件
|
||||||
Renderer.shell.showItemInFolder(filePath.value)
|
Renderer.shell.showItemInFolder(filePath.value)
|
||||||
} else {
|
|
||||||
// 使用默认下载路径
|
|
||||||
const downloadPath = Renderer.app.getPath('downloads')
|
|
||||||
Renderer.shell.openPath(downloadPath)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ElMessage.warning('当前运行环境不支持,请复制路径自行打开')
|
ElMessage.warning('当前运行环境不支持,请复制路径自行打开')
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
align-center
|
align-center
|
||||||
v-bind="dialogBig"
|
v-bind="dialogBig"
|
||||||
@close="close"
|
@close="close"
|
||||||
|
|
||||||
>
|
>
|
||||||
<el-form ref="dialogFormRef" :model="formContent" :rules="rules">
|
<el-form ref="dialogFormRef" :model="formContent" :rules="rules">
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
@@ -294,7 +293,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8" v-if="waveRecordSetting">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label-width="140"
|
:label-width="140"
|
||||||
label="录波数据有效组数"
|
label="录波数据有效组数"
|
||||||
@@ -312,7 +311,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8" v-if="realTimeSetting">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label-width="140"
|
:label-width="140"
|
||||||
label="实时数据有效组数"
|
label="实时数据有效组数"
|
||||||
@@ -330,7 +329,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8" v-if="statisticsSetting">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label-width="140"
|
:label-width="140"
|
||||||
label="统计数据有效组数"
|
label="统计数据有效组数"
|
||||||
@@ -348,7 +347,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8" v-if="flickerSetting">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label-width="140"
|
:label-width="140"
|
||||||
label="闪变数据有效组数"
|
label="闪变数据有效组数"
|
||||||
@@ -366,7 +365,6 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
@@ -380,12 +378,45 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<ImportExcel ref="deviceImportExcel" @result="importResult" />
|
<ImportExcel ref="deviceImportExcel" @result="importResult" />
|
||||||
|
<transition name="fade">
|
||||||
|
<div
|
||||||
|
v-if="shanBianDialogVisible"
|
||||||
|
style="
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 999999999;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style="
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid var(--el-color-warning);
|
||||||
|
border-radius: 5px;
|
||||||
|
user-select: none;
|
||||||
|
background-color: var(--el-color-danger-light-9);
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<el-text style="font-weight: bold" type="warning" size="large">
|
||||||
|
<el-icon><WarningFilled /></el-icon>
|
||||||
|
闪变耗时较长,不推荐批量被检设备在检测过程中采集该指标
|
||||||
|
<el-icon @click="() => (shanBianDialogVisible = false)"><Close /></el-icon>
|
||||||
|
</el-text>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { type CascaderOption, ElMessage, type FormItemRule } from 'element-plus'
|
import { type CascaderOption, ElMessage, type FormItemRule } from 'element-plus'
|
||||||
import { computed, reactive, ref } from 'vue'
|
import { computed, reactive, ref, watch } from 'vue'
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
import { type Plan } from '@/api/plan/interface'
|
import { type Plan } from '@/api/plan/interface'
|
||||||
import {
|
import {
|
||||||
@@ -416,6 +447,7 @@ import { downloadTemplate, importPqDev } from '@/api/device/device'
|
|||||||
import { getTestConfig } from '@/api/system/base'
|
import { getTestConfig } from '@/api/system/base'
|
||||||
import { getRegRes } from '@/api/system/versionRegister'
|
import { getRegRes } from '@/api/system/versionRegister'
|
||||||
import DevSelect from '@/views/plan/planList/components/devSelect.vue'
|
import DevSelect from '@/views/plan/planList/components/devSelect.vue'
|
||||||
|
import { WarningFilled } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const modeStore = useModeStore()
|
const modeStore = useModeStore()
|
||||||
const AppSceneStore = useAppSceneStore()
|
const AppSceneStore = useAppSceneStore()
|
||||||
@@ -446,8 +478,13 @@ const planType = ref<number>(0)
|
|||||||
const subPlanBindStandardDev = ref<any>([]) //哪些标准设备已经被子计划绑定
|
const subPlanBindStandardDev = ref<any>([]) //哪些标准设备已经被子计划绑定
|
||||||
const activeNames = ref(['1'])
|
const activeNames = ref(['1'])
|
||||||
const allDisabled = ref(false)
|
const allDisabled = ref(false)
|
||||||
|
const shanBianDialogVisible = ref(false)
|
||||||
const leaderData = ref<any[]>([])
|
const leaderData = ref<any[]>([])
|
||||||
const memberData = ref<any[]>([])
|
const memberData = ref<any[]>([])
|
||||||
|
const waveRecordSetting = ref(false)
|
||||||
|
const realTimeSetting = ref(false)
|
||||||
|
const statisticsSetting = ref(false)
|
||||||
|
const flickerSetting = ref(false)
|
||||||
const generateData = () => {
|
const generateData = () => {
|
||||||
const manufacturerDict = dictStore.getDictData('Dev_Manufacturers')
|
const manufacturerDict = dictStore.getDictData('Dev_Manufacturers')
|
||||||
|
|
||||||
@@ -672,15 +709,24 @@ const save = () => {
|
|||||||
if (planType.value == 1) {
|
if (planType.value == 1) {
|
||||||
formContent.fatherPlanId = formContent.id
|
formContent.fatherPlanId = formContent.id
|
||||||
formContent.id = ''
|
formContent.id = ''
|
||||||
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
|
formContent.memberIds =
|
||||||
|
formContent.memberIds && formContent.memberIds.length > 0
|
||||||
|
? typeof formContent.memberIds === 'string'
|
||||||
|
? [formContent.memberIds]
|
||||||
|
: formContent.memberIds.map(id => id.toString())
|
||||||
|
: []
|
||||||
await addPlan(formContent)
|
await addPlan(formContent)
|
||||||
emit('update:tab')
|
emit('update:tab')
|
||||||
// 编辑子计划
|
// 编辑子计划
|
||||||
} else if (planType.value == 2) {
|
} else if (planType.value == 2) {
|
||||||
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
|
formContent.memberIds =
|
||||||
|
formContent.memberIds && formContent.memberIds.length > 0
|
||||||
|
? typeof formContent.memberIds === 'string'
|
||||||
|
? [formContent.memberIds]
|
||||||
|
: formContent.memberIds.map(id => id.toString())
|
||||||
|
: []
|
||||||
await updatePlan(formContent)
|
await updatePlan(formContent)
|
||||||
emit('update:tab')
|
emit('update:tab')
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
formContent.sourceIds = null
|
formContent.sourceIds = null
|
||||||
await updatePlan(formContent)
|
await updatePlan(formContent)
|
||||||
@@ -740,6 +786,10 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
isSelectDisabled.value = false
|
isSelectDisabled.value = false
|
||||||
planType.value = plan
|
planType.value = plan
|
||||||
|
waveRecordSetting.value = false
|
||||||
|
statisticsSetting.value = false
|
||||||
|
realTimeSetting.value = false
|
||||||
|
flickerSetting.value = false
|
||||||
if (sign == 'add') {
|
if (sign == 'add') {
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
allDisabled.value = false
|
allDisabled.value = false
|
||||||
@@ -754,7 +804,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
user_Result: any
|
user_Result: any
|
||||||
|
|
||||||
if (mode.value === '比对式') {
|
if (mode.value === '比对式') {
|
||||||
[
|
;[
|
||||||
PqErrSys_Result,
|
PqErrSys_Result,
|
||||||
pqDevList_Result,
|
pqDevList_Result,
|
||||||
pqReportName_Result,
|
pqReportName_Result,
|
||||||
@@ -793,8 +843,13 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
.map((user: any) => ({ ...user, disabled: false }))
|
.map((user: any) => ({ ...user, disabled: false }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 默认选择 cp95值 作为数据处理原则
|
||||||
|
const dataRuleDict = dictStore.getDictData('Data_Rule')
|
||||||
|
const rule = dataRuleDict.find(item => item.code === 'Cp95_Value')
|
||||||
|
formContent.dataRule = rule ? rule.id : ''
|
||||||
} else {
|
} else {
|
||||||
[pqSource_Result, PqScript_Result, PqErrSys_Result, pqDevList_Result, pqReportName_Result] =
|
;[pqSource_Result, PqScript_Result, PqErrSys_Result, pqDevList_Result, pqReportName_Result] =
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
getTestSourceList(data),
|
getTestSourceList(data),
|
||||||
getPqScriptList(data),
|
getPqScriptList(data),
|
||||||
@@ -829,8 +884,10 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
const datasourceDicts = dictStore.getDictData('Datasource')
|
const datasourceDicts = dictStore.getDictData('Datasource')
|
||||||
|
|
||||||
formContent.datasourceIds = datasourceDicts
|
formContent.datasourceIds = datasourceDicts
|
||||||
.filter(item => ['real', 'wave_data'].includes(item.code))
|
.filter(item => ['real', 'wave_data'].includes(item.code))
|
||||||
.map(item => item.code)
|
.map(item => item.code)
|
||||||
|
realTimeSetting.value = true
|
||||||
|
waveRecordSetting.value = true
|
||||||
} else {
|
} else {
|
||||||
//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
|
//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
|
||||||
|
|
||||||
@@ -907,7 +964,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[
|
;[
|
||||||
pqSource_Result,
|
pqSource_Result,
|
||||||
PqScript_Result,
|
PqScript_Result,
|
||||||
PqErrSys_Result,
|
PqErrSys_Result,
|
||||||
@@ -982,6 +1039,8 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
}
|
}
|
||||||
formContent.devIds = boundData.map((i: any) => i.id) // 已绑定设备id集合
|
formContent.devIds = boundData.map((i: any) => i.id) // 已绑定设备id集合
|
||||||
}
|
}
|
||||||
|
handleDataSourceChange()
|
||||||
|
handleTestItemChange(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
pqToArray() //将对象转为数组
|
pqToArray() //将对象转为数组
|
||||||
@@ -1004,9 +1063,9 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
formContent.sourceIds = formContent.sourceIds.join(',')
|
formContent.sourceIds = formContent.sourceIds.join(',')
|
||||||
}
|
}
|
||||||
// 将 formContent.sourceIds 从数组转换为字符串
|
// 将 formContent.sourceIds 从数组转换为字符串
|
||||||
/*if (Array.isArray(formContent.datasourceIds)) {
|
if (Array.isArray(formContent.datasourceIds)) {
|
||||||
formContent.datasourceIds = formContent.datasourceIds.join(',')
|
formContent.datasourceIds = formContent.datasourceIds.join(',')
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AppSceneStore.currentScene == '1') {
|
if (AppSceneStore.currentScene == '1') {
|
||||||
@@ -1029,13 +1088,21 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 检测项选择变化时的处理函数
|
// 检测项选择变化时的处理函数
|
||||||
const handleTestItemChange = () => {
|
const handleTestItemChange = (showTip: boolean = true) => {
|
||||||
if (formContent.testItems.length > 0) {
|
if (formContent.testItems.length > 0) {
|
||||||
const hasShanBian = secondLevelOptions
|
const hasShanBian = secondLevelOptions
|
||||||
.filter(option => formContent.testItems.includes(option.value))
|
.filter(option => formContent.testItems.includes(option.value))
|
||||||
.find(option => option.label === '闪变')
|
.find(option => option.label === '闪变')
|
||||||
if (hasShanBian) {
|
if (hasShanBian) {
|
||||||
ElMessage.warning('闪变耗时较长,不推荐批量被检设备在检测过程中采集该指标')
|
flickerSetting.value = true
|
||||||
|
if (showTip) {
|
||||||
|
shanBianDialogVisible.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
shanBianDialogVisible.value = false
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
flickerSetting.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1058,8 +1125,8 @@ const handleErrorSysChange = async (value: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
formContent.testItems = secondLevelOptions
|
formContent.testItems = secondLevelOptions
|
||||||
.filter(option => option.label !== '闪变')
|
.filter(option => option.label !== '闪变')
|
||||||
.map(option => option.value)
|
.map(option => option.value)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
formContent.testItems = []
|
formContent.testItems = []
|
||||||
console.error('获取检测项失败:', error)
|
console.error('获取检测项失败:', error)
|
||||||
@@ -1090,9 +1157,9 @@ const loadTestItemsForErrorSys = async (errorSysId: string) => {
|
|||||||
label: (res.data as Record<string, string>)[key]
|
label: (res.data as Record<string, string>)[key]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
formContent.testItems = secondLevelOptions
|
formContent.testItems = secondLevelOptions
|
||||||
.filter(option => option.label !== '闪变')
|
.filter(option => option.label !== '闪变')
|
||||||
.map(option => option.value)
|
.map(option => option.value)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取检测项失败:', error)
|
console.error('获取检测项失败:', error)
|
||||||
@@ -1188,16 +1255,49 @@ const handleDataSourceChange = () => {
|
|||||||
// 判断是否同时包含 '3s' 和 '分钟'
|
// 判断是否同时包含 '3s' 和 '分钟'
|
||||||
const hasThreeSeconds = selectedLabels.some(label => label.includes('3s'))
|
const hasThreeSeconds = selectedLabels.some(label => label.includes('3s'))
|
||||||
const hasMinuteStats = selectedLabels.some(label => label.includes('分钟'))
|
const hasMinuteStats = selectedLabels.some(label => label.includes('分钟'))
|
||||||
|
const hasLuBo = selectedLabels.some(label => label.includes('录波'))
|
||||||
|
|
||||||
if (hasThreeSeconds && hasMinuteStats) {
|
if (hasThreeSeconds && hasMinuteStats) {
|
||||||
ElMessage.warning('3s实时数据与分钟统计数据不能同时选择')
|
ElMessage.warning('3s实时数据与分钟统计数据不能同时选择')
|
||||||
formContent.datasourceIds = []
|
formContent.datasourceIds = []
|
||||||
|
realTimeSetting.value = false
|
||||||
|
statisticsSetting.value = false
|
||||||
|
waveRecordSetting.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasLuBo && hasMinuteStats) {
|
||||||
|
ElMessage.warning('录波数据与分钟统计数据不能同时选择')
|
||||||
|
formContent.datasourceIds = []
|
||||||
|
realTimeSetting.value = false
|
||||||
|
statisticsSetting.value = false
|
||||||
|
waveRecordSetting.value = false
|
||||||
|
return
|
||||||
}
|
}
|
||||||
// 判断是否选择了多个“分钟统计数据”项
|
// 判断是否选择了多个“分钟统计数据”项
|
||||||
const minuteStatLabels = selectedLabels.filter(label => label.includes('分钟'))
|
const minuteStatLabels = selectedLabels.filter(label => label.includes('分钟'))
|
||||||
if (minuteStatLabels.length > 1) {
|
if (minuteStatLabels.length > 1) {
|
||||||
ElMessage.warning('分钟统计数据不能多选')
|
ElMessage.warning('分钟统计数据不能多选')
|
||||||
formContent.datasourceIds = []
|
formContent.datasourceIds = []
|
||||||
|
realTimeSetting.value = false
|
||||||
|
statisticsSetting.value = false
|
||||||
|
waveRecordSetting.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (hasThreeSeconds) {
|
||||||
|
realTimeSetting.value = true
|
||||||
|
} else {
|
||||||
|
realTimeSetting.value = false
|
||||||
|
}
|
||||||
|
if (hasMinuteStats) {
|
||||||
|
statisticsSetting.value = true
|
||||||
|
} else {
|
||||||
|
statisticsSetting.value = false
|
||||||
|
}
|
||||||
|
if (hasLuBo) {
|
||||||
|
waveRecordSetting.value = true
|
||||||
|
} else {
|
||||||
|
waveRecordSetting.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1235,7 +1335,6 @@ const props = defineProps<{
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
// :deep(.dialog-small .el-dialog__body){
|
// :deep(.dialog-small .el-dialog__body){
|
||||||
// max-height: 330px !important;
|
// max-height: 330px !important;
|
||||||
// }
|
// }
|
||||||
@@ -1254,6 +1353,12 @@ const props = defineProps<{
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
.fade-enter-active,
|
||||||
|
.fade-leave-active {
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
.fade-enter-from,
|
||||||
|
.fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -338,9 +338,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return scope.row.testState === 0 ? (
|
return scope.row.testState === 0 ? (
|
||||||
<el-tag type="primary" effect="dark">
|
<el-tag type="info">未检</el-tag>
|
||||||
未检
|
|
||||||
</el-tag>
|
|
||||||
) : scope.row.testState === 1 ? (
|
) : scope.row.testState === 1 ? (
|
||||||
<el-tag type="warning" effect="dark">
|
<el-tag type="warning" effect="dark">
|
||||||
检测中
|
检测中
|
||||||
@@ -579,7 +577,11 @@ const importClick = () => {
|
|||||||
|
|
||||||
// 点击导出按钮
|
// 点击导出按钮
|
||||||
const exportClick = () => {
|
const exportClick = () => {
|
||||||
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() => {
|
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', {
|
||||||
|
type: 'warning',
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消'
|
||||||
|
}).then(() => {
|
||||||
useDownload(
|
useDownload(
|
||||||
exportPlan,
|
exportPlan,
|
||||||
'检测计划导出数据',
|
'检测计划导出数据',
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
<el-button type="primary" @click="submitForm()">保存配置</el-button>
|
<el-button type="primary" @click="submitForm()">保存配置</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="日志配置">
|
<!-- <el-tab-pane label="日志配置">
|
||||||
<div>
|
<div>
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
@@ -181,20 +181,20 @@
|
|||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button type="primary">保存配置</el-button>
|
<el-button type="primary">保存配置</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>-->
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx'>
|
<script setup lang='tsx'>
|
||||||
import {useDictStore} from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import {computed, onMounted, Ref, ref} from 'vue'
|
import { computed, onMounted, Ref, ref } from 'vue'
|
||||||
import {type Base} from '@/api/system/base/interface'
|
import { type Base } from '@/api/system/base/interface'
|
||||||
import {type VersionRegister} from '@/api/system/versionRegister/interface'
|
import { type VersionRegister } from '@/api/system/versionRegister/interface'
|
||||||
import {getTestConfig, updateTestConfig} from '@/api/system/base/index'
|
import { getTestConfig, updateTestConfig } from '@/api/system/base/index'
|
||||||
import {getRegRes, updateRegRes} from '@/api/system/versionRegister/index'
|
import { getRegRes, updateRegRes } from '@/api/system/versionRegister/index'
|
||||||
import {ElMessage, FormItemRule} from 'element-plus'
|
import { ElMessage, FormItemRule } from 'element-plus'
|
||||||
import {useModeStore} from '@/stores/modules/mode'; // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'base'
|
name: 'base'
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,154 +1,194 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class='table-box' v-model='dialogVisible' top='114px'
|
<el-dialog
|
||||||
:style="{ height: height+'px', maxHeight: height+'px', overflow: 'hidden' }"
|
class="table-box"
|
||||||
title='字典数据'
|
v-model="dialogVisible"
|
||||||
:width='width'
|
top="114px"
|
||||||
:modal='false'>
|
:style="{ height: height + 'px', maxHeight: height + 'px', overflow: 'hidden' }"
|
||||||
<div class='table-box' :style="{height:(height-64)+'px',maxHeight:(height-64)+'px',overflow:'hidden'}">
|
title="字典数据"
|
||||||
<ProTable ref='proTable' :columns="columns" :request-api='getDictDataListByTypeId' :initParam="initParam">
|
:width="width"
|
||||||
<template #tableHeader="scope">
|
:modal="false"
|
||||||
<el-button v-auth.dict="'show_add'" type="primary" :icon="CirclePlus" @click="openDialog('add')">新增</el-button>
|
>
|
||||||
<el-button v-auth.dict="'show_export'" type='primary' :icon='Download' plain @click="downloadFile">导出</el-button>
|
<div
|
||||||
<el-button v-auth.dict="'show_delete'" type="danger" :icon="Delete" plain :disabled="!scope.isSelected"
|
class="table-box"
|
||||||
@click="batchDelete(scope.selectedListIds)">
|
:style="{ height: height - 64 + 'px', maxHeight: height - 64 + 'px', overflow: 'hidden' }"
|
||||||
删除
|
>
|
||||||
</el-button>
|
<ProTable ref="proTable" :columns="columns" :request-api="getDictDataListByTypeId" :initParam="initParam">
|
||||||
</template>
|
<template #tableHeader="scope">
|
||||||
|
<el-button v-auth.dict="'show_add'" type="primary" :icon="CirclePlus" @click="openDialog('add')">
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.dict="'show_export'" type="primary" :icon="Download" plain @click="downloadFile">
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-auth.dict="'show_delete'"
|
||||||
|
type="danger"
|
||||||
|
:icon="Delete"
|
||||||
|
plain
|
||||||
|
:disabled="!scope.isSelected"
|
||||||
|
@click="batchDelete(scope.selectedListIds)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #operation="scope">
|
<template #operation="scope">
|
||||||
<el-button v-auth.dict="'show_edit'" type="primary" link :icon="EditPen" @click="openDialog('edit', scope.row)">编辑</el-button>
|
<el-button
|
||||||
<el-button v-auth.dict="'show_delete'" type="primary" link :icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
v-auth.dict="'show_edit'"
|
||||||
</template>
|
type="primary"
|
||||||
</ProTable>
|
link
|
||||||
</div>
|
:icon="EditPen"
|
||||||
</el-dialog>
|
@click="openDialog('edit', scope.row)"
|
||||||
<DataPopup :refresh-table='proTable?.getTableList' ref='dataPopup'/>
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-auth.dict="'show_delete'"
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
:icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<DataPopup :refresh-table="proTable?.getTableList" ref="dataPopup" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="tsx" name="dictData">
|
<script setup lang="tsx" name="dictData">
|
||||||
import {CirclePlus, Delete, Download, EditPen} from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, Download, EditPen } from '@element-plus/icons-vue'
|
||||||
import {type Dict} from '@/api/system/dictionary/interface'
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
import {ColumnProps, ProTableInstance} from '@/components/ProTable/interface'
|
import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import {useHandleData} from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import {deleteDictData, getDictDataListByTypeId, exportDictData} from "@/api/system/dictionary/dictData/index";
|
import { deleteDictData, exportDictData, getDictDataListByTypeId } from '@/api/system/dictionary/dictData/index'
|
||||||
import {useDownload} from "@/hooks/useDownload";
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import {exportDictType} from "@/api/system/dictionary/dictType";
|
|
||||||
import { isShallow } from 'vue';
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'dict'
|
name: 'dict'
|
||||||
})
|
})
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
//字典数据所属的字典类型Id
|
//字典数据所属的字典类型Id
|
||||||
const dictTypeId = ref('')
|
const dictTypeId = ref('')
|
||||||
const dictTypeName = ref('')
|
const dictTypeName = ref('')
|
||||||
|
|
||||||
|
const initParam = reactive({ typeId: '' })
|
||||||
const initParam = reactive({typeId: ''})
|
|
||||||
|
|
||||||
const dataPopup = ref()
|
const dataPopup = ref()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
width: {
|
width: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 800,
|
default: 800
|
||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 744,
|
default: 744
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
||||||
{type: 'selection', fixed: 'left', width: 70},
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
search: {
|
search: {
|
||||||
el: 'input'
|
el: 'input'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'code',
|
prop: 'code',
|
||||||
label: '编码',
|
label: '编码',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
search: {
|
search: {
|
||||||
el: 'input'
|
el: 'input'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'value',
|
prop: 'value',
|
||||||
label: '值',
|
label: '值',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
render: (scope) => {
|
render: scope => {
|
||||||
if (scope.row.openValue === 0 || scope.row.value === null || scope.row.value === '') {
|
if (scope.row.openValue === 0 || scope.row.value === null || scope.row.value === '') {
|
||||||
return <span>/</span>; // 使用 JSX 返回 VNode
|
return <span>/</span> // 使用 JSX 返回 VNode
|
||||||
}
|
|
||||||
return <span>{scope.row.value}</span>; // 使用 JSX 返回 VNode
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'level',
|
|
||||||
label: '事件等级',
|
|
||||||
minWidth: 180,
|
|
||||||
isShow:false,
|
|
||||||
render: scope => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{
|
|
||||||
(<el-tag type={scope.row.level === 0 ? 'info' : scope.row.level === 1 ? 'warning' : 'danger'}>
|
|
||||||
{scope.row.level === 0 ? '普通' : scope.row.level === 1 ? '中等' : '严重'}
|
|
||||||
</el-tag>)
|
|
||||||
}
|
}
|
||||||
</>
|
return <span>{scope.row.value}</span> // 使用 JSX 返回 VNode
|
||||||
)
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'level',
|
||||||
|
label: '事件等级',
|
||||||
|
minWidth: 180,
|
||||||
|
isShow: false,
|
||||||
|
render: scope => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{
|
||||||
|
<el-tag type={scope.row.level === 0 ? 'info' : scope.row.level === 1 ? 'warning' : 'danger'}>
|
||||||
|
{scope.row.level === 0 ? '普通' : scope.row.level === 1 ? '中等' : '严重'}
|
||||||
|
</el-tag>
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
minWidth: 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'operation',
|
||||||
|
label: '操作',
|
||||||
|
fixed: 'right',
|
||||||
|
width: 200
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
minWidth: 180
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'operation',
|
|
||||||
label: '操作',
|
|
||||||
fixed: 'right',
|
|
||||||
width: 200
|
|
||||||
},
|
|
||||||
])
|
])
|
||||||
|
|
||||||
const open = (row: Dict.ResDictType) => {
|
const open = (row: Dict.ResDictType) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dictTypeId.value = row.id
|
dictTypeId.value = row.id
|
||||||
dictTypeName.value = row.name
|
dictTypeName.value = row.name
|
||||||
initParam.typeId = row.id
|
initParam.typeId = row.id
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({open})
|
defineExpose({ open })
|
||||||
|
|
||||||
// 打开 dialog(新增、查看、编辑)
|
// 打开 dialog(新增、查看、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<Dict.ResDictData> = {}) => {
|
const openDialog = (titleType: string, row: Partial<Dict.ResDictData> = {}) => {
|
||||||
dataPopup.value?.open(titleType, dictTypeId.value, dictTypeName.value, row)
|
dataPopup.value?.open(titleType, dictTypeId.value, dictTypeName.value, row)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量删除字典数据
|
// 批量删除字典数据
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deleteDictData, id, '删除所选字典数据')
|
await useHandleData(deleteDictData, id, '删除所选字典数据')
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除字典数据
|
// 删除字典数据
|
||||||
const handleDelete = async (params: Dict.ResDictData) => {
|
const handleDelete = async (params: Dict.ResDictData) => {
|
||||||
await useHandleData(deleteDictData, [params.id], `删除【${params.name}】字典数据`)
|
await useHandleData(deleteDictData, [params.id], `删除【${params.name}】字典数据`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
const downloadFile = async () => {
|
const downloadFile = async () => {
|
||||||
ElMessageBox.confirm('确认导出字典数据?', '温馨提示', {type: 'warning'}).then(() =>
|
ElMessageBox.confirm('确认导出字典数据?', '温馨提示', {
|
||||||
useDownload(exportDictData, '字典数据导出数据', {typeId: dictTypeId.value, ...(proTable.value?.searchParam)}, false),
|
type: 'warning',
|
||||||
)
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消'
|
||||||
|
}).then(() =>
|
||||||
|
useDownload(
|
||||||
|
exportDictData,
|
||||||
|
'字典数据导出数据',
|
||||||
|
{ typeId: dictTypeId.value, ...proTable.value?.searchParam },
|
||||||
|
false
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,43 +1,62 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='table-box' ref='popupBaseView'>
|
<div class="table-box" ref="popupBaseView">
|
||||||
<ProTable
|
<ProTable ref="proTable" :columns="columns" :request-api="getDictTypeList">
|
||||||
ref='proTable'
|
<template #tableHeader="scope">
|
||||||
:columns='columns'
|
<el-button v-auth.dict="'add'" type="primary" :icon="CirclePlus" @click="openDialog('add')">
|
||||||
:request-api='getDictTypeList'
|
新增
|
||||||
>
|
</el-button>
|
||||||
<template #tableHeader='scope'>
|
<el-button v-auth.dict="'export'" type="primary" :icon="Download" plain @click="downloadFile()">
|
||||||
<el-button v-auth.dict="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
导出
|
||||||
<el-button v-auth.dict="'export'" type='primary' :icon='Download' plain @click='downloadFile()'>导出</el-button>
|
</el-button>
|
||||||
<el-button v-auth.dict="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
<el-button
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
v-auth.dict="'delete'"
|
||||||
删除
|
type="danger"
|
||||||
</el-button>
|
:icon="Delete"
|
||||||
</template>
|
plain
|
||||||
|
:disabled="!scope.isSelected"
|
||||||
|
@click="batchDelete(scope.selectedListIds)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #operation='scope'>
|
<template #operation="scope">
|
||||||
<el-button v-auth.dict="'show'" type='primary' link :icon='View' @click='toDictData(scope.row)'>查看</el-button>
|
<el-button v-auth.dict="'show'" type="primary" link :icon="View" @click="toDictData(scope.row)">
|
||||||
<el-button v-auth.dict="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
查看
|
||||||
<el-button v-auth.dict="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
</el-button>
|
||||||
</template>
|
<el-button
|
||||||
</ProTable>
|
v-auth.dict="'edit'"
|
||||||
</div>
|
type="primary"
|
||||||
<DictData :width='viewWidth' :height='viewHeight' ref='openView' />
|
link
|
||||||
<TypePopup :refresh-table='proTable?.getTableList' ref='typePopup' />
|
:icon="EditPen"
|
||||||
|
@click="openDialog('edit', scope.row)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.dict="'delete'" type="primary" link :icon="Delete" @click="handleDelete(scope.row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<DictData :width="viewWidth" :height="viewHeight" ref="openView" />
|
||||||
|
<TypePopup :refresh-table="proTable?.getTableList" ref="typePopup" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='dict'>
|
<script setup lang="tsx" name="dict">
|
||||||
import { CirclePlus, Delete, Download, EditPen, View } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, Download, EditPen, View } from '@element-plus/icons-vue'
|
||||||
import { type Dict } from '@/api/system/dictionary/interface'
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import DictData from '@/views/system/dictionary/dictData/index.vue'
|
import DictData from '@/views/system/dictionary/dictData/index.vue'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { useViewSize } from '@/hooks/useViewSize'
|
import { useViewSize } from '@/hooks/useViewSize'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import { deleteDictType, getDictTypeList, exportDictType } from '@/api/system/dictionary/dictType'
|
import { deleteDictType, exportDictType, getDictTypeList } from '@/api/system/dictionary/dictType'
|
||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'dict'
|
name: 'dict'
|
||||||
})
|
})
|
||||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
|
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
@@ -45,76 +64,76 @@ const typePopup = ref()
|
|||||||
const openView = ref()
|
const openView = ref()
|
||||||
|
|
||||||
const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '类型名称',
|
label: '类型名称',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
search: {
|
search: {
|
||||||
el: 'input',
|
el: 'input'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
prop: 'code',
|
||||||
prop: 'code',
|
label: '类型编码',
|
||||||
label: '类型编码',
|
minWidth: 220,
|
||||||
minWidth: 220,
|
search: {
|
||||||
search: {
|
el: 'input'
|
||||||
el: 'input',
|
}
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
prop: 'remark',
|
||||||
prop: 'remark',
|
label: '描述',
|
||||||
label: '描述',
|
minWidth: 250
|
||||||
minWidth: 250,
|
},
|
||||||
},
|
{
|
||||||
{
|
prop: 'sort',
|
||||||
prop: 'sort',
|
label: '排序',
|
||||||
label: '排序',
|
minWidth: 70
|
||||||
minWidth: 70,
|
},
|
||||||
},
|
{
|
||||||
{
|
prop: 'createTime',
|
||||||
prop: 'createTime',
|
label: '创建时间',
|
||||||
label: '创建时间',
|
minWidth: 180
|
||||||
minWidth: 180,
|
},
|
||||||
},
|
{
|
||||||
{
|
prop: 'operation',
|
||||||
prop: 'operation',
|
label: '操作',
|
||||||
label: '操作',
|
fixed: 'right',
|
||||||
fixed: 'right',
|
width: 250
|
||||||
width: 250,
|
}
|
||||||
},
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<Dict.ResDictType> = {}) => {
|
const openDialog = (titleType: string, row: Partial<Dict.ResDictType> = {}) => {
|
||||||
typePopup.value?.open(titleType, row)
|
typePopup.value?.open(titleType, row)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 批量删除字典类型
|
// 批量删除字典类型
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deleteDictType, id, '删除所选字典类型')
|
await useHandleData(deleteDictType, id, '删除所选字典类型')
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除字典类型
|
// 删除字典类型
|
||||||
const handleDelete = async (params: Dict.ResDictType) => {
|
const handleDelete = async (params: Dict.ResDictType) => {
|
||||||
await useHandleData(deleteDictType, [params.id], `删除【${params.name}】字典类型`)
|
await useHandleData(deleteDictType, [params.id], `删除【${params.name}】字典类型`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
//查看字典类型包含的字典数据
|
//查看字典类型包含的字典数据
|
||||||
const toDictData = (row: Dict.ResDictType) => {
|
const toDictData = (row: Dict.ResDictType) => {
|
||||||
openView.value.open(row)
|
openView.value.open(row)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出字典类型列表
|
// 导出字典类型列表
|
||||||
const downloadFile = async () => {
|
const downloadFile = async () => {
|
||||||
ElMessageBox.confirm('确认导出字典类型数据?', '温馨提示', { type: 'warning' }).then(() =>
|
ElMessageBox.confirm('确认导出字典类型数据?', '温馨提示', {
|
||||||
useDownload(exportDictType, '字典类型导出数据', proTable.value?.searchParam, false),
|
type: 'warning',
|
||||||
)
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消'
|
||||||
|
}).then(() => useDownload(exportDictType, '字典类型导出数据', proTable.value?.searchParam, false))
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -13,84 +13,61 @@
|
|||||||
<el-text style="margin-left: 82%">{{ 'v' + versionNumber }}</el-text>
|
<el-text style="margin-left: 82%">{{ 'v' + versionNumber }}</el-text>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-descriptions
|
<el-descriptions class="mode-descriptions" title="模块激活状态" size="small"></el-descriptions>
|
||||||
class="mode-descriptions"
|
<el-form label-position="left" :label-width="100">
|
||||||
v-if="!hadActivationCode"
|
<el-form-item class="mode-item" label="模拟式模块">
|
||||||
title="模块激活状态"
|
<el-tag
|
||||||
size="small"
|
v-if="activateInfo.simulate.permanently !== 1"
|
||||||
></el-descriptions>
|
class="activated-state"
|
||||||
<el-form
|
disable-transitions
|
||||||
ref="applicationFormRef"
|
type="danger"
|
||||||
v-if="!hadActivationCode"
|
>
|
||||||
:model="applicationForm"
|
未激活
|
||||||
label-position="left"
|
</el-tag>
|
||||||
:label-width="100"
|
<el-tag
|
||||||
>
|
v-if="activateInfo.simulate.permanently === 1"
|
||||||
<el-form-item
|
class="activated-state"
|
||||||
class="mode-item"
|
disable-transitions
|
||||||
v-if="activateInfo.simulate.apply !== 1 || activateInfo.simulate.permanently !== 1"
|
type="success"
|
||||||
label="模拟式模块"
|
>
|
||||||
prop="simulate.apply"
|
已激活
|
||||||
>
|
</el-tag>
|
||||||
<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>
|
||||||
<el-form-item
|
<el-form-item class="mode-item" label="数字式模块">
|
||||||
class="mode-item"
|
<el-tag
|
||||||
v-if="activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1"
|
v-if="activateInfo.digital.permanently !== 1"
|
||||||
label="模拟式模块"
|
class="activated-state"
|
||||||
>
|
disable-transitions
|
||||||
<el-tag class="activated-tag" disable-transitions type="success">已激活</el-tag>
|
type="danger"
|
||||||
|
>
|
||||||
|
未激活
|
||||||
|
</el-tag>
|
||||||
|
<el-tag
|
||||||
|
v-if="activateInfo.digital.permanently === 1"
|
||||||
|
class="activated-state"
|
||||||
|
disable-transitions
|
||||||
|
type="success"
|
||||||
|
>
|
||||||
|
已激活
|
||||||
|
</el-tag>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item class="mode-item" label="比对式模块">
|
||||||
class="mode-item"
|
<el-tag
|
||||||
v-if="activateInfo.digital.apply !== 1 || activateInfo.digital.permanently !== 1"
|
v-if="activateInfo.contrast.permanently !== 1"
|
||||||
label="数字式模块"
|
class="activated-state"
|
||||||
prop="digital.apply"
|
disable-transitions
|
||||||
>
|
type="danger"
|
||||||
<el-tag disable-transitions type="danger">未激活</el-tag>
|
>
|
||||||
<el-checkbox
|
未激活
|
||||||
:false-value="0"
|
</el-tag>
|
||||||
:true-value="1"
|
<el-tag
|
||||||
class="apply-checkbox"
|
v-if="activateInfo.contrast.permanently === 1"
|
||||||
v-model="applicationForm.digital.apply"
|
class="activated-state"
|
||||||
label="激活"
|
disable-transitions
|
||||||
/>
|
type="success"
|
||||||
</el-form-item>
|
>
|
||||||
<el-form-item
|
已激活
|
||||||
class="mode-item"
|
</el-tag>
|
||||||
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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-row v-if="applicationCode">
|
<el-row v-if="applicationCode">
|
||||||
@@ -137,25 +114,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { version } from '../../../../package.json'
|
import { version } from '../../../../package.json'
|
||||||
import type { Activate } from '@/api/activate/interface'
|
|
||||||
import { generateApplicationCode, verifyActivationCode } from '@/api/activate'
|
import { generateApplicationCode, verifyActivationCode } from '@/api/activate'
|
||||||
import { useAuthStore } from '@/stores/modules/auth'
|
import { useAuthStore } from '@/stores/modules/auth'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const activateInfo = authStore.activateInfo
|
const activateInfo = authStore.activateInfo
|
||||||
const versionNumber = ref(version)
|
const versionNumber = ref(version)
|
||||||
const applicationForm = reactive<Activate.ApplicationCodePlaintext>({
|
|
||||||
simulate: { apply: 0 },
|
|
||||||
digital: { apply: 0 },
|
|
||||||
contrast: { apply: 0 }
|
|
||||||
})
|
|
||||||
const activatedAll = computed(() => {
|
const activatedAll = computed(() => {
|
||||||
return (
|
return (
|
||||||
activateInfo.simulate.apply === 1 &&
|
|
||||||
activateInfo.simulate.permanently === 1 &&
|
activateInfo.simulate.permanently === 1 &&
|
||||||
activateInfo.digital.apply === 1 &&
|
|
||||||
activateInfo.digital.permanently === 1 &&
|
activateInfo.digital.permanently === 1 &&
|
||||||
activateInfo.contrast.apply === 1 &&
|
|
||||||
activateInfo.contrast.permanently === 1
|
activateInfo.contrast.permanently === 1
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -166,25 +134,7 @@ const activationCode = ref('')
|
|||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
// 获取申请码
|
// 获取申请码
|
||||||
const getApplicationCode = async () => {
|
const getApplicationCode = async () => {
|
||||||
if (
|
const res = await generateApplicationCode()
|
||||||
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') {
|
if (res.code == 'A0000') {
|
||||||
applicationCode.value = res.data as string
|
applicationCode.value = res.data as string
|
||||||
}
|
}
|
||||||
@@ -202,9 +152,6 @@ const openDialog = () => {
|
|||||||
hadActivationCode.value = false
|
hadActivationCode.value = false
|
||||||
activationCode.value = ''
|
activationCode.value = ''
|
||||||
applicationCode.value = ''
|
applicationCode.value = ''
|
||||||
applicationForm.simulate.apply = 0
|
|
||||||
applicationForm.digital.apply = 0
|
|
||||||
applicationForm.contrast.apply = 0
|
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
const beforeClose = (done: Function) => {
|
const beforeClose = (done: Function) => {
|
||||||
@@ -228,15 +175,12 @@ const submitActivation = async () => {
|
|||||||
defineExpose({ openDialog })
|
defineExpose({ openDialog })
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.apply-checkbox {
|
.activated-state {
|
||||||
margin-left: 62%;
|
|
||||||
}
|
|
||||||
.activated-tag {
|
|
||||||
margin-left: 80%;
|
margin-left: 80%;
|
||||||
}
|
}
|
||||||
.code-display,
|
.code-display,
|
||||||
.code-input {
|
.code-input {
|
||||||
font-family: consolas;
|
font-family: consolas, sans-serif;
|
||||||
}
|
}
|
||||||
:deep(.el-tag) {
|
:deep(.el-tag) {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|||||||
@@ -37,15 +37,13 @@
|
|||||||
"electron-builder": "^25.1.8"
|
"electron-builder": "^25.1.8"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
||||||
"autofit.js": "^3.2.8",
|
"autofit.js": "^3.2.8",
|
||||||
"dayjs": "^1.10.7",
|
"dayjs": "^1.10.7",
|
||||||
"ee-core": "2.10.0",
|
"ee-core": "4.1.5",
|
||||||
"electron-updater": "^5.3.0",
|
"electron-updater": "^5.3.0",
|
||||||
"event-source-polyfill": "^1.0.31",
|
"event-source-polyfill": "^1.0.31",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mqtt": "^5.10.1",
|
"mqtt": "^5.10.1",
|
||||||
"sass": "^1.80.4"
|
"sass": "^1.80.4"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user