K8: 管理端前端配套 门禁设备操作按钮(开门/授权)

This commit is contained in:
2026-05-19 23:17:05 +08:00
parent 94313a3492
commit 6125f1d711

View File

@@ -134,6 +134,21 @@
} }
const openControl = (d) => { curDev.value = d; controlVisible.value = true } const openControl = (d) => { curDev.value = d; controlVisible.value = true }
//── KMS 钥匙柜操作 ──
const kmsOpen = async (row) => {
try {
await fetch(`${GW}/api/gateway/control/${row.adapterCode}`, {
method: 'POST', headers: {'Content-Type':'application/json'},
body: JSON.stringify({ deviceId: row.sourceId, command: 'open', parameters: {} })
})
proxy.$message.success('开门指令已发送')
} catch { proxy.$message.error('开门失败') }
}
const kmsAuthorize = (row) => {
// TODO Phase 2: 打开授权对话框
console.log('authorize', row)
}
//── 框架钩子 ── //── 框架钩子 ──
const onInit = async ($vm) => { gridRef = $vm; } const onInit = async ($vm) => { gridRef = $vm; }
const onInited = async () => { const onInited = async () => {
@@ -168,6 +183,22 @@
</div> </div>
); );
} }
if (row.DeviceGroup === '门禁设备') {
return (
<div>
<el-button size="small" type="danger" plain
style="height:26px;padding:0 8px !important;"
onClick={($e) => kmsOpen(row)}>
开门
</el-button>
<el-button size="small" plain
style="height:26px;padding:0 8px !important;margin-left:4px"
onClick={($e) => kmsAuthorize(row)}>
授权
</el-button>
</div>
);
}
return null; return null;
} }
}); });