From d0f98ad8e1047e3161a458399ad3005404ed87b8 Mon Sep 17 00:00:00 2001
From: whychdw <496960745@qq.com>
Date: 星期五, 06 六月 2025 15:52:15 +0800
Subject: [PATCH] 标准参数管理

---
 src/views/statistics/battCompare1.vue |  594 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 594 insertions(+), 0 deletions(-)

diff --git a/src/views/statistics/battCompare1.vue b/src/views/statistics/battCompare1.vue
new file mode 100644
index 0000000..24f2d2e
--- /dev/null
+++ b/src/views/statistics/battCompare1.vue
@@ -0,0 +1,594 @@
+<script setup name="battCompare1">
+  import { ref, reactive, onMounted, computed, nextTick } from "vue";
+  import { storeToRefs } from "pinia";
+  import { Search, Plus } from "@element-plus/icons-vue";
+  import ycCard from "@/components/ycCard/index.vue";
+  import addEdit from "../datas/addEdit.vue";
+  import { ElMessage } from "element-plus";
+  import useElement from "@/hooks/useElement.js";
+  import { useUserStore } from '@/store/user';
+
+  import useStation from "@/hooks/useStationList.js";
+  const { provice, city, country, stationName,
+    proviceList, cityList, countryList, stationList,
+  } = useStation();
+
+  import { useRouter } from "vue-router";
+  const router = useRouter();
+
+  import { ExportFile } from '@/utils/exportFile.js';
+
+
+  import powerTypes from '@/utils/const/const_powerType.js';
+  import hrTypes from '@/utils/const/const_hrTestType.js';
+  import {
+    getBattPerformance,
+    getMonCapByUid,
+    getBatteryBrand,
+  } from "@/api/station";
+
+  const userStore = useUserStore();
+  const { uid, uname } = storeToRefs(userStore);
+  import moment from 'moment';
+
+  import formatSeconds from '@/utils/formatSeconds';
+  import {
+    toFixed,
+    digits,
+  } from '@/utils/toFixed';
+
+  import {
+    getBattCompare16,
+  } from "@/api/statistic.js";
+
+  const { $loading, $message, $confirm } = useElement();
+
+
+  const headers = [
+    {
+      prop: "stationName",
+      label: "绔欑偣鍚嶇О",
+      width: "160",
+    },
+    {
+      prop: "devName",
+      label: "璁惧鍚嶇О",
+      width: "80",
+    },
+    {
+      prop: "battgroupName",
+      label: "鐢垫睜缁勫悕绉�",
+      width: "80",
+    },
+    {
+			prop: "product",
+			label: "鐢垫睜鍝佺墝",
+			width: "100",
+		},
+    {
+			prop: "inuseTime",
+			label: "鎶曡繍鏃堕棿",
+			width: "100",
+		},
+    {
+			prop: "moncapstd",
+			label: "鏍囧噯瀹归噺",
+			width: "100",
+		},
+    {
+			prop: "monvolstd",
+			label: "鏍囩О鐢靛帇",
+			width: "100",
+		},
+    {
+      prop: "realCap",
+			label: "棰勪及瀹為檯瀹归噺",
+			width: "80",
+		},
+    {
+      prop: "stopReason",
+      label: "鍋滄鍘熷洜",
+      width: "160",
+    },
+    {
+			prop: "precentCapStr",
+			label: "瀹归噺鐧惧垎姣�",
+			width: "80",
+		},
+    {
+      prop: "capperformance",
+      label: "璇勫垎缁撴灉",
+      width: "80",
+    },
+    {
+      prop: "capperformance",
+      label: "鐢垫睜鎬ц兘",
+      width: "80",
+    },
+	];
+
+   const testType = ref('');
+  const hrTypeList = computed(() => {
+    return Object.keys(hrTypes).map(v => {
+      return {
+        value: v,
+        label: hrTypes[v],
+      };
+    });
+  });
+
+  
+  const background = ref(true);
+  const disabled = ref(false);
+  const pageCurr = ref(1);
+  const pageSize = ref(10);
+  const total = ref(0);
+  const addEditVisible = ref(false);
+  const dialogTitle = ref("");
+  const currentAreaId = ref();
+  const currentAreaIds = ref([]);
+  const inuseStartTime = ref('');
+  const inuseEndTime = ref('');
+  
+  const datas = reactive({
+    tableData: [],
+    rowData: {},
+  });
+
+
+  // 璁$畻灞炴�х敓鎴� picker-options锛堟洿绠�娲侊級
+  const startDisabledDate = (time) =>  inuseEndTime.value ? moment(inuseEndTime.value).isBefore(time) || moment().isBefore(time) : moment().isBefore(time);
+
+  const endDisabledDate = (time) => inuseStartTime.value ? moment(time).isBefore(inuseStartTime.value) || moment().isBefore(time) : moment().isBefore(time);
+
+  const performance = ref('');
+  const performanceList = ref([]);
+
+  function getPerformancList() {
+    getBattPerformance()
+      .then((res) => {
+        let { code, data, data2 } = res;
+        let list = [];
+        if (code && data) {
+          // console.log(data);
+          list = Object.keys(data2).map((key) => ({ value: key, label: data2[key] }));
+        }
+        performanceList.value = list;
+      })
+      .catch((err) => {
+        console.log(err);
+      });
+  }
+
+  const product = ref('');
+  const productList = ref([]);
+
+  function getProductList() {
+    getBatteryBrand().then((res) => {
+      let { code, data, data2 } = res;
+      let list = [];
+      if (code && data) {
+        list = data2;
+      }
+      productList.value = list;
+    });
+  }
+
+  const moncapstd = ref('');
+  const monCapList = ref([]);
+
+// 鑾峰彇鏍囩О瀹归噺
+  function getMonCapList() {
+    getMonCapByUid().then((res) => {
+      let { code, data, data2 } = res;
+      let list = [];
+      if (code && data) {
+        list = data2;
+      }
+      monCapList.value = list;
+    });
+  }
+
+
+
+  function getList() {
+    let loading = $loading();
+    let params = {
+      provice: provice.value || undefined,
+      city: city.value || undefined,
+      country: country.value || undefined,
+      stationName: stationName.value || undefined,
+      pageNum: pageCurr.value,
+      pageSize: pageSize.value,
+
+      performance: performance.value || undefined,
+      product: product.value || undefined,
+      inuseStartTime: inuseStartTime.value ? inuseStartTime.value + ' 00:00:00' : undefined,
+      inuseEndTime: inuseEndTime.value ? inuseEndTime.value + ' 23:59:59' : undefined,
+    };
+
+    getBattCompare16(params)
+      .then((res) => {
+        let { code, data, data2 } = res;
+        let list = [];
+        let _total = 0;
+        if (code && data) {
+          // console.log(data);
+          list = data2.list.map(v => ({
+            ...v,
+            precentCapStr: toFixed(v.precentCap, digits.PREC) + '%',
+          }));
+          _total = data2.total;
+        }
+        loading.close();
+        // tableData.length = 0;
+        // tableData.push(...list);
+        datas.tableData = list;
+        total.value = _total;
+      })
+      .catch((err) => {
+        console.log(err);
+        loading.close();
+      });
+  }
+
+  // 灞曠ず鏁版嵁鏁伴噺
+  function handleSizeChange(val) {
+    pageSize.value = val;
+    getList();
+  }
+  // 缈婚〉
+  function handleCurrentChange(val) {
+    pageCurr.value = val;
+    getList();
+  }
+
+  function filterChange() {
+    nextTick(() => {
+      pageCurr.value = 1;
+      getList();
+    });
+  }
+
+  function goRt (row) {
+    router.push({
+      path: '/datas/realtime',
+      query: {
+        stationId: row.stationId || undefined,
+        powerId: row.powerId || undefined,
+        devId: row.devId || undefined,
+        battgroupId: row.battgroupId || undefined,
+        pageFlag: Math.random(),
+      }
+    });
+  }
+
+  function goHis (row) {
+    router.push({
+      path: '/datas/history',
+      query: {
+        stationId: row.stationId || undefined,
+        powerId: row.powerId || undefined,
+        devId: row.devId || undefined,
+        battgroupId: row.battgroupId || undefined,
+        pageTab: 'his-real',
+        pageFlag: Math.random(),
+      }
+    });
+  }
+
+  function exportExcel() {
+    ExportFile(headers, datas.tableData, "钃勭數姹犵粍瀵规瘮鍒嗘瀽--鍚屼竴鍝佺墝鍚屼竴鏃堕棿");
+  }
+
+  onMounted(() => {
+    getPerformancList();
+    getProductList();
+    getMonCapList();
+    getList();
+  });
+</script>
+
+<template>
+  <div class="page-wrapper">
+    <!-- <div class="page-header">
+    </div> -->
+    <div class="page-content">
+      <yc-card is-full>
+        <div class="page-content-wrapper">
+          <div class="page-content-tools page-filter">
+            <div class="grid-container" :style="{'--counter': 6}">
+              <div class="grid-item">
+                <div class="label">鐪�</div>
+                <div class="value">
+                  <el-select
+                    v-model="provice"
+                    size="small"
+                    clearable
+                    @change="filterChange"
+                    placeholder="璇烽�夋嫨鐪�"
+                  >
+                    <el-option
+                      v-for="item in proviceList"
+                      :key="'l0_' + item"
+                      :label="item"
+                      :value="item"
+                    >
+                    </el-option>
+                  </el-select>
+                </div>
+              </div>
+              <div class="grid-item">
+                <div class="label">甯�</div>
+                <div class="value">
+                  <el-select
+                    v-model="city"
+                    size="small"
+                    clearable
+                    @change="filterChange"
+                    placeholder="璇烽�夋嫨甯�"
+                  >
+                    <el-option
+                      v-for="item in cityList"
+                      :key="'l1_' + item"
+                      :label="item"
+                      :value="item"
+                    >
+                    </el-option>
+                  </el-select>
+                </div>
+              </div>
+              <div class="grid-item">
+                <div class="label">鍖哄幙</div>
+                <div class="value">
+                  <el-select
+                    v-model="country"
+                    clearable
+                    @change="filterChange"
+                    size="small"
+                    placeholder="璇烽�夋嫨鍖哄幙"
+                  >
+                    <el-option
+                      v-for="item in countryList"
+                      :key="'l2_' + item"
+                      :label="item"
+                      :value="item"
+                    >
+                    </el-option>
+                  </el-select>
+                </div>
+              </div>
+              <div class="grid-item">
+                <div class="label">绔欑偣</div>
+                <div class="value">
+                  <el-select
+                    v-model="stationName"
+                    clearable
+                    @change="filterChange"
+                    size="small"
+                    placeholder="璇烽�夋嫨绔欑偣"
+                  >
+                    <el-option
+                      v-for="item in stationList"
+                      :key="'l3_' + item.stationId"
+                      :label="item.stationName"
+                      :value="item.stationName"
+                    >
+                    </el-option>
+                  </el-select>
+                </div>
+              </div>
+              <div class="grid-item">
+                <div class="label">鐢垫睜鍝佺墝</div>
+                <div class="value">
+                  <el-select
+                    v-model="performance"
+                    filterable
+                    clearable
+                    size="small"
+                    @change="filterChange"
+                    placeholder="璇烽�夋嫨"
+                  >
+                    <el-option
+                      v-for="(item, idx) in performanceList"
+                      :key="'list7_' + idx"
+                      :label="item.label"
+                      :value="item.value"
+                    />
+                  </el-select>
+                </div>
+              </div>
+              <div class="grid-item">
+                <div class="label">鏍囩О瀹归噺</div>
+                <div class="value">
+                  <el-select
+                    v-model="moncapstd"
+                    filterable
+                    clearable
+                    placeholder="璇烽�夋嫨"
+                  >
+                    <el-option
+                      v-for="(item, idx) in monCapList"
+                      :key="'list11_' + idx"
+                      :label="item"
+                      :value="item"
+                    />
+                  </el-select>
+                </div>
+              </div>
+              <div class="grid-item">
+                <div class="label">鐢垫睜鎬ц兘</div>
+                <div class="value">
+                  <el-select
+                    v-model="product"
+                    filterable
+                    clearable
+                    size="small"
+                    @change="filterChange"
+                    placeholder="璇烽�夋嫨"
+                  >
+                    <el-option
+                      v-for="(item, idx) in productList"
+                      :key="'list6_' + idx"
+                      :label="item"
+                      :value="item"
+                    />
+                  </el-select>
+                </div>
+              </div>
+              <div class="grid-item">
+                <div class="label">鎶曡繍鏃堕棿娈�</div>
+                <div class="value" style="grid-column: span 7;">
+                  <el-date-picker
+                    v-model="inuseStartTime"
+                    type="date"
+                    size="small"
+                    placeholder="閫夋嫨鏃ユ湡"
+                    format="YYYY-MM-DD"
+                    value-format="YYYY-MM-DD"
+                    :disabled-date="startDisabledDate"
+                  />
+                  -
+                  <el-date-picker
+                    v-model="inuseEndTime"
+                    size="small"
+                    type="date"
+                    placeholder="閫夋嫨鏃ユ湡"
+                    format="YYYY-MM-DD"
+                    value-format="YYYY-MM-DD"
+                    :disabled-date="endDisabledDate"
+                  />
+                </div>
+              </div>
+              <div class="grid-item">
+                <el-button type="primary" size="small" >璁剧疆鏉冮噸</el-button>
+              </div>
+            </div>
+          </div>
+          <div class="page-content-table">
+            <div class="pos-rel">
+              <div class="pos-abs">
+                <el-table class="yc-table" stripe height="100%" size="small" :data="datas.tableData" style="width: 100%">
+                  <el-table-column type="index" fixed="left" label="搴忓彿" width="60"></el-table-column>
+                  <el-table-column v-for="header in headers" :key="header.prop" :prop="header.prop" :label="header.label"
+                    :min-width="header.width" align="center">
+                    <template #default="scope">{{ scope.row[header.prop] }}</template>  
+                  </el-table-column>
+                  <el-table-column label="鎿嶄綔" fixed="right" width="240" align="center">
+                    <template #default="scope">
+                      <el-button type="warning" size="small" @click="goRt(scope.row)">瀹炴椂鐩戞祴</el-button>
+                      <el-button type="primary" size="small" @click="goHis(scope.row)">鍘嗗彶鏁版嵁</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </div>
+            </div>
+          </div>
+          <div class="page-content-page">
+            <div class="page-tool">
+              <el-button type="primary" round size="small" @click="getList" :icon="Search">鏌ヨ</el-button>
+            </div>
+            <div class="el-page-container">
+              <el-pagination v-model:current-page="pageCurr" v-model:page-size="pageSize"
+                :page-sizes="[20, 40, 60, 80, 100, 200, 300, 400]" size="small" :disabled="disabled"
+                :background="background" layout="total, sizes, prev, pager, next, jumper" :total="total"
+                @size-change="handleSizeChange" @current-change="handleCurrentChange" />
+            </div>
+            <div class="page-tool">
+              <el-button type="primary" round size="small" @click="exportExcel">瀵煎嚭</el-button>
+            </div>
+          </div>
+        </div>
+      </yc-card>
+    </div>
+    <div class="page-footer"></div>
+  </div>
+</template>
+
+<style scoped lang="less">
+.page-wrapper {
+  display: flex;
+  flex-direction: row;
+  // padding: 8px;
+  height: 100%;
+
+  .page-content {
+    flex: 1;
+  }
+}
+
+.page-content-wrapper {
+  display: flex;
+  flex-direction: column;
+  height: 100%;
+
+  .page-content-tools {
+    padding-bottom: 8px;
+  }
+
+  .page-content-table {
+    // border-top: 1px solid var(--border-light-color);
+    box-sizing: border-box;
+    flex: 1;
+    margin-left: 26px;
+    margin-right: 26px;
+  }
+
+  .page-content-page {
+    padding: 8px 8px 0 8px;
+    text-align: center;
+
+    .el-page-container {
+      display: inline-block;
+      padding: 0 16px;
+    }
+
+    .page-tool {
+      display: inline-block;
+    }
+  }
+}
+
+.hdw-card-container {
+  width: 240px;
+  padding-right: 8px;
+  height: 100%;
+}
+
+.pos-rel {
+  position: relative;
+  width: 100%;
+  height: 100%;
+
+  .pos-abs {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    width: 100%;
+    height: 100%;
+  }
+}
+
+.tools-filter {
+  display: inline-block;
+  font-size: 14px;
+
+  .tools-filter-item {
+    display: inline-block;
+    margin-right: 8px;
+
+    .filter-label {
+      display: inline-block;
+    }
+
+    .filter-content {
+      display: inline-block;
+    }
+  }
+}
+.max-width {
+  max-width: 200px;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.1