소스 검색

上传模具文档修改3

Reiskuchen 5 년 전
부모
커밋
b46fdd08bb
1개의 변경된 파일31개의 추가작업 그리고 7개의 파일을 삭제
  1. 31 7
      ys_vue/src/views/mold/moldDetail.vue

+ 31 - 7
ys_vue/src/views/mold/moldDetail.vue

@@ -341,15 +341,27 @@
     <!-- 模具报废上传弹窗 -->
     <el-dialog title="模具报废上传" :visible.sync="centerDialog2Visible" width="30%" center>
       <p>申请单</p>
-      <el-upload action="customize" :http-request="uploadFile" :limit="1">
+      <el-upload
+        ref="upload1"
+        action="customize"
+        :http-request="uploadFile"
+        :limit="1"
+        :auto-upload="false"
+      >
         <el-button size="small" type="primary">上传</el-button>
       </el-upload>
       <p>报废单</p>
-      <el-upload action="customize" :http-request="uploadFile" :limit="1">
+      <el-upload
+        ref="upload2"
+        action="customize"
+        :http-request="uploadFile"
+        :limit="1"
+        :auto-upload="false"
+      >
         <el-button size="small" type="primary">上传</el-button>
       </el-upload>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="centerDialog2Visible = false">确定</el-button>
+        <el-button @click="confirmUpload">确定</el-button>
       </span>
     </el-dialog>
   </section>
@@ -500,6 +512,22 @@ export default {
     download(id) {
       console.log(id + "被下载啦"); //这里应该有下载记录
     },
+    //报废文件上传
+    confirmUpload() {
+      if (
+        this.$refs.upload1.uploadFiles.length == 1 &&
+        this.$refs.upload2.uploadFiles.length == 1
+      ) {
+        this.$refs.upload1.submit();
+        this.$refs.upload2.submit();
+        this.centerDialog2Visible = false;
+      } else {
+        this.$message({
+          message: "必须各上传一个文件",
+          type: "error"
+        });
+      }
+    },
     //文件上传
     uploadFile(params) {
       var fileObj = params.file;
@@ -533,10 +561,6 @@ export default {
         }
       );
     },
-    //上传成功时的提示 没卵用
-    successTips() {
-      console.log("成功啦");
-    },
     //文件删除
     deleteFile(fileId) {
       this.http.post(