فهرست منبع

文档报废双文件上传

Reiskuchen 5 سال پیش
والد
کامیت
b709f1b630
2فایلهای تغییر یافته به همراه87 افزوده شده و 30 حذف شده
  1. 85 28
      ys_vue/src/views/mold/moldDetail.vue
  2. 2 2
      ys_vue/src/views/project/staff.vue

+ 85 - 28
ys_vue/src/views/mold/moldDetail.vue

@@ -363,8 +363,10 @@
                 <el-tab-pane label="模具报废" name="5">
                     <el-table :data="documents.abandon" highlight-current-row v-loading="listLoading" style="width: 100%;">
                         <el-table-column type="index" width="40"></el-table-column>
-                        <el-table-column prop="fileName" label="名称" sortable></el-table-column>
-                        <el-table-column prop="fileSize" label="大小" width="200" sortable></el-table-column>
+                        <el-table-column prop="fileName" label="申请单名称" sortable></el-table-column>
+                        <el-table-column prop="fileSize" label="申请单大小" width="200" sortable></el-table-column>
+                        <el-table-column prop="fileName2" label="报废单名称" sortable></el-table-column>
+                        <el-table-column prop="fileSize2" label="报废单大小" width="200" sortable></el-table-column>
                         <el-table-column prop="uploadtor" label="上传者" width="200" sortable></el-table-column>
                         <el-table-column prop="indate" label="上传时间" width="200" sortable></el-table-column>
                         <el-table-column label="状态" width="120" sortable>
@@ -435,18 +437,18 @@
         <el-dialog title="模具报废上传" :visible.sync="centerDialog2Visible" width="450px" :before-close="clearFileRecord">
             <p style="height:60px;">
                 <span style="float:left;margin-right:30px;">申请单</span>
-                <el-upload ref="upload1" action="customize" :http-request="uploadFile" :limit="1" :auto-upload="false" style="float:left">
+                <el-upload ref="upload1" action="customize" :http-request="uploadDiscardFile1" :limit="1" :before-remove="beforeRemove1" style="float:left">
                     <el-button size="small" type="primary">上传</el-button>
                 </el-upload>
             </p>
             <p style="height:60px;">
                 <span style="float:left;margin-right:30px;">报废单</span>
-                <el-upload ref="upload2" action="customize" :http-request="uploadFile" :limit="1" :auto-upload="false" style="float:left">
+                <el-upload ref="upload2" action="customize" :http-request="uploadDiscardFile2" :limit="1" :before-remove="beforeRemove2" style="float:left">
                     <el-button size="small" type="primary">上传</el-button>
                 </el-upload>
             </p>
             <span slot="footer" class="dialog-footer">
-                <el-button @click="confirmUpload" :loading="uploading[3]">确定</el-button>
+                <el-button @click="discardUpload" :loading="uploading[3]">确定</el-button>
             </span>
         </el-dialog>
 
@@ -655,7 +657,10 @@
                     holes: "",
                 },
 
+                //零件文件
                 files: [],
+                //报废文件
+                files2: [null, null],
 
                 twoId: null,
                 threeId: null,
@@ -894,13 +899,6 @@
                 this.centerDialogVisible = true;
             },
 
-            //清理报废文档上传窗口中的文件
-            clearFileRecord() {
-                this.centerDialog2Visible = false;
-                this.$refs.upload1.clearFiles();
-                this.$refs.upload2.clearFiles();
-            },
-
             //清理零件文档上传窗口中的文件
             clearFileRecord2() {
                 this.centerDialog4Visible = false;
@@ -992,21 +990,6 @@
                 })
             },
 
-            //报废文件上传
-            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;
-                    this.clearFileRecord();
-                } else {
-                    this.$message({
-                        message: "必须各上传一个文件",
-                        type: "error"
-                    });
-                }
-            },
-
             //文件上传
             uploadFile(params) {
                 var fileObj = params.file;
@@ -1244,7 +1227,7 @@
             },
 
             uploadPartFile(params) {
-                this.files.push(params.file)
+                this.files.push(params.file);
                 return false;
             },
 
@@ -1281,6 +1264,80 @@
                 });
             },
 
+            //报废文件上传
+            discardUpload() {
+                if (this.files2[0] != null && this.files2[1] != null) {
+                    var form = new FormData();  
+                    form.append("file", this.files2[0]);
+                    form.append("file2", this.files2[1]);
+                    form.append("belongType", this.activeTab);
+                    form.append("mouldId", this.detailId);
+                    if (this.activeTab == 0 || this.activeTab == 1) {
+                        form.append("dwgType", this.fileType);
+                    }
+                    this.http.uploadFile( this.port.mold.moldFileUpload, form,
+                    res => {
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: "上传成功",
+                                type: "success"
+                            });
+                            this.centerDialog2Visible = false;
+                            this.clearFileRecord();
+                            this.getDocument();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                    });
+                } else {
+                    console.log(this.files2);
+                    this.$message({
+                        message: "必须各上传一个文件",
+                        type: "error"
+                    });
+                }
+            },
+
+            //清理报废文档上传窗口中的文件
+            clearFileRecord() {
+                this.centerDialog2Visible = false;
+                this.$refs.upload1.clearFiles();
+                this.$refs.upload2.clearFiles();
+                this.files2[0] = null;
+                this.files2[1] = null;
+            },
+
+            //报废的申请单上传
+            uploadDiscardFile1(params){
+                this.files2[0] = params.file;
+                return false;
+            },
+
+            //报废的报废单上传
+            uploadDiscardFile2(params){
+                this.files2[1] = params.file;
+                return false;
+            },
+
+            //报废的申请单移除
+            beforeRemove1(params) {
+                this.files2[0] = null;
+            },
+
+            //报废的报废单移除
+            beforeRemove2(params) {
+                this.files2[0] = null;
+            },
+
             //获取操作记录
             getOperationRecord(type) {
                 this.http.post( this.port.mold.moldOperationList, { 

+ 2 - 2
ys_vue/src/views/project/staff.vue

@@ -34,8 +34,8 @@
 		<!--列表-->
 		<el-table :data="list" highlight-current-row :height="tableHeight" v-loading="listLoading" style="width: 100%;">
 			<el-table-column type="index" width="60"></el-table-column>
-			<el-table-column prop="username" label="姓名" width="120" align="center" sortable></el-table-column>
-			<el-table-column prop="account" label="手机号(登录账号)" align="center" width="180" sortable></el-table-column>
+			<el-table-column prop="username" label="姓名" width="120" sortable></el-table-column>
+			<el-table-column prop="account" label="手机号" width="180" sortable></el-table-column>
 			<!-- <el-table-column prop="mobile" label="联系方式" width="150" sortable></el-table-column> -->
             <el-table-column prop="projects" label="参与项目" sortable>
                 <template slot-scope="scope">