<a-card :bordered="false"> <div class="table-operator"> <a-button type="primary" icon="plus" </a-button> <a-button type="primary" icon="plus" @click="modalClick($event, "",'addz')"> </ a-table :columns="columns" :data-source="loadData" // data source :loading="loading" // Loading: Selections ="true" // Customize the selection of configuration items, Use the default option when set to true :rowClassName="rowClassName" // table rowClassName :customRow="customRow" // set row property :pagination="false" :rowKey="(record)=>record.orgId" class="borderTable" > <template v-slot:action="text,record,index"> <a-button @click.stop="modalClick($event,record,'views')" type="link" class="ownerLinkFirst"> </a-button> < A-button @click.stop="modalClick($event,record,'edit')" type="link" class="ownerLink"> </a-button> </template> </a-table> </a-card> //============================================================= rowClassName(record, index) { return record.orgId === this.rowClassId ? 'clickRowStyle' : CustomRow (Record, index) {return {on: {click: (eee) => {selectObj = record this.rowClassid = record.orgid console.log(selectObj,' see parameters ')}}}}, SearchFormUctOrg () {searchFormUctOrg() {searchFormUctOrg() {searchFormUctOrg() { You can configure the childrenColumnName if it is not needed or configured for another field. this.loading = true let requestParameters = Object.assign({ pageName: 'org-manager', formName: 'searchForm', 'uctOrg.w_sysEname': this.$sysEname, orderBy: 'create_time desc' // }, pagination, this.queryParam) }, this.queryParam) getCommonList(requestParameters).then(res => { this.rowClassId = ''; selectObj = {}; This. loadData = eachArray(res.rows, 0, 'orgId', 'fatherId', 'uctOrg'); this.loading = false console.log(res.rows,'res.rows') console.log(this.loadData,'this.loadData') }) }, / / = = = = = = = = = = = = turn the method of tree = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = export function eachArray(list,num,thisName,fatherName,key,fatherCode,listObj){ const arrList = []; if(list.lenght == 0 || ! thisName || ! FatherName){alert('eachArray method missing execution arguments! ') return; } for(let i = 0; i < list.length; i++) { let objNew = list[i]; If (key) {objNew = list [I] [key]} the if (objNew [fatherName] = = = num | | objNew [fatherName] = = = num. The toString ()) {/ / prevent type different 0 "0" Let comCode = objNew[thisName]; // Current id // objnew. title = objNew.comName; arrList.push(objNew); let newArray = list.slice(0); // create a newArray newarray.splice (I,1); eachArray(newArray,'',thisName,fatherName,key,comCode,objNew); / / initializes the secondary / / eachArray (newArray, comCode, ' ', objNew, key, thisName, fatherName); Else {if(listObj && objNew[fatherName] == fatherCode){// objnew.title = objnew.name; let comCode = objNew[thisName]; // const newListObj = {children:[]}; if(listObj.children == undefined){ // const obj = {children:[]}; // Object.assign(listObj,obj); listObj.children = []; } listObj.children.push(objNew); // var newArray = JSON.parse(JSON.stringify(list)); let newArray = list.slice(0); // create a newArray newarray.splice (I,1); eachArray(newArray,'',thisName,fatherName,key,comCode,listObj.children[listObj.children.length-1]); // eachArray(newArray,'',thisName,fatherName,key,comCode,listObj.children[listObj.children.length-1]); } } } return arrList; }Copy the code