lchao 1 gadu atpakaļ
vecāks
revīzija
fb27fdef9d

+ 14 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClipboardUtil.java

@@ -0,0 +1,14 @@
+package com.ruoyi.web.controller.system;
+
+import java.awt.*;
+import java.awt.datatransfer.*;
+
+public class ClipboardUtil {
+
+    public static void copyToClipboard(String text) {
+        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+        StringSelection selection = new StringSelection(text);
+        clipboard.setContents(selection, null);
+    }
+
+}

+ 12 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysSecretProjectController.java

@@ -79,4 +79,16 @@ public class SysSecretProjectController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(sysSecretProjectService.deleteSysSecretProjectByIds(ids));
     }
+
+    /**
+     * 复制【请填写功能名称】
+     */
+    @PostMapping("/copy")
+    public AjaxResult copySecretKey(@RequestBody SysSecretProject sysSecretProject) {
+        String secretKey = sysSecretProject.getSecretKey();
+        ClipboardUtil.copyToClipboard(secretKey);
+        return AjaxResult.success("字段信息已复制");
+    }
+
+
 }

+ 9 - 0
ruoyi-ui/src/api/system/secret.js

@@ -42,3 +42,12 @@ export function delSecret(id) {
     method: 'delete'
   })
 }
+
+// 复制【请填写功能名称】
+export function copySecret(data) {
+  return request({
+    url: '/system/secret/copy',
+    method: 'post',
+    data: data
+  })
+}

+ 8 - 8
ruoyi-ui/src/views/authority/project/index.vue

@@ -57,14 +57,14 @@
         </el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-        >导出
-        </el-button>
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          plain-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          @click="handleExport"-->
+<!--        >导出-->
+<!--        </el-button>-->
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>

+ 26 - 10
ruoyi-ui/src/views/authority/secret/index.vue

@@ -59,14 +59,14 @@
         </el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-        >导出
-        </el-button>
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          plain-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          @click="handleExport"-->
+<!--        >导出-->
+<!--        </el-button>-->
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -139,7 +139,7 @@
 </template>
 
 <script>
-import {listSecret, getSecret, delSecret, addSecret, updateSecret} from "@/api/system/secret";
+import {listSecret, getSecret, delSecret, addSecret, updateSecret,copySecret} from "@/api/system/secret";
 import {listAllProject} from "@/api/system/project";
 
 export default {
@@ -247,7 +247,23 @@ export default {
     },
     /** 复制按钮操作 */
     handleCopy(row) {
-      alert(row.secretKey)
+      // 获取需要复制的字段信息
+      const secretKey = row.secretKey;
+
+      // 创建一个包含字段信息的文本框元素
+      const textarea = document.createElement("textarea");
+      textarea.value = secretKey;
+      document.body.appendChild(textarea);
+
+      // 选择并复制文本
+      textarea.select();
+      document.execCommand("copy");
+
+      // 移除临时创建的文本框元素
+      document.body.removeChild(textarea);
+
+      // 显示复制成功的消息
+      this.$message.success("字段信息已复制");
     },
     onChange(e) {
       this.form.projectId = e