疯狂的狮子li
2021-07-09 ea506de04817bfd7b077f553feae9261d43fd636
Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev

 Conflicts:
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
 ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
 ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
 ruoyi-ui/src/directive/index.js
 ruoyi-ui/src/directive/permission/hasPermi.js
 ruoyi-ui/src/directive/permission/hasRole.js
 ruoyi-ui/src/main.js
 ruoyi-ui/src/views/system/notice/index.vue
已修改8个文件
已添加2个文件
已删除1个文件
199 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/directive/dialog/drag.js 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/directive/index.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/directive/permission/hasPermi.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/directive/permission/hasRole.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/directive/permission/index.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/main.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/views/system/notice/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -208,6 +208,7 @@
    /**
     * æ‰¹é‡å–消授权用户
     */
    @PreAuthorize("@ss.hasPermi('system:role:edit')")
    @Log(title = "角色管理", businessType = BusinessType.GRANT)
    @PutMapping("/authUser/cancelAll")
    public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
@@ -218,6 +219,7 @@
    /**
     * æ‰¹é‡é€‰æ‹©ç”¨æˆ·æŽˆæƒ
     */
    @PreAuthorize("@ss.hasPermi('system:role:edit')")
    @Log(title = "角色管理", businessType = BusinessType.GRANT)
    @PutMapping("/authUser/selectAll")
    public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
@@ -256,46 +256,10 @@
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "imageUpload")
import ImageUpload from '@/components/ImageUpload';
#break
#end
#end
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "fileUpload")
import FileUpload from '@/components/FileUpload';
#break
#end
#end
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "editor")
import Editor from '@/components/Editor';
#break
#end
#end
export default {
  name: "${BusinessName}",
  components: {
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "imageUpload")
    ImageUpload,
#break
#end
#end
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "fileUpload")
    FileUpload,
#break
#end
#end
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "editor")
    Editor,
#break
#end
#end
    Treeselect
  },
  data() {
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
@@ -308,47 +308,9 @@
<script>
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "imageUpload")
import ImageUpload from '@/components/ImageUpload';
#break
#end
#end
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "fileUpload")
import FileUpload from '@/components/FileUpload';
#break
#end
#end
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "editor")
import Editor from '@/components/Editor';
#break
#end
#end
export default {
  name: "${BusinessName}",
  components: {
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "imageUpload")
    ImageUpload,
#break
#end
#end
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "fileUpload")
    FileUpload,
#break
#end
#end
#foreach($column in $columns)
#if($column.insert && !$column.pk && $column.htmlType == "editor")
    Editor,
#break
#end
#end
  },
  data() {
    return {
      // æŒ‰é’®loading
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -262,6 +262,7 @@
     * @param roleIds è§’色组
     */
    @Override
    @Transactional
    public void insertUserAuth(Long userId, Long[] roleIds)
    {
        userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
ruoyi-ui/src/directive/dialog/drag.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
/**
* v-dialogDrag å¼¹çª—拖拽
* Copyright (c) 2019 ruoyi
*/
export default {
  bind(el, binding, vnode, oldVnode) {
    const value = binding.value
    if (value == false) return
    // èŽ·å–æ‹–æ‹½å†…å®¹å¤´éƒ¨
    const dialogHeaderEl = el.querySelector('.el-dialog__header');
    const dragDom = el.querySelector('.el-dialog');
    dialogHeaderEl.style.cursor = 'move';
    // èŽ·å–åŽŸæœ‰å±žæ€§ ie dom元素.currentStyle ç«ç‹è°·æ­Œ window.getComputedStyle(dom元素, null);
    const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
    dragDom.style.position = 'absolute';
    dragDom.style.marginTop = 0;
    let width = dragDom.style.width;
    if (width.includes('%')) {
      width = +document.body.clientWidth * (+width.replace(/\%/g, '') / 100);
    } else {
      width = +width.replace(/\px/g, '');
    }
    dragDom.style.left = `${(document.body.clientWidth - width) / 2}px`;
    // é¼ æ ‡æŒ‰ä¸‹äº‹ä»¶
    dialogHeaderEl.onmousedown = (e) => {
      // é¼ æ ‡æŒ‰ä¸‹ï¼Œè®¡ç®—当前元素距离可视区的距离 (鼠标点击位置距离可视窗口的距离)
      const disX = e.clientX - dialogHeaderEl.offsetLeft;
      const disY = e.clientY - dialogHeaderEl.offsetTop;
      // èŽ·å–åˆ°çš„å€¼å¸¦px æ­£åˆ™åŒ¹é…æ›¿æ¢
      let styL, styT;
      // æ³¨æ„åœ¨ie中 ç¬¬ä¸€æ¬¡èŽ·å–åˆ°çš„å€¼ä¸ºç»„ä»¶è‡ªå¸¦50% ç§»åŠ¨ä¹‹åŽèµ‹å€¼ä¸ºpx
      if (sty.left.includes('%')) {
        styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
        styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
      } else {
        styL = +sty.left.replace(/\px/g, '');
        styT = +sty.top.replace(/\px/g, '');
      };
      // é¼ æ ‡æ‹–拽事件
      document.onmousemove = function (e) {
        // é€šè¿‡äº‹ä»¶å§”托,计算移动的距离 ï¼ˆå¼€å§‹æ‹–拽至结束拖拽的距离)
        const l = e.clientX - disX;
        const t = e.clientY - disY;
        let finallyL = l + styL
        let finallyT = t + styT
        // ç§»åŠ¨å½“å‰å…ƒç´ 
        dragDom.style.left = `${finallyL}px`;
        dragDom.style.top = `${finallyT}px`;
      };
      document.onmouseup = function (e) {
        document.onmousemove = null;
        document.onmouseup = null;
      };
    }
  }
};
ruoyi-ui/src/directive/index.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
import hasRole from './permission/hasRole'
import hasPermi from './permission/hasPermi'
import dialogDrag from './dialog/drag'
const install = function(Vue) {
  Vue.directive('hasRole', hasRole)
  Vue.directive('hasPermi', hasPermi)
  Vue.directive('dialogDrag', dialogDrag)
}
if (window.Vue) {
  window['hasRole'] = hasRole
  window['hasPermi'] = hasPermi
  window['dialogDrag'] = dialogDrag
  Vue.use(install); // eslint-disable-line
}
export default install
ruoyi-ui/src/directive/permission/hasPermi.js
@@ -1,8 +1,8 @@
 /**
 * æ“ä½œæƒé™å¤„理
 * v-hasPermi æ“ä½œæƒé™å¤„理
 * Copyright (c) 2019 ruoyi
 */
import store from '@/store'
export default {
ruoyi-ui/src/directive/permission/hasRole.js
@@ -1,8 +1,8 @@
 /**
 * è§’色权限处理
 * v-hasRole è§’色权限处理
 * Copyright (c) 2019 ruoyi
 */
import store from '@/store'
export default {
ruoyi-ui/src/directive/permission/index.js
ÎļþÒÑɾ³ý
ruoyi-ui/src/main.js
@@ -10,7 +10,7 @@
import App from './App'
import store from './store'
import router from './router'
import permission from './directive/permission'
import directive from './directive' //directive
import './assets/icons' // icon
import './permission' // permission control
@@ -20,6 +20,12 @@
import Pagination from "@/components/Pagination";
// è‡ªå®šä¹‰è¡¨æ ¼å·¥å…·ç»„ä»¶
import RightToolbar from "@/components/RightToolbar"
// å¯Œæ–‡æœ¬ç»„ä»¶
import Editor from "@/components/Editor"
// æ–‡ä»¶ä¸Šä¼ ç»„ä»¶
import FileUpload from "@/components/FileUpload"
// å›¾ç‰‡ä¸Šä¼ ç»„ä»¶
import ImageUpload from "@/components/ImageUpload"
// å­—典标签组件
import DictTag from '@/components/DictTag'
// å¤´éƒ¨æ ‡ç­¾ç»„ä»¶
@@ -52,8 +58,11 @@
Vue.component('DictTag', DictTag)
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('Editor', Editor)
Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload)
Vue.use(permission)
Vue.use(directive)
Vue.use(VueMeta)
/**
ruoyi-ui/src/views/system/notice/index.vue
@@ -177,13 +177,9 @@
<script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
import Editor from '@/components/Editor';
export default {
  name: "Notice",
  components: {
    Editor
  },
  data() {
    return {
      // é®ç½©å±‚