Forráskód Böngészése

修改海工问题

chenbaoxin 3 hónapja
szülő
commit
4eb7732d03

+ 16 - 0
src/api/index.ts

@@ -240,6 +240,22 @@ export function uploadBatch(data:any) {
 export function mockTotal(data:any) {
   return get('/fileManagement/mockTotal',data);
 }
+/**
+ * @name  辅助决策自动
+ * @param params 
+ * @returns 
+ */
+export function autoFailureRecord(params:any) {
+  return get('/maintenanceStrategy/autoFailureRecord',params);
+}
+/**
+ * @name  工况时间修改历史
+ * @param data 
+ * @returns 
+ */
+export function setConditionTime(data:any) {
+  return post('/operatingCondition/setConditionTime',data);
+}
 // // 使用 http 方法获取特定的 HTTP 方法并调用
 // const deleteMethod = http("DELETE");
 // deleteMethod("/api/data")

+ 3 - 0
src/style.css

@@ -294,6 +294,9 @@ body {
   background: rgba(2, 22, 43, 0.95);
   border-top: 1px solid var(--el-datepicker-inner-border-color);
 }
+.el-range-editor.is-disabled input {
+  background-color: #000e1d;
+}
 .popperClass{
   background: #000 !important;
 }

+ 3 - 3
src/views/HealthStatusAnalysis/index.vue

@@ -7,7 +7,7 @@
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
 <template>
-     <div class="filters">
+     <!-- <div class="filters">
           <div class="tabs">
             <div
               :class="['tab tab1', { active: activeTab === '1' }]"
@@ -22,7 +22,7 @@
               <div class="tab-text">批量模拟</div>
             </div>
           </div>
-        </div>
+        </div> -->
     <mock v-if="activeTab==2"></mock>
     <realTime v-else></realTime>
 
@@ -45,7 +45,7 @@ import {
 
 import mock from './mock.vue'
 import realTime from './realTime.vue'
-const activeTab = ref("1");
+const activeTab = ref("2");
 const setActiveTab = (val: number) => {
   activeTab.value=val
 };

+ 161 - 40
src/views/HealthStatusAnalysis/mock.vue

@@ -14,7 +14,7 @@
         <div class="mockDiv custom-time-select">
           选择时间: &nbsp;
           <el-date-picker
-          class=" custom-time-input"
+            class="custom-time-input"
             v-model="queryParamsMock.sDate"
             style="width: 140px"
             type="datetime"
@@ -33,17 +33,17 @@
             style="width: 80px"
             max="60"
             min="1"
-          class="no-arrows"
+            class="no-arrows"
             placeholder=""
-             type="number"
+            type="number"
             v-model="queryParamsMock.time"
           ></el-input
           >&nbsp;秒显示&nbsp;<el-input
             style="width: 80px"
-             type="number"
-                max="60"
+            type="number"
+            max="60"
             min="1"
-             class="no-arrows"
+            class="no-arrows"
             v-model="queryParamsMock.count"
           ></el-input
           >&nbsp;分钟数据&emsp;
@@ -242,16 +242,24 @@
             <!-- {{ chartData }} -->
             <div class="his-time custom-time-select custom-time-input">
               <div class="tools">
-                <div class="arrow-button arrow-button-left"></div>
+                <div
+                  class="arrow-button arrow-button-left"
+                  @click="prevWeek"
+                ></div>
                 <el-date-picker
+                :disabled="true"
                   v-model="hlQueryParams.eDate"
                   type="daterange"
+                  value-format="YYYY-MM-DD"
                   range-separator="-"
                   start-placeholder="开始日期"
                   end-placeholder="结束日期"
                 >
                 </el-date-picker>
-                <div class="arrow-button arrow-button-right"></div>
+                <div
+                  class="arrow-button arrow-button-right"
+                  @click="nextWeek"
+                ></div>
               </div>
               <!-- <div class="his-select">下拉</div> -->
               <el-select
@@ -274,7 +282,7 @@
         </div>
 
         <div class="timeEcharts">
-          <CalendarHeatmap :data="chartData" />
+          <CalendarHeatmap :data="chartData" @showDetails="handleShowDetails"  />
         </div>
       </div>
       <div class="right-bottom">
@@ -473,6 +481,54 @@
       </el-tooltip>
     </div>
   </ModalComponent>
+  <!-- 工况详情 -->
+  <ModalComponent
+    v-model:visible="showCondModal"
+    customClass="custom-modal"
+    title="工况详情"
+    type="warn"
+  >
+    <!-- 模态框内容插槽 -->
+    <div class="custom-warn-box">
+       <el-table
+       border
+       max-height="300"
+        show-overflow-tooltip
+        :data="tableData"
+        style="width: 100%"
+        align="center"
+        class="custom-table"
+      >
+        <el-table-column
+          prop="name"
+          label="时间"
+          sortable
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="createTime"
+          label="工况名称"
+          align="center"
+          
+          width="240"
+        ></el-table-column>
+        <el-table-column
+          prop="remark"
+          label="状态"
+          align="center"
+        >
+           <template v-slot="scope">
+            <div :class="['scope.row.sts'+enumParasm[scope.row.sts].color]" 
+              >{{scope.row.sts}}</div
+            >
+
+          </template>
+        
+        </el-table-column>
+
+      </el-table>
+    </div>
+  </ModalComponent>
 </template>
 
 <script lang="ts" setup>
@@ -506,7 +562,8 @@ import {
   measurementPoints,
   devicesAndCategories,
   updateDataRangeSpeed,
-  mockCacheData
+  mockCacheData,
+  setConditionTime
 } from "@/api/index";
 const wsMockUrl = import.meta.env.VITE_WS_MOCK_URL as string;
 const wsMockClient = new WebSocketClient(wsMockUrl);
@@ -520,7 +577,7 @@ watch(
   () => queryParamsMock.value.sDate,
   (newSDate) => {
     if (newSDate) {
-      queryParamsMock.value.eDate = moment(newSDate).add(1, 'hour').toDate();
+      queryParamsMock.value.eDate = moment(newSDate).add(1, "hour").toDate();
     }
   }
 );
@@ -551,15 +608,14 @@ onMounted(() => {
       checkedParams.value = Object.values(COLUMN_MAP).slice(0, 5);
     }
   });
-  mockCacheData({}).then((res:any)=>{
-        lineParamsAllRef.value=res.data.map((its)=>{
-          return {
-data:its
-          }
-          });
-        // debugger
-
-  })
+  mockCacheData({}).then((res: any) => {
+    lineParamsAllRef.value = res.data.map((its) => {
+      return {
+        data: its,
+      };
+    });
+    // debugger
+  });
   // 处理接收到的消息
   wsMockClient.onMessage = (data: string) => {
     try {
@@ -593,8 +649,74 @@ data:its
     }
   };
 });
+const handleDateRangeChange = (dates) => {
+  let { start, end } = dates;
+  start = moment(start).format('YYYY-MM-DD');
+  end = moment(end).format('YYYY-MM-DD');
+  const duration = moment(end).diff(moment(start), 'days');
+  if (duration <= 7) {
+    // hlQueryParams.value.eDate = [start, end];
+    setParamsHl(start, end);
+  } else {
+    const startOfWeek = moment(start).format('YYYY-MM-DD');
+    const endOfWeek = moment(start).endOf('isoWeek').format('YYYY-MM-DD');
+    // hlQueryParams.value.eDate = [startOfWeek, endOfWeek];
+        setParamsHl(startOfWeek, endOfWeek);
+
+  }
+};
+
+const prevWeek = () => {
+     const duration = moment(queryParamsMock.value.eDate).diff(moment(queryParamsMock.value.sDate), 'days');
+  if (duration <= 7) {
+    return;
+  }
+  const start = moment(hlQueryParams.value.eDate[0]).subtract(1, "week").startOf("isoWeek");
+  const end = moment(hlQueryParams.value.eDate[0]).subtract(1, "week").endOf("isoWeek");
+
+  if (start.isBefore(moment(queryParamsMock.value.sDate))) {
+    setParamsHl(moment(queryParamsMock.value.sDate), moment(queryParamsMock.value.sDate).endOf("isoWeek"));
+  } else {
+    setParamsHl(start, end);
+  }
+};
+
+const nextWeek = () => {
+    const duration = moment(queryParamsMock.value.eDate).diff(moment(queryParamsMock.value.sDate), 'days');
+  if (duration <= 7) {
+    return;
+  }
+   const start = moment(hlQueryParams.value.eDate[1]).add(1, "week").startOf("isoWeek");
+  const end = moment(hlQueryParams.value.eDate[1]).add(1, "week").endOf("isoWeek");
 
+  if (end.isAfter(moment(queryParamsMock.value.eDate))) {
+    setParamsHl(moment(queryParamsMock.value.eDate).startOf("isoWeek"), moment(queryParamsMock.value.eDate));
+  } else {
+    setParamsHl(start, end);
+  }
+};
+const setParamsHl = (start: string, end: string) => {
+  hlQueryParams.value.eDate = [
+    moment(start).format("YYYY-MM-DD"),
+    moment(end).format("YYYY-MM-DD"),
+  ];
+  setConditionTime({"min_time":hlQueryParams.value.eDate[0],"max_time":hlQueryParams.value.eDate[1]})
+};
 const mockStart = () => {
+  if (queryParamsMock.value.time > 60) {
+    ElMessage({
+      message: `最大不超过60s`,
+      type: "error",
+    });
+    return false;
+  }
+  if (!!!queryParamsMock.value.sDate) {
+    ElMessage({
+      message: `请选择开始时间`,
+      type: "error",
+    });
+    return false;
+  }
   lineParamsAllRef.value = [];
   seriesData.value = [
     {
@@ -606,28 +728,20 @@ const mockStart = () => {
   wsMockClient.connect();
   // 向服务器发送消息
   wsMockClient.send("你好!");
-  if (queryParamsMock.value.time>60) {
-        ElMessage({
-      message: `最大不超过60s`,
-      type: "error",
-    });
-    return false
-  }
-    if (!!!queryParamsMock.value.sDate) {
-        ElMessage({
-      message: `请选择开始时间`,
-      type: "error",
-    });
-    return false
-  }
-  
+
+  handleDateRangeChange({
+    start: queryParamsMock.value.sDate,
+    end: queryParamsMock.value.eDate,
+  });
   updateDataRangeSpeed({
-    start_time: moment(queryParamsMock.value.sDate).format("YYYY-MM-DD HH:mm:ss"),
+    start_time: moment(queryParamsMock.value.sDate).format(
+      "YYYY-MM-DD HH:mm:ss"
+    ),
     end_time: moment(queryParamsMock.value.eDate).format("YYYY-MM-DD HH:mm:ss"),
     interval: queryParamsMock.value.time,
     batch_size: Number(queryParamsMock.value.count),
   }).then((res: any) => {
-         ElMessage({
+    ElMessage({
       message: `设置成功!`,
       type: "success",
     });
@@ -846,8 +960,8 @@ const convertToChartData = (
     data: selectedData.map((item) => item.data[inverParams[propertyName]]),
     //   data: selectedData.map((item) => {
     // const key = inverParams[propertyName];
-    // return key && item.data ? item.data[key] : null; 
-  // }),
+    // return key && item.data ? item.data[key] : null;
+    // }),
   }));
 };
 const formatPressure = (value: number | string) => {
@@ -913,6 +1027,13 @@ const generatePastWeekData = (
 // 首先设置存储sockets接活来的所有数据
 // 获取所有显示参数
 let workParamsAllRef: Ref<DataPoint[]> = ref([]);
+
+const tableData=ref([])
+const showCondModal=ref(false)
+const handleShowDetails=(data:any)=>{
+  showCondModal.value=true
+  tableData.value=data
+}
 // 历史工况记录 chartData 实际图表展示的
 const chartData: Ref<DataPoint[]> = ref(
   []
@@ -1156,7 +1277,7 @@ const healthColor = (status: string) => {
 };
 </script>
 <style lang="css">
-  .no-arrows::-webkit-outer-spin-button,
+.no-arrows::-webkit-outer-spin-button,
 .no-arrows::-webkit-inner-spin-button {
   -webkit-appearance: none;
   margin: 0;

+ 7 - 7
src/views/MaintenanceStrategyAssistance/record/auto.vue

@@ -70,13 +70,13 @@
         </el-table-column> -->
     <el-table-column prop="lifetime" label="时间" width="320" align="center">
       <template v-slot="scope">
-        <span>{{ scope.row.startTime }} - {{ scope.row.endTime }}</span>
+        <span>{{ scope.row.date_range }}</span>
       </template>
     </el-table-column>
     <el-table-column label="是否故障" width="110"  align="center">
       <template v-slot="scope">
-        <span :class="getHealthStatusClass(scope.row.sts)">{{
-          scope.row.sts == 2 ? "有故障" : "无故障"
+        <span :class="getHealthStatusClass(scope.row.status)">{{
+          scope.row.status == '有故障' ? "有故障" : "无故障"
         }}</span>
       </template>
     </el-table-column>
@@ -117,7 +117,7 @@ import sTitle from "@/components/StructTitle/index.vue";
 import { Filter } from "@element-plus/icons-vue";
 import { ref, computed, getCurrentInstance } from "vue";
 
-import { repairList } from "@/api/index";
+import { repairList,autoFailureRecord } from "@/api/index";
 const { proxy } = getCurrentInstance()!;
 // pages
 import {
@@ -147,11 +147,11 @@ const fetchDataFunction = async (
     }
   }
   proxy.$loading.start();
-  const response = await repairList({
+  const response = await autoFailureRecord({
     current: page,
     size: 9,
     status: "",
-    type: activeTab.value == 1 ? "1" : "2",
+    // type: activeTab.value == 1 ? "1" : "2",
     name: "",
     startTime: "",
     endTime: "",
@@ -195,7 +195,7 @@ const getHealthStatusClass = (sts: number) => {
   switch (sts) {
     case 1:
       return "success";
-    case 2:
+    case '有故障':
       return "dange";
   }
 };