Bladeren bron

cpms优化
附件管理

jiangbiao 1 jaar geleden
bovenliggende
commit
8b982de872

+ 5 - 2
cpms-admin/src/main/java/com/cpms/project/file/controller/TFileController.java

@@ -4,7 +4,6 @@ import com.cpms.common.annotation.Log;
 import com.cpms.common.config.RuoYiConfig;
 import com.cpms.common.core.controller.BaseController;
 import com.cpms.common.core.domain.AjaxResult;
-import com.cpms.common.core.page.TableDataInfo;
 import com.cpms.common.enums.BusinessType;
 import com.cpms.common.utils.StringUtils;
 import com.cpms.common.utils.file.FileUploadUtils;
@@ -18,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -39,6 +39,9 @@ public class TFileController extends BaseController {
     @PreAuthorize("@ss.hasPermi('file:file:list')")
     @GetMapping("/list")
     public AjaxResult list(TFile tFile) {
+        if (tFile.getLinkId() == null || StringUtils.isEmpty(tFile.getLinkName())) {
+            return AjaxResult.success(new ArrayList<TFile>());
+        }
         List<TFile> list = tFileService.selectTFileList(tFile);
         return AjaxResult.success(list);
     }
@@ -93,7 +96,7 @@ public class TFileController extends BaseController {
             tFile.setFileUrl(avatar);
             tFile.setType("1");
             tFile.setpId(pId);
-            tFile.setFileSize(String.valueOf(new BigDecimal(file.getSize()).divide(BigDecimal.valueOf(1024),2, RoundingMode.HALF_DOWN)));
+            tFile.setFileSize(String.valueOf(new BigDecimal(file.getSize()).divide(BigDecimal.valueOf(1024), 2, RoundingMode.HALF_DOWN)));
             tFile.setUploader(getNickname());
             tFile.setUploadDate(new Date());
             tFile.setLinkId(linkId);

+ 1 - 6
cpms-ui/src/views/asset/basedoc/index.vue

@@ -233,10 +233,6 @@
       <input :value="upload.type" hidden name="type"/>
     </form>
 
-    <el-dialog :close-on-click-modal="false" title="附件" :visible.sync="file.open" append-to-body
-               width="70%">
-      <upload-file :linkId="file.linkId" :linkName="file.linkName"/>
-    </el-dialog>
 
   </div>
 </template>
@@ -328,8 +324,7 @@ export default {
   },
   methods: {
     openFileDialog(row) {
-      this.file.open = true;
-      this.file.linkId = row.id;
+      this.$router.push({ path: '/system/file', query: { linkId: row.id, linkName: this.file.linkName }})
     },
     /** 查询资产管理基础文档清单列表 */
     getList() {

+ 12 - 17
cpms-ui/src/views/file/file/uploadFile.vue

@@ -122,7 +122,7 @@
           ref="doc"
           :limit="50"
           :headers="doc.headers"
-          :action="doc.url + '?linkId=' + this.linkId + '&linkName=' + this.linkName + '&pId=' + this.form.pId"
+          :action="doc.url + '?linkId=' + this.$route.query.linkId + '&linkName=' + this.$route.query.linkName + '&pId=' + this.form.pId"
           :disabled="doc.isUploading"
           :on-progress="handleFileDocProgress"
           :on-success="handleFileDocSuccess"
@@ -171,16 +171,6 @@ export default {
   components: {
     Treeselect
   },
-  props: {
-    linkId: {
-      type: Number,
-      required: true
-    },
-    linkName: {
-      type: String,
-      required: true
-    }
-  },
   data() {
     return {
       // 遮罩层
@@ -198,8 +188,8 @@ export default {
       pId: null,
       // 查询参数
       queryParams: {
-        linkId: this.linkId,
-        linkName: this.linkName,
+        linkId: this.$route.query.linkId,
+        linkName: this.$route.query.linkName,
         fileName: null,
         pId: null,
       },
@@ -242,6 +232,11 @@ export default {
     };
   },
   created() {
+    console.log(this.$route.query)
+    if(this.$route.query){
+      this.queryParams.linkId=this.$route.query.linkId
+      this.queryParams.linkName=this.$route.query.linkName
+    }
     this.getList();
   },
   methods: {
@@ -267,8 +262,8 @@ export default {
     /** 查询部门下拉树结构 */
     getTreeselect() {
       let param = {
-        linkId: this.linkId,
-        linkName: this.linkName,
+        linkId: this.$route.query.linkId,
+        linkName: this.$route.query.linkName,
       }
       param.type = 0
       listFile(param).then(response => {
@@ -294,8 +289,8 @@ export default {
         remarks: null,
         fileSize: null,
         type: null,
-        linkId: this.linkId,
-        linkName: this.linkName
+        linkId: this.$route.query.linkId,
+        linkName: this.$route.query.linkName
       };
       this.resetForm("form");
     },

+ 8 - 5
cpms-ui/src/views/onlyoffice/edit.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="report-onlyoffice">
+  <div :style="{height:clientHeight,width:'100%'}">
     <div id="placeholder"></div>
   </div>
 </template>
@@ -11,6 +11,7 @@ export default {
   name: 'OnlyOffice',
   data() {
     return {
+      clientHeight:'700px',
       docEditor: null, //  文档编辑器
       platform: 'desktop', //  查看平台
     }
@@ -21,6 +22,12 @@ export default {
       return this.$route.query
     }
   },
+  created() {
+    //设置表格高度对应屏幕高度
+    this.$nextTick(() => {
+      this.clientHeight = (document.body.clientHeight-90) +'px'
+    });
+  },
   mounted() {
     this.$nextTick(() => {
       switch (this.fileInfo.ot) {
@@ -191,8 +198,4 @@ export default {
 </script>
 
 <style scoped>
-.report-onlyoffice {
-  height: 700px;
-  width: 100%;
-}
 </style>