刘恒 1 год назад
Родитель
Сommit
d69ccfd985
1 измененных файлов с 23 добавлено и 10 удалено
  1. 23 10
      src/views/FinancialManagement/ContractManagement/ContractManagement.vue

+ 23 - 10
src/views/FinancialManagement/ContractManagement/ContractManagement.vue

@@ -215,11 +215,11 @@
                 @click.native="handleCommand('watch', scope.row)"
                 >查看附件</el-dropdown-item
               >
-              <el-dropdown-item
+              <!-- <el-dropdown-item
                 command="download"
                 @click.native="handleCommand('download', scope.row)"
                 >下载附件</el-dropdown-item
-              >
+              > -->
               <el-dropdown-item
                 command="error"
                 @click.native="handleCommand('error', scope.row)"
@@ -519,6 +519,7 @@
                 :limit="10"
                 :file-list="form.filePathIdList"
                 :http-request="httpRequest"
+                :on-remove="handleRemove"
                 accept=".pdf,.doc,.docx"
               >
                 <el-button size="small" type="primary">点击上传</el-button>
@@ -805,7 +806,7 @@ export default {
             this.fileIdList =
               res.data.contractFileEntityList != null
                 ? res.data.contractFileEntityList.map((v, i) => {
-                    return v.id;
+                    return v.fileId;
                   })
                 : [];
             if (commad == "supplement") {
@@ -862,6 +863,8 @@ export default {
     //新增
     submit() {
       // console.log(this.form.supplierIdList);
+      // console.log(this.fileIdList);
+
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
           if (this.operation != "supplement") {
@@ -926,11 +929,8 @@ export default {
         this.form.internalType = this.accountObj[id] == "0" ? "内部" : "外部";
       }
     },
-    // 上传的方法Start
-    beforeAvatarUpload(file) {
-      console.log(file);
-    },
-    //上传影像
+
+    //上传附件
     httpRequest(options) {
       let file = options.file;
       let filename = options.filename;
@@ -952,6 +952,19 @@ export default {
         }
       });
     },
+    //删除附件
+    handleRemove(file, fileList) {
+      // console.log(this.form.filePathIdList);
+      // console.log(this.fileIdList);
+      this.fileIdList = [];
+      this.form.filePathIdList = this.form.filePathIdList.filter(
+        (item) => item.uid !== file.uid
+      );
+
+      this.fileIdList = this.form.filePathIdList.map((v, i) => {
+        return v.id;
+      });
+    },
     //获取甲乙方列表
     getInvAccountList() {
       this.$api.contract.getInvAccountList({}).then((res) => {
@@ -1035,14 +1048,14 @@ export default {
 
               filePathIdList: res.data.contractFileEntityList
                 ? res.data.contractFileEntityList.map((v, i) => {
-                    return { name: v.fileName, url: v.url };
+                    return { name: v.fileName, url: v.url, id: v.fileId };
                   })
                 : [],
             };
             this.fileIdList =
               res.data.contractFileEntityList != null
                 ? res.data.contractFileEntityList.map((v, i) => {
-                    return v.id;
+                    return v.fileId;
                   })
                 : [];
           }