sunyadv %!s(int64=5) %!d(string=hai) anos
pai
achega
a81d49234d

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldFileController.java

@@ -78,7 +78,7 @@ public class MouldFileController {
     @ApiOperation("零件文档的批量上传")
     @RequestMapping("/uploadPartFileList")
     @ResponseBody
-    public HttpRespMsg uploadFile(@RequestParam(required = false) MultipartFile[] files,UserVO userVO) throws Exception {
+    public HttpRespMsg uploadFile(@RequestParam("file") MultipartFile[] files,UserVO userVO) throws Exception {
         HttpRespMsg msg = new HttpRespMsg();
         msg = mouldFileService.addPartFile(userVO,path, files);
         return msg;

+ 8 - 6
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -365,10 +365,13 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     @Override
     public HttpRespMsg addPartFile(UserVO userVO, String path, MultipartFile[] files) {
         HttpRespMsg msg = new HttpRespMsg();
+        System.out.println("files==============="+files);
+        System.out.println("files==============="+files.length);
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
+        System.out.println("进来了");
         if (user != null) {
             List<Part> partLists = partMapper.selectList(new QueryWrapper<Part>().eq("mould_id", userVO.getMouldId()));
-            if (files.length > 0) {
+            System.out.println("partLists"+partLists);
                 for (MultipartFile file : files) {
                     MouldFile partFile = new MouldFile();
                     partFile.setModelId(userVO.getMouldId());
@@ -380,10 +383,12 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         dir.mkdirs();
                     }
                     String fileName = "";
-                    if (file != null && !file.isEmpty()) {
+                    System.out.println(file);
+                    //if (file != null && !file.isEmpty()) {
                         fileName = file.getOriginalFilename();
                         String fileNamePrex = fileName.substring(0, fileName.lastIndexOf("."));
                         String[] split = fileNamePrex.split("\\+");
+                        System.out.println("split"+split);
                         for (Part part : partLists) {
                             if (split[0] == part.getPartNo()) {
                                 partFile.setPartId(part.getId());
@@ -424,12 +429,9 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         dynamics.setOperatorName(user.getUsername());
                         dynamics.setMouldId(userVO.getMouldId());
                         mouldOperationDynamicsMapper.insert(dynamics);
-                    }
+                    //}
                     msg.data = partFile;
                 }
-            } else {
-                msg.setError("上传文件不可为空");
-            }
         } else {
             msg.setError("用户不存在或者未登录");
         }

+ 2 - 2
cloud-model/src/main/resources/application.properties

@@ -42,8 +42,8 @@ download.path=D:/mould/download/
 #######################################################################################################
 # 配置上传文件的大小设置
 # Single file max size  即单个文件大小
-spring.servlet.multipart.max-file-size=10MB
-spring.servlet.multipart.max-request-size=100MB
+spring.servlet.multipart.max-file-size=1000MB
+spring.servlet.multipart.max-request-size=1000MB
 ##################SpringBoot连接池配置########
 spring.datasource.hikari.minimum-idle=3
 spring.datasource.hikari.maximum-pool-size=10

+ 1 - 0
ys_vue/src/port.js

@@ -56,6 +56,7 @@ export default {
         partList: '/part/list', //零件列表
         addPart: '/part/addOrUpdate', //单个零件添加
         importPart: '/part/importAppLogin',//零件的excel导入
+        partUpload: '/mouldfile/uploadPartFileList', //零件文档的批量上传
 
         moldMaintain: '/mouldmaintain/maintain', //维护
         moldMaintainList: '/mouldmaintain/list' //获取列表

+ 100 - 30
ys_vue/src/views/mold/moldDetail.vue

@@ -85,18 +85,23 @@
             文档资料
 
             <!-- 上传 模具0 零件1 时 -->
-            <el-dropdown trigger="click" style="float:right;" v-show="(activeTab == 0 || activeTab == 1) && update == 1">
+            <el-dropdown trigger="click" style="float:right;" v-show="activeTab == 0 && update == 1">
                 <el-button size="small" type="primary">
                     上传
                     <i class="el-icon-arrow-down el-icon--right"></i>
                 </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>
+            
+            <!-- 上传 模具0 零件1 时 -->
+            <el-button size="small" type="primary" style="float:right;" v-show="activeTab == 1 && update == 1" @click.native="fileType = 0;centerDialog4Visible = true;">
+                上传
+            </el-button>
 
             <!-- 零件1 新建零件 -->
             <el-dropdown trigger="click" style="float:right; margin-right: 10px;" v-show=" activeTab == 1 && update == 1">
@@ -113,7 +118,7 @@
                             :show-file-list="false"
                             :limit="1"
                         >
-                            <el-button size="small" type="primary">批量导入</el-button>
+                            批量导入
                         </el-upload>
                     </el-dropdown-item>
                 </el-dropdown-menu>
@@ -187,27 +192,29 @@
                 <el-tab-pane label="零件文档" name="1">
 
                     <el-table
-                    :data="documents.part"
-                    highlight-current-row
-                    v-loading="listLoading"
-                    style="width: 100%;"
+                        :data="documents.part"
+                        highlight-current-row
+                        v-loading="listLoading"
+                        style="width: 100%;"
                     >
                         <el-table-column type="index" width="40"></el-table-column>
-                        <el-table-column label="零件编号" width="200" sortable></el-table-column>
-                        <el-table-column prop="fileName" label="零件名称" sortable></el-table-column>
-                        <el-table-column label="寿命次数" width="100" sortable></el-table-column>
-                        <el-table-column label="易损件" width="100" sortable></el-table-column>
-                        <el-table-column prop="fileSize" label="大小" width="200" sortable></el-table-column>
-                        <el-table-column prop="uploadtor" label="上传者" width="200" sortable></el-table-column>
+                        <el-table-column prop="partNo" label="零件编号" width="150" sortable></el-table-column>
+                        <el-table-column prop="partName" label="零件名称" sortable></el-table-column>
+                        <el-table-column prop="partLife" label="寿命次数" width="100" sortable></el-table-column>
+                        <el-table-column prop="isVulnerable" label="易损件" width="100" sortable>
+                            <template slot-scope="scope">{{scope.row.isVulnerable==0?'否':'是'}}</template>
+                        </el-table-column>
+                        <el-table-column prop="part3dFile" label="3D图档" width="200" sortable></el-table-column>
+                        <el-table-column prop="part2dFile" label="2D图档" 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>
                             <template slot-scope="scope">
-                            <span v-if="scope.row.state == -2">生产方审核不通过</span>
-                            <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
-                            <span v-else-if="scope.row.state == 0">待双方审核</span>
-                            <span v-else-if="scope.row.state == 1">待生产方审核</span>
-                            <span v-else-if="scope.row.state == 2">待资产方审核</span>
-                            <span v-else-if="scope.row.state == 3">审核通过</span>
+                                <span v-if="scope.row.state == -2">生产方审核不通过</span>
+                                <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
+                                <span v-else-if="scope.row.state == 0">待双方审核</span>
+                                <span v-else-if="scope.row.state == 1">待生产方审核</span>
+                                <span v-else-if="scope.row.state == 2">待资产方审核</span>
+                                <span v-else-if="scope.row.state == 3">审核通过</span>
                             </template>
                         </el-table-column>
                         <el-table-column label="操作" width="200" sortable>
@@ -215,9 +222,12 @@
                                 <el-button size="small" 
                                     v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))" 
                                     @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
-                                <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
-                                    <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
-                                </a>
+                                <el-button size="small" @click="dowloadfile(scope.row.id)" v-if="download == 1 && scope.row.state == 3">
+                                    修改
+                                </el-button>
+                                <el-button size="small" @click="dowloadfile(scope.row.id)" v-if="download == 1 && scope.row.state == 3">
+                                    <a :href="scope.row.fileUrl" :download="scope.row.fileName">下载 </a>
+                                </el-button>
                                 <el-button size="small" 
                                     v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0" 
                                     @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
@@ -409,6 +419,17 @@
             </span>
         </el-dialog>
 
+        <!-- 零件文档上传弹窗 -->
+        <el-dialog title="零件文档上传" v-if="centerDialog4Visible" :visible.sync="centerDialog4Visible" width="30%" :before-close="clearFileRecord" center>
+            <p style="color:#ccc;">文件命名规则:零件编号+2D/3D  如 LJ001+2D.dwg</p>
+            <el-upload ref="upload4" action="uploadFile" :http-request="uploadPartFile" :show-file-list="true" :before-remove="beforeRemove" multiple>
+                <el-button size="small" type="primary">上传</el-button>
+            </el-upload>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="uploadFilePart">确定</el-button>
+            </span>
+        </el-dialog>
+
         <!-- 单个新增零件弹窗 -->
         <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">
@@ -534,6 +555,7 @@
                 centerDialogVisible: false, //审批界面
                 centerDialog2Visible: false, //模具界面
                 centerDialog3Visible: false, //创建零件界面
+                centerDialog4Visible: false, //零件文档上传界面
 
                 listLoading: false,
                 activeTab: 0,
@@ -554,7 +576,9 @@
                     rfid: "",
                     produceCompanyId: "",
                     flag: 1
-                }
+                },
+
+                files: new FormData()
             };
         },
         methods: {
@@ -751,8 +775,10 @@
             //清理报废文档上传窗口中的文件
             clearFileRecord() {
                 this.centerDialog2Visible = false;
+                this.centerDialog4Visible = false;
                 this.$refs.upload1.clearFiles();
                 this.$refs.upload2.clearFiles();
+                this.$refs.upload4.clearFiles();
             },
 
             //审批文件
@@ -930,16 +956,60 @@
             },
 
             //零件导入
-            uploadPart(file) {
+            uploadPart(params) {
                 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.importPart, form,
+                res => {
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: "上传成功",
+                            type: "success"
+                        });
+                        this.$refs.upload.clearFiles();
+                        this.getPartList();
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            //零件文档批量
+            beforeRemove(params) {
+                for(var i in this.files){
+                    if(this.files[i].uid == params.uid) {
+                        this.files.splice(i , 1); 
+                    }
                 }
-                this.http.uploadFile( this.port.mold.moldFileUpload, form,
+            },
+
+            uploadPartFile(params) {
+                //this.files.push(params.file)
+                this.files.append("file", params.file);
+                return false;
+            },
+
+            uploadFilePart() {
+                // var fileObj = this.files;
+                // var form = new FormData();
+                // for(var i in fileObj){
+                //     console.log(fileObj[i])
+                //     form.append("file", fileObj[i]);
+                // }
+                var form = this.files;
+                form.append("mouldId", this.detailId);
+                this.http.uploadFile( this.port.mold.partUpload, form,
                 res => {
                     if (res.code == "ok") {
                         this.$message({
@@ -947,7 +1017,7 @@
                             type: "success"
                         });
                         this.$refs.upload.clearFiles();
-                        this.getDocument();
+                        this.getPartList();
                     } else {
                         this.$message({
                             message: res.msg,