|
|
@@ -297,6 +297,10 @@ func (this *UserController) AddUser() {
|
|
|
unitId := svcorg.GetMyUnitDepartmentId(model.DepartmentId)
|
|
|
var org organize.Base_Organize
|
|
|
svcorg.GetEntityById(unitId, &org)
|
|
|
+ thrunitId := svcorg.GetMyThrUnitDepartmentId(model.DepartmentId)
|
|
|
+ var throrg organize.Base_Organize
|
|
|
+ svcorg.GetEntityById(thrunitId,&throrg)
|
|
|
+
|
|
|
|
|
|
var userentity userRole.Base_User
|
|
|
userentity.Companyid = "0"
|
|
|
@@ -304,6 +308,20 @@ func (this *UserController) AddUser() {
|
|
|
userentity.Roleid, _ = utils.StrTo(model.Role).Int()
|
|
|
userentity.UnitId = org.Id
|
|
|
userentity.Unit = org.Fullname
|
|
|
+
|
|
|
+ if model.DepartmentId == thrunitId {
|
|
|
+ if throrg.Category == "ThrUnit" {
|
|
|
+ userentity.UnitThirdId = throrg.Id
|
|
|
+ userentity.UnitThird = throrg.Fullname
|
|
|
+ }else {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ userentity.UnitThirdId = throrg.Id
|
|
|
+ userentity.UnitThird = throrg.Fullname
|
|
|
+ }
|
|
|
+
|
|
|
if userentity.Roleid == 0 {
|
|
|
//userentity.Roleid = 10000123 //普通用户
|
|
|
}
|
|
|
@@ -396,6 +414,32 @@ func (this *UserController) EditUser() {
|
|
|
//获取组织名称
|
|
|
svcorg := organize.GetOrganizeService(utils.DBE)
|
|
|
model.DepartmentName = svcorg.GetNameById(model.DepartmentId)
|
|
|
+
|
|
|
+ unitId := svcorg.GetMyUnitDepartmentId(model.DepartmentId)
|
|
|
+ var org organize.Base_Organize
|
|
|
+ svcorg.GetEntityById(unitId, &org)
|
|
|
+ thrunitId := svcorg.GetMyThrUnitDepartmentId(model.DepartmentId)
|
|
|
+ var throrg organize.Base_Organize
|
|
|
+ svcorg.GetEntityById(thrunitId,&throrg)
|
|
|
+
|
|
|
+ userentity.UnitId = org.Id
|
|
|
+ userentity.Unit = org.Fullname
|
|
|
+
|
|
|
+ if model.DepartmentId == thrunitId {
|
|
|
+ if throrg.Category == "ThrUnit" {
|
|
|
+ userentity.UnitThirdId = throrg.Id
|
|
|
+ userentity.UnitThird = throrg.Fullname
|
|
|
+ }else {
|
|
|
+ userentity.UnitThirdId = 0
|
|
|
+ userentity.UnitThird = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ userentity.UnitThirdId = throrg.Id
|
|
|
+ userentity.UnitThird = throrg.Fullname
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//获取组织上级组织
|
|
|
//var orginizeentity organize.Base_Organize
|
|
|
//svcorg.GetEntityById(model.DepartmentId, &orginizeentity)
|
|
|
@@ -415,7 +459,7 @@ func (this *UserController) EditUser() {
|
|
|
userentity.Departmentid = model.DepartmentId
|
|
|
userentity.Departmentname = model.DepartmentName
|
|
|
|
|
|
- var cols []string = []string{"Realname", "CompanyId", "DepartmentId", "DepartmentName", "Telephone", "Mobile", "Description", "Photo", "Modifieduserid", "Modifiedby", "Superior"}
|
|
|
+ var cols []string = []string{"Realname", "CompanyId", "DepartmentId", "DepartmentName", "Telephone", "Mobile", "Description", "Photo", "Modifieduserid", "Modifiedby", "Superior", "UnitId","Unit","UnitThirdId","UnitThird"}
|
|
|
|
|
|
err := svc.UpdateEntityAndBackupByCols(id, &userentity, &userentityempty, cols, utils.ToStr(this.User.Id), this.User.Realname)
|
|
|
|