Browse Source

修改首页弹窗

fujunwen 4 years ago
parent
commit
ef4b900eb0
1 changed files with 58 additions and 8 deletions
  1. 58 8
      src/views/statistics/index.vue

+ 58 - 8
src/views/statistics/index.vue

@@ -162,6 +162,10 @@
             </section>
         </main>
        <el-dialog  :visible.sync="dialogVisible" width="80%"  :custom-class="'my-dialog'">
+            <div class="shut-download">
+                <span class="download" @click="downloadExcel">下载</span>
+                <span class="shut" @click="shutMaskPanel">x</span>
+            </div>
             <div class="table-content">
                 <div class="table-title">
                     {{currentSelectedSys.smsxtname}}
@@ -190,7 +194,7 @@
                     />
                 </div>
                 <section>
-                    <table>
+                    <table id="tableReport">
                         <thead>
                             <tr>
                                 <th width="10%">序号</th>
@@ -213,6 +217,7 @@
                             </tr>
                         </tbody>
                     </table>
+                    
                     <Pagination
                         v-show="pageCount>9"
                         :pageCount="pageCount"
@@ -223,6 +228,7 @@
                         @change="currentChangeHandle"
                     />
                 </section>
+                <div class="empty-text" v-show="!pageCount">暂无数据</div>
             </div> 
         </el-dialog>
     </div>
@@ -359,6 +365,21 @@ export default {
         window.addEventListener('resize', this.reinitalMap, false)
     },
     methods: {
+        downloadExcel() {
+            let tableContent = document.querySelector('#tableReport').outerHTML;
+            let blob = new Blob([tableContent], { type : 'text/plain; charset=utf-8'});
+            blob = new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type});
+            let link = window.URL.createObjectURL(blob);
+            let a = document.createElement('a');
+            a.download = '异常数据表格.xls'
+            a.href = link
+            document.body.appendChild(a)
+            a.click()
+            document.body.removeChild(a);
+        },
+        shutMaskPanel() {
+            this.dialogVisible = false;
+        },
         currentChangeHandle (page) {
             this.currentPage = page.newPage
             this.exceptionData =  this.storeExceptionData.slice((page.newPage - 1)*this.pageSize, (page.newPage) * this.pageSize)
@@ -933,14 +954,18 @@ export default {
         getInfoOfProject(system) {
             this.tabData = []
             system.assetTypeList.forEach(item => {
-                this.tabData.push({
-                    name: item.category_name,
-                    id:item.category_code
-                })
+                if (item.is_exception_num > 0) {
+                    this.tabData.push({
+                        name: item.category_name,
+                        id:item.category_code
+                    })
+                }
             })
-            this.activeName = this.tabData[0].id
-            this.currentDialogTab = this.activeName
-            this.dialogVisible = true
+            if (this.tabData.length) {
+                this.activeName = this.tabData[0].id
+                this.currentDialogTab = this.activeName
+                this.dialogVisible = true
+            }
             this.systemList.forEach(item => {
                 item.selected = false
             })
@@ -1302,6 +1327,26 @@ export default {
     height: 100vh;
     background: rgba(247, 249, 250, 1);
     .my-dialog{
+        position: relative;
+        .shut-download{
+            position: absolute;
+            top:10px;
+            right:10px;
+            width: 90px;
+            height: 30px;
+            cursor: pointer;
+            text-align: center;
+            span{
+                display: inline-block;
+            }
+            .download{
+                width: 50px;
+                border-right: 1px solid #cccccc;
+            }
+            .shut{
+                width: 30px;
+            }
+        }
         .table-content{
             margin: 0;
             padding-bottom: 40px;
@@ -1349,6 +1394,11 @@ export default {
                 }
             }
         }
+        .empty-text{
+            height: 60px;
+            line-height: 60px;
+            text-align: center;
+        }
     }
     
     .menu {