/** @jsx h */
// scada-2d 组态最小工程:泵→罐→连线 + 测点长表驱动(液位/状态色)。
// 数据用 mock 连接实时演示;改接真实源只需换 connectorType 与 tables。
import { defineProject, h } from '../scripts/vptsx/runtime'
export default defineProject({
name: "组态:泵站液位监控",
connections: [
{
"uid": "conn_pts",
"name": "测点长表",
"type": "mock",
"connectorType": "mock",
"config": {
"refreshInterval": 2000,
"mock": {
"mode": "walk",
"seed": 42
}
},
"tables": [
{
"uid": "tbl_pts",
"name": "points",
"eventName": "data",
"eventParams": "",
"fields": [
{ "uid": "f_key", "sourceField": "key", "alias": "键", "type": "string" },
{ "uid": "f_val", "sourceField": "value", "alias": "值", "type": "number" }
]
}
]
}
],
connectionData: {
"conn_pts": [
{
"tableId": "tbl_pts",
"tableName": "points",
"fields": [
{ "uid": "f_key", "sourceField": "key", "alias": "键", "type": "string" },
{ "uid": "f_val", "sourceField": "value", "alias": "值", "type": "number" }
],
"rows": [
{ "f_key": "PUMP1_STATE", "f_val": 1 },
{ "f_key": "TANK1_LEVEL", "f_val": 62 }
]
}
]
},
screen: (
<screen
uid={"screen_main"}
name={"泵站监控"}
fullscreen-mode={"fill-uniform"} fill-auto-expand={true}
size={[1920,1080]}
background-color={"#0c0d0e"}
stateOverrides={{}}
>
<scada-2d
uid={"w_scada"}
position={[0,0]}
size={[1920,1080]}
scene-width={1920} scene-height={1080}
theme={"tech-blue"}
appearance-3d={true}
grid={true} snap={true} grid-size={24}
view-zoom={true} view-pan={true}
scada-initialized={true}
point-key-field={[["conn_pts","tbl_pts","f_key"]]}
point-value-field={[["conn_pts","tbl_pts","f_val"]]}
stateOverrides={{}}
pieces={[
{
"uid": "n_pump", "type": "scada-node",
"options": {
"shape": "pump", "geo-x": 400, "geo-y": 560, "geo-w": 96, "geo-h": 96,
"node-text": "1#提升泵",
"data-enabled": true, "data-key": "PUMP1_STATE",
"state-by-value": true,
"state-rules": "1|run=#22c55e\n0|stop=#94a3b8\nfault=#ef4444",
"anim": "spin"
}
},
{
"uid": "n_tank", "type": "scada-node",
"options": {
"shape": "tank", "geo-x": 900, "geo-y": 380, "geo-w": 160, "geo-h": 220,
"node-text": "清水池",
"data-enabled": true, "data-key": "TANK1_LEVEL",
"value-min": 0, "value-max": 100, "value-unit": "%",
"show-value-text": true, "value-decimals": 0,
"liquid-wave": true
}
},
{
"uid": "l_1", "type": "scada-link",
"options": {
"from-node": "n_pump", "from-port": "e",
"to-node": "n_tank", "to-port": "w",
"router": "polyline", "flow": true, "flow-style": "flow"
}
}
]}
/>
</screen>
),
})