From 6e940f67eabe8ae168124dafac6b7430d17c2432 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 23 八月 2023 09:45:30 +0800
Subject: [PATCH] 1.角色管理

---
 src/utils/request.js                     |    2 
 /dev/null                                |   11 
 src/api/basicSettings.js                 |   48 +
 src/views/basicSettings/powerDivider.vue |  710 +++++++++++++++++++++++
 src/views/basicSettings/roleList.vue     | 1006 ++++++++++++---------------------
 src/views/basicSettings/groupList.vue    |    6 
 src/router/index.js                      |    8 
 7 files changed, 1,119 insertions(+), 672 deletions(-)

diff --git a/src/api/basicSettings.js b/src/api/basicSettings.js
index d1c5ee3..11a9d51 100644
--- a/src/api/basicSettings.js
+++ b/src/api/basicSettings.js
@@ -90,24 +90,6 @@
   })
 }
 
-// 瑙掕壊鏂板銆佺紪杈戜繚瀛�
-export function RoleAddUpdateSava(data) {
-  return request({
-    url: 'BasicSetting/RoleAddUpdateSava',
-    method: 'post',
-    params: data
-  })
-}
-
-// 瑙掕壊鍒犻櫎
-export function RoleDeleteSava(data) {
-  return request({
-    url: 'BasicSetting/RoleDeleteSava',
-    method: 'post',
-    params: data
-  })
-}
-
 // 瑙掕壊鏉冮檺瑙掕壊缂栫爜銆佹搷浣滅缂栫爜鏌ヨ鑿滃崟鍙婃寜閽�
 export function RolePermissionSearchRoleMenu(data) {
   return request({
@@ -138,6 +120,7 @@
     data
   })
 }
+
 // 鐝粍淇℃伅鍒楄〃鏌ヨ
 export function GroupData(data) {
   return request({
@@ -146,6 +129,7 @@
     params: data
   })
 }
+
 // 鐝粍鏂板缂栬緫
 export function AddUpdateGroup(data) {
   return request({
@@ -154,6 +138,7 @@
     data
   })
 }
+
 // 鐝粍鍒犻櫎
 export function DeleteGroup(data) {
   return request({
@@ -163,3 +148,30 @@
   })
 }
 
+// 瑙掕壊鍒楄〃鏌ヨ
+export function RoleData(data) {
+  return request({
+    url: 'BasicSetting/RoleData',
+    method: 'get',
+    params: data
+  })
+}
+
+// 瑙掕壊淇濆瓨銆佺紪杈戞柊澧�
+export function RoleAddUpdateSava(data) {
+  return request({
+    url: 'BasicSetting/RoleAddUpdateSava',
+    method: 'post',
+    data
+  })
+}
+
+// 瑙掕壊鍒犻櫎
+export function RoleDeleteSava(data) {
+  return request({
+    url: 'BasicSetting/RoleDeleteSava',
+    method: 'post',
+    params: data
+  })
+}
+
diff --git a/src/router/index.js b/src/router/index.js
index a324776..f1937d4 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -128,11 +128,11 @@
         meta: { code: '1014', title: '鐝粍绠$悊', icon: '', keepAlive: true }
       },
       {
-        path: 'menuList',
-        name: 'menuListCancel',
+        path: 'powerDivider',
+        name: 'powerDividerCancel',
         code: '1015',
-        component: () => import('@/views/basicSettings/menuList'),
-        meta: { code: '1015', title: '鑿滃崟绠$悊', icon: '', keepAlive: true }
+        component: () => import('@/views/basicSettings/powerDivider'),
+        meta: { code: '1015', title: '鏉冮檺鍒嗛厤', icon: '', keepAlive: true }
       }
 
     ]
diff --git a/src/utils/request.js b/src/utils/request.js
index 0c655ce..6bfb054 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -16,7 +16,7 @@
     // do something before request is sent
     config.headers['Token'] = localStorage.getItem('token')
 
-    // config.headers['ruleCode'] = getCookie('ruleCode') // 缂栫爜瑙勫垯
+    config.headers['Menucode'] = getCookie('ruleCode') // 缂栫爜瑙勫垯
     return config
   },
   error => {
diff --git a/src/views/basicSettings/groupList.vue b/src/views/basicSettings/groupList.vue
index 4b7220d..c260af2 100644
--- a/src/views/basicSettings/groupList.vue
+++ b/src/views/basicSettings/groupList.vue
@@ -14,10 +14,10 @@
           style="display: flex;"
         >
           <div class="elForm">
-            <el-form-item label="缁勭粐缂栫爜" style=" display: flex;">
+            <el-form-item label="鐝粍缂栫爜" style=" display: flex;">
               <el-input v-model="form.storg_code" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
-            <el-form-item label="缁勭粐鍚嶇О" style=" display: flex;">
+            <el-form-item label="鐝粍鍚嶇О" style=" display: flex;">
               <el-input v-model="form.storg_name" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
           </div>
@@ -74,7 +74,7 @@
           </el-table-column>
           <el-table-column
             prop="description"
-            label="鐝粍鍚嶇О"
+            label="鎻忚堪"
             sortable="custom"
           >
             <template slot-scope="{row}">
diff --git a/src/views/basicSettings/menuList.vue b/src/views/basicSettings/menuList.vue
deleted file mode 100644
index fad6f6a..0000000
--- a/src/views/basicSettings/menuList.vue
+++ /dev/null
@@ -1,11 +0,0 @@
-<template />
-
-<script>
-export default {
-  name: 'MenuList'
-}
-</script>
-
-<style scoped>
-
-</style>
diff --git a/src/views/basicSettings/powerDivider.vue b/src/views/basicSettings/powerDivider.vue
new file mode 100644
index 0000000..3fe1ff7
--- /dev/null
+++ b/src/views/basicSettings/powerDivider.vue
@@ -0,0 +1,710 @@
+<template>
+  <div>
+    <div class="body" :style="{height:mainHeight+'px'}">
+
+      <div
+        class="elTableDiv"
+      >
+
+        <div style="width: 300px;background:#fff">
+
+          <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;">
+            <div style="display: flex;">
+              <div
+                style="width: 5px;height: 100%;border-radius: 5px;"
+                :style="{background:$store.state.settings.theme}"
+              />
+              <div style="margin-left: 8px;">瑙掕壊鍚嶇О</div>
+            </div>
+
+            <div style="margin-right:10px">
+              <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="rolePlusClick" />
+            </div>
+
+          </div>
+
+          <el-tree
+            ref="treeLeftRef"
+            style="padding: 10px;overflow: auto"
+            :style="{height:(tableHeight-20)+'px'}"
+            :data="treeLeft"
+            node-key="code"
+            highlight-current
+            :props="defaultPropsLeft"
+            :default-expand-all="true"
+            :expand-on-click-node="false"
+            draggable
+            :allow-drop="treeLeftAllowDrop"
+            @node-click="treeLeftNodeClick"
+          >
+            <span slot-scope="{ node, data }" class="custom-tree-node">
+              <span v-if="!data.isEdit">{{ node.label }}</span>
+              <input
+                v-if="data.isEdit"
+                :ref="data.code"
+                v-model="data.name"
+                type="text"
+                @click.stop
+                @blur="roleSave(data)"
+                @keyup.enter="roleSave(data)"
+              >
+
+              <span v-if="!data.isEdit&&data.identifying!=='0'&&data.identifying!=='1'">
+                <i
+                  v-if="data.code!=='000'"
+                  class="el-icon-edit"
+                  style="margin-right:10px;color: #999"
+                  @click.stop="val=>roleEditClick(val,node,data)"
+                />
+                <i
+                  v-if="data.code!=='000'"
+                  class="el-icon-delete"
+                  style="margin-right: 4px;color: #999"
+                  @click.stop="val=>roleDeleteClick(val,node,data)"
+                />
+              </span>
+            </span>
+          </el-tree>
+        </div>
+
+        <div
+          style="margin-left: 10px;width:100%;position: relative"
+        >
+
+          <el-button
+            style="position: absolute;right: 15px;z-index:1;top:3px"
+            type="primary"
+            @click="saveClick"
+          >淇� 瀛�
+          </el-button>
+
+          <el-tabs v-model="activeName" type="border-card">
+            <el-tab-pane label="PC绔�" name="PC">
+              <div style="display: flex;">
+
+                <div
+                  ref="scrollLeft"
+                  style="border-right: 1px solid rgba(0,0,0,0.2);width: 200px;
+                  overflow-y: auto;overflow-x:hidden;"
+                  :style="{height:(tableHeight-40)+'px'}"
+                  @scroll="scrollLeftScroll()"
+                  @mouseover="isScroll='left'"
+                >
+                  <div style=" ">
+                    <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鑿滃崟鏉冮檺
+                  </div>
+
+                  <el-tree
+                    ref="treeCenterRef"
+                    style="padding-top: 10px;width: 199px;"
+                    :data="treeCenter"
+                    highlight-current
+                    :props="defaultPropsCenter"
+                    show-checkbox
+                    node-key="menucode"
+                    :default-expand-all="true"
+                    @check-change="handleTreeCenterCheckChange"
+                    @check="handleTreeCenterCheck"
+                    @node-click="getLeftTreeNode"
+                  />
+                </div>
+
+                <div
+                  ref="scrollCenter"
+                  style="border-right: 1px solid rgba(0,0,0,0.2);width: 660px;padding-left: 10px;overflow-y: auto"
+                  :style="{height:(tableHeight-40)+'px'}"
+                  @scroll="scrollCenterScroll()"
+                  @mouseover="isScroll='center'"
+                >
+                  <div style=" ">
+                    <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鎸夐挳鏉冮檺
+                  </div>
+
+                  <el-checkbox
+                    v-model="buttonIsChecked"
+                    style="height: 26px;display:flex;align-items: center;margin-top:10px;width:200px"
+                    @change="val=>handleCheckAllChange(val,'button')"
+                  >鍏ㄩ��
+                  </el-checkbox>
+
+                  <div v-if="treeCenter.length>0">
+                    <div v-for="(item,index) in treeCenter[0].children" :key="item.menucode">
+
+                      <div
+                        v-if="!item.buttoncodelist"
+                        style="margin-left: 40px;height:26px;display: flex;"
+                      />
+
+                      <el-checkbox-group
+                        v-for="it in item.children"
+                        v-if="item.expanded"
+                        :key="it.menucode"
+                        v-model="it.buttonChecked"
+                        style="margin-left: 40px;height:26px;display: flex;"
+                        @change="val=>handleCheckedButtonChange(val,index,it.menucode,it.buttonChecked)"
+                      >
+
+                        <el-checkbox
+                          v-for="i in it.buttoncodelist"
+                          :key="i"
+                          :label="i"
+                          style="display:flex;align-items: center;"
+                        />
+                      </el-checkbox-group>
+
+                    </div>
+
+                  </div>
+
+                </div>
+
+                <div
+                  ref="scrollRight"
+                  style="width: 360px;padding-left: 10px;overflow-y: auto"
+                  :style="{height:(tableHeight-40)+'px',}"
+                  @scroll="scrollRightScroll()"
+                  @mouseover="isScroll='right'"
+                >
+                  <div style=" ">
+                    <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鏁版嵁鏉冮檺
+                  </div>
+
+                  <el-checkbox
+                    v-model="dataIsChecked"
+                    style="height: 26px;display:flex;align-items: center;margin-top:10px;width:200px"
+                    @change="val=>handleCheckAllChange(val,'data')"
+                  >鍏ㄩ��
+                  </el-checkbox>
+
+                  <div v-if="treeCenter.length>0">
+                    <div v-for="item in treeCenter[0].children" :key="item.menucode">
+                      <div
+                        v-if="!item.datacodelist"
+                        style="margin-left: 40px;height:26px;display: flex;"
+                      />
+
+                      <el-radio-group
+                        v-for="it in item.children"
+                        v-if="item.expanded"
+                        :key="it.menucode"
+                        v-model="it.dataChecked"
+                        style="margin-left: 40px;height:26px;display: flex"
+                        @change="val=>handleCheckedDataChange(val,it.menucode)"
+                      >
+                        <el-radio
+                          v-for="i in it.datacodelist"
+                          :key="i"
+                          style="display:flex;align-items: center"
+                          :label="i"
+                        />
+                      </el-radio-group>
+                    </div>
+
+                  </div>
+
+                </div>
+
+              </div>
+            </el-tab-pane>
+            <el-tab-pane label="APP绔�" name="APP">澶уぇ</el-tab-pane>
+            <el-tab-pane label="宸ユ帶绔�" name="宸ユ帶绔�">宸ユ帶绔�</el-tab-pane>
+          </el-tabs>
+
+        </div>
+
+      </div>
+
+    </div>
+
+  </div>
+</template>
+
+<script>
+import waves from '@/directive/waves'
+import {
+  RoleAddUpdateSava, RoleDeleteSava,
+  RolePermissionSava,
+  RolePermissionSearchRole,
+  RolePermissionSearchRoleMenu,
+  RolePermissionSearchRoleMenuButton
+} from '@/api/basicSettings'
+import arrayToTree from 'array-to-tree'
+import { throttle } from '@/utils/debounceAndThrottle'
+import { DataPermissions } from '@/api/GeneralBasicData'
+
+export default {
+  name: 'RoleList',
+  directives: { waves },
+  data() {
+    return {
+      mainHeight: 0,
+      tableHeight: 0,
+
+      treeLeft: [], // 宸︿晶鏍�
+      treeCenter: [], // 涓棿鏍�
+      defaultPropsLeft: {
+        children: 'roles',
+        label: 'name'
+      },
+      defaultPropsCenter: {
+        children: 'children',
+        label: 'menuname'
+      },
+      activeName: 'PC',
+
+      buttonIsChecked: false,
+      dataIsChecked: false,
+
+      menuCheckedCodeArr: [], // 鑿滃崟鏉冮檺鏁扮粍閫変腑鐨�
+
+      allButtonData: [], // 鎵�鏈夎彍鍗曞搴旂殑鎸夐挳鏉冮檺鍔犳暟鎹潈闄�
+
+      isScroll: 'left',
+
+      dataKeyValue: []// 鏁版嵁鏉冮檺閿�煎
+
+    }
+  },
+  watch: {
+    treeLeft: {
+      handler(newValue, oldValue) {
+        newValue[0].roles.forEach(i => {
+          if (i.isEdit) {
+            this.$nextTick(() => {
+              this.$refs[i.code].focus()
+            })
+          }
+        })
+      },
+      deep: true
+    }
+  },
+
+  created() {
+  },
+  mounted() {
+    window.addEventListener('resize', this.getHeight)
+    this.getHeight()
+
+    this.getRolePermissionSearchRole()
+  },
+  methods: {
+
+    // 鑾峰彇瑙掕壊鏉冮檺鏌ヨ瑙掕壊
+    async getRolePermissionSearchRole() {
+      const { data: res } = await RolePermissionSearchRole()
+      res[0].roles.forEach(i => {
+        i.isEdit = false
+      })
+
+      this.treeLeft = res
+
+      if (res && res.length > 0) {
+        this.$nextTick(() => { // 榛樿閫変腑绗竴涓�
+          this.$refs.treeLeftRef.setCurrentKey(res[0].roles[0].code) // 榛樿閫変腑鑺傜偣绗竴涓�
+        })
+
+        await this.getDataPermissions()// 鑾峰彇鏁版嵁鏉冮檺閿�煎
+        await this.getRolePermissionSearchRoleMenuButton(res[0].roles[0].code)// 鐢ㄤ簬鏁版嵁鍥炴樉
+
+        await this.getRolePermissionSearchRoleMenu(res[0].roles[0].code)// 鐢ㄤ簬娓叉煋椤甸潰
+      } else {
+        this.$notify.error('璇峰厛寤虹浉瀵瑰簲鐨勮鑹诧紒')
+      }
+    },
+    async getDataPermissions() {
+      const { data: res } = await DataPermissions()
+      this.dataKeyValue = res
+    },
+
+    // 鑾峰彇鑿滃崟鏉冮檺瀵瑰簲鐨勬寜閽�
+    async getRolePermissionSearchRoleMenuButton(rolecode) {
+      const { data: res } = await RolePermissionSearchRoleMenuButton({ rolecode, type: this.activeName })
+      this.allButtonData = res.length > 0 ? JSON.parse(res[0].jsondate) : []
+    },
+    // 鑾峰彇鑿滃崟鏉冮檺
+    async getRolePermissionSearchRoleMenu(rolecode) {
+      const { data: res } = await RolePermissionSearchRoleMenu({ rolecode, type: this.activeName })
+
+      // 鎷垮埌鏁扮粍list杞崲鎴愭爲褰ree
+      const result = arrayToTree(res, {
+        parentProperty: 'parent_id',
+        customID: 'menucode',
+        childrenProperty: 'children'
+      })
+
+      this.treeCenter = [
+        { menucode: '-1', menuname: '鍏ㄩ儴', children: result }
+      ]
+
+      this.treeCenter[0].children.forEach(item => {
+        if (item.children && item.children.length) {
+          item.children.forEach(it => {
+            it.buttoncodelist = it.buttoncodelist !== '' && it.buttoncodelist !== null ? it.buttoncodelist.split(',') : []
+            if (it.buttoncodelist && it.buttoncodelist.length > 0) {
+              it.buttoncodelist = this.$ButtonData.filter(j =>
+                it.buttoncodelist.includes(j.buttoncode)
+              )
+
+              it.buttoncodelist = it.buttoncodelist.map(j => j.buttonname)
+            }
+
+            it.datacodelist = it.datacodelist ? it.datacodelist.split(',') : []
+            if (it.datacodelist && it.datacodelist.length > 0) {
+              it.datacodelist = this.dataKeyValue.filter(j =>
+                it.datacodelist.includes(j.datacode)
+              ).map(j => j.dataname)
+            }
+          })
+
+          item.expanded = true
+        }
+      })
+
+      this.handleData()// 澶勭悊鏁版嵁鍥炴樉
+    },
+    // 澶勭悊缁勫悎鏁版嵁
+    handleData() {
+      this.menuCheckedCodeArr = this.allButtonData.map(i => i.menucode)
+      this.$nextTick(() => {
+        this.$refs.treeCenterRef.setCheckedKeys(this.menuCheckedCodeArr)
+      })
+
+      this.treeCenter[0].children.forEach(item => {
+        if (item.children && item.children.length) {
+          item.children.forEach(it => {
+            let temp = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].buttoncode : []
+            temp = temp.length > 0 ? temp.split(',') : []
+            it.buttonChecked = [] // 鏁版嵁鍥炴樉
+            this.$ButtonData.forEach(j => {
+              if (temp.includes(j.buttoncode)) {
+                it.buttonChecked.push(j.buttonname)
+              }
+            })
+
+            const datacode = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].datacode : ''
+            it.dataChecked = datacode ? this.dataKeyValue.find(j => j.datacode === datacode).dataname : '' // 鏁版嵁鍥炴樉
+          })
+        }
+      })
+
+      this.handleCheckedButtonChange('', '', '', '', true)
+      this.handleCheckedDataChange('', '', true)
+      // this.$forceUpdate()
+    },
+
+    // 宸﹁竟婊氬姩鏉℃粦鍔ㄦ椂
+    scrollLeftScroll() {
+      if (this.isScroll === 'left') {
+        this.$refs.scrollCenter.scrollTop = this.$refs.scrollLeft.scrollTop
+        this.$refs.scrollRight.scrollTop = this.$refs.scrollLeft.scrollTop
+      }
+    },
+    // 涓棿杈规粴鍔ㄦ潯婊戝姩鏃�
+    scrollCenterScroll() {
+      if (this.isScroll === 'center') {
+        this.$refs.scrollLeft.scrollTop = this.$refs.scrollCenter.scrollTop
+        this.$refs.scrollRight.scrollTop = this.$refs.scrollCenter.scrollTop
+      }
+    },
+    // 鍙充晶婊氬姩鏉℃粦鍔ㄦ椂
+    scrollRightScroll() {
+      if (this.isScroll === 'right') {
+        this.$refs.scrollLeft.scrollTop = this.$refs.scrollRight.scrollTop
+        this.$refs.scrollCenter.scrollTop = this.$refs.scrollRight.scrollTop
+      }
+    },
+    // 鍏ㄩ�夋敼鍙�
+    handleCheckAllChange(val, belong) {
+      const checkedKeys = this.$refs.treeCenterRef.getCheckedKeys()
+
+      if (val) {
+        this.treeCenter[0].children.forEach(item => {
+          if (item.children && item.children.length) {
+            item.children.forEach(it => {
+              if (checkedKeys.includes(it.menucode)) {
+                if (belong === 'button') {
+                  it.buttonChecked = it.buttoncodelist
+                }
+                if (belong === 'data') {
+                  it.dataChecked = '鍏ㄩ儴'
+                }
+              }
+            })
+          }
+        })
+      } else {
+        this.treeCenter[0].children.forEach(item => {
+          if (item.children && item.children.length) {
+            item.children.forEach(it => {
+              if (checkedKeys.includes(it.menucode)) {
+                if (belong === 'button') {
+                  it.buttonChecked = []
+                }
+                if (belong === 'data') {
+                  it.dataChecked = ''
+                }
+              }
+            })
+          }
+        })
+      }
+    },
+    // 鍗曚釜鎸夐挳鏀瑰彉
+    handleCheckedButtonChange(oldValue, index, code, newValue, flag) {
+      // console.log(oldValue, index, code, newValue, 2)
+      // 鍒ゆ柇鏄惁鍖呭惈鍦ㄥ唴
+      if (!flag) {
+        if (!this.menuCheckedCodeArr.includes(code) && oldValue.length === 0 && newValue.length === 1) { // 鍚�
+          this.menuCheckedCodeArr.push(code)
+        } else if (this.menuCheckedCodeArr.includes(code) && oldValue.length === 1 && newValue.length === 0) { // 鏄�
+          // 褰撴暟鎹潈闄愭湭鍕鹃�夋椂鍒欒繃婊ゆ帀鐩稿搴旂殑鑿滃崟
+          if (this.treeCenter[0].children[index].children.find(i => i.menucode === code).dataChecked.toString().length < 1) {
+            this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== code)
+          }
+        }
+        this.$refs.treeCenterRef.setCheckedKeys(this.menuCheckedCodeArr)
+      }
+
+      // 杩欓噷鏄垽鏂叏閫塩heckbox 鏄惁閫変腑
+      let count = 0
+      let childrenLength = 0
+      this.treeCenter[0].children.forEach(item => {
+        if (item.children && item.children.length) {
+          item.children.forEach(it => {
+            if (it.buttonChecked && it.buttonChecked.length === it.buttoncodelist.length && it.buttoncodelist.length > 0) {
+              count++
+            }
+
+            if (it.buttoncodelist.length) {
+              childrenLength++
+            }
+          })
+        }
+      })
+
+      this.buttonIsChecked = count === childrenLength
+      this.$forceUpdate()
+    },
+    // 鑾峰彇鏍戝舰鑺傜偣node
+    getLeftTreeNode(data, Node, VueComponent) {
+      this.treeCenter[0].children.forEach(item => {
+        if (item.menucode === data.menucode) {
+          item.expanded = Node.expanded
+        }
+      })
+      if (data.menucode === '-1') {
+        Node.expanded = true // 鏆傛椂鍏堝啓鎴愯繖涓�
+      }
+      this.$forceUpdate()
+    },
+    // 澶勭悊涓棿鏍戝舰鍕鹃��
+    handleTreeCenterCheck(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) {
+      // console.log(obj, checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys, '鍔犲瀹�')
+
+      if (checkedKeys.length === 0) { // 鏍戝舰鑿滃崟鍏ㄤ笉閫夌殑鎯呭喌涓�
+        this.buttonIsChecked = false
+        this.dataIsChecked = false
+        this.menuCheckedCodeArr = []
+      } else {
+        if (checkedKeys.includes(obj.menucode)) { // 鍒ゆ柇鏄惁鍖呭惈鍦ㄥ唴   //鏄�
+          this.menuCheckedCodeArr.push(obj.menucode)
+        } else { // 鍚�
+          this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== obj.menucode)
+        }
+      }
+    },
+    // 澶勭悊涓棿鏍戝舰閫変腑鍊兼敼鍙�
+    handleTreeCenterCheckChange(obj, selfChecked, selfChildrenTreeCheck) {
+      // console.log(obj, selfChecked, selfChildrenTreeCheck, '鐜嬭�佸悏')
+      if (!selfChildrenTreeCheck) {
+        if (!selfChecked) { // 浠庨�変腑鍒颁笉閫変腑
+          obj.buttonChecked = []
+          obj.dataChecked = ''
+          this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== obj.menucode)
+        }
+        if (selfChecked) { // 浠庝笉閫変腑鍒伴�変腑
+          obj.buttonCheckedCode = []
+          this.treeCenter[0].children.forEach(item => {
+            if (item.children && item.children.length) {
+              item.children.forEach(it => {
+                if (it.menucode === obj.menucode) {
+                  this.menuCheckedCodeArr.push(obj.menucode)
+                }
+              })
+            }
+          })
+        }
+
+        this.$forceUpdate()
+      }
+    },
+    // 鍗曢�夋鎸夐挳鏀瑰彉
+    handleCheckedDataChange(value, code, flag) {
+      // console.log(value, code)
+      if (!flag) {
+        this.menuCheckedCodeArr.push(code)
+        this.menuCheckedCodeArr = [...new Set(this.menuCheckedCodeArr)]
+        this.$refs.treeCenterRef.setCheckedKeys(this.menuCheckedCodeArr)
+      }
+      // 杩欓噷鏄垽鏂叏閫塺adio 鏄惁閫変腑
+      let count = 0
+      let childrenLength = 0
+      this.treeCenter[0].children.forEach(item => {
+        if (item.children && item.children.length) {
+          item.children.forEach(it => {
+            if (it.dataChecked.length > 0 && it.datacodelist.length > 0) {
+              count++
+            }
+            // console.log(it.dataChecked, 234)
+            if (it.datacodelist.length > 0) {
+              childrenLength++
+            }
+          })
+        }
+      })
+      // console.log(count, childrenLength, 123)
+      this.dataIsChecked = count === childrenLength
+      this.$forceUpdate()
+    },
+    // 瑙掕壊鍒囨崲
+    async treeLeftNodeClick(obj, Node, VueComponent) {
+      if (obj.code !== '000') {
+        await this.getRolePermissionSearchRoleMenuButton(obj.code)
+        // await this.getRolePermissionSearchRoleMenu(obj.code)
+        this.handleData()
+      }
+    },
+    // 瑙掕壊鍚嶇О鏂板
+    rolePlusClick() {
+      this.treeLeft[0].roles.push({ code: '', name: '', isEdit: true })
+    },
+    // 瑙掕壊鍚嶇О淇敼
+    roleEditClick(self, node, data) {
+      // console.log(self, node, data)
+      this.treeLeft[0].roles.forEach(i => {
+        i.isEdit = false
+      })
+      data.isEdit = !data.isEdit
+    },
+    // 瑙掕壊鍚嶇О鍒犻櫎
+    roleDeleteClick(self, node, data) {
+      // console.log(self, node, data)
+      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        const D = {
+          rolecode: data.code,
+          rolename: data.name,
+          type: this.activeName
+        }
+        RoleDeleteSava(D).then(res => {
+          if (res.code === '200') {
+            this.$notify.success('瑙掕壊鍒犻櫎鎴愬姛锛�')
+          }
+          this.getRolePermissionSearchRole()
+        })
+      }).catch(() => {
+        this.$notify.info('宸插彇娑堝垹闄�')
+      })
+    },
+    // 瑙掕壊鍚嶇О淇濆瓨   閲囩敤闃叉姈褰㈠紡
+    roleSave: throttle(function(val) {
+      val.isEdit = false
+
+      if (val.name.trim().length === 0) {
+        this.getRolePermissionSearchRole()
+        return this.$notify.info('鏃犳晥淇濆瓨锛�')
+      }
+
+      const data = {
+        rolecode: val.code,
+        rolename: val.name,
+        type: val.code === '' ? 'Add' : 'Update'
+      }
+      console.log(data, '鎵ц浜嗭紒')
+      RoleAddUpdateSava(data).then(res => {
+        if (res.code === '200') {
+          this.$notify.success(val.code === '' ? '瑙掕壊鏂板鎴愬姛锛�' : '瑙掕壊淇敼鎴愬姛锛�')
+        }
+      })
+      this.getRolePermissionSearchRole()
+    }, 1000, true),
+
+    // 椤甸潰鍕鹃�夊ソ淇濆瓨浜嬩欢
+    async saveClick() {
+      const menuKeyArr = this.$refs.treeCenterRef.getCheckedKeys()
+      const arr = []
+      this.treeCenter[0].children.forEach(item => {
+        if (item.children && item.children.length) {
+          item.children.forEach(it => {
+            if (menuKeyArr.includes(it.menucode)) {
+              if (it.buttoncodelist.length > 0 && it.buttoncodelist && it.dataChecked && it.dataChecked.toString().length > 0) { // 鏁版嵁鏉冮檺宸插嬀閫�
+                it.dataCheckedCode = this.dataKeyValue.find(i => i.dataname === it.dataChecked).datacode
+              }
+
+              if (it.buttonChecked && it.buttonChecked.length > 0) { // 宸查�夎彍鍗�
+                it.buttonCheckedCode = this.$ButtonData.filter(i =>
+                  it.buttonChecked.includes(i.buttonname)
+                ).map(i => i.buttoncode)
+              }
+              arr.push({
+                menucode: it.menucode,
+                datacode: it.dataCheckedCode !== undefined ? it.dataCheckedCode : '',
+                buttoncode: it.buttonCheckedCode ? it.buttonCheckedCode.join(',') : ''
+              })
+            }
+          })
+        }
+      })
+
+      const rolecode = this.$refs.treeLeftRef.getCurrentKey()
+      const res = await RolePermissionSava(JSON.stringify(arr), rolecode, this.activeName)
+      if (res.code === '200') {
+        const rolename = this.treeLeft[0].roles.find(i => i.code === rolecode).name
+        this.$notify.success(rolename + '鐨勮鑹叉潈闄愭彁浜ゆ垚鍔燂紒')
+        await this.getRolePermissionSearchRoleMenuButton(rolecode)
+      }
+    },
+    // 鑾峰彇椤甸潰楂樺害
+    getHeight() {
+      this.$nextTick(() => {
+        this.mainHeight = window.innerHeight - 85
+        this.tableHeight = this.mainHeight - 50
+      })
+    },
+    // 宸︿晶鏍戝舰鎷栧姩澶勭悊
+    treeLeftAllowDrop(draggingNode, dropNode, type) {
+      // console.log(draggingNode, dropNode, type)
+      // 娉ㄦ帀鐨勬槸鍚岀骇鎷栨嫿
+      if (draggingNode.level === dropNode.level) {
+        return type === 'prev' || type === 'next'
+      } else {
+        // 涓嶅悓绾ц繘琛屽鐞�
+        return false
+      }
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.custom-tree-node {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  font-size: 14px;
+  padding-right: 8px;
+}
+
+::v-deep .el-checkbox__label {
+  width: 55px;
+}
+
+.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover {
+  color: #000 !important;
+}
+</style>
diff --git a/src/views/basicSettings/roleList.vue b/src/views/basicSettings/roleList.vue
index 3fe1ff7..61812af 100644
--- a/src/views/basicSettings/roleList.vue
+++ b/src/views/basicSettings/roleList.vue
@@ -1,710 +1,446 @@
 <template>
   <div>
     <div class="body" :style="{height:mainHeight+'px'}">
+      <div class="bodyTopButtonGroup" style="justify-content: space-between">
+        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+      </div>
 
-      <div
-        class="elTableDiv"
-      >
-
-        <div style="width: 300px;background:#fff">
-
-          <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;">
-            <div style="display: flex;">
-              <div
-                style="width: 5px;height: 100%;border-radius: 5px;"
-                :style="{background:$store.state.settings.theme}"
-              />
-              <div style="margin-left: 8px;">瑙掕壊鍚嶇О</div>
-            </div>
-
-            <div style="margin-right:10px">
-              <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="rolePlusClick" />
-            </div>
-
-          </div>
-
-          <el-tree
-            ref="treeLeftRef"
-            style="padding: 10px;overflow: auto"
-            :style="{height:(tableHeight-20)+'px'}"
-            :data="treeLeft"
-            node-key="code"
-            highlight-current
-            :props="defaultPropsLeft"
-            :default-expand-all="true"
-            :expand-on-click-node="false"
-            draggable
-            :allow-drop="treeLeftAllowDrop"
-            @node-click="treeLeftNodeClick"
-          >
-            <span slot-scope="{ node, data }" class="custom-tree-node">
-              <span v-if="!data.isEdit">{{ node.label }}</span>
-              <input
-                v-if="data.isEdit"
-                :ref="data.code"
-                v-model="data.name"
-                type="text"
-                @click.stop
-                @blur="roleSave(data)"
-                @keyup.enter="roleSave(data)"
-              >
-
-              <span v-if="!data.isEdit&&data.identifying!=='0'&&data.identifying!=='1'">
-                <i
-                  v-if="data.code!=='000'"
-                  class="el-icon-edit"
-                  style="margin-right:10px;color: #999"
-                  @click.stop="val=>roleEditClick(val,node,data)"
-                />
-                <i
-                  v-if="data.code!=='000'"
-                  class="el-icon-delete"
-                  style="margin-right: 4px;color: #999"
-                  @click.stop="val=>roleDeleteClick(val,node,data)"
-                />
-              </span>
-            </span>
-          </el-tree>
-        </div>
-
-        <div
-          style="margin-left: 10px;width:100%;position: relative"
+      <div class="bodyTopFormGroup">
+        <el-form
+          ref="form"
+          :model="form"
+          label-width="100px"
+          inline
+          style="display: flex;"
         >
-
-          <el-button
-            style="position: absolute;right: 15px;z-index:1;top:3px"
-            type="primary"
-            @click="saveClick"
-          >淇� 瀛�
-          </el-button>
-
-          <el-tabs v-model="activeName" type="border-card">
-            <el-tab-pane label="PC绔�" name="PC">
-              <div style="display: flex;">
-
-                <div
-                  ref="scrollLeft"
-                  style="border-right: 1px solid rgba(0,0,0,0.2);width: 200px;
-                  overflow-y: auto;overflow-x:hidden;"
-                  :style="{height:(tableHeight-40)+'px'}"
-                  @scroll="scrollLeftScroll()"
-                  @mouseover="isScroll='left'"
-                >
-                  <div style=" ">
-                    <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鑿滃崟鏉冮檺
-                  </div>
-
-                  <el-tree
-                    ref="treeCenterRef"
-                    style="padding-top: 10px;width: 199px;"
-                    :data="treeCenter"
-                    highlight-current
-                    :props="defaultPropsCenter"
-                    show-checkbox
-                    node-key="menucode"
-                    :default-expand-all="true"
-                    @check-change="handleTreeCenterCheckChange"
-                    @check="handleTreeCenterCheck"
-                    @node-click="getLeftTreeNode"
-                  />
-                </div>
-
-                <div
-                  ref="scrollCenter"
-                  style="border-right: 1px solid rgba(0,0,0,0.2);width: 660px;padding-left: 10px;overflow-y: auto"
-                  :style="{height:(tableHeight-40)+'px'}"
-                  @scroll="scrollCenterScroll()"
-                  @mouseover="isScroll='center'"
-                >
-                  <div style=" ">
-                    <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鎸夐挳鏉冮檺
-                  </div>
-
-                  <el-checkbox
-                    v-model="buttonIsChecked"
-                    style="height: 26px;display:flex;align-items: center;margin-top:10px;width:200px"
-                    @change="val=>handleCheckAllChange(val,'button')"
-                  >鍏ㄩ��
-                  </el-checkbox>
-
-                  <div v-if="treeCenter.length>0">
-                    <div v-for="(item,index) in treeCenter[0].children" :key="item.menucode">
-
-                      <div
-                        v-if="!item.buttoncodelist"
-                        style="margin-left: 40px;height:26px;display: flex;"
-                      />
-
-                      <el-checkbox-group
-                        v-for="it in item.children"
-                        v-if="item.expanded"
-                        :key="it.menucode"
-                        v-model="it.buttonChecked"
-                        style="margin-left: 40px;height:26px;display: flex;"
-                        @change="val=>handleCheckedButtonChange(val,index,it.menucode,it.buttonChecked)"
-                      >
-
-                        <el-checkbox
-                          v-for="i in it.buttoncodelist"
-                          :key="i"
-                          :label="i"
-                          style="display:flex;align-items: center;"
-                        />
-                      </el-checkbox-group>
-
-                    </div>
-
-                  </div>
-
-                </div>
-
-                <div
-                  ref="scrollRight"
-                  style="width: 360px;padding-left: 10px;overflow-y: auto"
-                  :style="{height:(tableHeight-40)+'px',}"
-                  @scroll="scrollRightScroll()"
-                  @mouseover="isScroll='right'"
-                >
-                  <div style=" ">
-                    <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鏁版嵁鏉冮檺
-                  </div>
-
-                  <el-checkbox
-                    v-model="dataIsChecked"
-                    style="height: 26px;display:flex;align-items: center;margin-top:10px;width:200px"
-                    @change="val=>handleCheckAllChange(val,'data')"
-                  >鍏ㄩ��
-                  </el-checkbox>
-
-                  <div v-if="treeCenter.length>0">
-                    <div v-for="item in treeCenter[0].children" :key="item.menucode">
-                      <div
-                        v-if="!item.datacodelist"
-                        style="margin-left: 40px;height:26px;display: flex;"
-                      />
-
-                      <el-radio-group
-                        v-for="it in item.children"
-                        v-if="item.expanded"
-                        :key="it.menucode"
-                        v-model="it.dataChecked"
-                        style="margin-left: 40px;height:26px;display: flex"
-                        @change="val=>handleCheckedDataChange(val,it.menucode)"
-                      >
-                        <el-radio
-                          v-for="i in it.datacodelist"
-                          :key="i"
-                          style="display:flex;align-items: center"
-                          :label="i"
-                        />
-                      </el-radio-group>
-                    </div>
-
-                  </div>
-
-                </div>
-
-              </div>
-            </el-tab-pane>
-            <el-tab-pane label="APP绔�" name="APP">澶уぇ</el-tab-pane>
-            <el-tab-pane label="宸ユ帶绔�" name="宸ユ帶绔�">宸ユ帶绔�</el-tab-pane>
-          </el-tabs>
-
-        </div>
+          <div class="elForm">
+            <el-form-item label="瑙掕壊缂栫爜" style=" display: flex;">
+              <el-input v-model="form.storg_code" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </el-form-item>
+            <el-form-item label="瑙掕壊鍚嶇О" style=" display: flex;">
+              <el-input v-model="form.storg_name" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </el-form-item>
+          </div>
+          <div
+            class="bodySearchReset"
+            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
+          >
+            <el-button v-waves type="primary" icon="el-icon-search" @click="getRoleData">鏌ヨ</el-button>
+            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
+          </div>
+        </el-form>
 
       </div>
 
+      <div class="elTableDiv">
+        <el-table
+          ref="tableDataRef"
+          class="tableFixed"
+          :data="tableData"
+          :height="tableHeight+'px'"
+          border
+          row-class-name="custom-row"
+          :style="{width: 100+'%',height:tableHeight+'px',}"
+          highlight-current-row
+          :header-cell-style="this.$headerCellStyle"
+          :cell-style="this.$cellStyle"
+          @sort-change="sortChange"
+        >
+          <el-table-column
+            prop="rowNum"
+            width="120"
+            fixed
+            label="搴忓彿"
+          />
+          <el-table-column
+            prop="rolecode"
+            label="瑙掕壊缂栫爜"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="rolename"
+            label="瑙掕壊鍚嶇О"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="status"
+            label="鐘舵��"
+            sortable="custom"
+          >
+            <template slot-scope="{row}">
+              <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag>
+              <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="dataname"
+            label="鏉冮檺鑼冨洿"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="description"
+            label="澶囨敞"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="lm_user"
+            label="鍒涘缓浜哄憳"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="lm_date"
+            label="鍒涘缓鏃堕棿"
+            width="160"
+            sortable="custom"
+          />
+          <el-table-column
+            label="鎿嶄綔"
+            width="160"
+            fixed="right"
+          >
+            <template slot-scope="{row}">
+              <div class="operationClass">
+                <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
+                  <i
+                    class="el-icon-edit-outline"
+                    :style="{color:$store.state.settings.theme}"
+                    @click="edit('edit',row)"
+                  />
+                </el-tooltip>
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
+                  <i
+                    class="el-icon-delete"
+                    :style="{color:$store.state.settings.theme}"
+                    @click="del(row)"
+                  />
+                </el-tooltip>
+
+                <el-dropdown placement="bottom" @command="command=>handleCommand(command,row)">
+                  <div
+                    class="el-dropdown-link"
+                    style="display: flex;align-content: center;
+                    justify-content: center;
+                    cursor: pointer;"
+                    :style="{color:$store.state.settings.theme}"
+                  >
+                    <div>鏇村</div>
+                    <div>
+                      <i class="el-icon-arrow-down el-icon--right" />
+                    </div>
+                  </div>
+                  <el-dropdown-menu slot="dropdown">
+                    <el-dropdown-item icon="el-icon-circle-check" command="menuPower">鑿滃崟鏉冮檺</el-dropdown-item>
+                    <el-dropdown-item icon="el-icon-user" command="divideUser">鍒嗛厤鐢ㄦ埛</el-dropdown-item>
+                    <el-dropdown-item icon="el-icon-download" command="downloadMenu">瀵煎嚭鑿滃崟</el-dropdown-item>
+                  </el-dropdown-menu>
+                </el-dropdown>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <!--鍒嗛〉-->
+      <pagination
+        :total="total"
+        :page.sync="form.page"
+        :limit.sync="form.rows"
+        align="right"
+        layout="total,prev, pager, next,sizes,jumper"
+        popper-class="select_bottom"
+        @pagination="getRoleData"
+      />
     </div>
+
+    <el-dialog
+      v-el-drag-dialog
+      :title="operation==='add'?'鏂板':'缂栬緫'"
+      :visible.sync="dialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      top="15vh"
+      @closed="handleClose"
+      @close="handleClose"
+    >
+      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
+        <!--        <el-form-item label="瑙掕壊缂栫爜" prop="rolecode">-->
+        <!--          <el-input v-model="dialogForm.rolecode" :disabled="operation!=='add'" style="width: 200px" />-->
+        <!--        </el-form-item>-->
+        <el-form-item label="瑙掕壊鍚嶇О" prop="rolename">
+          <el-input v-model="dialogForm.rolename" style="width: 200px" />
+        </el-form-item>
+
+        <el-form-item required label="鏁版嵁鑼冨洿">
+          <el-select
+            v-model="dialogForm.datacode"
+            style="width:200px"
+            placeholder="璇烽�夋嫨"
+            :popper-append-to-body="false"
+          >
+            <el-option
+              v-for="item in datacodeArr"
+              :key="item.code"
+              :label="item.name"
+              :value="item.code"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item required label="鐘舵��">
+          <el-radio-group v-model="dialogForm.status" style="width: 200px">
+            <el-radio label="Y">姝e父</el-radio>
+            <el-radio label="N">鍋滅敤</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item v-if="dialogForm.datacode==='CUSTOM'" label="鏁版嵁鏉冮檺" style="margin: 0">
+          <el-checkbox-group v-model="checkboxGroupSelected" @change="checkboxGroupChange">
+            <el-checkbox v-for="item in checkboxGroup" :key="item" :label="item">
+              {{ item }}
+              <el-tooltip class="item" effect="dark" content="鍕鹃�夌埗鑺傜偣鏄惁鍚屾椂閫変腑瀛愯妭鐐�" placement="top">
+                <i v-if="item==='鐖跺瓙鑱斿姩'" class="el-icon-question" />
+              </el-tooltip>
+            </el-checkbox>
+          </el-checkbox-group>
+        </el-form-item>
+        <el-card
+          v-if="dialogForm.datacode==='CUSTOM'"
+          class="box-card"
+          shadow="never"
+          style="margin-bottom: 30px;width: 78%;margin-left: 12%;"
+        >
+
+          <el-tree
+            ref="tree"
+            :key="checkboxGroupSelected.toString()"
+            :data="treeData"
+            show-checkbox
+            :check-strictly="!checkboxGroupSelected.includes('鐖跺瓙鑱斿姩')"
+            :default-expand-all="checkboxGroupSelected.includes('灞曞紑/鎶樺彔')"
+            node-key="torg_code"
+            :props="defaultProps"
+          />
+        </el-card>
+
+        <el-form-item label="澶囨敞">
+          <el-input v-model="dialogForm.description" type="textarea" style="width:500px" />
+        </el-form-item>
+
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>
+          <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>
+        </div>
+      </span>
+    </el-dialog>
 
   </div>
 </template>
 
 <script>
-import waves from '@/directive/waves'
+import Pagination from '@/components/Pagination'
 import {
-  RoleAddUpdateSava, RoleDeleteSava,
-  RolePermissionSava,
-  RolePermissionSearchRole,
-  RolePermissionSearchRoleMenu,
-  RolePermissionSearchRoleMenuButton
+  AddUpdateGroup,
+  DeleteGroup, RoleAddUpdateSava,
+  RoleData, RoleDeleteSava
 } from '@/api/basicSettings'
+import { validateCode } from '@/utils/global'
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
+import { PrentOrganization } from '@/api/GeneralBasicData'
 import arrayToTree from 'array-to-tree'
-import { throttle } from '@/utils/debounceAndThrottle'
-import { DataPermissions } from '@/api/GeneralBasicData'
 
 export default {
-  name: 'RoleList',
-  directives: { waves },
+  name: 'Zzjg',
+  components: {
+    Pagination
+  },
+  directives: { elDragDialog, waves },
   data() {
     return {
       mainHeight: 0,
       tableHeight: 0,
-
-      treeLeft: [], // 宸︿晶鏍�
-      treeCenter: [], // 涓棿鏍�
-      defaultPropsLeft: {
-        children: 'roles',
-        label: 'name'
+      form: {
+        role_code: '',
+        role_name: '',
+        prop: 'lm_date', // 鎺掑簭瀛楁
+        order: 'desc', // 鎺掑簭瀛楁
+        page: 1, // 绗嚑椤�
+        rows: 20 // 姣忛〉澶氬皯鏉�
       },
-      defaultPropsCenter: {
+      total: 10,
+      tableData: [],
+      dialogVisible: false,
+      dialogForm: {
+        rolecode: '', //
+        rolename: '', //
+        datacode: 'ALL',
+        description: '',
+        datapermissions: '', // 鏁版嵁鏉冮檺
+        status: 'Y'// 鐘舵��
+      },
+      datacodeArr: [
+        { code: 'ALL', name: '鍏ㄩ儴' },
+        { code: 'CUSTOM', name: '鑷畾涔�' },
+        { code: 'LEVEL', name: '鏈骇' },
+        { code: 'PERSON', name: '鏈汉' }
+      ],
+      checkboxGroupSelected: ['灞曞紑/鎶樺彔', '鐖跺瓙鑱斿姩'],
+      checkboxGroup: ['灞曞紑/鎶樺彔', '鍏ㄩ��/鍏ㄤ笉閫�', '鐖跺瓙鑱斿姩'],
+      operation: '',
+      dialogFormRules: {
+        rolecode: [
+          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
+        ],
+        rolename: [
+          { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] }
+        ]
+      },
+      defaultProps: {
         children: 'children',
-        label: 'menuname'
+        label: 'torg_name'
       },
-      activeName: 'PC',
-
-      buttonIsChecked: false,
-      dataIsChecked: false,
-
-      menuCheckedCodeArr: [], // 鑿滃崟鏉冮檺鏁扮粍閫変腑鐨�
-
-      allButtonData: [], // 鎵�鏈夎彍鍗曞搴旂殑鎸夐挳鏉冮檺鍔犳暟鎹潈闄�
-
-      isScroll: 'left',
-
-      dataKeyValue: []// 鏁版嵁鏉冮檺閿�煎
+      treeData: []
 
     }
   },
-  watch: {
-    treeLeft: {
-      handler(newValue, oldValue) {
-        newValue[0].roles.forEach(i => {
-          if (i.isEdit) {
-            this.$nextTick(() => {
-              this.$refs[i.code].focus()
-            })
-          }
-        })
-      },
-      deep: true
-    }
-  },
-
   created() {
+    this.getRoleData()
   },
   mounted() {
     window.addEventListener('resize', this.getHeight)
     this.getHeight()
 
-    this.getRolePermissionSearchRole()
+    this.getPrentOrganization()
   },
   methods: {
-
-    // 鑾峰彇瑙掕壊鏉冮檺鏌ヨ瑙掕壊
-    async getRolePermissionSearchRole() {
-      const { data: res } = await RolePermissionSearchRole()
-      res[0].roles.forEach(i => {
-        i.isEdit = false
-      })
-
-      this.treeLeft = res
-
-      if (res && res.length > 0) {
-        this.$nextTick(() => { // 榛樿閫変腑绗竴涓�
-          this.$refs.treeLeftRef.setCurrentKey(res[0].roles[0].code) // 榛樿閫変腑鑺傜偣绗竴涓�
-        })
-
-        await this.getDataPermissions()// 鑾峰彇鏁版嵁鏉冮檺閿�煎
-        await this.getRolePermissionSearchRoleMenuButton(res[0].roles[0].code)// 鐢ㄤ簬鏁版嵁鍥炴樉
-
-        await this.getRolePermissionSearchRoleMenu(res[0].roles[0].code)// 鐢ㄤ簬娓叉煋椤甸潰
-      } else {
-        this.$notify.error('璇峰厛寤虹浉瀵瑰簲鐨勮鑹诧紒')
-      }
+    async getRoleData() {
+      const res = await RoleData(this.form)
+      this.tableData = res.data
+      this.total = res.count
     },
-    async getDataPermissions() {
-      const { data: res } = await DataPermissions()
-      this.dataKeyValue = res
-    },
-
-    // 鑾峰彇鑿滃崟鏉冮檺瀵瑰簲鐨勬寜閽�
-    async getRolePermissionSearchRoleMenuButton(rolecode) {
-      const { data: res } = await RolePermissionSearchRoleMenuButton({ rolecode, type: this.activeName })
-      this.allButtonData = res.length > 0 ? JSON.parse(res[0].jsondate) : []
-    },
-    // 鑾峰彇鑿滃崟鏉冮檺
-    async getRolePermissionSearchRoleMenu(rolecode) {
-      const { data: res } = await RolePermissionSearchRoleMenu({ rolecode, type: this.activeName })
-
-      // 鎷垮埌鏁扮粍list杞崲鎴愭爲褰ree
-      const result = arrayToTree(res, {
+    // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣�
+    async getPrentOrganization() {
+      const { data: res } = await PrentOrganization()
+      this.treeData = arrayToTree(res, {
         parentProperty: 'parent_id',
-        customID: 'menucode',
+        customID: 'torg_code',
         childrenProperty: 'children'
       })
-
-      this.treeCenter = [
-        { menucode: '-1', menuname: '鍏ㄩ儴', children: result }
-      ]
-
-      this.treeCenter[0].children.forEach(item => {
-        if (item.children && item.children.length) {
-          item.children.forEach(it => {
-            it.buttoncodelist = it.buttoncodelist !== '' && it.buttoncodelist !== null ? it.buttoncodelist.split(',') : []
-            if (it.buttoncodelist && it.buttoncodelist.length > 0) {
-              it.buttoncodelist = this.$ButtonData.filter(j =>
-                it.buttoncodelist.includes(j.buttoncode)
-              )
-
-              it.buttoncodelist = it.buttoncodelist.map(j => j.buttonname)
-            }
-
-            it.datacodelist = it.datacodelist ? it.datacodelist.split(',') : []
-            if (it.datacodelist && it.datacodelist.length > 0) {
-              it.datacodelist = this.dataKeyValue.filter(j =>
-                it.datacodelist.includes(j.datacode)
-              ).map(j => j.dataname)
-            }
-          })
-
-          item.expanded = true
-        }
-      })
-
-      this.handleData()// 澶勭悊鏁版嵁鍥炴樉
     },
-    // 澶勭悊缁勫悎鏁版嵁
-    handleData() {
-      this.menuCheckedCodeArr = this.allButtonData.map(i => i.menucode)
+    // 鎺掑簭鏀瑰彉鏃�
+    sortChange({ column, prop, order }) {
+      if (order === 'descending') {
+        order = 'desc'
+      } else if (order === 'ascending') {
+        order = 'asc'
+      } else {
+        order = 'desc'
+      }
+      this.form.order = order
+      this.form.prop = prop
+      this.getRoleData()
+    },
+    // 閲嶇疆
+    reset() {
+      this.form.storg_code = ''
+      this.form.storg_name = ''
+      this.getRoleData()
+    },
+    // 鏂板鎸夐挳
+    add(operation) {
+      this.operation = operation
+      this.dialogVisible = true
+      this.dialogForm.OperType = 'Add'
+    },
+    // 淇敼鎸夐挳
+    async edit(operation, row) {
+      this.operation = operation
+      this.dialogVisible = true
+      this.dialogForm.OperType = 'Update'
       this.$nextTick(() => {
-        this.$refs.treeCenterRef.setCheckedKeys(this.menuCheckedCodeArr)
-      })
-
-      this.treeCenter[0].children.forEach(item => {
-        if (item.children && item.children.length) {
-          item.children.forEach(it => {
-            let temp = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].buttoncode : []
-            temp = temp.length > 0 ? temp.split(',') : []
-            it.buttonChecked = [] // 鏁版嵁鍥炴樉
-            this.$ButtonData.forEach(j => {
-              if (temp.includes(j.buttoncode)) {
-                it.buttonChecked.push(j.buttonname)
-              }
-            })
-
-            const datacode = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].datacode : ''
-            it.dataChecked = datacode ? this.dataKeyValue.find(j => j.datacode === datacode).dataname : '' // 鏁版嵁鍥炴樉
+        this.dialogForm.rolecode = row.rolecode
+        this.dialogForm.rolename = row.rolename
+        this.dialogForm.datacode = row.datacode
+        this.dialogForm.status = row.status
+        this.dialogForm.description = row.description
+        if (this.dialogForm.datacode === 'CUSTOM') {
+          setTimeout(() => {
+            this.$refs.tree.setCheckedKeys(row.datapermissionscode.split(','))
           })
         }
       })
-
-      this.handleCheckedButtonChange('', '', '', '', true)
-      this.handleCheckedDataChange('', '', true)
-      // this.$forceUpdate()
     },
-
-    // 宸﹁竟婊氬姩鏉℃粦鍔ㄦ椂
-    scrollLeftScroll() {
-      if (this.isScroll === 'left') {
-        this.$refs.scrollCenter.scrollTop = this.$refs.scrollLeft.scrollTop
-        this.$refs.scrollRight.scrollTop = this.$refs.scrollLeft.scrollTop
-      }
-    },
-    // 涓棿杈规粴鍔ㄦ潯婊戝姩鏃�
-    scrollCenterScroll() {
-      if (this.isScroll === 'center') {
-        this.$refs.scrollLeft.scrollTop = this.$refs.scrollCenter.scrollTop
-        this.$refs.scrollRight.scrollTop = this.$refs.scrollCenter.scrollTop
-      }
-    },
-    // 鍙充晶婊氬姩鏉℃粦鍔ㄦ椂
-    scrollRightScroll() {
-      if (this.isScroll === 'right') {
-        this.$refs.scrollLeft.scrollTop = this.$refs.scrollRight.scrollTop
-        this.$refs.scrollCenter.scrollTop = this.$refs.scrollRight.scrollTop
-      }
-    },
-    // 鍏ㄩ�夋敼鍙�
-    handleCheckAllChange(val, belong) {
-      const checkedKeys = this.$refs.treeCenterRef.getCheckedKeys()
-
-      if (val) {
-        this.treeCenter[0].children.forEach(item => {
-          if (item.children && item.children.length) {
-            item.children.forEach(it => {
-              if (checkedKeys.includes(it.menucode)) {
-                if (belong === 'button') {
-                  it.buttonChecked = it.buttoncodelist
-                }
-                if (belong === 'data') {
-                  it.dataChecked = '鍏ㄩ儴'
-                }
-              }
-            })
-          }
-        })
-      } else {
-        this.treeCenter[0].children.forEach(item => {
-          if (item.children && item.children.length) {
-            item.children.forEach(it => {
-              if (checkedKeys.includes(it.menucode)) {
-                if (belong === 'button') {
-                  it.buttonChecked = []
-                }
-                if (belong === 'data') {
-                  it.dataChecked = ''
-                }
-              }
-            })
-          }
-        })
-      }
-    },
-    // 鍗曚釜鎸夐挳鏀瑰彉
-    handleCheckedButtonChange(oldValue, index, code, newValue, flag) {
-      // console.log(oldValue, index, code, newValue, 2)
-      // 鍒ゆ柇鏄惁鍖呭惈鍦ㄥ唴
-      if (!flag) {
-        if (!this.menuCheckedCodeArr.includes(code) && oldValue.length === 0 && newValue.length === 1) { // 鍚�
-          this.menuCheckedCodeArr.push(code)
-        } else if (this.menuCheckedCodeArr.includes(code) && oldValue.length === 1 && newValue.length === 0) { // 鏄�
-          // 褰撴暟鎹潈闄愭湭鍕鹃�夋椂鍒欒繃婊ゆ帀鐩稿搴旂殑鑿滃崟
-          if (this.treeCenter[0].children[index].children.find(i => i.menucode === code).dataChecked.toString().length < 1) {
-            this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== code)
-          }
-        }
-        this.$refs.treeCenterRef.setCheckedKeys(this.menuCheckedCodeArr)
-      }
-
-      // 杩欓噷鏄垽鏂叏閫塩heckbox 鏄惁閫変腑
-      let count = 0
-      let childrenLength = 0
-      this.treeCenter[0].children.forEach(item => {
-        if (item.children && item.children.length) {
-          item.children.forEach(it => {
-            if (it.buttonChecked && it.buttonChecked.length === it.buttoncodelist.length && it.buttoncodelist.length > 0) {
-              count++
-            }
-
-            if (it.buttoncodelist.length) {
-              childrenLength++
-            }
-          })
-        }
-      })
-
-      this.buttonIsChecked = count === childrenLength
-      this.$forceUpdate()
-    },
-    // 鑾峰彇鏍戝舰鑺傜偣node
-    getLeftTreeNode(data, Node, VueComponent) {
-      this.treeCenter[0].children.forEach(item => {
-        if (item.menucode === data.menucode) {
-          item.expanded = Node.expanded
-        }
-      })
-      if (data.menucode === '-1') {
-        Node.expanded = true // 鏆傛椂鍏堝啓鎴愯繖涓�
-      }
-      this.$forceUpdate()
-    },
-    // 澶勭悊涓棿鏍戝舰鍕鹃��
-    handleTreeCenterCheck(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) {
-      // console.log(obj, checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys, '鍔犲瀹�')
-
-      if (checkedKeys.length === 0) { // 鏍戝舰鑿滃崟鍏ㄤ笉閫夌殑鎯呭喌涓�
-        this.buttonIsChecked = false
-        this.dataIsChecked = false
-        this.menuCheckedCodeArr = []
-      } else {
-        if (checkedKeys.includes(obj.menucode)) { // 鍒ゆ柇鏄惁鍖呭惈鍦ㄥ唴   //鏄�
-          this.menuCheckedCodeArr.push(obj.menucode)
-        } else { // 鍚�
-          this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== obj.menucode)
-        }
-      }
-    },
-    // 澶勭悊涓棿鏍戝舰閫変腑鍊兼敼鍙�
-    handleTreeCenterCheckChange(obj, selfChecked, selfChildrenTreeCheck) {
-      // console.log(obj, selfChecked, selfChildrenTreeCheck, '鐜嬭�佸悏')
-      if (!selfChildrenTreeCheck) {
-        if (!selfChecked) { // 浠庨�変腑鍒颁笉閫変腑
-          obj.buttonChecked = []
-          obj.dataChecked = ''
-          this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== obj.menucode)
-        }
-        if (selfChecked) { // 浠庝笉閫変腑鍒伴�変腑
-          obj.buttonCheckedCode = []
-          this.treeCenter[0].children.forEach(item => {
-            if (item.children && item.children.length) {
-              item.children.forEach(it => {
-                if (it.menucode === obj.menucode) {
-                  this.menuCheckedCodeArr.push(obj.menucode)
-                }
-              })
-            }
-          })
-        }
-
-        this.$forceUpdate()
-      }
-    },
-    // 鍗曢�夋鎸夐挳鏀瑰彉
-    handleCheckedDataChange(value, code, flag) {
-      // console.log(value, code)
-      if (!flag) {
-        this.menuCheckedCodeArr.push(code)
-        this.menuCheckedCodeArr = [...new Set(this.menuCheckedCodeArr)]
-        this.$refs.treeCenterRef.setCheckedKeys(this.menuCheckedCodeArr)
-      }
-      // 杩欓噷鏄垽鏂叏閫塺adio 鏄惁閫変腑
-      let count = 0
-      let childrenLength = 0
-      this.treeCenter[0].children.forEach(item => {
-        if (item.children && item.children.length) {
-          item.children.forEach(it => {
-            if (it.dataChecked.length > 0 && it.datacodelist.length > 0) {
-              count++
-            }
-            // console.log(it.dataChecked, 234)
-            if (it.datacodelist.length > 0) {
-              childrenLength++
-            }
-          })
-        }
-      })
-      // console.log(count, childrenLength, 123)
-      this.dataIsChecked = count === childrenLength
-      this.$forceUpdate()
-    },
-    // 瑙掕壊鍒囨崲
-    async treeLeftNodeClick(obj, Node, VueComponent) {
-      if (obj.code !== '000') {
-        await this.getRolePermissionSearchRoleMenuButton(obj.code)
-        // await this.getRolePermissionSearchRoleMenu(obj.code)
-        this.handleData()
-      }
-    },
-    // 瑙掕壊鍚嶇О鏂板
-    rolePlusClick() {
-      this.treeLeft[0].roles.push({ code: '', name: '', isEdit: true })
-    },
-    // 瑙掕壊鍚嶇О淇敼
-    roleEditClick(self, node, data) {
-      // console.log(self, node, data)
-      this.treeLeft[0].roles.forEach(i => {
-        i.isEdit = false
-      })
-      data.isEdit = !data.isEdit
-    },
-    // 瑙掕壊鍚嶇О鍒犻櫎
-    roleDeleteClick(self, node, data) {
-      // console.log(self, node, data)
+    // 鍒犻櫎鎸夐挳
+    async del(row) {
       this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        const D = {
-          rolecode: data.code,
-          rolename: data.name,
-          type: this.activeName
-        }
-        RoleDeleteSava(D).then(res => {
+        RoleDeleteSava({ rolecode: row.rolecode }).then(res => {
           if (res.code === '200') {
-            this.$notify.success('瑙掕壊鍒犻櫎鎴愬姛锛�')
+            this.$notify.success('鍒犻櫎鎴愬姛!')
+            if (this.form.page > 1 && this.tableData.length === 1) {
+              this.form.page--
+            }
+            this.getRoleData()
           }
-          this.getRolePermissionSearchRole()
         })
       }).catch(() => {
         this.$notify.info('宸插彇娑堝垹闄�')
       })
     },
-    // 瑙掕壊鍚嶇О淇濆瓨   閲囩敤闃叉姈褰㈠紡
-    roleSave: throttle(function(val) {
-      val.isEdit = false
-
-      if (val.name.trim().length === 0) {
-        this.getRolePermissionSearchRole()
-        return this.$notify.info('鏃犳晥淇濆瓨锛�')
+    checkboxGroupChange(val) {
+      if (val.includes('鍏ㄩ��/鍏ㄤ笉閫�')) {
+        this.$refs.tree.setCheckedKeys([this.treeData[0].torg_code])
       }
-
-      const data = {
-        rolecode: val.code,
-        rolename: val.name,
-        type: val.code === '' ? 'Add' : 'Update'
-      }
-      console.log(data, '鎵ц浜嗭紒')
-      RoleAddUpdateSava(data).then(res => {
-        if (res.code === '200') {
-          this.$notify.success(val.code === '' ? '瑙掕壊鏂板鎴愬姛锛�' : '瑙掕壊淇敼鎴愬姛锛�')
-        }
-      })
-      this.getRolePermissionSearchRole()
-    }, 1000, true),
-
-    // 椤甸潰鍕鹃�夊ソ淇濆瓨浜嬩欢
-    async saveClick() {
-      const menuKeyArr = this.$refs.treeCenterRef.getCheckedKeys()
-      const arr = []
-      this.treeCenter[0].children.forEach(item => {
-        if (item.children && item.children.length) {
-          item.children.forEach(it => {
-            if (menuKeyArr.includes(it.menucode)) {
-              if (it.buttoncodelist.length > 0 && it.buttoncodelist && it.dataChecked && it.dataChecked.toString().length > 0) { // 鏁版嵁鏉冮檺宸插嬀閫�
-                it.dataCheckedCode = this.dataKeyValue.find(i => i.dataname === it.dataChecked).datacode
-              }
-
-              if (it.buttonChecked && it.buttonChecked.length > 0) { // 宸查�夎彍鍗�
-                it.buttonCheckedCode = this.$ButtonData.filter(i =>
-                  it.buttonChecked.includes(i.buttonname)
-                ).map(i => i.buttoncode)
-              }
-              arr.push({
-                menucode: it.menucode,
-                datacode: it.dataCheckedCode !== undefined ? it.dataCheckedCode : '',
-                buttoncode: it.buttonCheckedCode ? it.buttonCheckedCode.join(',') : ''
-              })
+    },
+    // 瀵硅瘽妗嗗叧闂簨浠�
+    handleClose() {
+      this.dialogForm.rolecode = ''
+      this.dialogForm.rolename = ''
+      this.dialogForm.description = ''
+      this.dialogForm.datapermissions = ''
+      this.dialogForm.datacode = 'ALL'
+      this.dialogForm.status = 'Y'
+      this.$refs.dialogForm.clearValidate()
+    },
+    // 瀵硅瘽妗嗗彇娑�
+    dialogVisibleCancel() {
+      this.dialogVisible = false
+    },
+    // 瀵硅瘽妗嗙‘璁�
+    dialogVisibleConfirm() {
+      this.$refs.dialogForm.validate(valid => {
+        if (valid) {
+          if (this.$refs.tree) {
+            this.dialogForm.datapermissions = this.$refs.tree.getCheckedKeys().join(',')
+          }
+          RoleAddUpdateSava(this.dialogForm).then(res => {
+            if (res.code === '200') {
+              this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
+              this.dialogVisible = false
+              this.getRoleData()
+            } else {
+              this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
             }
           })
         }
       })
-
-      const rolecode = this.$refs.treeLeftRef.getCurrentKey()
-      const res = await RolePermissionSava(JSON.stringify(arr), rolecode, this.activeName)
-      if (res.code === '200') {
-        const rolename = this.treeLeft[0].roles.find(i => i.code === rolecode).name
-        this.$notify.success(rolename + '鐨勮鑹叉潈闄愭彁浜ゆ垚鍔燂紒')
-        await this.getRolePermissionSearchRoleMenuButton(rolecode)
+    },
+    handleCommand(command, row) {
+      console.log(command, row)
+      if (command === 'menuPower') {
+        this.$router.push('./roleList?powerId=' + row.id)// demo
       }
     },
     // 鑾峰彇椤甸潰楂樺害
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 50
+        this.tableHeight = this.mainHeight - 200
+        this.$refs.tableDataRef.doLayout()
       })
-    },
-    // 宸︿晶鏍戝舰鎷栧姩澶勭悊
-    treeLeftAllowDrop(draggingNode, dropNode, type) {
-      // console.log(draggingNode, dropNode, type)
-      // 娉ㄦ帀鐨勬槸鍚岀骇鎷栨嫿
-      if (draggingNode.level === dropNode.level) {
-        return type === 'prev' || type === 'next'
-      } else {
-        // 涓嶅悓绾ц繘琛屽鐞�
-        return false
-      }
     }
   }
 }
 </script>
-
-<style scoped lang="scss">
-.custom-tree-node {
-  flex: 1;
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  font-size: 14px;
-  padding-right: 8px;
-}
-
-::v-deep .el-checkbox__label {
-  width: 55px;
-}
-
-.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover {
-  color: #000 !important;
-}
-</style>

--
Gitblit v1.9.3