fix del api
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user