作者 小范

进港快件数据导入界面新增loading

@@ -18,7 +18,12 @@ @@ -18,7 +18,12 @@
18 :limit=1 18 :limit=1
19 :on-exceed="fileExceed" 19 :on-exceed="fileExceed"
20 accept="application/vnd.ms-excel,application/vnd.ms-excels" 20 accept="application/vnd.ms-excel,application/vnd.ms-excels"
21 - ref="fileupload"> 21 + ref="fileupload"
  22 + v-loading.fullscreen.lock="loading"
  23 + element-loading-text="正在上传原始数据"
  24 + element-loading-spinner="el-icon-loading"
  25 + element-loading-background="rgba(0,0,0,0.3)"
  26 + >
22 <el-button size="medium" type="primary">点击上传原始数据</el-button> 27 <el-button size="medium" type="primary">点击上传原始数据</el-button>
23 <div slot="tip" class="el-upload__tip">只能上传excel文件</div> 28 <div slot="tip" class="el-upload__tip">只能上传excel文件</div>
24 </el-upload> 29 </el-upload>
@@ -31,7 +36,11 @@ @@ -31,7 +36,11 @@
31 :limit=1 36 :limit=1
32 :on-exceed="fileExceed2" 37 :on-exceed="fileExceed2"
33 accept="application/vnd.ms-excel,application/vnd.ms-excels" 38 accept="application/vnd.ms-excel,application/vnd.ms-excels"
34 - ref="fileupload"> 39 + ref="fileupload"
  40 + v-loading.fullscreen.lock="loadings"
  41 + element-loading-text="正在上传理货数据"
  42 + element-loading-spinner="el-icon-loading"
  43 + element-loading-background="rgba(0,0,0,0.3)">
35 <el-button size="medium" type="success">点击上传理货数据</el-button> 44 <el-button size="medium" type="success">点击上传理货数据</el-button>
36 <div slot="tip" class="el-upload__tip">只能上传excel文件</div> 45 <div slot="tip" class="el-upload__tip">只能上传excel文件</div>
37 </el-upload> 46 </el-upload>
@@ -47,6 +56,10 @@ @@ -47,6 +56,10 @@
47 p{font-size:25px;font-weight: bold;} 56 p{font-size:25px;font-weight: bold;}
48 .row-bg{padding:30px 0;} 57 .row-bg{padding:30px 0;}
49 .el-form-item {margin-bottom: 0px;} 58 .el-form-item {margin-bottom: 0px;}
  59 + .el-loading-spinner{
  60 + top:60%;
  61 + width: 120%;
  62 + }
50 </style> 63 </style>
51 64
52 <script> 65 <script>
@@ -54,6 +67,8 @@ @@ -54,6 +67,8 @@
54 export default { 67 export default {
55 data() { 68 data() {
56 return { 69 return {
  70 + loading:false,
  71 + loadings:false,
57 fileList: [], 72 fileList: [],
58 }; 73 };
59 }, 74 },
@@ -64,12 +79,15 @@ @@ -64,12 +79,15 @@
64 }, 79 },
65 // 自定义上传 excel 80 // 自定义上传 excel
66 uploadOri (item) { 81 uploadOri (item) {
  82 + this.loading = true;
67 const form = new FormData() 83 const form = new FormData()
68 form.append('file', item.file); 84 form.append('file', item.file);
69 upfile(form).then(res =>{ 85 upfile(form).then(res =>{
70 if(res.data.count >0){ 86 if(res.data.count >0){
  87 + this.loading = false;
71 return this.$message.error('主单导入失败') 88 return this.$message.error('主单导入失败')
72 }else { 89 }else {
  90 + this.loading = false;
73 this.$message.success('主单导入成功') 91 this.$message.success('主单导入成功')
74 } 92 }
75 }).catch((e) => {}) 93 }).catch((e) => {})
@@ -80,12 +98,15 @@ @@ -80,12 +98,15 @@
80 }, 98 },
81 // 自定义上传 excel 99 // 自定义上传 excel
82 uploadTal (item) { 100 uploadTal (item) {
  101 + this.loadings = true;
83 const form = new FormData() 102 const form = new FormData()
84 form.append('file', item.file); 103 form.append('file', item.file);
85 upfiles(form).then(res =>{ 104 upfiles(form).then(res =>{
86 if(res.data.count >0){ 105 if(res.data.count >0){
  106 + this.loadings = false;
87 return this.$message.error('主单导入失败') 107 return this.$message.error('主单导入失败')
88 }else { 108 }else {
  109 + this.loadings = false;
89 this.$message.success('主单导入成功') 110 this.$message.success('主单导入成功')
90 } 111 }
91 }).catch((e) => {}) 112 }).catch((e) => {})