This commit is contained in:
zhouhuang 2024-12-03 20:28:31 +08:00
commit e3b12266cd
18 changed files with 395 additions and 126 deletions

View File

@ -0,0 +1,52 @@
package com.das.modules.calc.functions;
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 FunctionBeginOfDate extends AbstractFunction {
public FunctionBeginOfDate() {
}
@Override
public String getName() {
return "beginOfDate";
}
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject dateData, AviatorObject dimData) {
Date date = (Date) dateData.getValue(env);
String dim = (String) dimData.getValue(env);
Date result = null;
switch (dim) {
case "day":
result = DateUtil.beginOfDay(date);
break;
case "week":
result = DateUtil.beginOfWeek(date);
break;
case "month":
result = DateUtil.beginOfMonth(date);
break;
case "year":
result = DateUtil.beginOfYear(date);
break;
default:
log.error("不支持的维度: {}", dim);
}
return AviatorRuntimeJavaType.valueOf(result);
}
}

View File

@ -0,0 +1,52 @@
package com.das.modules.calc.functions;
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 FunctionEndOfDate extends AbstractFunction {
public FunctionEndOfDate() {
}
@Override
public String getName() {
return "endOfDate";
}
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject dateData, AviatorObject dimData) {
Date date = (Date) dateData.getValue(env);
String dim = (String) dimData.getValue(env);
Date result = null;
switch (dim) {
case "day":
result = DateUtil.endOfDay(date);
break;
case "week":
result = DateUtil.endOfWeek(date);
break;
case "month":
result = DateUtil.endOfMonth(date);
break;
case "year":
result = DateUtil.endOfYear(date);
break;
default:
log.error("不支持的维度: {}", dim);
}
return AviatorRuntimeJavaType.valueOf(result);
}
}

View File

@ -6,10 +6,7 @@ import com.das.common.utils.AdminRedisTemplate;
import com.das.modules.cache.service.CacheService; import com.das.modules.cache.service.CacheService;
import com.das.modules.calc.domain.entity.CalcModule; import com.das.modules.calc.domain.entity.CalcModule;
import com.das.modules.calc.domain.vo.CalcModuleVo; import com.das.modules.calc.domain.vo.CalcModuleVo;
import com.das.modules.calc.functions.FunctionCacheValue; import com.das.modules.calc.functions.*;
import com.das.modules.calc.functions.FunctionRealData;
import com.das.modules.calc.functions.FunctionSaveCalcData;
import com.das.modules.calc.functions.FunctionSumValue;
import com.das.modules.calc.mapper.CalcModuleMapper; import com.das.modules.calc.mapper.CalcModuleMapper;
import com.das.modules.data.service.DataService; import com.das.modules.data.service.DataService;
import com.googlecode.aviator.AviatorEvaluator; import com.googlecode.aviator.AviatorEvaluator;
@ -125,6 +122,12 @@ public class CalcService {
FunctionSumValue sumv = new FunctionSumValue(dataService, cacheService); FunctionSumValue sumv = new FunctionSumValue(dataService, cacheService);
aviator.addFunction(sumv); aviator.addFunction(sumv);
FunctionBeginOfDate beginOfDate = new FunctionBeginOfDate();
aviator.addFunction(beginOfDate);
FunctionEndOfDate endOfDate = new FunctionEndOfDate();
aviator.addFunction(endOfDate);
} }
/** /**

View File

@ -363,14 +363,13 @@ public class SysNodeServiceImpl implements SysNodeService {
List<SysTabMappingVo> discrete = impList.stream().filter(item -> collect.get(item.getId()) == 140).collect(Collectors.toList()); List<SysTabMappingVo> discrete = impList.stream().filter(item -> collect.get(item.getId()) == 140).collect(Collectors.toList());
List<SysTabMappingVo> setPoint = impList.stream().filter(item -> collect.get(item.getId()) == 146).collect(Collectors.toList()); List<SysTabMappingVo> setPoint = impList.stream().filter(item -> collect.get(item.getId()) == 146).collect(Collectors.toList());
List<SysTabMappingVo> control = impList.stream().filter(item -> collect.get(item.getId()) == 147).collect(Collectors.toList()); List<SysTabMappingVo> control = impList.stream().filter(item -> collect.get(item.getId()) == 147).collect(Collectors.toList());
//校验param里面order不重复
if (checkOrderRepeated(analogList) || checkOrderRepeated(accumulator) || checkOrderRepeated(discrete) || checkOrderRepeated(setPoint) || checkOrderRepeated(control)){ if (checkOrderRepeated(analogList) || checkOrderRepeated(accumulator) || checkOrderRepeated(discrete) || checkOrderRepeated(setPoint) || checkOrderRepeated(control)){
throw new ServiceException("检查顺序,排序不能重复"); throw new ServiceException("检查顺序,排序不能重复");
} }
} }
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY); SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
for (SysTabMappingVo imp : impList) { for (SysTabMappingVo imp : impList) {
//校验param里面order不重复
SysTabMapping rec = sysImptabmappingMapper.selectById(imp.getId()); SysTabMapping rec = sysImptabmappingMapper.selectById(imp.getId());
rec.setUpdatedTime(new Date()); rec.setUpdatedTime(new Date());
rec.setUpdatedBy(sysUserVo.getAccount()); rec.setUpdatedBy(sysUserVo.getAccount());

View File

@ -78,9 +78,6 @@ public class StatisticalAnalysisServiceImpl implements StatisticalAnalysisServic
*/ */
@Override @Override
public void trendAnalyseExport(List<TrendAnalyseDto> param, HttpServletRequest request, HttpServletResponse response) { public void trendAnalyseExport(List<TrendAnalyseDto> param, HttpServletRequest request, HttpServletResponse response) {
if (param == null || param.isEmpty()) {
throw new ServiceException("参数列表不能为空");
}
//根据条件获取历史数据 //根据条件获取历史数据
List<Map<String, Map<String, Map<String, Object>>>> mapsList = new ArrayList<>(); List<Map<String, Map<String, Map<String, Object>>>> mapsList = new ArrayList<>();
for (TrendAnalyseDto trendAnalyseDto : param) { for (TrendAnalyseDto trendAnalyseDto : param) {
@ -271,12 +268,22 @@ public class StatisticalAnalysisServiceImpl implements StatisticalAnalysisServic
*/ */
private void setTrendContrastExcelValue(Map<String, Map<String, Map<String, Object>>> maps, private void setTrendContrastExcelValue(Map<String, Map<String, Map<String, Object>>> maps,
List<Map<String, Object>> dataList) { List<Map<String, Object>> dataList) {
Map<String,Integer> mapKey = new HashMap<>();
int num =1;
int flagNum = 0;
for (Map.Entry<String, Map<String, Map<String, Object>>> stringMapEntry : maps.entrySet()) { for (Map.Entry<String, Map<String, Map<String, Object>>> stringMapEntry : maps.entrySet()) {
int flagNum = 0;
for (Map.Entry<String, Map<String, Object>> mapEntry : stringMapEntry.getValue().entrySet()) { for (Map.Entry<String, Map<String, Object>> mapEntry : stringMapEntry.getValue().entrySet()) {
List<String> timesListstr = new ArrayList<>(); List<String> timesListstr = new ArrayList<>();
List<Double> valuesList = new ArrayList<>(); List<Double> valuesList = new ArrayList<>();
String key = mapEntry.getKey(); String key = mapEntry.getKey();
if (mapKey.containsKey(key)){
num++;
String str = key + num;
mapKey.put(str, num );
key=str;
}else {
mapKey.put(key, num);
}
for (Map.Entry<String, Object> stringObjectEntry : mapEntry.getValue().entrySet()) { for (Map.Entry<String, Object> stringObjectEntry : mapEntry.getValue().entrySet()) {
String key1 = stringObjectEntry.getKey(); String key1 = stringObjectEntry.getKey();
if (key1.equals("times")) { if (key1.equals("times")) {
@ -345,12 +352,21 @@ public class StatisticalAnalysisServiceImpl implements StatisticalAnalysisServic
for (SnapshotValueQueryParam device : param.getDevices()) { for (SnapshotValueQueryParam device : param.getDevices()) {
strList.addAll(device.getAttributes()); strList.addAll(device.getAttributes());
} }
QueryWrapper<SysIotModelField> queryWrapper = new QueryWrapper<>(); int num =1;
queryWrapper.in("attribute_code", strList); for (String code : strList) {
List<SysIotModelField> sysIotModelFields = sysIotModelFieldMapper.selectVoList(queryWrapper); QueryWrapper<SysIotModelField> queryWrapper = new QueryWrapper<>();
for (SysIotModelField sysIotModelField : sysIotModelFields) { queryWrapper.eq("attribute_code", code);
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getAttributeName()); List<SysIotModelField> sysIotModelFields = sysIotModelFieldMapper.selectVoList(queryWrapper);
for (SysIotModelField sysIotModelField : sysIotModelFields) {
if (map.containsKey(sysIotModelField.getAttributeCode())){
num++;
map.put(sysIotModelField.getAttributeCode()+num, sysIotModelField.getAttributeName()+num );
}else {
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getAttributeName());
}
}
} }
return map; return map;
} }

View File

@ -27,8 +27,8 @@ public class TemperatureDashboardServiceImpl implements TemperatureDashboardServ
String params = mapping.getParams(); String params = mapping.getParams();
if (params != null && !params.isEmpty()) { if (params != null && !params.isEmpty()) {
JSONObject json = JSONObject.parseObject(params); JSONObject json = JSONObject.parseObject(params);
String code = json.getString("measPointCode"); String code = mapping.getMeasPointCode();
String name = json.getString("measPointName"); String name = mapping.getMeasPointName();
Double limit1High=0.0; Double limit1High=0.0;
Double limit1Low=0.0; Double limit1Low=0.0;
Double limit2High=0.0; Double limit2High=0.0;

View File

@ -28,13 +28,13 @@
<if test="info.attributeType != null and info.attributeType != ''"> <if test="info.attributeType != null and info.attributeType != ''">
and t.attribute_type = #{info.attributeType} and t.attribute_type = #{info.attributeType}
</if> </if>
<if test="info.orderColumn != null and info.orderType != ''">
order by ${info.orderColumn} ${info.orderType}
</if>
<if test="info.orderColumn == null or info.orderColumn == '' or info.orderType == null or info.orderType == ''">
order by t.porder asc
</if>
</where> </where>
<if test="info.orderColumn != null and info.orderType != ''">
order by ${info.orderColumn} ${info.orderType}
</if>
<if test="info.orderColumn == null or info.orderColumn == '' or info.orderType == null or info.orderType == ''">
order by t.porder asc
</if>
</select> </select>
<select id="querySysIotModelFieldByModelId" resultType="java.lang.Long"> <select id="querySysIotModelFieldByModelId" resultType="java.lang.Long">

View File

@ -8,6 +8,7 @@ export const getAirBlowerListReq = () => {
belongLine: string belongLine: string
irn: string irn: string
madeinfactory: string madeinfactory: string
deviceCode: string
model: string model: string
modelId: string modelId: string
name: string name: string

View File

@ -35,7 +35,9 @@
<div class="cardContentLeft"> <div class="cardContentLeft">
<!--实时预览--> <!--实时预览-->
<div class="overview"> <div class="overview">
<div class="cardLabel">实时预览</div> <div class="cardLabel">
{{ '名称:' + route.query.name + '&nbsp;&nbsp;&nbsp;&nbsp;' + '型号:' + route.query.model }}
</div>
<div class="overviewDataSection" ref="listContainer"> <div class="overviewDataSection" ref="listContainer">
<div class="overviewDataSectionItem"> <div class="overviewDataSectionItem">
<span class="realLeft">机组运行状态</span> <span class="realLeft">机组运行状态</span>
@ -101,6 +103,14 @@
<div class="cardContentCenter"> <div class="cardContentCenter">
<!--风机控制--> <!--风机控制-->
<div class="controlBackgroundImg"> <div class="controlBackgroundImg">
<div class="switchWindBlower">
<el-tooltip :content="beforeAirBlower.name">
<el-icon color="#fff" size="30" @click="switchAirblower(0)"><ArrowLeftBold /></el-icon>
</el-tooltip>
<el-tooltip :content="afterAirBlower.name">
<el-icon color="#fff" size="30" @click="switchAirblower(1)"><ArrowRightBold /></el-icon>
</el-tooltip>
</div>
<div class="control-type"> <div class="control-type">
<el-tag v-if="realTimeData.locked === 1" class="control-tag control-tag-left" type="primary">已锁定</el-tag> <el-tag v-if="realTimeData.locked === 1" class="control-tag control-tag-left" type="primary">已锁定</el-tag>
<el-tag class="control-tag" type="primary">{{ realTimeDataState }}</el-tag> <el-tag class="control-tag" type="primary">{{ realTimeDataState }}</el-tag>
@ -305,25 +315,27 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, onActivated, onMounted, reactive, ref, computed, onBeforeMount, onUnmounted, VNode, VNodeRef } from 'vue' import { nextTick, onActivated, onMounted, reactive, ref, computed, watch, onBeforeMount, onUnmounted, VNode, VNodeRef } from 'vue'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { useEventListener } from '@vueuse/core' import { useEventListener } from '@vueuse/core'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { DArrowRight } from '@element-plus/icons-vue' import { DArrowRight, ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue'
import { getRealValueListReq, getRealValueRangeReq } from '/@/api/backend/deviceModel/request' import { getRealValueListReq, getRealValueRangeReq } from '/@/api/backend/deviceModel/request'
import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request' import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request'
import { useRoute } from 'vue-router' import { getAirBlowerListReq } from '/@/api/backend/airBlower/request'
import { useRoute, useRouter } from 'vue-router'
import Overview from './overview.vue' import Overview from './overview.vue'
import { TableInstance } from 'element-plus' import { TableInstance } from 'element-plus'
import { dayjs, ElMessage, ElMessageBox } from 'element-plus' import { dayjs, ElMessage, ElMessageBox } from 'element-plus'
import { getRealTimeState, getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils' import { getRealTimeState, getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils'
import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request' import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request'
import { getAlarmListReq } from '/@/api/backend/alarms/request' import { getAlarmListReq } from '/@/api/backend/alarms/request'
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
import { useEnumStore } from '/@/stores/enums' import { useEnumStore } from '/@/stores/enums'
const enumStore = useEnumStore() const enumStore = useEnumStore()
const route = useRoute() const route = useRoute()
const router = useRouter()
const { t } = useI18n() const { t } = useI18n()
const windBlower = ref() const windBlower = ref()
@ -400,8 +412,9 @@ const initpowerChart = () => {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow', type: 'line',
}, },
show: true,
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@ -602,7 +615,7 @@ const initTrendChart = (type: 'day' | 'month') => {
top: 30, top: 30,
right: 10, right: 10,
bottom: 20, bottom: 20,
left: 45, left: 100,
borderColor: '#dadada', borderColor: '#dadada',
}, },
tooltip: { tooltip: {
@ -1025,6 +1038,9 @@ const createRealTimeData = async () => {
if (enumStore.keys.includes(item.attributeCode)) { if (enumStore.keys.includes(item.attributeCode)) {
val = enumStore.data[item.attributeCode][val] val = enumStore.data[item.attributeCode][val]
} }
if (malFunctionKeys.includes(item.attributeCode)) {
val = malFunctionEnums?.[item.attributeCode] ?? val
}
if (sigleDataKeys.includes(item.attributeCode.toLowerCase())) { if (sigleDataKeys.includes(item.attributeCode.toLowerCase())) {
realTimeDataForSingle.value[item.attributeCode.toLowerCase()] = val === '-' ? val : val realTimeDataForSingle.value[item.attributeCode.toLowerCase()] = val === '-' ? val : val
} }
@ -1054,7 +1070,7 @@ const createRealTimeData = async () => {
realDataForSub[index].type138.push(showData) realDataForSub[index].type138.push(showData)
} else if (item.attributeType === 140) { } else if (item.attributeType === 140) {
const copyData = { const copyData = {
name: item.attributeName +' '+ item.attributeCode, name: item.attributeCode + ' ' + item.attributeName,
value: showData.value, value: showData.value,
} }
realDataForSub[index].type140.push(copyData) realDataForSub[index].type140.push(copyData)
@ -1150,6 +1166,7 @@ const getChartData = <T extends string = any>(params: {
getRealValueRangeReq(data).then((res) => { getRealValueRangeReq(data).then((res) => {
if (res.success) { if (res.success) {
const data = res.data[route.query.irn as string] const data = res.data[route.query.irn as string]
if (!data) return
const rangeKeys = Object.keys(data) const rangeKeys = Object.keys(data)
const times: any = {} const times: any = {}
const val: any = {} const val: any = {}
@ -1338,7 +1355,91 @@ const getAlarmList = () => {
} }
}) })
} }
getAlarmList()
const malFunctionKeys = [
'ActiveStatusCode01',
'ActiveStatusCode02',
'ActiveStatusCode03',
'ActiveStatusCode04',
'ActiveStatusCode05',
'ActiveStatusCode06',
'ActiveStatusCode07',
'ActiveStatusCode08',
'FirstTriggeredCode',
]
const 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
})
}
})
}
const airBlowerList = ref<
{
irn: string
model: string
name: string
deviceCode: string
iotModelId: string
madeinfactory: string
}[]
>([])
const getAirBlowerList = () => {
return getAirBlowerListReq().then((res) => {
if (res.success) {
airBlowerList.value = res.data.map((item) => {
return {
irn: item.irn,
model: item.model,
name: item.name,
deviceCode: item.deviceCode,
iotModelId: item.modelId,
madeinfactory: item.madeinfactory,
}
})
return
}
})
}
const beforeAirBlower = computed(() => {
const len = airBlowerList.value.length
if (len === 0) return { irn: '', model: '', name: '', deviceCode: '', iotModelId: '' }
const curIndex = airBlowerList.value.findIndex((item) => item.irn === route.query.irn)
if (curIndex === 0) return airBlowerList.value[len - 1]
return airBlowerList.value[curIndex - 1]
})
const afterAirBlower = computed(() => {
const len = airBlowerList.value.length
if (len === 0) return { irn: '', model: '', name: '', deviceCode: '', iotModelId: '' }
const curIndex = airBlowerList.value.findIndex((item) => item.irn === route.query.irn)
if (curIndex === len - 1) return airBlowerList.value[0]
return airBlowerList.value[curIndex + 1]
})
const switchAirblower = (type: 0 | 1) => {
const data = type === 0 ? beforeAirBlower.value : afterAirBlower.value
const query = {
irn: data.irn,
iotModelId: data.iotModelId,
deviceCode: data.deviceCode,
model: data.model,
name: data.name,
}
router.push({
name: 'windTurbine',
query,
})
}
onMounted(() => { onMounted(() => {
window.addEventListener('resize', sizeChange) window.addEventListener('resize', sizeChange)
sizeChange() sizeChange()
@ -1346,6 +1447,10 @@ onMounted(() => {
createScroll() createScroll()
useEventListener(window, 'resize', echartsResize) useEventListener(window, 'resize', echartsResize)
autoUpdate() autoUpdate()
getAlarmList()
getAirBlowerList().then(() => {
getMalfunctionEnums()
})
}) })
onUnmounted(() => { onUnmounted(() => {
@ -1356,8 +1461,32 @@ onUnmounted(() => {
const chartKeys = Object.keys(state.charts) as Array<keyof typeof state.charts> const chartKeys = Object.keys(state.charts) as Array<keyof typeof state.charts>
chartKeys.forEach((key) => { chartKeys.forEach((key) => {
state.charts[key] && state.charts[key].dispose() state.charts[key] && state.charts[key].dispose()
state.charts[key] = null
}) })
}) })
watch(
() => route.query.irn,
() => {
autoUpdateForSecondTimer && clearInterval(autoUpdateForSecondTimer)
autoUpdateForSecondTimer = null
autoUpdateTimerForHourTimer && clearInterval(autoUpdateTimerForHourTimer)
autoUpdateTimerForHourTimer = null
autoUpdateTimerForMinuteTimer && clearInterval(autoUpdateTimerForMinuteTimer)
autoUpdateTimerForMinuteTimer = null
const chartKeys = Object.keys(state.charts) as Array<keyof typeof state.charts>
chartKeys.forEach((key) => {
state.charts[key] && state.charts[key].dispose()
state.charts[key] = null
})
nextTick(() => {
autoUpdate()
getAlarmList()
getAllChartData()
})
}
)
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -1515,6 +1644,28 @@ $labelHeight: 38px;
aspect-ratio: 43 / 24; aspect-ratio: 43 / 24;
background: url('/@/assets/WindBlower/bg.png') no-repeat; background: url('/@/assets/WindBlower/bg.png') no-repeat;
background-size: contain; background-size: contain;
&:hover {
.switchWindBlower {
opacity: 1;
}
}
.switchWindBlower {
position: absolute;
left: 50%;
top: 5%;
transform: translateX(-50%);
width: 100px;
height: 40px;
// background-color: red;
opacity: 0;
display: flex;
justify-content: space-between;
transition: opacity 0.4s;
.el-icon:hover {
cursor: pointer;
color: rgba(255, 255, 255, 0.7);
}
}
.control-type { .control-type {
width: 100%; width: 100%;
display: flex; display: flex;

View File

@ -1,16 +1,18 @@
<template> <template>
<div class="overviewWrap"> <div class="overviewWrap">
<div class="dialogContent"> <div class="dialogContent">
<div class="PitchPart"> <el-scrollbar>
<el-row> <div class="PitchPart">
<el-col :span="12" v-for="item in showData" :key="item.name"> <el-row>
<div class="Pitchitem"> <el-col :span="12" v-for="item in showData" :key="item.name">
<span class="PitchitemLeft">{{ item.name }}</span> <div class="Pitchitem">
<span class="PitchitemRight">{{ item.value }}</span> <span class="PitchitemLeft">{{ item.name }}</span>
</div> <span class="PitchitemRight">{{ item.value }}</span>
</el-col> </div>
</el-row> </el-col>
</div> </el-row>
</div>
</el-scrollbar>
</div> </div>
<div class="footer"> <div class="footer">
<el-pagination <el-pagination
@ -71,15 +73,13 @@ onMounted(() => {
<style scoped lang="scss"> <style scoped lang="scss">
.dialogContent { .dialogContent {
width: 100%; width: 100%;
max-height: 540px; height: 540px;
overflow-x: hidden;
overflow-y: auto;
.PitchPart { .PitchPart {
.Pitchitem { .Pitchitem {
border: 1px solid #e1edf6; border: 1px solid #e1edf6;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-left: 15px; // margin-left: 15px;
width: 100%; width: 100%;
height: 100%; height: 100%;
.PitchitemLeft { .PitchitemLeft {

View File

@ -655,6 +655,8 @@ const openWindTurbine = (row: TableDataObjType) => {
irn: row.irn, irn: row.irn,
iotModelId: row.iotModelId, iotModelId: row.iotModelId,
deviceCode: row.deviceCode, deviceCode: row.deviceCode,
model: row.model,
name:row.name
}, },
}) })
} }

View File

@ -117,8 +117,6 @@ const defaultList = [
//#endregion //#endregion
const selectList = ref([]) const selectList = ref([])
const changeCheck = () => { const changeCheck = () => {
console.log('-----------------------------------', timer, selectList.value)
if (!timer && selectList.value[0]) { if (!timer && selectList.value[0]) {
createTimer() createTimer()
} }

View File

@ -39,6 +39,7 @@ export type TableColumnType = {
align?: 'left' | 'right' | 'center' align?: 'left' | 'right' | 'center'
custom?: 'header' | 'default' custom?: 'header' | 'default'
type?: 'default' | 'selection' | 'index' | 'expand' type?: 'default' | 'selection' | 'index' | 'expand'
sortable?:boolean
} }
export type CommandReqType = { export type CommandReqType = {

View File

@ -126,6 +126,8 @@ const handleDoubleClick = (row) => {
irn: row.irn, irn: row.irn,
iotModelId: row.modelId, iotModelId: row.modelId,
name: row.name, name: row.name,
deviceCode: row.deviceCode,
model: row.model,
}, },
}) })
} }

View File

@ -125,6 +125,8 @@ const handleClick = (row) => {
irn: row.irn, irn: row.irn,
iotModelId: row.modelId, iotModelId: row.modelId,
deviceCode: row.deviceCode, deviceCode: row.deviceCode,
name: row.name,
model: row.model,
}, },
}) })
} }

View File

@ -466,11 +466,11 @@ const readFile = (data: tableItemData) => {
attrName.forEach((item) => { attrName.forEach((item) => {
if (item === 'TimeStamp') { if (item === 'TimeStamp') {
previewChartData.TimeStamp = previewChartData.TimeStamp.map((item: any) => { previewChartData.TimeStamp = previewChartData.TimeStamp.map((item: any) => {
return dayjs(item).format('YYYY-MM-DD HH:mm:ss') return dayjs(item).format('YYYY-MM-DD HH:mm:ss.SSS')
}) })
} else if (item === 'TimeStampUTC') { } else if (item === 'TimeStampUTC') {
previewChartData.TimeStamp = previewChartData.TimeStampUTC.map((item: any) => { previewChartData.TimeStamp = previewChartData.TimeStampUTC.map((item: any) => {
return dayjs(item).format('YYYY-MM-DD HH:mm:ss') return dayjs(item).format('YYYY-MM-DD HH:mm:ss.SSS')
}) })
} else { } else {
data.push({ data.push({
@ -625,7 +625,7 @@ const initPreviewChart = () => {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow', type: 'line',
}, },
}, },
xAxis: { xAxis: {

View File

@ -286,16 +286,16 @@ export const excelDefaultConfig: any = {
}, },
], ],
R0C4: [ R0C4: [
"32位浮点数(高位在第一个寄存器)", "1、32位浮点数(高位在第一个寄存器)",
"32位浮点数(高位在第二个寄存器)", "2、32位浮点数(高位在第二个寄存器)",
"16位归一化值", "2、16位归一化值",
"32位归一化值(高位在第一个寄存器)", "4、32位归一化值(高位在第一个寄存器)",
"32位归一化值(高位在第二个寄存器)", "5、32位归一化值(高位在第二个寄存器)",
"32位浮点数(小端系统模式)", "6、32位浮点数(小端系统模式)",
"32位BCD数据*高位在第一个寄存器*", "7、32位BCD数据*高位在第一个寄存器*",
"32位BCD数据*高位在第二个寄存器*", "8、32位BCD数据*高位在第二个寄存器*",
"16位BCD数据", "9、16位BCD数据",
"8位归一化值" "10、8位归一化值"
], // 数据类型的提示 ], // 数据类型的提示
}, },
//遥控147 CONTROL //遥控147 CONTROL
@ -603,6 +603,8 @@ export const createUpLoadExcelData = (workbookData: any) => {
} }
sheetData.params = JSON.stringify(params) sheetData.params = JSON.stringify(params)
data.push(sheetData) data.push(sheetData)
console.log(data);
} }
}) })
}) })
@ -622,10 +624,10 @@ export const createSheetData = (data: any, protocol: string | number) => {
const result: any = {} const result: any = {}
data[item].forEach((obj: any, index: number) => { data[item].forEach((obj: any, index: number) => {
const params = obj.params && obj.params !== '' ? JSON.parse(obj.params) : {} const params = obj.params && obj.params !== '' ? JSON.parse(obj.params) : {}
obj = { ...obj, ...params } const newObj = { ...obj, ...params }
const row = index + 1 const row = index + 1
result[row] = {} result[row] = {}
Object.keys(obj).forEach((field) => { Object.keys(newObj).forEach((field) => {
const col = excelCellDataMap[field] const col = excelCellDataMap[field]
if (col) { if (col) {
let custom: any let custom: any
@ -635,7 +637,7 @@ export const createSheetData = (data: any, protocol: string | number) => {
custom.protocol = Number(protocol) custom.protocol = Number(protocol)
custom.otherData = obj custom.otherData = obj
} }
result[row][col] = { v: obj[field], s: '1', custom } result[row][col] = { v: newObj[field], s: '1', custom }
} }
}) })
}) })

View File

@ -17,18 +17,18 @@
:row-key="getRowKey" :row-key="getRowKey"
:span-method="objectSpanMethod" :span-method="objectSpanMethod"
class="tablePart"> class="tablePart">
<el-table-column type="selection" width="55"/> <!-- <el-table-column type="selection" width="55"/>-->
<el-table-column prop="name" label="风机名称" align="center"> </el-table-column> <el-table-column prop="name" label="风机名称" align="center"> </el-table-column>
<el-table-column prop="windspeedvalue" label="风速" align="center"> </el-table-column> <el-table-column prop="windspeedvalue" label="风速" align="center"> </el-table-column>
<el-table-column prop="factorK" label="系数K" align="center"> </el-table-column> <el-table-column prop="factorK" label="系数K" align="center"> </el-table-column>
<el-table-column prop="factorB" label="系数B" align="center"> </el-table-column> <el-table-column prop="factorB" label="系数B" align="center"> </el-table-column>
<el-table-column label="操作" width="400" align="center"> <!-- <el-table-column label="操作" width="400" align="center">
<template #default="scope"> <template #default="scope">
<div class="tableOperate"> <div class="tableOperate">
<a @click="viewDetails(scope.row)">查看</a> <a @click="viewDetails(scope.row)">查看</a>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>-->
</el-table> </el-table>
<div style="display: flex; justify-content: right"> <div style="display: flex; justify-content: right">
<el-pagination <el-pagination
@ -45,52 +45,6 @@
</div> </div>
</el-main> </el-main>
</el-container> </el-container>
<el-dialog v-model="dialogOpen" title="查看参数" width="500">
<el-from
ref="formRef"
:inline="true"
label-width="auto"
:model="fromUpDate"
style="padding: 5px 15px; line-height: 1.5; word-wrap: break-word;">
<el-row>
<el-col :span="24">
<el-form-item label="风机名称:">
<el-input v-model="fromUpDate.name" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="&nbsp;&nbsp;&nbsp;最小值:">
<el-input v-model="fromUpDate.speedMin" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="&nbsp;&nbsp;&nbsp;最大值:">
<el-input v-model="fromUpDate.speedMax" disabled></el-input>
</el-form-item>
</el-col>
<!-- <el-col :span="24">
<el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;风速:">
<el-input v-model="fromUpDate.windspeedvalue" disabled></el-input>
</el-form-item>
</el-col>-->
<el-col :span="12">
<el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;系数K:">
<el-input v-model="fromUpDate.factorK" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;系数B:">
<el-input v-model="fromUpDate.factorB" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
</el-from>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogOpen = false">取消</el-button>
</div>
</template>
</el-dialog>
</div> </div>
</template> </template>
@ -101,8 +55,10 @@ import {powerCurveQuery,powerImport,powerExport} from "/@/api/backend/powerCurve
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { encrypt_aes, generateRandomNumber } from '/@/utils/crypto' import { encrypt_aes, generateRandomNumber } from '/@/utils/crypto'
import type { TableColumnCtx } from 'element-plus' import type { TableColumnCtx } from 'element-plus'
import { dataMethods } from './utils'
/*interface User {
interface User {
id:string, id:string,
turbineId:string, turbineId:string,
name:string, name:string,
@ -110,7 +66,9 @@ import type { TableColumnCtx } from 'element-plus'
speedMin:string, speedMin:string,
speedMax:string, speedMax:string,
factorK:string, factorK:string,
factorB:string factorB:string,
NameIndex:string,
count:number
} }
interface SpanMethodProps { interface SpanMethodProps {
@ -119,18 +77,28 @@ interface SpanMethodProps {
rowIndex: number rowIndex: number
columnIndex: number columnIndex: number
} }
const objectSpanMethod = ({
row, const objectSpanMethod = ({row, column, rowIndex, columnIndex,}: SpanMethodProps) => {
column, /*if (columnIndex === 0) {
rowIndex, if (rowIndex % 7 === 0) {
columnIndex, return {
}: SpanMethodProps) => { rowspan: 7,
colspan: 1,
};
} else {
return {
rowspan: 0,
colspan: 0,
};
}
}*/
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex % 2 === 0) { if (row.NameIndex === 1) {
return { return {
rowspan: 2, rowspan: row.count,
colspan: 1, colspan: 1,
} };
} else { } else {
return { return {
rowspan: 0, rowspan: 0,
@ -138,8 +106,26 @@ const objectSpanMethod = ({
} }
} }
} }
}*/ }
const tableData=ref([]) const tableData=ref([])
let obj = {}
const formatData = (list) => {
obj = {}
list.forEach(item => {
let count = list.filter(listItem => listItem.name === item.name).length
if (obj[item.name] ) {
obj[item.name]++
} else {
obj[item.name] = 1
}
item.NameIndex = obj[item.name]
item.count = count
})
tableData.value = list
}
const formQuery = reactive({ const formQuery = reactive({
pageSize: 20, pageSize: 20,
@ -163,7 +149,7 @@ const getTableData = (formQuery) => {
powerCurveQuery(formQuery).then((res: any) => { powerCurveQuery(formQuery).then((res: any) => {
if (res.code == 200) { if (res.code == 200) {
pageTotal.value = res.data.total pageTotal.value = res.data.total
tableData.value = (res.data.rows || []).map((item: { speedMin?: number | string; speedMax?: number | string }) => { tableData.value = res.data.rows.map((item: { speedMin?: number | string; speedMax?: number | string }) => {
const speedMin = item.speedMin ?? ''; const speedMin = item.speedMin ?? '';
const speedMax = item.speedMax ?? ''; const speedMax = item.speedMax ?? '';
if(speedMax==''){ if(speedMax==''){
@ -179,6 +165,7 @@ const getTableData = (formQuery) => {
} }
}); });
formatData(tableData.value)
} else { } else {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
@ -256,6 +243,7 @@ const Export = () => {
document.body.removeChild(a) document.body.removeChild(a)
}) })
} }
onMounted(() => { onMounted(() => {
getTableData(formQuery) getTableData(formQuery)
}) })