This commit is contained in:
zhouhuang 2024-12-10 10:14:55 +08:00
commit ea2021cf33
34 changed files with 352 additions and 101 deletions

View File

@ -28,6 +28,7 @@ import com.das.modules.equipment.mapper.SysIotModelMapper;
import com.das.modules.equipment.mapper.SysIotModelServiceMapper;
import com.das.modules.equipment.service.SysIotModelService;
import com.das.modules.data.service.TDEngineService;
import com.das.modules.record.service.SysRecordLogService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
@ -61,6 +62,9 @@ public class SysIotModelServiceImpl implements SysIotModelService {
@Autowired
private DataServiceImpl dataService;
@Autowired
SysRecordLogService sysRecordLogService;
public SysIotModelVo creatSysIotModel(SysIotModelDto sysIotModelDto) {
SysIotModel sysIotModel = new SysIotModel();
BeanCopyUtils.copy(sysIotModelDto, sysIotModel);
@ -174,9 +178,10 @@ public class SysIotModelServiceImpl implements SysIotModelService {
if (sysIotModelFieldDto.getAttributeType() == 140) {
sysIotModelField.setDataType("tinyint");
}
sysIotModelFieldMapper.insert(sysIotModelField);
//动态执行创建td超级表字段
createTdStableOrColumn(sysIotModelField);
sysIotModelFieldMapper.insert(sysIotModelField);
//新增物模型属性缓存
addModelFieldCache(sysIotModelField);
SysIotModelFieldVo sysIotModelFieldVo = new SysIotModelFieldVo();
@ -206,12 +211,13 @@ public class SysIotModelServiceImpl implements SysIotModelService {
if (oldSysIotField == null) {
throw new ServiceException("未查找到该条记录");
}
sysIotModelFieldMapper.updateById(sysIotModelField);
if (!oldSysIotField.getAttributeCode().equals(sysIotModelField.getAttributeCode()) || !oldSysIotField.getDataType().equals(sysIotModelField.getDataType()) || Objects.equals(oldSysIotField.getHighSpeed(), sysIotModelField.getHighSpeed())) {
//更新td表结构
updateTDStableOrColumn(sysIotModelField, oldSysIotField);
updateModelFieldCache(sysIotModelField, oldSysIotField);
}
sysIotModelFieldMapper.updateById(sysIotModelField);
SysIotModelFieldVo sysIotModelFieldVo = new SysIotModelFieldVo();
BeanCopyUtils.copy(sysIotModelField, sysIotModelFieldVo);
return sysIotModelFieldVo;
@ -220,9 +226,10 @@ public class SysIotModelServiceImpl implements SysIotModelService {
@Override
public void deleteSysIotModelField(SysIotModelFieldDto sysIotModelFieldDto) {
SysIotModelField sysIotModelField = sysIotModelFieldMapper.selectById(sysIotModelFieldDto.getId());
sysIotModelFieldMapper.deleteById(sysIotModelFieldDto.getId());
//删除td表结构字段
deleteTDStableOrColumn(sysIotModelField);
sysIotModelFieldMapper.deleteById(sysIotModelFieldDto.getId());
//删除物模型属性缓存
deleteModelFieldCache(sysIotModelField);
}
@ -453,6 +460,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
//创建低频超级表
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "l_", map);
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段,"+"表名l_" +sysIotModel.getIotModelCode()+",字段:"+map);
addModelFieldCache(lowCreateList.get(i));
}
}
@ -468,6 +476,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
//创建高频超级表
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "h_", map);
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段,"+"表名h_" +sysIotModel.getIotModelCode()+",字段:"+map);
addModelFieldCache(highCreateList.get(i));
}
}
@ -535,6 +544,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
if (sysIotModelField.getAttributeType() == 199) {
String modelCode = dataService.iotModelMap.get(sysIotModelField.getIotModelId().toString());
tdEngineService.createCalStable(modelCode, sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建计算超级表"+"c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
} else {
//创建type为138 139 140的超级表
//如果新增的是第一条记录 创建tdengine超级表 分为高频和低频
@ -549,6 +559,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
//创建低频超级表
tdEngineService.createStable(sysIotModel.getIotModelCode(), "l_", map);
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建低频TD超级表"+"l_" +sysIotModel.getIotModelCode());
}
if (sysIotModelField.getHighSpeed() == 1) {
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
@ -556,6 +567,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
//创建高频超级表
tdEngineService.createStable(sysIotModel.getIotModelCode(), "h_", map);
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建高频TD超级表"+"h_" +sysIotModel.getIotModelCode());
}
} else {
//stable已经存在,新增stable列
@ -565,6 +577,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
//创建低频超级表
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "l_", map);
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段,"+"表名l_" +sysIotModel.getIotModelCode()+",字段:"+map);
}
if (sysIotModelField.getHighSpeed() == 1) {
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
@ -572,6 +585,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
//创建高频超级表
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "h_", map);
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增高频TD超级表字段,"+"表名h_" +sysIotModel.getIotModelCode()+",字段:"+map);
}
}
}
@ -587,6 +601,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
Long iotModelId = sysIotModelField.getIotModelId();
String modelCode = dataService.iotModelMap.get(iotModelId.toString());
tdEngineService.deleteStable("c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+"c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
} else {
String stableName = null;
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
@ -602,10 +617,12 @@ public class SysIotModelServiceImpl implements SysIotModelService {
List<SysIotModelField> sysIotModelFields = sysIotModelFieldMapper.selectList(queryWrapper);
if (CollectionUtils.isNotEmpty(sysIotModelFields) && sysIotModelFields.size() > 1) {
tdEngineService.deleteColumn(stableName, sysIotModelField.getAttributeCode());
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+ stableName +"中字段:"+ sysIotModelField.getAttributeCode());
}
//物模型属性只剩下最后一个删除表
if (CollectionUtils.isNotEmpty(sysIotModelFields) && sysIotModelFields.size() == 1) {
tdEngineService.deleteStable(stableName);
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+ stableName);
}
}

View File

@ -51,7 +51,7 @@ public class FaultRecorderController {
String code = jsonObject.getString("deviceCode");
String startTime = jsonObject.getString("startTime");
String endTime = jsonObject.getString("endTime");
List<FileNode> result = faultRecorderService.getDirOrFileList("故障录波",code,startTime,endTime);
List<FileNode> result = faultRecorderService.getDirOrFileList("Tracelog",code,startTime,endTime);
return R.success(result);
}

View File

@ -135,9 +135,9 @@ public class MinioViewsServcie {
try {
if (StringUtils.isBlank(directoryName)) {
build = ListObjectsArgs.builder().bucket(minioProperties.getBucket()).recursive(false).build();
build = ListObjectsArgs.builder().bucket(minioProperties.getBucket()).recursive(true).build();
} else {
build = ListObjectsArgs.builder().bucket(minioProperties.getBucket()).prefix(directoryName+"/").recursive(false).build();
build = ListObjectsArgs.builder().bucket(minioProperties.getBucket()).prefix(directoryName+"/").recursive(true).build();
}
Iterable<Result<Item>> results = minioClient.listObjects(build);
for (Result<Item> result : results) {
@ -161,7 +161,7 @@ public class MinioViewsServcie {
lastModifyTime = zonedDateTime.format(dateFormat);
}
if (parts.length > 0) {
String nodeName = parts[1];
String nodeName = parts[2];
int type = isDir ? 0 : 1;
itemName= isDir ? itemName.substring(0,itemName.lastIndexOf("/")) : itemName;
FileNode node = new FileNode(nodeName, type,size,lastModifyTime,"/"+itemName);

View File

@ -44,7 +44,7 @@ public class PlcLogsController {
String code = jsonObject.getString("deviceCode");
String startTime = jsonObject.getString("startTime");
String endTime = jsonObject.getString("endTime");
List<FileNode> result = plcLogService.getDirOrFileList("日志",code,startTime,endTime);
List<FileNode> result = plcLogService.getDirOrFileList("Statuscode",code,startTime,endTime);
return R.success(result);
}

View File

@ -0,0 +1,40 @@
package com.das.modules.record.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@TableName("sys_record_log")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysRecordLog {
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
@TableField("user_id")
private String userId;
@TableField("user_name")
private String username;
@TableField("group_by")
private String groupBy;
@TableField("ip_address")
private String ipAddress;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("opt_time")
private Date optTime;
@TableField("opt_desc")
private String optDesc;
}

View File

@ -0,0 +1,10 @@
package com.das.modules.record.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.das.modules.record.domain.SysRecordLog;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysRecordLogMapper extends BaseMapper<SysRecordLog> {
}

View File

@ -0,0 +1,7 @@
package com.das.modules.record.service;
public interface SysRecordLogService {
void createRecordLog(String group, String desc);
}

View File

@ -0,0 +1,32 @@
package com.das.modules.record.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import com.das.common.config.SessionUtil;
import com.das.modules.auth.domain.vo.SysUserVo;
import com.das.modules.plc.mapper.SysRunLogDescMapper;
import com.das.modules.record.domain.SysRecordLog;
import com.das.modules.record.mapper.SysRecordLogMapper;
import com.das.modules.record.service.SysRecordLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class SysRecordLogServiceImpl implements SysRecordLogService {
@Autowired
private SysRecordLogMapper sysRecordLogMapper;
@Override
public void createRecordLog(String group, String desc) {
SysRecordLog sysRecordLog = new SysRecordLog();
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
sysRecordLog.setUsername(sysUserVo.getAccount());
sysRecordLog.setUserId(sysUserVo.getAccount());
sysRecordLog.setOptTime(new Date());
sysRecordLog.setGroupBy(group);
sysRecordLog.setOptDesc(desc);
sysRecordLogMapper.insert(sysRecordLog);
}
}

View File

@ -13,5 +13,5 @@
- [报表管理](api/pages/report.md)
- [数据采集](datacollect/)
- [系统部署](deploy/)
- [Linux系统部署](deploy/linux.md)
- [TDEngine3部署](deploy/tdengine3.md)
- [OpenEuler系统安装](deploy/linux.md)
- [DAS部署](deploy/das.md)

View File

@ -98,7 +98,9 @@ PS: 同一节点只允许建立一条连接。
//限值2上限
"limit2High": 999.0,
//限值2下限
"limit2Low": 0.0
"limit2Low": 0.0,
//强制归档,default: 0
"forceArchive": 1
}
},
{
@ -106,7 +108,9 @@ PS: 同一节点只允许建立一条连接。
"type": "yx",
"params": {
//是否取反,default: 0
"invert": 0
"invert": 0,
//强制归档,default: 0
"forceArchive": 1
}
}
],

View File

Before

Width:  |  Height:  |  Size: 389 KiB

After

Width:  |  Height:  |  Size: 389 KiB

View File

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 263 KiB

View File

Before

Width:  |  Height:  |  Size: 606 KiB

After

Width:  |  Height:  |  Size: 606 KiB

View File

Before

Width:  |  Height:  |  Size: 365 KiB

After

Width:  |  Height:  |  Size: 365 KiB

View File

Before

Width:  |  Height:  |  Size: 423 KiB

After

Width:  |  Height:  |  Size: 423 KiB

View File

Before

Width:  |  Height:  |  Size: 348 KiB

After

Width:  |  Height:  |  Size: 348 KiB

View File

Before

Width:  |  Height:  |  Size: 419 KiB

After

Width:  |  Height:  |  Size: 419 KiB

View File

Before

Width:  |  Height:  |  Size: 615 KiB

After

Width:  |  Height:  |  Size: 615 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 598 KiB

After

Width:  |  Height:  |  Size: 598 KiB

174
docs/deploy/das.md Normal file
View File

@ -0,0 +1,174 @@
# DAS系统部署
## TDEngine3 安装部署
> 当前版本: 3.3.2.0
### 安装包确认
请确认安装包是否已经在`/das/install`目录下
`TDengine-server-3.3.2.0-Linux-x64.tar.gz` - TDEngine 3.3.2.0 官方安装包 [下载地址](https://oss.jsspisoft.com/public/software/tdengine3/TDengine-server-3.3.2.0-Linux-x64.tar.gz)
可以通过下面的命令获取安装包
```shell
wget https://oss.jsspisoft.com/public/software/tdengine3/TDengine-server-3.3.2.0-Linux-x64.tar.gz
```
`td3.3.2.13_openeuler_patch.tar.gz` - TDEngine 3.3.2.13 OpenEuler补丁包 [下载地址](https://oss.jsspisoft.com/public/software/tdengine3/td3.3.2.13_openeuler_patch.tar.gz)
可以通过下面的命令获取安装包
```shell
wget https://oss.jsspisoft.com/public/software/tdengine3/td3.3.2.13_openeuler_patch.tar.gz
```
### TDEngine3安装
1. 先解压TDEngine3官方安装包
```shell
cd /das/install/
tar zxvf TDengine-server-3.3.2.0-Linux-x64.tar.gz
```
2. 运行安装脚本
```shell
cd TDengine-server-3.3.2.0
./install.sh
```
![alt text](asserts/image-tdinst01.png)
这里输入服务器的IP地址。
![alt text](asserts/image-tdinst02.png)
这里直接回车即可。
![alt text](asserts/image-tdinst03.png)
继续回车。
![alt text](asserts/image-tdinst04.png)
看到上图的内容TDEngine官方安装包就安装完毕了下面运行补丁。
```shell
cd /das/install
tar zxvf td3.3.2.13_openeuler_patch.tar.gz
```
执行补丁脚本
```shell
cd patch
./apply_patch.sh
```
> PS. 此脚本会更改TDEngine的默认数据目录为/das/data/tddata
### TDEngine3启停
```sh
systemctl start taosd
systemctl stop taosd
systemctl restart taosd
```
开机自启
```shell
systemctl enable taosd
```
###
这样就完成了TDEngine3.3.2.13的安装。
## PostgreSQL 安装配置
```shell
yum install postgresql-server -y
mkdir /das/data/pgdata
chown postgres:postgres /das/data/pgdata
````
### 修改数据文件位置
编辑`/usr/lib/systemd/system/postgresql.service`文件
将PGDATA改为下面的内容
```systemdS
Environment=PGDATA=/das/data/pgdata
```
### 初始话数据库
```shell
postgresql-setup initdb
systemctl start postgresql
```
### 配置文件修改
修改访问权限配置, 编辑文件`/das/data/pgdata/pg_hba.conf`,修改为
![alt text](image.png)
修改数据监听端口,编辑文件`/das/data/pgdata/postgresql.conf`,修改为
![alt text](image-1.png)
### 服务自启
```shell
systemctl enable postgresql
```
### 数据库初始化
```shell
su - postgres
```
### Redis安装配置
```shell
yum install redis6 -y
```
### 配置文件修改
编辑文件`/etc/redis/redis.conf`,修改为
![alt text](image-2.png)
第一处修改数据文件dump位置
![alt text](image-3.png)
第二处修改redis密码
![alt text](image-4.png)
第三处修改redis监听端口
### 服务启动与自启
```shell
systemctl start redis
systemctl enable redis
```
### 防火墙配置
```shell
firewall-cmd --zone=public --add-port=6379/tcp --permanent
firewall-cmd --reload
```
## minio安装配置

BIN
docs/deploy/image-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
docs/deploy/image-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
docs/deploy/image-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
docs/deploy/image-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
docs/deploy/image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -4,11 +4,11 @@
OpenEuler的安装和Centos差不多这里不详细说明了就把几个建议步骤说下这样可以减少后期手动配置的麻烦。
![alt text](asserts/image-2.png)
![alt text](asserts/image-welcome.png)
> 语言这里选 `English`
![alt text](asserts/image-3.png)
![alt text](asserts/image-mainmenu.png)
> `Keyboard` 不修改。
@ -16,29 +16,29 @@ OpenEuler的安装和Centos差不多这里不详细说明了就把几个
> `Installation Destination` 这里要配置磁盘分区。(不是一定要这样配置,会的随意配置)
![alt text](asserts/image-4.png)
![alt text](asserts/image-diskmgr.png)
![alt text](asserts/image-5.png)
![alt text](asserts/image-partitions.png)
![alt text](asserts/image-6.png)
![alt text](asserts/image-partitions01.png)
点左下角的`+`,新建分区
![alt text](asserts/image-7.png)
![alt text](asserts/image-partitions02.png)
`Mount Point`填: /das, 大小不用填,默认会使用剩余所有空间。
![alt text](asserts/image-9.png)
![alt text](asserts/image-partitions03.png)
点击 `Done`完成分区配置。
> `Language Support` 这个需要勾上中文。
![alt text](asserts/image-10.png)
![alt text](asserts/image-language.png)
> `Software Selection` 这里基础环境选择"Server", 右侧再勾上一个开发工具包,以防后续内网环境下编译安装程序时需要。
![alt text](asserts/image-11.png)
![alt text](asserts/image-software.png)
> `Network & Hostname` 根据实际情况配置。
@ -49,7 +49,15 @@ OpenEuler的安装和Centos差不多这里不详细说明了就把几个
## 系统配置
### 更新系统(不能访问外网请忽略)
首先切换系统yum源为国内地址加快更新速度。
```bash
sed -e 's|http://repo.openeuler.org/|https://mirrors.ustc.edu.cn/openeuler/|g' \ -e 's|https://mirrors.openeuler.org/|https://mirrors.ustc.edu.cn/openeuler/|g' \ -i.bak \ /etc/yum.repos.d/openEuler.repo
```
创建索引缓存
```bash
yum makecache
```
执行更新操作
```bash
yum update -y
```
@ -67,9 +75,10 @@ setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
```
### 关闭防火墙
### 关闭防火墙(根据情况)
```bash
systemctl stop firewalld
systemctl disable firewalld
```
```

View File

@ -1,63 +0,0 @@
# TDEngine3 安装部署
> 当前版本: 3.3.2.0
## 安装包确认
请确认安装包是否已经在`/das/install`目录下
`TDengine-server-3.3.2.0-Linux-x64.tar.gz` - TDEngine 3.3.2.0 官方安装包
`td3.3.2.13_openeuler_patch.tar.gz` - TDEngine 3.3.2.13 OpenEuler补丁包
## TDEngine3安装
1. 先解压TDEngine3官方安装包
```shell
cd /das/install/
tar zxvf TDengine-server-3.3.2.0-Linux-x64.tar.gz
```
2. 运行安装脚本
```shell
cd TDengine-server-3.3.2.0
./install.sh
```
![alt text](asserts/image1.png)
这里输入服务器的IP地址。
![alt text](asserts/image2.png)
这里直接回车即可。
![alt text](asserts/image.png)
继续回车。
![alt text](asserts/image-1.png)
看到上图的内容TDEngine官方安装包就安装完毕了下面运行补丁。
```shell
cd /das/install
tar zxvf td3.3.2.13_openeuler_patch.tar.gz
```
执行补丁脚本
```shell
cd patch
./apply_patch.sh
```
> PS. 此脚本会更改TDEngine的默认数据目录为/das/data/tddata
这样就完成了TDEngine3.3.2.13的安装。

View File

@ -338,7 +338,6 @@ const statAnalysisOperate = () => {
type: 'scatter',
data: seriesData,
name: '实际值',
smooth: true,
symbolSize: 5,
symbol: 'circle',
}

View File

@ -512,6 +512,7 @@ const historyDataReq = (promises: any) => {
data: yData.map((value: any) => ({
value: getCutDecimalsValue(value, 2),
})),
smooth: true,
symbolSize: 5,
symbol: 'circle',
}

View File

@ -37,7 +37,7 @@
<el-dialog v-model="showMeasure" title="选择测点" width="1200" top="0">
<div class="measureSlot">
<el-row :gutter="20">
<el-col :span="8">
<el-col :span="12">
<div class="col">
<div class="transferHeader">
<span class="transferTitle">风机列表</span>
@ -49,23 +49,35 @@
v-model:selection="selectedLeft"
@selection-change="handleSelectionChange"
row-key="irn"
class="windtable"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="风机名称" width="120" />
<el-table-column type="selection" width="40" />
<el-table-column prop="name" label="风机名称" />
</el-table>
<el-table
:data="tableDataMid"
v-model:selection="selectedMid"
@selection-change="handleSelectionChange2"
row-key="irn"
class="windtable"
>
<el-table-column type="selection" width="40" />
<el-table-column prop="name" label="风机名称" />
</el-table>
<el-table
:data="tableDataRight"
v-model:selection="selectedRight"
@selection-change="handleSelectionChange1"
row-key="irn"
class="windtable"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="风机名称" width="120" />
<el-table-column type="selection" width="40" />
<el-table-column prop="name" label="风机名称" />
</el-table>
</div>
</div>
</el-col>
<el-col :span="16">
<el-col :span="12">
<div class="col">
<div class="transferHeader">
<span class="transferTitle">可添加的测点</span>
@ -83,7 +95,7 @@
row-key="id"
class="attrtable"
>
<el-table-column type="selection" width="55" />
<el-table-column type="selection" width="40" />
<el-table-column prop="attributeName" label="属性名称" />
<el-table-column prop="attributeCode" label="属性编码" />
<el-table-column prop="subSystem" label="子系统" />
@ -202,9 +214,11 @@ onMounted(() => {
})
const tableDataLeft = ref([])
const tableDataRight = ref([])
const tableDataMid = ref([])
const iotModelId = ref('')
const selectedLeft = ref([])
const selectedRight = ref([])
const selectedMid = ref([])
const radioActiveName = ref(138)
const attributeTableRef = ref()
@ -225,9 +239,10 @@ const queryWindTurbines = () => {
})
if (resData.length) {
iotModelId.value = resData[0]['modelId']
const middleIndex = Math.ceil(resData.length / 2)
const middleIndex = Math.floor(resData.length / 3)
tableDataLeft.value = resData.slice(0, middleIndex)
tableDataRight.value = resData.slice(middleIndex)
tableDataMid.value = resData.slice(middleIndex, middleIndex * 2)
tableDataRight.value = resData.slice(middleIndex * 2)
}
resolve(resData[0])
} else {
@ -388,6 +403,9 @@ const openMeasure = () => {
const handleSelectionChange1 = (val: any) => {
selectedRight.value = val
}
const handleSelectionChange2 = (val: any) => {
selectedMid.value = val
}
const handleSelectionChange = (val: any) => {
selectedLeft.value = val
}
@ -404,7 +422,7 @@ function generateDeviceAttributes(devices: any, attributes: any) {
}
const statAnalysisOperate = () => {
const allDevices = [...selectedLeft.value, ...selectedRight.value]
const allDevices = [...selectedLeft.value, ...selectedMid.value, ...selectedRight.value]
if (!statAnalysisTime.value) {
ElMessage.info('请选择查询时间!')
return
@ -425,7 +443,7 @@ const statAnalysisOperate = () => {
}
const calculate: any = ref([{ max: '', min: '', average: '' }])
const historyDataReq = (data: any) => {
const selectAllDevices = [...selectedLeft.value, ...selectedRight.value].sort((a: any, b: any) => {
const selectAllDevices = [...selectedLeft.value, ...selectedMid.value, ...selectedRight.value].sort((a: any, b: any) => {
return a.index - b.index
})
historyReq(data)
@ -459,6 +477,7 @@ const historyDataReq = (data: any) => {
value: getCutDecimalsValue(value, 2),
unit: unit, //
})),
smooth: true,
symbolSize: 5,
symbol: 'circle',
}
@ -506,7 +525,7 @@ const statAnalysisExport = () => {
}
const getRequestData = () => {
const devices = generateDeviceAttributes([...selectedLeft.value, ...selectedRight.value], multipleSelection.value)
const devices = generateDeviceAttributes([...selectedLeft.value, ...selectedMid.value, ...selectedRight.value], multipleSelection.value)
const requestData = {
devices: devices,
interval: statAnalysisInterval.value || '5m',
@ -673,7 +692,9 @@ const timestampToTime = (timestamp: any) => {
border-bottom: 1px solid #e1edf6;
border-radius: 6px 6px 0 0;
}
.windtable {
height: 721px;
}
.mainPart {
display: flex;
padding: 10px;