Ver Fonte

+精准分析-产能分析

chen.cheng há 1 ano atrás
pai
commit
25aa4c0f59

+ 129 - 0
ems-ui/src/components/Block/charts/LineChartBlock.vue

@@ -0,0 +1,129 @@
+<template>
+  <div class="app-container power-index-content">
+    <el-row type="flex" :gutter="20">
+      <el-col :span="24">
+        <div class="filter-container">
+          <SwitchTag
+              :ds="[{val: 'all', text: '全部'},{val: 'south', text: '南区'},{val: 'north', text: '北区'}]"
+              :tagClick="onSwitchTagClick"
+          />
+        </div>
+      </el-col>
+    </el-row>
+    <el-row type="flex" :gutter="20" style="margin-top: 20px">
+      <el-col :span="12">
+        <div class="grid-content bg-purple">
+          <div class="grid-title">发电量</div>
+          <div class="filter-container">
+            <SwitchTag
+                :ds="[{val: 'day', text: '按日'},{val: 'month', text: '按月'},{val: 'year', text: '按年'}]"
+                :defTag="{val: 'day', text: '按日'}"
+                :tagClick="onSwitchTagClick"
+            />
+          </div>
+          <div class="grid-chart" id="charts">
+
+          </div>
+        </div>
+      </el-col>
+      <el-col :span="12">
+        <div class="grid-content bg-purple"></div>
+      </el-col>
+    </el-row>
+    <el-row type="flex" :gutter="20" style="margin-top: 20px">
+      <el-col :span="12">
+        <div class="grid-content bg-purple"></div>
+      </el-col>
+      <el-col :span="12">
+        <div class="grid-content bg-purple"></div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+
+import * as echarts from 'echarts';
+import SwitchTag from '../../../components/SwitchTag/index.vue';
+
+export default {
+  components: { SwitchTag },
+  data() {
+    return {};
+  },
+  mounted() {
+    const chartDom = document.getElementById('charts');
+    const myChart = echarts.init(chartDom);
+    const option = {
+      tooltip: {
+        show:true,
+        trigger: "axis"
+      },
+      grid: {
+        top: 30,
+        left: 40,
+        right: 30,
+        bottom: 30,
+      },
+      xAxis: {
+        type: 'category',
+        boundaryGap: false,
+        data: [
+          '00:00',
+          '01:00',
+          '02:00',
+          '03:00',
+          '04:00',
+          '05:00',
+          '06:00',
+          '07:00',
+          '08:00',
+          '09:00',
+          '10:00',
+          '11:00',
+          '12:00',
+          '13:00',
+          '14:00',
+          '15:00',
+          '16:00',
+          '17:00',
+          '18:00',
+          '19:00',
+          '20:00',
+          '21:00',
+          '22:00',
+          '23:00',
+        ],
+      },
+      yAxis: {
+        type: 'value',
+      },
+      series: [
+        {
+          data: [
+            735, 577, 377, 403, 377, 400, 239, 500, 550, 600, 800, 900, 991, 980,
+            990, 600, 540, 500, 600, 700, 789, 790, 500, 450, 400,
+          ],
+          type: 'line',
+
+          areaStyle: {
+            color: '#d7e4fc',
+            emphasis: {
+              color: '#6093f5',
+            },
+          },
+        },
+      ],
+    };
+    option && myChart.setOption(option);
+  },
+  created() {
+  },
+  methods: {
+    onSwitchTagClick(item) {
+      console.log(item);
+    },
+  },
+};
+</script>
+<style src="./index.scss" lang="scss" />

+ 46 - 0
ems-ui/src/components/Block/charts/index.scss

@@ -0,0 +1,46 @@
+@import "src/assets/styles";
+
+.power-index-content {
+  background: rgba(245, 247, 249, 1);
+
+  .filter-container {
+    height: 50px;
+    background: $bg-color;
+    display: flex;
+    align-items: center;
+    justify-content: flex-start;
+    box-sizing: border-box;
+    padding: 0 10px;
+  }
+
+  .grid-content {
+    height: 38vh;
+    display: flex;
+    background: $bg-color;
+    width: 100%;
+    flex-direction: column;
+    align-items: center;
+    justify-content: flex-start;
+
+    > div {
+      width: 100%;
+    }
+
+    .grid-title {
+      font-weight: bolder;
+      font-size: 24px;
+      box-sizing: border-box;
+      padding: 10px;
+    }
+
+    .filter-container {
+      display: flex;
+      align-items: center;
+      justify-content: flex-end;
+    }
+    .grid-chart{
+      height: calc(100% - 100px);
+    }
+  }
+}
+

+ 25 - 0
ems-ui/src/components/SwitchTag/index.scss

@@ -0,0 +1,25 @@
+
+.switch-tag {
+  height: fit-content;
+  display: flex;
+  background: #ddd;
+  box-sizing: border-box;
+  padding: 2px;
+  border-radius: 2px;
+
+  .el-tag {
+    border: none;
+    background: none;
+    color: #000;
+    border-radius: 2px;
+
+    &:hover, &.active {
+      background: #fefefe;
+    }
+
+    &:not(:first-child) {
+      margin-left: 10px;
+    }
+  }
+}
+

+ 28 - 0
ems-ui/src/components/SwitchTag/index.vue

@@ -0,0 +1,28 @@
+<template>
+
+  <div class="switch-tag">
+
+    <el-tag class="active">全部</el-tag>
+    <el-tag>北区</el-tag>
+    <el-tag>南区</el-tag>
+  </div>
+</template>
+
+<script>
+
+export default {
+  props: {
+    ds: {
+      type: Array,
+      default: [],
+    },
+  },
+  data() {
+    return {};
+  },
+  created() {
+  },
+  methods: {},
+};
+</script>
+<style src="./index.scss" lang="scss" />

+ 9 - 0
ems-ui/src/directive/resize/directive.js

@@ -0,0 +1,9 @@
+import resize from './resize'
+const importDirective = Vue => {
+  /**
+   * Window大小变化回调 v-resize='function'
+   */
+  Vue.directive('resize', resize)
+}
+
+export default importDirective

+ 32 - 0
ems-ui/src/directive/resize/resize.js

@@ -0,0 +1,32 @@
+const resize = {
+  inserted: (el, binding, vNode) => {
+    // 指令的绑定值,是一个function函数
+    const callback = binding.value
+    // 延时执行函数的毫秒数
+    const debounce = binding.arg || 1000
+
+    // 禁止执行与事件关联的默认动作
+    const options = binding.modifiers || {passive: true}
+
+    let debounceTimeout = null
+    const onResize = () => {
+      clearTimeout(debounceTimeout)
+      debounceTimeout = setTimeout(callback, debounce, options)
+    }
+    // 监听窗口缩放
+    window.addEventListener('customResize', onResize, options)
+    window.addEventListener('resize', onResize, options)
+    // 存储监听窗口缩放事件的参数,方便在unbind钩子函数中解除事件绑定的时候使用到
+    el._onResize = {
+      onResize,
+      options,
+    }
+  },
+  unbind(el, binding) {
+    const {onResize, options} = el._onResize
+    window.removeEventListener('customResize', onResize, options)
+    window.removeEventListener('resize', onResize, options)
+    delete el._onResize
+  },
+}
+export default resize

+ 0 - 0
ems-ui/src/views/analysis/power/index.scss


+ 362 - 0
ems-ui/src/views/analysis/power/prod.vue

@@ -0,0 +1,362 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="园区代码" prop="areaCode">
+        <el-input
+          v-model="queryParams.areaCode"
+          placeholder="请输入园区代码"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="设施代码" prop="facsCode">
+        <el-input
+          v-model="queryParams.facsCode"
+          placeholder="请输入设施代码"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="日期 yyyy-MM-dd" prop="date">
+        <el-date-picker clearable
+          v-model="queryParams.date"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="请选择日期 yyyy-MM-dd">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="时间 HH:mm:ss" prop="time">
+        <el-date-picker clearable
+          v-model="queryParams.time"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="请选择时间 HH:mm:ss">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="时间序列" prop="timeIndex">
+        <el-input
+          v-model="queryParams.timeIndex"
+          placeholder="请输入时间序列"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="充电电量 单位:kW-h" prop="chargeElecQuantity">
+        <el-input
+          v-model="queryParams.chargeElecQuantity"
+          placeholder="请输入充电电量 单位:kW-h"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="放电电量 单位:kW-h" prop="dischargeElecQuantity">
+        <el-input
+          v-model="queryParams.dischargeElecQuantity"
+          placeholder="请输入放电电量 单位:kW-h"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['ems:h:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['ems:h:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['ems:h:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['ems:h:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="hList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="序号" align="center" prop="id" />
+      <el-table-column label="园区代码" align="center" prop="areaCode" />
+      <el-table-column label="设施代码" align="center" prop="facsCode" />
+      <el-table-column label="日期 yyyy-MM-dd" align="center" prop="date" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="时间 HH:mm:ss" align="center" prop="time" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.time, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="时间序列" align="center" prop="timeIndex" />
+      <el-table-column label="充电电量 单位:kW-h" align="center" prop="chargeElecQuantity" />
+      <el-table-column label="放电电量 单位:kW-h" align="center" prop="dischargeElecQuantity" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['ems:h:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['ems:h:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改储能计量-小时对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="园区代码" prop="areaCode">
+          <el-input v-model="form.areaCode" placeholder="请输入园区代码" />
+        </el-form-item>
+        <el-form-item label="设施代码" prop="facsCode">
+          <el-input v-model="form.facsCode" placeholder="请输入设施代码" />
+        </el-form-item>
+        <el-form-item label="日期 yyyy-MM-dd" prop="date">
+          <el-date-picker clearable
+            v-model="form.date"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="请选择日期 yyyy-MM-dd">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="时间 HH:mm:ss" prop="time">
+          <el-date-picker clearable
+            v-model="form.time"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="请选择时间 HH:mm:ss">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="时间序列" prop="timeIndex">
+          <el-input v-model="form.timeIndex" placeholder="请输入时间序列" />
+        </el-form-item>
+        <el-form-item label="充电电量 单位:kW-h" prop="chargeElecQuantity">
+          <el-input v-model="form.chargeElecQuantity" placeholder="请输入充电电量 单位:kW-h" />
+        </el-form-item>
+        <el-form-item label="放电电量 单位:kW-h" prop="dischargeElecQuantity">
+          <el-input v-model="form.dischargeElecQuantity" placeholder="请输入放电电量 单位:kW-h" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listH, getH, delH, addH, updateH } from "@/api/ems/h";
+
+export default {
+  name: "H",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 储能计量-小时表格数据
+      hList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        areaCode: null,
+        facsCode: null,
+        date: null,
+        time: null,
+        timeIndex: null,
+        chargeElecQuantity: null,
+        dischargeElecQuantity: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        areaCode: [
+          { required: true, message: "园区代码不能为空", trigger: "blur" }
+        ],
+        facsCode: [
+          { required: true, message: "设施代码不能为空", trigger: "blur" }
+        ],
+        date: [
+          { required: true, message: "日期 yyyy-MM-dd不能为空", trigger: "blur" }
+        ],
+        time: [
+          { required: true, message: "时间 HH:mm:ss不能为空", trigger: "blur" }
+        ],
+        timeIndex: [
+          { required: true, message: "时间序列不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询储能计量-小时列表 */
+    getList() {
+      this.loading = true;
+      listH(this.queryParams).then(response => {
+        this.hList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        areaCode: null,
+        facsCode: null,
+        date: null,
+        time: null,
+        timeIndex: null,
+        chargeElecQuantity: null,
+        dischargeElecQuantity: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    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
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加储能计量-小时";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getH(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改储能计量-小时";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateH(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addH(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除储能计量-小时编号为"' + ids + '"的数据项?').then(function() {
+        return delH(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('ems/h/export', {
+        ...this.queryParams
+      }, `h_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>