物模型:添加敏感字段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 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-form-item :label="ModelAttributeFieldsEnums['visible']" prop="visible">
<el-checkbox v-model="attributeForm.visible"></el-checkbox> <el-checkbox v-model="attributeForm.visible"></el-checkbox>
</el-form-item> </el-form-item>
<el-form-item :label="ModelAttributeFieldsEnums['confidential']" prop="confidential">
<el-checkbox v-model="attributeForm.confidential"></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>
@ -692,6 +695,7 @@ const getAttributeList = ({
: item.attributeType!, : item.attributeType!,
highSpeed: item.highSpeed === 1, highSpeed: item.highSpeed === 1,
visible: item.visible === 1, visible: item.visible === 1,
confidential: item.confidential === 1,
} }
}) })
pageTotal.value = res.total pageTotal.value = res.total
@ -807,6 +811,7 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
unit: '', unit: '',
stateDesc: '', stateDesc: '',
level: undefined, level: undefined,
confidential: false,
revision: 1, revision: 1,
createdBy: undefined, createdBy: undefined,
createdTime: undefined, createdTime: undefined,
@ -835,6 +840,7 @@ const submitAttributeForm = () => {
const copyFormData = JSON.parse(JSON.stringify(attributeForm.value)) const copyFormData = JSON.parse(JSON.stringify(attributeForm.value))
copyFormData.highSpeed = copyFormData.highSpeed ? 1 : 0 copyFormData.highSpeed = copyFormData.highSpeed ? 1 : 0
copyFormData.visible = copyFormData.visible ? 1 : 0 copyFormData.visible = copyFormData.visible ? 1 : 0
copyFormData.confidential = copyFormData.confidential ? 1 : 0
if (copyFormData.stateDesc0 || copyFormData.stateDesc1) { if (copyFormData.stateDesc0 || copyFormData.stateDesc1) {
copyFormData.stateDesc = (copyFormData?.stateDesc0 ?? '') + '|' + (copyFormData?.stateDesc1 ?? '') copyFormData.stateDesc = (copyFormData?.stateDesc0 ?? '') + '|' + (copyFormData?.stateDesc1 ?? '')
} }

View File

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

View File

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

View File

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

View File

@ -4,12 +4,23 @@
<el-col :span="14"> <el-col :span="14">
<div class="transferLeft"> <div class="transferLeft">
<div class="transferHeader"> <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-group v-model="radioActiveName" @change="typeChange">
<el-radio :value="138">模拟量</el-radio> <el-radio :value="138">模拟量</el-radio>
<el-radio :value="199">计算量</el-radio> <el-radio :value="199">计算量</el-radio>
<el-radio :value="140">状态量</el-radio> <el-radio :value="140">状态量</el-radio>
</el-radio-group> </el-radio-group> -->
</div> </div>
<el-main class="mainPart"> <el-main class="mainPart">
<el-table <el-table
@ -42,7 +53,7 @@
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<div class="transferRight"> <div class="transferRight">
<div class="transferHeader"> <div class="transferHeader transferHeaderRight">
<span class="transferTitle" <span class="transferTitle"
>已选择<span>{{ Statistic }}</span >已选择<span>{{ Statistic }}</span
></span ></span
@ -70,7 +81,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed, watch, nextTick, onMounted } from 'vue' 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 { ElMessage, TableInstance } from 'element-plus'
import { Top, Bottom, Close } from '@element-plus/icons-vue' 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 searchType = ref('attributeName')
const typeChange = () => {
getTableData() 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 }[]>([]) 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 defaultCode = props.defaultAttr.map((item: any) => item.attributeCode)
const addSection = section const addSection = section
.filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase())) .filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase()))
.map((item:any) => { .map((item: any) => {
return { return {
attributeName: item.attributeName, attributeName: item.attributeName,
attributeCode: item.attributeCode.toLowerCase(), attributeCode: item.attributeCode.toLowerCase(),
@ -108,7 +140,7 @@ const selectAllTable = (section: any) => {
const defaultCode = props.defaultAttr.map((item: any) => item.attributeCode) const defaultCode = props.defaultAttr.map((item: any) => item.attributeCode)
const addSection = section const addSection = section
.filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase())) .filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase()))
.map((item:any) => { .map((item: any) => {
return { return {
attributeName: item.attributeName, attributeName: item.attributeName,
attributeCode: item.attributeCode.toLowerCase(), 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({ getModelAttributeListReq({
iotModelId: '', iotModelId: '',
attributeType: radioActiveName.value, // attributeType: radioActiveName.value,
pageNum: pageSetting.current, pageNum: pageSetting.current,
pageSize: pageSetting.pageSize, pageSize: pageSetting.pageSize,
subSystem: (!subSystemVal.value || subSystemVal.value === ' ') ? null : subSystemVal.value,
...inputVal,
...customData,
}) })
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
@ -207,6 +245,7 @@ defineExpose({
onMounted(() => { onMounted(() => {
getTableData() getTableData()
getAllSubSystem()
}) })
</script> </script>
@ -217,13 +256,35 @@ onMounted(() => {
.transferHeader { .transferHeader {
height: 40px; height: 40px;
display: flex; display: flex;
justify-content: space-between; // justify-content: space-between;
align-items: center; align-items: center;
padding: 0 10px; padding: 0 10px;
color: #333333; color: #333333;
background: #f7f9fc; background: #f7f9fc;
border-bottom: 1px solid #e1edf6; border-bottom: 1px solid #e1edf6;
border-radius: 6px 6px 0 0; 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 { .transferLeft {
width: 550px; width: 550px;

View File

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