Parcourir la source

feat: 文件同步

wanggaokun il y a 1 an
Parent
commit
318f6f394b

+ 7 - 0
src/api/modules/manage/backupRestoreLog.ts

@@ -33,3 +33,10 @@ export const restoreApi = (data?: any) => {
 export const exportBackupRestoreLogApi = (data: any) => {
   return http.downloadPost('/manage/backupRestore/export', data)
 }
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const syncFileDataApi = (data: any) => {
+  return http.post('/manage/backupRestore/syncFileData', data)
+}

+ 8 - 0
src/api/modules/manage/faultCase.ts

@@ -68,3 +68,11 @@ export const importFaultCaseDataApi = (data: any) => {
 export const exportFaultCaseApi = (data: any) => {
   return http.downloadPost('/manage/faultCase/export', data)
 }
+/**
+ * @name 修改故障案例信息
+ * @param data data
+ * @returns returns
+ */
+export const syncEsDataApi = () => {
+  return http.get<any>('/manage/faultCase/syncEsData')
+}

+ 12 - 1
src/views/manage/backupRestoreLog/index.vue

@@ -5,6 +5,7 @@
       <template #tableHeader>
         <el-button type="primary" @click="backup()"> 备份文件 </el-button>
         <el-button type="primary" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button type="primary" v-auth="['manage:faultCase:add']" icon="Refresh" @click="syncFileData()"> 同步文件至服务器 </el-button>
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
@@ -25,7 +26,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
 import ProTable from '@/components/ProTable/index.vue'
 import FormDialog from '@/components/FormDialog/index.vue'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
-import { listBackupRestoreLogApi, exportBackupRestoreLogApi, backupApi, restoreApi } from '@/api/modules/manage/backupRestoreLog'
+import { listBackupRestoreLogApi, exportBackupRestoreLogApi, backupApi, restoreApi, syncFileDataApi } from '@/api/modules/manage/backupRestoreLog'
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
@@ -58,6 +59,16 @@ const restore = () => {
     }
   })
 }
+const syncFileData = () => {
+  syncFileDataApi({}).then(res => {
+    if (res.code === 200) {
+      ElMessage.success('同步成功')
+      proTable.value?.getTableList()
+    } else {
+      ElMessage.error(res.msg)
+    }
+  })
+}
 
 // 导出备份恢复日志列表
 const downloadFile = async () => {

+ 9 - 2
src/views/manage/faultCase/index.vue

@@ -16,6 +16,7 @@
         >
           批量删除
         </el-button>
+        <el-button type="primary" v-auth="['manage:faultCase:add']" icon="Refresh" @click="syncEsData()"> 同步ES </el-button>
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
@@ -51,12 +52,18 @@ import {
   importTemplateApi,
   importFaultCaseDataApi,
   exportFaultCaseApi,
-  getFaultCaseApi
+  getFaultCaseApi,
+  syncEsDataApi
 } from '@/api/modules/manage/faultCase'
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
-
+const syncEsData = () => {
+  console.log('syncEsData')
+  syncEsDataApi().then(() => {
+    proTable.value?.getTableList()
+  })
+}
 // 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
 const initParam = reactive({})