ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` if(config.path){ admin.req({ url: layui.setter.apiUrl.SlopsApi + '/Execute', data: { path: config.path, UserID: layui.data(layui.setter.tableName).userInfo.ID, }, done: function (res) { var nodes = []; // 思路: 使用对象属性特性,缓存每个MenuID对应的节点对象,用于判断对应的上级在不在,如果在,则可直接将节点挂接到其上级菜单节点下;不在则将节点放到根节点上 // rels 用于 建立MenuID 与 节点的关系 var tables = res.tables, len = tables.length, townlist = [], towns= {}; // 组装 Tom $.each(tables[0], function (idx, item){ if(!towns[item.TownID]){ var t = {TownID: item.TownID, TownName: item.TownName, villageList: []}; townlist.push(t); towns[item.TownID] = t; } towns[item.TownID].villageList.push({VillageID: item.VillageID, VillageName: item.VillageName }); }); view('hongbo-chooseVillage-body').send($('#hongbo-chooseVillage-fill').html(), $.extend({ type: config.type }, { townList: config.full ? datas.fullVillage : datas.villageList }, {townList: townlist}) ); form.render(null, 'hongbo-chooseVillage-form'); } }); } ``` ``` select distinct v.ID as VillageID, v.Name as VillageName,c.ID as TownID,c.Name as TownName from dbo.P_ProBidVill pb1 inner join dbo.f_getUserBidList(@UserID) ub on ub.BidID = pb1.BidID LEFT JOIN Slops.dbo.S_Village v on v.ID = pb1.Village LEFT JOIN Slops.dbo.S_County c on c.ID = v.CountyID ```