Bladeren bron

清除日志

qule 2 jaren geleden
bovenliggende
commit
4e40f1168e
2 gewijzigde bestanden met toevoegingen van 97 en 29 verwijderingen
  1. 9 1
      src/api/synclog/index.js
  2. 88 28
      src/views/syncManage/index.vue

+ 9 - 1
src/api/synclog/index.js

@@ -74,4 +74,12 @@ export function queryRecordUpdata(param, success, error) {
  */
 export function exportSql(param, success) {
     return httputils.getDownload(`${baseUrl}${dataCenter}/data/migration/getSqlFile`, param, success)
-} 
+} 
+/**
+ * @description: 清除日志
+ * @param {*}
+ * @return {*}
+ */
+export function clearLogApi(param, success) {
+    return httputils.postJson(`${baseUrl}${dataCenter}/data/migration/deleteLog`, param, success)
+}

+ 88 - 28
src/views/syncManage/index.vue

@@ -17,7 +17,11 @@
         <div style="margin-top: 8px" class="">
             
             <div  class="modify">
-                <el-button type="primary" icon="el-icon-download" @click="exportSqlHandle" :loading='sqlBtnLoading' :disabled='sqlBtnLoading'>导出SQL文件</el-button>
+                <div>
+                    <el-button type="primary" icon="el-icon-download" @click="exportSqlHandle" :loading='sqlBtnLoading' :disabled='sqlBtnLoading'>导出SQL文件</el-button>
+                    <el-button type="primary"  @click="clearLog">清除日志</el-button>
+                </div>
+                
                 <div>     
                         <el-input style="width: 220px" placeholder="请输入内容" @input="httpInputChange" @blur="httpInputBlur" :value="httpValue" />
                         <el-button type="primary" style="margin-left: 8px" :loading='httpBtnLoading' :disabled='!httpValue' @click="httpExportHandle">导出Excel</el-button>
@@ -185,7 +189,8 @@ import {
     syncData,
     queryRecordUpdata,
     dHttpExport,
-    exportSql
+    exportSql,
+    clearLogApi
 } from "@/api/synclog";
 import moment from 'moment'
 import { ENUM_OBJECT_TABLE, OBJ_TYPE, TABLE_NAME } from './constant'
@@ -418,13 +423,51 @@ export default {
         // 对象表变化
         objTableChange(val) {
             this.tableName = val;
-            
+            this.getTable();
         },
          // 时间变动
         timeChange() {
             
             this.getTable();
         },
+        // 清除日志
+        clearLog() {
+            this.$confirm('清除操作会清除当前条件下的所有日志,且清除后不可恢复,请谨慎操作', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then( async () => {
+                let creationTime = this.timeParam && this.timeParam.map(item => moment(item).format('YYYYMMDDHHmm'))
+                const postParam = {
+                    criteria: {
+                        type: this.operationValue ? this.operationValue : undefined,
+                        sign: this.sign,
+                        tableName: this.tableName,
+                        creationTime: (creationTime && creationTime.length) ?  {
+                            $gte: creationTime[0],
+                            $lte: creationTime[1]
+                        } : undefined,
+                        objectType: this.objTypeValue ? this.objTypeValue : undefined,
+                        classCodeName: this.objClassifyValue ? this.objClassifyValue  : undefined,
+                        targetId: this.targetId ? this.targetId : undefined
+                    }
+                }
+                clearLogApi(postParam, res => {
+                    if (res.result === 'success') {
+                        this.$message({
+                            type: 'success',
+                            message: '清除成功!'
+                        });
+                        this.getTable();
+                    } else {
+                        
+                    }
+                    
+                    
+                });
+                
+            });
+        },
         // 对象id变化
         objIdChange(val) {
             this.targetId = val.trim();
@@ -434,44 +477,61 @@ export default {
         getTable() {
             this.loading = true;
             if (this.projectId) {
-                // 请求table以及中台状态接口
-                //对象类型
-                const objectType = this.objTypeValue
-                    ? `;objectType='${this.objTypeValue}'`
-                    : "";
-                // 对象分类
-                const classCodeName = this.objClassifyValue
-                    ? `;classCode='${this.objClassifyValue}'`
-                    : "";
-                // 操作符状态
-                const type = this.operationValue
-                    ? `;type='${this.operationValue}'`
-                    : "";
-                // 对象表
-                const tableName = this.tableName ? `;tableName='${this.tableName}'` : ''
 
-                // 对象id
-                const targetId = this.targetId ? `;targetId='${this.targetId}'` : ''
+                // // 请求table以及中台状态接口
+                // //对象类型
+                // const objectType = this.objTypeValue
+                //     ? `;objectType='${this.objTypeValue}'`
+                //     : "";
+                // // 对象分类
+                // const classCodeName = this.objClassifyValue
+                //     ? `;classCode='${this.objClassifyValue}'`
+                //     : "";
+                // // 操作符状态
+                // const type = this.operationValue
+                //     ? `;type='${this.operationValue}'`
+                //     : "";
+                // // 对象表
+                // const tableName = this.tableName ? `;tableName='${this.tableName}'` : ''
+
+                // // 对象id
+                // const targetId = this.targetId ? `;targetId='${this.targetId}'` : ''
 
                 // 时间范围
                 let creationTime = this.timeParam && this.timeParam.map(item => moment(item).format('YYYYMMDDHHmm'))
-                creationTime = creationTime && !!creationTime.length ? `;creationTime in [${creationTime}]` : ''
+                // creationTime = creationTime && !!creationTime.length ? `;creationTime in [${creationTime}]` : ''
 
 
+                // const postParam = {
+                //     orders: this.order,
+                //     pageNumber: this.pageObj.pageNumber,
+                //     pageSize: this.pageObj.pageSize,
+                //     filters: `projectId='${this.projectId}';sign=${this.sign}${type}${classCodeName}${objectType}${tableName}${targetId}${creationTime}`,
+                // };
                 const postParam = {
-                    orders: this.order,
-                    pageNumber: this.pageObj.pageNumber,
-                    pageSize: this.pageObj.pageSize,
-                    filters: `projectId='${this.projectId}';sign=${this.sign}${type}${classCodeName}${objectType}${tableName}${targetId}${creationTime}`,
-                };
+                    page: this.pageObj.pageNumber,
+                    size: this.pageObj.pageSize,
+                    criteria: {
+                        type: this.operationValue ? this.operationValue : undefined,
+                        sign: this.sign,
+                        tableName: this.tableName,
+                        creationTime: (creationTime && creationTime.length) ?  {
+                            $gte: creationTime[0],
+                            $lte: creationTime[1]
+                        } : undefined,
+                        objectType: this.objTypeValue ? this.objTypeValue : undefined,
+                        classCodeName: this.objClassifyValue ? this.objClassifyValue  : undefined,
+                        targetId: this.targetId ? this.targetId : undefined
+                    }
+                }
 
 
                 syncDataLogList(postParam, res => {
                     this.isShowTable = true;
-                    this.data = res.content;
+                    this.data = res.data;
                     this.loading = false;
                     this.pageObj = Object.assign(this.pageObj, {
-                        total: res.total,
+                        total: res.count,
                         // pageNumber: res.pageNumber,
                         // pageSize: res.pageSize,
                     });