替换导入数据接收方式sse

This commit is contained in:
龙运模 2025-07-31 15:09:41 +08:00
parent 0496907995
commit 083a112e95
22 changed files with 51 additions and 5 deletions

View File

@ -42,10 +42,14 @@
<slot name="download"></slot> <slot name="download"></slot>
</span> </span>
</div> </div>
<div class="importBox" v-if="progressShow"> <div class="importBox" v-if="progressShow">
<div class="name">导入进度</div> <div class="name">导入进度</div>
<el-progress class="exportPopover" :text-inside="true" :stroke-width="12" :percentage="importInfo.rate" /> <el-progress class="exportPopover" :text-inside="true" :stroke-width="12" :percentage="importInfo.rate" />
</div> </div>
<div class="primaryText" v-if="analysisShow">
<div class="text success">正在解析...</div>
</div>
<div class="errText" v-if="errorShow"> <div class="errText" v-if="errorShow">
<div class="deleteErr" @click="errorClick"><el-icon class="icon"><el-icon-Close/></el-icon></div> <div class="deleteErr" @click="errorClick"><el-icon class="icon"><el-icon-Close/></el-icon></div>
<el-scrollbar ref="scrollbar" max-height="120px"> <el-scrollbar ref="scrollbar" max-height="120px">
@ -74,7 +78,7 @@ export default {
size:{type:String, default:'small'}, size:{type:String, default:'small'},
title:{type:String, default: ""}, title:{type:String, default: ""},
type:{type:[String, Number], default: ""}, type:{type:[String, Number], default: ""},
httpDisabled:{type:Boolean, default:false} httpDisabled:{type:Boolean, default:false},
}, },
data(){ data(){
return{ return{
@ -88,6 +92,7 @@ export default {
fileShow:false, fileShow:false,
params:{}, params:{},
analysisShow:false,
importDis:false, importDis:false,
importTrue:false, importTrue:false,
progressShow:false, progressShow:false,
@ -106,19 +111,21 @@ export default {
}, },
mounted() { mounted() {
eventBus.$on('sockBack', this.getWsResult); // eventBus.$on('sockBack', this.getWsResult);
// eventBus.$on('sseBack', this.getWsResult); eventBus.$on('sseBack', this.getWsResult);
}, },
unmounted() { unmounted() {
eventBus.$off('sockBack', this.getWsResult); // eventBus.$off('sockBack', this.getWsResult);
// eventBus.$off('sseBack', this.getWsResult); eventBus.$off('sseBack', this.getWsResult);
}, },
methods:{ methods:{
getWsResult(res){ getWsResult(res){
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18 || res.data.type == 27 || res.data.type == 28 || res.data.type == 31 || res.data.type == 42 || res.data.type == 44 || res.data.type == 45 || res.data.type == 48 || res.data.type == 49 || res.data.type == 50 || res.data.type == 51)){ if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18 || res.data.type == 27 || res.data.type == 28 || res.data.type == 31 || res.data.type == 42 || res.data.type == 44 || res.data.type == 45 || res.data.type == 48 || res.data.type == 49 || res.data.type == 50 || res.data.type == 51)){
if(this.type == res.data.type){ if(this.type == res.data.type){
this.analysisShow = false;
this.importInfo = res.data; this.importInfo = res.data;
this.progressShow = true; this.progressShow = true;
this.progressTrue = true; this.progressTrue = true;
@ -140,6 +147,10 @@ export default {
} }
}, },
setAnalysisShow(params){
this.analysisShow = params;
},
// //
importFile(){ importFile(){
this.visible = true; this.visible = true;
@ -274,6 +285,20 @@ export default {
font-size: 10px; font-size: 10px;
} }
} }
.primaryText{
margin: 15px 0 0 0;
padding: 10px;
border-radius: 6px;
background: var(--el-color-primary-light-9);
::v-deep .text{
font-size: 12px;
line-height: 20px;
text-align: left;
}
.text{
color: var(--el-color-primary)
}
}
.errText{ .errText{
margin: 15px 0 0 0; margin: 15px 0 0 0;
padding: 10px; padding: 10px;

View File

@ -234,6 +234,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.finance.cost.import.post(params); const res = await this.$API.finance.cost.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -239,6 +239,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.early.exclude.import.post(params); const res = await this.$API.early.exclude.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -337,6 +337,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.early.earlyWarn.import.post(params); const res = await this.$API.early.earlyWarn.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -175,6 +175,7 @@ export default {
async importUpload(params) { async importUpload(params) {
const res = await this.$API.orders.order.maintenance.import.post(params); const res = await this.$API.orders.order.maintenance.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -220,6 +220,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.orders.order.sock.import.post(params); const res = await this.$API.orders.order.sock.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -176,6 +176,7 @@ export default {
async importUpload(params) { async importUpload(params) {
const res = await this.$API.orders.order.maintenance.import.post(params); const res = await this.$API.orders.order.maintenance.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -303,6 +303,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.orders.order.maintenance.import.post(params); const res = await this.$API.orders.order.maintenance.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -303,6 +303,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.orders.order.repair.import.post(params); const res = await this.$API.orders.order.repair.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -175,6 +175,7 @@ export default {
async importUpload(params) { async importUpload(params) {
const res = await this.$API.orders.order.maintenance.import.post(params); const res = await this.$API.orders.order.maintenance.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -175,6 +175,7 @@ export default {
async importUpload(params) { async importUpload(params) {
const res = await this.$API.orders.order.maintenance.import.post(params); const res = await this.$API.orders.order.maintenance.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -111,6 +111,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.setup.material.import.post(params); const res = await this.$API.setup.material.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -128,6 +128,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.setup.regional.import.post(params); const res = await this.$API.setup.regional.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -106,6 +106,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.setup.spare.import.post(params); const res = await this.$API.setup.spare.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -208,6 +208,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.setup.bom.import.post(params); const res = await this.$API.setup.bom.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -282,6 +282,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.system.company.import.post(params); const res = await this.$API.system.company.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -244,6 +244,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.system.spareInfo.import.post(params); const res = await this.$API.system.spareInfo.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -246,6 +246,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.system.spare.import.post(params); const res = await this.$API.system.spare.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -300,6 +300,7 @@
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.system.user.import.post(params); const res = await this.$API.system.user.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -176,6 +176,7 @@ export default {
async importUpload(params) { async importUpload(params) {
const res = await this.$API.orders.order.maintenance.import.post(params); const res = await this.$API.orders.order.maintenance.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -238,6 +238,7 @@ export default {
this.httpDisabled = true; this.httpDisabled = true;
const res = await this.$API.shipment.out.import.post(params); const res = await this.$API.shipment.out.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },

View File

@ -176,6 +176,7 @@ export default {
async importUpload(params) { async importUpload(params) {
const res = await this.$API.orders.order.maintenance.import.post(params); const res = await this.$API.orders.order.maintenance.import.post(params);
if(res.code == 200){ if(res.code == 200){
this.$refs.scImport.setAnalysisShow(true);
this.$message.success('上传成功,开始导入数据'); this.$message.success('上传成功,开始导入数据');
} }
}, },