v3.4.6
This commit is contained in:
@@ -77,12 +77,12 @@ public class ControlParsing : ITransient
|
||||
// 子表
|
||||
if (item.Value != null && item.Key.ToLower().Contains("tablefield") && (item.Value is List<Dictionary<string, object>> || item.Value.GetType().Name.Equals("JArray")))
|
||||
{
|
||||
var ctOldDatas = item.Value.ToObject<List<Dictionary<string, object>>>();
|
||||
var ctOldDatas = item.Value.ToObject<List<Dictionary<string, object>>>(CommonConst.options);
|
||||
ctOldDatas.ForEach(ctItems =>
|
||||
{
|
||||
foreach (var ctItem in ctItems)
|
||||
{
|
||||
if (vModelList.Contains(item.Key + "-" + ctItem.Key) && !vModels.ContainsKey(item.Key + "-" + ctItem.Key))
|
||||
if ((vModelList.Contains(item.Key + "-" + ctItem.Key) || vModelList.Contains(item.Key + "-" + ctItem.Key + "_name")) && !vModels.ContainsKey(item.Key + "-" + ctItem.Key))
|
||||
vModels.Add(item.Key + "-" + ctItem.Key, jnpfKeyConst);
|
||||
}
|
||||
});
|
||||
@@ -108,13 +108,13 @@ public class ControlParsing : ITransient
|
||||
|
||||
foreach (var items in oldDatas)
|
||||
{
|
||||
for(var i = 0; i < items.Count; i++)
|
||||
for (var i = 0; i < items.Count; i++)
|
||||
{
|
||||
var item = items.ToList()[i];
|
||||
|
||||
if (vModels.Any(x => x.Key.Equals(item.Key)) && items[item.Key] != null)
|
||||
{
|
||||
FieldsModel model = fields.Any(x=>x.__vModel__.Equals(item.Key)) ? fields.Find(x=> x.__vModel__.Equals(item.Key)) : (fields.Any(x => x.__vModel__.Equals(item.Key.Replace("_name", string.Empty))) ? fields.Find(x => x.__vModel__.Equals(item.Key.Replace("_name", string.Empty))) : new FieldsModel());
|
||||
FieldsModel model = fields.Any(x => x.__vModel__.Equals(item.Key)) ? fields.Find(x => x.__vModel__.Equals(item.Key)) : (fields.Any(x => x.__vModel__.Equals(item.Key.Replace("_name", string.Empty))) ? fields.Find(x => x.__vModel__.Equals(item.Key.Replace("_name", string.Empty))) : new FieldsModel());
|
||||
model.separator = ",";
|
||||
var jnpfKey = vModels.FirstOrDefault(x => x.Key.Equals(item.Key)).Value;
|
||||
switch (jnpfKey)
|
||||
@@ -194,7 +194,7 @@ public class ControlParsing : ITransient
|
||||
if (specificData != null)
|
||||
{
|
||||
// 要用模板的 “显示字段 - relationField”来展示数据
|
||||
items[item.Key + "_id"] = items[item.Key];
|
||||
items[model.__vModel__ + "_id"] = items[item.Key];
|
||||
items[item.Key] = specificData[model.relationField];
|
||||
|
||||
// 弹窗选择属性
|
||||
@@ -208,7 +208,7 @@ public class ControlParsing : ITransient
|
||||
var vara = popupselectDataList.Where(a => a.ContainsValue(items[item.Key] == null ? model.interfaceId : items[item.Key].ToString())).FirstOrDefault();
|
||||
if (vara != null)
|
||||
{
|
||||
items[item.Key + "_id"] = items[item.Key];
|
||||
items[model.__vModel__ + "_id"] = items[item.Key];
|
||||
items[item.Key] = vara[items[item.Key].ToString()];
|
||||
|
||||
// 弹窗选择属性
|
||||
@@ -222,7 +222,7 @@ public class ControlParsing : ITransient
|
||||
var vara = popupselectDataList.Where(a => a.ContainsValue(items[item.Key] == null ? model.interfaceId : items[item.Key].ToString())).FirstOrDefault();
|
||||
if (vara != null)
|
||||
{
|
||||
items[item.Key + "_id"] = items[item.Key];
|
||||
items[model.__vModel__ + "_id"] = items[item.Key];
|
||||
items[item.Key] = vara[items[item.Key].ToString()];
|
||||
|
||||
// 弹窗选择属性
|
||||
@@ -257,11 +257,11 @@ public class ControlParsing : ITransient
|
||||
pageSize = 999999
|
||||
};
|
||||
|
||||
Scoped.Create(async (_, scope) =>
|
||||
Scoped.Create((_, scope) =>
|
||||
{
|
||||
var services = scope.ServiceProvider;
|
||||
var _runService = App.GetService<IRunService>(services);
|
||||
var res = await _runService.GetRelationFormList(relationFormModel, listQueryInput);
|
||||
var res = _runService.GetRelationFormList(relationFormModel, listQueryInput).WaitAsync(TimeSpan.FromMinutes(2)).Result;
|
||||
_cacheManager.Set(redisName, res.list.ToList(), TimeSpan.FromMinutes(10)); // 缓存10分钟
|
||||
});
|
||||
var cacheStr = _cacheManager.Get(redisName);
|
||||
@@ -271,7 +271,7 @@ public class ControlParsing : ITransient
|
||||
var relationFormRealData = relationFormDataList.Where(it => it["id"].Equals(items[item.Key])).FirstOrDefault();
|
||||
if (relationFormRealData != null && relationFormRealData.Count > 0)
|
||||
{
|
||||
items[item.Key + "_id"] = relationFormRealData["id"];
|
||||
items[model.__vModel__ + "_id"] = relationFormRealData["id"];
|
||||
items[item.Key] = relationFormRealData.ContainsKey(model.relationField) ? relationFormRealData[model.relationField] : string.Empty;
|
||||
|
||||
// 关联表单属性
|
||||
@@ -291,7 +291,7 @@ public class ControlParsing : ITransient
|
||||
// 子表
|
||||
if (item.Value != null && item.Key.ToLower().Contains("tablefield") && (item.Value is List<Dictionary<string, object>> || item.Value.GetType().Name.Equals("JArray")))
|
||||
{
|
||||
var ctList = item.Value.ToObject<List<Dictionary<string, object>>>();
|
||||
var ctList = item.Value.ToObject<List<Dictionary<string, object>>>(CommonConst.options);
|
||||
var ctVModels = new Dictionary<string, object>();
|
||||
foreach (var ctItem in vModels.Where(x => x.Key.Contains(item.Key)).ToList())
|
||||
{
|
||||
@@ -349,71 +349,112 @@ public class ControlParsing : ITransient
|
||||
/// 获取用户组件查询条件组装.
|
||||
/// </summary>
|
||||
/// <param name="key">字段名.</param>
|
||||
/// <param name="value">查询值.</param>
|
||||
/// <param name="multiple">是否多选.</param>
|
||||
/// <param name="values">查询值.</param>
|
||||
/// <returns></returns>
|
||||
public List<IConditionalModel> GetUsersSelectQueryWhere(string key, string value, bool multiple)
|
||||
public List<IConditionalModel> GetUsersSelectQueryWhere(string key, string values)
|
||||
{
|
||||
if (values.IsNotEmptyOrNull()) return GetUsersSelectQueryWhere(key, new List<string>() { values });
|
||||
else return new List<IConditionalModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户组件查询条件组装.
|
||||
/// </summary>
|
||||
/// <param name="key">字段名.</param>
|
||||
/// <param name="values">查询值.</param>
|
||||
/// <returns></returns>
|
||||
public List<IConditionalModel> GetUsersSelectQueryWhere(string key, string values, bool isMultiple = false)
|
||||
{
|
||||
return GetUsersSelectQueryWhere(key, values);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户组件查询条件组装.
|
||||
/// </summary>
|
||||
/// <param name="key">字段名.</param>
|
||||
/// <param name="values">查询值.</param>
|
||||
/// <returns></returns>
|
||||
public List<IConditionalModel> GetUsersSelectQueryWhere(string key, List<string> values)
|
||||
{
|
||||
var conModels = new List<IConditionalModel>();
|
||||
if (value.IsNullOrEmpty()) return conModels;
|
||||
if (multiple)
|
||||
if (values.IsNullOrEmpty() || !values.Any()) return conModels;
|
||||
var userIds = values.Select(x => x.Replace("--user", string.Empty)).ToList();
|
||||
var rIdList = _repository.AsSugarClient().Queryable<UserRelationEntity>().Where(x => userIds.Contains(x.UserId)).Select(x => new { x.ObjectId, x.ObjectType }).ToList();
|
||||
var objIdList = values;
|
||||
rIdList.ForEach(x =>
|
||||
{
|
||||
var rIdList = _repository.AsSugarClient().Queryable<UserRelationEntity>().Where(x => x.UserId.Equals(value.Replace("--user", string.Empty))).Select(x => new { x.ObjectId, x.ObjectType }).ToList();
|
||||
var objIdList = new List<string>() { value };
|
||||
rIdList.ForEach(x =>
|
||||
if (x.ObjectType.Equals("Organize"))
|
||||
{
|
||||
if (x.ObjectType.Equals("Organize"))
|
||||
{
|
||||
objIdList.Add(x.ObjectId + "--company");
|
||||
objIdList.Add(x.ObjectId + "--department");
|
||||
}
|
||||
else
|
||||
{
|
||||
objIdList.Add(x.ObjectId + "--" + x.ObjectType.ToLower());
|
||||
}
|
||||
});
|
||||
|
||||
var whereList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
||||
for (var i = 0; i < objIdList.Count(); i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
whereList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Like,
|
||||
FieldValue = objIdList[i]
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
whereList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Like,
|
||||
FieldValue = objIdList[i]
|
||||
}));
|
||||
}
|
||||
objIdList.Add(x.ObjectId + "--company");
|
||||
objIdList.Add(x.ObjectId + "--department");
|
||||
}
|
||||
|
||||
conModels.Add(new ConditionalCollections() { ConditionalList = whereList });
|
||||
}
|
||||
else
|
||||
{
|
||||
conModels.Add(new ConditionalCollections()
|
||||
else
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||
objIdList.Add(x.ObjectId + "--" + x.ObjectType.ToLower());
|
||||
}
|
||||
});
|
||||
|
||||
var whereList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
||||
for (var i = 0; i < objIdList.Count(); i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
whereList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Equal,
|
||||
FieldValue = value
|
||||
})
|
||||
}
|
||||
});
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Like,
|
||||
FieldValue = objIdList[i]
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
whereList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Like,
|
||||
FieldValue = objIdList[i]
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
whereList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.IsNot,
|
||||
FieldValue = null
|
||||
}));
|
||||
whereList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.IsNot,
|
||||
FieldValue = string.Empty
|
||||
}));
|
||||
conModels.Add(new ConditionalCollections() { ConditionalList = whereList });
|
||||
return conModels;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成查询多选条件.
|
||||
/// </summary>
|
||||
/// <param name="key">数据库列名称.</param>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
public List<IConditionalModel> GenerateMultipleSelectionCriteriaForQuerying(string key, List<string>? list)
|
||||
{
|
||||
var conModels = new List<IConditionalModel>();
|
||||
var addItems = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
||||
for (int i = 0; i < list?.Count; i++)
|
||||
{
|
||||
var add = new KeyValuePair<WhereType, ConditionalModel>(i == 0 ? WhereType.And : WhereType.Or, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Like,
|
||||
FieldValue = list[i]
|
||||
});
|
||||
addItems.Add(add);
|
||||
}
|
||||
if (addItems?.Count > 0)
|
||||
conModels.Add(new ConditionalCollections() { ConditionalList = addItems });
|
||||
return conModels;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user