6
0

2 Commits a70b847661 ... 9b33c13a1b

Autor SHA1 Mensaje Fecha
  hsshuxian 9b33c13a1b Merge branch 'master' of http://git.xt.wenhq.top:8083/hs/zhny_ui hace 3 meses
  hsshuxian b3bb4d3bd5 充电桩 hace 3 meses

+ 1 - 0
ems-ui-cloud/package.json

@@ -81,6 +81,7 @@
     "vue-seamless-scroll": "^1.1.23",
     "vue-select": "^3.20.3",
     "vue-super-flow": "^1.4.0",
+    "vue-virtual-scroller": "^1.1.2",
     "vuedraggable": "2.24.3",
     "vuex": "3.6.0"
   },

+ 4 - 5
ems-ui-cloud/src/views/devmgr/el/index.vue

@@ -330,19 +330,19 @@ export default {
   watch: {
     'form.areaCode': function(newVal) {
       if (newVal) {
-        this.updateObjCodeOptions(); // 当 areaCode 变化时更新 objCodeOptions
+        this.updateObjCodeOptions();
       }
     },
 
     'form.objType' (newVal) {
       if (!this.isViewOnly) {
-        this.isObjCodeVisible = !!newVal; // 当对象类型有值且不在查看模式时,显示台账对象输入框
+        this.isObjCodeVisible = !!newVal;
       }
     },
     'isViewOnly' (newVal) {
       if (newVal) {
-        this.isObjCodeVisible = false; // 进入查看模式时,隐藏台账对象输入框
-        this.form.objCode = null; // 清空台账对象数据
+        this.isObjCodeVisible = false;
+        this.form.objCode = null;
       }
     },
     // 根据名称筛选区域树
@@ -359,7 +359,6 @@ export default {
       }
       this.loading = true
       listRbook(this.queryParams).then(response => {
-       console.log('设备台账搜索参数!!!!!', this.queryParams)
         this.rbookList = response.rows
         this.total = response.total
         this.loading = false

+ 195 - 0
ems-ui-cloud/src/views/mgr/construction.vue

@@ -0,0 +1,195 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="20">
+      <el-col :span="4" :xs="24">
+        <div class="head-container">
+          <el-input v-model="areaName" placeholder="请输入区块名称" clearable size="small" prefix-icon="el-icon-search"
+                    style="margin-bottom: 20px" />
+        </div>
+        <div class="head-container">
+          <el-tree :data="areaOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree"
+                   node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" />
+        </div>
+      </el-col>
+      <el-col :span="20" :xs="24">
+        <el-row :gutter="20">
+          <el-col :span="6" v-for="(item, index) in chargingStation" :key="index">
+            <el-card class="box-card" :style="getCardStyle(item.deviceStatus)">
+                <h2>{{ item.deviceName }}</h2>
+                <div class="status" :style="getStatusStyle(item.deviceStatus)">
+                  {{ item.deviceStatus === 1 ? '使用中' : '离线' }}
+                </div>
+              <div class="card-content">
+                <p>电流:{{ item.current }} {{ item.currentUnit }}</p>
+                <p>电压:{{ item.voltage }} {{ item.voltageUnit }}</p>
+                <p>功率:{{ item.power }} {{ item.powerUnit }}</p>
+              </div>
+            </el-card>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+
+import { areaTreeSelect } from '@/api/basecfg/area'
+import {getByCondition} from '@/api/device/device.js'
+import { getObjAttr } from '@/api/basecfg/objAttribute'
+
+
+export default {
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 充电桩表格数据
+      chargingStation: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      areaCode: undefined,
+      // 区域名称
+      areaName: undefined,
+      areaOptions: [],
+      defaultProps: {
+        children: 'children',
+        label: 'label'
+      },
+
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        areaCode: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {},
+    };
+  },
+  created() {
+    this.getAreaTree('0', 1)
+    this.getList()
+  },
+  methods: {
+    /** 查询充电桩列表 */
+    getList() {
+      this.loading = true;
+      getByCondition({
+        areaCode: this.queryParams.areaCode,
+        psCode: 'DC-EVSE'
+      }).then(({ code, data }) => {
+        if (code === 200) {
+          /**(充电桩)设备属性*/
+          const promises = data.map(item => {
+            return getObjAttr(2, item.deviceCode).then(response => {
+              if (response.code === 200) {
+                const measureData = response.data.Measure || [];
+                const power = measureData.find(attr => attr.attrKey === 'power')?.attrValue || '0';
+                const powerUnit = measureData.find(attr => attr.attrKey === 'power')?.attrUnit || 'W';
+                const voltage = measureData.find(attr => attr.attrKey === 'voltage')?.attrValue || '0';
+                const voltageUnit = measureData.find(attr => attr.attrKey === 'voltage')?.attrUnit || 'V';
+                const current = measureData.find(attr => attr.attrKey === 'current')?.attrValue || '0';
+                const currentUnit = measureData.find(attr => attr.attrKey === 'current')?.attrUnit || 'A';
+                item.current = current;
+                item.currentUnit = currentUnit;
+                item.voltage = voltage;
+                item.voltageUnit = voltageUnit;
+                item.power = power;
+                item.powerUnit = powerUnit;
+              }
+            });
+          });
+          Promise.all(promises).then(() => {
+            this.chargingStation = data;
+          });
+        }
+      })
+    },
+
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm('queryForm');
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+
+    // 筛选节点
+    filterNode(value, data) {
+      if (!value) return true
+      return data.label.indexOf(value) !== -1
+    },
+
+    // 节点单击事件
+    handleNodeClick(data) {
+      if (data.id === '-1') {
+        this.queryParams.areaCode = null;
+      } else {
+        this.queryParams.areaCode = data.id;
+      }
+      this.handleQuery();
+    },
+    /** 查询区域树结构 */
+    getAreaTree(areaCode, layer) {
+      areaTreeSelect(areaCode, layer).then(response => {
+        this.areaOptions = [{
+           id: '-1',
+          label: '全部',
+          children: response.data
+        }]
+      })
+    },
+    /** 获取卡片背景颜色*/
+    getCardStyle(status) {
+      return status === 1 ? 'background: linear-gradient(135deg, #9AF576, #FFFFFF);' : 'background: linear-gradient(135deg, #FF7070, #FFFFFF);';
+    },
+    /**获取状态文字样式*/
+    getStatusStyle(status) {
+      return status === 1 ? 'color: #fff; background: #67c23a;' : 'color: #fff; background: linear-gradient(135deg, #f44336, #e57373);';
+    },
+
+  },
+};
+</script>
+
+<style lang="css" scoped>
+.box-card {
+  margin: 10px;
+  width: calc(100% - 40px);
+  position: relative;
+}
+
+.status{
+  position: absolute;
+  top: 10px;
+  right: 10px;
+  padding: 2px 8px;
+  border-radius: 4px;
+  font-size: 12px;
+  color: #fff;
+}
+</style>