refactor(control): align point roles and equipment kind
This commit is contained in:
parent
2d80266422
commit
a38204511a
|
|
@ -115,18 +115,6 @@ pub async fn validate_manual_control(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(estop_point) = role_map.get("estop").copied() {
|
|
||||||
let estop_monitor = monitor_guard
|
|
||||||
.get(&estop_point.point_id)
|
|
||||||
.ok_or_else(|| missing_monitor_err("ESTOP", equipment_id))?;
|
|
||||||
if monitor_value_as_bool(estop_monitor) {
|
|
||||||
return Err(ApiErr::Forbidden(
|
|
||||||
"Emergency stop is active, command denied".to_string(),
|
|
||||||
Some(json!({ "equipment_id": equipment_id })),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let command_value_type = monitor_guard
|
let command_value_type = monitor_guard
|
||||||
.get(&command_point.point_id)
|
.get(&command_point.point_id)
|
||||||
.and_then(|item| item.value_type.clone());
|
.and_then(|item| item.value_type.clone());
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
类型
|
类型
|
||||||
<input id="equipmentKind" placeholder="coal_feeder / distributor" />
|
<select id="equipmentKind"></select>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
说明
|
说明
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { apiFetch } from "./api.js";
|
import { apiFetch } from "./api.js";
|
||||||
import { dom } from "./dom.js";
|
import { dom } from "./dom.js";
|
||||||
import { renderRoleOptions } from "./roles.js";
|
import { renderEquipmentKindOptions, renderRoleOptions } from "./roles.js";
|
||||||
import { clearSelectedPoints, loadPoints, updatePointFilterSummary } from "./points.js";
|
import { clearSelectedPoints, loadPoints, updatePointFilterSummary } from "./points.js";
|
||||||
import { state } from "./state.js";
|
import { state } from "./state.js";
|
||||||
|
|
||||||
|
|
@ -81,6 +81,7 @@ export function resetEquipmentForm() {
|
||||||
dom.equipmentForm.reset();
|
dom.equipmentForm.reset();
|
||||||
dom.equipmentId.value = "";
|
dom.equipmentId.value = "";
|
||||||
renderEquipmentUnitOptions("");
|
renderEquipmentUnitOptions("");
|
||||||
|
dom.equipmentKind.innerHTML = renderEquipmentKindOptions("");
|
||||||
}
|
}
|
||||||
|
|
||||||
function openEquipmentModal() {
|
function openEquipmentModal() {
|
||||||
|
|
@ -101,7 +102,7 @@ function openEditEquipmentModal(equipment) {
|
||||||
dom.equipmentUnitId.value = equipment.unit_id || "";
|
dom.equipmentUnitId.value = equipment.unit_id || "";
|
||||||
dom.equipmentCode.value = equipment.code || "";
|
dom.equipmentCode.value = equipment.code || "";
|
||||||
dom.equipmentName.value = equipment.name || "";
|
dom.equipmentName.value = equipment.name || "";
|
||||||
dom.equipmentKind.value = equipment.kind || "";
|
dom.equipmentKind.innerHTML = renderEquipmentKindOptions(equipment.kind || "");
|
||||||
dom.equipmentDescription.value = equipment.description || "";
|
dom.equipmentDescription.value = equipment.description || "";
|
||||||
openEquipmentModal();
|
openEquipmentModal();
|
||||||
}
|
}
|
||||||
|
|
@ -235,6 +236,7 @@ export async function loadEquipments() {
|
||||||
|
|
||||||
renderEquipmentUnitOptions(dom.equipmentUnitId?.value || "");
|
renderEquipmentUnitOptions(dom.equipmentUnitId?.value || "");
|
||||||
renderBatchUnitOptions(dom.equipmentBatchUnitId?.value || "");
|
renderBatchUnitOptions(dom.equipmentBatchUnitId?.value || "");
|
||||||
|
dom.equipmentKind.innerHTML = renderEquipmentKindOptions(dom.equipmentKind?.value || "");
|
||||||
renderBindingEquipmentOptions();
|
renderBindingEquipmentOptions();
|
||||||
renderBatchBindingDefaults();
|
renderBatchBindingDefaults();
|
||||||
if (state.selectedEquipmentId && !state.equipmentMap.has(state.selectedEquipmentId)) {
|
if (state.selectedEquipmentId && !state.equipmentMap.has(state.selectedEquipmentId)) {
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,17 @@
|
||||||
export const SIGNAL_ROLE_OPTIONS = [
|
export const SIGNAL_ROLE_OPTIONS = [
|
||||||
{ value: "", label: "Unset" },
|
{ value: "", label: "Unset" },
|
||||||
{ value: "remote_status", label: "Remote Status" },
|
{ value: "rem", label: "REM Remote Enable" },
|
||||||
{ value: "run_status", label: "Run Status" },
|
{ value: "run", label: "RUN Running" },
|
||||||
{ value: "fault_status", label: "Fault Status" },
|
{ value: "flt", label: "FLT Fault" },
|
||||||
{ value: "ready_status", label: "Ready Status" },
|
{ value: "ii", label: "II Current" },
|
||||||
{ value: "alarm_status", label: "Alarm Status" },
|
|
||||||
{ value: "interlock_status", label: "Interlock Status" },
|
|
||||||
{ value: "auto_enable", label: "Auto Enable" },
|
|
||||||
{ value: "mode_auto", label: "Auto Mode" },
|
|
||||||
{ value: "mode_manual", label: "Manual Mode" },
|
|
||||||
{ value: "start_cmd", label: "Start Command" },
|
{ value: "start_cmd", label: "Start Command" },
|
||||||
{ value: "stop_cmd", label: "Stop Command" },
|
{ value: "stop_cmd", label: "Stop Command" },
|
||||||
{ value: "reset_cmd", label: "Reset Command" },
|
];
|
||||||
{ value: "runtime_value", label: "Runtime Value" },
|
|
||||||
{ value: "counter_value", label: "Counter Value" },
|
export const EQUIPMENT_KIND_OPTIONS = [
|
||||||
|
{ value: "", label: "Unset" },
|
||||||
|
{ value: "coal_feeder", label: "Coal Feeder" },
|
||||||
|
{ value: "distributor", label: "Distributor" },
|
||||||
];
|
];
|
||||||
|
|
||||||
export function renderRoleOptions(selected = "") {
|
export function renderRoleOptions(selected = "") {
|
||||||
|
|
@ -22,3 +20,10 @@ export function renderRoleOptions(selected = "") {
|
||||||
return `<option value="${item.value}" ${isSelected}>${item.label}</option>`;
|
return `<option value="${item.value}" ${isSelected}>${item.label}</option>`;
|
||||||
}).join("");
|
}).join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function renderEquipmentKindOptions(selected = "") {
|
||||||
|
return EQUIPMENT_KIND_OPTIONS.map((item) => {
|
||||||
|
const isSelected = item.value === selected ? "selected" : "";
|
||||||
|
return `<option value="${item.value}" ${isSelected}>${item.label}</option>`;
|
||||||
|
}).join("");
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue