wkyuer 3 сар өмнө
parent
commit
1f1e59645a

+ 10 - 1
internal/controller/commonHandler.go

@@ -5,15 +5,24 @@ import (
 	"fmt"
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/net/ghttp"
+	"github.com/gogf/gf/v2/os/gctx"
+	"github.com/gogf/gf/v2/util/gconv"
 	"github.com/pkg/errors"
 	"jyOrderManager/internal/jyutil"
 )
 
 func GetSelectItemHandler(r *ghttp.Request) {
 	rData, err := func() (interface{}, error) {
+		displayMap := make(map[string]interface{})
+		for deptId, channelCode := range g.Cfg().MustGet(gctx.New(), "deptDefaultChannel").Map() {
+			displayMap[deptId] = channelCode
+			for _, node := range jyutil.JyDepartmentManager.GetDeptAllChildNode(gconv.Int(deptId)) {
+				displayMap[gconv.String(node.Id)] = channelCode
+			}
+		}
 		return g.Map{
 			"deptTree":           jyutil.JyDepartmentManager.GetShowDeptTree(g.Cfg("global").MustGet(r.Context(), "saleDeptShowArr").Strings()...), //可选择销售部门tree
-			"defaultSaleChannel": g.Cfg("global").MustGet(r.Context(), "deptDefaultChannel").Map(),                                                 //默认销售渠道
+			"defaultSaleChannel": displayMap,                                                                                                       //默认销售渠道
 			"channel":            jyutil.GetChannel(r.Context()),                                                                                   //销售渠道
 		}, nil
 	}()