流程属性导入日志改造
This commit is contained in:
parent
f80513ac9c
commit
1436309c4b
@ -45,13 +45,39 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog
|
||||
title="日志"
|
||||
v-model="dlg.visible"
|
||||
width="800px"
|
||||
height="520px"
|
||||
destroy-on-close
|
||||
@close="dlgClose">
|
||||
<div style="width: 100%;height: 500px;">
|
||||
<log-codemirror ref="dataCodemirrorRef" :width="logCodemirror.width" :height="logCodemirror.height" :log-str="logCodemirror.logStr" ></log-codemirror>
|
||||
<div style="width: 100%;height: 10px;">
|
||||
<el-progress :percentage="result.totalCount == 0 ? 0 : (Math.floor(result.importingCount / result.totalCount * 100))" color="#287ff4" />
|
||||
</div>
|
||||
<div style="width: 100%;height: 10px;text-align: left;">
|
||||
<span>正在导入第[{{result.importingCount}}]条,总共[{{result.totalCount}}]条</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<awsui-button type="primary" @click="downloadLog">下载日志</awsui-button>
|
||||
<awsui-button @click="dlg.visible = false">关闭</awsui-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent,getCurrentInstance,reactive,ref } from 'vue';
|
||||
import {defineComponent, getCurrentInstance, nextTick, reactive, ref} from 'vue';
|
||||
import LogCodemirror from "./log-codemirror";
|
||||
|
||||
export default defineComponent({
|
||||
name: "data-import",
|
||||
components:{LogCodemirror},
|
||||
setup() {
|
||||
const { proxy: $this } = getCurrentInstance();
|
||||
let info = reactive({
|
||||
@ -70,17 +96,18 @@ export default defineComponent({
|
||||
const beforeRemove = () => {}
|
||||
const handleExceed = () => {}
|
||||
const handleSuccess = (res: any,uploadFile: any,uploadFiles: any) => {
|
||||
console.log(res,'---',uploadFile,'----',uploadFiles)
|
||||
// console.log(res,'---',uploadFile,'----',uploadFiles)
|
||||
info.fileName = res.files.name
|
||||
let tempFileObj = {id: uploadFile.uid,name: res.files.name,downloadUrl: res.data.data.attrs.downloadUrl}
|
||||
info.fileList.push(tempFileObj)
|
||||
console.info('fileList',info.fileList)
|
||||
// console.info('fileList',info.fileList)
|
||||
}
|
||||
const next = () => {
|
||||
if (info.fileList.length === 0) {
|
||||
$this.$message({type:'warning',message:'请上传文件'});
|
||||
return;
|
||||
}
|
||||
dlg.visible = true;
|
||||
let param = {
|
||||
url: './jd',
|
||||
data: {
|
||||
@ -89,15 +116,21 @@ export default defineComponent({
|
||||
wsId: settingParam.wsId ? settingParam.wsId : '6f4e292c-1b90-4dd2-8c20-7da159cb20a5',
|
||||
groupValue: info.groupValue,
|
||||
fileValue: info.fileValue,
|
||||
fileName: info.fileName
|
||||
}
|
||||
}
|
||||
$this.awsuiaxios.post(param)
|
||||
.then((ro: any) => {
|
||||
console.log(ro)
|
||||
if (ro.result === 'ok') {
|
||||
$this.$message({type:'warning',message:'流程数据导入成功'});
|
||||
result.path = ro.data.path;
|
||||
result.logId = ro.data.logId;
|
||||
result.resultStatus = ro.data.resultStatus;
|
||||
if (ro.result == 'ok') {
|
||||
result.totalCount = ro.data.totalCount;
|
||||
result.importingCount = ro.data.importingCount;
|
||||
} else {
|
||||
// $this.$message.error(ro.msg);
|
||||
}
|
||||
getImportInfoEvent();
|
||||
|
||||
})
|
||||
.catch((err: any) => {})
|
||||
}
|
||||
@ -106,6 +139,121 @@ export default defineComponent({
|
||||
info.uploadAction = axiosBaseUrl +'uf?sid='+settingParam.sessionId+'&repositoryName='+info.repositoryName+'&groupValue='
|
||||
+ info.groupValue+'&fileValue='+info.fileValue+'&appId='+ info.appId;
|
||||
}
|
||||
const dataCodemirrorRef = ref();
|
||||
let dlg = reactive({
|
||||
visible: false
|
||||
})
|
||||
let logCodemirror = reactive({
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
logStr: ''
|
||||
})
|
||||
const result = reactive({
|
||||
path: '',
|
||||
logId : '',
|
||||
totalCount : 0,
|
||||
importingCount: 0,
|
||||
resultStatus: 0,
|
||||
interval: null, // 查询日志定时器
|
||||
timer:0, // 时间戳记录
|
||||
})
|
||||
const dlgClose = () => {
|
||||
if (result.resultStatus == 0) {
|
||||
$this.$message({message: '导入正在进行中,关闭窗口不影响导入的执行', type: 'warning',})
|
||||
}
|
||||
clearResult();
|
||||
logCodemirror.logStr = '';
|
||||
}
|
||||
const clearResult = () => {
|
||||
if (result.interval != null) {
|
||||
removeInterval();
|
||||
}
|
||||
result.path = '';
|
||||
result.logId = '';
|
||||
result.totalCount = 0;
|
||||
result.importingCount = 0;
|
||||
result.resultStatus = 0;
|
||||
result.interval = null; // 查询日志定时器
|
||||
result.timer = 0; // 时间戳记录
|
||||
}
|
||||
// 获取导入进度
|
||||
const getImportInfoEvent = () => {
|
||||
result.interval = setInterval(queryLog, 1000);
|
||||
}
|
||||
const queryLog = () => {
|
||||
const that = $this;
|
||||
result.timer = new Date().getTime();
|
||||
const param = {
|
||||
url: './jd',
|
||||
data: {
|
||||
cmd: 'com.actionsoft.apps.coe.pal.datamigration_data_migrate_log_query',
|
||||
sid: settingParam.sessionId,
|
||||
logId: result.logId,
|
||||
path: result.path,
|
||||
timer: result.timer
|
||||
}
|
||||
}
|
||||
that.awsuiaxios.post(param)
|
||||
.then((ro: any) => {
|
||||
if (ro.result === 'ok') {
|
||||
if (parseInt(ro.data.timer) <= result.timer) {
|
||||
logCodemirror.logStr = ro.data.content;
|
||||
// 添加内容后定位到行尾
|
||||
nextTick(()=> {
|
||||
moveLogEnd();
|
||||
});
|
||||
result.resultStatus = ro.data.resultStatus;
|
||||
if (result.resultStatus != 0) {
|
||||
removeInterval();
|
||||
result.importingCount = result.totalCount;// 出错或成功,直接100%
|
||||
} else {
|
||||
result.importingCount = ro.data.importingCount;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
that.$message.error(ro.msg);
|
||||
removeInterval();
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
})
|
||||
}
|
||||
const moveLogEnd = () => {
|
||||
dataCodemirrorRef.value.moveTextToEnd();
|
||||
}
|
||||
const removeInterval= () => {
|
||||
clearInterval(result.interval);
|
||||
}
|
||||
const downloadLog = () => {
|
||||
// 下载日志
|
||||
const that = $this;
|
||||
if (result.path == '') {
|
||||
that.$message({message: '获取日志失败', type: 'warning'});
|
||||
return;
|
||||
}
|
||||
if (result.resultStatus == 0) {
|
||||
that.$message({message: '正在导入,请稍等', type: 'warning'});
|
||||
return;
|
||||
}
|
||||
const param = {
|
||||
url:'./jd',
|
||||
data:{
|
||||
cmd : "com.actionsoft.apps.coe.pal.datamigration_data_migrate_log_download",
|
||||
path: result.path,
|
||||
logId: result.logId
|
||||
}
|
||||
};
|
||||
that.awsuiaxios.post(param)
|
||||
.then((ro: any) => {
|
||||
if (ro.result === 'ok') {
|
||||
window.open(ro.data.url);
|
||||
} else {
|
||||
that.$message.error(ro.msg);
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
})
|
||||
}
|
||||
return {
|
||||
info,
|
||||
handlePreview,
|
||||
@ -114,7 +262,13 @@ export default defineComponent({
|
||||
handleExceed,
|
||||
handleUploadBtn,
|
||||
handleSuccess,
|
||||
next
|
||||
next,
|
||||
dataCodemirrorRef,
|
||||
dlg,
|
||||
logCodemirror,
|
||||
result,
|
||||
downloadLog,
|
||||
dlgClose
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user