Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
1e464a4945
@ -67,6 +67,9 @@ public class TDEngineService {
|
||||
}
|
||||
}
|
||||
|
||||
public HikariDataSource getHikariDataSource(){
|
||||
return hikariDataSource;
|
||||
}
|
||||
/**
|
||||
* 创建超级表
|
||||
*/
|
||||
|
@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
@ -85,7 +86,6 @@ public class DataServiceImpl implements DataService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Map<String, Object>> querySnapshotValues(List<SnapshotValueQueryParam> paramList) {
|
||||
long start = System.currentTimeMillis();
|
||||
Map<String, Map<String, Object>> result = new HashMap<>(paramList.size());
|
||||
ListUtil.page(paramList, COMMIT_COUNT, list -> {
|
||||
List<String> keyList = new ArrayList<>();
|
||||
@ -122,8 +122,6 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
}
|
||||
});
|
||||
long end = System.currentTimeMillis();
|
||||
log.debug("querySnapshotValues {}个,耗时: {}秒", paramList.size(), (end - start) / 1000.0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,122 @@
|
||||
package com.das.modules.data.service.impl;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.das.modules.data.service.TDEngineService;
|
||||
import com.das.modules.equipment.entity.SysEquipment;
|
||||
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.sql.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ExportTdDataServiceImpl {
|
||||
|
||||
@Autowired
|
||||
SysEquipmentMapper sysEquipmentMapper;
|
||||
|
||||
@Autowired
|
||||
private TDEngineService tdEngineService;
|
||||
|
||||
@Value("${zipUrl}")
|
||||
private String fileUrl;
|
||||
|
||||
|
||||
public void exportDataCsvZip() throws IOException, SQLException {
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start("导出风机数据zip");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||
String yesterday = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
|
||||
|
||||
//获取所有风机数据
|
||||
QueryWrapper<SysEquipment> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("object_type", 10002);
|
||||
List<SysEquipment> sysEquipments = sysEquipmentMapper.selectList(queryWrapper);
|
||||
//获取临时目录文件路径
|
||||
String tempDir = String.valueOf(Files.createTempDirectory(null));
|
||||
File zipFile = new File(fileUrl + "/data_"+yesterday+".zip");
|
||||
List<File> fileList = new ArrayList<>();
|
||||
try {
|
||||
for (SysEquipment item : sysEquipments) {
|
||||
|
||||
String hTableName = "h" + item.getId();
|
||||
String lTableName = "l" + item.getId();
|
||||
File fileHighSpeed = new File(tempDir +"/" + "h_"+item.getCode()+"_"+yesterday + ".csv");
|
||||
File fileLowSpeed = new File(tempDir +"/" + "l_"+item.getCode()+"_"+yesterday + ".csv");
|
||||
getYesterdayData(hTableName, yesterday, fileHighSpeed.getPath());
|
||||
getYesterdayData(lTableName, yesterday, fileLowSpeed.getPath());
|
||||
fileList.add(fileLowSpeed);
|
||||
fileList.add(fileHighSpeed);
|
||||
}
|
||||
//压缩文件
|
||||
// 将文件添加到压缩文件中
|
||||
ZipUtil.zip(zipFile, false, fileList.toArray(new File[0]));
|
||||
stopWatch.stop();
|
||||
log.debug(stopWatch.prettyPrint(TimeUnit.SECONDS));
|
||||
}catch (Exception e){
|
||||
log.error("导出风机数据zip失败{}",e);
|
||||
}
|
||||
finally {
|
||||
if (!CollectionUtils.isEmpty(fileList)){
|
||||
FileUtil.del(new File(fileList.get(0).getParent()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void getYesterdayData(String tableName, String time, String csvFilePath) {
|
||||
// TDengine 查询语句
|
||||
String query = "SELECT * FROM " + tableName + " WHERE updatetime >= '" + time + " 00:00:00' AND updatetime < '" + time + " 23:59:59.999'";
|
||||
try (Connection conn = tdEngineService.getHikariDataSource().getConnection();
|
||||
Statement smt = conn.createStatement();
|
||||
ResultSet rs = smt.executeQuery(query)) {
|
||||
writeResultSetToCsv(rs, csvFilePath);
|
||||
}catch (Exception e){
|
||||
log.error(tableName +"获取数据异常{}",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void writeResultSetToCsv(ResultSet resultSet, String csvFilePath) throws IOException, SQLException {
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(csvFilePath))) {
|
||||
// 写入列名
|
||||
ResultSetMetaData metaData = resultSet.getMetaData();
|
||||
int columnCount = metaData.getColumnCount();
|
||||
for (int i = 1; i <= columnCount; i++) {
|
||||
writer.write(metaData.getColumnName(i));
|
||||
if (i < columnCount) writer.write(",");
|
||||
}
|
||||
writer.newLine();
|
||||
|
||||
// 写入数据
|
||||
while (resultSet.next()) {
|
||||
for (int i = 1; i <= columnCount; i++) {
|
||||
String value = resultSet.getString(i);
|
||||
writer.write(value == null ? "" : resultSet.getString(i));
|
||||
if (i < columnCount) writer.write(",");
|
||||
}
|
||||
writer.newLine();
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("数据写入csv文件失败{}",e);
|
||||
}
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ import com.das.modules.node.mapper.SysCommunicationLinkMapper;
|
||||
import com.das.modules.node.mapper.SysImpTabMappingMapper;
|
||||
import com.das.modules.node.mapper.SysNodeMapper;
|
||||
import com.das.modules.node.service.SysNodeService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@ -407,10 +408,6 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
*/
|
||||
@Override
|
||||
public void saveMappingList(List<SysTabMappingVo> impList) {
|
||||
try {
|
||||
if (!CollectionUtils.isEmpty(impList)) {
|
||||
List<SysTabMapping> list = new ArrayList<>();
|
||||
|
||||
if (impList.get(0).getProtocol() == 9 || impList.get(0).getProtocol() == 17){
|
||||
Map<Long, Integer> collect = sysImptabmappingMapper.getMappingInfoListByLinkId(impList.get(0).getLinkId()).stream().collect(Collectors.toMap(SysTabMappingVo::getId, SysTabMappingVo::getMeasPointType, (value1, value2) -> value1));
|
||||
List<SysTabMappingVo> analogList = impList.stream().filter(item -> collect.get(item.getId()) == 138).collect(Collectors.toList());
|
||||
@ -423,6 +420,9 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
throw new ServiceException("检查顺序,排序不能重复");
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!CollectionUtils.isEmpty(impList)) {
|
||||
List<SysTabMapping> list = new ArrayList<>();
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
for (SysTabMappingVo imp : impList) {
|
||||
SysTabMapping rec = sysImptabmappingMapper.selectById(imp.getId());
|
||||
@ -540,12 +540,19 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
|
||||
private Boolean checkOrderRepeated(List<SysTabMappingVo> mappings) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
List<SysTabMappingVo> orderCollect = mappings.stream().filter(item -> {
|
||||
try {
|
||||
JsonNode jsonNode = objectMapper.readTree(item.getParams());
|
||||
return StringUtils.isNotEmpty(jsonNode.get("order").asText());
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
Boolean orderRepeated = false;
|
||||
try {
|
||||
// 提取所有的 order 字段,转换为 Set
|
||||
Set<String> orderSet = new HashSet<>();
|
||||
orderRepeated = mappings.stream()
|
||||
orderRepeated = orderCollect.stream()
|
||||
.map(SysTabMappingVo::getParams) // 提取 param 字段
|
||||
.map(param -> {
|
||||
try {
|
||||
@ -556,7 +563,16 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
throw new RuntimeException("JSON 解析失败: " + param, e);
|
||||
}
|
||||
})
|
||||
.anyMatch(order -> !orderSet.add(order));
|
||||
.anyMatch(order -> {
|
||||
if (StringUtils.isNotEmpty(order)){
|
||||
boolean b = !orderSet.add(order);
|
||||
if (b){
|
||||
log.error("排序重复{}",order);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}catch (Exception e){
|
||||
log.error("校验order不重复失败",e);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.das.modules.page.domian.dto.SysHomeParamSetDto;
|
||||
import com.das.modules.page.domian.vo.SysHomeParamSetVo;
|
||||
import com.das.modules.page.service.HomeParamSetService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -29,6 +30,9 @@ public class HomeParamSetController {
|
||||
/** 新增系统参数设置页面 */
|
||||
@PostMapping("/add")
|
||||
public R<SysHomeParamSetVo> add(@RequestBody SysHomeParamSetDto sysHomeParamSetDto) {
|
||||
if (StringUtils.isBlank(sysHomeParamSetDto.getParamType())) {
|
||||
throw new ServiceException("参数类型不能为空");
|
||||
}
|
||||
SysHomeParamSetVo sysHomeParamSetVo = homeParamSetService.add(sysHomeParamSetDto);
|
||||
return R.success(sysHomeParamSetVo);
|
||||
}
|
||||
@ -50,4 +54,14 @@ public class HomeParamSetController {
|
||||
SysHomeParamSetVo sysHomeParamSetVo = homeParamSetService.update(sysHomeParamSetDto);
|
||||
return R.success(sysHomeParamSetVo);
|
||||
}
|
||||
|
||||
/** 删除系统参数设置 */
|
||||
@PostMapping("/delete")
|
||||
public R<Void> delete(@RequestBody SysHomeParamSetDto sysHomeParamSetDto) {
|
||||
if (sysHomeParamSetDto.getId() == null) {
|
||||
throw new ServiceException("id不能为空");
|
||||
}
|
||||
homeParamSetService.delete(sysHomeParamSetDto);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SysHomeParamSetDto {
|
||||
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
private String paramName;
|
||||
|
||||
@ -15,4 +15,6 @@ public class SysHomeParamSetDto {
|
||||
private JSONArray paramValueJson;
|
||||
|
||||
private String paramDesc;
|
||||
|
||||
private String paramType;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SysHomeParamSetVo {
|
||||
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
private String paramName;
|
||||
|
||||
@ -15,4 +15,6 @@ public class SysHomeParamSetVo {
|
||||
private JSONArray paramValueJson;
|
||||
|
||||
private String paramDesc;
|
||||
|
||||
private String paramType;
|
||||
}
|
||||
|
@ -29,4 +29,6 @@ public class SysHomeParamSet extends BaseEntity {
|
||||
private String paramValue;
|
||||
|
||||
private String paramDesc;
|
||||
|
||||
private String paramType;
|
||||
}
|
||||
|
@ -12,4 +12,6 @@ public interface HomeParamSetService {
|
||||
List<SysHomeParamSetVo> getList(SysHomeParamSetDto sysHomeParamSetDto);
|
||||
|
||||
SysHomeParamSetVo update(SysHomeParamSetDto sysHomeParamSetDto);
|
||||
|
||||
void delete(SysHomeParamSetDto sysHomeParamSetDto);
|
||||
}
|
||||
|
@ -61,9 +61,15 @@ public class HomeParamSetServiceImpl implements HomeParamSetService {
|
||||
if (sysHomeParamSetDto.getParamValueJson() !=null){
|
||||
sysHomeParamSet.setParamValue(sysHomeParamSetDto.getParamValueJson().toString());
|
||||
}
|
||||
sysHomeParamSet.setId(Long.valueOf(sysHomeParamSetDto.getId()));
|
||||
sysHomeParamSetMapper.updateById(sysHomeParamSet);
|
||||
SysHomeParamSetVo sysHomeParamSetVo = new SysHomeParamSetVo();
|
||||
SysHomeParamSetVo result = BeanCopyUtils.copy(sysHomeParamSet, sysHomeParamSetVo);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(SysHomeParamSetDto sysHomeParamSetDto) {
|
||||
sysHomeParamSetMapper.deleteById(Long.valueOf(sysHomeParamSetDto.getId()));
|
||||
}
|
||||
}
|
||||
|
@ -111,3 +111,5 @@ minio:
|
||||
bucket: das
|
||||
accessKey: das
|
||||
secretKey: zaq12WSX
|
||||
|
||||
zipUrl: /log/zip/
|
@ -114,3 +114,5 @@ minio:
|
||||
publicBucket: das-dock
|
||||
accessKey: das
|
||||
secretKey: zaq12WSX
|
||||
|
||||
zipUrl: /log/zip/
|
@ -19,6 +19,9 @@
|
||||
<if test="info.iotModelId != null and info.iotModelId != ''">
|
||||
and t.iot_model_id = #{info.iotModelId}
|
||||
</if>
|
||||
<if test="info.highSpeed != null and info.highSpeed != ''">
|
||||
and t.highSpeed = #{info.highSpeed}
|
||||
</if>
|
||||
<if test="info.attributeName != null and info.attributeName != ''">
|
||||
and t.attribute_name like concat('%',#{info.attributeName},'%')
|
||||
</if>
|
||||
|
@ -15,4 +15,18 @@ export function Paramupdate(params: object = {}) {
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
export function ParamAdd(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/page/home/set/add',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
export function Paramdelete(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/page/home/set/delete ',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
|
57
ui/dasadmin/src/api/backend/historyData/request.ts
Normal file
57
ui/dasadmin/src/api/backend/historyData/request.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import createAxios from '/@/utils/axios'
|
||||
|
||||
export const getTemplateListReq = (data: { category: '历史数据' & string; pageNum: number; pageSize: number }) => {
|
||||
return createAxios<
|
||||
never,
|
||||
Promise<{
|
||||
code: number
|
||||
msg: string
|
||||
data: {
|
||||
total: number
|
||||
rows: { id: string; category: '历史数据' & string; template: string }[]
|
||||
code: number
|
||||
msg: string
|
||||
}
|
||||
success: boolean
|
||||
}>
|
||||
>({
|
||||
url: '/api/page/report/template/getList',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export const addTemplateListReq = (data: { category: '历史数据' & string; template: string }) => {
|
||||
return createAxios<
|
||||
never,
|
||||
Promise<{
|
||||
code: number
|
||||
msg: string
|
||||
data: {
|
||||
id: string
|
||||
category: '历史数据' & string
|
||||
template: string
|
||||
}[]
|
||||
success: boolean
|
||||
}>
|
||||
>({
|
||||
url: '/api/page/report/template/add',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export const delTemplateListReq = (data: { id: string }) => {
|
||||
return createAxios<
|
||||
never,
|
||||
Promise<{
|
||||
code: number
|
||||
msg: string
|
||||
success: boolean
|
||||
}>
|
||||
>({
|
||||
url: '/api/page/report/template/del',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
@ -2,7 +2,8 @@
|
||||
<div class="SystemParam">
|
||||
<el-container class="mainContainer">
|
||||
<div class="mainHeader">
|
||||
<el-text class="mx-1 title">风机矩阵设置</el-text>
|
||||
<el-text class="mx-1 title">系统参数设置</el-text>
|
||||
<el-button :icon="Plus" type="primary" @click="addItem">新增</el-button>
|
||||
</div>
|
||||
<el-main class="defaultMain">
|
||||
<el-row>
|
||||
@ -11,7 +12,7 @@
|
||||
<el-table :data="paramData" style="width: 100%">
|
||||
<el-table-column prop="paramName" label="参数名称" />
|
||||
<el-table-column prop="paramDesc" label="中文" />
|
||||
<!-- <el-table-column prop="paramValue" label="参数值" />-->
|
||||
<el-table-column prop="paramType" label="类型" />
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="scope">
|
||||
<span style="color: #0064aa; cursor: pointer"
|
||||
@ -22,6 +23,9 @@
|
||||
v-else
|
||||
@click="EditLayout(scope)"
|
||||
>编辑</span>
|
||||
<span style="color: #0064aa; cursor: pointer;margin-left: 10px;"
|
||||
@click="fromDelete(scope)"
|
||||
>删除</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -202,13 +206,61 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="visibleAdd" title="新增系统参数" width="500" :before-close="handleCloseAdd" class="addPart">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:inline="true"
|
||||
label-width="auto"
|
||||
:model="formInlineAdd"
|
||||
: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="paramName">
|
||||
<el-input v-model="formInlineAdd.paramName" placeholder="" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="中文描述:" prop="paramDesc">
|
||||
<el-input v-model="formInlineAdd.paramDesc" placeholder="" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型:" prop="paramType">
|
||||
<el-input v-model="formInlineAdd.paramType" placeholder="" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="参数值:">
|
||||
<el-input
|
||||
v-model="formInlineAdd.paramValue"
|
||||
:rows="2"
|
||||
type="textarea"
|
||||
placeholder="参数值为json格式"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="SaveParamAdd">保存</el-button>
|
||||
<el-button @click="visibleAdd = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 删除确认弹框 -->
|
||||
<el-dialog v-model="dialogVisibleDelete" title="操作提示" width="500" :before-close="handleCloseDelete">
|
||||
<span>确定是否删除?</span>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="dialogVisibleDelete1"> 确定 </el-button>
|
||||
<el-button @click="dialogVisibleDelete = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {onMounted, ref,nextTick} from 'vue'
|
||||
import { getParamList,Paramupdate } from '/@/api/backend/SystemParam/request'
|
||||
import { ElMessage} from 'element-plus'
|
||||
import {onMounted, ref, nextTick, reactive} from 'vue'
|
||||
import {getParamList, ParamAdd, Paramdelete, Paramupdate} from '/@/api/backend/SystemParam/request'
|
||||
import {ElMessage, FormRules} from 'element-plus'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import {enumTypeAdd, enumValueDelete} from "/@/api/backend/Enumeration/request";
|
||||
const paramData=ref([])
|
||||
const tableData = ref([])
|
||||
const PARAM_COLOR = 'paramColor';
|
||||
@ -323,6 +375,108 @@ const onSubmit=()=>{
|
||||
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
||||
})
|
||||
}
|
||||
const formRef=ref()
|
||||
interface RuleForm {
|
||||
paramName: string | undefined
|
||||
paramDesc: string | undefined
|
||||
paramType: string | undefined
|
||||
}
|
||||
const rules = reactive<FormRules<RuleForm>>({
|
||||
paramName: [
|
||||
{
|
||||
required: true,
|
||||
message: '参数名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
paramDesc: [
|
||||
{
|
||||
required: true,
|
||||
message: '中文描述不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
paramType: [
|
||||
{
|
||||
required: true,
|
||||
message: '类型不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
})
|
||||
const formInlineAdd = reactive({
|
||||
paramName: '',
|
||||
paramDesc: '',
|
||||
paramType: '',
|
||||
paramValue: [],
|
||||
})
|
||||
const visibleAdd=ref(false)
|
||||
const addItem=()=>{
|
||||
formInlineAdd.paramName = ''
|
||||
formInlineAdd.paramDesc = ''
|
||||
formInlineAdd.paramType = ''
|
||||
formInlineAdd.paramValue = []
|
||||
visibleAdd.value=true
|
||||
}
|
||||
const SaveParamAdd=()=>{
|
||||
formRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
ParamAdd(formInlineAdd).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
getList()
|
||||
ElMessage({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
})
|
||||
} else {
|
||||
ElMessage.error({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
visibleAdd.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleCloseAdd = () => {
|
||||
visibleAdd.value=false
|
||||
}
|
||||
const fromDeleteData = reactive({
|
||||
id: '',
|
||||
})
|
||||
interface fromDelete {
|
||||
row?: any[]
|
||||
}
|
||||
const fromDelete = (data:any) => {
|
||||
dialogVisibleDelete.value = true
|
||||
fromDeleteData.id = data.row.id
|
||||
}
|
||||
const dialogVisibleDelete = ref(false)
|
||||
|
||||
const handleCloseDelete = (done: () => void) => {
|
||||
dialogVisibleDelete.value = false
|
||||
}
|
||||
const dialogVisibleDelete1 = (done: () => void) => {
|
||||
dialogVisibleDelete.value = false
|
||||
Paramdelete(fromDeleteData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
setTimeout(() => {
|
||||
ElMessage({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
})
|
||||
}, 1000)
|
||||
getList()
|
||||
} else {
|
||||
ElMessage.error({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() =>{
|
||||
getList()
|
||||
})
|
||||
@ -395,6 +549,11 @@ $headerHeight: 60px;
|
||||
-webkit-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
|
||||
}
|
||||
}
|
||||
.addPart{
|
||||
.el-form--inline .el-form-item {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes selected {
|
||||
|
@ -237,6 +237,7 @@ import { getRealValueListReq } from '/@/api/backend/deviceModel/request'
|
||||
import SelectPoint from '/@/views/backend/equipment/airBlower/selectPoint.vue'
|
||||
import RealDataChart from '/@/views/backend/equipment/airBlower/realDataChart.vue'
|
||||
import { permission } from '/@/utils/directive'
|
||||
import { table } from 'console'
|
||||
const vPermission = permission()
|
||||
|
||||
const router = useRouter()
|
||||
@ -423,7 +424,7 @@ const defaultColumn: TableColumnType[] = [
|
||||
width: 100,
|
||||
},
|
||||
]
|
||||
const dynamicColumn: TableColumnType[] = [
|
||||
let dynamicColumn: TableColumnType[] = [
|
||||
{
|
||||
label: '风速 (m/s)',
|
||||
prop: 'iwindspeed',
|
||||
@ -523,6 +524,17 @@ const dynamicColumn: TableColumnType[] = [
|
||||
},
|
||||
]
|
||||
const tableColumn = ref<TableColumnType[]>([...defaultColumn, ...dynamicColumn])
|
||||
const getSaveColumn = () => {
|
||||
const saveColumn = localStorage.getItem('airBlowerTableColumnList')
|
||||
console.log(saveColumn,'saveColumn');
|
||||
|
||||
if (saveColumn) {
|
||||
tableColumn.value = JSON.parse(saveColumn)
|
||||
console.log(tableColumn.value,'tableColumn.value');
|
||||
dynamicColumn = tableColumn.value.slice(4)
|
||||
}
|
||||
}
|
||||
getSaveColumn()
|
||||
|
||||
const tableRef = ref<TableInstance>()
|
||||
const tableData = ref<TableDataObjType[]>([])
|
||||
@ -611,7 +623,7 @@ const getTableData = () => {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage.error(err)
|
||||
// ElMessage.error(err)
|
||||
})
|
||||
}
|
||||
|
||||
@ -702,9 +714,10 @@ const selectPointDialogRef = ref()
|
||||
const selectPointVisible = ref(false)
|
||||
const defaultAttr = computed(() => {
|
||||
return dynamicColumn.map((item) => {
|
||||
tableColumn.value.length
|
||||
return {
|
||||
attributeName: item.label.split(' ')[0],
|
||||
unit: item.label.split(' ')[1] ?? '',
|
||||
unit:item.label.split(' ')[1] ?? '',
|
||||
attributeCode: item.prop as string,
|
||||
}
|
||||
})
|
||||
@ -728,7 +741,7 @@ const saveSelectPoint = () => {
|
||||
}
|
||||
})
|
||||
tableColumn.value = [...defaultColumn, ...addCoulmn]
|
||||
|
||||
localStorage.setItem('airBlowerTableColumnList', JSON.stringify(tableColumn.value))
|
||||
getTableData()
|
||||
selectPointVisible.value = false
|
||||
ElMessage.success('选择成功')
|
||||
|
1014
ui/dasadmin/src/views/backend/historyData/index.vue
Normal file
1014
ui/dasadmin/src/views/backend/historyData/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
10
ui/dasadmin/src/views/backend/historyData/type.ts
Normal file
10
ui/dasadmin/src/views/backend/historyData/type.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export type selectData =
|
||||
{
|
||||
id: string
|
||||
attributeName: string
|
||||
attributeCode: string
|
||||
interpolation: boolean
|
||||
average: boolean
|
||||
max: boolean
|
||||
min: boolean
|
||||
}
|
@ -148,7 +148,7 @@ const props = defineProps({
|
||||
const getAnimationStyle = (item) => {
|
||||
const irotorspeed = item.attributeMap?.irotorspeed ?? 0
|
||||
let animationDuration;
|
||||
animationDuration = 60 / irotorspeed / 3
|
||||
animationDuration = 60 / irotorspeed / 2
|
||||
const processedoperationmode = item.attributeMap?.processedoperationmode ?? 0
|
||||
if(processedoperationmode==33||processedoperationmode==0){
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user