Browse Source

查看成功失败列表,导入进度

feature
mk 2 years ago
parent
commit
a798c66b84
  1. 7
      src/assets/scss/pages/smartImport.scss
  2. 175
      src/views/modules/base/smartImport/cpts/completeTask.vue
  3. 233
      src/views/modules/base/smartImport/cpts/executeTask.vue
  4. 53
      src/views/modules/base/smartImport/cpts/smartImportAdd.vue
  5. 23
      src/views/modules/base/smartImport/cpts/smartImportDetail.vue
  6. 89
      src/views/modules/base/smartImport/cpts/smartImportInfo.vue
  7. 23
      src/views/modules/base/smartImport/index.vue

7
src/assets/scss/pages/smartImport.scss

@ -32,6 +32,13 @@
align-items: center;
.el-upload__text{
color: #c5c9d1;
width: 100%;
}
/deep/ .el-upload {
width: 100%;
.el-upload-dragger{
width: 100%;
}
}
}
}

175
src/views/modules/base/smartImport/cpts/completeTask.vue

@ -2,8 +2,15 @@
<div class="">
<div class="content_box">
<div class="left">
<i class="el-icon-success" style="font-size: 50px; color: #1cc58c;"></i>
<i class="el-icon-success" style="font-size: 50px; color: #1cc58c"></i>
<p>导入完成</p>
<el-button
style="margin-left: 10px"
size="small"
type="primary"
@click="handelClickBackList"
>返回任务列表</el-button
>
</div>
<div class="right">
<h4>
@ -18,6 +25,70 @@
</div>
</div>
<h3 class="title-small">数据导入明细</h3>
<el-row type="flex" justify="">
<el-col :span="24">
<i class="el-icon-circle-check" style="color: #1cc58c; font-size: 15px;font-weight: 600;"></i> {{ this.importSuccessNum || "--" }}条数据已导入<el-button
type="text"
@click="handelClickLook('success')"
>查看</el-button
>
</el-col>
</el-row>
<el-row type="flex" justify="">
<el-col :span="24">
<i class="el-icon-circle-close" style="color: #ff5b5d;font-size: 15px;font-weight: 600;"></i> {{ this.importFailNum || "--" }}条问题数据导入失败<el-button
type="text"
@click="handelClickLook('fail')"
>查看</el-button
>
<!-- -->
<i class="el-icon-download" style="margin-left: 16px;"></i>
<a
v-if="this.resultDescFile"
:href="this.resultDescFile"
target="_blank"
style="color: #ff4d4f; cursor: pointer"
>下载结果说明</a
>
</el-col>
</el-row>
<el-dialog
title="列表"
:visible.sync="showTable"
width="50%"
v-if="showTable"
>
<el-table
:data="tableData"
row-key="fileCode"
border
style="width: 100%; height: 500px; overflow-y: auto"
>
<el-table-column
v-for="item in tableHeader"
:key="item.columnName"
:prop="item.columnName"
:label="item.label"
:align="item.align"
show-overflow-tooltip
>
<template slot-scope="scope">
<span>{{ handleFilterSpan(scope.row, item) }}</span>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="pageNo"
:page-size="pageSize"
:total="total"
layout=" prev, pager, next"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="showTable = false"> </el-button>
<el-button type="primary" @click="showTable = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
@ -25,29 +96,99 @@ import { requestPost } from "@/js/dai/request";
export default {
data() {
return {
form: {
importCategory: null,
taskName: null,
},
rules: {
importCategory: [
{ required: true, message: "请选择任务类型", trigger: "change" },
],
taskName: [
{ required: true, message: "请输入任务名称", trigger: "change" },
],
},
resident_category_import_list: [],
showTable: false,
tableHeader: [],
tableData: [],
importSuccessNum: null,
importFailNum: null,
importCategory:null,
pageNo:1,
pageSize:20,
total:0,
tableType:null
};
},
props: {},
created() {},
props: {
fileCode: {
type: String,
default: "",
},
fileCodeP: {
type: String,
default: "",
},
},
created() {
this.getTaskInfo();
},
methods: {
handleFilterSpan(row, item) {
let _val = "";
if (item.options && item.options.length > 0) {
item.options.forEach((n) => {
if (n.value === row[item.columnName]) _val = n.label;
});
}
return _val || row[item.columnName];
},
async handelClickLook(type) {
this.showTable = true;
this.tableType = type;
this.getTable()
},
async getTable(){
let url = "/actual/base/excelDataShow/quaryExcelDataList";
const {pageNo,pageSize,importCategory,tableType} = this;
let parm = {
taskId: this.taskId,
boolranFlag: tableType == "success" ? "1" : "0",
pageNo,
pageSize,
fileCategory:importCategory,
};
let { data, code, msg } = await requestPost(url, parm);
if (code == 0) {
this.showTable = true;
this.tableHeader = Object.entries(data.columnsDict).map((item) => ({
label: item[0],
columnName: item[1],
})); //
this.tableData = data.excelDataShowDTOList.list;
this.total = data.excelDataShowDTOList.total;
} else if (code >= 8000) {
this.$message.error(msg);
}
},
pageCurrentChangeHandle (val) {
this.pageNo = val
this.getTable()
},
handelClickUpload() {
this.$emit("handelClickUpload");
},
handelClickBack() {
// this.$emit("handelClickBack");
handelClickBackList() {
this.$emit("handelClickBack");
},
async getTaskInfo() {
let url = "/actual/base/intelligentImportData/getTaskInfo";
let parm = {
fileCode: this.fileCodeP || this.fileCode,
};
let { data, code, msg } = await requestPost(url, parm);
if (code == 0) {
this.taskId = data.taskId;
this.importFailNum = data.importFailNum.toString();
this.importSuccessNum = data.importSuccessNum.toString();
this.importCategory = data.importCategory;
this.resultDescFile = data.resultDescFile;
this.$emit("updateoperatorName", {
operatorName: data.operatorName,
createdTime: data.createdTime,
});
} else if (code >= 8000) {
this.$message.error(msg);
}
},
},
components: {},

233
src/views/modules/base/smartImport/cpts/executeTask.vue

@ -38,40 +38,68 @@
</div>
</div>
<h3 class="title-small">数据导入明细</h3>
<el-row type="flex" justify="" >
<el-row type="flex" justify="">
<el-col :span="24">
{{this.importSuccessNum || '--'}}条数据已导入<el-button type="text" @click="handelClickLook('success')">查看</el-button>
<i class="el-icon-circle-check" style="color: #1cc58c; font-size: 15px;font-weight: 600;"></i> {{ this.importSuccessNum || "--" }}条数据已导入<el-button
type="text"
@click="handelClickLook('success')"
>查看</el-button
>
</el-col>
</el-row>
<el-row type="flex" justify="" >
<el-row type="flex" justify="">
<el-col :span="24">
{{this.importFailNum || '--'}}条问题数据导入失败<el-button type="text" @click="handelClickLook('fail')">查看</el-button>
<i class="el-icon-circle-close" style="color: #ff5b5d;font-size: 15px;font-weight: 600;"></i> {{ this.importFailNum || "--" }}条问题数据导入失败<el-button
type="text"
@click="handelClickLook('fail')"
>查看</el-button
>
</el-col>
</el-row>
<!-- <el-dialog title="列表"
:visible.sync="dialogVisible"
width="50%">
<el-table :data="tableDate"
<el-dialog
title="列表"
:visible.sync="showTable"
width="50%"
v-if="showTable"
>
<el-table
:data="tableData"
row-key="fileCode"
border
style="width: 100%">
<el-table-column type="设置类型">
</el-table-column>
<el-table-column prop="渲染绑定的表数据tableDate中的哪个数据"
label="显示名字"
width="180">
style="width: 100%"
>
<el-table-column
v-for="item in tableHeader"
:key="item.columnName"
:prop="item.columnName"
:label="item.label"
:align="item.align"
show-overflow-tooltip
>
<template slot-scope="scope">
<span>{{ handleFilterSpan(scope.row, item) }}</span>
</template>
</el-table-column>
</el-table>
<span slot="footer"
class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary"
@click="dialogVisible = false"> </el-button>
<el-pagination
:current-page="pageNo"
:page-size="pageSize"
:total="total"
layout=" prev, pager, next"
@current-change="pageCurrentChangeHandle"
>
</el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="showTable = false"> </el-button>
<el-button type="primary" @click="showTable = false"
> </el-button
>
</span>
</el-dialog> -->
</el-dialog>
</div>
</template>
<script>
import { requestPost,requestGet} from "@/js/dai/request";
import { requestPost, requestGet } from "@/js/dai/request";
export default {
data() {
@ -85,28 +113,48 @@ export default {
],
},
resident_category_import_list: [],
taskId:null,
timerId:null,
importSuccessNum:null,
importFailNum:null,
importCategory:null,
taskId: null,
timerId: null,
importSuccessNum: null,
importFailNum: null,
importCategory: null,
showTable: false,
tableHeader: [],
tableData:[],
pageNo:1,
pageSize:20,
total:0,
tableType:null
};
},
props: {
fileCode:{
type:String,
default:''
}
fileCode: {
type: String,
default: "",
},
fileCodeP: {
type: String,
default: "",
},
},
async created() {
await this.getTaskInfo();
// await this.getQuaryExcelDataList()
await this.startTimer();
},
methods: {
handleFilterSpan(row, item) {
let _val = "";
if (item.options && item.options.length > 0) {
item.options.forEach((n) => {
if (n.value === row[item.columnName]) _val = n.label;
});
}
return _val || row[item.columnName];
},
startTimer() {
if (!this.timerId ) {
this.timerId = setInterval(this.getProcessRate, 3000);
if (!this.timerId) {
this.timerId = setInterval(this.getProcessRate, 500);
}
},
//
@ -115,88 +163,103 @@ export default {
this.timerId = null;
},
async getProcessRate() {
let url = '/actual/base/intelligentImportData/processRate'
let url = "/actual/base/intelligentImportData/processRate";
let parm = {
fileCode:this.fileCode
}
let res= await requestPost(url, parm)
if(res.code == 0){
if(res.data == 100){
this.stopTimer()
fileCode: this.fileCode,
};
let res = await requestPost(url, parm);
if (res.code == 0) {
if (res.data === 100) {
this.stopTimer();
this.$emit('successImport')
}else{
this.$emit('updateProgress',res.data)
}
}else if(code >= 8000){
} else if (code >= 8000) {
this.$message.error(msg);
}
},
async getTaskInfo () {
let url = '/actual/base/intelligentImportData/getTaskInfo'
async getTaskInfo() {
let url = "/actual/base/intelligentImportData/getTaskInfo";
let parm = {
fileCode:this.fileCode
}
let {data,code,msg} = await requestPost(url, parm)
if(code == 0){
fileCode: this.fileCodeP || this.fileCode,
};
let { data, code, msg } = await requestPost(url, parm);
if (code == 0) {
this.taskId = data.taskId;
this.importFailNum = data.importFailNum.toString();
this.importSuccessNum = data.importSuccessNum.toString();
this.importCategory = data.importCategory
if(data.processStatus != 'processing'){
this.stopTimer()
this.importCategory = data.importCategory;
this.$emit('updateoperatorName',{operatorName:data.operatorName,createdTime:data.createdTime})
if (data.processStatus != "processing") {
this.stopTimer();
}
}else if(code >= 8000){
} else if (code >= 8000) {
this.$message.error(msg);
}
// this.$emit("handelClickUpload");
},
async handelClickLook (type) {
let url = '/actual/base/excelDataShow/quaryExcelDataList'
async handelClickLook(type) {
this.showTable = true;
this.tableType = type;
this.getTable()
},
async getTable(){
let url = "/actual/base/excelDataShow/quaryExcelDataList";
const {pageNo,pageSize,importCategory,tableType} = this;
let parm = {
taskId:this.taskId,
boolranFlag:type == 'success'?'1':'0',
pageNo:1,
pageSize:20,
importCategory:this.importCategory
}
let {data,code,msg} = await requestPost(url, parm)
if(code == 0){
console.log(data);
}else if(code >= 8000){
taskId: this.taskId,
boolranFlag: tableType == "success" ? "1" : "0",
pageNo,
pageSize,
fileCategory:importCategory,
};
let { data, code, msg } = await requestPost(url, parm);
if (code == 0) {
this.showTable = true;
this.tableHeader = Object.entries(data.columnsDict).map((item) => ({
label: item[0],
columnName: item[1],
})); //
this.tableData = data.excelDataShowDTOList.list;
this.total = data.excelDataShowDTOList.total;
} else if (code >= 8000) {
this.$message.error(msg);
}
// this.$emit("handelClickUpload");
},
async cancelTask(){
let url = '/actual/base/intelligentImportData/cancelTask'
async cancelTask() {
let url = "/actual/base/intelligentImportData/cancelTask";
let parm = {
fileCode:this.fileCode,
taskId:this.taskId
}
let {data,code,msg} = await requestPost(url, parm)
if(code == 0){
fileCode: this.fileCode,
taskId: this.taskId,
};
let { data, code, msg } = await requestPost(url, parm);
if (code == 0) {
console.log(data);
this.$message.info('任务已取消');
this.$message.info("任务已取消");
this.$emit("handelClickBack");
}else if(code >= 8000){
} else if (code >= 8000) {
this.$message.error(msg);
}
},
handelClickBack() {
this.$confirm(`您确定要取消本次数据导入任务吗`, {
confirmButtonText: '确定',
cancelButtonText: '再想想',
type: 'warning'
}).then(() => {
this.cancelTask()
}).catch(() => {
});
confirmButtonText: "确定",
cancelButtonText: "再想想",
type: "warning",
})
.then(() => {
this.cancelTask();
})
.catch(() => {});
},
handelClickBackList(){
handelClickBackList() {
this.$emit("handelClickBack");
}
},
destroyed(){
this.stopTimer()
},
destroyed() {
this.stopTimer();
},
components: {},
computed: {},

53
src/views/modules/base/smartImport/cpts/smartImportAdd.vue

@ -1,53 +0,0 @@
<template>
<div class="m-detail-main">
<el-card>
<div class="steps">
<el-steps :active="progress" >
<!-- description="这是一段很长很长很长的描述性文字" -->
<el-step title="创建任务" ></el-step>
<el-step title="正在导入"></el-step>
<el-step title="导入完成"></el-step>
</el-steps>
</div>
<div style="margin-top: 37px;">
<created-task v-if="progress == 1" @handelClickUpload="handelClickUpload" @handelClickBack="handelClickBack"></created-task>
<execute-task v-if="progress == 2"@handelClickBack="handelClickBack" :fileCode="fileCode"></execute-task>
<complete-task v-if="progress == 3"@handelClickBack="handelClickBack"></complete-task>
</div>
</el-card>
</div>
</template>
<script>
import createdTask from './createdTask.vue'
import executeTask from './executeTask.vue'
import completeTask from './completeTask.vue'
export default {
data() {
return {
progress:1,
fileCode:null
};
},
props: {},
created() {
},
methods: {
handelClickUpload(fileCode){
this.progress = 2;
this.fileCode = fileCode;
},
handelClickBack(){
this.$emit('handleClose');
},
},
components: {createdTask,executeTask,completeTask},
computed: {},
watch: {},
};
</script>
<style lang="scss" scoped>
@import "@/assets/scss/buttonstyle.scss";
@import "@/assets/scss/modules/management/detail-main.scss";
@import "@/assets/scss/pages/smartImport.scss";
</style>

23
src/views/modules/base/smartImport/cpts/smartImportDetail.vue

@ -1,23 +0,0 @@
<template>
<div class="">
detail
</div>
</template>
<script>
export default {
data() {
return {};
},
props: {
},
created() {},
methods: {},
components: {},
computed: {},
watch: {},
};
</script>
<style lang="scss" scoped>
</style>

89
src/views/modules/base/smartImport/cpts/smartImportInfo.vue

@ -1,39 +1,88 @@
<template>
<div class="">
<div v-if="pageType == 'add'">
<smart-import-add @handleClose="handleClose" @handelClickCloseUpload="handelClickCloseUpload"></smart-import-add>
<div class="m-detail-main">
<el-card>
<div class="steps">
<el-steps :active="progress" >
<!-- description="这是一段很长很长很长的描述性文字" -->
<el-step :class="[this.operatorName == null?'showNum':'']" title="创建任务" :description="`${this.operatorName}(${this.createdTime})`" ></el-step>
<el-step title="正在导入" :description="`导入进度${this.processStatus == 'processing'?this.progressNum:100 }%`"></el-step>
<el-step title="导入完成"></el-step>
</el-steps>
</div>
<div v-if="pageType == 'detail'">
<smart-import-detail></smart-import-detail>
<div style="margin-top: 37px;">
<created-task v-if="progress == 1" @handelClickUpload="handelClickUpload" @handelClickBack="handelClickBack"></created-task>
<execute-task v-if="progress == 2" @successImport="successImport" @handelClickBack="handelClickBack" @updateProgress="updateProgress" :fileCode="fileCode" :fileCodeP="fileCodeP" @updateoperatorName="updateoperatorName"></execute-task>
<complete-task v-if="progress == 3"@handelClickBack="handelClickBack" :fileCodeP="fileCodeP" @updateoperatorName="updateoperatorName" :fileCode="fileCode"></complete-task>
</div>
</el-card>
</div>
</template>
<script>
import smartImportAdd from "./smartImportAdd";
import smartImportDetail from "./smartImportDetail";
<script>
import createdTask from './createdTask.vue'
import executeTask from './executeTask.vue'
import completeTask from './completeTask.vue'
export default {
data() {
return {};
return {
progress:1,
fileCode:null,
progressNum:null,
createdTime:null,
operatorName:null
};
},
props: {
pageType: String,
default: "",
fileCodeP:{
type:String,
default:null
},
taskId:{
type:String,
default:null
},
processStatus:{
type:String,
default:null
}
},
created() {
console.log(this.processStatus);
if(this.processStatus){
this.progress = this.processStatus == 'processing'?2:3
}
},
created() {},
methods: {
handleClose(){
this.$emit("handleClose");
handelClickUpload(fileCode){
this.progress = 2;
this.fileCode = fileCode;
},
handelClickBack(){
this.$emit('handleClose');
},
handelClickCloseUpload(){
this.$emit("handelClickCloseUpload");
successImport(){
this.progress = 3;
},
updateProgress(num){
this.progressNum = num;
},
components: {smartImportAdd,smartImportDetail},
updateoperatorName({operatorName,createdTime}){
this.operatorName = operatorName;
this.createdTime = createdTime;
},
},
components: {createdTask,executeTask,completeTask},
computed: {},
watch: {},
};
</script>
<style lang="scss" scoped>
<style lang="scss" scoped>
@import "@/assets/scss/buttonstyle.scss";
@import "@/assets/scss/modules/management/detail-main.scss";
@import "@/assets/scss/pages/smartImport.scss";
.showNum{
/deep/.el-step__description{
display: none;
}
}
</style>

23
src/views/modules/base/smartImport/index.vue

@ -41,7 +41,7 @@
<el-table-column type="selection" fixed="left" align="center" width="50" />
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" />
<el-table-column prop="originFileName" align="center" label="任务名称" :show-overflow-tooltip="true">
<el-table-column prop="taskName" align="center" label="任务名称" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="importCategory" align="center" width="100" label="任务类型" :show-overflow-tooltip="true">
<template slot-scope="scope">
@ -66,7 +66,7 @@
</el-table-column>
<el-table-column prop="importFailNum" align="center" width="80" label="失败数目" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="createdByName" align="center" width="100" label="操作人" :show-overflow-tooltip="true">
<el-table-column prop="operatorName" align="center" width="100" label="操作人" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="completedTime" align="center" width="180" label="操作完成时间"
:show-overflow-tooltip="true">
@ -87,10 +87,10 @@
</div>
</div>
</div>
<div v-if=" pageType == 'detail' || pageType == 'add'">
<div v-if="pageType == 'add'">
<!-- :eventDetailData="eventDetailData" -->
<smart-import-info ref="eleEditForm" :pageType="pageType"
@handleClose="handleClose" @handleOk="handleOk"/>
@handleClose="handleClose" @handleOk="handleOk" :fileCodeP="fileCode" :taskId="taskId" :processStatus="processStatus"/>
</div>
</div>
</template>
@ -121,8 +121,11 @@ export default {
dicts: {
import_status:[],
resident_category_import:[],
}, //
fileCode:null,
taskId:null,
processStatus:null,
};
},
computed: {
@ -184,13 +187,17 @@ export default {
},
//
async handleDetail(row) {
this.pageType = "detail";
this.pageType = "add";
const {taskId,fileCode,processStatus} = row;
this.taskId = taskId;
this.fileCode = fileCode;
this.processStatus = processStatus;
},
//
handleClose() {
this.pageType = "list";
this.processStatus = null;
},
//
handleOk(type) {
@ -229,7 +236,7 @@ export default {
//
async getTableData() {
this.tableLoading = true;
const url = "/commonservice/import-task/page";
const url = "/commonservice/import-task/pageList";
const { pageSize, pageNo, formData } = this;
const { data, code, msg } = await requestPost(url, {
pageSize,

Loading…
Cancel
Save