瀏覽代碼

Merge branch 'dev' into d_ls

谢杰标 2 年之前
父節點
當前提交
adac80fbc0

+ 18 - 0
src/directive/common/throttle.js

@@ -0,0 +1,18 @@
+export default {
+    inserted(el, binding) {
+        let throttleTime = binding.value; 
+        if (!throttleTime) {
+            throttleTime = 1000;
+        }
+        let cbFun;
+        el.addEventListener('click', event => {
+            if (!cbFun) { // 第一次执行
+                cbFun = setTimeout(() => {
+                    cbFun = null;
+                }, throttleTime);
+            } else {
+                event && event.stopImmediatePropagation();
+            }
+        }, true);
+    }
+}

+ 3 - 1
src/directive/index.js

@@ -3,13 +3,15 @@ import hasPermi from './permission/hasPermi'
 import dialogDrag from './dialog/drag'
 import dialogDragWidth from './dialog/dragWidth'
 import dialogDragHeight from './dialog/dragHeight'
+import throttle from "./common/throttle"
 
-const install = function(Vue) {
+const install = function (Vue) {
   Vue.directive('hasRole', hasRole)
   Vue.directive('hasPermi', hasPermi)
   Vue.directive('dialogDrag', dialogDrag)
   Vue.directive('dialogDragWidth', dialogDragWidth)
   Vue.directive('dialogDragHeight', dialogDragHeight)
+  Vue.directive('throttle', throttle)
 }
 
 if (window.Vue) {

+ 1 - 1
src/views/Marketing/goods/commodityManageMent/teacher/index.vue

@@ -87,7 +87,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="closeBZ">取 消</el-button>
-        <el-button @click="submits">确 定</el-button>
+        <el-button @click="submits" v-throttle>确 定</el-button>
       </span>
     </el-dialog>
     <select-course ref="selectCourse" @backData="backData" />

+ 1 - 1
src/views/systemManagement/roleManagement/index.vue

@@ -503,7 +503,7 @@ export default {
     rulesTableSumbit() {
       this.disabledBtn = true;
       this.listData.menuIds = this.getMenuAllCheckedKeys();
-      // this.listData.businessIds = this.getMenuAllCheckedKeysInfo();
+      this.listData.businessIds = this.getMenuAllCheckedKeysInfo();
       var data = this.listData;
       if (this.statusPop === 1) {
         this.$api