Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
b01080d72d
@ -32,6 +32,7 @@ import com.das.modules.node.mapper.SysCommunicationLinkMapper;
|
|||||||
import com.das.modules.node.mapper.SysImpTabMappingMapper;
|
import com.das.modules.node.mapper.SysImpTabMappingMapper;
|
||||||
import com.das.modules.node.mapper.SysNodeMapper;
|
import com.das.modules.node.mapper.SysNodeMapper;
|
||||||
import com.das.modules.node.service.SysNodeService;
|
import com.das.modules.node.service.SysNodeService;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@ -407,10 +408,6 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void saveMappingList(List<SysTabMappingVo> impList) {
|
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){
|
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));
|
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());
|
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("检查顺序,排序不能重复");
|
throw new ServiceException("检查顺序,排序不能重复");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
if (!CollectionUtils.isEmpty(impList)) {
|
||||||
|
List<SysTabMapping> list = new ArrayList<>();
|
||||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||||
for (SysTabMappingVo imp : impList) {
|
for (SysTabMappingVo imp : impList) {
|
||||||
SysTabMapping rec = sysImptabmappingMapper.selectById(imp.getId());
|
SysTabMapping rec = sysImptabmappingMapper.selectById(imp.getId());
|
||||||
@ -540,12 +540,19 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
|
|
||||||
private Boolean checkOrderRepeated(List<SysTabMappingVo> mappings) {
|
private Boolean checkOrderRepeated(List<SysTabMappingVo> mappings) {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
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;
|
Boolean orderRepeated = false;
|
||||||
try {
|
try {
|
||||||
// 提取所有的 order 字段,转换为 Set
|
// 提取所有的 order 字段,转换为 Set
|
||||||
Set<String> orderSet = new HashSet<>();
|
Set<String> orderSet = new HashSet<>();
|
||||||
orderRepeated = mappings.stream()
|
orderRepeated = orderCollect.stream()
|
||||||
.map(SysTabMappingVo::getParams) // 提取 param 字段
|
.map(SysTabMappingVo::getParams) // 提取 param 字段
|
||||||
.map(param -> {
|
.map(param -> {
|
||||||
try {
|
try {
|
||||||
@ -556,7 +563,16 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
throw new RuntimeException("JSON 解析失败: " + param, e);
|
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){
|
}catch (Exception e){
|
||||||
log.error("校验order不重复失败",e);
|
log.error("校验order不重复失败",e);
|
||||||
}
|
}
|
||||||
|
@ -15,4 +15,18 @@ export function Paramupdate(params: object = {}) {
|
|||||||
data: params,
|
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,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
<div class="SystemParam">
|
<div class="SystemParam">
|
||||||
<el-container class="mainContainer">
|
<el-container class="mainContainer">
|
||||||
<div class="mainHeader">
|
<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>
|
</div>
|
||||||
<el-main class="defaultMain">
|
<el-main class="defaultMain">
|
||||||
<el-row>
|
<el-row>
|
||||||
@ -11,7 +12,7 @@
|
|||||||
<el-table :data="paramData" style="width: 100%">
|
<el-table :data="paramData" style="width: 100%">
|
||||||
<el-table-column prop="paramName" label="参数名称" />
|
<el-table-column prop="paramName" label="参数名称" />
|
||||||
<el-table-column prop="paramDesc" 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">
|
<el-table-column label="操作" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span style="color: #0064aa; cursor: pointer"
|
<span style="color: #0064aa; cursor: pointer"
|
||||||
@ -22,6 +23,9 @@
|
|||||||
v-else
|
v-else
|
||||||
@click="EditLayout(scope)"
|
@click="EditLayout(scope)"
|
||||||
>编辑</span>
|
>编辑</span>
|
||||||
|
<span style="color: #0064aa; cursor: pointer;margin-left: 10px;"
|
||||||
|
@click="fromDelete(scope)"
|
||||||
|
>删除</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -202,13 +206,61 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {onMounted, ref,nextTick} from 'vue'
|
import {onMounted, ref, nextTick, reactive} from 'vue'
|
||||||
import { getParamList,Paramupdate } from '/@/api/backend/SystemParam/request'
|
import {getParamList, ParamAdd, Paramdelete, Paramupdate} from '/@/api/backend/SystemParam/request'
|
||||||
import { ElMessage} from 'element-plus'
|
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 paramData=ref([])
|
||||||
const tableData = ref([])
|
const tableData = ref([])
|
||||||
const PARAM_COLOR = 'paramColor';
|
const PARAM_COLOR = 'paramColor';
|
||||||
@ -323,6 +375,108 @@ const onSubmit=()=>{
|
|||||||
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
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(() =>{
|
onMounted(() =>{
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
@ -395,6 +549,11 @@ $headerHeight: 60px;
|
|||||||
-webkit-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
|
-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 {
|
@keyframes selected {
|
||||||
|
Loading…
Reference in New Issue
Block a user