实时数据:测点选择回显问题
设备清单:添加能量管理设备表单
This commit is contained in:
parent
e56dc03ccc
commit
0ba63ec627
@ -342,11 +342,9 @@ const sizeChange = () => {
|
|||||||
// computedHeight.alarmHeight = rect.height - 570 + 'px'
|
// computedHeight.alarmHeight = rect.height - 570 + 'px'
|
||||||
// computedHeight.centerHeight = rect.height - 20 + 'px'
|
// computedHeight.centerHeight = rect.height - 20 + 'px'
|
||||||
const bgiRect = backgroundImgRef.value?.getBoundingClientRect()
|
const bgiRect = backgroundImgRef.value?.getBoundingClientRect()
|
||||||
console.log(bgiRect)
|
|
||||||
|
|
||||||
if (!bgiRect) return
|
if (!bgiRect) return
|
||||||
computedHeight.backgroundImgHeight = bgiRect.height + 'px'
|
computedHeight.backgroundImgHeight = bgiRect.height + 'px'
|
||||||
console.log(computedHeight.backgroundImgHeight)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let timer: any = null
|
let timer: any = null
|
||||||
|
@ -500,9 +500,10 @@ let dynamicColumn = ref<TableColumnType[]>([
|
|||||||
const tableColumn = ref<TableColumnType[]>([...defaultColumn, ...dynamicColumn.value])
|
const tableColumn = ref<TableColumnType[]>([...defaultColumn, ...dynamicColumn.value])
|
||||||
const getSaveColumn = () => {
|
const getSaveColumn = () => {
|
||||||
const saveColumn = localStorage.getItem('airBlowerTableColumnList')
|
const saveColumn = localStorage.getItem('airBlowerTableColumnList')
|
||||||
if (saveColumn) {
|
if (saveColumn && saveColumn !=='undefined') {
|
||||||
tableColumn.value = JSON.parse(saveColumn)
|
const parseColumn = JSON.parse(saveColumn)
|
||||||
dynamicColumn.value = tableColumn.value.slice(4)
|
tableColumn.value = [...defaultColumn, ...parseColumn]
|
||||||
|
dynamicColumn.value = parseColumn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getSaveColumn()
|
getSaveColumn()
|
||||||
@ -684,6 +685,7 @@ const mutiTaskList = ref<
|
|||||||
const selectPointDialogRef = ref()
|
const selectPointDialogRef = ref()
|
||||||
const selectPointVisible = ref(false)
|
const selectPointVisible = ref(false)
|
||||||
const defaultAttr = computed(() => {
|
const defaultAttr = computed(() => {
|
||||||
|
selectPointVisible.value
|
||||||
return dynamicColumn.value.map((item) => {
|
return dynamicColumn.value.map((item) => {
|
||||||
return {
|
return {
|
||||||
attributeName: item.label.split(' ')[0],
|
attributeName: item.label.split(' ')[0],
|
||||||
@ -703,62 +705,22 @@ const saveSelectPoint = () => {
|
|||||||
if (list) {
|
if (list) {
|
||||||
const addCoulmn = list.map((item: any) => {
|
const addCoulmn = list.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
label: item.unit ? item.attributeName + item.unit : item.attributeName,
|
label: item.unit ? item.attributeName +' '+ item.unit : item.attributeName,
|
||||||
prop: item.attributeCode.toLowerCase(),
|
prop: item.attributeCode.toLowerCase(),
|
||||||
align: 'center',
|
align: 'center',
|
||||||
custom: item.unit ? 'header' : undefined,
|
custom: item.unit ? 'header' : undefined,
|
||||||
width: 100,
|
width: 120,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
dynamicColumn.value = list
|
dynamicColumn.value = addCoulmn
|
||||||
tableColumn.value = [...defaultColumn, ...addCoulmn]
|
tableColumn.value = [...defaultColumn, ...addCoulmn]
|
||||||
localStorage.setItem('airBlowerTableColumnList', JSON.stringify(tableColumn.value))
|
localStorage.setItem('airBlowerTableColumnList', JSON.stringify(addCoulmn))
|
||||||
getTableData()
|
getTableData()
|
||||||
selectPointVisible.value = false
|
selectPointVisible.value = false
|
||||||
ElMessage.success('选择成功')
|
ElMessage.success('选择成功')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const downFun = () => {
|
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 title = tableColumn.value.map((item: any) => item.label).join('\t,') + '\n'
|
||||||
const titleKeyArr = tableColumn.value.map((item: any) => item.prop)
|
const titleKeyArr = tableColumn.value.map((item: any) => item.prop)
|
||||||
let str = ''
|
let str = ''
|
||||||
|
@ -570,7 +570,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-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>
|
<el-button @click="type10001DialogVisible = false">取消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -800,8 +800,8 @@ const defaultEquipmentProps = {
|
|||||||
children: 'equipChildren',
|
children: 'equipChildren',
|
||||||
}
|
}
|
||||||
|
|
||||||
const belongLineList = ref<{ value: string;id:string }[]>([])
|
const belongLineList = ref<{ value: string; id: string }[]>([])
|
||||||
const belongprojectList = ref<{ value: string;id:string }[]>([])
|
const belongprojectList = ref<{ value: string; id: string }[]>([])
|
||||||
const getEnumList = () => {
|
const getEnumList = () => {
|
||||||
enumListQuery({ enumTypeId: '1872545505561620482' }).then((res) => {
|
enumListQuery({ enumTypeId: '1872545505561620482' }).then((res) => {
|
||||||
belongprojectList.value = res.data.rows.map((item: { description: string; id: string }) => {
|
belongprojectList.value = res.data.rows.map((item: { description: string; id: string }) => {
|
||||||
@ -920,6 +920,9 @@ const addDeviceList = () => {
|
|||||||
type10002DialogTitle.value = '新增机组设备台账'
|
type10002DialogTitle.value = '新增机组设备台账'
|
||||||
type10002DialogVisible.value = true
|
type10002DialogVisible.value = true
|
||||||
setOtherParamsFormData()
|
setOtherParamsFormData()
|
||||||
|
} else if (queryParameter.value.equipmentTypeId === 10003) {
|
||||||
|
type10001DialogTitle.value = '新增能量管理设备台账'
|
||||||
|
type10001DialogVisible.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,9 +983,12 @@ const viewDeviceDetails = (data: any) => {
|
|||||||
type10002DialogVisible.value = true
|
type10002DialogVisible.value = true
|
||||||
type10002DialogTitle.value = '编辑机组设备台账'
|
type10002DialogTitle.value = '编辑机组设备台账'
|
||||||
getOtherParams(data.row.id)
|
getOtherParams(data.row.id)
|
||||||
} else {
|
} else if (data.row.objectType === 10001) {
|
||||||
type10001DialogVisible.value = true
|
type10001DialogVisible.value = true
|
||||||
type10001DialogTitle.value = '编辑风电场设备台账'
|
type10001DialogTitle.value = '编辑风电场设备台账'
|
||||||
|
} else if (data.row.objectType === 10003) {
|
||||||
|
type10001DialogTitle.value = '编辑能量管理设备台账'
|
||||||
|
type10001DialogVisible.value = true
|
||||||
}
|
}
|
||||||
setDevicedata(data.row)
|
setDevicedata(data.row)
|
||||||
}
|
}
|
||||||
@ -1069,16 +1075,14 @@ const modifyDeviceDetails = ref()
|
|||||||
const saveData = () => {
|
const saveData = () => {
|
||||||
modifyDeviceDetails.value.validate((valid: any) => {
|
modifyDeviceDetails.value.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
deviceTypeList.value.forEach((ele: any) => {
|
const submitData = JSON.parse(JSON.stringify(deviceData))
|
||||||
if (ele.equipmentTypeName === editDeviceData.objectType) {
|
if (getCurDialogState() === 'add') {
|
||||||
editDeviceData.objectType = ele.equipmentTypeId
|
submitData.objectType = queryParameter.value.equipmentTypeId
|
||||||
}
|
equipAdd(submitData)
|
||||||
})
|
|
||||||
equipUpdate(editDeviceData)
|
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
deviceQuery(formQuery)
|
deviceQuery(formQuery)
|
||||||
return res?.data?.id
|
ElMessage.success('新增设备成功!')
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error({
|
ElMessage.error({
|
||||||
message: res.msg,
|
message: res.msg,
|
||||||
@ -1086,28 +1090,26 @@ const saveData = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((id) => {
|
.finally(() => {
|
||||||
if (id) {
|
type10001DialogVisible.value = false
|
||||||
return updateOtherParamsReq({ ...otherParamsForm, id })
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((res) => {
|
} else if (getCurDialogState() === 'edit') {
|
||||||
if (res) {
|
equipUpdate(submitData)
|
||||||
ElMessage({
|
.then((res: any) => {
|
||||||
message: res.msg,
|
if (res.code == 200) {
|
||||||
type: 'success',
|
deviceQuery(formQuery)
|
||||||
})
|
ElMessage.success('修改设备成功!')
|
||||||
}
|
} else {
|
||||||
editDeviceDialog.value = false
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
ElMessage.error({
|
ElMessage.error({
|
||||||
message: err.response?.data?.msg ?? '编辑失败!',
|
message: res.msg,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
.finally(() => {
|
||||||
return false
|
type10001DialogVisible.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1281,11 +1283,13 @@ const setDevicedata = (formData: any = {}) => {
|
|||||||
const getCurDialogState = () => {
|
const getCurDialogState = () => {
|
||||||
if (
|
if (
|
||||||
(type10001DialogVisible.value && type10001DialogTitle.value === '新增风电场设备台账') ||
|
(type10001DialogVisible.value && type10001DialogTitle.value === '新增风电场设备台账') ||
|
||||||
|
(type10001DialogVisible.value && type10001DialogTitle.value === '新增能量管理设备台账') ||
|
||||||
(type10002DialogVisible.value && type10002DialogTitle.value === '新增机组设备台账')
|
(type10002DialogVisible.value && type10002DialogTitle.value === '新增机组设备台账')
|
||||||
) {
|
) {
|
||||||
return 'add'
|
return 'add'
|
||||||
} else if (
|
} else if (
|
||||||
(type10001DialogVisible.value && type10001DialogTitle.value === '编辑风电场设备台账') ||
|
(type10001DialogVisible.value && type10001DialogTitle.value === '编辑风电场设备台账') ||
|
||||||
|
(type10001DialogVisible.value && type10001DialogTitle.value === '编辑能量管理设备台账') ||
|
||||||
(type10002DialogVisible.value && type10002DialogTitle.value === '编辑机组设备台账')
|
(type10002DialogVisible.value && type10002DialogTitle.value === '编辑机组设备台账')
|
||||||
) {
|
) {
|
||||||
return 'edit'
|
return 'edit'
|
||||||
|
Loading…
Reference in New Issue
Block a user