silent 4 роки тому
батько
коміт
b469d302c0
2 змінених файлів з 14 додано та 1 видалено
  1. 1 0
      src/option/system/dictbiz.js
  2. 13 1
      src/views/system/dictbiz.vue

+ 1 - 0
src/option/system/dictbiz.js

@@ -98,6 +98,7 @@ export const optionChild = {
   border: true,
   index: true,
   selection: true,
+  lazy: true,
   viewBtn: true,
   menuWidth: 300,
   dialogWidth: 880,

+ 13 - 1
src/views/system/dictbiz.vue

@@ -72,6 +72,7 @@
         @current-change="currentChangeChild"
         @size-change="sizeChangeChild"
         @refresh-change="refreshChangeChild"
+        @tree-load="onLoadChildTree"
         @on-load="onLoadChild"
       >
         <template slot="menuLeft">
@@ -98,7 +99,7 @@
             icon="el-icon-circle-plus-outline"
             size="small"
             @click.stop="handleAdd(scope.row,scope.index)"
-            v-if="userInfo.role_name.includes('admin')"
+            v-if="userInfo.role_name.includes('admin') && scope.row.hasChildren"
           >新增子项
           </el-button>
         </template>
@@ -482,6 +483,17 @@ export default {
         this.selectionClear();
       });
     },
+    onLoadChildTree(tree, treeNode, resolve) {
+      this.loadingChild = true;
+      getChildList(1,9999,tree.id).then(res => {
+        res.data.data.records.forEach(ele => {
+          ele.hasChildren = false;
+        })
+        resolve(res.data.data.records);
+      }).finally(()=>{
+        this.loadingChild = false;
+      });
+    },
     handleImport() {
       this.excelBox = true;
     },