Browse Source

Merge pull request #66 from flipped-aurora/gin-vue-admin_v2_dev

Gin vue admin v2 dev
rainyan 4 years ago
parent
commit
229ad72d8c
3 changed files with 58 additions and 4 deletions
  1. 3 1
      server/Dockerfile
  2. 16 0
      web/src/api/authority.js
  3. 39 3
      web/src/view/superAdmin/authority/authority.vue

+ 3 - 1
server/Dockerfile

@@ -7,7 +7,9 @@ ENV GOPROXY=https://goproxy.io GOPATH=/gopath PATH="${PATH}:/usr/local/go/bin"
 ARG GO_VERSION=1.13.3
 
 # 安装 golang 1.13.3
-RUN wget "https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz" && \
+RUN yum install -y wget && \
+    yum install -y wqy-microhei-fonts wqy-zenhei-fonts && \
+    wget "https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz" && \
     rm -rf /usr/local/go && \
     tar -C /usr/local -xzf "go$GO_VERSION.linux-amd64.tar.gz" && \
     rm -rf *.tar.gz && \

+ 16 - 0
web/src/api/authority.js

@@ -46,6 +46,22 @@ export const createAuthority = (data) => {
     })
 }
 
+// @Tags authority
+// @Summary 拷贝角色
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body api.CreateAuthorityPatams true "拷贝角色"
+// @Success 200 {string} json "{"success":true,"data":{},"msg":"拷贝成功"}"
+// @Router /authority/copyAuthority [post]
+export const copyAuthority = (data) => {
+    return service({
+        url: "/authority/copyAuthority",
+        method: 'post',
+        data
+    })
+}
+
 // @Summary 设置角色资源权限
 // @Security ApiKeyAuth
 // @accept application/json

+ 39 - 3
web/src/view/superAdmin/authority/authority.vue

@@ -17,6 +17,7 @@
         <template slot-scope="scope">
           <el-button @click="opdendrawer(scope.row)" size="small" type="text">设置权限</el-button>
           <el-button @click="addAuthority(scope.row.authorityId)" size="small" type="text">新增子角色</el-button>
+          <el-button @click="copyAuthority(scope.row)" size="small" type="text">拷贝角色</el-button>
           <el-button @click="editAuthority(scope.row)" size="small" type="text">编辑角色</el-button>
           <el-button @click="deleteAuth(scope.row)" size="small" type="text">删除角色</el-button>
 
@@ -72,7 +73,8 @@ import {
   getAuthorityList,
   deleteAuthority,
   createAuthority,
-  updateAuthority 
+  updateAuthority,
+  copyAuthority 
 } from '@/api/authority'
 
 import Menus from '@/view/superAdmin/authority/components/menus'
@@ -97,6 +99,7 @@ export default {
       dialogTitle:"新增角色",
       dialogFormVisible: false,
       apiDialogFlag: false,
+      copyForm: {},
       form: {
         authorityId: '',
         authorityName: '',
@@ -121,6 +124,17 @@ export default {
     Datas
   },
   methods: {
+    // 拷贝角色
+    copyAuthority(row) {
+      this.setOptions()
+      this.dialogTitle = "拷贝角色"
+      this.dialogType = "copy"
+      for(let k in this.form) {
+        this.form[key] = row[key]
+      }
+      this.copyForm = row
+      this.dialogFormVisible = true;
+    }
     opdendrawer(row) {
       this.drawer = true
       this.activeRow = row
@@ -203,8 +217,30 @@ export default {
                 }
               }
               break;
-            default:
-              break;
+              case 'copy': {
+                const data = {
+                  "authority": {
+                      "authorityId": "string",
+                      "authorityName": "string",
+                      "datauthorityId": [],
+                      "parentId": "string",
+                  },
+                      "oldAuthorityId": 0
+                }
+                data.authority.authorityId = this.form.authorityId
+                data.authority.authorityName = this.form.authorityName
+                data.authority.parentId = this.form.parentId
+                data.authority.dataAuthorityId = this. copyForm.dataAuthorityId
+                data.oldAuthorityId = this.copyForm.authorityId
+                const res = await copyAuthority(data)
+                if(res.code == 0) {
+                  this.$message({
+                    type: 'success',
+                    message: '复制成功!'
+                  })
+                  this.getTableData()
+                }
+              }
           }
           
           this.initForm()