Browse Source

Merge pull request '修复资源维护导入不显示问题' (#174) from xuxiaoming into develop

Reviewed-on: http://101.201.121.115:3000/leo/LAPP_AdvancedPlanner_Front/pulls/174
pull/176/head
xuxiaoming 3 years ago
parent
commit
5ef4e79a9d
1 changed files with 62 additions and 60 deletions
  1. +62
    -60
      src/views/factoryModel/materialResourceMaintenance/artStockResource/upload.vue

+ 62
- 60
src/views/factoryModel/materialResourceMaintenance/artStockResource/upload.vue View File

@ -1,81 +1,83 @@
<template>
<el-dialog :title="title" width="50%" :before-close="handleClose" >
<input
type="file"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, xls, xlsx"
@change="previewUpload"
>
<el-button
type="primary"
:loading="uploadLoading"
icon="el-icon-upload"
size="mini"
@click="uploadEvent"
>上传</el-button>
</el-dialog>
<el-dialog model-value :title="title" width="50%" :before-close="handleClose">
<input
type="file"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, xls, xlsx"
@change="previewUpload"
/>
<el-button
type="primary"
:loading="uploadLoading"
icon="el-icon-upload"
size="mini"
@click="uploadEvent"
>上传</el-button
>
</el-dialog>
</template>
<script>
import { importArtResource } from "@/server/factoryModel/materialResourceMaintenance/artStockResource";
export default {
name: 'upload',
emits:["editCallBack"],
props:{
showUploadDailog : {
name: "upload",
emits: ["editCallBack"],
props: {
importDialogVisible: {
type: Boolean,
default: () => {
return false
}
return false;
},
},
},
data() {
return {
title: '导入', //
uploadLoading: false,
excel: '',
}
},
created () {
data() {
return {
title: "导入", //
uploadLoading: false,
excel: "",
};
},
methods: {
handleClose(done) { //
done();
},
//
created() {},
methods: {
handleClose(done) {
//
done();
},
//
previewUpload(file) {
this.excle = file.target.files[0]
this.excle = file.target.files[0];
},
//
uploadEvent() {
this.uploadLoading = true
if (this.excle === null || this.excle === '' || this.excle === undefined) {
this.uploadLoading = true;
if (this.excle === null || this.excle === "" || this.excle === undefined) {
this.$message({
showClose: true,
duration: 2000,
message: '请选择文件',
type: 'error'
})
this.uploadLoading = false
message: "请选择文件",
type: "error",
});
this.uploadLoading = false;
} else {
const uploadData = new FormData()
uploadData.append('upload', this.excle)
importArtResource(uploadData).then(res => {
this.uploadLoading = false
if (res.code === 200) {
this.$message({
showClose: true,
duration: 2000,
message: '导入成功',
type: 'success'
})
this.$emit('editCallBack', res.data)
}
}).catch((res) => {
this.uploadLoading = false
})
const uploadData = new FormData();
uploadData.append("upload", this.excle);
importArtResource(uploadData)
.then((res) => {
this.uploadLoading = false;
if (res.code === 200) {
this.$message({
showClose: true,
duration: 2000,
message: "导入成功",
type: "success",
});
this.$emit("editCallBack", res.data);
}
})
.catch((res) => {
this.uploadLoading = false;
});
}
},
}
}
</script>
},
};
</script>

Loading…
Cancel
Save