|
@ -9,12 +9,7 @@ |
|
|
style="width: 100%" |
|
|
style="width: 100%" |
|
|
:tree-line="treeLine && { showLeafIcon }" |
|
|
:tree-line="treeLine && { showLeafIcon }" |
|
|
:tree-data="treeData1" |
|
|
:tree-data="treeData1" |
|
|
@change=""> |
|
|
@change="changeDeviceType" /> |
|
|
<!-- <template #title="{ value: val, title }"> |
|
|
|
|
|
<b v-if="val === 'parent 1-1'" style="color: #08c">sss</b> |
|
|
|
|
|
<template v-else>{{ title }}</template> |
|
|
|
|
|
</template> --> |
|
|
|
|
|
</a-tree-select> |
|
|
|
|
|
|
|
|
|
|
|
<a-tree |
|
|
<a-tree |
|
|
v-model:expandedKeys="expandedKeys" |
|
|
v-model:expandedKeys="expandedKeys" |
|
@ -69,35 +64,6 @@ |
|
|
import { device } from '/@/api/deviceManage'; |
|
|
import { device } from '/@/api/deviceManage'; |
|
|
// import { device } from '/@/api/deviceManage'; |
|
|
// import { device } from '/@/api/deviceManage'; |
|
|
|
|
|
|
|
|
const treeData2: TreeProps['treeData'] = [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'AC_001(总电表)', |
|
|
|
|
|
key: '1', |
|
|
|
|
|
children: [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'AC_002(暖通电表)', |
|
|
|
|
|
key: '2', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'AC_003(照明电表)', |
|
|
|
|
|
key: '3', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'AC_004(给排水电表)', |
|
|
|
|
|
key: '4', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'AC_005(通风电表)', |
|
|
|
|
|
key: '5', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'AC_006(电动门电表)', |
|
|
|
|
|
key: '6', |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
export default defineComponent({ |
|
|
// eslint-disable-next-line vue/multi-word-component-names |
|
|
// eslint-disable-next-line vue/multi-word-component-names |
|
|
name: 'Tree', |
|
|
name: 'Tree', |
|
@ -111,42 +77,42 @@ |
|
|
orgId.value = result; |
|
|
orgId.value = result; |
|
|
|
|
|
|
|
|
const treeData1 = ref<TreeSelectProps['treeData']>([ |
|
|
const treeData1 = ref<TreeSelectProps['treeData']>([ |
|
|
{ |
|
|
// { |
|
|
title: '3.电梯', |
|
|
// title: '3.电梯', |
|
|
value: '3', |
|
|
// value: '3', |
|
|
children: [ |
|
|
// children: [ |
|
|
{ |
|
|
// { |
|
|
title: '301.扶梯', |
|
|
// title: '301.扶梯', |
|
|
value: '301', |
|
|
// value: '301', |
|
|
}, |
|
|
// }, |
|
|
{ |
|
|
// { |
|
|
title: '302.直梯', |
|
|
// title: '302.直梯', |
|
|
value: '302', |
|
|
// value: '302', |
|
|
}, |
|
|
// }, |
|
|
], |
|
|
// ], |
|
|
}, |
|
|
// }, |
|
|
{ |
|
|
// { |
|
|
title: '4.冷热源', |
|
|
// title: '4.冷热源', |
|
|
value: '4', |
|
|
// value: '4', |
|
|
children: [ |
|
|
// children: [ |
|
|
{ |
|
|
// { |
|
|
title: '401.冷水机组', |
|
|
// title: '401.冷水机组', |
|
|
value: '401', |
|
|
// value: '401', |
|
|
}, |
|
|
// }, |
|
|
{ |
|
|
// { |
|
|
title: '402.热泵机组', |
|
|
// title: '402.热泵机组', |
|
|
value: '402', |
|
|
// value: '402', |
|
|
}, |
|
|
// }, |
|
|
{ |
|
|
// { |
|
|
title: '403.锅炉', |
|
|
// title: '403.锅炉', |
|
|
value: '403', |
|
|
// value: '403', |
|
|
}, |
|
|
// }, |
|
|
{ |
|
|
// { |
|
|
title: '404.水处理机组', |
|
|
// title: '404.水处理机组', |
|
|
value: '404', |
|
|
// value: '404', |
|
|
}, |
|
|
// }, |
|
|
], |
|
|
// ], |
|
|
}, |
|
|
// }, |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
http.post(device.queryDeviceTree, { orgId: orgId.value }).then((res) => { |
|
|
http.post(device.queryDeviceTree, { orgId: orgId.value }).then((res) => { |
|
@ -156,14 +122,64 @@ |
|
|
const formatTreeData = (data) => { |
|
|
const formatTreeData = (data) => { |
|
|
return data.map((item) => ({ |
|
|
return data.map((item) => ({ |
|
|
title: item.code + '.' + item.deviceType, |
|
|
title: item.code + '.' + item.deviceType, |
|
|
value: item.id, |
|
|
value: item.code, |
|
|
children: item.children ? formatTreeData(item.children) : [], |
|
|
children: item.children ? formatTreeData(item.children) : [], |
|
|
})); |
|
|
})); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const expandedKeys = ref<string[]>(['0-0-0', '0-0-1']); |
|
|
// const treeData2: TreeProps['treeData'] = [ |
|
|
const selectedKeys = ref<string[]>(['0-0-0', '0-0-1']); |
|
|
const treeData2 = ref<TreeSelectProps['treeData']>([ |
|
|
const checkedKeys = ref<string[]>(['0-0-0', '0-0-1']); |
|
|
// { |
|
|
|
|
|
// title: 'AC_001(总电表)', |
|
|
|
|
|
// key: '1', |
|
|
|
|
|
// children: [ |
|
|
|
|
|
// { |
|
|
|
|
|
// title: 'AC_002(暖通电表)', |
|
|
|
|
|
// key: '2', |
|
|
|
|
|
// }, |
|
|
|
|
|
// { |
|
|
|
|
|
// title: 'AC_003(照明电表)', |
|
|
|
|
|
// key: '3', |
|
|
|
|
|
// }, |
|
|
|
|
|
// { |
|
|
|
|
|
// title: 'AC_004(给排水电表)', |
|
|
|
|
|
// key: '4', |
|
|
|
|
|
// }, |
|
|
|
|
|
// { |
|
|
|
|
|
// title: 'AC_005(通风电表)', |
|
|
|
|
|
// key: '5', |
|
|
|
|
|
// }, |
|
|
|
|
|
// { |
|
|
|
|
|
// title: 'AC_006(电动门电表)', |
|
|
|
|
|
// key: '6', |
|
|
|
|
|
// }, |
|
|
|
|
|
// ], |
|
|
|
|
|
// }, |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
const changeDeviceType = (val, label, extra) => { |
|
|
|
|
|
http |
|
|
|
|
|
.post(device.queryDevicePage, { code: val, orgId: orgId.value, pageNum: 1, pageSize: 10 }) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
if (!val) { |
|
|
|
|
|
val = '999999999'; |
|
|
|
|
|
} |
|
|
|
|
|
if (!label) { |
|
|
|
|
|
label = ['所有设备']; |
|
|
|
|
|
} |
|
|
|
|
|
let records = res.data.records; |
|
|
|
|
|
records.forEach((item: any) => { |
|
|
|
|
|
(item.title = item.deviceModel + ' ' + item.deviceName), (item.key = item.id); |
|
|
|
|
|
}); |
|
|
|
|
|
let a: TreeSelectProps['treeData'] = [{ title: label[0], key: val, children: records }]; |
|
|
|
|
|
treeData2.value = a; |
|
|
|
|
|
expandedKeys.value = [val]; |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const expandedKeys = ref<string[]>([]); |
|
|
|
|
|
const selectedKeys = ref<string[]>([]); |
|
|
|
|
|
const checkedKeys = ref<string[]>([]); |
|
|
|
|
|
|
|
|
const options1 = ref<SelectProps['options']>([]); |
|
|
const options1 = ref<SelectProps['options']>([]); |
|
|
const options2 = ref<SelectProps['options']>([ |
|
|
const options2 = ref<SelectProps['options']>([ |
|
@ -515,6 +531,7 @@ |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
getDianWeiList(); |
|
|
getDianWeiList(); |
|
|
|
|
|
changeDeviceType(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// const dateFormat = 'YYYY-MM-DD'; |
|
|
// const dateFormat = 'YYYY-MM-DD'; |
|
@ -542,6 +559,7 @@ |
|
|
onChange, |
|
|
onChange, |
|
|
hackValue, |
|
|
hackValue, |
|
|
pageData, |
|
|
pageData, |
|
|
|
|
|
changeDeviceType, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|