QuietShadow vor 3 Jahren
Ursprung
Commit
da64ff4885

+ 37 - 2
src/views/energyPlan/components/supplyAndDemand/planProjectIronMill.vue

@@ -96,7 +96,21 @@
                                     @click="upState()"
                                     :loading="loading"
                                     v-if="butPrivilege.CHECK && isCheck"
-                                >审核</el-button>
+                                >审核</el-button>
+                                <el-upload
+                                  v-if="butPrivilege.IMPORT"
+                                  style="display: inline-block;margin-left:5px"
+                                  action=""
+                                  :on-progress='beforeUpload'
+                                  :multiple='false'
+                                  :limit="1"
+                                  accept=".xls"
+                                  :show-file-list="false"
+                                  ><el-button
+                                  size="mini"
+                                  type="primary"
+                                  :loading='loading'>导入</el-button>
+                                  </el-upload>
                                 <el-button
                                     class="button"
                                     size="mini"
@@ -856,7 +870,8 @@ export default {
                 QUERY: false,
                 PUT: false,
                 CHECK: false,
-                UNDOCHECK: false
+                UNDOCHECK: false,
+                IMPORT: false
             },
             loginName: getCookie('loginName')
         }
@@ -1741,6 +1756,26 @@ export default {
                 }
             }
             return result;
+        },
+        // 导入方法
+        beforeUpload (event, file, fileList) {
+          let _this = this
+          let formData = new FormData();
+          formData.append('file', file.raw)
+          _this.loading = true
+          this.axios.post('pass/ems/v1/emsprodplanyears/excelimport/', formData, {
+            headers: {'Content-Type': 'multipart/form-data'}
+          }).then(res => {
+            if (res.code === '200') {
+              this.$message.success('操作成功')
+              _this.getTableData();
+            } else {
+              this.$message.error(res.message)
+            }
+            _this.loading = false
+          }).catch(() => {
+            _this.loading = false
+          })
         }
     }
 }