问题修改

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

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

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

@ -259,9 +259,9 @@ export default {
};
console.log("🔥 准备插入新记录:", newRecord);
this.allSavedFileList.unshift(newRecord);
this.total = this.allSavedFileList.length;
this.updateCurrentPageData();
// this.allSavedFileList.unshift(newRecord);
// this.total = this.allSavedFileList.length;
// this.updateCurrentPageData();
console.log("🔥 已插入列表,当前总数:", this.total);
//
@ -333,7 +333,8 @@ export default {
record.analysisDate = JSON.stringify(result.data);
//
await window.api.saveFileInfo([{
await window.api.saveFileInfo([
{
deviceId: device.code,
orderNumber: file.fileName.replace(/\.[^/.]+$/, ""),
deviceModel: device.codeType,
@ -342,15 +343,19 @@ export default {
type: "auto",
date: this.getCurrentDateTime(),
uploadType: "自动上传",
}]);
},
]);
console.log("自动上传成功");
this.lastUploadStatus = { title: "上传成功", type: "success" };
this.getSavedFileInfo();
} else {
// 🔥
record.uploading = false;
record.analysisDate = "上传失败: " + result.msg;
console.error("上传失败:", result.msg);
this.lastUploadStatus = { title: result.msg, type: "error" };
record.analysisDate = "上传失败: " + (result.msg || "上传异常");
this.lastUploadStatus = {
title: result.msg || "上传异常",
type: "error",
};
}
} catch (err) {
// 🔥
@ -373,10 +378,32 @@ export default {
this.tableLoading = true;
const res = await window.api.getSavedFileInfo();
if (res.success) {
//
this.allSavedFileList = res.data.filter(
// 1.
const autoUploadRecords = res.data.filter(
(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.updateCurrentPageData();
console.log(`成功读取${this.total}条自动上传记录`);

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

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

Loading…
Cancel
Save