fix del api

This commit is contained in:
2026-08-03 15:28:37 +08:00
parent bae71f3253
commit 5edb0b2d69
2 changed files with 40 additions and 7 deletions
+19 -7
View File
@@ -367,7 +367,15 @@ function closeActionDialog(value) {
resolve(value);
}
function requestModelName({ title, message, value = "", confirmLabel = "确认", danger = false, expectedValue = null }) {
function requestModelName({
title,
message,
value = "",
confirmLabel = "确认",
danger = false,
expectedValue = null,
expectedLabel = "输入内容"
}) {
if (actionDialogState) closeActionDialog(null);
elements.actionDialogTitle.textContent = title;
elements.actionDialogMessage.textContent = message;
@@ -383,7 +391,7 @@ function requestModelName({ title, message, value = "", confirmLabel = "确认",
elements.actionDialogInput.select();
});
return new Promise((resolve) => {
actionDialogState = { resolve, previousFocus, expectedValue };
actionDialogState = { resolve, previousFocus, expectedValue, expectedLabel };
});
}
@@ -391,14 +399,15 @@ elements.actionDialogForm.addEventListener("submit", (event) => {
event.preventDefault();
const value = elements.actionDialogInput.value.trim();
const expectedValue = actionDialogState?.expectedValue;
const expectedLabel = actionDialogState?.expectedLabel || "输入内容";
if (!value) {
elements.actionDialogError.textContent = "文件名不能为空";
elements.actionDialogError.textContent = `${expectedLabel}不能为空`;
elements.actionDialogError.hidden = false;
elements.actionDialogInput.focus();
return;
}
if (expectedValue !== null && value !== expectedValue) {
elements.actionDialogError.textContent = "文件名不匹配,请输入完整文件名";
elements.actionDialogError.textContent = `${expectedLabel}不匹配,请按提示完整输入`;
elements.actionDialogError.hidden = false;
elements.actionDialogInput.focus();
return;
@@ -698,7 +707,8 @@ document.querySelector("#delete-line").addEventListener("click", async () => {
value: "",
confirmLabel: "删除产线",
danger: true,
expectedValue: line.deviceId
expectedValue: line.deviceId,
expectedLabel: "deviceId"
});
if (confirmation === null) return;
const result = await runBusy("正在删除产线", () => window.reinloop.deleteProductionLine({
@@ -723,7 +733,8 @@ document.querySelector("#delete-company").addEventListener("click", async () =>
value: "",
confirmLabel: "删除公司",
danger: true,
expectedValue: company.code
expectedValue: company.code,
expectedLabel: "公司编码"
});
if (confirmation === null) return;
const result = await runBusy("正在删除公司", () => window.reinloop.deleteCompany({
@@ -790,7 +801,8 @@ elements.licenseList.addEventListener("click", async (event) => {
value: "",
confirmLabel: "永久删除",
danger: true,
expectedValue: deleteId
expectedValue: deleteId,
expectedLabel: "许可证ID"
});
if (confirmation === null) return;
button.disabled = true;
+21
View File
@@ -204,3 +204,24 @@
- `ReinLoop/core/device_heartbeat.py`
- `ReinLoop/core/data_collector.py`
- `ReinLoop/core/identification.py`
### ReinLoop:许可证文件改为通配检索
- 许可证启动校验与信息读取不再固定使用 `license.lic`,改为在程序目录检索匹配 `*license.lic` 的文件。
- 当存在多个匹配文件时,按“最近修改时间优先”选择目标文件,降低人工改名或多版本并存时的启动失败概率。
- 同步更新提示文案:明确要求许可证文件名需匹配 `*license.lic`
- 新增协议测试覆盖:默认通配匹配与多文件择优选择。
涉及文件:
- `ReinLoop/license_utils.py`
- `ReinLoop/tests/test_license_protocol.py`
### ControlPanel:删除确认提示文案修正
- 删除产线、删除公司、删除许可证的二次确认弹窗改为按业务字段显示错误提示,不再统一显示“文件名不匹配”。
- 现分别提示 `deviceId`、公司编码、许可证 ID 的必填和匹配错误,减少误解与误操作。
涉及文件:
- `ControlPanel/electron-ui/renderer.js`