Bladeren bron

模具文档删除功能

Reiskuchen 5 jaren geleden
bovenliggende
commit
37d9bd62fa
2 gewijzigde bestanden met toevoegingen van 54 en 18 verwijderingen
  1. 2 1
      ys_vue/src/port.js
  2. 52 17
      ys_vue/src/views/mold/moldDetail.vue

+ 2 - 1
ys_vue/src/port.js

@@ -35,7 +35,8 @@ export default {
         moldFileList: '/mouldfile/list', //获取模具文档*
         moldFileListAll: '/mouldfile/allList', //获取全部模具文档
         moldFileUpload: '/mouldfile/uploadFile', //上传模具文档*
-        moldFileCheck: '/mouldfile/check' //审批模具文档
+        moldFileCheck: '/mouldfile/check', //审批模具文档 
+        moldFileDelete: '/mouldfile/delFile', //项目文档的删除
     },
     // 基础管理
     base: {

+ 52 - 17
ys_vue/src/views/mold/moldDetail.vue

@@ -110,7 +110,7 @@
                   <a :href="scope.row.fileUrl" :download="scope.row.fileName">
                     <el-button size="small" @click="download(scope.row.id)">下载</el-button>
                   </a>
-                  <el-button size="small" type="danger">删除</el-button>
+                  <el-button size="small" @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -138,9 +138,10 @@
               <el-table-column label="操作" width="300" sortable>
                 <template slot-scope="scope">
                   <el-button size="small" @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
-                  <el-button size="small">浏览</el-button>
-                  <el-button size="small" @click="download(scope.row.fileUrl)">下载</el-button>
-                  <el-button size="small" type="danger">删除</el-button>
+                  <a :href="scope.row.fileUrl" :download="scope.row.fileName">
+                    <el-button size="small" @click="download(scope.row.id)">下载</el-button>
+                  </a>
+                  <el-button size="small" @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -168,9 +169,10 @@
               <el-table-column label="操作" width="300" sortable>
                 <template slot-scope="scope">
                   <el-button size="small" @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
-                  <el-button size="small">浏览</el-button>
-                  <el-button size="small" @click="download(scope.row.fileUrl)">下载</el-button>
-                  <el-button size="small" type="danger">删除</el-button>
+                  <a :href="scope.row.fileUrl" :download="scope.row.fileName">
+                    <el-button size="small" @click="download(scope.row.id)">下载</el-button>
+                  </a>
+                  <el-button size="small" @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -198,9 +200,10 @@
               <el-table-column label="操作" width="300" sortable>
                 <template slot-scope="scope">
                   <el-button size="small" @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
-                  <el-button size="small">浏览</el-button>
-                  <el-button size="small" @click="download(scope.row.fileUrl)">下载</el-button>
-                  <el-button size="small" type="danger">删除</el-button>
+                  <a :href="scope.row.fileUrl" :download="scope.row.fileName">
+                    <el-button size="small" @click="download(scope.row.id)">下载</el-button>
+                  </a>
+                  <el-button size="small" @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -228,9 +231,10 @@
               <el-table-column label="操作" width="300" sortable>
                 <template slot-scope="scope">
                   <el-button size="small" @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
-                  <el-button size="small">浏览</el-button>
-                  <el-button size="small" @click="download(scope.row.fileUrl)">下载</el-button>
-                  <el-button size="small" type="danger">删除</el-button>
+                  <a :href="scope.row.fileUrl" :download="scope.row.fileName">
+                    <el-button size="small" @click="download(scope.row.id)">下载</el-button>
+                  </a>
+                  <el-button size="small" @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -258,9 +262,10 @@
               <el-table-column label="操作" width="300" sortable>
                 <template slot-scope="scope">
                   <el-button size="small" @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
-                  <el-button size="small">浏览</el-button>
-                  <el-button size="small" @click="download(scope.row.fileUrl)">下载</el-button>
-                  <el-button size="small" type="danger">删除</el-button>
+                  <a :href="scope.row.fileUrl" :download="scope.row.fileName">
+                    <el-button size="small" @click="download(scope.row.id)">下载</el-button>
+                  </a>
+                  <el-button size="small" @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -410,7 +415,7 @@ export default {
       this.activeFileName = name;
       this.centerDialogVisible = true;
     },
-    //审批
+    //审批文件
     check(adoption) {
       this.http.post(
         this.port.mold.moldFileCheck,
@@ -424,6 +429,7 @@ export default {
               message: "审批成功",
               type: "success"
             });
+            this.getDocument();
           } else {
             this.$message({
               message: res.msg,
@@ -475,6 +481,35 @@ export default {
           });
         }
       );
+    },
+    //文件删除
+    deleteFile(fileId) {
+      this.http.post(
+        this.port.mold.moldFileDelete,
+        {
+          id: fileId
+        },
+        res => {
+          if (res.code == "ok") {
+            this.$message({
+              message: "删除成功",
+              type: "success"
+            });
+            this.getDocument();
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
     }
   },
   created() {