Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
fbb3980044
@ -16,6 +16,7 @@ public class AnalogDataCommand implements BaseCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void doCommand(TerminalMessage data) {
|
public void doCommand(TerminalMessage data) {
|
||||||
try {
|
try {
|
||||||
|
//analogData值只存入redis
|
||||||
dataService.handleData(data);
|
dataService.handleData(data);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -17,6 +17,7 @@ public class StateDataCommand implements BaseCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void doCommand(TerminalMessage data) {
|
public void doCommand(TerminalMessage data) {
|
||||||
try {
|
try {
|
||||||
|
//只存入redis
|
||||||
dataService.handleData(data);
|
dataService.handleData(data);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("解析数据异常", e);
|
log.error("解析数据异常", e);
|
||||||
|
@ -17,4 +17,10 @@ public interface NodeConstant {
|
|||||||
String ANALOG_DATA = "analogData";
|
String ANALOG_DATA = "analogData";
|
||||||
|
|
||||||
String STATE_DATA = "stateData";
|
String STATE_DATA = "stateData";
|
||||||
|
|
||||||
|
String HIS_ANALOG_DATA = "historyStateData";
|
||||||
|
|
||||||
|
String HIS_STATE_DATA = "historyStateData";
|
||||||
|
|
||||||
|
String DEVICE_CONTROL_RESP = "deviceControlResp";
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,6 @@ public class IotModelVo {
|
|||||||
private String equipmentService;
|
private String equipmentService;
|
||||||
|
|
||||||
private Object params;
|
private Object params;
|
||||||
|
|
||||||
|
private Integer highSpeed;
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,7 @@ public class NewIotModelVo {
|
|||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
private Integer highSpeed;
|
||||||
|
|
||||||
private Object params;
|
private Object params;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public class TDEngineService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public void updateYCValues(List<RTData> values, String iotModelCode) {
|
public void updateYCHighValues(List<RTData> values, String iotModelCode) {
|
||||||
StringBuilder sb = new StringBuilder(1024*1024);
|
StringBuilder sb = new StringBuilder(1024*1024);
|
||||||
try (Connection conn = hikariDataSource.getConnection();
|
try (Connection conn = hikariDataSource.getConnection();
|
||||||
Statement pstmt = conn.createStatement()) {
|
Statement pstmt = conn.createStatement()) {
|
||||||
@ -132,12 +132,54 @@ public class TDEngineService {
|
|||||||
sb.setLength(0);
|
sb.setLength(0);
|
||||||
sb.append("insert into ");
|
sb.append("insert into ");
|
||||||
for (RTData dv : list) {
|
for (RTData dv : list) {
|
||||||
sb.append("d");
|
sb.append("h");
|
||||||
sb.append(dv.getDeviceId());
|
sb.append(dv.getDeviceId());
|
||||||
sb.append(" using " );
|
sb.append(" using h_" );
|
||||||
sb.append(iotModelCode);
|
sb.append(iotModelCode);
|
||||||
sb.append(" tags (");
|
sb.append(" tags (");
|
||||||
sb.append(dv.getDeviceId());
|
sb.append(dv.getDeviceId());
|
||||||
|
sb.append(") (");
|
||||||
|
dv.getValues().forEach((key, value) ->
|
||||||
|
sb.append(",").append(key)
|
||||||
|
);
|
||||||
|
sb.append(") values (");
|
||||||
|
sb.append(dv.getDataTime());
|
||||||
|
|
||||||
|
dv.getValues().forEach((key, value) ->
|
||||||
|
sb.append(",").append(value)
|
||||||
|
);
|
||||||
|
sb.append(")");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pstmt.executeUpdate(sb.toString());
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
log.error("save yc error", ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
log.error(ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void updateYCLowValues(List<RTData> values, String iotModelCode) {
|
||||||
|
StringBuilder sb = new StringBuilder(1024*1024);
|
||||||
|
try (Connection conn = hikariDataSource.getConnection();
|
||||||
|
Statement pstmt = conn.createStatement()) {
|
||||||
|
ListUtil.page(values, batchSize, (list)->{
|
||||||
|
sb.setLength(0);
|
||||||
|
sb.append("insert into ");
|
||||||
|
for (RTData dv : list) {
|
||||||
|
sb.append("l");
|
||||||
|
sb.append(dv.getDeviceId());
|
||||||
|
sb.append(" using l_" );
|
||||||
|
sb.append(iotModelCode);
|
||||||
|
sb.append(" tags (");
|
||||||
|
sb.append(dv.getDeviceId());
|
||||||
|
sb.append(") (");
|
||||||
|
dv.getValues().forEach((key, value) ->
|
||||||
|
sb.append(",").append(key)
|
||||||
|
);
|
||||||
sb.append(") values (");
|
sb.append(") values (");
|
||||||
sb.append(dv.getDataTime());
|
sb.append(dv.getDataTime());
|
||||||
|
|
||||||
|
@ -29,10 +29,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@ -72,8 +69,6 @@ public class DataServiceImpl implements DataService {
|
|||||||
|
|
||||||
public ConcurrentHashMap<String, Map<String, Object>> lowIotFieldMap = new ConcurrentHashMap<>(10000);
|
public ConcurrentHashMap<String, Map<String, Object>> lowIotFieldMap = new ConcurrentHashMap<>(10000);
|
||||||
|
|
||||||
public static final String DEVICE_DATA = "deviceData:{0}";
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
//初始化高性能队列
|
//初始化高性能队列
|
||||||
@ -151,9 +146,10 @@ public class DataServiceImpl implements DataService {
|
|||||||
List<IotModelVo> iotModelFieldList = sysImptabmappingMapper.getIotModelFieldByEquipmentId(equipmentId);
|
List<IotModelVo> iotModelFieldList = sysImptabmappingMapper.getIotModelFieldByEquipmentId(equipmentId);
|
||||||
if (!CollectionUtils.isEmpty(iotModelFieldList)) {
|
if (!CollectionUtils.isEmpty(iotModelFieldList)) {
|
||||||
for (IotModelVo info : iotModelFieldList) {
|
for (IotModelVo info : iotModelFieldList) {
|
||||||
if(info.getServiceType() == null) {
|
if (info.getServiceType() == null) {
|
||||||
NewIotModelVo newIotModelVo = new NewIotModelVo();
|
NewIotModelVo newIotModelVo = new NewIotModelVo();
|
||||||
newIotModelVo.setName(info.getEquipmentAttribute());
|
newIotModelVo.setName(info.getEquipmentAttribute());
|
||||||
|
newIotModelVo.setHighSpeed(info.getHighSpeed());
|
||||||
if (info.getParams() == null) {
|
if (info.getParams() == null) {
|
||||||
newIotModelVo.setParams(equipJsonNode);
|
newIotModelVo.setParams(equipJsonNode);
|
||||||
} else {
|
} else {
|
||||||
@ -235,7 +231,7 @@ public class DataServiceImpl implements DataService {
|
|||||||
}
|
}
|
||||||
lowIotFieldMap.put(item.getIotModelCode(), lowMap);
|
lowIotFieldMap.put(item.getIotModelCode(), lowMap);
|
||||||
}
|
}
|
||||||
tdEngineService.initIotModel(allIotModel, highIotFieldMap,lowIotFieldMap);
|
tdEngineService.initIotModel(allIotModel, highIotFieldMap, lowIotFieldMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -243,33 +239,52 @@ public class DataServiceImpl implements DataService {
|
|||||||
// 先从redis里面获取设备的初始化数据
|
// 先从redis里面获取设备的初始化数据
|
||||||
JsonNode jsonNode = data.getData();
|
JsonNode jsonNode = data.getData();
|
||||||
String deviceId = jsonNode.get("deviceId").asText();
|
String deviceId = jsonNode.get("deviceId").asText();
|
||||||
String key = MessageFormat.format(DEVICE_DATA, deviceId);
|
|
||||||
HashMap<String, Object> initValue = adminRedisTemplate.get(key);
|
|
||||||
JsonNode values = jsonNode.get("values");
|
JsonNode values = jsonNode.get("values");
|
||||||
List<Map.Entry<String, Object>> entryList = new ArrayList<>(initValue.entrySet());
|
JsonNode high = values.get("high");
|
||||||
HashMap<String, Object> newHashMap = new HashMap<>();
|
JsonNode low = values.get("low");
|
||||||
for (Map.Entry<String, Object> entry : entryList) {
|
Map<String, Object> keyValueMap = new HashMap<>();
|
||||||
if(values.get(entry.getKey()) == null){
|
|
||||||
newHashMap.put(entry.getKey(), entry.getValue());
|
|
||||||
} else{
|
|
||||||
newHashMap.put(entry.getKey(), values.get(entry.getKey()).asDouble());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
adminRedisTemplate.set(key, newHashMap);
|
|
||||||
Long dataTime = data.getTime();
|
|
||||||
// 存入td库
|
|
||||||
// 根据设备ID获取对应的物模型属性
|
// 根据设备ID获取对应的物模型属性
|
||||||
String iotModelCode = sysIotModelMapper.getIotModel(jsonNode.get("deviceId").asLong());
|
String iotModelCode = sysIotModelMapper.getIotModel(jsonNode.get("deviceId").asLong());
|
||||||
HashMap<String, Object> tdValues = adminRedisTemplate.get(key);
|
Map<String, Object> highFieldMap = highIotFieldMap.get(iotModelCode);
|
||||||
List<RTData> list = new ArrayList<>();
|
Map<String, Object> lowFiledMap = lowIotFieldMap.get(iotModelCode);
|
||||||
RTData rtData = RTData.builder()
|
|
||||||
.dataTime(dataTime)
|
|
||||||
.deviceId(Long.valueOf(deviceId))
|
|
||||||
.values(tdValues)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
list.add(rtData);
|
//High数据
|
||||||
tdEngineService.updateYCValues(list, iotModelCode);
|
Iterator<String> keysHigh = high.fieldNames();
|
||||||
|
while (keysHigh.hasNext()) {
|
||||||
|
String fieldName = keysHigh.next();
|
||||||
|
highFieldMap.put(fieldName, high.get(fieldName));
|
||||||
|
String key = String.format("RT:[%s]:[%s]", deviceId, fieldName);
|
||||||
|
keyValueMap.put(key, high.get(fieldName).asDouble());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//LOW数据
|
||||||
|
Iterator<String> keysLow = low.fieldNames();
|
||||||
|
while (keysLow.hasNext()) {
|
||||||
|
String fieldName = keysLow.next();
|
||||||
|
lowFiledMap.put(fieldName, low.get(fieldName));
|
||||||
|
String key = String.format("RT:[%s]:[%s]", deviceId, fieldName);
|
||||||
|
keyValueMap.put(key, high.get(fieldName).asDouble());
|
||||||
|
}
|
||||||
|
adminRedisTemplate.mSet(keyValueMap);
|
||||||
|
// Long dataTime = data.getTime();
|
||||||
|
//
|
||||||
|
// // 存入td库
|
||||||
|
// List<RTData> highList = new ArrayList<>();
|
||||||
|
// List<RTData> lowList = new ArrayList<>();
|
||||||
|
// RTData rtHighData = RTData.builder()
|
||||||
|
// .dataTime(dataTime)
|
||||||
|
// .deviceId(Long.valueOf(deviceId))
|
||||||
|
// .values(highFieldMap)
|
||||||
|
// .build();
|
||||||
|
// RTData rtLowData = RTData.builder()
|
||||||
|
// .dataTime(dataTime)
|
||||||
|
// .deviceId(Long.valueOf(deviceId))
|
||||||
|
// .values(highFieldMap)
|
||||||
|
// .build();
|
||||||
|
// highList.add(rtHighData);
|
||||||
|
// lowList.add(rtLowData);
|
||||||
|
// tdEngineService.updateYCHighValues(highList, iotModelCode);
|
||||||
|
// tdEngineService.updateYCLowValues(lowList, iotModelCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getIotModelFieldByEquipmentId" resultType="com.das.modules.node.domain.vo.IotModelVo">
|
<select id="getIotModelFieldByEquipmentId" resultType="com.das.modules.node.domain.vo.IotModelVo">
|
||||||
select simf.attribute_type as attributeType,sims.service_type as serviceType, se.iot_addr as iotAddr,si.equipment_attribute as equipmentAttribute,si.equipment_service as equipmentService, si.params from sys_imptabmapping si
|
select simf.attribute_type as attributeType,sims.service_type as serviceType, se.iot_addr as iotAddr,si.equipment_attribute as equipmentAttribute,si.equipment_service as equipmentService, si.params, simf.highspeed as highSpeed from sys_imptabmapping si
|
||||||
left join sys_equipment se on si.equipment_id = se.id
|
left join sys_equipment se on si.equipment_id = se.id
|
||||||
left join sys_iot_model_field simf on si.equipment_attribute = simf.attribute_code
|
left join sys_iot_model_field simf on si.equipment_attribute = simf.attribute_code
|
||||||
left join sys_iot_model_service sims on si.equipment_service = sims.service_code
|
left join sys_iot_model_service sims on si.equipment_service = sims.service_code
|
||||||
|
@ -6,9 +6,10 @@ VITE_BASE_PATH = './'
|
|||||||
|
|
||||||
# 代理配置(开发使用),必须在一行中
|
# 代理配置(开发使用),必须在一行中
|
||||||
# 本地
|
# 本地
|
||||||
# VITE_APP_PROXY=[["/api","http://10.65.57.55:8080/api"]]
|
# VITE_APP_PROXY=[["/api","http://192.168.130.12:8080/api"]]
|
||||||
# 线上
|
# 线上
|
||||||
VITE_APP_PROXY=[["/api","https://test.jsspisoft.com/api"]]
|
VITE_APP_PROXY=[["/api","https://test.jsspisoft.com/api"]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,13 +185,28 @@
|
|||||||
<el-form-item :label="ModelAttributeFieldsEnums['attributeCode']" prop="attributeCode">
|
<el-form-item :label="ModelAttributeFieldsEnums['attributeCode']" prop="attributeCode">
|
||||||
<el-input v-model="attributeForm.attributeCode" :placeholder="'请输入' + ModelAttributeFieldsEnums['attributeCode']"></el-input>
|
<el-input v-model="attributeForm.attributeCode" :placeholder="'请输入' + ModelAttributeFieldsEnums['attributeCode']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="ModelAttributeFieldsEnums['attributeTypeName']" prop="attributeType">
|
<div class="formRowStyle">
|
||||||
<el-select v-model="attributeForm.attributeType" :placeholder="'请选择' + ModelAttributeFieldsEnums['attributeTypeName']">
|
<el-form-item :label="ModelAttributeFieldsEnums['attributeTypeName']" prop="attributeType">
|
||||||
<el-option label="模拟量" :value="138"></el-option>
|
<el-select
|
||||||
<el-option label="累积量" :value="139"></el-option>
|
v-model="attributeForm.attributeType"
|
||||||
<el-option label="离散量" :value="140"></el-option>
|
:placeholder="'请选择' + ModelAttributeFieldsEnums['attributeTypeName']"
|
||||||
</el-select>
|
@change="attributeTypeChange"
|
||||||
</el-form-item>
|
>
|
||||||
|
<el-option label="模拟量" :value="138"></el-option>
|
||||||
|
<el-option label="累积量" :value="139"></el-option>
|
||||||
|
<el-option label="离散量" :value="140"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="ModelAttributeFieldsEnums['dataType']" prop="dataType">
|
||||||
|
<el-select
|
||||||
|
:disabled="!attributeForm.attributeType || attributeForm.attributeType === 140"
|
||||||
|
v-model="attributeForm.dataType"
|
||||||
|
:placeholder="'请选择' + ModelAttributeFieldsEnums['dataType']"
|
||||||
|
>
|
||||||
|
<el-option v-for="v in attributeFormDataTypeOptions" :key="v.value" :label="v.value" :value="v.value"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
|
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
|
||||||
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
|
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -201,6 +216,9 @@
|
|||||||
<el-form-item :label="ModelAttributeFieldsEnums['highSpeed']" prop="highSpeed">
|
<el-form-item :label="ModelAttributeFieldsEnums['highSpeed']" prop="highSpeed">
|
||||||
<el-checkbox v-model="attributeForm.highSpeed"></el-checkbox>
|
<el-checkbox v-model="attributeForm.highSpeed"></el-checkbox>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="ModelAttributeFieldsEnums['visible']" prop="visible">
|
||||||
|
<el-checkbox v-model="attributeForm.visible"></el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button type="primary" @click="submitAttributeForm">提交</el-button>
|
<el-button type="primary" @click="submitAttributeForm">提交</el-button>
|
||||||
@ -278,7 +296,9 @@ import {
|
|||||||
ModelAttributeTableType,
|
ModelAttributeTableType,
|
||||||
ModelServiceTableType,
|
ModelServiceTableType,
|
||||||
ModelServiceFieldsEnums,
|
ModelServiceFieldsEnums,
|
||||||
|
ModelAttributeType,
|
||||||
AttributeDialogTitleStateType,
|
AttributeDialogTitleStateType,
|
||||||
|
attributeTypeDataType,
|
||||||
serviceDialogTitleStateType,
|
serviceDialogTitleStateType,
|
||||||
GetModelServiceType,
|
GetModelServiceType,
|
||||||
GetModelAttributeType,
|
GetModelAttributeType,
|
||||||
@ -533,6 +553,7 @@ const getAttributeList = (type?: radioGroupType, value?: string) => {
|
|||||||
? '离散量'
|
? '离散量'
|
||||||
: item.attributeType!,
|
: item.attributeType!,
|
||||||
highSpeed: item.highSpeed === 1,
|
highSpeed: item.highSpeed === 1,
|
||||||
|
visible: item.visible === 1,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
pageTotal.value = res.total
|
pageTotal.value = res.total
|
||||||
@ -607,6 +628,12 @@ const delServiceForm = (data: AddModelServiceType & UpdateModelServiceType) => {
|
|||||||
|
|
||||||
const attributeVisible = ref(false)
|
const attributeVisible = ref(false)
|
||||||
const attributeFormTitle = ref(AttributeDialogTitleStateType['add'])
|
const attributeFormTitle = ref(AttributeDialogTitleStateType['add'])
|
||||||
|
const attributeFormDataTypeOptions: { value: attributeTypeDataType }[] = [
|
||||||
|
{ value: 'int4' },
|
||||||
|
{ value: 'int8' },
|
||||||
|
{ value: 'float4' },
|
||||||
|
{ value: 'float8' },
|
||||||
|
]
|
||||||
const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
||||||
id: null,
|
id: null,
|
||||||
iotModelId: '',
|
iotModelId: '',
|
||||||
@ -615,7 +642,9 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
|||||||
attributeType: null,
|
attributeType: null,
|
||||||
porder: null,
|
porder: null,
|
||||||
highSpeed: false,
|
highSpeed: false,
|
||||||
subsystem:'',
|
subsystem: '',
|
||||||
|
dataType: '',
|
||||||
|
visible: true,
|
||||||
revision: 1,
|
revision: 1,
|
||||||
createdBy: undefined,
|
createdBy: undefined,
|
||||||
createdTime: undefined,
|
createdTime: undefined,
|
||||||
@ -625,6 +654,12 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
|||||||
const attributeFormRef = ref<FormInstance>()
|
const attributeFormRef = ref<FormInstance>()
|
||||||
const attributeForm = ref<AddModelAttributeType & UpdateModelAttributeType>(JSON.parse(JSON.stringify(originAttributeForm)))
|
const attributeForm = ref<AddModelAttributeType & UpdateModelAttributeType>(JSON.parse(JSON.stringify(originAttributeForm)))
|
||||||
|
|
||||||
|
const attributeTypeChange = (value: ModelAttributeType) => {
|
||||||
|
if (value === 140) {
|
||||||
|
attributeForm.value.dataType = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const closeAttributeForm = () => {
|
const closeAttributeForm = () => {
|
||||||
attributeVisible.value = false
|
attributeVisible.value = false
|
||||||
attributeForm.value = JSON.parse(JSON.stringify(originAttributeForm))
|
attributeForm.value = JSON.parse(JSON.stringify(originAttributeForm))
|
||||||
@ -633,11 +668,12 @@ const closeAttributeForm = () => {
|
|||||||
const submitAttributeForm = () => {
|
const submitAttributeForm = () => {
|
||||||
attributeFormRef.value?.validate((valid: boolean) => {
|
attributeFormRef.value?.validate((valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
const copyFormData = JSON.parse(JSON.stringify(attributeForm.value))
|
||||||
|
copyFormData.highSpeed = copyFormData.highSpeed ? 1 : 0
|
||||||
|
copyFormData.visible = copyFormData.visible ? 1 : 0
|
||||||
if (attributeFormTitle.value === AttributeDialogTitleStateType['add']) {
|
if (attributeFormTitle.value === AttributeDialogTitleStateType['add']) {
|
||||||
const addFormData = JSON.parse(JSON.stringify(attributeForm.value))
|
copyFormData.iotModelId = curContextMenuTreeData.value!.id!
|
||||||
addFormData.iotModelId = curContextMenuTreeData.value!.id!
|
addModelAttributeReq(copyFormData)
|
||||||
addFormData.highSpeed = addFormData.highSpeed ? 1 : 0
|
|
||||||
addModelAttributeReq(addFormData)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
ElMessage.success('新增物模型属性成功')
|
ElMessage.success('新增物模型属性成功')
|
||||||
@ -651,9 +687,7 @@ const submitAttributeForm = () => {
|
|||||||
ElMessage.error(err?.response?.data?.msg ?? '新增失败')
|
ElMessage.error(err?.response?.data?.msg ?? '新增失败')
|
||||||
})
|
})
|
||||||
} else if (attributeFormTitle.value === AttributeDialogTitleStateType['edit']) {
|
} else if (attributeFormTitle.value === AttributeDialogTitleStateType['edit']) {
|
||||||
const updateForm = JSON.parse(JSON.stringify(attributeForm.value))
|
updateModelAttributeReq(copyFormData)
|
||||||
updateForm.highSpeed = updateForm.highSpeed ? 1 : 0
|
|
||||||
updateModelAttributeReq(updateForm)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
ElMessage.success('修改物模型属性成功')
|
ElMessage.success('修改物模型属性成功')
|
||||||
@ -964,4 +998,10 @@ $paginationHeight: 32px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.formRowStyle {
|
||||||
|
display: flex;
|
||||||
|
.el-select {
|
||||||
|
width: 184px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -62,8 +62,10 @@ export enum ModelAttributeFieldsEnums {
|
|||||||
'attributeType' = '属性类型value',
|
'attributeType' = '属性类型value',
|
||||||
'attributeTypeName' = '属性类型',
|
'attributeTypeName' = '属性类型',
|
||||||
'porder' = '序号',
|
'porder' = '序号',
|
||||||
'highSpeed'='是否高频',
|
'highSpeed' = '是否高频',
|
||||||
'subsystem'='子系统',
|
'subsystem' = '子系统',
|
||||||
|
'dataType' = '数据类型',
|
||||||
|
'visible'='是否可见',
|
||||||
'revision' = '乐观锁',
|
'revision' = '乐观锁',
|
||||||
'createdBy' = '创建人',
|
'createdBy' = '创建人',
|
||||||
'createdTime' = '创建时间',
|
'createdTime' = '创建时间',
|
||||||
@ -94,14 +96,17 @@ export type GetModelAttributeType = {
|
|||||||
pageNum: number
|
pageNum: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type attributeTypeDataType = 'int4' | 'int8' | 'float4' | 'float8'
|
||||||
export type AddModelAttributeType = {
|
export type AddModelAttributeType = {
|
||||||
iotModelId: string
|
iotModelId: string
|
||||||
attributeCode: string
|
attributeCode: string
|
||||||
attributeName: string
|
attributeName: string
|
||||||
attributeType: ModelAttributeType | null
|
attributeType: ModelAttributeType | null
|
||||||
porder: number | null
|
porder: number | null
|
||||||
highSpeed:0|1|boolean
|
highSpeed: 0 | 1 | boolean
|
||||||
subsystem:string
|
subsystem: string
|
||||||
|
dataType: ''
|
||||||
|
visible: 0 | 1 | boolean
|
||||||
revision: number
|
revision: number
|
||||||
createdBy?: string
|
createdBy?: string
|
||||||
createdTime?: string
|
createdTime?: string
|
||||||
|
Loading…
Reference in New Issue
Block a user