sunyadv il y a 5 ans
Parent
commit
3446a0a8d4
3 fichiers modifiés avec 110 ajouts et 9 suppressions
  1. 4 0
      ys_vue/src/port.js
  2. 105 8
      ys_vue/src/views/mold/moldDetail.vue
  3. 1 1
      ys_vue/src/views/mold/moldList.vue

+ 4 - 0
ys_vue/src/port.js

@@ -53,6 +53,10 @@ export default {
         moldFileDelete: '/mouldfile/delFile', //项目文档的删除
         moldOperationList: '/mouldoperationdynamics/list', //项目文档的删除
 
+        partList: '/part/list', //零件列表
+        addPart: '/part/addOrUpdate', //单个零件添加
+        importPart: '/part/importAppLogin',//零件的excel导入
+
         moldMaintain: '/mouldmaintain/maintain', //维护
         moldMaintainList: '/mouldmaintain/list' //获取列表
     },

+ 105 - 8
ys_vue/src/views/mold/moldDetail.vue

@@ -92,8 +92,8 @@
                 </el-button>
                 <el-dropdown-menu slot="dropdown">
                     <el-upload ref="upload" action="customize" :http-request="uploadFile" :show-file-list="false" multiple :limit="5" style="float:right;">
-                    <el-dropdown-item @click.native="fileType = 0">2D</el-dropdown-item>
-                    <el-dropdown-item @click.native="fileType = 1">3D</el-dropdown-item>
+                    <el-dropdown-item @click.native="fileType = 0">2D图档</el-dropdown-item>
+                    <el-dropdown-item @click.native="fileType = 1">3D图档</el-dropdown-item>
                     </el-upload>
                 </el-dropdown-menu>
             </el-dropdown>
@@ -106,7 +106,16 @@
                 </el-button>
                 <el-dropdown-menu slot="dropdown">
                     <el-dropdown-item @click.native="centerDialog3Visible = true">单个新建</el-dropdown-item>
-                    <el-dropdown-item>批量新建</el-dropdown-item>
+                    <el-dropdown-item>
+                         <el-upload ref="upload"
+                            action="customize"
+                            :http-request="uploadPart"
+                            :show-file-list="false"
+                            :limit="1"
+                        >
+                            <el-button size="small" type="primary">批量导入</el-button>
+                        </el-upload>
+                    </el-dropdown-item>
                 </el-dropdown-menu>
             </el-dropdown>
 
@@ -404,18 +413,18 @@
         <el-dialog title="编辑模具" v-if="centerDialog3Visible" :visible.sync="centerDialog3Visible" :close-on-click-modal="false" customClass="customWidth">
             <el-form :model="newParts" label-width="100px" :rules="formRules" ref="newParts" :inline="true" class="demo-form-inline">
                 <el-form-item label="零件编号" prop="number">
-                    <el-input v-model="newParts.number" autocomplete="off" placeholder="请输入模具名称"></el-input>
+                    <el-input v-model="newParts.number" autocomplete="off" placeholder="请输入零件编号"></el-input>
                 </el-form-item>
                 <el-form-item label="零件名称" prop="name">
-                    <el-input v-model="newParts.name" autocomplete="off" placeholder="请输入模具编号"></el-input>
+                    <el-input v-model="newParts.name" autocomplete="off" placeholder="请输入零件名称"></el-input>
                 </el-form-item>
                 <el-form-item label="零件寿命" prop="life">
-                    <el-input v-model="newParts.life" autocomplete="off" placeholder="请输入初始模次"></el-input>
+                    <el-input v-model="newParts.life" autocomplete="off" placeholder="请输入零件寿命"></el-input>
                 </el-form-item>
             </el-form>
             <div slot="footer" class="dialog-footer">
                 <el-button @click.native="centerDialog3Visible = false">取消</el-button>
-                <el-button type="primary">提交</el-button>
+                <el-button type="primary" @click.native="subPart" :loading="editLoading">提交</el-button>
             </div>
         </el-dialog>
 
@@ -612,6 +621,7 @@
                         this.approve = res.data.approve;
 
                         this.getDocument();
+                        this.getPartList();
                     } else {
                         this.$message({
                             message: res.msg,
@@ -719,7 +729,7 @@
                 if(num == 0){
                     this.documents.mould = array;
                 } else if(num == 1) {
-                    this.documents.part = array;
+                    //this.documents.part = array;
                 } else if(num == 2) {
                     this.documents.check = array;
                 } else if(num == 3) {
@@ -867,6 +877,93 @@
                 })
             },
 
+            //零件新建
+            subPart() {
+                this.editLoading = true;
+                this.http.post( this.port.mold.moulds, {
+                    belongCompanyId: this.user.companyId,
+                    mouldId: this.detailId
+                },
+                res => {
+                    this.editLoading = false;
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: "新建成功",
+                            type: "success"
+                        });
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.editLoading = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            //零件列表
+            getPartList() {
+                this.http.post( this.port.mold.partList, {
+                    mouldId: this.detailId
+                },
+                res => {
+                    if (res.code == "ok") {
+                        this.documents.part = res.data;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            //零件导入
+            uploadPart(file) {
+                var fileObj = params.file;
+                var form = new FormData();
+                form.append("file", fileObj);
+                form.append("blongType", 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.$refs.upload.clearFiles();
+                        this.getDocument();
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
             //获取操作记录
             getOperationRecord(type) {
                 this.http.post( this.port.mold.moldOperationList, { 

+ 1 - 1
ys_vue/src/views/mold/moldList.vue

@@ -43,7 +43,7 @@
             <el-table-column prop="hillNumber" label="电量" align="center" width="100" sortable></el-table-column>
             <el-table-column prop="diffTime" label="倒计时" align="center" width="100" sortable></el-table-column>
             <el-table-column prop="projectName" label="所属项目" width="140" sortable></el-table-column>
-            <el-table-column prop="ownerCompanyName" label="所属资产方" width="300" sortable></el-table-column>
+            <el-table-column prop="companyName" label="所属资产方" width="300" sortable></el-table-column>
             <el-table-column prop="produceCompany" label="所属生产方" width="200" sortable></el-table-column>
             <el-table-column prop="initialModulus" label="初始模次" width="100" align="center" sortable></el-table-column>
             <el-table-column prop="settingLife" label="模次寿命" width="100" align="center" sortable></el-table-column>