From 9a6757109b406fa0c7c1c548d9977702e6df76b6 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 27 七月 2023 19:42:55 +0800
Subject: [PATCH] 提交代码

---
 Source/UBCS-WEB/src/components/file/main.vue |   49 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/file/main.vue b/Source/UBCS-WEB/src/components/file/main.vue
index cfbd438..1aa1f8b 100644
--- a/Source/UBCS-WEB/src/components/file/main.vue
+++ b/Source/UBCS-WEB/src/components/file/main.vue
@@ -65,15 +65,17 @@
 import {mapGetters} from "vuex";
 import {dateFormat} from "@/util/date";
 import {validatenull} from "@/util/validate";
+import func from "@/util/func";
 
 export default {
-  props: ["options","visible"],
+  props: ["options","visible","ownbizOid"],
   data() {
     return {
       form: {},
       query: {},
       params:{},
       loading: false,
+      hasPage:this.options.hasPage||false,
       page: {
         pageSize: 10,
         currentPage: 1,
@@ -86,10 +88,10 @@
       hasDel:validatenull(this.options.hasDel) ? true :this.options.hasDel,
       hasDownload:validatenull(this.options.hasDownload) ? true :this.options.hasDownload,
       option: {
-        height:(this.options.tableHeight?this.options.tableHeight:'auto'),
+        height:(this.options.tableHeight?this.options.tableHeight:'200'),
         calcHeight: 30,
         tip: false,
-        searchShow: true,
+        searchShow: false,
         searchMenuSpan: 6,
         border: true,
         index: true,
@@ -232,6 +234,12 @@
   mounted() {
 
   },
+  watch:{
+    ownbizOid(val){
+      this.setParams()
+      this.refreshChange()
+    }
+  },
   methods: {
     setFormItem(){
       /*this.options.formItems=[{
@@ -312,9 +320,9 @@
     setParams() {
       var queryMap = {
         currentButtonKey: 'VIEW',
-        ownbizOid:this.options.ownbizOid || "share",
-        ownBtmName:this.options.ownbizBtm || "share",
-        fileDocClassify: this.options.fileDocClassify|| "ADMIN_SHARE",
+        ownbizOid: this.options.ownbizOid || "share",
+        ownBtmName: this.options.ownbizBtm || "share",
+        fileDocClassify: this.options.fileDocClassify || "ADMIN_SHARE",
         fileDocClassifyName: this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
       };
       if (this.options.where) {
@@ -330,6 +338,12 @@
       }
       this.page.pageSize = this.options.pageObject.limit;
       this.page.currentPage = this.options.pageObject.page;
+
+      this.attachOption.column[1].data.ownbizOid = this.options.ownbizOid || "share";
+      this.attachOption.column[1].data.ownBtmName = this.options.ownbizBtm || "share";
+      this.attachOption.column[1].data.fileDocClassify = this.options.fileDocClassify || "ADMIN_SHARE";
+      this.attachOption.column[1].data.fileDocClassifyName = this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
+
     },
     handleUpload() {
       this.attachOption.column[1].data.fileOid='';
@@ -367,15 +381,30 @@
       let data=new FormData();
       if(row && row.oid){
         data.append('fileOids',row.oid)
-        download(data)
+        this.downloadFile(data);
       }else{
         if (this.selectionList.length === 0) {
-          this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");x
+          this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
           return;
         }
         data.append('fileOids',this.oids)
-        download(data);
+        this.downloadFile(data);
       }
+    },
+    downloadFile(data){
+      download(data).then(res=>{
+        // console.log(res);
+        if(res){
+          const fileNames = res.headers['content-disposition'].split(";");
+          let characterSet = fileNames[2].split("filename*=")[1];
+          let fileName = decodeURI(fileNames[1].split("filename=")[1],characterSet);  // 涓嬭浇鐨勬枃浠跺悕
+          let blob = new Blob([res.data], {
+            type: res.data.type + ";charset=utf-8",
+          });
+          func.downloadFileByBlob(blob,fileName);
+          window.URL.revokeObjectURL(src); //閲婃斁鎺塨lob瀵硅薄
+        }
+      });
     },
     rowDel(row) {
       this.$confirm("纭畾灏嗛�夋嫨鏂囦欢鍒犻櫎?", {
@@ -448,7 +477,7 @@
       this.page.pageSize = pageSize;
     },
     refreshChange() {
-      this.onLoad(this.page, this.query);
+      this.onLoad(this.page);
     },
     onLoad(page, params={}) {
       this.loading = true;

--
Gitblit v1.9.3