|
@@ -9,7 +9,10 @@ import (
|
|
|
"eta/eta_api/services/data"
|
|
|
"eta/eta_api/services/data/data_manage_permission"
|
|
|
"eta/eta_api/utils"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"sort"
|
|
|
+ "strconv"
|
|
|
+ "strings"
|
|
|
)
|
|
|
|
|
|
// EdbClassifyController 数据管理-分类模块
|
|
@@ -288,7 +291,7 @@ func (this *EdbClassifyController) EditEdbClassify() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- err, errMsg := data.EditEdbClassify(req.ClassifyId, req.ClassifyName, this.Lang, this.SysUser)
|
|
|
+ err, errMsg := data.EditEdbClassify(req.ClassifyId, req.ParentId, req.ClassifyName, this.Lang, this.SysUser)
|
|
|
if errMsg != `` {
|
|
|
br.Msg = errMsg
|
|
|
br.ErrMsg = errMsg
|
|
@@ -1109,7 +1112,7 @@ func (this *EdbClassifyController) ClassifyTree() {
|
|
|
this.Data["json"] = br
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
-
|
|
|
+ level, _ := this.GetInt(`Level`)
|
|
|
allList, err := data_manage.GetNormalEdbClassifyAll()
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取失败"
|
|
@@ -1135,7 +1138,7 @@ func (this *EdbClassifyController) ClassifyTree() {
|
|
|
button := data.GetEdbClassifyOpButton(this.SysUser, v.SysUserId, v.HaveOperaAuth)
|
|
|
allList[k].Button = button
|
|
|
}
|
|
|
- nodeAll = data.GetClassifyTreeRecursive(allList, 0)
|
|
|
+ nodeAll = data.GetClassifyTreeRecursive(allList, 0, level)
|
|
|
//根据sort值排序
|
|
|
sortList = nodeAll
|
|
|
sort.Sort(sortList)
|
|
@@ -1221,3 +1224,106 @@ func (this *EdbClassifyController) ClassifyTree() {
|
|
|
// br.Success = true
|
|
|
// br.Msg = "移动成功"
|
|
|
//}
|
|
|
+
|
|
|
+// EdbInfoList
|
|
|
+// @Title 批量编辑指标列表接口
|
|
|
+// @Description 批量编辑指标列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param EdbInfoId query int true "指标id"
|
|
|
+// @Param KeyWord query string false "搜索关键词:指标ID/指标名称"
|
|
|
+// @Success 200 {object} data_manage.EdbInfoListResp
|
|
|
+// @router /classify/edb/list [get]
|
|
|
+func (this *EdbInfoController) ClassifyEdbInfoList() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
+ subClassify, _ := this.GetBool("SubClassify")
|
|
|
+ classifyIdsStr := this.GetString("ClassifyIds")
|
|
|
+ classifyIds := strings.Split(classifyIdsStr, ",")
|
|
|
+
|
|
|
+
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ // 已授权分类id
|
|
|
+ permissionClassifyIdList, err := data_manage_permission.GetUserEdbClassifyPermissionList(this.SysUser.AdminId, 0)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取已授权分类id数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ classifyIdsArr := make([]int, 0)
|
|
|
+ for _, v := range classifyIds {
|
|
|
+ if v != `` {
|
|
|
+ id, _ := strconv.Atoi(v)
|
|
|
+ classifyIdsArr = append(classifyIdsArr, id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ classifyIdsArr = utils.IntersectInt(permissionClassifyIdList, classifyIdsArr)
|
|
|
+
|
|
|
+ condition += " AND edb_info_type = 0 "
|
|
|
+ if len(classifyIdsArr) > 0 {
|
|
|
+ if !subClassify {
|
|
|
+ condition += " AND chart_classify_id IN(" + utils.GetOrmInReplace(len(classifyIdsArr)) + ") "
|
|
|
+ pars = append(pars, classifyIdsArr)
|
|
|
+ } else {
|
|
|
+ classifyAll, err := data_manage.GetEdbClassifyAll()
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ finalClassifyIds := make([]int, 0)
|
|
|
+ parents := data.GetEdbClassifyChildrenRecursiveByParentIds(classifyAll, classifyIds)
|
|
|
+ sort.Slice(parents, func(i, j int) bool {
|
|
|
+ return parents[i].Level < parents[i].Level
|
|
|
+ })
|
|
|
+ for _, v := range parents {
|
|
|
+ finalClassifyIds = append(finalClassifyIds, v.ClassifyId)
|
|
|
+ }
|
|
|
+
|
|
|
+ condition += " AND classify_id IN(" + utils.GetOrmInReplace(len(finalClassifyIds)) + ") "
|
|
|
+ pars = append(pars, finalClassifyIds)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ count, err := data_manage.GetEdbInfoByConditionCount(condition, pars)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, count)
|
|
|
+
|
|
|
+ list, err := data_manage.GetEdbInfoListByCondition(condition, pars, startSize, pageSize, "")
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ resp := new(data_manage.EdbInfoFilterDataResp)
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|