import { reactive, defineAsyncComponent } from 'vue'; import { useGlobSetting } from '/@/hooks/setting'; export const warningConfig = reactive({ header: ['设备名称', '预警信息', '时间'], data: [ ['火焰6', '严重报警', '03-05'], ['测点43', '一般预警', '03-05'], ['CO23', '一般预警', '03-05'], ['测点6', '超高预警', '03-05'], ['测点65', '超高预警', '03-05'], ['温度4', '一般预警', '03-05'], ['测点61', '一般预警', '03-05'], ['测点87', '一般信息', '03-05'], ], index: false, // columnWidth: [150, 80, 150, 150], headerBGC: '#3d9dd45d', oddRowBGC: '#009acd10', evenRowBGC: '#009acd05', align: ['center', 'center', 'center'], }); // export const pumpMonitorData = [ // { // title: '运行状态', // code: 'CentrifugalPump_PU_CBStatus', // type: 'sign', // }, // { // title: '启动准备', // code: 'CentrifugalPump_PU_Ready', // type: 'sign', // }, // { // title: '电压(V)', // code: 'CentrifugalPump_PU_SysVoltage', // type: '', // }, // { // title: 'A相电流(A)', // code: 'CentrifugalPump_PU_Ia', // type: '', // }, // { // title: 'B相电流(A)', // code: 'CentrifugalPump_PU_Ib', // type: '', // }, // { // title: 'C相电流(A)', // code: 'CentrifugalPump_PU_Ic', // type: '', // }, // ]; export const pumpMonitorData = [ { title: '断路器状态', code: 'Starter_CBStatus', type: 'sign', }, { title: '合闸失败', code: 'Starter_CloseFail', type: 'warning', }, { title: 'A相电流(A)', code: 'Starter_Ia', type: '', }, { title: 'B相电流(A)', code: 'Starter_Ib', type: '', }, { title: 'C相电流(A)', code: 'Starter_Ic', type: '', }, { title: 'AB电压(V)', code: 'Starter_Uab', type: '', }, { title: '健康信号', code: 'Starter_Ready', type: 'sign', }, ]; export const waterPumpData = [ { title: '运行状态', code: 'WaterfloodPump_CBStatus', type: 'sign', }, { title: '启动准备', code: 'WaterfloodPump_Ready', type: 'sign', }, { title: '电压(V)', code: 'WaterfloodPump_SysVoltage', type: '', }, ]; export const dewateringPumpData = [ { title: '运行状态', code: 'DewateringPump_CBStatus', type: 'sign', }, { title: '启动准备', code: 'DewateringPump_Ready', type: 'sign', }, { title: '电压(V)', code: 'DewateringPump_SysVoltage', type: '', }, ]; export const valveCtrlType = [ { title: '进水阀', code: 'WaterInValve1', }, { title: '排水阀', code: 'WaterOutValve2', }, { title: '进气阀', code: 'AirInValve1', }, { title: '排气阀', code: 'AirOutValve2', }, ]; export const valveCtrl = [ { title: '开启', code: '_HMIOpen', }, { title: '关闭', code: '_HMIClose', }, { title: '停止', code: '_HMIStop', }, { title: '复位', code: '_Reset', }, ]; export const stateWarningHeader = ['设备名称', '开限位', '关限位', '开输出', '关输出']; export const stateHeader = ['设备名称', '是否健康', '开失败', '关失败', '控制方式']; export const valveWarningState = [ { title: '开限位', code: '_OpenLimit', defaultValue: '-', }, { title: '关限位', code: '_CloseLimit', defaultValue: '-', }, { title: '开输出', code: '_OnOutput', defaultValue: '-', }, { title: '关输出', code: '_OffOutput', defaultValue: '-', }, ]; export const valveState = [ { title: '是否健康', code: '_Healthy', defaultValue: '-', }, { title: '开失败', code: '_OpenFail', defaultValue: '-', }, { title: '关失败', code: '_CloseFail', defaultValue: '-', }, { title: '控制方式', code: '_CtrlMode', defaultValue: '-', }, ]; export const pumpCtrlType = [ { title: '瓦斯泵', code: 'CentrifugalPump', }, { title: '排水泵', code: 'DewateringPump', }, ]; export const publicPumpCtrlType = [ { title: '注水泵', code: 'WaterfloodPump', }, ]; export const PumpCtrlItems = [ { title: '启动', code: '_SwitchOn', }, { title: '停止', code: '_SwitchOff', }, { title: '短路测试', code: '_HMIShortTest', }, { title: '漏电测试', code: '_HMILeakageTest', }, ]; export const modelMonitor = [ { title: '泵站输入管道内工混流量(m³/min)', code: 'mixedTraffic', }, { title: '泵站内瓦斯(%CH₄)', code: 'gas2', }, { title: '泵站输入管道内标况流量(m³/min)', code: 'standardTraffic', }, { title: '泵站输入管道内瓦斯(%CH₄)', code: 'gas3', }, { title: '泵站输入管道内工混累计(m³)', code: 'totalGasDrainage', }, { title: '泵站管道输出瓦斯(%CH₄)', code: 'gas4', }, { title: '泵站输入管道内一氧化碳(ppm)', code: 'coVal', }, { title: '泵站管路出口30米处瓦斯(%CH₄)', code: 'gas1', }, { title: '泵站内温度(℃)', code: 'temp', }, { title: '泵站输入管道内温度(℃)', code: 'pipeTemp', }, ]; export const getModelMonitorTags = () => { const { sysOrgCode } = useGlobSetting(); // const sysOrgCode = 'sdmtjtcctmk'; switch (sysOrgCode) { case 'sdmtjtcctmk': // 寸草塔1 return [ { domId: 'jsf1', title: '进水阀1#', code: 'DRS13_GVL1_OpenLimit', type: 'sign', // value: '0', position: [-8.75, 0.3, 0.6], }, { domId: 'jsf2', title: '进水阀2#', code: 'DRS13_GVL2_OpenLimit', type: 'sign', // value: '0', position: [-5.26, 0.28, 0.6], }, { domId: 'csf1', title: '出水阀1#', code: 'DRS13_GVL1_OpenLimit', type: 'sign', // value: '0', position: [-9.42, 0.35, 0.3], }, { domId: 'csf2', title: '出水阀2#', code: 'DRS13_GVL2_OpenLimit', type: 'sign', // value: '0', position: [-5.74, 0.35, 0.27], }, { domId: 'jqf1', title: '进气阀1#', code: 'DRS13_GVL4_OpenLimit', type: 'sign', // value: '0', position: [-7.7, 1.31, -0.14], }, { domId: 'jqf2', title: '进气阀2#', code: 'DRS13_GVL6_OpenLimit', type: 'sign', // value: '0', position: [-4.41, 1.28, 0.03], }, { domId: 'cqf1', title: '出气阀1#', code: 'DRS13_GVL3_OpenLimit', type: 'sign', // value: '0', position: [-9.58, 1.55, -0.13], }, { domId: 'cqf2', title: '出气阀2#', code: 'DRS13_GVL5_OpenLimit', type: 'sign', // value: '0', position: [-6.2, 1.55, 0.06], }, ]; case 'sdmtjtcctrk': // 布尔台 return [ { domId: 'jsf1', title: '进水阀1#', code: 'CentrifugalPump1_WaterInValve1_OpenLimit', type: 'sign', // value: '0', position: [-5.26, 0.28, 0.6], }, { domId: 'jsf2', title: '进水阀2#', code: 'CentrifugalPump2_WaterInValve1_OpenLimit', type: 'sign', // value: '0', position: [-8.75, 0.3, 0.6], }, { domId: 'csf1', title: '出水阀1#', code: 'CentrifugalPump1_WaterOutValve2_OpenLimit', type: 'sign', // value: '0', position: [-5.74, 0.35, 0.27], }, { domId: 'csf2', title: '出水阀2#', code: 'CentrifugalPump2_WaterOutValve2_OpenLimit', type: 'sign', // value: '0', position: [-9.42, 0.35, 0.3], }, { domId: 'jqf1', title: '进气阀1#开度', code: 'CentrifugalPump1_AirInValve1_OpenLimit', type: 'value', // value: '0', position: [-4.41, 1.28, 0.03], }, { domId: 'jqf2', title: '进气阀2#开度', code: 'CentrifugalPump2_AirInValve1_OpenLimit', type: 'value', // value: '0', position: [-7.7, 1.31, -0.14], }, { domId: 'cqf1', title: '出气阀1#开度', code: 'CentrifugalPump1_AirOutValve2_OpenLimit', type: 'value', // value: '0', position: [-6.2, 1.55, 0.06], }, { domId: 'cqf2', title: '出气阀2#开度', code: 'CentrifugalPump2_AirOutValve2_OpenLimit', type: 'value', // value: '0', position: [-9.58, 1.55, -0.13], }, ]; default: return [ { domId: 'jsf1', title: '进水阀1#', code: 'CentrifugalPump1_WaterInValve1_OpenLimit', type: 'sign', // value: '0', position: [-5.26, 0.28, 0.6], }, { domId: 'jsf2', title: '进水阀2#', code: 'CentrifugalPump2_WaterInValve1_OpenLimit', type: 'sign', // value: '0', position: [-8.75, 0.3, 0.6], }, { domId: 'csf1', title: '出水阀1#', code: 'CentrifugalPump1_WaterOutValve2_OpenLimit', type: 'sign', // value: '0', position: [-5.74, 0.35, 0.27], }, { domId: 'csf2', title: '出水阀2#', code: 'CentrifugalPump2_WaterOutValve2_OpenLimit', type: 'sign', // value: '0', position: [-9.42, 0.35, 0.3], }, { domId: 'jqf1', title: '进气阀1#', code: 'CentrifugalPump1_AirInValve1_OpenLimit', type: 'sign', // value: '0', position: [-4.41, 1.28, 0.03], }, { domId: 'jqf2', title: '进气阀2#', code: 'CentrifugalPump2_AirInValve1_OpenLimit', type: 'sign', // value: '0', position: [-7.7, 1.31, -0.14], }, { domId: 'cqf1', title: '出气阀1#', code: 'CentrifugalPump1_AirOutValve2_OpenLimit', type: 'sign', // value: '0', position: [-6.2, 1.55, 0.06], }, { domId: 'cqf2', title: '出气阀2#', code: 'CentrifugalPump2_AirOutValve2_OpenLimit', type: 'sign', // value: '0', position: [-9.58, 1.55, -0.13], }, ]; } }; export function getComponent() { const { sysOrgCode } = useGlobSetting(); // const sysOrgCode = 'sdmtjtbetmk'; let gasPumpHome; switch (sysOrgCode) { case 'sdmtjtbetmk': // 布尔台 gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeBet.vue')); return gasPumpHome; case 'sdmtjtcctmk': // 寸草塔1 gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeCC.vue')); return gasPumpHome; case 'sdmtjtcctrk': // 寸草塔2 gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeCC.vue')); return gasPumpHome; case 'sdmtjtbdmk': // 保德 gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeBD.vue')); return gasPumpHome; default: // gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHome.vue')); gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeCopy.vue')); // gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeBD.vue')); return gasPumpHome; } } /** * 按站型取「瓦斯泵运行信号」表(泵号 → 运行状态点位),用于驱动管道流动动画。 * * 两个布尔台泵站的运行信号点位完全不同,绝不能互相借用: * - pump_22m2pq(新站):瓦斯泵由变频器驱动,用 CentrifugalPump_VFD_Status * - pump_under (老站):用瓦斯泵磁力启动器 Starter5_/Starter6_ 的断路器状态 * * 返回 null 表示该站型暂不支持泵状态驱动动画(调用方据此不点亮任何箭头)。 */ export async function getPumpRunSignals(deviceType: string) { const { sysOrgCode } = useGlobSetting(); if (sysOrgCode !== 'sdmtjtbetmk') return null; if (deviceType == 'pump_22m2pq') { return (await import('./gasPump.data.bet2')).pumpRunSignals; } if (deviceType?.startsWith('pump_under')) { return (await import('./gasPump.data.bet')).pumpRunSignals; } return null; } export async function getMonitorData(deviceType) { const { sysOrgCode } = useGlobSetting(); // const sysOrgCode = 'sdmtjtcctmk'; switch (sysOrgCode) { // 布尔台 case 'sdmtjtbetmk': if (deviceType == 'pump_22m2pq') { return await import('./gasPump.data.bet2'); } else { return await import('./gasPump.data.bet'); } case 'sdmtjtcctmk': return await import('./gasPump.dataCc'); case 'sdmtjtcctrk': if (deviceType == 'pump_under') { return await import('./gasPump.dataCc2_1'); } else if (deviceType == 'pump_under_31') { return await import('./gasPump.dataCc2_2'); } default: //默认 if (deviceType == 'pump_over') { return await import('./gasPump.dataCc2_1'); } else if (deviceType == 'pump_under') { return await import('./gasPump.dataCc2_2'); } } } interface deviceChildType { title: string; key: string[]; childTitle: string[]; } interface propertyListType { title: string; type: string; code: string; } export interface devicePropertyType { type: string; title: string; stateHeader: []; children: deviceChildType[]; list: propertyListType[]; } /** 二维 SVG 模型组件缓存(用于切换模型时不闪烁) */ const componentsCaches = new Map(); /** * 获取瓦斯抽采泵模型组件 * * @param is2DModel 是否为二维模型;三维模型由 index.vue 的 mountedThree 负责,此处仅返回二维组件 * @param type 站型(页面 dataSource 里的 deviceType,如 pump_over / pump_under / pump_22m2pq) */ export function getModelComponent(is2DModel: boolean = false, type: string = '') { if (!is2DModel) return null; const getComponent = (name) => { if (!componentsCaches.has(name)) { componentsCaches.set(name, import(`./components/${name}.vue`)); } return componentsCaches.get(name); }; // @ts-ignore return defineAsyncComponent(() => { switch (type) { // case 'pump_over': // case 'pump_under': // 目前地上/井下共用同一套二维场景,将来要分开时按站型指到不同组件即可 default: return getComponent('gasPumpSVG'); } }); } /** * 判断某台泵是否运行(与三维 gasPump.threejs.under.ts 的 isPumpRunning 同一套口径) * * 已注入 runSignals 时(布尔台两站)按泵运行状态点位判定:Number(data[code]) === 1; * 未注入时(寸草塔1/2、保德等未接入该机制的站型)回落到进气/出气阀门开度, * 避免这些站的流动动画因缺少运行点位而全部不动。 * * @param data 子组件轮询得到的监测数据(与传给三维 playAnimate 的同一份) * @param pumpNo 泵号(1 / 2) * @param runSignals 该站的"泵号 → 运行点位"表,null 表示未接入 * @param tags 回落口径用的标签表(getModelMonitorTags() 的返回值) */ export function isPumpRunning( data: any, pumpNo: number, runSignals: Record | null, tags: { domId: string; code: string }[] ): boolean { if (!data) return false; const code = runSignals?.[pumpNo]?.code; if (code) { const raw = data[code]; if (raw === undefined || raw === null || raw === '') return false; const value = Number(raw); return Number.isFinite(value) && value === 1; } // 回落到旧的阀门开度口径:该泵的任一进气/出气阀门开启即认为有流动 const valvePrefixes = pumpNo === 1 ? ['jqf1', 'cqf1'] : ['jqf2', 'cqf2']; return valvePrefixes.some((domId) => { const tag = tags?.find((e: any) => e.domId === domId); if (!tag) return false; const value = Number(data[tag.code]); return Number.isFinite(value) && value > 0; }); }