From 5a66a6bea00940c40e71ee681c5b47466cdce3db Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期五, 21 十月 2022 14:13:08 +0800
Subject: [PATCH] 修改基础设置违建新增

---
 src/views/operate/log/index.vue |   70 +++++++++++++++++++++++------------
 1 files changed, 46 insertions(+), 24 deletions(-)

diff --git a/src/views/operate/log/index.vue b/src/views/operate/log/index.vue
index 5480f57..dcc0d0b 100644
--- a/src/views/operate/log/index.vue
+++ b/src/views/operate/log/index.vue
@@ -12,7 +12,7 @@
                 </div>
                 <div class="message-status">
                     <span>鎿嶄綔绫诲瀷:</span>
-                    <el-select v-model="operationType" style="margin-left:20px">
+                    <el-select v-model="operationType">
                         <el-option v-for="item in operationTypeList" :key="item.id" :label="item.operationType"
                             :value="item.operationType">
                         </el-option>
@@ -20,7 +20,10 @@
                 </div>
                 <div class="message-kind">
                     <span>鏃堕棿鑼冨洿:</span>
-                    <el-input placeholder="閫夋嫨鏃堕棿鑼冨洿" v-model="timeArea"></el-input>
+                    <el-date-picker v-model="mytime" type="daterange" range-separator="-" start-placeholder="寮�濮嬫棩鏈�"
+                        end-placeholder="缁撴潫鏃ユ湡">
+                    </el-date-picker>
+                    <!-- <el-input placeholder="閫夋嫨鏃堕棿鑼冨洿" v-model="timeArea"></el-input> -->
                 </div>
                 <div class="find">
                     <el-button type="primary" icon="el-icon-search" @click="setTableData">鏌ヨ</el-button>
@@ -38,13 +41,13 @@
                     </div>
                 </div>
                 <!-- 鏁版嵁灞曠ず -->
-                <el-table ref="multipleTable"
+                <el-table ref="multipleTable" :default-sort="{prop: 'createTime'}"
                     :header-cell-style="{background:'#06122c','font-size':'12px',color:'#4b9bb7','font-weight':'650','line-height':'45px'}"
-                    :data="tableData" style="width: 100%" :row-class-name="tableRowClassName"
+                    :data="tableData" style="width: 100%" @sort-change="sortTime" :row-class-name="tableRowClassName"
                     @selection-change="tableChange">
                     <el-table-column type="selection" min-width="5">
                     </el-table-column>
-                    <el-table-column prop="createTime" label="鏃ュ織鏃堕棿" min-width="10">
+                    <el-table-column prop="createTime" sortable label="鏃ュ織鏃堕棿" min-width="10">
                         <template slot-scope="scope">
                             <span>{{changeTime(scope.row.createTime)}}</span>
                         </template>
@@ -109,21 +112,15 @@
             options: [
                 {
                     value: 1,
-                    label: '鎵归噺鍚敤',
-                },
-                {
-                    value: 2,
-                    label: '鎵归噺绂佺敤',
-                },
-                {
-                    value: 3,
                     label: '鎵归噺鍒犻櫎',
                 }
             ],
+            mysort: 0,
             tempList: [],
             timeArea: '',
             operationType: '鍏ㄩ儴',
             operationTypeList: [],
+            mytime: '',
         }
     },
     created() {
@@ -140,6 +137,11 @@
                 current: currentPage,
                 size: pageSize,
             });
+            let fileName = arr.headers['content-disposition'];
+            console.log(fileName);
+            if (fileName) {
+                fileName = fileName.slice(fileName.indexOf('filename=') + 9);
+            }
             const blob = new Blob([arr.data], {
                 type: 'application/octet-stream'
             })
@@ -149,7 +151,7 @@
             const href = window.URL.createObjectURL(blob)
             downloadElement.href = href
             // // 涓嬭浇鍚庢枃浠跺悕
-            // downloadElement.download = '鏃ュ織鎶ュ憡'+'.xlsx'
+            downloadElement.download = fileName
             document.body.appendChild(downloadElement)
             // 鐐瑰嚮涓嬭浇
             downloadElement.click()
@@ -165,7 +167,6 @@
         // 鑾峰彇鎿嶄綔绫诲瀷
         async getOperationType() {
             let arr = await this.getLogsOperationType();
-            console.log(arr);
             arr.data.data.unshift({ id: 0, operationType: '鍏ㄩ儴' })
             return arr.data.data;
         },
@@ -199,19 +200,30 @@
             this.tableData = arr.records;
             this.totalNum = arr.total
         },
+        // 鏃堕棿鎺掑簭
+        sortTime({ column, prop, order }) {
+            if (order === 'ascending') {
+                this.mysort = 0
+            } else {
+                this.mysort = 1
+            }
+            this.setTableData();
+        },
         // 鑾峰彇鏃ュ織鏁版嵁
         async getLogList() {
-            const { currentPage, pageSize, context, operationType } = this;
+            const { currentPage, pageSize, context, operationType, mysort } = this;
             let arr = await this.getLogsList({
                 content: context,
                 current: currentPage,
                 endTime: '',
                 id: '',
                 operationType: operationType === '鍏ㄩ儴' ? '' : operationType,
-                portEqulpment: '',
+                portEquipment: '',
                 size: pageSize,
                 startTime: '',
+                sort: mysort
             })
+            console.log(arr)
             return arr.data.data;
         },
         // 鎵归噺涓嬫媺妗嗘搷浣�
@@ -330,6 +342,10 @@
             if (index === 1) {
                 this.setTableData();
             }
+        },
+        //
+        timechange(data) {
+            console.log(data);
         }
     }
 }
@@ -364,19 +380,25 @@
             .message-kind {
                 display: flex;
                 justify-content: flex-start;
-
-                span {
-                    flex: 1;
-                }
-
+                align-items: center;
+                flex: 1;
                 .el-input {
-                    flex: 2;
+                    flex: 1;
                     color: #1d3f57;
 
                     &::v-deep .el-input__inner {
                         background-color: #09152f;
                         border: 1px solid #17324c;
                     }
+                }
+                .el-select{
+                    flex: 1;
+                }
+                .el-date-editor{
+                    flex: 1;
+                }
+                :deep(.el-range-input){
+                    background-color: #09152f;
                 }
 
             }
@@ -389,7 +411,7 @@
                 margin-top: -2px;
 
                 .el-button {
-                    padding: 12px 25px;
+                    padding: 10px 20px;
                     border-radius: 20px;
                 }
             }

--
Gitblit v1.8.0