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

View File

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

View File

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

View File

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