|
|
@@ -25,15 +25,24 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Traffic
|
|
25
|
25
|
{
|
|
26
|
26
|
_sys_areaRepository = sys_areaRepository;
|
|
27
|
27
|
}
|
|
28
|
|
-
|
|
|
28
|
+
|
|
29
|
29
|
/// <summary>
|
|
30
|
30
|
/// 返回树形下拉框 菜单数据
|
|
31
|
31
|
/// </summary>
|
|
32
|
32
|
/// <returns></returns>
|
|
33
|
33
|
[HttpGet("getall")]
|
|
34
|
|
- public async Task<IActionResult> GetALL()
|
|
|
34
|
+ public async Task<IActionResult> GetALL(string code, int level = 0)
|
|
35
|
35
|
{
|
|
36
|
|
- var list_ModuleInfo = await _sys_areaRepository.GetListALL(x => x.F_State == (int)EnumDelState.Enabled, o => o.F_Sort, SqlSugar.OrderByType.Asc);
|
|
|
36
|
+ #region 筛选
|
|
|
37
|
+ List<IConditionalModel> conModels = new List<IConditionalModel>();
|
|
|
38
|
+ conModels.Add(new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = ((int)EnumDelState.Enabled).ToString() });
|
|
|
39
|
+
|
|
|
40
|
+ if (level > 0)
|
|
|
41
|
+ conModels.Add(new ConditionalModel() { FieldName = "F_Level", ConditionalType = ConditionalType.LessThanOrEqual, FieldValue = level.ToString() });
|
|
|
42
|
+ if (!string.IsNullOrWhiteSpace(code))
|
|
|
43
|
+ conModels.Add(new ConditionalModel() { FieldName = "F_Code", ConditionalType = ConditionalType.LikeLeft, FieldValue = code });
|
|
|
44
|
+ #endregion
|
|
|
45
|
+ var list_ModuleInfo = await _sys_areaRepository.GetListALL(conModels, "F_Code asc");
|
|
37
|
46
|
var treeList = new List<TreeModel>();
|
|
38
|
47
|
foreach (var item in list_ModuleInfo)
|
|
39
|
48
|
{
|
|
|
@@ -44,7 +53,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Traffic
|
|
44
|
53
|
treeModel.parentid = item.F_ParentId.Value;
|
|
45
|
54
|
treeList.Add(treeModel);
|
|
46
|
55
|
}
|
|
47
|
|
- return Success("获取地区树成功", treeList.TreeRecursion(0));
|
|
|
56
|
+ return Success("获取地区树成功", treeList.TreeRecursion(1));
|
|
48
|
57
|
}
|
|
49
|
58
|
|
|
50
|
59
|
/// <summary>
|
|
|
@@ -53,14 +62,23 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Traffic
|
|
53
|
62
|
/// <param name="keyword"></param>
|
|
54
|
63
|
/// <returns></returns>
|
|
55
|
64
|
[HttpGet("gettreegridjson")]
|
|
56
|
|
- public async Task<ActionResult> GetTreeGridJson(string keyword)
|
|
|
65
|
+ public async Task<ActionResult> GetTreeGridJson(string keyword, int level = 0)
|
|
57
|
66
|
{
|
|
58
|
|
- var list_ModuleInfo = await _sys_areaRepository.GetListALL(x => x.F_State < (int)EnumDelState.Delete);
|
|
|
67
|
+ #region 筛选
|
|
|
68
|
+ List<IConditionalModel> conModels = new List<IConditionalModel>();
|
|
|
69
|
+ conModels.Add(new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = ((int)EnumDelState.Enabled).ToString() });
|
|
|
70
|
+
|
|
|
71
|
+ if (level > 0)
|
|
|
72
|
+ conModels.Add(new ConditionalModel() { FieldName = "F_Level", ConditionalType = ConditionalType.LessThanOrEqual, FieldValue = level.ToString() });
|
|
|
73
|
+ #endregion
|
|
|
74
|
+
|
|
|
75
|
+ var list_ModuleInfo = await _sys_areaRepository.GetListALL(conModels, "F_Code asc");
|
|
|
76
|
+
|
|
59
|
77
|
if (!string.IsNullOrEmpty(keyword))
|
|
60
|
78
|
{
|
|
61
|
|
- list_ModuleInfo = list_ModuleInfo.ToList().TreeWhere(t => t.F_AreaName.Contains(keyword) || t.F_AreaCode.Contains(keyword), "F_Id", "F_ParentId").ToList();
|
|
|
79
|
+ list_ModuleInfo = list_ModuleInfo.ToList().TreeWhere(t => t.F_AreaName.Contains(keyword) || t.F_Code.StartsWith(keyword) || t.F_Code=="0", "F_Id", "F_ParentId").ToList();
|
|
62
|
80
|
}
|
|
63
|
|
- list_ModuleInfo = list_ModuleInfo.Where(x => x.F_State != (int)EnumDelState.Delete).OrderBy(x => x.F_Sort).ThenByDescending(x => x.F_LastModifyOn).ToList();//排序
|
|
|
81
|
+ list_ModuleInfo = list_ModuleInfo.OrderBy(x => x.F_Sort).ThenByDescending(x => x.F_LastModifyOn).ToList();//排序
|
|
64
|
82
|
|
|
65
|
83
|
var treeList = new List<TreeGridModel>();
|
|
66
|
84
|
foreach (var item in list_ModuleInfo)
|
|
|
@@ -140,8 +158,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Traffic
|
|
140
|
158
|
#endregion
|
|
141
|
159
|
T_Sys_Area clmodel = new T_Sys_Area();
|
|
142
|
160
|
clmodel.F_AreaName = input.areaname;
|
|
143
|
|
- clmodel.F_AreaCode = input.areacode;
|
|
|
161
|
+ clmodel.F_Code = input.code;
|
|
|
162
|
+ clmodel.F_ParentCode = input.parentcode;
|
|
144
|
163
|
clmodel.F_ParentId = input.parentid;
|
|
|
164
|
+ clmodel.F_Level = input.level;
|
|
145
|
165
|
clmodel.F_Sort = input.sort;
|
|
146
|
166
|
clmodel.F_Remark = input.remark;
|
|
147
|
167
|
|
|
|
@@ -177,8 +197,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Traffic
|
|
177
|
197
|
if (clmodel == null)
|
|
178
|
198
|
return Error("信息获取失败");
|
|
179
|
199
|
clmodel.F_AreaName = input.areaname;
|
|
180
|
|
- clmodel.F_AreaCode = input.areacode;
|
|
|
200
|
+ clmodel.F_Code = input.code;
|
|
|
201
|
+ clmodel.F_ParentCode = input.parentcode;
|
|
181
|
202
|
clmodel.F_ParentId = input.parentid;
|
|
|
203
|
+ clmodel.F_Level = input.level;
|
|
182
|
204
|
clmodel.F_Sort = input.sort;
|
|
183
|
205
|
clmodel.F_Remark = input.remark;
|
|
184
|
206
|
|
|
|
@@ -226,7 +248,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Traffic
|
|
226
|
248
|
}
|
|
227
|
249
|
|
|
228
|
250
|
/// <summary>
|
|
229
|
|
- /// 导入号码段
|
|
|
251
|
+ /// 导入地区
|
|
230
|
252
|
/// </summary>
|
|
231
|
253
|
/// <param name="input"></param>
|
|
232
|
254
|
/// <returns></returns>
|
|
|
@@ -244,14 +266,14 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Traffic
|
|
244
|
266
|
if (dtExcel.Rows.Count <= 0)
|
|
245
|
267
|
return Error("请选择要导入的文件");
|
|
246
|
268
|
|
|
247
|
|
- IList<AreaInput> IMobileDatas = ModelConvertHelper<AreaInput>.ConvertToModel(dtExcel);
|
|
248
|
|
- List<AreaInput> MobileDatas = ModelConvertHelper<AreaInput>.ConvertIListToList(IMobileDatas);
|
|
249
|
|
- int num = MobileDatas.Count;
|
|
|
269
|
+ IList<AreaInput> IDatas = ModelConvertHelper<AreaInput>.ConvertToModel(dtExcel);
|
|
|
270
|
+ List<AreaInput> Datas = ModelConvertHelper<AreaInput>.ConvertIListToList(IDatas);
|
|
|
271
|
+ int num = Datas.Count;
|
|
250
|
272
|
List<AreaInput> inputlist = new List<AreaInput>();
|
|
251
|
273
|
|
|
252
|
|
- foreach (AreaInput input in MobileDatas)
|
|
|
274
|
+ foreach (AreaInput input in Datas)
|
|
253
|
275
|
{
|
|
254
|
|
- Expression<Func<T_Sys_Area, bool>> eq = a => a.F_AreaCode == input.areacode;
|
|
|
276
|
+ Expression<Func<T_Sys_Area, bool>> eq = a => a.F_Code == input.code;
|
|
255
|
277
|
eq = eq.And(b => b.F_AreaName == input.areaname);
|
|
256
|
278
|
if (await _sys_areaRepository.GetCount(eq) > 0)
|
|
257
|
279
|
{
|
|
|
@@ -351,9 +373,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Traffic
|
|
351
|
373
|
foreach (var input in inputs)
|
|
352
|
374
|
{
|
|
353
|
375
|
T_Sys_Area clmodel = new T_Sys_Area();
|
|
354
|
|
- clmodel.F_AreaName = input.areaname.Trim();
|
|
355
|
|
- clmodel.F_AreaCode = input.areacode.Trim();
|
|
|
376
|
+ clmodel.F_AreaName = input.areaname;
|
|
|
377
|
+ clmodel.F_Code = input.code;
|
|
|
378
|
+ clmodel.F_ParentCode = input.parentcode;
|
|
356
|
379
|
clmodel.F_ParentId = input.parentid;
|
|
|
380
|
+ clmodel.F_Level = input.level;
|
|
357
|
381
|
clmodel.F_Sort = input.sort;
|
|
358
|
382
|
clmodel.F_Remark = input.remark;
|
|
359
|
383
|
|