|
@@ -22,7 +22,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { onMounted, ref } from "vue";
|
|
|
-import { QueryBasicsInfo, QueryIotListTree } from "../../../service/iotService";
|
|
|
+import { QueryListEquipment, QueryIotListTree, QueryIotEquipment } from "../../../service/iotService";
|
|
|
import { addDataPoint } from "@/unit/map/addLayer";
|
|
|
|
|
|
const treeTabSecondRef = ref(null);
|
|
@@ -31,7 +31,6 @@ let treeDataTabSecond = ref([]);
|
|
|
//获取iot列表树
|
|
|
const getListTree = () => {
|
|
|
QueryIotListTree().then((res) => {
|
|
|
- debugger;
|
|
|
if (res.data.code == "200") {
|
|
|
treeDataTabSecond.value = [res.data.data];
|
|
|
}
|
|
@@ -42,97 +41,92 @@ const defaultPropsValue = ref({
|
|
|
children: "child",
|
|
|
label: "name",
|
|
|
});
|
|
|
-
|
|
|
+const checkNameData = ref([])
|
|
|
+//树表单选择
|
|
|
const handleCheck = (node, checkKeys) => {
|
|
|
+
|
|
|
+
|
|
|
+ console.log(node)
|
|
|
let data;
|
|
|
- if (checkKeys.checkedNodes.length > 0) {
|
|
|
- data = [
|
|
|
- {
|
|
|
- mapx: -2465.155,
|
|
|
- mapy: -4227.303,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2457.302,
|
|
|
- mapy: -4210.527,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2483.733,
|
|
|
- mapy: -4259.984,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2450.596,
|
|
|
- mapy: -4222.605,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2478.293,
|
|
|
- mapy: -4229.018,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2482.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2484.258,
|
|
|
- mapy: -4218.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2452.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2432.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2382.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2482.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2462.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2456.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2482.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2457.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2458.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2482.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2482.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2482.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- {
|
|
|
- mapx: -2282.258,
|
|
|
- mapy: -4217.836,
|
|
|
- },
|
|
|
- ];
|
|
|
+ if(checkNameData.value.includes(node.name)){
|
|
|
+ checkNameData.value = checkNameData.value.filter(item => item != node.name)
|
|
|
+ addDataPoint({id: node.name}, false)
|
|
|
+ }else{
|
|
|
+ checkNameData.value.push(node.name)
|
|
|
+ queryPointList(node.name)
|
|
|
}
|
|
|
-
|
|
|
- addDataPoint(true, data);
|
|
|
+
|
|
|
};
|
|
|
|
|
|
+//获取点位数据
|
|
|
+const queryPointList = async (terminal) => {
|
|
|
+ try {
|
|
|
+ const equipmengRes = await QueryListEquipment({terminal: terminal});
|
|
|
+ if(equipmengRes?.data?.code == 200){
|
|
|
+ const list = equipmengRes?.data?.data?.list || []
|
|
|
+ const allPromise = []
|
|
|
+ list.forEach((item, index) => {
|
|
|
+ if(item.serialNumber){
|
|
|
+ let promiseItem = new Promise((resolve, reject) => {
|
|
|
+ QueryIotEquipment(item.serialNumber).then(res => {
|
|
|
+ resolve({
|
|
|
+ ...res,
|
|
|
+ item
|
|
|
+ })
|
|
|
+ }).catch((error) => {
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ allPromise.push(promiseItem)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //处理异步调用
|
|
|
+ Promise.allSettled(allPromise).then(resArr => {
|
|
|
+ let data = [];
|
|
|
+ resArr.forEach(result => {
|
|
|
+ if(result.status == "fulfilled"){
|
|
|
+ const detailRes = result.value;
|
|
|
+ if(detailRes?.data?.code == '200'){
|
|
|
+ let obj = {
|
|
|
+ textTitle: terminal,
|
|
|
+ countNum: 12,
|
|
|
+ type: '数量'
|
|
|
+ }
|
|
|
+ const resData = detailRes?.data?.data || []
|
|
|
+ resData.forEach(el => {
|
|
|
+ if(el.latestValue){
|
|
|
+ obj[el.name] = el.latestValue
|
|
|
+ }
|
|
|
+ })
|
|
|
+ data.push(
|
|
|
+ {
|
|
|
+ x: detailRes?.item?.lng,
|
|
|
+ y: detailRes?.item?.lat,
|
|
|
+ attributes: obj
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let params = {
|
|
|
+ id: terminal,
|
|
|
+ title: terminal,
|
|
|
+ data: data
|
|
|
+ }
|
|
|
+ console.log(params)
|
|
|
+ addDataPoint(params)
|
|
|
+ }).catch((error) => {
|
|
|
+ console.log('allSettled:error', error)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getListTree();
|
|
|
});
|
|
@@ -299,5 +293,14 @@ const renderContent = (h, { node, data, store }) => {
|
|
|
background-image: url("@/assets/imgs/IOTImage/header-bottom.png");
|
|
|
background-size: 100% 100%;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+:deep(.custom-tree-node){
|
|
|
+ .node-label{
|
|
|
+ width: 15ch;
|
|
|
+ display: inline-block;
|
|
|
+ overflow-x: hidden;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|