From 79d9fc857559982b00b68b2d709807bdc4cd286f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 11 Apr 2022 10:58:17 +0800
Subject: [PATCH] minio 地址修改

---
 src/views/resource/attach.vue |  131 +++++++++++++++++++++++++++++++------------
 1 files changed, 93 insertions(+), 38 deletions(-)

diff --git a/src/views/resource/attach.vue b/src/views/resource/attach.vue
index 29abbf0..8b8daf5 100644
--- a/src/views/resource/attach.vue
+++ b/src/views/resource/attach.vue
@@ -1,6 +1,13 @@
 <template>
-  <basic-container>
+  <basic-container
+    :class="[
+      'hasButTwo',
+      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
+      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
+    ]"
+  >
     <avue-crud
+      class="tablesss"
       :option="option"
       :table-loading="loading"
       :data="data"
@@ -47,6 +54,14 @@
           @click="handleDownload(scope.row)"
           >下载
         </el-button>
+        <el-button
+          type="text"
+          icon="el-icon-picture-outline-round"
+          size="small"
+          v-show="!fileFormat(scope.row)"
+          @click="seeImages(scope.row)"
+          >预览
+        </el-button>
       </template>
       <template slot-scope="{ row }" slot="attachSize">
         <el-tag>{{ `${row.attachSize} KB` }}</el-tag>
@@ -65,6 +80,15 @@
         :upload-after="uploadAfter"
       >
       </avue-form>
+    </el-dialog>
+
+    <el-dialog
+      title="预览"
+      append-to-body
+      :visible.sync="imgSee"
+      class="see-img-box"
+    >
+      <div class="img" :style="{ background: imgUrl }"></div>
     </el-dialog>
   </basic-container>
 </template>
@@ -86,6 +110,7 @@
         pageSize: 10,
         currentPage: 1,
         total: 0,
+        ...this.$store.state.control.changePageSize
       },
       attachBox: false,
       selectionList: [],
@@ -95,12 +120,13 @@
         tip: false,
         searchShow: true,
         searchMenuSpan: 6,
-        border: false,
+        border: true, //liu
         index: true,
         stripe: true,
         viewBtn: true,
         selection: true,
         dialogClickModal: false,
+        ...this.$store.state.control.clearOtherBut,
         column: [
           {
             label: "附件地址",
@@ -109,9 +135,9 @@
               {
                 required: true,
                 message: "请输入附件地址",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "附件域名",
@@ -121,9 +147,9 @@
               {
                 required: true,
                 message: "请输入附件域名",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "附件名称",
@@ -133,9 +159,9 @@
               {
                 required: true,
                 message: "请输入附件名称",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "附件原名",
@@ -145,9 +171,9 @@
               {
                 required: true,
                 message: "请输入附件原名",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "附件拓展名",
@@ -156,9 +182,9 @@
               {
                 required: true,
                 message: "请输入附件拓展名",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "附件大小",
@@ -168,11 +194,11 @@
               {
                 required: true,
                 message: "请输入附件大小",
-                trigger: "blur",
-              },
-            ],
-          },
-        ],
+                trigger: "blur"
+              }
+            ]
+          }
+        ]
       },
       data: [],
       attachForm: {},
@@ -188,16 +214,18 @@
             loadText: "模板上传中,请稍等",
             span: 24,
             propsHttp: {
-              res: "data",
+              res: "data"
             },
             action:
               "/api/blade-resource/oss/endpoint/put-file-attach?type=" +
               type +
               "&deptid=" +
-              deptid,
-          },
-        ],
+              deptid
+          }
+        ]
       },
+      imgSee: false,
+      imgUrl: ""
     };
   },
   computed: {
@@ -207,18 +235,19 @@
         addBtn: false,
         editBtn: false,
         viewBtn: false,
-        delBtn: this.vaildData(this.permission.attach_delete, false),
+        delBtn: this.vaildData(this.permission.attach_delete, false)
       };
     },
     ids() {
       let ids = [];
-      this.selectionList.forEach((ele) => {
+      this.selectionList.forEach(ele => {
         ids.push(ele.id);
       });
       return ids.join(",");
-    },
+    }
   },
   mounted() {
+    this.$store.commit("setWindowSizeHeightAdd");
     var flag = false,
       i = 0,
       ind = null;
@@ -252,7 +281,7 @@
       this.$confirm("确定将选择数据删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(() => {
           return remove(row.id);
@@ -261,7 +290,7 @@
           this.onLoad(this.page);
           this.$message({
             type: "success",
-            message: "操作成功!",
+            message: "操作成功!"
           });
         });
     },
@@ -273,7 +302,7 @@
       this.$confirm("确定将选择数据删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(() => {
           return remove(this.ids);
@@ -282,14 +311,14 @@
           this.onLoad(this.page);
           this.$message({
             type: "success",
-            message: "操作成功!",
+            message: "操作成功!"
           });
           this.$refs.crud.toggleSelection();
         });
     },
     beforeOpen(done, type) {
       if (["edit", "view"].includes(type)) {
-        getDetail(this.form.id).then((res) => {
+        getDetail(this.form.id).then(res => {
           this.form = res.data.data;
         });
       }
@@ -329,17 +358,43 @@
         page.currentPage,
         page.pageSize,
         Object.assign(params, this.query)
-      ).then((res) => {
+      ).then(res => {
         const data = res.data.data;
         this.page.total = data.total;
         this.data = data.records;
         this.loading = false;
+        this.$store.commit("setWindowSizeHeightAdd");
         this.selectionClear();
       });
     },
-  },
+
+    seeImages(row) {
+      this.imgUrl = "";
+      this.imgUrl = "url(" + row.link + ") center center / contain no-repeat";
+
+      this.imgSee = true;
+    },
+
+    fileFormat(row) {
+      var index = row.link.lastIndexOf(".");
+      var ext = row.link.substr(index + 1);
+
+      return (
+        [
+          "png",
+          "jpg",
+          "jpeg",
+          "bmp",
+          "gif",
+          "webp",
+          "psd",
+          "svg",
+          "tiff"
+        ].indexOf(ext.toLowerCase()) == -1
+      );
+    }
+  }
 };
 </script>
 
-<style>
-</style>
+<style></style>

--
Gitblit v1.9.3