chart_classify.go 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. package data_manage
  2. import (
  3. "encoding/json"
  4. "eta/eta_api/controllers"
  5. "eta/eta_api/models"
  6. "eta/eta_api/models/data_manage"
  7. "eta/eta_api/models/system"
  8. "eta/eta_api/services/data"
  9. "eta/eta_api/services/data/data_manage_permission"
  10. "eta/eta_api/utils"
  11. "fmt"
  12. "time"
  13. )
  14. // 数据管理-分类模块
  15. type ChartClassifyController struct {
  16. controllers.BaseAuthController
  17. }
  18. //
  19. //// @Title 图表分类列表
  20. //// @Description 图表分类列表接口
  21. //// @Success 200 {object} data_manage.ChartClassifyListResp
  22. //// @router /chart_classify/list [get]
  23. //func (this *ChartClassifyController) ChartClassifyList() {
  24. // br := new(models.BaseResponse).Init()
  25. // defer func() {
  26. // this.Data["json"] = br
  27. // this.ServeJSON()
  28. // }()
  29. // rootList, err := data_manage.GetChartClassifyByParentId(0)
  30. // if err != nil {
  31. // br.Msg = "获取失败"
  32. // br.ErrMsg = "获取数据失败,Err:" + err.Error()
  33. // return
  34. // }
  35. //
  36. // classifyAll, err := data_manage.GetChartClassifyAll()
  37. // if err != nil {
  38. // br.Msg = "获取失败"
  39. // br.ErrMsg = "获取数据失败,Err:" + err.Error()
  40. // return
  41. // }
  42. //
  43. // nodeAll := make([]*data_manage.ChartClassifyItems, 0)
  44. // for k := range rootList {
  45. // rootNode := rootList[k]
  46. // data.ChartClassifyListMakeTree(classifyAll, rootNode)
  47. // nodeAll = append(nodeAll, rootNode)
  48. // }
  49. // resp := new(data_manage.ChartClassifyListResp)
  50. // resp.AllNodes = nodeAll
  51. // br.Ret = 200
  52. // br.Success = true
  53. // br.Msg = "获取成功"
  54. // br.Data = resp
  55. //}
  56. // ChartClassifyListV2
  57. // @Title 图表分类列表
  58. // @Description 图表分类列表接口
  59. // @Param IsShowMe query bool true "是否只看我的,true、false"
  60. // @Success 200 {object} data_manage.ChartClassifyListResp
  61. // @router /chart_classify/list [get]
  62. func (this *ChartClassifyController) ChartClassifyListV2() {
  63. br := new(models.BaseResponse).Init()
  64. defer func() {
  65. this.Data["json"] = br
  66. this.ServeJSON()
  67. }()
  68. resp := new(data_manage.ChartClassifyListResp)
  69. // 获取当前账号的不可见指标
  70. noPermissionChartIdMap := make(map[int]bool)
  71. {
  72. obj := data_manage.EdbInfoNoPermissionAdmin{}
  73. confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
  74. if err != nil && err.Error() != utils.ErrNoRow() {
  75. br.Msg = "获取失败"
  76. br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
  77. return
  78. }
  79. for _, v := range confList {
  80. noPermissionChartIdMap[v.ChartInfoId] = true
  81. }
  82. }
  83. isShowMe, _ := this.GetBool("IsShowMe")
  84. if isShowMe {
  85. errMsg, err := getChartClassifyListForMe(*this.SysUser, resp)
  86. if err != nil {
  87. br.Msg = errMsg
  88. br.ErrMsg = err.Error()
  89. return
  90. }
  91. // 移除没有权限的图表
  92. allNodes := data.HandleNoPermissionChart(resp.AllNodes, noPermissionChartIdMap, this.SysUser.AdminId)
  93. resp.AllNodes = allNodes
  94. br.Ret = 200
  95. br.Success = true
  96. br.Msg = "获取成功"
  97. br.Data = resp
  98. fmt.Println("source my classify")
  99. return
  100. }
  101. //判断是否存在缓存,如果存在缓存,那么直接从缓存中获取
  102. key := utils.CACHE_CHART_CLASSIFY
  103. if utils.Re == nil {
  104. if utils.Re == nil && utils.Rc.IsExist(key) {
  105. if redisData, err1 := utils.Rc.RedisBytes(key); err1 == nil {
  106. err := json.Unmarshal(redisData, &resp)
  107. if err == nil && resp != nil {
  108. // 移除没有权限的图表
  109. allNodes := data.HandleNoPermissionChart(resp.AllNodes, noPermissionChartIdMap, this.SysUser.AdminId)
  110. resp.AllNodes = allNodes
  111. br.Ret = 200
  112. br.Success = true
  113. br.Msg = "获取成功"
  114. br.Data = resp
  115. fmt.Println("source redis")
  116. return
  117. }
  118. }
  119. }
  120. }
  121. rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_DEFAULT)
  122. if err != nil && err.Error() != utils.ErrNoRow() {
  123. br.Msg = "获取失败"
  124. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  125. return
  126. }
  127. classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_DEFAULT)
  128. if err != nil && err.Error() != utils.ErrNoRow() {
  129. br.Msg = "获取失败"
  130. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  131. return
  132. }
  133. allChartInfo, err := data_manage.GetChartInfoAll([]int{utils.CHART_SOURCE_DEFAULT})
  134. if err != nil && err.Error() != utils.ErrNoRow() {
  135. br.Msg = "获取失败"
  136. br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
  137. return
  138. }
  139. chartInfoMap := make(map[int][]*data_manage.ChartClassifyItems)
  140. for _, v := range allChartInfo {
  141. chartInfoMap[v.ChartClassifyId] = append(chartInfoMap[v.ChartClassifyId], v)
  142. }
  143. rootChildMap := make(map[int][]*data_manage.ChartClassifyItems)
  144. for _, v := range classifyAll {
  145. rootChildMap[v.ParentId] = append(rootChildMap[v.ParentId], v)
  146. if existItems, ok := chartInfoMap[v.ChartClassifyId]; ok {
  147. v.Children = existItems
  148. } else {
  149. items := make([]*data_manage.ChartClassifyItems, 0)
  150. v.Children = items
  151. }
  152. }
  153. nodeAll := make([]*data_manage.ChartClassifyItems, 0)
  154. for _, v := range rootList {
  155. if existItems, ok := rootChildMap[v.ChartClassifyId]; ok {
  156. v.Children = existItems
  157. } else {
  158. items := make([]*data_manage.ChartClassifyItems, 0)
  159. v.Children = items
  160. }
  161. nodeAll = append(nodeAll, v)
  162. }
  163. //
  164. //
  165. //nodeAll := make([]*data_manage.ChartClassifyItems, 0)
  166. //for k := range rootList {
  167. // rootNode := rootList[k]
  168. // data.ChartClassifyListMakeTree(classifyAll, rootNode)
  169. // nodeAll = append(nodeAll, rootNode)
  170. //}
  171. resp.AllNodes = nodeAll
  172. // 将数据加入缓存
  173. if utils.Re == nil {
  174. redisData, _ := json.Marshal(resp)
  175. utils.Rc.Put(key, redisData, 2*time.Hour)
  176. }
  177. // 移除没有权限的图表
  178. allNodes := data.HandleNoPermissionChart(resp.AllNodes, noPermissionChartIdMap, this.SysUser.AdminId)
  179. resp.AllNodes = allNodes
  180. br.Ret = 200
  181. br.Success = true
  182. br.Msg = "获取成功"
  183. br.Data = resp
  184. }
  185. // getChartClassifyListForMe 获取我创建的图表
  186. func getChartClassifyListForMe(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
  187. rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_DEFAULT)
  188. if err != nil && err.Error() != utils.ErrNoRow() {
  189. errMsg = "获取失败"
  190. return
  191. }
  192. classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_DEFAULT)
  193. if err != nil && err.Error() != utils.ErrNoRow() {
  194. errMsg = "获取失败"
  195. return
  196. }
  197. allChartInfo, err := data_manage.GetChartInfoByAdminId([]int{utils.CHART_SOURCE_DEFAULT}, adminInfo.AdminId)
  198. if err != nil && err.Error() != utils.ErrNoRow() {
  199. errMsg = "获取失败"
  200. return
  201. }
  202. chartInfoMap := make(map[int][]*data_manage.ChartClassifyItems)
  203. for _, v := range allChartInfo {
  204. chartInfoMap[v.ChartClassifyId] = append(chartInfoMap[v.ChartClassifyId], v)
  205. }
  206. rootChildMap := make(map[int][]*data_manage.ChartClassifyItems)
  207. for _, v := range classifyAll {
  208. rootChildMap[v.ParentId] = append(rootChildMap[v.ParentId], v)
  209. if existItems, ok := chartInfoMap[v.ChartClassifyId]; ok {
  210. v.Children = existItems
  211. } else {
  212. items := make([]*data_manage.ChartClassifyItems, 0)
  213. v.Children = items
  214. }
  215. }
  216. nodeAll := make([]*data_manage.ChartClassifyItems, 0)
  217. for _, v := range rootList {
  218. if existItems, ok := rootChildMap[v.ChartClassifyId]; ok {
  219. v.Children = existItems
  220. } else {
  221. items := make([]*data_manage.ChartClassifyItems, 0)
  222. v.Children = items
  223. }
  224. nodeAll = append(nodeAll, v)
  225. }
  226. resp.AllNodes = nodeAll
  227. return
  228. }
  229. // ChartClassifyItems
  230. // @Title 获取所有图表分类接口-不包含图表
  231. // @Description 获取所有图表分类接口-不包含图表
  232. // @Success 200 {object} data_manage.ChartClassifyListResp
  233. // @router /chart_classify/items [get]
  234. func (this *ChartClassifyController) ChartClassifyItems() {
  235. br := new(models.BaseResponse).Init()
  236. defer func() {
  237. this.Data["json"] = br
  238. this.ServeJSON()
  239. }()
  240. level, _ := this.GetInt(`Level`)
  241. rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_DEFAULT)
  242. if err != nil {
  243. br.Msg = "获取失败"
  244. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  245. return
  246. }
  247. classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_DEFAULT)
  248. if err != nil {
  249. br.Msg = "获取失败"
  250. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  251. return
  252. }
  253. // 已授权分类id
  254. permissionClassifyIdList, err := data_manage_permission.GetUserChartClassifyPermissionList(this.SysUser.AdminId, 0)
  255. if err != nil {
  256. br.Msg = "获取失败"
  257. br.ErrMsg = "获取已授权分类id数据失败,Err:" + err.Error()
  258. return
  259. }
  260. nodeAll := make([]*data_manage.ChartClassifyItems, 0)
  261. for k := range rootList {
  262. rootNode := rootList[k]
  263. data.ChartClassifyItemsMakeTree(this.SysUser, classifyAll, rootNode, permissionClassifyIdList, level)
  264. nodeAll = append(nodeAll, rootNode)
  265. }
  266. language := `CN`
  267. // 指标显示的语言
  268. {
  269. configDetail, _ := system.GetConfigDetailByCode(this.SysUser.AdminId, system.ChartLanguageVar)
  270. if configDetail != nil {
  271. language = configDetail.ConfigValue
  272. } else {
  273. configDetail, _ = system.GetDefaultConfigDetailByCode(system.ChartLanguageVar)
  274. if configDetail != nil {
  275. language = configDetail.ConfigValue
  276. }
  277. }
  278. }
  279. // 是否允许添加分类
  280. canOpClassify := true
  281. // 如果不是 超管 或者 ficc管理员 或者 ficc研究员,那么就没有权限
  282. //if !utils.InArrayByStr([]string{utils.ROLE_TYPE_CODE_ADMIN, utils.ROLE_TYPE_CODE_FICC_ADMIN, utils.ROLE_TYPE_CODE_RESEARCHR, utils.ROLE_TYPE_CODE_FICC_RESEARCHR}, this.SysUser.RoleTypeCode) {
  283. // canOpClassify = false
  284. //}
  285. resp := data_manage.ChartClassifyListResp{
  286. AllNodes: nodeAll,
  287. Language: language,
  288. CanOpClassify: canOpClassify,
  289. }
  290. br.Ret = 200
  291. br.Success = true
  292. br.Msg = "获取成功"
  293. br.Data = resp
  294. }
  295. // @Title 新增图表分类
  296. // @Description 新增图表分类接口
  297. // @Param request body data_manage.AddChartClassifyReq true "type json string"
  298. // @Success 200 Ret=200 保存成功
  299. // @router /chart_classify/add [post]
  300. func (this *ChartClassifyController) AddChartClassify() {
  301. br := new(models.BaseResponse).Init()
  302. defer func() {
  303. this.Data["json"] = br
  304. this.ServeJSON()
  305. }()
  306. var req data_manage.AddChartClassifyReq
  307. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  308. if err != nil {
  309. br.Msg = "参数解析异常!"
  310. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  311. return
  312. }
  313. if req.ChartClassifyName == "" {
  314. br.Msg = "请输入分类名称"
  315. br.IsSendEmail = false
  316. return
  317. }
  318. if req.ParentId < 0 {
  319. br.Msg = "参数错误"
  320. br.IsSendEmail = false
  321. return
  322. }
  323. // 新增图表分类
  324. _, err, errMsg, isSendEmail := data.AddChartClassify(req.ChartClassifyName, req.ParentId, req.Level, utils.CHART_SOURCE_DEFAULT, this.Lang, this.SysUser)
  325. if err != nil {
  326. br.Msg = errMsg
  327. br.ErrMsg = "添加分类失败,Err:" + err.Error()
  328. br.IsSendEmail = isSendEmail
  329. return
  330. }
  331. br.Ret = 200
  332. br.Msg = "保存成功"
  333. br.Success = true
  334. }
  335. // EditChartClassify
  336. // @Title 修改图表分类
  337. // @Description 修改图表分类接口
  338. // @Param request body data_manage.EditChartClassifyReq true "type json string"
  339. // @Success 200 Ret=200 修改成功
  340. // @router /chart_classify/edit [post]
  341. func (this *ChartClassifyController) EditChartClassify() {
  342. br := new(models.BaseResponse).Init()
  343. defer func() {
  344. this.Data["json"] = br
  345. this.ServeJSON()
  346. }()
  347. var req data_manage.EditChartClassifyReq
  348. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  349. if err != nil {
  350. br.Msg = "参数解析异常!"
  351. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  352. return
  353. }
  354. if req.ChartClassifyName == "" {
  355. br.Msg = "请输入分类名称"
  356. br.IsSendEmail = false
  357. return
  358. }
  359. if req.ChartClassifyId <= 0 {
  360. br.Msg = "参数错误"
  361. br.IsSendEmail = false
  362. return
  363. }
  364. // 编辑图表分类
  365. _, err, errMsg, isSendEmail := data.EditChartClassifyV2(req.ChartClassifyId, req.ParentId, utils.CHART_SOURCE_DEFAULT, req.ChartClassifyName, this.Lang)
  366. if err != nil {
  367. br.Msg = errMsg
  368. br.ErrMsg = "保存分类失败,Err:" + err.Error()
  369. br.IsSendEmail = isSendEmail
  370. return
  371. }
  372. br.Ret = 200
  373. br.Msg = "保存成功"
  374. br.Success = true
  375. br.IsAddLog = true
  376. }
  377. // @Title 删除图表检测接口
  378. // @Description 删除图表检测接口
  379. // @Param request body data_manage.ChartClassifyDeleteCheckResp true "type json string"
  380. // @Success 200 Ret=200 检测成功
  381. // @router /chart_classify/delete/check [post]
  382. func (this *ChartClassifyController) DeleteChartClassifyCheck() {
  383. br := new(models.BaseResponse).Init()
  384. defer func() {
  385. this.Data["json"] = br
  386. this.ServeJSON()
  387. }()
  388. var req data_manage.ChartClassifyDeleteCheckReq
  389. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  390. if err != nil {
  391. br.Msg = "参数解析异常!"
  392. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  393. return
  394. }
  395. if req.ChartClassifyId < 0 && req.ChartInfoId <= 0 {
  396. br.Msg = "参数错误"
  397. br.IsSendEmail = false
  398. return
  399. }
  400. var deleteStatus int
  401. var tipsMsg string
  402. //删除分类
  403. if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
  404. // 查找分类
  405. item, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
  406. if err != nil {
  407. br.Msg = "保存失败"
  408. br.Msg = "获取分类信息失败,Err:" + err.Error()
  409. return
  410. }
  411. // 已授权分类id
  412. permissionClassifyIdList, err := data_manage_permission.GetUserChartClassifyPermissionList(this.SysUser.AdminId, item.ChartClassifyId)
  413. if err != nil {
  414. br.Msg = "获取失败"
  415. br.ErrMsg = "获取已授权分类id数据失败,Err:" + err.Error()
  416. return
  417. }
  418. // 权限校验
  419. {
  420. haveOperaAuth := data_manage_permission.CheckEdbClassifyPermissionByPermissionIdList(item.IsJoinPermission, item.ChartClassifyId, permissionClassifyIdList)
  421. button := data.GetChartClassifyOpButton(this.SysUser, item.SysUserId, haveOperaAuth)
  422. if !button.OpButton {
  423. br.Msg = "无操作权限"
  424. br.IsSendEmail = false
  425. return
  426. }
  427. }
  428. //判断图表分类下,是否含有图表
  429. count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
  430. if err != nil {
  431. br.Msg = "删除失败"
  432. br.ErrMsg = "分类下是否含有指标失败,Err:" + err.Error()
  433. return
  434. }
  435. if count > 0 {
  436. deleteStatus = 1
  437. tipsMsg = "该分类下关联图表不可删除"
  438. }
  439. }
  440. if deleteStatus != 1 && req.ChartInfoId == 0 {
  441. classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
  442. if err != nil && err.Error() != utils.ErrNoRow() {
  443. br.Msg = "删除失败"
  444. br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
  445. return
  446. }
  447. if classifyCount > 0 {
  448. deleteStatus = 2
  449. tipsMsg = "确认删除当前目录及包含的子目录吗"
  450. }
  451. }
  452. if deleteStatus == 0 {
  453. tipsMsg = "可删除,进行删除操作"
  454. }
  455. resp := new(data_manage.ChartClassifyDeleteCheckResp)
  456. resp.DeleteStatus = deleteStatus
  457. resp.TipsMsg = tipsMsg
  458. br.Ret = 200
  459. br.Msg = "检测成功"
  460. br.Success = true
  461. br.Data = resp
  462. }
  463. // @Title 删除图表分类/图表
  464. // @Description 删除图表分类/图表接口
  465. // @Param request body data_manage.DeleteChartClassifyReq true "type json string"
  466. // @Success 200 Ret=200 删除成功
  467. // @router /chart_classify/delete [post]
  468. func (this *ChartClassifyController) DeleteChartClassify() {
  469. br := new(models.BaseResponse).Init()
  470. defer func() {
  471. this.Data["json"] = br
  472. this.ServeJSON()
  473. }()
  474. sysUser := this.SysUser
  475. if sysUser == nil {
  476. br.Msg = "请登录"
  477. br.ErrMsg = "请登录,SysUser Is Empty"
  478. br.Ret = 408
  479. return
  480. }
  481. var req data_manage.DeleteChartClassifyReq
  482. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  483. if err != nil {
  484. br.Msg = "参数解析异常!"
  485. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  486. return
  487. }
  488. if req.ChartClassifyId < 0 && req.ChartInfoId <= 0 {
  489. br.Msg = "参数错误"
  490. br.IsSendEmail = false
  491. return
  492. }
  493. //删除分类
  494. if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
  495. // 查找分类
  496. item, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
  497. if err != nil {
  498. br.Msg = "保存失败"
  499. br.Msg = "获取分类信息失败,Err:" + err.Error()
  500. return
  501. }
  502. // 已授权分类id
  503. permissionClassifyIdList, err := data_manage_permission.GetUserChartClassifyPermissionList(this.SysUser.AdminId, item.ChartClassifyId)
  504. if err != nil {
  505. br.Msg = "获取失败"
  506. br.ErrMsg = "获取已授权分类id数据失败,Err:" + err.Error()
  507. return
  508. }
  509. // 权限校验
  510. {
  511. haveOperaAuth := data_manage_permission.CheckChartClassifyPermissionByPermissionIdList(item.IsJoinPermission, item.ChartClassifyId, permissionClassifyIdList)
  512. button := data.GetChartClassifyOpButton(this.SysUser, item.SysUserId, haveOperaAuth)
  513. if !button.OpButton {
  514. br.Msg = "无操作权限"
  515. br.IsSendEmail = false
  516. return
  517. }
  518. }
  519. //判断是否含有指标
  520. count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
  521. if err != nil && err.Error() != utils.ErrNoRow() {
  522. br.Msg = "删除失败"
  523. br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
  524. return
  525. }
  526. if count > 0 {
  527. br.Msg = "该目录下存在关联指标,不可删除"
  528. br.IsSendEmail = false
  529. return
  530. }
  531. err = data_manage.DeleteChartClassify(req.ChartClassifyId)
  532. if err != nil {
  533. br.Msg = "删除失败"
  534. br.ErrMsg = "删除失败,Err:" + err.Error()
  535. return
  536. }
  537. }
  538. resp := new(data_manage.AddChartInfoResp)
  539. //删除图表
  540. if req.ChartInfoId > 0 {
  541. chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
  542. if err != nil {
  543. if err.Error() == utils.ErrNoRow() {
  544. br.Msg = "图表已删除,请刷新页面"
  545. br.ErrMsg = "指标不存在,Err:" + err.Error()
  546. return
  547. } else {
  548. br.Msg = "删除失败"
  549. br.ErrMsg = "删除失败,获取指标信息失败,Err:" + err.Error()
  550. return
  551. }
  552. }
  553. if chartInfo == nil {
  554. br.Msg = "图表已删除,请刷新页面"
  555. return
  556. }
  557. chartClassifyItem, err := data_manage.GetChartClassifyById(chartInfo.ChartClassifyId)
  558. if err != nil {
  559. br.Msg = "获取失败"
  560. br.ErrMsg = "获取图表分类详情数据失败,Err:" + err.Error()
  561. return
  562. }
  563. // 已授权图表、分类id
  564. permissionChartIdList, permissionClassifyIdList, err := data_manage_permission.GetUserChartAndClassifyPermissionList(this.SysUser.AdminId, chartInfo.ChartInfoId, chartInfo.ChartClassifyId)
  565. if err != nil {
  566. br.Msg = "获取失败"
  567. br.ErrMsg = "获取已授权分类id数据失败,Err:" + err.Error()
  568. return
  569. }
  570. // 权限校验
  571. {
  572. haveOperaAuth := data_manage_permission.CheckChartPermissionByPermissionIdList(chartInfo.IsJoinPermission, chartClassifyItem.IsJoinPermission, chartInfo.ChartInfoId, chartInfo.ChartClassifyId, permissionChartIdList, permissionClassifyIdList)
  573. //图表操作权限
  574. ok := data.CheckOpChartPermission(sysUser, chartInfo.SysUserId, haveOperaAuth)
  575. if !ok {
  576. br.Msg = "没有该图表的操作权限"
  577. br.ErrMsg = "没有该图表的操作权限"
  578. return
  579. }
  580. }
  581. // 获取引用该图表的MyCharts, 用于ES删除
  582. var myCond string
  583. var myPars []interface{}
  584. myCond += ` AND a.chart_info_id = ? `
  585. myPars = append(myPars, req.ChartInfoId)
  586. myCharts, e := data_manage.GetMyChartListGroupByCharyInfoIdAndAdminIdByCondition(myCond, myPars)
  587. if e != nil {
  588. br.Msg = "删除失败"
  589. br.ErrMsg = "获取引用图表的MyChats失败, Err: " + e.Error()
  590. return
  591. }
  592. myIds := make([]int, 0)
  593. for _, m := range myCharts {
  594. myIds = append(myIds, m.MyChartId)
  595. }
  596. //删除图表及关联指标
  597. err = data_manage.DeleteChartInfoAndData(req.ChartInfoId)
  598. if err != nil {
  599. br.Msg = "删除失败"
  600. br.ErrMsg = "删除失败,Err:" + err.Error()
  601. return
  602. }
  603. if chartInfo.ChartType == utils.CHART_TYPE_SECTION_COMBINE {
  604. err = data_manage.DeleteChartSeriesAndEdbMapping(req.ChartInfoId)
  605. if err != nil {
  606. br.Msg = "删除失败"
  607. br.ErrMsg = "删除失败,Err:" + err.Error()
  608. return
  609. }
  610. }
  611. //删除ES
  612. {
  613. go data.EsDeleteChartInfo(req.ChartInfoId)
  614. // 删除MY ETA 图表 es数据
  615. //go data.EsDeleteMyChartInfoByChartInfoId(req.ChartInfoId)
  616. go data.EsDeleteMyChartInfoByMyChartIds(myIds)
  617. }
  618. var condition string
  619. var pars []interface{}
  620. condition += " AND chart_classify_id=? AND source = ? "
  621. pars = append(pars, chartInfo.ChartClassifyId, utils.CHART_SOURCE_DEFAULT)
  622. condition += " AND chart_info_id>? ORDER BY create_time ASC LIMIT 1 "
  623. pars = append(pars, req.ChartInfoId)
  624. nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
  625. if err != nil && err.Error() != utils.ErrNoRow() {
  626. br.Msg = "删除失败"
  627. br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
  628. return
  629. }
  630. if nextItem != nil {
  631. resp.UniqueCode = nextItem.UniqueCode
  632. resp.ChartInfoId = nextItem.ChartInfoId
  633. } else {
  634. var condition string
  635. var pars []interface{}
  636. condition += " AND level=3 "
  637. //pars = append(pars, chartInfo.ChartClassifyId)
  638. condition += " AND chart_classify_id>? ORDER BY chart_classify_id ASC LIMIT 1 "
  639. pars = append(pars, chartInfo.ChartClassifyId)
  640. classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
  641. if err != nil && err.Error() != utils.ErrNoRow() {
  642. br.Msg = "删除失败"
  643. br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
  644. return
  645. }
  646. if classifyItem != nil {
  647. nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
  648. if err != nil && err.Error() != utils.ErrNoRow() {
  649. br.Msg = "删除失败"
  650. br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
  651. return
  652. }
  653. if nextItem != nil {
  654. resp.UniqueCode = nextItem.UniqueCode
  655. resp.ChartInfoId = nextItem.ChartInfoId
  656. }
  657. }
  658. }
  659. // 删除图表中的指标引用
  660. _ = data_manage.DeleteEdbRelationByObjectId(req.ChartInfoId, utils.EDB_RELATION_CHART)
  661. //新增操作日志
  662. {
  663. chartLog := new(data_manage.ChartInfoLog)
  664. chartLog.ChartName = chartInfo.ChartName
  665. chartLog.ChartInfoId = req.ChartInfoId
  666. chartLog.ChartClassifyId = chartInfo.ChartClassifyId
  667. chartLog.SysUserId = sysUser.AdminId
  668. chartLog.SysUserRealName = sysUser.RealName
  669. chartLog.UniqueCode = chartInfo.UniqueCode
  670. chartLog.CreateTime = time.Now()
  671. chartLog.Content = string(this.Ctx.Input.RequestBody)
  672. chartLog.Status = "删除图表"
  673. chartLog.Method = this.Ctx.Input.URI()
  674. go data_manage.AddChartInfoLog(chartLog)
  675. }
  676. }
  677. br.Ret = 200
  678. br.Msg = "删除成功"
  679. br.Success = true
  680. br.Data = resp
  681. br.IsAddLog = true
  682. }
  683. // ChartClassifyMove
  684. // @Title 图表分类移动接口
  685. // @Description 图表分类移动接口
  686. // @Success 200 {object} data_manage.MoveChartClassifyReq
  687. // @router /chart_classify/move [post]
  688. func (this *ChartClassifyController) ChartClassifyMove() {
  689. br := new(models.BaseResponse).Init()
  690. defer func() {
  691. if br.ErrMsg == "" {
  692. br.IsSendEmail = false
  693. }
  694. this.Data["json"] = br
  695. this.ServeJSON()
  696. }()
  697. sysUser := this.SysUser
  698. if sysUser == nil {
  699. br.Msg = "请登录"
  700. br.ErrMsg = "请登录,SysUser Is Empty"
  701. br.Ret = 408
  702. return
  703. }
  704. var req data_manage.MoveChartClassifyReq
  705. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  706. if err != nil {
  707. br.Msg = "参数解析异常!"
  708. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  709. return
  710. }
  711. if req.ClassifyId <= 0 {
  712. br.Msg = "参数错误"
  713. br.ErrMsg = "分类id小于等于0"
  714. return
  715. }
  716. //判断分类是否存在
  717. chartClassifyInfo, err := data_manage.GetChartClassifyById(req.ClassifyId)
  718. if err != nil {
  719. if err.Error() == utils.ErrNoRow() {
  720. br.Msg = "分类不存在,请刷新页面"
  721. return
  722. }
  723. br.Msg = "移动失败"
  724. br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
  725. return
  726. }
  727. // 校验移动的父级目录下是否有重名分类
  728. exists, e := data_manage.GetChartClassifyByParentIdAndName(req.ParentClassifyId, chartClassifyInfo.ChartClassifyName, req.ClassifyId)
  729. if e != nil && e.Error() != utils.ErrNoRow() {
  730. br.Msg = "移动失败"
  731. br.ErrMsg = "获取父级目录下的同名分类失败, Err: " + e.Error()
  732. return
  733. }
  734. if exists != nil {
  735. br.Msg = "移动失败,分类名称已存在"
  736. return
  737. }
  738. // 已授权分类id
  739. permissionClassifyIdList, err := data_manage_permission.GetUserChartClassifyPermissionList(this.SysUser.AdminId, chartClassifyInfo.ChartClassifyId)
  740. if err != nil {
  741. br.Msg = "获取失败"
  742. br.ErrMsg = "获取已授权分类id数据失败,Err:" + err.Error()
  743. return
  744. }
  745. // 权限校验
  746. {
  747. haveOperaAuth := data_manage_permission.CheckEdbClassifyPermissionByPermissionIdList(chartClassifyInfo.IsJoinPermission, chartClassifyInfo.ChartClassifyId, permissionClassifyIdList)
  748. button := data.GetChartClassifyOpButton(this.SysUser, chartClassifyInfo.SysUserId, haveOperaAuth)
  749. if !button.OpButton {
  750. br.Msg = "无操作权限"
  751. br.IsSendEmail = false
  752. return
  753. }
  754. }
  755. if chartClassifyInfo.Source != utils.CHART_SOURCE_DEFAULT {
  756. br.Msg = "分类异常"
  757. br.ErrMsg = "分类异常,不是ETA图库的分类"
  758. return
  759. }
  760. updateCol := make([]string, 0)
  761. //判断上级id是否一致,如果不一致的话,那么需要移动该分类层级
  762. if chartClassifyInfo.ParentId != req.ParentClassifyId && req.ParentClassifyId != 0 {
  763. parentChartClassifyInfo, err := data_manage.GetChartClassifyById(req.ParentClassifyId)
  764. if err != nil {
  765. br.Msg = "移动失败"
  766. br.ErrMsg = "获取上级分类信息失败,Err:" + err.Error()
  767. return
  768. }
  769. chartClassifyInfo.ParentId = parentChartClassifyInfo.ChartClassifyId
  770. chartClassifyInfo.Level = parentChartClassifyInfo.Level + 1
  771. chartClassifyInfo.ModifyTime = time.Now()
  772. updateCol = append(updateCol, "ParentId", "Level", "ModifyTime")
  773. }
  774. //如果有传入 上一个兄弟节点分类id
  775. if req.PrevClassifyId > 0 {
  776. //上一个兄弟节点
  777. prevClassify, err := data_manage.GetChartClassifyById(req.PrevClassifyId)
  778. if err != nil {
  779. br.Msg = "移动失败"
  780. br.ErrMsg = "获取上一个兄弟节点分类信息失败,Err:" + err.Error()
  781. return
  782. }
  783. //如果是移动在两个兄弟节点之间
  784. if req.NextClassifyId > 0 {
  785. //下一个兄弟节点
  786. nextClassify, err := data_manage.GetChartClassifyById(req.NextClassifyId)
  787. if err != nil {
  788. br.Msg = "移动失败"
  789. br.ErrMsg = "获取下一个兄弟节点分类信息失败,Err:" + err.Error()
  790. return
  791. }
  792. //如果上一个兄弟与下一个兄弟的排序权重是一致的,那么需要将下一个兄弟(以及下个兄弟的同样排序权重)的排序权重+2,自己变成上一个兄弟的排序权重+1
  793. if prevClassify.Sort == nextClassify.Sort || prevClassify.Sort == chartClassifyInfo.Sort {
  794. //变更兄弟节点的排序
  795. updateSortStr := `sort + 2`
  796. _ = data_manage.UpdateChartClassifySortByParentId(prevClassify.ParentId, prevClassify.ChartClassifyId, prevClassify.Sort, updateSortStr)
  797. } else {
  798. //如果下一个兄弟的排序权重正好是上个兄弟节点的下一层,那么需要再加一层了
  799. if nextClassify.Sort-prevClassify.Sort == 1 {
  800. //变更兄弟节点的排序
  801. updateSortStr := `sort + 1`
  802. _ = data_manage.UpdateChartClassifySortByParentId(prevClassify.ParentId, 0, prevClassify.Sort, updateSortStr)
  803. }
  804. }
  805. }
  806. chartClassifyInfo.Sort = prevClassify.Sort + 1
  807. chartClassifyInfo.ModifyTime = time.Now()
  808. updateCol = append(updateCol, "Sort", "ModifyTime")
  809. } else {
  810. firstClassify, err := data_manage.GetFirstChartClassifyByParentId(chartClassifyInfo.ParentId)
  811. if err != nil && err.Error() != utils.ErrNoRow() {
  812. br.Msg = "移动失败"
  813. br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
  814. return
  815. }
  816. //如果该分类下存在其他分类,且第一个其他分类的排序等于0,那么需要调整排序
  817. if firstClassify != nil && firstClassify.Sort == 0 {
  818. updateSortStr := ` sort + 1 `
  819. _ = data_manage.UpdateChartClassifySortByParentId(firstClassify.ParentId, firstClassify.ChartClassifyId-1, 0, updateSortStr)
  820. }
  821. chartClassifyInfo.Sort = 0 //那就是排在第一位
  822. chartClassifyInfo.ModifyTime = time.Now()
  823. updateCol = append(updateCol, "Sort", "ModifyTime")
  824. }
  825. //更新
  826. if len(updateCol) > 0 {
  827. err = chartClassifyInfo.Update(updateCol)
  828. if err != nil {
  829. br.Msg = "移动失败"
  830. br.ErrMsg = "修改失败,Err:" + err.Error()
  831. return
  832. }
  833. }
  834. br.Ret = 200
  835. br.Success = true
  836. br.Msg = "移动成功"
  837. }
  838. // getChartClassifyListForMe 获取我创建的图表分类
  839. func getChartClassifyListForMeV2(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
  840. rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_DEFAULT)
  841. if err != nil && err.Error() != utils.ErrNoRow() {
  842. errMsg = "获取失败"
  843. return
  844. }
  845. classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_DEFAULT)
  846. if err != nil && err.Error() != utils.ErrNoRow() {
  847. errMsg = "获取失败"
  848. return
  849. }
  850. rootChildMap := make(map[int][]*data_manage.ChartClassifyItems)
  851. for _, v := range classifyAll {
  852. rootChildMap[v.ParentId] = append(rootChildMap[v.ParentId], v)
  853. }
  854. nodeAll := make([]*data_manage.ChartClassifyItems, 0)
  855. for _, v := range rootList {
  856. if existItems, ok := rootChildMap[v.ChartClassifyId]; ok {
  857. v.Children = existItems
  858. } else {
  859. items := make([]*data_manage.ChartClassifyItems, 0)
  860. v.Children = items
  861. }
  862. nodeAll = append(nodeAll, v)
  863. }
  864. resp.AllNodes = nodeAll
  865. return
  866. }
  867. // ChartClassifyChartListV2
  868. // @Title 根据图表分类获取图表列表
  869. // @Description 根据图表分类获取图表列表接口
  870. // @Param IsShowMe query bool true "是否只看我的,true、false"
  871. // @Param ChartClassifyId query bool true "图片分类id"
  872. // @Success 200 {object} data_manage.ChartClassifyListResp
  873. // @router /chart_classify/chart/list [get]
  874. func (this *ChartClassifyController) ChartClassifyChartListV2() {
  875. br := new(models.BaseResponse).Init()
  876. defer func() {
  877. this.Data["json"] = br
  878. this.ServeJSON()
  879. }()
  880. sysUser := this.SysUser
  881. if sysUser == nil {
  882. br.Msg = "请登录"
  883. br.ErrMsg = "请登录,SysUser Is Empty"
  884. br.Ret = 408
  885. return
  886. }
  887. resp := new(data_manage.ChartClassifyListResp)
  888. chartClassifyId, _ := this.GetInt("ChartClassifyId")
  889. if chartClassifyId <= 0 {
  890. br.Msg = "参数错误"
  891. return
  892. }
  893. // 获取当前账号的不可见指标
  894. noPermissionChartIdMap := make(map[int]bool)
  895. {
  896. obj := data_manage.EdbInfoNoPermissionAdmin{}
  897. confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
  898. if err != nil && err.Error() != utils.ErrNoRow() {
  899. br.Msg = "获取失败"
  900. br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
  901. return
  902. }
  903. for _, v := range confList {
  904. noPermissionChartIdMap[v.ChartInfoId] = true
  905. }
  906. }
  907. isShowMe, _ := this.GetBool("IsShowMe")
  908. if isShowMe {
  909. allChartInfo, err := data_manage.GetChartInfoByAdminIdAndClassify([]int{utils.CHART_SOURCE_DEFAULT}, sysUser.AdminId, chartClassifyId)
  910. if err != nil && err.Error() != utils.ErrNoRow() {
  911. br.Msg = "获取失败"
  912. br.ErrMsg = "获取全部数据失败,Err:" + err.Error()
  913. return
  914. }
  915. // 移除没有权限的图表
  916. allNodes := data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
  917. resp.AllNodes = allNodes
  918. br.Ret = 200
  919. br.Success = true
  920. br.Msg = "获取成功"
  921. br.Data = resp
  922. fmt.Println("source my classify")
  923. return
  924. }
  925. allChartInfo, err := data_manage.GetChartInfoAllByClassifyId(utils.CHART_SOURCE_DEFAULT, chartClassifyId)
  926. if err != nil && err.Error() != utils.ErrNoRow() {
  927. br.Msg = "获取失败"
  928. br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
  929. return
  930. }
  931. // 移除没有权限的图表
  932. allNodes := data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
  933. for k, item := range allNodes {
  934. item.Button = data.GetChartOpButton(this.SysUser, item.SysUserId, item.HaveOperaAuth)
  935. item.Button.AddButton = false
  936. item.Button.OpButton = false
  937. item.Button.DeleteButton = false
  938. allNodes[k] = item
  939. }
  940. resp.AllNodes = allNodes
  941. br.Ret = 200
  942. br.Success = true
  943. br.Msg = "获取成功"
  944. br.Data = resp
  945. }
  946. // ChartClassifyChartListV3
  947. // @Title 根据图表分类获取图表列表-包含分类和图表
  948. // @Description 根据图表分类获取图表列表接口-包含分类和图表
  949. // @Param IsShowMe query bool true "是否只看我的,true、false"
  950. // @Param ChartClassifyId query bool true "图片分类id"
  951. // @Success 200 {object} data_manage.ChartClassifyListResp
  952. // @router /chart_classify/chart/listV2 [get]
  953. func (this *ChartClassifyController) ChartClassifyChartListV3() {
  954. br := new(models.BaseResponse).Init()
  955. defer func() {
  956. this.Data["json"] = br
  957. this.ServeJSON()
  958. }()
  959. sysUser := this.SysUser
  960. if sysUser == nil {
  961. br.Msg = "请登录"
  962. br.ErrMsg = "请登录,SysUser Is Empty"
  963. br.Ret = 408
  964. return
  965. }
  966. resp := new(data_manage.ChartClassifyListResp)
  967. chartClassifyId, _ := this.GetInt("ChartClassifyId")
  968. if chartClassifyId < 0 {
  969. br.Msg = "参数错误"
  970. return
  971. }
  972. // 获取当前账号的不可见指标
  973. noPermissionChartIdMap := make(map[int]bool)
  974. {
  975. obj := data_manage.EdbInfoNoPermissionAdmin{}
  976. confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
  977. if err != nil && err.Error() != utils.ErrNoRow() {
  978. br.Msg = "获取失败"
  979. br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
  980. return
  981. }
  982. for _, v := range confList {
  983. noPermissionChartIdMap[v.ChartInfoId] = true
  984. }
  985. }
  986. isShowMe, _ := this.GetBool("IsShowMe")
  987. if isShowMe {
  988. allChartInfo, err := data_manage.GetChartClassifyAndInfoByParentIdForMe(chartClassifyId, sysUser.AdminId)
  989. if err != nil && err.Error() != utils.ErrNoRow() {
  990. br.Msg = "获取失败"
  991. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  992. return
  993. }
  994. // 移除没有权限的图表
  995. allNodes := data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
  996. resp.AllNodes = allNodes
  997. br.Ret = 200
  998. br.Success = true
  999. br.Msg = "获取成功"
  1000. br.Data = resp
  1001. fmt.Println("source my classify")
  1002. return
  1003. }
  1004. allChartInfo, err := data_manage.GetChartClassifyAndInfoByParentId(chartClassifyId)
  1005. if err != nil && err.Error() != utils.ErrNoRow() {
  1006. br.Msg = "获取失败"
  1007. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1008. return
  1009. }
  1010. //allChartInfo, err := data_manage.GetChartInfoAllByClassifyId(utils.CHART_SOURCE_DEFAULT, chartClassifyId)
  1011. //if err != nil && err.Error() != utils.ErrNoRow() {
  1012. // br.Msg = "获取失败"
  1013. // br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
  1014. // return
  1015. //}
  1016. // 移除没有权限的图表
  1017. allNodes := data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
  1018. for k, item := range allNodes {
  1019. item.Button = data.GetChartOpButton(this.SysUser, item.SysUserId, item.HaveOperaAuth)
  1020. if item.ChartInfoId > 0 {
  1021. item.Button.AddButton = false
  1022. item.Button.OpButton = false
  1023. item.Button.DeleteButton = false
  1024. item.Button.MoveButton = true
  1025. } else if item.Level == 6 {
  1026. item.Button.AddButton = false
  1027. }
  1028. allNodes[k] = item
  1029. }
  1030. resp.AllNodes = allNodes
  1031. br.Ret = 200
  1032. br.Success = true
  1033. br.Msg = "获取成功"
  1034. br.Data = resp
  1035. }