问题修改

master
zhangdi 2 weeks ago
parent 3e10324225
commit a7a0569ee1
  1. 10
      config.json
  2. 2
      src/background.js
  3. 65
      src/views/AutoMode.vue
  4. 1
      src/views/ModeSelect.vue
  5. 3
      src/views/config/configFile.vue

@ -7,17 +7,19 @@
"path": "/mqtt", "path": "/mqtt",
"reconnect_time": "6", "reconnect_time": "6",
"status_reporting_time": "6", "status_reporting_time": "6",
"topic": "6" "topic": "6",
"updateFileName": "2"
}, },
"device": { "device": {
"username": "12111", "username": "NkXDO8uDmvnSMV8BGT7Y",
"code": "Z139009/202402", "code": "fileTest1",
"codeType": "dd", "codeType": "dd",
"reconnect_time": "3", "reconnect_time": "3",
"address": "http://10.1.19.52:9999", "address": "http://10.1.19.52:9999",
"filePathDisc": "D", "filePathDisc": "D",
"file_path": "ai", "file_path": "ai",
"no_report_path": "未上传记录", "no_report_path": "未上传记录",
"searchMode": "manual" "searchMode": "auto",
"updateFileName": "2"
} }
} }

@ -40,7 +40,7 @@ async function createWindow() {
createProtocol('app') createProtocol('app')
win.loadURL(`${winURL}` + '/#/') win.loadURL(`${winURL}` + '/#/')
win.webContents.openDevTools({ mode: 'right' }); // win.webContents.openDevTools({ mode: 'right' });
win.once('ready-to-show', () => { win.once('ready-to-show', () => {
win.setTitle('Utils-Hub'); // 设置窗口标题 win.setTitle('Utils-Hub'); // 设置窗口标题
win.show(); win.show();

@ -259,9 +259,9 @@ export default {
}; };
console.log("🔥 准备插入新记录:", newRecord); console.log("🔥 准备插入新记录:", newRecord);
this.allSavedFileList.unshift(newRecord); // this.allSavedFileList.unshift(newRecord);
this.total = this.allSavedFileList.length; // this.total = this.allSavedFileList.length;
this.updateCurrentPageData(); // this.updateCurrentPageData();
console.log("🔥 已插入列表,当前总数:", this.total); console.log("🔥 已插入列表,当前总数:", this.total);
// //
@ -333,24 +333,29 @@ export default {
record.analysisDate = JSON.stringify(result.data); record.analysisDate = JSON.stringify(result.data);
// //
await window.api.saveFileInfo([{ await window.api.saveFileInfo([
deviceId: device.code, {
orderNumber: file.fileName.replace(/\.[^/.]+$/, ""), deviceId: device.code,
deviceModel: device.codeType, orderNumber: file.fileName.replace(/\.[^/.]+$/, ""),
fileName: file.fileName, deviceModel: device.codeType,
analysisDate: JSON.stringify(result.data), fileName: file.fileName,
type: "auto", analysisDate: JSON.stringify(result.data),
date: this.getCurrentDateTime(), type: "auto",
uploadType: "自动上传", date: this.getCurrentDateTime(),
}]); uploadType: "自动上传",
},
]);
console.log("自动上传成功"); console.log("自动上传成功");
this.lastUploadStatus = { title: "上传成功", type: "success" }; this.lastUploadStatus = { title: "上传成功", type: "success" };
this.getSavedFileInfo();
} else { } else {
// 🔥
record.uploading = false; record.uploading = false;
record.analysisDate = "上传失败: " + result.msg;
console.error("上传失败:", result.msg); record.analysisDate = "上传失败: " + (result.msg || "上传异常");
this.lastUploadStatus = { title: result.msg, type: "error" }; this.lastUploadStatus = {
title: result.msg || "上传异常",
type: "error",
};
} }
} catch (err) { } catch (err) {
// 🔥 // 🔥
@ -373,10 +378,32 @@ export default {
this.tableLoading = true; this.tableLoading = true;
const res = await window.api.getSavedFileInfo(); const res = await window.api.getSavedFileInfo();
if (res.success) { if (res.success) {
// // 1.
this.allSavedFileList = res.data.filter( const autoUploadRecords = res.data.filter(
(item) => item.uploadType === "自动上传" (item) => item.uploadType === "自动上传"
); );
// 2. orderNumber fileName
// res.data
const uniqueMap = new Map();
autoUploadRecords.forEach(item => {
// _
// orderNumber key : (item.orderNumber || 'unknown') + '_' + item.fileName
const key = `${item.orderNumber}_${item.fileName}`;
// Map key
// ->
if (!uniqueMap.has(key)) {
uniqueMap.set(key, item);
}
});
// 3. Map
// Map.values()
this.allSavedFileList = Array.from(uniqueMap.values());
// 4.
this.total = this.allSavedFileList.length; this.total = this.allSavedFileList.length;
this.updateCurrentPageData(); this.updateCurrentPageData();
console.log(`成功读取${this.total}条自动上传记录`); console.log(`成功读取${this.total}条自动上传记录`);

@ -34,6 +34,7 @@ export default {
// 🔥 // 🔥
if (this.configData && this.configData.device && this.configData.device.searchMode === "auto") { if (this.configData && this.configData.device && this.configData.device.searchMode === "auto") {
console.log("配置检测:自动检索模式,直接启动"); console.log("配置检测:自动检索模式,直接启动");
window.api.stopWatchFolder();
await this.selectMode('auto'); await this.selectMode('auto');
return; // return; //
} }

@ -130,6 +130,8 @@ export default {
file_path: "检索目录", file_path: "检索目录",
no_report_path: "未上报目录", no_report_path: "未上报目录",
searchMode: "auto", searchMode: "auto",
updateFileName:'2'
}, },
mqttInfo: { mqttInfo: {
address: "tcp://127.0.0.1:1883/", address: "tcp://127.0.0.1:1883/",
@ -140,6 +142,7 @@ export default {
reconnect_time: "10", reconnect_time: "10",
status_reporting_time: "10", status_reporting_time: "10",
topic: 'v1/telemetry/device/v1"', topic: 'v1/telemetry/device/v1"',
updateFileName:'2'
}, },
configData: {}, configData: {},
}; };

Loading…
Cancel
Save