import { ref, reactive } from 'vue'; import echarts from '/@/utils/lib/echarts'; export const preMonitorList = [ { title: `累计流量`, code: `FluxTotal`, unit: 'm³', child: [], }, { title: `瞬时流量`, code: `InputFlux`, unit: 'm³/min', child: [], }, { title: `氮气浓度`, code: `NitrogenPurity`, unit: '%', child: [], }, { title: `运行时间`, code: `AirCompressor_RunTime`, unit: 'h', child: [], }, { code: 'signal', child: [ { title: `加载/卸载`, code: `AirCompressor_LoadorUnload`, isFault: -1, }, { title: `重故障`, code: `AirCompressor_TotalFailureSignal`, isFault: true, }, ], }, { code: 'signal', child: [ { title: `电源信号`, code: `AirCompressor_PowerFault`, isFault: false, }, { title: `运行信号`, code: `AirCompressor_Status`, isFault: false, }, ], }, { code: 'signal', child: [ { title: '风机过载', code: 'AirCompressor_Fan_OverloadFault', isFault: true, }, { title: '排气压力过高', code: 'AirCompressor_ExhaustPreHighFault', isFault: true, }, ], }, ]; export const preFanMonitorData = [ { title: '膜前温度', code: 'PreMembraneTemperature', unit: '℃', }, { title: '排气温度', code: 'AirCompressor_ExhaustTemp', unit: '℃', }, { title: '排气高温', code: 'AirCompressor_ExhaustTemp1', unit: '℃', }, { title: '排气压力', code: 'AirCompressor_ExhaustPre', unit: 'Mpa', }, { title: '电机电压', code: 'AirCompressor_SysVoltage', unit: 'V', }, { title: '电机电压', code: 'AirCompressor_SysVoltage', unit: 'V', }, { title: '电机电流', code: 'AirCompressor_MainMotor_Current', unit: 'A', }, { title: '三相不平衡', code: 'AirCompressor_UnbalanceFault', unit: 'signal', }, { title: ' 断相', code: 'AirCompressor_PhaseFailureFault', unit: 'signal', }, { title: '相序故障', code: 'AirCompressor_PhaseSequenceFault', unit: 'signal', }, { title: '接线错误', code: 'AirCompressor_PhaseSequenceFault1', unit: 'signal', }, { title: '短路故障', code: 'AirCompressor_ShortCutFaul', unit: 'signal', }, { title: '主电机高温', code: 'AirCompressor_MainMotor_OverTempFault', unit: 'signal', }, { title: '主机过载', code: 'AirCompressor_MainMotor_OverloadFault', unit: 'signal', }, { title: '欠压故障', code: 'AirCompressor_LowVoltageFault', unit: 'signal', }, { title: '过压故障', code: 'AirCompressor_OverVoltageFault', unit: 'signal', }, ]; export const deviceFault = [ { title: '分闸失败', code: 'AirCompressor_OpenFail', }, { title: '合闸失败', code: 'AirCompressor_CloseFail', }, { title: '油细分离器故障', code: 'AirCompressor_OilGasBarrel_SeparatorFault', }, { title: '油压过低', code: 'AirCompressor_OilPressureLowFault', }, { title: '油气桶高温', code: 'AirCompressor_OilGasBarrel_OverTempAlarm', }, // { // title: '油气桶高温预警预留', // code: 'AirCompressor_OilGasBarrel_OverTempAlarm1', // }, { title: '油过滤器堵塞', code: 'AirCompressor_OilGasBarrel_FilterBlockageFault', }, { title: '油气桶高压', code: 'AirCompressor_OilGasBarrel_HighPressureFault', }, { title: '失水故障', code: 'AirCompressor_NoWaterFault', }, { title: '漏电闭锁故障', code: 'AirCompressor_LeakageLock', }, { title: '轻故障预留', code: 'AirCompressor_TotalFailureSignal1', }, ]; export const zhudanOption = reactive({ tooltip: { trigger: 'axis', axisPointer: { lineStyle: { color: '#fff' } } }, legend: { top: '0', icon: 'rect', data: ['瞬时流量'], right: '10px', textStyle: { fontSize: 12, color: '#fff' }, }, grid: { x: 45, y: 60, x2: 45, y2: 60 }, xAxis: { type: 'category', boundaryGap: false, axisLine: { lineStyle: { color: '#57617B' } }, axisLabel: { color: '#ffffffcc', formatter: function (params) { const newParamsName = ref(''); // 最终拼接成的字符串 const paramsNameNumber = ref(params.length); // 实际标签的个数 const provideNumber = ref(10); // 每行能显示的字的个数 const rowNumber = Math.ceil(paramsNameNumber.value / provideNumber.value); // 换行的话,需要显示几行,向上取整 /** * 判断标签的个数是否大于规定的个数, 如果大于,则进行换行处理 如果不大于,即等于或小于,就返回原标签 */ // 条件等同于rowNumber>1 if (paramsNameNumber.value > provideNumber.value) { /** 循环每一行,p表示行 */ for (let p = 0; p < rowNumber; p++) { let tempStr = ''; // 表示每一次截取的字符串 const start = p * provideNumber.value; // 开始截取的位置 const end = start + provideNumber.value; // 结束截取的位置 // 此处特殊处理最后一行的索引值 if (p == rowNumber - 1) { // 最后一次不换行 tempStr = params.substring(start, paramsNameNumber.value); } else { // 每一次拼接字符串并换行 tempStr = params.substring(start, end) + '\n'; } newParamsName.value += tempStr; // 最终拼成的字符串 } } else { // 将旧标签的值赋给新标签 newParamsName.value = params; } //将最终的字符串返回 return newParamsName.value; }, }, splitLine: { show: true, lineStyle: { color: '#57617B22', type: 'dashed' } }, data: [], }, yAxis: [ // { // type: 'value', // name: 'm³/h', // max: 6000, // axisTick: { // show: false, // }, // position: 'left', // axisLine: { lineStyle: { show: true, color: '#57617B' } }, // axisLabel: { margin: 10, fontSize: 12, color: '#ffffffcc' }, // splitLine: { show: true, lineStyle: { color: '#57617B22', type: 'dashed' } }, // }, { type: 'value', name: 'm³/h', max: 2000, axisTick: { show: false, }, position: 'right', axisLine: { lineStyle: { show: true, color: '#57617B' } }, axisLabel: { margin: 10, fontSize: 12, color: '#ffffffcc' }, splitLine: { show: true, lineStyle: { color: '#57617B22', type: 'dashed' } }, }, ], series: [ // { // name: '累计流量', // type: 'line', // smooth: true, // lineStyle: { width: 2 }, // yAxisIndex: 0, // areaStyle: { // color: new echarts.graphic.LinearGradient( // 0, // 0, // 0, // 1, // [ // { // offset: 0, // color: 'rgba(185,150,248,0.3)', // }, // { // offset: 0.8, // color: 'rgba(185,150,248,0)', // }, // ], // false // ), // shadowColor: 'rgba(0, 0, 0, 0.1)', // shadowBlur: 10, // }, // itemStyle: { color: '#B996F8' }, // data: [], // }, { name: '瞬时流量', type: 'line', smooth: true, lineStyle: { width: 2 }, yAxisIndex: 0, areaStyle: { color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ { offset: 0, color: 'rgba(3, 194, 236, 0.3)', }, { offset: 0.8, color: 'rgba(3, 194, 236, 0)', }, ], false ), shadowColor: 'rgba(0, 0, 0, 0.1)', shadowBlur: 10, }, itemStyle: { color: '#03C2EC' }, data: [], }, ], });