Browse Source

修改工况、文件、维修记录接口

chenbaoxin 3 months ago
parent
commit
b4d34bb7a2

+ 24 - 4
src/api/index.ts

@@ -31,11 +31,11 @@ export function downloadDeviceRepair() {
 // 工况列表接口
 /**
  * 
- * @param data 包含{name名称、current当前页、size每页数量}
+ * @param params 包含{name名称、current当前页、size每页数量}
  * @returns [name、remark、id]
  */
-export function operatingConditionList(data:any) {
-  return post('/operatingCondition/pageList',data);
+export function operatingConditionList(params:any) {
+  return get('/operatingCondition/conditionList',params);
 }
 // 工况添加接口
 /**
@@ -105,6 +105,14 @@ export function repairList(data:any) {
 export function repairDetailList(data:any) {
   return post('deviceRepair/strategy/pageList',data);
 }
+/**
+ * @name 维修策略详情列表(自动)
+ * @param params 包含
+ * @returns 
+ */
+export function repairDetailAutoList(params:any) {
+  return get('/maintenanceStrategy/autoDetection/faultRecordDetails',params);
+}
 /**
  * @name 维修策略详情列表删除功能
  * @param data 包含
@@ -121,6 +129,14 @@ export function repairDetailDel(id:number) {
 export function repairHisList(data:any) {
   return post('deviceRepair/strategy/history/pageList',data);
 }
+/**
+ * @name 维修策略设置历史建议列表(自动)
+ * @param data 包含 {current:,size:,id:}
+ * @returns 
+ */
+export function repairAutoHisList(data:any) {
+  return get('/maintenanceStrategy/autoDetection/faultHistoryRecords',data);
+}
 /**
  * @name 维修策略设置历史建议列表删除
  * @param id 包含
@@ -129,6 +145,10 @@ export function repairHisList(data:any) {
 export function repairHisDel(id:number) {
   return del('deviceRepair/strategy/history/'+id);
 }
+// 维修策略删除接口
+export function repairDel(id:number) {
+  return del('/maintenanceStrategy/remove/'+id);
+}
 /**
  * @name 记录评估结果
  * @param source 来源 1是实时 2是模拟
@@ -246,7 +266,7 @@ export function mockTotal(data:any) {
  * @returns 
  */
 export function autoFailureRecord(params:any) {
-  return get('/maintenanceStrategy/autoFailureRecord',params);
+  return get('/maintenanceStrategy/autoDetection/faultRecords',params);
 }
 /**
  * @name  工况时间修改历史

+ 100 - 38
src/components/CalendarHeatmap/index.vue

@@ -27,12 +27,35 @@ interface Props {
 const props = defineProps<Props>();
 const chart = ref<HTMLDivElement | null>(null);
 let myChart: echarts.ECharts | null = null;
-
-const hours = ref(['12a','1a','2a','3a','4a','5a','6a','7a','8a','9a','10a','11a','12p',
-  '1p','2p','3p','4p','5p','6p','7p','8p','9p','10p','11p'
+const emit = defineEmits(["showDetails"]);
+const hours = ref([
+  "12a",
+  "1a",
+  "2a",
+  "3a",
+  "4a",
+  "5a",
+  "6a",
+  "7a",
+  "8a",
+  "9a",
+  "10a",
+  "11a",
+  "12p",
+  "1p",
+  "2p",
+  "3p",
+  "4p",
+  "5p",
+  "6p",
+  "7p",
+  "8p",
+  "9p",
+  "10p",
+  "11p",
 ]);
 
-const days = ["周日","周六", "周五", "周四", "周三", "周二", "周一"];
+const days = ["周日", "周六", "周五", "周四", "周三", "周二", "周一"];
 
 const typeColorMap: { [key: string]: string } = {
   2: "#FC3F3F", // 红色
@@ -46,21 +69,50 @@ const initChart = () => {
     myChart = echarts.init(chart.value);
     const option = {
       tooltip: {
-        position: "left",
-        enterable:true,
+           trigger: 'item',
+        position: "top",
+        triggerOn:'click',
+        enterable: true,
         formatter: (params) => {
           const { data } = params;
-          const { x, y, objs } = data;
-          const valueDetails = objs.map(obj => 
-            obj.value.map(val => `${obj.name}:${val.min} - ${val.max}`).join('<br/>')
-          ).join('<br/>');
+          const { x, y, objs, date } = data;
+          function getFirstThreeUniqueTypes(objs: Obj[]): string[] {
+            const uniqueTypes = new Set<string>();
+            const result: string[] = [];
+
+            for (const obj of objs[0].value) {
+              if (!uniqueTypes.has(obj.type)) {
+                uniqueTypes.add(obj.type);
+                result.push(obj.label);
+              }
+              if (uniqueTypes.size === 3) {
+                break;
+              }
+            }
+
+            return result;
+          }
+          const nameArr = getFirstThreeUniqueTypes(objs);
+          // 动态生成多个 <div> 元素
+          const colors = ["#FC3F3F", "#FF8C00", "#0982FE"];
+          const nameDivs = nameArr
+            .map(
+              (name, index) => `
+        <div style="border-bottom:1px solid #eee;line-height:30px;text-align:center;color:${
+          colors[index % colors.length]
+        }">${name}</div>
+      `
+            )
+            .join("");
           return `
-            <div style="max-height: 100px; overflow-y: auto; padding-right: 10px;">
-              ${valueDetails}
-            </div>
-          `;
+        <div style="max-height: 150px; width: 200px;background:'#fff';borderRadius:'6px'">
+          <div style="border-bottom:1px solid #eee;line-height:30px;text-align:center">${date}</div>
+          ${nameDivs}
+          <div style="border-bottom:1px solid #eee;line-height:30px;text-align:center;color:#0982FE;cursor: pointer;"
+           data-objs='${JSON.stringify(objs[0].value)}'>查看工况详情</div>
+        </div>
+      `;
         },
-       
       },
       grid: {
         // height: '50%',
@@ -149,7 +201,16 @@ const initChart = () => {
         },
       ],
     };
-    myChart.setOption(option,true);
+    myChart.setOption(option, true);
+
+    // 事件委托,监听 tooltip 内部的点击事件
+    chart.value.addEventListener("click", (event) => {
+      const target = event.target as HTMLElement;
+      if (target && target.dataset.objs) {
+        const objs = JSON.parse(target.dataset.objs);
+        emit("showDetails", objs);
+      }
+    });
   }
 };
 
@@ -169,31 +230,32 @@ watch(
     if (myChart) {
       // hours.value=Array.from(new Set(props.data.map((its:any)=>its.x))).sort((a, b) => a - b)
       myChart.setOption({
-      //    xAxis: {
-      //   type: "category",
-      //   data: hours.value,
-      //   axisTick: {
-      //     show: false,
-      //   },
-      //   axisLabel: {
-      //     show: true,
-      //     color: "#FFFFFFE6",
-      //   },
-      //   axisLine: {
-      //     show: true,
-      //     lineStyle: {
-      //       color: "#FFFFFFE6",
-      //     },
-      //     symbol: ["none", "arrow"], // 添加箭头
-      //     symbolSize: [4, 4], // 调整箭头大小
-      //   },
-      //   boundaryGap: true,
-      // },
+        //    xAxis: {
+        //   type: "category",
+        //   data: hours.value,
+        //   axisTick: {
+        //     show: false,
+        //   },
+        //   axisLabel: {
+        //     show: true,
+        //     color: "#FFFFFFE6",
+        //   },
+        //   axisLine: {
+        //     show: true,
+        //     lineStyle: {
+        //       color: "#FFFFFFE6",
+        //     },
+        //     symbol: ["none", "arrow"], // 添加箭头
+        //     symbolSize: [4, 4], // 调整箭头大小
+        //   },
+        //   boundaryGap: true,
+        // },
         series: [
           {
             data: newData.map((item) => ({
-              value: [item.x, item.y,0],
-              objs:item.value,
+              value: [item.x, item.y, 0],
+              date: item.date,
+              objs: item.value,
               itemStyle: {
                 color: typeColorMap[item.type], // 根据类型设置颜色
               },

+ 1 - 1
src/utils/useServerPagination.ts

@@ -23,7 +23,7 @@ export interface FetchDataFunction<T> {
 export function useServerPagination<T>(
     fetchDataFunction: FetchDataFunction<T>,
     initialPage: number = 1,
-    initialPageSize: number = 10
+    initialPageSize: number = 9
 ) {
     const currentPage = ref<number>(initialPage); // 当前页码
     const pageSize = ref<number>(initialPageSize); // 每页显示的条目数

+ 71 - 51
src/views/ConditionClassification/components/card.vue

@@ -108,22 +108,36 @@ const props = defineProps({
     required: true,
   },
 });
-watch(
-  () => props.data,
-  (newData, oldData) => {
-    lineParamsAllRef.value = newData;
-  },
-  { deep: true }
-);
+// 获取所有显示参数
+let lineParamsAllRef = ref([]);
+interface AnyObject {
+  [key: string]: any;
+}
+const convertToChartData = (
+  selectedData: AnyObject[],
+  properties: string[]
+): { name: string; data: any[] }[] => {
+  // properties.forEach(its=>{
+  //   console.log(selectedData.map((item) => item.data['right_de_rpm_sensor_fault']),its,inverParams[its]);
+
+  // })
+  // // console.log(selectedData);
+
+  // debugger
+  return properties.map((propertyName) => ({
+    name: propertyName,
+    // name: propertyName,
+    data: selectedData.map((item) => item[inverParams[propertyName]]),
+  }));
+};
+const checkedParams = ref([]);
+
 const emit = defineEmits(["viewDetails"]);
 
 const handleClick = () => {
   emit("viewDetails", props.data);
 };
-onMounted(() => {
-  getcateData();
-  getPointData(btnBigIndex.value, "温度");
-});
+
 let cateBigRef = ref([]);
 let cateSmallRef = ref([]);
 let setParams = ref([]);
@@ -146,28 +160,14 @@ const getPointData = async (deviceName, categoryName) => {
   let data = await measurementPoints({ deviceName, categoryName });
   setParams.value = data.data.map((its) => its.pointName);
 };
-// 获取所有显示参数
-let lineParamsAllRef = ref([]);
-watch(
-  () => lineParamsAllRef.value,
-  (newdata: any) => {
-    if (lineParamsAllRef.value.length == 0) {
-      const result: Array<AnyObject> = convertToChartData(
-        newdata,
-        checkedParams.value
-      );
-      setLineparames(newdata, result);
-      return false;
-    }
-    const result: Array<AnyObject> = convertToChartData(
-      newdata,
-      checkedParams.value
-    );
 
-    setLineparames(newdata, result);
-  },
-  { deep: true }
-);
+// watch(
+//   () => lineParamsAllRef.value,
+//   (newdata: any) => {
+  
+//   },
+//   { deep: true }
+// );
 // const setParams = ref(convertObjectToArray(COLUMN_MAP));
 const changeAttr = (valArr: string[]) => {
   btnIndex.value == 5
@@ -212,7 +212,6 @@ const showParamsModel = () => {
   showModal.value = true;
 };
 
-const checkedParams = ref([]);
 // 设备参数全
 // 参数运行示例数据
 // 横坐标轴时间点
@@ -251,7 +250,7 @@ const setLineparames = (
 ) => {
   // 横坐标时间点
   xAxisParamsData.value = dataAll.map((its) =>
-    moment(its.data._ts).format("HH:mm:ss")
+    moment(its._ts).format("HH:mm:ss")
   );
   // .slice(-30);
   // 折线图数据
@@ -260,9 +259,11 @@ const setLineparames = (
       ...its,
       data: its.data.slice(-30),
     };
+    
   });
   // 图例
   legendPramsData.value = selectData.map((its) => its.name);
+  
 };
 // 参数转化
 const convertObjectToArray = (
@@ -274,26 +275,45 @@ const convertObjectToArray = (
   }));
 };
 
-interface AnyObject {
-  [key: string]: any;
+const runLineParams=()=>{
+      let newDataValue=lineParamsAllRef.value
+      if (lineParamsAllRef.value.length == 0) {
+      const result: Array<AnyObject> = convertToChartData(
+        newDataValue,
+        checkedParams.value
+      );
+      setLineparames(newDataValue, result);
+      return false;
+    }
+    const result: Array<AnyObject> = convertToChartData(
+      newDataValue,
+      checkedParams.value
+    );
+    setLineparames(newDataValue, result);
 }
-const convertToChartData = (
-  selectedData: AnyObject[],
-  properties: string[]
-): { name: string; data: any[] }[] => {
-  // properties.forEach(its=>{
-  //   console.log(selectedData.map((item) => item.data['right_de_rpm_sensor_fault']),its,inverParams[its]);
+watch(
+  () => props.data,
+  (newData, oldData) => {
+     lineParamsAllRef.value = newData.chart_data;
+    runLineParams()
+  },
+  { deep: true,immediate:true }
+);
+watch(
+  () => checkedParams.value,
+  (newData, oldData) => {
+    runLineParams()
+  },
+  { deep: true,immediate:true }
+);
 
-  // })
-  // // console.log(selectedData);
+onMounted(async () => {
+  getcateData();
+  await getPointData(btnBigIndex.value, "温度");
+     checkedParams.value = setParams.value.slice(0, 5);
+     runLineParams()
 
-  // debugger
-  return properties.map((propertyName) => ({
-    name: propertyName,
-    // name: propertyName,
-    data: selectedData.map((item) => item.data[inverParams[propertyName]]),
-  }));
-};
+});
 const formatPressure = (value: number | string) => {
   // console.log(typeof value,'------');
 

+ 22 - 10
src/views/HealthStatusAnalysis/mock.vue

@@ -7,6 +7,7 @@
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
 <template>
+
   <div class="all-page">
     <div class="left">
       <!-- {{machineImgParamsRef}} -->
@@ -486,13 +487,13 @@
     v-model:visible="showCondModal"
     customClass="custom-modal"
     title="工况详情"
-    type="warn"
+    type="success"
   >
     <!-- 模态框内容插槽 -->
     <div class="custom-warn-box">
        <el-table
        border
-       max-height="300"
+       max-height="600"
         show-overflow-tooltip
         :data="tableData"
         style="width: 100%"
@@ -500,13 +501,13 @@
         class="custom-table"
       >
         <el-table-column
-          prop="name"
+          prop="time"
           label="时间"
           sortable
           align="center"
         ></el-table-column>
         <el-table-column
-          prop="createTime"
+          prop="label"
           label="工况名称"
           align="center"
           
@@ -518,8 +519,8 @@
           align="center"
         >
            <template v-slot="scope">
-            <div :class="['scope.row.sts'+enumParasm[scope.row.sts].color]" 
-              >{{scope.row.sts}}</div
+            <div :class="['text-normal','text-'+enumParasm[scope.row.type].color]" 
+              >{{enumParasm[scope.row.type].text}}</div
             >
 
           </template>
@@ -589,9 +590,9 @@ const getHStatus = async () => {
 };
 let lineParamsAllRef = ref([]);
 
-onMounted(() => {
+onMounted(async () => {
   getcateData();
-  getPointData(btnBigIndex.value, "温度");
+  await getPointData(btnBigIndex.value, "温度");
   getHStatus();
   if (!!sessionStorage.getItem("runStatus")) {
     runstatusMessage(JSON.parse(sessionStorage.getItem("runStatus")));
@@ -605,7 +606,7 @@ onMounted(() => {
     if (cachecheckedParams) {
       checkedParams.value = JSON.parse(cachecheckedParams);
     } else {
-      checkedParams.value = Object.values(COLUMN_MAP).slice(0, 5);
+      checkedParams.value = setParams.value.slice(0, 5);
     }
   });
   mockCacheData({}).then((res: any) => {
@@ -1145,6 +1146,7 @@ const transformData = (data: DataPoint[]) => {
     return {
       x: convertTo12HourFormat(x),
       y: weekDayMap[y],
+      date:item.date,
       value: valueArray,
       type: `${type}`,
     };
@@ -1411,7 +1413,7 @@ const healthColor = (status: string) => {
 .left {
   display: grid;
   grid-template-rows: 60% 40%;
-  margin-top: 43px;
+  margin-top: 10px;
   /* 默认情况下,子元素会自动分配空间 */
 }
 
@@ -1833,4 +1835,14 @@ const healthColor = (status: string) => {
   background-clip: text;
   text-fill-color: transparent;
 }
+
+.text-normal{
+  color: #0982FE;
+}
+.text-warn{
+  color: #FF8C00;
+}
+.text-danger{
+  color: #FC3F3F;
+}
 </style>

+ 13 - 5
src/views/MaintenanceStrategyAssistance/his.vue

@@ -184,20 +184,24 @@ const getHealthStatusText = (status: number) => {
 // 可靠性预测
 const toRpc=async (row:any)=>{
       proxy.$loading.start();
-  await recordAssessmentResult({source:2,fileId:row.id})
+      // if (routeType.value!='auto') {
+        // await recordAssessmentResult({source:1,fileId:row.id})
+      // }
       proxy.$loading.stop();
   router.push({
     path:'/OperationalReliabilityPrediction',
     query:{
       id:row.id,
-      name:row.name
+      name:row.name,
+      source:routeType.value=='auto'?3:1
     }
   })
 }
 import {
   repairHisList,
   repairHisDel,
-  recordAssessmentResult
+  recordAssessmentResult,
+  repairAutoHisList
 } from "@/api/index";
 const { proxy } = getCurrentInstance()!;
 // pages
@@ -217,7 +221,11 @@ const fetchDataFunction = async (
   pageSize: number
 ): Promise<PaginationResponse<DataItem>> => {
     proxy.$loading.start()
-  const response = await repairHisList({
+    let state=repairHisList
+    if (routeType.value=='auto') {
+      state=repairAutoHisList
+    }
+  const response = await state({
     current: page,
     size: 9,
     ...queryParams.value,
@@ -242,7 +250,7 @@ onMounted(() => {
   const name = route.query.name;
   routeType.value=route.query.type;
   if (pageId) {
-    queryParams.value.id = Number(pageId);
+    queryParams.value.id = pageId;
  
   }
   if (name) {

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

@@ -1,6 +1,6 @@
 <template>
   <div class="ace-sear">
-    <div class="custom-time-select">
+    <!-- <div class="custom-time-select">
       <el-select
         class="ace-sel"
         v-model="queryParams.status"
@@ -16,7 +16,7 @@
         <el-option label="有故障" value="2"></el-option>
         <el-option label="无故障" value="1"></el-option>
       </el-select>
-    </div>
+    </div> -->
     <div class="custom-time-input" v-if="activeTab == 1">
       <el-date-picker
         v-model="queryParams.startTime"
@@ -73,10 +73,11 @@
         <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.status)">{{
-          scope.row.status == '有故障' ? "有故障" : "故障"
+        <span :class="getHealthStatusClass('有故障')">{{
+          scope.row.status == '有故障' ? "有故障" : "故障"
         }}</span>
       </template>
     </el-table-column>
@@ -85,7 +86,7 @@
         <el-button
           class="btns"
           link
-          @click="viewDetails(scope.row.id, scope.row.name)"
+          @click="viewDetails(scope.row.date_range, scope.row.name)"
           >详情</el-button
         >
         <!-- <el-button class="btns" link @click="exportRecord(scope.row.name)"
@@ -117,7 +118,7 @@ import sTitle from "@/components/StructTitle/index.vue";
 import { Filter } from "@element-plus/icons-vue";
 import { ref, computed, getCurrentInstance } from "vue";
 
-import { repairList,autoFailureRecord } from "@/api/index";
+import { repairList,autoFailureRecord,repairDetailAutoList } from "@/api/index";
 const { proxy } = getCurrentInstance()!;
 // pages
 import {
@@ -184,7 +185,7 @@ const setActiveTab = (val: number) => {
 const viewDetails = (id: number) => {
   router.push({
     path: "/repair/MaintenanceStrategyAssistanceView",
-    query: { id,type:'auto' },
+    query: { id,type:'auto', },
   });
   // ElMessage({
   //   message: `查看详情: ${id}`,

+ 117 - 5
src/views/MaintenanceStrategyAssistance/record/hand.vue

@@ -91,7 +91,7 @@
         <el-button class="btns" link @click="toRpc(scope.row)"
           >跳转至可靠性预测</el-button
         >
-        <el-button class="btns-warn" link @click="delBefore(scope.row.id)"
+        <el-button class="btns-warn"  link @click="delBefore(scope.row.id)"
           >删除</el-button
         >
       </template>
@@ -109,6 +109,24 @@
     >
     </el-pagination>
   </div>
+    <!-- 维修记录删除的删除 -->
+  <ModalComponent
+    v-model:visible="delVisible"
+    customClass="custom-modal"
+    width="730px"
+    title="维修记录删除警告"
+  >
+    <!-- 模态框内容插槽 -->
+    <div class="custom-box custom-time-input">
+      <div class="confirmText">确认删除该数据吗?</div>
+      <div class="footer">
+        <div class="btnFooter cancel" @click="delVisible = false">取消</div>
+        <div class="btnFooter btnFooter-big" @click="deleteRecord(form)">
+          确认
+        </div>
+      </div>
+    </div>
+  </ModalComponent>
 </template>
 
 <script lang="ts" setup>
@@ -116,8 +134,9 @@ import { ElMessage } from "element-plus";
 import sTitle from "@/components/StructTitle/index.vue";
 import { Filter } from "@element-plus/icons-vue";
 import { ref, computed, getCurrentInstance } from "vue";
+import ModalComponent from "@/components/ModalComponent/index.vue";
 
-import { repairList,recordAssessmentResult } from "@/api/index";
+import { repairList,recordAssessmentResult,repairDel } from "@/api/index";
 const { proxy } = getCurrentInstance()!;
 // pages
 import {
@@ -177,13 +196,16 @@ const route = useRoute(); // 获取当前路由对象
 // 可靠性预测
 const toRpc=async (row:any)=>{
       proxy.$loading.start();
-  await recordAssessmentResult({source:2,fileId:row.id})
+  // await recordAssessmentResult({source:1,fileId:row.id})
       proxy.$loading.stop();
   router.push({
     path:'/OperationalReliabilityPrediction',
     query:{
       id:row.id,
-      name:row.name
+      name:row.name,
+       start_time:row.startTime,
+       end_time:row.endTime,
+      source:1
     }
   })
 }
@@ -212,6 +234,29 @@ const getHealthStatusClass = (sts: number) => {
       return "dange";
   }
 };
+// 删除逻辑
+let delVisible = ref(false);
+let delId = ref("");
+const delBefore = (id: number) => {
+  delVisible.value = true;
+  delId.value = id;
+};
+const deleteRecord = async () => {
+  let res = await repairDel(delId.value);
+  if (res == true || !!res.data) {
+    ElMessage({
+      message: `操作成功`,
+      type: "success",
+    });
+    delVisible.value = false;
+    fetchData();
+  } else {
+    ElMessage({
+      message: res.msg,
+      type: "error",
+    });
+  }
+};
 </script>
 
 <style scoped>
@@ -425,7 +470,9 @@ const getHealthStatusClass = (sts: number) => {
   letter-spacing: 0%;
   text-align: left;
 }
-
+.btns-warn{
+  color:rgb(255, 0, 0) ;
+}
 .invalid {
   background: linear-gradient(180deg, rgb(255, 0, 0), rgb(255, 255, 255));
   -webkit-background-clip: text;
@@ -459,4 +506,69 @@ const getHealthStatusClass = (sts: number) => {
   display: flex;
   justify-content: center;
 }
+
+
+
+.btns {
+  color: #4faffc;
+}
+.btns-warn {
+  color: #f80102;
+}
+.pagination {
+  margin-top: 20px;
+  display: flex;
+  justify-content: center;
+}
+.btnFooter {
+  width: 22%;
+  margin: 5px 0;
+  padding: 5px;
+  height: 40px;
+  box-sizing: border-box;
+  background: rgba(0, 122, 255, 0.25);
+  color: rgba(255, 255, 255, 0.45);
+  text-align: center;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border: none;
+  cursor: pointer;
+  border-radius: 20px;
+  border: 2px solid rgb(0, 122, 255);
+}
+.btnFooter:hover {
+  color: #fff;
+}
+.btnFooter-big,
+.cancel {
+  width: 200px;
+}
+.btnFooter-big {
+  background-color: rgb(0, 122, 255);
+  color: #fff;
+}
+.footer {
+  position: absolute;
+  bottom: 0px;
+  left: 15%;
+  width: 70%;
+  display: flex;
+  justify-content: space-between;
+  margin: 30px auto;
+}
+.modal-bot {
+  padding-bottom: 100px;
+}
+.confirmText {
+  font-size: 20px;
+  text-align: center;
+  line-height: 180px;
+  color: rgba(255, 255, 255, 0.85);
+  width: 100%;
+}
+.maintenance-strategy-assistance {
+  color: #fff;
+}
+
 </style>

+ 13 - 3
src/views/MaintenanceStrategyAssistance/view.vue

@@ -146,7 +146,7 @@ import { Filter } from "@element-plus/icons-vue";
 import { Search } from "@element-plus/icons-vue";
 import { useRoute, useRouter } from "vue-router";
 import ModalComponent from "@/components/ModalComponent/index.vue";
-import { downloadDeviceRepair } from "@/api/index";
+import { downloadDeviceRepair,repairDetailAutoList } from "@/api/index";
 import { downloadFile } from "@/utils/utils";
 
 // 基础路由
@@ -211,7 +211,11 @@ const fetchDataFunction = async (
   pageSize: number
 ): Promise<PaginationResponse<DataItem>> => {
     proxy.$loading.start()
-  const response = await repairDetailList({
+    let stateAsync=repairDetailList
+    if (routeType.value=='auto') {
+      stateAsync=repairDetailAutoList
+    }
+  const response = await stateAsync({
     current: page,
     size: 9,
     ...queryParams.value,
@@ -236,7 +240,13 @@ onMounted(() => {
   routeType.value=route.query.type
   // const pageId = route.query.id;
   if (pageId) {
-    queryParams.value.id = Number(pageId);
+    if (routeType.value=='auto') {
+      
+      queryParams.value.dateRange = pageId.replaceAll('+',' ');
+    }else{
+            queryParams.value.id = Number(pageId);
+
+    }
     // queryParams.value.id = Number(pageId);
   }
 });

+ 78 - 50
src/views/OperationalReliabilityPrediction/index.vue

@@ -4,9 +4,11 @@
       <s-title titleText="可靠性预测"></s-title>
     </div>
     <div class="content emptyDs" v-if="showEmpty">
-      <empty message="暂无可靠性预测结果,您可通过以下途径进行可靠性预测:<br>
+      <empty
+        message="暂无可靠性预测结果,您可通过以下途径进行可靠性预测:<br>
 1、在健康状态分析页面点击【记录评估结果】后,重进该页面<br>
-2、在数据文件管理页面,上传文件后,点击可靠性预测`"></empty>
+2、在数据文件管理页面,上传文件后,点击可靠性预测`"
+      ></empty>
     </div>
     <div class="content" v-else>
       <div class="left-panel">
@@ -34,7 +36,10 @@
           </div>
         </div>
         <div class="section-title">
-          <s-title :type="3" :titleText="!!fileName ? '模拟可靠性预测':'可靠性预测'"></s-title>
+          <s-title
+            :type="3"
+            :titleText="!!fileName ? '模拟可靠性预测' : '可靠性预测'"
+          ></s-title>
         </div>
         <div class="info-type">
           <div
@@ -59,25 +64,37 @@
           </div>
           <div class="info-item" v-if="!!!fileName">
             预计发生故障:
-            <span class="info-value"> {{ formattedText(currentBtn.expected_failure) }}</span>
+            <span class="info-value">
+              {{ formattedText(currentBtn.expected_failure) }}</span
+            >
           </div>
           <div class="info-item">
             近期故障概率:
             <span class="info-value">
-              {{ formattedText(currentBtn.short_term_failure_probability,'5%') }}</span
+              {{
+                formattedText(currentBtn.short_term_failure_probability, "5%")
+              }}</span
             >
           </div>
           <div class="info-item">
             故障发生时间:
-            <span class="info-value"> {{ formattedText(currentBtn.failure_time) }}</span>
+            <span class="info-value">
+              {{ formattedText(currentBtn.failure_time) }}</span
+            >
           </div>
           <div class="info-item">
             影响因素分析:
-            <span class="info-value"> {{ formattedText(currentBtn.impact_factors) }}</span>
+            <span class="info-value">
+              {{ formattedText(currentBtn.impact_factors) }}</span
+            >
           </div>
           <div class="info-item">
             剩余可靠时间:
-            <span class="info-value"> {{ formattedText(currentBtn.remaining_lifetime,'半年以上')  }}</span>
+            <span class="info-value">
+              {{
+                formattedText(currentBtn.remaining_lifetime, "半年以上")
+              }}</span
+            >
           </div>
         </div>
       </div>
@@ -88,7 +105,7 @@
         <div class="chart">
           <!-- 图表组件 -->
           <LineChart
-          ref="lineChartRef"
+            ref="lineChartRef"
             :xAxisData="xAxisData"
             :seriesData="seriesData"
             :showLegend="showLegend"
@@ -110,19 +127,18 @@
           <div class="suggestion-item">
             <div class="suggestion-title">维修方法</div>
             <span class="suggestion-value">{{
-             formattedText( currentBtn.maintenance_method)
+              formattedText(currentBtn.maintenance_method)
             }}</span>
           </div>
           <div class="suggestion-item">
             <div class="suggestion-title">所需维修资源</div>
             <span class="suggestion-value">{{
-             formattedText( currentBtn.required_resources)
+              formattedText(currentBtn.required_resources)
             }}</span>
           </div>
         </div>
         <div class="buttons">
           <button
-            
             class="btn btn-big"
             @click="goAdvice(currentBtn.name, currentBtn.name)"
           >
@@ -159,17 +175,20 @@ const router = useRouter();
 const route = useRoute(); // 获取当前路由对象
 // 可靠性预测导出
 const lineChartRef = ref(null);
-let serviceDataRef=ref(null)
+let serviceDataRef = ref(null);
 const getAllDomElements = async () => {
   // this.$nextTick(() => {
-   let imgBase64= await lineChartRef.value.saveChartAndSend();
-   console.log(imgBase64);
-   
-    serviceDataRef.value={
+  let imgBase64 = await lineChartRef.value.saveChartAndSend();
+  console.log(imgBase64);
+
+  serviceDataRef.value = {
     ...serviceDataRef.value,
-    image:imgBase64.split(',')[1]
-   }
-     downloadFile(downloadStrategy(), "预测结果.docx", { fileName:fileName.value,...serviceDataRef.value });
+    image: imgBase64.split(",")[1],
+  };
+  downloadFile(downloadStrategy(), "预测结果.docx", {
+    fileName: fileName.value,
+    ...serviceDataRef.value,
+  });
 
   //  downloadStrategy({...serviceDataRef.value}).then((res:any)=>{
   //   debugger
@@ -214,35 +233,41 @@ const btnTab = (index: number, item: any) => {
 };
 const formatPercentage = (value: string) => {
   // 去掉百分号
-  const numericValue = parseFloat(value.replace('%', ''));
+  const numericValue = parseFloat(value.replace("%", ""));
   // 检查是否为数字
   if (isNaN(numericValue)) {
     return value; // 如果不是数字,返回原始值
   }
   // 取小数点后两位并加上百分号
-  return numericValue.toFixed(2) + '%';
+  return numericValue.toFixed(2) + "%";
 };
 
 // 计算属性来格式化 short_term_failure_probability
 const formattedShortTermFailureProbability = computed(() => {
   const value = currentBtn.value.short_term_failure_probability;
-  return typeof value === 'string' ? formatPercentage(value) : '暂无';
+  return typeof value === "string" ? formatPercentage(value) : "暂无";
 });
-const formattedText = (value,deValue)=>{
+const formattedText = (value, deValue) => {
   if (!!deValue) {
-     return !!value?value:deValue
+    return !!value ? value : deValue;
   }
-  return !!value?value:'暂无'
-}
-const showEmpty=ref(false)
+  return !!value ? value : "暂无";
+};
+const showEmpty = ref(false);
 onMounted(() => {
   let source = 1;
   const pageId = route.query.id;
   const name = route.query.name;
   fileName.value = name;
+
   if (pageId) {
     source = 2;
   }
+  const sourceCp = route.query.source;
+
+  if (!!sourceCp) {
+    source = sourceCp;
+  }
   // evaluateHealthStatus({ source, fileId: pageId }).then((res: any) => {
   //   const result: any = res.data;
   //   xAxisData.value = result.chart.x;
@@ -259,35 +284,38 @@ onMounted(() => {
   //       data: result.chart.y,
   //     },
   //   ];
-
-  evaluateHealthStatus({ source, fileId: pageId })
+let timeObj={};
+if (!!route.query.start_time) {
+  timeObj.start_time=route.query.start_time.replaceAll('+',' ')
+}
+if (!!route.query.end_time) {
+  timeObj.end_time=route.query.end_time.replaceAll('+',' ')
+}
+  evaluateHealthStatus({ source, [source == 2 ? "fileId" : "id"]: pageId,...timeObj })
     .then((res: any) => {
       proxy.$loading.stop();
 
       const result: any = res.data;
-      if (result==false) {
-        showEmpty.value=true
-        return false
+      if (result == false) {
+        showEmpty.value = true;
+        return false;
       }
-        showEmpty.value=false
-      serviceDataRef.value=result;
+      showEmpty.value = false;
+      serviceDataRef.value = result;
       xAxisData.value = result.chart.x;
       forecast_result.value = result.forecast_result;
       devicesArr.value = result.devices;
-      
-      
-      if (result.devices.length==0) {
-        currentBtn.value={
-          health_status:'健康'
-        }
-        
-      }else{
-        currentBtn.value = {
-        ...result.devices[0],
-        ...result.devices[0].maintenance_suggestion,
-        ...result.devices[0].reliability_forecast,
 
-      };
+      if (result.devices.length == 0) {
+        currentBtn.value = {
+          health_status: "健康",
+        };
+      } else {
+        currentBtn.value = {
+          ...result.devices[0],
+          ...result.devices[0].maintenance_suggestion,
+          ...result.devices[0].reliability_forecast,
+        };
       }
       seriesData.value = [
         {
@@ -311,8 +339,8 @@ onMounted(() => {
 </script>
 
 <style scoped>
-.emptyDs{
-  height: calc( 100% - 300px);
+.emptyDs {
+  height: calc(100% - 300px);
 }
 .container {
   display: flex;