Jelajahi Sumber

计划下达 上传附件

qukaidi 4 tahun lalu
induk
melakukan
c41214e6fe

+ 68 - 4
src/views/fleet/plans/AddOrUpdate.vue

@@ -1173,10 +1173,40 @@
                   label="上传附件"
                 >
                   <template slot-scope="scope">
-                    <uploadFile
-                      @input="showFile"
-                      v-model="scope.row.attachUrl"
-                    />
+                    <el-upload
+                      class="upload-demo"
+                      :action="uploadImgUrl"
+                      :on-success="
+                        (res, file) => {
+                          handleSucces(scope, res, file);
+                        }
+                      "
+                      :headers="headers"
+                      style="width: 25%; float: left"
+                      :disabled="disabled"
+                      :show-file-list="false"
+                      :limit="1"
+                    >
+                      <el-button
+                        size="small"
+                        type="primary"
+                        :disabled="disabled"
+                        >点击上传</el-button
+                      >
+                    </el-upload>
+                    <el-button
+                      size="small"
+                      type="primary"
+                      @click="checkFile(scope)"
+                      >查看</el-button
+                    >
+                    <el-button
+                      size="small"
+                      type="primary"
+                      :disabled="disabled"
+                      @click="deleteFile(scope)"
+                      >删除</el-button
+                    >
                   </template>
                 </el-table-column>
                 <el-table-column
@@ -1242,6 +1272,7 @@ import { listCorps } from "@/api/basicdata/corps";
 import { listFees } from "@/api/basicdata/fees";
 import UploadFile from "@/components/Uploadfile";
 import Cookies from "js-cookie";
+import { getToken } from "@/utils/auth";
 export default {
   name: "plans",
   props: {
@@ -1353,6 +1384,10 @@ export default {
       fWbuOptions: [],
       ffeeunitidList: [],
       collapses2: [],
+      uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
+      headers: {
+        Authorization: "Bearer " + getToken(),
+      },
     };
   },
   created() {
@@ -1423,6 +1458,35 @@ export default {
         opdata: Date.parse(new Date()),
       });
     },
+     //附件删除
+    deleteFile(scope){
+      this.relevantAttachments[scope.$index].attachName = ''
+      this.relevantAttachments[scope.$index].attachUrl = ''
+      if(this.relevantAttachments[scope.$index].attachUrl === ''){
+        this.$message.success("删除成功")
+      }else{
+        this.$message.error("未知错误,删除失败")
+      }
+    },
+    //附件查看
+    checkFile(scope){
+
+      if(this.relevantAttachments[scope.$index].attachUrl){
+        window.open(this.relevantAttachments[scope.$index].attachUrl)
+      }else{
+        this.$message.error("请上传附件")
+      }
+    },
+    //附件上传
+    handleSucces(scope, res, file) {
+      this.relevantAttachments[scope.$index].attachName = res.fileName;
+      this.relevantAttachments[scope.$index].attachUrl = res.url;
+      if (this.relevantAttachments[scope.$index].attachUrl === "") {
+        this.$message.error("上传失败");
+      } else {
+        this.$message.success("上传成功");
+      }
+    },
     // 添加行
     addRow(tableData, event) {
       var obj = {};

+ 2 - 2
src/views/warehouseBusiness/inStock/index.vue

@@ -2912,7 +2912,7 @@
 <!--              style="font-size: 28px; font-weight: bold;"-->
 <!--            >-->
 <!--            </td>-->
-            <td  width="500"v-if="!fBsdates || !fBstime" colspan="2" style="padding-bottom: 0; font-weight: bold;">入库时间:</td>
+            <td  width="500" v-if="!fBsdates || !fBstime" colspan="2" style="padding-bottom: 0; font-weight: bold;">入库时间:</td>
 
             <td
               v-else
@@ -6061,7 +6061,7 @@ export default {
   height: 50px;
   text-align: center;
   border-right: 1px solid #dfe6ec !important;
-  order-bottom: 1px solid #dfe6ec !important;
+  border-bottom: 1px solid #dfe6ec !important;
   border-bottom: 1px solid #dfe6ec !important;
 }
 .el-table thead th {