Merge branch 'master' of http://192.168.1.22:3000/ClientApps/pqs-9100_client
This commit is contained in:
@@ -4,7 +4,7 @@ const path = require('path');
|
||||
const { logger } = require('ee-core/log');
|
||||
const { getConfig } = require('ee-core/config');
|
||||
const { getMainWindow } = require('ee-core/electron');
|
||||
const { getBaseDir } = require('ee-core/ps');
|
||||
const ps = require('ee-core/ps');
|
||||
const { app } = require('electron');
|
||||
|
||||
// 动态获取 scripts 目录路径
|
||||
@@ -74,7 +74,10 @@ class Lifecycle {
|
||||
async ready() {
|
||||
logger.info('[lifecycle] ready');
|
||||
// 延迟加载 scripts
|
||||
loadScripts();
|
||||
if (ps.isProd()) {
|
||||
loadScripts();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -493,44 +496,55 @@ class Lifecycle {
|
||||
*/
|
||||
async windowReady() {
|
||||
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));
|
||||
|
||||
// 创建日志窗口
|
||||
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.startupManager = new StartupManager();
|
||||
this.startupManager.createLoadingWindow();
|
||||
|
||||
// 创建 Loading 窗口
|
||||
this.startupManager = new StartupManager();
|
||||
this.startupManager.createLoadingWindow();
|
||||
// 开始启动流程
|
||||
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 || '启动失败,请查看日志');
|
||||
|
||||
// 开始启动流程
|
||||
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();
|
||||
|
||||
// 显示错误5秒后关闭Loading窗口,但不关闭日志窗口
|
||||
setTimeout(() => {
|
||||
this.startupManager.closeLoadingWindow();
|
||||
// 即使启动失败,也显示主窗口(但用户可能需要手动修复问题)
|
||||
const win = getMainWindow();
|
||||
win.show();
|
||||
win.focus();
|
||||
|
||||
// 即使启动失败,也显示主窗口(但用户可能需要手动修复问题)
|
||||
const win = getMainWindow();
|
||||
win.show();
|
||||
win.focus();
|
||||
// 添加主窗口关闭事件监听
|
||||
win.on('close', async () => {
|
||||
logger.info('[lifecycle] Main window closing (after error), cleaning up...');
|
||||
await this.cleanup();
|
||||
});
|
||||
|
||||
// 添加主窗口关闭事件监听
|
||||
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();
|
||||
})
|
||||
}
|
||||
|
||||
this.logWindowManager.addLog('warn', '应用已启动,但部分服务可能未正常运行');
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// 主窗口初始化但不显示,等待启动流程完成后再显示
|
||||
@@ -542,7 +556,10 @@ class Lifecycle {
|
||||
*/
|
||||
async beforeClose() {
|
||||
logger.info('[lifecycle] before-close hook triggered');
|
||||
await this.cleanup();
|
||||
if (ps.isProd()) {
|
||||
await this.cleanup();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Lifecycle.toString = () => '[class Lifecycle]';
|
||||
|
||||
@@ -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}`)
|
||||
}
|
||||
|
||||
@@ -141,22 +141,22 @@ export const importSubPlan = (params: Plan.ResPlan) => {
|
||||
|
||||
// 导出计划检测结果数据
|
||||
export const exportPlanCheckData = (params: any) => {
|
||||
return http.post(
|
||||
`/adPlan/exportPlanCheckData?planId=${params.id}&devIds=${params.devIds}&report=${params.report}`
|
||||
)
|
||||
return http.post(`/adPlan/exportPlanCheckData?planId=${params.id}&devIds=${params.devIds}&report=${params.report}`)
|
||||
}
|
||||
|
||||
//根据误差体系id获取测试项
|
||||
export const getPqErrSysTestItemList = (params: {errorSysId : string}) => {
|
||||
export const getPqErrSysTestItemList = (params: { errorSysId: string }) => {
|
||||
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}`)
|
||||
}
|
||||
|
||||
// 导入并合并子检测计划检测结果数据
|
||||
export const importAndMergePlanCheckData = (params: Plan.ResPlan) => {
|
||||
return http.upload(`/adPlan/importAndMergePlanCheckData`, params)
|
||||
return http.upload(`/adPlan/importAndMergePlanCheckData`, params, {
|
||||
timeout: 60000 * 20
|
||||
})
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
action="#"
|
||||
class="upload"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:http-request="uploadZip"
|
||||
accept=".zip"
|
||||
:auto-upload="!parameter.confirmMessage"
|
||||
@@ -56,7 +57,15 @@
|
||||
|
||||
<script setup lang="ts" name="ImportZip">
|
||||
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'
|
||||
|
||||
export interface ZipParameterProps {
|
||||
@@ -170,7 +179,12 @@ const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
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({
|
||||
percentage: 0,
|
||||
status: '',
|
||||
|
||||
@@ -184,10 +184,9 @@
|
||||
v-if="progressData.status === 'success'"
|
||||
type="primary"
|
||||
title="点击打开目录"
|
||||
:href="progressData.message"
|
||||
@click="openDownloadLocation"
|
||||
>
|
||||
{{ progressData.message }}
|
||||
{{ filePath }}
|
||||
</el-link>
|
||||
</el-row>
|
||||
<el-progress
|
||||
@@ -692,6 +691,7 @@ const exportPlan = async () => {
|
||||
}
|
||||
|
||||
const exportPlanCheckResultData = async (selectedListIds: string[]) => {
|
||||
filePath.value = ''
|
||||
const params = {
|
||||
id: planFormContent.value.id,
|
||||
report: downloadReport.value,
|
||||
@@ -773,10 +773,6 @@ const openDownloadLocation = () => {
|
||||
if (filePath.value) {
|
||||
// 打开指定文件所在的目录,并选中该文件
|
||||
Renderer.shell.showItemInFolder(filePath.value)
|
||||
} else {
|
||||
// 使用默认下载路径
|
||||
const downloadPath = Renderer.app.getPath('downloads')
|
||||
Renderer.shell.openPath(downloadPath)
|
||||
}
|
||||
} else {
|
||||
ElMessage.warning('当前运行环境不支持,请复制路径自行打开')
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"dependencies": {
|
||||
"autofit.js": "^3.2.8",
|
||||
"dayjs": "^1.10.7",
|
||||
"ee-core": "2.10.0",
|
||||
"ee-core": "4.1.5",
|
||||
"electron-updater": "^5.3.0",
|
||||
"event-source-polyfill": "^1.0.31",
|
||||
"lodash": "^4.17.21",
|
||||
|
||||
Reference in New Issue
Block a user