Browse Source

Merge branch 'mw2' of http://61.161.152.110:10101/r/electronic-map into sl

shilin 3 years ago
parent
commit
790dc6e276
3 changed files with 46 additions and 109 deletions
  1. 21 105
      src/views/Decision/table.vue
  2. 4 1
      src/views/NewPages/znzhfx.vue
  3. 21 3
      src/views/singleAnalysis/index.vue

+ 21 - 105
src/views/Decision/table.vue

@@ -2,7 +2,7 @@
   <table class="com-table">
     <thead>
       <tr>
-        <th v-for="(col, index) of data.column" :key="index" :class="{ light: col.is_light }" :style="{ width: col.width , display : col.display }" @click="onSort(col)">
+        <th v-for="(col, index) of data.column" :key="index" :class="{ light: col.is_light }" :style="{ width: col.width }" @click="onSort(col)">
           {{ col.name }}
         </th>
       </tr>
@@ -13,18 +13,18 @@
           <td
             v-for="(col, i) of data.column"
             :key="i"
-            :style="{ width: col.width , display : col.display}"
+            :style="{ width: col.width ,cursor:col.cursor}"
             :class="{ light: hoverRow == row || hoverCol == col, num: col.is_num, 'always-light': col.is_light || row.is_light }"
             @mouseenter="hover(row, col)"
             @mouseleave="leave()"
           >
-            <component :is="col.type ? col.type : 'div'" v-bind="col.props" v-html="template(col, row[col.field])" @click="onClick(col, row)"> </component>
+            <component :is="col.type ? col.type : 'span'" v-bind="col.props" v-html="template(col, row[col.field])" @click="onClick(col, row)"> </component>
           </td>
         </tr>
 		<slot name="tr"></slot>
       </tbody>
     </el-scrollbar>
-    <el-pagination class="mg-t-8" v-if="pageable" @current-change="handleCurrentChange" :current-page="currentPage4" :page-size="pageSize" layout="total, prev, pager, next, jumper" :total="data.total"> </el-pagination>
+    <el-pagination class="mg-t-8" v-if="pageable" @current-change="handleCurrentChange" :current-page="currentPage" :page-size="pageSize" :total="data.total" v-bind="elPaggingProps"> </el-pagination>
   </table>
 </template>
 
@@ -71,6 +71,11 @@ export default {
       type: Boolean,
       default: true,
     },
+    // 列高亮
+    showColHover: {
+      type: Boolean,
+      default: false,
+    },
     canScroll: {
       type: Boolean,
       default: true,
@@ -83,6 +88,16 @@ export default {
       type: String,
       default: "",
     },
+    // 新增 支持 pagging 组件
+    elPaggingProps: {
+      type: Object,
+      default: () => {
+        return {
+          layout: "total, sizes, prev, pager, next, jumper",
+          // "page-sizes": [100, 200, 300, 400],
+        };
+      },
+    },
   },
   // 自定义事件
   emits: {
@@ -173,7 +188,7 @@ export default {
     hover(row, col) {
       if (this.showHover) {
         this.hoverRow = row;
-        this.hoverCol = col;
+        if (this.showColHover) this.hoverCol = col;
       }
     },
     leave() {
@@ -209,104 +224,5 @@ export default {
 </script>
 
 <style lang="less">
-@titleGray: #9ca5a8;
-@rowGray: #606769;
-@darkBack: #536268;
-.com-table {
-  width: 100%;
-  border-collapse: collapse;
-
-  thead {
-    tr {
-      display: table;
-      table-layout: fixed;
-      width: 100%;
-
-      th {
-        background-color: fade(@darkBack, 20%);
-        height: 30px;
-        line-height: 30px;
-        color: @titleGray;
-        font-weight: 400;
-        font-size: @fontsize-s;
-        position: sticky;
-        top: 0;
-        cursor: pointer;
-
-        &.light,
-        &.always-light {
-          color: @green;
-        }
-      }
-    }
-  }
-
-  tbody {
-    display: block;
-
-    tr {
-      display: table;
-      table-layout: fixed;
-      width: 100%;
-
-      &:nth-child(2n) {
-        background-color: fade(@rowGray, 20%);
-      }
-
-      td {
-        padding: 0.556vh 0;
-        color: @rowGray;
-        text-align: center;
-        font-size: @fontsize-s;
-        overflow: hidden; //隐藏文字
-        text-overflow: ellipsis; //显示 ...
-        white-space: nowrap; //不换行
-
-        &.light,
-        &.always-light {
-          color: @green !important;
-        }
-
-        &.num {
-          font-family: "Bicubik";
-          font-weight: 400;
-        }
-      }
-    }
-  }
-
-  .el-pagination {
-    color: @gray;
-    .el-pagination__total {
-      color: @gray;
-    }
-
-    button {
-      &.btn-next,
-      &.btn-prev {
-        background: center center no-repeat fade(@gray, 20);
-        color: @gray-l;
-      }
-      &:disabled {
-        color: @gray-l;
-        background-color: fade(@gray, 20);
-        cursor: not-allowed;
-      }
-    }
-
-    .el-pager li {
-      color: @gray-l;
-      background: fade(@gray, 20);
-      &.active {
-        color: @green;
-      }
-    }
-
-    .el-input__inner {
-      color: @gray-l;
-      background: fade(@gray, 20);
-      border: 1px solid fade(@gray, 20);
-    }
-  }
-}
 </style>
+

+ 4 - 1
src/views/NewPages/znzhfx.vue

@@ -4,7 +4,7 @@
       <el-row :gutter="20" class="table-panel">
         <el-col :span="24">
           <div class="back">
-            <button class="btn" type="button">
+            <button class="btn" type="button" @click="back">
               <span>返回</span>
             </button>
           </div>
@@ -507,6 +507,9 @@ export default {
       this.bar2data.data = arrwsdata;
       console.warn(this.bar2data);
     },
+	back(){
+		this.$router.go(-1);
+	}
   },
 };
 </script>

+ 21 - 3
src/views/singleAnalysis/index.vue

@@ -26,7 +26,17 @@
 			</div>
 		</div>
     <div class="df-table">
-      <ComTable height="78vh" :data="tableData"></ComTable>
+      <ComTable height="78vh" :data="tableData">
+		  
+		  <template v-slot:tr v-if="tableData.data.length > 0">
+		  	<tr>
+		  		<td v-for="(item , index) in tableData.column" key="index">
+		  			{{tableDataEnd[item.field]}}
+		  		</td>
+		  	</tr>
+		  </template>
+		  
+	  </ComTable>
     </div>
     <el-dialog title="切入切出风速整合历史" v-model="dialogShow" width="85%" top="10vh" custom-class="modal" :close-on-click-modal="true" @closed="dialogType = ''">
       test
@@ -35,7 +45,7 @@
 </template>
 
 <script>
-import ComTable from "@com/coms/table/table.vue";
+import ComTable from "../Decision/table.vue";
 export default {
   // 名称
   name: "cutAnalyse",
@@ -54,11 +64,13 @@ export default {
       wpId:"",
       recorddate:new Date((new Date().getTime() - 3600 * 1000 * 24)).formatDate("yyyy-MM-dd"),
       dialogShow:false,
+	  tableDataEnd: [], //合计
       tableData: {
         column: [
           {
             name: "机组编号",
             field: "windturbineName",
+			cursor: 'pointer',
             is_num: false,
             is_light: false,
             sortable: true,
@@ -238,6 +250,8 @@ export default {
                 ele[key] = ele[key] || 0;
               }
             });
+			that.tableDataEnd = res.data[res.data.length - 1];
+			res.data.pop();
             that.tableData.data = res.data;
           }
         });
@@ -288,7 +302,11 @@ export default {
         }
       });
 
-      const list = that.tableData.data; //把要导出的数据tableData存到list 
+	  var list = [];
+	  that.tableData.data.forEach((i,index) =>{
+	  				  list.push(i);
+	  })
+	  list.push(that.tableDataEnd)
       const data = that.formatJson(filterVal, list);
       export_json_to_excel(tHeader, data, '导出的Excel'); // 最后一个是表名字
     },