2025-06-30 10:21:25 +08:00
|
|
|
<template>
|
|
|
|
|
<view style="height: 100%;">
|
|
|
|
|
<u-navbar :is-back="true" :background="background" :border-bottom="false" :custom-back="toback">
|
|
|
|
|
<view class="slot-wrap">
|
|
|
|
|
<stationDropdow disabled style="width: 100%" ref="dropdow" />
|
|
|
|
|
</view>
|
|
|
|
|
</u-navbar>
|
|
|
|
|
<zero-loading v-if="loading"></zero-loading>
|
|
|
|
|
|
|
|
|
|
<view v-else style="height: calc(100% - 100rpx);">
|
|
|
|
|
|
|
|
|
|
<luyj-tree :props="treeProps" :searchPlaceholder="$t('homePage.device.inputNameQuery')" :trees="deviceArr" @lookDetail="toDetail">
|
|
|
|
|
</luyj-tree>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import stationDropdow from "@/components/station-dropdow/index.vue";
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
stationDropdow
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
stationId: null,
|
|
|
|
|
deviceArr: [],
|
|
|
|
|
PCSstatus: [],
|
|
|
|
|
loading: false,
|
|
|
|
|
treeProps: {
|
|
|
|
|
id: 'srcId',
|
|
|
|
|
label: 'name',
|
|
|
|
|
children: 'children',
|
|
|
|
|
multiple: false,
|
|
|
|
|
checkStrictly: false,
|
|
|
|
|
nodes: false
|
|
|
|
|
},
|
|
|
|
|
background: {
|
|
|
|
|
backgroundColor: "#0ea17e",
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
currentStation() {
|
|
|
|
|
return this.vuex_currentStation;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
currentStation: {
|
|
|
|
|
handler(val) {
|
|
|
|
|
this.stationId = val.id;
|
|
|
|
|
this.GetPageDevice();
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
immediate: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
onLoad() {},
|
|
|
|
|
onShow() {},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
toback() {
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
delta: 1
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
toDetail(item) {
|
|
|
|
|
let type = ""
|
2025-10-29 17:31:26 +08:00
|
|
|
if (item.deviceType?.includes("pcs")) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "pcs";
|
2025-10-29 17:31:26 +08:00
|
|
|
} else if (item.deviceType?.includes("stack") ) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "cluster";
|
2025-10-29 17:31:26 +08:00
|
|
|
} else if (item.deviceType?.includes("bms") && this.stationId === 349 ) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "stack";
|
2025-10-29 17:31:26 +08:00
|
|
|
} else if (item.deviceType?.includes("pack")) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "pack";
|
2025-10-29 17:31:26 +08:00
|
|
|
} else if (item.deviceType?.includes("air_condition")) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "air";
|
2025-10-29 17:31:26 +08:00
|
|
|
} else if (item.deviceType?.includes("ele_meter") ) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "ammeter";
|
2025-10-29 17:31:26 +08:00
|
|
|
} else if (item.deviceType?.includes("emu" )) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "emu";
|
2025-10-29 17:31:26 +08:00
|
|
|
} else if (item.deviceType?.includes("storage_fire") ) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "storage";
|
2025-10-29 17:31:26 +08:00
|
|
|
} else if (item.deviceType?.includes("basic") ) {
|
2025-06-30 10:21:25 +08:00
|
|
|
type = "anything"
|
2025-12-26 11:26:40 +08:00
|
|
|
} else if (item.deviceType?.includes("mttp") || item.deviceType?.includes("mppt")) {
|
2025-11-07 15:23:08 +08:00
|
|
|
type = "mttp"
|
2025-06-30 10:21:25 +08:00
|
|
|
}
|
2025-10-30 09:16:28 +08:00
|
|
|
|
2025-06-30 10:21:25 +08:00
|
|
|
if (type) {
|
|
|
|
|
uni.setStorage({
|
|
|
|
|
key: 'deviceName', //本地缓存中的指定的 key
|
|
|
|
|
data: item.name
|
|
|
|
|
})
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/home-page/device-detail/index?srcId=${item.srcId}&type=${type}`,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// processData(node) {
|
|
|
|
|
// if (node.isContainCol === 1) {
|
|
|
|
|
// node.children.push({name: "属性", children: [], deviceType:node.deviceType ? node.deviceType : 'basic',srcId:node.srcId }); // 添加一个空对象
|
|
|
|
|
// }
|
|
|
|
|
// // 递归处理子节点
|
|
|
|
|
// node.children.forEach(child => {
|
|
|
|
|
// if(child.isContainCol || child.deviceType.includes("pack")){
|
|
|
|
|
// this.processData(child);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
// return node;
|
|
|
|
|
// },
|
|
|
|
|
async GetPageDevice() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
try {
|
|
|
|
|
const res = await this.$u.api.deviceList.GetPageDevice({
|
|
|
|
|
stationId: this.stationId,
|
|
|
|
|
});
|
|
|
|
|
this.deviceArr = res.data[0].children
|
|
|
|
|
} catch (e) {
|
|
|
|
|
//TODO handle the exception
|
|
|
|
|
} finally {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
page {
|
|
|
|
|
height: 100% !important;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.slot-wrap {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
/* 如果您想让slot内容占满整个导航栏的宽度 */
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
/* 如果您想让slot内容与导航栏左右有空隙 */
|
|
|
|
|
/* padding: 0 30rpx; */
|
|
|
|
|
/deep/ .u-input__input {
|
|
|
|
|
color: #fff !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|