新增装备

This commit is contained in:
bb_pan 2025-10-23 09:31:42 +08:00
parent da8eefb2cd
commit b635a8a7ea
1 changed files with 9 additions and 8 deletions

View File

@ -508,9 +508,9 @@ const dialogTypeCascader = ref()
//-change
const dialogTypeChange = async (val: any) => {
const nodeId = val[val.length - 1]
const nodeList = findNextLevelIds(oldDeviceTypeTree.value, nodeId)
const nodeList = findNextLevelNodes(oldDeviceTypeTree.value, nodeId)
console.log('🚀 ~ dialogTypeChange ~ nodeList:', nodeList)
typeId.value = nodeList ? nodeList[0] : []
typeId.value = nodeList ? nodeList[0].id : ''
options.value = []
const deviceTypeList = dialogTypeCascader.value.getCheckedNodes()
warningDays.value = deviceTypeList[0].data.maintenanceAlarmDay
@ -534,7 +534,7 @@ const dialogTypeChange = async (val: any) => {
console.log(propertyNames.value)
}
isDisabled.value = true
addAndEditForm.unitName = deviceTypeList[0].data.unitName
addAndEditForm.unitName = nodeList ? nodeList[0].unitName : ''
addAndEditForm.dayLeasePrice = deviceTypeList[0].data.leasePrice
addAndEditFormRef.value.clearValidate(['unitName', 'dayLeasePrice'])
equipTableList.value = []
@ -550,19 +550,20 @@ const dialogTypeChange = async (val: any) => {
examinationPdf: [],
})
}
const findNextLevelIds = (tree: any, targetId: any) => {
const findNextLevelNodes = (tree: any, targetId: any) => {
for (const node of tree) {
if (node.id === targetId) {
// children id
return node.children ? node.children.map((child: any) => child.id) : [];
// children
return node.children ? node.children : []
}
if (node.children) {
const result: any = findNextLevelIds(node.children, targetId);
if (result) return result;
const result: any = findNextLevelNodes(node.children, targetId);
if (result) return result
}
}
return null //
}
const changeDeviceType = async (val: any) => {
console.log('🚀 ~ changeDeviceType ~ val:', val)
if (val == 0) {