From 32f4bb41c82ded759e7db18c9fa449b1442f15c8 Mon Sep 17 00:00:00 2001
From: fujunling <2984387807@qq.com>
Date: 星期三, 21 六月 2023 16:39:12 +0800
Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs

---
 Source/UBCS-WEB/src/components/file/main.vue |  126 +++++++++++++++++++++++++----------------
 1 files changed, 76 insertions(+), 50 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/file/main.vue b/Source/UBCS-WEB/src/components/file/main.vue
index d3a2da1..9e5a099 100644
--- a/Source/UBCS-WEB/src/components/file/main.vue
+++ b/Source/UBCS-WEB/src/components/file/main.vue
@@ -4,8 +4,8 @@
                :table-loading="loading"
                :data="data"
                :page.sync="page"
-               :permission="permissionList"
                :before-open="beforeOpen"
+               :permission="permissionList"
                v-model="form"
                ref="crud"
                @row-del="rowDel"
@@ -17,19 +17,25 @@
                @refresh-change="refreshChange"
                @on-load="onLoad">
       <template slot="menuLeft">
-        <el-button type="primary"
+        <el-button v-if="hasUpload" type="primary"
                    size="small"
                    plain
                    icon="el-icon-upload2"
                    @click="handleUpload">涓� 浼�
         </el-button>
-        <el-button type="primary"
+        <el-button v-if="hasEdit" type="primary"
                    size="small"
                    plain
                    icon="el-icon-edit"
                    @click="handleEdit">淇� 鏀�
         </el-button>
-        <el-button type="danger"
+        <el-button  v-if="hasDownload" type="primary"
+                    size="small"
+                    icon="el-icon-download"
+                    plain
+                    @click="handleDownload">涓� 杞�
+        </el-button>
+        <el-button  v-if="hasDel" type="danger"
                    size="small"
                    icon="el-icon-delete"
                    plain
@@ -37,7 +43,7 @@
         </el-button>
       </template>
       <template slot-scope="scope" slot="menu">
-        <el-button type="text"
+        <el-button v-if="hasDownload" type="text"
                    icon="el-icon-download"
                    size="small"
                    @click="handleDownload(scope.row)">涓嬭浇
@@ -58,6 +64,7 @@
 import {getList, getFile,upload,update, remove,download} from "@/api/resource/file";
 import {mapGetters} from "vuex";
 import {dateFormat} from "@/util/date";
+import {validatenull} from "@/util/validate";
 
 export default {
   props: ["options","visible"],
@@ -74,8 +81,12 @@
       },
       attachBox: false,
       selectionList: [],
+      hasUpload:validatenull(this.options.hasUpload) ? true :this.options.hasUpload,
+      hasEdit:validatenull(this.options.hasEdit) ? true :this.options.hasEdit,
+      hasDel:validatenull(this.options.hasDel) ? true :this.options.hasDel,
+      hasDownload:validatenull(this.options.hasDownload) ? true :this.options.hasDownload,
       option: {
-        height: 'auto',
+        height:(this.options.tableHeight?this.options.tableHeight:'auto'),
         calcHeight: 30,
         tip: false,
         searchShow: true,
@@ -150,25 +161,7 @@
         date: "date",
         refer: "refer",
       },
-      data: [{
-        btmname: "fileobject",
-        createTime: "2023-06-14 16:08:50.002",
-        creator: "1",
-        fileDocClassify: "undefined",
-        fileDocClassifyName: null,
-        fileExtension: "png",
-        filePath: "VolumnFactoryService:/f87a4c92-ce6e-458b-aad0-0c76bd5eeb35\\54120082-76aa-4092-abbf-b13cb40606c5",
-        fileSize: 858,
-        id: "assignRole",
-        name: "assignRole",
-        nameOid: "9FF4C05D-4EFA-F00B-0080-5ABB50257D4E",
-        oid: "54120082-76aa-4092-abbf-b13cb40606c5",
-        ownBtmname: "wupin",
-        ownbizOid: "6EF696C3-CD87-0E7C-1EA1-8DE3913A95C9",
-        owner: "1",
-        secretGrade: null,
-        secretGradeText: null
-      }],
+      data: [],
       attachForm: {},
       attachOption: {
         submitBtn: false,
@@ -203,7 +196,7 @@
           },
           data: {
             ownbizOid:this.options.ownbizOid || "share",
-            ownBtmname:this.options.ownbizBtm || "share",
+            ownBtmName:this.options.ownbizBtm || "share",
             fileDocClassify:this.options.fileDocClassify || "ADMIN_SHARE",
             fileDocClassifyName:this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
           },
@@ -214,13 +207,13 @@
     };
   },
   computed: {
-    ...mapGetters(["permission"]),
+    ...mapGetters([ "permission"]),
     permissionList() {
       return {
         addBtn: false,
-        editBtn: false,
         viewBtn: false,
-        delBtn: this.vaildData(this.permission.attach_delete, false)
+        delBtn: this.vaildData(this.permission.attach_delete, false),
+        editBtn: false
       };
     },
     oids() {
@@ -231,9 +224,12 @@
       return oids.join(",");
     }
   },
-  mounted() {
+  created() {
     this.setFormItem();
     this.setParams()
+  },
+  mounted() {
+
   },
   methods: {
     setFormItem(){
@@ -312,16 +308,27 @@
       }
       return [];
     },
-    setParams(){
+    setParams() {
       var queryMap = {
-        currentButtonKey:'VIEW',
-        ownbizOid:this.options.ownbizOid,
-        ownbizBtm:this.options.ownbizBtm
+        currentButtonKey: 'VIEW',
+        ownbizOid:this.options.ownbizOid || "share",
+        ownBtmName:this.options.ownbizBtm || "share",
+        fileDocClassify: this.options.fileDocClassify|| "ADMIN_SHARE",
+        fileDocClassifyName: this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
       };
-      if(this.options.where){
-        Object.assign(queryMap,this.options.where);
+      if (this.options.where) {
+        Object.assign(queryMap, this.options.where);
       }
-      this.params=queryMap;
+      this.params = queryMap;
+
+      if (!this.options.pageObject) {
+        this.options.pageObject = {
+          limit: 10,
+          page: 1
+        };
+      }
+      this.page.pageSize = this.options.pageObject.limit;
+      this.page.currentPage = this.options.pageObject.page;
     },
     handleUpload() {
       this.attachOption.column[1].data.fileOid='';
@@ -331,10 +338,10 @@
     },
     handleEdit() {
       if(this.selectionList.length==0){
-        this.$message.error('璇烽�夋嫨闇�瑕佷慨鏀圭殑鏂囦欢')
+        this.$message.warning('璇烽�夋嫨闇�瑕佷慨鏀圭殑鏂囦欢')
         return false;
       }else if(this.selectionList.length>1){
-        this.$message.error('璇烽�夋嫨涓�鏉℃暟鎹�')
+        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�')
         return false;
       }
       this.attachOption.column[1].data.fileOid=this.oids;
@@ -346,21 +353,25 @@
       done();
     },
     uploadAfter(res, done, loading, column) {
-      if(res.success){
-        this.attachBox = false;
-        this.$message.success('鏂囦欢涓婁紶鎴愬姛')
-      }else{
-        this.$message.error(res.msg);
-      }
+      this.attachBox = false;
+      this.$message.success('鏂囦欢涓婁紶鎴愬姛')
       this.refreshChange();
       done();
     },
     uploadError(error, column) {
-      this.$message.error('涓婁紶鏂囦欢鍑虹幇浜嗗紓甯�')
+      this.$message.error(error || '涓婁紶鏂囦欢鍑虹幇浜嗗紓甯�')
     },
     handleDownload(row) {
       //window.open(`${row.link}`);
-      download(row.oid)
+      if(row && row.oid){
+        download(row.oid)
+      }else{
+        if (this.selectionList.length === 0) {
+          this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+          return;
+        }
+        download(this.oids);
+      }
     },
     rowDel(row) {
       this.$confirm("纭畾灏嗛�夋嫨鏂囦欢鍒犻櫎?", {
@@ -369,7 +380,7 @@
         type: "warning"
       })
         .then(() => {
-          return remove(row.oid);
+          return remove(row.oid,row.oid);
         })
         .then(() => {
           this.onLoad(this.page);
@@ -390,7 +401,7 @@
         type: "warning"
       })
         .then(() => {
-          return remove(this.oids);
+          return remove(this.oids,this.oids);
         })
         .then(() => {
           this.onLoad(this.page);
@@ -446,9 +457,24 @@
       getList(page.currentPage, page.pageSize, Object.assign(params,this.params, query,this.query)).then(res => {
         const data = res.data.data;
         this.page.total = data.total;
-        this.data = data.records;
+        if(this.options.fileDocClassifyCombox){
+          this.data = data.records.map(item => {
+            if(validatenull(item.fileDocClassifyName)&& !validatenull(item.fileDocClassify)){
+              item.fileDocClassifyName = this.options.fileDocClassifyCombox[item.fileDocClassify] || '';
+            }
+            return {
+              ...item
+            }
+          })
+        }else{
+          this.data = data.records;
+        }
+
         this.loading = false;
         this.selectionClear();
+      }).catch(error=>{
+        this.$message.error(error);
+        this.loading = false;
       });
     }
   }

--
Gitblit v1.9.3