|
|
@@ -105,7 +105,8 @@ |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleLook(scope.row)" v-hasPermi="['business:import:query']">查看</el-button> |
|
|
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['business:import:edit']">修改</el-button> |
|
|
|
<el-button size="mini" type="text" icon="el-icon-video-play" @click="handleDo(scope.row)" v-hasPermi="['business:import: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:import:do']" v-if="scope.row.taskStatus == '0'">执行</el-button> |
|
|
|
<el-button size="mini" type="text" icon="el-icon-tickets" @click="openLog(scope.row)" v-hasPermi="['business:import:do']">日志</el-button> |
|
|
|
|
|
|
|
<el-dropdown size="mini" v-hasPermi="['business:import:remove']"> |
|
|
|
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button> |
|
|
@@ -134,7 +135,7 @@ |
|
|
|
<div class="el-upload__tip" slot="tip"> |
|
|
|
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的导入任务 |
|
|
|
</div> |
|
|
|
<p style="color: red">1、仅允许导入xls、xlsx格式文件;</p> |
|
|
|
<p style="color: red">1、仅允许导入zip格式文件;</p> |
|
|
|
<p style="color: red">2、覆盖导入:指先将所选区划当前在库数据删除,然后按新数据包解析导入;</p> |
|
|
|
<p style="color: red">3、增量导入:指按新数据包解析并追加导入;</p> |
|
|
|
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link> |
|
|
@@ -201,17 +202,37 @@ |
|
|
|
<el-button @click="cancel">取 消</el-button> |
|
|
|
</div> |
|
|
|
</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> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { listImport, getImport, getImportDetail, delImport, addImport, updateImport, printImport } from "@/api/business/import" |
|
|
|
import { |
|
|
|
listImport, |
|
|
|
getImport, |
|
|
|
getImportDetail, |
|
|
|
delImport, |
|
|
|
addImport, |
|
|
|
updateImport, |
|
|
|
printImport, |
|
|
|
startImport, importLog, downloadLog |
|
|
|
} from "@/api/business/import" |
|
|
|
import { getToken } from "@/utils/auth" |
|
|
|
import Treeselect from "@riophae/vue-treeselect"; |
|
|
|
import {Pane, Splitpanes} from "splitpanes"; |
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css" |
|
|
|
import "splitpanes/dist/splitpanes.css" |
|
|
|
import { deptTreeSelect } from "@/api/system/user" |
|
|
|
import {save} from "@/utils"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "Import", |
|
|
@@ -315,7 +336,11 @@ export default { |
|
|
|
// 上传的地址 |
|
|
|
url: process.env.VUE_APP_BASE_API + "/business/import/importData" |
|
|
|
}, |
|
|
|
|
|
|
|
log: { |
|
|
|
taskId: null, |
|
|
|
logOpen: false, |
|
|
|
logText: '', |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
@@ -586,7 +611,60 @@ export default { |
|
|
|
this.selectDeptName = data.label |
|
|
|
this.handleQuery() |
|
|
|
}, |
|
|
|
|
|
|
|
/** 开始 */ |
|
|
|
handleDo(row) { |
|
|
|
const ids = row.id || this.ids |
|
|
|
this.$modal.confirm('是否确认开始编号为"' + ids + '"的导入任务?').then(function() { |
|
|
|
return startImport(ids) |
|
|
|
}).then((resp) => { |
|
|
|
this.getList() |
|
|
|
this.$modal.msgSuccess(resp.data == 2 ? '正在执行' : '已加入队列, 等待执行') |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
/** 日志 */ |
|
|
|
handleLog(row, offset = 0) { |
|
|
|
if(!this.log.logOpen) |
|
|
|
return; |
|
|
|
importLog(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) => { |
|
|
|
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 = ''; |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|