|
@@ -90,8 +90,9 @@ |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleLook(scope.row)" v-hasPermi="['business:export:query']">查看</el-button> |
|
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleLook(scope.row)" v-hasPermi="['business:export:query']">查看</el-button> |
|
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['business:export:edit']">修改</el-button> |
|
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['business:export:edit']">修改</el-button> |
|
|
<el-button size="mini" type="text" icon="el-icon-video-play" @click="handleDo(scope.row)" v-hasPermi="['business:export:do']" v-if="scope.row.taskStatus == '1'">执行</el-button> |
|
|
|
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-video-play" @click="handleDo(scope.row)" v-hasPermi="['business:export:do']" v-if="scope.row.taskStatus == '0'">执行</el-button> |
|
|
<el-button size="mini" type="text" icon="el-icon-download" @click="handleDown(scope.row)" v-hasPermi="['business:export:down']" v-if="scope.row.taskStatus == '3'">下载</el-button> |
|
|
<el-button size="mini" type="text" icon="el-icon-download" @click="handleDown(scope.row)" v-hasPermi="['business:export:down']" v-if="scope.row.taskStatus == '3'">下载</el-button> |
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-tickets" @click="openLog(scope.row)" v-hasPermi="['business:export:do']">日志</el-button> |
|
|
|
|
|
|
|
|
<el-dropdown size="mini" v-hasPermi="['business:export:remove']"> |
|
|
<el-dropdown size="mini" v-hasPermi="['business:export:remove']"> |
|
|
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button> |
|
|
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button> |
|
@@ -169,17 +170,37 @@ |
|
|
<el-button @click="cancel">取 消</el-button> |
|
|
<el-button @click="cancel">取 消</el-button> |
|
|
</div> |
|
|
</div> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="任务日志" :visible.sync="log.logOpen" width="800px" append-to-body> |
|
|
|
|
|
<div v-html="log.logText"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<!-- 弹框操作按钮 --> |
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
|
|
<el-button @click="downloadLog">下 载</el-button> |
|
|
|
|
|
<el-button @click="closeLog">关 闭</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-dialog> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { listExport, getExport, getExportDetail, delExport, addExport, updateExport, printExport } from "@/api/business/export" |
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
listExport, |
|
|
|
|
|
getExport, |
|
|
|
|
|
getExportDetail, |
|
|
|
|
|
delExport, |
|
|
|
|
|
addExport, |
|
|
|
|
|
updateExport, |
|
|
|
|
|
printExport, |
|
|
|
|
|
startExport, exportLog, downloadLog, downloadFile |
|
|
|
|
|
} from "@/api/business/export" |
|
|
import { getToken } from "@/utils/auth" |
|
|
import { getToken } from "@/utils/auth" |
|
|
import Treeselect from "@riophae/vue-treeselect"; |
|
|
import Treeselect from "@riophae/vue-treeselect"; |
|
|
import { Splitpanes, Pane } from "splitpanes" |
|
|
import { Splitpanes, Pane } from "splitpanes" |
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css" |
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css" |
|
|
import "splitpanes/dist/splitpanes.css" |
|
|
import "splitpanes/dist/splitpanes.css" |
|
|
import { deptTreeSelect } from "@/api/system/user" |
|
|
import { deptTreeSelect } from "@/api/system/user" |
|
|
|
|
|
import {save} from "@/utils"; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: "Export", |
|
|
name: "Export", |
|
@@ -276,7 +297,11 @@ export default { |
|
|
// 上传的地址 |
|
|
// 上传的地址 |
|
|
url: process.env.VUE_APP_BASE_API + "/business/export/importData" |
|
|
url: process.env.VUE_APP_BASE_API + "/business/export/importData" |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
log: { |
|
|
|
|
|
taskId: null, |
|
|
|
|
|
logOpen: false, |
|
|
|
|
|
logText: '', |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
@@ -529,7 +554,68 @@ export default { |
|
|
this.selectDeptName = data.label |
|
|
this.selectDeptName = data.label |
|
|
this.handleQuery() |
|
|
this.handleQuery() |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** 开始 */ |
|
|
|
|
|
handleDo(row) { |
|
|
|
|
|
const ids = row.id || this.ids |
|
|
|
|
|
this.$modal.confirm('是否确认开始编号为"' + ids + '"的导出任务?').then(function() { |
|
|
|
|
|
return startExport(ids) |
|
|
|
|
|
}).then((resp) => { |
|
|
|
|
|
this.getList() |
|
|
|
|
|
this.$modal.msgSuccess(resp.data == 2 ? '正在执行' : '已加入队列, 等待执行') |
|
|
|
|
|
}).catch(() => {}) |
|
|
|
|
|
}, |
|
|
|
|
|
/** 日志 */ |
|
|
|
|
|
handleLog(row, offset = 0) { |
|
|
|
|
|
if(!this.log.logOpen) |
|
|
|
|
|
return; |
|
|
|
|
|
exportLog(row.id, offset).then(({data}) => { |
|
|
|
|
|
if(null == data.text) |
|
|
|
|
|
{ |
|
|
|
|
|
this.log.logText = ''; |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
this.log.logText += data.text |
|
|
|
|
|
.replaceAll('<', '<') |
|
|
|
|
|
.replaceAll('>', '>') |
|
|
|
|
|
.replaceAll('\r\n', '<br/>') |
|
|
|
|
|
.replaceAll('\r', '<br/>') |
|
|
|
|
|
.replaceAll('\n', '<br/>') |
|
|
|
|
|
; |
|
|
|
|
|
if(!data.eof && this.log.logOpen && (data.taskStatus === '1' || data.taskStatus === '2')) |
|
|
|
|
|
{ |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.handleLog(row, data.length); |
|
|
|
|
|
}, data.nextPollDelay > 0 ? data.nextPollDelay : 2000); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
/** 日志 */ |
|
|
|
|
|
downloadLog() { |
|
|
|
|
|
if(!this.log.taskId) |
|
|
|
|
|
return; |
|
|
|
|
|
downloadLog(this.log.taskId).then((resp) => { |
|
|
|
|
|
this.$message.success('开始下载......'); |
|
|
|
|
|
save(`导出任务_${this.log.taskId}.log`, resp); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
openLog(row) { |
|
|
|
|
|
this.log.logText = ''; |
|
|
|
|
|
this.log.logOpen = true; |
|
|
|
|
|
this.log.taskId = row.id; |
|
|
|
|
|
this.handleLog(row); |
|
|
|
|
|
}, |
|
|
|
|
|
closeLog() { |
|
|
|
|
|
this.log.logOpen = false; |
|
|
|
|
|
this.log.taskId = null; |
|
|
|
|
|
this.log.logText = ''; |
|
|
|
|
|
}, |
|
|
|
|
|
/** 下载 */ |
|
|
|
|
|
handleDown(row) { |
|
|
|
|
|
downloadFile(row.id).then((resp) => { |
|
|
|
|
|
this.$message.success('开始下载......'); |
|
|
|
|
|
save(`导出任务_${row.id}.zip`, resp); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|