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

首页弹窗逻辑修改

Koishi 3 éve
szülő
commit
9865aa2a46
2 módosított fájl, 34 hozzáadás és 75 törlés
  1. 4 53
      src/views/Home/Home.vue
  2. 30 22
      src/views/Home/dialog/table.vue

+ 4 - 53
src/views/Home/Home.vue

@@ -771,18 +771,6 @@
       </div>
     </el-dialog>
     <el-dialog
-      title="预测电量详情"
-      v-model="showForecastDialog"
-      width="70%"
-      top="10vh"
-      custom-class="modal"
-      :close-on-click-modal="true"
-    >
-      <div style="height: 500px; padding: 50px 0">
-        <ComTable :data="forecastData" height="100%;" />
-      </div>
-    </el-dialog>
-    <el-dialog
       :title="dialogTitle"
       v-model="dialogShow"
       width="70%"
@@ -859,7 +847,6 @@ export default {
       timmer2: null,
       timmer3: null,
       showWeatherDialog: false,
-      showForecastDialog: false,
       weatherChart: [
         {
           title: "温度",
@@ -908,18 +895,6 @@ export default {
       dialogShow: false,
       dialogTitle: "",
       dialogData: {},
-      forecastData: {
-        column: [
-          {
-            name: "风场",
-            field: "name",
-            is_num: false,
-            is_light: false,
-            sortable: true,
-          },
-        ],
-        data: [],
-      },
       // 预测电量
       ForecastPower: [],
       // 日发电量
@@ -1249,6 +1224,7 @@ export default {
 
     showForecastBox() {
       let that = this;
+      that.dialogTitle = "预测电量详情";
       that.API.requestData({
         method: "POST",
         subUrl: "/genreset/getForecastwindspeedInfo",
@@ -1256,34 +1232,9 @@ export default {
           wpId: that.wpId,
         },
         success(res) {
-
-          let forecastData = {
-            column: [
-              {
-                name: "风场名称",
-                field: "name",
-                is_num: false,
-                is_light: false,
-                sortable: true,
-              },
-            ],
-            data: [],
-          };
-
-          res.data.retValue.forEach((ele, index) => {
-            forecastData.column.push({
-              name: res.data.datels[index],
-              field: "value" + (index + 1),
-              is_num: false,
-              is_light: false,
-              sortable: true,
-            });
-          });
-
-          forecastData.data = res.data.retValue;
-          that.forecastData = forecastData;
-
-          that.showForecastDialog = true;
+          that.dialogData = res.data;
+          that.dialogType = "table";
+          that.dialogShow = true;
         },
       });
     },

+ 30 - 22
src/views/Home/dialog/table.vue

@@ -15,18 +15,26 @@
       <div class="left">
         <table class="table-form">
           <tr>
-            <td class="white"></td>
-            <td class="white" v-for="(item, index) in tableData.datels" :key="index">{{item}}</td>
+            <td class="white" v-if="tableData.result && tableData.result.length"></td>
+            <td class="white" v-if="tableData.retValue && tableData.retValue.length">风场</td>
+            <td
+              class="white"
+              v-for="(item, index) in tableData.datels"
+              :key="index"
+            >
+              {{ item }}
+            </td>
           </tr>
-          <tr v-for="(item, index) in tableData.result" :key="index">
-            <td class="white" v-if="item.value1">{{item.value1}}</td>
-            <td class="white" v-if="item.value2">{{item.value2}}</td>
-            <td class="white" v-if="item.value3">{{item.value3}}</td>
-            <td class="white" v-if="item.value4">{{item.value4}}</td>
-            <td class="white" v-if="item.value5">{{item.value5}}</td>
-            <td class="white" v-if="item.value6">{{item.value6}}</td>
-            <td class="white" v-if="item.value7">{{item.value7}}</td>
-            <td class="white" v-if="item.value8">{{item.value8}}</td>
+          <tr v-for="(item, index) in tableData.result || tableData.retValue" :key="index">
+            <td class="white" v-if="tableData.retValue && item.name">{{ item.name }}</td>
+            <td class="white" v-if="item.value1">{{ item.value1 }}</td>
+            <td class="white" v-if="item.value2">{{ item.value2 }}</td>
+            <td class="white" v-if="item.value3">{{ item.value3 }}</td>
+            <td class="white" v-if="item.value4">{{ item.value4 }}</td>
+            <td class="white" v-if="item.value5">{{ item.value5 }}</td>
+            <td class="white" v-if="item.value6">{{ item.value6 }}</td>
+            <td class="white" v-if="item.value7">{{ item.value7 }}</td>
+            <td class="white" v-if="item.value8">{{ item.value8 }}</td>
           </tr>
         </table>
       </div>
@@ -39,26 +47,26 @@ export default {
   data() {
     return {
       value: "",
-      tableData:{}
+      tableData: {},
     };
   },
 
-  props:{
-    data:{
-      type:Object,
-      default:() => {}
-    }
+  props: {
+    data: {
+      type: Object,
+      default: () => {},
+    },
   },
 
-  mounted(){
+  mounted() {
     this.tableData = this.data;
   },
 
-  watch:{
-    data(res){
+  watch: {
+    data(res) {
       this.tableData = res;
-    }
-  }
+    },
+  },
 };
 </script>