This commit is contained in:
zhouhuang 2024-12-26 19:59:47 +08:00
commit e2440a72b2
7 changed files with 985 additions and 425 deletions

View File

@ -264,3 +264,69 @@ export function equipDetailsOrg(params: object = {}) {
data: params,
})
}
export function getOtherParamsReq(params: any) {
return createAxios({
url: '/api/equipment/extProps/query',
method: 'POST',
data: params,
})
}
export function addOtherParamsReq(params: any) {
return createAxios({
url: '/api/equipment/extProps/add',
method: 'POST',
data: params,
})
}
export function updateOtherParamsReq(params: any) {
return createAxios({
url: '/api/equipment/extProps/update',
method: 'POST',
data: params,
})
}
export function delOtherParamsReq(params: any) {
return createAxios({
url: '/api/equipment/extProps/delete',
method: 'POST',
data: params,
})
}
export function uploadOtherParamsFileReq(formData: FormData, V: string) {
const token = encrypt_aes(adminInfo.token, V)
return createAxios({
url: '/api/equipment//file/upload',
method: 'POST',
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
V,
token,
}
},
{ customEncrypt: true })
}
export function readFileReq(path: string, v: string) {
const formData = new FormData()
formData.append('path', path)
const token = encrypt_aes(adminInfo.token, v)
return createAxios({
url: '/api/equipment/file/read',
method: 'POST',
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
v,
token,
}
}, {
customEncrypt: true
})
}

View File

@ -0,0 +1,21 @@
import { useAdminInfo } from '/@/stores/adminInfo'
const authorityStore = useAdminInfo()
export const permission = () => {
return {
mounted: (el: any, binding: { value: number[] }) => {
let hasShow = false
for (let item of binding.value) {
if (authorityStore.authorities.includes(item)) {
hasShow = true
break
}
}
if (!hasShow) {
el.style.display = 'none'
}
}
}
}

View File

@ -92,7 +92,7 @@
<el-tag v-if="realTimeData.locked === 1" class="control-tag control-tag-left" type="primary">已锁定</el-tag>
<el-tag class="control-tag" type="primary">{{ realTimeDataState }}</el-tag>
</div>
<div class="btnLeft">
<div class="btnLeft" v-permission="[104]">
<el-button
@click="sendCommand('setTurbineFastStart')"
v-if="realTimeData.processedoperationmode !== 16"
@ -296,6 +296,8 @@ import { getAlarmListReq } from '/@/api/backend/alarms/request'
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
import { useEnumStore } from '/@/stores/enums'
import { adminBaseRoutePath } from '/@/router/static/adminBase'
import { permission } from '/@/utils/directive'
const vPermission = permission()
const enumStore = useEnumStore()
@ -1644,12 +1646,22 @@ $labelHeight: 24px;
.temperatureList {
@include cardDefaultStyle;
@include cardlabel;
position: relative;
display: flex;
flex-direction: column;
justify-content: space-around;
margin: 10px 0;
width: 100%;
height: calc(40% - 20px);
&::before {
content: '点击可查看温度管理详情';
position: absolute;
right: 10px;
bottom: 0;
font-size: 12px;
color: rgb(144, 147, 153);
}
.chartPart-item {
// margin: 5px 0;
width: 100%;
@ -1989,7 +2001,7 @@ $labelHeight: 24px;
color: #333333;
font-size: 16px;
font-weight: 600;
&:last-child{
&:last-child {
font-size: 14px;
}
}

View File

@ -26,7 +26,7 @@ export type GetAlarmsTableParam = {
eventLevel?: string | number | null
pageNum?: Number
pageSize?: Number
firstTriggeredCode: string | number | null
firstTriggeredCode?: string | number | null
}
export enum AlarmsFieldsEnums {

View File

@ -156,6 +156,7 @@ const selectPointNum = ref(10)
let realDataXAxis: any = []
let realDataSeries: any = []
let realDataYAxis: any = []
let realDataLegend: any = []
const getRandomDarkColor = () => {
let r = Math.floor(Math.random() * 200) // 0127
let g = Math.floor(Math.random() * 200)
@ -180,8 +181,9 @@ const createChartData = (data: { [k: string]: number }, time: string) => {
lastSeriesId.forEach((item: any) => {
if (!attrCode.includes(item)) {
const cur = realDataSeries.findIndex((val: any) => val.id === item)
// delete cur.id
realDataSeries.splice(cur, 1)
const curLegendIndex = realDataLegend.findIndex((val:any)=>val.customKey===item)
realDataLegend.splice(curLegendIndex,1)
clearState = true
}
})
@ -189,13 +191,13 @@ const createChartData = (data: { [k: string]: number }, time: string) => {
chartInstance.setOption(
{
series: realDataSeries,
legend: realDataLegend,
},
{
replaceMerge: ['series'],
replaceMerge: ['series','legend'],
}
)
}
const seriesData = attrCode.map((item) => {
const curVal = getCutDecimalsValue(data[item], 2)
if (lastSeriesId.includes(item)) {
@ -208,6 +210,14 @@ const createChartData = (data: { [k: string]: number }, time: string) => {
const len = list.length
const fillData = new Array(len).fill('')
fillData.push(curVal)
realDataLegend.push({
name:info.name,
icon: 'rect',
textStyle: {
color: color,
},
customKey:item
})
return {
id: item,
name: info.name + ' ' + (info?.unit ?? ''),
@ -298,6 +308,7 @@ const createChart = () => {
},
yAxis: realDataYAxis,
series: realDataSeries,
legend:realDataLegend
}
} else {
option = {
@ -386,7 +397,7 @@ const createChart = () => {
},
],
legend: {
data: [],
data: realDataLegend,
textStyle: {
color: '#73767a',
},
@ -394,7 +405,7 @@ const createChart = () => {
series: realDataSeries,
}
}
chart.setOption(option, { replaceMerge: ['series', 'yAxis'] })
chart.setOption(option, { replaceMerge: ['series', 'yAxis','legend'] })
chartInstance = chart
}

View File

@ -88,13 +88,13 @@ import { Top, Bottom, Close } from '@element-plus/icons-vue'
const props = withDefaults(
defineProps<{
defaultAttr: { attributeCode: string; attributeName: string }[]
visible: boolean,
iotModelId:string
visible: boolean
iotModelId: string
}>(),
{
defaultAttr: () => [],
visible: false,
iotModelId:''
iotModelId: '',
}
)
@ -111,7 +111,7 @@ const subSystemVal = ref('')
const subSystemList = ref()
const getAllSubSystem = () => {
getAllSubSystemReq({iotModelId:props.iotModelId}).then((res) => {
getAllSubSystemReq({ iotModelId: props.iotModelId }).then((res) => {
const data = res.data
.filter((item: any) => item)
.map((item: any) => {
@ -125,21 +125,21 @@ const getAllSubSystem = () => {
}
const attributeTableData = ref<{ attributeName: string; attributeCode: string }[]>([])
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) => {
return {
attributeName: item.attributeName,
attributeCode: item.attributeCode.toLowerCase(),
unit: item.unit,
const selectTable = (section: any, row: any) => {
const hasSelect = section.find((item: any) => item.attributeCode === row.attributeCode)
if (hasSelect) {
const hasExist = multipleSelection.value.find((item: any) => item.attributeCode === hasSelect.attributeCode.toLowerCase())
if (!hasExist) {
multipleSelection.value.push(hasSelect)
}
} else {
const index = multipleSelection.value.findIndex((item: any) => item.attributeCode === row.attributeCode.toLowerCase())
multipleSelection.value.splice(index, 1)
}
})
multipleSelection.value = [...props.defaultAttr, ...addSection]
}
const selectAllTable = (section: any) => {
const defaultCode = props.defaultAttr.map((item: any) => item.attributeCode)
if (section.length) {
const defaultCode = multipleSelection.value.map((item: any) => item.attributeCode.toLowerCase())
const addSection = section
.filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase()))
.map((item: any) => {
@ -149,7 +149,10 @@ const selectAllTable = (section: any) => {
unit: item.unit,
}
})
multipleSelection.value = [...props.defaultAttr, ...addSection]
multipleSelection.value = [...multipleSelection.value, ...addSection]
} else {
multipleSelection.value = []
}
}
const pageSetting = reactive({
current: 1,
@ -162,7 +165,7 @@ const pageChange = () => {
}
const attributeTableRef = ref<TableInstance>()
const multipleSelection = ref<{ attributeName: string; attributeCode: string }[]>(props.defaultAttr)
const multipleSelection = ref<{ attributeName: string; attributeCode: string }[]>([])
const Statistic = computed(() => multipleSelection.value.length)
const clearList = () => {
multipleSelection.value = []
@ -187,7 +190,7 @@ const moveDown = (index: number) => {
const moveRemove = (index: number, item: any) => {
multipleSelection.value.splice(index, 1)
nextTick(() => {
const row = attributeTableData.value.find((attr) => attr.attributeCode === item.attributeCode)
const row = attributeTableData.value.find((attr) => attr.attributeCode.toLowerCase() === item.attributeCode.toLowerCase())
attributeTableRef.value?.toggleRowSelection(row, false)
})
}
@ -219,13 +222,15 @@ const getTableData = (customData = {}) => {
})
}
const initSelect = () => {
const defaultCode = props.defaultAttr.map((item: any) => item.attributeCode)
const defaultCode = multipleSelection.value.map((item: any) => item.attributeCode.toLowerCase())
const row = attributeTableData.value.filter((item) => defaultCode.includes(item.attributeCode.toLowerCase()))
if (row.length === 0) return
nextTick(() => {
attributeTableRef.value?.clearSelection()
row.forEach((item) => {
attributeTableRef.value?.toggleRowSelection(item, true)
})
})
}
watch(
@ -234,6 +239,8 @@ watch(
if (props.visible) {
pageSetting.current = 1
pageSetting.pageSize = 20
multipleSelection.value = JSON.parse(JSON.stringify(props.defaultAttr))
initSelect()
}
}
)
@ -246,6 +253,7 @@ defineExpose({
})
onMounted(() => {
multipleSelection.value = JSON.parse(JSON.stringify(props.defaultAttr))
getTableData()
getAllSubSystem()
})