物模型:添加敏感字段confidential

实时数据:测点选择修改为搜索框,添加子系统选择框
This commit is contained in:
高云鹏 2024-12-17 10:30:19 +08:00
parent c96c3ed552
commit b533146d3c
7 changed files with 198 additions and 42 deletions

View File

@ -179,3 +179,10 @@ export function queryfaultCodeDict(params: object = {}) {
showErrorMessage: false
})
}
export function getAllSubSystemReq() {
return createAxios({
url: '/api/equipment/model/attribute/getAllSubsystem',
method: 'post'
})
}

View File

@ -277,6 +277,9 @@
<el-form-item :label="ModelAttributeFieldsEnums['visible']" prop="visible">
<el-checkbox v-model="attributeForm.visible"></el-checkbox>
</el-form-item>
<el-form-item :label="ModelAttributeFieldsEnums['confidential']" prop="confidential">
<el-checkbox v-model="attributeForm.confidential"></el-checkbox>
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="submitAttributeForm">保存</el-button>
@ -692,6 +695,7 @@ const getAttributeList = ({
: item.attributeType!,
highSpeed: item.highSpeed === 1,
visible: item.visible === 1,
confidential: item.confidential === 1,
}
})
pageTotal.value = res.total
@ -807,6 +811,7 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
unit: '',
stateDesc: '',
level: undefined,
confidential: false,
revision: 1,
createdBy: undefined,
createdTime: undefined,
@ -835,6 +840,7 @@ const submitAttributeForm = () => {
const copyFormData = JSON.parse(JSON.stringify(attributeForm.value))
copyFormData.highSpeed = copyFormData.highSpeed ? 1 : 0
copyFormData.visible = copyFormData.visible ? 1 : 0
copyFormData.confidential = copyFormData.confidential ? 1 : 0
if (copyFormData.stateDesc0 || copyFormData.stateDesc1) {
copyFormData.stateDesc = (copyFormData?.stateDesc0 ?? '') + '|' + (copyFormData?.stateDesc1 ?? '')
}

View File

@ -73,7 +73,8 @@ export enum ModelAttributeFieldsEnums {
'createdTime' = '创建时间',
'updatedBy' = '更新人',
'updatedTime' = '更新时间',
'stateDesc' = '状态描述'
'stateDesc' = '状态描述',
'confidential'='敏感数据'
}
export enum ModelServiceFieldsEnums {
@ -115,6 +116,7 @@ export type AddModelAttributeType = {
unit: string
level?: 0 | 1 | 2
visible: 0 | 1 | boolean
confidential:0 | 1 | boolean
stateDesc:string
stateDesc0?:string
stateDesc1?:string

View File

@ -192,7 +192,7 @@
</div>
</template>
</el-dialog>
<el-dialog v-model="realDataLineChartVisible" title="实时曲线" @close="closeLineChart" width="1000">
<el-dialog v-model="realDataLineChartVisible" title="实时曲线" @close="closeLineChart" width="1200">
<RealDataChart
ref="realDataChartRef"
:visible="realDataLineChartVisible"
@ -432,28 +432,28 @@ const dynamicColumn: TableColumnType[] = [
width: 100,
},
{
label: '有功功率 (KW)',
label: '有功功率 (kW)',
prop: 'igenpower',
align: 'center',
custom: 'header',
width: 100,
},
{
label: '有功给定 (KW)',
label: '有功给定 (kW)',
prop: 'iactivepowersetpointvalue',
align: 'center',
custom: 'header',
width: 100,
},
{
label: '无功功率 (KVar)',
label: '无功功率 (kVar)',
prop: 'ireactivepower',
align: 'center',
custom: 'header',
width: 100,
},
{
label: '无功给定 (KVar)',
label: '无功给定 (kVar)',
prop: 'ireactivepowersetpointvalue',
align: 'center',
custom: 'header',

View File

@ -13,7 +13,7 @@
</div>
<div class="leftMain">
<el-scrollbar>
<el-checkbox-group v-model="selectList" @change="changeCheck">
<el-checkbox-group v-model="selectList" @change="changeCheck" :max="selectPointNum">
<el-checkbox
v-for="item in realDataList"
:key="item.prop"
@ -146,8 +146,10 @@ const getRealData = () => {
})
return []
}
const selectPointNum = ref(10)
let realDataXAxis: any = []
let realDataSeries: any = []
let realDataYAxis: any = []
const getRandomDarkColor = () => {
let r = Math.floor(Math.random() * 200) // 0127
let g = Math.floor(Math.random() * 200)
@ -171,8 +173,9 @@ const createChartData = (data: { [k: string]: number }, time: string) => {
let clearState = null
lastSeriesId.forEach((item: any) => {
if (!attrCode.includes(item)) {
const cur = realDataSeries.find((val: any) => val.id === item)
delete cur.id
const cur = realDataSeries.findIndex((val: any) => val.id === item)
// delete cur.id
realDataSeries.splice(cur, 1)
clearState = true
}
})
@ -201,7 +204,7 @@ const createChartData = (data: { [k: string]: number }, time: string) => {
fillData.push(curVal)
return {
id: item,
name: info.name + info.unit,
name: info.name +' '+ (info?.unit ?? ''),
type: 'line',
barWidth: 20,
itemStyle: {
@ -221,19 +224,82 @@ const createChart = () => {
const chart = chartInstance ?? echarts.init(chartRef.value)
let option = null
if (chartInstance && realDataXAxis.length > 1) {
const nameMap: any = {}
realDataSeries.forEach((item: any) => {
const yAxisName = item.name.split(' ')[1]
if (nameMap[yAxisName] || nameMap[yAxisName]===0) {
item.yAxisIndex = nameMap[yAxisName]
} else {
const len = Object.keys(nameMap).length
item.yAxisIndex = len
nameMap[yAxisName] = len
}
})
const nameMapKeys = Object.keys(nameMap)
if (realDataSeries.length >= 4 && nameMapKeys.length === 4) {
selectPointNum.value = realDataSeries.length
}
const yAxisData = nameMapKeys.map((item, index) => {
const offset = Math.floor(index / 2) * 50
const position = index % 2 == 0 ? 'left' : 'right'
const yAxisName = item
const cacheYAxis = realDataYAxis.find((item: any) => item.name === yAxisName)
if (cacheYAxis) {
return {
...cacheYAxis,
offset,
position,
}
} else {
return {
type: 'value',
name: item,
nameTextStyle: {
color: '#4E5969',
},
axisLine: {
show: false,
onZero: false,
lineStyle: {
color: '#dadada',
width: 0,
type: 'solid',
},
},
axisLabel: {
//x
show: true,
color: '#4E5969',
},
axisTick: { show: false },
splitLine: {
interval: 50,
lineStyle: {
type: 'dashed',
color: '#dadada',
},
},
offset,
position,
}
}
})
realDataYAxis = yAxisData
option = {
xAxis: {
data: realDataXAxis,
},
yAxis: realDataYAxis,
series: realDataSeries,
}
} else {
option = {
grid: {
top: 50,
right: 23,
right: 60,
bottom: 50,
left: 18,
left: 60,
containLabel: true,
},
tooltip: {
@ -280,6 +346,7 @@ const createChart = () => {
},
axisLine: {
show: false,
onZero: false,
lineStyle: {
color: '#dadada',
width: 0,
@ -321,7 +388,7 @@ const createChart = () => {
series: realDataSeries,
}
}
chart.setOption(option, { replaceMerge: 'series' })
chart.setOption(option, { replaceMerge: ['series', 'yAxis'] })
chartInstance = chart
}
@ -338,6 +405,19 @@ const selectPointAttr = computed(() => {
const addPoint = () => {
selectPointVisible.value = true
}
const checkShowChart = (data: any) => {
console.log(realDataSeries)
const curCode = data.map((item: any) => item.prop)
console.log(curCode, 'curCode')
for (let i = selectList.value.length - 1; i >= 0; i--) {
if (!curCode.includes(selectList.value[i])) {
selectList.value.splice(i, 1)
realDataSeries.splice(i, 1)
changeCheck()
}
}
}
const saveSelectPoint = () => {
const data = selectPointRef.value?.getSelectList()
if (data) {
@ -348,9 +428,10 @@ const saveSelectPoint = () => {
unit: item.unit,
}
})
checkShowChart(selectList)
realDataList.value = selectList
selectPointVisible.value = false
ElMessage.success('添加成功')
ElMessage.success('修改成功')
}
}
let timer: any = null
@ -364,6 +445,7 @@ const clearTimer = () => {
timer = null
realDataSeries = []
realDataXAxis = []
realDataYAxis = []
pauseState.value = false
emits('clearChart')
}

View File

@ -4,12 +4,23 @@
<el-col :span="14">
<div class="transferLeft">
<div class="transferHeader">
<span class="transferTitle">可添加的测点</span>
<div class="searchPart">
<el-radio-group v-model="searchType" class="radio">
<el-radio value="attributeName">名称</el-radio>
<el-radio value="attributeCode">编码</el-radio>
</el-radio-group>
</div>
<el-input clearable class="searchInput" placeholder="请输入测点信息" v-model="searchInfo" @change="search"></el-input>
<!-- <el-button type="primary" @click="search">查询</el-button> -->
<el-select v-model="subSystemVal" placeholder="请选择子系统" @change="search">
<el-option v-for="item in subSystemList" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select>
<!-- <span class="transferTitle">可添加的测点</span>
<el-radio-group v-model="radioActiveName" @change="typeChange">
<el-radio :value="138">模拟量</el-radio>
<el-radio :value="199">计算量</el-radio>
<el-radio :value="140">状态量</el-radio>
</el-radio-group>
</el-radio-group> -->
</div>
<el-main class="mainPart">
<el-table
@ -42,7 +53,7 @@
</el-col>
<el-col :span="10">
<div class="transferRight">
<div class="transferHeader">
<div class="transferHeader transferHeaderRight">
<span class="transferTitle"
>已选择<span>{{ Statistic }}</span
></span
@ -70,7 +81,7 @@
<script setup lang="ts">
import { ref, reactive, computed, watch, nextTick, onMounted } from 'vue'
import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request'
import { getModelAttributeListReq, getAllSubSystemReq } from '/@/api/backend/deviceModel/request'
import { ElMessage, TableInstance } from 'element-plus'
import { Top, Bottom, Close } from '@element-plus/icons-vue'
@ -85,9 +96,30 @@ const props = withDefaults(
}
)
const radioActiveName = ref<138 | 139 | 140 | 199>(138)
const typeChange = () => {
getTableData()
const searchType = ref('attributeName')
const searchInfo = ref('')
// const radioActiveName = ref<138 | 139 | 140 | 199>(138)
const search = () => {
getTableData({ pageNum: 1 })
}
const subSystemVal = ref('')
const subSystemList = ref()
const getAllSubSystem = () => {
getAllSubSystemReq().then((res) => {
const data = res.data
.filter((item: any) => item)
.map((item:any) => {
return {
label: item,
value: item,
}
})
subSystemList.value = [...data, { label: '全部', value: ' ' }]
})
}
const attributeTableData = ref<{ attributeName: string; attributeCode: string }[]>([])
@ -95,7 +127,7 @@ const selectTable = (section: any) => {
const defaultCode = props.defaultAttr.map((item: any) => item.attributeCode)
const addSection = section
.filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase()))
.map((item:any) => {
.map((item: any) => {
return {
attributeName: item.attributeName,
attributeCode: item.attributeCode.toLowerCase(),
@ -108,7 +140,7 @@ const selectAllTable = (section: any) => {
const defaultCode = props.defaultAttr.map((item: any) => item.attributeCode)
const addSection = section
.filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase()))
.map((item:any) => {
.map((item: any) => {
return {
attributeName: item.attributeName,
attributeCode: item.attributeCode.toLowerCase(),
@ -158,12 +190,18 @@ const moveRemove = (index: number, item: any) => {
})
}
const getTableData = () => {
const getTableData = (customData = {}) => {
const inputVal: any = {}
inputVal[searchType.value] = searchInfo.value
getModelAttributeListReq({
iotModelId: '',
attributeType: radioActiveName.value,
// attributeType: radioActiveName.value,
pageNum: pageSetting.current,
pageSize: pageSetting.pageSize,
subSystem: (!subSystemVal.value || subSystemVal.value === ' ') ? null : subSystemVal.value,
...inputVal,
...customData,
})
.then((res) => {
if (res.code === 200) {
@ -207,6 +245,7 @@ defineExpose({
onMounted(() => {
getTableData()
getAllSubSystem()
})
</script>
@ -217,13 +256,35 @@ onMounted(() => {
.transferHeader {
height: 40px;
display: flex;
justify-content: space-between;
// justify-content: space-between;
align-items: center;
padding: 0 10px;
color: #333333;
background: #f7f9fc;
border-bottom: 1px solid #e1edf6;
border-radius: 6px 6px 0 0;
.searchPart {
.radio {
width: 110px;
.el-radio {
margin-right: 5px;
width: 50px;
}
}
}
.searchInput {
width: 200px;
margin: 0 20px;
}
.el-select {
width: 200px;
}
:deep(.el-input__wrapper) {
width: 200px;
}
}
.transferHeaderRight {
justify-content: space-between;
}
.transferLeft {
width: 550px;

View File

@ -130,8 +130,8 @@ export const excelDefaultConfig: any = {
code: 'limit2Low'
},
{
label:'强制归档',
code:'forceArchive',
label: '强制归档',
code: 'forceArchive',
}
],
R0C4: ['03', '04'],
@ -247,8 +247,8 @@ export const excelDefaultConfig: any = {
code: 'col3',
},
{
label:'强制归档',
code:'forceArchive',
label: '强制归档',
code: 'forceArchive',
}
],
R0C4: ['03', '04'],
@ -280,8 +280,8 @@ export const excelDefaultConfig: any = {
code: 'col3',
},
{
label:'强制归档',
code:'forceArchive',
label: '强制归档',
code: 'forceArchive',
}
],
R0C4: ['01', '02', '03', '04'],
@ -358,8 +358,8 @@ export const excelDefaultConfig: any = {
code: 'limit2Low'
},
{
label:'强制归档',
code:'forceArchive',
label: '强制归档',
code: 'forceArchive',
}
],
R0C4: [
@ -374,7 +374,7 @@ export const excelDefaultConfig: any = {
"8. 16位BCD数据",
"9. 8位归一化值"
], // 数据类型的提示
R0C7:[
R0C7: [
"0. 不启用",
"1. 启用"
]
@ -420,8 +420,8 @@ export const excelDefaultConfig: any = {
name: '累计量',
head: [
{
label:'强制归档',
code:'forceArchive',
label: '强制归档',
code: 'forceArchive',
}
],
},
@ -442,8 +442,8 @@ export const excelDefaultConfig: any = {
code: 'registerAddr',
},
{
label:'强制归档',
code:'forceArchive',
label: '强制归档',
code: 'forceArchive',
}
],
R0C4: [
@ -684,7 +684,7 @@ export const createUpLoadExcelData = (workbookData: any) => {
sheetData.protocol = sheets[item].cellData[key][fieldKey].custom.protocol
continue
}
if (fieldKey === '1') {
if (['1','2','3'].includes(fieldKey)) {
sheetData[sheetkeyMap[fieldKey]] = sheets[item].cellData[key][fieldKey]?.v ?? ''
continue
}
@ -692,8 +692,6 @@ export const createUpLoadExcelData = (workbookData: any) => {
}
sheetData.params = JSON.stringify(params)
data.push(sheetData)
console.log(data);
}
})
})