Selaa lähdekoodia

增加sql导出

qule 3 vuotta sitten
vanhempi
commit
5a83f16919
2 muutettua tiedostoa jossa 37 lisäystä ja 20 poistoa
  1. 8 0
      src/api/synclog/index.js
  2. 29 20
      src/views/syncManage/index.vue

+ 8 - 0
src/api/synclog/index.js

@@ -67,3 +67,11 @@ export function queryRecordSyn(param, success, error) {
 export function queryRecordUpdata(param, success, error) {
     return httputils.postJson(`${baseUrl}${datasyn}/record/update`, param, success, error)
 }
+/**
+ * @description: 迁移数据,获取执行脚本文件
+ * @param {string} projectId
+ * @return {*}
+ */
+export function exportSql(param, success) {
+    return httputils.getDownload(`${baseUrl}${dataCenter}/data/migration/getSqlFile`, param, success)
+} 

+ 29 - 20
src/views/syncManage/index.vue

@@ -1,7 +1,7 @@
 <template>
     <div id="DataLog">
         <div class="top">
-            <h2>数据同步管理</h2>
+            <!-- <h2>数据同步管理</h2> -->
             <!-- <div class="serve-updata">
                 <span> 中台状态 </span>
                 <el-popover placement="bottom" width="200" trigger="hover">
@@ -14,13 +14,15 @@
                 <div ref="status" class="state"></div>
             </div> -->
         </div>
-        <div style="margin-top: 8px">
+        <div style="margin-top: 8px" class="">
+            
             <div  class="modify">
-               <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>
-                    <el-button type="primary"  :loading='syncBtnLoading' :disabled='!httpValue || !isExported' @click="syncDataHandle">同步</el-button>       
-               </div> 
+                <el-button type="primary" icon="el-icon-download" @click="exportSqlHandle" :loading='sqlBtnLoading' :disabled='sqlBtnLoading'>导出SQL文件</el-button>
+                <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>
+                        <el-button type="primary"  :loading='syncBtnLoading' :disabled='!httpValue || !isExported' @click="syncDataHandle">同步</el-button>       
+                </div> 
             </div>
             <el-divider />    
             <div v-if="isShowTable" class="screen">  
@@ -130,16 +132,11 @@
                             <span style="margin-left: 10px">{{ scope.row.sign ? (scope.row.sign === 1 ? '失败' : '成功') : "--" }}</span>
                         </template>
                     </el-table-column>
-                    <el-table-column label="创建时间" >
+                    <el-table-column label="同步时间" >
                         <template slot-scope="scope">
                             <span style="margin-left: 10px">{{ scope.row.creationTime | timeFormat }}</span>
                         </template>
                     </el-table-column>
-                    <el-table-column label="修改时间" >
-                        <template slot-scope="scope">
-                            <span style="margin-left: 10px">{{ scope.row.modifiedTime | timeFormat }}</span>
-                        </template>
-                    </el-table-column>
                     <el-table-column label="错误信息" >
                         <template slot-scope="scope">
                             <span style="margin-left: 10px">{{ scope.row.error ? scope.row.error : "--" }}</span>
@@ -174,10 +171,12 @@ import {
     syncDataLogList,
     syncData,
     queryRecordUpdata,
-    dHttpExport
+    dHttpExport,
+    exportSql
 } from "@/api/synclog";
 import moment from 'moment'
 import { ENUM_OBJECT_TABLE, OBJ_TYPE } from './constant'
+import { message } from '../../api/scan/config';
 export default {
     data() {
         return {
@@ -243,7 +242,7 @@ export default {
             targetId: '',   //对象id
             tableName: 'dt_object',  //对象表
             loading: false, //是否加载
-            order: "lastUpdate asc, objId asc", //顺序
+            order: "creationTime  desc", //时间倒序排列
             pageObj: {
                 total: 0, //总计
                 pageSize: 50, //每页数量
@@ -257,6 +256,7 @@ export default {
             isExported: false,  //是否已导出excel,未导出则不可同步
 
             syncBtnLoading: false,  //同步按钮状态
+            sqlBtnLoading: false   //导出sql文件按钮状态
         }
     },
     computed: {
@@ -335,10 +335,19 @@ export default {
                     this.httpBtnLoading = false;
                     this.isExported = true
                 }
-            )
-            
-           
-            
+            ) 
+        },
+        /**
+         * @description: 导出sql文件
+         * @param {*}
+         * @return {*}
+         */
+        exportSqlHandle() {
+            this.sqlBtnLoading = true
+            exportSql({}, res => {
+                this.sqlBtnLoading = false;
+                this.$message.success('导出sql文件操作成功!')
+            })
         },
 
         // 项目id请求接口
@@ -612,7 +621,7 @@ export default {
 .modify {
     
     display: flex;
-    justify-content: flex-end;
+    justify-content: space-between;
 }
 
 </style>