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
|
||||
.get(&command_point.point_id)
|
||||
.and_then(|item| item.value_type.clone());
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
</label>
|
||||
<label>
|
||||
类型
|
||||
<input id="equipmentKind" placeholder="coal_feeder / distributor" />
|
||||
<select id="equipmentKind"></select>
|
||||
</label>
|
||||
<label>
|
||||
说明
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { apiFetch } from "./api.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 { state } from "./state.js";
|
||||
|
||||
|
|
@ -81,6 +81,7 @@ export function resetEquipmentForm() {
|
|||
dom.equipmentForm.reset();
|
||||
dom.equipmentId.value = "";
|
||||
renderEquipmentUnitOptions("");
|
||||
dom.equipmentKind.innerHTML = renderEquipmentKindOptions("");
|
||||
}
|
||||
|
||||
function openEquipmentModal() {
|
||||
|
|
@ -101,7 +102,7 @@ function openEditEquipmentModal(equipment) {
|
|||
dom.equipmentUnitId.value = equipment.unit_id || "";
|
||||
dom.equipmentCode.value = equipment.code || "";
|
||||
dom.equipmentName.value = equipment.name || "";
|
||||
dom.equipmentKind.value = equipment.kind || "";
|
||||
dom.equipmentKind.innerHTML = renderEquipmentKindOptions(equipment.kind || "");
|
||||
dom.equipmentDescription.value = equipment.description || "";
|
||||
openEquipmentModal();
|
||||
}
|
||||
|
|
@ -235,6 +236,7 @@ export async function loadEquipments() {
|
|||
|
||||
renderEquipmentUnitOptions(dom.equipmentUnitId?.value || "");
|
||||
renderBatchUnitOptions(dom.equipmentBatchUnitId?.value || "");
|
||||
dom.equipmentKind.innerHTML = renderEquipmentKindOptions(dom.equipmentKind?.value || "");
|
||||
renderBindingEquipmentOptions();
|
||||
renderBatchBindingDefaults();
|
||||
if (state.selectedEquipmentId && !state.equipmentMap.has(state.selectedEquipmentId)) {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
export const SIGNAL_ROLE_OPTIONS = [
|
||||
{ value: "", label: "Unset" },
|
||||
{ value: "remote_status", label: "Remote Status" },
|
||||
{ value: "run_status", label: "Run Status" },
|
||||
{ value: "fault_status", label: "Fault Status" },
|
||||
{ value: "ready_status", label: "Ready Status" },
|
||||
{ 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: "rem", label: "REM Remote Enable" },
|
||||
{ value: "run", label: "RUN Running" },
|
||||
{ value: "flt", label: "FLT Fault" },
|
||||
{ value: "ii", label: "II Current" },
|
||||
{ value: "start_cmd", label: "Start 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 = "") {
|
||||
|
|
@ -22,3 +20,10 @@ export function renderRoleOptions(selected = "") {
|
|||
return `<option value="${item.value}" ${isSelected}>${item.label}</option>`;
|
||||
}).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