Merge remote-tracking branch 'origin/main'

This commit is contained in:
houwei 2024-10-25 13:50:02 +08:00
commit 8247e8c668
23 changed files with 1998 additions and 372 deletions

View File

@ -53,12 +53,12 @@ public class DataService {
//为空查全部
List<String> sysIotModelFields = sysIotModelFieldMapper.queryAllFiledNames(Long.valueOf(snapshotValueQueryParam.getDeviceId()));
for (String item : sysIotModelFields) {
String key = String.format("RT:%s:%s", snapshotValueQueryParam.getDeviceId(), item);
String key = String.format("RT:%s:%s", snapshotValueQueryParam.getDeviceId(), item.toLowerCase());
keyList.add(key);
}
} else {
for (String item : attributes) {
String key = String.format("RT:%s:%s", snapshotValueQueryParam.getDeviceId(), item);
String key = String.format("RT:%s:%s", snapshotValueQueryParam.getDeviceId(), item.toLowerCase());
keyList.add(key);
}
}

View File

@ -8,6 +8,7 @@ import com.das.modules.equipment.domain.excel.SysEquipmentExcel;
import com.das.modules.equipment.domain.vo.BaseImptabmappingVo;
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
import com.das.modules.equipment.entity.SysEquipment;
import com.das.modules.page.domian.WindTurbinesPageVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -40,4 +41,7 @@ public interface SysEquipmentMapper extends BaseMapperPlus<SysEquipment, SysEqui
SysEquipmentVo queryEquipmentInfoByCode(@Param("code")String code);
List<String> queryBelongLines(@Param("objectType") Long objectType);
List<WindTurbinesPageVo> queryAllWindList(@Param("objectType") Long objectType);
}

View File

@ -418,33 +418,33 @@ public class SysIotModelServiceImpl implements SysIotModelService {
}
if (CollectionUtils.isNotEmpty(sysIotModelFieldList)) {
sysIotModelFieldMapper.insertBatch(sysIotModelFieldList);
ListUtil.page(sysIotModelFieldList, COMMIT_COUNT, create -> {
for (SysIotModelField item : create){
createTdStableOrColumn(item);
}
});
// ListUtil.page(sysIotModelFieldList, COMMIT_COUNT, create -> {
// for (SysIotModelField item : create){
// createTdStableOrColumn(item);
// }
// });
}
if (CollectionUtils.isNotEmpty(updateSysIotModelFieldList)) {
ListUtil.page(updateSysIotModelFieldList, COMMIT_COUNT, update -> {
for (SysIotModelField item : update){
SysIotModelField oldSysIotField = sysIotModelFieldMapper.selectById(item.getId());
if (oldSysIotField != null){
if (!oldSysIotField.getAttributeCode().equals(item.getAttributeCode()) && oldSysIotField.getDataType().equals(item.getDataType()) && Objects.equals(oldSysIotField.getHighSpeed(), item.getHighSpeed())){
//更新td表结构
updateTDStableOrColumn(item,oldSysIotField);
}
}
}
});
// ListUtil.page(updateSysIotModelFieldList, COMMIT_COUNT, update -> {
// for (SysIotModelField item : update){
// SysIotModelField oldSysIotField = sysIotModelFieldMapper.selectById(item.getId());
// if (oldSysIotField != null){
// if (!oldSysIotField.getAttributeCode().equals(item.getAttributeCode()) && oldSysIotField.getDataType().equals(item.getDataType()) && Objects.equals(oldSysIotField.getHighSpeed(), item.getHighSpeed())){
// //更新td表结构
// updateTDStableOrColumn(item,oldSysIotField);
// }
// }
// }
// });
sysIotModelFieldMapper.updateBatchById(updateSysIotModelFieldList);
}
if (CollectionUtils.isNotEmpty(delSysIotModelFieldList)) {
ListUtil.page(updateSysIotModelFieldList, COMMIT_COUNT, delete -> {
for (SysIotModelField item : delete){
deleteTDStableOrColumn(item);
}
});
// ListUtil.page(updateSysIotModelFieldList, COMMIT_COUNT, delete -> {
// for (SysIotModelField item : delete){
// deleteTDStableOrColumn(item);
// }
// });
sysIotModelFieldMapper.deleteBatchIds(delSysIotModelFieldList);
}
}

View File

@ -245,7 +245,7 @@ public class DataServiceImpl implements DataService {
Iterator<String> keysHigh = values.fieldNames();
while (keysHigh.hasNext()) {
String fieldName = keysHigh.next();
String key = String.format("RT:%s:%s", deviceId, fieldName);
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
keyValueMap.put(key,values.get(fieldName));
}
adminRedisTemplate.mSet(keyValueMap);

View File

@ -1,10 +1,12 @@
package com.das.modules.page.controller;
import com.das.common.result.R;
import com.das.modules.node.domain.dto.DeviceCommandDto;
import com.das.modules.page.domian.WindTurbinesPageVo;
import com.das.modules.page.service.WindTurbinesPageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -17,13 +19,37 @@ import java.util.List;
@RequestMapping("/api/page/turbines")
@RestController
public class WindTurbinesPageController {
@Autowired
private WindTurbinesPageService windTurbinesPageService;
/**
* 获取风机机组所属线路列表
* @return 返回字符串数组
*/
@PostMapping("/lines")
@GetMapping("/lines")
public R<List<String>> queryBelongLines() {
//TODO: 查询sql: select distinct belong_line as name from sys_equipment t where t.object_type = 10002 and belong_line !='';
List<String> lines = windTurbinesPageService.queryBelongLines();
return R.success(lines);
}
/**
* 获取风机页面数据
* @return 返回风机页面数据
*/
@GetMapping ("/queryWindTurbinesPages")
public R<List<WindTurbinesPageVo>> queryWindTurbinesPages(){
List<WindTurbinesPageVo> windTurbinesPageVos = windTurbinesPageService.queryAllWindTurbinesPages();
return R.success(windTurbinesPageVos);
}
/**
*
* @param controlList 遥控List
* @return 成功或者失败
*/
@PostMapping ("/windTurbinesControl")
public R<Void> windTurbinesControl(@RequestBody List<DeviceCommandDto> controlList){
windTurbinesPageService.windTurbinesControl(controlList);
return R.success();
}
}

View File

@ -0,0 +1,19 @@
package com.das.modules.page.domian;
import lombok.Data;
import java.util.Map;
@Data
public class WindTurbinesPageVo {
private Long irn;
private String name;
private String model;
private String belongLine;
private Map<String,Object> attributeMap;
}

View File

@ -0,0 +1,83 @@
package com.das.modules.page.service;
import com.das.modules.data.domain.SnapshotValueQueryParam;
import com.das.modules.data.service.DataService;
import com.das.modules.equipment.mapper.SysEquipmentMapper;
import com.das.modules.node.domain.dto.DeviceCommandDto;
import com.das.modules.node.service.SysNodeService;
import com.das.modules.page.domian.WindTurbinesPageVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Transactional(rollbackFor = Exception.class)
@Service
@Slf4j
public class WindTurbinesPageService {
private static final Long OBJECT_TYPE = 10002L;
@Autowired
SysEquipmentMapper sysEquipmentMapper;
@Autowired
private DataService dataService;
@Autowired
SysNodeService sysNodeService;
/**
* 获取风机机组所属线路列表
* @return 返回字符串数组
*/
public List<String> queryBelongLines(){
return sysEquipmentMapper.queryBelongLines(OBJECT_TYPE);
}
/**
* 获取风机页面数据
* @return 返回风机页面数据
*/
public List<WindTurbinesPageVo> queryAllWindTurbinesPages(){
List<WindTurbinesPageVo> windTurbinesPageVos = sysEquipmentMapper.queryAllWindList(OBJECT_TYPE);
List<SnapshotValueQueryParam> paramList = new ArrayList<>();
List<String> attributesList = new ArrayList<>();
attributesList.add("iwindspeed");
attributesList.add("iturbineoperationmode");
attributesList.add("igenpower");
attributesList.add("ikwhthisday");
attributesList.add("ikwhoverall");
attributesList.add("ivanedirection");
attributesList.add("irotorspeed");
attributesList.add("igenspeed");
attributesList.add("itempnacelle_1sec");
attributesList.add("ihydrpress");
attributesList.add("ipitchangle1");
attributesList.add("ipitchangle2");
attributesList.add("ipitchangle3");
attributesList.add("iyplevel");
attributesList.add("gridlostdetected");
for (WindTurbinesPageVo item : windTurbinesPageVos){
SnapshotValueQueryParam snapshotValueQueryParam = new SnapshotValueQueryParam();
snapshotValueQueryParam.setAttributes(attributesList);
snapshotValueQueryParam.setDeviceId(item.getIrn().toString());
paramList.add(snapshotValueQueryParam);
}
Map<String, Map<String, Object>> map = dataService.querySnapshotValues(paramList);
for (WindTurbinesPageVo item : windTurbinesPageVos){
item.setAttributeMap(map.get(item.getIrn().toString()));
}
return windTurbinesPageVos;
}
public void windTurbinesControl(List<DeviceCommandDto> controlList){
for (DeviceCommandDto item : controlList){
sysNodeService.deviceCommand(item);
}
}
}

View File

@ -162,5 +162,12 @@
<select id="queryEquipmentInfoByCode" resultMap="SysEquipmentMap">
select * from sys_equipment where code = #{code}
</select>
<select id="queryBelongLines" resultType="java.lang.String">
select distinct belong_line as name from sys_equipment t where t.object_type = 10002 and belong_line !='';
</select>
<select id="queryAllWindList" resultType="com.das.modules.page.domian.WindTurbinesPageVo">
select se.id as irn,se.name,se.model,se.belong_line as belongLine from sys_equipment se where se.object_type = #{objectType}
</select>
</mapper>

View File

@ -14,9 +14,9 @@
| | 2.1.8实时告警确认 | 告警记录ID | /api/home/realTimeAlertConfirm | |
### 2.1 首页相关接口
## 2.1 首页相关接口
#### 2.1.1 风场概况
### 2.1.1 风场概况
POST 请求接口
@ -56,7 +56,7 @@ POST 请求接口
#### 2.1.2 今日运行状态
### 2.1.2 今日运行状态
POST 请求接口
@ -106,7 +106,7 @@ POST 请求接口
| offlineNum | Integer | 否 | 离线台数 |
#### 2.1.3 功率趋势
### 2.1.3 功率趋势
POST 请求接口
@ -148,7 +148,7 @@ POST 请求接口
| windSpeed | Double | 否 | 风速 |
| dataTime | String | 否 | 数据时间 |
#### 2.1.4 风机矩阵
### 2.1.4 风机矩阵
POST 请求接口
@ -199,7 +199,7 @@ POST 请求接口
| standard | Integer | 否 | 是否为标杆机组 |
| windTurbine | String | 否 | 风机编码 |
#### 2.1.5 发电量概况
### 2.1.5 发电量概况
POST 请求接口
@ -251,7 +251,7 @@ POST 请求接口
| yearGeneration | Double | 否 | 年发电量 |
| totalGeneration | Double | 否 | 总发电量 |
#### 2.1.6 发电量趋势
### 2.1.6 发电量趋势
POST 请求接口
@ -305,7 +305,7 @@ POST 请求接口
| samePeriod | Double | 否 | 同期 |
| generationTime | Double | 否 | 发电量时间 |
#### 2.1.7 实时告警
### 2.1.7 实时告警
POST 请求接口
@ -353,7 +353,7 @@ POST 请求接口
| alertId | Long | 否 | 告警id |
| confirmStatus | Integer | 否 | 确认状态 |
#### 2.1.8 实时告警-确认
### 2.1.8 实时告警-确认
POST 请求接口

View File

@ -1,4 +1,12 @@
import createAxios from '/@/utils/axios'
//左侧树查询
export function enumTreeQuery(params: object = {}) {
return createAxios({
url: '/api/enum/queryEnumTypesList',
method: 'POST',
data: params,
})
}
// 枚举类型新增
export function enumTypeAdd(params: object = {}) {
return createAxios({
@ -8,6 +16,24 @@ export function enumTypeAdd(params: object = {}) {
})
}
// 编辑类型新增
export function enumTypecurEdit(params: object = {}) {
return createAxios({
url: '/api/enum/updateEnumTypes',
method: 'POST',
data: params,
})
}
// 枚举类型删除
export function enumTypeDelete(params: object = {}) {
return createAxios({
url: '/api/enum/deleteEnumTypes',
method: 'POST',
data: params,
})
}
//表格查询
export function enumListQuery(params: object = {}) {
return createAxios({
@ -17,14 +43,7 @@ export function enumListQuery(params: object = {}) {
})
}
//左侧树查询
export function enumTreeQuery(params: object = {}) {
return createAxios({
url: '/api/enum/queryEnumTypesList',
method: 'POST',
data: params,
})
}
// 枚举值新增
export function enumValueAdd(params: object = {}) {
return createAxios({

View File

@ -0,0 +1,28 @@
import createAxios from '/@/utils/axios'
export const getAirBlowerListReq = () => {
return createAxios({
url: '/api/page/turbines/queryWindTurbinesPages',
method: 'get',
})
}
export const getBelongLineListReq = () => {
return createAxios({
url: '/api/page/turbines/lines',
method: 'get',
})
}
export const runAirBlowerReq = (data: {
deviceId: string,
serviceName: string,
opValue: 1 | 0
}[]) => {
return createAxios({
url: '/windTurbinesControl',
method: 'post',
data: data
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@
:props="defaultProps"
node-key="id"
@node-click="handleNodeClick"
@node-contextmenu="enumContextMenu"
/>
</el-main>
@ -79,6 +80,31 @@
</template>
</el-dialog>
<!--编辑枚举类型-->
<el-dialog v-model="visibleTypeEdit" title="编辑枚举类型" width="500" :before-close="handleCloseTypeEdit">
<el-form
ref="formRef"
:inline="true"
:model="formInlineEdit"
:rules="rules"
style="padding: 24px 40px; font-size: 14px; line-height: 1.5; word-wrap: break-word; font-size: 20px"
>
<el-form-item label="名称:" prop="name">
<el-input v-model="formInlineEdit.name" placeholder="" clearable />
</el-form-item>
<el-form-item label="&nbsp;&nbsp;描述:">
<el-input v-model="formInlineEdit.description" placeholder="" clearable />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="visibleTypeEdit = false">取消</el-button>
<el-button type="primary" @click="onSubmitTypeEdit">提交</el-button>
</div>
</template>
</el-dialog>
<!--新增枚举值-->
<el-dialog v-model="visibleValueAdd" title="新增枚举值" width="500" :before-close="handleClosevalue">
<el-form
@ -155,21 +181,39 @@
</div>
</template>
</el-dialog>
<ContextMenu :pos="enumcontextMenuPos" v-model:visible="enumOperateVisible">
<template #default>
<div class="modelOperate">
<el-button @click="enumTypeEdit(curnodeData)">修改</el-button>
<el-popconfirm title="确认删除?" @confirm="delenumType">
<template #reference>
<el-button @click.stop>删除</el-button>
</template>
</el-popconfirm>
</div>
</template>
</ContextMenu>
</el-container>
</div>
</template>
<script setup lang="ts">
import {nextTick, onMounted, reactive, ref} from 'vue'
import { Search, Plus, CaretRight } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox, FormRules } from 'element-plus'
import { Search, Plus } from '@element-plus/icons-vue'
import { ElMessage, FormRules } from 'element-plus'
import {
enumListQuery,
enumTreeQuery,
enumTypeAdd,
enumTypecurEdit,
enumTypeDelete,
enumValueAdd,
enumValueDelete, enumValuepageEdit
enumValueDelete,
enumValuepageEdit
} from "/@/api/backend/Enumeration/request";
import ContextMenu from '/@/views/backend/auth/model/contextMenu.vue'
import {delModelReq} from "/@/api/backend/deviceModel/request";
const activeName = ref('1')
@ -179,7 +223,6 @@ interface Tree {
enumDesc: string,
}
const defaultProps = {
children: 'children',
label: 'description',
@ -236,13 +279,23 @@ const enumTreeTypeList = () => {
})
}
const queryParameter = ref()
const nodename = ref()
const curnodeData=ref({
id: '',
description: '',
name:''
})
const handleNodeClick = (data: any) => {
queryParameter.value = data
enumTypeId.value=data.id
queryListData.enumTypeId=data.id,
queryListData.description=queryName.value,
queryListData.pageNum=currentPage.value,
queryListData.enumTypeId=data.id
queryListData.description=queryName.value
queryListData.pageNum=currentPage.value
queryListData.pageSize=currentPageSize.value
nodename.value=data.description
curnodeData.value.id=data.id
curnodeData.value.name=data.name
curnodeData.value.description=data.description
queryenumValueMethod(queryListData)
}
@ -492,6 +545,87 @@ const EditonSubmitvalue = () => {
})
}
const visibleTypeEdit=ref(false)
const formInlineEdit=reactive({
id:'',
name: '',
description: ''
})
const enumTypeEdit = (curnodeData) => {
visibleTypeEdit.value=true
formInlineEdit.id = curnodeData.id
formInlineEdit.name = curnodeData.name
formInlineEdit.description = curnodeData.description
}
const handleCloseTypeEdit = (done: () => void) => {
visibleTypeEdit.value = false
}
const onSubmitTypeEdit = () => {
formRef.value.validate((valid: any) => {
if (valid) {
enumTypecurEdit(formInlineEdit).then((res: any) => {
if (res.code == 200) {
enumTreeTypeList()
ElMessage({
message: res.msg,
type: 'success',
})
} else {
ElMessage.error({
message: res.msg,
type: 'error',
})
}
})
visibleTypeEdit.value = false
}
})
}
const contextMenuTreeData=ref({
id:'',
name: '',
description: ''
})
const enumOperateVisible = ref(false)
const enumcontextMenuPos = ref({
x: 0,
y: 0,
})
const enumContextMenu = (event: any,curnodeData) => {
enumcontextMenuPos.value.x = event.pageX
enumcontextMenuPos.value.y = event.pageY
contextMenuTreeData.value = curnodeData
if(nodename.value=="枚举类型配置"||nodename.value==undefined){
enumOperateVisible.value = false
}else{
enumOperateVisible.value = true
}
}
const delenumType = () => {
enumTypeDelete({ id: contextMenuTreeData.value!.id! })
.then((res) => {
if (res.code == 200) {
enumTreeTypeList()
ElMessage({
message: res.msg,
type: 'success',
})
} else {
ElMessage.error({
message: res.msg,
type: 'error',
})
}
})
.catch((err) => {
ElMessage.error(err?.response?.data?.msg ?? '删除失败')
})
}
onMounted(() => {
enumTreeTypeList()
})
@ -584,5 +718,16 @@ $paginationHeight: 32px;
width: 100%;
}
}
.modelOperate{
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 80px;
height: 80px;
.el-button {
margin: 0;
}
}
}
</style>

View File

@ -6,68 +6,91 @@
<div class="selectPart">
<span>{{ t('airBlower.status') }}</span>
<el-select
v-model="airBlowerSelect.a"
@change="selectAirBlower('a')"
v-model="airBlowerSelect.iturbineoperationmode"
@change="selectAirBlower('iturbineoperationmode')"
:placeholder="'请选择' + t('airBlower.status')"
class="airBlowerSelect"
>
<el-option v-for="v in airBlowerSelectOptions.a" :key="v.value" :label="v.label" :value="v.value"></el-option>
<el-option
v-for="v in airBlowerSelectOptions.iturbineoperationmode"
:key="v.value"
:label="v.label"
:value="v.value"
></el-option>
</el-select>
</div>
<div class="selectPart">
<span>{{ t('airBlower.feeder') }}</span>
<el-select
v-model="airBlowerSelect.b"
@change="selectAirBlower('b')"
v-model="airBlowerSelect.belongLine"
@change="selectAirBlower('belongLine')"
:placeholder="'请选择' + t('airBlower.feeder')"
class="airBlowerSelect"
>
<el-option v-for="v in airBlowerSelectOptions.b" :key="v.value" :label="v.label" :value="v.value"></el-option>
</el-select>
<el-option v-for="v in airBlowerSelectOptions.belongLine" :key="v.value" :label="v.value" :value="v.value"></el-option>
</el-select>
</div>
<div class="selectPart">
<span>{{ t('airBlower.airBlowerNumber') }}</span>
<el-select
v-model="airBlowerSelect.c"
@change="selectAirBlower('c')"
:placeholder="'请选择' + t('airBlower.airBlowerNumber')"
class="airBlowerSelect"
>
<el-option v-for="item in airBlowerSelectOptions.c" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<span>自动更新</span>
<el-switch
v-model="autoUpdate"
class="ml-2"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
></el-switch>
</div>
</div>
<div class="headerRight">
<el-button type="primary" @click="airBlowerOperate('start')">{{ t('airBlower.start') }}</el-button>
<el-button style="color:#0064AA" @click="airBlowerOperate('stop')">{{ t('airBlower.stop') }}</el-button>
<el-button style="color:#0064AA" @click="airBlowerOperate('reset')">{{ t('airBlower.reset') }}</el-button>
<el-button style="color:#0064AA" @click="airBlowerOperate('verify')">{{ t('airBlower.verify') }}</el-button>
<el-button type="primary" @click="airBlowerOperate('setTurbineFastStart')">{{ t('airBlower.start') }}</el-button>
<el-button style="color: #0064aa" @click="airBlowerOperate('setTurbineStop')">{{ t('airBlower.stop') }}</el-button>
<el-button style="color: #0064aa" @click="airBlowerOperate('setTurbineResetSafetyChain')">{{ t('airBlower.reset') }}</el-button>
<el-button style="color: #0064aa" @click="airBlowerOperate('verify')">{{ t('airBlower.verify') }}</el-button>
</div>
</el-header>
<el-main class="mainPart">
<el-table :column="tableColumn" :data="tableData" :header-row-style="tableHaderStyle">
<el-table :column="tableColumn" :data="tableData" :header-row-style="tableHaderStyle" @selectionChange="selectTable" height="100%">
<el-table-column type="selection" width="55"></el-table-column>
<template v-for="item in tableColumn" :key="item.prop">
<el-table-column
v-if="!item.custom"
:prop="item.prop"
:label="item.name"
:label="item.label"
:align="item.align"
:width="item.width"
:type="item.type"
/>
<el-table-column v-else :label="item.name" :align="item.align" :width="item.width">
<el-table-column v-else :label="item.label" :align="item.align" :width="item.width">
<template v-if="item.custom === 'default'" #default="scope">
<div v-if="item.prop === 'c'">
<el-tag v-if="scope.row.c === '1'" color="rgba(0,100,170,0.20)" style="color: #0064aa">并网</el-tag>
<el-tag v-if="scope.row.c === '2'" color="rgba(0,160,150,0.20)" style="color: #00a096">维护</el-tag>
<el-tag v-if="scope.row.c === '3'" color="rgba(255,126,0,0.20)" style="color: #ff7e00">故障</el-tag>
<el-tag v-if="scope.row.c === '4'" color="rgba(153,153,153,0.20)" style="color: #666666">离线</el-tag>
<el-tag v-if="scope.row.c === '5'" color="rgba(6,180,41,0.20)" style="color: #06b429">启动</el-tag>
<el-tag v-if="scope.row.c === '6'" color="rgba(254,55,49,0.20)" style="color: #fe3731">集控停机</el-tag>
<el-tag v-if="scope.row.c === '7'" color="rgba(254,55,49,0.20)" style="color: #fe3731">远程监控停机</el-tag>
<el-tag v-if="scope.row.c === '8'" color="rgba(255,182,0,0.20)" style="color: #ffb600">待机</el-tag>
<el-tag v-if="scope.row.c === '9'" color="rgba(48,89,236,0.20)" style="color: #3059ec">维护</el-tag>
<el-tag v-if="scope.row.c === '10'" color="rgba(153,153,153,0.20)" style="color: #666666">离线</el-tag>
<div v-if="item.prop === 'iturbineoperationmode'">
<el-tag v-if="scope.row.iturbineoperationmode === 20" color="rgba(0,100,170,0.20)" style="color: #0064aa"
>并网</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 10" color="rgba(0,160,150,0.20)" style="color: #00a096"
>维护</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 8" color="rgba(255,126,0,0.20)" style="color: #ff7e00"
>限功率运行</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 0" color="rgba(153,153,153,0.20)" style="color: #666666"
>离线</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 16" color="rgba(6,180,41,0.20)" style="color: #06b429"
>启动</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 6" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>正常停机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>紧急停机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 11" color="rgba(255,182,0,0.20)" style="color: #ffb600"
>待机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1110" color="rgba(153,153,153,0.20)" style="color: #666666"
>解缆状态</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1111" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>紧急停机</el-tag
>
</div>
</template>
<template v-if="item.custom === 'header'" #header="scope">
@ -77,331 +100,302 @@
<template v-if="item.custom === 'header'" #default="scope">
<div>{{ scope.row[item.prop] }}</div>
</template>
<template v-if="item.prop === 'name'" #default="scope">
<div class="tableColumnClick">{{ scope.row[item.prop] }}</div>
</template>
</el-table-column>
</template>
</el-table>
</el-main>
<el-footer class="footerPart">
<div class="footerPage">
<el-pagination
background
layout="total,prev, pager, next,sizes,jumper"
:total="paginationData.total"
:page-sizes="[10, 20, 30]"
v-model:current-page="paginationData.currentPage"
@change="paginationChange"
/>
</div>
</el-footer>
</el-container>
</div>
</template>
<script setup lang="ts">
import { SelectTypeObj, SelectTypeKeyUnion } from './type'
import { reactive, ref } from 'vue'
import { SelectTypeObjType, SelectTypeKeyUnionType, TableDataObjType, TableColumnType } from './type'
import { reactive, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { getAirBlowerListReq, getBelongLineListReq, runAirBlowerReq } from '/@/api/backend/airBlower/request'
import { ElMessage } from 'element-plus'
const { t } = useI18n()
const airBlowerSelect = reactive<SelectTypeObj>({
a: '',
b: '',
c: '',
const airBlowerSelect = reactive<SelectTypeObjType>({
iturbineoperationmode: 987654321,
belongLine: '全部',
})
const airBlowerSelectOptions = reactive<{ [K in SelectTypeKeyUnion]: { label: string; value: string }[] }>({
a: [],
b: [],
c: [],
const airBlowerSelectOptions = reactive<{ [K in SelectTypeKeyUnionType]: { label: string; value: string | number }[] }>({
iturbineoperationmode: [
{
label: '全部',
value: 987654321,
},
{
label: '并网',
value: 20,
},
{
label: '待机',
value: 11,
},
{
label: '启动',
value: 16,
},
{
label: '维护',
value: 10,
},
{
label: '离线',
value: 0,
},
{
label: '限功率运行',
value: 8,
},
{
label: '正常停机',
value: 6,
},
{
label: '紧急停机',
value: 1,
},
{
label: '解缆状态',
value: 1110,
},
{
label: '电网故障停机',
value: 1111,
},
],
belongLine: [],
})
const selectAirBlower = (type: SelectTypeKeyUnion) => {
switch (type) {
case 'a':
break
case 'b':
break
case 'c':
break
const selectAirBlower = (type: SelectTypeKeyUnionType) => {
if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.iturbineoperationmode === 987654321) {
tableData.value = originTableData.value
return
} else if (airBlowerSelect.belongLine !== '全部' && airBlowerSelect.iturbineoperationmode !== 987654321) {
tableData.value = tableData.value.filter((item) => item[type] === airBlowerSelect[type])
return
} else {
if (type === 'belongLine' && airBlowerSelect.belongLine === '全部') {
tableData.value = originTableData.value.filter((item) => item.iturbineoperationmode === airBlowerSelect.iturbineoperationmode)
return
} else if (type === 'iturbineoperationmode' && airBlowerSelect.iturbineoperationmode === 987654321) {
tableData.value = originTableData.value.filter((item) => item.belongLine === airBlowerSelect.belongLine)
return
}
tableData.value = originTableData.value.filter((item) => item[type] === airBlowerSelect[type])
return
}
}
const airBlowerOperate = (type: 'start' | 'stop' | 'reset' | 'verify') => {
switch (type) {
case 'start':
break
case 'stop':
break
case 'reset':
break
case 'verify':
break
}
const airBlowerOperate = (type: 'setTurbineFastStart' | 'setTurbineStop' | 'setTurbineResetSafetyChain' | 'verify') => {
const data = selectList.value.map((item) => {
return {
deviceId: item,
serviceName: type,
opValue: 1 as const,
}
})
console.log(data)
runAirBlowerReq(data).then((res) => {
console.log(res)
})
}
const tableHaderStyle = {
color: '#333',
}
const tableColumn = [
const tableColumn: TableColumnType[] = [
{
type: 'selection',
width: 55,
},
{
name: '风机列表',
prop: 'a',
align: 'center',
},
{
name: '风机型号',
prop: 'b',
align: 'center',
},
{
name: '风机状态',
prop: 'c',
label: '风机列表',
prop: 'name',
align: 'center',
custom: 'default',
},
{
name: '线路',
prop: 'd',
label: '风机型号',
prop: 'model',
align: 'center',
},
{
name: '风速 (m/s)',
prop: 'e',
label: '风机状态',
prop: 'iturbineoperationmode',
align: 'center',
custom: 'default',
},
{
label: '线路',
prop: 'belongLine',
align: 'center',
},
{
label: '风速 (m/s)',
prop: 'iwindspeed',
align: 'center',
custom: 'header',
},
{
name: '有功功率 (MW)',
prop: 'f',
label: '有功功率 (MW)',
prop: 'igenpower',
align: 'center',
custom: 'header',
},
{
name: '日发电量 (kWh)',
prop: 'g',
label: '日发电量 (kWh)',
prop: 'ikwhthisday',
align: 'center',
custom: 'header',
},
{
name: '总发电量 (万kWh)',
prop: 'h',
label: '总发电量 (万kWh)',
prop: 'ikwhoverall',
align: 'center',
custom: 'header',
},
{
name: '机舱角度',
prop: 'i',
label: '机舱角度',
prop: 'ivanedirection',
align: 'center',
},
{
name: '叶轮转速 (rmp)',
prop: 'j',
label: '叶轮转速 (rmp)',
prop: 'irotorspeed',
align: 'center',
custom: 'header',
},
{
name: '发电机转速 (rmp)',
prop: 'k',
label: '发电机转速 (rmp)',
prop: 'igenspeed',
align: 'center',
custom: 'header',
},
{
name: '机舱温度 (℃)',
prop: 'l',
label: '机舱温度 (℃)',
prop: 'itempnacelle_1sec',
align: 'center',
custom: 'header',
},
{
name: '主油路压力 (kpa)',
prop: 'm',
label: '主油路压力 (kpa)',
prop: 'ihydrpress',
align: 'center',
custom: 'header',
},
{
name: '变桨角度',
prop: 'n',
label: '变桨角度',
prop: 'ipitchangle',
align: 'center',
},
]
const tableData = ref([
{
a: 'SC-001',
b: '-',
c: '1',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-002',
b: '-',
c: '2',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-003',
b: '-',
c: '3',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-004',
b: '-',
c: '4',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-005',
b: '-',
c: '5',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-006',
b: '-',
c: '6',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-007',
b: '-',
c: '7',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-008',
b: '-',
c: '8',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-009',
b: '-',
c: '9',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
{
a: 'SC-010',
b: '-',
c: '10',
d: '线路1',
e: '5',
f: '-',
g: '-',
h: '-',
i: '-',
j: '-',
k: '-',
l: '-',
m: '-',
n: '-',
},
])
const tableData = ref<TableDataObjType[]>([])
const originTableData = ref<TableDataObjType[]>([])
const getTableData = () => {
getAirBlowerListReq()
.then((res) => {
const data = res.data.map((item: any) => {
const state = item.attributeMap.iturbineoperationmode ?? item.attributeMap.GridLostDetected ?? item.attributeMap.iPYlevel ?? '-'
const ipitchangle = Math.min(item.attributeMap.ipitchangle1, item.attributeMap.ipitchangle2, item.attributeMap.ipitchangle3)
const resVal: any = {}
Object.keys(item.attributeMap).forEach((attrKey) => {
resVal[attrKey] =
item.attributeMap[attrKey] === 0
? 0
: item.attributeMap[attrKey]
? item.attributeMap.iwindspeed % 1 === 0
? item.attributeMap.iwindspeed
: Math.floor(item.attributeMap[attrKey] * 1000) / 1000
: '-'
})
return {
irn: item.irn,
name: item.name ?? '-',
model: item.model || '-',
belongLine: item.belongLine || '-',
iwindspeed: '-',
igenpower: '-',
ikwhthisday: '-',
ikwhoverall: '-',
ivanedirection: '-',
irotorspeed: '-',
igenspeed: '-',
itempnacelle_1sec: '-',
ihydrpress: '-',
...resVal,
ipitchangle: ipitchangle === 0 ? 0 : ipitchangle ? Math.floor(ipitchangle * 1000) / 1000 : '-',
iturbineoperationmode: state,
}
})
console.log(data)
const getTableData = () => {}
originTableData.value = data
if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.iturbineoperationmode === 987654321) {
tableData.value = data
} else {
const irn = tableData.value.map((item) => item.irn)
const result: TableDataObjType[] = []
data.forEach((item: TableDataObjType) => {
if (irn.includes(item.irn)) {
result.push(item)
}
})
tableData.value = result
}
})
.catch((err: any) => {
console.log(err)
})
}
const paginationData = reactive({
currentPage: 1,
pageSize: 10,
total: 0,
const getBlongLineList = () => {
getBelongLineListReq()
.then((res) => {
const data = res.data.map((item: any) => {
return {
value: item,
}
})
airBlowerSelectOptions.belongLine = [{ value: '全部', label: '全部' }, ...data]
})
.catch((err) => {
console.log(err)
})
}
const selectList = ref<string[]>([])
const selectTable = (selected: TableDataObjType[]) => {
selectList.value = selected.map((item) => item.irn)
}
const autoUpdate = ref(false)
const autoUpdateInterval = ref<any>(null)
watch(autoUpdate, (newVal: boolean) => {
if (newVal) {
if (autoUpdateInterval.value) return
ElMessage.success('开启自动刷新')
autoUpdateInterval.value = setInterval(() => {
console.log('刷新')
getTableData()
}, 2000)
} else {
ElMessage.warning('关闭自动刷新')
clearInterval(autoUpdateInterval.value)
autoUpdateInterval.value = null
}
})
const paginationChange = () => {}
getTableData()
getBlongLineList()
</script>
<style scoped lang="scss">
@ -444,15 +438,11 @@ const paginationChange = () => {}
}
}
.mainPart {
height: calc(100% - 120px);
}
.footerPart {
width: 100%;
.footerPage {
height: 100%;
display: flex;
justify-content: right;
align-items: center;
height: 100%;
.tableColumnClick {
text-decoration: underline;
color: #00a4ff;
cursor: pointer;
}
}
}

View File

@ -1,23 +1,39 @@
export type SelectTypeObj = {
a: string
b: string
c: string
export type SelectTypeObjType = {
iturbineoperationmode?: number
belongLine: string
}
export type SelectTypeKeyUnion = keyof SelectTypeObj
export type SelectTypeKeyUnionType = keyof SelectTypeObjType
export type TableDataObj = {
1: string
2: string
3: string
4: string
5: string
6: string
7: string
8: string
9: string
10: string
11: string
12: string
13: string
14: string
export type TableDataObjType = {
irn:string
name: string
model: string
iturbineoperationmode: number
belongLine: string
iwindspeed: string
igenpower: string
ikwhthisday: string
ikwhoverall: string
ivanedirection: string
irotorspeed: string
igenspeed: string
itempnacelle_1sec: string
ihydrpress: string
ipitchangle: string
}
export type TableColumnSortType = {
type?: 'default' | 'selection' | 'index' | 'expand'
}
export type TableColumnType = {
label: string
prop: keyof TableDataObjType
width?: number
fixed?: 'left' | 'right'
align?: 'left' | 'right' | 'center'
custom?: 'header' | 'default'
type?: 'default' | 'selection' | 'index' | 'expand'
}

View File

@ -63,34 +63,34 @@ const tableColumn = [
prop: 'porder',
width: 76,
align: 'center',
sortable:'custom'
sortable: 'custom',
},
{
label: '属性名称',
prop: 'attributeName',
align: 'left',
sortable:'custom'
sortable: 'custom',
},
{
label: '属性编码',
prop: 'attributeCode',
align: 'left',
width: 200,
sortable:'custom'
sortable: 'custom',
},
{
label: '子系统',
prop: 'subSystem',
align: 'left',
width: 110,
sortable:false
sortable: false,
},
{
label: '实时值',
prop: 'realTimeValue',
width: 140,
align: 'center',
sortable:false
sortable: false,
},
]
const tableData = ref<any[]>([])
@ -156,10 +156,10 @@ const getCompleteData = () => {
})
.then((realData: any) => {
const data = realData.list.map((item: any) => {
const realValItem = realData.realVal[props.deviceId]?.[item.attributeCode] ?? '-'
const realValItem = realData.realVal[props.deviceId]?.[item.attributeCode]
return {
...item,
realTimeValue: realValItem % 1 === 0 ? realValItem : realValItem.toFixed(3),
realTimeValue: realValItem ? (realValItem % 1 === 0 ? realValItem : realValItem.toFixed(3)) : '-',
}
})

View File

@ -74,8 +74,8 @@
<div class="correctionTreeItem">
<span>{{ correctionDevice.findIndex((item) => item === data) + 1 + '、' + data.name }}</span>
<div class="rightItem">
<el-input v-if="data.isEdit" v-model="data.iotAddr" @keyup.enter="okEdit(data)" @blur="okEdit(data)"></el-input>
<el-tag v-else type="info" @click="editAttr(data)">{{ data.iotAddr }}</el-tag>
<el-input v-if="data.isEdit" v-model="data.iotAddr" @keyup.enter="okEdit(data)" @blur="okEdit(data)" ></el-input>
<el-tag v-else type="info" @click="editAttr(data)">{{ data.iotAddr??'请输入地址' }}</el-tag>
<el-popconfirm @confirm="delCorrectionDevice(node)" title="确认删除么?">
<template #reference>
<el-icon><Delete /></el-icon>
@ -551,4 +551,12 @@ onBeforeUnmount(() => {
}
}
}
.treeMain{
height: 600px;
.el-tree{
height: 100%;
overflow-y: auto;
}
}
</style>