Browse Source

1.监控中心 - 设备监测 对接接口

deploy-dev
fks-yangshouda 2 months ago
parent
commit
de2202e360
  1. 168
      hx-ai-intelligent/src/view/monitor/deviceMonitor/tree/index.vue

168
hx-ai-intelligent/src/view/monitor/deviceMonitor/tree/index.vue

@ -9,12 +9,7 @@
style="width: 100%"
:tree-line="treeLine && { showLeafIcon }"
:tree-data="treeData1"
@change="">
<!-- <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>
@change="changeDeviceType" />
<a-tree
v-model:expandedKeys="expandedKeys"
@ -69,35 +64,6 @@
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({
// eslint-disable-next-line vue/multi-word-component-names
name: 'Tree',
@ -111,42 +77,42 @@
orgId.value = result;
const treeData1 = ref<TreeSelectProps['treeData']>([
{
title: '3.电梯',
value: '3',
children: [
{
title: '301.扶梯',
value: '301',
},
{
title: '302.直梯',
value: '302',
},
],
},
{
title: '4.冷热源',
value: '4',
children: [
{
title: '401.冷水机组',
value: '401',
},
{
title: '402.热泵机组',
value: '402',
},
{
title: '403.锅炉',
value: '403',
},
{
title: '404.水处理机组',
value: '404',
},
],
},
// {
// title: '3.',
// value: '3',
// children: [
// {
// title: '301.',
// value: '301',
// },
// {
// title: '302.',
// value: '302',
// },
// ],
// },
// {
// title: '4.',
// value: '4',
// children: [
// {
// title: '401.',
// value: '401',
// },
// {
// title: '402.',
// value: '402',
// },
// {
// title: '403.',
// value: '403',
// },
// {
// title: '404.',
// value: '404',
// },
// ],
// },
]);
http.post(device.queryDeviceTree, { orgId: orgId.value }).then((res) => {
@ -156,14 +122,64 @@
const formatTreeData = (data) => {
return data.map((item) => ({
title: item.code + '.' + item.deviceType,
value: item.id,
value: item.code,
children: item.children ? formatTreeData(item.children) : [],
}));
};
const expandedKeys = ref<string[]>(['0-0-0', '0-0-1']);
const selectedKeys = ref<string[]>(['0-0-0', '0-0-1']);
const checkedKeys = ref<string[]>(['0-0-0', '0-0-1']);
// const treeData2: TreeProps['treeData'] = [
const treeData2 = ref<TreeSelectProps['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',
// },
// ],
// },
]);
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 options2 = ref<SelectProps['options']>([
@ -515,6 +531,7 @@
onMounted(() => {
getDianWeiList();
changeDeviceType();
});
// const dateFormat = 'YYYY-MM-DD';
@ -542,6 +559,7 @@
onChange,
hackValue,
pageData,
changeDeviceType,
};
},
});

Loading…
Cancel
Save