This commit is contained in:
zhouhuang 2024-12-05 20:23:51 +08:00
commit 5f001006bd
30 changed files with 820 additions and 198 deletions

View File

@ -0,0 +1,11 @@
package com.das.modules.cache.domain;
import lombok.Data;
@Data
public class WindSpeedCoefValue {
private Double minValue;
private Double maxValue;
private Double coef;
private Double base;
}

View File

@ -16,4 +16,6 @@ public interface CacheService {
* @return
*/
IotModelCache getIotModelCache();
CalcCache getCalcCache();
}

View File

@ -0,0 +1,10 @@
package com.das.modules.cache.service;
import com.das.modules.cache.domain.WindSpeedCoefValue;
import java.util.List;
public interface CalcCache {
List<WindSpeedCoefValue> getWindSpeedCoef(Long deviceId);
void refreshWindSpeedCoef();
}

View File

@ -1,6 +1,7 @@
package com.das.modules.cache.service.impl;
import com.das.modules.cache.service.CacheService;
import com.das.modules.cache.service.CalcCache;
import com.das.modules.cache.service.EquipmentCache;
import com.das.modules.cache.service.IotModelCache;
import org.springframework.beans.factory.annotation.Autowired;
@ -15,6 +16,9 @@ public class CacheServiceImpl implements CacheService {
@Autowired
IotModelCache iotModelCache;
@Autowired
CalcCache calcCache;
@Override
public EquipmentCache getEquipmentCache() {
return equipmentCache;
@ -25,5 +29,10 @@ public class CacheServiceImpl implements CacheService {
return iotModelCache;
}
@Override
public CalcCache getCalcCache() {
return calcCache;
}
}

View File

@ -0,0 +1,50 @@
package com.das.modules.cache.service.impl;
import com.das.modules.cache.domain.WindSpeedCoefValue;
import com.das.modules.cache.service.CalcCache;
import com.das.modules.page.domian.dto.SysPowerCurveFactorDto;
import com.das.modules.page.domian.vo.SysPowerCurveFactorVo;
import com.das.modules.page.mapper.SysPowerCurveFactorMapper;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@Service
public class CalcCacheImpl implements CalcCache {
@Autowired
SysPowerCurveFactorMapper sysPowerCurveFactorMapper;
private ConcurrentHashMap<Long, List<WindSpeedCoefValue>> windSpeedCoefMap = new ConcurrentHashMap<>();
@PostConstruct
private void init(){
refreshWindSpeedCoef();
}
@Override
public List<WindSpeedCoefValue> getWindSpeedCoef(Long deviceId) {
return windSpeedCoefMap.get(deviceId);
}
@Override
public void refreshWindSpeedCoef() {
List<SysPowerCurveFactorVo> sysPowerCurveFactorVos = sysPowerCurveFactorMapper.querySysPowerCurveFactorList(new SysPowerCurveFactorDto());
for (SysPowerCurveFactorVo sysPowerCurveFactorVo : sysPowerCurveFactorVos) {
WindSpeedCoefValue windSpeedCoefValue = new WindSpeedCoefValue();
windSpeedCoefValue.setMinValue(sysPowerCurveFactorVo.getSpeedMin());
windSpeedCoefValue.setMaxValue(sysPowerCurveFactorVo.getSpeedMax());
windSpeedCoefValue.setCoef(sysPowerCurveFactorVo.getFactorK());
windSpeedCoefValue.setBase(sysPowerCurveFactorVo.getFactorB());
List<WindSpeedCoefValue> windSpeedCoefValues = windSpeedCoefMap.get(sysPowerCurveFactorVo.getTurbineId());
if (windSpeedCoefValues == null) {
windSpeedCoefValues = new java.util.ArrayList<>();
}
windSpeedCoefValues.add(windSpeedCoefValue);
windSpeedCoefMap.put(sysPowerCurveFactorVo.getTurbineId(), windSpeedCoefValues);
}
}
}

View File

@ -0,0 +1,76 @@
package com.das.modules.calc.functions;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.das.modules.cache.domain.DeviceInfoCache;
import com.das.modules.cache.service.CacheService;
import com.das.modules.data.service.DataService;
import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.type.AviatorNil;
import com.googlecode.aviator.runtime.type.AviatorObject;
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.Map;
/**
* Aviator扩展函数 - 获取时间维度内平均
* 函数格式: avg(deviceId, attr, timedim)
* timedim: day - month - year -
* 返回值数值 nil - 获取错误
*/
@Slf4j
public class FunctionAvgValue extends AbstractFunction {
private DataService dataService = null;
private CacheService cacheService = null;
public FunctionAvgValue(DataService dataService, CacheService cacheService) {
this.dataService = dataService;
this.cacheService = cacheService;
}
@Override
public String getName() {
return "avgv";
}
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject deviceCode, AviatorObject attr) {
//设备Code
String code = (String)deviceCode.getValue(env);
String attrName = (String)attr.getValue(env);
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheByCode(code);
if (deviceInfoCache == null) {
return AviatorNil.NIL;
}
Double value = dataService.getTimeAvgValue(deviceInfoCache.getDeviceId(), attrName, null, null);
if (value == null){
return AviatorNil.NIL;
}
//未找到缓存查询时序API获取数据
return AviatorRuntimeJavaType.valueOf(value);
}
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject deviceCode, AviatorObject attr, AviatorObject startTimeData, AviatorObject endTimeData) {
//设备Code
String code = (String)deviceCode.getValue(env);
String attrName = (String)attr.getValue(env);
Date startTime = (Date)startTimeData.getValue(env);
Date endTime = (Date)endTimeData.getValue(env);
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheByCode(code);
if (deviceInfoCache == null) {
return AviatorNil.NIL;
}
Double value = dataService.getTimeSumValue(deviceInfoCache.getDeviceId(), attrName, startTime.getTime(), endTime.getTime());
if (value == null){
return AviatorNil.NIL;
}
//未找到缓存查询时序API获取数据
return AviatorRuntimeJavaType.valueOf(value);
}
}

View File

@ -0,0 +1,60 @@
package com.das.modules.calc.functions;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.type.AviatorObject;
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.Map;
/**
* Aviator扩展函数 - 获取时间维度的起始时间
* 函数格式: beginOf(Date, TimeDim)
*
*/
@Slf4j
public class FunctionOffsetDate extends AbstractFunction {
public FunctionOffsetDate() {
}
@Override
public String getName() {
return "offsetDate";
}
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject dateData, AviatorObject dimData, AviatorObject offsetData) {
Date date = (Date) dateData.getValue(env);
String dim = (String) dimData.getValue(env);
Integer offset = (Integer) offsetData.getValue(env);
Date result = null;
switch (dim) {
case "day":
result = DateUtil.offset(date, DateField.DAY_OF_MONTH, offset);
break;
case "month":
result = DateUtil.offset(date, DateField.MONTH, offset);
break;
case "year":
result = DateUtil.offset(date, DateField.YEAR, offset);
break;
case "hour":
result = DateUtil.offset(date, DateField.HOUR, offset);
break;
case "minute":
result = DateUtil.offset(date, DateField.MINUTE, offset);
break;
case "second":
result = DateUtil.offset(date, DateField.SECOND, offset);
break;
default:
log.error("不支持的维度: {}", dim);
}
return AviatorRuntimeJavaType.valueOf(result);
}
}

View File

@ -0,0 +1,59 @@
package com.das.modules.calc.functions;
import cn.hutool.core.collection.CollectionUtil;
import com.das.modules.cache.domain.DeviceInfoCache;
import com.das.modules.cache.domain.WindSpeedCoefValue;
import com.das.modules.cache.service.CacheService;
import com.das.modules.data.service.DataService;
import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.type.AviatorNil;
import com.googlecode.aviator.runtime.type.AviatorObject;
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Aviator扩展函数 - 获取时间维度内平均
* 函数格式: avg(deviceId, attr, timedim)
* timedim: day - month - year -
* 返回值数值 nil - 获取错误
*/
@Slf4j
public class FunctionWindSpeedFactor extends AbstractFunction {
private DataService dataService = null;
private CacheService cacheService = null;
public FunctionWindSpeedFactor(DataService dataService, CacheService cacheService) {
this.dataService = dataService;
this.cacheService = cacheService;
}
@Override
public String getName() {
return "windSpeedFactor";
}
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject deviceCode) {
//设备Code
String code = (String)deviceCode.getValue(env);
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheByCode(code);
if (deviceInfoCache == null) {
return AviatorNil.NIL;
}
List<WindSpeedCoefValue> windSpeedCoef = cacheService.getCalcCache().getWindSpeedCoef(deviceInfoCache.getDeviceId());
if (CollectionUtil.isEmpty(windSpeedCoef)){
return AviatorNil.NIL;
}
//未找到缓存查询时序API获取数据
return AviatorRuntimeJavaType.valueOf(windSpeedCoef);
}
}

View File

@ -128,6 +128,12 @@ public class CalcService {
FunctionEndOfDate endOfDate = new FunctionEndOfDate();
aviator.addFunction(endOfDate);
FunctionAvgValue avgValue = new FunctionAvgValue(dataService, cacheService);
aviator.addFunction(avgValue);
FunctionOffsetDate offsetDate = new FunctionOffsetDate();
aviator.addFunction(offsetDate);
}
/**

View File

@ -17,6 +17,8 @@ public interface DataService {
void updateCalFieldData(List<CalculateRTData> values);
Double getTimeTopValue(Long devcieId, String attr, Long startTime, Long endTime);
Double getTimeSumValue(Long devcieId, String attr, Long startTime, Long endTime);
Double getTimeTopValue(Long deviceId, String attr, Long startTime, Long endTime);
Double getTimeSumValue(Long deviceId, String attr, Long startTime, Long endTime);
Double getTimeAvgValue(Long deviceId, String attrName, Long startTime, Long endTime);
}

View File

@ -905,4 +905,52 @@ public class TDEngineService {
}
return result;
}
public Double getTimeAvgValue(String tableName, String attr, Long startTime, Long endTime) {
StringBuffer sb = new StringBuffer(256);
sb.append("select ");
sb.append("avg(");
sb.append(attr);
sb.append(")");
sb.append(" from ");
sb.append(tableName);
if (startTime != null && endTime != null) {
sb.append(" where ");
sb.append(String.format(" updatetime >= %d and updatetime < %d ", startTime, endTime));
}
Double result = 0.0;
try (Connection conn = hikariDataSource.getConnection();
Statement smt = conn.createStatement();
ResultSet rs = smt.executeQuery(sb.toString())) {
if (rs.next()) {
result = rs.getDouble(1);
}
} catch (Exception e) {
log.error("获取数据异常",e);
}
return result;
}
public Double getTimeAvgCalcValue(String tableName, String attr, Long startTime, Long endTime) {
StringBuffer sb = new StringBuffer(256);
sb.append("select ");
sb.append("avg(datavalue)");
sb.append(" from ");
sb.append(tableName);
if (startTime != null && endTime != null) {
sb.append(" where ");
sb.append(String.format(" updatetime >= %d and updatetime < %d ", startTime, endTime));
}
Double result = 0.0;
try (Connection conn = hikariDataSource.getConnection();
Statement smt = conn.createStatement();
ResultSet rs = smt.executeQuery(sb.toString())) {
if (rs.next()) {
result = rs.getDouble(1);
}
} catch (Exception e) {
log.error("获取数据异常",e);
}
return result;
}
}

View File

@ -268,8 +268,8 @@ public class DataServiceImpl implements DataService {
* @return
*/
@Override
public Double getTimeTopValue(Long devcieId, String attr, Long startTime, Long endTime){
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(devcieId);
public Double getTimeTopValue(Long deviceId, String attr, Long startTime, Long endTime){
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId);
if (deviceInfoCache == null) {
return null;
}
@ -285,8 +285,8 @@ public class DataServiceImpl implements DataService {
}
@Override
public Double getTimeSumValue(Long devcieId, String attr, Long startTime, Long endTime) {
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(devcieId);
public Double getTimeSumValue(Long deviceId, String attr, Long startTime, Long endTime) {
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId);
if (deviceInfoCache == null) {
return null;
}
@ -301,4 +301,22 @@ public class DataServiceImpl implements DataService {
}
return tdEngineService.getTimeSumValue(tableName, attr, startTime, endTime);
}
@Override
public Double getTimeAvgValue(Long deviceId, String attr, Long startTime, Long endTime) {
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId);
if (deviceInfoCache == null) {
return null;
}
String tableName = "";
if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("c_%s_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
return tdEngineService.getTimeAvgCalcValue(tableName, attr, startTime, endTime);
} else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){
tableName = String.format("h_%s", deviceInfoCache.getDeviceId());
} else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){
tableName = String.format("l_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
}
return tdEngineService.getTimeAvgValue(tableName, attr, startTime, endTime);
}
}

View File

@ -19,7 +19,7 @@ public interface SysIotModelMapper extends BaseMapper<SysIotModel> {
List<SysIotModelServiceExcel> queryServiceByModelId(Long id);
Long queryIotModelIdByName(String code);
Long queryIotModelIdByCode(String code);
List<SysIotModelVo> getSysIotModelByType(Integer objectType);

View File

@ -2,12 +2,14 @@ package com.das.modules.equipment.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.das.common.config.SessionUtil;
import com.das.common.constant.EquipmentTypeIds;
import com.das.common.exceptions.ServiceException;
import com.das.common.utils.BeanCopyUtils;
import com.das.common.utils.PageDataInfo;
@ -41,6 +43,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.rmi.ServerException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -249,10 +252,19 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
List<SysEquipment> delSysEquipmentList = new ArrayList<>();
// 遍历
for (List<Object> row : list) {
if (ObjectUtil.isAllNotEmpty(row.get(4),row.get(1),row.get(5))){
throw new ServerException("请检查必填参数:"+row);
}
if (!Integer.valueOf(row.get(1).toString()).equals(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG) && !Integer.valueOf(row.get(1).toString()).equals(EquipmentTypeIds.EQUIPMENT_TYPE_WIND_FARM)){
throw new ServerException("设备类型编码错误"+ row.get(1));
}
SysEquipment field = new SysEquipment();
// 根据编码获取物模型id
if (StringUtils.hasText(row.get(2).toString())) {
Long iotModelId = sysIotModelMapper.queryIotModelIdByName(row.get(3).toString());
Long iotModelId = sysIotModelMapper.queryIotModelIdByCode(row.get(2).toString());
if (iotModelId == null){
throw new ServerException("物模型编码错误,错误编码:"+ row.get(2).toString());
}
field.setIotModelId(iotModelId);
}
if (StringUtils.hasText(row.get(13).toString())) {
@ -263,9 +275,9 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
field.setObjectType(Integer.valueOf(row.get(1).toString()));
field.setCode(row.get(4).toString());
field.setName(row.get(5).toString());
field.setMadeinFactory(row.get(6).toString());
field.setModel(row.get(7).toString());
field.setLocation(row.get(8).toString());
field.setMadeinFactory(ObjectUtil.isEmpty(row.get(6)) ? null : row.get(6).toString());
field.setModel(ObjectUtil.isEmpty(row.get(7)) ? null : row.get(7).toString());
field.setLocation(ObjectUtil.isEmpty(row.get(8)) ? null : row.get(8).toString());
if (StringUtils.hasText(row.get(9).toString())) {
field.setLongitude(Double.valueOf(row.get(9).toString()));
}
@ -276,9 +288,9 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
if (StringUtils.hasText(row.get(11).toString())) {
field.setInstallDate(sf.parse(row.get(11).toString()));
}
field.setRemarks(row.get(12).toString());
field.setBelongLine(row.get(17).toString());
field.setStandard(Integer.valueOf(row.get(18).toString()));
field.setRemarks(ObjectUtil.isEmpty(row.get(12)) ? null : row.get(12).toString());
field.setBelongLine(ObjectUtil.isEmpty(row.get(17)) ? null : row.get(17).toString());
field.setStandard(ObjectUtil.isEmpty(row.get(18)) ? null : Integer.valueOf(row.get(18).toString()));
if (StringUtils.hasText(row.get(19).toString())) {
field.setNominalCapacity(Double.valueOf(row.get(19).toString()));
}

View File

@ -56,13 +56,13 @@ public class HeartbeatCommand implements BaseCommand{
}
//判断是不是风机
String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId);
String keyDeviceStatus = String.format("RT:%d:commfaultstate");
String keyCommFaultState = String.format("RT:%d:commfaultstate");
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
if (plcDeviceStatus == null){
adminRedisTemplate.set(keyDeviceStatus, online ? 1 : 0);
adminRedisTemplate.set(keyCommFaultState, online ? 0 : 1);
}
else{
adminRedisTemplate.set(keyDeviceStatus, online && plcDeviceStatus == 1 ? 1 : 0);
adminRedisTemplate.set(keyCommFaultState, online && plcDeviceStatus != 0 ? 0 : 1);
}
}
}

View File

@ -23,25 +23,25 @@ import java.text.ParseException;
public class WindSpeedCorrectController {
@Autowired
private WindSpeedCorrectService sysEquipmentService;
private WindSpeedCorrectService windSpeedCorrectService;
/** 导入 */
@PostMapping("/import")
public R<Void> importWindSpeedCorrect( @RequestParam("file") MultipartFile file) throws IOException, ParseException {
sysEquipmentService.importWindSpeedCorrect( file);
windSpeedCorrectService.importWindSpeedCorrect( file);
return R.success("导入成功");
}
/** 获取风机风速功率修正系数列表 */
@PostMapping("/getList")
public R<PageDataInfo<SysPowerCurveFactorVo>> getList(@RequestBody SysPowerCurveFactorDto dto) {
PageDataInfo<SysPowerCurveFactorVo> list = sysEquipmentService.getList(dto);
PageDataInfo<SysPowerCurveFactorVo> list = windSpeedCorrectService.getList(dto);
return R.success(list);
}
/** 导出 */
@PostMapping("/export")
public void exportWindSpeedCorrect(@RequestBody SysPowerCurveFactorDto dto, HttpServletRequest request, HttpServletResponse response) {
sysEquipmentService.exportWindSpeedCorrect(dto,request, response);
windSpeedCorrectService.exportWindSpeedCorrect(dto,request, response);
}

View File

@ -12,6 +12,8 @@ import com.das.common.utils.BeanCopyUtils;
import com.das.common.utils.PageDataInfo;
import com.das.common.utils.PageQuery;
import com.das.modules.auth.domain.vo.SysUserVo;
import com.das.modules.cache.domain.WindSpeedCoefValue;
import com.das.modules.cache.service.CacheService;
import com.das.modules.equipment.entity.SysEquipment;
import com.das.modules.equipment.mapper.SysEquipmentMapper;
import com.das.modules.page.domian.dto.IntervalDto;
@ -52,6 +54,9 @@ public class WindSpeedCorrectServiceImpl implements WindSpeedCorrectService {
@Autowired
private SysPowerCurveFactorMapper sysPowerCurveFactorMapper;
@Autowired
private CacheService cacheService;
@Override
public void importWindSpeedCorrect(MultipartFile file) throws IOException {
// 通过文件获取输入流
@ -90,6 +95,8 @@ public class WindSpeedCorrectServiceImpl implements WindSpeedCorrectService {
}
//批量插入数据库
sysPowerCurveFactorMapper.insertBatch(listData);
//更新缓存数据
cacheService.getCalcCache().refreshWindSpeedCoef();
}
@Override

View File

@ -45,7 +45,7 @@
where sims.iot_model_id = #{id} order by sims.porder asc
</select>
<select id="queryIotModelIdByName" resultType="java.lang.Long">
<select id="queryIotModelIdByCode" resultType="java.lang.Long">
select id from sys_iot_model where iot_model_code = #{code}
</select>

View File

@ -24,7 +24,7 @@
and t.turbine_id = #{info.turbineId}
</if>
</where>
order by sq.name asc
order by sq.name asc, t.speed_min asc
</select>
<select id="querySysPowerCurveFactorList" resultMap="resultMap">
@ -46,7 +46,7 @@
</foreach>
</if>
</where>
order by sq.name asc
order by sq.name asc, t.speed_min asc
</select>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

@ -327,7 +327,7 @@ import { useRoute, useRouter } from 'vue-router'
import Overview from './overview.vue'
import { TableInstance } from 'element-plus'
import { dayjs, ElMessage, ElMessageBox } from 'element-plus'
import { getRealTimeState, getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils'
import { getRealTimeState, getCutDecimalsValue, malFunctionKeys } from '/@/views/backend/equipment/airBlower/utils'
import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request'
import { getAlarmListReq } from '/@/api/backend/alarms/request'
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
@ -1037,7 +1037,7 @@ const createRealTimeData = async () => {
val = enumStore.data[item.attributeCode][val]
}
if (malFunctionKeys.includes(item.attributeCode)) {
val = malFunctionEnums?.[item.attributeCode] ?? val
val = malFunctionEnums?.[val] ?? val
}
if (sigleDataKeys.includes(item.attributeCode.toLowerCase())) {
realTimeDataForSingle.value[item.attributeCode.toLowerCase()] = val === '-' ? val : val
@ -1345,29 +1345,16 @@ const getAlarmList = () => {
})
}
const malFunctionKeys = [
'ActiveStatusCode01',
'ActiveStatusCode02',
'ActiveStatusCode03',
'ActiveStatusCode04',
'ActiveStatusCode05',
'ActiveStatusCode06',
'ActiveStatusCode07',
'ActiveStatusCode08',
'FirstTriggeredCode',
]
const malFunctionEnums: any = {}
let malFunctionEnums: any = {}
const getMalfunctionEnums = () => {
const curWindBlower = airBlowerList.value.find((item) => item.irn === route.query.irn)
console.log(curWindBlower)
queryfaultCodeDict({ madeinfactory: curWindBlower!.madeinfactory, model: curWindBlower!.model }).then((res) => {
if (res.code == 200) {
const data: any = {}
res.data.forEach((item: any) => {
data[item.code] = item.description
})
malFunctionEnums = data
}
})
}

View File

@ -3,79 +3,114 @@
<el-row style="margin: 0px;">
<el-col :md="24" :lg="24" class="col-top">
<el-row class="overview">
<el-col :xs="12" :sm="8" :md="8" :lg="4">
<el-col :xs="24" :sm="24" :md="24" :lg="16">
<div class="overviewItem" style="margin-left: 0px;">
<img class="small-panel-pic" src="~assets/dashboard/overview01.png" alt="" />
<el-col :xs="1" :sm="1" :md="1" :lg="1">
<img class="small-panel-pic" src="~assets/dashboard/overview07.png" alt="" />
</el-col>
<el-col :xs="4" :sm="3" :md="3" :lg="3">
<div class="small-base">
<div class="small-title">全场平均风速</div>
<div class="small-value">
<span class="content-number">{{realData.attributeMap.windfarmavgwindspeed}}</span>
<span>m/s</span>
</div>
</div>
<div class="small-title">平均风速</div>
</div>
</el-col>
<el-col :xs="12" :sm="8" :md="8" :lg="4">
<div class="overviewItem">
<img class="small-panel-pic" src="~assets/dashboard/overview02.png" alt="" />
<el-col :xs="3" :sm="4" :md="4" :lg="4">
<div class="small-base">
<div class="small-title">全场实时有功</div>
<div class="small-value">
<span class="content-number">{{realData.attributeMap.windfarmactivepower}}</span>
<span>kW</span>
</div>
</div>
<div class="small-title">实时有功</div>
</div>
</el-col>
<el-col :xs="12" :sm="8" :md="8" :lg="4">
<div class="overviewItem">
<img class="small-panel-pic" src="~assets/dashboard/overview03.png" alt="" />
<el-col :xs="4" :sm="4" :md="4" :lg="4">
<div class="small-base">
<div class="small-title">全场实时无功</div>
<div class="small-value">
<span class="content-number">{{realData.attributeMap.windfarmreactivepower}}</span>
<span>kvar</span>
</div>
</div>
<div class="small-title">实时无功</div>
</div>
</el-col>
<el-col :xs="12" :sm="8" :md="8" :lg="4">
<div class="overviewItem">
<img class="small-panel-pic" src="~assets/dashboard/overview04.png" alt="" />
<el-col :xs="4" :sm="4" :md="4" :lg="4">
<div class="small-base">
<div class="small-title">日发电量</div>
<div class="small-value">
<span class="content-number">{{realData.attributeMap.windfarmdayprodenergy}}</span>
<span>kWh</span>
</div>
<span>万kWh</span>
</div>
<div class="small-title">日发电量</div>
</div>
</el-col>
<el-col :xs="12" :sm="8" :md="8" :lg="4">
<div class="overviewItem">
<img class="small-panel-pic" src="~assets/dashboard/overview05.png" alt="" />
<el-col :xs="4" :sm="4" :md="4" :lg="4">
<div class="small-base">
<div class="small-title">本月发电量</div>
<div class="small-value">
<span class="content-number">{{realData.attributeMap.windfarmmonthprodenergy}}</span>
<span>kWh</span>
</div>
<span>万kWh</span>
</div>
<div class="small-title">本月发电量</div>
</div>
</el-col>
<el-col :xs="12" :sm="8" :md="8" :lg="4">
<div class="overviewItem" style="margin-right: 0px;">
<img class="small-panel-pic" src="~assets/dashboard/overview06.png" alt="" />
<div class="small-base">
<div class="small-title">年发电量</div>
<el-col :xs="4" :sm="4" :md="4" :lg="4">
<div class="small-base" style="border: none;">
<div class="small-value">
<span class="content-number">{{realData.attributeMap.windfarmyearprodenergy}}</span>
<span>kWh</span>
<span>kWh</span>
</div>
<div class="small-title">年发电量</div>
</div>
</el-col>
</div>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="8">
<div class="overviewItem">
<el-col :xs="3" :sm="3" :md="3" :lg="3">
<img class="small-panel-pic" src="~assets/dashboard/overview08.png" alt="" />
</el-col>
<el-col :xs="4" :sm="4" :md="4" :lg="4">
<div class="small-base">
<div class="small-value">
<span class="content-number">{{realData.attributeMap.turbinecountpowerprod}}</span>
<span></span>
</div>
<div class="small-title">并网台数</div>
</div>
</el-col>
<el-col :xs="6" :sm="6" :md="6" :lg="6">
<div class="small-base">
<div class="small-value">
<span class="content-number">{{realData.attributeMap.turbinecountidle}}</span>
<span></span>
</div>
<div class="small-title">待机台数</div>
</div>
</el-col>
<el-col :xs="6" :sm="6" :md="6" :lg="6">
<div class="small-base">
<div class="small-value">
<span class="content-number">{{realData.attributeMap.turbinecountdisconnected}}</span>
<span></span>
</div>
<div class="small-title">断联台数</div>
</div>
</el-col>
<el-col :xs="6" :sm="5" :md="5" :lg="5">
<div class="small-base" style="border: none;">
<div class="small-value">
<span class="content-number">{{realData.attributeMap.turbinecountservice}}</span>
<span></span>
</div>
<div class="small-title">维护台数</div>
</div>
</el-col>
</div>
</el-col>
</el-row>
@ -125,9 +160,7 @@
</template>
<script setup lang="ts">
import { nextTick, onActivated, onMounted, reactive, ref, onBeforeMount, onUnmounted, VNodeRef } from 'vue'
import * as echarts from 'echarts'
import { useTemplateRefsList, useEventListener } from '@vueuse/core'
import { onMounted, reactive, ref, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import WindContent from '/@/views/backend/home/windMatrix.vue'
import { equipList } from '/@/api/backend/realData/request'
@ -156,6 +189,11 @@ const attributeList = ref({
'windfarmdayprodenergy',
'windfarmmonthprodenergy',
'windfarmyearprodenergy',
'turbinecountpowerprod',
'turbinecountidle',
'turbinecountdisconnected',
'turbinecountservice'
]
})
@ -174,9 +212,33 @@ const overviewList = () => {
res.data.attributeMap.windfarmactivepower = formatAttributeValue(res.data.attributeMap.windfarmactivepower)
res.data.attributeMap.windfarmreactivepower = formatAttributeValue(res.data.attributeMap.windfarmreactivepower)
res.data.attributeMap.windfarmavgwindspeed = formatAttributeValue(res.data.attributeMap.windfarmavgwindspeed)
res.data.attributeMap.windfarmdayprodenergy = formatAttributeValue(res.data.attributeMap.windfarmdayprodenergy)
res.data.attributeMap.windfarmmonthprodenergy = formatAttributeValue(res.data.attributeMap.windfarmmonthprodenergy)
res.data.attributeMap.windfarmyearprodenergy = formatAttributeValue(res.data.attributeMap.windfarmyearprodenergy)
res.data.attributeMap.windfarmdayprodenergy = formatAttributeValue(res.data.attributeMap.windfarmdayprodenergy/10000)
res.data.attributeMap.windfarmmonthprodenergy = formatAttributeValue(res.data.attributeMap.windfarmmonthprodenergy/10000)
res.data.attributeMap.windfarmyearprodenergy = formatAttributeValue(res.data.attributeMap.windfarmyearprodenergy/10000)
res.data.attributeMap.turbinecountpowerprod =
res.data.attributeMap.turbinecountpowerprod !== undefined
? res.data.attributeMap.turbinecountpowerprod % 1 === 0
? res.data.attributeMap.turbinecountpowerprod
: res.data.attributeMap.turbinecountpowerprod.toFixed(0)
: '0'
res.data.attributeMap.turbinecountidle =
res.data.attributeMap.turbinecountidle !== undefined
? res.data.attributeMap.turbinecountidle % 1 === 0
? res.data.attributeMap.turbinecountidle
: res.data.attributeMap.turbinecountidle.toFixed(0)
: '0'
res.data.attributeMap.turbinecountdisconnected =
res.data.attributeMap.turbinecountdisconnected !== undefined
? res.data.attributeMap.turbinecountdisconnected % 1 === 0
? res.data.attributeMap.turbinecountdisconnected
: res.data.attributeMap.turbinecountdisconnected.toFixed(0)
: '0'
res.data.attributeMap.turbinecountservice =
res.data.attributeMap.turbinecountservice !== undefined
? res.data.attributeMap.turbinecountservice % 1 === 0
? res.data.attributeMap.turbinecountservice
: res.data.attributeMap.turbinecountservice.toFixed(0)
: '0'
const data: any = {
windFarmId: res.data.windFarmId,
attributeMap: {
@ -185,7 +247,11 @@ const overviewList = () => {
windfarmavgwindspeed: res.data.attributeMap.windfarmavgwindspeed,
windfarmdayprodenergy: res.data.attributeMap.windfarmdayprodenergy,
windfarmmonthprodenergy: res.data.attributeMap.windfarmmonthprodenergy,
windfarmyearprodenergy: res.data.attributeMap.windfarmyearprodenergy
windfarmyearprodenergy: res.data.attributeMap.windfarmyearprodenergy,
turbinecountpowerprod: res.data.attributeMap.turbinecountpowerprod,
turbinecountidle: res.data.attributeMap.turbinecountidle,
turbinecountdisconnected: res.data.attributeMap.turbinecountdisconnected,
turbinecountservice: res.data.attributeMap.turbinecountservice
},
}
@ -327,9 +393,6 @@ const StatusListData = () => {
})
}
const timestampToTime = (timestamp: any) => {
timestamp = timestamp ? timestamp : null
let date = new Date(timestamp)
@ -422,10 +485,6 @@ const createScroll = () => {
if (scrollRef.value.clientWidth + scrollRef.value.scrollLeft == scrollRef.value.scrollWidth) {
scrollRef.value.scrollLeft = 0
}
//scrollRef.value.scrollTop += 1
/* if (scrollRef.value.clientHeight + scrollRef.value.scrollTop == scrollRef.value.scrollHeight) {
scrollRef.value.scrollTop = 0
}*/
}, 30);
}
@ -514,13 +573,13 @@ $labelHeight: 30px;
background-color: #f2f3f5;
.el-row {
width: calc(100% - 0px);
.el-col {
/* .el-col {
height: calc(100% - 10px);
}
}*/
}
.content-number {
color: #333333;
font-size: 28px;
font-size: 22px;
}
.homelabel {
font-family: PingFangSC-Semibold;
@ -533,7 +592,7 @@ $labelHeight: 30px;
display: block;
}
.overview {
width: calc(100% - 10px);
width: calc(100% - 5px);
height: 100%;
.overviewItem{
height: 100px;
@ -547,6 +606,10 @@ $labelHeight: 30px;
width: 80px;
height: 80px;
}
.small-base{
text-align: center;
border-right: 1px #eeeeee solid;
}
}
}
@ -616,7 +679,21 @@ $labelHeight: 30px;
}
}
}
@media screen and (max-width: 1280px) {
.default-main {
font-size: 12px !important;
.content-number {
font-size: 16px !important;
}
.overviewItem{
.small-panel-pic{
width: 40px!important;
height: 40px!important;
}
}
}
}
@media screen and (max-width: 1360px) {
@ -636,7 +713,14 @@ $labelHeight: 30px;
.default-main {
/*font-size: 12px !important;*/
.content-number {
font-size: 18px !important;
font-size: 16px !important;
}
.overviewItem{
.small-panel-pic{
width: 60px!important;
height: 60px!important;
}
}
.homelabel {

View File

@ -157,7 +157,6 @@
</el-table>
</el-main>
</el-container>
</div>
<el-dialog v-model="multiTaskVisible" :title="mutiTaskTitle" width="400" :close-on-click-modal="false">
<el-row v-for="item in mutiTaskList" :key="item.sendData.deviceId">
<el-col :span="18">
@ -205,6 +204,7 @@
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
@ -694,7 +694,6 @@ const openMeasure = () => {
const saveSelectPoint = () => {
const list = selectPointDialogRef.value?.getSelectList()
if (list) {
const addCoulmn = list.map((item: any) => {
return {
label: item.unit ? item.attributeName + item.unit : item.attributeName,

View File

@ -36,3 +36,15 @@ export const getEnumToValue = (key: string, value: any) => {
return value
}
}
export const malFunctionKeys = [
'ActiveStatusCode01',
'ActiveStatusCode02',
'ActiveStatusCode03',
'ActiveStatusCode04',
'ActiveStatusCode05',
'ActiveStatusCode06',
'ActiveStatusCode07',
'ActiveStatusCode08',
'FirstTriggeredCode',
]

View File

@ -118,15 +118,26 @@
<el-row>
<el-col :span="12">
<el-form-item label="生产厂家:">
<el-input disabled v-model="editDeviceData.madeinFactory" placeholder="请选择规格型号" clearable />
<el-input
:disabled="hasSetOfMachines"
v-model="editDeviceData.madeinFactory"
:placeholder="hasSetOfMachines ? '请选择规格型号' : '请输入生产厂家'"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格型号:">
<!-- <el-input v-model="editDeviceData.model" style="width: 200px" placeholder="请输入规格型号" clearable /> -->
<el-select v-model="editDeviceData.model" placeholder="请选择规格型号" style="width: 200px" @change="selectEditModel">
<el-select
v-if="hasSetOfMachines"
v-model="editDeviceData.model"
placeholder="请选择规格型号"
style="width: 200px"
@change="selectEditModel"
>
<el-option v-for="item in modelList" :key="item.model" :value="item.model"></el-option>
</el-select>
<el-input v-else v-model="editDeviceData.model" style="width: 200px" placeholder="请输入规格型号" clearable />
</el-form-item>
</el-col>
</el-row>
@ -215,11 +226,12 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="editDeviceData.objectType == '风电场' ? '装机容量(MW):' : '额定容量(MW):'">
<el-form-item :label="hasSetOfMachines ? '额定容量(MW):' : '装机容量(MW):'">
<el-input-number
:disabled="hasSetOfMachines"
style="width: 200px"
:controls="false"
:placeholder="editDeviceData.objectType == '风电场' ? '请输入装机容量' : '请输入额定容量'"
:placeholder="hasSetOfMachines ? '请输入额定容量' : '请输入装机容量'"
v-model="editDeviceData.nominalCapacity"
/>
</el-form-item>
@ -287,14 +299,26 @@
<el-row>
<el-col :span="12">
<el-form-item label="生产厂家:">
<el-input disabled v-model="editAddDeviceData.madeinFactory" placeholder="请选择规格型号" clearable />
<el-input
:disabled="hasSetOfMachines"
v-model="editAddDeviceData.madeinFactory"
:placeholder="hasSetOfMachines ? '请选择规格型号' : '请输入生产厂家'"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格型号:">
<el-select v-model="editAddDeviceData.model" placeholder="请选择规格型号" style="width: 200px" @change="selectAddModel">
<el-select
v-if="hasSetOfMachines"
v-model="editAddDeviceData.model"
placeholder="请选择规格型号"
style="width: 200px"
@change="selectAddModel"
>
<el-option v-for="item in modelList" :key="item.model" :value="item.model"></el-option>
</el-select>
<el-input v-else v-model="editAddDeviceData.model" placeholder="请输入规格型号" style="width: 200px"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -388,11 +412,12 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="editAddDeviceData.objectType == '风电场' ? '装机容量(MW):' : '额定容量(MW):'">
<el-form-item :label="hasSetOfMachines ? '额定容量(MW):' : '装机容量(MW):'">
<el-input-number
:disabled="hasSetOfMachines"
style="width: 200px"
:controls="false"
:placeholder="editAddDeviceData.objectType == '风电场' ? '请输入装机容量' : '请输入额定容量'"
:placeholder="hasSetOfMachines ? '请输入额定容量' : '请输入装机容量'"
v-model="editAddDeviceData.nominalCapacity"
/>
</el-form-item>
@ -464,6 +489,8 @@
:iotModelId="measureData.iotModelId"
:autoUpdate="measureData.autoUpdate"
:attributeType="measureData.measureType"
:madein-factory="measureData.madeinFactory"
:model="measureData.model"
></MeasurementPage>
</div>
</el-dialog>
@ -471,7 +498,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, nextTick, watch } from 'vue'
import { ref, reactive, computed, onMounted, nextTick, watch } from 'vue'
import { Search, CirclePlusFilled, Upload, Download } from '@element-plus/icons-vue'
import {
equipTree,
@ -708,7 +735,7 @@ const addDeviceList = () => {
editAddDeviceData.iotModelId = ''
editAddDeviceData.belongLine = ''
editAddDeviceData.standard = 0
editAddDeviceData.nominalCapacity = null
editAddDeviceData.nominalCapacity = ''
}
//
@ -731,30 +758,34 @@ const editDeviceData = reactive({
id: '',
belongLine: '',
standard: 0,
nominalCapacity: null,
nominalCapacity: '',
})
const modelList = ref<{ model: string; madeinFactory: string }[]>([])
const hasSetOfMachines = computed(() => {
return queryParameter.value.equipmentTypeId === 10002
})
const modelList = ref<{ model: string; madeinFactory: string; nominalCapacity: string }[]>([])
const getModelList = () => {
theoreticalpowerCurveList().then((res) => {
if (res.rows) {
console.log(res);
modelList.value = (res.rows as any[]).map((item: any) => {
return {
model: item.model,
madeinFactory: item.madeinfactory,
nominalCapacity: item.nominalCapacity,
}
})
}
})
}
const selectEditModel = (value:string)=>{
const selectEditModel = (value: string) => {
editDeviceData.madeinFactory = modelList.value.find((item) => item.model == value)?.madeinFactory || ''
editDeviceData.nominalCapacity = modelList.value.find((item) => item.model == value)?.nominalCapacity || ''
}
const selectAddModel = (value:string)=>{
const selectAddModel = (value: string) => {
editAddDeviceData.madeinFactory = modelList.value.find((item) => item.model == value)?.madeinFactory || ''
editAddDeviceData.nominalCapacity = modelList.value.find((item) => item.model == value)?.nominalCapacity || ''
}
const size = ref<'default' | 'large' | 'small'>('default')
@ -912,7 +943,7 @@ const editAddDeviceData = reactive({
iotModelId: '',
belongLine: '',
standard: 0,
nominalCapacity: null,
nominalCapacity: '',
})
const addhandleSwitchChange = (value: any) => {
editAddDeviceData.standard = value ? 1 : 0
@ -1034,16 +1065,22 @@ const measureData = reactive<{
iotModelId: string
autoUpdate: boolean
measureType: ModelAttributeType
madeinFactory: string
model: string
}>({
deviceId: '',
iotModelId: '',
autoUpdate: false,
measureType: 138,
madeinFactory: '',
model: '',
})
const showMeasure = ref(false)
const openMeasure = (data: any) => {
measureData.deviceId = data.row.id
measureData.iotModelId = data.row.iotModelId
measureData.madeinFactory = data.row.madeinFactory
measureData.model = data.row.model
if (measureData.iotModelId) {
showMeasure.value = true
} else {

View File

@ -89,16 +89,21 @@ import { getModelAttributeListReq, getRealValueListReq } from '/@/api/backend/de
import * as echarts from 'echarts'
import { getRealValueRangeReq } from '/@/api/backend/deviceModel/request'
import { useEnumStore } from '/@/stores/enums'
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
import { malFunctionKeys} from '/@/views/backend/equipment/airBlower/utils'
const enumStore = useEnumStore()
const props = withDefaults(
defineProps<{ iotModelId: string; deviceId: string; show: boolean; autoUpdate: boolean; attributeType: ModelAttributeType }>(),
defineProps<{ iotModelId: string; deviceId: string; show: boolean; autoUpdate: boolean; attributeType: ModelAttributeType;model:string;madeinFactory:string }>(),
{
iotModelId: '',
deviceId: '',
show: false,
autoUpdate: false,
attributeType: 138,
model:'',
madeinFactory:''
}
)
@ -204,6 +209,20 @@ const getRealValueList = (data: { deviceId: string; attributes: string[] }, list
})
}
let malFunctionEnums: any = {}
const getMalfunctionEnums = () => {
queryfaultCodeDict({ madeinfactory: props.madeinFactory, model: props.model }).then((res) => {
if (res.code == 200) {
const data: any = {}
res.data.forEach((item: any) => {
data[item.code] = item.description
})
malFunctionEnums = data
}
})
}
const getCompleteData = () => {
getAttributeList()
.then(({ data, codeList }: any) => {
@ -217,6 +236,9 @@ const getCompleteData = () => {
if (enumStore.keys.includes(item.attributeCode)) {
realValItem = enumStore.data[item.attributeCode][realValItem]
}
if(malFunctionKeys.includes(item.attributeCode)){
realValItem = malFunctionEnums?.[realValItem] ?? realValItem
}
return {
...item,
realTimeValue: realValItem
@ -505,6 +527,7 @@ watch(
(newVal) => {
if (newVal) {
getCompleteData()
getMalfunctionEnums()
searchOptions.datePickerValue = shortcuts[0].value()
} else {
autoUpdateTimer.value && clearInterval(autoUpdateTimer.value)

View File

@ -2,7 +2,10 @@
<div class="FanList-content">
<el-row :gutter="10">
<el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="3" v-for="(item, index) in props.parentData" style="margin-bottom: 5px">
<div class="grid-content ep-bg-purple" @click="handleClick(item)">
<div class="grid-content ep-bg-purple"
@click="handleClick(item)"
@contextmenu.prevent="windContextMenu($event,item)"
>
<div class="FanList-panel" :class="item.standard == true ? 'wind-mark' : 'wind-default'">
<div class="fanlist-top">
<span :class="item.standard == true ? 'wind-mark-icon' : 'fanlist-icon'">
@ -71,13 +74,37 @@
</div>
</el-col>
</el-row>
<ContextMenu :pos="contextMenuPos" v-model:visible="OperateVisible">
<template #default>
<div class="modelOperate">
<el-button
class="control-btn"
type="primary"
@click="sendCommand('setTurbineFastStart')"
v-if="realTimeData.iturbineoperationmode !== 16"
>启动</el-button>
<el-button @click="sendCommand('setTurbineStop')" v-else class="control-btn" type="primary">停机</el-button>
<el-button @click="sendCommand('setTurbineResetStatusCode')" class="control-btn" type="primary">复位</el-button>
<el-button
@click="sendManualCommand(1)"
v-if="realTimeData.locked !== 1"
class="control-btn"
type="primary">锁定</el-button>
<el-button @click="sendManualCommand(0)" v-else class="control-btn" type="primary">解锁</el-button>
</div>
</template>
</ContextMenu>
</div>
</template>
<script setup lang="ts">
import { defineProps, defineEmits, onMounted, onUnmounted } from 'vue'
import {defineProps, defineEmits, onMounted, onUnmounted, ref} from 'vue'
import { useRouter } from 'vue-router'
import { adminBaseRoutePath } from '/@/router/static/adminBase'
import ContextMenu from '/@/views/backend/auth/model/contextMenu.vue'
import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request'
import {ElMessage, ElMessageBox} from "element-plus";
const router = useRouter()
const props = defineProps({
@ -126,6 +153,79 @@ const handleClick = (row) => {
},
})
}
const OperateVisible = ref(false)
const contextMenuPos = ref({
x: 0,
y: 0,
})
const realTimeData = ref<any>({
iturbineoperationmode: 1111,
locked: 0,
deviceId: '',
name:''
})
const windContextMenu = (event: any,curnodeData) => {
contextMenuPos.value.x = event.pageX
contextMenuPos.value.y = event.pageY
realTimeData.value.iturbineoperationmode=curnodeData.attributeMap.iturbineoperationmode
realTimeData.value.locked=curnodeData.attributeMap.locked
realTimeData.value.deviceId=curnodeData.irn
realTimeData.value.name=curnodeData.name
OperateVisible.value = true
}
const sendCommand = (type: 'setTurbineFastStart' | 'setTurbineStop' | 'setTurbineResetStatusCode') => {
const sendTypeEnum = {
setTurbineFastStart: '风机快速启动指令',
setTurbineStop: '风机停机指令',
setTurbineResetStatusCode: '风机复位故障代码指令',
}
ElMessageBox.confirm('确认发送' + sendTypeEnum[type] + '吗?', '', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
const serviceName = sendTypeEnum[type]
const optDesc = serviceName + ',设定值为1'
sendCommandReq({
deviceId: realTimeData.value.deviceId as string,
serviceCode: type,
serviceName,
optDesc,
opValue: 1,
}).then((res) => {
if (res.code == 200) {
ElMessage.success('指令发送成功')
} else {
ElMessage.error('指令发送失败')
}
})
})
}
const sendManualCommand = (type: 1 | 0) => {
const serviceName = type === 0 ? '风机解锁' : '风机锁定'
ElMessageBox.confirm('确认' + serviceName + '吗?', '', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
sendManualCommandReq({
deviceId: realTimeData.value.deviceId as string,
serviceCode: 'Locked',
serviceName,
optDesc: serviceName + ',设定值为:' + type,
opValue: type,
}).then((res) => {
if (res.code == 200) {
ElMessage.success('指令发送成功')
} else {
ElMessage.error('指令发送失败')
}
})
})
}
</script>
<style scoped lang="scss">
@ -247,10 +347,10 @@ const handleClick = (row) => {
text-align: center;
top: 5px;
left: 17px;
z-index: 3;
/* z-index: 3;*/
}
.leafs {
z-index: 1;
/* z-index: 1;*/
position: absolute;
/* animation: leafRotate 1s infinite linear;*/
transform-origin: center center;
@ -313,6 +413,17 @@ const handleClick = (row) => {
}
}
}
.modelOperate{
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 80px;
/* height: 80px;*/
.el-button {
margin: 5px;
}
}
}
@media screen and (max-width: 1680px) {

View File

@ -323,8 +323,6 @@ const pageSetting = reactive({
const changePageSetting = () => {}
const getListForAirBlower = () => {
console.log(activeName.value)
const data = {
deviceCode: curTreeData.value.code,
startTime: dayjs(searchData.date[0]).format('YYYY-MM'),

View File

@ -613,6 +613,7 @@ const handleCurrentChange = (val: any) => {
getpowerCurve()
getFaultRecording()
getRunLog()
getfaultCodeDict()
}
const getpowerCurve = () => {
currentRow.value = currentRow.value ?? theoreticalTableData.value[0]