{"hidden":false,"children":[{"configs":{"itemId":"module"},"expanded":true,"children":[{"configs":{"itemId":"tree1","split":"true","width":"200","viewConfig":"app.treeViewConfig","region":"west","title":"部门","iconCls":"org_icon","tools":"Wb.getTreeTools()","rootVisible":"false"},"expanded":true,"children":[{"configs":{"itemId":"store","url":"m?xwl=examples/employee/public/get-dept-tree"},"expanded":false,"children":[],"type":"treestore","events":{"load":"Wb.selFirst(app.tree1); //首次加载时选择首个节点","beforeload":"var node = operation.node;\noperation.params.parentDept = node.isRoot() ? -1 : operation.node.data.DEPT_ID;"}}],"type":"tree","events":{"selectionchange":"if (contextOwner) {\n  contextOwner.selDept = selected[0];\n  console.info(selected[0]);\n  contextOwner.deptid.setValue(selected[0].data.DEPT_ID);\n  if (contextOwner.loadData)\n    contextOwner.loadData();\n}"}}],"type":"module","events":{"initialize":"Wb.apply(app, {\n  /**\n   * tree1配置拖放事件，允许grid数据拖动到tree以调整人员所属部门。\n   */\n  treeViewConfig: {\n    plugins: {\n      ptype: 'treeviewdragdrop',\n      ddGroup: 'dept',\n      enableDrag: false\n    },\n    listeners: {\n      beforedrop: function(node, data, om, dp, dh) {\n        dh.wait = true;\n        dh.cancelDrop();\n        Wb.request({\n          url: 'm?xwl=examples/employee/edit/change-dept',\n          params: {\n            newDeptId: om.data.DEPT_ID,\n            recs: Wb.getData(data.records)\n          },\n          success: function() {\n            //停止删除store记录时触发的app.setModified方法\n            if (contextOwner) {\n              contextOwner.suspendSetModified = true;\n              Wb.remove(contextOwner.grid1);\n              contextOwner.suspendSetModified = false;\n            }\n          }\n        });\n      },\n      nodedragover: function(node, dp, data) {\n        return dp == 'append' && app.selectDeptNode != node;\n      }\n    }\n  }\n});"}}],"roles":{"demo":1},"title":"部门树组件","iconCls":"","inframe":false,"pageLink":""}