Ver código fonte

修改下载问题

chenbaoxin 4 meses atrás
pai
commit
63b32177ab

+ 2 - 0
src/api/index.ts

@@ -19,6 +19,8 @@ export function uploadFile(data:any) {
 }
 
 export function downloadStrategy() {
+  // return post("/deviceRepair/downloadStrategy",data);
+
   return "/deviceRepair/downloadStrategy";
 }
 // 工况列表接口

+ 2 - 2
src/components/LineChart/index.vue

@@ -106,13 +106,13 @@ const initChart = () => {
   myChart.setOption(option,true);
 };
 const saveChartAndSend = async () => {
-  const imgData = myChart.getDataURL({
+  const imgData = await myChart.getDataURL({
     type: 'png',
     pixelRatio: 2,
     backgroundColor: '#fff'
   });
   console.log(imgData);
-  
+  return imgData
   };
  defineExpose({ saveChartAndSend });
 onMounted(() => {

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

@@ -802,7 +802,7 @@ const gridData = [
   {
     date: ">0.75",
     name: "75%",
-    address: "严重异常",
+    address: "严重故障",
   },
 ];
 const determineHealthStatus = (avgNum:any) => {
@@ -824,7 +824,7 @@ const determineHealthStatus = (avgNum:any) => {
     };
   } else if (value > 0.75) {
        return {
-      name:`严重异常(${avgNum}%)`,
+      name:`严重故障(${avgNum}%)`,
       color:'error'
     };
   }

+ 8 - 4
src/views/OperationalReliabilityPrediction/index.vue

@@ -154,12 +154,16 @@ const lineChartRef = ref(null);
 let serviceDataRef=ref(null)
 const getAllDomElements = async () => {
   // this.$nextTick(() => {
-   let imgBase64=lineChartRef.value.saveChartAndSend();
-   serviceDataRef.value={
+   let imgBase64= await lineChartRef.value.saveChartAndSend();
+    serviceDataRef.value={
     ...serviceDataRef.value,
-    imgBase64:imgBase64
+    image:imgBase64
    }
-   
+     downloadFile(downloadStrategy(), "预测结果", { ...serviceDataRef.value });
+
+  //  downloadStrategy({...serviceDataRef.value}).then((res:any)=>{
+  //   debugger
+  //  })
 };
 const goAdvice = (name: string) => {
   router.push({

+ 2 - 2
vite.config.ts

@@ -22,8 +22,8 @@ export default defineConfig({
     proxy: {
       // 代理配置
       '/api': {
-        // target: 'http://192.168.1.103:8083',  // 目标服务器
-        target: 'http://192.168.99.49:8083',  // 目标服务器
+        target: 'http://192.168.1.103:8083',  // 目标服务器
+        // target: 'http://192.168.99.49:8083',  // 目标服务器
         changeOrigin: true,            // 需要虚拟主机站点
         rewrite: (path) => path.replace(/^\/api/, '/api/')  // 重写 API 请求
       }