实时数据:测点选择回显问题
设备清单:添加能量管理设备表单
This commit is contained in:
parent
e56dc03ccc
commit
0ba63ec627
@ -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
|
||||
|
@ -500,9 +500,10 @@ 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)
|
||||
if (saveColumn && saveColumn !=='undefined') {
|
||||
const parseColumn = JSON.parse(saveColumn)
|
||||
tableColumn.value = [...defaultColumn, ...parseColumn]
|
||||
dynamicColumn.value = parseColumn
|
||||
}
|
||||
}
|
||||
getSaveColumn()
|
||||
@ -684,6 +685,7 @@ const mutiTaskList = ref<
|
||||
const selectPointDialogRef = ref()
|
||||
const selectPointVisible = ref(false)
|
||||
const defaultAttr = computed(() => {
|
||||
selectPointVisible.value
|
||||
return dynamicColumn.value.map((item) => {
|
||||
return {
|
||||
attributeName: item.label.split(' ')[0],
|
||||
@ -703,62 +705,22 @@ const saveSelectPoint = () => {
|
||||
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 = ''
|
||||
|
@ -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>
|
||||
@ -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,16 +1075,14 @@ 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)
|
||||
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)
|
||||
return res?.data?.id
|
||||
ElMessage.success('新增设备成功!')
|
||||
} else {
|
||||
ElMessage.error({
|
||||
message: res.msg,
|
||||
@ -1086,28 +1090,26 @@ const saveData = () => {
|
||||
})
|
||||
}
|
||||
})
|
||||
.then((id) => {
|
||||
if (id) {
|
||||
return updateOtherParamsReq({ ...otherParamsForm, id })
|
||||
}
|
||||
.finally(() => {
|
||||
type10001DialogVisible.value = false
|
||||
})
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
ElMessage({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
editDeviceDialog.value = false
|
||||
})
|
||||
.catch((err) => {
|
||||
} else if (getCurDialogState() === 'edit') {
|
||||
equipUpdate(submitData)
|
||||
.then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
deviceQuery(formQuery)
|
||||
ElMessage.success('修改设备成功!')
|
||||
} else {
|
||||
ElMessage.error({
|
||||
message: err.response?.data?.msg ?? '编辑失败!',
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
.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'
|
||||
|
Loading…
Reference in New Issue
Block a user