From f5735f60380e779eec5e28047578e29ea7d19ac9 Mon Sep 17 00:00:00 2001 From: zhaoqiang <2117596534@qq.com> Date: Mon, 15 Jul 2024 14:15:02 +0800 Subject: [PATCH] update --- src/api/ajust/tree.ts | 18 +++-- src/views/commonPage/carTree.vue | 17 ++--- src/views/pages/carPage/index.vue | 109 ++++++++++-------------------- 3 files changed, 57 insertions(+), 87 deletions(-) diff --git a/src/api/ajust/tree.ts b/src/api/ajust/tree.ts index 3259fb1..19aec08 100644 --- a/src/api/ajust/tree.ts +++ b/src/api/ajust/tree.ts @@ -3,7 +3,7 @@ import request from "@/utils/http/request"; interface idInfo { orgID?: string, - + } // 设备树 0 一级服务 @@ -16,9 +16,9 @@ export function treeT(data: idInfo) { } -interface treeInfo{ - orgID:string; - transformId:string; +interface treeInfo { + orgID: string; + transformId: string; } // 设备树 1 二级服务 export function treeSecond(data: treeInfo) { @@ -29,6 +29,16 @@ export function treeSecond(data: treeInfo) { }) } +// 设备树 充电站 +export function carTree_api(data: idInfo) { + return request({ + url: '/api/wwpm/biz/v1/car_tree', + method: 'POST', + data + }) +} + + // 负载率 export function loadRateApi(data: any) { diff --git a/src/views/commonPage/carTree.vue b/src/views/commonPage/carTree.vue index 700cfab..b012123 100644 --- a/src/views/commonPage/carTree.vue +++ b/src/views/commonPage/carTree.vue @@ -17,7 +17,7 @@ import { onMounted, ref, watch } from 'vue' import { ElTree } from 'element-plus' import treeDatas from '@/assets/json/tree-right2.json' -import { treeT, treeSecond } from '@/api/ajust/tree' +import { treeT, treeSecond, carTree_api } from '@/api/ajust/tree' // defineProps<{ // elec_list: EList[] @@ -91,14 +91,12 @@ let treeData = ref([]) const loadNode = async (node: any, resolve: any) => { //默认加载的节点 if (node.level === 0) { - // let res= await treeT({ - // orgID: "8af8470a47aad8e20147aad92e400335", - // }); - treeT({ + let treeData = [] + let result = await carTree_api({ orgID: '8af8470a47aad8e20147aad92e400335' - }).then(res => { - resolve(res.data) //默认加载第1层 }) + treeData = result.data + resolve(treeData) } else if (node.level > 0 && node.level < 4) { //默认展开的层级,需要默认几层就判断一下. resolve(node.data.children) @@ -179,10 +177,7 @@ const emits = defineEmits(['update-node-key']) ////接收父组件的事件, // 点击树节点 // 处理选中target数据,最终得到由高层到底层的数组 const handleTargetInfo = (data: TreeData, node: any) => { - if (node.level === 4 || node.level === 6 ) { - //点中第4层 为台区时 去返回id到父组件 并让父组件获取可调资源的相关信息和表格 - emits('update-node-key', node) //获取id,用于二级接口服务返回接口给可调资源列表 - } + emits('update-node-key', node) } const handleTarget = (node: any) => { // 递归得到target结果数组 diff --git a/src/views/pages/carPage/index.vue b/src/views/pages/carPage/index.vue index 14db783..4f8dc2e 100644 --- a/src/views/pages/carPage/index.vue +++ b/src/views/pages/carPage/index.vue @@ -276,11 +276,20 @@ onMounted(() => { getRunning_api() }) +// 设备树传的数据 +let currentData = reactive({}) // 点击设备数 const getTreeKey = (treeKey: any) => { console.log(treeKey, '---') - // 第6级 居民充电桩 - if (treeKey.level === 6) { + // 桩:pipe 站:station + currentData = treeKey.data + console.log(currentData, 'currentData') + + if (currentData.type === 'station' || currentData.type === 'pipe') { + // 获取右侧数据 + getPowerCurve_api() + // 获取充电桩列表 + getRunning_api() } } @@ -299,70 +308,6 @@ let carleftContentFlag = ref(true) // 右侧页面标识 let carrightFlag = ref(true) -// 负荷管理切换 -let loadtabDateFlag = ref(1) -const loadEchart = reactive([ - { - id: 1, - name: '高速充电桩群' - }, - { - id: 2, - name: '谊景村' - } -]) -const loadhandleTabDate = (val: any) => { - loadtabDateFlag.value = val.id -} -// load_echart 传参 -let eName1 = ref('负载率') -let eName2 = ref('负载情况') - -// 地图标识 -let lengendDate = reactive([ - { - id: 1, - lengendName: '充电桩分布热力图', - checkFlag: false - }, - { - id: 2, - lengendName: '新能源车辆热力图', - checkFlag: false - } -]) -let handleSelectCheck = (datas: any) => { - // 让选中的项样式发生变化 - datas.checkFlag = !datas.checkFlag - // if (data.lengendName === "中压光伏" || data.lengendName === "低压光伏" || data.lengendName === "充电站" || data.lengendName === "储能站") { - // // bottomconterListtest.includes(props.gettreeprovidecityname) - // bottomconterListtest.forEach(item => { - // if (item.name === props.gettreeprovidecityname) { - // let _list = { - // type: data.value, - // status: data.checkFlag ? '2' : '0',// - // CityID: item.id, - // }; - // api_send("showCityElement", _list, () => { - // console.log("showCityElement", "Switchstationstatus"); - // }); - // } - // }) - // } else { - // let _list = { - // type: "BD", //类型 BD:变电站 PD:配电站 KG:开关站 - // Voltage_Level: data.value, //电压等级:0:全电压等级 22:10KV 24:20kV 32:110kV 33:220kV 35:500kV - // region: "315800", //区域id:城市ID(邮政编码)315000:宁波全市 315001:宁波市区(显示江北区、海曙区、镇海区边界) 315800:宁波北仑区 315100:宁波鄞州区 315500:宁波奉化区 315700:宁波象山县 //315600:宁波宁海县 315400:宁波余姚市315300:宁波 - // status: data.checkFlag ? '1' : '0',// 是否显示0:不显示1:显示 - // }; - // api_send("SwitchStationstatus", _list, () => { - // console.log("SwitchStationstatus", "Switchstationstatus"); - // }); - // } -} - -// 中 -// 调节次数信息 const adjustInfoFlag = ref(false) // 表格 @@ -465,9 +410,20 @@ let transformerOverloadCount = ref(0) // 获取曲线 let getPowerCurve_api = () => { - powerCurve_api({ - mrid: '1200330077182' - }).then((res: any) => { + let setData: any = {} + if (currentData.type === '') { + // 空的 请求全部 + setData.orgID = '1200330077182' + } else if (currentData.type === 'station') { + // 站 + setData.stationId = '1200330077182' + } else if (currentData.type === 'pipe') { + // 桩 + setData.mrid = '1200330077182' + } + console.log(currentData.type, setData, 'currentType.value') + + powerCurve_api(setData).then((res: any) => { res?.data.forEach((item: any) => { item.datetime = item.dateTime }) @@ -486,9 +442,18 @@ let getTransformerOverloadCount_api = () => { } // 获取充电桩列表 let getRunning_api = () => { - running_api({ - orgID: '8af8470a47aad8e20147aad92e400335' - }).then((res: any) => { + let setData: any = {} + if (currentData.type === '') { + // 空的 请求全部 + setData.orgID = '1200330077182' + } else if (currentData.type === 'station') { + // 站 + setData.stationId = '1200330077182' + } else if (currentData.type === 'pipe') { + // 桩 + setData.mrid = '1200330077182' + } + running_api(setData).then((res: any) => { carRightData.chargingList = res.data.data carRightData.chargingListRunning = res.data.running carRightData.chargingListTotal = res.data.total