实时数据:测点选择回显问题

设备清单:添加能量管理设备表单
This commit is contained in:
高云鹏 2025-01-17 10:55:10 +08:00
parent e56dc03ccc
commit 0ba63ec627
3 changed files with 59 additions and 95 deletions

View File

@ -342,11 +342,9 @@ const sizeChange = () => {
// computedHeight.alarmHeight = rect.height - 570 + 'px'
// computedHeight.centerHeight = rect.height - 20 + 'px'
const bgiRect = backgroundImgRef.value?.getBoundingClientRect()
console.log(bgiRect)
if (!bgiRect) return
computedHeight.backgroundImgHeight = bgiRect.height + 'px'
console.log(computedHeight.backgroundImgHeight)
}
let timer: any = null

View File

@ -499,10 +499,11 @@ let dynamicColumn = ref<TableColumnType[]>([
])
const tableColumn = ref<TableColumnType[]>([...defaultColumn, ...dynamicColumn.value])
const getSaveColumn = () => {
const saveColumn = localStorage.getItem('airBlowerTableColumnList')
if (saveColumn) {
tableColumn.value = JSON.parse(saveColumn)
dynamicColumn.value = tableColumn.value.slice(4)
const saveColumn = localStorage.getItem('airBlowerTableColumnList')
if (saveColumn && saveColumn !=='undefined') {
const parseColumn = JSON.parse(saveColumn)
tableColumn.value = [...defaultColumn, ...parseColumn]
dynamicColumn.value = parseColumn
}
}
getSaveColumn()
@ -683,7 +684,8 @@ const mutiTaskList = ref<
const selectPointDialogRef = ref()
const selectPointVisible = ref(false)
const defaultAttr = computed(() => {
const defaultAttr = computed(() => {
selectPointVisible.value
return dynamicColumn.value.map((item) => {
return {
attributeName: item.label.split(' ')[0],
@ -700,65 +702,25 @@ const openMeasure = () => {
}
const saveSelectPoint = () => {
const list = selectPointDialogRef.value?.getSelectList()
if (list) {
if (list) {
const addCoulmn = list.map((item: any) => {
return {
label: item.unit ? item.attributeName + item.unit : item.attributeName,
label: item.unit ? item.attributeName +' '+ item.unit : item.attributeName,
prop: item.attributeCode.toLowerCase(),
align: 'center',
custom: item.unit ? 'header' : undefined,
width: 100,
width: 120,
}
})
dynamicColumn.value = list
})
dynamicColumn.value = addCoulmn
tableColumn.value = [...defaultColumn, ...addCoulmn]
localStorage.setItem('airBlowerTableColumnList', JSON.stringify(tableColumn.value))
localStorage.setItem('airBlowerTableColumnList', JSON.stringify(addCoulmn))
getTableData()
selectPointVisible.value = false
ElMessage.success('选择成功')
}
}
const downFun = () => {
// const itemsWithoutAge = tableData.value.map((item) => {
// const { irn, ...rest } = item
// return rest
// })
// if (!tableColumn.value.length || !itemsWithoutAge.length) {
// return []
// }
// const columnSet = new Set(tableColumn.value.map((item) => item.prop))
// const result: any = []
// itemsWithoutAge.forEach((item) => {
// const newItem: any = {}
// for (const itemKey in item) {
// if (columnSet.has(itemKey)) {
// newItem[itemKey] = item[itemKey]
// }
// }
// if (Object.keys(newItem).length > 0) {
// result.push(newItem)
// }
// })
// let addobj: any = {}
// tableColumn.value.map((v, i) => {
// addobj['rowData' + i] = v.label
// })
// let tableDatadown = JSON.parse(JSON.stringify(result))
// tableDatadown.unshift(addobj)
// console.log(tableDatadown)
// debugger
// let str = ``
// for (let i = 0; i < tableDatadown.length; i++) {
// for (let item in tableDatadown[i]) {
// if (typeof tableDatadown[i][item] === 'string') {
// tableDatadown[i][item] = tableDatadown[i][item].replace(/[\n,]/g, (match: any) => (match === '\n' ? ' ' : ''))
// } else {
// console.warn(`tableDatadown[${i}][${item}] is not a string`)
// }
// str += `${tableDatadown[i][item] + '\t'},`
// }
// str += '\n'
// }
const title = tableColumn.value.map((item: any) => item.label).join('\t,') + '\n'
const titleKeyArr = tableColumn.value.map((item: any) => item.prop)
let str = ''

View File

@ -570,7 +570,7 @@
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="saveDeviceData">保存</el-button>
<el-button type="primary" @click="saveData">保存</el-button>
<el-button @click="type10001DialogVisible = false">取消</el-button>
</div>
</template>
@ -800,8 +800,8 @@ const defaultEquipmentProps = {
children: 'equipChildren',
}
const belongLineList = ref<{ value: string;id:string }[]>([])
const belongprojectList = ref<{ value: string;id:string }[]>([])
const belongLineList = ref<{ value: string; id: string }[]>([])
const belongprojectList = ref<{ value: string; id: string }[]>([])
const getEnumList = () => {
enumListQuery({ enumTypeId: '1872545505561620482' }).then((res) => {
belongprojectList.value = res.data.rows.map((item: { description: string; id: string }) => {
@ -920,6 +920,9 @@ const addDeviceList = () => {
type10002DialogTitle.value = '新增机组设备台账'
type10002DialogVisible.value = true
setOtherParamsFormData()
} else if (queryParameter.value.equipmentTypeId === 10003) {
type10001DialogTitle.value = '新增能量管理设备台账'
type10001DialogVisible.value = true
}
}
@ -980,9 +983,12 @@ const viewDeviceDetails = (data: any) => {
type10002DialogVisible.value = true
type10002DialogTitle.value = '编辑机组设备台账'
getOtherParams(data.row.id)
} else {
} else if (data.row.objectType === 10001) {
type10001DialogVisible.value = true
type10001DialogTitle.value = '编辑风电场设备台账'
} else if (data.row.objectType === 10003) {
type10001DialogTitle.value = '编辑能量管理设备台账'
type10001DialogVisible.value = true
}
setDevicedata(data.row)
}
@ -1069,45 +1075,41 @@ const modifyDeviceDetails = ref()
const saveData = () => {
modifyDeviceDetails.value.validate((valid: any) => {
if (valid) {
deviceTypeList.value.forEach((ele: any) => {
if (ele.equipmentTypeName === editDeviceData.objectType) {
editDeviceData.objectType = ele.equipmentTypeId
}
})
equipUpdate(editDeviceData)
.then((res: any) => {
if (res.code == 200) {
deviceQuery(formQuery)
return res?.data?.id
} else {
ElMessage.error({
message: res.msg,
type: 'error',
})
}
})
.then((id) => {
if (id) {
return updateOtherParamsReq({ ...otherParamsForm, id })
}
})
.then((res) => {
if (res) {
ElMessage({
message: res.msg,
type: 'success',
})
}
editDeviceDialog.value = false
})
.catch((err) => {
ElMessage.error({
message: err.response?.data?.msg ?? '编辑失败!',
type: 'error',
const submitData = JSON.parse(JSON.stringify(deviceData))
if (getCurDialogState() === 'add') {
submitData.objectType = queryParameter.value.equipmentTypeId
equipAdd(submitData)
.then((res: any) => {
if (res.code == 200) {
deviceQuery(formQuery)
ElMessage.success('新增设备成功!')
} else {
ElMessage.error({
message: res.msg,
type: 'error',
})
}
})
})
} else {
return false
.finally(() => {
type10001DialogVisible.value = false
})
} else if (getCurDialogState() === 'edit') {
equipUpdate(submitData)
.then((res: any) => {
if (res.code == 200) {
deviceQuery(formQuery)
ElMessage.success('修改设备成功!')
} else {
ElMessage.error({
message: res.msg,
type: 'error',
})
}
})
.finally(() => {
type10001DialogVisible.value = false
})
}
}
})
}
@ -1281,11 +1283,13 @@ const setDevicedata = (formData: any = {}) => {
const getCurDialogState = () => {
if (
(type10001DialogVisible.value && type10001DialogTitle.value === '新增风电场设备台账') ||
(type10001DialogVisible.value && type10001DialogTitle.value === '新增能量管理设备台账') ||
(type10002DialogVisible.value && type10002DialogTitle.value === '新增机组设备台账')
) {
return 'add'
} else if (
(type10001DialogVisible.value && type10001DialogTitle.value === '编辑风电场设备台账') ||
(type10001DialogVisible.value && type10001DialogTitle.value === '编辑能量管理设备台账') ||
(type10002DialogVisible.value && type10002DialogTitle.value === '编辑机组设备台账')
) {
return 'edit'