element樹形控制元件分步請求
阿新 • • 發佈:2018-12-19
1.【template】
<el-tree :data="orginOrgnData" node-key="id" ref="tree" :highlight-current="true" @node-click="getNodeData" :default-expanded-keys="[2, 3]" :default-checked-keys="[5]" :default-expand-all="true" :props="defaultProps" > </el-tree>
2.【method】
//獲取選單資料 getData(orgnCode) { //let orgnCode = JSON.parse(sessionStorage.getItem('sessionData')).orgnCode // sessionStorage.setItem('sessionData',JSON.stringify(sessData)); let parames = { "moduleName":this.A, "functionName": "uniformcertificationbiz.service.organ.OrgnService", "methodName": "qryOrgnList", "data": { "orgnCode": orgnCode, // "orgnStatus": "1" } } this.http(JSON.stringify(parames)) .then((res) => { console.log(res,"test>>>>>>>>>>>>>") this.organData = res.data.orgns.children; //console.log('>>>>>>>>>') // console.log(this.organData.children) // this.orginOrgnData = res.data.orgns }) .catch(err => { console.log(err) }) }, //獲取選單樹節點資料 getNodeData(n, m, j) { //children id title console.log("=n===========================================================",n); //node 結點 console.log("=m=========================================================",m); //Vue.component console.log("=i========================================================",j) this.nodeData = n; this.isShow = true; this.addShow = false; this.editShow = false; this.getFormData(); this.getData(this.nodeData.id); console.log("99999999===========================================================",this.nodeData.id); console.log(this.orginOrgnData) this.nodeData.children=this.organData; },